Commit a20f4dca authored by suichenguang's avatar suichenguang

解析数据

parents a86da907 f2a2d5f3
...@@ -91,6 +91,11 @@ ...@@ -91,6 +91,11 @@
<artifactId>javax.ws.rs-api</artifactId> <artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version> <version>2.0</version>
</dependency> </dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
</dependencies> </dependencies>
......
package com.yxproject.start.api;
import com.yxproject.start.service.PoliceStationApplyReasonService;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
*/
@RestController
@RequestMapping("api")
public class BizApi {
@Autowired
private PoliceStationApplyReasonService policeStationApplyReasonService;
/**
* 保存派出所申领表数据
* @param taskIdList
* @return
*/
@RequestMapping("savePoliceApplicationData")
public int savePoliceApplicationData(@RequestBody String taskIdList) {
JSONArray jsonArray = JSONArray.fromObject(taskIdList);
int i = policeStationApplyReasonService.getAndSavePoliceStationApplyReason(jsonArray);
return i;
}
}
package com.yxproject.start.api;
import com.yxproject.start.service.PreproPersonService;
import org.apache.commons.lang.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Date;
/**
* @auther zhangyusheng
* 2019/3/1 11:18
*/
@RestController
@RequestMapping("exportXML")
public class ExportXMLApi {
@Autowired
private PreproPersonService preproPersonService;
/**
* 导出邮寄制证数据包
*/
@RequestMapping("printPostXmlData")
// @RequiresPermissions("userInfo.add")//权限管理;
public byte[] printXmlData(@RequestParam("date") String date, HttpServletResponse response){
response.setContentType("application/x-download");
response.setCharacterEncoding("UTF-8");
String dateTime = DateFormatUtils.format(new Date(), "yyyyMMddHH");
// //使用Servlet实现文件下载的时候,避免浏览器自动打开文件
String fout = null;
//TODO
// List<PersonPostAbnormalEntity> postAbnormalEntity = personPostService.getAllPersonPostAbnormalEntity(date);
// fout = ExportExcel.exportPersonPostAbnormalExcel(postAbnormalEntity);
String outFile = dateTime + "制证数据包";
try {
FileInputStream fis = new FileInputStream(new File(fout));
byte[] b = new byte[fis.available()];
fis.read(b);
fis.close();
response.addHeader("Content-Disposition", "attachment;filename=" + outFile + ".xml");
return b;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
...@@ -52,4 +52,5 @@ public class UserApi { ...@@ -52,4 +52,5 @@ public class UserApi {
subject.logout(); subject.logout();
} }
} }
} }
package com.yxproject.start.entity;
import javax.persistence.*;
import java.sql.Time;
import java.util.Date;
import java.util.Objects;
/**
* @auther zhangyusheng
* 2019/3/1 10:39
*/
@Entity
@Table(name = "FILE_NAME_DIC", schema = "YX", catalog = "")
public class FileNameDicEntity {
private long fileId;
private String fileName;
private Date uploadDate;
private Date analysisDate;
private Date printDate;
private String formStartTime;
private String formDeadline;
@Id
@Column(name = "FILE_ID")
public long getFileId() {
return fileId;
}
public void setFileId(long fileId) {
this.fileId = fileId;
}
@Basic
@Column(name = "FILE_NAME")
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
@Basic
@Column(name = "UPLOAD_DATE")
public Date getUploadDate() {
return uploadDate;
}
public void setUploadDate(Date uploadDate) {
this.uploadDate = uploadDate;
}
@Basic
@Column(name = "ANALYSIS_DATE")
public Date getAnalysisDate() {
return analysisDate;
}
public void setAnalysisDate(Date analysisDate) {
this.analysisDate = analysisDate;
}
@Basic
@Column(name = "PRINT_DATE")
public Date getPrintDate() {
return printDate;
}
public void setPrintDate(Date printDate) {
this.printDate = printDate;
}
@Basic
@Column(name = "FORM_START_TIME")
public String getFormStartTime() {
return formStartTime;
}
public void setFormStartTime(String formStartTime) {
this.formStartTime = formStartTime;
}
@Basic
@Column(name = "FORM_DEADLINE")
public String getFormDeadline() {
return formDeadline;
}
public void setFormDeadline(String formDeadline) {
this.formDeadline = formDeadline;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FileNameDicEntity that = (FileNameDicEntity) o;
return fileId == that.fileId &&
Objects.equals(fileName, that.fileName) &&
Objects.equals(uploadDate, that.uploadDate) &&
Objects.equals(analysisDate, that.analysisDate) &&
Objects.equals(printDate, that.printDate) &&
Objects.equals(formStartTime, that.formStartTime) &&
Objects.equals(formDeadline, that.formDeadline);
}
@Override
public int hashCode() {
return Objects.hash(fileId, fileName, uploadDate, analysisDate, printDate, formStartTime, formDeadline);
}
}
...@@ -37,12 +37,7 @@ public class PersonPostEntity { ...@@ -37,12 +37,7 @@ public class PersonPostEntity {
private Time validPeriodEnd; private Time validPeriodEnd;
private String note; private String note;
private Long state; private Long state;
private Time uploadDate;
private Long fileId; private Long fileId;
private Time analysisDate;
private Time printDate;
private Time formStartTime;
private Time formDeadline;
@Id @Id
@Column(name = "WAYBILL_NUMBER") @Column(name = "WAYBILL_NUMBER")
...@@ -344,15 +339,6 @@ public class PersonPostEntity { ...@@ -344,15 +339,6 @@ public class PersonPostEntity {
this.state = state; this.state = state;
} }
@Basic
@Column(name = "UPLOAD_DATE")
public Time getUploadDate() {
return uploadDate;
}
public void setUploadDate(Time uploadDate) {
this.uploadDate = uploadDate;
}
@Basic @Basic
@Column(name = "FILE_ID") @Column(name = "FILE_ID")
...@@ -364,45 +350,6 @@ public class PersonPostEntity { ...@@ -364,45 +350,6 @@ public class PersonPostEntity {
this.fileId = fileId; this.fileId = fileId;
} }
@Basic
@Column(name = "ANALYSIS_DATE")
public Time getAnalysisDate() {
return analysisDate;
}
public void setAnalysisDate(Time analysisDate) {
this.analysisDate = analysisDate;
}
@Basic
@Column(name = "PRINT_DATE")
public Time getPrintDate() {
return printDate;
}
public void setPrintDate(Time printDate) {
this.printDate = printDate;
}
@Basic
@Column(name = "FORM_START_TIME")
public Time getFormStartTime() {
return formStartTime;
}
public void setFormStartTime(Time formStartTime) {
this.formStartTime = formStartTime;
}
@Basic
@Column(name = "FORM_DEADLINE")
public Time getFormDeadline() {
return formDeadline;
}
public void setFormDeadline(Time formDeadline) {
this.formDeadline = formDeadline;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
...@@ -439,16 +386,11 @@ public class PersonPostEntity { ...@@ -439,16 +386,11 @@ public class PersonPostEntity {
Objects.equals(validPeriodEnd, that.validPeriodEnd) && Objects.equals(validPeriodEnd, that.validPeriodEnd) &&
Objects.equals(note, that.note) && Objects.equals(note, that.note) &&
Objects.equals(state, that.state) && Objects.equals(state, that.state) &&
Objects.equals(uploadDate, that.uploadDate) && Objects.equals(fileId, that.fileId) ;
Objects.equals(fileId, that.fileId) &&
Objects.equals(analysisDate, that.analysisDate) &&
Objects.equals(printDate, that.printDate) &&
Objects.equals(formStartTime, that.formStartTime) &&
Objects.equals(formDeadline, that.formDeadline);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(waybillNumber, backWaybillNumber, orderNumber, createDate, openid, wcPlayOrderNumber, playState, orderState, applicantName, senderName, senderPhone, senderAddress, recipientName, recipientPhone, recipientAddress, orderBlankNumber, getToProvince, getToCity, getToCounty, businessType, latticeMouthInformation, natureOfTheInternal, natureOfTheInformation, firstWhite, idCard, acceptTheMatter, beginUsefulLife, validPeriodEnd, note, state, uploadDate, fileId, analysisDate, printDate, formStartTime, formDeadline); return Objects.hash(waybillNumber, backWaybillNumber, orderNumber, createDate, openid, wcPlayOrderNumber, playState, orderState, applicantName, senderName, senderPhone, senderAddress, recipientName, recipientPhone, recipientAddress, orderBlankNumber, getToProvince, getToCity, getToCounty, businessType, latticeMouthInformation, natureOfTheInternal, natureOfTheInformation, firstWhite, idCard, acceptTheMatter, beginUsefulLife, validPeriodEnd, note, state, fileId);
} }
} }
package com.yxproject.start.mapper;
import com.yxproject.start.entity.FileNameDicEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
/**
* @auther zhangyusheng
* 2019/3/1 10:41
*/
@Mapper
public interface FileNameDicMapper {
@Insert("INSERT INTO FILE_NAME_DIC (FILE_NAME,UPLOAD_DATE) VALUES (#{fileName},#{uploadDate})")
@Options(useGeneratedKeys=true, keyProperty="fileId", keyColumn="fileId")
public long saveFileNameDic(FileNameDicEntity fileNameDicEntity);
}
...@@ -12,9 +12,14 @@ import java.util.List; ...@@ -12,9 +12,14 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface PersonPostMapper { public interface PersonPostMapper {
<<<<<<< HEAD
@Update("update PERSON_POST set WAYBILL_NUMBER=#{waybillNumber},BACK_WAYBILL_NUMBER=#{backWaybillNumber},ORDER_NUMBER=#{orderNumber},CREATE_DATE=#{createDate},OPENID=#{openid},WC_PLAY_ORDER_NUMBER=#{wcPlayOrderNumber},PLAY_STATE=#{playState},ORDER_STATE=#{orderState},,APPLICANT_NAME=#{applicantName},SENDER_NAME=#{senderName},SENDER_PHONE=#{senderPhone},SENDER_ADDRESS=#{senderAddress},RECIPIENT_NAME=#{recipientName},RECIPIENT_PHONE=#{recipientPhone},RECIPIENT_ADDRESS=#{recipientAddress},ORDER_BLANK_NUMBER=#{orderBlankNumber},GET_TO_PROVINCE=#{getToProvince},GET_TO_CITY=#{getToCity},GET_TO_COUNTY=#{getToCounty},BUSINESS_TYPE=#{businessType},LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation},NATURE_OF_THE_INTERNAL=#{natureOfTheInternal},NATURE_OF_THE_INFORMATION=#{natureOfTheInformation},FIRST_WHITE=#{firstWhite}") @Update("update PERSON_POST set WAYBILL_NUMBER=#{waybillNumber},BACK_WAYBILL_NUMBER=#{backWaybillNumber},ORDER_NUMBER=#{orderNumber},CREATE_DATE=#{createDate},OPENID=#{openid},WC_PLAY_ORDER_NUMBER=#{wcPlayOrderNumber},PLAY_STATE=#{playState},ORDER_STATE=#{orderState},,APPLICANT_NAME=#{applicantName},SENDER_NAME=#{senderName},SENDER_PHONE=#{senderPhone},SENDER_ADDRESS=#{senderAddress},RECIPIENT_NAME=#{recipientName},RECIPIENT_PHONE=#{recipientPhone},RECIPIENT_ADDRESS=#{recipientAddress},ORDER_BLANK_NUMBER=#{orderBlankNumber},GET_TO_PROVINCE=#{getToProvince},GET_TO_CITY=#{getToCity},GET_TO_COUNTY=#{getToCounty},BUSINESS_TYPE=#{businessType},LATTICE_MOUTH_INFORMATION=#{latticeMouthInformation},NATURE_OF_THE_INTERNAL=#{natureOfTheInternal},NATURE_OF_THE_INFORMATION=#{natureOfTheInformation},FIRST_WHITE=#{firstWhite}")
public boolean updatePersonPost(PersonPostEntity personPostEntity); public boolean updatePersonPost(PersonPostEntity personPostEntity);
=======
@Update("insert into PERSON_POST ( WAYBILL_NUMBER,BACK_WAYBILL_NUMBER,ORDER_NUMBER,CREATE_DATE,OPENID,WC_PLAY_ORDER_NUMBER,PLAY_STATE,ORDER_STATE,APPLICANT_NAME,SENDER_NAME,SENDER_PHONE,SENDER_ADDRESS,RECIPIENT_NAME,RECIPIENT_PHONE,RECIPIENT_ADDRESS,ORDER_BLANK_NUMBER,GET_TO_PROVINCE,GET_TO_CITY,GET_TO_COUNTY,BUSINESS_TYPE,LATTICE_MOUTH_INFORMATION,NATURE_OF_THE_INTERNAL,NATURE_OF_THE_INFORMATION,FIRST_WHITE,UPLOAD_DATE) values (#{waybillNumber},#{backWaybillNumber},#{orderNumber},#{createDate},#{openid},#{wcPlayOrderNumber},#{playState},#{orderState},#{applicantName},#{senderName},#{senderPhone},#{senderAddress},#{recipientName},#{recipientPhone},#{recipientAddress},#{orderBlankNumber},#{getToProvince},#{getToCity},#{getToCounty},#{businessType},#{latticeMouthInformation},#{natureOfTheInternal},#{natureOfTheInformation},#{firstWhite},#(uploadDate))")
public boolean savePersonPost(PersonPostEntity personPostEntity);
>>>>>>> f2a2d5f3ff5f7cc54b7fe5ecf6c9f2258812c742
@Update("update prepro_person p \n" + @Update("update prepro_person p \n" +
......
...@@ -25,5 +25,16 @@ public interface PreproPersonMapper { ...@@ -25,5 +25,16 @@ public interface PreproPersonMapper {
@Update("UPDATE PREPRO_PERSON SET IS_POST=#{isPost} where JMSFZSLH=#{jmsfzslh}") @Update("UPDATE PREPRO_PERSON SET IS_POST=#{isPost} where JMSFZSLH=#{jmsfzslh}")
public boolean updatePreproPersonEntity(PreproPersonEntity personEntity); public boolean updatePreproPersonEntity(PreproPersonEntity personEntity);
<<<<<<< HEAD
=======
/*按条件查询制证数据*/
@Select("select * from PREPRO_PERSON \n" +
"left join files on PREPRO_PERSON.FILE_ID = files.ID\n" +
"left join NEW_FILES on PREPRO_PERSON.FILE_ID = NEW_FILES.ID " +
"where PREPRO_PERSON.JMSFZSLH = #{uploadNo} and GMSFHM = #{IDCard}" +
//TODO
"and files.SOURCE_FILE_NAME =#{oldFile} and ")
public List<PreproPersonEntity> selectPreproPerson(String uploadNo,String IDCard,String oldFile,String newFile,String SSXQDM,String cardType,String state,String uploadDate);
>>>>>>> f2a2d5f3ff5f7cc54b7fe5ecf6c9f2258812c742
} }
package com.yxproject.start.service;
import com.yxproject.start.entity.FileNameDicEntity;
/**
* @auther zhangyusheng
* 2019/3/1 10:42
*/
public interface FileNameDicService {
public long saveFileNameDic(FileNameDicEntity fileNameDicEntity);
}
...@@ -12,6 +12,7 @@ public interface PersonPostService { ...@@ -12,6 +12,7 @@ public interface PersonPostService {
/** /**
* 导入个人邮寄异常信息 * 导入个人邮寄异常信息
*/ */
public boolean updatePersonPost(List<PersonPostEntity> personPostEntities); public boolean updatePersonPost(List<PersonPostEntity> personPostEntities);
/** /**
...@@ -21,4 +22,8 @@ public interface PersonPostService { ...@@ -21,4 +22,8 @@ public interface PersonPostService {
* @return * @return
*/ */
public boolean updateIsPost(String fileId,String creatTime); public boolean updateIsPost(String fileId,String creatTime);
public boolean savePersonPost(List<PersonPostEntity> personPostEntities);
} }
package com.yxproject.start.service;
/**
* @auther zhangyusheng
* 2019/3/1 11:24
*/
public interface PreproPersonService {
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.FileNameDicEntity;
import com.yxproject.start.mapper.FileNameDicMapper;
import com.yxproject.start.service.FileNameDicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @auther zhangyusheng
* 2019/3/1 10:43
*/
@Service
public class FileNameDicServiceImpl implements FileNameDicService {
@Autowired
private FileNameDicMapper fileNameDicMapper;
@Override
public long saveFileNameDic(FileNameDicEntity fileNameDicEntity) {
long fileId = fileNameDicMapper.saveFileNameDic(fileNameDicEntity);
return fileId;
}
}
...@@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -23,13 +25,10 @@ public class PersonPostServiceImpl implements PersonPostService { ...@@ -23,13 +25,10 @@ public class PersonPostServiceImpl implements PersonPostService {
private PreproPersonMapper preproPersonMapper; private PreproPersonMapper preproPersonMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean updatePersonPost(List<PersonPostEntity> personPostEntities) { public boolean savePersonPost(List<PersonPostEntity> personPostEntities) {
for (PersonPostEntity personPostEntity: personPostEntities) { for (PersonPostEntity personPostEntity: personPostEntities) {
boolean b = personPostMapper.updatePersonPost(personPostEntity); personPostEntity.setCreateDate(new java.sql.Time(new Date().getTime()));
PreproPersonEntity preproPersonEntity = new PreproPersonEntity(); boolean b = personPostMapper.savePersonPost(personPostEntity);
preproPersonEntity.setJmsfzslh(personPostEntity.getFirstWhite());
preproPersonEntity.setIsPost((long)1);
preproPersonMapper.updatePreproPersonEntity(preproPersonEntity);
} }
return true; return true;
} }
......
package com.yxproject.start.service.impl;
import com.yxproject.start.mapper.PreproPersonMapper;
import com.yxproject.start.service.PreproPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @auther zhangyusheng
* 2019/3/1 11:25
*/
@Service
public class PreproPersonServiceImpl implements PreproPersonService {
@Autowired
private PreproPersonMapper preproPersonMapper;
}
package com.yxproject.start.utils; package com.yxproject.start.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import jxl.Sheet; import jxl.Sheet;
import jxl.Workbook; import jxl.Workbook;
import jxl.read.biff.BiffException; import jxl.read.biff.BiffException;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by zhangyusheng on 2019/1/30 14:39 * Created by zhangyusheng on 2019/1/30 14:39
*/ */
public class ReadExcel { public class ReadExcel {
public static void main(String[] args) {
ReadExcel obj = new ReadExcel();
// 此处为我创建Excel路径:E:/zhanhj/studysrc/jxl下
File file = new File("E:/北京制证项目/personal_progress_status.xls");
List excelList = obj.readExcel(file);
System.out.println("list中的数据打印出来");
for (int i = 0; i < excelList.size(); i++) {
System.out.println("第"+i+"行:"+excelList.get(i));
List list = (List) excelList.get(i);
for (int j = 0; j < list.size(); j++) {
// System.out.print(list.get(j));+
}
}
}
// 去读Excel的方法readExcel,该方法的入口参数为一个File对象 // 去读Excel的方法readExcel,该方法的入口参数为一个File对象
public List readExcel(File file) { public List readExcel(File file) {
try { try {
......
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