From d88e1dbc22a511d9b01da1a7c88dec713f1dc3ea Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 1 Nov 2022 17:17:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A3=90=E7=9F=B3=E5=AF=BC=E5=87=BA=E5=88=9D?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/IcTripReportRecordDTO.java | 32 ++-- .../IcTripReportRecordController.java | 8 +- .../IcPsTripReportRecordExportExcel.java | 157 ++++++++++++++++++ 3 files changed, 178 insertions(+), 19 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java index b3d8819d76..09134872c2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java @@ -66,14 +66,14 @@ public class IcTripReportRecordDTO implements Serializable { * 姓名 */ @ColumnWidth(15) - @ExcelProperty("姓名") + @ExcelProperty(value = "姓名", order = 1) private String name; /** * 手机号 */ @ColumnWidth(15) - @ExcelProperty("手机号") + @ExcelProperty(value = "手机号",order = 3) private String mobile; /** @@ -85,7 +85,7 @@ public class IcTripReportRecordDTO implements Serializable { * 身份证号 */ @ColumnWidth(22) - @ExcelProperty("证件号") + @ExcelProperty(value = "证件号",order = 2) private String idCard; /** @@ -121,14 +121,14 @@ public class IcTripReportRecordDTO implements Serializable { * 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区 */ @ColumnWidth(50) - @ExcelProperty("现居地") + @ExcelProperty(value = "现居地",order = 4) private String presentAddress; /** * 详细地址 */ @ColumnWidth(35) - @ExcelProperty("现居地详细地址") + @ExcelProperty(value = "现居地详细地址",order = 5) private String detailAddress; /** @@ -147,14 +147,14 @@ public class IcTripReportRecordDTO implements Serializable { * 来源地区地址 */ @ColumnWidth(50) - @ExcelProperty("来自地区") + @ExcelProperty(value = "来自地区",order = 6) private String sourceAddress; /** * 到达日期 */ @ColumnWidth(25) - @ExcelProperty("来到本地时间") + @ExcelProperty(value = "来到本地时间",order = 8) @JsonFormat(pattern = "yyyy-MM-dd") private Date arriveDate; @@ -162,7 +162,7 @@ public class IcTripReportRecordDTO implements Serializable { * 离开日期 */ @ColumnWidth(25) - @ExcelProperty("离开本地时间") + @ExcelProperty(value = "离开本地时间",order = 13) @JsonFormat(pattern = "yyyy-MM-dd") private Date leaveDate; @@ -170,7 +170,7 @@ public class IcTripReportRecordDTO implements Serializable { * pc行程上报-列表返参:最近一次通知时间 */ @ColumnWidth(25) - @ExcelProperty("最近一次通知时间") + //@ExcelProperty("最近一次通知时间") @JsonFormat(pattern = "yyyy-MM-dd") private Date latestNoticeTime; @@ -178,7 +178,7 @@ public class IcTripReportRecordDTO implements Serializable { * 备注信息 */ @ColumnWidth(100) - @ExcelProperty("备注") + @ExcelProperty(value = "备注",order = 14) private String remark; /** @@ -242,17 +242,19 @@ public class IcTripReportRecordDTO implements Serializable { * 交通方式-中国字 */ @ColumnWidth(50) - @ExcelProperty("返回方式") + @ExcelProperty(value = "返回方式",order = 9) private String trafficTypeName; /** * 其他返回方式,交通方式为其他时此列需要有值 */ @ColumnWidth(50) - @ExcelProperty("其他返回方式") + @ExcelProperty(value = "其他返回方式",order = 10) private String trafficTypeExplain; /** - * 来源地详细信息 source_address字段的说明 + * 来自地区详细地址 source_address字段的说明 */ + @ColumnWidth(25) + @ExcelProperty(value = "来自地区详细地址",order = 7) private String sourceDetailAddress; /** * 疫苗接种针次 (0 1 2 3)【小寨子】 @@ -262,7 +264,7 @@ public class IcTripReportRecordDTO implements Serializable { * 疫苗接种针次 -中国字(0针 1针 2针 3针) */ @ColumnWidth(50) - @ExcelProperty("疫苗接种针次") + @ExcelProperty(value = "疫苗接种针次",order = 12) private String vaccineNumName; /** * 是否有48小时核算记录 0:否 1:是 【小寨子】 @@ -272,7 +274,7 @@ public class IcTripReportRecordDTO implements Serializable { * 是否有48小时核算记录 0:否 1:是 【小寨子】-中国字 */ @ColumnWidth(50) - @ExcelProperty("48小时核酸检测") + @ExcelProperty(value = "48小时核酸检测",order = 11) private String isNatRecordName; /** * 户籍地 【磐石】 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index 185189cfb7..daa1b388b2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java @@ -27,6 +27,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.EmphasisTripListResultDTO; import com.epmet.dto.result.EmphasisTripPieDetailResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.excel.IcPsTripReportRecordExportExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcTripReportRecordService; import lombok.extern.slf4j.Slf4j; @@ -376,8 +377,6 @@ public class IcTripReportRecordController implements ResultDataResolver { public void psEexport(@LoginUser TokenDto tokenDto, @RequestBody PageTripReportFormDTO formDTO, HttpServletResponse response) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); - // formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); - // formDTO.setUserId("35005df15fb0f7c791344f0b424870b7"); formDTO.setIsPage(false); ExcelWriter excelWriter = null; formDTO.setPageSize(NumConstant.TEN_THOUSAND); @@ -389,16 +388,17 @@ public class IcTripReportRecordController implements ResultDataResolver { excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcTripReportRecordDTO.class).build(); WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); PageData data = null; + List list = null; do { data = icTripReportRecordService.page(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), IcPsTripReportRecordExportExcel.class); formDTO.setPageNo(++pageNo); - excelWriter.write(data.getList(), writeSheet); + excelWriter.write(list, writeSheet); } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); } catch (Exception e) { log.error("export exception", e); } finally { - // 千万别忘记finish 会帮忙关闭流 if (excelWriter != null) { excelWriter.finish(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java new file mode 100644 index 0000000000..bf9c9455d1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java @@ -0,0 +1,157 @@ +package com.epmet.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.HeadStyle; +import com.alibaba.excel.enums.poi.FillPatternTypeEnum; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 磐石-行程上报信息-导出 + * + */ +@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) +@Data +public class IcPsTripReportRecordExportExcel implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + @ColumnWidth(15) + @ExcelProperty(value = "姓名", order = 1) + private String name; + /** + * 年龄【磐石】 + */ + @ColumnWidth(15) + @ExcelProperty(value = "年龄",order = 2) + private int age; + /** + * 证件号 + */ + @ColumnWidth(20) + @ExcelProperty(value = "证件号",order = 3) + private String idCard; + /** + * 户籍地 【磐石】 + */ + @ColumnWidth(40) + @ExcelProperty(value = "户籍地(省市县区)",order = 4) + private String registeredResidence; + /** + * 手机号 + */ + @ColumnWidth(25) + @ExcelProperty(value = "手机号",order = 5) + private String mobile; + /** + * 来自地区(格式:省-市-区-街道-社区) + */ + @ColumnWidth(40) + @ExcelProperty(value = "来自地区(格式:省-市-区-街道-社区)",order = 6) + private String sourceAddress; + /** + * 来自地区详细地址 source_address字段的说明 + */ + @ColumnWidth(40) + @ExcelProperty(value = "来自地区详细地址",order = 7) + private String sourceDetailAddress; + /** + * 来曹事由(100字以内)【磐石】 + */ + @ColumnWidth(40) + @ExcelProperty(value = "来曹事由(100字以内)",order = 8) + private String describe; + /** + * 48小时核酸检测 0:阴性 1:阳性 -中国字 + */ + @ColumnWidth(30) + @ExcelProperty(value = "48小时核酸检测",order = 9) + private String isNatRecordName; + /** + * 来到本地时间(2022-01-01) + */ + @ColumnWidth(30) + @ExcelProperty(value = "来到本地时间(2022-01-01)",order = 10) + @JsonFormat(pattern = "yyyy-MM-dd") + private Date arriveDate; + /** + * 现居地 + */ + @ColumnWidth(40) + @ExcelProperty(value = "现居地",order = 11) + private String presentAddress; + /** + * 现居地详细地址 + */ + @ColumnWidth(40) + @ExcelProperty(value = "现居地详细地址",order = 12) + private String detailAddress; + /** + * 交通方式-中国字 + */ + @ColumnWidth(30) + @ExcelProperty(value = "返回方式",order = 13) + private String trafficTypeName; + /** + * 其他返回方式,交通方式为其他时此列需要有值 + */ + @ColumnWidth(30) + @ExcelProperty(value = "其他返回方式",order = 14) + private String trafficTypeExplain; + /** + * 7天内旅居史情况,字典表(sojourn_history)【磐石】-中国字 + */ + @ColumnWidth(30) + @ExcelProperty(value = "7天内旅居史情况",order = 15) + private String sojournHistoryName; + /** + * 隔离状态,字典表(isolate_type)【磐石】-中国字 + */ + @ColumnWidth(30) + @ExcelProperty(value = "隔离状态",order = 16) + private String isolateTypeName; + /** + * 备注(500字以内) + */ + @ColumnWidth(50) + @ExcelProperty(value = "备注(500字以内)",order = 17) + private String remark; + /** + * 是否落实"落地检" 0:否 1:是【磐石】-中国字 + */ + @ColumnWidth(30) + @ExcelProperty(value = "是否落实“落地检”",order = 18) + private String isArriveCheckName; + /** + * 是否达到曹县 0:否 1:是【磐石】-中国字 + */ + @ColumnWidth(30) + @ExcelProperty(value = "是否达到曹县",order = 19) + private String isArriveName; + /** + * 上报时间(2022-01-01)【磐石】 + */ + @ColumnWidth(30) + @ExcelProperty(value = "上报时间(2022-01-01)",order = 20) + @JsonFormat(pattern = "yyyy-MM-dd") + private Date reportingTime; + /** + * 管控措施(500字以内)【磐石】 + */ + @ColumnWidth(35) + @ExcelProperty(value = "管控措施(500字以内)",order = 21) + private String controlMeasures; + /** + * 类型(省内、省外、市内、县内),字典表(trip_data_type)【磐石】-中国字 + */ + @ColumnWidth(35) + @ExcelProperty(value = "类型(省内、省外、市内、县内)",order = 22) + private String tripDataTypeName; +}