diff --git a/doc/epmet-cloud.md b/doc/epmet-cloud.md index 43cd0d2f63..e47ddfc70e 100644 --- a/doc/epmet-cloud.md +++ b/doc/epmet-cloud.md @@ -10,4 +10,11 @@ 例如:有A、B2个服务,并且A调用B,如果我们只需要开发A服务,那本地只启动A服务即可,A调用B的时候,会调用服务器的B服务。 如果需要开发AB2个服务,那么将A中的FeignClient的url属性指向localhost。 PS:目前正在测试通过负载均衡器和本地环境变量实现动态修改目标服务IP,成功之后就不需要再修改FeignClient的url,配置一下环境变量即可,到时候具体说 -``` \ No newline at end of file +``` + + +## 私有化部署 +##### 需要开放哪些域名 + +- epmet-cloud.elinkservice.cn 微信交互代理 +- dysmsapi.aliyuncs.com 阿里云短信 \ No newline at end of file diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java index e6318f61b6..517330e427 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/BizTypeEnum.java @@ -19,6 +19,7 @@ public enum BizTypeEnum { GRID_PROJECT("grid_project", "网格项目"), PROJECT("project", "项目"), ARTICLE("article", "文章(党建声音)"), + SPECIAL_CROWD("special_crowd", "社会维稳(特殊人群)"), ; public static BizTypeEnum getEnum(String code) { 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 6e9c97a00f..3f65fa714f 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 吸毒人员 xinfangrenyuan("xinfangrenyuan", "信访人员", "equal", "ic_resi_user", "IS_XFRY", "1", 1), anzhibangjiao("anzhibangjiao", "安置帮教", "list_equal", "ic_special", "SPECIAL_RQLB", "anzhibangjiao", 2), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java index 00784bc7db..c606583613 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java @@ -153,4 +153,32 @@ public class FileUtils { return templateFilePathStr; } + /** + * @description: 删除文件 + * @param path: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 9:47 AM + */ + public static void deleteFileIfExists(Path path) { + if (path != null) { + try { + Files.deleteIfExists(path); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + /** + * @description: 删除文件 + * @param path: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 9:47 AM + */ + public static void deleteFileIfExists(String path) { + deleteFileIfExists(Paths.get(path)); + } + } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java index 34647de7ec..822d6cfe22 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/TCCCClientUtils.java @@ -13,7 +13,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class TCCCClientUtils { - private static String SDKAPPID = "1400801042"; + private static Long SDKAPPID = 1400801042L; private static String USERID = "286388969@qq.com"; @@ -34,12 +34,12 @@ public class TCCCClientUtils { CccClient client = new CccClient(cred, "", clientProfile); // 实例化一个请求对象,每个接口都会对应一个request对象 CreateSDKLoginTokenRequest req = new CreateSDKLoginTokenRequest(); - req.setSdkAppId(1400801042L); - req.setSeatUserId("286388969@qq.com"); + req.setSdkAppId(SDKAPPID); + req.setSeatUserId(USERID); // 返回的resp是一个CreateSDKLoginTokenResponse的实例,与请求对象对应 CreateSDKLoginTokenResponse resp = client.CreateSDKLoginToken(req); // 输出json格式的字符串回包 - System.out.println(CreateSDKLoginTokenResponse.toJsonString(resp)); + log.info(CreateSDKLoginTokenResponse.toJsonString(resp)); return CreateSDKLoginTokenResponse.toJsonString(resp); } catch (TencentCloudSDKException e) { log.error(e.toString()); diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index c723860629..0aa5931823 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -528,6 +528,8 @@ epmet: # 员工登记、受众群体登记 - /gov/org/icEmployeeRegister/add - /gov/org/icGroupPeopleRegister/add + # 组织树,灵山大屏需要无登录调用,放开 + - /gov/org/agency/maporg # 外部应用认证,使用AccessToken等头进行认证 externalOpenUrls: - /data/report/** diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java index 08fc2f0995..b64b8eb505 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java @@ -56,4 +56,14 @@ public class ImportTaskCommonFormDTO extends PageFormDTO { */ private String resultDesc; + /** + * 成功行数 + */ + private Integer successItemsQty; + + /** + * 失败行数 + */ + private Integer failItemsQty; + } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java index 9812f1abbc..22264424a2 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java @@ -40,4 +40,7 @@ public class ImportTaskCommonResultDTO implements Serializable { */ private String resultDescFile; + private Integer successItemsQty; + private Integer failItemsQty; + } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index 43766990ba..14bde6bfe9 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -22,7 +22,7 @@ import java.util.Map; * @date 2020/6/4 10:28 */ @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class) - //@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class, url = "http://localhost:8103") + // @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallbackFactory = EpmetCommonServiceOpenFeignClientFallbackFactory.class, url = "http://localhost:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java index 80bf086374..88193f832c 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/utils/ImportTaskUtils.java @@ -21,11 +21,17 @@ public class ImportTaskUtils implements ResultDataResolver { * @return Result */ public static Result createImportTask(String originFileName, String bizType) { + return createImportTask(originFileName, bizType, null, null); + } + + public static Result createImportTask(String originFileName, String bizType, + Integer successItemsQty, Integer failItemsQty) { ImportTaskCommonFormDTO form = new ImportTaskCommonFormDTO(); form.setOriginFileName(originFileName); form.setOperatorId(EpmetRequestHolder.getHeader(AppClientConstant.USER_ID)); form.setBizType(bizType); - + form.setSuccessItemsQty(successItemsQty); + form.setFailItemsQty(failItemsQty); return SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class).createImportTask(form); } @@ -48,4 +54,23 @@ public class ImportTaskUtils implements ResultDataResolver { return SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class).finishImportTask(form); } + /** + * @description: 结束导入任务 + * @return + * @author: WangXianZhang + * @date: 2023/4/20 9:55 AM + */ + public static Result finishImportTask(String taskId, String processStatus, String resultDescFilePath, String resultDesc, Integer successItemsQty, Integer failItemsQty) { + ImportTaskCommonFormDTO form = new ImportTaskCommonFormDTO(); + form.setTaskId(taskId); + form.setOperatorId(EpmetRequestHolder.getHeader(AppClientConstant.USER_ID)); + form.setProcessStatus(processStatus); + form.setResultDescFilePath(resultDescFilePath); + form.setResultDesc(resultDesc); + form.setSuccessItemsQty(successItemsQty); + form.setFailItemsQty(failItemsQty); + + return SpringContextUtils.getBean(EpmetCommonServiceOpenFeignClient.class).finishImportTask(form); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java index 8b03c4465b..5519578120 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java @@ -21,6 +21,19 @@ public class ImportTaskController { @Autowired private ImportTaskService importTaskService; + /** + * @description: 通过id查找 + * @param taskId: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 2:17 PM + */ + @RequestMapping("/getById") + public Result getById(@RequestParam("taskId") String taskId) { + ImportTaskCommonResultDTO r = importTaskService.getById(taskId); + return new Result().ok(r); + } + /** * desc:分页获取个人导入记录 * @param tokenDto @@ -59,7 +72,13 @@ public class ImportTaskController { @RequestMapping("finish") public Result finishTask(@RequestBody ImportTaskCommonFormDTO input) { ValidatorUtils.validateEntity(input, ImportTaskCommonFormDTO.Finish.class); - Boolean finished = importTaskService.finish(input.getTaskId(), input.getProcessStatus(), input.getOperatorId(), input.getResultDescFilePath(), input.getResultDesc()); + Boolean finished = importTaskService.finish(input.getTaskId(), + input.getProcessStatus(), + input.getOperatorId(), + input.getResultDescFilePath(), + input.getResultDesc(), + input.getSuccessItemsQty(), + input.getFailItemsQty()); if (!finished) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "失败,请确认任务是否存在,以及是否已完成", diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java index 1306b7e3cd..a758f2f33a 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java @@ -24,8 +24,10 @@ public interface ImportTaskDao extends BaseDao { * @return */ int finish(@Param("taskId") String taskId, - @Param("process_status") String processStatus, - @Param("operatorId") String operatorId, - @Param("resultDesc") String resultDesc, - @Param("resultDescFile") String resultDescFile); + @Param("process_status") String processStatus, + @Param("operatorId") String operatorId, + @Param("resultDesc") String resultDesc, + @Param("resultDescFile") String resultDescFile, + @Param("successItemsQty") Integer successItemsQty, + @Param("failItemsQty") Integer failItemsQty); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java index 0602a42963..756d5a7937 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java @@ -54,4 +54,7 @@ public class ImportTaskEntity extends BaseEpmetEntity { private String resultDesc; + private Integer successItemsQty; + private Integer failItemsQty; + } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java index 918643d8f2..74ceb6a3f4 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java @@ -36,7 +36,8 @@ public interface ImportTaskService { * @param resultDescFile 结果描述文件 * @param resultDesc 结果描述文本 */ - Boolean finish(String taskId, String processStatus, String operatorId, String resultDescFile, String resultDesc); + Boolean finish(String taskId, String processStatus, String operatorId, String resultDescFile, String resultDesc, + Integer successItemsQty, Integer failItemsQty); /** * desc:分页获取个人导入记录 @@ -51,4 +52,6 @@ public interface ImportTaskService { * @return */ Boolean processingTaskCheck(String bizType); + + ImportTaskCommonResultDTO getById(String taskId); } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java index 3aea2a5b23..6d37dab168 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java @@ -89,8 +89,9 @@ public class ImportTaskServiceImpl implements ImportTaskService { } @Override - public Boolean finish(String taskId, String processStatus, String operatorId, String resultDescFile, String resultDesc) { - return importRecordDao.finish(taskId, processStatus, operatorId, resultDesc, resultDescFile) > 0; + public Boolean finish(String taskId, String processStatus, String operatorId, String resultDescFile, String resultDesc, + Integer successItemsQty, Integer failItemsQty) { + return importRecordDao.finish(taskId, processStatus, operatorId, resultDesc, resultDescFile, successItemsQty, failItemsQty) > 0; } @Override @@ -120,4 +121,12 @@ public class ImportTaskServiceImpl implements ImportTaskService { return importRecordDao.selectCount(query) > 0; } + + @Override + public ImportTaskCommonResultDTO getById(String taskId) { + ImportTaskEntity task = importRecordDao.selectById(taskId); + ImportTaskCommonResultDTO r = ConvertUtils.sourceToTarget(task, ImportTaskCommonResultDTO.class); + r.setTaskId(taskId); + return r; + } } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.15__importtask_add_number.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.15__importtask_add_number.sql new file mode 100644 index 0000000000..93ea507a26 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.15__importtask_add_number.sql @@ -0,0 +1,2 @@ +alter table import_task add column SUCCESS_ITEMS_QTY int comment '成功条数' after RESULT_DESC; +alter table import_task add column FAIL_ITEMS_QTY int comment '失败条数' after SUCCESS_ITEMS_QTY; \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml index fce694cb16..8c17d0d858 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml @@ -12,6 +12,8 @@ + + @@ -26,6 +28,8 @@ set PROCESS_STATUS = #{process_status}, RESULT_DESC = #{resultDesc}, RESULT_DESC_FILE = #{resultDescFile}, + SUCCESS_ITEMS_QTY = #{successItemsQty}, + FAIL_ITEMS_QTY = #{failItemsQty}, UPDATED_BY=#{operatorId}, UPDATED_TIME=NOW() where ID=#{taskId} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java index 18c2baba6e..dd852c7eca 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/tccc/TCCCAuthController.java @@ -14,7 +14,7 @@ public class TCCCAuthController { public String getTcccAuth() { try { String tcccAuth = TCCCClientUtils.getToken(); - System.out.println(tcccAuth); + log.info(tcccAuth); return tcccAuth; } catch (Exception e) { log.error(e.toString()); diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java index 8afffa5726..238e0da9a1 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java @@ -1,8 +1,9 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -21,6 +22,20 @@ public class IcDangerousChemicalsDTO implements Serializable { */ private String id; + /** + * 灵山:企业所属组织/网格 + */ + private String orgId; + /** + * 灵山:组织:agency;网格:grid + */ + private String orgType; + + /** + * 灵山:ORG_ID的全路径;包含ORG_ID + */ + private String orgIdPath; + /** * 客户Id */ @@ -62,19 +77,19 @@ public class IcDangerousChemicalsDTO implements Serializable { private String dangerType; /** - * 负责人姓名 + * 负责人姓名;灵山项目中此列叫联系人 */ - private String principalName; + private String principalName; /** - * 负责人电话 + * 负责人电话;灵山项目中此列叫联系电话 */ - private String principalMobile; + private String principalMobile; /** - * 经营地址 + * 经营地址;灵山项目中此列叫企业地址 */ - private String address; + private String address; /** * 经度 @@ -91,6 +106,36 @@ public class IcDangerousChemicalsDTO implements Serializable { */ private String remark; + /** + * 灵山:是否重点安全企业;1是;0不是;必填 + */ + private Boolean securityFlag; + + /** + * 灵山:安全负责人姓名 + */ + private String securityPrincipalName; + + /** + * 灵山:手机号 + */ + private String securityPrincipalMobile; + + /** + * 灵山:包企领导 + */ + private String bqLd; + + /** + * 灵山:包企干部 + */ + private String bqGb; + + /** + * 灵山:企业介绍 + */ + private String companyProfile; + /** * 删除标识 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java index c67cb48fb2..dee46040f9 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java @@ -1,12 +1,11 @@ package com.epmet.dto.form; -import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -21,22 +20,42 @@ public class IcDangerousChemicalsAddEditFormDTO implements Serializable { public interface Del extends CustomerClientShowGroup { } + public interface LingShanAddGroup extends CustomerClientShowGroup { + } + + public interface LingShanEditGroup extends CustomerClientShowGroup { + } + + /** + * 灵山:企业所属组织/网格 + */ + @NotBlank(message = "所属组织不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) + private String orgId; + + /** + * 灵山:组织:agency;网格:grid + */ + @NotBlank(message = "所属组织类型不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) + private String orgType; + /** * 场所Id */ - @NotBlank(message = "场所Id不能为空", groups = {UpdateGroup.class, Del.class}) + @NotBlank(message = "企业Id不能为空", groups = {LingShanEditGroup.class, Del.class}) private String icDangerousChemicalsId; /** * 企业名称 */ - @NotBlank(message = "企业名称不能为空", groups = {AddGroup.class}) - @Length(max = 50, message = "场所名称不能超过50位", groups = AddGroup.class) + @NotBlank(message = "企业名称不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) + @Length(max = 35, message = "企业名称最多输入35字", groups = LingShanAddGroup.class) private String name; + /** * 企业类型值 */ - @NotBlank(message = "企业类型不能为空", groups = {AddGroup.class}) + @NotBlank(message = "企业类型不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) private String category; + /** * 周边安全距离 */ @@ -46,36 +65,71 @@ public class IcDangerousChemicalsAddEditFormDTO implements Serializable { */ private String dangerType; /** - * 负责人 + * 负责人姓名;灵山项目中此列叫联系人 */ private String principalName; + /** - * 联系电话 + * 负责人电话;灵山项目中此列叫联系电话 */ private String principalMobile; + /** * 经度 */ - @NotBlank(message = "经度不能为空", groups = {AddGroup.class}) + @NotBlank(message = "请完善经度信息", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) private String longitude; /** * 维度 */ - @NotBlank(message = "维度不能为空", groups = {AddGroup.class}) + @NotBlank(message = "请完善纬度信息", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) private String latitude; + /** - * 地址 + * 经营地址;灵山项目中此列叫企业地址 */ - @NotBlank(message = "地址不能为空", groups = {AddGroup.class}) - @Length(max = 50, message = "地址不能超过50位", groups = AddGroup.class) + @NotBlank(message = "企业地址不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) + @Length(max = 200, message = "企业地址最多输入200字", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) private String address; + /** * 备注 */ private String remark; + /** + * 灵山:是否重点安全企业;1是;0不是;必填 + */ + @NotNull(message = "是否重点安全企业不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class}) + private Boolean securityFlag; + + /** + * 灵山:安全负责人姓名 + */ + private String securityPrincipalName; + + /** + * 灵山:手机号 + */ + private String securityPrincipalMobile; + + /** + * 灵山:包企领导 + */ + private String bqLd; + + /** + * 灵山:包企干部 + */ + private String bqGb; + + /** + * 灵山:企业介绍 + */ + @Length(max = 1000,groups = {LingShanAddGroup.class, LingShanEditGroup.class},message = "企业介绍最多输入1000字") + private String companyProfile; + private String customerId; private String userId; - } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java index b0b7e589f4..39362d70b8 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import java.io.Serializable; @@ -9,34 +10,67 @@ import java.io.Serializable; * @Author sun */ @Data -public class IcDangerousChemicalsListFormDTO implements Serializable { +public class IcDangerousChemicalsListFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = 9156247659994638103L; /** - * 场所名称 + * 组织或者网格id + */ + private String orgId; + /** + * 组织:agency + * 网格:grid + */ + private String orgType; + + /** + * 灵山:GRID_ID的全路径;包含grid_id + * 接口内部赋值,用于sql,只有orgType=agency时,使用此列查询 + */ + private String orgIdPath; + + /** + * 企业名称 */ private String name; + /** - * 场所分类,字典表值 + * 企业类型,字典表值 */ private String category; + /** * 危化品种类字典值 + * 灵山界面暂无此列 */ private String dangerType; + /** - * 页码 + * 企业地址 + * 经营地址;灵山项目中此列叫企业地址 */ - private Integer pageNo = 1; + private String address; + + /** + * 联系人 + * 负责人姓名;灵山项目中此列叫联系人 + */ + private String principalName; + /** - * 每页显示数量 + * 灵山:安全负责人姓名 */ - private Integer pageSize = 20; + private String securityPrincipalName; - private Boolean isPage = true; private String icDangerousChemicalsId; + + /** + * tokenDto.customerId + */ private String customerId; + /** + * tokenDto.userId + */ private String staffId; - private String agencyId; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java index bf00d9205e..111c981357 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java @@ -17,7 +17,26 @@ public class IcDangerousChemicalsListResultDTO implements Serializable { */ private String icDangerousChemicalsId; /** - * 组织Id + * 灵山:企业所属组织/网格 + */ + private String orgId; + /** + * 灵山:组织:agency;网格:grid + */ + private String orgType; + + /** + * 灵山:ORG_ID的全路径;包含ORG_ID + */ + private String orgIdPath; + + /** + * 所属组织,可能是网格名,也可能是组织名 + */ + private String orgName; + + /** + * 所属组织机构Id;灵山:工作人员所属组织id */ private String agencyId; /** @@ -53,13 +72,15 @@ public class IcDangerousChemicalsListResultDTO implements Serializable { */ private String dangerTypeName; /** - * 负责人 + * 负责人姓名;灵山项目中此列叫联系人 */ private String principalName; + /** - * 联系电话 + * 负责人电话;灵山项目中此列叫联系电话 */ private String principalMobile; + /** * 经度 */ @@ -69,7 +90,7 @@ public class IcDangerousChemicalsListResultDTO implements Serializable { */ private String latitude; /** - * 地址 + * 经营地址;灵山项目中此列叫企业地址 */ private String address; /** @@ -77,4 +98,33 @@ public class IcDangerousChemicalsListResultDTO implements Serializable { */ private String remark; + /** + * 灵山:是否重点安全企业;1是;0不是;必填 + */ + private Boolean securityFlag; + + /** + * 灵山:安全负责人姓名 + */ + private String securityPrincipalName; + + /** + * 灵山:手机号 + */ + private String securityPrincipalMobile; + + /** + * 灵山:包企领导 + */ + private String bqLd; + + /** + * 灵山:包企干部 + */ + private String bqGb; + + /** + * 灵山:企业介绍 + */ + private String companyProfile; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index c6576dde5e..1218dc9381 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -362,14 +362,13 @@ public class AgencyController { /** * @param formDTO - * @param tokenDto * @Description 【地图配置】组织查询 * @author zxc * @date 2021/10/25 10:50 上午 */ @PostMapping("maporg") - public Result mapOrg(@RequestBody MapOrgFormDTO formDTO, @LoginUser TokenDto tokenDto) { - return new Result().ok(agencyService.mapOrg(formDTO, tokenDto)); + public Result mapOrg(@RequestBody MapOrgFormDTO formDTO) { + return new Result().ok(agencyService.mapOrg(formDTO)); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index ba94cc12ab..b7b13fd2ec 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -351,7 +351,7 @@ public class CustomerAgencyController { @PostMapping("agencylist") public Result getAgencyList(@LoginUser TokenDto tokenDTO,@RequestBody GetAgencyListFormDTO formDTO) { if(AppClientConstant.APP_OPER.equals(tokenDTO.getApp())){ - ValidatorUtils.validateEntity(formDTO.getCustomerId(),GetAgencyListFormDTO.OperAddUserShowGroup.class); + ValidatorUtils.validateEntity(formDTO,GetAgencyListFormDTO.OperAddUserShowGroup.class); }else{ if (StringUtils.isBlank(formDTO.getCustomerId())){ formDTO.setCustomerId(tokenDTO.getCustomerId()); @@ -405,6 +405,17 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId(),tokenDTO.getCustomerId())); } + /** + * 根组织开始,含网格 + * @param formDTO + * @return + */ + @PostMapping("agencygridtreeV2") + public Result getOrgList(@RequestBody GetAgencyListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,GetAgencyListFormDTO.OperAddUserShowGroup.class); + return new Result().ok(customerAgencyService.getOrgTreeData(formDTO.getUserId(),formDTO.getCustomerId())); + } + /** * @Description 【事件】社区服务热线 * @author sun diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java index d69c856fb1..5561fdcbaf 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java @@ -10,7 +10,6 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -19,9 +18,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcDangerousChemicalsDTO; import com.epmet.dto.form.IcDangerousChemicalsAddEditFormDTO; @@ -32,7 +28,6 @@ import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.excel.IcDangerousChemicalsExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcDangerousChemicalsService; -import com.epmet.utils.ImportTaskUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.IOUtils; @@ -72,6 +67,12 @@ public class IcDangerousChemicalsController { @Autowired private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; + /** + * 重点危化品企业 列表分页 + * @param tokenDto + * @param formDTO + * @return + */ @RequestMapping("list") public Result> list(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -85,26 +86,44 @@ public class IcDangerousChemicalsController { return new Result().ok(data); } + /** + * 重点危化品企业 新增 + * @param tokenDto + * @param dto + * @return + */ @NoRepeatSubmit @PostMapping("add") public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO dto) { - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + ValidatorUtils.validateEntity(dto, IcDangerousChemicalsAddEditFormDTO.LingShanAddGroup.class); dto.setCustomerId(tokenDto.getCustomerId()); dto.setUserId(tokenDto.getUserId()); icDangerousChemicalsService.save(dto); return new Result(); } + /** + * 重点危化品企业 编辑 + * @param tokenDto + * @param formDTO + * @return + */ @NoRepeatSubmit @PostMapping("edit") public Result update(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class); + ValidatorUtils.validateEntity(formDTO, IcDangerousChemicalsAddEditFormDTO.LingShanEditGroup.class); formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); icDangerousChemicalsService.update(formDTO); return new Result(); } + /** + * 重点危化品企业 删除 + * @param tokenDto + * @param formDTO + * @return + */ @PostMapping("del") public Result delete(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, IcDangerousChemicalsAddEditFormDTO.Del.class); @@ -114,19 +133,49 @@ public class IcDangerousChemicalsController { return new Result(); } + /** + * 批量删除 + * @param tokenDto + * @param ids + * @return + */ + @PostMapping("batch-del") + public Result delete(@LoginUser TokenDto tokenDto, @RequestBody List ids) { + ids.forEach(id->{ + IcDangerousChemicalsAddEditFormDTO formDTO=new IcDangerousChemicalsAddEditFormDTO(); + formDTO.setIcDangerousChemicalsId(id); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + icDangerousChemicalsService.delete(formDTO); + }); + return new Result(); + } + + /** + * 重点危化品企业 查看详情 + * @param formDTO + * @return + */ @RequestMapping("detail") public Result detail(@RequestBody IcDangerousChemicalsListFormDTO formDTO) { return new Result().ok(icDangerousChemicalsService.detail(formDTO)); } + /** + * 重点危化品企业 下载导入模板 + * @param response + * @throws IOException + */ @RequestMapping(value = "download", method = {RequestMethod.GET, RequestMethod.POST}) public void downloadTemplate(HttpServletResponse response) throws IOException { response.setCharacterEncoding("UTF-8"); response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("重点危化管理导入模板", "UTF-8") + ".xlsx"); + // response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("重点危化管理导入模板", "UTF-8") + ".xlsx"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("企业档案导入模板", "UTF-8") + ".xlsx"); - InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/dangerous_chemicals_template.xlsx"); + // InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/dangerous_chemicals_template.xlsx"); + InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/lingshan_dangerous_chemicals_template.xlsx"); try { ServletOutputStream os = response.getOutputStream(); IOUtils.copy(is, os); @@ -137,6 +186,13 @@ public class IcDangerousChemicalsController { } } + /** + * 重点危化品企业 导出 + * @param tokenDto + * @param formDTO + * @param response + * @throws IOException + */ @PostMapping("export") public void export(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO, HttpServletResponse response) throws IOException { formDTO.setCustomerId(tokenDto.getCustomerId()); @@ -146,7 +202,8 @@ public class IcDangerousChemicalsController { formDTO.setPageNo(NumConstant.ONE); formDTO.setPageSize(NumConstant.TEN_THOUSAND); try { - String fileName = "重点危化管理" + DateUtils.format(new Date()) + ".xlsx"; + // String fileName = "重点危化管理" + DateUtils.format(new Date()) + ".xlsx"; + String fileName = "企业档案" + DateUtils.format(new Date()) + ".xlsx"; // 头的策略 WriteCellStyle headWriteCellStyle = new WriteCellStyle(); // 背景设置为红色 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java index 83adfa87b8..1cc152c5f5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java @@ -20,9 +20,8 @@ public interface IcDangerousChemicalsDao extends BaseDao selectDangerousChemicalsList(IcDangerousChemicalsListFormDTO formDTO); - void del(IcDangerousChemicalsEntity entity); + void del(@Param("id") String id,@Param("updatedBy") String updatedBy); void importInsert(@Param("entityList") List entityList); - void delByAgencyAndName(IcDangerousChemicalsEntity entity); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java index 413cba21d6..6b1d55ae1e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java @@ -24,8 +24,22 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity { */ private String customerId; + /** + * 灵山:企业所属组织/网格 + */ + private String orgId; + /** + * 灵山:组织:agency;网格:grid + */ + private String orgType; + + /** + * 灵山:ORG_ID的全路径;包含ORG_ID + */ + private String orgIdPath; + /** - * 所属组织机构Id + * 所属组织机构Id;灵山:工作人员所属组织id */ private String agencyId; @@ -59,19 +73,19 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity { */ private String dangerType; - /** - * 负责人姓名 - */ + /** + * 负责人姓名;灵山项目中此列叫联系人 + */ private String principalName; - /** - * 负责人电话 - */ + /** + * 负责人电话;灵山项目中此列叫联系电话 + */ private String principalMobile; - /** - * 经营地址 - */ + /** + * 经营地址;灵山项目中此列叫企业地址 + */ private String address; /** @@ -89,6 +103,36 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity { */ private String remark; + /** + * 灵山:是否重点安全企业;1是;0不是;必填 + */ + private Boolean securityFlag; + + /** + * 灵山:安全负责人姓名 + */ + private String securityPrincipalName; + + /** + * 灵山:手机号 + */ + private String securityPrincipalMobile; + + /** + * 灵山:包企领导 + */ + private String bqLd; + + /** + * 灵山:包企干部 + */ + private String bqGb; + + /** + * 灵山:企业介绍 + */ + private String companyProfile; + @TableField(exist = false) private String dangerTypeName; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcDangerousChemicalsExcel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcDangerousChemicalsExcel.java index d7b612e504..4f1dd34ad2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcDangerousChemicalsExcel.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcDangerousChemicalsExcel.java @@ -13,27 +13,31 @@ import lombok.Data; @Data public class IcDangerousChemicalsExcel { + @ExcelProperty(value = "所属组织") + @ColumnWidth(25) + private String orgName; + @ExcelProperty(value = "企业名称") @ColumnWidth(25) private String name; - @ExcelProperty(value = "企业类型") + @ExcelProperty(value = "企业类别") @ColumnWidth(20) private String categoryName; - @ExcelProperty(value = "周边安全距离") - @ColumnWidth(20) - private String safeDistanceName; + // @ExcelProperty(value = "周边安全距离") + // @ColumnWidth(20) + // private String safeDistanceName; + // + // @ExcelProperty(value = "危化品种类") + // @ColumnWidth(20) + // private String dangerTypeName; - @ExcelProperty(value = "危化品种类") - @ColumnWidth(20) - private String dangerTypeName; - - @ExcelProperty(value = "经营地址") + @ExcelProperty(value = "企业地址") @ColumnWidth(25) private String address; - @ExcelProperty(value = "负责人") + @ExcelProperty(value = "联系人") @ColumnWidth(20) private String principalName; @@ -41,8 +45,12 @@ public class IcDangerousChemicalsExcel { @ColumnWidth(20) private String principalMobile; - @ExcelProperty(value = "备注") + @ExcelProperty(value = "安全负责人") + @ColumnWidth(25) + private String securityPrincipalName; + + @ExcelProperty(value = "安全负责人电话") @ColumnWidth(25) - private String remark; + private String securityPrincipalMobile; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java index 0511f8f6fc..2666b7a478 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java @@ -2,35 +2,30 @@ package com.epmet.model; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum; -import com.epmet.commons.tools.enums.DictTypeEnum; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ValidateException; -import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dao.IcDangerousChemicalsDao; -import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.CustomerGridDTO; import com.epmet.entity.IcDangerousChemicalsEntity; -import com.epmet.excel.IcCityManagementExcel; -import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.service.CoverageService; +import com.epmet.service.CustomerAgencyService; +import com.epmet.service.CustomerGridService; import com.epmet.service.IcDangerousChemicalsService; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * @Author zxc @@ -42,24 +37,51 @@ import java.util.stream.Collectors; public class DangerousChemicalsImportListener extends AnalysisEventListener { private IcDangerousChemicalsService icDangerousChemicalsService; - private EpmetAdminOpenFeignClient adminOpenFeignClient; private CoverageService coverageService; - private AgencyInfoCache agencyInfo; - private IcDangerousChemicalsDao icDangerousChemicalsDao; + private CustomerAgencyService customerAgencyService; + private CustomerGridService customerGridService; private String currentUserId; - + private String customerId; + private String staffAgencyId; + private String staffAgencyPath; private List errorRows = new ArrayList<>(); private List otherRows = new ArrayList<>(); private List insertList = new ArrayList<>(); - private Map existMap = null; + private List updateList = new ArrayList<>(); + // /** + // * 危化品种类 + // */ + // private Map dangerTypeMap; + /** + * 企业类别 + */ + private Map categoryDictMap; + /** + * key:网格id + * value:网格名称 + */ + private Map gridMap; - public DangerousChemicalsImportListener(String currentUserId, AgencyInfoCache agencyInfo, IcDangerousChemicalsService icDangerousChemicalsService, CoverageService coverageService, EpmetAdminOpenFeignClient adminOpenFeignClient, IcDangerousChemicalsDao icDangerousChemicalsDao){ + public DangerousChemicalsImportListener(String currentUserId, + String customerId, + String staffAgencyId, + String staffAgencyPath, + IcDangerousChemicalsService icDangerousChemicalsService, + CoverageService coverageService, + CustomerAgencyService customerAgencyService, + CustomerGridService customerGridService, + Map dangerTypeMap, + Map categoryDictMap){ this.currentUserId = currentUserId; - this.agencyInfo = agencyInfo; + this.customerId=customerId; + this.staffAgencyId=staffAgencyId; + this.staffAgencyPath=staffAgencyPath; this.icDangerousChemicalsService = icDangerousChemicalsService; this.coverageService = coverageService; - this.adminOpenFeignClient = adminOpenFeignClient; - this.icDangerousChemicalsDao = icDangerousChemicalsDao; + this.customerAgencyService=customerAgencyService; + this.customerGridService=customerGridService; + // this.dangerTypeMap=dangerTypeMap; + this.categoryDictMap=categoryDictMap; } @Override @@ -68,29 +90,72 @@ public class DangerousChemicalsImportListener extends AnalysisEventListener entry : categoryDictMap.entrySet()) { + if (data.getCategoryName().equals(entry.getValue())) { + categoryKey = entry.getKey(); + break; + } + } + if (StringUtils.isBlank(categoryKey)) { + throw new ValidateException("【" + data.getCategoryName() + "】此企业类别不存在"); + } + e.setCategory(categoryKey); e.setSourceType("import"); - e.setAgencyId(agencyInfo.getId()); - e.setCustomerId(agencyInfo.getCustomerId()); - e.setAgencyIdPath(agencyInfo.getPids().equals(NumConstant.ZERO_STR) || agencyInfo.getPids().equals("") ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId())); + e.setCustomerId(customerId); + e.setAgencyId(staffAgencyId); + e.setAgencyIdPath(staffAgencyPath); e.setCreatedBy(currentUserId); e.setUpdatedBy(currentUserId); - insertList.add(e); - if (insertList.size() == NumConstant.ONE_HUNDRED){ + e.setSecurityFlag("是".equals(data.getSecurityFlagName()) ? true : false); + // 判断是否存在 + IcDangerousChemicalsEntity origin=icDangerousChemicalsService.get(e.getOrgId(),e.getName()); + if (null != origin) { + e.setId(origin.getId()); + updateList.add(origin); + } else { + insertList.add(e); + } + if (insertList.size() == NumConstant.ONE_HUNDRED) { + execPersist(); + } + if (updateList.size() == NumConstant.ONE_HUNDRED) { execPersist(); } }catch (Exception e){ String errorMsg = null; if (e instanceof ValidateException) { errorMsg = ((ValidateException) e).getMsg(); - } else { + }else if(e instanceof EpmetException){ + errorMsg=((EpmetException) e).getMsg(); + }else { errorMsg = "未知错误"; log.error("【重点危化品企业导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); } @@ -105,68 +170,21 @@ public class DangerousChemicalsImportListener extends AnalysisEventListener getExistMap(String agencyId){ - LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); - tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, agencyId); - List entityList = icDangerousChemicalsDao.selectList(tWrapper); - Map existMap = new HashMap<>(16); - if (CollectionUtils.isNotEmpty(entityList)){ - existMap = entityList.stream().collect(Collectors.toMap(IcDangerousChemicalsEntity::getName,IcDangerousChemicalsEntity::getId,(v1,v2) -> v1)); - } - return existMap; - } /** * Desc: 数据库插入 */ private void execPersist() { try { if (CollectionUtils.isNotEmpty(insertList)) { - //危化品种类字典 - Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_DANGER_TYPE.getCode()); - if (!statusRes.success()){ - throw new EpmetException("获取IC_DANGER_TYPE字典表失败"); - } - Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(16); - //企业类别字典数据 - List dictList = coverageService.dictMap(agencyInfo.getCustomerId(), CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode()); - Map dictMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel)); - insertList.forEach(i -> { - statusMap.forEach((k,v) -> { - if (i.getDangerTypeName().equals(v)){ - i.setDangerType(k); - } - }); - dictMap.forEach((k,v) -> { - if (i.getCategoryName().equals(v)){ - i.setCategory(k); - } - }); - }); - Map groupByName = insertList.stream().collect(Collectors.groupingBy(IcDangerousChemicalsEntity::getName, Collectors.counting())); - groupByName.forEach((k,v) -> { - if (v.compareTo(NumConstant.ONE_L) != NumConstant.ZERO){ - insertList.forEach(i -> { - if (i.getName().equals(k)){ - i.setExistStatus(true); - } - }); - } - }); - Map> groupByStatus = insertList.stream().collect(Collectors.groupingBy(IcDangerousChemicalsEntity::getExistStatus)); - if (CollectionUtils.isNotEmpty(groupByStatus.get(true))){ - groupByStatus.get(true).forEach(t -> { - DangerousChemicalsModel.RowRemarkMessage errorRow = ConvertUtils.sourceToTarget(t, DangerousChemicalsModel.RowRemarkMessage.class); - errorRow.setErrorInfo("表格中存在重复数据"); - errorRows.add(errorRow); - }); - } - if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){ - icDangerousChemicalsService.importInsert(groupByStatus.get(false)); - } + icDangerousChemicalsService.insertBatch(insertList); + } + + if (CollectionUtils.isNotEmpty(updateList)) { + icDangerousChemicalsService.updateBatchById(updateList); } } finally { insertList.clear(); - existMap = null; + updateList.clear(); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java index 199ab033cd..d18dd7566a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java @@ -3,7 +3,6 @@ package com.epmet.model; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; -import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -17,46 +16,98 @@ import javax.validation.constraints.NotBlank; @Data public class DangerousChemicalsModel { + @NotBlank(message = "所属组织不能为空") + @ExcelProperty(value = "所属组织") + private String agencyName; + + @ExcelProperty(value = "所属网格") + private String gridName; + @NotBlank(message = "企业名称不能为空") - @Length(max = 50,message = "企业名称长度超出50字限制") + @Length(max = 35, message = "企业名称最多输入35字") @ExcelProperty(value = "企业名称") private String name; - @NotBlank(message = "企业类型不能为空") - @ExcelProperty(value = "企业类型") + @NotBlank(message = "企业类别不能为空") + @ExcelProperty(value = "企业类别") private String categoryName; - @ExcelProperty(value = "周边安全间距(公里)") - private String safeDistance = NumConstant.ZERO_STR; - - @ExcelProperty(value = "危化品种类") - private String dangerTypeName; + /** + * 灵山:是否重点安全企业;1是;0不是;必填 + */ + @NotBlank(message = "是否重点安全企业不能为空") + @ExcelProperty(value = "是否重点安全企业") + private String securityFlagName; + + // @ExcelProperty(value = "周边安全间距(公里)") + // private String safeDistance = NumConstant.ZERO_STR; + // + // @ExcelProperty(value = "危化品种类") + // private String dangerTypeName; + + @NotBlank(message = "企业地址不能为空") + @Length(max = 200, message = "企业地址最多输入200字") + @ExcelProperty(value = "企业地址") + private String address; - @ExcelProperty(value = "负责人") + @ExcelProperty(value = "联系人") private String principalName; - @Length(max = 50,message = "联系电话长度超出50字限制") + @Length(max = 50, message = "联系电话长度超出50字限制") @ExcelProperty(value = "联系电话") private String principalMobile; - @NotBlank(message = "经营地址不能为空") - @Length(max = 50,message = "经营地址长度超出50字限制") - @ExcelProperty(value = "经营地址") - private String address; - - @ExcelProperty(value = "备注") - private String remark; + // @ExcelProperty(value = "备注") + // private String remark; + + /** + * 灵山:安全负责人姓名 + */ + @ExcelProperty(value = "安全负责人姓名") + private String securityPrincipalName; + + /** + * 灵山:手机号 + */ + @ExcelProperty(value = "手机号") + private String securityPrincipalMobile; + + /** + * 灵山:包企领导 + */ + @ExcelProperty(value = "包企领导") + private String bqLd; + + /** + * 灵山:包企干部 + */ + @ExcelProperty(value = "包企干部") + private String bqGb; + + /** + * 灵山:企业介绍 + */ + @Length(max = 1000, message = "企业介绍最多输入1000字") + @ExcelProperty(value = "企业介绍") + private String companyProfile; @ExcelIgnore private Integer rowNum; @Data public static class RowRemarkMessage { - @ExcelProperty(value = "行号") private Integer rowNum; @ColumnWidth(20) + @ExcelProperty(value = "所属组织") + private String agencyName; + + @ColumnWidth(20) + @ExcelProperty(value = "所属网格") + private String gridName; + + @ColumnWidth(40) @ExcelProperty(value = "企业名称") private String name; @@ -64,29 +115,62 @@ public class DangerousChemicalsModel { @ExcelProperty(value = "企业类型") private String categoryName; + /** + * 灵山:是否重点安全企业;1是;0不是;必填 + */ @ColumnWidth(20) - @ExcelProperty(value = "周边安全间距(公里)") - private String safeDistance = NumConstant.ZERO_STR; + @ExcelProperty(value = "是否重点安全企业") + private String securityFlag; - @ColumnWidth(20) - @ExcelProperty(value = "危化品种类") - private String dangerTypeName; + @ColumnWidth(50) + @ExcelProperty(value = "企业地址") + private String address; @ColumnWidth(20) - @ExcelProperty(value = "负责人") + @ExcelProperty(value = "联系人") private String principalName; @ColumnWidth(20) @ExcelProperty(value = "联系电话") private String principalMobile; - @ColumnWidth(40) - @ExcelProperty(value = "经营地址") - private String address; + // @ExcelProperty(value = "备注") + // private String remark; - @ColumnWidth(60) - @ExcelProperty(value = "备注") - private String remark; + /** + * 灵山:安全负责人姓名 + */ + @ColumnWidth(20) + @ExcelProperty(value = "安全负责人姓名") + private String securityPrincipalName; + + /** + * 灵山:手机号 + */ + @ColumnWidth(20) + @ExcelProperty(value = "手机号") + private String securityPrincipalMobile; + + /** + * 灵山:包企领导 + */ + @ColumnWidth(30) + @ExcelProperty(value = "包企领导") + private String bqLd; + + /** + * 灵山:包企干部 + */ + @ColumnWidth(30) + @ExcelProperty(value = "包企干部") + private String bqGb; + + /** + * 灵山:企业介绍 + */ + @ColumnWidth(50) + @ExcelProperty(value = "企业介绍") + private String companyProfile; @ColumnWidth(60) @ExcelProperty("错误信息") diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java index d7bb4b2564..126a4ac975 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java @@ -118,12 +118,11 @@ public interface AgencyService { /** * @param formDTO - * @param tokenDto * @Description 【地图配置】组织查询 * @author zxc * @date 2021/10/25 10:50 上午 */ - MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO, TokenDto tokenDto); + MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO); /** * @param formDTO diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index f9ac7182e7..bf2f7b855e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -18,7 +18,6 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -268,7 +267,7 @@ public interface CustomerAgencyService extends BaseService /** * desc:获取用户所属组织的组织及网格树 - * @param staffId + * @param staffId 为空时,从根组织返回 * @return */ AgencyTreeResultDTO getOrgTreeData(String staffId,String customerId); @@ -355,4 +354,6 @@ public interface CustomerAgencyService extends BaseService * @Date 2022/11/30 22:41 **/ Result> getCurrentUserCommunityInfo(TokenDto tokenDTO); + + CustomerAgencyDTO getByAgencyName(String customerId,String agencyName); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index c3ba7c1286..213e000ba6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -387,4 +387,6 @@ public interface CustomerGridService extends BaseService { * @param formDTO */ void abandonGridForDealBizData(AbandonGridFormDTO formDTO); + + CustomerGridDTO get(CustomerGridDTO forDto); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcDangerousChemicalsService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcDangerousChemicalsService.java index 89b3c667ca..be86798fd5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcDangerousChemicalsService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcDangerousChemicalsService.java @@ -81,5 +81,5 @@ public interface IcDangerousChemicalsService extends BaseService entityList); - + IcDangerousChemicalsEntity get(String orgId, String name); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index fcb04db161..9b7ee4e3ba 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -32,6 +32,7 @@ import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.*; @@ -732,7 +733,6 @@ public class AgencyServiceImpl implements AgencyService { /** * @param formDTO - * @param tokenDto * @Description 【地图配置】组织查询 * 根据level查询去查询不同的表,类型,组织:agency,网格:grid,小区:neighborHood * 组织类型去查 customer_agency,看本级是不是 community,是,下级组织就是网格,查询customer_grid,不是,继续查customer_agency @@ -743,19 +743,35 @@ public class AgencyServiceImpl implements AgencyService { * @date 2021/10/25 10:50 上午 */ @Override - public MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO, TokenDto tokenDto) { + public MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO) { MapOrgResultDTO result = new MapOrgResultDTO(); - LambdaQueryWrapper qw = new LambdaQueryWrapper(); - qw.eq(CustomerAgencyEntity::getPid, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getDelFlag, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getCustomerId, tokenDto.getCustomerId()); - CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectOne(qw); + + String customerId = null; + if (StringUtils.isBlank(formDTO.getOrgId())) { - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + // 没有传参,则使用当前用户所属组织 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo((customerId = EpmetRequestHolder.getLoginUserCustomerId()), EpmetRequestHolder.getLoginUserId()); if (null == staffInfo) { return result; } formDTO.setOrgId(staffInfo.getAgencyId()); formDTO.setLevel(OrgInfoConstant.AGENCY); + } else { + // 前段传递了,那就用前端传递的level和orgId,并且查出来这个组织的客户id,用于后面查询跟组织中心点 + if (OrgInfoConstant.AGENCY.equals(formDTO.getLevel())) { + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId()); + customerId = agencyInfo.getCustomerId(); + } else if (OrgInfoConstant.GRID.equals(formDTO.getLevel())) { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getOrgId()); + customerId = gridInfo.getCustomerId(); + } } + + // 查询客户跟组织中心点 + LambdaQueryWrapper qw = new LambdaQueryWrapper(); + qw.eq(CustomerAgencyEntity::getPid, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getDelFlag, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getCustomerId, customerId); + CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectOne(qw); + if (StringUtils.isNotBlank(customerAgencyEntity.getLatitude())) { result.setLatitude(new BigDecimal(customerAgencyEntity.getLatitude())); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index a6702963c4..c0bae678b1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -1177,14 +1178,35 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl%s", staffId)); - throw new RenException(CustomerAgencyConstant.SELECT_STAFF_AGENCY_EXCEPTION); + AgencyResultDTO rootAgency=new AgencyResultDTO(); + if(StringUtils.isNotBlank(staffId)){ + //1.查询工作人员所属组织信息 + rootAgency = baseDao.selectAgencyByStaffId(staffId); + if (null == rootAgency) { + logger.error(String.format("查询工作人员所属组织信息失败,staffId->%s", staffId)); + throw new RenException(CustomerAgencyConstant.SELECT_STAFF_AGENCY_EXCEPTION); + } + }else{ + LambdaQueryWrapper rootQuery=new LambdaQueryWrapper<>(); + rootQuery.eq(CustomerAgencyEntity::getCustomerId,customerId) + .eq(CustomerAgencyEntity::getPid,NumConstant.ZERO_STR); + CustomerAgencyEntity rootEntity=baseDao.selectOne(rootQuery); + rootAgency.setAgencyId(rootEntity.getId()); + rootAgency.setAgencyName(rootEntity.getOrganizationName()); + rootAgency.setPids(rootEntity.getPids()); + rootAgency.setPid(rootEntity.getPid()); + rootAgency.setLevel(rootEntity.getLevel()); + rootAgency.setLongitude(rootEntity.getLongitude()); + rootAgency.setLatitude(rootEntity.getLatitude()); } result.setPid(rootAgency.getPid()); result.setAgencyName(rootAgency.getAgencyName()); @@ -1607,4 +1629,13 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl>().ok(list); } + @Override + public CustomerAgencyDTO getByAgencyName(String customerId,String agencyName) { + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(CustomerAgencyEntity::getOrganizationName,agencyName) + .eq(CustomerAgencyEntity::getCustomerId,customerId) + .last("limit 1"); + CustomerAgencyEntity customerAgencyEntity=baseDao.selectOne(queryWrapper); + return ConvertUtils.sourceToTarget(customerAgencyEntity,CustomerAgencyDTO.class); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index cbcce699ac..e165811212 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -1095,4 +1095,14 @@ public class CustomerGridServiceImpl extends BaseServiceImpl queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(StringUtils.isNotBlank(formDto.getCustomerId()),CustomerGridEntity::getCustomerId,formDto.getCustomerId()) + .eq(StringUtils.isNotBlank(formDto.getPid()),CustomerGridEntity::getPid,formDto.getPid()) + .eq(StringUtils.isNotBlank(formDto.getGridName()),CustomerGridEntity::getGridName,formDto.getGridName()) + .last("limit 1"); + CustomerGridEntity customerGridEntity=baseDao.selectOne(queryWrapper); + return ConvertUtils.sourceToTarget(customerGridEntity,CustomerGridDTO.class); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java index c62bad0456..4bb95cf9a0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java @@ -2,41 +2,41 @@ package com.epmet.service.impl; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum; import com.epmet.commons.tools.enums.DictTypeEnum; +import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; -import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.FileUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcDangerousChemicalsDao; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.IcDangerousChemicalsDTO; +import com.epmet.dto.form.BelongGridNameFormDTO; import com.epmet.dto.form.IcDangerousChemicalsAddEditFormDTO; import com.epmet.dto.form.IcDangerousChemicalsListFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; -import com.epmet.dto.result.IcCityManagementListResultDTO; import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO; import com.epmet.dto.result.IcDangerousChemicalsListResultDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.IcDangerousChemicalsEntity; -import com.epmet.entity.IcSuperiorResourceEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.model.DangerousChemicalsImportListener; import com.epmet.model.DangerousChemicalsModel; import com.epmet.service.CoverageService; +import com.epmet.service.CustomerAgencyService; +import com.epmet.service.CustomerGridService; import com.epmet.service.IcDangerousChemicalsService; import com.epmet.utils.ImportTaskUtils; import com.github.pagehelper.PageHelper; @@ -84,16 +84,26 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl list(IcDangerousChemicalsListFormDTO formDTO) { - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); - if (null == staffInfo) { - throw new EpmetException("获取工作人员信息失败"); + if(StringUtils.isBlank(formDTO.getOrgId())||StringUtils.isBlank(formDTO.getOrgType())){ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo) { + throw new EpmetException("获取工作人员信息失败"); + } + //查询当前组织及下级数据 + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType(OrgTypeEnum.AGENCY.getCode()); } - //查询当前组织及下级数据 - formDTO.setAgencyId(staffInfo.getAgencyId()); + if(OrgTypeEnum.AGENCY.getCode().equals(formDTO.getOrgType())){ + CustomerAgencyDTO agencyDTO=SpringContextUtils.getBean(CustomerAgencyService.class).get(formDTO.getOrgId()); + formDTO.setOrgIdPath(PidUtils.convertPid2OrgIdPath(agencyDTO.getId(),agencyDTO.getPids())); + } + //列表/导出查询 PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); List list = baseDao.selectDangerousChemicalsList(formDTO); @@ -114,20 +124,20 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl(list, pageInfo.getTotal()); } - private QueryWrapper getWrapper(Map params) { - String id = (String) params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } @Override public IcDangerousChemicalsDTO get(String id) { @@ -138,60 +148,68 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl tWrapper = new LambdaQueryWrapper<>(); - tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, staffInfo.getAgencyId()); - tWrapper.eq(IcDangerousChemicalsEntity::getName, formDTO.getName()); - List entityList = baseDao.selectList(tWrapper); - if (!CollectionUtils.isEmpty(entityList)) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的场所"); - } - //3.新增服务组织数据 + //同一网格下,企业名称唯一 + checkNameUnqiue(formDTO.getOrgId(),formDTO.getName(), StrConstant.EPMETY_STR); + //新增服务组织数据 IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class); entity.setSourceType("add"); - entity.setAgencyId(staffInfo.getAgencyId()); - entity.setAgencyIdPath(StringUtils.isEmpty(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":" + staffInfo.getAgencyId()); + CustomerStaffInfoCacheResult staffInfoCacheResult=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getUserId()); + entity.setAgencyId(staffInfoCacheResult.getAgencyId()); + entity.setAgencyIdPath(StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) ? staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()) : staffInfoCacheResult.getAgencyId()); + if(OrgTypeEnum.GRID.getCode().equals(formDTO.getOrgType())){ + // 获取网格信息 + CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getOrgId()); + entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids())); + }else if(OrgTypeEnum.AGENCY.getCode().equals(formDTO.getOrgType())){ + CustomerAgencyDTO customerAgencyDTO=SpringContextUtils.getBean(CustomerAgencyService.class).get(formDTO.getOrgId()); + entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerAgencyDTO.getId(),customerAgencyDTO.getPids())); + } insert(entity); } + /** + * 同一网格下,企业名称唯一 + * @param orgId + * @param name + * @param icDangerousChemicalsId + */ + public void checkNameUnqiue(String orgId, String name, String icDangerousChemicalsId) { + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(IcDangerousChemicalsEntity::getOrgId, orgId); + tWrapper.eq(IcDangerousChemicalsEntity::getName, name) + .ne(StringUtils.isNotBlank(icDangerousChemicalsId),IcDangerousChemicalsEntity::getId,icDangerousChemicalsId); + if (baseDao.selectCount(tWrapper) > NumConstant.ZERO) { + String msg = String.format("所属组织下已存在%s", name); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); + } + } + @Override @Transactional(rollbackFor = Exception.class) public void update(IcDangerousChemicalsAddEditFormDTO formDTO) { - //1.获取当前工作人员缓存信息 - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); - if (null == staffInfo) { - throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); - } - //2.校验同组织下服务组织名称不能重复 - LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); - tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, staffInfo.getAgencyId()); - tWrapper.ne(IcDangerousChemicalsEntity::getId, formDTO.getIcDangerousChemicalsId()); - tWrapper.eq(IcDangerousChemicalsEntity::getName, formDTO.getName()); - List entityList = baseDao.selectList(tWrapper); - if (!CollectionUtils.isEmpty(entityList)) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的服务组织"); - } + // 2.同一网格下,企业名称唯一 + checkNameUnqiue(formDTO.getOrgId(),formDTO.getName(), formDTO.getIcDangerousChemicalsId()); //3.更新服务组织数据 IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class); entity.setId(formDTO.getIcDangerousChemicalsId()); + CustomerStaffInfoCacheResult staffInfoCacheResult=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getUserId()); + entity.setAgencyId(staffInfoCacheResult.getAgencyId()); + entity.setAgencyIdPath(StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) ? staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()) : staffInfoCacheResult.getAgencyId()); + if(OrgTypeEnum.GRID.getCode().equals(formDTO.getOrgType())){ + // 获取网格信息 + CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getOrgId()); + entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids())); + }else if(OrgTypeEnum.AGENCY.getCode().equals(formDTO.getOrgType())){ + CustomerAgencyDTO customerAgencyDTO=SpringContextUtils.getBean(CustomerAgencyService.class).get(formDTO.getOrgId()); + entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerAgencyDTO.getId(),customerAgencyDTO.getPids())); + } updateById(entity); } @Override @Transactional(rollbackFor = Exception.class) public void delete(IcDangerousChemicalsAddEditFormDTO formDTO) { - IcDangerousChemicalsEntity entity = baseDao.selectById(formDTO.getIcDangerousChemicalsId()); - //先删除本组织先可能存在的名称相同的已经是无效的历史数据,为了表中的唯一索引不失效 - baseDao.delByAgencyAndName(entity); - //再把当前数据置为无效数据 - entity.setId(formDTO.getIcDangerousChemicalsId()); - entity.setUpdatedBy(formDTO.getUserId()); - baseDao.del(entity); + baseDao.del(formDTO.getIcDangerousChemicalsId(),formDTO.getUserId()); } @Override @@ -231,15 +249,32 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_DANGER_TYPE.getCode()); + if (!statusRes.success() || MapUtils.isEmpty(statusRes.getData())) { + throw new EpmetException("获取IC_DANGER_TYPE字典表失败"); } - DangerousChemicalsImportListener listener = new DangerousChemicalsImportListener(tokenDto.getUserId(), agencyInfo,this,coverageService,adminOpenFeignClient,icDangerousChemicalsDao); + Map dangerTypeMap = statusRes.getData(); + //企业类别字典数据 + List dictList = coverageService.dictMap(tokenDto.getCustomerId(), CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode()); + Map categoryDictMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel)); + + DangerousChemicalsImportListener listener = new DangerousChemicalsImportListener(tokenDto.getUserId(), tokenDto.getCustomerId(), + staffInfo.getAgencyId(),staffAgencyPath, + this, + coverageService, + customerAgencyService, + customerGridService, + dangerTypeMap, + categoryDictMap); + EasyExcel.read(filePath.toFile(), DangerousChemicalsModel.class, listener).headRowNumber(1).sheet(0).doRead(); String errorDesFileUrl = null; List errorRows = listener.getErrorRows(); @@ -291,7 +326,7 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(IcDangerousChemicalsEntity::getOrgId,orgId).eq(IcDangerousChemicalsEntity::getName,name); + return baseDao.selectOne(queryWrapper); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/excel/lingshan_dangerous_chemicals_template.xlsx b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/lingshan_dangerous_chemicals_template.xlsx new file mode 100644 index 0000000000..effc8937d1 Binary files /dev/null and b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/lingshan_dangerous_chemicals_template.xlsx differ diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml index 99d3138558..936cda737e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml @@ -67,48 +67,73 @@ updated_time = NOW() - SELECT - id icDangerousChemicalsId, - agency_id agencyId, - source_type sourceType, - `name` name, - category category, - safe_distance safeDistance, - CONCAT(safe_distance,'公里') safeDistanceName, - danger_type dangerType, - principal_name principalName, - principal_mobile principalMobile, - address address, - longitude longitude, - latitude latitude, - remark remark + dc.id icDangerousChemicalsId, + dc.ORG_ID orgId, + dc.org_type orgType, + dc.org_id_path as orgIdPath, + dc.agency_id agencyId, + dc.source_type sourceType, + dc.`name` name, + dc.category category, + dc.safe_distance safeDistance, + CONCAT(dc.safe_distance,'公里') safeDistanceName, + dc.danger_type dangerType, + dc.principal_name principalName, + dc.principal_mobile principalMobile, + dc.address address, + dc.longitude longitude, + dc.latitude latitude, + dc.remark remark, + dc.SECURITY_FLAG securityFlag, + dc.SECURITY_PRINCIPAL_NAME securityPrincipalName, + dc.SECURITY_PRINCIPAL_MOBILE securityPrincipalMobile, + dc.BQ_LD bqLd, + dc.BQ_GB bqGb, + dc.COMPANY_PROFILE companyProfile FROM - ic_dangerous_chemicals + ic_dangerous_chemicals dc WHERE - del_flag = '0' + dc.del_flag = '0' - AND id = #{icDangerousChemicalsId} + AND dc.id = #{icDangerousChemicalsId} - AND customer_id = #{customerId} + AND dc.customer_id = #{customerId} - - AND agency_id_path LIKE CONCAT('%',#{agencyId},'%') + + + AND dc.AGENCY_ID_PATH like concat(#{orgIdPath},'%') + + + + + AND dc.ORG_ID=#{orgId} + - AND name LIKE CONCAT('%', #{name}, '%') + AND dc.name LIKE CONCAT('%', #{name}, '%') - AND category = #{category} + AND dc.category = #{category} - AND danger_type = #{dangerType} + AND dc.danger_type = #{dangerType} + + + AND dc.ADDRESS LIKE CONCAT('%',#{address},'%') + + + AND dc.PRINCIPAL_NAME LIKE CONCAT('%',#{principalName},'%') + + + AND dc.SECURITY_PRINCIPAL_NAME LIKE CONCAT('%',#{securityPrincipalName},'%') - ORDER BY created_time DESC + ORDER BY dc.created_time DESC - + UPDATE ic_dangerous_chemicals SET del_flag = '1', updated_by = #{updatedBy}, @@ -118,14 +143,5 @@ AND del_flag = '0' - - DELETE - FROM - ic_dangerous_chemicals - WHERE - del_flag != '0' - AND agency_id = #{agencyId} - AND `name` = #{name} - \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventAddEditFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventAddEditFormDTO.java new file mode 100644 index 0000000000..d31d57b3d1 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventAddEditFormDTO.java @@ -0,0 +1,83 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +@Data +public class EventAddEditFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 事件编号 + */ + private String code; + /** + * 事件状态 + */ + private String status; + /** + * 上报人员 + */ + private String reporter; + /** + * 联系电话 + */ + private String phone; + /** + * 上报事件 + */ + private Date reportDate; + /** + * 紧急程度 + */ + private String urgency; + /** + * 所属网格 + */ + private String grid; + /** + * 事件类型 + */ + private String eventType; + /** + * 即办类型 + */ + private String type; + /** + * 办理期限 + */ + private Date lastDate; + + /** + * 满意度 + */ + private String satisficing; + + /** + * 页码 + */ + private Integer pageNo = 1; + /** + * 每页显示数量 + */ + private Integer pageSize = 20; + + private Boolean isPage = true; + + + private String customerId; + + private String agencyId; + + private String staffId; + + private String userId; + + private String app; + + private String client; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventFormsDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventFormsDTO.java new file mode 100644 index 0000000000..a9c4c2baa5 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/EventFormsDTO.java @@ -0,0 +1,86 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 灵山项目事件 formDTO + */ + +@Data +public class EventFormsDTO implements Serializable { + private static final long serialVersionUID = 1; + + public interface Detail extends CustomerClientShowGroup { + } + + public interface GovRedDot extends CustomerClientShowGroup { + } + + /** + * 事件编号 + */ + private String code; + /** + * 事件状态 + */ + private String status; + /** + * 上报人员 + */ + private String reporter; + /** + * 联系电话 + */ + private String phone; + /** + * 上报事件 + */ + private Date reportDate; + /** + * 紧急程度 + */ + private String urgency; + /** + * 所属网格 + */ + private String grid; + /** + * 事件类型 + */ + private String eventType; + /** + * 即办类型 + */ + private String type; + /** + * 办理期限 + */ + private Date lastDate; + + /** + * 满意度 + */ + private String satisficing; + + /** + * 页码 + */ + private Integer pageNo = 1; + /** + * 每页显示数量 + */ + private Integer pageSize = 20; + + private Boolean isPage = true; + + + private String customerId; + + private String agencyId; + + private String staffId; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventResultDTO.java new file mode 100644 index 0000000000..059905086a --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/EventResultDTO.java @@ -0,0 +1,102 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 即墨灵山项目 + */ + +@Data +public class EventResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 事件编号 + */ + private String code; + + /** + * 事件状态 + */ + private String status; + + /** + * 事件明细ID + */ + private String detailId; + /** + * 上报人员 + */ + private String reporter; + /** + * 联系电话 + */ + private String phone; + /** + * 上报事件事件 + */ + private Date reportDate; + /** + * 紧急程度 + */ + private String urgency; + /** + * 所属网格 + */ + private String grid; + /** + * 事件类型 + */ + private String eventType; + /** + * 即办类型 + */ + private String type; + /** + * 办理期限 + */ + private Date lastDate; + /** + * 事件地址 + */ + private String eventAddr; + + /** + * 坐标经度 + */ + private String longitude; + /** + * 坐标纬度 + */ + private String latitude; + /** + * 音频 + */ + private String voice; + /** + * 视频 + */ + private String video; + /** + * 满意度 + */ + private String satisficing; + /** + * 解决情况 + */ + private String remark; + /** + * 事件描述 + */ + private String conetnt; + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java new file mode 100644 index 0000000000..2a85af367f --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/EventController.java @@ -0,0 +1,88 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.form.EventAddEditFormDTO; +import com.epmet.dto.form.EventFormsDTO; +import com.epmet.dto.result.EventResultDTO; +import com.epmet.service.EventService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @author yan Lu + * @date 2023-04-14 19:07 + * @deprecated 社会治理--事件处理 + */ +@Slf4j +@RestController +@RequestMapping("event") +public class EventController { + + @Autowired + private EventService eventService; + + /** + * 社会治理 事件列表 + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("list") + public Result> getList(@LoginUser TokenDto tokenDto, @RequestBody EventFormsDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + return new Result>().ok(eventService.getList(formDTO)); + } + + /** + * @deprecated 根据ID获取事件 + * @param id + * @return + */ + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + EventResultDTO data = eventService.getById(id); + return new Result().ok(data); + } + + + @NoRepeatSubmit + @PostMapping("add") + public Result save(@LoginUser TokenDto tokenDto, @RequestBody EventAddEditFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddGroup.class, DefaultGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setApp(tokenDto.getApp()); + formDTO.setClient(tokenDto.getClient()); + eventService.save(formDTO); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody EventResultDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + eventService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + eventService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/EventEntityDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/EventEntityDao.java new file mode 100644 index 0000000000..fe05484677 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/EventEntityDao.java @@ -0,0 +1,19 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.EventFormsDTO; +import com.epmet.dto.result.EventResultDTO; +import com.epmet.entity.EventEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 灵山项目 + */ + +@Mapper +public interface EventEntityDao extends BaseDao { + + List getList(EventFormsDTO formDTO); +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventDetailEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventDetailEntity.java new file mode 100644 index 0000000000..84d4c2e0c8 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventDetailEntity.java @@ -0,0 +1,43 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("event_detail") +public class EventDetailEntity extends BaseEpmetEntity { + + /** + * 事件ID + */ + private String eventId; + /** + * 上报人 + */ + private String reporter; + /** + * 接收人 + */ + private String recipient; + /** + * 上报事件 + */ + private Date reportDate; + /** + * 事件附件地址 + */ + private String atts; + /** + * 事件处理耗时 + */ + private String timeSpent; + /** + * 反馈内容 + */ + private String content; +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventEntity.java new file mode 100644 index 0000000000..1d6212adcf --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/EventEntity.java @@ -0,0 +1,97 @@ +package com.epmet.entity; + + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 灵山项目事件 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("event_entity") +public class EventEntity extends BaseEpmetEntity { + + /** + * 事件编号 + */ + private String code; + /** + * 事件状态 + */ + private String status; + /** + * 事件明细ID + */ + private String detailId; + /** + * 上报人员 + */ + private String reporter; + /** + * 联系电话 + */ + private String phone; + /** + * 上报事件事件 + */ + private Date reportDate; + /** + * 紧急程度 + */ + private String urgency; + /** + * 所属网格 + */ + private String grid; + /** + * 事件类型 + */ + private String eventType; + /** + * 即办类型 + */ + private String type; + /** + * 办理期限 + */ + private Date lastDate; + /** + * 事件地址 + */ + private String eventAddr; + + /** + * 坐标经度 + */ + private String longitude; + /** + * 坐标纬度 + */ + private String latitude; + /** + * 音频 + */ + private String voice; + /** + * 视频 + */ + private String video; + /** + * 满意度 + */ + private String satisficing; + /** + * 解决情况 + */ + private String remark; + /** + * 事件描述 + */ + private String conetnt; + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/EventService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/EventService.java new file mode 100644 index 0000000000..07371f7f4f --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/EventService.java @@ -0,0 +1,19 @@ +package com.epmet.service; + + +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.EventAddEditFormDTO; +import com.epmet.dto.form.EventFormsDTO; +import com.epmet.dto.result.EventResultDTO; + +public interface EventService { + PageData getList(EventFormsDTO formDTO); + + EventResultDTO getById(String id); + + void update(EventResultDTO dto); + + void delete(String[] ids); + + void save(EventAddEditFormDTO dto); +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java new file mode 100644 index 0000000000..7567d05e6d --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java @@ -0,0 +1,136 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.EventEntityDao; +import com.epmet.dto.form.EventAddEditFormDTO; +import com.epmet.dto.form.EventFormsDTO; +import com.epmet.dto.result.EventResultDTO; +import com.epmet.entity.EventEntity; +import com.epmet.entity.IcEventOperationLogEntity; +import com.epmet.service.EventService; +import com.epmet.service.IcEventOperationLogService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +@Service +public class EventServiceImpl extends BaseServiceImpl implements EventService { + + @Autowired + private LoginUserUtil loginUserUtil; + + @Autowired + private IcEventOperationLogService icEventOperationLogService; + + /** + * @param formDTO + * @return + * @deprecated 查询事件列表 + */ + @Override + public PageData getList(EventFormsDTO formDTO) { + if (StringUtils.isBlank(formDTO.getAgencyId())) { + //获取当前工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + } + //分页查询当前组织下网格内事件数据 + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list = baseDao.getList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * @param id + * @return + * @deprecated 获取事件详情 + */ + @Override + public EventResultDTO getById(String id) { + EventEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, EventResultDTO.class); + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(EventResultDTO dto) { + EventEntity entity = ConvertUtils.sourceToTarget(dto, EventEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + for (String id : ids) { + EventEntity entity = baseDao.selectById(id); + if (null == entity) { + continue; + } + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); + wrapper.eq(EventEntity::getId, id).set(EventEntity::getUpdatedTime, new Date()) + .set(EventEntity::getUpdatedBy, loginUserUtil.getLoginUserId()) + .set(EventEntity::getDelFlag, NumConstant.ONE_STR); + baseDao.update(null, wrapper); +// icEventCategoryService.delInsert(id,null); + } + } + + @Override + public void save(EventAddEditFormDTO formDTO) { + EventEntity entity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class); + entity.setId(IdWorker.getIdStr()); +// List logList = new ArrayList<>(); +// logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), new Date(), "add", "publish")); +// icEventOperationLogService.insertBatch(logList); + insert(entity); + } + + /** + * @param customerId + * @param staffId + * @return + * @deprecated 获取当前登陆人员信息 + */ + + public CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staffId); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", staffId)); + } + return staffInfo; + } + + /** + * 事件管理操作日志记录 + * + * @return + */ + private IcEventOperationLogEntity logEntity(String customerId, String icEventId, String userId, Date operateTime, String actionCode, String actionDesc) { + IcEventOperationLogEntity logEntity = new IcEventOperationLogEntity(); + logEntity.setCustomerId(customerId); + logEntity.setIcEventId(icEventId); + logEntity.setUserId(userId); + logEntity.setUserIdentity("staff"); + logEntity.setActionCode(actionCode); + logEntity.setActionDesc(actionDesc); + logEntity.setOperateTime(operateTime); + return logEntity; + } +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/EventEntityDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/EventEntityDao.xml new file mode 100644 index 0000000000..722e76a38f --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/EventEntityDao.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java index 207fb75bcc..1433f2f1b6 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddOrSaveDraftFormDTO.java @@ -1,13 +1,12 @@ package com.epmet.dto.form; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import java.io.Serializable; -import java.util.Date; import java.util.List; /** @@ -18,7 +17,7 @@ import java.util.List; @Data public class AddOrSaveDraftFormDTO implements Serializable { - public interface AddArticleForm{} + public interface AddArticleForm extends CustomerClientShowGroup {} public interface AddDraftForm{} /** @@ -31,7 +30,7 @@ public class AddOrSaveDraftFormDTO implements Serializable { @Length(max = 50, message = "标题最长为50个字") private String title; - @NotBlank(message = "栏目分类不能为空",groups = {AddArticleForm.class}) + // @NotBlank(message = "所属栏目不能为空",groups = {AddArticleForm.class}) private String category; /** @@ -84,4 +83,17 @@ public class AddOrSaveDraftFormDTO implements Serializable { * 封面图地址 */ private String imgUrl; + + /** + * 内容列表 + */ + private List fileList; + + @Data + public static class ContentDTO { + public ContentDTO() { + } + private String content; + private String fileName; + } } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/ArticleListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/ArticleListFormDTO.java index 0a601e9802..aad4177f65 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/ArticleListFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/ArticleListFormDTO.java @@ -14,6 +14,16 @@ import java.util.List; public class ArticleListFormDTO implements Serializable { private static final long serialVersionUID = 6397877545890473794L; + /** + * 栏目 + */ + private String category; + + /** + * 子栏目列表 + */ + private List subCategories; + /** * 文章标题 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java index 860e0fd6e6..4c1a305203 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateArticleFormDTO.java @@ -28,7 +28,7 @@ public class UpdateArticleFormDTO { @NotBlank(message = "articleId不能为空", groups = {AddUserInternalGroup.class}) private String articleId; - @NotBlank(message = "栏目不能为空", groups = {AddUserInternalGroup.class}) + // @NotBlank(message = "所属栏目不能为空", groups = {AddUserShowGroup.class}) private String category; @NotBlank(message = "文章标题不能为空", groups = {AddUserShowGroup.class}) @@ -91,5 +91,18 @@ public class UpdateArticleFormDTO { */ @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) private String customerId; + + /** + * 内容列表 + */ + private List fileList; + + @Data + public static class ContentDTO { + public ContentDTO() { + } + private String content; + private String fileName; + } } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java index 814d1e797c..3aed178f5f 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftPcListResultDTO.java @@ -110,6 +110,11 @@ public class DraftPcListResultDTO implements Serializable { */ private List contentList; + /** + * 文章内容 + */ + private List fileList; + @Data public static class Content { /** diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java index 78ff5fe7f9..0e25e4fd03 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java @@ -26,6 +26,11 @@ public class PublishedListResultDTO implements Serializable { * 分类 */ private String category; + + /** + * 栏目名称 + */ + private String categoryName; /** * 组织Id */ @@ -112,6 +117,11 @@ public class PublishedListResultDTO implements Serializable { */ private List contentList; + /** + * 附件列表 + */ + private List fileList; + @Data public static class Content { /** diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java index 40d67f975f..fae386fced 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/CategoryDictController.java @@ -10,12 +10,20 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.CategoryDictDTO; import com.epmet.service.CategoryDictService; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; /** @@ -31,12 +39,87 @@ public class CategoryDictController { @Autowired private CategoryDictService categoryDictService; + @Data + @NoArgsConstructor + public static class TreeNode { + + private String pid; + private String id; + private String categoryName; + + private List children = new ArrayList<>(); + + public TreeNode(String pid, String id, String categoryName) { + this.pid = pid; + this.id = id; + this.categoryName = categoryName; + } + } + + @GetMapping("tree") + public Result> tree() { + List treeNodes = buildTree(categoryDictService.list(1, 100)); + return new Result().ok(treeNodes); + } + + /** + * 树形结构输出 + */ @RequestMapping("list") public Result> list(@RequestParam Integer pageNo, @RequestParam Integer pageSize){ List list = categoryDictService.list(pageNo, pageSize); return new Result>().ok(list); } + /** + * @description: 根据父级栏目id查询子栏目列表 + * @param parentCategoryId: 父级栏目id + * @return + * @author: WangXianZhang + * @date: 2023/4/25 3:33 PM + */ + @GetMapping("subCategories") + public Result> listSubCategories(@RequestParam("parentCategoryId") String parentCategoryId) { + List list = categoryDictService.listSubCategories(parentCategoryId); + return new Result>().ok(list); + } + + /** + * @description: 构建树状结构 + * @param list: + * @return + * @author: WangXianZhang + * @date: 2023/4/25 3:38 PM + */ + private List buildTree(List list) { + + //总共2级,直接构建就行了。 + List pNodes = new ArrayList<>(); + List sNodes = new ArrayList<>(); + + // 过滤出一级和二级节点 + for (CategoryDictDTO ele : list) { + if (StringUtils.isBlank(ele.getPid()) || "0".equals(ele.getPid())) { + // 是一级节点 + pNodes.add(new TreeNode(ele.getPid(), ele.getId(), ele.getCategoryName())); + } else { + // 二级节点 + sNodes.add(new TreeNode(ele.getPid(), ele.getId(), ele.getCategoryName())); + } + } + + // 追加二级节点 + for (TreeNode sNode : sNodes) { + for (TreeNode pNode : pNodes) { + if (pNode.getId().equals(sNode.getPid())) { + pNode.getChildren().add(sNode); + } + } + } + + return pNodes; + } + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) public Result get(@PathVariable("id") String id){ CategoryDictDTO data = categoryDictService.get(id); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleContentDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleContentDao.java index 227fa89114..737329e96d 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleContentDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleContentDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.ArticleContentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 文章内容表 @@ -36,4 +37,12 @@ public interface ArticleContentDao extends BaseDao { * @return */ ArticleContentEntity selectByArticleId(String articleId); + + /** + * 如果是工作端小程序发布的文章,在pc编辑后,img和text删除。 + * @param articleId + * @param updatedBy + * @return + */ + int updateWxMpContent(@Param("articleId") String articleId, @Param("updatedBy")String updatedBy); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java index b070fd1c34..40fb125ae6 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/CategoryDictService.java @@ -85,4 +85,6 @@ public interface CategoryDictService extends BaseService { * @date: 2023/4/11 7:06 PM */ List list(Integer pageNo, Integer pageSize); + + List listSubCategories(String parentCategoryId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index c8146140d2..fbdb18f5ed 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -131,6 +131,9 @@ public class ArticleServiceImpl extends BaseServiceImpl rangeList = new ArrayList<>(); @@ -1728,6 +1762,20 @@ public class ArticleServiceImpl extends BaseServiceImpl subCategories; + if (StringUtils.isNotBlank(categoryId = formDTO.getCategory())) { + LambdaQueryWrapper cq = new LambdaQueryWrapper<>(); + cq.eq(CategoryDictEntity::getPid, categoryId); + List subCtgs = categoryDictDao.selectList(cq); + if (! CollectionUtils.isEmpty(subCtgs)) { + subCategories = subCtgs.stream().map(CategoryDictEntity::getId).collect(Collectors.toList()); + formDTO.setSubCategories(subCategories); + } + } + List list = baseDao.selectAllArticle(formDTO); PageInfo pageInfo = new PageInfo<>(list); @@ -1773,12 +1821,25 @@ public class ArticleServiceImpl extends BaseServiceImpl tWrapper1 = new LambdaQueryWrapper<>(); tWrapper1.eq(ArticleContentEntity::getArticleId, formDTO.getArticleId()); tWrapper1.eq(ArticleContentEntity::getDelFlag, NumConstant.ZERO_STR); + tWrapper1.ne(ArticleContentEntity::getContentType,"file"); tWrapper1.orderByDesc(ArticleContentEntity::getOrderNum); List contentEntityList = articleContentDao.selectList(tWrapper1); + resultDTO.setContentList(new ArrayList<>()); if (!CollectionUtils.isEmpty(contentEntityList)) { List contentList = ConvertUtils.sourceToTarget(contentEntityList, PublishedListResultDTO.Content.class); resultDTO.setContentList(contentList); } + // 附件列表 + LambdaQueryWrapper fileWrapper = new LambdaQueryWrapper<>(); + fileWrapper.eq(ArticleContentEntity::getArticleId, formDTO.getArticleId()); + fileWrapper.eq(ArticleContentEntity::getDelFlag, NumConstant.ZERO_STR); + fileWrapper.eq(ArticleContentEntity::getContentType,"file"); + fileWrapper.orderByDesc(ArticleContentEntity::getOrderNum); + List fileContentEntityList = articleContentDao.selectList(fileWrapper); + if (!CollectionUtils.isEmpty(fileContentEntityList)) { + List fileList = ConvertUtils.sourceToTarget(fileContentEntityList, PublishedListResultDTO.Content.class); + resultDTO.setFileList(fileList); + } //标签列表 LambdaQueryWrapper tWrapper2 = new LambdaQueryWrapper<>(); @@ -1790,6 +1851,12 @@ public class ArticleServiceImpl extends BaseServiceImpl del=new LambdaQueryWrapper<>(); + del.eq(ArticleContentEntity::getArticleId,formDTO.getArticleId()) + .eq(ArticleContentEntity::getContentType,"file"); + articleContentDao.delete(del); + int orderNum=2; + for(UpdateArticleFormDTO.ContentDTO file:formDTO.getFileList()){ + ArticleContentEntity fileDto=new ArticleContentEntity(); + fileDto.setCustomerId(formDTO.getCustomerId()); + fileDto.setArticleId(formDTO.getArticleId()); + fileDto.setContent(file.getContent()); + fileDto.setFileName(file.getFileName()); + fileDto.setContentType("file"); + fileDto.setOrderNum(orderNum); + articleContentDao.insert(fileDto); + orderNum++; + } + } + //内容类型 图片:img;文字:text;文件:file 富文本:rich_text 如果是工作端小程序发布的文章,在pc编辑后,img和text删除。 + articleContentDao.updateWxMpContent(formDTO.getArticleId(),EpmetRequestHolder.getLoginUserId()); + // 3.操作记录 ArticleOperateRecordEntity articleOperateRecord = new ArticleOperateRecordEntity(); articleOperateRecord.setCustomerId(formDTO.getCustomerId()); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java index e48f6fd893..66ec701d54 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/CategoryDictServiceImpl.java @@ -143,7 +143,18 @@ public class CategoryDictServiceImpl extends BaseServiceImpl list(Integer pageNo, Integer pageSize) { - List list = baseDao.selectList(null); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CategoryDictEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + List list = baseDao.selectList(query); + return ConvertUtils.sourceToTarget(list, CategoryDictDTO.class); + } + + @Override + public List listSubCategories(String parentCategoryId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(CategoryDictEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + query.eq(CategoryDictEntity::getPid, parentCategoryId); + List list = baseDao.selectList(query); return ConvertUtils.sourceToTarget(list, CategoryDictDTO.class); } } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java index 5d786be693..27111b4545 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java @@ -266,7 +266,8 @@ public class DraftServiceImpl extends BaseServiceImpl imp //查询文章内容 LambdaQueryWrapper tWrapper1 = new LambdaQueryWrapper<>(); tWrapper1.eq(DraftContentEntity::getDraftId, formDTO.getDraftId()); - tWrapper1.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR); + tWrapper1.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR) + .ne(DraftContentEntity::getContentType,"file"); tWrapper1.orderByDesc(DraftContentEntity::getOrderNum); List contentEntityList = draftContentDao.selectList(tWrapper1); if (!CollectionUtils.isEmpty(contentEntityList)) { @@ -274,6 +275,16 @@ public class DraftServiceImpl extends BaseServiceImpl imp resultDTO.setContentList(contentList); } + LambdaQueryWrapper fileWrapper = new LambdaQueryWrapper<>(); + fileWrapper.eq(DraftContentEntity::getDraftId, formDTO.getDraftId()); + fileWrapper.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR) + .eq(DraftContentEntity::getContentType,"file"); + fileWrapper.orderByDesc(DraftContentEntity::getOrderNum); + List fileContentEntityList = draftContentDao.selectList(fileWrapper); + if (!CollectionUtils.isEmpty(fileContentEntityList)) { + List fileContentList = ConvertUtils.sourceToTarget(fileContentEntityList, DraftPcListResultDTO.Content.class); + resultDTO.setFileList(fileContentList); + } //标签列表 if(!CollectionUtils.isEmpty(resultDTO.getTagNameList())){ LambdaQueryWrapper tWrapper2 = new LambdaQueryWrapper<>(); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleContentDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleContentDao.xml index 52007cee9e..9614ff32fa 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleContentDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleContentDao.xml @@ -11,7 +11,17 @@ article_content ac WHERE ac.DEL_FLAG = '0' - AND ac.ID = #{articleId} + AND ac.ARTICLE_ID = #{articleId} + and ac.CONTENT_TYPE ='rich_text' - \ No newline at end of file + + update article_content ac + set ac.del_flag='1', + ac.UPDATED_BY=#{updatedBy}, + ac.UPDATED_TIME=now() + where ac.id = #{articleId} + and ac.CONTENT_TYPE in ('img','text') + and ac.del_flag='0' + + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml index 3be92a0bde..b33d17a98a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml @@ -437,6 +437,7 @@ a.org_id AS "agencyId", a.title AS "title", a.category AS "category", + cd.CATEGORY_NAME, IFNULL(a.preview_content, "") AS "previewContent", a.publish_range_desc AS "publishRangeDesc", a.publisher_id AS "publisher", @@ -453,9 +454,25 @@ ac.img_url AS "imgUrl" FROM article a + LEFT JOIN category_dict cd on (cd.DEL_FLAG = 0 and a.CATEGORY = cd.ID) LEFT JOIN article_cover ac ON a.id = ac.article_id AND ac.del_flag = '0' WHERE a.del_flag = '0' + + + and ( + + a.CATEGORY in ( + + #{ctg} + + ) or + + + a.CATEGORY = #{category} + + ) + AND a.id = #{articleId} 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..dd7a76b94b --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveFormDTO.java @@ -0,0 +1,294 @@ +package com.epmet.dto.form.lingshan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +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 String headPhoto; + 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 = "释放日期不能为空") + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date releaseDate; + + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date originPrisonTerm; + + /** + * 是否累犯。0否,1是 + */ + private Integer recidivismFlag; + + /** + * 是否安置。0否,1是 + */ + private Integer emplacementFlag; + + /** + * 安置日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + 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; + + /** + * 初次发现日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + 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; + + /** + * 矫正开始日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date rectificateStartDate; + + /** + * 矫正结束日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + 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..f1e7a75eca --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/lingshan/LingShanSpecialTypeSaveResultDTO.java @@ -0,0 +1,295 @@ +package com.epmet.dto.form.lingshan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +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 headPhoto; + 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 = "释放日期不能为空") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date releaseDate; + + @JsonFormat(pattern = "yyyy-MM-dd") + private Date originPrisonTerm; + + /** + * 是否累犯。0否,1是 + */ + private Integer recidivismFlag; + + /** + * 是否安置。0否,1是 + */ + private Integer emplacementFlag; + + /** + * 安置日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + 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; + + /** + * 初次发现日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + 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; + + /** + * 矫正开始日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date rectificateStartDate; + + /** + * 矫正结束日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + 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 new file mode 100644 index 0000000000..efa7a61b47 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class LingShanSpecialCrowdListResultDTO { + + private String resiId; + private String orgNamePath; + private String specialTypesStr; + private String specialTypeDisplay; + private String name; + private String mobile; + private String idCard; + private String address; + + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createdTime; + + @JsonFormat(pattern = "yyyy-MM-dd") + private Date updatedTime; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/lingshan/LingShanSpecialCrowdStatsByOrgResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/lingshan/LingShanSpecialCrowdStatsByOrgResultDTO.java new file mode 100644 index 0000000000..726bd63450 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/lingshan/LingShanSpecialCrowdStatsByOrgResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result.lingshan; + +import lombok.Data; + +@Data +public class LingShanSpecialCrowdStatsByOrgResultDTO { + + private String orgId; + + private String orgIdPath; + /** + * 组织层级。agency:行政组织。grid:网格 + */ + private String orgType; + /** + * 组织名称 + */ + private String orgName; + /** + * 数量 + */ + private Integer quantity = 0; + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/lingshan/LingShanSpecialCrowdStatsBySpecialTypeResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/lingshan/LingShanSpecialCrowdStatsBySpecialTypeResultDTO.java new file mode 100644 index 0000000000..8b33d96e07 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/lingshan/LingShanSpecialCrowdStatsBySpecialTypeResultDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.result.lingshan; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Data +public class LingShanSpecialCrowdStatsBySpecialTypeResultDTO { + + private String specialType; + private String specialTypeName; + private Integer quantity; + +} 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 new file mode 100644 index 0000000000..21ed2904ef --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java @@ -0,0 +1,53 @@ +package com.epmet.enums; + +/** + * @description: 灵山街道-特殊人群 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/19 10:55 AM + */ +public enum LingShanSpecialCrowdTypeEnums { + AZBJ("anzhibangjiao", "安置帮教", 1), + SQJZ("shequjiaozheng", "社区矫正", 1), + JDRY("jiedurenyuan", "戒毒人员", 1), + JZHZ("jingzhanghuanzhe", "精障患者", 1), + XFRY("xinfangrenyuan", "信访人员", 1); + + /** + * 类型。anzhibangjiao, + */ + public final String type; + public final String name; + + private Integer headerRowNumber; + + LingShanSpecialCrowdTypeEnums(String type, String name, Integer headerRowNumber) { + this.type = type; + this.name = name; + this.headerRowNumber = headerRowNumber; + } + + public String getType() { + return type; + } + + public String getName() { + return name; + } + + public Integer getHeaderRowNumber() { + return headerRowNumber; + } + + public static LingShanSpecialCrowdTypeEnums getByType(String type) { + for (LingShanSpecialCrowdTypeEnums e : LingShanSpecialCrowdTypeEnums.values()) { + if (e.getType().equals(type)) { + return e; + } + } + return null; + } + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/bean/PersonSpecialTypeBean.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/bean/PersonSpecialTypeBean.java new file mode 100644 index 0000000000..df260b524f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/bean/PersonSpecialTypeBean.java @@ -0,0 +1,15 @@ +package com.epmet.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PersonSpecialTypeBean { + private String resiId; + private String idCard; + + private String specialType; +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanScreenController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanScreenController.java new file mode 100644 index 0000000000..ab9b8a7240 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanScreenController.java @@ -0,0 +1,53 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsBySpecialTypeResultDTO; +import com.epmet.service.LingShanScreenService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 灵山大屏 + */ +@RestController +@RequestMapping("lingshanScreen") +public class LingShanScreenController { + + @Autowired + private LingShanScreenService lingShanScreenService; + + /** + * @description: 特殊人群-按组织分组统计数量 + * @param parentAgencyId: + * @return + * @author: WangXianZhang + * @date: 2023/4/27 10:20 AM + */ + @GetMapping("specialCrowdStats/qtyOfSubOrg") + public Result specialCrowdStatsCountBySubOrg(@RequestParam("parentAgencyId") String parentAgencyId, + @RequestParam(value = "specialType", required = false) String specialType) { + + List l = lingShanScreenService.specialCrowdStatsCountBySubOrg(parentAgencyId, specialType); + return new Result().ok(l); + } + + /** + * @description: 组织下每一类人群数量 + * @param parentAgencyId: + * @return + * @author: WangXianZhang + * @date: 2023/4/27 12:16 PM + */ + @GetMapping("specialCrowdStats/qtyOfSpecialType") + public Result specialCrowdStatsCountBySpecialType(@RequestParam("parentAgencyId") String parentAgencyId) { + List l = lingShanScreenService.specialCrowdStatsCountBySpecialType(parentAgencyId); + return new Result().ok(l); + } + +} 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 new file mode 100644 index 0000000000..a0814a8d9c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java @@ -0,0 +1,218 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.page.PageData; +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.*; +import com.epmet.service.LingShanSpecialCrowdService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @description: 灵山社会维稳(特殊人群) + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 9:08 AM + */ +@Slf4j +@RestController +@RequestMapping("lingShan/specialCrowd") +public class LingShanSpecialCrowdController { + + @Autowired + private LingShanSpecialCrowdService lingShanSpecialCrowdService; + + /** + * @description: 下载导入模板 + * @param specialType: + * @return + * @author: WangXianZhang + * @date: 2023/4/21 10:16 AM + */ + @GetMapping("downloadTemplate") + public void downloadTemplate(@RequestParam("specialType") String specialType, HttpServletResponse response) { + InputStream is = null; + + LingShanSpecialCrowdTypeEnums st = LingShanSpecialCrowdTypeEnums.getByType(specialType); + if (st == null) { + log.error("【灵山街道-下载特殊人群导入模板】传入的特殊人群类型错误:{}", specialType); + return; + } + + try (ServletOutputStream os = response.getOutputStream()) { + is = this.getClass().getClassLoader().getResourceAsStream("excel/lingshan/special_crowd_" + specialType + "_import.xlsx"); + + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + // response.setHeader("content-Type", "application/vnd.ms-excel"); + response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(st.getName(), "UTF-8")); + + IOUtils.copy(is, os); + } catch (IOException e) { + throw new RuntimeException(e); + } finally { + org.apache.poi.util.IOUtils.closeQuietly(is); + } + } + + /** + * @description: 特殊人群导入 + * @param file: + * @param crowdCategory: 人群类别 + * anzhibangjiao + * buliangqingshaonian + * shequjiaozheng + * jiedurenyuan + * xiejiaorenyuan + * zhaoshizhaohuojingshenbing + * @return + * @author: WangXianZhang + * @date: 2023/4/18 9:12 AM + */ + @PostMapping("import") + public Result importSpecialCowd(MultipartFile file, @RequestParam("crowdCategory") String crowdCategory) { + + String originalFilename = file.getOriginalFilename(); + String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); + + // 1.存文件 + Path fileSavePath = saveSpecialCrowdTempFile(file, suffix); + + // 2.执行业务导入 + try { + String taskId = lingShanSpecialCrowdService.importSpecialCrowd(crowdCategory, fileSavePath.toString(), originalFilename); + return new Result().ok(taskId); + } catch (Exception e) { + // 3.出错的话,删除文件。不能在finally中删除,因为正常执行的话,是在异步线程中执行导入,这里删除了,那子线程就获取不到文件了,所以子线程中有单独的删除逻辑 + FileUtils.deleteFileIfExists(fileSavePath); + throw e; + } + } + + /** + * @description: 保存特殊人群临时文件 + * @param file: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 9:46 AM + */ + public Path saveSpecialCrowdTempFile(@RequestParam("file") MultipartFile file, String suffix) { + Path fileSavePath; + FileOutputStream os = null; + try { + Path fileSaveDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("special_crowd_import"); + String fileName = DateUtils.format(new Date(), "yyyyMMdd_HHmmss_" + System.nanoTime()) + suffix; + fileSavePath = fileSaveDir.resolve(fileName); + IOUtils.copy(file.getInputStream(), (os = new FileOutputStream(fileSavePath.toString()))); + return fileSavePath; + } catch (IOException e) { + log.error("【灵山街道】导入社会维稳数据,缓存文件失败。"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, null); + } finally { + org.apache.poi.util.IOUtils.closeQuietly(os); + } + } + + /** + * @description: 保存 + * @param input: + * @return + * @author: WangXianZhang + * @date: 2023/4/23 10:58 AM + */ + @PostMapping("save") + public Result saveSpecialCrowd(@RequestBody LingShanSpecialTypeSaveFormDTO input) { + ValidatorUtils.validateEntity(input); + lingShanSpecialCrowdService.saveSpecialCrowd(input); + return new Result(); + } + + /** + * @description: 特殊人群详情 + * @return + * @author: WangXianZhang + * @date: 2023/4/20 3:44 PM + */ + @GetMapping("getPersonSpecialTypeDetail") + public Result getPersonSpecialTypeDetail(@RequestParam("resiId") String resiId) { + + LingShanSpecialTypeSaveResultDTO r = lingShanSpecialCrowdService.getPersonSpecialTypeDetail(resiId); + return new Result().ok(r); + } + + /** + * @description: 列表查询 + * @param orgId: + * @param orgType: + * @param specialType: + * @param name: + * @param mobile: + * @param idCard: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 5:42 PM + */ + @GetMapping("listSpecialCrowd") + @MaskResponse(fieldNames = {"name", "mobile", "idCard"}, + fieldsMaskType = { MaskResponse.MASK_TYPE_CHINESE_NAME, MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + public Result> listSpecialCrowds(@RequestParam(value = "orgId", required = false) String orgId, + @RequestParam(value = "orgType", required = false) String orgType, + @RequestParam(value = "specialType", required = false) String specialType, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "mobile", required = false) String mobile, + @RequestParam(value = "idCard", required = false) String idCard, + @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize) { + + PageData pd = lingShanSpecialCrowdService.listSpecialCrowds(orgId, orgType, specialType, name, mobile, + idCard, pageNo, pageSize); + return new Result>().ok(pd); + } + + /** + * @description: 删除 + * @param params: + * @return + * @author: WangXianZhang + * @date: 2023/4/21 9:40 AM + */ + @PostMapping("deleteByResi") + public Result deleteByType(@RequestBody Map params) { + String resiId = params.get("resiId"); + + if (StringUtils.isAnyBlank(resiId, resiId)) { + throw new ValidateException("特殊人群类型或身份证不能为空"); + } + + lingShanSpecialCrowdService.deleteByResi(resiId); + return new Result(); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSpecialDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSpecialDao.java new file mode 100644 index 0000000000..81ac6f0eba --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSpecialDao.java @@ -0,0 +1,23 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; +import com.epmet.entity.IcSpecialEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface IcSpecialDao extends BaseDao { + + public IcSpecialEntity selectByResiId(@Param("resiId") String resiId); + + List listSpecialCrowd(@Param("orgIdPath") String orgIdPath, + @Param("orgId") String orgId, + @Param("orgType") String orgType, + @Param("specialType") String specialType, + @Param("name") String name, + @Param("mobile") String mobile, + @Param("idCard") String idCard); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java new file mode 100644 index 0000000000..210f5f9ada --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java @@ -0,0 +1,25 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity; +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 LingshanSpecialCrowdDetailAzbjDao extends BaseDao { + + void saveBatchManually(@Param("asbjList") List l); + + void deletePhysical(@Param("idCard") String idCard); + + List statsCountsByOrgIds(@Param("orgIdPaths") List orgIdPaths); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java new file mode 100644 index 0000000000..195d45f550 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java @@ -0,0 +1,24 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.entity.LingshanSpecialCrowdDetailJdryEntity; +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 LingshanSpecialCrowdDetailJdryDao extends BaseDao { + + void saveBatchManually(@Param("list") List l); + void deletePhysical(@Param("idCard") String idCard); + + List statsCountsByOrgIds(@Param("orgIdPaths") List orgIdPaths); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java new file mode 100644 index 0000000000..96505e5ce8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java @@ -0,0 +1,24 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity; +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 LingshanSpecialCrowdDetailJzhzDao extends BaseDao { + + void saveBatchManually(@Param("list") List l); + void deletePhysical(@Param("idCard") String idCard); + + List statsCountsByOrgIds(@Param("orgIdPaths") List orgIdPaths); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java new file mode 100644 index 0000000000..d9e50ebb6a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java @@ -0,0 +1,24 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.entity.LingshanSpecialCrowdDetailSqjzEntity; +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 LingshanSpecialCrowdDetailSqjzDao extends BaseDao { + + void saveBatchManually(@Param("list") List l); + void deletePhysical(@Param("idCard") String idCard); + + List statsCountsByOrgIds(@Param("orgIdPaths") List orgIdPaths); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java new file mode 100644 index 0000000000..631be26f5f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java @@ -0,0 +1,24 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.entity.LingshanSpecialCrowdDetailXfryEntity; +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 LingshanSpecialCrowdDetailXfryDao extends BaseDao { + + void saveBatchManually(@Param("list") List l); + void deletePhysical(@Param("idCard") String idCard); + + List statsCountsByOrgIds(@Param("orgIdPaths") List orgIdPaths); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java index a78fae885d..966b7f8553 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java @@ -96,6 +96,11 @@ public class IcResiUserEntity extends BaseEpmetEntity { */ private String gender; + /** + * 头像 + */ + private String headPhoto; + /** * 证件号 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSpecialEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSpecialEntity.java index 114ad7e2e5..693cd2499e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSpecialEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSpecialEntity.java @@ -17,7 +17,7 @@ package com.epmet.entity; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -38,6 +38,7 @@ public class IcSpecialEntity extends BaseEpmetEntity { /** * 客户Id customer.id */ + @TableField(fill = FieldFill.INSERT) private String customerId; /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailAzbjEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailAzbjEntity.java new file mode 100644 index 0000000000..e8905d6624 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailAzbjEntity.java @@ -0,0 +1,69 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 灵山-特殊人群-安置帮教 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("lingshan_special_crowd_detail_azbj") +public class LingshanSpecialCrowdDetailAzbjEntity extends LingshanSpecialCrowdDetailBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 原罪名 + */ + private String originalCharge; + + /** + * 释放日期 + */ + 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; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailBaseEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailBaseEntity.java new file mode 100644 index 0000000000..ae663fc8c1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailBaseEntity.java @@ -0,0 +1,22 @@ +package com.epmet.entity; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; + +@Data +public class LingshanSpecialCrowdDetailBaseEntity extends BaseEpmetEntity { + /** + * 客户Id + */ + private String customerId; + + /** + * org id路径,:分割 + */ + private String orgIdPath; + + /** + * 证件号 + */ + private String idCard; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJdryEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJdryEntity.java new file mode 100644 index 0000000000..279af30d10 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJdryEntity.java @@ -0,0 +1,69 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 灵山-特殊人群-戒毒人员 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("lingshan_special_crowd_detail_jdry") +public class LingshanSpecialCrowdDetailJdryEntity extends LingshanSpecialCrowdDetailBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 有无犯罪史 + */ + private Integer criminalHistoryFlag; + + /** + * 有无复吸史 + */ + private Integer drugRepetitionFlag; + + /** + * 初次发现日期 + */ + private Date firstDiscoveryDate; + + /** + * 管控人姓名 + */ + private String controllerName; + + /** + * 管控人联系方式 + */ + private String controllerContact; + + /** + * 帮扶人姓名 + */ + private String helperName; + + /** + * 帮扶人联系方式 + */ + private String helperContact; + + /** + * 是否脱管 + */ + private Integer detachedFlag; + + /** + * 脱管原因 + */ + private String detachedReason; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJzhzEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJzhzEntity.java new file mode 100644 index 0000000000..4bdef1f2b0 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailJzhzEntity.java @@ -0,0 +1,74 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 灵山-特殊人群-精障患者 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("lingshan_special_crowd_detail_jzhz") +public class LingshanSpecialCrowdDetailJzhzEntity extends LingshanSpecialCrowdDetailBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 有无肇事肇祸史 + */ + private Integer causeTroubleHistoryFlag; + + /** + * 肇事肇祸次数 + */ + 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; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailSqjzEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailSqjzEntity.java new file mode 100644 index 0000000000..66f1b8767a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailSqjzEntity.java @@ -0,0 +1,79 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 灵山-特殊人群-社区矫正 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("lingshan_special_crowd_detail_sqjz") +public class LingshanSpecialCrowdDetailSqjzEntity extends LingshanSpecialCrowdDetailBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 矫正类型。1.管制,2缓刑,3假释,4暂予监外执行,5剥夺政治权利 + */ + 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; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailXfryEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailXfryEntity.java new file mode 100644 index 0000000000..34605bd8cc --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdDetailXfryEntity.java @@ -0,0 +1,70 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 灵山-特殊人群-信访人员 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("lingshan_special_crowd_detail_xfry") +public class LingshanSpecialCrowdDetailXfryEntity extends LingshanSpecialCrowdDetailBaseEntity { + + private static final long serialVersionUID = 1L; + + + /** + * 反映问题 + */ + private String problem; + + /** + * 稳控措施 + */ + 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-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java new file mode 100644 index 0000000000..3a6282cf2c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdJzhzConverter.java @@ -0,0 +1,129 @@ +package com.epmet.excel.converter; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.converters.ReadConverterContext; +import com.alibaba.excel.converters.WriteConverterContext; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import com.epmet.excel.data.LingshanSpecialCrowdDetailJzhzExcelData; + +/** + * 灵山-诊断类型转换器 + */ +public class LingShanSpecialCrowdJzhzConverter implements Converter { + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + @Override + public Class supportJavaTypeKey() { + return Integer.class; + } + + @Override + public Integer convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + String value = cellData.getStringValue(); + if (fieldName.equals("currentDiagnosis")) { + return Diagnosis.getByName(value).code; + } else if (fieldName.equals("dangerousClass")) { + return DangerousClass.getByName(value).code; + } + + return Converter.super.convertToJavaData(cellData, contentProperty, globalConfiguration); + } + + @Override + public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + if (fieldName.equals("currentDiagnosis")) { + return new WriteCellData<>(Diagnosis.getByCode(value).name); + } else if (fieldName.equals("dangerousClass")) { + return new WriteCellData<>(DangerousClass.getByCode(value).name); + } + + return Converter.super.convertToExcelData(value, contentProperty, globalConfiguration); + } + + + /** + * 诊断 + */ + public enum Diagnosis { + JSFLZ(1, "精神分裂症"), + FLQGXZA(2, "分裂情感性障碍"), + CJDWXXZA(3, "持久的妄想性障碍(偏执性精神病)"), + SXZA(4, "双相(情感)障碍"), + DXSZJSZA(5, "癫痫所致精神障碍"), + JSFYCZBFJSZA(6, "精神发育迟滞伴发精神障碍"), + ZDYYFZ(7, "重度抑郁发作"), + JSHXWZ(8, "精神活性物质所致精神障碍"), + OTHERS(9, "其他"); + + private Integer code; + private String name; + + Diagnosis(Integer code, String name) { + this.code = code; + this.name = name; + } + + static Diagnosis getByCode(Integer code) { + for (Diagnosis d : Diagnosis.values()) { + if (d.code.equals(code)) { + return d; + } + } + return null; + } + + static Diagnosis getByName(String name) { + for (Diagnosis d : Diagnosis.values()) { + if (d.name.equals(name)) { + return d; + } + } + return null; + } + } + + public enum DangerousClass { + ZERO(0, "0级"), + ONE(1, "1级"), + TOW(2, "2级(偏执性精神病)"), + THREE(3, "3级(情感)障碍"), + FOUR(4, "4级"), + FIVE(5, "5级"); + + private Integer code; + private String name; + + DangerousClass(Integer code, String name) { + this.code = code; + this.name = name; + } + + static DangerousClass getByCode(Integer code) { + for (DangerousClass d : DangerousClass.values()) { + if (d.code.equals(code)) { + return d; + } + } + return null; + } + + static DangerousClass getByName(String name) { + for (DangerousClass d : DangerousClass.values()) { + if (d.name.equals(name)) { + return d; + } + } + return null; + } + } +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java new file mode 100644 index 0000000000..7e352d1b81 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdSqjzConverter.java @@ -0,0 +1,126 @@ +package com.epmet.excel.converter; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.converters.ReadConverterContext; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import org.omg.CORBA.PRIVATE_MEMBER; + +/** + * 灵山-社区矫正转换器 + */ +public class LingShanSpecialCrowdSqjzConverter implements Converter { + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + @Override + public Class supportJavaTypeKey() { + return Integer.class; + } + + @Override + public Integer convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + String value = cellData.getStringValue(); + + if (fieldName.equals("rectificateType")) { + return RectificateType.getByName(value).code; + } else if (fieldName.equals("receiveWay")) { + return ReceiveWay.getByName(value).code; + } + + return Converter.super.convertToJavaData(cellData, contentProperty, globalConfiguration); + } + + @Override + public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String fieldName = contentProperty.getField().getName(); + if (fieldName.equals("rectificateType")) { + return new WriteCellData(RectificateType.getByCode(value).name); + } else if (fieldName.equals("receiveWay")) { + return new WriteCellData(ReceiveWay.getByCode(value).name); + } + + return Converter.super.convertToExcelData(value, contentProperty, globalConfiguration); + } + + /** + * 矫正类型 + */ + public enum RectificateType { + GUANZHI(1,"管制"), + HUANXING(2,"缓刑"), + JIASHI(3,"假释"), + ZYJWZX(4,"暂予监外执行"), + BDZZQL(5,"剥夺政治权利"); + + private Integer code; + private String name; + + RectificateType(Integer code, String name) { + this.code = code; + this.name = name; + } + + static RectificateType getByCode(Integer code) { + for (RectificateType d : RectificateType.values()) { + if (d.code.equals(code)) { + return d; + } + } + return null; + } + + static RectificateType getByName(String name) { + for (RectificateType d : RectificateType.values()) { + if (d.name.equals(name)) { + return d; + } + } + return null; + } + } + + /** + * 接受方式。1.自行报到,2狱所押送,3当庭交接,4其他 + */ + public enum ReceiveWay { + ZXBD(1,"自行报到"), + YSYS(2,"狱所押送"), + DTJJ(3,"当庭交接"), + OTHERS(4,"其他"); + + private Integer code; + private String name; + + ReceiveWay(Integer code, String name) { + this.code = code; + this.name = name; + } + + static ReceiveWay getByCode(Integer code) { + for (ReceiveWay d : ReceiveWay.values()) { + if (d.code.equals(code)) { + return d; + } + } + return null; + } + + static ReceiveWay getByName(String name) { + for (ReceiveWay d : ReceiveWay.values()) { + if (d.name.equals(name)) { + return d; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdYesOrNoConverter.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdYesOrNoConverter.java new file mode 100644 index 0000000000..1f9281d224 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/converter/LingShanSpecialCrowdYesOrNoConverter.java @@ -0,0 +1,78 @@ +package com.epmet.excel.converter; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.converters.ReadConverterContext; +import com.alibaba.excel.converters.WriteConverterContext; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.data.WriteCellData; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.List; + +/** + * 灵山-是否转换器 + */ +public class LingShanSpecialCrowdYesOrNoConverter implements Converter { + List group1 = Arrays.asList("localFlag", "multipleFlag", "recidivismFlag", "emplacementFlag", "canceledFlag", + "detachedFlag", "canGoOutFlag", "violenceFlag", "allowanceFlag", "subsistenceFlag"); + + List group2 = Arrays.asList("criminalHistoryFlag", "drugRepetitionFlag", "causeTroubleHistoryFlag"); + + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + @Override + public Class supportJavaTypeKey() { + return Integer.class; + } + + @Override + public Integer convertToJavaData(ReadConverterContext context) throws Exception { + String content = context.getReadCellData().getStringValue(); + if (StringUtils.isNotBlank(content)) { + if (content.equals("是") || content.equals("有")) { + return 1; + } else if (content.equals("无") || content.equals("否")) { + return 0; + } + } + return Converter.super.convertToJavaData(context); + } + + @Override + public WriteCellData convertToExcelData(WriteConverterContext context) throws Exception { + String fieldName = context.getContentProperty().getField().getName(); + Integer value = context.getValue(); + if (group1.contains(fieldName)) { + return convertYesOrNoFlag(value); + } else if (group2.contains(fieldName)) { + return convertHaveOrNotFlag(value); + } + + return Converter.super.convertToExcelData(context); + } + + WriteCellData convertHaveOrNotFlag(Integer value) { + if (value.equals(1)) { + return new WriteCellData("有"); + } else if (value.equals(0)) { + return new WriteCellData("无"); + } else { + return new WriteCellData("未知"); + } + } + + WriteCellData convertYesOrNoFlag(Integer value) { + if (value.equals(1)) { + return new WriteCellData("是"); + } else if (value.equals(0)) { + return new WriteCellData("否"); + } else { + return new WriteCellData("未知"); + } + } +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java new file mode 100644 index 0000000000..64c5b887b3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailAzbjExcelData.java @@ -0,0 +1,77 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * 安置帮教 + */ +@Data +public class LingShanSpecialCrowdDetailAzbjExcelData extends LingShanSpecialCrowdDetailBaseExcelData { + + /** + * 原罪名 + */ + @ExcelProperty(value = "*原罪名") + @NotBlank(message = "原罪名不能为空") + private String originalCharge; + + /** + * 释放日期 + */ + @ExcelProperty(value = "*释放日期") + @NotNull(message = "释放日期不能为空") + @DateTimeFormat("yyyy/MM/dd") + private Date releaseDate; + + /** + * 原判刑期(单位:月) + */ + @ExcelProperty(value = "原判刑期(单位:月)") + @DateTimeFormat("yyyy/MM/dd") + private Date originPrisonTerm; + + /** + * 是否累犯。0否,1是 + */ + @ExcelProperty(value = "是否累犯", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer recidivismFlag; + + /** + * 是否安置。0否,1是 + */ + @ExcelProperty(value = "是否安置", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer emplacementFlag; + + /** + * 安置日期 + */ + @ExcelProperty(value = "安置日期") + @DateTimeFormat("yyyy/MM/dd") + private Date emplacementDate; + + /** + * 安置帮教情况 + */ + @ExcelProperty(value = "安置帮教情况") + private String emplacementInfo; + + /** + * 是否注销 + */ + @ExcelProperty(value = "是否注销", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer canceledFlag; + + /** + * 注销原因 + */ + @ExcelProperty(value = "注销原因") + private String canceledReason; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java new file mode 100644 index 0000000000..2c5c66ea59 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java @@ -0,0 +1,43 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * + */ +@Data +public class LingShanSpecialCrowdDetailBaseExcelData extends LingShanSpecialCrowdDetailResultExtraInfo { + /** + * 姓名 + */ + @ExcelProperty(value = "*姓名") + @NotBlank(message = "姓名不能为空") + private String name; + /** + * 证件号 + */ + @ExcelProperty(value = "*身份证号") + @NotBlank(message = "身份证号不能为空") + private String idCard; + + /** + * 错误信息 + */ + @ExcelProperty(value = "错误信息") + private String errorInfo; + + /** + * 居民id + */ + @ExcelIgnore + private String resiId; + + /** + * 网格id + */ + private String resiGridId; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailResultExtraInfo.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailResultExtraInfo.java new file mode 100644 index 0000000000..6a746798b2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailResultExtraInfo.java @@ -0,0 +1,32 @@ +package com.epmet.excel.data; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @description: 灵山特殊人群扩展字段 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 4:21 PM + */ +@Data +public class LingShanSpecialCrowdDetailResultExtraInfo { + + private String gender; + private String genderZh; + private String nation; + private String birthday; + /** + * 户籍地 + */ + private String domicilePlace; + private String mobile; + /** + * 住址 + */ + private String address; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java new file mode 100644 index 0000000000..76f17cb45f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJdryExcelData.java @@ -0,0 +1,77 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * 灵山-特殊人群-戒毒人员 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +public class LingshanSpecialCrowdDetailJdryExcelData extends LingShanSpecialCrowdDetailBaseExcelData { + + /** + * 有无犯罪史 + */ + @ExcelProperty(value = "*有无犯罪史", converter = LingShanSpecialCrowdYesOrNoConverter.class) + @NotNull(message = "有无犯罪史不能为空") + private Integer criminalHistoryFlag; + + /** + * 有无复吸史 + */ + @ExcelProperty(value = "*有无复吸史", converter = LingShanSpecialCrowdYesOrNoConverter.class) + @NotNull(message = "有无复吸史不能为空") + private Integer drugRepetitionFlag; + + /** + * 初次发现日期 + */ + @ExcelProperty(value = "初次发现日期") + @DateTimeFormat("yyyy/MM/dd") + private Date firstDiscoveryDate; + + /** + * 管控人姓名 + */ + @ExcelProperty(value = "管控人姓名") + private String controllerName; + + /** + * 管控人联系方式 + */ + @ExcelProperty(value = "管控人联系方式") + private String controllerContact; + + /** + * 帮扶人姓名 + */ + @ExcelProperty(value = "帮扶人姓名") + private String helperName; + + /** + * 帮扶人联系方式 + */ + @ExcelProperty(value = "帮扶人联系方式") + private String helperContact; + + /** + * 是否脱管 + */ + @ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer detachedFlag; + + /** + * 脱管原因 + */ + @ExcelProperty(value = "脱管原因") + private String detachedReason; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java new file mode 100644 index 0000000000..98d5012bb1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailJzhzExcelData.java @@ -0,0 +1,83 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; +import com.epmet.excel.converter.LingShanSpecialCrowdJzhzConverter; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 灵山-特殊人群-精障患者 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +public class LingshanSpecialCrowdDetailJzhzExcelData extends LingShanSpecialCrowdDetailBaseExcelData { + + private static final long serialVersionUID = 1L; + + /** + * 有无肇事肇祸史 + */ + @ExcelProperty(value = "*有无肇事肇祸史", converter = LingShanSpecialCrowdYesOrNoConverter.class) + @NotNull(message = "有无肇事肇祸史不能为空") + private Integer causeTroubleHistoryFlag; + + /** + * 肇事肇祸次数 + */ + @ExcelProperty(value = "*肇事肇祸次数") + @NotNull(message = "肇事肇祸次数不能为空") + private Integer causeTroubleTimes; + + /** + * 目前诊断类型。1精神分裂症,2分裂情感性障碍,3持久的妄想性障碍(偏执性精神病),4双相(情感)障碍,5癫痫所致精神障碍,6精神发育迟滞伴发精神障碍,7重度抑郁发作,8精神活性物质所致精神障碍,9其他 + */ + @ExcelProperty(value = "目前诊断类型", converter = LingShanSpecialCrowdJzhzConverter.class) + private Integer currentDiagnosis; + + /** + * 危险性评估等级。0,1,2,3,4,5 + */ + @ExcelProperty(value = "危险性评估等级", converter = LingShanSpecialCrowdJzhzConverter.class) + private Integer dangerousClass; + + /** + * 是否具备外出能力 + */ + @ExcelProperty(value = "是否具备外出能力", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer canGoOutFlag; + + /** + * 是否有暴力倾向 + */ + @ExcelProperty(value = "是否有暴力倾向", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer violenceFlag; + + /** + * 是否落实监管补助 + */ + @ExcelProperty(value = "是否落实监管补助", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer allowanceFlag; + + /** + * 是否纳入低保 + */ + @ExcelProperty(value = "是否纳入低保", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer subsistenceFlag; + + /** + * 监护人姓名 + */ + @ExcelProperty(value = "监护人姓名") + private String guardianName; + + /** + * 监护人联系方式 + */ + @ExcelProperty(value = "监护人联系方式") + private String guardianContact; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java new file mode 100644 index 0000000000..06966e6de8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailSqjzExcelData.java @@ -0,0 +1,91 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; +import com.epmet.excel.converter.LingShanSpecialCrowdSqjzConverter; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * 灵山-特殊人群-社区矫正 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +public class LingshanSpecialCrowdDetailSqjzExcelData extends LingShanSpecialCrowdDetailBaseExcelData { + + + /** + * 矫正类型。1.管制,2缓刑,3假释,4暂予监外执行,5剥夺政治权利 + */ + @ExcelProperty(value = "*矫正类型", converter = LingShanSpecialCrowdSqjzConverter.class) + @NotNull(message = "矫正类型不能为空") + private Integer rectificateType; + + /** + * 矫正开始日期 + */ + @ExcelProperty(value = "矫正开始日期") + @DateTimeFormat("yyyy/MM/dd") + private Date rectificateStartDate; + + /** + * 矫正结束日期 + */ + @ExcelProperty(value = "矫正结束日期") + @DateTimeFormat("yyyy/MM/dd") + private Date rectificateEndDate; + + /** + * 原羁押场所 + */ + @ExcelProperty(value = "原羁押场所") + private String originDetainAddress; + + /** + * 原罪名 + */ + @ExcelProperty(value = "原罪名") + private String originalCharge; + + /** + * 接受方式。1.自行报到,2狱所押送,3当庭交接,4其他 + */ + @ExcelProperty(value = "接受方式", converter = LingShanSpecialCrowdSqjzConverter.class) + private Integer receiveWay; + + /** + * 矫正情况说明 + */ + @ExcelProperty(value = "矫正情况说明") + private String rectificateInfo; + + /** + * 是否脱管 + */ + @ExcelProperty(value = "是否脱管", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer detachedFlag; + + /** + * 脱管原因 + */ + @ExcelProperty(value = "脱管原因") + private String detachedReason; + + /** + * 是否注销 + */ + @ExcelProperty(value = "是否注销" , converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer canceledFlag; + + /** + * 注销原因 + */ + @ExcelProperty(value = "注销原因") + private String canceledReason; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java new file mode 100644 index 0000000000..5ba1ca13bb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingshanSpecialCrowdDetailXfryExcelData.java @@ -0,0 +1,74 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.epmet.excel.converter.LingShanSpecialCrowdYesOrNoConverter; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 灵山-特殊人群-信访人员 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-04-18 + */ +@Data +public class LingshanSpecialCrowdDetailXfryExcelData extends LingShanSpecialCrowdDetailBaseExcelData { + + /** + * 反映问题 + */ + @ExcelProperty(value = "*反映问题") + @NotBlank(message = "反映问题不能为空") + private String problem; + + /** + * 稳控措施 + */ + @ExcelProperty(value = "*稳控措施") + @NotBlank(message = "稳控措施不能为空") + private String stableControlMeasurement; + + /** + * 是否多次上访 + */ + @ExcelProperty(value = "是否多次上访", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer multipleFlag; + + /** + * 是否在当地 + */ + @ExcelProperty(value = "是否在当地", converter = LingShanSpecialCrowdYesOrNoConverter.class) + private Integer localFlag; + + /** + * 分管领导 + */ + @ExcelProperty(value = "分管领导") + private String branchLeader; + + /** + * 分管领导联系方式 + */ + @ExcelProperty(value = "分管领导联系方式") + private String branchLeaderContact; + + /** + * 负责人 + */ + @ExcelProperty(value = "负责人") + private String principal; + + /** + * 负责人联系方式 + */ + @ExcelProperty(value = "负责人联系方式") + private String principalContact; + + /** + * 稳控人员名单 + */ + @ExcelProperty(value = "稳控人员名单") + private String stableControlerList; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java new file mode 100644 index 0000000000..23dd2802ad --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java @@ -0,0 +1,409 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.bean.PersonSpecialTypeBean; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.PidUtils; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.entity.LingshanSpecialCrowdDetailBaseEntity; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData; +import com.epmet.exceptions.ReadExcelHeaderOnlyException; +import com.epmet.service.LingShanSpecialCrowdService; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.redisson.api.RLock; + +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 灵山大屏-抽象的导入excel监听器 + */ +@Data +@Slf4j +public abstract class AbstractLingShanSpecialCrowdExcelImportListener + extends AnalysisEventListener { + + /** + * @description: 分布式锁 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 11:43 PM + */ + private DistributedLock distributedLock; + + /** + * 按批次保存,单次最大数据量 + */ + private static final Integer MAX_BATCH_SIZE = 500; + + private String templateFileName; + + /** + * 表头应有行数 + */ + private Integer maxHeadRowNum; + + /** + * 文件的表头中应当有哪些列 + */ + private List headerZhList; + + /** + * @description: 是否只校验表头 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/19 5:16 PM + */ + private Boolean validateHeaderOnly = false; + + /** + * 当前表头读到了第几行 + */ + private Integer currentHeadRowNum = 0; + + /** + * 原始数据列表 + */ + private List originDatas = new ArrayList<>(); + + /** + * 错误数据列表 + */ + private List errorDatas = new ArrayList<>(); + + /** + * 正确数据 + */ + private List correctDatas = new ArrayList<>(); + + private AtomicInteger correctDatasQty = new AtomicInteger(); + + // 为什么去掉了?因为需求改成了:直接用type根居民基础信息关联 + // private List persons = new ArrayList<>(); + // private List personTypes = new ArrayList<>(); + private List specialTypes = new ArrayList<>(); + + protected LingShanSpecialCrowdService lingShanSpecialCrowdService; + + private Class entityClass; + + private CustomerStaffInfoCacheResult currentStaffInfo; + + private LingShanSpecialCrowdTypeEnums specialCrowdType; + + public AbstractLingShanSpecialCrowdExcelImportListener() { + lingShanSpecialCrowdService = SpringContextUtils.getBean(LingShanSpecialCrowdService.class); + distributedLock = SpringContextUtils.getBean(DistributedLock.class); + currentStaffInfo = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); + maxHeadRowNum = setMaxHeadRowNum(); + headerZhList = setHeaderZhList(); + specialCrowdType = getSpecialCrowdType(); + entityClass = getEntityClass(); + templateFileName = setTemplateFileName(); + } + + /** + * @param headMap: + * @param context: + * @return + * @description: 表头回调函数,此处做统一表头校验,确认文件内容与当前要导入的数据的字段一致,防止导错类型. + * @author: WangXianZhang + * @date: 2023/4/18 10:42 AM + */ + @Override + public void invokeHeadMap(Map headMap, AnalysisContext context) { + // super.invokeHeadMap(headMap, context); + + if (maxHeadRowNum == null || CollectionUtils.isEmpty(headerZhList)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【灵山街道】社会维稳数据导入-子类未设置header行数以及header字段列表。"); + } + + if ((++currentHeadRowNum).equals(maxHeadRowNum)) { + // 如果是表头最后一行,则校验表头 + List redundentHeaders = new ArrayList<>(); + List lackHeaders = new ArrayList<>(); + + Collection headersFromFile = headMap.values(); + // 2次循环,双向校验 + for (String headerZh : headersFromFile) { + if (StringUtils.isNotBlank(headerZh) && !headerZhList.contains(headerZh)) { + redundentHeaders.add(headerZh); + } + } + + for (String headerZh : headerZhList) { + if (StringUtils.isNotBlank(headerZh) && !headersFromFile.contains(headerZh)) { + lackHeaders.add(headerZh); + } + } + + // 汇总错误字段,成一句话 + String preValidTipStr = ""; + if (CollectionUtils.isNotEmpty(redundentHeaders)) { + preValidTipStr += "多余【" + String.join(",", redundentHeaders) + "】字段。"; + } + + if (CollectionUtils.isNotEmpty(lackHeaders)) { + preValidTipStr += "缺少【" + String.join(",", lackHeaders) + "】必填字段。"; + } + + if (StringUtils.isNotBlank(preValidTipStr)) { + log.error("【灵山街道-社会维稳导入】表格表头不对应," + preValidTipStr); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "上传文件有误!" + preValidTipStr + "请确认表格格式正确"); + } + } + } + + /** + * @description: 行读取回调函数 + * @param row: + * @param context: + * @return + * @author: WangXianZhang + * @date: 2023/4/18 11:44 PM + */ + @Override + public void invoke(T row, AnalysisContext context) { + if (validateHeaderOnly) { + // 如果仅解析表头,那么抛出异常,外层接住 + throw new ReadExcelHeaderOnlyException(); + } + try { + ValidatorUtils.validateEntity(row); + } catch (ValidateException e) { + // 加入到错误记录中去 + errorDatas.add(row); + return; + } + + originDatas.add(row); + + if (originDatas.size() >= MAX_BATCH_SIZE) { + // 满足了一批次的数量,执行保存 + saveBatchWithLock(); + clear(); + } + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + if (validateHeaderOnly) { + throw new ReadExcelHeaderOnlyException(); + } + + if (originDatas.size() > 0) { + saveBatchWithLock(); + clear(); + } + } + + /** + * @param : + * @return + * @description: 批量保存,带锁的。因为要在Listener中过滤出哪些数据不能导入,返回给前端。 + * 所以需要再lisener中做批量检查,然后批量保存。过程需要一点时间,为了防止并发问题,加分布式锁。以agencyId为粒度。 + * @author: WangXianZhang + * @date: 2023/4/18 4:33 PM + */ + private void saveBatchWithLock() { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, EpmetRequestHolder.getLoginUserId()); + RLock lock = distributedLock.getLock(String.format("{}:{}:{}", "lock:specialcrowd", customerId, staffInfo.getAgencyId())); + try { + this.saveBatch(); + } catch (Exception e) { + throw e; + } finally { + if (lock != null && lock.isHeldByCurrentThread()) { + lock.unlock(); + } + } + } + + /** + * @param : + * @return + * @description: 批量保存 + * @author: WangXianZhang + * @date: 2023/4/18 3:42 PM + */ + protected void saveBatch() { + String orgIdPath = PidUtils.convertPid2OrgIdPath(currentStaffInfo.getAgencyId(), currentStaffInfo.getAgencyPIds()); + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + Date now = new Date(); + Iterator it = getOriginDatas().iterator(); + for (; it.hasNext(); ) { + T row = it.next(); + String errorInfo = lingShanSpecialCrowdService.validate(row); + if (StringUtils.isNotBlank(errorInfo)) { + row.setErrorInfo(errorInfo); + errorDatas.add(row); + it.remove(); + } else { + specialTypes.add(new PersonSpecialTypeBean(row.getResiId(), row.getIdCard(), specialCrowdType.getType())); + + orgIdPath = PidUtils.convertPid2OrgIdPath(row.getResiGridId(), orgIdPath); + + E e = ConvertUtils.sourceToTarget(row, entityClass); + e.setCustomerId(customerId); + e.setOrgIdPath(orgIdPath); + e.setId(IdWorker.getIdStr()); + e.setRevision(0); + e.setCreatedTime(now); + e.setUpdatedTime(now); + e.setCreatedBy(currentStaffInfo.getStaffId()); + e.setUpdatedBy(currentStaffInfo.getStaffId()); + e.setDelFlag("0"); + correctDatas.add(e); + correctDatasQty.incrementAndGet(); + } + } + + // 执行保存 + if(!CollectionUtils.isEmpty(specialTypes)) { + savePersonAndTypes(specialTypes); + } + + // 将错误的数据处理 todo + + // 保存人群详情数据 + saveBatchCallback(correctDatas); + } + + /** + * @description: 保存人员信息,人员类型 + * @param personTypes: + * @return + * @author: WangXianZhang + * @date: 2023/4/19 11:06 AM + */ + private void savePersonAndTypes(List personTypes) { + lingShanSpecialCrowdService.savePersonAndTypes(personTypes, false); + } + + /** + * @param : + * @return + * @description: 清理数据 + * @author: WangXianZhang + * @date: 2023/4/18 4:41 PM + */ + protected void clear() { + originDatas.clear(); + } + + /** + * @description: 获取读取到的原始数据 + * @param : + * @return + * @author: WangXianZhang + * @date: 2023/4/18 11:21 PM + */ + protected List getOriginDatas() { + return originDatas; + } + + /** + * @description: 获取错误数据行 + * @param : + * @return + * @author: WangXianZhang + * @date: 2023/4/18 11:22 PM + */ + public List getErrorDatas() { + return errorDatas; + } + + public Integer getFailedItemsQty() { + return errorDatas.size(); + } + + public Integer getSuccessedItemsQty() { + return correctDatasQty.get(); + } + + /** + * @description: 获取正确数据行 + * @param : + * @return + * @author: WangXianZhang + * @date: 2023/4/18 11:22 PM + */ + protected List getCorrectDatas() { + return correctDatas; + } + + /** + * @param : + * @return + * @description: 批量保存,子类实现 + * @author: WangXianZhang + * @date: 2023/4/18 4:32 PM + */ + abstract void saveBatchCallback(List entities); + + /** + * @description: 设置表头行数 + * @param : + * @return + * @author: WangXianZhang + * @date: 2023/4/18 11:22 PM + */ + abstract Integer setMaxHeadRowNum(); + + /** + * @description: 设置header字段列表。子类应当调用该方法设置该值 + * @return + * @author: WangXianZhang + * @date: 2023/4/18 11:21 PM + */ + abstract List setHeaderZhList(); + + /** + * @description: 设置模板名称 + * @param : + * @return + * @author: WangXianZhang + * @date: 2023/4/20 9:07 AM + */ + abstract String setTemplateFileName(); + + /** + * @description: 获取entity的class,用于数据拷贝 + * @param : + * @return + * @author: WangXianZhang + * @date: 2023/4/19 9:47 AM + */ + abstract Class getEntityClass(); + + /** + * @description: 指定特殊人群类型 + * @param : + * @return + * @author: WangXianZhang + * @date: 2023/4/19 11:00 AM + */ + abstract LingShanSpecialCrowdTypeEnums getSpecialCrowdType(); + + /** + * 人员类别信息bean,用于导入临时存储数据 + */ + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdAzbjExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdAzbjExcelImportListener.java new file mode 100644 index 0000000000..549abd1d7a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdAzbjExcelImportListener.java @@ -0,0 +1,54 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.excel.data.LingShanSpecialCrowdDetailAzbjExcelData; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; + +import java.io.File; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +/** + * 灵山-安置帮教导入 + */ +public class LingShanSpecialCrowdAzbjExcelImportListener + extends AbstractLingShanSpecialCrowdExcelImportListener { + + @Override + Integer setMaxHeadRowNum() { + return 1; + } + + @Override + List setHeaderZhList() { + return Arrays.asList("*姓名", "*身份证号", "*原罪名", "*释放日期", "原判刑期(单位:月)", "是否累犯", "是否安置", "安置日期", "安置帮教情况", "是否注销", "注销原因"); + } + + @Override + Class getEntityClass() { + return LingshanSpecialCrowdDetailAzbjEntity.class; + } + + @Override + void saveBatchCallback(List entities) { + lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailAzbjEntity()); + } + + @Override + LingShanSpecialCrowdTypeEnums getSpecialCrowdType() { + return LingShanSpecialCrowdTypeEnums.AZBJ; + } + + @Override + String setTemplateFileName() { + return "excel/lingshan/lingshan_special_crowd_azbj_export.xlsx"; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJieduExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJieduExcelImportListener.java new file mode 100644 index 0000000000..0e48f04535 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJieduExcelImportListener.java @@ -0,0 +1,50 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.epmet.entity.LingshanSpecialCrowdDetailAzbjEntity; +import com.epmet.entity.LingshanSpecialCrowdDetailJdryEntity; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.excel.data.LingshanSpecialCrowdDetailJdryExcelData; + +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 灵山-戒毒导入 + */ +public class LingShanSpecialCrowdJieduExcelImportListener + extends AbstractLingShanSpecialCrowdExcelImportListener { + + @Override + Integer setMaxHeadRowNum() { + return 1; + } + + @Override + List setHeaderZhList() { + return Arrays.asList("*姓名", "*身份证号", "*有无犯罪史", "*有无复吸史", "初次发现日期", "管控人姓名", "管控人联系方式", "帮扶人姓名", "帮扶人联系方式", "是否脱管", "脱管原因"); + } + + @Override + Class getEntityClass() { + return LingshanSpecialCrowdDetailJdryEntity.class; + } + + @Override + void saveBatchCallback(List entities) { + lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailJdryEntity()); + } + + @Override + LingShanSpecialCrowdTypeEnums getSpecialCrowdType() { + return LingShanSpecialCrowdTypeEnums.JDRY; + } + + @Override + String setTemplateFileName() { + return "excel/lingshan/lingshan_special_crowd_jdry_export.xlsx"; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJingZhangExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJingZhangExcelImportListener.java new file mode 100644 index 0000000000..60b432d746 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdJingZhangExcelImportListener.java @@ -0,0 +1,51 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.epmet.entity.LingshanSpecialCrowdDetailJdryEntity; +import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.excel.data.LingshanSpecialCrowdDetailJzhzExcelData; + +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 灵山-精神障碍患者导入 + */ +public class LingShanSpecialCrowdJingZhangExcelImportListener + extends AbstractLingShanSpecialCrowdExcelImportListener { + + + @Override + void saveBatchCallback(List entities) { + lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailJzhzEntity()); + } + + @Override + Integer setMaxHeadRowNum() { + return 1; + } + + @Override + List setHeaderZhList() { + return Arrays.asList("*姓名", "*身份证号", "*有无肇事肇祸史", "*肇事肇祸次数", "目前诊断类型", "危险性评估等级", "是否具备外出能力", "是否有暴力倾向", "是否落实监管补助", "是否纳入低保", "监护人姓名", "监护人联系方式"); + } + + @Override + Class getEntityClass() { + return LingshanSpecialCrowdDetailJzhzEntity.class; + } + + @Override + LingShanSpecialCrowdTypeEnums getSpecialCrowdType() { + return LingShanSpecialCrowdTypeEnums.JZHZ; + } + + @Override + String setTemplateFileName() { + return "excel/lingshan/lingshan_special_crowd_jzhz_export.xlsx"; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdSqjzExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdSqjzExcelImportListener.java new file mode 100644 index 0000000000..3e8be96113 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdSqjzExcelImportListener.java @@ -0,0 +1,50 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.epmet.dao.LingshanSpecialCrowdDetailSqjzDao; +import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity; +import com.epmet.entity.LingshanSpecialCrowdDetailSqjzEntity; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.excel.data.LingshanSpecialCrowdDetailSqjzExcelData; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +/** + * 灵山-矫正人员导入 + */ +public class LingShanSpecialCrowdSqjzExcelImportListener + extends AbstractLingShanSpecialCrowdExcelImportListener { + + @Override + void saveBatchCallback(List entities) { + lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailSqjzEntity()); + } + + @Override + Integer setMaxHeadRowNum() { + return 1; + } + + @Override + List setHeaderZhList() { + return Arrays.asList("*姓名", "*身份证号", "*矫正类型", "矫正开始日期", "矫正结束日期", "原羁押场所", "原罪名", "接受方式", "矫正情况说明", "是否脱管", "脱管原因", "是否注销", "注销原因"); + } + + @Override + Class getEntityClass() { + return LingshanSpecialCrowdDetailSqjzEntity.class; + } + + @Override + LingShanSpecialCrowdTypeEnums getSpecialCrowdType() { + return LingShanSpecialCrowdTypeEnums.SQJZ; + } + + @Override + String setTemplateFileName() { + return "excel/lingshan/lingshan_special_crowd_sqjz_export.xlsx"; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdXinFangExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdXinFangExcelImportListener.java new file mode 100644 index 0000000000..a1affca651 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/LingShanSpecialCrowdXinFangExcelImportListener.java @@ -0,0 +1,51 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.epmet.entity.LingshanSpecialCrowdDetailJzhzEntity; +import com.epmet.entity.LingshanSpecialCrowdDetailXfryEntity; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.excel.data.LingshanSpecialCrowdDetailXfryExcelData; + +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 灵山-信访人员导入 + */ +public class LingShanSpecialCrowdXinFangExcelImportListener + extends AbstractLingShanSpecialCrowdExcelImportListener { + + + @Override + void saveBatchCallback(List entities) { + lingShanSpecialCrowdService.saveBatch(entities, new LingshanSpecialCrowdDetailXfryEntity()); + } + + @Override + Integer setMaxHeadRowNum() { + return 1; + } + + @Override + List setHeaderZhList() { + return Arrays.asList("*姓名", "*身份证号", "*反映问题", "*稳控措施", "是否多次上访", "是否在当地", "分管领导", "分管领导联系方式", "负责人", "负责人联系方式", "稳控人员名单"); + } + + @Override + Class getEntityClass() { + return LingshanSpecialCrowdDetailXfryEntity.class; + } + + @Override + LingShanSpecialCrowdTypeEnums getSpecialCrowdType() { + return LingShanSpecialCrowdTypeEnums.XFRY; + } + + @Override + String setTemplateFileName() { + return "excel/lingshan/lingshan_special_crowd_xfry_export.xlsx"; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/exceptions/ReadExcelHeaderOnlyException.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/exceptions/ReadExcelHeaderOnlyException.java new file mode 100644 index 0000000000..4efda39455 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/exceptions/ReadExcelHeaderOnlyException.java @@ -0,0 +1,7 @@ +package com.epmet.exceptions; + +/** + * 只解析表头的异常(用于停止excel导入) + */ +public class ReadExcelHeaderOnlyException extends RuntimeException { +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanScreenService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanScreenService.java new file mode 100644 index 0000000000..b52d51fc12 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanScreenService.java @@ -0,0 +1,14 @@ +package com.epmet.service; + +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsBySpecialTypeResultDTO; + +import java.util.List; + +public interface LingShanScreenService { + + + List specialCrowdStatsCountBySubOrg(String parentAgencyId, String specialType); + + List specialCrowdStatsCountBySpecialType(String parentAgencyId); +} 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 new file mode 100644 index 0000000000..3221504fc8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java @@ -0,0 +1,106 @@ +package com.epmet.service; + +import com.epmet.bean.PersonSpecialTypeBean; +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; +import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData; +import com.epmet.excel.handler.AbstractLingShanSpecialCrowdExcelImportListener; +import com.sun.org.apache.xpath.internal.operations.Bool; +import org.apache.poi.ss.formula.functions.T; + +import java.util.List; + +/** + * 灵山特殊人群service + */ +public interface LingShanSpecialCrowdService { + + /** + * @description: 导入特殊人群 + * @param crowdCategory: + * @param fileSavePath: + * @return taskId 导入任务id + * @author: WangXianZhang + * @date: 2023/4/18 5:42 PM + */ + String importSpecialCrowd(String crowdCategory, String fileSavePath, String originFilename); + + /** + * @description: 数据校验 + * @param row: + * @returns + * @author: WangXianZhang + * @date: 2023/4/18 4:49 PM + */ + String validate(LingShanSpecialCrowdDetailBaseExcelData row); + + /** + * @description: + * @param personTypes: + * @param hard: 是否硬性写入。true:会覆盖现有的,用于页面的修改。false:会与现有的合并,用户导入 + * @return + * @author: WangXianZhang + * @date: 2023/4/24 3:25 PM + */ + void savePersonAndTypes(List personTypes, Boolean hard); + + /** + * @description: 安置帮教-导入 + * @return + * @author: WangXianZhang + * @date: 2023/4/18 4:11 PM + */ + void saveBatch(List entities, LingshanSpecialCrowdDetailAzbjEntity e); + void saveBatch(List entities, LingshanSpecialCrowdDetailJdryEntity e); + void saveBatch(List entities, LingshanSpecialCrowdDetailJzhzEntity e); + 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 idCard: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 3:45 PM + */ + LingShanSpecialTypeSaveResultDTO getPersonSpecialTypeDetail(String resiId); + + /** + * @description: 列表查询 + * @param orgId: + * @param orgType: + * @param specialType: + * @param name: + * @param mobile: + * @param idCard: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 5:44 PM + */ + PageData listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile, + String idCard, Integer pageNo, Integer pageSize); + + void deleteByResi(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/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index c49ecc7554..7b9434043a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -708,7 +708,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl", resiUserId)); } //2022-1-18 信息修改判断基础信息表人员网格、小区、楼栋、单元、房屋维度数据以及十八类的类别数据是否变化,相应生成变更记录和变更明细数据 sun start - icUserChangeRecord(tokenDto, entity, map); + icUserChangeRecord(entity, map); //2022-1-18 sun end //2.更新主表数据 if (map.size() > NumConstant.ONE) { @@ -789,10 +789,16 @@ public class IcResiUserServiceImpl extends BaseServiceImpl map) { + * @description: 生成居民变更记录 + * @param null: + * @return + * @author: sun + */ + public void icUserChangeRecord(IcResiUserEntity entity, LinkedHashMap map) { + // prepare + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + String staffId = EpmetRequestHolder.getLoginUserId(); + java.util.Date date = new java.util.Date(); //1.判断维度数据是否修改【网格、小区、楼栋、单元、房间有变化则先走人员调动逻辑】 if ((map.containsKey("GRID_ID") && !entity.getGridId().equals(map.get("GRID_ID"))) || (map.containsKey("VILLAGE_ID") && !entity.getVillageId().equals(map.get("VILLAGE_ID"))) @@ -809,13 +815,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> categoryListResult = operCustomizeOpenFeignClient.getCategoryList(sfdto); if (!categoryListResult.success()) { throw new RenException("居民信息修改,获取客户居民类别预警配置表数据失败"); @@ -840,7 +846,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl NumConstant.ZERO) { //变更记录 - CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); - changeRecordEntity.setCustomerId(tokenDto.getCustomerId()); - changeRecordEntity.setOperatorId(tokenDto.getUserId()); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId); + changeRecordEntity.setCustomerId(customerId); + changeRecordEntity.setOperatorId(staffId); changeRecordEntity.setIcUserId(entity.getId()); changeRecordEntity.setOperatorName(staffInfoCache.getRealName()); changeRecordEntity.setIcUserName(map.containsKey("NAME") ? map.get("NAME") : entity.getName()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanScreenServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanScreenServiceImpl.java new file mode 100644 index 0000000000..fc2912ebb6 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanScreenServiceImpl.java @@ -0,0 +1,120 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.utils.PidUtils; +import com.epmet.constant.LevelConstant; +import com.epmet.dao.*; +import com.epmet.dto.result.SubOrgResDTO; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsByOrgResultDTO; +import com.epmet.dto.result.lingshan.LingShanSpecialCrowdStatsBySpecialTypeResultDTO; +import com.epmet.entity.*; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.LingShanScreenService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class LingShanScreenServiceImpl implements LingShanScreenService, ResultDataResolver { + + @Autowired + private LingshanSpecialCrowdDetailXfryDao xfryDao; + + @Autowired + private LingshanSpecialCrowdDetailAzbjDao azbjDao; + + @Autowired + private LingshanSpecialCrowdDetailJdryDao jdryDao; + + @Autowired + private LingshanSpecialCrowdDetailJzhzDao jzhzDao; + + @Autowired + private LingshanSpecialCrowdDetailSqjzDao sqjzDao; + + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + @Override + public List specialCrowdStatsCountBySubOrg(String parentAgencyId, String specialType) { + List subOrgs = getResultDataOrThrowsException(govOrgOpenFeignClient.subOrgList(parentAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, null); + List orgIdPaths = subOrgs.stream().map(sub -> PidUtils.convertPid2OrgIdPath(sub.getOrgId(), sub.getPids())).collect(Collectors.toList()); + + List rl = subOrgs.stream().map(sub -> { + LingShanSpecialCrowdStatsByOrgResultDTO t = new LingShanSpecialCrowdStatsByOrgResultDTO(); + t.setOrgId(sub.getOrgId()); + t.setOrgName(sub.getOrgName()); + t.setOrgType(sub.getOrgType()); + t.setOrgIdPath(PidUtils.convertPid2OrgIdPath(sub.getOrgId(), sub.getPids())); + return t; + }).collect(Collectors.toList()); + + + List ol = new ArrayList<>(); + if (LingShanSpecialCrowdTypeEnums.AZBJ.getType().equals(specialType) || StringUtils.isBlank(specialType)) { + ol.addAll(azbjDao.statsCountsByOrgIds(orgIdPaths)); + } + if (LingShanSpecialCrowdTypeEnums.SQJZ.getType().equals(specialType) || StringUtils.isBlank(specialType)) { + ol.addAll(sqjzDao.statsCountsByOrgIds(orgIdPaths)); + } + if (LingShanSpecialCrowdTypeEnums.XFRY.getType().equals(specialType) || StringUtils.isBlank(specialType)) { + ol.addAll(xfryDao.statsCountsByOrgIds(orgIdPaths)); + } + if (LingShanSpecialCrowdTypeEnums.JDRY.getType().equals(specialType) || StringUtils.isBlank(specialType)) { + ol.addAll(jdryDao.statsCountsByOrgIds(orgIdPaths)); + } + if (LingShanSpecialCrowdTypeEnums.JZHZ.getType().equals(specialType) || StringUtils.isBlank(specialType)) { + ol.addAll(jzhzDao.statsCountsByOrgIds(orgIdPaths)); + } + + // 开始给rl++ + for (LingShanSpecialCrowdStatsByOrgResultDTO o : ol) { + for (LingShanSpecialCrowdStatsByOrgResultDTO r : rl) { + if (o.getOrgIdPath().contains(r.getOrgIdPath())) { + // 如果ol中的数据,orgIdPath包含了这个组织的orgIdPath,说明这条数据就是这个组织的数据,那就++把 + r.setQuantity(r.getQuantity() + o.getQuantity()); + } + } + } + + return rl; + } + + @Override + public List specialCrowdStatsCountBySpecialType(String parentAgencyId) { + String orgIdPath = CustomerOrgRedis.getOrgIdPath(parentAgencyId, LevelConstant.AGENCY); + + ArrayList l = new ArrayList<>(); + + LambdaQueryWrapper azbjq = new LambdaQueryWrapper<>(); + azbjq.likeRight(LingshanSpecialCrowdDetailAzbjEntity::getOrgIdPath, orgIdPath); + l.add(new LingShanSpecialCrowdStatsBySpecialTypeResultDTO(LingShanSpecialCrowdTypeEnums.AZBJ.getType(), LingShanSpecialCrowdTypeEnums.AZBJ.getName(), azbjDao.selectCount(azbjq))); + + LambdaQueryWrapper sqjzq = new LambdaQueryWrapper<>(); + sqjzq.likeRight(LingshanSpecialCrowdDetailSqjzEntity::getOrgIdPath, orgIdPath); + l.add(new LingShanSpecialCrowdStatsBySpecialTypeResultDTO(LingShanSpecialCrowdTypeEnums.SQJZ.getType(), LingShanSpecialCrowdTypeEnums.SQJZ.getName(), sqjzDao.selectCount(sqjzq))); + + LambdaQueryWrapper xfryq = new LambdaQueryWrapper<>(); + xfryq.likeRight(LingshanSpecialCrowdDetailXfryEntity::getOrgIdPath, orgIdPath); + l.add(new LingShanSpecialCrowdStatsBySpecialTypeResultDTO(LingShanSpecialCrowdTypeEnums.XFRY.getType(), LingShanSpecialCrowdTypeEnums.XFRY.getName(), xfryDao.selectCount(xfryq))); + + LambdaQueryWrapper jdryq = new LambdaQueryWrapper<>(); + jdryq.likeRight(LingshanSpecialCrowdDetailJdryEntity::getOrgIdPath, orgIdPath); + l.add(new LingShanSpecialCrowdStatsBySpecialTypeResultDTO(LingShanSpecialCrowdTypeEnums.JDRY.getType(), LingShanSpecialCrowdTypeEnums.JDRY.getName(), jdryDao.selectCount(jdryq))); + + LambdaQueryWrapper jzhzq = new LambdaQueryWrapper<>(); + jzhzq.likeRight(LingshanSpecialCrowdDetailJzhzEntity::getOrgIdPath, orgIdPath); + l.add(new LingShanSpecialCrowdStatsBySpecialTypeResultDTO(LingShanSpecialCrowdTypeEnums.JZHZ.getType(), LingShanSpecialCrowdTypeEnums.JZHZ.getName(), jzhzDao.selectCount(jzhzq))); + + return l; + } +} 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 new file mode 100644 index 0000000000..a4d83cef6e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java @@ -0,0 +1,719 @@ +package com.epmet.service.impl; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.bean.PersonSpecialTypeBean; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.enums.BizTypeEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache; +import com.epmet.commons.tools.utils.*; +import com.epmet.constants.ImportTaskConstants; +import com.epmet.dao.*; +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; +import com.epmet.dto.result.UploadImgResultDTO; +import com.epmet.entity.*; +import com.epmet.enums.LingShanSpecialCrowdTypeEnums; +import com.epmet.excel.data.*; +import com.epmet.excel.handler.*; +import com.epmet.exceptions.ReadExcelHeaderOnlyException; +import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.OssFeignClient; +import com.epmet.remote.EpmetUserRemoteService; +import com.epmet.service.IcResiUserService; +import com.epmet.service.LingShanSpecialCrowdService; +import com.epmet.utils.ImportTaskUtils; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.github.pagehelper.dialect.helper.SqlServer2012Dialect; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.commons.CommonsMultipartFile; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; + +/** + * 灵山特殊人群service + */ +@Slf4j +@Service +public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdService, ResultDataResolver { + + @Autowired + private LingshanSpecialCrowdDetailAzbjDao specialCrowdDetailAzbjDao; + + @Autowired + private LingshanSpecialCrowdDetailSqjzDao specialCrowdDetailSqjzDao; + + @Autowired + private LingshanSpecialCrowdDetailJdryDao specialCrowdDetailJdryDao; + + @Autowired + private LingshanSpecialCrowdDetailJzhzDao specialCrowdDetailJzhzDao; + + @Autowired + private LingshanSpecialCrowdDetailXfryDao specialCrowdDetailXfryDao; + + @Autowired + private IcResiUserDao icResiUserDao; + + @Autowired + private IcSpecialDao icSpecialDao; + + @Autowired + private ExecutorService executorService; + + @Autowired + private OssFeignClient ossFeignClient; + + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + @Autowired + private EpmetUserRemoteService epmetUserRemoteService; + + @Override + public String importSpecialCrowd(String crowdCategory, String fileSavePath, String originFilename) { + Class excelDataClass; + AbstractLingShanSpecialCrowdExcelImportListener listener; + LingShanSpecialCrowdTypeEnums specialCrowdTypeEnum; + + if (LingShanSpecialCrowdTypeEnums.AZBJ.getType().equals(crowdCategory)) { + listener = new LingShanSpecialCrowdAzbjExcelImportListener(); + excelDataClass = LingShanSpecialCrowdDetailAzbjExcelData.class; + specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.AZBJ; + } else if (LingShanSpecialCrowdTypeEnums.SQJZ.getType().equals(crowdCategory)) { + listener = new LingShanSpecialCrowdSqjzExcelImportListener(); + excelDataClass = LingshanSpecialCrowdDetailSqjzExcelData.class; + specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.SQJZ; + } else if (LingShanSpecialCrowdTypeEnums.JDRY.getType().equals(crowdCategory)) { + listener = new LingShanSpecialCrowdJieduExcelImportListener(); + excelDataClass = LingshanSpecialCrowdDetailJdryExcelData.class; + specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.JDRY; + } else if (LingShanSpecialCrowdTypeEnums.JZHZ.getType().equals(crowdCategory)) { + listener = new LingShanSpecialCrowdJingZhangExcelImportListener(); + excelDataClass = LingshanSpecialCrowdDetailJzhzExcelData.class; + specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.JZHZ; + } else if (LingShanSpecialCrowdTypeEnums.XFRY.getType().equals(crowdCategory)) { + listener = new LingShanSpecialCrowdXinFangExcelImportListener(); + excelDataClass = LingshanSpecialCrowdDetailXfryExcelData.class; + specialCrowdTypeEnum = LingShanSpecialCrowdTypeEnums.XFRY; + } else { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "【灵山街道-维稳】导入。不支持的人群类别:" + crowdCategory); + } + + // Execute reading + // ReadSheet sheet = EasyExcel.readSheet(0).registerReadListener(listener).build(); + // EasyExcel.read(fileSavePath).build().read(sheet); + + // 解析表头,判断表头是否合格 + try { + listener.setValidateHeaderOnly(true); + EasyExcel.read(fileSavePath, excelDataClass, listener) + .headRowNumber(specialCrowdTypeEnum.getHeaderRowNumber()) + .sheet(0) + .doRead(); + } catch (ReadExcelHeaderOnlyException e) { + log.info("【灵山街道-导入社会维稳】验证通过,可以继续导入"); + } + + // 正式开始导入。异步导入 + listener.setValidateHeaderOnly(false); + + // 创建导入任务 + ImportTaskCommonResultDTO importTaskRst = getResultDataOrThrowsException(ImportTaskUtils.createImportTask(originFilename, + BizTypeEnum.SPECIAL_CROWD.getType()), + ServiceConstant.EPMET_COMMON_SERVICE, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + null, "【灵山街道-导入特殊人群】创建导入任务失败"); + + CompletableFuture.runAsync(() -> { + try { + EasyExcel.read(fileSavePath, excelDataClass, listener) + .headRowNumber(specialCrowdTypeEnum.getHeaderRowNumber()) + .sheet(0) + .doRead(); + + List errorDatas = listener.getErrorDatas(); + if (CollectionUtils.isNotEmpty(errorDatas)) { + // 有错误数据需要提示 + String resultDescFilePath = uploadResultDescFilePath(errorDatas, listener.getTemplateFileName()); + ImportTaskUtils.finishImportTask(importTaskRst.getTaskId(), + ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, resultDescFilePath, "失败,请导出文件查看详细信息", + listener.getSuccessedItemsQty(), listener.getFailedItemsQty()); + } else { + // 全部成功 + ImportTaskUtils.finishImportTask(importTaskRst.getTaskId(), + ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS, null, "成功"); + } + } catch (Exception e) { + log.error("【灵山街道-导入特殊人群】失败,错误信息:" + ExceptionUtils.getErrorStackTrace(e)); + ImportTaskUtils.finishImportTask(importTaskRst.getTaskId(), + ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, null, "未知错误"); + } finally { + FileUtils.deleteFileIfExists(fileSavePath); + } + }, executorService); + + return importTaskRst.getTaskId(); + } + + /** + * @description: 上传错误描述文件 + * @param errorDatas: + * @return + * @author: WangXianZhang + * @date: 2023/4/19 10:19 PM + */ + private String uploadResultDescFilePath(List errorDatas, String templateFileName) { + FileItem fileItem = null; + try { + String fileName = + DateUtils.format(new Date(), "yyyyMMdd_HHmmss_") + System.nanoTime() + "社会维稳导入失败数据.xlsx"; + + // 创建临时文件 + fileItem = new DiskFileItemFactory(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD, FileUtils.getAndCreateDirUnderEpmetFilesDir("temp").toFile()) + .createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), false, fileName); + + // 写入临时文件 + try (OutputStream os = fileItem.getOutputStream()) { + WriteSheet sheet = EasyExcel.writerSheet(0).build(); + InputStream templateIs = this.getClass().getClassLoader().getResourceAsStream(templateFileName); + ExcelWriter excelWriter = EasyExcel.write(os).withTemplate(templateIs).build().fill(errorDatas, sheet); + excelWriter.finish(); + } catch (IOException e) { + throw new RuntimeException(e); + } + + // 上传文件 + UploadImgResultDTO uploadRst = getResultDataOrThrowsException(ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)), ServiceConstant.EPMET_COMMON_SERVICE, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + null, "【灵山街道-导入特殊人群】上传错误描述文件失败。"); + + return uploadRst.getUrl(); + + } catch (IOException e) { + throw new RuntimeException("【灵山街道-导入特殊人群】生成错误描述文件-创建临时目录失败"); + } finally { + try { + fileItem.delete(); + } catch (Exception e) { + log.error("【灵山街道-导入特殊人群】删除fileItem临时文件失败"); + } + } + } + + @Override + public String validate(LingShanSpecialCrowdDetailBaseExcelData row) { + String idCard = row.getIdCard(); + String name = row.getName(); + + IcResiUserEntity resiEntity = icResiUserDao.selectResiUserEntityByIdCard(idCard, EpmetRequestHolder.getLoginUserCustomerId()); + if (resiEntity == null) { + // 居民不存在,报错 + return "居民信息不存在,请先维护居民基础信息。"; + } + if (!resiEntity.getName().equals(name)) { + return String.format("姓名信息与居民基础信息不一致。(在居民库中根据身份证号找到的居民姓名为:%s)", resiEntity.getName()); + } + + // 设置居民id + row.setResiId(resiEntity.getId()); + row.setResiGridId(resiEntity.getGridId()); + + return null; + } + + @Override + public void savePersonAndTypes(List personTypes, Boolean hard) { + HashMap> resiIdAndTypes = new HashMap<>(); + + // 将所有的人群类别信息,按照居民id归类为map + for (PersonSpecialTypeBean type : personTypes) { + String resiId = type.getResiId(); + Set types = resiIdAndTypes.get(resiId); + if (CollectionUtils.isEmpty(types)) { + types = new HashSet<>(); + resiIdAndTypes.put(resiId, types); + } + types.add(type.getSpecialType()); + } + + // 取出已有的人群类别,合并,转化为字符串,存入 + for (Map.Entry> entry : resiIdAndTypes.entrySet()) { + String resiId = entry.getKey(); + Set typeSet = entry.getValue(); + IcSpecialEntity specialTypeInDb = icSpecialDao.selectByResiId(resiId); + if (specialTypeInDb == null) { + //目前还不是特殊人群,直接新增 + specialTypeInDb = new IcSpecialEntity(); + specialTypeInDb.setIcResiUser(resiId); + specialTypeInDb.setSpecialRqlb(String.join(",", typeSet)); + icSpecialDao.insert(specialTypeInDb); + } else { + if (! hard) { + // 已经是特殊人群了,但不是硬性写入,就需要合并数据库中已存在的数据。否则直接将最新提交的数据覆盖进去 + typeSet.addAll(new HashSet<>(Arrays.asList(specialTypeInDb.getSpecialRqlb().split(",")))); + } + IcSpecialEntity icSpecialUpdate = new IcSpecialEntity(); + icSpecialUpdate.setSpecialRqlb(String.join(",", typeSet)); + icSpecialUpdate.setId(specialTypeInDb.getId()); + icSpecialDao.updateById(icSpecialUpdate); + } + + LinkedHashMap updateMap = new LinkedHashMap<>(); + updateMap.put("IS_SPECIAL", "1"); + + // 居民变更记录(一定要在更新主表IS_SPECIAL之前执行,否则检测不出类别变更) + IcResiUserServiceImpl resiService = SpringContextUtils.getBean(IcResiUserServiceImpl.class); + resiService.icUserChangeRecord(icResiUserDao.selectById(resiId), updateMap); + + // 设置居民的IS_SPECIAL字段为1 + icResiUserDao.upTable("ic_resi_user", resiId, updateMap); + } + } + + @Override + public void saveBatch(List entities, LingshanSpecialCrowdDetailAzbjEntity e) { + List> partition = ListUtils.partition(entities, 50); + for (List l : partition) { + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailAzbjDao.saveBatchManually(l); + } + } + } + + @Override + public void saveBatch(List entities, LingshanSpecialCrowdDetailJdryEntity e) { + List> partition = ListUtils.partition(entities, 50); + for (List l : partition) { + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailJdryDao.saveBatchManually(l); + } + } + } + + @Override + public void saveBatch(List entities, LingshanSpecialCrowdDetailJzhzEntity e) { + List> partition = ListUtils.partition(entities, 50); + for (List l : partition) { + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailJzhzDao.saveBatchManually(l); + } + } + } + + @Override + public void saveBatch(List entities, LingshanSpecialCrowdDetailSqjzEntity e) { + List> partition = ListUtils.partition(entities, 50); + for (List l : partition) { + if (CollectionUtils.isNotEmpty(l)) { + specialCrowdDetailSqjzDao.saveBatchManually(l); + } + } + } + + @Override + public void saveBatch(List entities, LingshanSpecialCrowdDetailXfryEntity e) { + List> partition = ListUtils.partition(entities, 50); + for (List l : partition) { + 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 saveSpecialCrowd(LingShanSpecialTypeSaveFormDTO input) { + LingShanSpecialCrowdDetailBaseExcelData vt = new LingShanSpecialCrowdDetailBaseExcelData(); + vt.setName(input.getName()); + vt.setIdCard(input.getIdCard()); + // 检查 + String validateRst = validate(vt); + 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()); + + orgIdPath = PidUtils.convertPid2OrgIdPath(vt.getResiGridId(), orgIdPath); + + Date now = new Date(); + + ArrayList types2Save = new ArrayList<>(); + + // 保存居民头像 + HashMap dm = new HashMap<>(); + dm.put("HEAD_PHOTO", input.getHeadPhoto()); + icResiUserDao.upTable("ic_resi_user", vt.getResiId(), dm); + + // 保存人群详情 + 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); + + PersonSpecialTypeBean azbjE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.AZBJ.getType()); + types2Save.add(azbjE); + } else { + // 修改的时候,前端提交过来是空的,那就需要将现有的删掉 + deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailAzbjEntity.class); + } + + 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); + + PersonSpecialTypeBean jdryE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JDRY.getType()); + types2Save.add(jdryE); + } else { + deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailJdryEntity.class); + } + + 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); + + PersonSpecialTypeBean jzhzE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JZHZ.getType()); + types2Save.add(jzhzE); + } else { + deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailJzhzEntity.class); + } + + 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); + + PersonSpecialTypeBean xfryE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.XFRY.getType()); + types2Save.add(xfryE); + } else { + deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailXfryEntity.class); + } + + 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); + + PersonSpecialTypeBean sqjzE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.SQJZ.getType()); + types2Save.add(sqjzE); + } else { + deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailSqjzEntity.class); + } + + // 保存人员类型 + savePersonAndTypes(types2Save, true); + } + + /** + * @description: 删除特殊人群详情表 + * @param idCard: + * @return + * @author: WangXianZhang + * @date: 2023/4/24 3:33 PM + */ + private void deleteSpecialCrowdDetail(String idCard, Class e) { + if (LingshanSpecialCrowdDetailAzbjEntity.class == e) { + specialCrowdDetailAzbjDao.deletePhysical(idCard); + } else if (LingshanSpecialCrowdDetailXfryEntity.class == e) { + specialCrowdDetailXfryDao.deletePhysical(idCard); + } else if (LingshanSpecialCrowdDetailSqjzEntity.class == e) { + specialCrowdDetailSqjzDao.deletePhysical(idCard); + } else if (LingshanSpecialCrowdDetailJzhzEntity.class == e) { + specialCrowdDetailJzhzDao.deletePhysical(idCard); + } else if (LingshanSpecialCrowdDetailJdryEntity.class == e) { + specialCrowdDetailJdryDao.deletePhysical(idCard); + } + } + + + void setCommonFields(LingshanSpecialCrowdDetailBaseEntity e, String customerId, String orgIdPath, Date now, String staffId) { + e.setCustomerId(customerId); + e.setOrgIdPath(orgIdPath); + e.setId(IdWorker.getIdStr()); + e.setRevision(0); + e.setCreatedTime(now); + e.setUpdatedTime(now); + e.setCreatedBy(staffId); + e.setUpdatedBy(staffId); + e.setDelFlag("0"); + } + + @Override + public LingShanSpecialTypeSaveResultDTO getPersonSpecialTypeDetail(String resiId) { + // 1.校验人员基础信息 + IcResiUserEntity person = icResiUserDao.selectById(resiId); + + if (person == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员信息"); + } + + LingShanSpecialTypeSaveResultDTO d = new LingShanSpecialTypeSaveResultDTO(); + + // 头像 + d.setHeadPhoto(person.getHeadPhoto()); + + // 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()); + + // 3.查询和补充居民信息 + IcResiUserEntity resiBaseEntity = icResiUserDao.selectResiUserEntityByIdCard(person.getIdCard(), EpmetRequestHolder.getLoginUserCustomerId()); + if (resiBaseEntity == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员信息"); + } + + // 户籍地 + d.setDomicilePlace(resiBaseEntity.getHjszd()); + + // 住址 + d.setAddress(getAddressOfResi(resiBaseEntity.getGridId(), resiBaseEntity.getHomeId())); + + // 生日 + d.setBirthday(resiBaseEntity.getBirthday()); + + // 性别 + String gender = resiBaseEntity.getGender(); + String genderStr; + if (gender == null) { + genderStr = "保密"; + } else if (gender.equals("0")) { + genderStr = "男"; + } else if (gender.equals("1")) { + genderStr = "女"; + } else { + genderStr = "未知"; + } + d.setGender(resiBaseEntity.getGender()); + d.setGenderZh(genderStr); + d.setMobile(resiBaseEntity.getMobile()); + + // 民族 + AtomicReference nationZh = new AtomicReference(); + List nationDict = getResultDataOrReturnNull(adminOpenFeignClient.getNationOption(), ServiceConstant.EPMET_ADMIN_SERVER); + if (CollectionUtils.isNotEmpty(nationDict)) { + nationDict.stream().forEach(n -> { + if (n.getValue().equals(resiBaseEntity.getMz())) { + nationZh.set(n.getLabel()); + } + }); + } + + d.setNation(nationZh.get()); + return d; + } + + private String getAddressOfResi(String gridId, String homeId) { + + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId); + String allParentName = gridInfo.getAllParentName(); + String gridNamePath = gridInfo.getGridNamePath(); + + // IcNeighborHoodDTO nei = getResultDataOrReturnNull(govOrgOpenFeignClient.getIcNeighbordhoodById(villageId), ServiceConstant.GOV_ORG_SERVER); + // IcBuildingDTO buildingDTO = getResultDataOrReturnNull(govOrgOpenFeignClient.getBuildingById(buildId), ServiceConstant.GOV_ORG_SERVER); + // IcBuildingUnitDTO unit = getResultDataOrReturnNull(govOrgOpenFeignClient.getUnitById(unitId), ServiceConstant.GOV_ORG_SERVER); + HouseAgencyInfoResultDTO houseInfo = getResultDataOrReturnNull(govOrgOpenFeignClient.getHouseAgencyInfo(homeId), ServiceConstant.GOV_ORG_SERVER); + return String.format("%s-%s-%s", allParentName, gridNamePath, houseInfo.getFullName()); + } + + @Override + public PageData listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile, + String idCard, Integer pageNo, Integer pageSize) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + String orgIdPath = null; + if (StringUtils.isNotBlank(orgId)) { + orgIdPath = CustomerOrgRedis.getOrgIdPath(orgId, orgType); + } else { + // 前端没传递,那就用当前staff所属的 + orgIdPath = epmetUserRemoteService.getLoginUserDetails().getOrgIdPath(); + orgType = "agency"; + } + PageHelper.startPage(pageNo, pageSize); + List l = icSpecialDao.listSpecialCrowd(orgIdPath, orgId, orgType, specialType, name, mobile, idCard); + // List l = specialCrowdPersonTypeDao.listSpecialCrowds(orgIdPath, orgType, specialType, name, mobile, idCard); + l.forEach(i -> { + IcResiUserDTO resi = icResiUserDao.getResiUserByIdCard(i.getIdCard(), customerId); + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(resi.getGridId()); + i.setOrgNamePath(gridInfo.getAgencyName().concat("-").concat(gridInfo.getGridName())); + i.setAddress(getAddressOfResi(resi.getGridId(), resi.getHomeId())); + + // 处理类型展示中文,将a,b,c =》 啊,喔,额 + List typesDisplay = new ArrayList<>(); + String specialTypesStr = i.getSpecialTypesStr(); + if (StringUtils.isNotBlank(specialTypesStr)) { + String[] types = specialTypesStr.split(","); + for (String type : types) { + LingShanSpecialCrowdTypeEnums crowdType = LingShanSpecialCrowdTypeEnums.getByType(type); + if (crowdType != null) { + typesDisplay.add(crowdType.getName()); + } + } + } + i.setSpecialTypeDisplay(String.join(",", typesDisplay)); + }); + return new PageData<>(l, new PageInfo<>(l).getTotal()); + } + + @Transactional + @Override + public void deleteByResi(String resiId) { + // 1.先删除type + LambdaQueryWrapper q = new LambdaQueryWrapper<>(); + q.eq(IcSpecialEntity::getIcResiUser, resiId); + icSpecialDao.delete(q); + + // 2.更新居民信息主表中的标记 + IcResiUserEntity resiInfo = icResiUserDao.selectById(resiId); + + HashMap updateData = new HashMap<>(); + updateData.put("IS_SPECIAL", null); + icResiUserDao.upTable("ic_resi_user", resiId, updateData); + + // 3.再删除detail + specialCrowdDetailAzbjDao.deletePhysical(resiInfo.getIdCard()); + specialCrowdDetailXfryDao.deletePhysical(resiInfo.getIdCard()); + specialCrowdDetailJdryDao.deletePhysical(resiInfo.getIdCard()); + specialCrowdDetailSqjzDao.deletePhysical(resiInfo.getIdCard()); + specialCrowdDetailJzhzDao.deletePhysical(resiInfo.getIdCard()); + } +} diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_azbj_export.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_azbj_export.xlsx new file mode 100644 index 0000000000..8e26c9f346 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_azbj_export.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jdry_export.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jdry_export.xlsx new file mode 100644 index 0000000000..b584c9be47 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jdry_export.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jzhz_export.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jzhz_export.xlsx new file mode 100644 index 0000000000..1d9b1aa072 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_jzhz_export.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_sqjz_export.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_sqjz_export.xlsx new file mode 100644 index 0000000000..821ac90f7e Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_sqjz_export.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_xfry_export.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_xfry_export.xlsx new file mode 100644 index 0000000000..05e2a77bd4 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/lingshan_special_crowd_xfry_export.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx new file mode 100644 index 0000000000..a50dfb04b2 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx new file mode 100644 index 0000000000..63d3839c6d Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx new file mode 100644 index 0000000000..984fdb14cb Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx new file mode 100644 index 0000000000..d29f9b4b30 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx new file mode 100644 index 0000000000..17de7b7846 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcSpecialDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSpecialDao.xml new file mode 100644 index 0000000000..5d66f2482f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcSpecialDao.xml @@ -0,0 +1,46 @@ + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml new file mode 100644 index 0000000000..4a4dee13a3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into lingshan_special_crowd_detail_azbj ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, ORIGINAL_CHARGE, RELEASE_DATE + , ORIGIN_PRISON_TERM, RECIDIVISM_FLAG, EMPLACEMENT_FLAG, EMPLACEMENT_DATE + , EMPLACEMENT_INFO, CANCELED_FLAG, CANCELED_REASON, DEL_FLAG, REVISION + , CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) + values + + ( #{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.originalCharge}, + #{item.releaseDate},#{item.originPrisonTerm},#{item.recidivismFlag},#{item.emplacementFlag}, + #{item.emplacementDate}, #{item.emplacementInfo}, #{item.canceledFlag}, #{item.canceledReason}, #{item.delFlag}, + #{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime} + ) + + on duplicate key update ORG_ID_PATH = values(ORG_ID_PATH) + , ID_CARD = values(ID_CARD) + , ORIGINAL_CHARGE = values(ORIGINAL_CHARGE) + , RELEASE_DATE = values(RELEASE_DATE) + , ORIGIN_PRISON_TERM = values(ORIGIN_PRISON_TERM) + , RECIDIVISM_FLAG = values(RECIDIVISM_FLAG) + , EMPLACEMENT_FLAG = values(EMPLACEMENT_FLAG) + , EMPLACEMENT_DATE = values(EMPLACEMENT_DATE) + , EMPLACEMENT_INFO = values(EMPLACEMENT_INFO) + , CANCELED_FLAG = values(CANCELED_FLAG) + , CANCELED_REASON = values(CANCELED_REASON) + , UPDATED_BY = values(UPDATED_BY) + , UPDATED_TIME = values(UPDATED_TIME) + + + delete from lingshan_special_crowd_detail_azbj where ID_CARD=#{idCard} + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml new file mode 100644 index 0000000000..9d0e724a4c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml @@ -0,0 +1,51 @@ + + + + + + insert into lingshan_special_crowd_detail_jdry ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, CRIMINAL_HISTORY_FLAG + , DRUG_REPETITION_FLAG, FIRST_DISCOVERY_DATE, CONTROLLER_NAME + , CONTROLLER_CONTACT, HELPER_NAME, HELPER_CONTACT, DETACHED_FLAG + , DETACHED_REASON, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME + , UPDATED_BY, UPDATED_TIME) + values + + (#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.criminalHistoryFlag}, + #{item.drugRepetitionFlag}, #{item.firstDiscoveryDate}, #{item.controllerName}, #{item.controllerContact}, #{item.helperName}, + #{item.helperContact}, #{item.detachedFlag}, #{item.detachedReason}, #{item.delFlag}, #{item.revision}, + #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}) + + on duplicate key update + ORG_ID_PATH = values(ORG_ID_PATH), + CRIMINAL_HISTORY_FLAG = values(CRIMINAL_HISTORY_FLAG), + DRUG_REPETITION_FLAG = values(DRUG_REPETITION_FLAG), + FIRST_DISCOVERY_DATE = values(FIRST_DISCOVERY_DATE), + CONTROLLER_NAME = values(CONTROLLER_NAME), + CONTROLLER_CONTACT = values(CONTROLLER_CONTACT), + HELPER_NAME = values(HELPER_NAME), + HELPER_CONTACT = values(HELPER_CONTACT), + DETACHED_FLAG = values(DETACHED_FLAG), + DETACHED_REASON = values(DETACHED_REASON), + DEL_FLAG = values(DEL_FLAG), + REVISION = values(REVISION), + UPDATED_BY = values(UPDATED_BY), + UPDATED_TIME = values(UPDATED_TIME) + + + delete from lingshan_special_crowd_detail_jdry where ID_CARD=#{idCard} + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml new file mode 100644 index 0000000000..1bc308d6e2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into lingshan_special_crowd_detail_jzhz ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, CAUSE_TROUBLE_HISTORY_FLAG + , CAUSE_TROUBLE_TIMES, CURRENT_DIAGNOSIS, DANGEROUS_CLASS + , CAN_GO_OUT_FLAG, VIOLENCE_FLAG, ALLOWANCE_FLAG, SUBSISTENCE_FLAG + , GUARDIAN_NAME, GUARDIAN_CONTACT, DEL_FLAG, REVISION, CREATED_BY + , CREATED_TIME, UPDATED_BY, UPDATED_TIME) + values + + (#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.causeTroubleHistoryFlag}, + #{item.causeTroubleTimes}, #{item.currentDiagnosis}, #{item.dangerousClass}, #{item.canGoOutFlag}, #{item.violenceFlag}, + #{item.allowanceFlag}, #{item.subsistenceFlag}, #{item.guardianName}, #{item.guardianContact}, #{item.delFlag}, + #{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime} + ) + + on duplicate key update ORG_ID_PATH = values(ORG_ID_PATH) + , ID_CARD = values(ID_CARD) + , CAUSE_TROUBLE_HISTORY_FLAG = values(CAUSE_TROUBLE_HISTORY_FLAG) + , CAUSE_TROUBLE_TIMES = values(CAUSE_TROUBLE_TIMES) + , CURRENT_DIAGNOSIS = values(CURRENT_DIAGNOSIS) + , DANGEROUS_CLASS = values(DANGEROUS_CLASS) + , CAN_GO_OUT_FLAG = values(CAN_GO_OUT_FLAG) + , VIOLENCE_FLAG = values(VIOLENCE_FLAG) + , ALLOWANCE_FLAG = values(ALLOWANCE_FLAG) + , SUBSISTENCE_FLAG = values(SUBSISTENCE_FLAG) + , GUARDIAN_NAME = values(GUARDIAN_NAME) + , GUARDIAN_CONTACT = values(GUARDIAN_CONTACT) + , UPDATED_BY = values(UPDATED_BY) + , UPDATED_TIME = values(UPDATED_TIME) + + + + delete from lingshan_special_crowd_detail_jzhz where ID_CARD=#{idCard} + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml new file mode 100644 index 0000000000..9b729f29b9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into lingshan_special_crowd_detail_sqjz ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, RECTIFICATE_TYPE + , RECTIFICATE_START_DATE, RECTIFICATE_END_DATE, ORIGIN_DETAIN_ADDRESS + , ORIGINAL_CHARGE, RECEIVE_WAY, RECTIFICATE_INFO, DETACHED_FLAG + , DETACHED_REASON, CANCELED_FLAG, CANCELED_REASON, DEL_FLAG, REVISION + , CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) + values + + (#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.rectificateType}, + #{item.rectificateStartDate}, #{item.rectificateEndDate}, #{item.originDetainAddress}, #{item.originalCharge}, #{item.receiveWay}, + #{item.rectificateInfo}, #{item.detachedFlag}, #{item.detachedReason}, #{item.canceledFlag}, #{item.canceledReason}, + #{item.delFlag}, #{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, + #{item.updatedTime}) + + on duplicate key update + ORG_ID_PATH = values(ORG_ID_PATH) + , RECTIFICATE_TYPE = values(RECTIFICATE_TYPE) + , RECTIFICATE_START_DATE = values(RECTIFICATE_START_DATE) + , RECTIFICATE_END_DATE = values(RECTIFICATE_END_DATE) + , ORIGIN_DETAIN_ADDRESS = values(ORIGIN_DETAIN_ADDRESS) + , ORIGINAL_CHARGE = values(ORIGINAL_CHARGE), RECEIVE_WAY = values(RECEIVE_WAY) + , RECTIFICATE_INFO = values(RECTIFICATE_INFO), DETACHED_FLAG = values(DETACHED_FLAG) + , DETACHED_REASON = values(DETACHED_REASON), CANCELED_FLAG = values(CANCELED_FLAG) + , CANCELED_REASON = values(CANCELED_REASON) + , UPDATED_BY = values(UPDATED_BY) + , UPDATED_TIME = values(UPDATED_TIME) + + + delete from lingshan_special_crowd_detail_sqjz where ID_CARD=#{idCard} + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml new file mode 100644 index 0000000000..ef6c561bbe --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into lingshan_special_crowd_detail_xfry ( ID, CUSTOMER_ID, ORG_ID_PATH, ID_CARD, PROBLEM + , STABLE_CONTROL_MEASUREMENT, MULTIPLE_FLAG, LOCAL_FLAG, BRANCH_LEADER + , BRANCH_LEADER_CONTACT, PRINCIPAL, PRINCIPAL_CONTACT + , STABLE_CONTROLER_LIST, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME + , UPDATED_BY, UPDATED_TIME) + values + + (#{item.id}, #{item.customerId}, #{item.orgIdPath}, #{item.idCard}, #{item.problem}, + #{item.stableControlMeasurement}, #{item.multipleFlag}, #{item.localFlag}, #{item.branchLeader}, #{item.branchLeaderContact}, + #{item.principal}, #{item.principalContact}, #{item.stableControlerList}, #{item.delFlag}, #{item.revision}, + #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}) + + on duplicate key update + ORG_ID_PATH = values (ORG_ID_PATH) + , PROBLEM = values(PROBLEM) + , STABLE_CONTROL_MEASUREMENT = values(STABLE_CONTROL_MEASUREMENT) + , MULTIPLE_FLAG = values(MULTIPLE_FLAG) + , LOCAL_FLAG = values(LOCAL_FLAG) + , BRANCH_LEADER = values(BRANCH_LEADER) + , BRANCH_LEADER_CONTACT = values(BRANCH_LEADER_CONTACT) + , PRINCIPAL = values(PRINCIPAL) + , PRINCIPAL_CONTACT = values(PRINCIPAL_CONTACT) + , STABLE_CONTROLER_LIST = values(STABLE_CONTROLER_LIST) + , DEL_FLAG = values(DEL_FLAG) + , REVISION = values(REVISION) + , UPDATED_BY = values(UPDATED_BY) + , UPDATED_TIME = values(UPDATED_TIME) + + + delete from lingshan_special_crowd_detail_xfry where ID_CARD=#{idCard} + + + + + + + \ No newline at end of file