Browse Source

磐石导出初版

dev
sunyuchao 3 years ago
parent
commit
d88e1dbc22
  1. 32
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  2. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  3. 157
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExportExcel.java

32
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java

@ -66,14 +66,14 @@ public class IcTripReportRecordDTO implements Serializable {
* 姓名 * 姓名
*/ */
@ColumnWidth(15) @ColumnWidth(15)
@ExcelProperty("姓名") @ExcelProperty(value = "姓名", order = 1)
private String name; private String name;
/** /**
* 手机号 * 手机号
*/ */
@ColumnWidth(15) @ColumnWidth(15)
@ExcelProperty("手机号") @ExcelProperty(value = "手机号",order = 3)
private String mobile; private String mobile;
/** /**
@ -85,7 +85,7 @@ public class IcTripReportRecordDTO implements Serializable {
* 身份证号 * 身份证号
*/ */
@ColumnWidth(22) @ColumnWidth(22)
@ExcelProperty("证件号") @ExcelProperty(value = "证件号",order = 2)
private String idCard; private String idCard;
/** /**
@ -121,14 +121,14 @@ public class IcTripReportRecordDTO implements Serializable {
* 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区 * 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区
*/ */
@ColumnWidth(50) @ColumnWidth(50)
@ExcelProperty("现居地") @ExcelProperty(value = "现居地",order = 4)
private String presentAddress; private String presentAddress;
/** /**
* 详细地址 * 详细地址
*/ */
@ColumnWidth(35) @ColumnWidth(35)
@ExcelProperty("现居地详细地址") @ExcelProperty(value = "现居地详细地址",order = 5)
private String detailAddress; private String detailAddress;
/** /**
@ -147,14 +147,14 @@ public class IcTripReportRecordDTO implements Serializable {
* 来源地区地址 * 来源地区地址
*/ */
@ColumnWidth(50) @ColumnWidth(50)
@ExcelProperty("来自地区") @ExcelProperty(value = "来自地区",order = 6)
private String sourceAddress; private String sourceAddress;
/** /**
* 到达日期 * 到达日期
*/ */
@ColumnWidth(25) @ColumnWidth(25)
@ExcelProperty("来到本地时间") @ExcelProperty(value = "来到本地时间",order = 8)
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date arriveDate; private Date arriveDate;
@ -162,7 +162,7 @@ public class IcTripReportRecordDTO implements Serializable {
* 离开日期 * 离开日期
*/ */
@ColumnWidth(25) @ColumnWidth(25)
@ExcelProperty("离开本地时间") @ExcelProperty(value = "离开本地时间",order = 13)
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date leaveDate; private Date leaveDate;
@ -170,7 +170,7 @@ public class IcTripReportRecordDTO implements Serializable {
* pc行程上报-列表返参最近一次通知时间 * pc行程上报-列表返参最近一次通知时间
*/ */
@ColumnWidth(25) @ColumnWidth(25)
@ExcelProperty("最近一次通知时间") //@ExcelProperty("最近一次通知时间")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date latestNoticeTime; private Date latestNoticeTime;
@ -178,7 +178,7 @@ public class IcTripReportRecordDTO implements Serializable {
* 备注信息 * 备注信息
*/ */
@ColumnWidth(100) @ColumnWidth(100)
@ExcelProperty("备注") @ExcelProperty(value = "备注",order = 14)
private String remark; private String remark;
/** /**
@ -242,17 +242,19 @@ public class IcTripReportRecordDTO implements Serializable {
* 交通方式-中国字 * 交通方式-中国字
*/ */
@ColumnWidth(50) @ColumnWidth(50)
@ExcelProperty("返回方式") @ExcelProperty(value = "返回方式",order = 9)
private String trafficTypeName; private String trafficTypeName;
/** /**
* 其他返回方式交通方式为其他时此列需要有值 * 其他返回方式交通方式为其他时此列需要有值
*/ */
@ColumnWidth(50) @ColumnWidth(50)
@ExcelProperty("其他返回方式") @ExcelProperty(value = "其他返回方式",order = 10)
private String trafficTypeExplain; private String trafficTypeExplain;
/** /**
* 源地详细信息 source_address字段的说明 * 自地区详细地址 source_address字段的说明
*/ */
@ColumnWidth(25)
@ExcelProperty(value = "来自地区详细地址",order = 7)
private String sourceDetailAddress; private String sourceDetailAddress;
/** /**
* 疫苗接种针次 (0 1 2 3)小寨子 * 疫苗接种针次 (0 1 2 3)小寨子
@ -262,7 +264,7 @@ public class IcTripReportRecordDTO implements Serializable {
* 疫苗接种针次 -中国字(0针 1针 2针 3针) * 疫苗接种针次 -中国字(0针 1针 2针 3针)
*/ */
@ColumnWidth(50) @ColumnWidth(50)
@ExcelProperty("疫苗接种针次") @ExcelProperty(value = "疫苗接种针次",order = 12)
private String vaccineNumName; private String vaccineNumName;
/** /**
* 是否有48小时核算记录 0: 1: 小寨子 * 是否有48小时核算记录 0: 1: 小寨子
@ -272,7 +274,7 @@ public class IcTripReportRecordDTO implements Serializable {
* 是否有48小时核算记录 0: 1: 小寨子-中国字 * 是否有48小时核算记录 0: 1: 小寨子-中国字
*/ */
@ColumnWidth(50) @ColumnWidth(50)
@ExcelProperty("48小时核酸检测") @ExcelProperty(value = "48小时核酸检测",order = 11)
private String isNatRecordName; private String isNatRecordName;
/** /**
* 户籍地 磐石 * 户籍地 磐石

8
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.EmphasisTripListResultDTO;
import com.epmet.dto.result.EmphasisTripPieDetailResultDTO; import com.epmet.dto.result.EmphasisTripPieDetailResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.excel.IcPsTripReportRecordExportExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcTripReportRecordService; import com.epmet.service.IcTripReportRecordService;
import lombok.extern.slf4j.Slf4j; 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) { public void psEexport(@LoginUser TokenDto tokenDto, @RequestBody PageTripReportFormDTO formDTO, HttpServletResponse response) {
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserId(tokenDto.getUserId());
// formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
// formDTO.setUserId("35005df15fb0f7c791344f0b424870b7");
formDTO.setIsPage(false); formDTO.setIsPage(false);
ExcelWriter excelWriter = null; ExcelWriter excelWriter = null;
formDTO.setPageSize(NumConstant.TEN_THOUSAND); formDTO.setPageSize(NumConstant.TEN_THOUSAND);
@ -389,16 +388,17 @@ public class IcTripReportRecordController implements ResultDataResolver {
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcTripReportRecordDTO.class).build(); excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcTripReportRecordDTO.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build();
PageData<IcTripReportRecordDTO> data = null; PageData<IcTripReportRecordDTO> data = null;
List<IcPsTripReportRecordExportExcel> list = null;
do { do {
data = icTripReportRecordService.page(formDTO); data = icTripReportRecordService.page(formDTO);
list = ConvertUtils.sourceToTarget(data.getList(), IcPsTripReportRecordExportExcel.class);
formDTO.setPageNo(++pageNo); formDTO.setPageNo(++pageNo);
excelWriter.write(data.getList(), writeSheet); excelWriter.write(list, writeSheet);
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize());
} catch (Exception e) { } catch (Exception e) {
log.error("export exception", e); log.error("export exception", e);
} finally { } finally {
// 千万别忘记finish 会帮忙关闭流
if (excelWriter != null) { if (excelWriter != null) {
excelWriter.finish(); excelWriter.finish();
} }

157
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;
}
Loading…
Cancel
Save