Commit 1c225209 authored by dahai's avatar dahai

修改查询EXCEL格口信息

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