Commit 1c225209 authored by dahai's avatar dahai

修改查询EXCEL格口信息

parent 98533f7a
...@@ -26,6 +26,7 @@ import javax.ws.rs.Produces; ...@@ -26,6 +26,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -50,6 +51,7 @@ public class ReadExcelApi { ...@@ -50,6 +51,7 @@ public class ReadExcelApi {
public boolean ReadPersonPost(@RequestParam("formStartTime") String startDate,@RequestParam("formDeadLine") String endDate, HttpServletResponse resp, HttpServletRequest requ) { public boolean ReadPersonPost(@RequestParam("formStartTime") String startDate,@RequestParam("formDeadLine") String endDate, HttpServletResponse resp, HttpServletRequest requ) {
YXJSONResponse yxresp = new YXJSONResponse(); YXJSONResponse yxresp = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
String filename = ""; String filename = "";
DiskFileItemFactory factory = new DiskFileItemFactory(); DiskFileItemFactory factory = new DiskFileItemFactory();
...@@ -83,8 +85,7 @@ public class ReadExcelApi { ...@@ -83,8 +85,7 @@ public class ReadExcelApi {
// 如果fileitem中封装的是普通输入项的数据 // 如果fileitem中封装的是普通输入项的数据
// 如果fileitem中封装的是上传文件 // 如果fileitem中封装的是上传文件
// 得到上传的文件名称 // 得到上传的文件名称
filename = item.getName(); filename = item.getOriginalFilename();
System.out.println(item.getName()); // 为上传的key值 System.out.println(item.getName()); // 为上传的key值
System.out.println(item.getOriginalFilename()); // 上传的真实文件的文件名 System.out.println(item.getOriginalFilename()); // 上传的真实文件的文件名
File file = null; File file = null;
...@@ -99,7 +100,7 @@ public class ReadExcelApi { ...@@ -99,7 +100,7 @@ public class ReadExcelApi {
//保存EXCEL文件信息 //保存EXCEL文件信息
FileNameDicEntity fileNameDicEntity = new FileNameDicEntity(); FileNameDicEntity fileNameDicEntity = new FileNameDicEntity();
fileNameDicEntity.setFileName(filename); fileNameDicEntity.setFileName(filename);
fileNameDicEntity.setUploadDate(new Date()); fileNameDicEntity.setUploadDate(simpleDateFormat.format(new Date()));
fileNameDicEntity.setFormStartTime(replaceDate(startDate)); fileNameDicEntity.setFormStartTime(replaceDate(startDate));
fileNameDicEntity.setFormDeadline(replaceDate(endDate)); fileNameDicEntity.setFormDeadline(replaceDate(endDate));
long l = fileNameDicService.saveFileNameDic(fileNameDicEntity); long l = fileNameDicService.saveFileNameDic(fileNameDicEntity);
...@@ -127,15 +128,17 @@ public class ReadExcelApi { ...@@ -127,15 +128,17 @@ public class ReadExcelApi {
personPostEntity.setRecipientName((String) list2.get(12)); personPostEntity.setRecipientName((String) list2.get(12));
personPostEntity.setRecipientPhone((String) list2.get(13)); personPostEntity.setRecipientPhone((String) list2.get(13));
personPostEntity.setRecipientAddress((String) list2.get(14)); personPostEntity.setRecipientAddress((String) list2.get(14));
personPostEntity.setOrderBlankNumber((String) list2.get(15)); personPostEntity.setOrderBlankNumber("");
personPostEntity.setGetToProvince((String) list2.get(16)); personPostEntity.setGetToProvince((String) list2.get(15));
personPostEntity.setGetToCity((String) list2.get(17)); personPostEntity.setGetToCity((String) list2.get(16));
personPostEntity.setGetToCounty((String) list2.get(18)); personPostEntity.setGetToCounty((String) list2.get(17));
personPostEntity.setBusinessType((String) list2.get(19)); personPostEntity.setBusinessType((String) list2.get(18));
personPostEntity.setLatticeMouthInformation((String) list2.get(20)); personPostEntity.setLatticeMouthInformation((String) list2.get(19));
personPostEntity.setNatureOfTheInternal((String) list2.get(21)); personPostEntity.setNatureOfTheInternal((String) list2.get(20));
personPostEntity.setNatureOfTheInformation((String) list2.get(22)); personPostEntity.setNatureOfTheInformation((String) list2.get(21));
personPostEntity.setFirstWhite((String) list2.get(23)); System.out.println(list2.get(23).toString());
System.out.println(list2.get(23).toString().length());
personPostEntity.setFirstWhite(list2.get(22).toString().substring(5,24) );
personPostEntity.setFileId(l); personPostEntity.setFileId(l);
entityList.add(personPostEntity); entityList.add(personPostEntity);
} }
...@@ -175,7 +178,7 @@ public class ReadExcelApi { ...@@ -175,7 +178,7 @@ public class ReadExcelApi {
*/ */
@RequestMapping("queryPersonPost") @RequestMapping("queryPersonPost")
public String queryPersonPost(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, @RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize, HttpServletResponse resp) { public String queryPersonPost(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, @RequestParam("currPage") String currPage,@RequestParam("pageSize") String pageSize, HttpServletResponse resp) {
List<FileNameDicEntity> fileNameDicEntities = fileNameDicService.queryFileNameDic(uploadDate,replaceNullString(fileName), Long.valueOf(analysisState), Long.valueOf(currPage), Long.valueOf(pageSize)); List<FileNameDicEntity> fileNameDicEntities = fileNameDicService.queryFileNameDic(replaceDate(uploadDate),replaceNullString(fileName), Long.valueOf(analysisState), Long.valueOf(currPage), Long.valueOf(pageSize));
YXJSONResponse yxjsonResponse = new YXJSONResponse(); YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(fileNameDicEntities); yxjsonResponse.outPutSuccess(fileNameDicEntities);
...@@ -191,7 +194,7 @@ public class ReadExcelApi { ...@@ -191,7 +194,7 @@ public class ReadExcelApi {
*/ */
@RequestMapping("queryPersonPostCount") @RequestMapping("queryPersonPostCount")
public String queryPersonPostCount(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, HttpServletResponse resp) { public String queryPersonPostCount(@RequestParam("fileName") String fileName,@RequestParam("analysisState") String analysisState,@RequestParam("uploadDate") String uploadDate, HttpServletResponse resp) {
int i = fileNameDicService.queryFileNameDicCount(uploadDate,replaceNullString(fileName), Long.valueOf(analysisState)); int i = fileNameDicService.queryFileNameDicCount(replaceDate(uploadDate),replaceNullString(fileName), Long.valueOf(analysisState));
YXJSONResponse yxjsonResponse = new YXJSONResponse(); YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8");
yxjsonResponse.outPutSuccess(i+""); yxjsonResponse.outPutSuccess(i+"");
......
...@@ -14,9 +14,9 @@ import java.util.Objects; ...@@ -14,9 +14,9 @@ import java.util.Objects;
public class FileNameDicEntity { public class FileNameDicEntity {
private long fileId; private long fileId;
private String fileName; private String fileName;
private Date uploadDate; private String uploadDate;
private Date analysisDate; private String analysisDate;
private Date printDate; private String printDate;
private String formStartTime; private String formStartTime;
private String formDeadline; private String formDeadline;
...@@ -42,31 +42,31 @@ public class FileNameDicEntity { ...@@ -42,31 +42,31 @@ public class FileNameDicEntity {
@Basic @Basic
@Column(name = "UPLOAD_DATE") @Column(name = "UPLOAD_DATE")
public Date getUploadDate() { public String getUploadDate() {
return uploadDate; return uploadDate;
} }
public void setUploadDate(Date uploadDate) { public void setUploadDate(String uploadDate) {
this.uploadDate = uploadDate; this.uploadDate = uploadDate;
} }
@Basic @Basic
@Column(name = "ANALYSIS_DATE") @Column(name = "ANALYSIS_DATE")
public Date getAnalysisDate() { public String getAnalysisDate() {
return analysisDate; return analysisDate;
} }
public void setAnalysisDate(Date analysisDate) { public void setAnalysisDate(String analysisDate) {
this.analysisDate = analysisDate; this.analysisDate = analysisDate;
} }
@Basic @Basic
@Column(name = "PRINT_DATE") @Column(name = "PRINT_DATE")
public Date getPrintDate() { public String getPrintDate() {
return printDate; return printDate;
} }
public void setPrintDate(Date printDate) { public void setPrintDate(String printDate) {
this.printDate = printDate; this.printDate = printDate;
} }
......
...@@ -19,7 +19,7 @@ public interface FileNameDicMapper { ...@@ -19,7 +19,7 @@ public interface FileNameDicMapper {
* @return * @return
*/ */
@Insert("INSERT INTO FILE_NAME_DIC (FILE_NAME,UPLOAD_DATE,FORM_START_TIME,FORM_DEADLINE) VALUES (#{fileName},#{uploadDate},#{formStartTime},#{formDeadline})") @Insert("INSERT INTO FILE_NAME_DIC (FILE_NAME,UPLOAD_DATE,FORM_START_TIME,FORM_DEADLINE) VALUES (#{fileName},#{uploadDate},#{formStartTime},#{formDeadline})")
@Options(useGeneratedKeys=true, keyProperty="fileId", keyColumn="fileId") @Options(useGeneratedKeys=true, keyProperty="fileId", keyColumn="file_Id")
public long saveFileNameDic(FileNameDicEntity fileNameDicEntity); public long saveFileNameDic(FileNameDicEntity fileNameDicEntity);
/** /**
...@@ -40,11 +40,11 @@ public interface FileNameDicMapper { ...@@ -40,11 +40,11 @@ public interface FileNameDicMapper {
@Select("<script> " + @Select("<script> " +
"select * from (select FILE_NAME_DIC.*,rownum rn from FILE_NAME_DIC " + "select * from (select FILE_NAME_DIC.*,rownum rn from FILE_NAME_DIC " +
"<where> 1=1 " + "<where> 1=1 " +
"<if test='analysisState != -1' >" + "<if test='analysisState != -1 ' >" +
" and STATE =#{analysisState}" + " and STATE =#{analysisState}" +
"</if>" + "</if>" +
"<if test='uploadDate !=null' >" + "<if test='uploadDate !=null' >" +
" and to_char(UPLOAD_DATE,'yyyyMMdd') =#{uploadDate}" + " and substr(UPLOAD_DATE,0,8) =#{uploadDate}" +
"</if>" + "</if>" +
"<if test='fileName != null ' >" + "<if test='fileName != null ' >" +
" and FILE_NAME =#{fileName}" + " and FILE_NAME =#{fileName}" +
...@@ -66,7 +66,7 @@ public interface FileNameDicMapper { ...@@ -66,7 +66,7 @@ public interface FileNameDicMapper {
" and STATE =#{analysisState}" + " and STATE =#{analysisState}" +
"</if>" + "</if>" +
"<if test='uploadDate !=null' >" + "<if test='uploadDate !=null' >" +
" and to_char(UPLOAD_DATE,'yyyyMMdd') = #{uploadDate}" + " and substr(UPLOAD_DATE,0,8) = #{uploadDate}" +
"</if>" + "</if>" +
"<if test='fileName != null ' >" + "<if test='fileName != null ' >" +
" and FILE_NAME = #{fileName}" + " and FILE_NAME = #{fileName}" +
......
...@@ -25,12 +25,18 @@ public class FileNameDicServiceImpl implements FileNameDicService { ...@@ -25,12 +25,18 @@ public class FileNameDicServiceImpl implements FileNameDicService {
@Override @Override
public List<FileNameDicEntity> queryFileNameDic(String uploadDate,String fileName, long analysisState, long currPage, long pageSize) { public List<FileNameDicEntity> queryFileNameDic(String uploadDate,String fileName, long analysisState, long currPage, long pageSize) {
fileNameDicMapper.queryFileNameDic(uploadDate, fileName, analysisState, currPage * pageSize, (currPage - 1) * pageSize + 1); // if (analysisState<0){
return fileNameDicMapper.queryFileNameDic(uploadDate,fileName, analysisState, currPage*pageSize,(currPage-1)*pageSize+1 ); // analysisState=2;
// }
// List<FileNameDicEntity> fileNameDicEntities = fileNameDicMapper.queryFileNameDic(uploadDate, fileName, -1, currPage * pageSize, (currPage - 1) * pageSize + 1);
return fileNameDicMapper.queryFileNameDic(uploadDate,fileName, -1, currPage*pageSize,(currPage-1)*pageSize+1 );
// return null; // return null;
} }
@Override @Override
public int queryFileNameDicCount(String uploadDate,String fileName, long analysisState) { public int queryFileNameDicCount(String uploadDate,String fileName, long analysisState) {
// if (analysisState<0){
// analysisState=2;
// }
return fileNameDicMapper.queryFileNameDicCount(uploadDate,fileName, analysisState ).size(); return fileNameDicMapper.queryFileNameDicCount(uploadDate,fileName, analysisState ).size();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment