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 2c24205126..19cd71a0a5 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 @@ -411,6 +411,11 @@ public class IcTripReportRecordDTO implements Serializable { */ @ExcelIgnore private String viaCounty; + /** + * 途经地区全拼 + */ + @ExcelIgnore + private String via; /** * 同行人员【烟台】 */ @@ -450,6 +455,7 @@ public class IcTripReportRecordDTO implements Serializable { * 入鲁时间【烟台】 */ @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String arriveLuTime; /** * 行程码【烟台】 @@ -460,6 +466,7 @@ public class IcTripReportRecordDTO implements Serializable { * 无效时间【烟台】 */ @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String invalidTime; /** * 证件类型【烟台】 @@ -475,7 +482,7 @@ public class IcTripReportRecordDTO implements Serializable { * 年龄【烟台】 */ @ExcelIgnore - private String age; + private int age; /** * 性别【烟台】 */ @@ -500,6 +507,7 @@ public class IcTripReportRecordDTO implements Serializable { * 抵烟时间【烟台】 */ @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String arriveTime; /** * 上报街道【烟台】 @@ -515,7 +523,8 @@ public class IcTripReportRecordDTO implements Serializable { * 离开风险区域的时间【烟台】 */ @ExcelIgnore - private String leaveTheRiskAreaTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date leaveTheRiskAreaTime; /** * 是否携带48小时核算证明 是/否【烟台】 */ @@ -570,11 +579,16 @@ public class IcTripReportRecordDTO implements Serializable { * 【烟台】 */ @ExcelIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String iTime; /** * 【烟台】 */ @ExcelIgnore private String iFlag; + /** + * 烟台数据主键【烟台】 + */ + private String ytId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcYtTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcYtTripReportFormDTO.java new file mode 100644 index 0000000000..a3872b4926 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcYtTripReportFormDTO.java @@ -0,0 +1,339 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.hibernate.validator.constraints.Length; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 行程上报烟台入参 + */ +@Data +public class IcYtTripReportFormDTO implements Serializable { + + public interface YtAdd extends CustomerClientShowGroup { + } + public interface YtEdit extends CustomerClientShowGroup { + } + + @NotBlank(message = "主键不能为空", groups = {YtEdit.class}) + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = {YtAdd.class}) + private String name; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {YtAdd.class}) + private String mobile; + + /** + * 身份证号 + */ + @NotBlank(message = "证件号能为空", groups = {YtAdd.class}) + private String idCard; + + /** + * 是否添加到核算检测关注名单,true加入;默认false不加入 + */ + @NotNull(message = "是否添加到核算检测关注名单", groups = {YtAdd.class}) + private Boolean heSuanCheck; + /** + * 现居地编码 + */ + private String presentAddressCode; + + /** + * 现居地编码路径:"presentAddressPathCode":"37,3702,370203,370203026,370203026002" + */ + private String presentAddressPathCode; + + /** + * 现居地名称eg:山东省青岛市黄岛区玫瑰山路社区 + */ + private String presentAddress; + + /** + * 详细地址 + */ + private String detailAddress; + + /** + * 来源地区编码 + */ + private String sourceAddressCode; + + /** + * 来源地编码路径: "sourceAddressPathCode": "37,3702,370203,370203026,370203026002" + */ + private String sourceAddressPathCode; + + /** + * 来源地区地址 + */ + private String sourceAddress; + + /** + * 到达日期 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date arriveDate; + + /** + * 离开日期 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date leaveDate; + + /** + * 备注信息 + */ + @Length(max = 500, message = "备注最多可输入500字", groups = {YtAdd.class}) + private String remark; + + /** + * userType=icresi时,必填,取值居民所属的网格ID; + * 居民端小程序上报前端赋值当前用户所在的网格id + */ + private String gridId; + + /** + * 用户id + * 居民端上报时后端自己赋值 + * pc录入如果是从居民信息选择,此列有值 + */ + private String userId; + + /** + * 居民端小程序的人:resi;数字社区的居民:icresi;单独录入:input; 导入:import + * 居民端上报是后端赋值;导入后端赋值 + * pc录入是前端赋值 + */ + private String userType; + + /** + * userType=icresi时,必填。 + * 居民所属的组织id + */ + @NotBlank(message = "agencyId不能为空", groups = {YtAdd.class}) + private String agencyId; + + /** + * pc录入时用 + */ + private String currentStaffId; + + /** + * pc录入时用 + * 通知渠道 0小程序通知,1短信通知 + */ + private List channel = new ArrayList<>(); + /** + * pc录入时用 + * 通知内容 + */ + private String content = ""; + + /** + * 交通方式,来源字典表(traffic_type) + */ + private String trafficType; + /** + * 其他返回方式,交通方式为其他时此列需要有值 + */ + private String trafficTypeExplain; + /** + * 来源地详细信息 source_address字段的说明 + */ + private String sourceDetailAddress; + /** + * 核酸检测报告异常 是/否【烟台】 + */ + private String detectionAbnormal; + /** + * 两码一报告状态 (正常 异常)【烟台】 + */ + private String twoCodeOneReportStatus; + /** + * 申报状态( 0未审核 1审核通过 2无效数据)【烟台】 + */ + private String declarationStatus; + /** + * 是否有外地旅居史 是/否【烟台】 + */ + private String nonlocalResidenceHistory; + /** + * 途经省【烟台】 + */ + private String viaProvince; + /** + * 途经市【烟台】 + */ + private String viaCity; + /** + * 途经县区【烟台】 + */ + private String viaCounty; + /** + * 同行人员【烟台】 + */ + private String travelPersonnel; + /** + * 户籍地【烟台】 + */ + private String registeredResidenceCity; + /** + * 户籍地详细【烟台】 + */ + private String registeredResidenceAddress; + /** + * 是否带车 是/否 【烟台】 + */ + private String carryVehicle; + /** + * 带车车牌号【烟台】 + */ + private String carryVehicleNumber; + /** + * 车牌颜色【烟台】 + */ + private String carryVehiclenumberColor; + /** + * 目的地交通场站【烟台】 + */ + private String destinationStation; + /** + * 入鲁时间【烟台】 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date arriveLuTime; + /** + * 行程码【烟台】 + */ + private String travelCodeImg; + /** + * 无效时间【烟台】 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date invalidTime; + /** + * 证件类型【烟台】 + */ + private String cardType; + /** + * 区域【烟台】 + */ + private String area; + /** + * 年龄【烟台】 + */ + private int age; + /** + * 性别【烟台】 + */ + private String sex; + /** + * 是否有新冠肺炎病史 是/否 【烟台】 + */ + private String covidFlag; + /** + * 来烟方式【烟台】 + */ + private String comeMode; + /** + * 班次【烟台】 + */ + private String shift; + /** + * 抵烟时间【烟台】 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date arriveTime; + /** + * 上报街道【烟台】 + */ + private String reportStreet; + /** + * 来源地区全【烟台】 + */ + private String comeAreaFull; + /** + * 离开风险区域的时间【烟台】 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date leaveTheRiskAreaTime; + /** + * 是否携带48小时核算证明 是/否【烟台】 + */ + private String carryHesuanProof; + /** + * 省【烟台】 + */ + private String provinceName; + /** + * 市【烟台】 + */ + private String cityName; + /** + * 县【烟台】 + */ + private String countyName; + /** + * 详细地址【烟台】 + */ + private String twonName; + /** + * 健康码异常 是/否【烟台】 + */ + private String healthCodeAbnormal; + /** + * 行程码异常 是/否【烟台】 + */ + private String travelCodeAbnormal; + /** + * 【烟台】 + */ + private String iId; + /** + * 【烟台】 + */ + private String iDate; + /** + * 【烟台】 + */ + private String iType; + /** + * 【烟台】 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date iTime; + /** + * 【烟台】 + */ + private String iFlag; + +} 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 0e149ed9df..83b232bec7 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 @@ -30,6 +30,7 @@ import com.epmet.dto.result.EmphasisTripPieDetailResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.excel.IcPsTripReportRecordExportExcel; import com.epmet.excel.IcTripReportRecordExportExcel; +import com.epmet.excel.IcYtTripReportRecordExportExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcTripReportRecordService; import lombok.extern.slf4j.Slf4j; @@ -494,4 +495,96 @@ public class IcTripReportRecordController implements ResultDataResolver { return new Result>().ok(icTripReportRecordService.emphasisTripPieDetail(formDTO)); } + /** + * pc: 行程上报-列表--烟台 + */ + @PostMapping("yt-page") + @MaskResponse(fieldNames = {"mobile", "idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) + public Result> ytPage(@LoginUser TokenDto tokenDto, @RequestBody PageTripReportFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(PageFormDTO.AddUserInternalGroup.class); + PageData page = icTripReportRecordService.ytPage(formDTO); + return new Result>().ok(page); + } + + /** + * 查看详情--烟台 + */ + @MaskResponse(fieldNames = {"showMobile", "showIdCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) + @PostMapping("yt-detail") + public Result ytDetail(@LoginUser TokenDto tokenDto, @RequestBody IcTripReportRecordDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, IcTripReportRecordDTO.DetailViewGroup.class); + PageTripReportFormDTO pageTripReportFormDTO = new PageTripReportFormDTO(); + pageTripReportFormDTO.setCustomerId(tokenDto.getCustomerId()); + pageTripReportFormDTO.setUserId(tokenDto.getUserId()); + pageTripReportFormDTO.setId(formDTO.getId()); + return new Result().ok(icTripReportRecordService.ytDetail(pageTripReportFormDTO)); + } + + /** + * pc: 行程上报-新增--烟台 + * + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("yt-save") + public Result ytSave(@LoginUser TokenDto tokenDto, @RequestBody IcYtTripReportFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCurrentStaffId(tokenDto.getUserId()); + String id = icTripReportRecordService.ytSave(formDTO); + return new Result().ok(id); + } + + /** + * pc: 行程上报-修改--烟台 + * + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("yt-update") + public Result ytUpdate(@LoginUser TokenDto tokenDto, @RequestBody IcYtTripReportFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCurrentStaffId(tokenDto.getUserId()); + return new Result().ok(icTripReportRecordService.ytUpdate(formDTO)); + } + + /** + * pc:行程上报-导出--烟台 + */ + @NoRepeatSubmit + @PostMapping("yt-export") + public void ytEexport(@LoginUser TokenDto tokenDto, @RequestBody PageTripReportFormDTO formDTO, HttpServletResponse response) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + // 这里 需要指定写用哪个class去写 + String today = DateUtils.format(new Date(), DateUtils.DATE_PATTERN_MMDD); + String fileName = "行程上报信息".concat(today); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcYtTripReportRecordExportExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + data = icTripReportRecordService.ytPage(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), IcYtTripReportRecordExportExcel.class); + formDTO.setPageNo(++pageNo); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); + + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java index 20f851210c..d9dee65f52 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java @@ -239,7 +239,7 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { /** * 入鲁时间【烟台】 */ - private String arriveLuTime; + private Date arriveLuTime; /** * 行程码【烟台】 */ @@ -247,7 +247,7 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { /** * 无效时间【烟台】 */ - private String invalidTime; + private Date invalidTime; /** * 证件类型【烟台】 */ @@ -259,7 +259,7 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { /** * 年龄【烟台】 */ - private String age; + private int age; /** * 性别【烟台】 */ @@ -279,19 +279,19 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { /** * 抵烟时间【烟台】 */ - private String arriveTime; + private Date arriveTime; /** * 上报街道【烟台】 */ private String reportStreet; /** - * 来源地区全【烟台】 + * 来源地区 全【烟台】 */ private String comeAreaFull; /** * 离开风险区域的时间【烟台】 */ - private String leaveTheRiskAreaTime; + private Date leaveTheRiskAreaTime; /** * 是否携带48小时核算证明 是/否【烟台】 */ @@ -335,10 +335,14 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity { /** * 【烟台】 */ - private String iTime; + private Date iTime; /** * 【烟台】 */ private String iFlag; + /** + * 烟台数据主键【烟台】 + */ + private String ytId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcYtTripReportRecordExportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcYtTripReportRecordExportExcel.java new file mode 100644 index 0000000000..ae1b520d22 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcYtTripReportRecordExportExcel.java @@ -0,0 +1,194 @@ +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; + + +/** + * 烟台-行程上报信息-导出 + * + */ +@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) +@Data +public class IcYtTripReportRecordExportExcel implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + @ColumnWidth(12) + @ExcelProperty(value = "姓名") + private String name; + /** + * 证件号 + */ + @ColumnWidth(20) + @ExcelProperty(value = "证件号") + private String idCard; + /** + * 手机号 + */ + @ColumnWidth(15) + @ExcelProperty(value = "手机号") + private String mobile; + /** + * 现居地 + */ + @ColumnWidth(20) + @ExcelProperty(value = "现居地") + private String presentAddress; + /** + * 现居地详细地址 + */ + @ColumnWidth(30) + @ExcelProperty(value = "现居地详细地址") + private String detailAddress; + /** + * 来自地区 + */ + @ColumnWidth(30) + @ExcelProperty(value = "来自地区") + private String comeAreaFull; + /** + * 来自地区详细地址 + */ + @ColumnWidth(30) + @ExcelProperty(value = "来自地区详细地址") + private String sourceDetailAddress; + /** + * 来到本地时间 + */ + @ColumnWidth(20) + @ExcelProperty(value = "来到本地时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private String arriveTime; + + /** + * 返回方式 + */ + @ColumnWidth(15) + @ExcelProperty(value = "返回方式") + private String comeMode; + /** + * 班次 + */ + @ColumnWidth(15) + @ExcelProperty(value = "班次") + private String shift; + /** + * 48小时核酸检测 + */ + @ColumnWidth(20) + @ExcelProperty(value = "48小时核酸检测") + private String carryHesuanProof; + /** + * 健康码异常 + */ + @ColumnWidth(15) + @ExcelProperty(value = "健康码异常") + private String healthCodeAbnormal; + /** + * 行程码异常 + */ + @ColumnWidth(15) + @ExcelProperty(value = "行程码异常") + private String travelCodeAbnormal; + /** + * 核酸检测报告异常 + */ + @ColumnWidth(20) + @ExcelProperty(value = "核酸检测报告异常") + private String detectionAbnormal; + /** + * 两码一报告状态 + */ + @ColumnWidth(20) + @ExcelProperty(value = "两码一报告状态") + private String twoCodeOneReportStatus; + /** + * 是否有外地旅居史 + */ + @ColumnWidth(20) + @ExcelProperty(value = "是否有外地旅居史") + private String nonlocalResidenceHistory; + /** + * 途径地区 + */ + @ColumnWidth(30) + @ExcelProperty(value = "途径地区") + private String via; + /** + * 同行人 + */ + @ColumnWidth(15) + @ExcelProperty(value = "同行人") + private String travelPersonnel; + /** + * 户籍地 + */ + @ColumnWidth(20) + @ExcelProperty(value = "户籍地") + private String registeredResidenceCity; + /** + * 户籍详细地址 + */ + @ColumnWidth(30) + @ExcelProperty(value = "户籍详细地址") + private String registeredResidenceAddress; + /** + * 是否带车 + */ + @ColumnWidth(15) + @ExcelProperty(value = "是否带车") + private String carryVehicle; + /** + * 带车车牌号 + */ + @ColumnWidth(20) + @ExcelProperty(value = "带车车牌号") + private String carryVehicleNumber; + /** + * 车辆颜色 + */ + @ColumnWidth(15) + @ExcelProperty(value = "车辆颜色") + private String carryVehiclenumberColor; + /** + * 目的地交通场站 + */ + @ColumnWidth(25) + @ExcelProperty(value = "目的地交通场站") + private String destinationStation; + /** + * 入鲁时间 + */ + @ColumnWidth(20) + @ExcelProperty(value = "入鲁时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private String arriveLuTime; + /** + * 行程码 + */ + @ColumnWidth(30) + @ExcelProperty(value = "行程码") + private String travelCodeImg; + /** + * 离开本地时间 + */ + @ColumnWidth(20) + @ExcelProperty(value = "离开本地时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private String leaveDate; + /** + * 备注 + */ + @ColumnWidth(30) + @ExcelProperty(value = "备注") + private String remark; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java index d90f8907f7..7a1d1fc607 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java @@ -10,8 +10,6 @@ import com.epmet.dto.result.EmphasisTripPieDetailResultDTO; import com.epmet.dto.result.TripListDTO; import com.epmet.entity.IcTripReportRecordEntity; -import javax.servlet.http.HttpServletResponse; -import java.io.InputStream; import java.nio.file.Path; import java.util.List; import java.util.Map; @@ -131,4 +129,12 @@ public interface IcTripReportRecordService extends BaseService emphasisTripPieDetail(EmphasisTripPieDetailFormDTO formDTO); + + PageData ytPage(PageTripReportFormDTO formDTO); + + IcTripReportRecordDTO ytDetail(PageTripReportFormDTO pageTripReportFormDTO); + + String ytSave(IcYtTripReportFormDTO formDTO); + + String ytUpdate(IcYtTripReportFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index 06ae46b36a..feb26f1aae 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java @@ -835,5 +835,151 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl ytPage(PageTripReportFormDTO formDTO) { + //1.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = queryCurrentStaff(formDTO.getCustomerId(), formDTO.getUserId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + //2.按条件查询业务数据 + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) + .doSelectPageInfo(() -> baseDao.pageList(formDTO)); + List list = data.getList(); + if (CollectionUtils.isEmpty(list)) { + return new PageData(list, data.getTotal()); + } + //3.查询最近一次通知时间、核算检测关注名单 + if (CollectionUtils.isNotEmpty(list)) { + Map latestNotice = new HashMap<>(); + List gzIdCardList = new ArrayList<>(); + List idCardList = list.stream().map(m -> m.getIdCard()).distinct().collect(Collectors.toList()); + //如果不分页可能会有很多个身份证号 + List> partionList = ListUtils.partition(idCardList, NumConstant.ONE_HUNDRED); + partionList.forEach(l -> { + Map map = icNoticeService.getUserLatestNoticeTime(formDTO.getCustomerId(), l); + List gzIdCards = epidemicSpecialAttentionService.getHeSuanIdCardList(formDTO.getCustomerId(), l); + latestNotice.putAll(map); + gzIdCardList.addAll(gzIdCards); + }); + for (IcTripReportRecordDTO dto : list) { + //默认未加入 + dto.setHeSuanCheck(false); + dto.setHeSuanCheckDesc("未加入"); + if (CollectionUtils.isNotEmpty(gzIdCardList) && gzIdCardList.contains(dto.getIdCard())) { + dto.setHeSuanCheck(true); + dto.setHeSuanCheckDesc("已加入"); + } + if (MapUtils.isNotEmpty(latestNotice) && latestNotice.containsKey(dto.getIdCard())) { + dto.setLatestNoticeTime(latestNotice.get(dto.getIdCard())); + } + } + } + return new PageData(list, data.getTotal()); + } + + @Override + public IcTripReportRecordDTO ytDetail(PageTripReportFormDTO formDTO) { + //1.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = queryCurrentStaff(formDTO.getCustomerId(), formDTO.getUserId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + //2.按条件查询业务数据 + List list = baseDao.pageList(formDTO); + if (CollectionUtils.isEmpty(list)) { + return null; + } + //3.查询最近一次通知时间、核算检测关注名单 + Map latestNotice = new HashMap<>(); + List gzIdCardList = new ArrayList<>(); + List idCardList = list.stream().map(m -> m.getIdCard()).distinct().collect(Collectors.toList()); + //如果不分页可能会有很多个身份证号 + List> partionList = ListUtils.partition(idCardList, NumConstant.ONE_HUNDRED); + partionList.forEach(l -> { + Map map = icNoticeService.getUserLatestNoticeTime(formDTO.getCustomerId(), l); + List gzIdCards = epidemicSpecialAttentionService.getHeSuanIdCardList(formDTO.getCustomerId(), l); + latestNotice.putAll(map); + gzIdCardList.addAll(gzIdCards); + }); + + for (IcTripReportRecordDTO dto : list) { + //默认未加入 + dto.setHeSuanCheck(false); + dto.setHeSuanCheckDesc("未加入"); + if (CollectionUtils.isNotEmpty(gzIdCardList) && gzIdCardList.contains(dto.getIdCard())) { + dto.setHeSuanCheck(true); + dto.setHeSuanCheckDesc("已加入"); + } + if (MapUtils.isNotEmpty(latestNotice) && latestNotice.containsKey(dto.getIdCard())) { + dto.setLatestNoticeTime(latestNotice.get(dto.getIdCard())); + } + } + IcTripReportRecordDTO resultDto = list.get(NumConstant.ZERO); + if (null != resultDto) { + resultDto.setShowIdCard(resultDto.getIdCard()); + resultDto.setShowMobile(resultDto.getMobile()); + } + return resultDto; + } + + @Override + public String ytSave(IcYtTripReportFormDTO formDTO) { + //如果是单个录入的,默认数据属于当前用户所属组织id + if (IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())) { + //获取当前登录用户所属组织id + CustomerStaffInfoCacheResult staffInfo = queryCurrentStaff(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + } + IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class); + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId()); + if (null == agencyInfoCache) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); + } + entity.setPids(agencyInfoCache.getPids()); + //1.插入行程记录表 + entity.setYtId(IdWorker.getIdStr()); + insert(entity); + IcTripReportFormDTO dto = ConvertUtils.sourceToTarget(formDTO, IcTripReportFormDTO.class); + if (formDTO.getHeSuanCheck()) { + // 2.加入核算检测关注名单 + vaccinationAdd(dto); + } + //3.新增通知表信息 + if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { + sendNotice(dto, agencyInfoCache.getOrganizationName()); + } + return entity.getId(); + } + + @Override + public String ytUpdate(IcYtTripReportFormDTO formDTO) { + IcTripReportRecordEntity origin = baseDao.selectById(formDTO.getId()); + if (null == origin) { + log.warn("ic_trip_report_record记录不存在id:", formDTO.getId()); + return formDTO.getId(); + } + //如果是单个录入的,默认数据属于当前用户所属组织id + if (IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())) { + //获取当前登录用户所属组织id + CustomerStaffInfoCacheResult staffInfo = queryCurrentStaff(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + } + IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class); + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId()); + if (null == agencyInfoCache) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); + } + entity.setPids(agencyInfoCache.getPids()); + //1.修改行程记录表 + updateById(entity); + IcTripReportFormDTO dto = ConvertUtils.sourceToTarget(formDTO, IcTripReportFormDTO.class); + if (formDTO.getHeSuanCheck()) { + // 2.加入核算检测关注名单,如果之前关注了,会在通知的service层移除 + vaccinationAdd(dto); + } + //3.新增通知表信息 + if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { + sendNotice(dto, agencyInfoCache.getOrganizationName()); + } + return entity.getId(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index 92cb344f9f..20fe1d8f9a 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -33,17 +33,18 @@