Commit e95a50b9 authored by liboyang's avatar liboyang

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/yxproject/start/api/BizApi.java
#	src/main/java/com/yxproject/start/mapper/PersonPostMapper.java
#	src/main/java/com/yxproject/start/mapper/PersonalProgressStatusMapper.java
#	src/main/java/com/yxproject/start/service/PersonPostService.java
#	src/main/java/com/yxproject/start/service/PersonalProgressStatusService.java
#	src/main/java/com/yxproject/start/service/impl/PersonPostServiceImpl.java
#	src/main/java/com/yxproject/start/service/impl/PersonalProgressStatusServiceImpl.java
parents 9a2a08c0 42d37972
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId> <artifactId>spring-boot-starter-jdbc</artifactId>
...@@ -52,10 +57,27 @@ ...@@ -52,10 +57,27 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.apache.poi</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>poi</artifactId>
<version>1.3.2</version> <version>3.14</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.10</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.yxproject.start.api;
import com.yxproject.start.entity.PersonPostAbnormalEntity;
import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import com.yxproject.start.utils.ExportExcel;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("exportExcel")
public class ExportExcelApi {
/**
* 导出临时证信息
*/
@RequestMapping("ExportTemporaryCertificate")
public boolean ExportTemporaryCertificate(){
PersonPostAbnormalEntity temporaryCertificate = new PersonPostAbnormalEntity();
ExportExcel obj = new ExportExcel();
obj.exportTemporaryCertificateExcel((List<TemporaryCertificateEntity>) temporaryCertificate);
return true;
}
/**
* 导出重做证件信息
*/
@RequestMapping("ExportRedoRegistration")
public boolean ExportRedoRegistration(){
RedoRegistrationEntity redoRegistration = new RedoRegistrationEntity();
ExportExcel obj = new ExportExcel();
obj.exportRedoRegistrationExcel((List<RedoRegistrationEntity>) redoRegistration);
return true;
}
}
package com.yxproject.start.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("person")
public class PersonalDetailsApi {
}
package com.yxproject.start.api;
import com.yxproject.start.entity.*;
import com.yxproject.start.mapper.*;
import com.yxproject.start.service.*;
import com.yxproject.start.utils.ReadExcel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Time;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
/**
*
* 导入Excel文件
*
*/
@RestController
@RequestMapping("ReadExcel")
public class ReadExcelApi {
@Autowired
PersonalProgressStatusService personalProgressStatusService;
@Autowired
PersonPostAbnormalService personPostAbnormalService;
@Autowired
CardDetailedListService cardDetailedListService;
@Autowired
PersonPostService personPostService;
@Autowired
TemporaryCertificateService temporaryCertificateService;
@Autowired
RedoRegistrationService redoRegistrationService;
Boolean result = null;
/**
* 导入个人制证进度状态表
*/
@RequestMapping("ReadPPS")
public boolean ReadPersonalProgressStatus() {
ReadExcel obj = new ReadExcel();
PersonalProgressStatusEntity personalProgressStatus = new PersonalProgressStatusEntity();
List<PersonalProgressStatusEntity> entityList=new ArrayList<PersonalProgressStatusEntity>();
File file = new File("E:/北京制证项目/personal_progress_status.xls");
List excelList = obj.readExcel(file);
for (int i = 0; i < excelList.size(); i++) {
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list ==null||i==0){
continue;
}
System.out.println("输出:"+list);
personalProgressStatus.setUploadNo((String) list.get(0));
personalProgressStatus.setProgressStatus((Long) list.get(1));
personalProgressStatus.setNote((String) list.get(2));
personalProgressStatus.setImportDate((String) list.get(3));
personalProgressStatus.setCreateTaskDate((Time) list.get(4));
personalProgressStatus.setDataCheckDate((Time) list.get(5));
personalProgressStatus.setFilmPrintDate((Time) list.get(6));
personalProgressStatus.setPositionDate((Time) list.get(7));
personalProgressStatus.setSortDate((Time) list.get(8));
personalProgressStatus.setQualityTestDate((Time) list.get(9));
personalProgressStatus.setOutStorageDate((Time) list.get(10));
personalProgressStatus.setHandOutDate((Time) list.get(11));
personalProgressStatus.setSignInDate((Time) list.get(12));
entityList.add(personalProgressStatus);
// for (int j=0;j<list.size();j++){
// System.out.println();
// }
result = personalProgressStatusService.updatePersonalProgressStatus(entityList);
}
return result;
}
/**
* 导入个人邮寄异常信息
*/
@RequestMapping("ReadPPA")
public boolean ReadPersonPostAbnormal(){
ReadExcel obj = new ReadExcel();
PersonPostAbnormalEntity personPostAbnormal = new PersonPostAbnormalEntity();
List<PersonPostAbnormalEntity> entityList= new ArrayList<PersonPostAbnormalEntity>();
File file = new File("E:/北京制证项目/person_post_abnormal.xls");
List excelList = obj.readExcel(file);
for (int i = 0; i < excelList.size(); i++){
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
personPostAbnormal.setBackWaybillNumber((String) list.get(0));
personPostAbnormal.setOrderNumber((String) list.get(1));
personPostAbnormal.setCreateDate((Time) list.get(2));
personPostAbnormal.setOpenid((String) list.get(3));
personPostAbnormal.setWcPlayOrderNumber((String) list.get(4));
personPostAbnormal.setPlayState((String) list.get(5));
personPostAbnormal.setOrderState((String) list.get(6));
personPostAbnormal.setApplicantName((String) list.get(7));
personPostAbnormal.setSenderName((String) list.get(8));
personPostAbnormal.setSenderPhone((String) list.get(9));
personPostAbnormal.setSenderAddress((String) list.get(10));
personPostAbnormal.setRecipientName((String) list.get(11));
personPostAbnormal.setRecipientPhone((String) list.get(12));
personPostAbnormal.setRecipientAddress((String) list.get(13));
personPostAbnormal.setOrderBlankNumber((String) list.get(14));
personPostAbnormal.setGetToProvince((String) list.get(15));
personPostAbnormal.setGetToCity((String) list.get(16));
personPostAbnormal.setGetToCounty((String) list.get(17));
personPostAbnormal.setBusinessType((String) list.get(18));
personPostAbnormal.setLatticeMouthInformation((String) list.get(19));
personPostAbnormal.setNatureOfTheInternal((String) list.get(20));
personPostAbnormal.setNatureOfTheInformation((String) list.get(21));
personPostAbnormal.setFirstWhite((String) list.get(22));
personPostAbnormal.setErrCode((String) list.get(23));
entityList.add(personPostAbnormal);
System.out.println("111111111111111111"+entityList.get(0));
}
result = personPostAbnormalService.updatePersonPostAbnormal(entityList);
return result;
}
/**
* 导入身份证详单
*/
@RequestMapping("ReadCDL")
public boolean ReadCardDetailList(){
ReadExcel obj = new ReadExcel();
CardDetailedListEntity cardDetailedList = new CardDetailedListEntity();
List<CardDetailedListEntity> entityList = new ArrayList<CardDetailedListEntity>();
File file = new File("E:/北京制证项目/Card_Detail_List.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++){
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
cardDetailedList.setPolistListId((String) list.get(0));
cardDetailedList.setUploadNo((String) list.get(1));
cardDetailedList.setNote((String) list.get(2));
cardDetailedList.setFileName((String) list.get(3));
cardDetailedList.setPoliceCode((String) list.get(4));
entityList.add(cardDetailedList);
}
result = cardDetailedListService.updateCardDetailedList(entityList);
return result;
}
/**
* 导入个人信息表
*/
@RequestMapping("ReadPersonPost")
public boolean ReadPersonPost(){
ReadExcel obj = new ReadExcel();
PersonPostEntity personPost = new PersonPostEntity();
List<PersonPostEntity> entityList = new ArrayList<PersonPostEntity>();
File file = new File("E:/北京制证项目/Person_Post.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++){
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
personPost.setBackWaybillNumber((String) list.get(0));
personPost.setOrderNumber((String) list.get(1));
personPost.setCreateDate((Time) list.get(2));
personPost.setOpenid((String) list.get(3));
personPost.setWcPlayOrderNumber((String) list.get(4));
personPost.setPlayState((String) list.get(5));
personPost.setOrderState((String) list.get(6));
personPost.setApplicantName((String) list.get(7));
personPost.setSenderName((String) list.get(8));
personPost.setSenderPhone((String) list.get(9));
personPost.setSenderAddress((String) list.get(10));
personPost.setRecipientName((String) list.get(11));
personPost.setRecipientPhone((String) list.get(12));
personPost.setRecipientAddress((String) list.get(13));
personPost.setOrderBlankNumber((String) list.get(14));
personPost.setGetToProvince((String) list.get(15));
personPost.setGetToCity((String) list.get(16));
personPost.setGetToCounty((String) list.get(17));
personPost.setBusinessType((String) list.get(18));
personPost.setLatticeMouthInformation((String) list.get(19));
personPost.setNatureOfTheInternal((String) list.get(20));
personPost.setLatticeMouthInformation((String) list.get(21));
personPost.setFirstWhite((String) list.get(22));
entityList.add(personPost);
}
result = personPostService.updatePersonPost(entityList);
return result;
}
/**
* 导入临时证信息
*/
@RequestMapping("ReadTemporaryCertificate")
public boolean ReadTemporaryCertificate(){
ReadExcel obj = new ReadExcel();
TemporaryCertificateEntity temporaryCertificate = new TemporaryCertificateEntity();
List<TemporaryCertificateEntity> entityList = new ArrayList<TemporaryCertificateEntity>();
File file = new File("E:/北京制证项目/Temporary_Certificate.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++) {
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
temporaryCertificate.setName((String) list.get(0));
temporaryCertificate.setCardId((String) list.get(1));
temporaryCertificate.setPhone((String) list.get(2));
temporaryCertificate.setLastDurationOfStatus((String) list.get(3));
temporaryCertificate.setReceiptDate((String) list.get(4));
temporaryCertificate.setDateOfHandOverToTreat((String) list.get(5));
temporaryCertificate.setBackWorkshopDate((String) list.get(6));
temporaryCertificate.setDeliverToParty((String) list.get(7));
temporaryCertificate.setNote((String) list.get(8));
entityList.add(temporaryCertificate);
}
result = temporaryCertificateService.updateTemporaryCertificate(entityList);
return result;
}
/**
* 导入重做证件信息
*/
@RequestMapping("ReadRedoRegistration")
public boolean ReadRedoRegistration(){
ReadExcel obj = new ReadExcel();
RedoRegistrationEntity redoRegistration = new RedoRegistrationEntity();
List<RedoRegistrationEntity> entityList = new ArrayList<RedoRegistrationEntity>();
File file = new File("E:/北京制证项目/Read_Redo_Registration.xls");
List excelList = obj.readExcel(file);
for (int i=0;i<excelList.size();i++) {
List list = (List) excelList.get(i);
//跳过空行和第一行
if (list == null||i==0){
continue;
}
redoRegistration.setRedoRegistrationId((String) list.get(0));
redoRegistration.setSubmitDate((String) list.get(1));
redoRegistration.setCountyCode((String) list.get(2));
redoRegistration.setPoliceCode((String) list.get(3));
redoRegistration.setName((String) list.get(4));
redoRegistration.setCardId((String) list.get(5));
redoRegistration.setRedoReason((String) list.get(6));
redoRegistration.setCallDate((String) list.get(7));
redoRegistration.setBackDate((String) list.get(8));
redoRegistration.setNote((String) list.get(9));
entityList.add(redoRegistration);
}
result=redoRegistrationService.updateRedoRegistration(entityList);
return result;
}
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.CardDetailedListEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface CardDetailedListMapper {
@Update("update CARD_DETAILED_LIST set CARD_DETAILED_LIST_ID = #{cardDetailedListId},POLIST_LIST_ID = #{polistListId},UPLOAD_NO =#{uploadNo},NOTE =#{note},FILE_NAME =#{fileName},POLICE_CODE =#{policeCode}")
public void updateCardDetailedList(List<CardDetailedListEntity> cardDetailedList);
}
...@@ -2,7 +2,8 @@ package com.yxproject.start.mapper; ...@@ -2,7 +2,8 @@ package com.yxproject.start.mapper;
import com.yxproject.start.entity.PersonPostAbnormalEntity; import com.yxproject.start.entity.PersonPostAbnormalEntity;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
...@@ -20,4 +21,8 @@ public interface PersonPostAbnormalMapper { ...@@ -20,4 +21,8 @@ public interface PersonPostAbnormalMapper {
*/ */
@Select("select * from PERSON_POST_ABNORMAL where FIRST_WHITE in (select UPLOAD_NO from CARD_DETAILED_LIST where POLICE_CODE=#{police} and UPLOAD_NO like CONCAT(CONCAT('%',#{date}),'%'))") @Select("select * from PERSON_POST_ABNORMAL where FIRST_WHITE in (select UPLOAD_NO from CARD_DETAILED_LIST where POLICE_CODE=#{police} and UPLOAD_NO like CONCAT(CONCAT('%',#{date}),'%'))")
public List<PersonPostAbnormalEntity> selectPersonPostAbnormalMsg(@Param("police")String police,@Param("date")String date); public List<PersonPostAbnormalEntity> selectPersonPostAbnormalMsg(@Param("police")String police,@Param("date")String date);
@Update("update PERSON_POST_ABNORMAL 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},ERR_CODE=#{errCode}")
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormal);
} }
...@@ -4,9 +4,10 @@ import com.yxproject.start.entity.PersonPostEntity; ...@@ -4,9 +4,10 @@ import com.yxproject.start.entity.PersonPostEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface PersonPostMapper { public interface PersonPostMapper {
...@@ -18,4 +19,7 @@ public interface PersonPostMapper { ...@@ -18,4 +19,7 @@ public interface PersonPostMapper {
*/ */
@Select("SELECT * FROM PERSON_POST WHERE WAYBILL_NUMBER=#{waybillNumber}") @Select("SELECT * FROM PERSON_POST WHERE WAYBILL_NUMBER=#{waybillNumber}")
public PersonPostEntity selectPersonPostMsgByIdCard(String waybillNumber); public PersonPostEntity selectPersonPostMsgByIdCard(String waybillNumber);
@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 void updatePersonPost(List<PersonPostEntity> personPost);
} }
...@@ -4,7 +4,12 @@ import com.yxproject.start.dto.CardsStatusAndCardsMsgDto; ...@@ -4,7 +4,12 @@ import com.yxproject.start.dto.CardsStatusAndCardsMsgDto;
import com.yxproject.start.dto.CardsStatusAndPostMsgDto; import com.yxproject.start.dto.CardsStatusAndPostMsgDto;
import com.yxproject.start.entity.PersonalProgressStatusEntity; import com.yxproject.start.entity.PersonalProgressStatusEntity;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -35,4 +40,8 @@ public interface PersonalProgressStatusMapper { ...@@ -35,4 +40,8 @@ public interface PersonalProgressStatusMapper {
@Update("UPDATE PERSONAL_PROGRESS_STATUS SET PROGRESS_STATUS=9 WHERE UPLOAD_NO=#{uploadNo}") @Update("UPDATE PERSONAL_PROGRESS_STATUS SET PROGRESS_STATUS=9 WHERE UPLOAD_NO=#{uploadNo}")
void updateSignInDate(@Param("uploadNo")String uploadNo); void updateSignInDate(@Param("uploadNo")String uploadNo);
@Update("update PERSONAL_PROGRESS_STATUS set UPLOAD_NO =#{uploadNo},PROGRESS_STATUS=#{progressStatus},NOTE=#{note},IMPORT_DATE=#{importDate},CREATE_TASK_DATE=#{create_Task_Date},DATA_CHECK_DATE=#{data_Check_Date},FILM_PRINT_DATE=#{film_Print_Date},POSITION_DATE=#{position_Date},SORT_DATE=#{sort_Date},QUALITY_TEST_DATE=#{quality_Test_Date},OUT_STORAGE_DATE=#{out_Storage_Date},HAND_OUT_DATE=#{hand_Out_Date},SIGN_IN_DATE=#{sign_In_Date}")
public void updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatus);
} }
package com.yxproject.start.mapper;
import com.yxproject.start.entity.RedoRegistrationEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface RedoRegistrationMapper {
@Update("update REDO_REGISTRATION set REDO_REGISTRATION_ID=#{redoRegistrationId},SUBMIT_DATE=#{submitDate},COUNTY_CODE=#{countyCode},POLICE_CODE=#{countyCode},POLICE_CODE=#{policeCode},NAME=#{name},CARD_ID=#{cardId},REDO_REASON=#{redoReason},CALL_DATE=#{callDate},BACK_DATE=#{backDate},NOTE=#{note}")
public void updateRedoRegistration(List<RedoRegistrationEntity> redoRegistration);
@Select("select * from REDO_REGISTRATION ")
public List<RedoRegistrationEntity> selectRedoRegistration();
}
package com.yxproject.start.mapper;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface TemporaryCertificateMapper {
@Update("update TEMPORARY_CERTIFICATE set TEMPORARY_CERTIFICATE_ID=#{temporaryCertificateId},NAME=#{name},CARD_ID=#{cardId},PHONE=#{phone},LAST_DURATION_OF_STATUS=#{lastDurationOfStatus},RECEIPT_DATE=#{receiptDate},DATE_OF_HAND_OVER_TO_TREAT=#{dateOfHandOverToTreat},BACK_WORKSHOP_DATE=#{backWorkshopDate},DELIVER_TO_PARTY=#{deliverToParty},NOTE=#{note}")
public void updateTemporaryCertificate(List<TemporaryCertificateEntity> TemporaryCertificate);
@Select("select * from TEMPORARY_CERTIFICATE ")
public List<TemporaryCertificateEntity> selectTemporaryCertificate();
}
package com.yxproject.start.service;
import com.yxproject.start.entity.CardDetailedListEntity;
import java.util.List;
/**
* 导入身份证详单
*/
public interface CardDetailedListService {
public boolean updateCardDetailedList(List<CardDetailedListEntity> cardDetailedListEntities);
}
...@@ -18,4 +18,8 @@ public interface PersonPostAbnormalService { ...@@ -18,4 +18,8 @@ public interface PersonPostAbnormalService {
* @return * @return
*/ */
public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police); public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police);
/**
* 导入个人邮寄异常信息
*/
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormalEntities);
} }
...@@ -2,7 +2,12 @@ package com.yxproject.start.service; ...@@ -2,7 +2,12 @@ package com.yxproject.start.service;
import com.yxproject.start.entity.PersonPostEntity; import com.yxproject.start.entity.PersonPostEntity;
import java.util.List;
/**
* 导入个人信息表
*/
public interface PersonPostService { public interface PersonPostService {
public boolean updatePersonPost(List<PersonPostEntity> personPostEntities);
public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard); public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard);
} }
...@@ -16,4 +16,10 @@ public interface PersonalProgressStatusService { ...@@ -16,4 +16,10 @@ public interface PersonalProgressStatusService {
public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police); public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police);
public List<CardsStatusAndCardsMsgDto> getStatusAndCardMsg(String date, String police); public List<CardsStatusAndCardsMsgDto> getStatusAndCardMsg(String date, String police);
public boolean updateSignInDate(JSONArray jsonArray); public boolean updateSignInDate(JSONArray jsonArray);
/**
* 导入个人制证进度状态表
*/
public boolean updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatusEntities);
} }
package com.yxproject.start.service;
import com.yxproject.start.entity.CardDetailedListEntity;
import com.yxproject.start.entity.RedoRegistrationEntity;
import java.util.List;
public interface RedoRegistrationService {
/**
* 导入重做证件信息
*/
public boolean updateRedoRegistration(List<RedoRegistrationEntity> redoRegistrationEntities);
/**
* 导出重做证件信息
*/
public List<RedoRegistrationEntity> selectRedoRegistration();
}
package com.yxproject.start.service;
import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import java.util.List;
public interface TemporaryCertificateService {
/**
* 导入临时证信息
*/
public boolean updateTemporaryCertificate(List<TemporaryCertificateEntity> temporaryCertificateEntities);
/**
* 导出临时证信息
*/
public List<TemporaryCertificateEntity> selectTemporaryCertificate();
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.CardDetailedListEntity;
import com.yxproject.start.mapper.CardDetailedListMapper;
import com.yxproject.start.service.CardDetailedListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CardDetialedListServiceImpl implements CardDetailedListService {
@Autowired
private CardDetailedListMapper cardDetailedListMapper;
@Override
public boolean updateCardDetailedList(List<CardDetailedListEntity> cardDetailedListEntities) {
cardDetailedListMapper.updateCardDetailedList(cardDetailedListEntities);
return true;
}
}
...@@ -18,7 +18,11 @@ public class PersonPostAbnormalServiceImpl implements PersonPostAbnormalService ...@@ -18,7 +18,11 @@ public class PersonPostAbnormalServiceImpl implements PersonPostAbnormalService
private PersonPostAbnormalMapper personPostAbnormalMapper; private PersonPostAbnormalMapper personPostAbnormalMapper;
@Override @Override
public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police) { public List<PersonPostAbnormalEntity> getPersonPostAbnormal(String date, String police) {
List<PersonPostAbnormalEntity> list = personPostAbnormalMapper.selectPersonPostAbnormalMsg(police,date); List<PersonPostAbnormalEntity> list = personPostAbnormalMapper.selectPersonPostAbnormalMsg(police, date);
return list; return list;
} }
public boolean updatePersonPostAbnormal(List<PersonPostAbnormalEntity> personPostAbnormalEntities) {
personPostAbnormalMapper.updatePersonPostAbnormal(personPostAbnormalEntities);
return true;
}
} }
...@@ -5,10 +5,13 @@ import com.yxproject.start.mapper.PersonPostMapper; ...@@ -5,10 +5,13 @@ import com.yxproject.start.mapper.PersonPostMapper;
import com.yxproject.start.service.PersonPostService; import com.yxproject.start.service.PersonPostService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @author Administrator * @author Administrator
*/ */
@Service @Service
public class PersonPostServiceImpl implements PersonPostService { public class PersonPostServiceImpl implements PersonPostService {
...@@ -19,5 +22,9 @@ public class PersonPostServiceImpl implements PersonPostService { ...@@ -19,5 +22,9 @@ public class PersonPostServiceImpl implements PersonPostService {
public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard) { public PersonPostEntity getPersonPostMsg(String idwaybillNumberCard) {
PersonPostEntity personPostEntity = personPostMapper.selectPersonPostMsgByIdCard(idwaybillNumberCard); PersonPostEntity personPostEntity = personPostMapper.selectPersonPostMsgByIdCard(idwaybillNumberCard);
return personPostEntity; return personPostEntity;
@Override
public boolean updatePersonPost(List<PersonPostEntity> personPostEntities) {
personPostMapper.updatePersonPost(personPostEntities);
return true;
} }
} }
...@@ -22,7 +22,7 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus ...@@ -22,7 +22,7 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus
private PersonalProgressStatusMapper personalProgressStatusMapper; private PersonalProgressStatusMapper personalProgressStatusMapper;
@Override @Override
public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police) { public List<CardsStatusAndPostMsgDto> getStatusAndPostMsg(String date, String police) {
List<CardsStatusAndPostMsgDto> list = personalProgressStatusMapper.selectStatusAndPostMsg(date,police); List<CardsStatusAndPostMsgDto> list = personalProgressStatusMapper.selectStatusAndPostMsg(date, police);
return list; return list;
} }
...@@ -40,4 +40,9 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus ...@@ -40,4 +40,9 @@ public class PersonalProgressStatusServiceImpl implements PersonalProgressStatus
} }
return true; return true;
} }
@Override
public boolean updatePersonalProgressStatus(List<PersonalProgressStatusEntity> personalProgressStatusEntities) {
personalProgressStatusMapper.updatePersonalProgressStatus(personalProgressStatusEntities);
return true;
}
} }
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.mapper.RedoRegistrationMapper;
import com.yxproject.start.service.RedoRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RedoRegistrationServiceImpl implements RedoRegistrationService {
@Autowired
private RedoRegistrationMapper redoRegistrationMapper;
@Override
public boolean updateRedoRegistration(List<RedoRegistrationEntity> redoRegistrationEntities) {
redoRegistrationMapper.updateRedoRegistration(redoRegistrationEntities);
return false;
}
@Override
public List<RedoRegistrationEntity> selectRedoRegistration() {
List<RedoRegistrationEntity> list = redoRegistrationMapper.selectRedoRegistration();
return list;
}
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import com.yxproject.start.mapper.TemporaryCertificateMapper;
import com.yxproject.start.service.TemporaryCertificateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TemporaryCertificateServiceImpl implements TemporaryCertificateService {
@Autowired
private TemporaryCertificateMapper temporaryCertificateMapper;
@Override
public boolean updateTemporaryCertificate(List<TemporaryCertificateEntity> temporaryCertificateEntities) {
temporaryCertificateMapper.updateTemporaryCertificate(temporaryCertificateEntities);
return true;
}
@Override
public List<TemporaryCertificateEntity> selectTemporaryCertificate() {
List<TemporaryCertificateEntity> list = temporaryCertificateMapper.selectTemporaryCertificate();
return list;
}
}
package com.yxproject.start.utils;
import com.yxproject.start.entity.PersonPostAbnormalEntity;
import com.yxproject.start.entity.PersonalProgressStatusEntity;
import com.yxproject.start.entity.RedoRegistrationEntity;
import com.yxproject.start.entity.TemporaryCertificateEntity;
import org.apache.poi.hssf.usermodel.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import static java.lang.Integer.parseInt;
import static java.lang.Integer.valueOf;
/**
* @auther zhangyusheng
* 2019/2/12 15:44
*/
public class ExportExcel {
/**
* 导出错误邮寄信息
* @param personPostAbnormalEntities
* @return
*/
public static String exportPersonPostAbnormalExcel(List<PersonPostAbnormalEntity> personPostAbnormalEntities){
//第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
HSSFSheet sheet = wb.createSheet("邮寄信息错误信息表");
sheet.setColumnWidth(0, 30 * 100);
sheet.setColumnWidth(1, 30 * 70);
sheet.setColumnWidth(2, 30 * 80);
sheet.setColumnWidth(3, 30 * 50);
sheet.setColumnWidth(4, 30 * 110);
sheet.setColumnWidth(5, 30 * 110);
sheet.setColumnWidth(6, 30 * 110);
sheet.setColumnWidth(7, 30 * 110);
sheet.setColumnWidth(8, 30 * 110);
sheet.setColumnWidth(9, 30 * 110);
sheet.setColumnWidth(10, 30 * 110);
sheet.setColumnWidth(11, 30 * 110);
sheet.setColumnWidth(12, 30 * 110);
sheet.setColumnWidth(13, 30 * 110);
sheet.setColumnWidth(14, 30 * 110);
sheet.setColumnWidth(15, 30 * 110);
sheet.setColumnWidth(16, 30 * 110);
sheet.setColumnWidth(17, 30 * 110);
sheet.setColumnWidth(18, 30 * 110);
sheet.setColumnWidth(19, 30 * 110);
sheet.setColumnWidth(20, 30 * 110);
sheet.setColumnWidth(21, 30 * 110);
sheet.setColumnWidth(22, 30 * 110);
sheet.setColumnWidth(23, 30 * 110);
sheet.setColumnWidth(24, 30 * 110);
//第三步创建行row:添加表头0行
HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();//样式
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
style.setWrapText(true);//设置自动换行
HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 12);
style.setFont(font);
row = sheet.createRow(0); //创建下标为0的单元格
row.setHeightInPoints(Short.parseShort("20"));//设置行高
HSSFCell cell = row.createCell(0); //设定值
cell.setCellValue("邮件号");
cell = row.createCell(1); //设定值
cell.setCellValue("反邮件号");
cell = row.createCell(2); //设定值
cell.setCellValue("订单号");
cell = row.createCell(3); //设定值
cell.setCellValue("订单生成时间");
cell = row.createCell(4); //设定值
cell.setCellValue("openid");
cell = row.createCell(5); //设定值
cell.setCellValue("微信支付订单号");
cell = row.createCell(6); //设定值
cell.setCellValue("支付状态");
cell = row.createCell(7); //设定值
cell.setCellValue("订单状态");
cell = row.createCell(8); //设定值
cell.setCellValue("申请人姓名");
cell = row.createCell(9); //设定值
cell.setCellValue("寄件人姓名");
cell = row.createCell(10); //设定值
cell.setCellValue("寄件人联系方式");
cell = row.createCell(1); //设定值
cell.setCellValue("寄件人地址");
cell = row.createCell(11); //设定值
cell.setCellValue("收件人姓名");
cell = row.createCell(12); //设定值
cell.setCellValue("收件人联系方式");
cell = row.createCell(13); //设定值
cell.setCellValue("收件人地址");
cell = row.createCell(14); //设定值
cell.setCellValue("配货单号");
cell = row.createCell(15); //设定值
cell.setCellValue("到件省/直辖市");
cell = row.createCell(16); //设定值
cell.setCellValue("到件城市");
cell = row.createCell(17); //设定值
cell.setCellValue("到件县/区");
cell = row.createCell(18); //设定值
cell.setCellValue("业务类型");
cell = row.createCell(19); //设定值
cell.setCellValue("格口信息");
cell = row.createCell(20); //设定值
cell.setCellValue("内件性质");
cell = row.createCell(21); //设定值
cell.setCellValue("内件信息");
cell = row.createCell(22); //设定值
cell.setCellValue("留白一");
cell = row.createCell(23); //设定值
cell.setCellValue("错误代码");
cell = row.createCell(24); //设定值
cell.setCellValue("检查日期");
for (int i =0;i<personPostAbnormalEntities.size();i++){
PersonPostAbnormalEntity personPostAbnormalEntity = personPostAbnormalEntities.get(i);
row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值
cell.setCellValue(personPostAbnormalEntity.getWaybillNumber());
cell = row.createCell(1); //设定值
cell.setCellValue(personPostAbnormalEntity.getBackWaybillNumber());
cell = row.createCell(2); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderNumber());
cell = row.createCell(3); //设定值
cell.setCellValue(personPostAbnormalEntity.getCreateDate());
cell = row.createCell(4); //设定值
cell.setCellValue(personPostAbnormalEntity.getOpenid());
cell = row.createCell(5); //设定值
cell.setCellValue(personPostAbnormalEntity.getWcPlayOrderNumber());
cell = row.createCell(6); //设定值
cell.setCellValue(personPostAbnormalEntity.getPlayState());
cell = row.createCell(7); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderState());
cell = row.createCell(8); //设定值
cell.setCellValue(personPostAbnormalEntity.getApplicantName());
cell = row.createCell(9); //设定值
cell.setCellValue(personPostAbnormalEntity.getSenderName());
cell = row.createCell(10); //设定值
cell.setCellValue(personPostAbnormalEntity.getSenderPhone());
cell = row.createCell(11); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientName());
cell = row.createCell(12); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientPhone());
cell = row.createCell(13); //设定值
cell.setCellValue(personPostAbnormalEntity.getRecipientAddress());
cell = row.createCell(14); //设定值
cell.setCellValue(personPostAbnormalEntity.getOrderBlankNumber());
cell = row.createCell(15); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToProvince());
cell = row.createCell(16); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToCity());
cell = row.createCell(17); //设定值
cell.setCellValue(personPostAbnormalEntity.getGetToCounty());
cell = row.createCell(18); //设定值
cell.setCellValue(personPostAbnormalEntity.getBusinessType());
cell = row.createCell(19); //设定值
cell.setCellValue(personPostAbnormalEntity.getLatticeMouthInformation());
cell = row.createCell(20); //设定值
cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInternal());
cell = row.createCell(21); //设定值
cell.setCellValue(personPostAbnormalEntity.getNatureOfTheInformation());
cell = row.createCell(22); //设定值
cell.setCellValue(personPostAbnormalEntity.getFirstWhite());
cell = row.createCell(23); //设定值
cell.setCellValue(personPostAbnormalEntity.getErrCode());
// cell = row.createCell(24); //设定值
// cell.setCellValue(personPostAbnormalEntity.getCheck_Date());
}
//第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null;
try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "邮寄错误信息表" + ".xls");
wb.write(fout);
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "邮寄错误信息表" + ".xls";
}
/**
* 导出个人制证状态信息表
* @param personalProgressStatusEntities
* @return
*/
public static String exportPersonalProgressStatusExcel(List<PersonalProgressStatusEntity> personalProgressStatusEntities){
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
//第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
HSSFSheet sheet = wb.createSheet("个人制证状态信息表");
sheet.setColumnWidth(0, 30 * 110);
sheet.setColumnWidth(1, 30 * 110);
sheet.setColumnWidth(2, 30 * 110);
sheet.setColumnWidth(3, 30 * 110);
sheet.setColumnWidth(4, 30 * 110);
sheet.setColumnWidth(5, 30 * 110);
sheet.setColumnWidth(6, 30 * 110);
sheet.setColumnWidth(7, 30 * 110);
sheet.setColumnWidth(8, 30 * 110);
sheet.setColumnWidth(9, 30 * 110);
sheet.setColumnWidth(10, 30 * 110);
sheet.setColumnWidth(11, 30 * 110);
sheet.setColumnWidth(12, 30 * 110);
//第三步创建行row:添加表头0行
HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();//样式
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
style.setWrapText(true);//设置自动换行
HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 12);
style.setFont(font);
row = sheet.createRow(0); //创建下标为0的单元格
row.setHeightInPoints(Short.parseShort("20"));//设置行高
HSSFCell cell = row.createCell(0); //设定值
cell.setCellValue("上报受理编号");
cell = row.createCell(1); //设定值
cell.setCellValue("处理状态");
cell = row.createCell(2); //设定值
cell.setCellValue("备注");
cell = row.createCell(3); //设定值
cell.setCellValue("导入时间");
cell = row.createCell(4); //设定值
cell.setCellValue("生成任务单时间");
cell = row.createCell(5); //设定值
cell.setCellValue("数据核验时间");
cell = row.createCell(6); //设定值
cell.setCellValue("膜打印时间");
cell = row.createCell(7); //设定值
cell.setCellValue("预订位时间");
cell = row.createCell(8); //设定值
cell.setCellValue("分拣时间");
cell = row.createCell(9); //设定值
cell.setCellValue("质检时间");
cell = row.createCell(10); //设定值
cell.setCellValue("出库时间");
cell = row.createCell(11); //设定值
cell.setCellValue("下发时间");
cell = row.createCell(12); //设定值
cell.setCellValue("签收时间");
for (int i =0;i<personalProgressStatusEntities.size();i++){
PersonalProgressStatusEntity personalProgressStatusEntity = personalProgressStatusEntities.get(i);
row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值
cell.setCellValue(personalProgressStatusEntity.getUploadNo());
cell = row.createCell(1); //设定值
cell.setCellValue(personalProgressStatusEntity.getProgressStatus());
cell = row.createCell(2); //设定值
cell.setCellValue(personalProgressStatusEntity.getNote());
cell = row.createCell(3); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getImportDate()));
cell = row.createCell(4); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getCreateTaskDate()));
cell = row.createCell(5); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getDataCheckDate()));
cell = row.createCell(6); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getFilmPrintDate()));
cell = row.createCell(7); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getPositionDate()));
cell = row.createCell(8); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getSortDate()));
cell = row.createCell(9); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getQualityTestDate()));
cell = row.createCell(10); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getOutStorageDate()));
cell = row.createCell(11); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getHandOutDate()));
cell = row.createCell(12); //设定值
cell.setCellValue(formatter.format(personalProgressStatusEntity.getSignInDate()));
}
//第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null;
try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "个人制证状态信息表" + ".xls");
wb.write(fout);
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "个人制证状态信息表" + ".xls";
}
/**
* 导出临时证件信息表
* @param temporaryCertificateEntities
* @return
*/
public static String exportTemporaryCertificateExcel(List<TemporaryCertificateEntity> temporaryCertificateEntities){
//第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
HSSFSheet sheet = wb.createSheet("临时证件信息表");
sheet.setColumnWidth(0, 30 * 110);
sheet.setColumnWidth(1, 30 * 110);
sheet.setColumnWidth(2, 30 * 110);
sheet.setColumnWidth(3, 30 * 110);
sheet.setColumnWidth(4, 30 * 110);
sheet.setColumnWidth(5, 30 * 110);
sheet.setColumnWidth(6, 30 * 110);
sheet.setColumnWidth(7, 30 * 110);
sheet.setColumnWidth(8, 30 * 110);
sheet.setColumnWidth(9, 30 * 110);
//第三步创建行row:添加表头0行
HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();//样式
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
style.setWrapText(true);//设置自动换行
HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 12);
style.setFont(font);
row = sheet.createRow(0); //创建下标为0的单元格
row.setHeightInPoints(Short.parseShort("20"));//设置行高
HSSFCell cell = row.createCell(0); //设定值
cell.setCellValue("临时证件id");
cell = row.createCell(1); //设定值
cell.setCellValue("姓名");
cell = row.createCell(2); //设定值
cell.setCellValue("身份证号码");
cell = row.createCell(3); //设定值
cell.setCellValue("联系电话");
cell = row.createCell(4); //设定值
cell.setCellValue("上一个有效期");
cell = row.createCell(5); //设定值
cell.setCellValue("收到日期");
cell = row.createCell(6); //设定值
cell.setCellValue("交待日期");
cell = row.createCell(7); //设定值
cell.setCellValue("返给车间日期");
cell = row.createCell(8); //设定值
cell.setCellValue("交给当事人日期");
cell = row.createCell(9); //设定值
cell.setCellValue("备注");
for (int i =0;i<temporaryCertificateEntities.size();i++){
TemporaryCertificateEntity temporaryCertificateEntity = temporaryCertificateEntities.get(i);
row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值
cell.setCellValue(temporaryCertificateEntity.getTemporaryCertificateId());
cell = row.createCell(1); //设定值
cell.setCellValue(temporaryCertificateEntity.getName());
cell = row.createCell(2); //设定值
cell.setCellValue(temporaryCertificateEntity.getCardId());
cell = row.createCell(3); //设定值
cell.setCellValue(temporaryCertificateEntity.getPhone());
cell = row.createCell(4); //设定值
cell.setCellValue(temporaryCertificateEntity.getLastDurationOfStatus());
cell = row.createCell(5); //设定值
cell.setCellValue(temporaryCertificateEntity.getReceiptDate());
cell = row.createCell(6); //设定值
cell.setCellValue(temporaryCertificateEntity.getDateOfHandOverToTreat());
cell = row.createCell(7); //设定值
cell.setCellValue(temporaryCertificateEntity.getBackWorkshopDate());
cell = row.createCell(8); //设定值
cell.setCellValue(temporaryCertificateEntity.getDeliverToParty());
cell = row.createCell(9); //设定值
cell.setCellValue(temporaryCertificateEntity.getNote());
}
//第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null;
try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "临时证件信息表" + ".xls");
wb.write(fout);
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "临时证件信息表" + ".xls";
}
/**
* 导出重做登记信息表
* @param redoRegistrationEntities
* @return
*/
public static String exportRedoRegistrationExcel(List<RedoRegistrationEntity> redoRegistrationEntities){
//第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
HSSFSheet sheet = wb.createSheet("重做登记信息表");
sheet.setColumnWidth(0, 30 * 110);
sheet.setColumnWidth(1, 30 * 110);
sheet.setColumnWidth(2, 30 * 110);
sheet.setColumnWidth(3, 30 * 110);
sheet.setColumnWidth(4, 30 * 110);
sheet.setColumnWidth(5, 30 * 110);
sheet.setColumnWidth(6, 30 * 110);
sheet.setColumnWidth(7, 30 * 110);
sheet.setColumnWidth(8, 30 * 110);
sheet.setColumnWidth(9, 30 * 110);
//第三步创建行row:添加表头0行
HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();//样式
style.setVerticalAlignment(HSSFCellStyle.ALIGN_LEFT); //设置垂直居中
style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
style.setWrapText(true);//设置自动换行
HSSFFont font = wb.createFont();
font.setFontHeightInPoints((short) 12);
style.setFont(font);
row = sheet.createRow(0); //创建下标为0的单元格
row.setHeightInPoints(Short.parseShort("20"));//设置行高
HSSFCell cell = row.createCell(0); //设定值
cell.setCellValue("重做登记表id");
cell = row.createCell(1); //设定值
cell.setCellValue("上传日期");
cell = row.createCell(2); //设定值
cell.setCellValue("区县代码");
cell = row.createCell(3); //设定值
cell.setCellValue("公安机关代码");
cell = row.createCell(4); //设定值
cell.setCellValue("姓名");
cell = row.createCell(5); //设定值
cell.setCellValue("身份证号");
cell = row.createCell(6); //设定值
cell.setCellValue("重做原因");
cell = row.createCell(7); //设定值
cell.setCellValue("来电日期");
cell = row.createCell(8); //设定值
cell.setCellValue("返回日期");
cell = row.createCell(9); //设定值
cell.setCellValue("备注");
for (int i =0;i<redoRegistrationEntities.size();i++){
RedoRegistrationEntity redoRegistrationEntity = redoRegistrationEntities.get(i);
row = sheet.createRow(i + 1);
cell = row.createCell(0); //设定值
cell.setCellValue(redoRegistrationEntity.getRedoRegistrationId());
cell = row.createCell(1); //设定值
cell.setCellValue(redoRegistrationEntity.getSubmitDate());
cell = row.createCell(2); //设定值
cell.setCellValue(redoRegistrationEntity.getCountyCode());
cell = row.createCell(3); //设定值
cell.setCellValue(redoRegistrationEntity.getPoliceCode());
cell = row.createCell(4); //设定值
cell.setCellValue(redoRegistrationEntity.getName());
cell = row.createCell(5); //设定值
cell.setCellValue(redoRegistrationEntity.getCardId());
cell = row.createCell(6); //设定值
cell.setCellValue(redoRegistrationEntity.getRedoReason());
cell = row.createCell(7); //设定值
cell.setCellValue(redoRegistrationEntity.getCallDate());
cell = row.createCell(8); //设定值
cell.setCellValue(redoRegistrationEntity.getBackDate());
cell = row.createCell(9); //设定值
cell.setCellValue(redoRegistrationEntity.getNote());
}
//第六步将生成excel文件保存到指定路径下
FileOutputStream fout = null;
try {
// fout = new FileOutputStream("E:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls");
fout = new FileOutputStream("D:\\Excel\\" + simpleDateFormat.format(new Date())+ "重做登记信息表" + ".xls");
wb.write(fout);
fout.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Excel文件生成成功..." + new Date());
// return "E:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "D:\\Excel\\" + simpleDateFormat.format(new Date()) + "重做登记信息表" + ".xls";
}
}
package com.yxproject.start.utils;
//import com.yingxin.hibernate.domain.ProductionEntity;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class IDCardFactory {
// public void extractIDCard(String file) throws Exception{
// ArrayList<ProductionEntity> arrayList = new ArrayList<ProductionEntity>();
// try {
// Document document = DocumentHelper.parseText(file);
// Element root = document.getRootElement();
// Element packagehead = root.element("PACKAGEHEAD");
// String SJBBH = packagehead.element("SJBBH").getTextTrim();
// Element records = root.element("DATA");
// List<Element> recordlist = records.elements("RECORD");
// int checknum=0;
// for (Element e : recordlist) {
// Element chileEle = e;
// String SID = e.attributeValue("sid");
// String JMSFZSLH = chileEle.element("JMSFZSLH").getTextTrim();
// String GMSFHM = chileEle.element("GMSFHM").getTextTrim();
// String XM = chileEle.element("XM").getTextTrim();
// String XBDM = chileEle.element("XBDM").getTextTrim();
// String MZDM = chileEle.element("MZDM").getTextTrim();
// String CSRQ = chileEle.element("CSRQ").getTextTrim();
// String SSXQDM = chileEle.element("SSXQDM").getTextTrim();
// String DZMC = chileEle.element("DZMC").getTextTrim();
// String SDXP = chileEle.element("SDXP").getTextTrim();
// String ZWY_ZWTXSJ = chileEle.element("ZWY_ZWTXSJ").getTextTrim();
// ProductionEntity production = new ProductionEntity();
// production.setSid(SID);
// production.setJmsfzslh(JMSFZSLH);
// production.setGmsfhm(GMSFHM);
// production.setXm(XM);
// production.setXbdm(XBDM);
// production.setMzdm(MZDM);
// production.setCsrq(CSRQ);
// production.setSsxqdm(SSXQDM);
// production.setDzmc(DZMC);
// production.setSdxp(removeStr(SDXP));
// production.setZwyZwtxsj(ZWY_ZWTXSJ);
// String ZWY_ZWTZSJ = chileEle.element("ZWY_ZWTZSJ").getTextTrim();
// production.setZwyZwtzsj(ZWY_ZWTZSJ);
// String ZWE_ZWTXSJ = chileEle.element("ZWE_ZWTXSJ").getTextTrim();
// production.setZweZwtxsj(ZWE_ZWTXSJ);
// String ZWE_ZWTZSJ = chileEle.element("ZWE_ZWTZSJ").getTextTrim();
// production.setZweZwtzsj(ZWE_ZWTZSJ);
// String QFJG_GAJGMC = chileEle.element("QFJG_GAJGMC").getTextTrim();
// production.setQfjgGajgmc(QFJG_GAJGMC);
// String YXQQSRQ = chileEle.element("YXQQSRQ").getTextTrim();
// production.setYxqqsrq(YXQQSRQ);
// String YXQJZRQ = chileEle.element("YXQJZRQ").getTextTrim();
// production.setYxqjzrq(YXQJZRQ);
// String JMSFZSLYYDM = chileEle.element("JMSFZSLYYDM").getTextTrim();
// production.setJmsfzslyydm(JMSFZSLYYDM);
// String JMSFZZZLXDM = chileEle.element("JMSFZZZLXDM").getTextTrim();
// production.setJmsfzzzlxdm(JMSFZZZLXDM);
// production.setYxLczt(0);
// String JMSFZLZFSDM = chileEle.element("JMSFZLZFSDM").getTextTrim();
// production.setJmsfzlzfsdm(JMSFZLZFSDM);
// String SJR_XM = chileEle.element("SJR_XM").getTextTrim();
// production.setSjrXm(SJR_XM);
// String SJR_LXDH = chileEle.element("SJR_LXDH").getTextTrim();
// production.setSjrLxdh(SJR_LXDH);
// String SJR_YZBM = chileEle.element("SJR_YZBM").getTextTrim();
// production.setSjrYzbm(SJR_YZBM);
// production.setYxSjbh(SJBBH);
// String SJR_TXDZ = chileEle.element("SJR_TXDZ").getTextTrim();
// production.setSjrTxdz(SJR_TXDZ);
// production.setYxZpzlfk("0");
// arrayList.add(production);
// checknum++;
//
// }
// SpecialpackageEntity specialpackage = new SpecialpackageEntity();
// String BBH = packagehead.element("BBH").getTextTrim();
// specialpackage.setBbh(BBH);
//
// String DWDM = packagehead.element("DWDM").getTextTrim();
// specialpackage.setDwdm(DWDM);
// String DWMC = packagehead.element("DWMC").getTextTrim();
// specialpackage.setDwmc(DWMC);
//
// String JLS = packagehead.element("JLS").getTextTrim();
// specialpackage.setJls(JLS);
// specialpackage.setCount(0);
// String SCSJ = packagehead.element("SCSJ").getTextTrim();
// specialpackage.setScsj(SCSJ);
// specialpackage.setSjbbh(SJBBH);
// specialpackage.setChecknum(checknum);
// Manager manager = (Manager) SpringBeanUtil.getContext().getBean("manager");
// manager.saveProductionEntityByList(arrayList);
// manager.saveSpecialpackageBySpecialpackageEntity(specialpackage);
// } catch (DocumentException e) {
// throw e;
// }
// }
/**
* 解析xml文件
*
* @param file xml文件
* @return 返回xml包Map
* @throws Exception
*/
public Map<String, Object> extractIDCard(String file) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
List<Map<String, Object>> personMapList = new ArrayList<Map<String, Object>>();
try {
Document document = DocumentHelper.parseText(file);
Element root = document.getRootElement();
Element packagehead = root.element("PACKAGEHEAD");
String SJBBH = packagehead.element("SJBBH").getTextTrim();
Element records = root.element("DATA");
List<Element> recordlist = records.elements("RECORD");
int checknum = 0;
for (Element e : recordlist) {
Map<String, Object> personMap = new HashMap<String, Object>();
Element chileEle = e;
personMap.put("sid", e.attributeValue("sid"));
List<Element> personElement = chileEle.elements();
for (Element element : personElement) {
personMap.put(element.getName(), element.getStringValue());
}
// personMap.put("JMSFZSLH",chileEle.element("JMSFZSLH").getTextTrim());
// personMap.put("GMSFHM",chileEle.element("GMSFHM").getTextTrim());
// personMap.put("XM",chileEle.element("XM").getTextTrim());
// personMap.put("XBDM",chileEle.element("XBDM").getTextTrim());
// personMap.put("MZDM",chileEle.element("MZDM").getTextTrim());
// personMap.put("CSRQ",chileEle.element("CSRQ").getTextTrim());
// personMap.put("SSXQDM",chileEle.element("SSXQDM").getTextTrim());
// personMap.put("DZMC",chileEle.element("DZMC").getTextTrim());
// personMap.put("SDXP",chileEle.element("SDXP").getTextTrim());
// personMap.put("ZWY_ZWTXSJ",chileEle.element("ZWY_ZWTXSJ").getTextTrim());
// personMap.put("ZWY_ZWTZSJ",chileEle.element("ZWY_ZWTZSJ").getTextTrim());
// personMap.put("ZWE_ZWTXSJ",chileEle.element("ZWE_ZWTXSJ").getTextTrim());
// personMap.put("ZWE_ZWTZSJ",chileEle.element("ZWE_ZWTZSJ").getTextTrim());
// personMap.put("QFJG_GAJGMC",chileEle.element("QFJG_GAJGMC").getTextTrim());
// personMap.put("YXQQSRQ",chileEle.element("YXQQSRQ").getTextTrim());
// personMap.put("YXQJZRQ",chileEle.element("YXQJZRQ").getTextTrim());
// personMap.put("JMSFZSLYYDM",chileEle.element("JMSFZSLYYDM").getTextTrim());
// personMap.put("JMSFZZZLXDM",chileEle.element("JMSFZZZLXDM").getTextTrim());
// personMap.put("YX_LCZT",0);
// personMap.put("JMSFZLZFSDM",chileEle.element("JMSFZLZFSDM").getTextTrim());
// personMap.put("SJR_XM",chileEle.element("SJR_XM").getTextTrim());
// personMap.put("SJR_LXDH",chileEle.element("SJR_LXDH").getTextTrim());
// personMap.put("SJR_YZBM",chileEle.element("SJR_YZBM").getTextTrim());
// personMap.put("SJBBH",SJBBH);
// personMap.put("SJR_TXDZ",chileEle.element("SJR_TXDZ").getTextTrim());
// personMap.put("YXZPZLFK","0");
personMapList.add(personMap);
checknum++;
}
Map<String, Object> packageMap = new HashMap<String, Object>();
packageMap.put("BBH", packagehead.element("BBH").getTextTrim());
packageMap.put("DWDM", packagehead.element("DWDM").getTextTrim());
packageMap.put("DWMC", packagehead.element("DWMC").getTextTrim());
packageMap.put("JLS", packagehead.element("JLS").getTextTrim());
packageMap.put("COUNT", 0);
packageMap.put("SCSJ", packagehead.element("SCSJ").getTextTrim());
packageMap.put("SJBBH", SJBBH);
packageMap.put("checknum", checknum);
map.put("package", packageMap);
map.put("person", personMapList);
} catch (DocumentException e) {
throw e;
}
return map;
}
// public void extractSoldierIDCard(String file) throws Exception {
// ArrayList<ProductionEntity> arrayList = new ArrayList<ProductionEntity>();
// try {
// Document document = DocumentHelper.parseText(file);
// Element root = document.getRootElement();
// Element packagehead = root.element("PackageHead");
// String SJBBH = packagehead.element("SJBBH").getTextTrim();
// String SJBLX = packagehead.element("SJBLX").getTextTrim();
//
// Element records = root.element("Data");
// List<Element> recordlist = records.elements("Record");
// int checknum = 0;
// for (Element e : recordlist) {
// Element chileEle = e;
// String JMSFZSLH = chileEle.element("CzrkSlh").getTextTrim();
// String GMSFHM = chileEle.element("CzrkGmsfhm").getTextTrim();
// String XM = chileEle.element("CzrkXm").getTextTrim();
// String XBDM = chileEle.element("CzrkXb").getTextTrim();
// String MZDM = chileEle.element("CzrkMz").getTextTrim();
// String CSRQ = chileEle.element("CzrkCsrq").getTextTrim();
// String SSXQDM = chileEle.element("CzrkSsqx").getTextTrim();
// String DZMC = chileEle.element("CzrkZz").getTextTrim();
// String SDXP = chileEle.element("CzrkSdzp").getTextTrim();
// ProductionEntity production = new ProductionEntity();
// production.setSjblx(SJBLX);
// production.setJmsfzslh(JMSFZSLH);
// production.setGmsfhm(GMSFHM);
// production.setXm(XM);
// production.setXbdm(XBDM);
// production.setMzdm(MZDM);
// production.setCsrq(CSRQ);
// production.setSsxqdm(SSXQDM);
// production.setDzmc(DZMC);
// production.setSdxp(removeStr(SDXP));
// String QFJG_GAJGMC = chileEle.element("CzrkQfjg").getTextTrim();
// production.setQfjgGajgmc(QFJG_GAJGMC);
// String YXQQSRQ = chileEle.element("CzrkYxqxqsrq").getTextTrim();
// production.setYxqqsrq(YXQQSRQ);
// String YXQJZRQ = chileEle.element("CzrkYxqxjzrq").getTextTrim();
// production.setYxqjzrq(YXQJZRQ);
// String JMSFZSLYYDM = chileEle.element("CzrkSlyy").getTextTrim();
// production.setJmsfzslyydm(JMSFZSLYYDM);
// String JMSFZZZLXDM = chileEle.element("CzrkZzlx").getTextTrim();
// production.setJmsfzzzlxdm(JMSFZZZLXDM);
// production.setYxLczt(0);
// String JMSFZLZFSDM = chileEle.element("CzrkLzfs").getTextTrim();
// production.setJmsfzlzfsdm(JMSFZLZFSDM);
// String SJR_XM = chileEle.element("CzrkSjrxm").getTextTrim();
// production.setSjrXm(SJR_XM);
// String SJR_LXDH = chileEle.element("CzrkSjrlxdh").getTextTrim();
// production.setSjrLxdh(SJR_LXDH);
// String SJR_YZBM = chileEle.element("CzrkSjryb").getTextTrim();
// production.setSjrYzbm(SJR_YZBM);
// production.setYxSjbh(SJBBH);
// String SJR_TXDZ = chileEle.element("CzrkSjrtxdz").getTextTrim();
// production.setSjrTxdz(SJR_TXDZ);
// production.setYxZpzlfk("0");
// arrayList.add(production);
// checknum++;
//
// }
// SpecialpackageEntity specialpackage = new SpecialpackageEntity();
// String BBH = packagehead.element("BBH").getTextTrim();
// specialpackage.setBbh(BBH);
// String DWDM = packagehead.element("DWDM").getTextTrim();
// specialpackage.setDwdm(DWDM);
// String DWMC = packagehead.element("DWMC").getTextTrim();
// specialpackage.setDwmc(DWMC);
// String JLS = packagehead.element("JLS").getTextTrim();
// specialpackage.setJls(JLS);
// specialpackage.setCount(0);
// String SCSJ = packagehead.element("FSSJ").getTextTrim();
// specialpackage.setScsj(SCSJ);
// specialpackage.setSjbbh(SJBBH);
// specialpackage.setChecknum(checknum);
// Manager manager = (Manager) SpringBeanUtil.getContext().getBean("manager");
// manager.saveProductionEntityByList(arrayList);
// manager.saveSpecialpackageBySpecialpackageEntity(specialpackage);
// } catch (DocumentException e) {
// throw e;
// }
// }
// public Map<String, Object> extractSoldierIDCard(String file) throws Exception {
// Map<String, Object> map = new HashMap<String, Object>();
// List<Map<String, Object>> personMapList = new ArrayList<Map<String, Object>>();
// ArrayList<ProductionEntity> arrayList = new ArrayList<ProductionEntity>();
// try {
// Document document = DocumentHelper.parseText(file);
// Element root = document.getRootElement();
// Element packagehead = root.element("PackageHead");
// String SJBBH = packagehead.element("SJBBH").getTextTrim();
// String SJBLX = packagehead.element("SJBLX").getTextTrim();
// Element records = root.element("Data");
// List<Element> recordlist = records.elements("Record");
// int checknum = 0;
// for (Element chileEle : recordlist) {
// Map<String, Object> personMap = new HashMap<String, Object>();
// personMap.put("JMSFZSLH", chileEle.element("CzrkSlh").getTextTrim());
// personMap.put("GMSFHM", chileEle.element("CzrkGmsfhm").getTextTrim());
// personMap.put("XM", chileEle.element("CzrkXm").getTextTrim());
// personMap.put("XBDM", chileEle.element("CzrkXb").getTextTrim());
// personMap.put("MZDM", chileEle.element("CzrkMz").getTextTrim());
// personMap.put("CSRQ", chileEle.element("CzrkCsrq").getTextTrim());
// personMap.put("SSXQDM", chileEle.element("CzrkSsqx").getTextTrim());
// personMap.put("DZMC", chileEle.element("CzrkZz").getTextTrim());
// personMap.put("SDXP", chileEle.element("CzrkSdzp").getTextTrim());
// personMap.put("QFJG_GAJGMC", chileEle.element("CzrkQfjg").getTextTrim());
// personMap.put("YXQQSRQ", chileEle.element("CzrkYxqxqsrq").getTextTrim());
// personMap.put("YXQJZRQ", chileEle.element("CzrkYxqxjzrq").getTextTrim());
// personMap.put("JMSFZSLYYDM", chileEle.element("CzrkSlyy").getTextTrim());
// personMap.put("JMSFZZZLXDM", chileEle.element("CzrkZzlx").getTextTrim());
// personMap.put("JMSFZLZFSDM", chileEle.element("CzrkLzfs").getTextTrim());
// personMap.put("SJR_XM", chileEle.element("CzrkSjrxm").getTextTrim());
// personMap.put("SJR_LXDH", chileEle.element("CzrkSjrlxdh").getTextTrim());
// personMap.put("SJR_YZBM", chileEle.element("CzrkSjryb").getTextTrim());
// personMap.put("SJR_TXDZ", chileEle.element("CzrkSjrtxdz").getTextTrim());
// personMapList.add(personMap);
// checknum++;
// }
// Map<String, Object> packageMap = new HashMap<String, Object>();
// packageMap.put("BBH", packagehead.element("BBH").getTextTrim());
// packageMap.put("DWDM", packagehead.element("DWDM").getTextTrim());
// packageMap.put("DWMC", packagehead.element("DWMC").getTextTrim());
// packageMap.put("JLS", packagehead.element("JLS").getTextTrim());
// packageMap.put("COUNT", 0);
// packageMap.put("SCSJ", packagehead.element("FSSJ").getTextTrim());
// packageMap.put("SJBBH", SJBBH);
// packageMap.put("checknum", checknum);
// map.put("package", packageMap);
// map.put("person", personMapList);
//
// } catch (DocumentException e) {
// throw e;
// }
// return map;
// }
public String removeStr(String string) {
String str = string.replace("&#xD; ", "");
return str;
}
}
//package com.yxproject.start.utils;
//
//
//import com.yingxin.framework.config.YXServerConfig;
//import com.yingxin.framework.utils.SpringBeanUtil;
//import com.yingxin.framework.utils.YXStringUtils;
//import com.yingxin.hibernate.domain.NewPackageInfoEntity;
//import com.yingxin.hibernate.domain.ProductionEntity;
//import com.yingxin.hibernate.domain.SpecialpackageEntity;
//import com.yingxin.hibernate.service.Manager;
//import org.dom4j.*;
//
//import java.io.*;
//import java.text.SimpleDateFormat;
//import java.util.*;
//
//public class IDCardXmlUtils {
// static Manager manager = (Manager) SpringBeanUtil.getContext().getBean("manager");
//
// /**
// * 生成单个可制证数据XML
// *
// * @throws IOException 可能出现文件写入不成功
// */
// public static void createToMakePackageXML(Map<String, Object> map ,String url) throws IOException {
// Map<String, Object> packageMap = (Map<String, Object>) map.get("package");
// List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("list");
// Document document = DocumentHelper.createDocument();
// Element PACKAGE = DocumentHelper.createElement("PACKAGE");
// document.setRootElement(PACKAGE);
// Element PACKAGEHEAD = PACKAGE.addElement("PACKAGEHEAD");
// Element DATA = PACKAGE.addElement("DATA");
//
// Element BBH = PACKAGEHEAD.addElement("BBH");
// BBH.setText(((String) packageMap.get("BBH")));
// Element DWDM = PACKAGEHEAD.addElement("DWDM");
// DWDM.setText(((String) packageMap.get("DWDM")));
// Element DWMC = PACKAGEHEAD.addElement("DWMC");
// DWMC.setText(((String) packageMap.get("DWMC")));
// Element JLS = PACKAGEHEAD.addElement("JLS");
// JLS.setText(packageMap.get("JLS").toString());
// Element SCSJ = PACKAGEHEAD.addElement("SCSJ");
// SCSJ.setText(((String) packageMap.get("SCSJ")));
// Element SJBBH = PACKAGEHEAD.addElement("SJBBH");
// SJBBH.setText(((String) packageMap.get("SJBBH")));
//
//
// NewPackageInfoEntity newPackageInfoEntity = new NewPackageInfoEntity();
// newPackageInfoEntity.setPackagenum(((String) packageMap.get("SJBBH")));
// newPackageInfoEntity.setCreatedata(((String) packageMap.get("SCSJ")));
// newPackageInfoEntity.setCreatename("2222222");
// manager.saveNewPackageNum(newPackageInfoEntity);
// for (Map<String, Object> map1 : list) {
// Element RECORD = DATA.addElement("RECORD");
// RECORD.addAttribute("no", map1.get("no") + "");
// RECORD.addAttribute("sid", ((String) map1.get("sid")).replaceAll(" ", ""));
// Element JMSFZSLH = RECORD.addElement("JMSFZSLH");
// JMSFZSLH.setText(((String) map1.get("JMSFZSLH")));
// Element GMSFHM = RECORD.addElement("GMSFHM");
// GMSFHM.setText(((String) map1.get("GMSFHM")));
// Element XM = RECORD.addElement("XM");
// XM.setText(replaceNullString((String) map1.get("XM")));
// Element XBDM = RECORD.addElement("XBDM");
// XBDM.setText(replaceNullString((String) map1.get("XBDM")));
// Element MZDM = RECORD.addElement("MZDM");
// MZDM.setText(replaceNullString((String) map1.get("MZDM")));
// Element CSRQ = RECORD.addElement("CSRQ");
// CSRQ.setText(replaceNullString((String) map1.get("CSRQ")));
// Element SSXQDM = RECORD.addElement("SSXQDM");
// SSXQDM.setText(replaceNullString((String) map1.get("SSXQDM")));
// Element DZMC = RECORD.addElement("DZMC");
// DZMC.setText(replaceNullString((String) map1.get("DZMC")));
// Element SDXP = RECORD.addElement("SDXP");
// SDXP.setText(replaceNullString((String) map1.get("SDXP")));
// Element ZWY_ZWTXSJ = RECORD.addElement("ZWY_ZWTXSJ");
// ZWY_ZWTXSJ.setText(replaceNullString((String) map1.get("ZWY_ZWTXSJ")));
// Element ZWY_ZWTZSJ = RECORD.addElement("ZWY_ZWTZSJ");
// ZWY_ZWTZSJ.setText(replaceNullString((String) map1.get("ZWY_ZWTZSJ")));
// Element ZWE_ZWTXSJ = RECORD.addElement("ZWE_ZWTXSJ");
// ZWE_ZWTXSJ.setText(replaceNullString((String) map1.get("ZWE_ZWTXSJ")));
// Element ZWE_ZWTZSJ = RECORD.addElement("ZWE_ZWTZSJ");
// ZWE_ZWTZSJ.setText(replaceNullString((String) map1.get("ZWE_ZWTZSJ")));
// Element QFJG_GAJGMC = RECORD.addElement("QFJG_GAJGMC");
// QFJG_GAJGMC.setText(replaceNullString((String) map1.get("QFJG_GAJGMC")));
// Element YXQQSRQ = RECORD.addElement("YXQQSRQ");
// YXQQSRQ.setText(replaceNullString((String) map1.get("YXQQSRQ")));
// Element YXQJZRQ = RECORD.addElement("YXQJZRQ");
// YXQJZRQ.setText(replaceNullString((String) map1.get("YXQJZRQ")).replaceAll(" ",""));
// Element JMSFZSLYYDM = RECORD.addElement("JMSFZSLYYDM");
// JMSFZSLYYDM.setText(replaceNullString((String) map1.get("JMSFZSLYYDM")));
// Element JMSFZZZLXDM = RECORD.addElement("JMSFZZZLXDM");
// JMSFZZZLXDM.setText(replaceNullString((String) map1.get("JMSFZZZLXDM")));
// Element JMSFZLZFSDM = RECORD.addElement("JMSFZLZFSDM");
// JMSFZLZFSDM.setText(replaceNullString((String) map1.get("JMSFZLZFSDM")));
// Element SJR_XM = RECORD.addElement("SJR_XM");
// SJR_XM.setText(replaceNullString((String) map1.get("SJR_XM")));
// Element SJR_LXDH = RECORD.addElement("SJR_LXDH");
// SJR_LXDH.setText(replaceNullString((String) map1.get("SJR_LXDH")));
// Element SJR_YZBM = RECORD.addElement("SJR_YZBM");
// SJR_YZBM.setText(replaceNullString((String) map1.get("SJR_YZBM")));
// Element SJR_TXDZ = RECORD.addElement("SJR_TXDZ");
// SJR_TXDZ.setText(replaceNullString((String) map1.get("SJR_TXDZ")));
// }
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String date = simpleDateFormat.format(new Date());
//
// YXStringUtils.saveDom2File(document, url + "\\" + "ZAGL_ZZJH_" + packageMap.get("SJBBH") + ".xml");
//
// }
//
//
// /**
// * 生成单个可制证军人证数据XML
// *
// * @throws IOException 可能出现文件写入不成功
// */
// public static void createToMakePackageSoldierXML(Map<String, Object> map,String url) throws IOException {
// Map<String, Object> packageMap = (Map<String, Object>) map.get("package");
// List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("list");
// Document document = DocumentHelper.createDocument();
// Element PACKAGE = DocumentHelper.createElement("Package");
// document.setRootElement(PACKAGE);
// Element PACKAGEHEAD = PACKAGE.addElement("PackageHead");
// Element DATA = PACKAGE.addElement("Data");
// Element BBH = PACKAGEHEAD.addElement("BBH");
// BBH.setText(((String) packageMap.get("BBH")));
// Element SJBBH = PACKAGEHEAD.addElement("SJBBH");
// SJBBH.setText(((String) packageMap.get("SJBBH")));
// Element SJBLX = PACKAGEHEAD.addElement("SJBLX");
// SJBLX.setText("63");
// Element DWDM = PACKAGEHEAD.addElement("DWDM");
// DWDM.setText(((String) packageMap.get("DWDM")));
// Element DWMC = PACKAGEHEAD.addElement("DWMC");
// DWMC.setText(((String) packageMap.get("DWMC")));
// Element SCSJ = PACKAGEHEAD.addElement("FSSJ");
// SCSJ.setText(((String) packageMap.get("SCSJ")));
// Element JLS = PACKAGEHEAD.addElement("JLS");
// JLS.setText(packageMap.get("JLS").toString());
// NewPackageInfoEntity newPackageInfoEntity = new NewPackageInfoEntity();
// newPackageInfoEntity.setPackagenum(((String) packageMap.get("SJBBH")));
// newPackageInfoEntity.setCreatedata(((String) packageMap.get("SCSJ")));
// newPackageInfoEntity.setCreatename("2222222");
// manager.saveNewPackageNum(newPackageInfoEntity);
// for (Map<String, Object> map1 : list) {
// Element RECORD = DATA.addElement("Record");
// Element JMSFZSLH = RECORD.addElement("CzrkSlh");
// JMSFZSLH.setText(((String) map1.get("JMSFZSLH")));
// Element GMSFHM = RECORD.addElement("CzrkGmsfhm");
// GMSFHM.setText(((String) map1.get("GMSFHM")));
// Element XM = RECORD.addElement("CzrkXm");
// XM.setText(replaceNullString((String) map1.get("XM")));
// Element XBDM = RECORD.addElement("CzrkXb");
// XBDM.setText(replaceNullString((String) map1.get("XBDM")));
// Element CSRQ = RECORD.addElement("CzrkCsrq");
// CSRQ.setText(replaceNullString((String) map1.get("CSRQ")));
// Element MZDM = RECORD.addElement("CzrkMz");
// MZDM.setText(replaceNullString((String) map1.get("MZDM")));
// Element SSXQDM = RECORD.addElement("CzrkSsqx");
// SSXQDM.setText(replaceNullString((String) map1.get("SSXQDM")));
// Element DZMC = RECORD.addElement("CzrkZz");
// DZMC.setText(replaceNullString((String) map1.get("DZMC")));
// Element QFJG_GAJGMC = RECORD.addElement("CzrkQfjg");
// QFJG_GAJGMC.setText(replaceNullString((String) map1.get("QFJG_GAJGMC")));
// Element YXQQSRQ = RECORD.addElement("CzrkYxqxqsrq");
// YXQQSRQ.setText(replaceNullString((String) map1.get("YXQQSRQ")));
// Element YXQJZRQ = RECORD.addElement("CzrkYxqxjzrq");
// YXQJZRQ.setText(replaceNullString((String) map1.get("YXQJZRQ")));
// Element JMSFZSLYYDM = RECORD.addElement("CzrkSlyy");
// JMSFZSLYYDM.setText(replaceNullString((String) map1.get("JMSFZSLYYDM")));
// Element JMSFZZZLXDM = RECORD.addElement("CzrkZzlx");
// JMSFZZZLXDM.setText(replaceNullString((String) map1.get("JMSFZZZLXDM")));
// Element JMSFZLZFSDM = RECORD.addElement("CzrkLzfs");
// JMSFZLZFSDM.setText(replaceNullString((String) map1.get("JMSFZLZFSDM")));
// Element SJR_XM = RECORD.addElement("CzrkSjrxm");
// SJR_XM.setText(replaceNullString((String) map1.get("SJR_XM")));
// Element SJR_LXDH = RECORD.addElement("CzrkSjrlxdh");
// SJR_LXDH.setText(replaceNullString((String) map1.get("SJR_LXDH")));
// Element SJR_YZBM = RECORD.addElement("CzrkSjryb");
// SJR_YZBM.setText(replaceNullString((String) map1.get("SJR_YZBM")));
// Element SJR_TXDZ = RECORD.addElement("CzrkSjrtxdz");
// SJR_TXDZ.setText(replaceNullString((String) map1.get("SJR_TXDZ")));
// Element SDXP = RECORD.addElement("CzrkSdzp");
// SDXP.setText(replaceNullString((String) map1.get("SDXP")));
//
// }
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String date = simpleDateFormat.format(new Date());
// YXStringUtils.saveDom2File(document, url + "\\" + "TEST_SOLDIER_" + packageMap.get("SJBBH") + ".xml");
//
// }
//
//
// /**
// * 生成单个质量回馈数据XML
// *
// * @param list 质量回馈数据
// * @param idx 数据包编号
// * @throws IOException
// */
// public static void createToBackPackageXML(List<ProductionEntity> list, int idx) throws IOException {
//
// Document document = DocumentHelper.createDocument();
// Element PACKAGE = DocumentHelper.createElement("PACKAGE");
// document.setRootElement(PACKAGE);
//
// Element PACKAGEHEAD = PACKAGE.addElement("PACKAGEHEAD");
// Element DATA = PACKAGE.addElement("DATA");
//
// Element BBH = PACKAGEHEAD.addElement("BBH");
// BBH.setText("3.00");
// Element DWDM = PACKAGEHEAD.addElement("DWDM");
// DWDM.setText("410000000000");
// Element DWMC = PACKAGEHEAD.addElement("DWMC");
// DWMC.setText("河南省公安厅1");
// Element JLS = PACKAGEHEAD.addElement("JLS");
// JLS.setText(String.valueOf(list.size()));
//
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String date = simpleDateFormat.format(new Date());
//
// String zero = "00000";
// int len = String.valueOf(idx).length();
// String pkgNumber = "410000000000" + date + zero.substring(0, zero.length() - len) + String.valueOf(idx + 1);
// Element SCSJ = PACKAGEHEAD.addElement("SCSJ");
// SCSJ.setText(date);
// Element SJBBH = PACKAGEHEAD.addElement("SJBBH");
// SJBBH.setText(pkgNumber);
// for (int j = 0; j < list.size(); j++) {
//
// ProductionEntity production = list.get(j);
// Element RECORD = DATA.addElement("RECORD");
// RECORD.addAttribute("no", String.valueOf(j + 1));
// RECORD.addAttribute("sid", production.getSid().replaceAll(" ", ""));
// Element JMSFZSLH = RECORD.addElement("JMSFZSLH");
// JMSFZSLH.setText(replaceNullString(production.getJmsfzslh()));
// Element GMSFHM = RECORD.addElement("GMSFHM");
// GMSFHM.setText(replaceNullString(production.getGmsfhm()));
// Element XM = RECORD.addElement("XM");
// XM.setText(replaceNullString(production.getXm()));
// Element JMSFZZZXXCWLBDM = RECORD.addElement("JMSFZZZXXCWLBDM");
// JMSFZZZXXCWLBDM.setText(replaceNullString(production.getYxZpzlfk()));
// Element CWMS_JYQK = RECORD.addElement("CWMS_JYQK");
// CWMS_JYQK.setText("相片不合格");
// Element JYDW_GAJGJGDM = RECORD.addElement("JYDW_GAJGJGDM");
// JYDW_GAJGJGDM.setText("410000000000");
// Element JYDW_GAJGMC = RECORD.addElement("JYDW_GAJGMC");
// JYDW_GAJGMC.setText("河南省公安厅1");
// Element JYR_XM = RECORD.addElement("JYR_XM");
// JYR_XM.setText("yy");
// Element JYRQ = RECORD.addElement("JYRQ");
// JYRQ.setText(date);
//
//
// production.setYxLczt(-4);
// production.setNewpackagenum(pkgNumber);
// manager.updataSpecialpackageByProductionEntity(production);
//
// }
// String url = YXServerConfig.FILE_TEMP_FOLDER + "/" + date;
// YXStringUtils.saveDom2File(document, url + "\\" + "TEST_BACK_" + pkgNumber + ".xml");
//
// }
//
// /**
// * 循环生成数量为80的数组
// *
// * @param list 原始数组数据
// * @return
// */
// public static List<List<ProductionEntity>> splitPackage(List<ProductionEntity> list) {
//
// int packageNum = list.size() / 80 + (((list.size() % 80 > 0) ? 1 : 0));
//
// List<List<ProductionEntity>> ls = new ArrayList();
// for (int i = 0; i < packageNum; i++) {
// List<ProductionEntity> l = new ArrayList();
// for (int j = 80 * i; j < 80 * i + 80; j++) {
// if (j < list.size()) {
// l.add(list.get(j));
// } else {
// break;
// }
// }
// ls.add(l);
// }
//
// return ls;
// }
//
//
// /**
// * 生成单个可制证的XML
// *
// * @param list
// * @param specialpackage
// * @return
// * @throws IOException
// */
// public static File createToMakeXml(List<ProductionEntity> list, SpecialpackageEntity specialpackage) throws IOException {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String date = simpleDateFormat.format(new Date());
// String url = YXServerConfig.FILE_TEMP_FOLDER + "/" + date;
// File file = new File(url);
// if (!file.exists()) {
// file.mkdirs();
// }
// List<List<ProductionEntity>> pkgarr = splitPackage(list);
// for (int i = 0; i < pkgarr.size(); i++) {
// List<ProductionEntity> pl = pkgarr.get(i);
// if (pl.get(0).getSjblx() != null) {
// createToMakePackageSoldierXML(createToMakeMap(pl, specialpackage, i),url);
// } else {
// createToMakePackageXML(createToMakeMap(pl, specialpackage, i),url);
// }
// }
// return null;
// }
//
// /**
// * 重新生成单个可制证的XML
// *
// * @param list
// * @param specialpackage
// * @return
// * @throws IOException
// */
// public static File createToMakeXmlAgain(List<ProductionEntity> list, SpecialpackageEntity specialpackage) throws IOException {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String date = simpleDateFormat.format(new Date());
// String url = YXServerConfig.FILE_AGAIN_FOLDER + "/" + date;
// File file = new File(url);
// if (!file.exists()) {
// file.mkdirs();
// }
// List<List<ProductionEntity>> pkgarr = splitPackage(list);
// for (int i = 0; i < pkgarr.size(); i++) {
// List<ProductionEntity> pl = pkgarr.get(i);
// if (pl.get(0).getSjblx() != null) {
// createToMakePackageSoldierXML(createToMakeMap(pl, specialpackage, i),url);
// } else {
// createToMakePackageXML(createToMakeMap(pl, specialpackage, i),url);
// }
// }
// return null;
// }
//
//
// public static Map<String, Object> createToMakeMap(List<ProductionEntity> list, SpecialpackageEntity specialpackageEntity, int idex) {
// Map<String, Object> map = new HashMap<String, Object>();
// Map<String, Object> packageMap = new HashMap<String, Object>();
// packageMap.put("BBH", specialpackageEntity.getBbh());
// packageMap.put("DWDM", specialpackageEntity.getDwdm());
// packageMap.put("DWMC", specialpackageEntity.getDwmc());
// packageMap.put("JLS", list.size());
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String date = simpleDateFormat.format(new Date());
// String zero = "0000";
// int len = String.valueOf(idex).length();
// String pkgNumber = specialpackageEntity.getSjbbh().substring(0, 12) + date + specialpackageEntity.getSjbbh().substring(specialpackageEntity.getSjbbh().length() - 5, specialpackageEntity.getSjbbh().length() - 4) + zero.substring(0, zero.length() - len) + String.valueOf(idex + 1);
// SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
// String date1 = simpleDateFormat1.format(new Date());
// packageMap.put("SCSJ", date1);
// packageMap.put("SJBBH", pkgNumber);
// if (list.get(0).getSjblx() != null) {
// packageMap.put("SJBLX", list.get(0).getSjblx());
// }
// List<Map<String, Object>> personList = new ArrayList<Map<String, Object>>();
// for (int j = 0; j < list.size(); j++) {
// Map<String, Object> personMap = new HashMap<String, Object>();
// if (list.get(j).getSid() != null) {
// personMap.put("sid", list.get(j).getSid());
// personMap.put("no", j + 1);
// }
// personMap.put("JMSFZSLH", list.get(j).getJmsfzslh());
// personMap.put("GMSFHM", list.get(j).getGmsfhm());
// personMap.put("XM", list.get(j).getXm());
// personMap.put("XBDM", list.get(j).getXbdm());
// personMap.put("MZDM", list.get(j).getMzdm());
// personMap.put("CSRQ", list.get(j).getCsrq());
// personMap.put("SSXQDM", list.get(j).getSsxqdm());
// personMap.put("DZMC", list.get(j).getDzmc());
// personMap.put("SDXP", list.get(j).getSdxp());
// personMap.put("ZWY_ZWTXSJ", list.get(j).getZwyZwtxsj());
// personMap.put("ZWY_ZWTZSJ", list.get(j).getZwyZwtzsj());
// personMap.put("ZWE_ZWTXSJ", list.get(j).getZweZwtxsj());
// personMap.put("ZWE_ZWTZSJ", list.get(j).getZweZwtzsj());
// personMap.put("QFJG_GAJGMC", list.get(j).getQfjgGajgmc());
// personMap.put("YXQQSRQ", list.get(j).getYxqqsrq());
// personMap.put("YXQJZRQ", list.get(j).getYxqjzrq());
// personMap.put("JMSFZSLYYDM", list.get(j).getJmsfzslyydm());
// personMap.put("JMSFZZZLXDM", list.get(j).getJmsfzzzlxdm());
// personMap.put("JMSFZLZFSDM", list.get(j).getJmsfzlzfsdm());
// personMap.put("SJR_XM", list.get(j).getSjrXm());
// personMap.put("SJR_LXDH", list.get(j).getSjrLxdh());
// personMap.put("SJR_YZBM", list.get(j).getSjrYzbm());
// personMap.put("SJR_TXDZ", list.get(j).getSjrTxdz());
// personList.add(personMap);
// ProductionEntity production = list.get(j);
// production.setYxLczt(8);
// production.setNewpackagenum(pkgNumber);
// manager.updataSpecialpackageByProductionEntity(production);
// }
// map.put("list", personList);
// map.put("package", packageMap);
//
// return map;
// }
//
// /**
// * 生成质量回馈数据XML
// *
// * @param list 原始数据
// * @return
// * @throws IOException
// */
// public static File creakeToBackXML(List<ProductionEntity> list, int num) throws IOException {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String date = simpleDateFormat.format(new Date());
// String url = YXServerConfig.FILE_TEMP_FOLDER + "/" + date;
// File file = new File(url);
// if (!file.exists()) {
// file.mkdirs();
// }
// createToBackPackageXML(list, num);
// return null;
// }
//
// /**
// * 字符串去除空格
// *
// * @param str 原始字符串
// * @return 返回新的字符串
// */
// public static String replaceNullString(String str) {
// if (str == null) return "";
// else return str;
// }
//
//
//}
package com.yxproject.start.utils;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.InputStream;
public class MybatisUtils {
public static SqlSessionFactory getFactory(){
String resource="conf.xml";
//加载mybatis 的配置文件(它也加载关联的映射文件)
InputStream is=MybatisUtils.class.getClassLoader().getResourceAsStream(resource);
//构建sqlSession 的工厂
SqlSessionFactory factory=new SqlSessionFactoryBuilder().build(is);
return factory;
}
}
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.Workbook;
import jxl.read.biff.BiffException;
/**
* Created by zhangyusheng on 2019/1/30 14:39
*/
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对象
public List readExcel(File file) {
try {
// 创建输入流,读取Excel
InputStream is = new FileInputStream(file.getAbsolutePath());
// jxl提供的Workbook类
Workbook wb = Workbook.getWorkbook(is);
// Excel的页签数量
int sheet_size = wb.getNumberOfSheets();
for (int index = 0; index < sheet_size; index++) {
List<List> outerList=new ArrayList<List>();
// 每个页签创建一个Sheet对象
Sheet sheet = wb.getSheet(index);
// sheet.getRows()返回该页的总行数
for (int i = 0; i < sheet.getRows(); i++) {
List innerList=new ArrayList();
// sheet.getColumns()返回该页的总列数
for (int j = 0; j < sheet.getColumns(); j++) {
String cellinfo = sheet.getCell(j, i).getContents();
if(cellinfo.isEmpty()){
continue;
}
innerList.add(cellinfo);
}
outerList.add(i, innerList);
}
return outerList;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
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