From 2c716ada8af425a6d498f508c37fd176b310c8fa Mon Sep 17 00:00:00 2001 From: wxz Date: Sun, 23 Apr 2023 15:53:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=EF=BC=9A=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E4=BA=BA=E7=BE=A4=EF=BC=8C=E8=B0=83=E6=95=B4=EF=BC=8C=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=85=B3=E8=81=94=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/enums/ZhzlResiCategoryEnum.java | 4 +- .../LingShanSpecialTypeSaveFormDTO.java | 279 +++++++++++++++ .../LingShanSpecialTypeSaveResultDTO.java | 287 +++++++++++++++ .../LingShanSpecialCrowdListResultDTO.java | 3 +- .../enums/LingShanSpecialCrowdTypeEnums.java | 2 +- .../LingShanSpecialCrowdController.java | 119 ++++--- .../dao/LingshanSpecialCrowdPersonDao.java | 23 -- .../LingshanSpecialCrowdPersonTypeDao.java | 2 +- .../LingshanSpecialCrowdPersonEntity.java | 64 ---- .../LingshanSpecialCrowdPersonTypeEntity.java | 12 +- ...ngShanSpecialCrowdDetailBaseExcelData.java | 7 + ...ngShanSpecialCrowdExcelImportListener.java | 28 +- .../service/LingShanSpecialCrowdService.java | 36 +- .../impl/LingShanSpecialCrowdServiceImpl.java | 334 +++++++++++------- .../mapper/LingshanSpecialCrowdPersonDao.xml | 48 --- .../LingshanSpecialCrowdPersonTypeDao.xml | 36 +- 16 files changed, 923 insertions(+), 361 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveResultDTO.java delete mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java delete mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdPersonEntity.java delete mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ZhzlResiCategoryEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ZhzlResiCategoryEnum.java index b57baedf5e..66def5e16c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ZhzlResiCategoryEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/ZhzlResiCategoryEnum.java @@ -12,7 +12,7 @@ public enum ZhzlResiCategoryEnum { // buliangqingshaonian 不良青少年 // shequjiaozheng 社区矫正 // zhaoshizhaohuojingshenbing 肇事肇祸精神病 - // xidurenyuan 吸毒人员 + // jiedurenyuan 吸毒人员 resi_xfry("resi_xfry", "信访人员", "equal", "ic_resi_user", "IS_XFRY", "1", 1), anzhibangjiao("anzhibangjiao", "安置帮教", "list_equal", "ic_special", "SPECIAL_RQLB", "anzhibangjiao", 2), @@ -20,7 +20,7 @@ public enum ZhzlResiCategoryEnum { buliangqingshaonian("buliangqingshaonian", "不良青少年", "list_equal", "ic_special", "SPECIAL_RQLB", "buliangqingshaonian", 4), shequjiaozheng("shequjiaozheng", "社区矫正", "list_equal", "ic_special", "SPECIAL_RQLB", "shequjiaozheng", 5), zhaoshizhaohuojingshenbing("zhaoshizhaohuojingshenbing", "肇事肇祸精神病", "list_equal", "ic_special", "SPECIAL_RQLB", "zhaoshizhaohuojingshenbing", 6), - xidurenyuan("xidurenyuan", "吸毒人员", "list_equal", "ic_special", "SPECIAL_RQLB", "xidurenyuan", 7); + xidurenyuan("jiedurenyuan", "戒毒人员", "list_equal", "ic_special", "SPECIAL_RQLB", "xidurenyuan", 7); private String code; private String name; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveFormDTO.java new file mode 100644 index 0000000000..d0ede466a0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveFormDTO.java @@ -0,0 +1,279 @@ +package com.epmet.dto.form.lingshan; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +@Data +public class LingShanSpecialTypeSaveFormDTO { + + private String name; + private String idCard; + private SpecialCrowdDetails specialCrowdDetails; + + @Data + public static class SpecialCrowdDetails { + private SpecialCrowdAzbj anzhibangjiao ; + private SpecialCrowdJdry jiedurenyuan ; + private SpecialCrowdJzhz jingzhanghuanzhe ; + private SpecialCrowdSqjz shequjiaozheng ; + private SpecialCrowdXfry xinfangrenyuan ; + } + + /** + * 安置帮教 + */ + @Data + public static class SpecialCrowdAzbj { + @NotBlank(message = "原罪名不能为空") + private String originalCharge; + + /** + * 释放日期 + */ + @NotNull(message = "释放日期不能为空") + private Date releaseDate; + + private Date originPrisonTerm; + + /** + * 是否累犯。0否,1是 + */ + private Integer recidivismFlag; + + /** + * 是否安置。0否,1是 + */ + private Integer emplacementFlag; + + /** + * 安置日期 + */ + private Date emplacementDate; + + /** + * 安置帮教情况 + */ + private String emplacementInfo; + + /** + * 是否注销 + */ + private Integer canceledFlag; + + /** + * 注销原因 + */ + private String canceledReason; + } + + /** + * 戒毒人员 + */ + @Data + public static class SpecialCrowdJdry { + /** + * 有无犯罪史 + */ + @NotNull(message = "有无犯罪史不能为空") + private Integer criminalHistoryFlag; + + /** + * 有无复吸史 + */ + @NotNull(message = "有无复吸史不能为空") + private Integer drugRepetitionFlag; + + /** + * 初次发现日期 + */ + private Date firstDiscoveryDate; + + /** + * 管控人姓名 + */ + private String controllerName; + + /** + * 管控人联系方式 + */ + private String controllerContact; + + /** + * 帮扶人姓名 + */ + private String helperName; + + /** + * 帮扶人联系方式 + */ + private String helperContact; + + /** + * 是否脱管 + */ + private Integer detachedFlag; + + /** + * 脱管原因 + */ + private String detachedReason; + } + + @Data + public static class SpecialCrowdJzhz { + @NotNull(message = "有无肇事肇祸史不能为空") + private Integer causeTroubleHistoryFlag; + + /** + * 肇事肇祸次数 + */ + @NotNull(message = "肇事肇祸次数不能为空") + private Integer causeTroubleTimes; + + /** + * 目前诊断类型。1精神分裂症,2分裂情感性障碍,3持久的妄想性障碍(偏执性精神病),4双相(情感)障碍,5癫痫所致精神障碍,6精神发育迟滞伴发精神障碍,7重度抑郁发作,8精神活性物质所致精神障碍,9其他 + */ + private Integer currentDiagnosis; + + /** + * 危险性评估等级。0,1,2,3,4,5 + */ + private Integer dangerousClass; + + /** + * 是否具备外出能力 + */ + private Integer canGoOutFlag; + + /** + * 是否有暴力倾向 + */ + private Integer violenceFlag; + + /** + * 是否落实监管补助 + */ + private Integer allowanceFlag; + + /** + * 是否纳入低保 + */ + private Integer subsistenceFlag; + + /** + * 监护人姓名 + */ + private String guardianName; + + /** + * 监护人联系方式 + */ + private String guardianContact; + } + + @Data + public static class SpecialCrowdSqjz { + @NotNull(message = "矫正类型不能为空") + private Integer rectificateType; + + /** + * 矫正开始日期 + */ + private Date rectificateStartDate; + + /** + * 矫正结束日期 + */ + private Date rectificateEndDate; + + /** + * 原羁押场所 + */ + private String originDetainAddress; + + /** + * 原罪名 + */ + private String originalCharge; + + /** + * 接受方式。1.自行报到,2狱所押送,3当庭交接,4其他 + */ + private Integer receiveWay; + + /** + * 矫正情况说明 + */ + private String rectificateInfo; + + /** + * 是否脱管 + */ + private Integer detachedFlag; + + /** + * 脱管原因 + */ + private String detachedReason; + + /** + * 是否注销 + */ + private Integer canceledFlag; + + /** + * 注销原因 + */ + private String canceledReason; + } + + @Data + public static class SpecialCrowdXfry { + @NotBlank(message = "反映问题不能为空") + private String problem; + + /** + * 稳控措施 + */ + @NotBlank(message = "稳控措施不能为空") + private String stableControlMeasurement; + + /** + * 是否多次上访 + */ + private Integer multipleFlag; + + /** + * 是否在当地 + */ + private Integer localFlag; + + /** + * 分管领导 + */ + private String branchLeader; + + /** + * 分管领导联系方式 + */ + private String branchLeaderContact; + + /** + * 负责人 + */ + private String principal; + + /** + * 负责人联系方式 + */ + private String principalContact; + + /** + * 稳控人员名单 + */ + private String stableControlerList; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveResultDTO.java new file mode 100644 index 0000000000..3ed43eb2bd --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveResultDTO.java @@ -0,0 +1,287 @@ +package com.epmet.dto.form.lingshan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +@Data +public class LingShanSpecialTypeSaveResultDTO { + + private String gender; + private String genderZh; + private String nation; + private String birthday; + private String domicilePlace; + private String name; + private String mobile; + private String address; + private String idCard; + private SpecialCrowdDetails specialCrowdDetails = new SpecialCrowdDetails(); + + @Data + public static class SpecialCrowdDetails { + private SpecialCrowdAzbj anzhibangjiao ; + private SpecialCrowdJdry jiedurenyuan ; + private SpecialCrowdJzhz jingzhanghuanzhe ; + private SpecialCrowdSqjz shequjiaozheng ; + private SpecialCrowdXfry xinfangrenyuan ; + } + + /** + * 安置帮教 + */ + @Data + public static class SpecialCrowdAzbj { + @NotBlank(message = "原罪名不能为空") + private String originalCharge; + + /** + * 释放日期 + */ + @NotNull(message = "释放日期不能为空") + private Date releaseDate; + + private Date originPrisonTerm; + + /** + * 是否累犯。0否,1是 + */ + private Integer recidivismFlag; + + /** + * 是否安置。0否,1是 + */ + private Integer emplacementFlag; + + /** + * 安置日期 + */ + private Date emplacementDate; + + /** + * 安置帮教情况 + */ + private String emplacementInfo; + + /** + * 是否注销 + */ + private Integer canceledFlag; + + /** + * 注销原因 + */ + private String canceledReason; + } + + /** + * 戒毒人员 + */ + @Data + public static class SpecialCrowdJdry { + /** + * 有无犯罪史 + */ + @NotNull(message = "有无犯罪史不能为空") + private Integer criminalHistoryFlag; + + /** + * 有无复吸史 + */ + @NotNull(message = "有无复吸史不能为空") + private Integer drugRepetitionFlag; + + /** + * 初次发现日期 + */ + private Date firstDiscoveryDate; + + /** + * 管控人姓名 + */ + private String controllerName; + + /** + * 管控人联系方式 + */ + private String controllerContact; + + /** + * 帮扶人姓名 + */ + private String helperName; + + /** + * 帮扶人联系方式 + */ + private String helperContact; + + /** + * 是否脱管 + */ + private Integer detachedFlag; + + /** + * 脱管原因 + */ + private String detachedReason; + } + + @Data + public static class SpecialCrowdJzhz { + @NotNull(message = "有无肇事肇祸史不能为空") + private Integer causeTroubleHistoryFlag; + + /** + * 肇事肇祸次数 + */ + @NotNull(message = "肇事肇祸次数不能为空") + private Integer causeTroubleTimes; + + /** + * 目前诊断类型。1精神分裂症,2分裂情感性障碍,3持久的妄想性障碍(偏执性精神病),4双相(情感)障碍,5癫痫所致精神障碍,6精神发育迟滞伴发精神障碍,7重度抑郁发作,8精神活性物质所致精神障碍,9其他 + */ + private Integer currentDiagnosis; + + /** + * 危险性评估等级。0,1,2,3,4,5 + */ + private Integer dangerousClass; + + /** + * 是否具备外出能力 + */ + private Integer canGoOutFlag; + + /** + * 是否有暴力倾向 + */ + private Integer violenceFlag; + + /** + * 是否落实监管补助 + */ + private Integer allowanceFlag; + + /** + * 是否纳入低保 + */ + private Integer subsistenceFlag; + + /** + * 监护人姓名 + */ + private String guardianName; + + /** + * 监护人联系方式 + */ + private String guardianContact; + } + + @Data + public static class SpecialCrowdSqjz { + @NotNull(message = "矫正类型不能为空") + private Integer rectificateType; + + /** + * 矫正开始日期 + */ + private Date rectificateStartDate; + + /** + * 矫正结束日期 + */ + private Date rectificateEndDate; + + /** + * 原羁押场所 + */ + private String originDetainAddress; + + /** + * 原罪名 + */ + private String originalCharge; + + /** + * 接受方式。1.自行报到,2狱所押送,3当庭交接,4其他 + */ + private Integer receiveWay; + + /** + * 矫正情况说明 + */ + private String rectificateInfo; + + /** + * 是否脱管 + */ + private Integer detachedFlag; + + /** + * 脱管原因 + */ + private String detachedReason; + + /** + * 是否注销 + */ + private Integer canceledFlag; + + /** + * 注销原因 + */ + private String canceledReason; + } + + @Data + public static class SpecialCrowdXfry { + @NotBlank(message = "反映问题不能为空") + private String problem; + + /** + * 稳控措施 + */ + @NotBlank(message = "稳控措施不能为空") + private String stableControlMeasurement; + + /** + * 是否多次上访 + */ + private Integer multipleFlag; + + /** + * 是否在当地 + */ + private Integer localFlag; + + /** + * 分管领导 + */ + private String branchLeader; + + /** + * 分管领导联系方式 + */ + private String branchLeaderContact; + + /** + * 负责人 + */ + private String principal; + + /** + * 负责人联系方式 + */ + private String principalContact; + + /** + * 稳控人员名单 + */ + private String stableControlerList; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java index 1801914aa6..efa7a61b47 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java @@ -8,8 +8,9 @@ import java.util.Date; @Data public class LingShanSpecialCrowdListResultDTO { + private String resiId; private String orgNamePath; - private String specialType; + private String specialTypesStr; private String specialTypeDisplay; private String name; private String mobile; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java index 5728173c2f..21ed2904ef 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java @@ -10,7 +10,7 @@ package com.epmet.enums; public enum LingShanSpecialCrowdTypeEnums { AZBJ("anzhibangjiao", "安置帮教", 1), SQJZ("shequjiaozheng", "社区矫正", 1), - JDRY("xidurenyuan", "戒毒人员", 1), + JDRY("jiedurenyuan", "戒毒人员", 1), JZHZ("jingzhanghuanzhe", "精障患者", 1), XFRY("xinfangrenyuan", "信访人员", 1); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java index 5d9596722a..ed46a4ae89 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java @@ -9,6 +9,8 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.FileUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveFormDTO; +import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveResultDTO; import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; import com.epmet.enums.LingShanSpecialCrowdTypeEnums; import com.epmet.excel.data.*; @@ -77,9 +79,6 @@ public class LingShanSpecialCrowdController { } finally { org.apache.poi.util.IOUtils.closeQuietly(is); } - - - } /** @@ -89,7 +88,7 @@ public class LingShanSpecialCrowdController { * anzhibangjiao * buliangqingshaonian * shequjiaozheng - * xidurenyuan + * jiedurenyuan * xiejiaorenyuan * zhaoshizhaohuojingshenbing * @return @@ -110,7 +109,7 @@ public class LingShanSpecialCrowdController { String taskId = lingShanSpecialCrowdService.importSpecialCrowd(crowdCategory, fileSavePath.toString(), originalFilename); return new Result().ok(taskId); } catch (Exception e) { - // 3.出错的话,删除文件 + // 3.出错的话,删除文件。不能在finally中删除,因为正常执行的话,是在异步线程中执行导入,这里删除了,那子线程就获取不到文件了,所以子线程中有单独的删除逻辑 FileUtils.deleteFileIfExists(fileSavePath); throw e; } @@ -140,68 +139,78 @@ public class LingShanSpecialCrowdController { } } + // /** + // * @description: 安置帮教新增 + // * @param azbjData: + // * @return + // * @author: WangXianZhang + // * @date: 2023/4/20 2:50 PM + // */ + // @PostMapping("anzhibangjiao/save") + // public Result saveSpecialCrowd(@RequestBody LingShanSpecialCrowdDetailAzbjExcelData azbjData) { + // ValidatorUtils.validateEntity(azbjData); + // + // lingShanSpecialCrowdService.createSpecialCrowd(azbjData, "anzhibangjiao"); + // return new Result(); + // } + // + // @PostMapping("jiedurenyuan/save") + // public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJdryExcelData jdryData) { + // ValidatorUtils.validateEntity(jdryData); + // + // lingShanSpecialCrowdService.createSpecialCrowd(jdryData, "jiedurenyuan"); + // return new Result(); + // } + // + // @PostMapping("jingzhanhuanzhe/save") + // public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJzhzExcelData jzhzData) { + // ValidatorUtils.validateEntity(jzhzData); + // + // lingShanSpecialCrowdService.createSpecialCrowd(jzhzData, "jingzhanhuanzhe"); + // return new Result(); + // } + // + // @PostMapping("shequjiaozheng/save") + // public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailSqjzExcelData sqjzData) { + // ValidatorUtils.validateEntity(sqjzData); + // + // lingShanSpecialCrowdService.createSpecialCrowd(sqjzData, "shequjiaozheng"); + // return new Result(); + // } + // + // @PostMapping("xinfangrenyuan/save") + // public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailXfryExcelData xfryData) { + // ValidatorUtils.validateEntity(xfryData); + // + // lingShanSpecialCrowdService.createSpecialCrowd(xfryData, "xinfangrenyuan"); + // return new Result(); + // } + /** - * @description: 安置帮教新增 - * @param azbjData: + * @description: 保存 + * @param input: * @return * @author: WangXianZhang - * @date: 2023/4/20 2:50 PM + * @date: 2023/4/23 10:58 AM */ - @PostMapping("anzhibangjiao/save") - public Result saveSpecialCrowd(@RequestBody LingShanSpecialCrowdDetailAzbjExcelData azbjData) { - ValidatorUtils.validateEntity(azbjData); - - lingShanSpecialCrowdService.createSpecialCrowd(azbjData, "anzhibangjiao"); - return new Result(); - } - - @PostMapping("xidurenyuan/save") - public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJdryExcelData jdryData) { - ValidatorUtils.validateEntity(jdryData); - - lingShanSpecialCrowdService.createSpecialCrowd(jdryData, "xidurenyuan"); - return new Result(); - } - - @PostMapping("jingzhanhuanzhe/save") - public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJzhzExcelData jzhzData) { - ValidatorUtils.validateEntity(jzhzData); - - lingShanSpecialCrowdService.createSpecialCrowd(jzhzData, "jingzhanhuanzhe"); - return new Result(); - } - - @PostMapping("shequjiaozheng/save") - public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailSqjzExcelData sqjzData) { - ValidatorUtils.validateEntity(sqjzData); - - lingShanSpecialCrowdService.createSpecialCrowd(sqjzData, "shequjiaozheng"); - return new Result(); - } - - @PostMapping("xinfangrenyuan/save") - public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailXfryExcelData xfryData) { - ValidatorUtils.validateEntity(xfryData); - - lingShanSpecialCrowdService.createSpecialCrowd(xfryData, "xinfangrenyuan"); + @PostMapping("save") + public Result saveSpecialCrowd(@RequestBody LingShanSpecialTypeSaveFormDTO input) { + ValidatorUtils.validateEntity(input); + lingShanSpecialCrowdService.saveSpecialCrowd(input); return new Result(); } /** * @description: 特殊人群详情 - * @param personId: - * @param specialType: * @return * @author: WangXianZhang * @date: 2023/4/20 3:44 PM */ @GetMapping("getPersonSpecialTypeDetail") - public Result getPersonSpecialTypeDetail(@RequestParam("idCard") String idCard, - @RequestParam("specialType") String specialType, - @RequestParam("specialDetailId") String specialDetailId) { + public Result getPersonSpecialTypeDetail(@RequestParam("resiId") String resiId) { - LingShanSpecialCrowdDetailBaseExcelData r = lingShanSpecialCrowdService.getPersonSpecialTypeDetail(idCard, specialType, specialDetailId); - return new Result().ok(r); + LingShanSpecialTypeSaveResultDTO r = lingShanSpecialCrowdService.getPersonSpecialTypeDetail(resiId); + return new Result().ok(r); } /** @@ -243,13 +252,13 @@ public class LingShanSpecialCrowdController { @PostMapping("deleteByType") public Result deleteByType(@RequestBody Map params) { String specialType = params.get("specialType"); - String idCard = params.get("idCard"); + String resiId = params.get("resiId"); - if (StringUtils.isAnyBlank(specialType, idCard)) { + if (StringUtils.isAnyBlank(specialType, resiId)) { throw new ValidateException("特殊人群类型或身份证不能为空"); } - lingShanSpecialCrowdService.deleteByType(specialType, idCard); + lingShanSpecialCrowdService.deleteByType(specialType, resiId); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java deleted file mode 100644 index 46d27f818c..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.epmet.dao; - -import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity; -import com.epmet.entity.LingshanSpecialCrowdPersonEntity; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 灵山-特殊人群-人员基础信息 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2023-04-18 - */ -@Mapper -public interface LingshanSpecialCrowdPersonDao extends BaseDao { - - void saveOrUpdateManually(@Param("list") List list); - - void deletePhysical(@Param("idCard") String idCard); -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java index 28ff3ca03c..56d7132edf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java @@ -27,5 +27,5 @@ public interface LingshanSpecialCrowdPersonTypeDao extends BaseDao persons = new ArrayList<>(); + // 为什么去掉了?因为需求改成了:直接用type根居民基础信息关联 + // private List persons = new ArrayList<>(); private List personTypes = new ArrayList<>(); protected LingShanSpecialCrowdService lingShanSpecialCrowdService; @@ -262,9 +255,9 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener persons, List personTypes) { - lingShanSpecialCrowdService.savePersonAndTypes(persons, personTypes); + private void savePersonAndTypes(List personTypes) { + lingShanSpecialCrowdService.savePersonAndTypes(personTypes); } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java index eeee7f44df..7cf217c635 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java @@ -1,6 +1,8 @@ package com.epmet.service; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveFormDTO; +import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveResultDTO; import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; import com.epmet.entity.*; import com.epmet.excel.data.LingShanSpecialCrowdDetailAzbjExcelData; @@ -33,7 +35,7 @@ public interface LingShanSpecialCrowdService { */ String validate(LingShanSpecialCrowdDetailBaseExcelData row); - void savePersonAndTypes(List persons, List personTypes); + void savePersonAndTypes(List personTypes); /** * @description: 安置帮教-导入 @@ -47,28 +49,27 @@ public interface LingShanSpecialCrowdService { void saveBatch(List entities, LingshanSpecialCrowdDetailSqjzEntity e); void saveBatch(List entities, LingshanSpecialCrowdDetailXfryEntity e); - /** - * @description: 新增-安置帮教 - * @param azbjData: - * @return - * @author: WangXianZhang - * @date: 2023/4/20 2:51 PM - */ - void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData azbjData, String specialType); + // /** + // * @description: 新增-安置帮教 + // * @param azbjData: + // * @return + // * @author: WangXianZhang + // * @date: 2023/4/20 2:51 PM + // */ + // void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData azbjData, String specialType); /** * @description: 特殊人群详情 * @param idCard: - * @param specialType: * @return * @author: WangXianZhang * @date: 2023/4/20 3:45 PM */ - LingShanSpecialCrowdDetailBaseExcelData getPersonSpecialTypeDetail(String idCard, String specialType, String specialDetailId); + LingShanSpecialTypeSaveResultDTO getPersonSpecialTypeDetail(String resiId); /** * @description: 列表查询 - * @param orgId: + * @param orgId: * @param orgType: * @param specialType: * @param name: @@ -81,5 +82,14 @@ public interface LingShanSpecialCrowdService { PageData listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile, String idCard, Integer pageNo, Integer pageSize); - void deleteByType(String specialType, String idCard); + void deleteByType(String specialType, String resiId); + + /** + * @description: 保存或修改 + * @param input: + * @return + * @author: WangXianZhang + * @date: 2023/4/23 11:06 AM + */ + void saveSpecialCrowd(LingShanSpecialTypeSaveFormDTO input); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java index e0c484a97e..a8874bf67f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java @@ -27,6 +27,8 @@ import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.IcBuildingUnitDTO; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.IcResiUserDTO; +import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveFormDTO; +import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveResultDTO; import com.epmet.dto.result.HouseAgencyInfoResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; @@ -59,10 +61,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Optional; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicReference; @@ -74,9 +73,6 @@ import java.util.concurrent.atomic.AtomicReference; @Service public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdService, ResultDataResolver { - @Autowired - private LingshanSpecialCrowdPersonDao specialCrowdPersonDao; - @Autowired private LingshanSpecialCrowdPersonTypeDao specialCrowdPersonTypeDao; @@ -251,22 +247,27 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ return "居民信息不存在,请先维护居民基础信息。"; } if (!resiEntity.getName().equals(name)) { - return String.format("姓名信息与居民基础信息不一致。(在居民库中根据身份证号找到的居民姓名为:%s)", name); + return String.format("姓名信息与居民基础信息不一致。(在居民库中根据身份证号找到的居民姓名为:%s)", resiEntity.getName()); } + // 设置居民id + row.setResiId(resiEntity.getId()); + return null; } @Override - public void savePersonAndTypes(List persons, List personTypes) { - List> personParts = ListUtils.partition(persons, 50); + public void savePersonAndTypes(List personTypes) { + // List> personParts = ListUtils.partition(persons, 50); List> personTypeParts = ListUtils.partition(personTypes, 50); - for (List p : personParts) { - specialCrowdPersonDao.saveOrUpdateManually(p); - } + // for (List p : personParts) { + // specialCrowdPersonDao.saveOrUpdateManually(p); + // } for (List p : personTypeParts) { - specialCrowdPersonTypeDao.saveOrUpdateManually(p); + if (CollectionUtils.isNotEmpty(p)) { + specialCrowdPersonTypeDao.saveOrUpdateManually(p); + } } } @@ -274,7 +275,9 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ public void saveBatch(List entities, LingshanSpecialCrowdDetailAzbjEntity e) { List> partition = ListUtils.partition(entities, 50); for (List l : partition) { - specialCrowdDetailAzbjDao.saveBatchManually(l); + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailAzbjDao.saveBatchManually(l); + } } } @@ -282,7 +285,9 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ public void saveBatch(List entities, LingshanSpecialCrowdDetailJdryEntity e) { List> partition = ListUtils.partition(entities, 50); for (List l : partition) { - specialCrowdDetailJdryDao.saveBatchManually(l); + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailJdryDao.saveBatchManually(l); + } } } @@ -290,7 +295,9 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ public void saveBatch(List entities, LingshanSpecialCrowdDetailJzhzEntity e) { List> partition = ListUtils.partition(entities, 50); for (List l : partition) { - specialCrowdDetailJzhzDao.saveBatchManually(l); + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailJzhzDao.saveBatchManually(l); + } } } @@ -298,7 +305,9 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ public void saveBatch(List entities, LingshanSpecialCrowdDetailSqjzEntity e) { List> partition = ListUtils.partition(entities, 50); for (List l : partition) { - specialCrowdDetailSqjzDao.saveBatchManually(l); + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailSqjzDao.saveBatchManually(l); + } } } @@ -306,14 +315,76 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ public void saveBatch(List entities, LingshanSpecialCrowdDetailXfryEntity e) { List> partition = ListUtils.partition(entities, 50); for (List l : partition) { - specialCrowdDetailXfryDao.saveBatchManually(l); + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailXfryDao.saveBatchManually(l); + } } } + // @Override + // public void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData specialData, String specialType) { + // // 检查 + // String validateRst = validate(specialData); + // if (StringUtils.isNotBlank(validateRst)) { + // throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, validateRst); + // } + // + // String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + // String staffId = EpmetRequestHolder.getLoginUserId(); + // CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staffId); + // String orgIdPath = PidUtils.convertPid2OrgIdPath(staffInfo.getAgencyId(), staffInfo.getAgencyPIds()); + // + // Date now = new Date(); + // + // // 保存人员和类型信息 + // LingshanSpecialCrowdPersonEntity person = new LingshanSpecialCrowdPersonEntity(IdWorker.getIdStr(), customerId, orgIdPath, specialData.getName(), specialData.getIdCard(), + // "0", 0, now, staffId, now, staffId); + // // + // LingshanSpecialCrowdPersonTypeEntity personType = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, specialData.getResiId(), specialData.getIdCard(), specialType, + // "0", 0, now, staffId, now, staffId); + // + // savePersonAndTypes(Arrays.asList(person), Arrays.asList(personType)); + // + // // Class clazz; + // // 这下面的代码其实类名写错了,但是这个方法也不用了,不改了就 + // switch (specialType) { + // case "anzhibangjiao": + // LingshanSpecialCrowdDetailAzbjEntity e1 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + // setCommonFields(e1, customerId, orgIdPath, now, staffId); + // saveBatch(Arrays.asList(e1), e1); + // break; + // case "xinfangrenyuan": + // LingshanSpecialCrowdDetailAzbjEntity e2 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + // setCommonFields(e2, customerId, orgIdPath, now, staffId); + // saveBatch(Arrays.asList(e2), e2); + // break; + // case "jiedurenyuan": + // LingshanSpecialCrowdDetailAzbjEntity e3 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + // setCommonFields(e3, customerId, orgIdPath, now, staffId); + // saveBatch(Arrays.asList(e3), e3); + // break; + // case "shequjiaozheng": + // LingshanSpecialCrowdDetailAzbjEntity e4 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + // setCommonFields(e4, customerId, orgIdPath, now, staffId); + // saveBatch(Arrays.asList(e4), e4); + // break; + // case "jingzhanghuanzhe": + // LingshanSpecialCrowdDetailAzbjEntity e5 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + // setCommonFields(e5, customerId, orgIdPath, now, staffId); + // saveBatch(Arrays.asList(e5), e5); + // break; + // } + // + // } + + @Transactional(rollbackFor = Exception.class) @Override - public void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData specialData, String specialType) { + public void saveSpecialCrowd(LingShanSpecialTypeSaveFormDTO input) { + LingShanSpecialCrowdDetailBaseExcelData vt = new LingShanSpecialCrowdDetailBaseExcelData(); + vt.setName(input.getName()); + vt.setIdCard(input.getIdCard()); // 检查 - String validateRst = validate(specialData); + String validateRst = validate(vt); if (StringUtils.isNotBlank(validateRst)) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, validateRst); } @@ -325,45 +396,66 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ Date now = new Date(); - // 保存人员和类型信息 - LingshanSpecialCrowdPersonEntity person = new LingshanSpecialCrowdPersonEntity(IdWorker.getIdStr(), customerId, orgIdPath, specialData.getName(), specialData.getIdCard(), - "0", 0, now, staffId, now, staffId); - // - LingshanSpecialCrowdPersonTypeEntity personType = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, specialData.getIdCard(), specialType, - "0", 0, now, staffId, now, staffId); - - savePersonAndTypes(Arrays.asList(person), Arrays.asList(personType)); - - // Class clazz; - - switch (specialType) { - case "anzhibangjiao": - LingshanSpecialCrowdDetailAzbjEntity e1 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); - setCommonFields(e1, customerId, orgIdPath, now, staffId); - saveBatch(Arrays.asList(e1), e1); - break; - case "xinfangrenyuan": - LingshanSpecialCrowdDetailAzbjEntity e2 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); - setCommonFields(e2, customerId, orgIdPath, now, staffId); - saveBatch(Arrays.asList(e2), e2); - break; - case "xidurenyuan": - LingshanSpecialCrowdDetailAzbjEntity e3 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); - setCommonFields(e3, customerId, orgIdPath, now, staffId); - saveBatch(Arrays.asList(e3), e3); - break; - case "shequjiaozheng": - LingshanSpecialCrowdDetailAzbjEntity e4 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); - setCommonFields(e4, customerId, orgIdPath, now, staffId); - saveBatch(Arrays.asList(e4), e4); - break; - case "jingzhanghuanzhe": - LingshanSpecialCrowdDetailAzbjEntity e5 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); - setCommonFields(e5, customerId, orgIdPath, now, staffId); - saveBatch(Arrays.asList(e5), e5); - break; + ArrayList types2Save = new ArrayList<>(); + + // 保存人群详情 + if (input.getSpecialCrowdDetails().getAnzhibangjiao() != null) { + LingshanSpecialCrowdDetailAzbjEntity azbj = ConvertUtils.sourceToTarget(input.getSpecialCrowdDetails().getAnzhibangjiao(), LingshanSpecialCrowdDetailAzbjEntity.class); + setCommonFields(azbj, customerId, orgIdPath, now, staffId); + azbj.setIdCard(input.getIdCard()); + saveBatch(Arrays.asList(azbj), azbj); + + LingshanSpecialCrowdPersonTypeEntity azbjE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.AZBJ.getType(), + "0", 0, now, staffId, now, staffId); + types2Save.add(azbjE); + } + + if (input.getSpecialCrowdDetails().getJiedurenyuan() != null) { + LingshanSpecialCrowdDetailJdryEntity jdry = ConvertUtils.sourceToTarget(input.getSpecialCrowdDetails().getJiedurenyuan(), LingshanSpecialCrowdDetailJdryEntity.class); + setCommonFields(jdry, customerId, orgIdPath, now, staffId); + jdry.setIdCard(input.getIdCard()); + saveBatch(Arrays.asList(jdry), jdry); + + LingshanSpecialCrowdPersonTypeEntity JdryE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JDRY.getType(), + "0", 0, now, staffId, now, staffId); + types2Save.add(JdryE); + } + + if (input.getSpecialCrowdDetails().getJingzhanghuanzhe() != null) { + LingshanSpecialCrowdDetailJzhzEntity jzhz = ConvertUtils.sourceToTarget(input.getSpecialCrowdDetails().getJingzhanghuanzhe(), LingshanSpecialCrowdDetailJzhzEntity.class); + setCommonFields(jzhz, customerId, orgIdPath, now, staffId); + jzhz.setIdCard(input.getIdCard()); + saveBatch(Arrays.asList(jzhz), jzhz); + + LingshanSpecialCrowdPersonTypeEntity jzhzE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JZHZ.getType(), + "0", 0, now, staffId, now, staffId); + types2Save.add(jzhzE); + } + + if (input.getSpecialCrowdDetails().getXinfangrenyuan() != null) { + LingshanSpecialCrowdDetailXfryEntity xfry = ConvertUtils.sourceToTarget(input.getSpecialCrowdDetails().getXinfangrenyuan(), LingshanSpecialCrowdDetailXfryEntity.class); + setCommonFields(xfry, customerId, orgIdPath, now, staffId); + xfry.setIdCard(input.getIdCard()); + saveBatch(Arrays.asList(xfry), xfry); + + LingshanSpecialCrowdPersonTypeEntity xfryE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.XFRY.getType(), + "0", 0, now, staffId, now, staffId); + types2Save.add(xfryE); } + if (input.getSpecialCrowdDetails().getShequjiaozheng() != null) { + LingshanSpecialCrowdDetailSqjzEntity sqjz = ConvertUtils.sourceToTarget(input.getSpecialCrowdDetails().getShequjiaozheng(), LingshanSpecialCrowdDetailSqjzEntity.class); + setCommonFields(sqjz, customerId, orgIdPath, now, staffId); + sqjz.setIdCard(input.getIdCard()); + saveBatch(Arrays.asList(sqjz), sqjz); + + LingshanSpecialCrowdPersonTypeEntity sqjzE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.SQJZ.getType(), + "0", 0, now, staffId, now, staffId); + types2Save.add(sqjzE); + } + + // 保存人员类型 + savePersonAndTypes(types2Save); } void setCommonFields(LingshanSpecialCrowdDetailBaseEntity e, String customerId, String orgIdPath, Date now, String staffId) { @@ -379,51 +471,53 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ } @Override - public LingShanSpecialCrowdDetailBaseExcelData getPersonSpecialTypeDetail(String idCard, String specialType, String specialDetailId) { - // 查询人员基础信息 - LambdaQueryWrapper personQ = new LambdaQueryWrapper<>(); - personQ.eq(LingshanSpecialCrowdPersonEntity::getIdCard, idCard); - LingshanSpecialCrowdPersonEntity person = specialCrowdPersonDao.selectOne(personQ); + public LingShanSpecialTypeSaveResultDTO getPersonSpecialTypeDetail(String resiId) { + // 1.校验人员基础信息 + IcResiUserEntity person = icResiUserDao.selectById(resiId); if (person == null) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员信息"); } - // 查询人员类别详情 - LingShanSpecialCrowdDetailBaseExcelData d; - switch (specialType) { - case "anzhibangjiao": - LingshanSpecialCrowdDetailAzbjEntity e1 = specialCrowdDetailAzbjDao.selectById(specialDetailId); - d = ConvertUtils.sourceToTarget(e1, LingShanSpecialCrowdDetailAzbjExcelData.class); - break; - case "xinfangrenyuan": - LingshanSpecialCrowdDetailXfryEntity e2 = specialCrowdDetailXfryDao.selectById(specialDetailId); - d = ConvertUtils.sourceToTarget(e2, LingshanSpecialCrowdDetailXfryExcelData.class); - break; - case "xidurenyuan": - LingshanSpecialCrowdDetailJdryEntity e3 = specialCrowdDetailJdryDao.selectById(specialDetailId); - d = ConvertUtils.sourceToTarget(e3, LingshanSpecialCrowdDetailJdryExcelData.class); - break; - case "shequjiaozheng": - LingshanSpecialCrowdDetailSqjzEntity e4 = specialCrowdDetailSqjzDao.selectById(specialDetailId); - d = ConvertUtils.sourceToTarget(e4, LingshanSpecialCrowdDetailSqjzExcelData.class); - break; - case "jingzhanghuanzhe": - LingshanSpecialCrowdDetailJzhzEntity e5 = specialCrowdDetailJzhzDao.selectById(specialDetailId); - d = ConvertUtils.sourceToTarget(e5, LingshanSpecialCrowdDetailJzhzExcelData.class); - break; - default: - d = new LingShanSpecialCrowdDetailBaseExcelData(); - } + LingShanSpecialTypeSaveResultDTO d = new LingShanSpecialTypeSaveResultDTO(); - if (d == null) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员的类别详细信息"); - } + // 2.查询人员类别详情 + LambdaQueryWrapper azbjQ = new LambdaQueryWrapper<>(); + azbjQ.eq(LingshanSpecialCrowdDetailAzbjEntity::getIdCard, person.getIdCard()); + LingshanSpecialCrowdDetailAzbjEntity e1 = specialCrowdDetailAzbjDao.selectOne(azbjQ); + LingShanSpecialTypeSaveResultDTO.SpecialCrowdAzbj specialCrowdAzbj = ConvertUtils.sourceToTarget(e1, LingShanSpecialTypeSaveResultDTO.SpecialCrowdAzbj.class); + + LambdaQueryWrapper xfryQ = new LambdaQueryWrapper<>(); + xfryQ.eq(LingshanSpecialCrowdDetailXfryEntity::getIdCard, person.getIdCard()); + LingshanSpecialCrowdDetailXfryEntity e2 = specialCrowdDetailXfryDao.selectOne(xfryQ); + LingShanSpecialTypeSaveResultDTO.SpecialCrowdXfry specialCrowdXfry = ConvertUtils.sourceToTarget(e2, LingShanSpecialTypeSaveResultDTO.SpecialCrowdXfry.class); + + LambdaQueryWrapper jdryQ = new LambdaQueryWrapper<>(); + jdryQ.eq(LingshanSpecialCrowdDetailJdryEntity::getIdCard, person.getIdCard()); + LingshanSpecialCrowdDetailJdryEntity e3 = specialCrowdDetailJdryDao.selectOne(jdryQ); + LingShanSpecialTypeSaveResultDTO.SpecialCrowdJdry specialCrowdJdry = ConvertUtils.sourceToTarget(e3, LingShanSpecialTypeSaveResultDTO.SpecialCrowdJdry.class); + + LambdaQueryWrapper sqjzQ = new LambdaQueryWrapper<>(); + sqjzQ.eq(LingshanSpecialCrowdDetailSqjzEntity::getIdCard, person.getIdCard()); + LingshanSpecialCrowdDetailSqjzEntity e4 = specialCrowdDetailSqjzDao.selectOne(sqjzQ); + LingShanSpecialTypeSaveResultDTO.SpecialCrowdSqjz specialCrowdSqjz = ConvertUtils.sourceToTarget(e4, LingShanSpecialTypeSaveResultDTO.SpecialCrowdSqjz.class); + + LambdaQueryWrapper jzhzQ = new LambdaQueryWrapper<>(); + jzhzQ.eq(LingshanSpecialCrowdDetailJzhzEntity::getIdCard, person.getIdCard()); + LingshanSpecialCrowdDetailJzhzEntity e5 = specialCrowdDetailJzhzDao.selectOne(jzhzQ); + LingShanSpecialTypeSaveResultDTO.SpecialCrowdJzhz specialCrowdJzhz = ConvertUtils.sourceToTarget(e5, LingShanSpecialTypeSaveResultDTO.SpecialCrowdJzhz.class); + + d.getSpecialCrowdDetails().setAnzhibangjiao(specialCrowdAzbj); + d.getSpecialCrowdDetails().setXinfangrenyuan(specialCrowdXfry); + d.getSpecialCrowdDetails().setJiedurenyuan(specialCrowdJdry); + d.getSpecialCrowdDetails().setShequjiaozheng(specialCrowdSqjz); + d.getSpecialCrowdDetails().setJingzhanghuanzhe(specialCrowdJzhz); d.setName(person.getName()); + d.setIdCard(person.getIdCard()); - // 查询居民信息 - IcResiUserEntity resiBaseEntity = icResiUserDao.selectResiUserEntityByIdCard(idCard, EpmetRequestHolder.getLoginUserCustomerId()); + // 3.查询和补充居民信息 + IcResiUserEntity resiBaseEntity = icResiUserDao.selectResiUserEntityByIdCard(person.getIdCard(), EpmetRequestHolder.getLoginUserCustomerId()); if (resiBaseEntity == null) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员信息"); } @@ -497,41 +591,41 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(resi.getGridId()); i.setOrgNamePath(gridInfo.getAgencyName().concat("-").concat(gridInfo.getGridName())); i.setAddress(getAddressOfResi(resi.getGridId(), resi.getHomeId())); - i.setSpecialTypeDisplay(LingShanSpecialCrowdTypeEnums.getByType(i.getSpecialType()).getName()); + + // 处理类型展示中文,将a,b,c =》 啊,喔,额 + List typesDisplay = new ArrayList<>(); + String specialTypesStr = i.getSpecialTypesStr(); + if (StringUtils.isNotBlank(specialTypesStr)) { + String[] types = specialTypesStr.split(","); + for (String type : types) { + typesDisplay.add(LingShanSpecialCrowdTypeEnums.getByType(type).getName()); + } + } + i.setSpecialTypeDisplay(String.join(",", typesDisplay)); }); return new PageData<>(l, new PageInfo<>(l).getTotal()); } @Transactional @Override - public void deleteByType(String specialType, String idCard) { + public void deleteByType(String specialType, String resiId) { + LambdaQueryWrapper q = new LambdaQueryWrapper<>(); + q.eq(LingshanSpecialCrowdPersonTypeEntity::getSpecialType, specialType); + q.eq(LingshanSpecialCrowdPersonTypeEntity::getResiId, resiId); + // 先删除type - specialCrowdPersonTypeDao.deletePhysical(specialType, idCard); + specialCrowdPersonTypeDao.deletePhysical(specialType, resiId); - // 再删除detail - switch (specialType) { - case "anzhibangjiao": - specialCrowdDetailAzbjDao.deletePhysical(idCard); - break; - case "xinfangrenyuan": - specialCrowdDetailXfryDao.deletePhysical(idCard); - break; - case "xidurenyuan": - specialCrowdDetailJdryDao.deletePhysical(idCard); - break; - case "shequjiaozheng": - specialCrowdDetailSqjzDao.deletePhysical(idCard); - break; - case "jingzhanghuanzhe": - specialCrowdDetailJzhzDao.deletePhysical(idCard); - break; + LingshanSpecialCrowdPersonTypeEntity personType = specialCrowdPersonTypeDao.selectOne(q); + if (personType == null) { + return; } - LambdaQueryWrapper q = new LambdaQueryWrapper<>(); - q.eq(LingshanSpecialCrowdPersonTypeEntity::getIdCard, idCard); - if (specialCrowdPersonTypeDao.selectCount(q) == 0) { - // 没有type了,那就吧person也删了 - specialCrowdPersonDao.deletePhysical(idCard); - } + // 再删除detail + specialCrowdDetailAzbjDao.deletePhysical(personType.getIdCard()); + specialCrowdDetailXfryDao.deletePhysical(personType.getIdCard()); + specialCrowdDetailJdryDao.deletePhysical(personType.getIdCard()); + specialCrowdDetailSqjzDao.deletePhysical(personType.getIdCard()); + specialCrowdDetailJzhzDao.deletePhysical(personType.getIdCard()); } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml deleted file mode 100644 index de34f7d6d7..0000000000 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - insert into lingshan_special_crowd_person ( ID, CUSTOMER_ID, ORG_ID_PATH, `NAME`, ID_CARD, - DEL_FLAG, REVISION, CREATED_BY , CREATED_TIME, UPDATED_BY, UPDATED_TIME) - values - - ( #{item.id}, - #{item.customerId}, - #{item.orgIdPath}, - #{item.name}, - #{item.idCard}, - #{item.delFlag}, - #{item.revision}, - #{item.createdBy}, - #{item.createdTime}, - #{item.updatedBy}, - #{item.updatedTime} - ) - - on duplicate key update NAME=values(name) - , UPDATED_BY=values(UPDATED_BY) - , UPDATED_TIME=values(UPDATED_TIME) - - - delete from lingshan_special_crowd_person where ID_CARD = #{idCard} - - - - \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml index 7b41e26356..9c2eeca66b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml @@ -18,11 +18,11 @@ - insert into lingshan_special_crowd_person_type ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, SPECIAL_TYPE, + insert into lingshan_special_crowd_person_type ( ID, CUSTOMER_ID, ORG_ID_PATH, RESI_ID, ID_CARD, SPECIAL_TYPE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) values - (#{type.id}, #{type.customerId}, #{type.orgIdPath}, #{type.idCard}, #{type.specialType}, + (#{type.id}, #{type.customerId}, #{type.orgIdPath}, #{type.resiId}, #{type.idCard}, #{type.specialType}, #{type.delFlag}, #{type.revision}, #{type.createdBy}, #{type.createdTime}, #{type.updatedBy}, #{type.updatedTime}) on duplicate key update @@ -32,23 +32,23 @@ , UPDATED_TIME = values(UPDATED_TIME) - delete from lingshan_special_crowd_person_type where ID_CARD = #{idCard} and SPECIAL_TYPE = #{specialType} + delete from lingshan_special_crowd_person_type where RESI_ID = #{resiId} and SPECIAL_TYPE = #{specialType}