diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java index 7f3dec5314..7559bad559 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java @@ -23,7 +23,10 @@ import java.io.Serializable; @Data public class PasswordDTO implements Serializable { private static final long serialVersionUID = 1L; - + /** + * 旧密码 + */ + private String oldPassword; @NotBlank(message="{sysuser.password.require}") private String password; diff --git a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml index 2c1bea6b5d..847da3aacc 100644 --- a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml +++ b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml @@ -32,6 +32,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -134,6 +136,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -158,4 +166,4 @@ thread: queueCapacity: @thread.threadPool.queue-capacity@ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ - rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ \ No newline at end of file + rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.22__jmreport_category.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.22__jmreport_category.sql new file mode 100644 index 0000000000..aa7b268044 --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.22__jmreport_category.sql @@ -0,0 +1,5 @@ +INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1556509011061993473', 'jmreport_category', '报表应用类别', '居民信息、房屋信息', 32, 0, 0, '1', '2022-08-08 13:14:01', '1', '2022-08-08 13:14:01'); + + +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1556509175185108994', 1556509011061993473, '房屋信息', 'house_info', '0', '', 2, 0, 0, '1', '2022-08-08 13:14:41', '1', '2022-08-08 13:14:41'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1556509102015475714', 1556509011061993473, '居民信息', 'resi_info', '0', '', 1, 0, 0, '1', '2022-08-08 13:14:23', '1', '2022-08-08 13:14:23'); diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.23__party_publish_Time.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.23__party_publish_Time.sql new file mode 100644 index 0000000000..a2ad1f1ef8 --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.23__party_publish_Time.sql @@ -0,0 +1,8 @@ +INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458000894500866', 'icpartyact_auto_publish_time', '党组织活动自动发布时间', '党组织活动自动发布时间', 35, 0, 0, '1', '2022-08-19 10:45:54', '1', '2022-08-19 10:46:11'); + + +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458233091170305', 1560458000894500866, '活动开始前1天', '1', '0', '活动开始前1天', 1, 0, 0, '1', '2022-08-19 10:46:49', '1', '2022-08-19 10:46:49'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458276439302146', 1560458000894500866, '活动开始前3天', '3', '0', '活动开始前3天', 2, 0, 0, '1', '2022-08-19 10:47:00', '1', '2022-08-19 10:47:00'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458332076744705', 1560458000894500866, '活动开始前5天', '5', '0', '活动开始前5天', 3, 0, 0, '1', '2022-08-19 10:47:13', '1', '2022-08-19 10:47:13'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1560458388007788545', 1560458000894500866, '活动开始前7天', '7', '0', '活动开始前7天', 4, 0, 0, '1', '2022-08-19 10:47:26', '1', '2022-08-19 10:47:26'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1561627442626142210', 1560458000894500866, '现在发布', '0', '0', '', 5, 0, 0, '1', '2022-08-22 16:12:51', '1', '2022-08-22 16:12:51'); diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index baf612e28c..489d4c324e 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -138,6 +138,16 @@ epmet-auth-client 2.0.0 + + dingtalk-spring-boot-starter + com.taobao + 1.0.0 + + + commons-codec + commons-codec + 1.15 + diff --git a/epmet-auth/src/main/java/com/epmet/AuthApplication.java b/epmet-auth/src/main/java/com/epmet/AuthApplication.java index 0bf685bd5b..07d85a0d5f 100644 --- a/epmet-auth/src/main/java/com/epmet/AuthApplication.java +++ b/epmet-auth/src/main/java/com/epmet/AuthApplication.java @@ -8,6 +8,7 @@ package com.epmet; +import com.taobao.dingtalk.spring.annotations.EnableDingTalk; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; @@ -20,6 +21,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients; * @author Mark sunlightcs@gmail.com * @since 1.0.0 */ +@EnableDingTalk @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java index 43b2719dc8..a3a36c9588 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -9,6 +10,7 @@ import com.epmet.dto.form.GovWebLoginFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.GovWebService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; @@ -44,10 +46,14 @@ public class GovWebController { ValidatorUtils.validateEntity(formDTO); try { - if (formDTO.getPassword().length() > 50) { + if (StringUtils.isNotBlank(formDTO.getPassword())&&formDTO.getPassword().length() > NumConstant.FIFTY) { String newPassword = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey); formDTO.setPassword(newPassword); } + if (StringUtils.isNotBlank(formDTO.getPhone())&&formDTO.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey); + formDTO.setPhone(phone); + } } catch (Exception e) { log.error("method exception", e); diff --git a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java index 36c4d2a8d0..08e40eb99d 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java @@ -1,8 +1,10 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -15,6 +17,7 @@ import com.epmet.service.LoginService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.imageio.ImageIO; @@ -36,6 +39,8 @@ import java.util.Arrays; @RestController @RequestMapping("login") public class LoginController { + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private CaptchaService captchaService; @@ -90,11 +95,23 @@ public class LoginController { * @Date 2020/3/14 19:46 **/ @PostMapping("/operweb/loginbypassword") - public Result loginByPassword(@RequestBody LoginByPassWordFormDTO formDTO) { + public Result loginByPassword(@RequestBody LoginByPassWordFormDTO formDTO) throws Exception { //效验数据 ValidatorUtils.validateEntity(formDTO); - Result result = loginService.loginByPassword(formDTO); - return result; + //解密密码 + if (StringUtils.isNotBlank(formDTO.getPhone())&&formDTO.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey); + formDTO.setPhone(phone); + } + if (StringUtils.isNotBlank(formDTO.getMobile())&&formDTO.getMobile().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getMobile(), privateKey); + formDTO.setMobile(phone); + } + if (StringUtils.isNotBlank(formDTO.getPassword())&&formDTO.getPassword().length() > NumConstant.FIFTY) { + String confirmNewPassWord = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey); + formDTO.setPassword(confirmNewPassWord); + } + return loginService.loginByPassword(formDTO); } /** diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index e8977cd508..8629684232 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -3,15 +3,13 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; +import com.epmet.dto.result.ResiDingAppLoginResDTO; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.ThirdLoginService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -110,7 +108,7 @@ public class ThirdLoginController { **/ @PostMapping(value = "/getmyorgbyaccount") public Result> getMyOrgByAccount(@RequestBody ThirdStaffOrgByAccountFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, StaffOrgByAccountFormDTO.AddUserShowGroup.class, StaffOrgByAccountFormDTO.GetMyOrgByPassWordGroup.class); + ValidatorUtils.validateEntity(formDTO); List staffOrgs = thirdLoginService.getMyOrgByAccount(formDTO); return new Result>().ok(staffOrgs); } @@ -142,4 +140,68 @@ public class ThirdLoginController { return new Result(); } + /** + * 钉钉应用的登录-居民端 + * 产品服务商建立第三方企业应用 + * 参考文档:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process + * @param formDTO + * @return + */ + /** + * 接入流程:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process + * 1、获取个人用户token:https://open.dingtalk.com/document/isvapp-server/obtain-user-token + * 2、获取用户通讯录个人信息:https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information + * 接口逻辑: + * (1)根据clientId去XXX表找到customerId + * (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId, + * 是否注册居民:register_relation + * (3)没有则生成user、user_Base_info表记录 + * @param formDTO + * @return + */ + @PostMapping("resilogin-ding") + public Result resiLoginDing(@RequestBody ResiDingAppLoginFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,ResiDingAppLoginFormDTO.InnerMiniApp.class); + return new Result().ok(thirdLoginService.resiLoginDing(formDTO)); + } + + /** + * 烟台建立应用,授权给我们,走企业免登 + * 企业简历内部应用授权给第三方 + * 可参考文档: 获取第三方应用授权企业的accessToken https://open.dingtalk.com/document/orgapp-server/obtain-the-access_token-of-the-authorized-enterprise + * https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free + * @param formDTO + * @return + */ + @PostMapping("resilogin-ding-md") + public Result resiLoginDingMd(@RequestBody ResiDingAppLoginMdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(thirdLoginService.resiLoginDingMd(formDTO)); + } + + /** + * 企业内部应用开发,不授权了 文档地址:https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free + * https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free + * 建议用户信息保存在前端缓存中(dd.setStorage)或者cookie中,避免每次进入应用都调用钉钉接口进行免登。 + * + * 获取免登授权码。 + * 小程序免登 + * 微应用免登 + * 获取AccessToken。 + * 调用接口获取access_token,详情请参考获取企业内部应用的access_token。 + * + * 获取userid。 + * 调用接口获取用户的userid,详情请参考通过免登码获取用户信息。 + * + * 获取用户详情。 + * 调用接口获取用户详细信息,详情请参考根据userId获取用户详情。 + * + * @param formDTO + * @return + */ + @PostMapping("resilogin-internalding") + public Result resiLoginInternalDing(@RequestBody ResiDingAppLoginMdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(thirdLoginService.resiLoginInternalDing(formDTO)); + } } diff --git a/epmet-auth/src/main/java/com/epmet/dto/dingres/DingUserDetailDTO.java b/epmet-auth/src/main/java/com/epmet/dto/dingres/DingUserDetailDTO.java new file mode 100644 index 0000000000..4a46922590 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/dingres/DingUserDetailDTO.java @@ -0,0 +1,73 @@ +package com.epmet.dto.dingres; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/22 14:16 + */ +@Data +public class DingUserDetailDTO { + // 接口文档:https://open.dingtalk.com/document/isvapp-server/query-user-details + /** + * 员工的userId。 + */ + private String userid; + + /** + * 员工在当前开发者企业账号范围内的唯一标识。 + */ + private String unionid; + + /** + * 员工姓名。 + */ + private String name; + /** + * 头像。 + *

+ * 说明 员工使用默认头像,不返回该字段,手动设置头像会返回 + */ + private String avatar; + /** + * 国际电话区号。 + *

+ * 说明 第三方企业应用不返回该字段;如需获取state_code,可以使用钉钉统一授权套件方式获取。 + */ + private String state_code; + /** + * 手机号码。 + *

+ * 说明 + * 企业内部应用,只有应用开通通讯录邮箱等个人信息权限,才会返回该字段。 + * 第三方企业应用不返回该字段,如需获取mobile,可以使用钉钉统一授权套件方式获取。 + */ + private String mobile; + /** + * 是否号码隐藏: + *

+ * true:隐藏 + *

+ * false:不隐藏 + *

+ * 说明 隐藏手机号后,手机号在个人资料页隐藏,但仍可对其发DING、发起钉钉免费商务电话。 + */ + private String hide_mobile; + /** + * 分机号。 + *

+ * 说明 第三方企业应用不返回该参数。 + */ + private String telephone; + + /** + * 员工的企业邮箱。 + * + * 如果员工的企业邮箱没有开通,返回信息中不包含该数据。 + * + * 说明 第三方企业应用不返回该参数。 + */ + private String org_email; +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/dingres/V2UserGetuserinfoResDTO.java b/epmet-auth/src/main/java/com/epmet/dto/dingres/V2UserGetuserinfoResDTO.java new file mode 100644 index 0000000000..ea9eb3b46b --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/dingres/V2UserGetuserinfoResDTO.java @@ -0,0 +1,54 @@ +package com.epmet.dto.dingres; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/22 14:08 + */ +@Data +public class V2UserGetuserinfoResDTO { + // 接口返参:https://open.dingtalk.com/document/orgapp-server/obtain-the-userid-of-a-user-by-using-the-log-free + /** + * 用户的userid。 + */ + private String userid; + /** + * 设备ID。 + */ + private String device_id; + /** + * 是否是管理员。 + *

+ * true:是 + *

+ * false:不是 + */ + private Boolean sys; + /** + * 级别。 + *

+ * 1:主管理员 + *

+ * 2:子管理员 + *

+ * 100:老板 + *

+ * 0:其他(如普通员工) + */ + private Number sys_level; + /** + * 用户关联的unionId。 + */ + private String associated_unionid; + /** + * 用户unionId。 + */ + private String unionid; + /** + * 用户名字。 + */ + private String name; +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginFormDTO.java new file mode 100644 index 0000000000..b18e95478a --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginFormDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description + * @Author yzm + * @Date 2022/9/14 17:11 + */ +@Data +public class ResiDingAppLoginFormDTO { + public interface InnerMiniApp {} + public interface ThirdMiniApp {} + /** + * 授权统一后的authCode + */ + @NotBlank(message = "authCode不能为空",groups = InnerMiniApp.class) + private String authCode; +// /** +// * 第三方企业应用传应用的SuiteKey +// */ +// @NotBlank(message = "clientId不能为空") +// private String clientId; + /** + * 第三方企业应用传应用的SuiteKey + */ + @NotBlank(message = "miniAppId不能为空",groups = InnerMiniApp.class) + private String miniAppId; + + // @NotBlank(message = "当前访问用户的企业corpId不能为空") + // private String corpId; + + /** + * third:第三方应用 + * company_customize:企业定制应用 + */ + private String appType="company_customize"; +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java new file mode 100644 index 0000000000..0b3b9ae0f8 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description + * @Author yzm + * @Date 2022/9/22 10:42 + */ +@Data +public class ResiDingAppLoginMdFormDTO { + @NotBlank(message = "authCode不能为空") + private String authCode; + /** + * 第三方企业应用传应用的SuiteKey + */ + @NotBlank(message = "miniAppId不能为空") + private String miniAppId; + +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java index 3cad308ab6..fd1d93b725 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java @@ -1,6 +1,5 @@ package com.epmet.dto.form; -import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -13,36 +12,20 @@ import java.io.Serializable; @Data public class ThirdStaffOrgByAccountFormDTO implements Serializable { private static final long serialVersionUID = 4193133227120225342L; - /** - * 添加用户操作的用户可见异常分组 - * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup - * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 - */ - public interface AddUserShowGroup extends CustomerClientShowGroup { - } - public interface GetMyOrgByPassWordGroup extends CustomerClientShowGroup { - } - public interface GetMyOrgByLoginWxmp extends CustomerClientShowGroup{} /** * 小程序appId */ - @NotBlank(message = "appId不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "appId不能为空") private String appId; /** * 手机号 */ - @NotBlank(message = "账号不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "账号不能为空") private String userAccount; - /** - * 验证码 - */ - @NotBlank(message="验证码不能为空", groups = {GetMyOrgByLoginWxmp.class}) - private String smsCode; - - @NotBlank(message = "密码不能为空",groups ={GetMyOrgByPassWordGroup.class}) + @NotBlank(message = "密码不能为空") private String password; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java b/epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java new file mode 100644 index 0000000000..7a0517574a --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/14 17:20 + */ +@Data +public class ResiDingAppLoginResDTO { + private String authorization; + private String customerId; + private String gridId; + /** + * 网格名 + */ + private String gridName; + /** + * 网格所属的组织id + */ + private String agencyId; + /** + * 居民端用户id + */ + private String epmetUserId; + + /** + * 5.获取用户手机号。使用用户个人access_token调用获取用户通讯录个人信息接口获取 + * 返参信息 + * 接口文档:https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information + */ + private String extInfo; + + /** + * 是否注册居民 + * true:已注册 + * false:未注册 + */ + private Boolean regFlag; +} + diff --git a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java index 69d13bf926..70bcc92338 100644 --- a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.dto.form.*; +import com.epmet.dto.result.ResiDingAppLoginResDTO; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.UserTokenResultDTO; @@ -84,4 +85,29 @@ public interface ThirdLoginService { * @description 单客户-工作端微信小程序登录-发送验证码 **/ void sendSmsCode(ThirdSendSmsCodeFormDTO formDTO); + + /** + * 钉钉应用的登录-居民端 + * 产品服务商建立第三方企业应用 + * 参考文档:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process + * @param formDTO + * @return + */ + ResiDingAppLoginResDTO resiLoginDing(ResiDingAppLoginFormDTO formDTO); + + /** + * 企业简历内部应用授权给第三方 + * 可参考文档: 获取第三方应用授权企业的accessToken https://open.dingtalk.com/document/orgapp-server/obtain-the-access_token-of-the-authorized-enterprise + * https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free + * @param formDTO + * @return + */ + ResiDingAppLoginResDTO resiLoginDingMd(ResiDingAppLoginMdFormDTO formDTO); + + /** + * 企业内部应用免登 文档地址:https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free + * @param formDTO + * @return + */ + ResiDingAppLoginResDTO resiLoginInternalDing(ResiDingAppLoginMdFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index cd1495ddb2..052f0ed3b9 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -5,15 +5,23 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.aliyun.dingtalk.module.DingTalkResult; import com.epmet.auth.constants.AuthOperationConstants; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.rocketmq.messages.LoginMQMsg; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.EnvEnum; 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.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.redis.common.CustomerDingDingRedis; +import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.password.PasswordUtils; @@ -23,6 +31,8 @@ import com.epmet.commons.tools.validator.PhoneValidatorUtils; import com.epmet.constant.AuthHttpUrlConstant; import com.epmet.constant.SmsTemplateConstant; import com.epmet.dto.*; +import com.epmet.dto.dingres.DingUserDetailDTO; +import com.epmet.dto.dingres.V2UserGetuserinfoResDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -32,6 +42,11 @@ import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; import com.epmet.redis.CaptchaRedis; import com.epmet.service.ThirdLoginService; +import com.taobao.api.ApiException; +import com.taobao.dingtalk.client.DingTalkClientToken; +import com.taobao.dingtalk.client.DingTalkClientUser; +import com.taobao.dingtalk.vo.result.AccessTokenResult; +import com.taobao.dingtalk.vo.result.UserBaseInfo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -73,6 +88,12 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol private EpmetMessageOpenFeignClient messageOpenFeignClient; @Autowired private LoginUserUtil loginUserUtil; + @Autowired + private RedisUtils redisUtils; + @Autowired + private DingTalkClientToken dingTalkClientToken; + @Autowired + private DingTalkClientUser dingTalkClientUser; /** * @param formDTO @@ -599,11 +620,42 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol result.getMsg())); return new ArrayList<>(); } - + //临时解决方案 + private static final List resultTemp = new ArrayList<>(); + static { + StaffOrgsResultDTO t = new StaffOrgsResultDTO(); + t.setRootAgencyId("53613e1c5de6ed473467f0159a10b135"); + t.setRootAgencyName("平阴县"); + t.setCustomerId("6f203e30de1a65aab7e69c058826cd80"); + t.setCustomerName("平音"); + resultTemp.add(t); + } @Override public List getMyOrgByAccount(ThirdStaffOrgByAccountFormDTO formDTO) { + String appId = formDTO.getAppId(); + String userAccount = formDTO.getUserAccount(); + String password = formDTO.getPassword(); + //{"code":0,"msg":"success","internalMsg":"","data":[{"rootAgencyId":"53613e1c5de6ed473467f0159a10b135","rootAgencyName":"平阴县","customerId":"6f203e30de1a65aab7e69c058826cd80","customerName":"平音"}]} + if ("wx2b75d556ba867750".equals(appId)){ + if("18700011111".equals(userAccount)){ + if (!"Py02222".equals(password)){ + throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); + } + //String result = "[{\"rootAgencyId\":\"53613e1c5de6ed473467f0159a10b135\",\"rootAgencyName\":\"平阴县\",\"customerId\":\"6f203e30de1a65aab7e69c058826cd80\",\"customerName\":\"平音\"}]"; + return resultTemp; + } + if (userAccount.startsWith("187000111")){ + throw new EpmetException(EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode()); + } + } + //{"isNovice":false,"mobile":"","userAccount":"18700011111","password":"Py011111","appId":"wx2b75d556ba867750"} + + logger.info("getMyOrgByAccountService at :{}",System.currentTimeMillis()); + long start = System.currentTimeMillis(); //0.根据appId查询对应客户Id PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId()); + logger.info("getMyOrgByAccountService getCustomerInfo cost:{}",System.currentTimeMillis() - start ); + start = System.currentTimeMillis(); //7.28 上边根据appId只能锁定一条客户id,后边的批量循环操作暂不做调整,还是使用之前的代码 sun //1、根据手机号查询到用户信息 ThirdCustomerStaffByAccountFormDTO dto = new ThirdCustomerStaffByAccountFormDTO(); @@ -614,30 +666,31 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol logger.warn(String.format("账户密码登录异常,账户[%s],code[%s],msg[%s]", formDTO.getUserAccount(), customerStaffResult.getCode(), customerStaffResult.getMsg())); throw new RenException(customerStaffResult.getCode()); } + logger.info("getMyOrgByAccountService getCustsomerStaffByIdAndAccount cost:{}",System.currentTimeMillis()- start); + start = System.currentTimeMillis(); //2、密码是否正确 List customerStaffList=customerStaffResult.getData(); + if (CollectionUtils.isEmpty(customerStaffList)){ + throw new EpmetException(EpmetErrorCode.GOV_STAFF_ACCOUNT_NOT_EXISTS.getCode()); + } //3、查询用户所有的组织信息 List customerIdList = new ArrayList<>(); //是否设置过密码 boolean havePasswordFlag=false; //密码是否正确 boolean passwordRightFlag=false; - for (CustomerStaffDTO customerStaffDTO : customerStaffList) { - if(StringUtils.isNotBlank(customerStaffDTO.getPassword())){ - havePasswordFlag=true; - }else{ - logger.warn(String.format("当前用户:账户%s,客户Id%s下未设置密码.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); - continue; - } - if (!PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) { - logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配错误.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); + CustomerStaffDTO customerStaffDTO = customerStaffList.get(0); - }else{ - logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配正确.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId())); - passwordRightFlag=true; - customerIdList.add(customerStaffDTO.getCustomerId()); - } + if (StringUtils.isNotBlank(customerStaffDTO.getPassword())) { + havePasswordFlag = true; } + long start2 = System.currentTimeMillis(); + if (PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) { + passwordRightFlag = true; + customerIdList.add(customerStaffDTO.getCustomerId()); + } + logger.info("getMyOrgByAccountService PasswordUtils.matches cost:{}", System.currentTimeMillis() - start2); + //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 if(!havePasswordFlag){ logger.warn(String.format("当前账户(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getUserAccount())); @@ -648,11 +701,27 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol logger.warn(String.format("根据当前账户(%s)密码未找到所属组织,密码错误",formDTO.getUserAccount())); throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); } + logger.info("getMyOrgByAccountService checkpassword cost:{}",System.currentTimeMillis() - start); + start = System.currentTimeMillis(); + String tempKey = RedisKeys.getCustomerStaffTempKey(customerStaffDTO.getUserId()); + List redisTemp = (List)redisUtils.get(tempKey); + if (redisTemp != null){ + logger.info("getMyOrgByAccountService end redis :{}",System.currentTimeMillis()); + return redisTemp; + } + logger.info("getMyOrgByAccountService getCustomerStaffTempKey cost:{}",System.currentTimeMillis()-start); + start = System.currentTimeMillis(); StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO(); staffOrgFormDTO.setCustomerIdList(customerIdList); Result> result = govOrgOpenFeignClient.getStaffOrgList(staffOrgFormDTO); if(result.success()&&null!=result.getData()){ - return result.getData(); + List data = result.getData(); + logger.info("getMyOrgByAccountService getStaffOrgList from db cost:{}",System.currentTimeMillis() -start); + start = System.currentTimeMillis(); + redisUtils.set(tempKey,data); + logger.info("getMyOrgByAccountService getCustomerStaffTempKey set redis cost:{}",System.currentTimeMillis()-start); + logger.info("getMyOrgByAccountService end DB :{}",System.currentTimeMillis()); + return data; } logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参账户%s,密码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER, @@ -669,6 +738,11 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol * @author zxc */ public PaCustomerDTO getCustomerInfo(String appId){ + String redisKey = RedisKeys.getThirdCustomerInfoByAppId(appId); + PaCustomerDTO customer = (PaCustomerDTO) redisUtils.get(redisKey); + if (customer != null && StringUtils.isNotBlank(customer.getId())){ + return customer; + } JSONObject jsonObject = new JSONObject(); String data = HttpClientManager.getInstance().sendPostByJSON(AuthHttpUrlConstant.CUSTOMER_MSG_URL + appId, JSON.toJSONString(jsonObject)).getData(); logger.info("ThirdLoginServiceImpl.getCustomerInfo:httpclient->url:"+AuthHttpUrlConstant.CUSTOMER_MSG_URL+",结果->"+data); @@ -684,8 +758,9 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol Object PublicCustomerResultDTO = mapToResult.getData(); JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString()); Map map = (Map)json.get("customer"); - PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class); + customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class); logger.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->"+customer); + redisUtils.set(redisKey,customer); return customer; } @@ -815,4 +890,297 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol //getResultDataOrThrowsException(result, ServiceConstant.EPMET_MESSAGE_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用Message服务,发送登录事件到MQ失败"); } +// 接入流程:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process +// 1、获取个人用户token:https://open.dingtalk.com/document/isvapp-server/obtain-user-token +// 2、获取用户通讯录个人信息:https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information +// 接口逻辑: +// (1)根据clientId去XXX表找到customerId +// (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId, +// 是否注册居民:register_relation +// (3)没有则生成user、user_Base_info表记录 + /** + * 钉钉应用的登录-居民端 + * + * @param formDTO + * @return + */ + @Override + public ResiDingAppLoginResDTO resiLoginDing(ResiDingAppLoginFormDTO formDTO) { + //获取用户手机号 + log.info("1、钉钉居民端应用登录入参:"+ JSON.toJSONString(formDTO)); + ResiDingAppLoginResDTO resDTO= null; + try { + resDTO = new ResiDingAppLoginResDTO(); + resDTO.setCustomerId(getCurrentCustomerId()); + //1、获取用户手机号 + String miniAppId = formDTO.getMiniAppId(); + DingMiniInfoCache dingMiniInfo = CustomerDingDingRedis.getDingMiniInfo(miniAppId); + DingTalkResult userAccessToken = dingTalkClientToken.getUserAccessToken(formDTO.getAuthCode(), dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret()); + log.info("2、resiLoginDing userAccessToken:{}",JSON.toJSONString(userAccessToken)); + if (!userAccessToken.success() || null == userAccessToken.getData()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "调用微信api异常:" + JSON.toJSONString(userAccessToken), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); + } + DingTalkResult me = dingTalkClientUser.getUserInfo("me", userAccessToken.getData().getAccessToken()); + log.info("3、resiLoginDing me:{}",JSON.toJSONString(me)); + resDTO.setExtInfo(JSON.toJSONString(me.getData())); + if (!me.success() || StringUtils.isBlank(me.getData().getMobile())) { + log.error("resilogin-ding登录接口报错,入参:" + JSON.toJSONString(formDTO) + ";获取手机号为空, userAccessToken.getData().getAccessToken()=" + userAccessToken.getData().getAccessToken()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取手机号为空", "获取手机号为空"); + } + // 2、调用userfeign接口获取userId、注册网格相关信息 todo + DingLoginResiFormDTO dingLoginResiFormDTO=ConvertUtils.sourceToTarget(me.getData(),DingLoginResiFormDTO.class); + dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId()); + Result loginResiResDTOResult = epmetUserOpenFeignClient.dingResiLogin(dingLoginResiFormDTO); + if (!loginResiResDTOResult.success() || null == loginResiResDTOResult.getData()) { + //临时打个日志 + log.error(String.format("resilogin-ding获取epmetUserId异常,入参:%s,user服务返参:%s", JSON.toJSONString(formDTO), JSON.toJSONString(loginResiResDTOResult))); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取epmetUserId异常:" + JSON.toJSONString(loginResiResDTOResult), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); + } + DingLoginResiResDTO resiResDTO=loginResiResDTOResult.getData(); + resDTO.setGridId(resiResDTO.getGridId()); + resDTO.setGridName(resiResDTO.getGridName()); + resDTO.setAgencyId(resiResDTO.getAgencyId()); + resDTO.setEpmetUserId(resiResDTO.getEpmetUserId()); + resDTO.setRegFlag(resiResDTO.getRegFlag()); + + //3.生成token,并且存放Redis + String token=this.saveTokenDtoDing(formDTO.getMiniAppId(),AppClientConstant.APP_RESI,AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), resDTO.getCustomerId()); + resDTO.setAuthorization(token); + + } catch (ApiException e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getErrMsg(), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); + } + return resDTO; + } + + private String saveTokenDtoDing(String miniAppId,String app,String client, String userId,String customerId) { + //生成token串 + Map map = new HashMap<>(); + map.put(AppClientConstant.APP, app); + // map.put(AppClientConstant.CLIENT, client); + // 第三方企业应用传应用的SuiteKey 作为client + map.put(AppClientConstant.CLIENT, client.concat(miniAppId)); + map.put("userId", userId); + String token = jwtTokenUtils.createToken(map); + int expire = jwtTokenProperties.getExpire(); + TokenDto tokenDto = new TokenDto(); + tokenDto.setCustomerId(customerId); + tokenDto.setApp(app); + tokenDto.setClient(client.concat(miniAppId)); + tokenDto.setUserId(userId); + tokenDto.setToken(token); + tokenDto.setUpdateTime(System.currentTimeMillis()); + tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + cpUserDetailRedis.set(tokenDto, expire); + // cpUserDetailRedis.setForDingApp(miniAppId,tokenDto, expire); + logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); + return token; + } + + @Override + public ResiDingAppLoginResDTO resiLoginDingMd(ResiDingAppLoginMdFormDTO formDTO) { + // 获取用户手机号 + log.info("1、钉钉居民端应用登录入参:" + JSON.toJSONString(formDTO)); + ResiDingAppLoginResDTO resDTO = null; + resDTO = new ResiDingAppLoginResDTO(); + resDTO.setCustomerId(getCurrentCustomerId()); + // 1、获取用户手机号 + DingLoginResiFormDTO dingLoginResiFormDTO = getDingLoginResiFormDTOMd(formDTO.getMiniAppId(), formDTO.getAuthCode()); + dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId()); + // 2、调用userfeign接口获取userId、注册网格相关信息 + Result loginResiResDTOResult = epmetUserOpenFeignClient.dingResiLogin(dingLoginResiFormDTO); + if (!loginResiResDTOResult.success() || null == loginResiResDTOResult.getData()) { + // 临时打个日志 + log.error(String.format("resiLoginDingMd获取epmetUserId异常,入参:%s,user服务返参:%s", JSON.toJSONString(formDTO), JSON.toJSONString(loginResiResDTOResult))); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取epmetUserId异常:" + JSON.toJSONString(loginResiResDTOResult), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); + } + DingLoginResiResDTO resiResDTO = loginResiResDTOResult.getData(); + resDTO.setGridId(resiResDTO.getGridId()); + resDTO.setGridName(resiResDTO.getGridName()); + resDTO.setAgencyId(resiResDTO.getAgencyId()); + resDTO.setEpmetUserId(resiResDTO.getEpmetUserId()); + resDTO.setRegFlag(resiResDTO.getRegFlag()); + + // 3.生成token,并且存放Redis + String token = this.saveTokenDtoDing(formDTO.getMiniAppId(), AppClientConstant.APP_RESI, AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), resDTO.getCustomerId()); + resDTO.setAuthorization(token); + + return resDTO; + } + + private DingLoginResiFormDTO getDingLoginResiFormDTOMd(String miniAppId, String authCode) { + DingMiniInfoCache dingMiniInfo = CustomerDingDingRedis.getDingMiniInfo(miniAppId); + + // 1、服务商获取第三方应用授权企业的access_token,文档地址:https://open.dingtalk.com/document/orgapp-server/obtains-the-enterprise-authorized-credential + // 烟台的CorpId: dingaae55cbc47a96845f5bf40eda33b7ba0 + String yantaiCorpId = "dingaae55cbc47a96845f5bf40eda33b7ba0"; + DingTalkResult res = dingTalkClientToken.getThirdAuthCorpAccessToken(dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret(), "abc", yantaiCorpId); + if (!res.success() || StringUtils.isBlank(res.getData())) { + log.error(String.format("企业内部应用免登服务商获取第三方应用授权企业的access_token失败,customKey:%s,customSecret:%s,corpId:%s", dingMiniInfo.getSuiteSecret(), dingMiniInfo.getSuiteSecret(), yantaiCorpId)); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务商获取第三方应用授权企业的access_token", "服务商获取第三方应用授权企业的access_token"); + } + String accessToken = res.getData(); + log.info(String.format("1、服务商获取第三方应用授权企业的access_token返参:%s", accessToken)); + + // 2、通过免登码获取用户信息,文档地址:https://open.dingtalk.com/document/orgapp-server/obtain-the-userid-of-a-user-by-using-the-log-free + DingTalkResult v2UserGetuserinfoRes = dingTalkClientToken.getUserInfo(accessToken, authCode); + if (!v2UserGetuserinfoRes.success() || StringUtils.isBlank(v2UserGetuserinfoRes.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "通过免登码获取用户信息异常", "通过免登码获取用户信息异常"); + } + log.info(String.format("2、通过免登码获取用户信息返参:%s", v2UserGetuserinfoRes.getData())); + V2UserGetuserinfoResDTO v2UserGetuserinfoResDTO = JSON.parseObject(v2UserGetuserinfoRes.getData(), V2UserGetuserinfoResDTO.class); + if (null == v2UserGetuserinfoResDTO || StringUtils.isBlank(v2UserGetuserinfoResDTO.getUserid())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取钉钉用户userid为空", "获取钉钉用户userid为空"); + } + + + // 3、查询用户详情,文档地址:https://open.dingtalk.com/document/isvapp-server/query-user-details + DingTalkResult v2UserGetRes = dingTalkClientToken.getUserDetail(v2UserGetuserinfoResDTO.getUserid(), accessToken); + if (!v2UserGetRes.success() || StringUtils.isBlank(v2UserGetRes.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据userId查询用户详情失败", "根据userId查询用户详情失败"); + } + log.info(String.format("3、查询用户详情:%s", v2UserGetRes.getData())); + DingUserDetailDTO dingUserDetailDTO = JSON.parseObject(v2UserGetRes.getData(), DingUserDetailDTO.class); + if (null == dingUserDetailDTO || StringUtils.isBlank(dingUserDetailDTO.getMobile())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取手机号为空", "获取手机号为空"); + } + + DingLoginResiFormDTO dingLoginResiFormDTO = new DingLoginResiFormDTO(); + dingLoginResiFormDTO.setAvatarUrl(dingUserDetailDTO.getAvatar()); + dingLoginResiFormDTO.setEmail(dingUserDetailDTO.getOrg_email()); + dingLoginResiFormDTO.setMobile(dingUserDetailDTO.getMobile()); + dingLoginResiFormDTO.setNick(dingUserDetailDTO.getName()); + dingLoginResiFormDTO.setOpenId(StrConstant.EPMETY_STR); + dingLoginResiFormDTO.setStateCode(dingUserDetailDTO.getState_code()); + dingLoginResiFormDTO.setUnionId(dingUserDetailDTO.getUnionid()); + return dingLoginResiFormDTO; + } + + + /** + * 企业内部应用开发,不授权了 + * https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free + * 建议用户信息保存在前端缓存中(dd.setStorage)或者cookie中,避免每次进入应用都调用钉钉接口进行免登。 + * + * 获取免登授权码。 + * 小程序免登 + * 微应用免登 + * 获取AccessToken。 + * 调用接口获取access_token,详情请参考获取企业内部应用的access_token。 + * + * 获取userid。 + * 调用接口获取用户的userid,详情请参考通过免登码获取用户信息。 + * + * 获取用户详情。 + * 调用接口获取用户详细信息,详情请参考根据userId获取用户详情。 + * + * @param formDTO + * @return + */ + @Override + public ResiDingAppLoginResDTO resiLoginInternalDing(ResiDingAppLoginMdFormDTO formDTO) { + // 获取用户手机号 + log.info("1、钉钉居民端应用登录入参:" + JSON.toJSONString(formDTO)); + ResiDingAppLoginResDTO resDTO = null; + resDTO = new ResiDingAppLoginResDTO(); + resDTO.setCustomerId(getCurrentCustomerId()); + + // 1、获取用户手机号 + DingLoginResiFormDTO dingLoginResiFormDTO = getDingLoginResiFormDTOInternal(formDTO.getMiniAppId(), formDTO.getAuthCode()); + dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId()); + + // 2、调用userfeign接口获取userId、注册网格相关信息 + Result loginResiResDTOResult = epmetUserOpenFeignClient.dingResiLogin(dingLoginResiFormDTO); + if (!loginResiResDTOResult.success() || null == loginResiResDTOResult.getData()) { + // 临时打个日志 + log.error(String.format("resiLoginInternalDing获取epmetUserId异常,入参:%s", JSON.toJSONString(dingLoginResiFormDTO))); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取epmetUserId异常:"+ JSON.toJSONString(loginResiResDTOResult), "获取epmetUserId异常"); + } + DingLoginResiResDTO resiResDTO = loginResiResDTOResult.getData(); + resDTO.setGridId(resiResDTO.getGridId()); + resDTO.setGridName(resiResDTO.getGridName()); + resDTO.setAgencyId(resiResDTO.getAgencyId()); + resDTO.setEpmetUserId(resiResDTO.getEpmetUserId()); + resDTO.setRegFlag(resiResDTO.getRegFlag()); + + // 3.生成token,并且存放Redis + String token = this.saveTokenDtoDing(formDTO.getMiniAppId(), AppClientConstant.APP_RESI, AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), resDTO.getCustomerId()); + resDTO.setAuthorization(token); + + return resDTO; + } + + /** + * 最原始的企业内部应用开发,不授权给产品服务商 + * @param miniAppId + * @param authCode + * @return + */ + private DingLoginResiFormDTO getDingLoginResiFormDTOInternal(String miniAppId, String authCode) { + DingMiniInfoCache dingMiniInfo = CustomerDingDingRedis.getDingMiniInfo(miniAppId); + + // 1、获取企业内部应用的accessToken文档地址:https://open.dingtalk.com/document/orgapp-server/obtain-the-access_token-of-an-internal-app + String accessToken = ""; + DingTalkResult dingTalkResult = dingTalkClientToken.getAppAccessTokenToken(dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret()); + if (!dingTalkResult.success() || StringUtils.isBlank(dingTalkResult.getData())) { + log.error(String.format("获取企业内部应用的accessToken失败,customKey:%s,customSecret:%s", dingMiniInfo.getSuiteSecret(), dingMiniInfo.getSuiteSecret())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取企业内部应用的accessToken异常", "获取企业内部应用的accessToken"); + } + accessToken = dingTalkResult.getData(); + log.info(String.format("1、获取企业内部应用的accessToken返参:%s", accessToken)); + + + // 2、通过免登码获取用户信息,文档地址:https://open.dingtalk.com/document/orgapp-server/obtain-the-userid-of-a-user-by-using-the-log-free + DingTalkResult v2UserGetuserinfoRes = dingTalkClientToken.getUserInfo(accessToken, authCode); + if (!v2UserGetuserinfoRes.success() || StringUtils.isBlank(v2UserGetuserinfoRes.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "通过免登码获取用户信息异常", "通过免登码获取用户信息异常"); + } + log.info(String.format("2、通过免登码获取用户信息返参:%s", v2UserGetuserinfoRes.getData())); + V2UserGetuserinfoResDTO v2UserGetuserinfoResDTO = JSON.parseObject(v2UserGetuserinfoRes.getData(), V2UserGetuserinfoResDTO.class); + if (null == v2UserGetuserinfoResDTO || StringUtils.isBlank(v2UserGetuserinfoResDTO.getUserid())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取钉钉用户userid为空", "获取钉钉用户userid为空"); + } + + + // 3、查询用户详情,文档地址:https://open.dingtalk.com/document/isvapp-server/query-user-details + DingTalkResult v2UserGetRes = dingTalkClientToken.getUserDetail(v2UserGetuserinfoResDTO.getUserid(), accessToken); + if (!v2UserGetRes.success() || StringUtils.isBlank(v2UserGetRes.getData())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据userId查询用户详情失败", "根据userId查询用户详情失败"); + } + log.info(String.format("3、查询用户详情:%s", v2UserGetRes.getData())); + DingUserDetailDTO dingUserDetailDTO = JSON.parseObject(v2UserGetRes.getData(), DingUserDetailDTO.class); + if (null == dingUserDetailDTO || StringUtils.isBlank(dingUserDetailDTO.getMobile())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取手机号为空", "获取手机号为空"); + } + + DingLoginResiFormDTO dingLoginResiFormDTO = new DingLoginResiFormDTO(); + dingLoginResiFormDTO.setAvatarUrl(dingUserDetailDTO.getAvatar()); + dingLoginResiFormDTO.setEmail(dingUserDetailDTO.getOrg_email()); + dingLoginResiFormDTO.setMobile(dingUserDetailDTO.getMobile()); + dingLoginResiFormDTO.setNick(dingUserDetailDTO.getName()); + dingLoginResiFormDTO.setOpenId(StrConstant.EPMETY_STR); + dingLoginResiFormDTO.setStateCode(dingUserDetailDTO.getState_code()); + dingLoginResiFormDTO.setUnionId(dingUserDetailDTO.getUnionid()); + return dingLoginResiFormDTO; + } + + /** + * 客户写死吧 + * @return + */ + private String getCurrentCustomerId() { + String customerId=""; + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + if (EnvEnum.PROD.getCode().equals(currentEnv.getCode())) { + // 烟台的客户id + customerId="1535072605621841922"; + } else if (EnvEnum.TEST.getCode().equals(currentEnv.getCode())) { + // 最美琴岛 + customerId="0c41b272ee9ee95ac6f184ad548a30eb"; + } else { + // 其余统一走开发环境 + customerId="45687aa479955f9d06204d415238f7cc"; + } + return customerId; + } } diff --git a/epmet-auth/src/main/resources/bootstrap.yml b/epmet-auth/src/main/resources/bootstrap.yml index 3f338f611c..cb7141206f 100644 --- a/epmet-auth/src/main/resources/bootstrap.yml +++ b/epmet-auth/src/main/resources/bootstrap.yml @@ -91,6 +91,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -178,4 +184,4 @@ thread: queueCapacity: @thread.threadPool.queue-capacity@ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ - rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ \ No newline at end of file + rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ diff --git a/epmet-cloud-generator/src/main/resources/template/index.vue.vm b/epmet-cloud-generator/src/main/resources/template/index.vue.vm index aa5bcb3494..9b3ba8bee8 100644 --- a/epmet-cloud-generator/src/main/resources/template/index.vue.vm +++ b/epmet-cloud-generator/src/main/resources/template/index.vue.vm @@ -1,52 +1,52 @@ + diff --git a/epmet-commons/epmet-commons-feignclient/pom.xml b/epmet-commons/epmet-commons-feignclient/pom.xml new file mode 100644 index 0000000000..4cf486cefb --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/pom.xml @@ -0,0 +1,24 @@ + + + + epmet-commons + com.epmet + 2.0.0 + + + 4.0.0 + jar + + epmet-commons-feignclient + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + + \ No newline at end of file diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/.gitkeep b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/.gitkeep b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuPage.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuPage.java new file mode 100644 index 0000000000..1c92f30d11 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuPage.java @@ -0,0 +1,22 @@ +package com.epmet.commons.feignclient.dtos; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 积木报表的返回值Page对象 + * @param + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class JiMuPage { + private int pageNo; + private int pageSize; + private int total; + private int pages; + private List records; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java new file mode 100644 index 0000000000..5aa42d273a --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/JiMuResult.java @@ -0,0 +1,20 @@ +package com.epmet.commons.feignclient.dtos; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 积木报表的返回值Result对象 + * @param + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class JiMuResult { + private boolean success = true; + private String message = ""; + private Integer code = 0; + private T result; + private T data; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JiMuReportFormDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JiMuReportFormDTO.java new file mode 100644 index 0000000000..caf58ec9a9 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JiMuReportFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.commons.feignclient.dtos.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/8 15:08 + * @DESC + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class JiMuReportFormDTO implements Serializable { + + private static final long serialVersionUID = 3590609549416867701L; + + /** + * 报表IDs + */ + private List reportIds; + + /** + * 类别 + */ + private List categoryKeys; + + private String id; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JimuReportExportRequestDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JimuReportExportRequestDTO.java new file mode 100644 index 0000000000..7e66c588e9 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/form/JimuReportExportRequestDTO.java @@ -0,0 +1,27 @@ +package com.epmet.commons.feignclient.dtos.form; + +import lombok.Data; + +/** + * 批量导出用的requst dto + */ +@Data +public class JimuReportExportRequestDTO { + private String excelConfigId; + private ExportRequestQueryParam queryParam = new ExportRequestQueryParam(); + + /** + * 批量导出用的请求参数 + */ + @Data + public static class ExportRequestQueryParam { + private String id; + private String token; + private String paramKey; + private String pageNo; + private Integer pageSize; + private String currentPageNo; + private Integer currentPageSize; + } + +} \ No newline at end of file diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportBriefResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportBriefResultDTO.java new file mode 100644 index 0000000000..be5f3df667 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportBriefResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 报表简要信息result dto + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class JiMuReportBriefResultDTO { + private String id; + private String code; + private String name; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportDetailResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportDetailResultDTO.java new file mode 100644 index 0000000000..9e27d5ab5b --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportDetailResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.Map; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class JiMuReportDetailResultDTO { + private String id; + private String code; + private String name; + private String note; + private String status; + private String type; + private String jsonStr; + private String apiUrl; + private String apiMethod; + private String apiCode; + private String thumb; + private Integer template; + private String createBy; + private Date createTime; + private String updateBy; + private Date updateTime; + private Map dataList; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java new file mode 100644 index 0000000000..6ef587b6d5 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JiMuReportResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/8/8 15:10 + * @DESC + */ +@Data +public class JiMuReportResultDTO implements Serializable { + + private static final long serialVersionUID = -4048477731892329569L; + + private String code; + + private String name; + + private String id; + private String reportId; + private String reportName; + + private Boolean isList = false; +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java new file mode 100644 index 0000000000..8eb58e8b74 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportDbDataResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.Data; + +@Data +public class JimuReportDbDataResultDTO { + + private ReportDB reportDb; + + @Data + public static class ReportDB { + private String apiUrl; + private String apiMethod; + private String isList; + private String dbChName; + } + +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportFieldTreeResultDTO.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportFieldTreeResultDTO.java new file mode 100644 index 0000000000..ef4037afe8 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/dtos/result/JimuReportFieldTreeResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.commons.feignclient.dtos.result; + +import lombok.Data; + +import java.util.List; + +/** + * 积木报表,报表字段列表 + */ +@Data +public class JimuReportFieldTreeResultDTO { + + private Boolean expand; + private String code; + private List children; + private String dbId; + private String type; + private String isList; + + @Data + public static class Child { + private Boolean expand; + private String title; + private String fieldText; + } +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/.gitkeep b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java new file mode 100644 index 0000000000..009c68c2c8 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -0,0 +1,55 @@ +package com.epmet.commons.feignclient.feigns; + +import com.epmet.commons.feignclient.dtos.JiMuPage; +import com.epmet.commons.feignclient.dtos.JiMuResult; +import com.epmet.commons.feignclient.dtos.form.JimuReportExportRequestDTO; +import com.epmet.commons.feignclient.dtos.result.JiMuReportBriefResultDTO; +import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportDbDataResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportFieldTreeResultDTO; +import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallbackFactory; +import com.epmet.commons.tools.constant.ServiceConstant; +import feign.Response; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2022/8/8 13:52 + * @DESC + */ +@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class) +//@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallbackFactory.class, url = "localhost:8118") +public interface JiMuReportOpenFeignClient { + + @GetMapping(value = "jmreport/excelQuery") + JiMuResult> getList(@RequestParam("pageNo") Integer pageNo, + @RequestParam("pageSize") Integer pageSize, + @RequestParam("name") String name, + @RequestParam("reportType") String reportType, + @RequestParam("token") String token, + @RequestHeader MultiValueMap headers); + + @GetMapping("jmreport/show") + JiMuResult> getReport(@RequestParam("id") String id,@RequestParam("apiUrl") String apiUrl,@RequestParam("params") String params,@RequestHeader MultiValueMap headers); + + @GetMapping("/jmreport/field/tree/{report-id}") + JiMuResult>> fieldTree(@PathVariable("report-id") String reportId); + + @GetMapping("jmreport/loadDbData/{report-id}") + JiMuResult loadDbData(@PathVariable("report-id") String reportId); + + @PostMapping("jmreport/exportAllExcelStream") + Response exportAllExcelStream(JimuReportExportRequestDTO param); + + /** + * 报表简要信息 + * @return + */ + @GetMapping("jmreport/get/{report-id}") + JiMuResult getReportBrief(@PathVariable("report-id") String reportId); +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java new file mode 100644 index 0000000000..9158a6858c --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java @@ -0,0 +1,58 @@ +package com.epmet.commons.feignclient.feigns.fallback; + +import com.epmet.commons.feignclient.dtos.JiMuPage; +import com.epmet.commons.feignclient.dtos.JiMuResult; +import com.epmet.commons.feignclient.dtos.form.JimuReportExportRequestDTO; +import com.epmet.commons.feignclient.dtos.result.JiMuReportBriefResultDTO; +import com.epmet.commons.feignclient.dtos.result.JiMuReportDetailResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportDbDataResultDTO; +import com.epmet.commons.feignclient.dtos.result.JimuReportFieldTreeResultDTO; +import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; +import feign.Response; +import org.springframework.util.MultiValueMap; + +import java.util.List; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2022/8/8 13:53 + * @DESC + */ +public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignClient { + + @Override + public JiMuResult> getList(Integer pageNo, Integer pageSize, String name, String reportType, String token, MultiValueMap headers) { + JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; + } + + @Override + public JiMuResult> getReport(String id,String apiUrl,String params,MultiValueMap headers) { + JiMuResult> rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; + } + + @Override + public JiMuResult loadDbData(String reportId) { + JiMuResult rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; + } + + @Override + public Response exportAllExcelStream(JimuReportExportRequestDTO param) { + return null; + } + + @Override + public JiMuResult>> fieldTree(String reportId) { + JiMuResult rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; + } + + @Override + public JiMuResult getReportBrief(String reportID) { + JiMuResult rst = new JiMuResult<>(false, "请求失败", 200, null,null); + return rst; + } +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallbackFactory.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallbackFactory.java new file mode 100644 index 0000000000..e0274436c2 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallbackFactory.java @@ -0,0 +1,24 @@ +package com.epmet.commons.feignclient.feigns.fallback; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @Author zxc + * @DateTime 2022/8/9 13:27 + * @DESC + */ +@Slf4j +@Component +public class JiMuReportOpenFeignClientFallbackFactory implements FallbackFactory { + + private JiMuReportOpenFeignClientFallback fallback = new JiMuReportOpenFeignClientFallback(); + + @Override + public JiMuReportOpenFeignClientFallback create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-commons/epmet-commons-mybatis/pom.xml b/epmet-commons/epmet-commons-mybatis/pom.xml index db396c4042..df0ecffb56 100644 --- a/epmet-commons/epmet-commons-mybatis/pom.xml +++ b/epmet-commons/epmet-commons-mybatis/pom.xml @@ -70,6 +70,12 @@ pagehelper-spring-boot-starter 1.2.12 + + + org.apache.shardingsphere + sharding-jdbc-spring-boot-starter + 4.0.0-RC1 + diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index 2aadd34cb4..6bc618a01b 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -98,4 +98,14 @@ public interface ConsomerGroupConstants { * 创建党员居民信息消费者组,将user库的党员信息同步到partymember库的党员表。 */ String CREATE_RESI_PARTYMEMBER_SYNC_GROUP = "create_resi_sync_group"; + + /** + * 党建小助手监听器分组 + */ + String PARTY_MEETING_MESSAGE = "party_meeting_message"; + + /** + * 党建积分操作消费组 + */ + String PARTY_BUILDING_GROUP = "party_building_group"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java index cea27769bc..23bfd628a4 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java @@ -84,4 +84,11 @@ public interface TopicConstants { * 居民的党员信息 */ String PARTYMEMBER_RESI = "partymember_resi"; + + /** + * 消息-党建小助手 + */ + String IC_MESSAGE = "ic_message"; + + String PARTY_BUILDING = "party_building"; } diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PartyMeetingMessageMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PartyMeetingMessageMQMsg.java new file mode 100644 index 0000000000..af8792ea1c --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/PartyMeetingMessageMQMsg.java @@ -0,0 +1,23 @@ +package com.epmet.commons.rocketmq.messages; + +import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 党建小助手发布活动、活动到期提醒、活动发布提醒推送MQ + * @author sun + */ +@Data +public class PartyMeetingMessageMQMsg extends MqBaseFormDTO implements Serializable { + + //客户Id + private String customerId; + //活动/日程Id + private String icPartyActId; + //动作类型 发布活动:publish 提前提醒:remind 日程通知:notify + private String type; + +} diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index b0f7737940..3f75302370 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -75,6 +75,12 @@ commons-fileupload commons-fileupload ${commons.fileupload.version} + + + commons-io + commons-io + + commons-io diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java index bb889a5913..26a0e2d01a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java @@ -15,6 +15,7 @@ public @interface MaskResponse { */ String MASK_TYPE_ID_CARD = "ID_CARD"; String MASK_TYPE_MOBILE = "MOBILE"; + String MASK_TYPE_CHINESE_NAME = "CHINESE_NAME"; ///** // * 默认的一些字段,如果没有手动指定,就会使用默认的。如果手动指定了,就不再使用默认的 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ReportRequest.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ReportRequest.java new file mode 100644 index 0000000000..41a9379fe0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/ReportRequest.java @@ -0,0 +1,13 @@ +package com.epmet.commons.tools.annotation; + +import java.lang.annotation.*; + +/** + * 标记一个接口,它会被报表服务所调用 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ReportRequest { + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java new file mode 100644 index 0000000000..c355a39df1 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ReportRequestAspect.java @@ -0,0 +1,86 @@ +package com.epmet.commons.tools.aspect; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.redis.RedisUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import java.lang.reflect.Parameter; +import java.util.Map; + +/** + * 需要被报表服务请求的api,需要加上这个注解 + * 1.该注解会取url中固定的key,去redis获取参数,给入参dto复制 + */ +@Aspect +@Component +@Order(20) +@Slf4j +public class ReportRequestAspect { + + /** + * 从redis中取参数用 + */ + public static final String REPORT_REDIS_KEY = "paramKey"; + + @Autowired + private RedisUtils redisUtils; + + @Before("@annotation(com.epmet.commons.tools.annotation.ReportRequest)") + public void before(JoinPoint point) { + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + String paramKey = sra.getRequest().getParameter(REPORT_REDIS_KEY); + if (StringUtils.isBlank(paramKey)) { + // 没有携带key参数,直接跳过 + return; + } + + Map cachedParams = redisUtils.hGetAll(paramKey); + if (cachedParams == null || cachedParams.size() == 0) { + log.warn("【报表服务】根据paramKey:{}未获取到有效的参数缓存。", paramKey); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "参数失效", "参数失效"); + // redis中没有此参数 + } + + // 使用方法签名获取出参数class列表 + Object[] args = point.getArgs(); + MethodSignature signature = (MethodSignature) point.getSignature(); + Parameter[] parameters = signature.getMethod().getParameters(); + fillArgsToRequestBody(args, cachedParams, parameters); + } + + /** + * 将redis中取出的参数,赋值到指定的入参dto上 + * @param args + * @param storedParams + */ + private void fillArgsToRequestBody(Object[] args, Map storedParams, Parameter[] parameters) { + for (int i = 0; i < args.length; i++) { + Object arg = args[i]; + RequestBody requestBodyAnno = parameters[i].getAnnotation(RequestBody.class); + if (arg != null && requestBodyAnno != null) { + Object argBean = BeanUtil.mapToBean(storedParams, arg.getClass(), true); + + // "pageSize", "pageNo", "isPage"三个属性不从redis拷贝,而是取传递雇来的 + // redis里面的字段如果是null,则不会赋值给arg + BeanUtil.copyProperties(argBean, arg, new CopyOptions(null, true, "pageSize", "pageNo", "isPage")); + return; + } + } + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java index 0b42461f6e..049f335aa4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java @@ -32,6 +32,11 @@ public interface AppClientConstant { */ String CLIENT_WXMP = "wxmp"; + /** + * 钉钉小程序 + */ + String MINI_DING = "mini_ding"; + /** * 客户来源App * */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 1f0d76e14f..d3e34b119d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -85,6 +85,7 @@ public interface NumConstant { String POSITIVE_EIGHT_STR = "+8"; String EMPTY_STR = ""; String ONE_NEG_STR = "-1"; + String ONE_HUNDRED_STR = "100"; String FIFTY_STR="50"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index 8b819bcfb8..7d4eafae90 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -148,4 +148,9 @@ public interface ServiceConstant { * 插件pli-power服务 */ String PLI_POWER_SERVER = "pli-power-base-server"; + + /** + * + */ + String EPMET_JM_REPORT = "epmet-jmreport-server"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java index 1880debe42..88adefbd17 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java @@ -1,6 +1,8 @@ package com.epmet.commons.tools.dto.form; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; @@ -9,6 +11,8 @@ import javax.validation.constraints.NotBlank; * @Author sun */ @Data +@AllArgsConstructor +@NoArgsConstructor public class DictListFormDTO { /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingMiniInfoFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingMiniInfoFormDTO.java new file mode 100644 index 0000000000..bd36526985 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingMiniInfoFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.commons.tools.dto.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/15 10:25 + * @DESC + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DingMiniInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 2661531490851265637L; + + public interface DingMiniInfoForm{} + + @NotBlank(message = "miniAppId不能为空",groups = DingMiniInfoForm.class) + private String miniAppId; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasOperPermissionFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasOperPermissionFormDTO.java new file mode 100644 index 0000000000..62faa45150 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasOperPermissionFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.commons.tools.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class HasOperPermissionFormDTO { + + /** + * uri + */ + @NotBlank(message = "uri不能为空") + private String uri; + + /** + * http方法 + */ + @NotBlank(message = "请求http方法不能为空") + private String method; + + @NotBlank(message = "操作者ID不能为空") + private String operId; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OperResouce.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OperResouce.java new file mode 100644 index 0000000000..632f013746 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OperResouce.java @@ -0,0 +1,13 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; + +@Data +public class OperResouce { + + private String userId; + private String resourceUrl; + private String ResourceMethod; + + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java new file mode 100644 index 0000000000..4dcf8869a1 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java @@ -0,0 +1,22 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; + +import java.util.List; + + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 17:04 + */ +@Data +public class YtHsjcResDTO { + private int code = 200; + private String msg = "请求成功"; + /** + * 响应数据 + */ + private List data; + private int total; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDetailDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDetailDTO.java new file mode 100644 index 0000000000..4a958a3cf7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDetailDTO.java @@ -0,0 +1,48 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 17:10 + */ +@Data +public class YtHsjcResDetailDTO { + private String id; + private String name; + private String card_no; + private String telephone; + private String address; + private String test_time; + private String depart_name; + private String county; + private String upload_time; + private String sample_result_pcr; + private String sample_time; + private String sampling_org_pcr; + + /* { + "code":"200", + "msg":"请求成功", + "data":[ + { + "id":"6a31eb2d38c011eda054fa163ebc7ff4", + "name":"杨冠中",// 姓名 + "card_no":"372527198404130813",// 证件号码 + "telephone":"13697890860",// 电话 + "address":"保利香榭里公馆18-1-302",// 联系地址 + "test_time":"2022-09-20 12:52:28",// 检测时间 + "depart_name":"天仁医学检验实验室有限公司",// varchar + "county":"莱山区",// 所属区县 + "upload_time":"2022-09-20 21:23:10",// 时间戳 + "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性 + "sample_time":"2022-09-20 06:48:28",// 采样时间 + "sampling_org_pcr":"采样点327"// 核酸采样机构 + }, + ] + "total":1 + } +*/ +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoveragePlaceTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoveragePlaceTypeEnum.java index 6f71e122b0..d15036075b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoveragePlaceTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoveragePlaceTypeEnum.java @@ -18,7 +18,9 @@ public enum CoveragePlaceTypeEnum { VOLUNTEER("volunteer", "志愿者"), GROUP_RENT("group_rent", "群租房"), EVENT("event", "城市管理事件"), - ZHZL_RQ("zhzl_rq", "综合治理人群"); + ZHZL_RQ("zhzl_rq", "综合治理人群"), + NUCLEIC_POINT("nucleic_point", "核酸检测点"), + VACCINE_POINT("vaccine_point", "疫苗接种点"); private final String code; private final String name; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DingMiniAppEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DingMiniAppEnum.java new file mode 100644 index 0000000000..b0c0054ebb --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DingMiniAppEnum.java @@ -0,0 +1,79 @@ +package com.epmet.commons.tools.enums; + +/** + * @Description + * @Author yzm + * @Date 2022/9/14 19:11 + */ +public enum DingMiniAppEnum { + // 亿联云盘CorpId:dingd1e19e397c754c7735c2f4657eb6378f + // + // //各应用秘钥 + // 随手拍 + // SuiteId:27501006 + // AppId:119450 + // MiniAppId:5000000002934668 + // SuiteKey:suitew6ccvkquinmrghqy + // SuiteSecret:TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB + // + // 随时讲 + // SuiteId:27564007 + // AppId:119451 + // MiniAppId:5000000002934374 + // SuiteKey:suitezhyj12glsrp8em0f + // SuiteSecret:-z5Q_lvMP6l7fTzlArEzUT8D_-5pvqBQaJMuTGHoXnz0nuiqGQMZ8aeya_cxTsN- + // + // 我的报事 + // SuiteId:27569006 + // AppId:119452 + // MiniAppId:5000000002934456 + // SuiteKey:suite5yxliro6wawv514w + // SuiteSecret:aQxiPi7DwJSUa9HlbUU_L7Q4wGCLEDmgf__Ffx75cTn3jZwuHy9vdl-9Iv5FeyJU + // + // 实时动态 + // SuiteId:27458011 + // AppId:119453 + // MiniAppId:5000000002934488 + // SuiteKey:suitemcestnonr6y0xigc + // SuiteSecret:kKCNCkfDhmLoVnl_wuAiScyDG4776mkTevuSBuiYhHg-Bvz1-vhb_4IA-Km7nK2I + SSP("suitew6ccvkquinmrghqy", "随手拍", "TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB"), + SSJ("suitezhyj12glsrp8em0f", "随时讲", "-z5Q_lvMP6l7fTzlArEzUT8D_-5pvqBQaJMuTGHoXnz0nuiqGQMZ8aeya_cxTsN-"), + MY_REPORT_EVENT("suite5yxliro6wawv514w", "我的报事", "aQxiPi7DwJSUa9HlbUU_L7Q4wGCLEDmgf__Ffx75cTn3jZwuHy9vdl-9Iv5FeyJU"), + SSDT("suitemcestnonr6y0xigc", "实时动态", "kKCNCkfDhmLoVnl_wuAiScyDG4776mkTevuSBuiYhHg-Bvz1-vhb_4IA-Km7nK2I"); + + private String suiteKey; + private String name; + private String suiteSecret; + + + DingMiniAppEnum(String suiteKey, String name, String suiteSecret) { + this.suiteKey = suiteKey; + this.name = name; + this.suiteSecret = suiteSecret; + } + + public static DingMiniAppEnum getEnum(String suiteKey) { + DingMiniAppEnum[] values = DingMiniAppEnum.values(); + for (DingMiniAppEnum value : values) { + if (value.getSuiteKey().equals(suiteKey)) { + return value; + } + } + return null; + } + + + public String getSuiteKey() { + return suiteKey; + } + + public String getName() { + return name; + } + + public String getSuiteSecret() { + return suiteSecret; + } + +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java index 3cccd74d7a..09e5b55db8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -19,6 +19,12 @@ public enum EventEnum { TOPIC_SHIFTED_TO_PROJECT("topic_to_project","resi_group","话题被转为项目"), LEADER_RESOLVE_TOPIC("leader_resolve_topic","resi_group","组长解决组内话题"), FINISH_USER_DEMAND("finish_user_demand","community_service","服务完成"), + ZBWYH("参加支部委员会","part_member", "支部委员会活动签到"), + ZBDYDH("参加支部党员大会","part_member", "支部党员大会活动签到"), + DXZH("参加党小组会","part_member", "党小组会活动签到"), + DANGKE ("参加党课","part_member", "党课活动签到"), + ZTDR("参加主题党日","part_member", "主题党日活动签到"), + WMFWHD("参加为民服务活动","part_member", "为民服务活动活动签到"), ; private String eventClass; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java new file mode 100644 index 0000000000..7ca7f04641 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/IdCardTypeEnum.java @@ -0,0 +1,27 @@ +package com.epmet.commons.tools.enums; + +/** + * 唯一整件类型 + */ +public enum IdCardTypeEnum { + + OTHERS("0", "其他"), + SFZH("1", "身份证号"), + PASSPORT("2", "护照"); + + private String type; + private String name; + + IdCardTypeEnum(String type, String name) { + this.type = type; + this.name = name; + } + + public String getType() { + return type; + } + + public String getName() { + return name; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 7344cbf38d..64688c8990 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -86,6 +86,7 @@ public enum EpmetErrorCode { BUILDING_NAME_EXITED(8215,"楼栋名称已存在"), DOOR_NAME_EXITED(8216,"门牌号已存在"), NEIGHBOOR_NAME_EXITED(8217,"小区名称已存在"), + BUILDING_NAME_EXITED_IN_GRID(8218,"小区下该楼栋已存在于其他网格"), REQUIRE_PERMISSION(8301, "您没有足够的操作权限"), THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonOperAccessOpenFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonOperAccessOpenFeignClient.java new file mode 100644 index 0000000000..15f76dcb62 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonOperAccessOpenFeignClient.java @@ -0,0 +1,46 @@ +package com.epmet.commons.tools.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; +import com.epmet.commons.tools.dto.result.OperResouce; +import com.epmet.commons.tools.feign.fallback.CommonOperAccessOpenFeignClientFallbackFactory; +import com.epmet.commons.tools.utils.Result; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * @Description 运营端权限模块 + * @Author yinzuomei + * @Date 2020/5/21 15:17 本服务对外开放的API,其他服务通过引用此client调用该服务 + */ +@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class) +//@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class, url = "http://localhost:8093") +public interface CommonOperAccessOpenFeignClient { + /** + * @param + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 清空运营人员权限信息、菜单信息 + * @Date 2020/5/21 17:08 + **/ + @GetMapping("/oper/access/menu/clearoperuseraccess") + Result clearOperUserAccess(); + + /** + * 是否有该接口的权限 + * @return + */ + @PostMapping("/oper/access/menu/hasPermission") + Result hasOperPermission(@RequestBody HasOperPermissionFormDTO form); + + /** + * 需要验证的菜单资源 + * @return + */ + @PostMapping("/oper/access/menu/getExamineResourceUrls") + Result> getExamineResourceUrls(); +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonThirdFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonThirdFeignClient.java new file mode 100644 index 0000000000..6bc986aca0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonThirdFeignClient.java @@ -0,0 +1,24 @@ +package com.epmet.commons.tools.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO; +import com.epmet.commons.tools.feign.fallback.CommonThirdFeignClientFallBackFactory; +import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache; +import com.epmet.commons.tools.utils.Result; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + + +/** + * @Description + * @Author zxc + */ +@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallbackFactory = CommonThirdFeignClientFallBackFactory.class) +// @FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallbackFactory = CommonAggFeignClientFallBackFactory.class,url = "localhost:8110") +public interface CommonThirdFeignClient { + + @PostMapping("/third/dingTalk/getDingMiniInfo") + Result getDingMiniInfo(@RequestBody DingMiniInfoFormDTO formDTO); + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java index f7eb3a778d..746de189e9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java @@ -25,8 +25,6 @@ public class EpmetBaseRequestInterceptor implements RequestInterceptor { // Map requestHeaders = getHeadersFromRequest(); - log.debug("EpmetBaseRequestInterceptor#apply#inheritableAdditionalHeaders:" + requestHeaders); - if (requestHeaders != null && requestHeaders.size() > 0) { for (Map.Entry kv : requestHeaders.entrySet()) { template.header(kv.getKey(), kv.getValue()); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallback.java new file mode 100644 index 0000000000..ba047f1ada --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallback.java @@ -0,0 +1,35 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; +import com.epmet.commons.tools.dto.result.OperResouce; +import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; + +import java.util.List; + +/** + * @Description 运营端权限模块 + * @Author yinzuomei + * @Date 2020/5/21 15:47 + */ +//@Component +public class CommonOperAccessOpenFeignClientFallback implements CommonOperAccessOpenFeignClient { + @Override + public Result clearOperUserAccess() { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "clearOperUserAccess"); + + } + + @Override + public Result hasOperPermission(HasOperPermissionFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "hasOperPermission"); + } + + @Override + public Result> getExamineResourceUrls() { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "getExamineResourceUrls"); + } +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallbackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallbackFactory.java new file mode 100644 index 0000000000..d62f24900c --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallbackFactory.java @@ -0,0 +1,19 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class CommonOperAccessOpenFeignClientFallbackFactory implements FallbackFactory { + private CommonOperAccessOpenFeignClientFallback fallback = new CommonOperAccessOpenFeignClientFallback(); + + @Override + public CommonOperAccessOpenFeignClient create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallBackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallBackFactory.java new file mode 100644 index 0000000000..4a43935086 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallBackFactory.java @@ -0,0 +1,20 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.CommonThirdFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class CommonThirdFeignClientFallBackFactory implements FallbackFactory { + + private CommonThirdFeignClientFallback fallback = new CommonThirdFeignClientFallback(); + + @Override + public CommonThirdFeignClient create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallback.java new file mode 100644 index 0000000000..47e278f846 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallback.java @@ -0,0 +1,24 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO; +import com.epmet.commons.tools.feign.CommonThirdFeignClient; +import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import org.springframework.stereotype.Component; + +/** + * + * @Author zxc + * @Description + * @Date + **/ +@Component +public class CommonThirdFeignClientFallback implements CommonThirdFeignClient { + + @Override + public Result getDingMiniInfo(DingMiniInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getDingMiniInfo", formDTO); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java index 55a331c4e2..1e9271dc2a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/page/PageData.java @@ -29,6 +29,7 @@ public class PageData implements Serializable { private List list; + private int pages; /** * 分页 * @param list 列表数据 @@ -38,4 +39,10 @@ public class PageData implements Serializable { this.list = list; this.total = (int)total; } + + public PageData(List list, long total,int pageSize) { + this.list = list; + this.total = (int)total; + this.pages = (int) Math.ceil((double)total / pageSize); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java index 1ce0a85c54..a3169a2ec6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java @@ -2,8 +2,10 @@ package com.epmet.commons.tools.processor; import cn.hutool.core.util.StrUtil; import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.enums.IdCardTypeEnum; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -13,6 +15,7 @@ import java.lang.reflect.Field; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.regex.Pattern; /** * desc:脱敏处理器 @@ -130,27 +133,67 @@ public class MaskProcessor { return maskIdCard(originString); } else if (MaskResponse.MASK_TYPE_MOBILE.equals(maskType)) { return maskMobile(originString); + } else if (MaskResponse.MASK_TYPE_CHINESE_NAME.equals(maskType)) { + return maskChineseName(originString); } else { return originString; } } /** + * 对中文人名进行打码 + * @param originString + * @return + */ + private String maskChineseName(String originString) { + if (StringUtils.isBlank(originString)) { + // 空串,或者只有一个字的,不打码,直接返回 + return originString; + } + + int length = originString.length(); + // 2个字以上的,首位字母明文,中间* + // 中文不能用\\w,要用[\u4e00-\u9fa5] + if (length == 2) { + return originString.replaceAll("^([\\u4e00-\\u9fa5]).*$", "$1*"); + } else { + String maskStr = StrUtil.repeat("*", length - 2); + return originString.replaceAll("^([\\u4e00-\\u9fa5]).*([\\u4e00-\\u9fa5])$", "$1" + maskStr + "$2"); + } + } + + /** + * 唯一整件号打码,可能是身份证号或者是护照号 * 将明文字符串打码变为掩码。保留前6,后面打码 * @param originString * @return */ private String maskIdCard(String originString) { - int clearTextLength = 12; - // 仅将6位之后的全都打码 - int length = originString.length(); - if (length <= clearTextLength) { + + IdCardRegexUtils regexUtil = IdCardRegexUtils.parse(originString); + if (regexUtil == null) { + // 不匹配任何类型,不码 return originString; } - String maskStr = StrUtil.repeatByLength("*", length - clearTextLength); + if (regexUtil.getTypeEnum() == IdCardTypeEnum.SFZH) { + // 身份证号 + // 仅将6位之后的全都打码 + int maskedTextLength = 12; + int length = originString.length(); + String maskStr = StrUtil.repeatByLength("*", length - maskedTextLength); + return originString.replaceAll("^(\\d{10})\\d+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); + } else if (regexUtil.getTypeEnum() == IdCardTypeEnum.PASSPORT) { + // 护照,前两位,后两位为明文,其他* + int clearLength = 4; + int maskedLength = 0; + if ((maskedLength = originString.length() - clearLength) > 0) { + String maskStr = StrUtil.repeatByLength("*", maskedLength); + return originString.replaceAll("^([a-zA-Z0-9]{2})[a-zA-Z0-9]+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); + } + } - return originString.replaceAll("^(\\d{10})\\d+([a-zA-Z0-9]{2})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); + return originString; } /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index b39bb7fa47..5bd24ebe57 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -104,6 +104,10 @@ public class RedisKeys { return rootPrefix.concat("sys:security:user:").concat(app).concat(StrConstant.COLON).concat(client).concat(StrConstant.COLON).concat(userId); } + public static String getCpUserKeyForDingApp(String suiteKey,String app, String client, String userId) { + return rootPrefix.concat("sys:security:user:").concat(app).concat(StrConstant.COLON).concat(client).concat(StrConstant.COLON).concat(suiteKey).concat(StrConstant.COLON).concat(userId); + } + /** * 拼接手机验证码key---后面需要改!!! * @@ -856,4 +860,73 @@ public class RedisKeys { } return rootPrefix.concat("staffbaseinfo:")+userId; } + + + /** + * 大华publicKey + */ + public static String getDhPublicKey() { + return rootPrefix.concat("dh:public"); + } + + /** + * 大华token + */ + public static String getDhToken() { + return rootPrefix.concat("dh:token"); + } + + /** + * desc:根据appId 获取 客户信息key + * @param appId + * @return + */ + public static String getThirdCustomerInfoByAppId(String appId) { + if (StringUtils.isBlank(appId)){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误"); + } + return rootPrefix.concat("third:customerInfo:appId:")+appId; + } + + public static String getCustomerStaffTempKey(String staffId) { + if (StringUtils.isBlank(staffId)){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误"); + } + return rootPrefix.concat("gov:staff:temp:staffId:")+staffId; + } + + /** + * Desc: 票据 + * @param suiteKey + * @author zxc + * @date 2022/9/14 10:46 + */ + public static String getSuiteTicketKey(String suiteKey) { + return rootPrefix.concat("ding:suiteTicket:" + suiteKey); + } + + public static String getDingMiniInfoKey(String suiteKey) { + return rootPrefix.concat("ding:miniInfo:" + suiteKey); + } + + /** + * 运营人员-资源权限 + * @param operId + * @return + */ + public static String operResourcesBaseDir() { + return rootPrefix.concat("oper:access:resources:"); + } + + public static String operResourcesByUserId(String operId) { + return operResourcesBaseDir().concat(operId); + } + + /** + * 获取需要检查的资源url + * @return + */ + public static String getOperExamineResourceUrls() { + return rootPrefix.concat("oper:access:examineresources"); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerDingDingRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerDingDingRedis.java new file mode 100644 index 0000000000..8a57fb1ca7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerDingDingRedis.java @@ -0,0 +1,58 @@ +package com.epmet.commons.tools.redis.common; + +import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.feign.CommonThirdFeignClient; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import javax.annotation.PostConstruct; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2022/9/15 10:01 + * @DESC + */ +@Slf4j +@Component +public class CustomerDingDingRedis { + + @Autowired + private CommonThirdFeignClient thirdFeignClient; + @Autowired + private RedisUtils redisUtils; + + private static CustomerDingDingRedis customerDingDingRedis; + + @PostConstruct + public void init() { + customerDingDingRedis = this; + customerDingDingRedis.thirdFeignClient = this.thirdFeignClient; + customerDingDingRedis.redisUtils = this.redisUtils; + } + + public static DingMiniInfoCache getDingMiniInfo(String miniAppId){ + String key = RedisKeys.getDingMiniInfoKey(miniAppId); + Map miniInfoMap = customerDingDingRedis.redisUtils.hGetAll(key); + if (!CollectionUtils.isEmpty(miniInfoMap)){ + return ConvertUtils.mapToEntity(miniInfoMap,DingMiniInfoCache.class); + } + Result dingMiniInfoResult = customerDingDingRedis.thirdFeignClient.getDingMiniInfo(new DingMiniInfoFormDTO(miniAppId)); + if (!dingMiniInfoResult.success()){ + throw new EpmetException("查询dingMiniInfo失败..."); + } + if (null == dingMiniInfoResult.getData()){ + return null; + } + return dingMiniInfoResult.getData(); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/DingMiniInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/DingMiniInfoCache.java new file mode 100644 index 0000000000..bd656c9a7e --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/DingMiniInfoCache.java @@ -0,0 +1,52 @@ +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/15 10:11 + * @DESC + */ +@Data +public class DingMiniInfoCache implements Serializable { + + private static final long serialVersionUID = -6956910978074595334L; + + private String id; + + /** + * + */ + private String suiteId; + + /** + * + */ + private String appId; + + /** + * + */ + private String miniAppId; + + /** + * + */ + private String suiteName; + + /** + * + */ + private String suiteKey; + + /** + * + */ + private String suiteSecret; + + private String token; + + private String aesKey; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/BCryptPasswordEncoder.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/BCryptPasswordEncoder.java index babcf5c91f..ef4050a5c3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/BCryptPasswordEncoder.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/BCryptPasswordEncoder.java @@ -16,7 +16,7 @@ import java.util.regex.Pattern; * */ public class BCryptPasswordEncoder implements PasswordEncoder { - private Pattern BCRYPT_PATTERN = Pattern + private static final Pattern BCRYPT_PATTERN = Pattern .compile("\\A\\$2a?\\$\\d\\d\\$[./0-9A-Za-z]{53}"); private final Log logger = LogFactory.getLog(getClass()); @@ -72,10 +72,10 @@ public class BCryptPasswordEncoder implements PasswordEncoder { return false; } - if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { + /*if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warn("Encoded password does not look like BCrypt"); return false; - } + }*/ return BCrypt.checkpw(rawPassword.toString(), encodedPassword); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java index d7a685b2f2..fdae188e6b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java @@ -37,6 +37,43 @@ public class PasswordUtils { return passwordEncoder.matches(str, password); } + /** + * desc:校验密码规则是否 + * 校验密码规则:密码必须8-20个字符,而且同时包含大小写字母和数字 + * @param password + * @return + */ + public static boolean checkPassWordRule(String password) { + boolean flag=false; + if(password.length()<8||password.length()>20){ + return flag; + } + boolean numFlag=false; + boolean bigLetter=false; + boolean smallLetter=false; + char[] passwordArray = password.toCharArray(); + for(int i=0;i < passwordArray.length;i++) { + char currentStr=passwordArray[i]; + // 判断ch是否是数字字符,如'1','2‘,是返回true。否则返回false + if(Character.isDigit(currentStr)){ + numFlag=true; + continue; + } + // 判断ch是否是字母字符,如'a','b‘,是返回true。否则返回false + if(Character.isUpperCase(currentStr)){ + bigLetter=true; + continue; + } + if(Character.isLowerCase(currentStr)){ + smallLetter=true; + } + } + if(numFlag&&bigLetter&&smallLetter){ + flag=true; + } + return flag; + } + public static void main(String[] args) { String str = "wangqing"; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java index ce92400ae0..220ac403a8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java @@ -2,6 +2,7 @@ package com.epmet.commons.tools.security.user; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.utils.EpmetRequestHolder; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java index 4c0845fc6c..856cb6449d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java @@ -41,6 +41,15 @@ public class CpUserDetailRedis { redisUtils.hMSet(key, map, expire); } + public void setForDingApp(String suiteKey,TokenDto user, long expire) { + if (user == null) { + return; + } + String key = RedisKeys.getCpUserKeyForDingApp(suiteKey,user.getApp(), user.getClient(), user.getUserId()); + //bean to map + Map map = BeanUtil.beanToMap(user, false, true); + redisUtils.hMSet(key, map, expire); + } /** * 获取token信息 * diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index d5e6be9ab4..2c0fc380e6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -55,6 +55,7 @@ public class DateUtils { public final static String DATE_TIME_PATTERN_END_WITH_MINUTE = "yyyy-MM-dd HH:mm"; public static final String DATE_PATTERN_YYYYMMDD = "yyyyMMdd"; + public static final String DATE_PATTERN_YYYYMMDDHHMM = "yyyyMMddHHmm"; public static final String DATE_NAME_PATTERN = "yyyy年MM月dd日"; public static final String MONTH_NAME_PATTERN = "yyyy年MM月"; public static final String DATE_PATTERN_YYYY = "yyyy"; @@ -1070,4 +1071,10 @@ public class DateUtils { return cal.getTime(); } + public static Date calDateBaseDay(Date date, int day) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.DAY_OF_MONTH, day); + return calendar.getTime(); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java index c86ef93152..e24f420fa7 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/EpmetRequestHolder.java @@ -2,6 +2,7 @@ package com.epmet.commons.tools.utils; import com.alibaba.ttl.TransmittableThreadLocal; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.Constant; import org.apache.commons.lang3.StringUtils; import java.util.HashMap; @@ -86,6 +87,14 @@ public class EpmetRequestHolder { return getHeader(AppClientConstant.CLIENT); } + /** + * 获取登陆用户的token + * @return + */ + public static String getLoginUserAuthorizationToken() { + return getHeader(Constant.AUTHORIZATION_HEADER); + } + /** * 获取所有 * @return diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 4fe6be37da..69b9d87b97 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -443,6 +443,34 @@ public class HttpClientManager { } } + public Result sendGet(String url, Map params, Map headerMap) { + + try { + URIBuilder builder = new URIBuilder(url); + if (!CollectionUtils.isEmpty(params)) { + Set set = params.keySet(); + for (String key : set) { + builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key))); + } + } + + System.out.println(builder.getPath()); + HttpGet httpGet = new HttpGet(builder.build()); + httpGet.setConfig(requestConfig); + if (null != headerMap){ + headerMap.forEach((k,v) -> { + if (StringUtils.isNotBlank(k)) { + httpGet.addHeader(k, v == null ? null : v.toString()); + } + }); + } + return execute(httpGet,false); + } catch (Exception e) { + log.error("sendGet exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + private Result execute(HttpRequestBase httpMethod, boolean isHttps) { CloseableHttpResponse response = null; try { diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java new file mode 100644 index 0000000000..ff1f0b0549 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IdCardRegexUtils.java @@ -0,0 +1,155 @@ +package com.epmet.commons.tools.utils; + +import com.epmet.commons.tools.enums.IdCardTypeEnum; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.DateTimeException; +import java.time.LocalDate; +import java.time.Period; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 唯一整件正则工具 + */ +public class IdCardRegexUtils { + + /** + * 15位身份证号的正则表达式 + */ + private static final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?\\d{2})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)$"); + /** + * 18位身份证号的正则表达式 + */ + private static final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?\\d{4})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)[0-9a-xA-X]$"); + + /** + * 9位护照 + */ + private static final Pattern PATTERN_9_PASSPORT = Pattern.compile("^[a-zA-Z0-9]{8,9}$"); + + private String inputText; + + private Matcher matcher; + + private IdCardTypeEnum idCardType; + + private IdCardRegexUtils(IdCardTypeEnum idCardType, Matcher matcher, String inputText) { + this.idCardType = idCardType; + this.matcher = matcher; + this.inputText = inputText; + } + + /** + * 正则解析结果 + */ + @Data + @AllArgsConstructor + @NoArgsConstructor + public static class ParsedContent { + private String birthdayYear; + private String birthdayMonth; + private String birthdayDay; + private String sex; + private Integer age; + } + + /** + * desc:校验输入的证件号是否合法 + * @param input + * @return + */ + public static boolean validateIdCard(String input){ + IdCardRegexUtils parse = IdCardRegexUtils.parse(input); + return parse != null; + } + + /** + * 解析正则 + * @param input + * @return + */ + public static IdCardRegexUtils parse(String input) { + if (input == null || input.trim().length() == 0) { + return null; + } + + if (input.length() == 15) { + Matcher matcher = PATTERN_15_ID.matcher(input); + if (matcher.matches()) { + return new IdCardRegexUtils(IdCardTypeEnum.SFZH, matcher, input); + } + } + + if (input.length() == 18) { + Matcher matcher = PATTERN_18_ID.matcher(input); + if (matcher.matches()) { + return new IdCardRegexUtils(IdCardTypeEnum.SFZH, matcher, input); + } + } + + if (input.length() == 9 || input.length() == 8) { + Matcher matcher = PATTERN_9_PASSPORT.matcher(input); + if (matcher.matches()) { + return new IdCardRegexUtils(IdCardTypeEnum.PASSPORT, matcher, input); + } + } + return null; + } + + /** + * 获取解析结果 + * @return + */ + public ParsedContent getParsedResult() { + if (matcher == null || idCardType == null) { + return null; + } + + if (IdCardTypeEnum.SFZH == idCardType) { + //是身份证号,可以解析 + String year; + if (inputText.length() == 15) { + // 15位身份证号,years前需要拼上19 + year = "19".concat(matcher.group("year")); + } else { + year = matcher.group("year"); + } + String month = matcher.group("month"); + String day = matcher.group("day"); + String sex = matcher.group("sex"); + + // ------- 年龄Start---------- + Integer age; + try { + LocalDate birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); + age = Period.between(birthday, LocalDate.now()).getYears(); + } catch (DateTimeException e) { + throw new EpmetException("身份证号解析年龄失败:" + ExceptionUtils.getErrorStackTrace(e)); + } + // ------- 年龄End---------- + return new ParsedContent(year, month, day, sex, age); + } + + // 其他类型暂时不可解析 + return null; + } + + /** + * 获取类型枚举 + * @return + */ + public IdCardTypeEnum getTypeEnum() { + return idCardType; + } + + public static void main(String[] args) { + IdCardRegexUtils parse = IdCardRegexUtils.parse("370282198801303017"); + ParsedContent parsedResult = parse.getParsedResult(); + System.out.println(parsedResult); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/NameUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/NameUtils.java new file mode 100644 index 0000000000..8dec710c4a --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/NameUtils.java @@ -0,0 +1,89 @@ +package com.epmet.commons.tools.utils; + +import com.epmet.commons.tools.constant.NumConstant; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/9/14 14:40 + */ +public class NameUtils { + /** + * 复姓(两字),国内现存81个。末尾添加三字以上的部分满姓 + */ + private static final String[] SURNAME_NOW = {"百里", "北堂", "北野", "北宫", "辟闾", "孛尔", "淳于", "成公", "陈生", "褚师", + "端木", "东方", "东郭", "东野", "东门", "第五", "大狐", "段干", "段阳", "带曰", "第二", "东宫", "公孙", "公冶", "公羊", + "公良", "公西", "公孟", "高堂", "高阳", "公析", "公肩", "公坚", "郭公", "谷梁", "毌将", "公乘", "毌丘", "公户", "公广", + "公仪", "公祖", "皇甫", "黄龙", "胡母", "何阳", "夹谷", "九方", "即墨", "梁丘", "闾丘", "洛阳", "陵尹", "冷富", "龙丘", + "令狐", "林彭", "南宫", "南郭", "女娲", "南伯", "南容", "南门", "南野", "欧阳", "欧侯", "濮阳", "青阳", "漆雕", "亓官", + "渠丘", "壤驷", "上官", "少室", "少叔", "司徒", "司马", "司空", "司寇", "士孙", "申屠", "申徒", "申鲜", "申叔", "夙沙", + "叔先", "叔仲", "侍其", "叔孙", "澹台", "太史", "太叔", "太公", "屠岸", "唐古", "闻人", "巫马", "微生", "王孙", "无庸", + "夏侯", "西门", "信平", "鲜于", "轩辕", "相里", "新垣", "徐离", "羊舌", "羊角", "延陵", "於陵", "伊祁", "吾丘", "乐正", + "只斤", "诸葛", "颛孙", "仲孙", "仲长", "钟离", "宗政", "主父", "中叔", "左人", "左丘", "宰父", "长儿", "仉督", "单于", + "叱干", "叱利", "车非", "车公", "车侯", "车长", "车绵", "独孤", "大野", "独吉", "达奚", "达官", "达仲", "达品", "哥舒", + "哥夜", "哥翰", "哥汗", "赫连", "呼延", "贺兰", "黑齿", "斛律", "斛粟", "贺若", "贺奴", "贺远", "贺元", "夹谷", "吉胡", + "吉利", "吉家", "可频", "慕容", "万俟", "万红", "万中", "抹捻", "纳兰", "纳西", "纳吉", "纳罕", "纳塞", "纳博", "纳称", + "纳勉", "普周", "仆固", "仆散", "蒲察", "屈突", "屈卢", "钳耳", "是云", "索卢", "厍狄", "拓跋", "同蹄", "秃发", "完颜", + "完明", "完忠", "宇文", "尉迟", "耶律", "耶红", "也先", "耶鲜", "耶闻", "长孙", "长南", "长北", "长西", "长红", "长元", + "长秋", "长寸", "长李", "长云", "萨嘛喇","赫舍里","萨克达","钮祜禄","他塔喇","喜塔腊","库雅喇","瓜尔佳","舒穆禄","索绰络", + "叶赫那拉","依尔觉罗","额尔德特","讷殷富察","叶赫那兰","爱新觉罗","依尔根觉罗"}; + + /** + * 获取复姓,非单字姓氏。未匹配上则依旧返回单字姓氏 + * @param name + * @return + */ + public static String getSurNameComplex(String name){ + for (String s : SURNAME_NOW) { + if (name.startsWith(s)) { + return name.substring(0, s.length()); + } + } + return name.substring(0,1); + } + + /** + * 获取复姓名,去除姓氏后名 + * @param name + * @return + */ + public static String getNameComplex(String name){ + for (String s : SURNAME_NOW) { + if (name.startsWith(s)) { + return name.substring(s.length()); + } + } + return name.substring(1); + } + + /** + * 获取姓氏与姓名
+ * 姓名在两字时,首字为姓。
+ * 姓名大于两字时,优先匹配复姓。
+ * 姓氏未匹配且姓名多于5字时,姓与名均在姓氏中,名为空;少于5字时则采用第一个字为姓。
+ * @param name 姓名 + * @return map类型数据,姓氏为key值“X”,名字为value值“M” + */ + public static Map getSurName(String name) { + Map mapData = new HashMap<>(NumConstant.TWO); + if (name.length() > NumConstant.ZERO && name.length() <= NumConstant.TWO){ + mapData.put("X", name.substring(NumConstant.ZERO, NumConstant.ONE)); + mapData.put("M", name.substring(NumConstant.ONE)); + } else if (name.length() > NumConstant.TWO) { + for (String s : SURNAME_NOW) {//遍历复姓数组 + if (name.startsWith(s)) { + mapData.put("X", s); + mapData.put("M", name.substring(s.length())); + return mapData; + } + } + //姓氏没有匹配时采用第一个字为姓 + mapData.put("X", name.substring(NumConstant.ZERO, NumConstant.ONE)); + mapData.put("M", name.substring(NumConstant.ONE)); + } + return mapData; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java new file mode 100644 index 0000000000..dcde88f23f --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java @@ -0,0 +1,42 @@ +package com.epmet.commons.tools.utils; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.dto.result.YtHsjcResDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 16:56 + */ +@Slf4j +public class YtHsResUtils { + static String url = "https://10.2.2.60:8191/sjzt/server/hsjcxx?appkey=DR4jF5Be7sCsqDmCamq2tmYCl"; + + /** + * desc:图片同步扫描 + * + * @return + */ + public static YtHsjcResDTO hsjc(String cardNo, Integer rowNum, Integer pageSize) { + try { + String param = String.format("&card_no=%s&ROWNUM=%s&PAGESIZE=%s", cardNo, rowNum, pageSize); + String apiUrl = url.concat(param); + Result result = HttpClientManager.getInstance().sendPostByJSON(apiUrl, null); + if (result.success()) { + return JSON.parseObject(result.getData(), YtHsjcResDTO.class); + } + YtHsjcResDTO resultResult = new YtHsjcResDTO(); + resultResult.setData(new ArrayList<>()); + return resultResult; + } catch (Exception e) { + log.error(String.format("烟台核算检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage())); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取核算检测结果api异常"+e.getMessage()); + } + } +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java new file mode 100644 index 0000000000..b3c1d207d4 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/converter/EasyExcelDateConverter.java @@ -0,0 +1,51 @@ +package com.epmet.commons.tools.utils.poi.excel.converter; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/8/26 4:59 下午 + * @version: 1.0 + */ + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @Author: liujianjun + * @Date: 2022/7/19 + * @Description: yyyy-MM-dd easyExcel 日期转换 + */ +public class EasyExcelDateConverter implements Converter { + + private static final String PATTERN_YYYY_MM_DD = "yyyy-MM-dd"; + + @Override + public Class supportJavaTypeKey() { + return Converter.super.supportJavaTypeKey(); + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return Converter.super.supportExcelTypeKey(); + } + + @Override + public WriteCellData convertToExcelData(Date value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD); + String dateValue = sdf.format(value); + return new WriteCellData<>(dateValue); + } + + //@Override + //public Date convertToJavaData(ReadCellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + // SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_YYYY_MM_DD); + // return sdf.parse(cellData.getStringValue()); + //} +} \ No newline at end of file diff --git a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java index cf7493a300..399f574dd9 100644 --- a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java +++ b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java @@ -8,9 +8,15 @@ package com.epmet; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.aspect.ServletExceptionHandler; import com.epmet.commons.tools.config.RedissonConfig; import com.epmet.commons.tools.config.ThreadDispatcherConfig; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.filter.CpProperty; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @@ -18,6 +24,9 @@ import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; +import javax.annotation.PostConstruct; +import java.util.List; + /** * 网关服务 * @@ -31,7 +40,24 @@ import org.springframework.context.annotation.FilterType; @ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ThreadDispatcherConfig.class, ServletExceptionHandler.class})) public class GatewayApplication { + @Autowired + private CpProperty cpProperty; + + @Autowired + private RedisUtils redisUtils; + public static void main(String[] args) { SpringApplication.run(GatewayApplication.class, args); } + + /** + * 初始化运营端校验资源列表 + */ +// @PostConstruct +// public void initOperExamineResources() { +// if (!redisUtils.hasKey(RedisKeys.getOperExamineResourceUrls())) { +// List operExamineResourceUrls = cpProperty.getOperExamineResourceUrls(); +// redisUtils.setString(RedisKeys.getOperExamineResourceUrls(), JSON.toJSONString(operExamineResourceUrls)); +// } +// } } diff --git a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java index 305bf2b3a4..c857f97159 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -1,11 +1,22 @@ package com.epmet.auth; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; +import com.epmet.commons.tools.dto.result.OperResouce; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.dto.BaseTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.commons.tools.utils.Result; import com.epmet.filter.CpProperty; import com.epmet.jwt.JwtTokenUtils; import io.jsonwebtoken.Claims; @@ -15,18 +26,20 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import org.springframework.util.AntPathMatcher; import org.springframework.web.server.ServerWebExchange; import java.util.Date; +import java.util.List; /** * 内部认证处理器 */ @Component -public class InternalAuthProcessor extends AuthProcessor { +public class InternalAuthProcessor extends AuthProcessor implements ResultDataResolver { private Logger logger = LoggerFactory.getLogger(getClass()); @@ -41,6 +54,12 @@ public class InternalAuthProcessor extends AuthProcessor { @Autowired private CpProperty cpProperty; + @Autowired + private CommonOperAccessOpenFeignClient operAccessOpenFeignClient; + + @Autowired + private RedisUtils redisUtils; + @Override public ServerWebExchange auth(ServerWebExchange exchange, GatewayFilterChain chain) { ServerHttpRequest request = exchange.getRequest(); @@ -104,10 +123,59 @@ public class InternalAuthProcessor extends AuthProcessor { builder.header(AppClientConstant.CUSTOMER_ID, customerId); } + // 针对运营端的url拦截和校验 + if (AppClientConstant.APP_OPER.equals(app)) { + HttpMethod method = request.getMethod(); + Boolean hasAccess = checkRequestOperResource(userId, requestUri, method.toString()); + if (!hasAccess) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "资源未授权", "资源未授权"); + } + } + ServerHttpRequest shr = builder.build(); return exchange.mutate().request(shr).build(); } + /** + * 校验运营端用户是否有权访问该资源 + * @param uri + * @param method + * @return + */ + private Boolean checkRequestOperResource(String userId, String uri, String method) { + String resourceJsonString = redisUtils.getString(RedisKeys.getOperExamineResourceUrls()); + List resources = JSON.parseObject(resourceJsonString, new TypeReference>() {}); + + if (resources == null) { + // redis中没有缓存,需要api获取 + resources = getResultDataOrThrowsException(operAccessOpenFeignClient.getExamineResourceUrls(), ServiceConstant.OPER_ACCESS_SERVER, + EpmetErrorCode.SERVER_ERROR.getCode(), "调用operaccess获取要校验的资源失败", "调用operaccess获取要校验的资源失败"); + + // 缓存 + redisUtils.setString(RedisKeys.getOperExamineResourceUrls(), JSON.toJSONString(resources)); + } + + for (OperResouce resource : resources) { + if (antPathMatcher.match(resource.getResourceUrl(), uri) + && resource.getResourceMethod().equals(method)) { + + //需要校验权限的url + HasOperPermissionFormDTO form = new HasOperPermissionFormDTO(); + form.setUri(uri); + form.setMethod(method); + form.setOperId(userId); + Result result = operAccessOpenFeignClient.hasOperPermission(form); + if (result == null || !result.success()) { + return false; + } + return true; + } + } + + // 如果当前请求url不需要校验权限,那么返回true + return true; + } + /** * 是否需要认证 * @param requestUri diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java index 2ea01e1c32..71dce075fe 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java @@ -42,4 +42,15 @@ public class CpProperty { */ private List swaggerUrls; + /** + * 运营端,需要校验的url资源列表 + */ + private List operExamineResourceUrls; + + @Data + public static class OperExamineResource { + private String resourceUrl; + private String resourceMethod; + } + } diff --git a/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java b/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java index 7cca3c4b36..ea02f75376 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java @@ -5,6 +5,7 @@ import com.epmet.auth.ExternalAuthProcessor; import com.epmet.auth.InternalAuthProcessor; import com.epmet.commons.tools.constant.AppClientConstant; 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.exception.RenException; import com.epmet.commons.tools.utils.IpUtils; @@ -64,6 +65,10 @@ public class EpmetGatewayFilter implements GatewayFilter { } return doFilter(exchange, chain); + } catch (EpmetException re) { + // 人为抛出,则携带错误码和错误信息响应给前端 + log.error("EpmetGatewayFilter认证出错RenException,错误信息:{}", ExceptionUtils.getErrorStackTrace(re)); + return response(exchange, new Result<>().error(re.getCode(), re.getMessage())); } catch (RenException re) { // 人为抛出,则携带错误码和错误信息响应给前端 log.error("EpmetGatewayFilter认证出错RenException,错误信息:{}", ExceptionUtils.getErrorStackTrace(re)); diff --git a/epmet-gateway/src/main/resources/bootstrap-urls.yml b/epmet-gateway/src/main/resources/bootstrap-urls.yml new file mode 100644 index 0000000000..dded0b1b86 --- /dev/null +++ b/epmet-gateway/src/main/resources/bootstrap-urls.yml @@ -0,0 +1,5 @@ +epmet: + oper-examine-resource-urls: + # 角色编辑 + - resourceUrl: /oper/access/operrole + resourceMethod: PUT \ No newline at end of file diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 888f8544d1..09aac33a7c 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -12,6 +12,7 @@ spring: name: epmet-gateway-server #环境 dev|test|prod profiles: + include: urls active: @spring.profiles.active@ messages: encoding: UTF-8 @@ -471,6 +472,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -506,6 +513,7 @@ epmet: - /resi/voice/** - /point/** - /heart/** + - /oss/** # 内部认证url白名单(在白名单中的,就不会再校验登录了) internalAuthUrlsWhiteList: diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index 7cab2dfdbf..e50d1982cc 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -32,6 +32,13 @@ com.epmet epmet-commons-mybatis 2.0.0 + + + + org.apache.shardingsphere + sharding-jdbc-spring-boot-starter + +
com.epmet diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcPointNucleicMonitoringDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcPointNucleicMonitoringDao.java new file mode 100644 index 0000000000..599243a856 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcPointNucleicMonitoringDao.java @@ -0,0 +1,17 @@ +package com.epmet.dataaggre.dao.epmetuser; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.entity.epmetuser.IcPointNucleicMonitoringEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 核酸监测点 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-20 + */ +@Mapper +public interface IcPointNucleicMonitoringDao extends BaseDao { + + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcPointVaccinesInoculationDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcPointVaccinesInoculationDao.java new file mode 100644 index 0000000000..a3bfafee1a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/IcPointVaccinesInoculationDao.java @@ -0,0 +1,17 @@ +package com.epmet.dataaggre.dao.epmetuser; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.entity.epmetuser.IcPointVaccinesInoculationEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 疫苗接种点 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-20 + */ +@Mapper +public interface IcPointVaccinesInoculationDao extends BaseDao { + + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java index 10721a9f7a..9b8ba8580b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java @@ -86,4 +86,5 @@ public interface CustomerGridDao extends BaseDao { CustomerGridDTO getGridInfo(@Param("gridId") String gridId); List getSubGridList(@Param("customerId") String customerId, @Param("agencyId") String agencyId); + List getAllSubGridList(@Param("customerId") String customerId, @Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcPointNucleicMonitoringEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcPointNucleicMonitoringEntity.java new file mode 100644 index 0000000000..b19ab6b721 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcPointNucleicMonitoringEntity.java @@ -0,0 +1,77 @@ +package com.epmet.dataaggre.entity.epmetuser; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 核酸监测点 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_point_nucleic_monitoring") +public class IcPointNucleicMonitoringEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所属组织ID + */ + private String orgId; + + /** + * 所属组织名称 + */ + private String orgName; + + /** + * 组织ID上级 + */ + private String pid; + + /** + * 组织ID所有上级 + */ + private String pids; + + /** + * 核酸监测点名称 + */ + private String name; + + /** + * 服务时间 + */ + private String serveTime; + + /** + * 咨询电话 + */ + private String mobile; + + /** + * 监测点地址 + */ + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcPointVaccinesInoculationEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcPointVaccinesInoculationEntity.java new file mode 100644 index 0000000000..3e60c7660e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/IcPointVaccinesInoculationEntity.java @@ -0,0 +1,102 @@ +package com.epmet.dataaggre.entity.epmetuser; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 疫苗接种点 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_point_vaccines_inoculation") +public class IcPointVaccinesInoculationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所属组织ID + */ + private String orgId; + + /** + * 所属组织名称 + */ + private String orgName; + + /** + * 组织ID上级 + */ + private String pid; + + /** + * 组织ID所有上级 + */ + private String pids; + + /** + * 疫苗接种点名称 + */ + private String name; + + /** + * 接种日期 + */ + private String inoculationDate; + + /** + * 接种上午开始时间 + */ + private String moStartTime; + + /** + * 接种上午结束时间 + */ + private String moEndTime; + + /** + * 接种下午开始时间 + */ + private String afStartTime; + + /** + * 接种下午结束时间 + */ + private String afEndTime; + + /** + * 暂无疫苗(1:是;2:否) + */ + private String noAvailableVaccines; + + /** + * 咨询电话 + */ + private String mobile; + + /** + * 接种点地址 + */ + private String address; + + /** + * 经度 + */ + private String longitude; + + /** + * 纬度 + */ + private String latitude; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index 068b1176cd..901087a7ba 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -15,6 +15,8 @@ import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.dto.govorg.result.MemberProjectInfoResultDTO; import com.epmet.dataaggre.dto.govproject.result.ProjectAnalysisResultDTO; import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; +import com.epmet.dataaggre.entity.epmetuser.IcPointNucleicMonitoringEntity; +import com.epmet.dataaggre.entity.epmetuser.IcPointVaccinesInoculationEntity; import com.epmet.dataaggre.entity.epmetuser.IcResiUserEntity; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.UserBaseInfoDTO; @@ -240,4 +242,12 @@ public interface EpmetUserService { List listVolunteers(String customerId, String agencyId, String staffOrgIds, String search, String resiCategory); List getNowResiUser(NowStatsDataFormDTO formDTO); + + Integer countVaccinePoint(String customerId, String agencyId, String staffOrgIds, String search); + + Integer countNucleicPoint(String customerId, String agencyId, String staffOrgIds, String search); + + List listVaccinePoints(String customerId, String agencyId, String staffOrgIds, String search); + + List listNucleicPoints(String customerId, String agencyId,String staffOrgIds, String search); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 26c5ef1b3a..f93c66675b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -94,6 +94,10 @@ public class EpmetUserServiceImpl implements EpmetUserService { private CustomerFootBarService customerFootBarService; @Resource private RegisterRelationDao registerRelationDao; + @Resource + private IcPointVaccinesInoculationDao pointVaccinesInoculationDao; + @Resource + private IcPointNucleicMonitoringDao pointNucleicMonitoringDao; /** * @Description 根据UserIds查询 @@ -923,4 +927,48 @@ public class EpmetUserServiceImpl implements EpmetUserService { List list = registerRelationDao.selectNowResiUser(formDTO); return list; } + + @Override + public Integer countVaccinePoint(String customerId, String agencyId, String staffOrgIds, String search) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcPointVaccinesInoculationEntity::getCustomerId, customerId); + //query.and(w -> w.likeRight(IcPointVaccinesInoculationEntity::getPids, staffOrgIds) + // .or() + // .eq(IcPointVaccinesInoculationEntity::getOrgId, agencyId)); + query.like(StringUtils.isNotBlank(search), IcPointVaccinesInoculationEntity::getName, search); + return pointVaccinesInoculationDao.selectCount(query); + } + + @Override + public Integer countNucleicPoint(String customerId, String agencyId, String staffOrgIds, String search) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcPointNucleicMonitoringEntity::getCustomerId, customerId); + query.and(w -> w.likeRight(IcPointNucleicMonitoringEntity::getPids, staffOrgIds) + .or() + .eq(IcPointNucleicMonitoringEntity::getOrgId, agencyId)); + query.like(StringUtils.isNotBlank(search), IcPointNucleicMonitoringEntity::getName, search); + return pointNucleicMonitoringDao.selectCount(query); + } + + @Override + public List listVaccinePoints(String customerId, String agencyId, String staffOrgIds, String search) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcPointVaccinesInoculationEntity::getCustomerId, customerId); + //query.and(w -> w.likeRight(IcPointVaccinesInoculationEntity::getPids, staffOrgIds) + // .or() + // .eq(IcPointVaccinesInoculationEntity::getOrgId, agencyId)); + query.like(StringUtils.isNotBlank(search), IcPointVaccinesInoculationEntity::getName, search); + return pointVaccinesInoculationDao.selectList(query); + } + + @Override + public List listNucleicPoints(String customerId, String agencyId, String staffOrgIds, String search) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcPointNucleicMonitoringEntity::getCustomerId, customerId); + query.and(w -> w.likeRight(IcPointNucleicMonitoringEntity::getPids, staffOrgIds) + .or() + .eq(IcPointNucleicMonitoringEntity::getOrgId, agencyId)); + query.like(StringUtils.isNotBlank(search), IcPointNucleicMonitoringEntity::getName, search); + return pointNucleicMonitoringDao.selectList(query); + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index a07ebf0a7c..d2ee934888 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -1487,7 +1487,7 @@ public class GovOrgServiceImpl implements GovOrgService { List gridList = new ArrayList<>(); //组织级别为街道的查询下级所有网格 if (isGetSubAllGrid && (OrgLevelEnum.STREET.getCode().equals(dto.getLevel()))) { - gridList = customerGridDao.getSubGridList(customerId, agencyId); + gridList = customerGridDao.getAllSubGridList(customerId, agencyId); List allGridList = new ArrayList<>(); gridList.forEach(gr -> { ScreenAgencyOrGridListDTO.AgencyGrid org = new ScreenAgencyOrGridListDTO.AgencyGrid(); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java index 19b7c71d7e..ff931888c3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java @@ -30,6 +30,8 @@ import com.epmet.dataaggre.dto.govorg.form.DataListLeftSubTotalFormDTO; import com.epmet.dataaggre.dto.govorg.form.SearchDetailFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; +import com.epmet.dataaggre.entity.epmetuser.IcPointNucleicMonitoringEntity; +import com.epmet.dataaggre.entity.epmetuser.IcPointVaccinesInoculationEntity; import com.epmet.dataaggre.entity.epmetuser.IcResiUserEntity; import com.epmet.dataaggre.entity.govorg.*; import com.epmet.dataaggre.entity.govproject.IcEventEntity; @@ -628,6 +630,12 @@ public class CoverageServiceImpl implements CoverageService { // 志愿者 String[] parts = categoryKey.split("_"); return epmetUserService.countVolunteers(customerId, agencyId, staffOrgIds, search, parts[1]); + } else if (CoveragePlaceTypeEnum.VACCINE_POINT.getCode().equals(placeType)) { + // 疫苗接种点 + return epmetUserService.countVaccinePoint(customerId, agencyId, staffOrgIds, search); + } else if (CoveragePlaceTypeEnum.NUCLEIC_POINT.getCode().equals(placeType)) { + // 核酸检测点 + return epmetUserService.countNucleicPoint(customerId, agencyId, staffOrgIds, search); } return 0; @@ -805,6 +813,20 @@ public class CoverageServiceImpl implements CoverageService { coordinates[1], coordinates[0]); }).collect(Collectors.toList()); + } else if (CoveragePlaceTypeEnum.VACCINE_POINT.getCode().equals(placeType)) { + // 疫苗接种点 + List vps = epmetUserService.listVaccinePoints(customerId, agencyId, staffOrgIds, search); + return vps.stream() + .map(vp -> new CoverageAnalisisDataListResultDTO(vp.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null, + placeType, vp.getName(), vp.getLatitude(), vp.getLongitude())) + .collect(Collectors.toList()); + } else if (CoveragePlaceTypeEnum.NUCLEIC_POINT.getCode().equals(placeType)) { + // 核酸检测点 + List nps = epmetUserService.listNucleicPoints(customerId, agencyId, staffOrgIds, search); + return nps.stream() + .map(np -> new CoverageAnalisisDataListResultDTO(np.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null, + placeType, np.getName(), np.getLatitude(), np.getLongitude())) + .collect(Collectors.toList()); } return new ArrayList<>(); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml index af955a0722..fd72caafbf 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml @@ -191,6 +191,13 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 + ribbon: ReadTimeout: 300000 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml index 9ba9386fb3..49dad70cf7 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml @@ -7,13 +7,13 @@ + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml index 4b51beae89..29e53ff04b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml @@ -470,6 +470,9 @@ AND GRID_ID = #{orgId} + + AND ORG_ID_PATH LIKE concat('%', #{orgId}, '%') + AND DATE_FORMAT(CREATED_TIME,"%Y%m%d%H%i%s") = ]]> #{startDate} @@ -492,6 +495,9 @@ AND GRID_ID = #{orgId} + + AND ORG_ID_PATH LIKE concat('%', #{orgId}, '%') + AND DATE_FORMAT(CREATED_TIME,"%Y%m%d%H%i%s") = ]]> #{startDate} diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index b5c54347b9..839272531e 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -28,6 +28,13 @@ com.epmet epmet-commons-mybatis 2.0.0 + + + + org.apache.shardingsphere + sharding-jdbc-spring-boot-starter + + com.epmet diff --git a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml index 7d3bf719af..205f7efffa 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml @@ -138,6 +138,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java index dfd88c7e96..db6bd2c3d6 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java @@ -206,4 +206,5 @@ public class ScreenProjectDataDTO implements Serializable { private String orgIdPath; private String finishOrgType; + private Date processTime; } diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 4b65998598..54b10fbbb1 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -22,6 +22,13 @@ com.epmet epmet-commons-mybatis 2.0.0 + + + + org.apache.shardingsphere + sharding-jdbc-spring-boot-starter + + org.springframework.boot diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/PingYinConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/PingYinConstant.java index 043e256c42..988127dab7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/PingYinConstant.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/PingYinConstant.java @@ -18,4 +18,8 @@ public interface PingYinConstant { String TEST_PING_YIN_CUSTOMER_ID = "78e2b2227c07de1fe54da14e2b2d9eb6"; String PROD_PING_YIN_CUSTOMER_ID = "6f203e30de1a65aab7e69c058826cd80"; + + String KC = "2fe0065f70ca0e23ce4c26fca5f1d933"; + String YS = "46c55cb862d6d5e6d05d2ab61a1cc07e"; + String JS = "44876154d10d7cb7affd92000f84f833"; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java index 6d76dfd175..1ac0f1ab53 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DataReportingServiceImpl.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.OrgTypeConstant; +import com.epmet.constant.PingYinConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dto.basereport.form.EventInfoFormDTO; import com.epmet.dto.basereport.result.EventInfoResultDTO; @@ -243,7 +244,7 @@ public class DataReportingServiceImpl implements DataReportingService { if (CollectionUtils.isNotEmpty(formDTO.getProjectId())) { list = projectList.stream().map(project -> { EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); - ScreenCustomerGridDTO grid = screenCustomerGridService.getGridById(project.getOrgId()); + CustomerGridDTO grid = customerGridService.getGridById(project.getOrgId()); dto.setOrgId(project.getOrgId()); if (null != grid) { dto.setOrgCode(grid.getCode()); @@ -254,10 +255,10 @@ public class DataReportingServiceImpl implements DataReportingService { } else { //项目ID不为空时,提前取出客户下的组织和网格 Map agencyMap = screenCustomerAgencyService.getAgencyList(formDTO.getCustomerId()); - Map gridMap = screenCustomerGridService.getGridList(formDTO.getCustomerId()); + Map gridMap = customerGridService.getGridMap(PingYinConstant.PROD_PING_YIN_CUSTOMER_ID); list = projectList.stream().map(project -> { EventInfoResultDTO dto = getEventInfoResultDTO(project, finalEpmetCodeMap, codeMap); - ScreenCustomerGridDTO grid = gridMap.get(project.getOrgId()); + CustomerGridDTO grid = gridMap.get(project.getOrgId()); dto.setOrgId(project.getOrgId()); if (null != grid) { dto.setOrgCode(grid.getCode()); @@ -319,12 +320,16 @@ public class DataReportingServiceImpl implements DataReportingService { dto.setHappenPlace(project.getProjectAddress()); dto.setEventDescription(project.getProjectContent()); dto.setSuccessfulOrNo(ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode())?"Y":"N"); - if (ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode())) { + dto.setStatus(getProjectStatus(project.getProjectStatusCode())); + dto.setCompleteTime(project.getCloseCaseTime()); + + if (ProjectConstant.CLOSED_CASE.equals(project.getProjectStatusCode()) || + ProjectConstant.CLOSED.equals(project.getProjectStatusCode())) { //办结组织是机关时,办结层级为机关的层级 if (OrgTypeConstant.AGENCY.equals(project.getFinishOrgType())) { dto.setWaysOfResolving(ProjectConstant.PROJECT_REPORT); //如果是孔村的项目办结层级需要降一级 - if("2fe0065f70ca0e23ce4c26fca5f1d933".equals(project.getCustomerId())) { + if(PingYinConstant.KC.equals(project.getCustomerId())) { if (StringUtils.isNotBlank(project.getFinishOrgLevel())) { switch (project.getFinishOrgLevel()) { case OrgTypeConstant.DISTRICT: @@ -355,9 +360,12 @@ public class DataReportingServiceImpl implements DataReportingService { //办结组织是网格时,办结层级为网格 dto.setCompleteLevel("5"); } + if (ProjectConstant.CLOSED.equals(project.getProjectStatusCode()) &&(PingYinConstant.KC.equals(project.getCustomerId()) || + PingYinConstant.YS.equals(project.getCustomerId()) || PingYinConstant.JS.equals(project.getCustomerId()))) { + dto.setCompleteTime(project.getProcessTime()); + } } - dto.setStatus(getProjectStatus(project.getProjectStatusCode())); - dto.setCompleteTime(project.getCloseCaseTime()); + dto.setLat(project.getLatitude()); dto.setLng(project.getLongitude()); dto.setWaysOfResolving(ProjectConstant.PROJECT_SELF_CLOSED); @@ -386,7 +394,6 @@ public class DataReportingServiceImpl implements DataReportingService { case ProjectConstant.PENDING: return "01"; case ProjectConstant.CLOSED: - return "02"; case ProjectConstant.CLOSED_CASE: return "03"; default: diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 13f641fa98..4e840fd674 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -15,6 +15,7 @@ import com.epmet.entity.org.CustomerGridEntity; import java.util.Date; import java.util.List; +import java.util.Map; public interface CustomerGridService extends BaseService { /** @@ -106,4 +107,9 @@ public interface CustomerGridService extends BaseService { * @Description 查询客户下有效网格列表 **/ List gridListByCustomerId(String customerId); + + CustomerGridDTO getGridById(String gridId); + + Map getGridMap(String customerId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index 10bfbc4fd5..8c2c6740e5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -1,8 +1,10 @@ package com.epmet.service.org.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.CustomerGridDao; import com.epmet.dto.group.AgencyDTO; @@ -18,12 +20,13 @@ import com.epmet.dto.user.result.GridUserInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.Issue.IssueService; import com.epmet.service.org.CustomerGridService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; @Service @DataSource(DataSourceConstant.GOV_ORG) @@ -157,4 +160,20 @@ public class CustomerGridServiceImpl extends BaseServiceImpl getGridMap(String customerId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CustomerGridEntity::getCustomerId, customerId); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return ConvertUtils.sourceToTarget(list, CustomerGridDTO.class).stream().collect(Collectors.toMap(CustomerGridDTO::getId, Function.identity())); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index 368ee31ebe..f60ad30d00 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -120,6 +120,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml index 64b783c786..6f4ce649b9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -300,7 +300,8 @@ b.HANDLER_ID AS finishOrg, b.HANDLER_TYPE AS finishOrgType, b.ORG_ID_PATH AS orgIdPath, - c.`LEVEL` AS finishOrgLevel + c.`LEVEL` AS finishOrgLevel, + b.PROCESS_TIME FROM screen_project_data a LEFT JOIN ( @@ -309,12 +310,13 @@ PROJECT_ID, HANDLER_ID, HANDLER_TYPE, - ORG_ID_PATH + ORG_ID_PATH, + PROCESS_TIME FROM screen_project_process spp WHERE (( spp.CUSTOMER_ID = '2fe0065f70ca0e23ce4c26fca5f1d933' OR spp.CUSTOMER_ID = '44876154d10d7cb7affd92000f84f833' OR spp.CUSTOMER_ID = '46c55cb862d6d5e6d05d2ab61a1cc07e' ) - AND OPERATION = 'closed_case') + AND (OPERATION = 'closed_case' OR OPERATION = 'close')) OR (( spp.CUSTOMER_ID != '2fe0065f70ca0e23ce4c26fca5f1d933' AND spp.CUSTOMER_ID != '44876154d10d7cb7affd92000f84f833' AND spp.CUSTOMER_ID != '46c55cb862d6d5e6d05d2ab61a1cc07e' ) AND OPERATION = 'close') diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index 0c8a18627c..621d1344f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -521,7 +521,7 @@ - \ No newline at end of file + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceRecordDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceRecordDao.xml new file mode 100755 index 0000000000..0f92add2d8 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceRecordDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml new file mode 100755 index 0000000000..b62d6f86c6 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/societyorg_import_template.xlsx b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/societyorg_import_template.xlsx new file mode 100644 index 0000000000..9ca4a73e2f Binary files /dev/null and b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/societyorg_import_template.xlsx differ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx new file mode 100644 index 0000000000..0938c354cf Binary files /dev/null and b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/workdiary_service_import.xlsx differ diff --git a/epmet-module/epmet-job/epmet-job-server/pom.xml b/epmet-module/epmet-job/epmet-job-server/pom.xml index 039a553e88..34748f1dff 100644 --- a/epmet-module/epmet-job/epmet-job-server/pom.xml +++ b/epmet-module/epmet-job/epmet-job-server/pom.xml @@ -43,11 +43,6 @@ epmet-message-client 2.0.0 - - com.epmet - pli-power-base-client - 2.0.0 - org.springframework.boot spring-boot-starter-web diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/PliPowerService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/PliPowerService.java deleted file mode 100644 index 4fb990d033..0000000000 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/PliPowerService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.epmet.service; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; - -public interface PliPowerService { - - /** - * 访客登出 - * - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @author zhy - * @date 2022/5/30 10:25 - */ - Result visitorLogout(VisitorLogoutFormDTO formDTO); -} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/PliPowerServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/PliPowerServiceImpl.java deleted file mode 100644 index ed54b7e6d9..0000000000 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/PliPowerServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.epmet.service.impl; - -import com.epmet.commons.tools.utils.Result; -import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; -import com.epmet.plugin.power.feign.PliPowerFeignClient; -import com.epmet.service.PliPowerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -/** - * @Description - * @ClassName StatsUserServiceImpl - * @Auth wangc - * @Date 2020-06-29 09:41 - */ -@Service -public class PliPowerServiceImpl implements PliPowerService { - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Autowired - private PliPowerFeignClient pliPowerFeignClient; - - @Override - public Result visitorLogout(VisitorLogoutFormDTO formDTO) { - return pliPowerFeignClient.visitorLogout(formDTO); - } -} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoPublishIcPartyActTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoPublishIcPartyActTask.java new file mode 100644 index 0000000000..d1a9c7a250 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/AutoPublishIcPartyActTask.java @@ -0,0 +1,36 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Description + * @Author yzm + * @Date 2022/8/22 15:13 + */ +@Slf4j +@Component("autoPublishIcPartyActTask") +public class AutoPublishIcPartyActTask implements ITask { + @Autowired + private ResiPartyMemberOpenFeignClient resiPartyMemberOpenFeignClient; + /** + * 活动时间2022-08-15 10:30 选择的是提前3天自动发布 + * 本任务是自动发布活动 + * //2022-8-9号 8:00 收到一个:您有一个活动3天后即将自动发布 + * + * @param params 参数,多参数使用JSON数据 + */ + @Override + public void run(String params) { + Result result=resiPartyMemberOpenFeignClient.autoPublishIcPartyAct(); + if(result.success()){ + log.info("autoPublishIcPartyActTask执行成功"); + }else{ + log.info("autoPublishIcPartyActTask执行失败"); + } + } +} + diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EnterprisePatrolRemindTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EnterprisePatrolRemindTask.java new file mode 100644 index 0000000000..5cfaddd714 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/EnterprisePatrolRemindTask.java @@ -0,0 +1,31 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.GovOrgOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/9/6 17:35 + */ +@Component("enterprisePatrolRemindTask") +@Slf4j +public class EnterprisePatrolRemindTask implements ITask { + @Resource + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + @Override + public void run(String params) { + log.info("EnterprisePatrolRemindTask定时任务正在执行,参数为:{}", params); + Result result = govOrgOpenFeignClient.sendEnterprisePatrolRemindMessage(); + if (result.success()) { + log.info("EnterprisePatrolRemindTask定时任务执行成功"); + } else { + log.error("EnterprisePatrolRemindTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java new file mode 100644 index 0000000000..d7334fabd6 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java @@ -0,0 +1,40 @@ +package com.epmet.task; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author zxc + * @dscription + * 大数据局部门配置on + * 根据范围搜索居民,调接口查询最近一次核酸检测记录 + * 检测时间 + 身份证 不存在就插入 + */ +@Slf4j +@Component("natInfoScanTask") +public class NatInfoScanTask implements ITask { + + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; + + @Override + public void run(String params) { + NatInfoScanTaskFormDTO formDTO = new NatInfoScanTaskFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, NatInfoScanTaskFormDTO.class); + } + Result result = userOpenFeignClient.natInfoScanTask(formDTO); + if (result.success()) { + log.info("NatInfoScanTask定时任务执行成功"); + } else { + log.error("NatInfoScanTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NoticePartyActAutoPublishTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NoticePartyActAutoPublishTask.java new file mode 100644 index 0000000000..c0bbf5fcb8 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NoticePartyActAutoPublishTask.java @@ -0,0 +1,37 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Description + * @Author yzm + * @Date 2022/8/22 15:07 + */ +@Slf4j +@Component("noticePartyActAutoPublishTask") +public class NoticePartyActAutoPublishTask implements ITask { + @Autowired + private ResiPartyMemberOpenFeignClient resiPartyMemberOpenFeignClient; + + /** + * 活动时间2022-08-15 10:30 选择的是提前3天自动发布 + * //2022-8-12 10:30自动发布,收到消息:您有一个活动已经发布 + * 本任务是通知:2022-8-9号 8:00 收到一个:您有一个活动3天后即将自动发布 + * + * @param params 参数,多参数使用JSON数据 + */ + @Override + public void run(String params) { + Result result=resiPartyMemberOpenFeignClient.noticePartyActAutoPublishTask(); + if(result.success()){ + log.info("noticePartyActAutoPublishTask执行成功"); + }else{ + log.info("noticePartyActAutoPublishTask执行失败"); + } + } +} + diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PliVisitorLogoutTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PliVisitorLogoutTask.java deleted file mode 100644 index 41ffa19ecc..0000000000 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PliVisitorLogoutTask.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.epmet.task; - -import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.utils.Result; -import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; -import com.epmet.service.PliPowerService; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 访客登出 - * - * @author zhy - * @date 2022/5/30 10:23 - */ -@Component("pliVisitorLogoutTask") -public class PliVisitorLogoutTask implements ITask { - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Autowired - private PliPowerService pliPowerService; - - @Override - public void run(String params) { - logger.info("VisitorLogoutTask定时任务正在执行,参数为:{}", params); - VisitorLogoutFormDTO formDTO = new VisitorLogoutFormDTO(); - if (StringUtils.isNotBlank(params)) { - formDTO = JSON.parseObject(params, VisitorLogoutFormDTO.class); - } - Result result = pliPowerService.visitorLogout(formDTO); - if (result.success()) { - logger.info("VisitorLogoutTask定时任务执行成功"); - } else { - logger.error("VisitorLogoutTask定时任务执行失败:" + result.getMsg()); - } - } -} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcUpdateYlfnTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcUpdateYlfnTask.java new file mode 100644 index 0000000000..b7a1ffb6ea --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcUpdateYlfnTask.java @@ -0,0 +1,35 @@ +package com.epmet.task.ic; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.task.ITask; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * desc:定时弥补数据 保证数据的一致性 + */ +@Slf4j +@Component("icUpdateYlfnTask") +public class IcUpdateYlfnTask implements ITask { + + @Resource + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + /** + * 执行定时任务接口 + * + * @param params 参数,多参数使用JSON数据 + */ + @Override + public void run(String params) { + Result result = epmetUserOpenFeignClient.updateYlfn(); + if (result.success()) { + log.info("icUpdateYlfnTask定时任务正在执行定时任务执行成功"); + } else { + log.warn("icUpdateYlfnTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml index 458982fe09..cd7764c4c4 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml @@ -32,6 +32,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -125,6 +127,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 600000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 600000 diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java index 3f1ec288ac..00ad39d895 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java @@ -57,4 +57,11 @@ public interface SmsTemplateConstant { * ${name}给您指派了一个新的需求,请服务完成后尽快反馈,谢谢合作。 */ String DEMAND_SERVICE_TEM="SMS_247645013"; + + /** + * 模板名称: 数字社区-企事业单位复巡查消息提醒模板 + * 模板CODE: SMS_251056077 + * 模板内容: ${name}最近一次巡查结果不合格,请在${date}再次巡查。 + */ + String ENTERPRISE_PATROL_TEM="SMS_251056077"; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java index b60b3b8fe1..9920eb019a 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java @@ -170,4 +170,16 @@ public interface SystemMessageType { */ String PARTYMEMBER_RESI_IMPORT = "partymember_resi_import"; + /** + * 党建小助手消息 + */ + String PARTY_MEETING_MESSAGE = "party_meeting_message"; + + String ZBWYH = "参加支部委员会"; + String ZBDYDH = "参加支部党员大会"; + String DXZH = "参加党小组会"; + String DANGKE = "参加党课"; + String ZTDR = "参加主题党日"; + String WMFWHD = "参加为民服务活动"; + } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/IcMessageDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/IcMessageDTO.java new file mode 100644 index 0000000000..1c7e9e9785 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/IcMessageDTO.java @@ -0,0 +1,104 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 用户消息表(党建小助手) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@Data +public class IcMessageDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * app=resi时,此列为gridId,其他情况暂定 * + */ + private String gridId; + + /** + * 被通知的用户id + */ + private String userId; + + /** + * 消息通知对象:居民端用户resi、政府端工作人员gov、运营端工作人员oper + */ + private String app; + + /** + * 消息分类 党建活动:party_act 党建日程:party_schedule + */ + private String messageType; + + /** + * 消息类型对应的业务Id + */ + private String targetId; + + /** + * 消息标题 + */ + private String title; + + /** + * 消息通知内容 + */ + private String messageContent; + + /** + * read已读、unread未读 + */ + private String readFlag; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人(发布消息的人) + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 调用者 + */ + private String referer; + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageFormDTO.java new file mode 100644 index 0000000000..679621c430 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageFormDTO.java @@ -0,0 +1,66 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +public class IcMessageFormDTO implements Serializable { + private static final long serialVersionUID = 2697079163476964749L; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * app=resi时,此列为gridId,其他情况暂定 * + */ + private String gridId; + + /** + * 对应用户id + */ + @NotBlank(message = "通知用户id为空") + private String userId; + + /** + * 消息通知对象:居民端用户resi、政府端工作人员gov、运营端工作人员oper + */ + @NotBlank(message = "消息通知对象不能为空") + private String app; + + /** + * 消息标题 + */ + @NotBlank(message = "消息标题不能为空") + private String title; + + /** + * 消息通知内容 + */ + @NotBlank(message = "通知内容不能为空") + private String messageContent; + + /** + * read已读、unread未读 + */ + @NotBlank(message = "readFlag不能为空") + private String readFlag; + + /** + * 调用者 【分内部调用和外部调用,内部调用值为空,外部默认为:外挂-站内信】 + */ + private String referer; + + /** + * 消息分类:info-上传下达消息 详见UserMessageTypeConstant + */ + private String messageType; + /** + * 消息对应的业务id,比如message_type=info时,此列存储的是消息id,可跳转到消息详情 + */ + private String targetId; +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageListFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageListFormDTO.java new file mode 100644 index 0000000000..685fd340ad --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/IcMessageListFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +public class IcMessageListFormDTO implements Serializable { + private static final long serialVersionUID = 2697079163476964749L; + + private Integer pageNo = 1; + private Integer pageSize = 20; + private Boolean isPage = true; + //token中信息 + private String customerId; + private String userId; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadIcMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadIcMessageFormDTO.java new file mode 100644 index 0000000000..d5c875bd87 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadIcMessageFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ReadIcMessageFormDTO implements Serializable { + private static final long serialVersionUID = 2697079163476964749L; + + /** + * 消息Id + */ + private String id; + //token中信息 + private String customerId; + private String userId; +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java index 8b9f06198f..1083526f67 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java @@ -1,6 +1,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.SysSmsDTO; import com.epmet.dto.form.*; @@ -127,4 +128,15 @@ public interface EpmetMessageOpenFeignClient { @PostMapping(value = "message/sms/send-msg", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result sendMsg(@RequestBody List formDTO); + + /** + * @Author sun + * @Description 党建小助手-批量插入未读消息 + **/ + @PostMapping(value = "message/icMessage/saveicmessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveIcMessageList(List msgList); + + @PostMapping(value = "message/icMessage/unreadcount/{userId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result unReadCount(@PathVariable("userId") String userId); + } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java index 2d5c0d9073..9538233fe2 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java @@ -78,4 +78,15 @@ public class EpmetMessageOpenFeignClientFallback implements EpmetMessageOpenFeig public Result sendMsg(List formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendMsg",formDTO); } + + @Override + public Result saveIcMessageList(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveIcMessageList", msgList); + } + + @Override + public Result unReadCount(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "unReadCount", userId); + } + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java new file mode 100644 index 0000000000..3824123ace --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/IcMessageController.java @@ -0,0 +1,105 @@ +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.IcMessageDTO; +import com.epmet.dto.form.IcMessageFormDTO; +import com.epmet.dto.form.IcMessageListFormDTO; +import com.epmet.dto.form.ReadIcMessageFormDTO; +import com.epmet.service.IcMessageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + + +/** + * 用户消息表(党建小助手) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@RestController +@RequestMapping("icMessage") +public class IcMessageController { + + @Autowired + private IcMessageService icMessageService; + + @RequestMapping("list") + public Result> list(@LoginUser TokenDto tokenDto, @RequestBody IcMessageListFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(icMessageService.list(formDTO)); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcMessageDTO data = icMessageService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcMessageDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icMessageService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcMessageDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icMessageService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icMessageService.delete(ids); + return new Result(); + } + + /** + * @Author sun + * @Description 批量插入未读消息 + **/ + @PostMapping("saveicmessagelist") + public Result saveIcMessageList(@RequestBody List msgList) { + icMessageService.saveIcMessageList(msgList); + return new Result(); + } + + /** + * @Author sun + * @Description 单条或批量修改已读 + **/ + @PostMapping("read") + public Result read(@LoginUser TokenDto tokenDto, @RequestBody ReadIcMessageFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + icMessageService.read(formDTO); + return new Result(); + } + + @PostMapping("unreadcount/{userId}") + public Result unReadCount(@PathVariable ("userId") String userId) { + return new Result().ok(icMessageService.unReadCount(userId)); + } + + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/IcMessageDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/IcMessageDao.java new file mode 100644 index 0000000000..9c1ca666b8 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/IcMessageDao.java @@ -0,0 +1,27 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcMessageDTO; +import com.epmet.dto.form.IcMessageListFormDTO; +import com.epmet.dto.form.ReadIcMessageFormDTO; +import com.epmet.entity.IcMessageEntity; +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 2022-08-19 + */ +@Mapper +public interface IcMessageDao extends BaseDao { + + List selectMessageList(IcMessageListFormDTO formDTO); + + void upByUserId(ReadIcMessageFormDTO formDTO); + + Integer selectUnReadCount(@Param("userId") String userId); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/IcMessageEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/IcMessageEntity.java new file mode 100644 index 0000000000..e13ee49b0a --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/IcMessageEntity.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 2022-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_message") +public class IcMessageEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * app=resi时,此列为gridId,其他情况暂定 * + */ + private String gridId; + + /** + * 被通知的用户id + */ + private String userId; + + /** + * 消息通知对象:居民端用户resi、政府端工作人员gov、运营端工作人员oper + */ + private String app; + + /** + * 消息分类 党建活动:party_act 党建日程:party_schedule + */ + private String messageType; + + /** + * 消息类型对应的业务Id + */ + private String targetId; + + /** + * 消息标题 + */ + private String title; + + /** + * 消息通知内容 + */ + private String messageContent; + + /** + * read已读、unread未读 + */ + private String readFlag; + + /** + * 调用者 + */ + private String referer; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java new file mode 100644 index 0000000000..d0547f4bbd --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/IcMessageService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.IcMessageDTO; +import com.epmet.dto.form.IcMessageFormDTO; +import com.epmet.dto.form.IcMessageListFormDTO; +import com.epmet.dto.form.ReadIcMessageFormDTO; +import com.epmet.entity.IcMessageEntity; + +import java.util.List; +import java.util.Map; + +/** + * 用户消息表(党建小助手) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +public interface IcMessageService extends BaseService { + + /** + * 默认查询 + * + * @param formDTO + * @return java.util.List + * @author generator + * @date 2022-08-19 + */ + PageData list(IcMessageListFormDTO formDTO); + + /** + * 单条查询 + * + * @param id + * @return IcMessageDTO + * @author generator + * @date 2022-08-19 + */ + IcMessageDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-19 + */ + void save(IcMessageDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-19 + */ + void update(IcMessageDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-19 + */ + void delete(String[] ids); + + void saveIcMessageList(List msgList); + + void read(ReadIcMessageFormDTO formDTO); + + Integer unReadCount(String userId); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java new file mode 100644 index 0000000000..b50ad37940 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/IcMessageServiceImpl.java @@ -0,0 +1,116 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.enums.DictTypeEnum; +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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.IcMessageDao; +import com.epmet.dto.IcMessageDTO; +import com.epmet.dto.form.IcMessageFormDTO; +import com.epmet.dto.form.IcMessageListFormDTO; +import com.epmet.dto.form.IcMoveInListFormDTO; +import com.epmet.dto.form.ReadIcMessageFormDTO; +import com.epmet.dto.result.AllGridsByUserIdResultDTO; +import com.epmet.dto.result.HouseInfoDTO; +import com.epmet.dto.result.IcMoveInListResultDTO; +import com.epmet.entity.IcMessageEntity; +import com.epmet.service.IcMessageService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 用户消息表(党建小助手) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@Service +public class IcMessageServiceImpl extends BaseServiceImpl implements IcMessageService { + + + @Override + public PageData list(IcMessageListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list = baseDao.selectMessageList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(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 IcMessageDTO get(String id) { + IcMessageEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcMessageDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcMessageDTO dto) { + IcMessageEntity entity = ConvertUtils.sourceToTarget(dto, IcMessageEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcMessageDTO dto) { + IcMessageEntity entity = ConvertUtils.sourceToTarget(dto, IcMessageEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public void saveIcMessageList(List msgList) { + List entityList = ConvertUtils.sourceToTarget(msgList, IcMessageEntity.class); + insertBatch(entityList); + } + + @Override + public void read(ReadIcMessageFormDTO formDTO) { + //id入参有值就按id修改,没值就按用户修改 + if(StringUtils.isNotBlank(formDTO.getId())){ + IcMessageEntity entity = new IcMessageEntity(); + entity.setId(formDTO.getId()); + entity.setReadFlag("read"); + updateById(entity); + return; + } + //批量修改某个人消息列表 + baseDao.upByUserId(formDTO); + } + + @Override + public Integer unReadCount(String userId) { + return baseDao.selectUnReadCount(userId); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java index d43fc223dc..3eea1f03d8 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java @@ -237,6 +237,17 @@ public class SystemMessageServiceImpl implements SystemMessageService { case SystemMessageType.PARTYMEMBER_RESI_IMPORT: topic=TopicConstants.PARTYMEMBER_RESI; break; + case SystemMessageType.PARTY_MEETING_MESSAGE: + topic=TopicConstants.IC_MESSAGE; + break; + case SystemMessageType.ZBWYH: + case SystemMessageType.ZBDYDH: + case SystemMessageType.DXZH: + case SystemMessageType.DANGKE: + case SystemMessageType.ZTDR: + case SystemMessageType.WMFWHD: + topic=TopicConstants.PARTY_BUILDING; + break; default: logger.error("getTopicByMsgType msgType:{} is not support for any topic", msgType); } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml index 3f1bfc5e5d..9dda1591c0 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml @@ -32,6 +32,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.19__create_ic_message.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.19__create_ic_message.sql new file mode 100644 index 0000000000..7c9804fa70 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.19__create_ic_message.sql @@ -0,0 +1,20 @@ +CREATE TABLE `ic_message` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `customer_id` varchar(64) NOT NULL COMMENT '客户id', + `grid_id` varchar(64) NOT NULL DEFAULT '*' COMMENT '暂定 *', + `user_id` varchar(64) NOT NULL COMMENT '被通知的用户id', + `app` varchar(32) NOT NULL COMMENT '消息通知对象:居民端用户resi、政府端工作人员gov、运营端工作人员oper', + `message_type` varchar(32) DEFAULT NULL COMMENT '消息分类 党建小助手:party', + `target_id` varchar(64) DEFAULT NULL COMMENT '消息类型对应的业务Id', + `title` varchar(255) NOT NULL COMMENT '消息标题', + `message_content` varchar(3096) NOT NULL COMMENT '消息通知内容', + `read_flag` varchar(32) NOT NULL DEFAULT 'unread' COMMENT 'read已读、unread未读', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人(发布消息的人)', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `REFERER` varchar(20) DEFAULT NULL COMMENT '调用者', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户消息表(党建小助手)'; \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.20__alter_ic_message.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.20__alter_ic_message.sql new file mode 100644 index 0000000000..d962d2763e --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.20__alter_ic_message.sql @@ -0,0 +1,2 @@ +ALTER TABLE epmet_message.`ic_message` +MODIFY COLUMN `message_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消息分类 \r\n党建活动:party_act \r\n党建日程:party_schedule \r\n' AFTER `app`; diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml new file mode 100644 index 0000000000..f8b8e8b286 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/IcMessageDao.xml @@ -0,0 +1,40 @@ + + + + + + + + + UPDATE ic_message + SET read_flag = 'read', + updated_by = #{userId}, + updated_time = NOW() + WHERE + del_flag = '0' + AND customer_id = #{customerId} + AND user_id = #{userId} + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-oss/epmet-oss-client/pom.xml b/epmet-module/epmet-oss/epmet-oss-client/pom.xml index 3b07913b6e..3f4f3057bd 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-client/pom.xml @@ -32,6 +32,12 @@ commons-fileupload commons-fileupload 1.3.3 + + + commons-io + commons-io + + net.coobird diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java index cbd2797bfb..1906e0a192 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java @@ -13,6 +13,10 @@ import java.io.Serializable; @Data public class UploadImgResultDTO implements Serializable { private String url; + /** + * 原始文件名 + */ + private String fileName; /** * 域名 */ diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index 4260920a27..e2477c17c2 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -55,6 +55,12 @@ com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery + + + commons-io + commons-io + + com.alibaba.cloud @@ -85,6 +91,12 @@ com.github.tobato fastdfs-client ${fastdfs.version} + + + commons-io + commons-io + + org.springframework diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 8946e7e73a..49160b176d 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -10,6 +10,7 @@ package com.epmet.controller; import com.epmet.cloud.CloudStorageConfig; import com.epmet.cloud.OssFactory; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -17,6 +18,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AliyunGroup; @@ -404,8 +406,10 @@ public class OssController { * @date 2021.08.03 16:23 */ @PostMapping("upload-resi-event-file") - public Result uploadResiEventFile(@RequestPart(value = "file") MultipartFile file, @RequestParam("customerId") String customerId) { - + public Result uploadResiEventFile(@LoginUser TokenDto tokenDto, @RequestPart(value = "file") MultipartFile file, @RequestParam(value = "customerId",required = false) String customerId) { + if (StringUtils.isBlank(customerId)){ + customerId = tokenDto.getCustomerId(); + } // 体积限制 int sizeMb = 10; int sizeThreshold = sizeMb * 1024 * 1024; // 大小限制10m diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index d55751762c..140d57ead6 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -279,6 +279,7 @@ public class OssServiceImpl extends BaseServiceImpl implement UploadImgResultDTO dto = new UploadImgResultDTO(); dto.setUrl(url); dto.setDomain(ossDomain); + dto.setFileName(file.getOriginalFilename()); return new Result().ok(dto); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml index e84091a0eb..ba1ebd9637 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml @@ -32,6 +32,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -131,6 +133,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java index 750bdaf71b..6d0f830117 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdditiveRuleDTO.java @@ -98,5 +98,5 @@ public class PointAdditiveRuleDTO implements Serializable { * 更新时间 */ private Date updatedTime; - + private String editFlag; } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PartyPointFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PartyPointFormDTO.java new file mode 100644 index 0000000000..8082e71192 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PartyPointFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/8/22 15:57 + */ +@Data +public class PartyPointFormDTO extends PageFormDTO implements Serializable { + private static final long serialVersionUID = -4811220825653023328L; + private String customerId; + private String userId; + private String year; + private String quarter; + private String month; + private String type; + private String dateType; + private String startDate; + private String endDate; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointModifyFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointModifyFormDTO.java index 71cff835cd..72dc80773c 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointModifyFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointModifyFormDTO.java @@ -4,6 +4,7 @@ import lombok.Data; import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.util.List; /** * @program: epmet-cloud @@ -59,5 +60,7 @@ public class PointModifyFormDTO implements Serializable { */ private Integer pointValue; + List customerIdList; + } diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointRecordResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointRecordResultDTO.java new file mode 100644 index 0000000000..df87b12e14 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointRecordResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/8/25 9:20 + */ +@Data +public class PartyPointRecordResultDTO implements Serializable { + private static final long serialVersionUID = -1480768520576719171L; + /** + * 日期 yyyy-MM-dd 字符串 + * */ + private String date; + private List dailyList; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointResultDTO.java new file mode 100644 index 0000000000..7449b9cc9d --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PartyPointResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/8/22 15:59 + */ +@Data +public class PartyPointResultDTO implements Serializable { + private static final long serialVersionUID = -3208641116926725011L; + private String title; + /** + * 日期yyyy-MM-dd + */ + private String date; + /** + * 时间hh:mm + */ + private String time; + private String point; + private String actId; + private String actTopic; + private String actType; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date actDate; + private String actAddress; +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointAdditiveRuleController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointAdditiveRuleController.java index 3f780d3ff9..0a461d1486 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointAdditiveRuleController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointAdditiveRuleController.java @@ -185,4 +185,10 @@ public class PointAdditiveRuleController { dto.setCustomerId(tokenDto.getCustomerId()); return pointAdditiveRuleService.modify(dto); } + + @PostMapping("initPartyRole") + public Result initPartyBuilidingRole(@RequestBody PointModifyFormDTO dto) { + pointAdditiveRuleService.initPartyBuilidingRole(dto.getCustomerIdList()); + return new Result(); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java index 885910a843..e37fb2055e 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java @@ -255,4 +255,19 @@ public class ResiPointController { ValidatorUtils.validateEntity(pageUserParam, CommonPageUserFormDTO.PageUserGroup.class); return new Result>().ok(pointAdditiveRecordService.getRecords(pageUserParam)); } + + /** + * 党建积分 + * @Param tokenDto + * @Param formDTO + * @Return {@link Result< PageData< PartyPointResultDTO>>} + * @Author zhaoqifeng + * @Date 2022/8/23 14:12 + */ + @PostMapping("pagePartyPoint") + public Result> pagePartyPoint(@LoginUser TokenDto tokenDto, @RequestBody PartyPointFormDTO formDTO ){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(pointActionLogService.pagePartyPoint(formDTO)); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java index 8b39e7d65b..5d99197d02 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdditiveRuleDao.java @@ -8,6 +8,7 @@ import com.epmet.dto.form.List4treeFormDTO; import com.epmet.dto.form.SubmitRewardFormDTO; import com.epmet.dto.result.List4ApplyResultDTO; import com.epmet.entity.PointAdditiveRuleEntity; +import com.epmet.entity.PointRuleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -87,4 +88,6 @@ public interface PointAdditiveRuleDao extends BaseDao { * @return com.epmet.dto.PointAdditiveRuleDTO */ PointAdditiveRuleDTO selectRuledetail(@Param("ruleId") String ruleId); + + PointRuleEntity selectByRoleName(@Param("customerId") String customerId, @Param("roleName") String roleName); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java index ae9cb21307..bbf57d8c27 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java @@ -19,7 +19,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.IcResiPointPageFormDTO; +import com.epmet.dto.form.PartyPointFormDTO; import com.epmet.dto.result.MyPointTaskResultDTO; +import com.epmet.dto.result.PartyPointResultDTO; import com.epmet.dto.result.ResiPointLogPeriodResultDTO; import com.epmet.dto.result.ResiPointPageResDTO; import com.epmet.entity.UserPointActionLogEntity; @@ -73,4 +75,6 @@ public interface UserPointActionLogDao extends BaseDao @Param("dateId")String dateId); List selectPageResiPoin(IcResiPointPageFormDTO formDTO); + + List getPagePartyPoint(PartyPointFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index 500f4bb632..bab9146143 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -22,6 +22,7 @@ public class RocketMQConsumerRegister extends MQAbstractRegister { register(consumerProperties, ConsomerGroupConstants.RESI_GROUP_POINT_OPERATION_GROUP, MessageModel.CLUSTERING, TopicConstants.RESI_GROUP, "*", new PointListener(userPointActionLogService)); register(consumerProperties, ConsomerGroupConstants.EPMET_HEART_POINT_OPERATION_GROUP, MessageModel.CLUSTERING, TopicConstants.EPMET_HEART, "*", new PointListener(userPointActionLogService)); register(consumerProperties, ConsomerGroupConstants.COMMUNITY_SERVICE_POINT_OPERATION_GROUP, MessageModel.CLUSTERING, TopicConstants.COMMUNITY_SERVICE, "*", new PointListener(userPointActionLogService)); + register(consumerProperties, ConsomerGroupConstants.PARTY_BUILDING_GROUP, MessageModel.CLUSTERING, TopicConstants.PARTY_BUILDING, "*", new PointListener(userPointActionLogService)); // ...其他监听器类似 } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/listener/PointListener.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/listener/PointListener.java index 63b4c44e2b..2204d7c7e2 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/listener/PointListener.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/mq/listener/PointListener.java @@ -113,6 +113,15 @@ public class PointListener implements MessageListenerConcurrently { //给需求服务方(志愿者)发放积分 grantServerPoint(msg); break; + case SystemMessageType.ZBWYH: + case SystemMessageType.ZBDYDH: + case SystemMessageType.DXZH: + case SystemMessageType.DANGKE: + case SystemMessageType.ZTDR: + case SystemMessageType.WMFWHD: + partyAct(msg); + default: + break; } } catch (RenException e) { @@ -218,6 +227,14 @@ public class PointListener implements MessageListenerConcurrently { }); } + private void partyAct(String msg) { + List formList = JSON.parseArray(msg, BasePointEventMsg.class); + + formList.forEach(obj -> { + userPointActionLogService.grantPointByEvent(obj.getEventTag(),obj); + }); + } + /** * 需求完成,给志愿者发放积分 * @param msg diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdditiveRuleService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdditiveRuleService.java index 4f9995158e..f067064af5 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdditiveRuleService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdditiveRuleService.java @@ -151,4 +151,13 @@ public interface PointAdditiveRuleService extends BaseService customerIdList); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java index 360edcb9cb..9e6ec53a68 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java @@ -24,9 +24,8 @@ import com.epmet.dto.UserPointActionLogDTO; import com.epmet.dto.form.CommonPageUserFormDTO; import com.epmet.dto.form.IcResiPointPageFormDTO; import com.epmet.dto.form.MyPointTaskFormDTO; -import com.epmet.dto.result.MyPointTaskResultDTO; -import com.epmet.dto.result.ResiPointLogListResultDTO; -import com.epmet.dto.result.ResiPointPageResDTO; +import com.epmet.dto.form.PartyPointFormDTO; +import com.epmet.dto.result.*; import com.epmet.entity.UserPointActionLogEntity; import dto.form.SendPointFormDTO; @@ -159,4 +158,14 @@ public interface UserPointActionLogService extends BaseService pageUserPoint(IcResiPointPageFormDTO formDTO); + + /** + * 党建积分 + * + * @Param formDTO + * @Return {@link PageData< PartyPointResultDTO>} + * @Author zhaoqifeng + * @Date 2022/8/22 16:04 + */ + List pagePartyPoint(PartyPointFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java index 9c0942d574..a5ceb74a93 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/BizPointUserTotalDetailServiceImpl.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.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -127,11 +128,10 @@ public class BizPointUserTotalDetailServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq("BIZ_TYPE", type) - .eq("OBJECT_ID", objectId) - .eq("USER_ID", userId) - .eq("DEL_FLAG", NumConstant.ZERO_STR); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BizPointUserTotalDetailEntity::getBizType, type) + .eq(StringUtils.isNotBlank(objectId), BizPointUserTotalDetailEntity::getObjectId, objectId) + .eq(BizPointUserTotalDetailEntity::getUserId, userId); BizPointUserTotalDetailEntity entity = baseDao.selectOne(wrapper); return ConvertUtils.sourceToTarget(entity, BizPointUserTotalDetailDTO.class); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java index 7146f105f1..1e7fecf8ce 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdditiveRuleServiceImpl.java @@ -1,16 +1,19 @@ 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.metadata.IPage; import com.epmet.common.enu.PointAddRuleEnum; 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.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.SystemMessageType; import com.epmet.dao.PointAdditiveRuleDao; import com.epmet.dao.PointApplyDao; import com.epmet.dto.CategorydetailResultDTO; @@ -27,7 +30,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; /** * 附加积分规则 @@ -200,7 +205,25 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl> list4tree(List4treeFormDTO dto) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, dto.getCustomerId()); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, "党建活动"); + PointAdditiveRuleEntity rule = baseDao.selectOne(wrapper); + List result = baseDao.selectList4tree(dto); + if (CollectionUtils.isNotEmpty(result)) { + result.forEach(item -> { + if (null != rule) { + if (item.getId().equals(rule.getId()) || item.getPid().equals(rule.getId())) { + item.setEditFlag(NumConstant.ZERO_STR); + } else { + item.setEditFlag(NumConstant.ONE_STR); + } + } else { + item.setEditFlag(NumConstant.ONE_STR); + } + }); + } return new Result>().ok(result); } @@ -267,4 +290,161 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl customerIdList) { + customerIdList.forEach(customerId -> { + //党建积分 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, "党建积分"); + PointAdditiveRuleEntity djjf = baseDao.selectOne(wrapper); + if (null == djjf) { + djjf = new PointAdditiveRuleEntity(); + djjf.setCustomerId(customerId); + djjf.setType("category"); + djjf.setApplyFlag(NumConstant.ONE_STR); + djjf.setCategoryCode("party_building"); + djjf.setCategoryName("党建积分"); + djjf.setPid(NumConstant.ZERO_STR); + djjf.setPids(""); + baseDao.insert(djjf); + } + //党建活动 + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, "党建活动"); + PointAdditiveRuleEntity djhd = baseDao.selectOne(wrapper); + if (null == djhd) { + djhd = new PointAdditiveRuleEntity(); + djhd.setCustomerId(customerId); + djhd.setType("category"); + djhd.setApplyFlag(NumConstant.ONE_STR); + djhd.setCategoryCode("party_building"); + djhd.setCategoryName("党建活动"); + djhd.setPid(djjf.getId()); + djhd.setPids(djjf.getId()); + baseDao.insert(djhd); + } + //支部委员会 + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, SystemMessageType.ZBWYH); + PointAdditiveRuleEntity zbdyh = baseDao.selectOne(wrapper); + if (null == zbdyh) { + zbdyh = new PointAdditiveRuleEntity(); + zbdyh.setCustomerId(customerId); + zbdyh.setType("rule"); + zbdyh.setApplyFlag(NumConstant.ONE_STR); + zbdyh.setCategoryCode("party_building"); + zbdyh.setRuleName(SystemMessageType.ZBWYH); + zbdyh.setPid(djhd.getId()); + zbdyh.setPids(djhd.getPids().concat(StrConstant.COLON).concat(djhd.getId())); + zbdyh.setPointValue(10); + baseDao.insert(zbdyh); + } + //支部党员大会 + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, SystemMessageType.ZBDYDH); + PointAdditiveRuleEntity zbdydh = baseDao.selectOne(wrapper); + if (null == zbdydh) { + zbdydh = new PointAdditiveRuleEntity(); + zbdydh.setCustomerId(customerId); + zbdydh.setType("rule"); + zbdydh.setApplyFlag(NumConstant.ONE_STR); + zbdydh.setCategoryCode("party_building"); + zbdydh.setRuleName(SystemMessageType.ZBDYDH); + zbdydh.setPid(djhd.getId()); + zbdydh.setPids(djhd.getPids().concat(StrConstant.COLON).concat(djhd.getId())); + zbdydh.setPointValue(20); + baseDao.insert(zbdydh); + } + //党小组会 + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, SystemMessageType.DXZH); + PointAdditiveRuleEntity dxzh = baseDao.selectOne(wrapper); + if (null == dxzh) { + dxzh = new PointAdditiveRuleEntity(); + dxzh.setCustomerId(customerId); + dxzh.setType("rule"); + dxzh.setApplyFlag(NumConstant.ONE_STR); + dxzh.setCategoryCode("party_building"); + dxzh.setRuleName(SystemMessageType.DXZH); + dxzh.setPid(djhd.getId()); + dxzh.setPids(djhd.getPids().concat(StrConstant.COLON).concat(djhd.getId())); + dxzh.setPointValue(10); + baseDao.insert(dxzh); + } + //党课 + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, SystemMessageType.DANGKE); + PointAdditiveRuleEntity dk = baseDao.selectOne(wrapper); + if (null == dk) { + dk = new PointAdditiveRuleEntity(); + dk.setCustomerId(customerId); + dk.setType("rule"); + dk.setApplyFlag(NumConstant.ONE_STR); + dk.setCategoryCode("party_building"); + dk.setRuleName(SystemMessageType.DANGKE); + dk.setPid(djhd.getId()); + dk.setPids(djhd.getPids().concat(StrConstant.COLON).concat(djhd.getId())); + dk.setPointValue(15); + baseDao.insert(dk); + } + //主题党日 + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, SystemMessageType.ZTDR); + PointAdditiveRuleEntity ztdr = baseDao.selectOne(wrapper); + if (null == ztdr) { + ztdr = new PointAdditiveRuleEntity(); + ztdr.setCustomerId(customerId); + ztdr.setType("rule"); + ztdr.setApplyFlag(NumConstant.ONE_STR); + ztdr.setCategoryCode("party_building"); + ztdr.setRuleName(SystemMessageType.ZTDR); + ztdr.setPid(djhd.getId()); + ztdr.setPids(djhd.getPids().concat(StrConstant.COLON).concat(djhd.getId())); + ztdr.setPointValue(15); + baseDao.insert(ztdr); + } + //为民服务活动 + wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(PointAdditiveRuleEntity::getCustomerId, customerId); + wrapper.eq(PointAdditiveRuleEntity::getCategoryCode, "party_building"); + wrapper.eq(PointAdditiveRuleEntity::getCategoryName, SystemMessageType.WMFWHD); + PointAdditiveRuleEntity wmfwhd = baseDao.selectOne(wrapper); + if (null == wmfwhd) { + wmfwhd = new PointAdditiveRuleEntity(); + wmfwhd.setCustomerId(customerId); + wmfwhd.setType("rule"); + wmfwhd.setApplyFlag(NumConstant.ONE_STR); + wmfwhd.setCategoryCode("party_building"); + wmfwhd.setRuleName(SystemMessageType.WMFWHD); + wmfwhd.setPid(djhd.getId()); + wmfwhd.setPids(djhd.getPids().concat(StrConstant.COLON).concat(djhd.getId())); + wmfwhd.setPointValue(15); + baseDao.insert(wmfwhd); + } + }); + } + } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java index 0fbb19a3d8..d8717a5313 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java @@ -30,6 +30,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dao.PointAdditiveRuleDao; import com.epmet.dao.UserPointActionLogDao; import com.epmet.dto.BizPointTotalDetailDTO; import com.epmet.dto.BizPointUserTotalDetailDTO; @@ -38,15 +39,15 @@ import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.CommonPageUserFormDTO; import com.epmet.dto.form.IcResiPointPageFormDTO; import com.epmet.dto.form.MyPointTaskFormDTO; -import com.epmet.dto.result.MyPointTaskResultDTO; -import com.epmet.dto.result.ResiPointLogListResultDTO; -import com.epmet.dto.result.ResiPointLogPeriodResultDTO; -import com.epmet.dto.result.ResiPointPageResDTO; +import com.epmet.dto.form.PartyPointFormDTO; +import com.epmet.dto.result.*; import com.epmet.entity.PointRuleEntity; import com.epmet.entity.UserPointActionLogEntity; import com.epmet.entity.UserPointStatisticalDailyEntity; import com.epmet.entity.UserPointTotalEntity; import com.epmet.feign.EpmetHeartOpenFeignClient; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO; +import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import com.epmet.service.*; import com.epmet.utils.DimIdGenerator; import com.epmet.utils.ModuleConstant; @@ -56,14 +57,15 @@ import com.github.pagehelper.PageInfo; import com.google.common.collect.Maps; import dto.form.SendPointFormDTO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; +import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; @@ -89,6 +91,10 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl page(Map params) { @@ -207,6 +213,9 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.select("IFNULL(SUM(POINT), 0) as POINT") .eq("BIZ_TYPE", type) - .eq("OBJECT_ID", objectId) + .eq(StringUtils.isNotBlank(objectId), "OBJECT_ID", objectId) .eq("USER_ID", userId) .eq("ACTION_FLAG", "plus") .eq("DEL_FLAG", NumConstant.ZERO_STR); @@ -579,6 +611,86 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl(pageInfo.getList(), pageInfo.getTotal()); } + /** + * 党建积分 + * + * @param formDTO + * @Param formDTO + * @Return {@link List< PartyPointRecordResultDTO >} + * @Author zhaoqifeng + * @Date 2022/8/22 16:04 + */ + @Override + public List pagePartyPoint(PartyPointFormDTO formDTO) { + List result = new LinkedList<>(); + if (StringUtils.isNotBlank(formDTO.getYear())) { + if (StringUtils.isNotBlank(formDTO.getQuarter())) { + if (StringUtils.isNotBlank(formDTO.getMonth())) { + formDTO.setStartDate(formDTO.getYear().concat(formDTO.getMonth())); + formDTO.setDateType(NumConstant.TWO_STR); + } else { + switch (formDTO.getQuarter()) { + case NumConstant.ONE_STR: + formDTO.setStartDate(formDTO.getYear().concat("01")); + formDTO.setEndDate(formDTO.getYear().concat("03")); + break; + case NumConstant.TWO_STR: + formDTO.setStartDate(formDTO.getYear().concat("04")); + formDTO.setEndDate(formDTO.getYear().concat("06")); + break; + case NumConstant.THREE_STR: + formDTO.setStartDate(formDTO.getYear().concat("07")); + formDTO.setEndDate(formDTO.getYear().concat("09")); + break; + case NumConstant.FOUR_STR: + formDTO.setStartDate(formDTO.getYear().concat("10")); + formDTO.setEndDate(formDTO.getYear().concat("12")); + break; + default: + break; + } + formDTO.setDateType(NumConstant.THREE_STR); + } + } else if (StringUtils.isNotBlank(formDTO.getMonth())) { + formDTO.setStartDate(formDTO.getYear().concat(formDTO.getMonth())); + formDTO.setDateType(NumConstant.TWO_STR); + } else { + formDTO.setStartDate(formDTO.getYear()); + formDTO.setDateType(NumConstant.ONE_STR); + } + } else { + formDTO.setDateType(NumConstant.FOUR_STR); + } + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list =baseDao.getPagePartyPoint(formDTO); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + Result actInfo = resiPartyMemberOpenFeignClient.actDetail(item.getActId()); + if (actInfo.success() && null != actInfo.getData()) { + item.setActType(actInfo.getData().getActTypeName()); + item.setActAddress(actInfo.getData().getAddress()); + item.setActDate(actInfo.getData().getHoldTime()); + item.setActTopic(actInfo.getData().getTopic()); + } + }); + + Map> map = + list.stream().collect(Collectors.groupingBy(PartyPointResultDTO::getDate)); + + Map> sortedMap = Maps.newLinkedHashMap(); + map.entrySet().stream().sorted(Map.Entry.>comparingByKey().reversed()) + .forEachOrdered(e -> sortedMap.put(e.getKey(), e.getValue())); + sortedMap.forEach((key, value) -> { + PartyPointRecordResultDTO o = new PartyPointRecordResultDTO(); + o.setDate(key); + o.setDailyList(value); + result.add(o); + }); + + } + return result; + } + /** * 需求完成,给志愿者发放积分 * @param list diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml index e9806784c0..63b721cef6 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml @@ -29,6 +29,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -120,6 +122,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -155,4 +163,4 @@ shutdown: rocketmq: enable: @rocketmq.enable@ - name-server: @rocketmq.nameserver@ \ No newline at end of file + name-server: @rocketmq.nameserver@ diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml index 84a26d63e7..0cb0a8b1a5 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdditiveRuleDao.xml @@ -122,6 +122,31 @@ WHERE DEL_FLAG='0' AND ID=#{ruleId} + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml index c6136f2202..9797bd676f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml @@ -157,5 +157,47 @@ ORDER BY temp.sort ASC + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DingMiniInfoDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DingMiniInfoDTO.java new file mode 100644 index 0000000000..19ebfacdd9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DingMiniInfoDTO.java @@ -0,0 +1,89 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 钉钉小程序信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +@Data +public class DingMiniInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * + */ + private String suiteId; + + /** + * + */ + private String appId; + + /** + * + */ + private String miniAppId; + + /** + * + */ + private String suiteName; + + /** + * + */ + private String suiteKey; + + /** + * + */ + private String suiteSecret; + + private String token; + + private String aesKey; + + /** + * + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenSyncBizDataDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenSyncBizDataDTO.java new file mode 100644 index 0000000000..12dac445f0 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenSyncBizDataDTO.java @@ -0,0 +1,99 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +@Data +public class OpenSyncBizDataDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 第三方企业应用的suiteid加下划线0 + */ + private String subscribeId; + + private String suiteKey; + + /** + * 第三方企业应用的corpid + */ + private String corpId; + + /** + * 第三方企业应用的suiteid + */ + private String bizId; + + /** + * 数据为Json格式 + */ + private String bizData; + + /** + * 2:第三方企业应用票据; +4:企业授权变更,包含授权、解除授权、授权变更; +7:第三方企业应用变更,包含停用、启用、删除(删除保留授权); +13:企业用户变更,包含用户添加、修改、删除; +14:企业部门变更,包含部门添加、修改、删除; +15:企业角色变更,包含角色添加、修改、删除; +16:企业变更,包含企业修改、删除; +17:市场订单; +20:企业外部联系人变更,包含添加、修改、删除; +22:ISV自定义审批; +25:家校通讯录1.0(Deprecated)信息变更。家校通讯录升级,请查看家校通讯录2.0数据推送; +32:智能硬件绑定类型; +37:因订单到期或者用户退款等导致的服务关闭,目前仅推送因退款等导致的服务关闭; +50:家校通讯录2.0,部门信息变更; +51:家校通讯录2.0,人员信息变更; +63:应用试用记录回调信息; +66:工作台组件变更回调事件; +67:钉钉假期相关回调事件; +133:CRM客户动态相关数据回调事件; +137:人事平台员工异动V2相关数据回调事件; +139:异步转译通讯录id任务完成通知; +165:人事平台员工档案变动事件相关数据的回调事件; +175:人事解决方案变更事件; + */ + private String bizType; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date updatedTime; + + /** + * + */ + private String updatedBy; + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ExemptLoginUserDetailFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ExemptLoginUserDetailFormDTO.java new file mode 100644 index 0000000000..7e84993d2f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ExemptLoginUserDetailFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/14 14:52 + * @DESC + */ +@Data +public class ExemptLoginUserDetailFormDTO implements Serializable { + + private static final long serialVersionUID = -4333806195203619201L; + + public interface ExemptLoginUserDetailForm{} + + @NotBlank(message = "code不能为空",groups = ExemptLoginUserDetailForm.class) + private String code; + + @NotBlank(message = "corpId不能为空",groups = ExemptLoginUserDetailForm.class) + private String corpId; + + @NotBlank(message = "miniAppId不能为空",groups = ExemptLoginUserDetailForm.class) + private String miniAppId; +} diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index b183b574cc..353e5b47bf 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -157,7 +157,16 @@ rocketmq-acl 4.9.2 - + + dingtalk-spring-boot-starter + com.taobao + 1.0.0 + + + commons-codec + commons-codec + 1.15 + @@ -229,7 +238,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd - + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java index 3efd642c87..21c518e033 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java @@ -1,6 +1,7 @@ package com.epmet; import com.epmet.mq.properties.RocketMQProperties; +import com.taobao.dingtalk.spring.annotations.EnableDingTalk; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -8,6 +9,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; +@EnableDingTalk @EnableConfigurationProperties(RocketMQProperties.class) @SpringBootApplication @EnableDiscoveryClient diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/dingtalk/CallbackController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/dingtalk/CallbackController.java new file mode 100644 index 0000000000..8164c4cdbe --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/dingtalk/CallbackController.java @@ -0,0 +1,155 @@ +package com.epmet.controller.dingtalk; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.aliyun.dingtalk.util.DingCallbackCrypto; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO; +import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dao.OpenSyncBizDataDao; +import com.epmet.dto.DingMiniInfoDTO; +import com.epmet.dto.form.ExemptLoginUserDetailFormDTO; +import com.epmet.entity.OpenSyncBizDataEntity; +import com.epmet.redis.DingDingCallbackRedis; +import com.epmet.service.DingTalkService; +import com.epmet.service.OpenSyncBizDataService; +import org.apache.commons.collections4.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * ISV 小程序回调信息处理 + */ +@RestController +@RequestMapping("/dingTalk") +public class CallbackController { + + private final Logger log = LoggerFactory.getLogger(getClass()); + + /** + * 创建应用,验证回调URL创建有效事件(第一次保存回调URL之前) + */ + private static final String EVENT_CHECK_CREATE_SUITE_URL = "check_create_suite_url"; + + /** + * 创建应用,验证回调URL变更有效事件(第一次保存回调URL之后) + */ + private static final String EVENT_CHECK_UPADTE_SUITE_URL = "check_update_suite_url"; + + /** + * suite_ticket推送事件 + */ + private static final String EVENT_SUITE_TICKET = "suite_ticket"; + + /** + * 企业授权开通应用事件 + */ + private static final String EVENT_TMP_AUTH_CODE = "tmp_auth_code"; + + private static final String EVENT_SYNC_HTTP_PUSH_HIGH = "SYNC_HTTP_PUSH_HIGH"; + + @Autowired + private OpenSyncBizDataService openSyncBizDataService; + @Autowired + private OpenSyncBizDataDao openSyncBizDataDao; + @Autowired + private DingDingCallbackRedis dingCallbackRedis; + @Autowired + private DingTalkService dingTalkService; + + @PostMapping(value = "dingCallback") + public Object dingCallback( + @RequestParam(value = "signature") String signature, + @RequestParam(value = "timestamp") Long timestamp, + @RequestParam(value = "nonce") String nonce, + @RequestParam(value = "suiteKey") String suiteKey, + @RequestBody(required = false) JSONObject body + ) { + String params = "signature:" + signature + " timestamp:" + timestamp + " nonce:" + nonce + " body:" + body + "suiteKey::"+suiteKey; + try { + log.info("begin callback:" + params); + DingMiniInfoDTO dingMiniInfo = openSyncBizDataDao.getDingMiniInfo(suiteKey); + DingCallbackCrypto dingTalkEncryptor = new DingCallbackCrypto(dingMiniInfo.getToken(), dingMiniInfo.getAesKey(), suiteKey); + + // 从post请求的body中获取回调信息的加密数据进行解密处理 + String encrypt = body.getString("encrypt"); + String plainText = dingTalkEncryptor.getDecryptMsg(signature, timestamp.toString(), nonce, encrypt); + JSONObject callBackContent = JSON.parseObject(plainText); + + log.info("推来的消息体:"+plainText); + + // 根据回调事件类型做不同的业务处理 + String eventType = callBackContent.getString("EventType"); + if (EVENT_CHECK_CREATE_SUITE_URL.equals(eventType)) { + log.info("验证新创建的回调URL有效性: " + plainText); + } else if (EVENT_CHECK_UPADTE_SUITE_URL.equals(eventType)) { + log.info("验证更新回调URL有效性: " + plainText); + } else if (EVENT_SUITE_TICKET.equals(eventType)) { + // suite_ticket用于用签名形式生成accessToken(访问钉钉服务端的凭证),需要保存到应用的db。 + // 钉钉会定期向本callback url推送suite_ticket新值用以提升安全性。 + // 应用在获取到新的时值时,保存db成功后,返回给钉钉success加密串(如本demo的return) + log.info("应用suite_ticket数据推送: " + plainText); + } else if (EVENT_TMP_AUTH_CODE.equals(eventType)) { + // 本事件应用应该异步进行授权开通企业的初始化,目的是尽最大努力快速返回给钉钉服务端。用以提升企业管理员开通应用体验 + // 即使本接口没有收到数据或者收到事件后处理初始化失败都可以后续再用户试用应用时从前端获取到corpId并拉取授权企业信息,进而初始化开通及企业。 + log.info("企业授权开通应用事件: " + plainText); + } else if (EVENT_SYNC_HTTP_PUSH_HIGH.equals(eventType)){ + List> bizData = (List>) callBackContent.get("bizData"); + if (CollectionUtils.isNotEmpty(bizData)){ + List list = new ArrayList<>(); + bizData.forEach(b -> { + OpenSyncBizDataEntity e = new OpenSyncBizDataEntity(); + e.setSuiteKey(suiteKey); + e.setSubscribeId(b.get("subscribe_id").toString()); + e.setCorpId(b.get("corp_id").toString()); + e.setBizId(b.get("biz_id").toString()); + e.setBizData(b.get("biz_data").toString()); + e.setBizType(b.get("biz_type").toString()); + list.add(e); + openSyncBizDataService.delete(e); + if (e.getBizType().equals(NumConstant.TWO_STR)){ + Map ticketMap = JSON.parseObject(e.getBizData(), Map.class); + dingCallbackRedis.set(suiteKey,ticketMap.get("suiteTicket")); + } + }); + openSyncBizDataService.insertBatch(list); + } + } else{ + // 其他类型事件处理 + } + + // 返回success的加密信息表示回调处理成功 + return dingTalkEncryptor.getEncryptedMap("success", timestamp, nonce); + } catch (Exception e) { + //失败的情况,应用的开发者应该通过告警感知,并干预修复 + log.error("process callback fail." + params, e); + return "fail"; + } + } + + @PostMapping("getExemptLoginUserDetail") + public Result getExemptLoginUserDetail(@RequestBody ExemptLoginUserDetailFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ExemptLoginUserDetailFormDTO.ExemptLoginUserDetailForm.class); + return new Result().ok(dingTalkService.getExemptLoginUserDetail(formDTO)); + } + + /** + * Desc: 获取钉钉小程序信息 + * @param formDTO + * @author zxc + * @date 2022/9/15 10:46 + */ + @PostMapping("getDingMiniInfo") + public Result getDingMiniInfo(@RequestBody DingMiniInfoFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, DingMiniInfoFormDTO.DingMiniInfoForm.class); + return new Result().ok(dingTalkService.getDingMiniInfo(formDTO)); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenSyncBizDataDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenSyncBizDataDao.java new file mode 100644 index 0000000000..4737dabf93 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenSyncBizDataDao.java @@ -0,0 +1,29 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.DingMiniInfoDTO; +import com.epmet.dto.OpenSyncBizDataDTO; +import com.epmet.entity.OpenSyncBizDataEntity; +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 2022-09-14 + */ +@Mapper +public interface OpenSyncBizDataDao extends BaseDao { + + DingMiniInfoDTO getDingMiniInfo(@Param("suiteKey")String suiteKey); + + DingMiniInfoDTO getDingMiniInfoByAppId(@Param("miniAppId")String miniAppId); + + Integer delOpenSyncData(OpenSyncBizDataEntity e); + + List getOpenSyncData(@Param("suiteKey")String suiteKey, @Param("bizType")String bizType,@Param("corpId")String corpId); + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenSyncBizDataEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenSyncBizDataEntity.java new file mode 100644 index 0000000000..b881b457bb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenSyncBizDataEntity.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; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("open_sync_biz_data") +public class OpenSyncBizDataEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 第三方企业应用的suiteid加下划线0 + */ + private String subscribeId; + + private String suiteKey; + + /** + * 第三方企业应用的corpid + */ + private String corpId; + + /** + * 第三方企业应用的suiteid + */ + private String bizId; + + /** + * 数据为Json格式 + */ + private String bizData; + + /** + * 2:第三方企业应用票据; +4:企业授权变更,包含授权、解除授权、授权变更; +7:第三方企业应用变更,包含停用、启用、删除(删除保留授权); +13:企业用户变更,包含用户添加、修改、删除; +14:企业部门变更,包含部门添加、修改、删除; +15:企业角色变更,包含角色添加、修改、删除; +16:企业变更,包含企业修改、删除; +17:市场订单; +20:企业外部联系人变更,包含添加、修改、删除; +22:ISV自定义审批; +25:家校通讯录1.0(Deprecated)信息变更。家校通讯录升级,请查看家校通讯录2.0数据推送; +32:智能硬件绑定类型; +37:因订单到期或者用户退款等导致的服务关闭,目前仅推送因退款等导致的服务关闭; +50:家校通讯录2.0,部门信息变更; +51:家校通讯录2.0,人员信息变更; +63:应用试用记录回调信息; +66:工作台组件变更回调事件; +67:钉钉假期相关回调事件; +133:CRM客户动态相关数据回调事件; +137:人事平台员工异动V2相关数据回调事件; +139:异步转译通讯录id任务完成通知; +165:人事平台员工档案变动事件相关数据的回调事件; +175:人事解决方案变更事件; + */ + private String bizType; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/DingDingCallbackRedis.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/DingDingCallbackRedis.java new file mode 100644 index 0000000000..c6b02998f9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/DingDingCallbackRedis.java @@ -0,0 +1,46 @@ +package com.epmet.redis; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dao.OpenSyncBizDataDao; +import com.epmet.dto.OpenSyncBizDataDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2022/9/14 10:32 + * @DESC + */ +@Component +public class DingDingCallbackRedis { + @Autowired + private RedisUtils redisUtils; + @Autowired + private OpenSyncBizDataDao openSyncBizDataDao; + + public void set(String suiteKey,String suiteTicket){ + String key = RedisKeys.getSuiteTicketKey(suiteKey); + redisUtils.set(key,suiteTicket,-1); + } + + public String get(String suiteKey){ + String ticket = redisUtils.getString(RedisKeys.getSuiteTicketKey(suiteKey)); + if (StringUtils.isNotBlank(ticket)){ + return ticket; + } + List openSyncData = openSyncBizDataDao.getOpenSyncData(suiteKey, NumConstant.TWO_STR, null); + if (null == openSyncData){ + throw new EpmetException("未查询到"+suiteKey+"的ticket"); + } + Map map = JSON.parseObject(openSyncData.get(NumConstant.ZERO).getBizData(), Map.class); + return map.get("suiteTicket").toString(); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingTalkService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingTalkService.java new file mode 100644 index 0000000000..ca0ba390f8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingTalkService.java @@ -0,0 +1,24 @@ +package com.epmet.service; + +import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO; +import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache; +import com.epmet.dto.form.ExemptLoginUserDetailFormDTO; + +/** + * @Author zxc + * @DateTime 2022/9/14 14:56 + * @DESC + */ +public interface DingTalkService { + + Object getExemptLoginUserDetail(ExemptLoginUserDetailFormDTO formDTO); + + /** + * Desc: 获取钉钉小程序信息 + * @param formDTO + * @author zxc + * @date 2022/9/15 10:46 + */ + DingMiniInfoCache getDingMiniInfo(DingMiniInfoFormDTO formDTO); + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/OpenSyncBizDataService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/OpenSyncBizDataService.java new file mode 100644 index 0000000000..64f3668e38 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/OpenSyncBizDataService.java @@ -0,0 +1,80 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OpenSyncBizDataDTO; +import com.epmet.entity.OpenSyncBizDataEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +public interface OpenSyncBizDataService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-09-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-09-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OpenSyncBizDataDTO + * @author generator + * @date 2022-09-14 + */ + OpenSyncBizDataDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-14 + */ + void save(OpenSyncBizDataDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-14 + */ + void update(OpenSyncBizDataDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-09-14 + */ + void delete(String[] ids); + + void delete(OpenSyncBizDataEntity condition); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingTalkServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingTalkServiceImpl.java new file mode 100644 index 0000000000..ec239a3ee9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingTalkServiceImpl.java @@ -0,0 +1,68 @@ +package com.epmet.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.aliyun.dingtalk.module.DingTalkResult; +import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.OpenSyncBizDataDao; +import com.epmet.dto.DingMiniInfoDTO; +import com.epmet.dto.form.ExemptLoginUserDetailFormDTO; +import com.epmet.redis.DingDingCallbackRedis; +import com.epmet.service.DingTalkService; +import com.taobao.dingtalk.client.DingTalkClientToken; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2022/9/14 14:57 + * @DESC + */ +@Service +@Slf4j +public class DingTalkServiceImpl implements DingTalkService { + + @Autowired + private DingTalkClientToken dingTalkClientToken; + @Autowired + private OpenSyncBizDataDao openSyncBizDataDao; + @Autowired + private DingDingCallbackRedis dingCallbackRedis; + @Autowired + private RedisUtils redisUtils; + + @Override + public Object getExemptLoginUserDetail(ExemptLoginUserDetailFormDTO formDTO) { + DingMiniInfoDTO dingMiniInfo = openSyncBizDataDao.getDingMiniInfoByAppId(formDTO.getMiniAppId()); + DingTalkResult exemptLoginUserDetail = dingTalkClientToken.getExemptLoginUserDetail(formDTO.getCorpId(), dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret(), dingCallbackRedis.get(dingMiniInfo.getSuiteKey()), formDTO.getCode()); + return exemptLoginUserDetail.getData(); + } + + /** + * Desc: 获取钉钉小程序信息 + * @param formDTO + * @author zxc + * @date 2022/9/15 10:46 + */ + @Override + public DingMiniInfoCache getDingMiniInfo(DingMiniInfoFormDTO formDTO) { + String key = RedisKeys.getDingMiniInfoKey(formDTO.getMiniAppId()); + Map dingMiniInfoMap = redisUtils.hGetAll(key); + if (!CollectionUtils.isEmpty(dingMiniInfoMap)) { + return ConvertUtils.mapToEntity(dingMiniInfoMap,DingMiniInfoCache.class); + } + DingMiniInfoDTO dingMiniInfo = openSyncBizDataDao.getDingMiniInfoByAppId(formDTO.getMiniAppId()); + if (null != dingMiniInfo){ + redisUtils.hMSet(key, BeanUtil.beanToMap(dingMiniInfo)); + return ConvertUtils.sourceToTarget(dingMiniInfo,DingMiniInfoCache.class); + } + return null; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/OpenSyncBizDataServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/OpenSyncBizDataServiceImpl.java new file mode 100644 index 0000000000..85d508cbe4 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/OpenSyncBizDataServiceImpl.java @@ -0,0 +1,88 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.OpenSyncBizDataDao; +import com.epmet.dto.OpenSyncBizDataDTO; +import com.epmet.entity.OpenSyncBizDataEntity; +import com.epmet.service.OpenSyncBizDataService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-14 + */ +@Service +public class OpenSyncBizDataServiceImpl extends BaseServiceImpl implements OpenSyncBizDataService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OpenSyncBizDataDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OpenSyncBizDataDTO.class); + } + + 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 OpenSyncBizDataDTO get(String id) { + OpenSyncBizDataEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OpenSyncBizDataDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OpenSyncBizDataDTO dto) { + OpenSyncBizDataEntity entity = ConvertUtils.sourceToTarget(dto, OpenSyncBizDataEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OpenSyncBizDataDTO dto) { + OpenSyncBizDataEntity entity = ConvertUtils.sourceToTarget(dto, OpenSyncBizDataEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(OpenSyncBizDataEntity condition) { + baseDao.delOpenSyncData(condition); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml index 388b63d125..c85863f95f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml @@ -29,6 +29,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -154,6 +156,9 @@ third: - https://epmet-ext10.elinkservice.cn dingTalk: + appKey: dingo53zvltapzrstzbo + appsecret: o1hjFvWKwLG1GIuivX0nbynqFvFDZiI3CoqLyhdZXhghXMEsr34LKCud0Rz2Hd16 + agentid: 1880131092 robot: webHook: @dingTalk.robot.webHook@ secret: @dingTalk.robot.secret@ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql new file mode 100644 index 0000000000..9d13ecb53c --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql @@ -0,0 +1,51 @@ +CREATE TABLE `ding_mini_info` ( + `ID` varchar(64) NOT NULL COMMENT 'ID', + `SUITE_ID` varchar(255) NOT NULL, + `APP_ID` varchar(255) NOT NULL, + `MINI_APP_ID` varchar(255) NOT NULL, + `SUITE_NAME` varchar(255) NOT NULL, + `SUITE_KEY` varchar(255) NOT NULL, + `SUITE_SECRET` varchar(255) NOT NULL, + `TOKEN` varchar(255) NOT NULL, + `AES_KEY` varchar(255) DEFAULT NULL, + `DEL_FLAG` int(11) NOT NULL, + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='钉钉小程序信息'; + +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', '1903117866', '119453', '5000000003010492', '随时讲', 'suiter5nqmiwzwq4lodee', 'hHKnno_nGouRjB5LVFn0k11O20CCEhf9gaiErLNN0lKUExe5VzZrB8tN9hdRrhPA', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1001', '1905492491', '', '5000000003022462', '随手拍', 'dingu6fdnlcqbyr1fdxu', 'r-Fi8awDyD5rBCPS1NnoBEqkrq0InheNMkc0xAOKvkD0-47oDFiClbJRiFQy-JO1', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:54:09', '烟台企业内部应用', '2022-09-22 16:54:16'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1002', '1905441943', '', '5000000003021766', '随时讲', 'dinguizzwnfnvjs6nntz', 'uUqJYGyoOjOBcc1bC5jCD2lipOaUxbrdZyeXSWKq1JfX7tWQYNz6ZfvvybWBENKS', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:55:25', '烟台企业内部应用', '2022-09-22 16:55:28'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1003', '1905455843', '', '5000000003022737', '我的报事', 'dingllzzs6g8u7htteg5', 'fjTJe31Ot4FylmO_hWY-aRckikdPKA2u640GjiW68R4JItFG8picnwFd8d9gLFm_', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:56:29', '烟台企业内部应用', '2022-09-22 16:56:37'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1004', '1905486539', '', '5000000003022522', '实时动态', 'dingf8hpd485mlgaov7c', 'CmUSLH-M-tDgpwRTmiAXf9p3v-hLZ27J1kscxUg3118EKX4mV-JLJ073PMxC6We1', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:57:21', '烟台企业内部应用', '2022-09-22 16:57:24'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', '1903003033', '', '5000000003009021', '随手拍', 'suite44k7hacfbfx4zazi', 'EtamucmdHdQMe5nM7YW0qwn2b3m6UJXEk3JAr3ICoisZdZdcIBXsFI1uUHf9xUrl', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073948', '27501006', '119450', '5000000002934668', '随手拍', 'suitew6ccvkquinmrghqy', 'TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB', 'qN6Mg1XljdeHzVg2KeZGmBgY5', 'CzBxlN3uVCo6S3AzB8gfkUMBQxYsrRUdXRqX4XcYcyw', 0, 0, '亿联第三方企业应用', '2022-09-14 11:09:15', '亿联第三方企业应用', '2022-09-14 11:09:15'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073949', '27501007', '119451', '5000000002934374', '随时讲', 'suitezhyj12glsrp8em0f', '-z5Q_lvMP6l7fTzlArEzUT8D_-5pvqBQaJMuTGHoXnz0nuiqGQMZ8aeya_cxTsN-', 'rKs2lIN1Oe6K34AtASGOQDh', 'a7hsIIHVTiIB7SQwOiGNgxVo7zAigGUk4InTUNIikWy', 0, 0, '亿联第三方企业应用', '2022-09-14 11:11:13', '亿联第三方企业应用', '2022-09-14 11:11:13'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073950', '27501008', '119452', '5000000002934456', '我的报事', 'suite5yxliro6wawv514w', 'aQxiPi7DwJSUa9HlbUU_L7Q4wGCLEDmgf__Ffx75cTn3jZwuHy9vdl-9Iv5FeyJU', 'vTUvaf6QtOJZsa1h7Wkoteo', 'csRpvVFGL7Cf1N9ubajix8tDWhCllROhaxCHKFnbuAz', 0, 0, '亿联第三方企业应用', '2022-09-14 11:11:13', '亿联第三方企业应用', '2022-09-14 11:11:13'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073951', '27501009', '119453', '5000000002934488', '实时动态', 'suitemcestnonr6y0xigc', 'kKCNCkfDhmLoVnl_wuAiScyDG4776mkTevuSBuiYhHg-Bvz1-vhb_4IA-Km7nK2I', 'MvWLkZGbC', 'iSVLw69AeNXS8jgGefTG2ulkKWDQjcSsMBgkFMgfPuB', 0, 0, '亿联第三方企业应用', '2022-09-14 11:11:13', '亿联第三方企业应用', '2022-09-14 11:11:13'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('3', '1903155647', '', '5000000003010470', '我的报事', 'suitedwccu2wbepxvdebi', 'OHbAMPBzPWnTL-VqPuJ4ngnwBGLVoxKkkl12uY1CPvIhfX0NqcNJMGl21gQqNpd2', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('4', '1903147702', '', '5000000003010661', '实时动态', 'suitekcbekxzjnlrlgft2', 'fMKaF1UsORAftH7LdqR-CpHOCLzA56Q8S5WN6fRAOAI7E7T-p-96SspOyc-8CdnO', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13'); + + +CREATE TABLE `open_sync_biz_data` +( + `ID` varchar(255) NOT NULL, + `SUITE_KEY` varchar(255) DEFAULT NULL, + `SUBSCRIBE_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的suiteid加下划线0', + `CORP_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的corpid', + `BIZ_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的suiteid', + `BIZ_DATA` json NOT NULL COMMENT '数据为Json格式', + `BIZ_TYPE` varchar(10) NOT NULL COMMENT '2:第三方企业应用票据;\n4:企业授权变更,包含授权、解除授权、授权变更;\n7:第三方企业应用变更,包含停用、启用、删除(删除保留授权);\n13:企业用户变更,包含用户添加、修改、删除;\n14:企业部门变更,包含部门添加、修改、删除;\n15:企业角色变更,包含角色添加、修改、删除;\n16:企业变更,包含企业修改、删除;\n17:市场订单;\n20:企业外部联系人变更,包含添加、修改、删除;\n22:ISV自定义审批;\n25:家校通讯录1.0(Deprecated)信息变更。家校通讯录升级,请查看家校通讯录2.0数据推送;\n32:智能硬件绑定类型;\n37:因订单到期或者用户退款等导致的服务关闭,目前仅推送因退款等导致的服务关闭;\n50:家校通讯录2.0,部门信息变更;\n51:家校通讯录2.0,人员信息变更;\n63:应用试用记录回调信息;\n66:工作台组件变更回调事件;\n67:钉钉假期相关回调事件;\n133:CRM客户动态相关数据回调事件;\n137:人事平台员工异动V2相关数据回调事件;\n139:异步转译通讯录id任务完成通知;\n165:人事平台员工档案变动事件相关数据的回调事件;\n175:人事解决方案变更事件;', + `DEL_FLAG` int(1) NOT NULL, + `REVISION` int(1) NOT NULL, + `CREATED_TIME` datetime NOT NULL, + `CREATED_BY` varchar(255) NOT NULL, + `UPDATED_TIME` datetime NOT NULL, + `UPDATED_BY` varchar(255) NOT NULL, + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4; \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.15__other3app.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.15__other3app.sql new file mode 100644 index 0000000000..0904d7bff2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.15__other3app.sql @@ -0,0 +1,3 @@ +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1005', '1912268145', '', '5000000003054196', '信息登记', 'dingtbmsztg41nmbclzi', '6mdIbt8xWkKOkGasxqQt44uNEri-KQWSmMX1u7weTMEuoGWwQsoYSyc0hBeoQGEj', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:03:32', '烟台企业内部应用', '2022-09-26 14:03:40'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1006', '1912172899', '', '5000000003054651', '疫情防控', 'dingye4npkwn5l8gate0', 'iOqq_5nURdTr-69DKukTfpzmkJIN5UBCQNlOdB-g6PucCC2UG-wrXmyC2XEylkuE', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:04:39', '烟台企业内部应用', '2022-09-26 14:04:46'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1007', '1912176853', '', '5000000003054757', '议事厅', 'ding56hee9xi5kxlmpbp', 'Y16WoB0qD0k8N7NY2J7HLyHGGAkhlBj9Bxkpa1cFuUUrTZlH2SfLvP4ZYnsvxC7f', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:05:40', '烟台企业内部应用', '2022-09-26 14:05:43'); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.16__shenli4app.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.16__shenli4app.sql new file mode 100644 index 0000000000..de86515689 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.16__shenli4app.sql @@ -0,0 +1,4 @@ +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1008', '1914273833', '', '5000000003069546', '随手拍', 'dingpvk106h0eca7btlm', 'zLF8ld6pF40NLUxC2aRKP7yfXreRpSRJTCN48_kyAQtretSLBfSpFMX6prUOaH_Z', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1009', '1914301613', '', '5000000003069487', '随时讲', 'ding1ept2iaynjxu2w6o', 'xSXSennTbJG8nc-IjjsrG1zEugNoCp2rLhT7pS0vInT7OnPZ5FgY3974aR9D-xd2', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1010', '1914266905', '', '5000000003069391', '我的报事', 'dingpzsyljcsbu3fbac5', 'fWRzS2W59fwx__istOF23mHq1S0hAs64nZhcmljrSLLMYrceZVsz7GhgG4izZvhy', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); +INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1011', '1914338340', '', '5000000003069669', '实时动态', 'dingflbhlrd1epy11irl', '47OE8jNuSj-JoOPBx7ZCqEii4fycnWtY2x97ndu3Mk2BOh9ElKMNuOGNU0zzshVn', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml index 31d6de459d..c95ac8b0f3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml @@ -145,6 +145,7 @@ + @@ -158,6 +159,7 @@ + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenSyncBizDataDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenSyncBizDataDao.xml new file mode 100644 index 0000000000..d6bec2cfa5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenSyncBizDataDao.xml @@ -0,0 +1,30 @@ + + + + + + DELETE + FROM open_sync_biz_data + WHERE biz_id = #{bizId} + AND biz_type = #{bizType} + AND subscribe_id = #{subscribeId} + AND corp_id = #{corpId} + AND DEL_FLAG = 0 + + + + + + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java b/epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java new file mode 100644 index 0000000000..02c064c0de --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java @@ -0,0 +1,30 @@ +package com.epmet; + +import com.alibaba.fastjson.JSON; +import com.aliyun.dingtalk.module.DingTalkResult; +import com.taobao.dingtalk.client.DingTalkClientToken; +import lombok.extern.slf4j.Slf4j; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +/** + * desc:redisson测试类 + */ +@Slf4j +@RunWith(value = SpringRunner.class) +@SpringBootTest(classes = {EpmetThirdApplication.class}) +public class ThirdPlatformTest { + + + @Autowired + DingTalkClientToken dingTalkClientToken; + + @Test + public void sendText(){ + DingTalkResult appAccessTokenToken = dingTalkClientToken.getAppAccessTokenToken(); + System.out.println("=======:"+JSON.toJSONString(appAccessTokenToken)); + } +} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java index 91ef00b75a..d5ca9f7008 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java @@ -65,6 +65,10 @@ public class GovMenuDTO extends TreeStringNode implements Serializab * 菜单图标 */ private String icon; + /** + * 菜单颜色 + */ + private String color; /** * 权限标识,如:sys:menu:save diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java index 73ff018a10..46698701ed 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java @@ -38,4 +38,9 @@ public class OftenUseFunctionListResultDTO implements Serializable { * 排序 */ private String sort; + + /** + * 菜单颜色 + */ + private String color; } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java index 9c1c3922ed..6eba2e36d1 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java @@ -47,6 +47,10 @@ public class GovMenuEntity extends BaseEpmetEntity { * 菜单图标 */ private String icon; + /** + * 菜单颜色 + */ + private String color; /** * 权限标识,如:sys:menu:save */ diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml b/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml index 33c6ae4288..47479d4410 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml @@ -29,6 +29,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql new file mode 100644 index 0000000000..78036e8f34 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql @@ -0,0 +1,2 @@ +ALTER TABLE `epmet_gov_access`.`gov_menu` + ADD COLUMN `color` varchar(16) DEFAULT '' COMMENT '菜单颜色' AFTER `icon`; diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml index 5f25af85fc..35d01fb929 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml @@ -15,7 +15,8 @@ ic.MENU_ID, gm.url, gm.icon, - gl.field_value AS menuName + gl.field_value AS menuName, + gm.color FROM ic_often_use_function ic INNER JOIN gov_customer_menu gc ON (gc.TABLE_ID = ic.MENU_ID AND gc.DEL_FLAG = '0' AND ic.CUSTOMER_ID = gc.CUSTOMER_ID) INNER JOIN gov_menu gm ON (gc.TABLE_ID = gm.id AND gm.DEL_FLAG = 0 AND gm.SHOW_FLAG = 1) @@ -24,4 +25,4 @@ AND ic.USER_ID = #{userId} ORDER BY ic.SORT - \ No newline at end of file + diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java index 3414805602..74dce9f16f 100644 --- a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java +++ b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/SaveOrUpdateParyMemberFormDTO.java @@ -31,7 +31,7 @@ public class SaveOrUpdateParyMemberFormDTO implements Serializable { @NotBlank(message = "姓名不能为空", groups = {AddUserShowGroup.class}) private String name; - @NotBlank(message = "身份证不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserShowGroup.class}) private String idCard; @NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class}) diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml b/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml index 5347bdcd70..8ce4eb923f 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml @@ -77,6 +77,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml index 705e18b83e..6409f6c5ac 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml @@ -29,6 +29,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -118,6 +120,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java index 7fe2d7bf6c..755a12a89a 100644 --- a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java @@ -22,6 +22,10 @@ public class StaffResetPassWordFormDTO implements Serializable { public interface AddUserShowGroup extends CustomerClientShowGroup { } + /** + * 旧密码 + */ + private String oldPassword; @NotBlank(message = "新密码不能为空", groups = {AddUserShowGroup.class}) private String newPassword; @NotBlank(message = "确认新密码不能为空", groups = {AddUserShowGroup.class}) diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java index cc9a8c9e94..3191db2685 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java @@ -2,12 +2,15 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.StaffResetPassWordFormDTO; import com.epmet.dto.result.MineResultDTO; import com.epmet.service.MineService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -21,6 +24,8 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("mine") public class MineController { + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private MineService mineService; @@ -45,9 +50,27 @@ public class MineController { * @Date 2020/7/1 9:59 **/ @PostMapping("resetpassword") - public Result resetPassword(@LoginUser TokenDto tokenDto, @RequestBody StaffResetPassWordFormDTO formDTO) { + public Result resetPassword(@LoginUser TokenDto tokenDto, @RequestBody StaffResetPassWordFormDTO formDTO) throws Exception { formDTO.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO, StaffResetPassWordFormDTO.AddUserShowGroup.class, StaffResetPassWordFormDTO.AddUserInternalGroup.class); + //解密密码 + if (formDTO.getConfirmNewPassword().length() > 50) { + String confirmNewPassWord = RSASignature.decryptByPrivateKey(formDTO.getConfirmNewPassword(), privateKey); + String newPassword = RSASignature.decryptByPrivateKey(formDTO.getNewPassword(), privateKey); + formDTO.setConfirmNewPassword(confirmNewPassWord); + formDTO.setNewPassword(newPassword); + if (StringUtils.isNotBlank(formDTO.getOldPassword())){ + String oldPassWord = RSASignature.decryptByPrivateKey(formDTO.getOldPassword(), privateKey); + formDTO.setOldPassword(oldPassWord); + } + } return mineService.resetPassword(formDTO); } + + public static void main(String[] args) throws Exception { + String p= "R16c3yJqCMyRFTxElBeBexTVlW1GArItaVqEEyF3o3jXVwq0G08ck8wEdBAEyQI1y4uCsw3UBgx1mqiMbIfvdg=="; + String privateKey= "MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAqOANodapaCq6hq1sLjPNAKCoTwLjblUg7LMlVWAfUdRgIem41ScYK/ccECXZGzOJZCpCB3XHGXQLdrkngnr2jwIDAQABAkAyYaWvgrtHuHetdk+v+QRQC54q9FGluP/5nfilX+f4IUf8j92o/ZohTtmJn9qcDiAP4wxCLIsfy4IW3psST78BAiEA0A/E0WvtI7spWnjfw+wMDhdVMIbIJvDbj/cqMwRZInUCIQDPyO2sbXpwDjmAvyn0jpGJJxU5POWYdI37rTf9fScMcwIhAMkWNHbjBHKANVuHb10ACjakPmWEHnXkW5AspdBg53TxAiARPbzq99KXBbcjxbj3f/T3inSqYTEz60f0wDTLJd1dnQIhAIFe6Jd1TduIxGk1PDh/b/3q0jNGgVXkFnUBnKWDaL9N"; + String newPassword = RSASignature.decryptByPrivateKey(p, privateKey); + System.out.println(newPassword); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java index 77c8502971..44fb7f61a4 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffResetPassWordFormDTO; @@ -50,7 +51,7 @@ public class MineServiceImpl implements MineService { throw new RenException(EpmetErrorCode.PASSWORD_NOT_FIT.getCode()); } //2、校验密码规则:密码必须8-20个字符,而且同时包含大小写字母和数字 - boolean flag=this.checkPassWord(formDTO.getNewPassword()); + boolean flag= PasswordUtils.checkPassWordRule(formDTO.getNewPassword()); if(!flag){ throw new RenException(EpmetErrorCode.PASSWORD_OUT_OF_ORDER.getCode()); } @@ -59,50 +60,15 @@ public class MineServiceImpl implements MineService { staffResetPwFormDTO.setNewPassword(formDTO.getNewPassword()); staffResetPwFormDTO.setConfirmNewPassword(formDTO.getConfirmNewPassword()); staffResetPwFormDTO.setStaffId(formDTO.getStaffId()); + staffResetPwFormDTO.setOldPassword(formDTO.getOldPassword()); Result updatePassWordResult=epmetUserOpenFeignClient.resetStaffPassword(staffResetPwFormDTO); if(updatePassWordResult.success()){ logger.info(String.format("调用%s服务,修改密码成功", ServiceConstant.EPMET_USER_SERVER)); }else{ logger.warn(String.format("调用%s服务,修改密码失败,返参:%s", ServiceConstant.EPMET_USER_SERVER, JSON.toJSONString(updatePassWordResult))); - return new Result().error(EpmetErrorCode.PASSWORD_UPDATE_FAILED.getCode()); + return new Result().error(EpmetErrorCode.PASSWORD_UPDATE_FAILED.getCode(),updatePassWordResult.getMsg()); } return new Result(); } - - private boolean checkPassWord(String password) { - boolean flag=false; - if(password.length()<8||password.length()>20){ - logger.warn(String.format("密码长度应为8-20位,当前输入密码%s,长度为%s",password,password.length())); - return flag; - } - boolean numFlag=false; - boolean bigLetter=false; - boolean smallLetter=false; - char[] passwordArray = password.toCharArray(); - for(int i=0;i < passwordArray.length;i++) { - char currentStr=passwordArray[i]; - logger.info(String.format("当前字符%s",currentStr)); - // 判断ch是否是数字字符,如'1','2‘,是返回true。否则返回false - if(Character.isDigit(currentStr)){ - numFlag=true; - continue; - } - // 判断ch是否是字母字符,如'a','b‘,是返回true。否则返回false - if(Character.isUpperCase(currentStr)){ - bigLetter=true; - continue; - } - if(Character.isLowerCase(currentStr)){ - smallLetter=true; - continue; - } - } - if(numFlag&&bigLetter&&smallLetter){ - flag=true; - }else{ - logger.warn(String.format("当前密码%s,是否包含数字%s,是否包含大写字母%s,是否包含小写字母%s",password,numFlag,bigLetter,smallLetter)); - } - return flag; - } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml b/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml index 6b12841f19..92ab254a90 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml @@ -101,6 +101,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -127,3 +133,8 @@ thread: keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ +epmet: + login: + publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKjgDaHWqWgquoatbC4zzQCgqE8C425VIOyzJVVgH1HUYCHpuNUnGCv3HBAl2RsziWQqQgd1xxl0C3a5J4J69o8CAwEAAQ== + privateKey: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAqOANodapaCq6hq1sLjPNAKCoTwLjblUg7LMlVWAfUdRgIem41ScYK/ccECXZGzOJZCpCB3XHGXQLdrkngnr2jwIDAQABAkAyYaWvgrtHuHetdk+v+QRQC54q9FGluP/5nfilX+f4IUf8j92o/ZohTtmJn9qcDiAP4wxCLIsfy4IW3psST78BAiEA0A/E0WvtI7spWnjfw+wMDhdVMIbIJvDbj/cqMwRZInUCIQDPyO2sbXpwDjmAvyn0jpGJJxU5POWYdI37rTf9fScMcwIhAMkWNHbjBHKANVuHb10ACjakPmWEHnXkW5AspdBg53TxAiARPbzq99KXBbcjxbj3f/T3inSqYTEz60f0wDTLJd1dnQIhAIFe6Jd1TduIxGk1PDh/b/3q0jNGgVXkFnUBnKWDaL9N + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java index d50508c522..dbf18ee25a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcNeighborHoodDTO.java @@ -69,6 +69,11 @@ public class IcNeighborHoodDTO implements Serializable { */ private String gridId; + /** + * 网格 + */ + private String gridName; + /** * 详细地址 */ @@ -144,4 +149,9 @@ public class IcNeighborHoodDTO implements Serializable { */ private Integer realBuilding; + /** + * 楼栋名 + */ + private String buildingName; + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckHouseInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckHouseInfoFormDTO.java new file mode 100644 index 0000000000..106952e90c --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckHouseInfoFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 根据小区,楼宇,单元名称校验是否存在 + * @Author wgf + * @Date 2022/8/24 9:03 + */ +@Data +public class CheckHouseInfoFormDTO implements Serializable { + private static final long serialVersionUID = 2636608477324780974L; + + private String customerId; + + private String gridId; + private String gridName; + + private String villageId; + private String buildId; + private String unitId; + private String homeId; + + + private String villageName; + private String buildName; + private String unitName; + private String homeName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java index e6fae52bc9..434af5aed4 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridOptionFormDTO.java @@ -1,6 +1,8 @@ package com.epmet.dto.form; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -11,6 +13,8 @@ import java.io.Serializable; * @Date 2021/11/12 10:54 上午 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class GridOptionFormDTO implements Serializable { /** * 部门Id diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseChartFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseChartFormDTO.java index 6d3d8f433a..fec4b2d209 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseChartFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseChartFormDTO.java @@ -21,6 +21,14 @@ public class HouseChartFormDTO implements Serializable { * 组织、网格、小区类型 agency grid village */ private String orgType; + /** + * 数据类型【1:出租 0:自住 2:闲置 3:未售出】 + */ + private String rentType; + + private Integer pageNo = 1; + private Integer pageSize = 20; + private Boolean isPage = true; //token这信息 private String customerId; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java new file mode 100644 index 0000000000..2912d5546d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ReportHouseTestFormDTO.java @@ -0,0 +1,13 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class ReportHouseTestFormDTO { + + private Integer pageNo = 1; + private Integer pageSize = 20; + private String id; + private String test; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java index 212c85a700..63b6235605 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java @@ -11,13 +11,27 @@ import java.io.Serializable; */ @Data public class BuildingResultDTO implements Serializable { + private static final long serialVersionUID = -2129418426919785999L; + private String buildingId; + private String buildingName; + + private String gridId; + private String gridName; + private String neighborhoodId; + private String neighborhoodName; - private String buildingName; + private String label; + + private String allParentName; + + private String agencyName; + + private String customerId; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckHomeInfoResultInfo.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckHomeInfoResultInfo.java new file mode 100644 index 0000000000..ab4bc4d963 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckHomeInfoResultInfo.java @@ -0,0 +1,38 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 房屋信息 + * + * @author wgf + * @date 2022/8/23 20:58 + */ +@Data +public class CheckHomeInfoResultInfo implements Serializable { + private static final long serialVersionUID = -2797565581047800011L; + + // 0:校验成功;1:校验失败; + private String code; + // 提示信息 + private String msg; + // 是否新增房屋:0:否;1:是 + private String isAdd; + + private String gridId; + private String gridName; + + private String villageId; + private String villageName; + + private String buildId; + private String buildName; + + private String unitId; + private String unitName; + + private String homeId; + private String homeName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoByNameResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoByNameResultDTO.java new file mode 100644 index 0000000000..fd91d086b5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridInfoByNameResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 网格所属组织基本信息 + * @Author wgf + * @Date 2020/4/26 22:35 + */ +@Data +public class GridInfoByNameResultDTO implements Serializable { + private static final long serialVersionUID = 4360690752084258055L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格组织ID + */ + private String deptId; + + /** + * 网格名称 + */ + private String deptName; + + /** + * 网格的上级组织 + */ + private String pid; + + /** + * 网格的所有上级组织 + */ + private String pids; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java index d5734e2791..eff5a441d8 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseAgencyInfoResultDTO.java @@ -21,6 +21,7 @@ public class HouseAgencyInfoResultDTO implements Serializable { private String neighborHoodId; private String buildingId; private String buildingUnitId; + private String fullName; public HouseAgencyInfoResultDTO() { this.agencyId = ""; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java index aed43f1b0c..61bee2a9cc 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java @@ -47,6 +47,14 @@ public class HouseChartResultDTO implements Serializable { * 房屋闲置总数占比(保留两位小数,带百分号的) */ private Double xzHouseRatio = 0.0; + /** + * 房屋未售出总数 + */ + private Integer wscHouseTotal = 0; + /** + * 房屋未售出总数占比(保留两位小数,带百分号的) + */ + private Double wscHouseRatio = 0.0; @JsonIgnore private Integer num; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java index 910044f9cb..10e8e09477 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java @@ -57,6 +57,10 @@ public class IcBulidingDetailDTO implements Serializable { */ private String type; + /** + * --楼栋类型,1商品房,2自建房,3别墅 + */ + private String typeName; /** * 排序 diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java new file mode 100644 index 0000000000..2ed20afbfa --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java @@ -0,0 +1,111 @@ +package com.epmet.dto.result; + +import com.epmet.dto.IcPropertyManagementDTO; +import lombok.Data; + +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/9/21 9:19 + */ +@Data +public class IcNeighborHoodDetailDTO { + private String id; + /** + * 客户id + */ + private String customerId; + + /** + * 小区名称 + */ + private String neighborHoodName; + + /** + * 组织id + */ + private String agencyId; + + /** + * 组织名称--新版详情页面用于显示 + */ + private String agencyName; + + /** + * 上级组织id + */ + private String parentAgencyId; + + /** + * 组织的所有上级组织id + */ + private String agencyPids; + + /** + * 网格id + */ + private String gridId; + + /** + * 详细地址 + */ + private String address; + + /** + * 备注 + */ + private String remark; + + /** + * 中心点位:经度 + */ + private String longitude; + + /** + * 中心点位:纬度 + */ + private String latitude; + + /** + * 坐标区域 + */ + private String coordinates; + + /** + * 坐标位置 + */ + private String location; + + /** + * 网格名称--新版详情页面用于显示 + */ + private String gridName; + + /** + * 物业名称--新版详情页面用于显示 + */ + private List propertyList; + + /** + * 小区编码 + */ + private String coding; + + /** + * 小区系统编码 + */ + private String sysCoding; + + /** + * 实有楼栋数 + */ + private Integer realBuilding; + + /** + * 二维码地址 + */ + private String qrcodeUrl; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ReportHouseTestResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ReportHouseTestResultDTO.java new file mode 100644 index 0000000000..b9f074683d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ReportHouseTestResultDTO.java @@ -0,0 +1,14 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ReportHouseTestResultDTO { + private String houseId; + private String doorName; + private String fullName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java index 905dca051f..45ded6601b 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java @@ -50,6 +50,14 @@ public class SubUserHouseListResultDTO implements Serializable { * 房屋闲置总数占比(保留两位小数,带百分号的) */ private Double xzHouseRatio = 0.0; + /** + * 房屋未售出总数 + */ + private Integer wscHouseTotal = 0; + /** + * 房屋未售出总数占比(保留两位小数,带百分号的) + */ + private Double wscHouseRatio = 0.0; /** * 居民总数 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 7aa747a910..cc90ddbc2f 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -712,4 +712,7 @@ public interface GovOrgOpenFeignClient { @PostMapping("/gov/org/department/notsyncdept") Result notSyncDept(@RequestBody CheckStaffInfoFormDTO formDTO); + + @PostMapping("/gov/org/enterprise/sendEnterprisePatrolRemindMessage") + Result sendEnterprisePatrolRemindMessage(); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 050aa67bed..e242be2805 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -469,4 +469,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "notSyncDept", formDTO); } + @Override + public Result sendEnterprisePatrolRemindMessage() { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "sendEnterprisePatrolRemindMessage", null); + } + } diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index a12bbbd779..825a4e2213 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -33,11 +33,6 @@ epmet-commons-mybatis 2.0.0 - - com.epmet - epmet-commons-dynamic-datasource - 2.0.0 - com.epmet epmet-oss-client @@ -363,6 +358,16 @@ epmet_gov_org_user EpmEt-db-UsEr + + + + epmet_gov_org_user + EpmEt-db-UsEr + + + + epmet_gov_org_user + EpmEt-db-UsEr 0 172.22.76.1:6379,172.22.76.20:6379,172.22.76.36:6379,172.22.76.1:6389,172.22.76.20:6389,172.22.76.36:6389 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java index 85f0d846f7..50d0b7931c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java @@ -25,5 +25,6 @@ public interface ImportErrorMsgConstants { String HOUSE_ERROR_NAME = "导入失败的列表-房屋"; String BUILDING_ERROR_NAME = "导入失败的列表-楼栋"; String NEIGHBORHOOD_ERROR_NAME = "导入失败的列表-小区"; + String BUILDING_NAME_EXITED_IN_GRID = "小区下该楼栋已存在于其他网格"; } 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 73316bad52..c1aba9bb3c 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 @@ -475,6 +475,18 @@ public class CustomerAgencyController { return customerAgencyService.getCommunityInfo(formDTO); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据网格名称查询所属组织信息 + * @Date 2022/6/21 22:41 + **/ + @PostMapping("getGridInfoByGridName") + public Result getGridInfoByGridName(@RequestBody GridInfoVaccinePrarmeterFormDTO formDTO) { + return customerAgencyService.getGridInfoByGridName(formDTO); + } + /** * @param userId * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index 0be889c93d..35b3bc0e6f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -27,6 +27,7 @@ import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; @@ -105,6 +106,7 @@ public class HouseController implements ResultDataResolver { @Autowired private IcHouseDao icHouseDao; + @ReportRequest @PostMapping("houselist") @MaskResponse(fieldNames = {"ownerIdCard", "ownerPhone"}, fieldsMaskType = {MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE}) @@ -615,4 +617,16 @@ public class HouseController implements ResultDataResolver { return new Result(); } + /** + * @Author sun + * @Description 【人房概览】房屋统计数点击查询列表/详情 + **/ + @PostMapping("housestatislistdetail") + @MaskResponse(fieldNames = {"ownerIdCard", "ownerPhone"}, fieldsMaskType = {MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE}) + public Result> houseStatisListDetail(@LoginUser TokenDto tokenDto, @RequestBody HouseChartFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(houseService.houseStatisListDetail(formDTO)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java index 21ca6fb933..21cddd9951 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java @@ -23,7 +23,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.HouseInformationFormDTO; import com.epmet.dto.result.*; -import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -64,7 +63,7 @@ public class HouseInformationController { * @return com.epmet.commons.tools.utils.Result */ @PostMapping("neighborhoodDetail/{neighborhoodId}") - public Result neighborhoodDetail(@PathVariable("neighborhoodId") String neighborhoodId){ + public Result neighborhoodDetail(@PathVariable("neighborhoodId") String neighborhoodId){ return icNeighborHoodService.neighborhoodDetail(neighborhoodId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java index 244711596d..dba64a0964 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java @@ -301,4 +301,18 @@ public class IcEnterpriseController implements ResultDataResolver { icEnterpriseService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),tokenDto.getCustomerId(),tokenDto.getUserId()); return new Result(); } + + /** + * 复查消息提醒 + * + * @Param + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/9/6 17:31 + */ + @PostMapping("sendEnterprisePatrolRemindMessage") + public Result sendEnterprisePatrolRemindMessage() { + icEnterpriseService.sendEnterprisePatrolRemindMessage(); + return new Result(); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java index 49e3f15f92..6d828df25a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcHouseController.java @@ -18,11 +18,16 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.dto.form.PageFormDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.IcHouseDTO; +import com.epmet.dto.IcVaccinePrarmeterDTO; +import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.HouseFormDTO; +import com.epmet.dto.form.VaccinePrarmeterListFormDTO; import com.epmet.dto.result.HouseAgencyInfoResultDTO; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.HouseListResultDTO; @@ -136,4 +141,19 @@ public class IcHouseController { public Result> getOwnerHouseList(@RequestBody IcHouseDTO formDTO){ return new Result>().ok(icHouseService.getOwnerHouseList(formDTO)); } + + /** + * Desc: 根据小区,楼宇,单元名称校验是否存在 + * @param formDTO + * @param tokenDto + * @author wgf + * @date 2022/8/24 13:57 + */ + @PostMapping("checkHomeInfo") + public Result checkHomeInfo(@RequestBody CheckHouseInfoFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return icHouseService.checkHomeInfo(formDTO); + + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java index 627b5a5d8b..f44e52c44f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java @@ -39,6 +39,7 @@ import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.result.BuildingResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcNeighborHoodService; @@ -150,6 +151,20 @@ public class IcNeighborHoodController { return new Result>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getAgencyId(), dto.getGridId(),tokenDto.getUserId(),tokenDto.getCustomerId())); } + /** + * 获取用户组织下小区列表 + * + * @param tokenDto + * @param dto + * @return com.epmet.commons.tools.utils.Result> + * @author zhy + * @date 2022/8/19 15:56 + */ + @PostMapping("neighborhoodlist") + public Result> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody IcNeighborHoodDTO dto) { + return new Result>().ok(icNeighborHoodService.getNeighborhoodList(tokenDto, dto)); + } + /** * @Description 小区信息导入 * @param tokenDTO diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java new file mode 100644 index 0000000000..1f9337400e --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/ReportController.java @@ -0,0 +1,45 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.ReportRequest; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ReportHouseTestFormDTO; +import com.epmet.dto.result.ReportHouseTestResultDTO; +import com.epmet.service.HouseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; + +@RestController +@RequestMapping("report") +public class ReportController { + + @Autowired + private HouseService houseService; + + @Autowired + private RedisUtils redisUtils; + + /** + * todo 测试用的 + * @return + */ + @PostMapping("houses/test") + @ReportRequest + public Result> listHouses(@RequestBody ReportHouseTestFormDTO input) { + System.out.println("id:"+input.getId()); + PageData pageData = houseService.listHouses4ReportTest(input.getId(), input.getPageNo(), input.getPageSize()); + return new Result>().ok(pageData); + } + + @PostMapping("put") + public void put() { + final HashMap m = new HashMap<>(); + m.put("test", "aaa"); + + redisUtils.hMSet("ttt", m); + } + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index b54b4a28b7..37e8d93c98 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.form.GridInfoVaccinePrarmeterFormDTO; import com.epmet.dto.form.OrgInfoPointFormDTO; import com.epmet.dto.form.OrgTreeByUserAndTypeFormDTO; import com.epmet.dto.result.*; @@ -352,6 +353,8 @@ public interface CustomerAgencyDao extends BaseDao { CommunityInfoResultDTO getCommunityInfo(OrgInfoPointFormDTO formDTO); + GridInfoByNameResultDTO getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO); + CommunityInfoResultDTO getCommunityInfoByUserId(@Param("userId") String userId); /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java index 8b0cd3f470..46f0041e8d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java @@ -19,7 +19,9 @@ package com.epmet.dao; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.ImportGeneralDTO; +import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.IcBuildingListFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; @@ -65,6 +67,15 @@ public interface IcBuildingDao extends BaseDao { List baseInfoFamilyBuilding(@Param("neighborHoodId")String neighborHoodId); Integer checkBuildName(@Param("neighborHoodId") String neighborHoodId,@Param("buildingName")String buildingName, @Param("buildingId")String buildingId); + Integer checkBuildNameV2(@Param("agencyId") String agencyId, + @Param("neighborHoodName") String neighborHoodName, + @Param("buildingName")String buildingName, + @Param("buildingId")String buildingId); + Integer checkBuildNameV3(@Param("agencyId") String agencyId, + @Param("gridId") String gridId, + @Param("neighborHoodName") String neighborHoodName, + @Param("buildingName")String buildingName, + @Param("buildingId")String buildingId); List buildingListByIds(@Param("buildingIdList") List buildingIdList); IPage buildingListByIds(IPage page,@Param("buildingIdList") List buildingIdList); @@ -224,4 +235,22 @@ public interface IcBuildingDao extends BaseDao { IcBuildingEntity selectByCoding(@Param("coding") String coding, @Param("id") String id); + /** + * 展示所有楼栋和小区信息 + * + * @param dto + * @return java.util.List + * @author zhy + * @date 2022/8/19 17:32 + */ + List listBuildingInfo(IcNeighborHoodDTO dto); + + + /** + * 根据楼宇名称查询楼宇信息 + * @param formDTO + * @return + */ + IcBuildingEntity getBuildingInfoByName(CheckHouseInfoFormDTO formDTO); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java index 09c40920ed..ebc8c2f888 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingUnitDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.result.HouseInfoResultDTO; import com.epmet.dto.result.OrganizationCommunityDTO; import com.epmet.entity.IcBuildingUnitEntity; @@ -78,4 +79,11 @@ public interface IcBuildingUnitDao extends BaseDao { * @return com.epmet.dto.result.OrganizationCommunityDTO */ OrganizationCommunityDTO selectCommunityByUnitId(@Param("unitId") String unitId); + + /** + * 根据单元名称查询单元信息 + * @param formDTO + * @return + */ + IcBuildingUnitEntity getbuildingUnitInfoByName(CheckHouseInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index 3ae10791bf..1f3ceacfe5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -2,7 +2,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ImportGeneralDTO; +import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.GetHouseInfoToCollectFormDTO; +import com.epmet.dto.form.HouseChartFormDTO; import com.epmet.dto.form.IcHouseListFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerOrgParameterEntity; @@ -201,4 +203,14 @@ public interface IcHouseDao extends BaseDao { */ IcHouseInfoCollectResultDTO getHouseInfoToCollect(GetHouseInfoToCollectFormDTO formDTO); + /** + * 校验房屋 + * @param formDTO + * @return + */ + IcHouseEntity getHouseInfoByName(CheckHouseInfoFormDTO formDTO); + + List houseStatisListDetail(HouseChartFormDTO formDTO); + + List selectListForRenFangStats(@Param("buildingId") String buildingId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java index a1999a0ee6..afe0374247 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.NeighborHoodAndManagementDTO; +import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.HouseInformationFormDTO; import com.epmet.dto.form.IcNeighborHoodListFormDTO; import com.epmet.dto.result.*; @@ -211,4 +212,12 @@ public interface IcNeighborHoodDao extends BaseDao { * @Date 2022/6/29 16:48 */ List getHouseList(HouseInformationFormDTO formDTO); + + + /** + * 根据名称查小区信息 + * @param formDTO + * @return + */ + IcNeighborHoodEntity getNeighborHoodInfoByName(CheckHouseInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java index 24bd9b22e2..52a038ab3b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcPropertyManagementDTO; import com.epmet.entity.IcPropertyManagementEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -50,4 +51,11 @@ public interface IcPropertyManagementDao extends BaseDao selectIdByName(@Param("names")List names); + + /** + * 查询小区关联物业id,name + * @param neighborhoodId + * @return + */ + List selectPropertyNameList(String neighborhoodId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java index e567bf017d..38f8e3b494 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java @@ -210,6 +210,13 @@ public class ImportBuildingInfoListener extends AnalysisEventListener 0){ + // 说明数据库已存在此楼栋,不需添加 + nums.add(num); + disposeErrorMsg(info,ImportErrorMsgConstants.BUILDING_NAME_EXITED_IN_GRID); + return; + } if (orgType.equals(CustomerGridConstant.GRID) || orgType.equals(CustomerGridConstant.AGENCY)){ List gridIds = new ArrayList<>(); if (orgType.equals(CustomerGridConstant.GRID)){ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java index 812792b964..b8f1c41ce2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java @@ -3,12 +3,12 @@ package com.epmet.model; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.CustomerGridConstant; +import com.epmet.constant.ImportErrorMsgConstants; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcBuildingDao; import com.epmet.dto.IcHouseDTO; @@ -489,6 +489,13 @@ public class ImportHouseInfoListener extends AnalysisEventListener 0){ + // 说明数据库已存在此楼栋,不需添加 + nums.add(num); + disposeErrorMsg(info, ImportErrorMsgConstants.BUILDING_NAME_EXITED_IN_GRID); + return; + } if (orgType.equals(CustomerGridConstant.GRID) || orgType.equals(CustomerGridConstant.AGENCY)){ List gridIds = new ArrayList<>(); if (orgType.equals(CustomerGridConstant.GRID)){ 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 bec4188167..e71189e0ad 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 @@ -327,6 +327,15 @@ public interface CustomerAgencyService extends BaseService **/ Result getCommunityInfo(OrgInfoPointFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据网格名称查询所属组织信息 + * @Date 2022/6/21 22:41 + **/ + Result getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO); + /** * @param userId * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index 225c28405a..239e844523 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -193,4 +193,8 @@ public interface HouseService { * @return */ Result getHouseInfoToCollect(GetHouseInfoToCollectFormDTO formDTO); + + PageData listHouses4ReportTest(String houseId, Integer pageNo, Integer pageSize); + + PageData houseStatisListDetail(HouseChartFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java index 82057fb0cd..3f06567ca8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java @@ -68,4 +68,14 @@ public interface IcEnterpriseService extends BaseService { PageData list(EnterprisePageFormDTO formDTO); void execAsyncExcelImport(Path fileSavePath, String taskId, String customerId, String userId); + + /** + * 复查消息提醒 + * + * @Param + * @Return + * @Author zhaoqifeng + * @Date 2022/9/6 17:30 + */ + void sendEnterprisePatrolRemindMessage(); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java index 522acba117..77a5bdd4ad 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcHouseService.java @@ -3,8 +3,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcHouseDTO; import com.epmet.dto.ImportGeneralDTO; +import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.HouseFormDTO; import com.epmet.dto.result.HouseAgencyInfoResultDTO; import com.epmet.dto.result.HouseInfoDTO; @@ -130,4 +132,11 @@ public interface IcHouseService extends BaseService { * @Date 2022/7/19 17:41 */ List getOwnerHouseList(IcHouseDTO formDTO); + + /** + * 根据小区,楼宇,单元名称校验是否存在 + * @param formDTO + * @return + */ + Result checkHomeInfo(CheckHouseInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java index 085c363819..266d0f9b41 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java @@ -20,12 +20,15 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.dto.result.OptionResultDTO; 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.dto.IcNeighborHoodDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.NeighborHoodAndManagementDTO; import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; +import com.epmet.dto.result.BuildingResultDTO; +import com.epmet.dto.result.IcNeighborHoodDetailDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.entity.IcNeighborHoodEntity; import com.epmet.entity.IcNeighborHoodPropertyEntity; @@ -115,6 +118,17 @@ public interface IcNeighborHoodService extends BaseService */ List getNeighborHoodOptions(String agencyId, String gridId,String staffId,String customerId); + /** + * 获取用户组织下小区列表 + * + * @param tokenDto + * @param dto + * @return java.util.List + * @author zhy + * @date 2022/8/19 15:57 + */ + List getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto); + /** * @Description 通过ID查询小区信息 * @Param ids @@ -180,5 +194,5 @@ public interface IcNeighborHoodService extends BaseService * @params [neighborhoodId] * @return com.epmet.commons.tools.utils.Result */ - Result neighborhoodDetail(String neighborhoodId); + Result neighborhoodDetail(String neighborhoodId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 86e54b4356..36dde00dfe 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -102,9 +102,15 @@ public class BuildingServiceImpl implements BuildingService { public void addBuilding(String customerId, IcBulidingAddFormDTO formDTO) { //同一小区下不能存在楼栋名字一样的 Integer count = icBuildingDao.checkBuildName(formDTO.getNeighborHoodId(), formDTO.getBuildingName(), null); + if (null != count && count > 0) { throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(), EpmetErrorCode.BUILDING_NAME_EXITED.getMsg()); } + IcNeighborHoodEntity neighborHood = icNeighborHoodDao.selectById(formDTO.getNeighborHoodId()); + count = icBuildingDao.checkBuildNameV2(formDTO.getAgencyId(), neighborHood.getNeighborHoodName(), formDTO.getBuildingName(), null); + if (null != count && count > 0) { + throw new EpmetException(EpmetErrorCode.BUILDING_NAME_EXITED_IN_GRID.getCode()); + } //楼栋编码不可重复 if(org.apache.commons.lang3.StringUtils.isNotBlank(formDTO.getCoding())){ IcBuildingEntity isHaveCoding = icBuildingDao.selectByCoding(formDTO.getCoding(),null); @@ -475,6 +481,11 @@ public class BuildingServiceImpl implements BuildingService { if (null != count && count > 0) { throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(), EpmetErrorCode.BUILDING_NAME_EXITED.getMsg()); } + IcNeighborHoodEntity neighborHood = icNeighborHoodDao.selectById(formDTO.getNeighborHoodId()); + count = icBuildingDao.checkBuildNameV2(formDTO.getAgencyId(), neighborHood.getNeighborHoodName(), formDTO.getBuildingName(), formDTO.getBuildingId()); + if (null != count && count > 0) { + throw new EpmetException(EpmetErrorCode.BUILDING_NAME_EXITED_IN_GRID.getCode()); + } IcBuildingDTO icBuilding = icBuildingService.get(formDTO.getBuildingId()); if (!icBuilding.getNeighborHoodId().equals(formDTO.getNeighborHoodId())) { //更新对应房屋小区id 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 f2c0392dc7..3ee1bc565e 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 @@ -66,6 +66,9 @@ import org.springframework.transaction.annotation.Transactional; import java.lang.reflect.Field; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -112,6 +115,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl(); } - List list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList()); + CompletableFuture> listFuture = CompletableFuture.supplyAsync(()-> baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList()),executorService); + //List list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList()); + CustomerFormDTO customerFormDTO = new CustomerFormDTO(); customerFormDTO.setCustomerIdList(staffOrgsFormDTO.getCustomerIdList()); - Result> customerDTOResult = operCrmFeignClient.queryCustomerList(customerFormDTO); + CompletableFuture>> customerDTOResultFuture = CompletableFuture.supplyAsync(()-> operCrmFeignClient.queryCustomerList(customerFormDTO),executorService); + //Result> customerDTOResult = operCrmFeignClient.queryCustomerList(customerFormDTO); + List list = null; + Result> customerDTOResult = null; + try { + list = listFuture.get(10, TimeUnit.SECONDS); + customerDTOResult = customerDTOResultFuture.get(10, TimeUnit.SECONDS); + } catch (Exception e) { + log.error("getStaffOrgList exception",e); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg()); + } List customerDTOList = customerDTOResult.getData(); if (customerDTOResult.success() && customerDTOList.size() > 0) { for (CustomerDTO customer : customerDTOList) { @@ -1580,6 +1597,13 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl().ok(communityInfoResultDTO); } + @Override + public Result getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO) { + GridInfoByNameResultDTO gridInfoByNameResultDTO = baseDao.getGridInfoByGridName(formDTO); + + return new Result().ok(gridInfoByNameResultDTO); + } + @Override public Result getCommunityInfoByUserId(String userId) { CommunityInfoResultDTO communityInfoResultDTO = baseDao.getCommunityInfoByUserId(userId); 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 df84bed116..7f3e68df7f 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 @@ -111,6 +111,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl u.getBuildingName()).orElse(""); - String unitName = Optional.ofNullable(icBuildingUnit).map(u -> u.getUnitNum()).orElse(""); + String unitName = Optional.ofNullable(icBuildingUnit).map(u -> u.getUnitName()).orElse(""); return new StringBuilder().append(buildingName).append("-").append(unitName).append("-").append(doorName).toString(); } @@ -264,8 +264,10 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { houseChangeRecordCollect(formDTO.getId(), formDTO.getCustomerId(), icHouseDTO); icHouseDao.updateById(entity); + IcHouseDTO houseDTO = icHouseService.get(formDTO.getId()); + //删除房屋缓存 - icHouseRedis.delHouseInfo(formDTO.getId(), entity.getCustomerId()); + icHouseRedis.delHouseInfo(formDTO.getId(), houseDTO.getCustomerId()); } /** @@ -467,7 +469,9 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { item.setPurpose(HousePurposeEnums.getTypeValue(item.getPurposeKey())); }); - + if (formDTO.getIsPage()) { + return new PageData<>(records == null ? new ArrayList<>() : records, pageInfo.getTotal(), formDTO.getPageSize()); + } return new PageData<>(records == null ? new ArrayList<>() : records, pageInfo.getTotal()); } @@ -699,14 +703,17 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { resultDTO.setZzHouseTotal(l.getNum()); } else if (l.getRentFlag() == 1) { resultDTO.setCzHouseTotal(l.getNum()); - } else { + } else if (l.getRentFlag() == 2) { resultDTO.setXzHouseTotal(l.getNum()); + } else if (l.getRentFlag() == 3) { + resultDTO.setWscHouseTotal(l.getNum()); } }); resultDTO.setHouseTotal(houseTotal.get()); resultDTO.setZzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getZzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getZzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); resultDTO.setCzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getCzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getCzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); resultDTO.setXzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getXzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getXzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); + resultDTO.setWscHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getWscHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getWscHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); resultDTO.setOrgId(formDTO.getOrgId()); resultDTO.setOrgType(formDTO.getOrgType()); return resultDTO; @@ -942,6 +949,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { dto.setCzHouseRatio(h.getCzHouseRatio()); dto.setXzHouseTotal(h.getXzHouseTotal()); dto.setXzHouseRatio(h.getXzHouseRatio()); + dto.setWscHouseTotal(h.getWscHouseTotal()); + dto.setWscHouseRatio(h.getWscHouseRatio()); } } for (UserChartResultDTO u : userResult.getData()) { @@ -1310,4 +1319,49 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { return new Result().ok(icHouseInfoCollectResultDTO); } + + @Override + public PageData listHouses4ReportTest(String houseId, Integer pageNo, Integer pageSize) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcHouseEntity::getBuildingId, "1514143207495208961"); + query.eq(StringUtils.isNotBlank(houseId), IcHouseEntity::getId, houseId); + + PageHelper.startPage(pageNo, pageSize); + List icHouseEntities = icHouseDao.selectList(query); + + PageInfo pi = new PageInfo<>(icHouseEntities); + + List houseDtos = icHouseEntities.stream().map(house -> new ReportHouseTestResultDTO(house.getId(), house.getDoorName(), house.getFullName())).collect(Collectors.toList()); + + return new PageData<>(houseDtos, pi.getTotal()); + } + + @Override + public PageData houseStatisListDetail(HouseChartFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 + if (StringUtils.isEmpty(formDTO.getOrgId())) { + //获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + + //2.按条件查询房屋信息数据 + List list = icHouseDao.houseStatisListDetail(formDTO); + + //3.封装数据并返回 + list.forEach(item -> { + item.setHouseType(HouseTypeEnums.getTypeValue(item.getHouseTypeKey())); + item.setPurpose(HousePurposeEnums.getTypeValue(item.getPurposeKey())); + }); + + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java index a0feee5fba..88de234e7d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java @@ -19,15 +19,14 @@ 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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.FileUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.SmsTemplateConstant; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.*; import com.epmet.dto.SysDictDataDTO; -import com.epmet.dto.form.EnterpriseFormDTO; -import com.epmet.dto.form.EnterprisePageFormDTO; -import com.epmet.dto.form.EnterprisePatrolFormDTO; -import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.IcEnterpriseEntity; import com.epmet.entity.IcEnterprisePatrolAttachmentEntity; @@ -36,6 +35,7 @@ import com.epmet.excel.EnterpriseImportExcelDTO; import com.epmet.excel.handler.IcEnterpriseExcelImportListener; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.service.CoverageService; import com.epmet.service.IcEnterpriseService; @@ -55,14 +55,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.commons.CommonsMultipartFile; +import javax.annotation.Resource; import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; /** @@ -90,6 +88,8 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.apply("DATE_FORMAT(REVIEW_TIME,'%Y%m%d') = " + dateId); + List list = enterprisePatrolRecordDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(list)) { + List smsList=new ArrayList<>(); + list.forEach(item -> { + IcEnterpriseEntity enterprise = baseDao.selectById(item.getEnterpriseId()); + if (null != enterprise) { + SendSmsFormDTO sms = new SendSmsFormDTO(); + sms.setCustomerId(item.getCustomerId()); + sms.setMobile(item.getMobile()); + sms.setAliyunTemplateCode(SmsTemplateConstant.ENTERPRISE_PATROL_TEM); + Map paramMap = new HashMap<>(); + paramMap.put("name",enterprise.getPlaceOrgName()); + paramMap.put("date",DateUtils.format(item.getReviewTime(),DateUtils.DATE_PATTERN)); + sms.setParamMap(paramMap); + smsList.add(sms); + } + }); + messageOpenFeignClient.sendMsg(smsList); + } + } + private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); if (null == staffInfo) { diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index d31a2cbb54..0f69fc8816 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java @@ -9,6 +9,8 @@ import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; +import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -20,12 +22,9 @@ import com.epmet.dto.IcHouseDTO; import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.ImportGeneralDTO; +import com.epmet.dto.form.CheckHouseInfoFormDTO; import com.epmet.dto.form.HouseFormDTO; -import com.epmet.dto.result.HouseAgencyInfoResultDTO; -import com.epmet.dto.result.HomeInfoResultDTO; -import com.epmet.dto.result.HouseInfoDTO; -import com.epmet.dto.result.HouseListResultDTO; -import com.epmet.dto.result.HousesNameResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcBuildingEntity; import com.epmet.entity.IcBuildingUnitEntity; import com.epmet.entity.IcHouseEntity; @@ -163,10 +162,13 @@ public class IcHouseServiceImpl extends BaseServiceImpl getHouseList(TokenDto tokenDto, HouseFormDTO formDTO) { //查询楼栋下房屋列表 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()); - wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC"); - List list = baseDao.selectList(wrapper); +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()); +// wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC"); +// List list = baseDao.selectList(wrapper); + + List list = baseDao.selectListForRenFangStats(formDTO.getBuildingId()); + if (CollectionUtils.isEmpty(list)) { return Collections.emptyList(); } @@ -223,6 +225,13 @@ public class IcHouseServiceImpl extends BaseServiceImpl icHouseRedis.getHouseInfo(item.getId(), item.getCustomerId())).collect(Collectors.toList()); } + + @Override + public Result checkHomeInfo(CheckHouseInfoFormDTO formDTO) { + CheckHomeInfoResultInfo checkHomeInfoResultInfo = ConvertUtils.sourceToTarget(formDTO, CheckHomeInfoResultInfo.class); + + // 校验小区 + IcNeighborHoodEntity icNeighborHoodEntity = icNeighborHoodDao.getNeighborHoodInfoByName(formDTO); + if(icNeighborHoodEntity != null && StringUtils.isNotBlank(icNeighborHoodEntity.getId())){ + formDTO.setVillageId(icNeighborHoodEntity.getId()); + checkHomeInfoResultInfo.setVillageId(icNeighborHoodEntity.getId()); + }else{ + checkHomeInfoResultInfo.setCode("1"); + checkHomeInfoResultInfo.setMsg("小区名称未匹配到数据"); + return new Result().ok(checkHomeInfoResultInfo); + } + + // 校验楼宇 + IcBuildingEntity icBuildingEntity = icBuildingDao.getBuildingInfoByName(formDTO); + if(icBuildingEntity != null && StringUtils.isNotBlank(icBuildingEntity.getId())){ + formDTO.setBuildId(icBuildingEntity.getId()); + checkHomeInfoResultInfo.setBuildId(icBuildingEntity.getId()); + }else{ + checkHomeInfoResultInfo.setCode("1"); + checkHomeInfoResultInfo.setMsg("楼宇名称未匹配到数据"); + return new Result().ok(checkHomeInfoResultInfo); + } + + // 校验单元 + IcBuildingUnitEntity icBuildingUnitEntity = buildingUnitDao.getbuildingUnitInfoByName(formDTO); + if(icBuildingUnitEntity != null && StringUtils.isNotBlank(icBuildingUnitEntity.getId())){ + formDTO.setUnitId(icBuildingUnitEntity.getId()); + checkHomeInfoResultInfo.setUnitId(icBuildingUnitEntity.getId()); + }else{ + checkHomeInfoResultInfo.setCode("1"); + checkHomeInfoResultInfo.setMsg("单元名称未匹配到数据"); + return new Result().ok(checkHomeInfoResultInfo); + } + + // 校验房屋 + IcHouseEntity icHouseEntity = baseDao.getHouseInfoByName(formDTO); + checkHomeInfoResultInfo.setCode("0"); + if(icHouseEntity != null && StringUtils.isNotBlank(icHouseEntity.getId())){ + checkHomeInfoResultInfo.setHomeId(icHouseEntity.getId()); + checkHomeInfoResultInfo.setMsg("该房屋为已存在房屋"); + checkHomeInfoResultInfo.setIsAdd("0"); + }else{ + checkHomeInfoResultInfo.setMsg("该房屋暂不存在"); + checkHomeInfoResultInfo.setIsAdd("1"); + } + + return new Result().ok(checkHomeInfoResultInfo); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java index 14c9af3048..e14ea745ab 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java @@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker; 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.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -40,6 +41,7 @@ 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.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerGridConstant; @@ -49,9 +51,7 @@ import com.epmet.dto.*; import com.epmet.dto.form.IcNeighborHoodAddFormDTO; import com.epmet.dto.form.ImportInfoFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO; -import com.epmet.dto.result.ImportTaskCommonResultDTO; -import com.epmet.dto.result.InfoByNamesResultDTO; -import com.epmet.dto.result.UploadImgResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.excel.IcNeighborHoodExcel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; @@ -189,7 +189,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto) { + dto.setCustomerId(tokenDto.getCustomerId()); +// if (StringUtils.isBlank(dto.getAgencyId()) && StringUtils.isEmpty(dto.getGridId())) { +// log.info("agencyId与gridId都为空时,默认查询当前工作人员所属组织下的小区"); +// CustomerStaffInfoCacheResult result= CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); +// if (null == result || StringUtils.isBlank(result.getAgencyId())) { +// log.error(String.format("staffId:%s,工作人员缓存信息查询异常", tokenDto.getUserId())); +// return Collections.emptyList(); +// } +// dto.setAgencyId(result.getAgencyId()); +// } + return icBuildingDao.listBuildingInfo(dto); + } + /** * @param ids * @Description 通过ID查询小区信息 @@ -792,12 +806,22 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl neighborhoodDetail(String neighborhoodId) { - IcNeighborHoodEntity result = baseDao.selectById(neighborhoodId); - if(null != result && null == result.getRemark()){ - result.setRemark(""); + public Result neighborhoodDetail(String neighborhoodId) { + IcNeighborHoodEntity icNeighborHoodEntity = baseDao.selectById(neighborhoodId); + if (null == icNeighborHoodEntity) { + return new Result<>(); + } + IcNeighborHoodDetailDTO result = ConvertUtils.sourceToTarget(icNeighborHoodEntity, IcNeighborHoodDetailDTO.class); + if(null == result.getRemark()){ + result.setRemark(StrConstant.EPMETY_STR); + } + GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(result.getGridId()); + if (null != gridInfoCache) { + result.setAgencyName(gridInfoCache.getAgencyName()); + result.setGridName(gridInfoCache.getGridName()); } - return new Result().ok(result); + result.setPropertyList(propertyManagementDao.selectPropertyNameList(neighborhoodId)); + return new Result().ok(result); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index 8b65e6bffa..73c05e13fa 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -41,34 +41,129 @@ spring: password: @spring.datasource.druid.password@ baseline-on-migrate: true baseline-version: 0 - datasource: - druid: - #MySQL - driver-class-name: com.mysql.cj.jdbc.Driver - url: @spring.datasource.druid.url@ - username: @spring.datasource.druid.username@ - password: @spring.datasource.druid.password@ - initial-size: 10 - max-active: 100 - min-idle: 10 - max-wait: 60000 - pool-prepared-statements: true - max-pool-prepared-statement-per-connection-size: 20 - time-between-eviction-runs-millis: 60000 - min-evictable-idle-time-millis: 300000 - #Oracle需要打开注释 - #validation-query: SELECT 1 FROM DUAL - test-while-idle: true - test-on-borrow: false - test-on-return: false - filter: - stat: - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: false - wall: - config: - multi-statement-allow: true + shardingsphere: + sharding: + default-data-source-name: master + masterslave: + name: ms + master-data-source-name: master + slave-data-source-names: slave1,slave2 + #配置slave节点的负载均衡均衡策略,采用轮询机制 + load-balance-algorithm-type: round_robin + datasource: + names: master,slave1,slave2 + master: + #MySQL + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + filter: + stat: + log-slow-sql: false + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + slave1: + #MySQL + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.slave1.url@ + username: @spring.datasource.slave1.username@ + password: @spring.datasource.slave1.password@ + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + filter: + stat: + log-slow-sql: false + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + slave2: + #MySQL + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.slave2.url@ + username: @spring.datasource.slave2.username@ + password: @spring.datasource.slave2.password@ + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + filter: + stat: + log-slow-sql: false + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true +# datasource: +# druid: +# #MySQL +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: @spring.datasource.druid.url@ +# username: @spring.datasource.druid.username@ +# password: @spring.datasource.druid.password@ +# initial-size: 10 +# max-active: 100 +# min-idle: 10 +# max-wait: 60000 +# pool-prepared-statements: true +# max-pool-prepared-statement-per-connection-size: 20 +# time-between-eviction-runs-millis: 60000 +# min-evictable-idle-time-millis: 300000 +# #Oracle需要打开注释 +# #validation-query: SELECT 1 FROM DUAL +# test-while-idle: true +# test-on-borrow: false +# test-on-return: false +# filter: +# stat: +# log-slow-sql: true +# slow-sql-millis: 1000 +# merge-sql: false +# wall: +# config: +# multi-statement-allow: true cloud: nacos: discovery: diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index acf894391f..8493df5d81 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -916,6 +916,21 @@ limit 1 + + + + + + + + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml index fe5a0ef73b..c46c387e01 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingUnitDao.xml @@ -59,5 +59,16 @@ and u.id=#{unitId} + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 8b900c90dd..ed9bc5acd9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -393,6 +393,7 @@ h.BUILDING_UNIT_ID, nh.AGENCY_ID, nh.GRID_ID, + h.FULL_NAME, nh.AGENCY_PIDS AS pids FROM ic_house h INNER JOIN ic_neighbor_hood nh ON (nh.ID = h.NEIGHBOR_HOOD_ID AND nh.DEL_FLAG = '0') @@ -549,5 +550,136 @@ and DOOR_NAME = #{doorName} + + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml index 2f76bc1b7a..96ec0dd57f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml @@ -662,6 +662,15 @@ ORDER BY SORT, DOOR_NAME+0 + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml index 5a5cf172a3..0b0aba046c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml @@ -48,4 +48,21 @@ ) + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java index 0408211603..24f8e387d0 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java @@ -16,4 +16,5 @@ public class IcEventResultDTO { private String reportUserName; private String mobile; private String address; + private String happenTime; } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/enums/ProjectOriginEnum.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/enums/ProjectOriginEnum.java new file mode 100644 index 0000000000..5388c889a9 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/enums/ProjectOriginEnum.java @@ -0,0 +1,46 @@ +package com.epmet.enums; + +/** + * 项目来源枚举 + * @author liujianjun + */ +public enum ProjectOriginEnum { + /** + * 项目来源 + */ + ISSUE("issue", "议题上报"), + AGENCY("agency", "直接立项"), + WORK_EVENT("work_event", "巡查上报"), + IC_EVENT("ic_event", "居民上报"), + RESI_EVENT("resi_event", "旧的居民上报(已废弃)"); + + private String code; + private String name; + + ProjectOriginEnum(String code, String name) { + this.code = code; + this.name = name; + } + + /** + * 根据sourceType查询对应的枚举对象 + * @param code + * @return + */ + public static ProjectOriginEnum getEnumByCode(String code) { + for (ProjectOriginEnum e : ProjectOriginEnum.values()) { + if (e.getCode().equals(code)) { + return e; + } + } + return null; + } + + public String getCode() { + return code; + } + + public String getName() { + return name; + } +} diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index eedd673afd..5eec77763e 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -341,6 +341,16 @@ epmet_gov_project_user EpmEt-db-UsEr + + + + epmet_gov_project_user + EpmEt-db-UsEr + + + + epmet_gov_project_user + EpmEt-db-UsEr 0 172.22.76.1:6379,172.22.76.20:6379,172.22.76.36:6379,172.22.76.1:6389,172.22.76.20:6389,172.22.76.36:6389 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java index c57ac318a6..7dba649107 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java @@ -397,4 +397,13 @@ public interface ProjectService extends BaseService { List staffPendingProject(ProjectListFromDTO fromDTO); PageData orgProjectList(OrgProjectListFormDTO formDTO); -} \ No newline at end of file + + /** + * desc:根据来源id和类型 删除项目 (只删了主表) + * @param originId + * @param origin + * @return + */ + Integer deleteByOriginId(String originId, String origin); + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java index f11fd1044d..dda3a90647 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java @@ -1,5 +1,6 @@ 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.*; @@ -19,6 +20,7 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.*; import com.epmet.constant.*; import com.epmet.dao.IcEventDao; @@ -29,6 +31,7 @@ import com.epmet.dto.form.demand.IcEventCommentToDemandFromDTO; import com.epmet.dto.result.*; import com.epmet.entity.*; import com.epmet.enums.EcEventProcessStatusEnum; +import com.epmet.enums.ProjectOriginEnum; import com.epmet.feign.*; import com.epmet.resi.group.constant.TopicConstant; import com.epmet.service.*; @@ -94,6 +97,8 @@ public class IcEventServiceImpl extends BaseServiceImpl effectRow = epmetHeartOpenFeignClient.deleteUserDemandByOriginId(entity.getId(), ProjectOriginEnum.IC_EVENT.getCode()); + log.info("delete userDemand result:{},eventId:{}", effectRow, id); + } + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); + wrapper.eq(IcEventEntity::getId,id).set(IcEventEntity::getUpdatedTime,new Date()) + .set(IcEventEntity::getCreatedBy,loginUserUtil.getLoginUserId()) + .set(IcEventEntity::getDelFlag,NumConstant.ONE_STR); + baseDao.update(null,wrapper); + } } /** @@ -916,7 +940,7 @@ public class IcEventServiceImpl extends BaseServiceImpl(list, pageInfo.getTotal()); } + @Override + public Integer deleteByOriginId(String originId, String origin) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper(); + wrapper.eq(ProjectEntity::getOriginId, originId) + .eq(ProjectEntity::getOrigin,origin) + .set(ProjectEntity::getUpdatedTime,new Date()) + .set(ProjectEntity::getCreatedBy,loginUserUtil.getLoginUserId()) + .set(ProjectEntity::getDelFlag,NumConstant.ONE_STR); + return baseDao.update(null, wrapper); + } + } diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml b/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml index f9cda54e57..d9ef717249 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml @@ -29,6 +29,102 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false +# sharding: +# default-data-source-name: master +# masterslave: +# name: ms +# master-data-source-name: master +# slave-data-source-names: slave1,slave2 +# #配置slave节点的负载均衡均衡策略,采用轮询机制 +# load-balance-algorithm-type: round_robin +# datasource: +# names: master,slave1,slave2 +# master: +# #MySQL +# type: com.alibaba.druid.pool.DruidDataSource +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: @spring.datasource.slave1.url@ +# username: @spring.datasource.slave1.username@ +# password: @spring.datasource.slave1.password@ +# initial-size: 10 +# max-active: 100 +# min-idle: 10 +# max-wait: 60000 +# pool-prepared-statements: true +# max-pool-prepared-statement-per-connection-size: 20 +# time-between-eviction-runs-millis: 60000 +# min-evictable-idle-time-millis: 300000 +# #Oracle需要打开注释 +# #validation-query: SELECT 1 FROM DUAL +# test-while-idle: true +# test-on-borrow: false +# test-on-return: false +# filter: +# stat: +# log-slow-sql: false +# slow-sql-millis: 1000 +# merge-sql: false +# wall: +# config: +# multi-statement-allow: true +# slave1: +# #MySQL +# type: com.alibaba.druid.pool.DruidDataSource +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: @spring.datasource.slave2.url@ +# username: @spring.datasource.slave2.username@ +# password: @spring.datasource.slave2.password@ +# initial-size: 10 +# max-active: 100 +# min-idle: 10 +# max-wait: 60000 +# pool-prepared-statements: true +# max-pool-prepared-statement-per-connection-size: 20 +# time-between-eviction-runs-millis: 60000 +# min-evictable-idle-time-millis: 300000 +# #Oracle需要打开注释 +# #validation-query: SELECT 1 FROM DUAL +# test-while-idle: true +# test-on-borrow: false +# test-on-return: false +# filter: +# stat: +# log-slow-sql: false +# slow-sql-millis: 1000 +# merge-sql: false +# wall: +# config: +# multi-statement-allow: true +# slave2: +# #MySQL +# type: com.alibaba.druid.pool.DruidDataSource +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: @spring.datasource.druid.url@ +# username: @spring.datasource.druid.username@ +# password: @spring.datasource.druid.password@ +# initial-size: 10 +# max-active: 100 +# min-idle: 10 +# max-wait: 60000 +# pool-prepared-statements: true +# max-pool-prepared-statement-per-connection-size: 20 +# time-between-eviction-runs-millis: 60000 +# min-evictable-idle-time-millis: 300000 +# #Oracle需要打开注释 +# #validation-query: SELECT 1 FROM DUAL +# test-while-idle: true +# test-on-borrow: false +# test-on-return: false +# filter: +# stat: +# log-slow-sql: false +# slow-sql-millis: 1000 +# merge-sql: false +# wall: +# config: +# multi-statement-allow: true datasource: druid: #MySQL @@ -118,6 +214,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml index ec9ff0745f..dd94828eb2 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml @@ -43,7 +43,8 @@ e.REPORT_USER_ID reportUserId, e.NAME reportUserName, e.MOBILE mobile, - e.STATUS processStatus + e.STATUS processStatus, + e.happen_time happenTime from ic_event e @@ -71,7 +72,7 @@ and c.CATEGORY_CODE like CONCAT(#{categoryCode},'%') - order by e.CREATED_TIME desc + order by e.happen_time desc @@ -22,13 +22,12 @@ set grid_name = #{gridName}, grid_level = #{gridLevel}, lng = #{lng}, - lat = #{lat}, - update_time = now() + lat = #{lat} where grid_code = #{gridCode} and is_del = 'N' - update grid_info_pingyin set is_del = 'Y',update_time = now() + update grid_info_pingyin set is_del = 'Y' where grid_code = #{gridCode} diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml index 81143e89e0..b13583aad1 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffInfoPingyinDao.xml @@ -16,7 +16,7 @@ - delete from gridstaff_info_pingyin + UPDATE gridstaff_info_pingyin set IS_LEAVE = 'Y' - \ No newline at end of file + diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffWorkInfoPingyinDao.xml b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffWorkInfoPingyinDao.xml index ea3bc11030..0cba8e6cf6 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffWorkInfoPingyinDao.xml +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/resources/mapper/GridstaffWorkInfoPingyinDao.xml @@ -19,8 +19,8 @@ - delete from gridstaff_work_info_pingyin LIMIT 1000 + update gridstaff_work_info_pingyin SET is_del = 'Y' LIMIT 1000 - \ No newline at end of file + diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/HasOperPermissionFormDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/HasOperPermissionFormDTO.java new file mode 100644 index 0000000000..0284894e54 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/HasOperPermissionFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class HasOperPermissionFormDTO { + + /** + * uri + */ + @NotBlank(message = "uri不能为空") + private String uri; + + /** + * http方法 + */ + @NotBlank(message = "请求http方法不能为空") + private String method; + + @NotBlank(message = "操作者ID不能为空") + private String operId; +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperResouce.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperResouce.java new file mode 100644 index 0000000000..5867da40ef --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperResouce.java @@ -0,0 +1,13 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class OperResouce { + + private String userId; + private String resourceUrl; + private String ResourceMethod; + + +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/OperAccessOpenFeignClient.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/OperAccessOpenFeignClient.java index 9e5a1b0771..6bae396ae4 100644 --- a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/OperAccessOpenFeignClient.java +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/OperAccessOpenFeignClient.java @@ -2,9 +2,12 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.HasOperPermissionFormDTO; import com.epmet.feign.fallback.OperAccessOpenFeignClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; /** * @Description 运营端权限模块 @@ -23,4 +26,18 @@ public interface OperAccessOpenFeignClient { **/ @GetMapping("/oper/access/menu/clearoperuseraccess") Result clearOperUserAccess(); + + /** + * 是否有该接口的权限 + * @return + */ + @PostMapping("/oper/access/menu/hasPermission") + Result hasOperPermission(@RequestBody HasOperPermissionFormDTO form); + + /** + * 需要验证的菜单资源 + * @return + */ + @PostMapping("/oper/access/menu/getExamineResourceUrls") + Result getExamineResourceUrls(); } diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/fallback/OperAccessOpenFeignClientFallback.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/fallback/OperAccessOpenFeignClientFallback.java index 46c4b182eb..0f20298bfa 100644 --- a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/fallback/OperAccessOpenFeignClientFallback.java +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/fallback/OperAccessOpenFeignClientFallback.java @@ -3,6 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.HasOperPermissionFormDTO; import com.epmet.feign.OperAccessOpenFeignClient; /** @@ -17,5 +18,15 @@ public class OperAccessOpenFeignClientFallback implements OperAccessOpenFeignCli return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "clearOperUserAccess"); } + + @Override + public Result hasOperPermission(HasOperPermissionFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "hasOperPermission"); + } + + @Override + public Result getExamineResourceUrls() { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "getExamineResourceUrls"); + } } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java index 63fc7d61df..c04455b92e 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java @@ -1,9 +1,11 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -12,7 +14,9 @@ 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.OperMenuDTO; +import com.epmet.dto.form.HasOperPermissionFormDTO; import com.epmet.dto.result.MenuResourceDTO; +import com.epmet.dto.result.OperResouce; import com.epmet.excel.OperMenuExcel; import com.epmet.service.OperMenuService; import com.epmet.service.OperResourceService; @@ -53,7 +57,7 @@ public class OperMenuController { //菜单资源列表 List resourceList = operResourceService.getMenuResourceList(id); - + data.setResourceList(resourceList); return new Result().ok(data); } @@ -161,4 +165,37 @@ public class OperMenuController { operMenuService.clearOperUserAccess(tokenDto.getApp(), tokenDto.getClient(), tokenDto.getUserId()); return new Result(); } + + /** + * 改运营人员是否有该接口的权限 + * @return + */ + @PostMapping("hasPermission") + public Result hasOperPermission(@RequestBody HasOperPermissionFormDTO form) { + ValidatorUtils.validateEntity(form); + String uri = form.getUri(); + String method = form.getMethod(); + + // if (!AppClientConstant.APP_OPER.equals(loginUserApp)) { + //// 只校验运营端,其他都返回true + // return new Result(); + // } + + Boolean isMathe = operMenuService.hasOperPermission(uri, method, form.getOperId()); + if (isMathe){ + return new Result(); + } else { + return new Result().error(); + } + } + + /** + * 需要验证的菜单资源 + * @return + */ + @PostMapping("getExamineResourceUrls") + public Result getExamineResourceUrls() { + List resources = operMenuService.getExamineResourceUrls(); + return new Result().ok(resources); + } } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java index 2858a76f24..4e38620c38 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java @@ -9,6 +9,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.OperResouce; import com.epmet.entity.OperMenuEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -49,4 +50,8 @@ public interface OperMenuDao extends BaseDao { * @param pid 父菜单ID */ List getListPid(String pid); + + List getOperResourcesByUserId(String operId); + + List getExamineResourceUrls(); } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java index f1b568f33a..4173845149 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java @@ -17,10 +17,13 @@ package com.epmet.redis; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.HttpContextUtils; import com.epmet.dto.OperMenuDTO; +import com.epmet.dto.result.OperResouce; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -71,4 +74,25 @@ public class OperMenuRedis { return (Set)redisUtils.get(key); } + public List getOperResourcesByUserId(String operId) { + String key = RedisKeys.operResourcesByUserId(operId); + String json = redisUtils.getString(key); + return JSON.parseObject(json, new TypeReference>(){}); + } + + public void setOperResourcesByUserId(String operId, List resouces) { + String key = RedisKeys.operResourcesByUserId(operId); + String jsonString = JSON.toJSONString(resouces); + redisUtils.setString(key, jsonString); + } + + /** + * 运营端用户资源删除 + * @param operId + * @param resouces + */ + public void deleteOperResourcesByUserId(String operId) { + String key = RedisKeys.operResourcesByUserId(operId); + redisUtils.delete(key); + } } \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java index 54e3a58067..a56dffb0ac 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.OperMenuDTO; +import com.epmet.dto.result.OperResouce; import com.epmet.entity.OperMenuEntity; import java.util.List; @@ -141,4 +142,8 @@ public interface OperMenuService extends BaseService { List getListPid(String pid); void clearOperUserAccess(String app, String client, String userId); + + Boolean hasOperPermission(String uri, String method, String loginUserId); + + List getExamineResourceUrls(); } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java index d83970486c..47667c980f 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java @@ -24,8 +24,11 @@ import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.enums.SuperAdminEnum; import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpContextUtils; @@ -34,6 +37,7 @@ import com.epmet.commons.tools.utils.TreeUtils; import com.epmet.dao.OperMenuDao; import com.epmet.dto.OperMenuDTO; import com.epmet.dto.OperUserDTO; +import com.epmet.dto.result.OperResouce; import com.epmet.entity.OperMenuEntity; import com.epmet.enums.MenuTypeEnum; import com.epmet.feign.EpmetUserFeignClient; @@ -48,6 +52,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.AntPathMatcher; import java.util.*; @@ -70,6 +75,10 @@ public class OperMenuServiceImpl extends BaseServiceImpl page(Map params) { @@ -112,6 +121,13 @@ public class OperMenuServiceImpl extends BaseServiceImpl operUserDTOResult = epmetUserFeignClient.info(operId); + if(!operUserDTOResult.success()||null==operUserDTOResult.getData()){ + logger.error("查询运营人员信息失败:operId:{}", operId); + return false; + } + + //系统管理员,拥有最高权限 + if(operUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){ + return true; + } + + // 不是系统管理员再具体查询 + List resouces = operMenuRedis.getOperResourcesByUserId(operId); + if (resouces == null) { + resouces = baseDao.getOperResourcesByUserId(operId); + operMenuRedis.setOperResourcesByUserId(operId, resouces); + } + + return pathMatcher(uri, method, resouces); + } + + private boolean pathMatcher(String requestUri, String method, List resources){ + for (OperResouce resource : resources) { + String resourceUrl = resource.getResourceUrl(); + String resourceMethod = resource.getResourceMethod(); + +// 路径匹配 && http方法 匹配 + if(antPathMatcher.match(resourceUrl, requestUri) && resourceMethod.equals(method)){ + return true; + } + } + return false; + } + + @Override + public List getExamineResourceUrls() { + return baseDao.getExamineResourceUrls(); + } } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java index 7af5d774c6..e9d80b6399 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java @@ -21,7 +21,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.OperRoleDao; import com.epmet.dto.OperRoleDTO; @@ -30,6 +33,7 @@ import com.epmet.redis.OperRoleRedis; import com.epmet.service.OperRoleMenuService; import com.epmet.service.OperRoleService; import com.epmet.service.OperRoleUserService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -46,6 +50,7 @@ import java.util.Map; * @since v1.0.0 2020-03-18 */ @Service +@Slf4j public class OperRoleServiceImpl extends BaseServiceImpl implements OperRoleService { @Autowired @@ -55,6 +60,9 @@ public class OperRoleServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -93,6 +101,13 @@ public class OperRoleServiceImpl extends BaseServiceImpl select t3.*, (select lang.field_value from oper_language lang where lang.table_name='oper_menu' and lang.field_name='name' and lang.table_id=t3.id and lang.language=#{language}) as name from oper_role_user t1 - left join oper_role_menu t2 on t1.role_id = t2.role_id - left join oper_menu t3 on t2.menu_id = t3.id - where t1.user_id = #{userId} and t3.del_flag = 0 + left join oper_role_menu t2 on (t1.role_id = t2.role_id AND t2.del_flag = 0) + left join oper_menu t3 on (t2.menu_id = t3.id) + where t1.user_id = #{userId} AND t1.del_flag = 0 and t3.del_flag = 0 and t2.DEL_FLAG = 0 and t3.type = #{type} @@ -39,4 +39,22 @@ select * from oper_menu where del_flag = 0 and pid = #{value} + + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml index b9075fceda..17f9602254 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml @@ -4,7 +4,7 @@ diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerParaResDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerParaResDTO.java new file mode 100644 index 0000000000..7c7954d9a4 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerParaResDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author yzm + * @Date 2022/9/8 10:44 + */ +@Data +public class CustomerParaResDTO implements Serializable { + /** + * 开启:open + * 关闭:closed + * 没有数据默认开启 + */ + private String govPartyHelper; +} + diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerParameterController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerParameterController.java index 006080bd6b..f31cd52346 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerParameterController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerParameterController.java @@ -1,9 +1,12 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.CrmParameterFormDTO; import com.epmet.dto.result.CrmParameterResultDTO; +import com.epmet.dto.result.CustomerParaResDTO; import com.epmet.service.CustomerParameterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -50,4 +53,14 @@ public class CustomerParameterController { return new Result(); } + /** + * 查询客户定制化参数 + * 比如党建小助手是否开启 + * @param tokenDto + * @return + */ + @PostMapping("customize") + public Result queryCustomerCustomize(@LoginUser TokenDto tokenDto){ + return new Result().ok(parameterService.queryCustomerCustomize(tokenDto.getCustomerId())); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerParameterService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerParameterService.java index 4ff8119c79..ba8055f90e 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerParameterService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerParameterService.java @@ -4,6 +4,7 @@ import com.epmet.dto.form.CrmParameterFormDTO; import com.epmet.dto.form.FootBarPatternFormDTO; import com.epmet.dto.form.FootBarPatternQueryFormDTO; import com.epmet.dto.result.CrmParameterResultDTO; +import com.epmet.dto.result.CustomerParaResDTO; import com.epmet.dto.result.FootBarPatternQueryResultDTO; import java.util.List; @@ -49,4 +50,12 @@ public interface CustomerParameterService { * @date 2021/7/27 17:24 */ void saveFootBarPattern(FootBarPatternFormDTO formDTO); + + /** + * 查询客户定制化参数 + * 比如党建小助手是否开启 + * @param customerId + * @return + */ + CustomerParaResDTO queryCustomerCustomize(String customerId); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java index fc7cd29f80..e00e1b54ac 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; @@ -10,6 +11,7 @@ import com.epmet.dto.form.FootBarPatternFormDTO; import com.epmet.dto.form.FootBarPatternQueryFormDTO; import com.epmet.dto.result.CheckFloatFootBarResultDTO; import com.epmet.dto.result.CrmParameterResultDTO; +import com.epmet.dto.result.CustomerParaResDTO; import com.epmet.dto.result.FootBarPatternQueryResultDTO; import com.epmet.entity.CustomerParameterEntity; import com.epmet.feign.OperCustomizeOpenFeignClient; @@ -146,5 +148,27 @@ public class CustomerParameterServiceImpl implements CustomerParameterService { } } + /** + * 查询客户定制化参数 + * 比如党建小助手是否开启 + * + * @param customerId + * @return + */ + @Override + public CustomerParaResDTO queryCustomerCustomize(String customerId) { + CustomerParaResDTO resDTO = new CustomerParaResDTO(); + resDTO.setGovPartyHelper("open"); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CustomerParameterEntity::getCustomerId, customerId) + .eq(CustomerParameterEntity::getParameterKey, "gov_party_helper") + .last("limit 1"); + CustomerParameterEntity customerParameterEntity = parameterDao.selectOne(queryWrapper); + if (null != customerParameterEntity) { + resDTO.setGovPartyHelper(customerParameterEntity.getParameterValue()); + } + return resDTO; + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 856a72c96d..fb26af5f00 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -229,8 +229,24 @@ public class CustomerServiceImpl extends BaseServiceImpl> queryCustomerList(CustomerFormDTO formDTO) { - List customerDTOList = baseDao.selectListByIds(formDTO.getCustomerIdList()); - return new Result>().ok(customerDTOList); + List result = new ArrayList<>(); + if(formDTO.getCustomerIdList() != null){ + for (String customerId : formDTO.getCustomerIdList()) { + //先从缓存取 取不到从数据库取 + CustomerDTO customerDTO = customerRedis.queryCustomerInfo(customerId); + if (customerDTO == null) { + CustomerEntity customerEntity = baseDao.selectById(customerId); + if (customerEntity != null) { + customerDTO = ConvertUtils.sourceToTarget(customerEntity, CustomerDTO.class); + } + } + if (customerDTO != null) { + result.add(customerDTO); + } + } + //List customerDTOList = baseDao.selectListByIds(formDTO.getCustomerIdList()); + } + return new Result>().ok(result); } @Override diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml index 9ab17b97da..714c45a95f 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml @@ -32,6 +32,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -126,6 +128,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -156,4 +164,4 @@ thread: queueCapacity: @thread.threadPool.queue-capacity@ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ - rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ \ No newline at end of file + rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.9__party_helper_param.sql b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.9__party_helper_param.sql new file mode 100644 index 0000000000..5cc11e5f73 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.9__party_helper_param.sql @@ -0,0 +1,3 @@ +INSERT INTO `epmet_oper_crm`.`customer_parameter` ( `ID`, `CUSTOMER_ID`, `PARAMETER_KEY`, `PARAMETER_NAME`, `PARAMETER_SWITCH`, `PARAMETER_VALUE`, `DESCRIPTION`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME` ) +VALUES + ( '5ce6f22c-2f22-11ed-bb6b-0050568f8cf7', 'default', 'gov_party_helper', '工作端党建小助手是否开启?', 'on', 'open', '开启:open;关闭:closed;不配置,默认是开启', 0, 0, 'APP_USER', '2022-09-08 11:03:35', 'APP_USER', '2022-09-08 11:03:45' ); \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcCustomerReportDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcCustomerReportDTO.java new file mode 100644 index 0000000000..0ea2fa3416 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcCustomerReportDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Data +public class IcCustomerReportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 报表id + */ + private String reportId; + + /** + * 客户id + */ + private String customerId; + + /** + * 删除标识:0.未删除 1.已删除; + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间=绑定时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java index e9d4a34b8c..660171fce0 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java @@ -74,7 +74,7 @@ public class IcFormItemGroupDTO implements Serializable { private Integer sort; /** - * 1展示,0不展示,默认1 + * 1展示,0不展示,默认1;像党员点击是,追加党员信息这种分组,默认0不展示 */ private Boolean display; diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcReportFunDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcReportFunDTO.java new file mode 100644 index 0000000000..894bda4613 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcReportFunDTO.java @@ -0,0 +1,64 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Data +public class IcReportFunDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * ic_customer_report.id + */ + private String customerReportId; + + /** + * 功能类别来源于字典表key;eg:resi_info,house_info + */ + private String funCategoryKey; + + /** + * 删除标识:0.未删除 1.已删除; + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间=绑定时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigFormDTO.java index 7d10474443..c5af9dc2c1 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigFormDTO.java @@ -74,5 +74,12 @@ public class IcResiCategoryStatsConfigFormDTO implements Serializable { private Integer level2; private Integer level3; - + /** + * 自动匹配:开启1;不匹配:0 + */ + private String autoMatching; + /** + * 育龄妇女年龄范围,英文逗号隔开的数字例如:18,49 + */ + private String ylfnValue; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/PreviewReportFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/PreviewReportFormDTO.java new file mode 100644 index 0000000000..c38eb53b1c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/PreviewReportFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Map; + +/** + * @Description + * @Author yzm + * @Date 2022/8/8 13:31 + */ +@Data +public class PreviewReportFormDTO { + public interface AddUserInternalGroup { + } + + @NotBlank(message = "reportId不能为空", groups = AddUserInternalGroup.class) + private String reportId; + @NotBlank(message = "categoryKey不能为空", groups = AddUserInternalGroup.class) + private String categoryKey; + private Map paramMap; + + @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) + private String customerId; + @NotBlank(message = "staffId不能为空", groups = AddUserInternalGroup.class) + private String staffId; +} + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java new file mode 100644 index 0000000000..67f0be2c22 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportBatchExportFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 报表批量导出form dto + */ +@Data +public class ReportBatchExportFormDTO { + + //private String token; + + private String paramKey; + + @NotBlank(message = "reportId必填") + private String reportId; + + private String id; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java new file mode 100644 index 0000000000..3bb7871caa --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportEditFormDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/8 14:04 + * @DESC + */ +@Data +public class ReportEditFormDTO implements Serializable { + + private static final long serialVersionUID = -2157859106926125470L; + + public interface ReportEditForm{} + + /** + * 操作类型,批量操作:add;单个编辑:edit + */ + @NotBlank(message = "type不能为空", groups = ReportEditForm.class) + private String type; + + @NotBlank(message = "reportId不能为空", groups = ReportEditForm.class) + private String reportId; + + @Valid + private List customerList; + + + @Data + public static class CustomerReportEditForm implements Serializable{ + + private static final long serialVersionUID = 8154093835160706134L; + + private List categoryKeys; + + @NotBlank(message = "customerId不能为空", groups = ReportEditForm.class) + private String customerId; + } +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportListFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportListFormDTO.java new file mode 100644 index 0000000000..4d67790aed --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ReportListFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/8 15:16 + * @DESC + */ +@Data +public class ReportListFormDTO implements Serializable { + + private static final long serialVersionUID = -4459838228433571457L; + + private List categoryKeys; + + private String customerId; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcResiCategoryStatsConfigResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcResiCategoryStatsConfigResultDTO.java index e161b60f6d..45ee8f8ce3 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcResiCategoryStatsConfigResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcResiCategoryStatsConfigResultDTO.java @@ -44,7 +44,10 @@ public class IcResiCategoryStatsConfigResultDTO implements Serializable { */ private String label; - + /** + * 列名 + */ + private String columnName; /** * 管理平台分类图标 @@ -84,4 +87,13 @@ public class IcResiCategoryStatsConfigResultDTO implements Serializable { * 等级3阈值 */ private Integer level3; + + /** + * 自动匹配:开启1;不匹配:0 + */ + private String autoMatching; + /** + * 育龄妇女年龄范围,英文逗号隔开的数字例如:18,49 + */ + private String ylfnValue; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/PreviewReportResDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/PreviewReportResDTO.java new file mode 100644 index 0000000000..aaff6e933b --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/PreviewReportResDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/8/8 13:37 + */ +@Data +public class PreviewReportResDTO { + private String reportId; + /** + * rediskey格式:customerId:reportId:resiinfo:staffId + */ + private String paramKey; +} + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java new file mode 100644 index 0000000000..2701957317 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java @@ -0,0 +1,94 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/8 10:29 + * @DESC + */ +@Data +public class ReportResultDTO implements Serializable { + + private static final long serialVersionUID = -5798816843431200300L; + + /** + * 报表名字 + */ + private String reportName; + + /** + * 报表ID + */ + private String reportId; + + private Boolean isList; + + /** + * 客户ID + */ + @JsonIgnore + private String customerId; + + /** + * 客户名字 + */ + @JsonIgnore + private String customerName; + + /** + * 分类名字 + */ + @JsonIgnore + private String categoryName; + + /** + * 分类key + */ + @JsonIgnore + private String categoryKey; + + /** + * 客户信息集合 + */ + private List customerList; + + + @Data + public static class CustomerList implements Serializable{ + + private static final long serialVersionUID = 7146198312265513418L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户名字 + */ + private String customerName; + + /** + * 分类名字 + */ + private String categoryName; + + /** + * 分类key + */ + private String categoryKey; + } + + public ReportResultDTO() { + this.reportName = ""; + this.reportId = ""; + this.isList = false; + this.customerList = new ArrayList<>(); + } +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/YlfnValueResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/YlfnValueResultDTO.java new file mode 100644 index 0000000000..9056944c83 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/YlfnValueResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/9/8 15:43 + */ +@Data +public class YlfnValueResultDTO implements Serializable { + private static final long serialVersionUID = -1416102274320519092L; + private String customerId; + private Integer min; + private Integer max; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index e93d9badaa..ce2063c361 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -178,5 +178,6 @@ public interface OperCustomizeOpenFeignClient { */ @PostMapping("/oper/customize/icformitemoptions/getItemConditions") Result> getOptionsMap(@RequestBody IcFormOptionsQueryFormDTO input); - + @PostMapping("/oper/customize/icresicategorystatsconfig/getYlfnValue") + Result> getYlfnValue(); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index e59af2b818..70debfecf3 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -142,4 +142,9 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getOptionsMap", input); } + @Override + public Result> getYlfnValue() { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getYlfnValue", null); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml index cfaf3a1772..7cee38b4f7 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml @@ -8,6 +8,7 @@ services: network_mode: host # 使用现有网络 volumes: - "/opt/epmet-cloud-logs/dev:/logs" + - "/opt/epmet_files/:/opt/epmet_files" environment: RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./oper-customize.jar" restart: "unless-stopped" diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index 9a45f623db..e192727b47 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -22,6 +22,11 @@ epmet-commons-tools 2.0.0 + + com.epmet + epmet-commons-feignclient + 2.0.0 + com.epmet epmet-commons-mybatis diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java index dc347a7c53..b5cbc36f11 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java @@ -23,5 +23,10 @@ public interface CustomerFunctionConstant { */ String PARAMETER_EXCEPTION = "请至少勾选一条默认功能或定制功能数据"; + String REPORT_CATEGORY = "jmreport_category"; + + String REPORT_EDIT = "edit"; + String REPORT_ADD = "add"; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java new file mode 100644 index 0000000000..6859f3e942 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -0,0 +1,108 @@ +package com.epmet.controller; + +import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.ReportRequest; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.*; +import com.epmet.dto.result.PreviewReportResDTO; +import com.epmet.dto.result.ReportResultDTO; +import com.epmet.service.IcCustomerReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.List; + + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@RestController +@RequestMapping("icCustomerReport") +public class IcCustomerReportController { + + @Autowired + private IcCustomerReportService icCustomerReportService; + + + /** + * Desc: 报表集合 + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + @PostMapping("list") + public Result> reportList(){ + return new Result>().ok(icCustomerReportService.reportList()); + } + + + /** + * 在居民信息或者房屋信息等页面点击填表,存储入参到redis,返给前端key + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("preview") + public Result previewReport(@LoginUser TokenDto tokenDto, @RequestBody PreviewReportFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, PreviewReportFormDTO.AddUserInternalGroup.class); + return new Result().ok(icCustomerReportService.previewReport(formDTO)); + } + /** + * Desc: 报表编辑 + * @param formDTO + * @author zxc + * @date 2022/8/8 14:09 + */ + @PostMapping("edit") + public Result reportEdit(@RequestBody ReportEditFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ReportEditFormDTO.ReportEditForm.class); + icCustomerReportService.reportEdit(formDTO); + return new Result(); + } + + /** + * Desc: 居民信息/房屋信息-查询报表 + * @param formDTO + * @author zxc + * @date 2022/8/8 15:20 + */ + @PostMapping("report-list") + public Result> reportIdAndName(@RequestBody ReportListFormDTO formDTO,@LoginUser TokenDto tokenDto){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(icCustomerReportService.reportIdAndName(formDTO)); + } + + /** + * 批量导出 + */ + @PostMapping("batch-export") + public void batchExport(@RequestBody ReportBatchExportFormDTO input, HttpServletResponse response) { + ValidatorUtils.validateEntity(input); + String reportId = input.getReportId(); + String paramKey = input.getParamKey(); + final String id = input.getId(); + + icCustomerReportService.batchExport(id, reportId, paramKey, response); + } + + @ReportRequest + @PostMapping("test") + public void test(@RequestBody ExportResiUserFormDTO input) { + + System.out.println(input); + } + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcReportFunController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcReportFunController.java new file mode 100644 index 0000000000..8f22b6939e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcReportFunController.java @@ -0,0 +1,70 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +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.IcReportFunDTO; +import com.epmet.service.IcReportFunService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@RestController +@RequestMapping("icReportFun") +public class IcReportFunController { + + @Autowired + private IcReportFunService icReportFunService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = icReportFunService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcReportFunDTO data = icReportFunService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcReportFunDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icReportFunService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcReportFunDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icReportFunService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icReportFunService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryStatsConfigController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryStatsConfigController.java index 775001770f..e8dbf8b1af 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryStatsConfigController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcResiCategoryStatsConfigController.java @@ -26,6 +26,7 @@ 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.IcResiCategoryStatsConfigDTO; +import com.epmet.dto.result.YlfnValueResultDTO; import com.epmet.excel.IcResiCategoryStatsConfigExcel; import com.epmet.service.IcResiCategoryStatsConfigService; import org.springframework.beans.factory.annotation.Autowired; @@ -96,4 +97,9 @@ public class IcResiCategoryStatsConfigController { return new Result>().ok(icResiCategoryStatsConfigService.getCategoryList(dto)); } + @PostMapping("getYlfnValue") + public Result> getYlfnValue() { + return new Result>().ok(icResiCategoryStatsConfigService.getYlfnValue()); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java new file mode 100644 index 0000000000..0972fd32b4 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -0,0 +1,40 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.ReportResultDTO; +import com.epmet.entity.IcCustomerReportEntity; +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 2022-08-08 + */ +@Mapper +public interface IcCustomerReportDao extends BaseDao { + + /** + * Desc: 报表集合 + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + List reportList(@Param("categoryKeys")List categoryKeys,@Param("customerId")String customerId); + + /** + * Desc: 根据客户IDs获取ids + * @param customerIds + * @author zxc + * @date 2022/8/8 15:39 + */ + List getIdsByCustomer(@Param("customerIds") List customerIds,@Param("reportId") String reportId); + + void delCustomerReport(@Param("customerIds") List customerIds,@Param("reportId")String reportId); + + void delCustomerReportFun(@Param("reportIds") List reportIds); + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcReportFunDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcReportFunDao.java new file mode 100644 index 0000000000..a1486095e2 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcReportFunDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcReportFunEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Mapper +public interface IcReportFunDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcCustomerReportEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcCustomerReportEntity.java new file mode 100644 index 0000000000..b43d2e9887 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcCustomerReportEntity.java @@ -0,0 +1,31 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_customer_report") +public class IcCustomerReportEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 报表id + */ + private String reportId; + + /** + * 客户id + */ + private String customerId; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java index af11e9b05c..0ce8f42320 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java @@ -71,7 +71,7 @@ public class IcFormItemGroupEntity extends BaseEpmetEntity { private Integer sort; /** - * 1展示,0不展示,默认1 + * 1展示,0不展示,默认1;像党员点击是,追加党员信息这种分组,默认0不展示 */ private Boolean display; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcReportFunEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcReportFunEntity.java new file mode 100644 index 0000000000..b39c7fea27 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcReportFunEntity.java @@ -0,0 +1,34 @@ +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 2022-08-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_report_fun") +public class IcReportFunEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * ic_customer_report.id + */ + private String customerReportId; + + /** + * 功能类别来源于字典表key;eg:resi_info,house_info + */ + private String funCategoryKey; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryStatsConfigEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryStatsConfigEntity.java index d0201db93d..4a292260b9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryStatsConfigEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryStatsConfigEntity.java @@ -80,4 +80,12 @@ public class IcResiCategoryStatsConfigEntity extends BaseEpmetEntity { */ private Integer sort; + /** + * 自动匹配:开启1;不匹配:0 + */ + private String autoMatching; + /** + * 育龄妇女年龄范围,英文逗号隔开的数字例如:18,49 + */ + private String ylfnValue; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java new file mode 100644 index 0000000000..297d342e19 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -0,0 +1,55 @@ +package com.epmet.service; + +import com.epmet.commons.feignclient.dtos.result.JiMuReportResultDTO; +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.form.PreviewReportFormDTO; +import com.epmet.dto.form.ReportEditFormDTO; +import com.epmet.dto.form.ReportListFormDTO; +import com.epmet.dto.result.PreviewReportResDTO; +import com.epmet.dto.result.ReportResultDTO; +import com.epmet.entity.IcCustomerReportEntity; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +public interface IcCustomerReportService extends BaseService { + + /** + * Desc: 报表集合 + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + List reportList(); + + /** + * 在居民信息或者房屋信息等页面点击填表,存储入参到redis,返给前端key + * @param formDTO + * @return + */ + PreviewReportResDTO previewReport(PreviewReportFormDTO formDTO); + + /** + * Desc: 报表编辑 + * @param formDTO + * @author zxc + * @date 2022/8/8 14:09 + */ + void reportEdit(ReportEditFormDTO formDTO); + + /** + * Desc: 居民信息/房屋信息-查询报表 + * @param formDTO + * @author zxc + * @date 2022/8/8 15:20 + */ + List reportIdAndName(ReportListFormDTO formDTO); + + void batchExport(String bizId, String reportId, String paramKey, HttpServletResponse response); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcReportFunService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcReportFunService.java new file mode 100644 index 0000000000..567609f0cf --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcReportFunService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcReportFunDTO; +import com.epmet.entity.IcReportFunEntity; + +import java.util.List; +import java.util.Map; + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +public interface IcReportFunService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-08-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-08-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcReportFunDTO + * @author generator + * @date 2022-08-08 + */ + IcReportFunDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-08 + */ + void save(IcReportFunDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-08 + */ + void update(IcReportFunDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-08 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryStatsConfigService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryStatsConfigService.java index f9092491aa..6f151130dd 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryStatsConfigService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcResiCategoryStatsConfigService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.result.CustomerCategoryShowAndWarnListResultDTO; +import com.epmet.dto.result.YlfnValueResultDTO; import com.epmet.entity.IcResiCategoryStatsConfigEntity; import java.util.List; @@ -111,4 +112,14 @@ public interface IcResiCategoryStatsConfigService extends BaseService getCustomerCategoryShowAndWarnList(String customerId); + /** + * 获取育龄妇女配置 + * + * @Param + * @Return {@link List< YlfnValueResultDTO>} + * @Author zhaoqifeng + * @Date 2022/9/8 15:50 + */ + List getYlfnValue(); + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java new file mode 100644 index 0000000000..2775448c20 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -0,0 +1,587 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.commons.feignclient.dtos.JiMuPage; +import com.epmet.commons.feignclient.dtos.JiMuResult; +import com.epmet.commons.feignclient.dtos.form.JiMuReportFormDTO; +import com.epmet.commons.feignclient.dtos.form.JimuReportExportRequestDTO; +import com.epmet.commons.feignclient.dtos.result.*; +import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.*; +import com.epmet.commons.tools.dto.form.DictListFormDTO; +import com.epmet.commons.tools.dto.result.DictListResultDTO; +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.redis.RedisUtils; +import com.epmet.commons.tools.utils.*; +import com.epmet.constant.CustomerFunctionConstant; +import com.epmet.dao.IcCustomerReportDao; +import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.PreviewReportFormDTO; +import com.epmet.dto.form.ReportEditFormDTO; +import com.epmet.dto.form.ReportListFormDTO; +import com.epmet.dto.result.PreviewReportResDTO; +import com.epmet.dto.result.ReportResultDTO; +import com.epmet.entity.IcCustomerReportEntity; +import com.epmet.entity.IcReportFunEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; +import com.epmet.service.IcCustomerReportService; +import com.epmet.service.IcReportFunService; +import feign.Response; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.MultiValueMap; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * 客户报表关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Service +@Slf4j +public class IcCustomerReportServiceImpl extends BaseServiceImpl implements IcCustomerReportService { + @Autowired + private RedisUtils redisUtils; + + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private IcReportFunService reportFunService; + @Autowired + private JiMuReportOpenFeignClient jiMuReportOpenFeignClient; + @Autowired + private ExecutorService executorService; + + + 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; + } + + /** + * Desc: 报表集合 + * + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + @Override + public List reportList() { + String authorization = EpmetRequestHolder.getHeader("Authorization"); + // 自定义header传递 + MultiValueMap headers = new HttpHeaders(); + headers.add("token", authorization); + JiMuResult> result = jiMuReportOpenFeignClient.getList(1, 10000, "", "datainfo", authorization, headers); + if (!result.isSuccess()) { + throw new EpmetException("获取所有jm报表失败"); + } + List> records = (List>) result.getResult().getRecords(); + List allReports = new ArrayList<>(); + for (Map record : records) { + allReports.add(ConvertUtils.mapToEntity(record, JiMuReportResultDTO.class)); + } + if (CollectionUtils.isEmpty(allReports)) { + return new ArrayList<>(); + } + List allReportList = new ArrayList<>(); + allReports.forEach(r -> { + ReportResultDTO dto = new ReportResultDTO(); + dto.setReportId(r.getId()); + dto.setReportName(r.getName()); + allReportList.add(dto); + }); + List reportList = baseDao.reportList(null, null); + if (CollectionUtils.isEmpty(reportList)) { + return allReportList; + } + Result> dictList = adminOpenFeignClient.dictList(new DictListFormDTO(CustomerFunctionConstant.REPORT_CATEGORY)); + if (!dictList.success()) { + throw new EpmetException("查询字典信息失败:" + CustomerFunctionConstant.REPORT_CATEGORY); + } + if (CollectionUtils.isNotEmpty(dictList.getData())) { + dictList.getData().forEach(d -> reportList.stream().filter(r -> d.getValue().equals(r.getCategoryKey())).forEach(r -> r.setCategoryName(d.getLabel()))); + } + Result> allCustomerList = operCrmOpenFeignClient.getAllCustomerList(); + if (!allCustomerList.success()) { + throw new EpmetException("获取客户信息失败..."); + } + if (CollectionUtils.isNotEmpty(allCustomerList.getData())) { + allCustomerList.getData().forEach(c -> reportList.stream().filter(r -> c.getId().equals(r.getCustomerId())).forEach(r -> r.setCustomerName(c.getCustomerName()))); + } + Map> groupByReport = reportList.stream().collect(Collectors.groupingBy(ReportResultDTO::getReportId)); + groupByReport.forEach((reportId, l) -> allReportList.stream().filter(a -> a.getReportId().equals(reportId)).forEach(a -> a.setCustomerList(ConvertUtils.sourceToTarget(l, ReportResultDTO.CustomerList.class)))); + return allReportList; + } + + /** + * 在居民信息或者房屋信息等页面点击填表,存储入参到redis,返给前端key + * + * @param formDTO + * @return + */ + @Override + public PreviewReportResDTO previewReport(PreviewReportFormDTO formDTO) { + // rediskey格式:customerId:reportId:resiinfo:staffId + PreviewReportResDTO reportResDTO = new PreviewReportResDTO(); + reportResDTO.setReportId(formDTO.getReportId()); + String key = "epmet:jmreport:paramkey:".concat(formDTO.getCustomerId()).concat(StrConstant.COLON).concat(formDTO.getReportId()).concat(StrConstant.COLON).concat(formDTO.getCategoryKey()).concat(StrConstant.COLON).concat(formDTO.getStaffId()); + redisUtils.hMSet(key, formDTO.getParamMap(), RedisUtils.DEFAULT_EXPIRE); + reportResDTO.setParamKey(key); + return reportResDTO; + } + + /** + * Desc: 报表编辑 + * + * @param formDTO + * @author zxc + * @date 2022/8/8 14:09 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void reportEdit(ReportEditFormDTO formDTO) { + List reportIds = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())) { + reportIds = baseDao.getIdsByCustomer(formDTO.getCustomerList().stream().map(m -> m.getCustomerId()).collect(Collectors.toList()), formDTO.getReportId()); + } + if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_EDIT)) { + // 单个编辑 + baseDao.delCustomerReport(Arrays.asList(formDTO.getCustomerList().get(NumConstant.ZERO).getCustomerId()), formDTO.getReportId()); + } else if (formDTO.getType().equals(CustomerFunctionConstant.REPORT_ADD)) { + baseDao.delCustomerReport(null, formDTO.getReportId()); + } + if (CollectionUtils.isNotEmpty(reportIds)) { + baseDao.delCustomerReportFun(reportIds); + } + if (CollectionUtils.isNotEmpty(formDTO.getCustomerList())) { + List entities = new ArrayList<>(); + List funEntities = new ArrayList<>(); + formDTO.getCustomerList().forEach(c -> { + IcCustomerReportEntity reportEntity = new IcCustomerReportEntity(); + reportEntity.setReportId(formDTO.getReportId()); + reportEntity.setCustomerId(c.getCustomerId()); + reportEntity.setId(IdWorker.getIdStr()); + if (CollectionUtils.isNotEmpty(c.getCategoryKeys())) { + c.getCategoryKeys().forEach(key -> { + IcReportFunEntity funEntity = new IcReportFunEntity(); + funEntity.setCustomerReportId(reportEntity.getId()); + funEntity.setFunCategoryKey(key); + funEntities.add(funEntity); + }); + } + entities.add(reportEntity); + }); + insetCustomerReportAndFun(entities, funEntities); + } + } + + /** + * Desc: 居民信息/房屋信息-查询报表 + * + * @param formDTO + * @author zxc + * @date 2022/8/8 15:20 + */ + @Override + public List reportIdAndName(ReportListFormDTO formDTO) { + List reportList = baseDao.reportList(formDTO.getCategoryKeys(), formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(reportList)) { + return new ArrayList<>(); + } + List recordIds = reportList.stream().map(m -> m.getReportId()).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); + List result = new ArrayList<>(); + recordIds.forEach(r -> { + JiMuReportFormDTO form = new JiMuReportFormDTO(); + form.setId(r); + String authorization = EpmetRequestHolder.getHeader("Authorization"); + // 自定义header传递 + MultiValueMap headers = new HttpHeaders(); + headers.add("token", authorization); + headers.add("Authorization", authorization); + JiMuResult> report = jiMuReportOpenFeignClient.getReport(r, "", "", headers); + if (!report.isSuccess()) { + throw new EpmetException("获取jm报表详情失败:" + r); + } + + JiMuResult>> fResult = jiMuReportOpenFeignClient.fieldTree(r); + String datasourceId = fResult.getResult().get(0).get(0).getDbId(); + + JiMuResult reportDbDataResultDTOJiMuResult = jiMuReportOpenFeignClient.loadDbData(datasourceId); + if (!reportDbDataResultDTOJiMuResult.isSuccess()){ + throw new EpmetException("获取报表dbData失败:"+r); + } + JiMuReportResultDTO data = ConvertUtils.mapToEntity(report.getResult(), JiMuReportResultDTO.class); + log.info(JSON.toJSONString(reportDbDataResultDTOJiMuResult)); + JimuReportDbDataResultDTO.ReportDB reportDb = reportDbDataResultDTOJiMuResult.getResult().getReportDb(); + if (null != reportDb){ + data.setIsList(reportDb.getIsList().equals(NumConstant.ONE_STR)); + } + data.setReportId(data.getId()); + data.setReportName(data.getName()); + result.add(data); + }); + return result; + } + + @Transactional(rollbackFor = Exception.class) + public void insetCustomerReportAndFun(List reportEntities, List funEntities) { + if (CollectionUtils.isNotEmpty(reportEntities)) { + insertBatch(reportEntities); + } + if (CollectionUtils.isNotEmpty(funEntities)) { + reportFunService.insertBatch(funEntities); + } + } + + @Override + public void batchExport(String bizId, String reportId, String paramKey, HttpServletResponse response) { + + // 1. 首先去积木服务,查询出报表数据源的详细信息,包括报表url,isList;获取到哪一列是id(idFieldName) + + // 查询报表的字段列表(含数据源列表) + JiMuResult>> fResult = jiMuReportOpenFeignClient.fieldTree(reportId); + if (fResult == null || !fResult.isSuccess()) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "根据报表id未找到字段列表,报表ID:" + reportId, "根据报表id未找到字段列表,报表ID:" + reportId); + } + String datasourceId = fResult.getResult().get(0).get(0).getDbId(); + + // 报表数据源信息 + JiMuResult dbData = jiMuReportOpenFeignClient.loadDbData(datasourceId); + if (fResult == null || !fResult.isSuccess()) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "根据报表id未找到数据源,报表ID:" + reportId, "根据报表id未找到数据源,报表ID:" + reportId); + } + JimuReportDbDataResultDTO.ReportDB reportDb = dbData.getResult().getReportDb(); + + // 报表简要信息 + JiMuResult reportBriefResult = jiMuReportOpenFeignClient.getReportBrief(reportId); + if (fResult == null || !fResult.isSuccess()) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "根据报表id未找到报表信息,报表ID:" + reportId, "根据报表id未找到报表信息,报表ID:" + reportId); + } + JiMuReportBriefResultDTO reportBrief = reportBriefResult.getResult(); + + // api的url + String apiUrl = reportDb.getApiUrl(); + // api方法 + String apiMethod = reportDb.getApiMethod(); + // 是否是集合 + //String isList = reportDb.getIsList(); + // 返回的列表中,哪个字段是ID + String idFieldName = null; + String nameFieldName = null; + boolean isHttps = false; + + Matcher matcher = Pattern.compile("(http://|https://).+idFieldName=(\\w+).+nameFieldName=(\\w+).*").matcher(apiUrl); + if (matcher.matches()) { + String proto = matcher.group(1); + if ("https://".equals(proto)) { + isHttps = true; + } + idFieldName = matcher.group(2); + nameFieldName = matcher.group(3); + } + + if (StringUtils.isBlank(idFieldName)) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "配置的业务api url缺少idFieldName列"); + } + if (StringUtils.isBlank(idFieldName)) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "配置的业务api url缺少nameFieldName列"); + } + + // 2. 调用该url的接口,获取到一个列表,根据idFieldName取出ID列 + HashMap idAndNames = listBizObjectIdAndName(bizId, paramKey, apiUrl, isHttps, idFieldName, nameFieldName, apiMethod); + + // 3. 然后以这一列作为查询条件,循环,继续调用该接口,得到单条数据,每一条数据都下载一个excel,最后将其打包为一个压缩包下载 + Path storePath = makeTemporaryDownloadDir(reportId); + + // 4.生成压缩文件 + Path zipFile = downloadAndCompress(storePath, reportId, reportBrief.getName(), paramKey, idAndNames); + + // 5.下载 + try (FileInputStream fis = new FileInputStream(zipFile.toFile())) { + ServletOutputStream os = response.getOutputStream(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-Type", "application/zip"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(zipFile.getFileName().toString(), "UTF-8")); + + IOUtils.copy(fis, os); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + Files.delete(zipFile); + } catch (IOException e) { + log.error("【报表批量导出】删除临时zip文件失败"); + } + } + } + + /** + * 批量下载 + * @param storePath 本次导出文件的存储路径,子目录包括:zip文件,时间戳命名的子目录用于存放临时excel(导出完成会删掉) + * @return 压缩文件路径 + */ + private Path downloadAndCompress(Path storePath, String reportId, String reportName, String paramKey, HashMap idAndNames) { + // 请求头 + Map headers = new HashMap<>(); + headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); + + // 请求体 + JimuReportExportRequestDTO param = new JimuReportExportRequestDTO(); + param.setExcelConfigId(reportId); + param.getQueryParam().setCurrentPageNo("1"); + param.getQueryParam().setCurrentPageSize(20); + param.getQueryParam().setPageNo("1"); + param.getQueryParam().setPageSize(20); + param.getQueryParam().setParamKey(paramKey); + param.getQueryParam().setToken(EpmetRequestHolder.getLoginUserAuthorizationToken()); + + HashMap files = new HashMap<>(); + + String currentTimeStr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")); + + // 创建存放xlsx的临时目录 + Path xlsxStorePath = storePath.resolve(currentTimeStr); + try { + Files.createDirectories(xlsxStorePath); + } catch (IOException e) { + throw new EpmetException("【报表批量导出】生成临时目录失败:" + xlsxStorePath.toString()); + } + + // 将所有id分片,交给多个线程并行处理 + ArrayList idList = new ArrayList<>(); + idList.addAll(idAndNames.keySet()); + List> idParts = ListUtils.partition(idList, 100); + + // 1. 循环下载所有id对应的excel(积木报表的导出接口有并发问题,多线程会导出空表,暂时不用多线程了) + CountDownLatch cdl = new CountDownLatch(idParts.size()); + for (List idPart : idParts) { + CompletableFuture.runAsync(() -> { + downloadXlsByBatchByBizId(reportId, idPart, param, xlsxStorePath, files, cdl); + }, executorService); + } + + // 等待多线程执行完成,再执行打包 + try { + cdl.await(); + } catch (InterruptedException e) { + log.error(ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException("【报表批量导出】CountDownLatch等待被中断"); + } + + // 2,打包 + Path zipFile = storePath.resolve(reportName + "_" + currentTimeStr + ".zip"); + try (final FileOutputStream fos = new FileOutputStream(zipFile.toFile()); + final ZipOutputStream zos = new ZipOutputStream(fos)) { + + // 循环每一个文件 + HashMap bizObjNameAndCount = new HashMap<>(32); + for (Map.Entry entry : files.entrySet()) { + String bizObjectId = entry.getKey(); + File file = entry.getValue(); + + String bizObjName = getNumberedObjName(bizObjNameAndCount, idAndNames.get(bizObjectId)); + + try (FileInputStream fis = new FileInputStream(file.getAbsolutePath())) { + zos.putNextEntry(new ZipEntry(String.format("%s_%s/%s_%s.xlsx", reportName, currentTimeStr, reportName, bizObjName))); + final byte[] buffer = new byte[10240]; + for (int len; (len = fis.read(buffer)) > 0; ) { + zos.write(buffer, 0, len); + } + } finally { + zos.closeEntry(); + } + } + + zos.flush(); + } catch (Exception e) { + log.error("【报表批量导出】压缩文件失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "压缩失败", "压缩失败"); + } finally { + // 删除临时文件 + cleanTemporaryFiles(storePath.resolve(currentTimeStr)); + } + + return zipFile; + } + + /** + * 为业务对象名称编号,解决重名对象问题 + * @param bizObjNameAndCount 业务对象名称/出现次数map + * @param bizObjName 原始业务对象名 + * @return + */ + public String getNumberedObjName(HashMap bizObjNameAndCount, String bizObjName) { + Integer nameCount = bizObjNameAndCount.get(bizObjName); + if (nameCount == null) { + nameCount = 1; + bizObjNameAndCount.put(bizObjName, nameCount); + } else { + bizObjNameAndCount.put(bizObjName, ++nameCount); + } + + if (nameCount > 1) { + bizObjName = String.format("%s(%d)", bizObjName, nameCount); + } + + return bizObjName; + } + + /** + * 批量下载xlsx + * @param reportId + * @param bizIds + * @param param + * @param xlsxStorePath + * @param files + */ + public void downloadXlsByBatchByBizId(String reportId, List bizIds, JimuReportExportRequestDTO param, + Path xlsxStorePath, Map files, CountDownLatch cdl) { + for (String id : bizIds) { + param.getQueryParam().setId(id); + final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); + // 取出文件后缀 + final LinkedList header = (LinkedList) response.headers().get("content-disposition"); + final Matcher matcher = Pattern.compile("attachment;filename=(.+)(.xls|.xlsx)").matcher(header.get(0)); + if (!matcher.matches()) { + log.error("【报表批量导出】批量导出失败,后缀不匹配。文件名:{}, 报表ID:{}, 业务数据ID:{}", header.get(0), reportId, id); + continue; + } + + final File excelFile = xlsxStorePath.resolve("file_" + id + matcher.group(2)).toFile(); + + files.put(id, excelFile); + try (FileOutputStream fos = new FileOutputStream(excelFile)) { + IOUtils.copy(response.body().asInputStream(), fos); + } catch (Exception e) { + log.error("【报表批量导出】生成临时表格文件失败,文件名:{},报表ID:{}, 业务数据ID:{},错误信息:{}", header.get(0), reportId, id, ExceptionUtils.getErrorStackTrace(e)); + } + } + + cdl.countDown(); + } + + /** + * 清理临时保存文件 + */ + private void cleanTemporaryFiles(Path tempStorePath) { + // 删除内部文件 + for (File file : tempStorePath.toFile().listFiles()) { + try { + Files.delete(file.toPath()); + } catch (IOException e) { + log.error("【报表批量导出】删除临时文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), null, null); + } + } + + // 删除文件夹 + try { + Files.delete(tempStorePath); + } catch (IOException e) { + log.error("【报表批量导出】删除临时目录失败:{}", ExceptionUtils.getErrorStackTrace(e)); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), null, null); + } + } + + /** + * 创建临时目录 + * + * @param reportId + * @return + */ + private Path makeTemporaryDownloadDir(String reportId) { + + String userId = EpmetRequestHolder.getLoginUserId(); + try { + return FileUtils.getAndCreateDirUnderEpmetFilesDir("report/batch_export/", reportId, userId); + } catch (IOException e) { + throw new EpmetException("报表】批量导出-创建临时目录失败,错误信息:" + ExceptionUtils.getErrorStackTrace(e)); + } + } + + /** + * 列出id和name列表(生成文件用到了name),批量下载用 + * + * @param apiUrl + * @param isHttps + * @param idFieldName + * @return + */ + public HashMap listBizObjectIdAndName(String id, String paramKey, String apiUrl, boolean isHttps, String idFieldName, String nameFieldName, String apiMethod) { + apiUrl = apiUrl.replace("'${id}'", id == null ? "" : id); + apiUrl = apiUrl.replace("'${paramKey}'", paramKey); + + Map headers = new HashMap<>(); + headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); + + Result stringResult; + // 请求方法0-get,1-post + if (NumConstant.ONE_STR.equals(apiMethod)) { + stringResult = HttpClientManager.getInstance().sendPost(apiUrl, isHttps, "{\"id\":\"" + (id == null ? "" : id) + "\"}", headers); + } else { + stringResult = HttpClientManager.getInstance().sendGet(apiUrl, isHttps, null, headers); + } + + JSONObject dataJsonObject = JSON.parseObject(stringResult.getData()); + Object data = dataJsonObject.get("data"); + + JSONArray array; + HashMap idAndNames = new HashMap<>(); + + if (data instanceof JSONObject) { + // 这种可能是pageData的 + JSONObject jo = (JSONObject) data; + array = jo.getJSONArray("list"); + } else { + // 可能是不分页的列表 + array = (JSONArray) data; + } + + for (ListIterator it = array.listIterator(); it.hasNext(); ) { + JSONObject e = (JSONObject) it.next(); + String idValue = e.getString(idFieldName); + String nameValue = e.getString(nameFieldName); + idAndNames.put(idValue, nameValue); + } + return idAndNames; + } +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java index bb75b51fc4..2871ac9a3e 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java @@ -105,7 +105,9 @@ public class IcFormServiceImpl extends BaseServiceImpl if (null == resultDTO) { throw new RenException(EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getCode(), EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getMsg()); } + //基础信息这个分组对应的id:客户id_0 String itemGroupId=formDto.getCustomerId().concat(StrConstant.UNDER_LINE).concat(NumConstant.ZERO_STR); + //查询的是基础信息这个分组下的组件 List itemList = baseDao.selectItemList(itemGroupId,resultDTO.getFormId(), formDto.getDynamic()); List groupList = baseDao.selectListGroup(resultDTO.getFormId()); resultDTO.setItemList(itemList); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcReportFunServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcReportFunServiceImpl.java new file mode 100644 index 0000000000..bf2e8bece1 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcReportFunServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.IcReportFunDao; +import com.epmet.dto.IcReportFunDTO; +import com.epmet.entity.IcReportFunEntity; +import com.epmet.service.IcReportFunService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 报表所属功能表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-08 + */ +@Service +public class IcReportFunServiceImpl extends BaseServiceImpl implements IcReportFunService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcReportFunDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcReportFunDTO.class); + } + + 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 IcReportFunDTO get(String id) { + IcReportFunEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcReportFunDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcReportFunDTO dto) { + IcReportFunEntity entity = ConvertUtils.sourceToTarget(dto, IcReportFunEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcReportFunDTO dto) { + IcReportFunEntity entity = ConvertUtils.sourceToTarget(dto, IcReportFunEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryStatsConfigServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryStatsConfigServiceImpl.java index d5bfdbd521..a00f800733 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryStatsConfigServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcResiCategoryStatsConfigServiceImpl.java @@ -22,11 +22,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; 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.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcResiCategoryStatsConfigDao; import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.result.CustomerCategoryShowAndWarnListResultDTO; +import com.epmet.dto.result.YlfnValueResultDTO; import com.epmet.entity.IcResiCategoryStatsConfigEntity; import com.epmet.redis.IcResiCategoryStatsConfigRedis; import com.epmet.service.IcResiCategoryStatsConfigService; @@ -37,6 +40,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; /** * 居民类别配置表 @@ -137,4 +141,33 @@ public class IcResiCategoryStatsConfigServiceImpl extends BaseServiceImpl(); } + /** + * 获取育龄妇女配置 + * + * @Param + * @Return {@link List< YlfnValueResultDTO >} + * @Author zhaoqifeng + * @Date 2022/9/8 15:50 + */ + @Override + public List getYlfnValue() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcResiCategoryStatsConfigEntity::getAutoMatching, NumConstant.ONE_STR); + wrapper.eq(IcResiCategoryStatsConfigEntity::getColumnName, "IS_YLFN"); + wrapper.isNotNull(IcResiCategoryStatsConfigEntity::getYlfnValue); + wrapper.ne(IcResiCategoryStatsConfigEntity::getYlfnValue,StrConstant.EPMETY_STR); + List list = baseDao.selectList(wrapper); + if(CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(item -> { + YlfnValueResultDTO dto = new YlfnValueResultDTO(); + dto.setCustomerId(item.getCustomerId()); + String[] ages = item.getYlfnValue().split(StrConstant.COMMA); + dto.setMin(Integer.valueOf(ages[0])); + dto.setMax(Integer.valueOf(ages[1])); + return dto; + }).collect(Collectors.toList()); + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml index 0e202f1678..ce28431363 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml @@ -32,7 +32,10 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: + druid: #MySQL driver-class-name: com.mysql.cj.jdbc.Driver @@ -120,6 +123,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -154,4 +163,4 @@ thread: queueCapacity: @thread.threadPool.queue-capacity@ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ - rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ \ No newline at end of file + rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.36__ic_customer_report.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.36__ic_customer_report.sql new file mode 100644 index 0000000000..5ceef02408 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.36__ic_customer_report.sql @@ -0,0 +1,12 @@ +CREATE TABLE `ic_customer_report` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `REPORT_ID` varchar(64) NOT NULL COMMENT '报表id', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除;', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间=绑定时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户报表关系表'; \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql new file mode 100644 index 0000000000..57e0fe6602 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql @@ -0,0 +1,12 @@ +CREATE TABLE `ic_report_fun` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_REPORT_ID` varchar(64) NOT NULL COMMENT 'ic_customer_report.id', + `FUN_CATEGORY_KEY` varchar(255) NOT NULL COMMENT '功能类别来源于字典表key;eg:resi_info,house_info', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除;', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间=绑定时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='报表所属功能表'; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.38__ylfnv.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.38__ylfnv.sql new file mode 100644 index 0000000000..4ff1496be2 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.38__ylfnv.sql @@ -0,0 +1,4 @@ +alter table ic_resi_category_stats_config + add COLUMN `AUTO_MATCHING` varchar(1) NOT NULL DEFAULT '0' COMMENT '自动匹配:开启1;不匹配:0' after SORT; + +alter table ic_resi_category_stats_config add COLUMN `YLFN_VALUE` varchar(32) DEFAULT NULL COMMENT '育龄妇女年龄范围,英文逗号隔开的数字例如:18,49' after AUTO_MATCHING; \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.39__itemgroup_child.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.39__itemgroup_child.sql new file mode 100644 index 0000000000..39c51d745e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.39__itemgroup_child.sql @@ -0,0 +1,9 @@ +ALTER TABLE ic_form_item_group MODIFY COLUMN `DISPLAY` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '1展示,0不展示,默认1;像党员点击是,追加党员信息这种分组,默认0不展示'; + +ALTER TABLE ic_form_item_group ADD COLUMN `CHILD_SHOW_FLAG` + TINYINT ( 1 ) NOT NULL DEFAULT '0' COMMENT '1展示,0不展示,默认0' AFTER POLICY_FLAG; + + +UPDATE ic_form_item_group g +set g.CHILD_SHOW_FLAG='1' +where g.DISPLAY='0' and g.LABEL !='基础信息'; \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml new file mode 100644 index 0000000000..1c9b98a2bb --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -0,0 +1,61 @@ + + + + + + + DELETE FROM ic_customer_report + WHERE REPORT_ID = #{reportId} + + AND CUSTOMER_ID IN ( + + #{c} + + ) + + + + DELETE FROM ic_report_fun + + WHERE CUSTOMER_REPORT_ID IN ( + + #{r} + + ) + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml index 3fd2eae45e..d0cca510ad 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml @@ -71,6 +71,7 @@ ic_form_item_group g WHERE g.DEL_FLAG = '0' + and g.CHILD_SHOW_FLAG='1' AND g.id =( SELECT DISTINCT i.ITEM_GROUP_ID @@ -237,7 +238,7 @@ FROM ic_form_item fi left join ic_form_item_group g on (fi.ITEM_GROUP_ID = g.ID and fi.DEL_FLAG = 0 and g.DEL_FLAG = 0) left join ic_form_item pitem on (pitem.DEL_FLAG = 0 and fi.PARENT_ITEM_ID = pitem.ID) - WHERE fi.FORM_ID = #{formId} + WHERE fi.FORM_ID = #{formId} and fi.DEL_FLAG = '0' ORDER BY fi.SORT ASC diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcReportFunDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcReportFunDao.xml new file mode 100644 index 0000000000..0da1a5ae81 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcReportFunDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryStatsConfigDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryStatsConfigDao.xml index f138b59d0d..49ec2d3bbd 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryStatsConfigDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryStatsConfigDao.xml @@ -26,6 +26,7 @@ select a.ID as id, a.LABEL as label, + a.COLUMN_NAME as columnName, a.MANAGEMENT_ICON as managementIcon, a.DATA_ICON as dataIcon, a.HOUSE_SHOW_ICON as houseShowIcon, @@ -34,7 +35,9 @@ b.LEVEL_1 as level1, b.LEVEL_2 as level2, b.LEVEL_3 as level3, - b.WARN + b.WARN, + a.AUTO_MATCHING as autoMatching, + a.YLFN_VALUE as ylfnValue from ic_resi_category_stats_config a left join ic_resi_category_warn_config b on a.TABLE_NAME = b.TABLE_NAME and a.COLUMN_NAME = b.COLUMN_NAME and b.DEL_FLAG =0 and b.CUSTOMER_ID = #{customerId} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java index 7994bf7d8d..d409b089b6 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java @@ -66,6 +66,12 @@ public class ResiGroupDTO implements Serializable { */ private String gridId; + /** + * 所属党组织 + */ + private String partyOrgId; + private String partyOrgPids; + /** * 状态:(审核通过 - approved 、 审核中 - under_auditting、 审核未通过 - rejected 、 已屏蔽 - hidden、 已关闭 - closed) Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审核未通过” diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java index bdfd703f91..404fc0d7e6 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java @@ -17,6 +17,8 @@ public class ApplyCreateGroupFormDTO implements Serializable { private static final long serialVersionUID = 1570620480398949075L; public interface AddUserInternalGroup { } + public interface AddPartyOrgGroup { + } /** * 添加用户操作的用户可见异常分组 * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup @@ -69,6 +71,10 @@ public class ApplyCreateGroupFormDTO implements Serializable { @NotBlank(message = "app不能为空",groups ={AddUserInternalGroup.class}) private String app; + @NotBlank(message = "所属党组织不能为空",groups ={AddPartyOrgGroup.class}) + private String partyOrgId; + private String partyOrgPids; + /** * 小组是否允许参观:允许:open;不允许:closed */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java index ed56de167a..ccf51fe58c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/EditGroupFormDTO.java @@ -35,5 +35,6 @@ public class EditGroupFormDTO { @NotBlank(message = "组介绍不能为空", groups = { SubmitGroupEditVG.class }) @Length(max = 500, message = "组介绍长度不能超过500个字", groups = { SubmitGroupEditVG.class }) private String groupIntroduction; + private String partyOrgId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResult2DTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResult2DTO.java index bb48e14b91..d3d1e38ddf 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResult2DTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResult2DTO.java @@ -67,5 +67,6 @@ public class ApplyingGroupDetailResult2DTO implements Serializable { * 未读已读标识 unread read * */ private String readFlag; + private String partyOrgName; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java index 205d2d433c..c528e049d6 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java @@ -77,4 +77,6 @@ public class ApplyingGroupDetailResultDTO implements Serializable { * */ private String operationId; + private String partyOrgId; + } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java index 7d08176f31..f7444bdc17 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupDetailResultDTO.java @@ -26,4 +26,8 @@ public class GroupDetailResultDTO { private String leaderId; /** 当前用户是否是群主 */ private String groupLeaderFlag; + /** + * 所属党组织 + */ + private String partyOrgId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java index 0cf88d6802..08e2bb91ee 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupEditionDetailResultDTO.java @@ -39,4 +39,5 @@ public class GroupEditionDetailResultDTO implements Serializable { * 群主的昵称 xx路-xx先生/女士 */ private String groupLeaderName; + private String partyOrgName; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java index 9244410c3b..bc092e7205 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberDTO.java @@ -43,6 +43,8 @@ public class ResiGroupMemberDTO implements Serializable { * 用户id,来源于customer_user.id */ private String customerUserId; + private String customerUserName; + private String customerUserMobile; /** * 小组id: 来源于resi_group表id diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index 6f0ae98c44..2adf4c9ddc 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.*; @@ -13,12 +14,14 @@ import com.epmet.resi.group.dto.topic.result.TopicInfoResultDTO; import com.epmet.resi.group.dto.topic.result.*; import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallbackFactory; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -320,4 +323,29 @@ public interface ResiGroupOpenFeignClient { */ @PostMapping("/resi/group/group/list-groups-by-member") Result> listGroupsByMember(@RequestBody GroupsByMemberFormDTO formDTO); + + /** + * 获取客户下支部小组,根据所属党组织分组 + * + * @Param + * @Return {@link Result>>} + * @Author zhaoqifeng + * @Date 2022/8/16 14:04 + */ + @PostMapping("/resi/group/group/getBranchGroupList") + Result>> getBranchGroupList(); + + /** + * @Author sun + * @Description 查询小组成员列表 + **/ + @PostMapping("/resi/group/member/groupmemberlist") + Result> groupMemberList(@RequestBody List groupIdList); + + /** + * @Author sun + * @Description 查询支部下党小组列表 + **/ + @PostMapping("/resi/group/group/partygrouplist/{partyOrgId}") + Result> partyGroupList(@PathVariable String partyOrgId); } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index 9e228b2dce..e3c6b08c47 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.*; @@ -13,9 +14,11 @@ import com.epmet.resi.group.dto.topic.result.TopicInfoResultDTO; import com.epmet.resi.group.dto.topic.result.*; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -234,4 +237,20 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien public Result> listGroupsByMember(GroupsByMemberFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "listGroupsByMember", formDTO); } + + @Override + public Result>> getBranchGroupList() { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getBranchGroupList", null); + } + + @Override + public Result> groupMemberList(List groupIdList) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "groupMemberList", groupIdList); + } + + @Override + public Result> partyGroupList(String partyOrgId) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "partyGroupList", partyOrgId); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index e374a32136..94da912a7b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -34,12 +34,14 @@ import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO; import com.epmet.resi.group.dto.member.form.ResiIdentityFormDTO; import com.epmet.resi.group.dto.member.result.AchievementResultDTO; import com.epmet.resi.group.enums.SearchScopeTypeEnum; +import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; +import java.util.Map; /** @@ -399,7 +401,7 @@ public class ResiGroupController { @PostMapping("submit-edit") public Result submitGroupEdit(@RequestBody EditGroupFormDTO form, @LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(form, EditGroupFormDTO.SubmitGroupEditVG.class); - resiGroupService.submitGroupEdit(form.getGroupId(), form.getGroupName(), form.getGroupHeadPhoto(), form.getGroupIntroduction(), tokenDto.getUserId()); + resiGroupService.submitGroupEdit(form.getGroupId(), form.getGroupName(), form.getGroupHeadPhoto(), form.getGroupIntroduction(), tokenDto.getUserId(), form.getPartyOrgId()); return new Result(); } @@ -649,4 +651,28 @@ public class ResiGroupController { List groups = resiGroupService.listGroupsByMember(userId, gridId); return new Result>().ok(groups); } + + /** + * 获取客户下支部小组,根据所属党组织分组 + * + * @Param tokenDto + * @Return {@link Result< Map< String, List< IcPartyOrgTreeDTO>>>} + * @Author zhaoqifeng + * @Date 2022/8/16 14:02 + */ + @PostMapping("getBranchGroupList") + public Result>> getBranchGroupList(@LoginUser TokenDto tokenDto) { + return new Result>>().ok(resiGroupService.getBranchGroupList(tokenDto.getCustomerId())); + } + + /** + * @Author sun + * @Description 查询支部下党小组列表 + **/ + @PostMapping("partygrouplist/{partyOrgId}") + Result> partyGroupList(@PathVariable String partyOrgId){ + return new Result>().ok(resiGroupService.partyGroupList(partyOrgId)); + } + + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java index 6b12507ce9..4675312559 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java @@ -346,4 +346,6 @@ public interface ResiGroupDao extends BaseDao { * @date 2021.09.08 14:00:52 */ List listGroupsByMember(@Param("memberUserId") String memberUserId, @Param("gridId") String gridId); + + List getMembersByGroup(@Param("ids")List ids); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java index a40c7b2d1f..ba6f29f424 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupEditSubmitRecordEntity.java @@ -52,6 +52,12 @@ public class GroupEditSubmitRecordEntity extends BaseEpmetEntity { */ private String gridId; + /** + * 所属党组织 + */ + private String partyOrgId; + private String partyOrgPids; + /** * 头像 */ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java index da522bfcab..cc35c91b5b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java @@ -62,6 +62,12 @@ public class ResiGroupEntity extends BaseEpmetEntity { */ private String gridId; + /** + * 所属党组织 + */ + private String partyOrgId; + private String partyOrgPids; + /** * 状态:(审核通过 - approved 、 审核中 - under_auditting、 审核未通过 - rejected 、 已屏蔽 - hidden、 已关闭 - closed) Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审核未通过” diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index 3aaab6e4d4..e03178d06b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java @@ -30,6 +30,7 @@ import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO; import com.epmet.resi.group.dto.member.result.AchievementResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; import java.util.HashMap; import java.util.List; @@ -310,7 +311,7 @@ public interface ResiGroupService extends BaseService { GroupDetailResultDTO getGroupDetail(String groupId); - void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction, String editUserId); + void submitGroupEdit(String groupId, String groupName, String groupHeadPhoto, String groupIntroduction, String editUserId, String partyOrgId); /** * @Description 工作端 查询组变更待审核列表 @@ -471,4 +472,15 @@ public interface ResiGroupService extends BaseService { * @date 2021.09.08 13:59:31 */ List listGroupsByMember(String memberUserId, String gridId); + + /** + * 获取客户下支部小组,根据所属党组织分组 + * @Param customerId + * @Return {@link Map< String, List>} + * @Author zhaoqifeng + * @Date 2022/8/15 16:49 + */ + Map> getBranchGroupList(String customerId); + + List partyGroupList(String partyOrgId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 3bb3a435d7..493d176a07 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.rocketmq.messages.GroupAchievementMQMsg; import com.epmet.commons.tools.constant.*; import com.epmet.commons.tools.enums.AchievementTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; @@ -43,6 +44,7 @@ import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.UserMessageTypeConstant; import com.epmet.dto.form.*; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserInfoResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; @@ -83,6 +85,9 @@ import com.epmet.resi.group.dto.member.form.EditAuditSwitchFormDTO; import com.epmet.resi.group.dto.member.result.AchievementResultDTO; import com.epmet.resi.group.dto.member.result.GroupAchievementDTO; import com.epmet.resi.group.enums.SearchScopeTypeEnum; +import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; +import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import com.epmet.send.SendMqMsgUtil; import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; @@ -97,6 +102,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronizationAdapter; import org.springframework.transaction.support.TransactionSynchronizationManager; +import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; @@ -120,7 +126,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { @@ -403,7 +411,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> partyOrgResult = resiPartyMemberOpenFeignClient.getPartyOrgList(); + if (!partyOrgResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取党组织信息失败", "获取党组织信息失败"); + } + if (partyOrgResult.getData().containsKey(applyCreateGroupFormDTO.getPartyOrgId())) { + applyCreateGroupFormDTO.setPartyOrgPids(partyOrgResult.getData().get(applyCreateGroupFormDTO.getPartyOrgId()).getOrgPids().concat(StrConstant.COLON).concat(applyCreateGroupFormDTO.getPartyOrgId())); + } else { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所选党组织不存在", "所选党组织不存在"); + } + } + String roleName = ""; if(NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())){ roleName = ModuleConstant.PARTYMEMBER; @@ -586,6 +607,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl().ok(ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class)); + ApplyingGroupDetailResult2DTO result = ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class); + + if (StringUtils.isNotBlank(detail.getPartyOrgId())) { + Result> partyOrgResult = resiPartyMemberOpenFeignClient.getPartyOrgList(); + if (!partyOrgResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取党组织信息失败", "获取党组织信息失败"); + } + if (partyOrgResult.getData().containsKey(detail.getPartyOrgId())) { + result.setPartyOrgName(partyOrgResult.getData().get(detail.getPartyOrgId()).getPartyOrgName()); + } + } + + + return new Result().ok(result); } @Override @@ -1135,7 +1171,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> partyOrgResult = resiPartyMemberOpenFeignClient.getPartyOrgList(); + if (!partyOrgResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取党组织信息失败", "获取党组织信息失败"); + } + if (partyOrgResult.getData().containsKey(partyOrgId)) { + partyOrgPids = partyOrgResult.getData().get(partyOrgId).getOrgPids().concat(StrConstant.COLON).concat(partyOrgId); + } else { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所选党组织不存在", "所选党组织不存在"); + } + } // 3.内容检查 scanGroupEditContent(groupName, groupIntroduction, groupHeadPhoto); @@ -1537,6 +1590,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> partyOrgResult = resiPartyMemberOpenFeignClient.getPartyOrgList(); + if (!partyOrgResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取党组织信息失败", "获取党组织信息失败"); + } + if (partyOrgResult.getData().containsKey(edit.getPartyOrgId())) { + result.setPartyOrgName(partyOrgResult.getData().get(edit.getPartyOrgId()).getPartyOrgName()); + } + } + return result; } @@ -1863,4 +1928,64 @@ public class ResiGroupServiceImpl extends BaseServiceImpl listGroupsByMember(String memberUserId, String gridId) { return baseDao.listGroupsByMember(memberUserId, gridId); } + + /** + * 获取客户下支部小组,根据所属党组织分组 + * + * @param customerId + * @Param customerId + * @Return {@link Map< String, List>} + * @Author zhaoqifeng + * @Date 2022/8/15 16:49 + */ + @Override + public Map> getBranchGroupList(String customerId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ResiGroupEntity::getCustomerId, customerId); + wrapper.eq(ResiGroupEntity::getGroupType, ModuleConstant.GROUP_TYPE_BRANCH); + List entityList = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(entityList)) { + return Collections.emptyMap(); + } + List groupIds = entityList.stream().map(m -> m.getId()).collect(Collectors.toList()); + List membersByGroup = baseDao.getMembersByGroup(groupIds); + Result> listResult = epmetUserOpenFeignClient.queryUserBaseInfo(membersByGroup.stream().map(m -> m.getCustomerUserId()).collect(Collectors.toList())); + if (!listResult.success()){ + throw new EpmetException("查询居民信息失败..."); + } + membersByGroup.stream().forEach(m -> listResult.getData().stream().filter(u -> u.getUserId().equals(m.getCustomerUserId())).forEach(u -> { + m.setCustomerUserMobile(u.getMobile()); + m.setCustomerUserName(u.getRealName()); + })); + List list = entityList.stream().filter(i -> StringUtils.isNotBlank(i.getPartyOrgId())).map(item -> { + IcPartyOrgTreeDTO dto = new IcPartyOrgTreeDTO(); + dto.setId(item.getId()); + dto.setOrgPids(item.getPartyOrgPids()); + dto.setPid(item.getPartyOrgId()); + dto.setPartyOrgType(NumConstant.SIX_STR); + dto.setPartyOrgName(item.getGroupName()); + return dto; + }).collect(Collectors.toList()); + list.stream().forEach(l -> membersByGroup.stream().filter(m -> m.getResiGroupId().equals(l.getId())).forEach(m -> { + l.setPrincipal(m.getCustomerUserName()); + l.setPrincipalMobile(m.getCustomerUserMobile()); + })); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.groupingBy(IcPartyOrgTreeDTO::getPid)); + } + + @Override + public List partyGroupList(String partyOrgId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ResiGroupEntity::getPartyOrgId, partyOrgId); + wrapper.eq(ResiGroupEntity::getDelFlag, NumConstant.ZERO_STR); + List entityList = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(entityList)) { + return new ArrayList<>(); + } + return ConvertUtils.sourceToTarget(entityList, ResiGroupDTO.class); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java index c3d7547d07..cf99c5a61b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java @@ -24,16 +24,14 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.form.*; import com.epmet.resi.group.dto.member.result.ApplyingMemberResultDTO; import com.epmet.resi.group.dto.member.result.GridVotableCountResultDTO; import com.epmet.resi.group.dto.member.result.GroupMemberListResultDTO; import com.epmet.resi.group.dto.member.result.JoinGroupApplyRealTimeResultDTO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -206,4 +204,10 @@ public class ResiGroupMemberController { ValidatorUtils.validateEntity(param); return new Result().ok(operationService.applyEnterByLink(param)); } + + @PostMapping("groupmemberlist") + public Result> groupMemberList(@RequestBody List groupIdList){ + return new Result>().ok(resiGroupMemberService.groupMemberList(groupIdList)); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java index daf4e23248..c6c5501de7 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java @@ -181,4 +181,6 @@ public interface ResiGroupMemberDao extends BaseDao { int countAllMembers(@Param("customerId") String customerId, @Param("groupId") String groupId); int exitGroupById(@Param("id") String id, @Param("updatedBy") String updatedBy); + + List groupMemberList(@Param("groupIdList") List groupIdList); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java index 8027971cb6..2355fd5a2a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java @@ -262,4 +262,6 @@ public interface ResiGroupMemberService extends BaseService groupMemberList(List groupIdList); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index a933306cb2..773bf9ebf1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -1036,4 +1036,9 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl groupMemberList(List groupIdList) { + return baseDao.groupMemberList(groupIdList); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 48b68b15d5..244bec4d5d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -1559,9 +1559,9 @@ public class ResiTopicServiceImpl extends BaseServiceImpl{ if(topicInfo.getPublishedUser().equals(re.getUserId())){ //话题发起人 - String street = re.getStreet() == null ? "" : re.getStreet() + "-"; +// String street = re.getStreet() == null ? "" : re.getStreet() + "-"; String realName = re.getRealName() == null ? "" : re.getRealName(); - topicInfo.setPublishedUser(street + realName); + topicInfo.setPublishedUser(realName); } }); } else { @@ -2754,7 +2754,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index ff7060f839..af37ca8cc6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -250,4 +250,19 @@ WHERE id = #{id} + + diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml b/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml index 8a3e2fc9a2..6fcb9f365c 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml @@ -32,6 +32,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -121,6 +123,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -151,4 +159,4 @@ thread: queueCapacity: @thread.threadPool.queue-capacity@ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ - rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ \ No newline at end of file + rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ diff --git a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java index 69ebc4476c..27478b1f63 100644 --- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java +++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/result/IssueDetailResultDTO.java @@ -43,7 +43,7 @@ public class IssueDetailResultDTO implements Serializable { private String belongsGridName; /** - * 议题发起人(山东路168-尹女士) + * 议题发起人(尹女士) */ private String issueInitiator; diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 2156bddd41..fabcb5939e 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -104,9 +104,8 @@ public class IssueServiceImpl implements IssueService { resultDTOList.forEach(re->{ if(issueResult.getUserId().equals(re.getUserId())){ //话题发起人 - String street = re.getStreet() == null ? "" : re.getStreet() + "-"; String realName = re.getRealName() == null ? "" : re.getRealName(); - issueDetailResult.setIssueInitiator(street + realName); + issueDetailResult.setIssueInitiator(realName); } }); } else { diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java index e39bd2182c..c9a2f9996e 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java @@ -7,6 +7,7 @@ import com.epmet.dto.form.LatestGridInfoFormDTO; import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.modules.grid.service.ResiMineGridService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -63,7 +64,12 @@ public class ResiMineGridController { //formDTO.setAppId(appId); formDTO.setCustomerId(token.getCustomerId()); formDTO.setUserId(token.getUserId()); - return new Result().ok(resiMineGridService.latestGridInfo(formDTO)); + LatestGridInfoResultDTO data = resiMineGridService.latestGridInfo(formDTO); + //todo 兼容 一个老的 等删除这个if就行 + if ((data == null || StringUtils.isBlank(data.getGridId())&&"c2527f3d5cb8958583cc1348c328a784".equals(token.getCustomerId()))){ + return new Result().ok(null); + } + return new Result().ok(data); } /** diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java index 48ea31f06b..8666aca88c 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java @@ -1,7 +1,10 @@ package com.epmet.modules.mine.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.EditInfoFormDTO; @@ -10,6 +13,7 @@ import com.epmet.dto.form.SendCodeFormDTO; import com.epmet.modules.mine.service.PersonalCenterService; import com.epmet.resi.mine.dto.result.InitInfoResultDTO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -55,6 +59,12 @@ public class PersonalCenterController { formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); ValidatorUtils.validateEntity(formDTO,EditInfoFormDTO.AddUserShowGroup.class,EditInfoFormDTO.AddUserInternalGroup.class); + if (StringUtils.isNotBlank(formDTO.getIdNum())){ + boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdNum()); + if (!b){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号"); + } + } personalCenterService.editInfo(tokenDto, formDTO); return new Result(); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml b/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml index 4fc19e9bd7..45ed220213 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml @@ -104,6 +104,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -129,4 +135,4 @@ thread: queueCapacity: @thread.threadPool.queue-capacity@ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ - rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ \ No newline at end of file + rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActDTO.java new file mode 100644 index 0000000000..15094578aa --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActDTO.java @@ -0,0 +1,180 @@ +package com.epmet.resi.partymember.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 党建组织活动 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Data +public class IcPartyActDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID:当前工作人员所属组织id + */ + private String orgId; + + /** + * 组织ID的上级;如果org_id是根组织,那此列=0 + */ + private String pid; + + /** + * ORG_ID全路径,包含自身 + */ + private String orgIdPath; + + /** + * 发布活动党组织 + */ + private String publishPartyOrgId; + + /** + * 发布活动党组织名称 + */ + private String publishPartyOrgName; + + /** + * 参加活动党组织ID的上级节点 + */ + private String publishOrgPid; + + /** + * 党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组 + */ + private String publishOrgType; + + /** + * PARTY_ORG_ID的全路径,包含自身。方便前端回显 + */ + private String publishOrgPath; + + /** + * 活动类型,0:支部党员大会;1:支部委员会;2:党小组会;3:党课;4:主题党日;5:为民服务活动; + */ + private String actType; + + /** + * 活动举办时间:yyyy + */ + private String holdYearId; + + /** + * 活动举办时间:yyyyMM + */ + private String holdMonthId; + + /** + * 举办活动时间 + */ + private Date holdTime; + + /** + * 活动主题 + */ + private String topic; + + /** + * 活动地点 + */ + private String address; + + /** + * 活动地点纬度 + */ + private String latitude; + + /** + * 活动地点经度 + */ + private String longitude; + + /** + * 活动开始前几天 + */ + private Integer autoPublicType; + + /** + * 自动发布时间,保存时算好时间存在这里 + */ + private Date autoPublicTime; + + /** + * 参加人员类型,0:全体党员;1:支部委员 + */ + private String joinUserType; + + /** + * 是否自动通知参加人员,0否;1是 + */ + private String isAutoInform; + + /** + * 活动介绍 + */ + private String introduce; + + /** + * 是否发布,0未发布;1已发布; + */ + private String isPublish; + + /** + * 活动发布人 + */ + private String publishStaffId; + + /** + * 活动发布人姓名 + */ + private String publishStaffName; + + /** + * 0未删除;1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActOrgDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActOrgDTO.java new file mode 100644 index 0000000000..0bfc7c123b --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActOrgDTO.java @@ -0,0 +1,84 @@ +package com.epmet.resi.partymember.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 参加活动党组织表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Data +public class IcPartyActOrgDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 活动id + */ + private String icPartyActId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 参加活动党组织ID,groupId + */ + private String joinOrgId; + + /** + * 党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组 + */ + private String orgType; + + /** + * 参加活动党组织ID的上级节点 + */ + private String pid; + + /** + * PARTY_ORG_ID的全路径,包含自身。方便前端回显 + */ + private String joinOrgPath; + + /** + * 0:未删除;1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActSignInRecordDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActSignInRecordDTO.java new file mode 100644 index 0000000000..8800ba1170 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcPartyActSignInRecordDTO.java @@ -0,0 +1,94 @@ +package com.epmet.resi.partymember.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 党组织活动签到记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Data +public class IcPartyActSignInRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 活动id + */ + private String icPartyActId; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 签到用户id + */ + private String epmetUserId; + + /** + * 签到用户姓名 + */ + private String userRealName; + + /** + * 签到地点 + */ + private String address; + + /** + * 签到地点纬度 + */ + private String latitude; + + /** + * 签到地点经度 + */ + private String longitude; + + /** + * 0:未删除;1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcScheduleDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcScheduleDTO.java new file mode 100644 index 0000000000..c96a47b194 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/IcScheduleDTO.java @@ -0,0 +1,105 @@ +package com.epmet.resi.partymember.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 日程表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Data +public class IcScheduleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所属行政组织ID:当前工作人员所属组织id + */ + private String orgId; + + /** + * 组织ID的上级;如果org_id是根组织,那此列=0 + */ + private String pid; + + /** + * ORG_ID全路径,包含自身 + */ + private String orgIdPath; + + /** + * 当前登录用户userId + */ + private String staffId; + + /** + * 日程标题(35字) + */ + private String title; + + /** + * 提醒时间;其实就是日程所属日期 + */ + private Date remindTime; + + /** + * 发生时间 + */ + private Date happenedTime; + + /** + * 是否公开,0:仅自己可见;1:组织内其他人可见 + */ + private String isPublic; + + /** + * 备注(500字) + */ + private String remark; + + /** + * 0:未删除;1已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/BatchAddPartyActFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/BatchAddPartyActFormDTO.java new file mode 100644 index 0000000000..128eaaae3a --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/BatchAddPartyActFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.partymember.dto.icpartyact.form; + +import lombok.Data; + +import javax.validation.Valid; +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/8/22 12:25 + */ +@Data +public class BatchAddPartyActFormDTO implements Serializable { + private static final long serialVersionUID = 2616937693642413548L; + private List delActIds; + @Valid + private List actList; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java new file mode 100644 index 0000000000..bb1b090fe7 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActAddOrUpdateFormDTO.java @@ -0,0 +1,172 @@ +package com.epmet.resi.partymember.dto.icpartyact.form; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/8/19 9:58 + */ +@Data +public class IcPartyActAddOrUpdateFormDTO implements Serializable { + private static final long serialVersionUID = -2554822505755122067L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + public interface UpdateUserInternalGroup { + } + + public interface UpdateUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "customerId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class}) + private String customerId; + + @NotBlank(message = "publishStaffId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class}) + private String publishStaffId; + + @NotBlank(message = "icPartyActId不能为空", groups = {UpdateUserInternalGroup.class}) + private String icPartyActId; + + /** + * 活动类型,来源于ic_party_act_type_dict + */ + @NotBlank(message = "活动类型不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String actType; + + /** + * 活动举办时间:yyyy + */ + @NotBlank(message = "holdYearId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class}) + private String holdYearId; + + /** + * 活动举办时间:yyyyMM + */ + @NotBlank(message = "holdMonthId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class}) + private String holdMonthId; + + /** + * 举办活动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @NotNull(message = "活动举办时间不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private Date holdTime; + + /** + * 活动主题 + */ + @NotBlank(message = "活动主题不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + @Length(max = 35, message = "活动主题最多输入35个字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String topic; + + /** + * 活动地点 + */ + @NotBlank(message = "活动地点不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + @Length(max = 100, message = "活动地点最多输入100字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String address; + + /** + * 活动地点纬度 + */ + private String latitude; + + /** + * 活动地点经度 + */ + private String longitude; + + /** + * 活动开始前几天,字典接口返回的 + * 0,1,3,5,7天 + */ + @NotNull(message = "自动发布时间不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private Integer autoPublicType; + /** + * 发布活动党组织 + */ + @NotBlank(message = "发布活动党组织不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String publishPartyOrgId; + + /** + * 发布活动党组织名称 + */ + @NotBlank(message = "发布活动党组织名称不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String publishPartyOrgName; + + /** + * 发布活动党组织ID的上级节点 + */ + @NotBlank(message = "参加活动党组织ID的上级节点不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class}) + private String publishOrgPid; + + /** + * 发布活动党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组 + */ + @NotBlank(message = "发布活动党组织类型不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String publishOrgType; + + /** + * 发布活动党组织PUBLISH_PARTY_ORG_ID的全路径,包含自身。方便前端回显 + */ + // 后端接口内部去赋值,无需前端传入了 + private String publishOrgPath; + + /** + * 发布活动党组织路径,前端用此列 + * 先放开不限制必填 + */ + // @NotBlank(message = "publishOrgPathShow不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class}) + private String publishOrgPathShow; + + /** + * 参加人员类型,0:全体党员;1:支部委员 + */ + @NotBlank(message = "参加人员类型不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String joinUserType; + + /** + * 是否自动通知参加人员,0否;1是 + */ + @NotBlank(message = "自动通知参加人员不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String isAutoInform; + + /** + * 活动介绍 + */ + // @NotBlank(message = "活动介绍不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + @Length(max = 1000, message = "活动介绍最多输入1000字", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private String introduce; + + /** + * 参加活动党组织 + */ + @Valid + @NotEmpty(message = "参加活动党组织不能为空", groups = {AddUserShowGroup.class, UpdateUserShowGroup.class}) + private List joinOrgList; + + + /** + * 附件表 + */ + private List attachmentList; + +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActPageFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActPageFormDTO.java new file mode 100644 index 0000000000..7e35c92f39 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/IcPartyActPageFormDTO.java @@ -0,0 +1,45 @@ +package com.epmet.resi.partymember.dto.icpartyact.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @Author yzm + * @Date 2022/8/19 10:02 + */ +@Data +public class IcPartyActPageFormDTO extends PageFormDTO implements Serializable { + private static final long serialVersionUID = -8171649039313981541L; + // tokenDto取值 + @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) + private String customerId; + @NotBlank(message = "publishStaffId不能为空",groups = AddUserInternalGroup.class) + private String publishStaffId; + /** + * 接口内部查询 + * 当前登录用户所属的行政组织id + */ + private String staffAgencyId; + // 界面传参数 + private String publishPartyOrgId; + private String startDate; + private String endDate; + private String address; + private String topic; + private String isPublish; + private String actType; + + /** + * 工作端小程序用yyyy + */ + private String holdYearId; + /** + * 工作端小程序用yyyyMM + */ + private String holdMonthId; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/JoinOrgDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/JoinOrgDTO.java new file mode 100644 index 0000000000..81b141c93e --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/form/JoinOrgDTO.java @@ -0,0 +1,71 @@ +package com.epmet.resi.partymember.dto.icpartyact.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @Author yzm + * @Date 2022/8/19 10:31 + */ +@Data +public class JoinOrgDTO implements Serializable { + private static final long serialVersionUID = 6994576136698569857L; + + //前端传入 + /** + * 参加活动党组织ID,groupId + */ + @NotBlank(message = "参加活动党组织不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class}) + private String joinOrgId; + /** + * 参加党组织名称 + */ + @NotBlank(message = "参加党组织名称不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class}) + private String joinOrgName; + /** + * 党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组 + */ + @NotBlank(message = "参加活动党组织类型不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class}) + private String orgType; + + /** + * 参加活动党组织ID的上级节点 + */ + @NotBlank(message = "参加活动党组织不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserInternalGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserInternalGroup.class}) + private String pid; + + /** + * PARTY_ORG_ID的全路径,包含自身。方便前端回显 + */ + // 后端接口内部去赋值,无需前端传入了 + private String joinOrgPath; + + /** + * PARTY_ORG_ID的全路径,前端用 + * 先放开不限制必填 + */ + // @NotBlank(message = "joinOrgPathShow不能为空", groups = {IcPartyActAddOrUpdateFormDTO.AddUserInternalGroup.class, IcPartyActAddOrUpdateFormDTO.UpdateUserInternalGroup.class}) + private String joinOrgPathShow; + + //接口内部赋值 + /** + * 活动id + */ + private String icPartyActId; + + /** + * 客户ID + */ + private String customerId; + + /** + * ic_party_act_org.id + * 详情接口返回 + */ + private String icPartyActOrgRecId; + +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartActTypeDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartActTypeDTO.java new file mode 100644 index 0000000000..5242b94d7b --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartActTypeDTO.java @@ -0,0 +1,17 @@ +package com.epmet.resi.partymember.dto.icpartyact.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/8/18 18:45 + */ +@Data +public class IcPartActTypeDTO { + private String label; + private String value; + private Integer yearCount; + private String frequencyDesc; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartyActDetailResDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartyActDetailResDTO.java new file mode 100644 index 0000000000..564f101fb9 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartyActDetailResDTO.java @@ -0,0 +1,142 @@ +package com.epmet.resi.partymember.dto.icpartyact.result; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.resi.partymember.dto.icpartyact.form.JoinOrgDTO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/8/19 10:08 + */ +@Data +public class IcPartyActDetailResDTO implements Serializable { + private static final long serialVersionUID = -8102085878449811977L; + private String customerId; + + private String publishStaffId; + + private String icPartyActId; + + /** + * 活动类型,来源于ic_party_act_type_dict + */ + private String actType; + private String actTypeName; + + /** + * 活动举办时间:yyyy + */ + private String holdYearId; + + /** + * 活动举办时间:yyyyMM + */ + private String holdMonthId; + + /** + * 举办活动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date holdTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date autoPublicTime; + + /** + * 活动主题 + */ + private String topic; + + /** + * 活动地点 + */ + private String address; + + /** + * 活动地点纬度 + */ + private String latitude; + + /** + * 活动地点经度 + */ + private String longitude; + + /** + * 活动开始前几天 + */ + private Integer autoPublicType; + + private String autoPublicTypeDesc; + /** + * 发布活动党组织 + */ + private String publishPartyOrgId; + + /** + * 发布活动党组织名称 + */ + private String publishPartyOrgName; + + /** + * 发布活动党组织ID的上级节点 + */ + private String publishOrgPid; + + /** + * 发布活动党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组 + */ + private String publishOrgType; + + /** + * 发布活动党组织PUBLISH_PARTY_ORG_ID的全路径,包含自身。方便前端回显 + */ + private String publishOrgPath; + + /** + *发布活动党组织路径,前端用此列 + */ + private String publishOrgPathShow; + + /** + * 参加人员类型,0:全体党员;1:支部委员 + */ + private String joinUserType; + private String joinUserTypeName; + + + /** + * 是否自动通知参加人员,0否;1是 + */ + private String isAutoInform; + + /** + * 活动介绍 + */ + private String introduce; + + /** + * 参加活动党组织 + */ + private List joinOrgList; + + /** + * 附件表 + */ + private List attachmentList; + + private Boolean isSignIn; + + private String publishStaffName; + /** + * 是否发布,0未发布;1已发布; + */ + private String isPublish; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartyActPageResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartyActPageResultDTO.java new file mode 100644 index 0000000000..f28f8a0083 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/icpartyact/result/IcPartyActPageResultDTO.java @@ -0,0 +1,83 @@ +package com.epmet.resi.partymember.dto.icpartyact.result; + +import com.epmet.resi.partymember.dto.icpartyact.form.JoinOrgDTO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/8/19 10:06 + */ +@Data +public class IcPartyActPageResultDTO implements Serializable { + private static final long serialVersionUID = 1414832133227703667L; + + private String icPartyActId; + /** + * 活动主题 + */ + private String topic; + + /** + * 发布活动党组织名称 + */ + private String publishPartyOrgName; + + /** + * 活动发布人姓名 + */ + private String publishStaffName; + + /** + * 活动类型,来源于ic_party_act_type_dict + */ + private String actType; + + /** + * 活动类型,来源于ic_party_act_type_dict + */ + private String actTypeName; + + /** + * 举办活动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date holdTime; + + /** + * 活动地点 + */ + private String address; + + /** + * 是否发布,0未发布;1已发布; + */ + private String isPublish; + + /** + * 活动发布人 + */ + private String publishStaffId; + + //以下返参,用于导出 + /** + * 是否发布,0未发布;1已发布; + * 返回名称 + */ + private String isPublishName; + /** + * 参加人员类型,0:全体党员;1:支部委员 + */ + private String joinUserType; + private String joinUserTypeName; + + private List joinOrgList; + //导出用 + private String joinOrgNameStr; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/IcPartyActTypeDictDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/IcPartyActTypeDictDTO.java new file mode 100644 index 0000000000..bfcc4d97a2 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/IcPartyActTypeDictDTO.java @@ -0,0 +1,77 @@ +package com.epmet.resi.partymember.dto.partyOrg; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 党组织活动类型字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Data +public class IcPartyActTypeDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 活动类型key + */ + private String typeKey; + + /** + * 活动名称 + */ + private String typeName; + + /** + * 每年几次 + */ + private Integer yearCount; + + /** + * 频次单位 + */ + private String frequencyUnit; + + /** + * 频次数量 + */ + private Integer frequencyCount; + + /** + * 频率描述 + */ + private String frequencyDesc; + + /** + * 排序 + */ + private Integer sort; + + /** + * 0未删除;1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + private String label; + private String value; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/IcPartyOrgDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/IcPartyOrgDTO.java index b5d26e1ee6..a6ee2e449e 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/IcPartyOrgDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/IcPartyOrgDTO.java @@ -84,6 +84,21 @@ public class IcPartyOrgDTO implements Serializable { */ private String address; + /** + * 负责人 + */ + private String principal; + + /** + * 负责人staffId + */ + private String principalStaffId; + + /** + * 联系电话 + */ + private String principalMobile; + /** * 党组织介绍 */ diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/ActAndScheduleListFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/ActAndScheduleListFormDTO.java new file mode 100644 index 0000000000..46ee2bdaed --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/ActAndScheduleListFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/8/19 13:52 + * @DESC + */ +@Data +public class ActAndScheduleListFormDTO implements Serializable { + + private static final long serialVersionUID = -6776882545589530612L; + + private String startDate; + private String endDate; + private String dateId; + private String yearId = ""; + + /** + * 是否本人创建的活动,1:是;0:否 + */ + private String isSelf; + + /** + * 党组织ID + */ + private String orgId; + + private String customerId; + private String staffId; + private String agencyId; + private String path; + + /** + * 当seachType = 'yearSearch'时,不需要查询党组织 + */ + private String searchType = ""; + + private String type = ""; +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/AddOrEditScheduleFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/AddOrEditScheduleFormDTO.java new file mode 100644 index 0000000000..c1e50df6c7 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/AddOrEditScheduleFormDTO.java @@ -0,0 +1,51 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2022/8/18 16:23 + * @DESC + */ +@Data +public class AddOrEditScheduleFormDTO implements Serializable { + + private static final long serialVersionUID = 6290505458783549828L; + + public interface AddScheduleForm{} + + private String scheduleId; + private String staffId; + private String customerId; + + /** + * 日程标题(35字) + */ + @NotBlank(message = "title不能为空",groups = AddScheduleForm.class) + private String title; + + /** + * 提醒时间;其实就是日程所属日期 + */ + @NotNull(message = "remindTime不能为空",groups = AddScheduleForm.class) + private Date remindTime; + + /** + * 是否公开,0:仅自己可见;1:组织内其他人可见 + */ + @NotBlank(message = "isPublic不能为空",groups = AddScheduleForm.class) + private String isPublic; + + @NotNull(message = "happenedTime不能为空",groups = AddScheduleForm.class) + private Date happenedTime; + + /** + * 备注(500字) + */ + private String remark; +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/EditPrincipalFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/EditPrincipalFormDTO.java new file mode 100644 index 0000000000..c518b0ef7e --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/EditPrincipalFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/7 15:02 + * @DESC + */ +@Data +public class EditPrincipalFormDTO implements Serializable { + + private static final long serialVersionUID = -1006713792388125512L; + + /** + * 负责人 + */ + @NotBlank(message = "principal不能为空",groups = AddGroup.class) + private String principal; + + @NotBlank(message = "partyOrgId不能为空",groups = AddGroup.class) + private String partyOrgId; + + /** + * 联系电话 + */ + @NotBlank(message = "principalMobile不能为空",groups = AddGroup.class) + private String principalMobile; + + @NotBlank(message = "principalStaffId不能为空",groups = AddGroup.class) + private String principalStaffId; +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/HomeMonthTotalFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/HomeMonthTotalFormDTO.java new file mode 100644 index 0000000000..cc9f2cdd8d --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/HomeMonthTotalFormDTO.java @@ -0,0 +1,48 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/8/19 08:59 + * @DESC + */ +@Data +public class HomeMonthTotalFormDTO implements Serializable { + + private static final long serialVersionUID = 1128815856169903825L; + + public interface HomeMonthTotalForm{} + + /** + * 年份ID + */ + @NotBlank(message = "yearId不能为空",groups = HomeMonthTotalForm.class) + private String yearId; + + /** + * 党支部ID + */ + @NotBlank(message = "orgId不能为空",groups = HomeMonthTotalForm.class) + private String orgId; + + /** + * 是否本人创建的活动,1:是;0:否 + */ + @NotBlank(message = "isSelf不能为空",groups = HomeMonthTotalForm.class) + private String isSelf; + + private String staffId; + + private String customerId; + + /** + * 工作人员所属组织ID + */ + private String agencyId; + + // private String path; +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcPartyActListFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcPartyActListFormDTO.java new file mode 100644 index 0000000000..e9095b546f --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcPartyActListFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class IcPartyActListFormDTO implements Serializable { + /** + * 活动类型,0:支部党员大会;1:支部委员会;2:党小组会;3:党课;4:主题党日;5:为民服务活动; + */ + private String actType; + /** + * 签到状态[已签到:signIn 未签到:unSignIn] + */ + private String signIn; + /** + * 标题内容 模糊检索 + */ + private String topic; + + //参加活动党组织ID,groupId + private String joinOrgId; + + private Integer pageNo = 1; + private Integer pageSize = 20; + private Boolean isPage = true; + + //token中信息 + private String customerId; + private String userId; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcScheduleFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcScheduleFormDTO.java new file mode 100644 index 0000000000..859a8634fd --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/IcScheduleFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +public class IcScheduleFormDTO implements Serializable { + /** + * 日程标题 + */ + private String title; + /** + * 是否公开,0:仅自己可见;1:组织内其他人可见 + */ + private String isPublic; + /** + * 提醒开始时间 + */ + private String startTime; + /** + * 提醒结束时间 + */ + private String endTime; + + private Integer pageNo = 1; + private Integer pageSize = 20; + private Boolean isPage = true; + private String agencyId; + + //token中信息 + private String customerId; + private String staffId; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActSignFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActSignFormDTO.java new file mode 100644 index 0000000000..96c28eda43 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActSignFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +public class PartyActSignFormDTO implements Serializable { + /** + * 活动Id + */ + @NotBlank(message = "活动Id不能为空",groups = {UpdateGroup.class}) + private String icPartyActId; + /** + * 网格Id + */ + @NotBlank(message = "网格Id不能为空",groups = {AddGroup.class}) + private String gridId; + /** + * 签到地点 + */ + @NotBlank(message = "签到地点不能为空",groups = {AddGroup.class}) + private String address; + /** + * 签到地点纬度 + */ + @NotBlank(message = "签到地点纬度不能为空",groups = {AddGroup.class}) + private String latitude; + /** + * 签到地点经度 + */ + @NotBlank(message = "签到地点经度不能为空",groups = {AddGroup.class}) + private String longitude; + + private Integer pageNo = 1; + private Integer pageSize = 20; + private Boolean isPage = true; + + //token中信息 + private String customerId; + private String userId; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActStatisFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActStatisFormDTO.java new file mode 100644 index 0000000000..b2206cf169 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyActStatisFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +@Data +public class PartyActStatisFormDTO implements Serializable { + + /** + * 参加活动党组织ID,groupId + */ + @NotBlank(message = "党组织Id不能为空", groups = AddGroup.class) + private String joinOrgId; + + /** + * 活动开始时间 【yyyy-MM-dd】 + */ + private String startTime; + + /** + * 活动结束时间 【yyyy-MM-dd】 + */ + private String endTime; + + //党组织Id集合 + private List partyOrgIdList; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgListFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgListFormDTO.java new file mode 100644 index 0000000000..4314e566c2 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgListFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +public class PartyOrgListFormDTO implements Serializable { + /** + * 网格Id + */ + @NotNull(message = "网格Id不能为空", groups = AddGroup.class) + private String gridId; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgTreeListDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgTreeListDTO.java index 862d5e6c58..cdf2d7a80d 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgTreeListDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgTreeListDTO.java @@ -23,7 +23,7 @@ public class PartyOrgTreeListDTO implements Serializable { * 客户Id (customer.id) */ private String customerId; - + private String staffId; /** * 党组织pid */ diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/YearSearchFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/YearSearchFormDTO.java new file mode 100644 index 0000000000..5f92c375de --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/YearSearchFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.resi.partymember.dto.partyOrg.form; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/8/22 09:26 + * @DESC + */ +@Data +public class YearSearchFormDTO implements Serializable { + + private static final long serialVersionUID = 4557112229519696741L; + + public interface YearSearchForm{} + + @NotBlank(message = "yearId不能为空",groups = YearSearchForm.class) + private String yearId; + + private String type; + + /** + * 是否本人创建的活动,1:是;0:否 + */ + private String isSelf = NumConstant.ONE_STR; + + private String staffId; + private String customerId; +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java new file mode 100644 index 0000000000..bc320d7a8c --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/ActAndScheduleListResultDTO.java @@ -0,0 +1,87 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/19 13:41 + * @DESC + */ +@Data +public class ActAndScheduleListResultDTO implements Serializable { + + private static final long serialVersionUID = 7378300105829566449L; + + private Integer scheduleTotal; + private Integer activityTotal; + private String dateId; + + private List activityList; + + private List scheduleList; + + + @Data + public static class ActivityListDTO implements Serializable{ + + private static final long serialVersionUID = -9050507457068805831L; + + private String activityId; + private String staffId; + private String dateId; + private String topic; + private String address; + private String holdTime; + private String autoPublicTime; + private String isAutoInformValue; + private String isAutoInform; + private String autoInformDay; + private String type; + private String actTypeName; + private String isPublicValue; + private String isPublish; + private String joinTypeValue; + private String joinUserType; + private List joinOrgList; + private List joinOrgs; + private Boolean isMe = false; + + } + + @Data + public static class ScheduleListDTO implements Serializable{ + + private static final long serialVersionUID = 5372167729733804267L; + + private String scheduleId; + private String title; + private String remindTime; + private String happenedTime; + private String remark; + private Boolean isMe = false; + private String staffId; + private String dateId; + } + + @Data + public static class JoinOrgDTO implements Serializable{ + + private static final long serialVersionUID = -981758371558960097L; + + private String partyOrgId; + private String partyOrgName; + } + + public ActAndScheduleListResultDTO() { + this.scheduleTotal = NumConstant.ZERO; + this.activityTotal = NumConstant.ZERO; + this.dateId = ""; + this.activityList = new ArrayList<>(); + this.scheduleList = new ArrayList<>(); + } +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/DefaultPartyOrgResDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/DefaultPartyOrgResDTO.java new file mode 100644 index 0000000000..5474c78ba3 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/DefaultPartyOrgResDTO.java @@ -0,0 +1,39 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author yzm + * @Date 2022/8/22 10:25 + */ +@Data +public class DefaultPartyOrgResDTO implements Serializable { + private static final long serialVersionUID = -7563161453372080189L; + /** + * 当前登录用户所属的组织 + */ + private String staffAgencyId; + /** + * 当前登录用户所属的组织名称 + */ + private String staffAgencyName; + /** + * 当前登录用户所属的行政组织下,默认的党组织名称 + */ + private String defaultPartyOrgId; + private String defaultPartyOrgPid; + /** + * 党组织名称 + */ + private String defaultPartyOrgName; + /** + * 党组织路径 + */ + private String defaultPartyOrgPath; + + private String orgType; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/HomeMonthTotalResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/HomeMonthTotalResultDTO.java new file mode 100644 index 0000000000..f3ba554fd6 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/HomeMonthTotalResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/8/19 08:57 + * @DESC + */ +@Data +public class HomeMonthTotalResultDTO implements Serializable { + + private static final long serialVersionUID = -4647982500373510830L; + + private String monthId; + + private Integer count; + + public HomeMonthTotalResultDTO() { + this.monthId = ""; + this.count = NumConstant.ZERO; + } +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyActListResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyActListResultDTO.java new file mode 100644 index 0000000000..8644aa81c2 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyActListResultDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import com.epmet.resi.partymember.dto.partymember.result.AdditionalInfoDTO; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@NoArgsConstructor +@Data +public class IcPartyActListResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 活动Id + */ + private String icPartyActId; + /** + * 活动主题 + */ + private String topic; + /** + * 活动类型,0:支部党员大会;1:支部委员会;2:党小组会;3:党课;4:主题党日;5:为民服务活动; + */ + private String actType; + /** + * 活动类型,0:支部党员大会;1:支部委员会;2:党小组会;3:党课;4:主题党日;5:为民服务活动; + */ + private String actTypeName; + /** + * 活动时间 + */ + private String holdTime; + /** + * 活动地点 + */ + private String address; + /** + * 签到状态[已签到:signIn 未签到:unSignIn] + */ + private String signIn; + /** + * 签到状态名 + */ + private String signInName; + + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgInfo.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgInfo.java new file mode 100644 index 0000000000..5aba21de9a --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgInfo.java @@ -0,0 +1,33 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author yzm + * @Date 2022/8/23 13:10 + */ +@Data +public class IcPartyOrgInfo implements Serializable { + /** + * 党组织ID + */ + private String id; + /** + * 党组织的上级ID,没有上级时为0 + */ + private String orgPid; + /** + * 党组织名称 + */ + private String partyOrgName; + + /** + * 党组织的id全路径(包含自身) + */ + private String partyOrgIdPath; + private String partyOrgNamePath; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgTreeDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgTreeDTO.java index cb5bf1b927..7888f71899 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgTreeDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcPartyOrgTreeDTO.java @@ -53,6 +53,16 @@ public class IcPartyOrgTreeDTO implements Serializable { */ private String partyOrgName; + /** + * 负责人 + */ + private String principal; + + /** + * 联系电话 + */ + private String principalMobile; + private List children = new ArrayList<>(); diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcScheduleListDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcScheduleListDTO.java new file mode 100644 index 0000000000..8f6b83bd33 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/IcScheduleListDTO.java @@ -0,0 +1,71 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 日程表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Data +public class IcScheduleListDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 当前登录用户userId + */ + private String staffId; + + /** + * 日程标题(35字) + */ + private String title; + + /** + * 提醒时间;其实就是日程所属日期 + */ + private Date remindTime; + private Date happenedTime; + + /** + * 提醒时间;其实就是日程所属日期 + */ + private String remindTimeName; + + /** + * 是否公开,0:仅自己可见;1:组织内其他人可见 + */ + private String isPublic; + + /** + * 是否公开,0:是 1:否 + */ + private String isPublicName; + + /** + * 备注(500字) + */ + private String remark; + + /** + * 创建时间 + */ + private Date createdTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/PartyActStatisResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/PartyActStatisResultDTO.java new file mode 100644 index 0000000000..5f87fa3fb7 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/PartyActStatisResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@NoArgsConstructor +@Data +public class PartyActStatisResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 党组织Id + */ + private String joinOrgId = ""; + /** + * 党组织名称 + */ + private String joinOrgName = ""; + /** + * 支部党员大会次数 + */ + private Integer dydhNum = 0; + /** + * 支部委员会次数 + */ + private Integer wyhNum = 0; + /** + * 党小组会次数 + */ + private Integer dxzhNum = 0; + /** + * 党课次数 + */ + private Integer dkNum = 0; + /** + * 主题党日次数 + */ + private Integer ztdrNum = 0; + /** + * 为民服务活动次数 + */ + private Integer wmfwNum = 0; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/PartyOrgListResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/PartyOrgListResultDTO.java new file mode 100644 index 0000000000..cca225416d --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/PartyOrgListResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@NoArgsConstructor +@Data +public class PartyOrgListResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 党组织Id + */ + private String partyOrgId = ""; + /** + * 党支部IdPath + */ + private String partyOrgPath = ""; + /** + * 党组织名称 + */ + private String partyOrgName = ""; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/YearSearchDetailResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/YearSearchDetailResultDTO.java new file mode 100644 index 0000000000..ef6c80ed65 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/YearSearchDetailResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/22 09:27 + * @DESC + */ +@Data +public class YearSearchDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 8961924457475202790L; + + private String type; + private String typeValue; + private String frequency; + private List activityList; +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/YearSearchResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/YearSearchResultDTO.java new file mode 100644 index 0000000000..e03e53c13b --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/result/YearSearchResultDTO.java @@ -0,0 +1,46 @@ +package com.epmet.resi.partymember.dto.partyOrg.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/22 09:27 + * @DESC + */ +@Data +public class YearSearchResultDTO implements Serializable { + + private static final long serialVersionUID = 8961924457475202790L; + + private String type; + private String frequency; + private List activityList; + + @Data + public static class YearSearchActivityListDTO implements Serializable{ + + private static final long serialVersionUID = -9050507457068805831L; + + private String activityId; + private String staffId; + private String dateId; + private String topic; + private String address; + private String holdTime; + private String type; + private String isPublicValue; + private String isPublish; + private String joinTypeValue; + private String joinUserType; + private String isAutoInformValue; + private String autoInformDay; + private String autoPublicTime; + private List joinOrgList; + private List joinOrgs; + private Boolean isMe = false; + + } +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/IcPartyInfoResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/IcPartyInfoResultDTO.java new file mode 100644 index 0000000000..78207b0293 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partymember/result/IcPartyInfoResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.resi.partymember.dto.partymember.result; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class IcPartyInfoResultDTO implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 所属支部Id + */ + private String id = ""; + + /** + * 所属支部名称 + */ + private String partOrgName = ""; + + /** + * 未读消息数 + */ + private Integer count; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java index 0098acd036..03cac6e6f7 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java @@ -1,11 +1,10 @@ package com.epmet.resi.partymember.feign; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO; +import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import com.epmet.resi.partymember.dto.partymember.PartymemberBaseInfoDTO; import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; @@ -20,6 +19,7 @@ import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -135,4 +135,40 @@ public interface ResiPartyMemberOpenFeignClient { @PostMapping("/resi/partymember/icPartyOrg/branchlist") public Result> branchlist(); + + /** + * 获取客户下支部列表 + * @Param tokenDto + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/8/15 16:00 + */ + @PostMapping("/resi/partymember/icPartyOrg/getPartyOrgList") + Result> getPartyOrgList(); + + /** + * 您有一个活动3天后即将自动发布 + * @return + */ + @PostMapping("/resi/partymember/icPartyAct/noticePartyActAutoPublish") + Result noticePartyActAutoPublishTask(); + + /** + * 自动发布党组织活动 + * @return + */ + @PostMapping("/resi/partymember/icPartyAct/autoPublishIcPartyAct") + Result autoPublishIcPartyAct(); + + @PostMapping("/resi/partymember/icPartyAct/act-detail/{icPartyActId}") + Result actDetail(@PathVariable("icPartyActId")String icPartyActId); + + /** + * 更新partymember_info.ID_CARD + * @param userId + * @param idNum + * @return + */ + @PostMapping("/resi/partymember/partymemberinfo/updatePartyMemberIdCard") + Result updatePartyMemberIdCard(@RequestParam("userId") String userId, @RequestParam("idNum")String idNum); } diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java index 57ce87c1e4..f6d5c20813 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java @@ -2,10 +2,10 @@ package com.epmet.resi.partymember.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO; +import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import com.epmet.resi.partymember.dto.partymember.PartymemberBaseInfoDTO; import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; @@ -17,6 +17,7 @@ import com.epmet.resi.partymember.dto.partymember.result.WarnAndPartyAuditResult import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import java.util.List; +import java.util.Map; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -101,4 +102,44 @@ public class ResiPartyMemberOpenFeignClientFallback implements ResiPartyMemberOp public Result> branchlist() { return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "branchlist", null); } + + /** + * 获取客户下支部列表 + * + * @Param tokenDto + * @Return {@link Result< Map>} + * @Author zhaoqifeng + * @Date 2022/8/15 16:00 + */ + @Override + public Result> getPartyOrgList() { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "getPartyOrgList", null); + } + + @Override + public Result noticePartyActAutoPublishTask() { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "noticePartyActAutoPublish"); + } + + @Override + public Result autoPublishIcPartyAct() { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "autoPublishIcPartyAct"); + } + + @Override + public Result actDetail(String icPartyActId) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "actDetail"); + } + + /** + * 更新partymember_info.ID_CARD + * + * @param userId + * @param idNum + * @return + */ + @Override + public Result updatePartyMemberIdCard(String userId, String idNum) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "updatePartyMemberIdCard",userId,idNum); + } } diff --git a/epmet-module/resi-partymember/resi-partymember-server/pom.xml b/epmet-module/resi-partymember/resi-partymember-server/pom.xml index 78186b16da..80fe8956bc 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/pom.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/pom.xml @@ -123,6 +123,12 @@ epmet-commons-rocketmq 2.0.0 + + com.epmet + resi-group-client + 2.0.0 + compile + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActController.java new file mode 100644 index 0000000000..6b0d27503e --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActController.java @@ -0,0 +1,360 @@ +package com.epmet.modules.partyOrg.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +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.dto.form.PageFormDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +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.modules.partyOrg.excel.IcPartyActExpoprtExcel; +import com.epmet.modules.partyOrg.excel.PartyActStatisExcel; +import com.epmet.modules.partyOrg.service.IcPartyActService; +import com.epmet.resi.partymember.dto.icpartyact.form.BatchAddPartyActFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartActTypeDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActPageResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.*; +import com.epmet.resi.partymember.dto.partyOrg.result.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +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.io.IOException; +import java.io.PrintWriter; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +/** + * 党建组织活动 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Slf4j +@RestController +@RequestMapping("icPartyAct") +public class IcPartyActController { + + @Autowired + private IcPartyActService icPartyActService; + + /** + * 添加、修改活动各端通用 + * @param tokenDto + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("addOrUpdate") + public Result> addOrUpdate(@LoginUser TokenDto tokenDto,@RequestBody IcPartyActAddOrUpdateFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setPublishStaffId(tokenDto.getUserId()); + if(StringUtils.isNotBlank(formDTO.getIcPartyActId())){ + //修改活动 + ValidatorUtils.validateEntity(formDTO,IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class,IcPartyActAddOrUpdateFormDTO.UpdateUserInternalGroup.class); + }else{ + //添加活动 + ValidatorUtils.validateEntity(formDTO,IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class,IcPartyActAddOrUpdateFormDTO.AddUserInternalGroup.class); + } + Map map=icPartyActService.addOrUpdate(formDTO); + return new Result>().ok(map); + } + + /** + * 生成年度计划 + * @param tokenDto + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("batch-add") + public Result batchAdd(@LoginUser TokenDto tokenDto,@RequestBody BatchAddPartyActFormDTO formDTO){ + formDTO.getActList().forEach(dto->{ + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setPublishStaffId(tokenDto.getUserId()); + if(StringUtils.isNotBlank(dto.getIcPartyActId())){ + //修改活动 + ValidatorUtils.validateEntity(dto,IcPartyActAddOrUpdateFormDTO.UpdateUserShowGroup.class,IcPartyActAddOrUpdateFormDTO.UpdateUserInternalGroup.class); + }else{ + //添加活动 + ValidatorUtils.validateEntity(dto,IcPartyActAddOrUpdateFormDTO.AddUserShowGroup.class,IcPartyActAddOrUpdateFormDTO.AddUserInternalGroup.class); + } + icPartyActService.addOrUpdate(dto); + }); + icPartyActService.deleteIcPartyAct(tokenDto.getCustomerId(),tokenDto.getUserId(),formDTO.getDelActIds()); + return new Result(); + } + + /** + * 【活动列表】分页查询(工作端小程序通用) + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("page-list") + public Result> pageList(@LoginUser TokenDto tokenDto, @RequestBody IcPartyActPageFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setPublishStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + return new Result>().ok(icPartyActService.pageList(formDTO)); + } + + /** + * 活动列表活动详情 + * 居民端小程序活动详情、工作端小程序活动详情通用 + * @param tokenDto + * @param icPartyActId + * @return + */ + @PostMapping("act-detail/{icPartyActId}") + public Result actDetail(@LoginUser TokenDto tokenDto, @PathVariable("icPartyActId")String icPartyActId){ + if(StringUtils.isBlank(icPartyActId)){ + return new Result<>(); + } + return new Result().ok(icPartyActService.queryActDetail(tokenDto.getCustomerId(),tokenDto.getUserId(),icPartyActId)); + } + + + /** + * 活动类型 + * @param tokenDto + * @return + */ + @PostMapping("/acttypelist") + public com.epmet.commons.tools.utils.Result> actTypeList(@LoginUser TokenDto tokenDto){ + List list=icPartyActService.actTypeList(tokenDto.getCustomerId()); + return new Result>().ok(list); + } + + /** + * Desc: 【党建日历】首页-获取每月总数 + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2022/8/19 09:05 + */ + @PostMapping("homeMonthTotal") + public Result> getHomeMonthTotal(@LoginUser TokenDto tokenDto,@RequestBody HomeMonthTotalFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, HomeMonthTotalFormDTO.HomeMonthTotalForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + return new Result>().ok(icPartyActService.getHomeMonthTotal(formDTO)); + } + + /** + * Desc:【党建日历】活动、日程列表 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2022/8/19 13:57 + */ + @PostMapping("actAndScheduleList") + public Result getActAndScheduleList(@RequestBody ActAndScheduleListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().ok(icPartyActService.getActAndScheduleList(formDTO)); + } + + /** + * Desc:【党建日历】某月/天数据搜索列表 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2022/8/19 14:00 + */ + @PostMapping("homeSearch") + public Result> homeSearch(@RequestBody ActAndScheduleListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(icPartyActService.homeSearch(formDTO)); + } + + /** + * pc活动列表-发布活动 + * pc党建日历左下角列表,点击发布 + * 工作端小程序点击发布 + * @param tokenDto + * @param icPartyActId + * @return + */ + @NoRepeatSubmit + @PostMapping("publish/{icPartyActId}") + public Result publicshIcPartyAct(@LoginUser TokenDto tokenDto,@PathVariable("icPartyActId")String icPartyActId){ + icPartyActService.publicshIcPartyAct(tokenDto.getUserId(),icPartyActId); + return new Result(); + } + + /** + * pc活动列表-发布活动 + * pc党建日历左下角列表,点击删除 + * pc生成年度记录,删除活动 + * 工作端小程序-详情页面,删除 + * @param tokenDto + * @param icPartyActIds + * @return + */ + @NoRepeatSubmit + @PostMapping("del") + public Result deleteIcPartyAct(@LoginUser TokenDto tokenDto,@RequestBody List icPartyActIds){ + if(CollectionUtils.isNotEmpty(icPartyActIds)){ + icPartyActService.deleteIcPartyAct(tokenDto.getCustomerId(),tokenDto.getUserId(),icPartyActIds); + } + return new Result(); + } + + /** + * Desc:【党建日历】生成年度活动计划查询 + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2022/8/22 09:33 + */ + @PostMapping("yearSearch01") + public Result> yearSearch01(@LoginUser TokenDto tokenDto, @RequestBody YearSearchFormDTO formDTO){ + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(icPartyActService.yearSearch01(formDTO)); + } + + /** + * 【党建日历】生成年度活动计划查询 + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("yearSearch") + public Result> yearSearch(@LoginUser TokenDto tokenDto, @RequestBody YearSearchFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, YearSearchFormDTO.YearSearchForm.class); + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(icPartyActService.yearSearch(formDTO)); + } + + @NoRepeatSubmit + @PostMapping("/export-act") + public void export(@LoginUser TokenDto tokenDto, @RequestBody IcPartyActPageFormDTO formDTO, HttpServletResponse response) throws IOException { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setPublishStaffId(tokenDto.getUserId()); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "党组织活动" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcPartyActExpoprtExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + data = icPartyActService.pageList(formDTO); + data.getList().forEach(l->{ + List orgNameList = l.getJoinOrgList().stream().map(m -> m.getJoinOrgName()).distinct().collect(Collectors.toList()); + l.setJoinOrgNameStr(orgNameList.stream().map(String::valueOf).collect(Collectors.joining(","))); + }); + list = ConvertUtils.sourceToTarget(data.getList(), IcPartyActExpoprtExcel.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + @RequestMapping("list") + public Result> list(@LoginUser TokenDto tokenDto, @RequestBody IcPartyActListFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(icPartyActService.list(formDTO)); + } + + /** + * 通知:您有一个活动3天后即将自动发布 + * @return + */ + @PostMapping("noticePartyActAutoPublish") + public Result noticePartyActAutoPublish(){ + icPartyActService.noticePartyActAutoPublish(); + return new Result(); + } + + /** + * 自动发布活动 + * @return + */ + @PostMapping("autoPublishIcPartyAct") + public Result autoPublishIcPartyAct(){ + icPartyActService.autoPublishIcPartyAct(); + return new Result(); + } + + /** + * Desc: 统计各党组织参与各种党活动的次数 + */ + @RequestMapping("patryactstatis") + public Result> patryActStatis(@RequestBody PartyActStatisFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + return new Result>().ok(icPartyActService.patryActStatis(formDTO)); + } + + @PostMapping("export") + public void export(@RequestBody PartyActStatisFormDTO formDTO, HttpServletResponse response) throws IOException { + ExcelWriter excelWriter = null; + try { + String fileName = "党建数据统计" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), PartyActStatisExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + List data = icPartyActService.patryActStatis(formDTO); + List list = ConvertUtils.sourceToTarget(data, PartyActStatisExcel.class); + excelWriter.write(list, writeSheet); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActOrgController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActOrgController.java new file mode 100644 index 0000000000..a42a752523 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActOrgController.java @@ -0,0 +1,31 @@ +package com.epmet.modules.partyOrg.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +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.modules.partyOrg.service.IcPartyActOrgService; +import com.epmet.resi.partymember.dto.IcPartyActOrgDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 参加活动党组织表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@RestController +@RequestMapping("icPartyActOrg") +public class IcPartyActOrgController { + + @Autowired + private IcPartyActOrgService icPartyActOrgService; +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActSignInRecordController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActSignInRecordController.java new file mode 100644 index 0000000000..9a4b16fda7 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyActSignInRecordController.java @@ -0,0 +1,84 @@ +package com.epmet.modules.partyOrg.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.IcMessageDTO; +import com.epmet.dto.form.IcMessageListFormDTO; +import com.epmet.modules.partyOrg.service.IcPartyActSignInRecordService; +import com.epmet.resi.partymember.dto.IcPartyActSignInRecordDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.PartyActSignFormDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 党组织活动签到记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@RestController +@RequestMapping("icPartyActSignInRecord") +public class IcPartyActSignInRecordController { + + @Autowired + private IcPartyActSignInRecordService icPartyActSignInRecordService; + + @RequestMapping("list") + public Result> list(@RequestBody PartyActSignFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + return new Result>().ok(icPartyActSignInRecordService.list(formDTO)); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcPartyActSignInRecordDTO data = icPartyActSignInRecordService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcPartyActSignInRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icPartyActSignInRecordService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcPartyActSignInRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icPartyActSignInRecordService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icPartyActSignInRecordService.delete(ids); + return new Result(); + } + + @PostMapping("sign") + public Result sign(@LoginUser TokenDto tokenDto, @RequestBody PartyActSignFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + icPartyActSignInRecordService.sign(formDTO); + return new Result(); + } + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java index 499c2a1d70..2279fd3ca2 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java @@ -14,10 +14,14 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.modules.partyOrg.excel.IcPartyOrgExcel; import com.epmet.modules.partyOrg.service.IcPartyOrgService; import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.EditPrincipalFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.GetParentOrgFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgListFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO; import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.DefaultPartyOrgResDTO; import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.PartyOrgListResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -110,6 +114,13 @@ public class IcPartyOrgController { return icPartyOrgService.getSearchTreelist(formDTO); } + @PostMapping("getOrgTreeHaveGroup") + public Result> getOrgTreeHaveGroup(@LoginUser TokenDto tokenDto,PartyOrgTreeListDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + return new Result>().ok(icPartyOrgService.getOrgTreeHaveGroup(formDTO)); + } + /** * @describe: 当前登录用户所属行政组织,及下级的党组织(只限支部) * @author wangtong @@ -137,4 +148,59 @@ public class IcPartyOrgController { return icPartyOrgService.getParentOrgList(formDTO); } + /** + * 获取客户下支部列表 + * @Param tokenDto + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/8/15 16:00 + */ + @PostMapping("getPartyOrgList") + public Result> getPartyOrgList(@LoginUser TokenDto tokenDto){ + return new Result>().ok(icPartyOrgService.getPartyOrgList(tokenDto)); + } + + /** + * 党组织活动发布时, + * 查询当前登录用户所属行政组织下,默认的党组织,取第一个 + * @param tokenDto + * @return + */ + @PostMapping("defaultpartyorg") + public Result defaultPartyOrg(@LoginUser TokenDto tokenDto){ + return new Result().ok(icPartyOrgService.defaultPartyOrg(tokenDto.getCustomerId(), tokenDto.getUserId())); + } + + /** + * 调整历史数据 ORG_PIDS + * @return + */ + @PostMapping("adjustOrgPath") + public Result adjustOrgPath(@RequestBody List customerIds){ + icPartyOrgService.adjustOrgPath(customerIds); + return new Result(); + } + + /** + * 查询当前组织及下级党支部列表,供新增编辑党小组使用 + */ + @PostMapping("partorglist") + public Result> partOrgList(@RequestBody PartyOrgListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + return new Result>().ok(icPartyOrgService.partOrgList(formDTO.getGridId())); + } + + /** + * Desc: 党组织修改负责人 + * @param formDTO + * @author zxc + * @date 2022/9/7 15:04 + */ + @PostMapping("editPrincipal") + public Result editPrincipal(@RequestBody EditPrincipalFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + icPartyOrgService.editPrincipal(formDTO); + return new Result(); + } + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcScheduleController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcScheduleController.java new file mode 100644 index 0000000000..cc45d2e7bf --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcScheduleController.java @@ -0,0 +1,160 @@ +package com.epmet.modules.partyOrg.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; +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.modules.partyOrg.excel.IcScheduleListExcel; +import com.epmet.modules.partyOrg.service.IcScheduleService; +import com.epmet.resi.partymember.dto.IcScheduleDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Date; +import java.util.List; + + +/** + * 日程表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@RestController +@RequestMapping("icSchedule") +@Slf4j +public class IcScheduleController { + + @Autowired + private IcScheduleService icScheduleService; + + @RequestMapping(value = "list",method = {RequestMethod.POST,RequestMethod.GET}) + public Result> list(@LoginUser TokenDto tokenDto, @RequestBody IcScheduleFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + return new Result>().ok(icScheduleService.list(formDTO)); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcScheduleDTO data = icScheduleService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcScheduleDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icScheduleService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcScheduleDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icScheduleService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icScheduleService.delete(ids); + return new Result(); + } + + /** + * Desc: 新增或编辑日程 + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2022/8/18 16:31 + */ + @PostMapping("addOrEdit") + public Result addOrEditSchedule(@LoginUser TokenDto tokenDto,@RequestBody AddOrEditScheduleFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AddOrEditScheduleFormDTO.AddScheduleForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + icScheduleService.addOrEditSchedule(formDTO); + return new Result(); + } + + /** + * Desc: 删除日程 + * @param scheduleIds + * @author zxc + * @date 2022/8/18 17:00 + */ + @PostMapping("del") + public Result delSchedule(@RequestBody List scheduleIds){ + icScheduleService.delSchedule(scheduleIds); + return new Result(); + } + + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody IcScheduleFormDTO formDTO, HttpServletResponse response) throws IOException { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageNo(NumConstant.ONE); + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + try { + String fileName = "日程列表" + DateUtils.format(new Date()) + ".xlsx"; + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcScheduleListExcel.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + List list = null; + do { + data = icScheduleService.list(formDTO); + list = ConvertUtils.sourceToTarget(data.getList(), IcScheduleListExcel.class); + formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); + excelWriter.write(list, writeSheet); + } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActDao.java new file mode 100644 index 0000000000..d3bdd9d957 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActDao.java @@ -0,0 +1,55 @@ +package com.epmet.modules.partyOrg.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.partyOrg.entity.IcPartyActEntity; +import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActPageResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.IcPartyActTypeDictDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.ActAndScheduleListFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.IcPartyActListFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.PartyActStatisFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.ActAndScheduleListResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyActListResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.PartyActStatisResultDTO; +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 2022-08-18 + */ +@Mapper +public interface IcPartyActDao extends BaseDao { + + /** + * 活动类型列表 + * @param customerId + * @return + */ + List actTypeList(String customerId); + + List getActivityList(ActAndScheduleListFormDTO formDTO); + + /** + * pc活动列表分页 + * @param formDTO + * @return + */ + List selectPageList(IcPartyActPageFormDTO formDTO); + + String selectActTypeName(@Param("customerId") String customerId,@Param("actType")String actType); + + int deleteIcPartyAct(@Param("customerId") String customerId, @Param("userId")String userId, @Param("icPartyActId")String icPartyActId); + + List selectresiPartyActList(IcPartyActListFormDTO formDTO); + + List selectNeedRemindAutoPublishAct(String dateId); + + List selectNoPublishList(String dateId); + + List getPartActStatis(PartyActStatisFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActOrgDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActOrgDao.java new file mode 100644 index 0000000000..9351804f7c --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActOrgDao.java @@ -0,0 +1,36 @@ +package com.epmet.modules.partyOrg.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; +import com.epmet.resi.partymember.dto.icpartyact.form.JoinOrgDTO; +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 2022-08-18 + */ +@Mapper +public interface IcPartyActOrgDao extends BaseDao { + + /** + * 删除活动时,同时删除,参与活动党组织表 + * @param customerId + * @param icPartyActIds + * @return + */ + int deleteByPartyActId(@Param("customerId") String customerId, @Param("icPartyActIds")List icPartyActIds); + + /** + * 查询活动的参与活动党组织列表 + * @param icPartyActId + * @return + */ + List selectJoinOrgList(String icPartyActId); + + int updateToDel(@Param("userId") String userId, @Param("icPartyActId") String icPartyActId); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActSignInRecordDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActSignInRecordDao.java new file mode 100644 index 0000000000..72e00ccdc1 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActSignInRecordDao.java @@ -0,0 +1,22 @@ +package com.epmet.modules.partyOrg.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.partyOrg.entity.IcPartyActSignInRecordEntity; +import com.epmet.resi.partymember.dto.IcPartyActSignInRecordDTO; +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 2022-08-18 + */ +@Mapper +public interface IcPartyActSignInRecordDao extends BaseDao { + + List selectSignList(@Param("icPartyActId") String icPartyActId); + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActTypeDictDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActTypeDictDao.java new file mode 100644 index 0000000000..58eda1e4b2 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyActTypeDictDao.java @@ -0,0 +1,16 @@ +package com.epmet.modules.partyOrg.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.partyOrg.entity.IcPartyActTypeDictEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 党组织活动类型字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Mapper +public interface IcPartyActTypeDictDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java index 93fa4d8a64..88fe00f0ad 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java @@ -2,9 +2,13 @@ package com.epmet.modules.partyOrg.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; +import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.EditPrincipalFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.ActAndScheduleListResultDTO; import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeSubDTO; import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.PartyOrgListResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -104,4 +108,22 @@ public interface IcPartyOrgDao extends BaseDao { * @return com.epmet.modules.partyOrg.entity.IcPartyOrgEntity */ IcPartyOrgEntity selectByCustomerIdAndFirstOrg(@Param("customerId") String customerId); + + List getPartyOrg(@Param("orgIds")List orgIds); + + IcPartyOrgEntity selectDefaultPartyOrg(@Param("agencyId") String agencyId, @Param("level") String level); + + List getUserIdByPartyOrgIds(@Param("partyOrgIdList") List partyOrgIdList); + + List getSelfAndSub(@Param("joinOrgId") String joinOrgId); + + List partOrgList(@Param("agencyId") String agencyId); + + /** + * Desc: 党组织修改负责人 + * @param formDTO + * @author zxc + * @date 2022/9/7 15:04 + */ + void editPrincipal(EditPrincipalFormDTO formDTO); } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcScheduleDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcScheduleDao.java new file mode 100644 index 0000000000..996d46c361 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcScheduleDao.java @@ -0,0 +1,34 @@ +package com.epmet.modules.partyOrg.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.partyOrg.entity.IcScheduleEntity; +import com.epmet.resi.partymember.dto.partyOrg.form.ActAndScheduleListFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.HomeMonthTotalFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.ActAndScheduleListResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.HomeMonthTotalResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 日程表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Mapper +public interface IcScheduleDao extends BaseDao { + + void editSchedule(AddOrEditScheduleFormDTO formDTO); + + List getScheduleAndActCount(HomeMonthTotalFormDTO formDTO); + + List getScheduleList(ActAndScheduleListFormDTO formDTO); + + List selectScheduleList(IcScheduleFormDTO formDTO); + + List selectNeedNotice(String dateId); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/ResiPartymemberAttachmentDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/ResiPartymemberAttachmentDao.java new file mode 100644 index 0000000000..f068318861 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/ResiPartymemberAttachmentDao.java @@ -0,0 +1,27 @@ +package com.epmet.modules.partyOrg.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; +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 2022-08-19 + */ +@Mapper +public interface ResiPartymemberAttachmentDao extends BaseDao { + /** + * + * @param businessIds + * @return + */ + int deleteByBusinessId(@Param("customerId")String customerId,@Param("businessIds") List businessIds); + + List selectListByBusinessId(String businessId); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActEntity.java new file mode 100644 index 0000000000..3764f8d223 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActEntity.java @@ -0,0 +1,152 @@ +package com.epmet.modules.partyOrg.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 2022-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_party_act") +public class IcPartyActEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID:当前工作人员所属组织id + */ + private String orgId; + + /** + * 组织ID的上级;如果org_id是根组织,那此列=0 + */ + private String pid; + + /** + * ORG_ID全路径,包含自身 + */ + private String orgIdPath; + + /** + * 发布活动党组织 + */ + private String publishPartyOrgId; + + /** + * 发布活动党组织名称 + */ + private String publishPartyOrgName; + + /** + * 发布活动党组织ID的上级节点 + */ + private String publishOrgPid; + + /** + * 发布活动党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组 + */ + private String publishOrgType; + + /** + * 发布活动党组织PUBLISH_PARTY_ORG_ID的全路径,包含自身。方便前端回显 + */ + private String publishOrgPath; + /** + *发布活动党组织路径,前端用此列 + */ + private String publishOrgPathShow; + /** + * 活动类型,来源于ic_party_act_type_dict + */ + private String actType; + + /** + * 活动举办时间:yyyy + */ + private String holdYearId; + + /** + * 活动举办时间:yyyyMM + */ + private String holdMonthId; + + /** + * 举办活动时间 + */ + private Date holdTime; + + /** + * 活动主题 + */ + private String topic; + + /** + * 活动地点 + */ + private String address; + + /** + * 活动地点纬度 + */ + private String latitude; + + /** + * 活动地点经度 + */ + private String longitude; + + /** + * 活动开始前几天 + */ + private Integer autoPublicType; + + /** + * 自动发布时间,保存时算好时间存在这里 + */ + private Date autoPublicTime; + + /** + * 参加人员类型,0:全体党员;1:支部委员 + */ + private String joinUserType; + + /** + * 是否自动通知参加人员,0否;1是 + */ + private String isAutoInform; + + /** + * 活动介绍 + */ + private String introduce; + + /** + * 是否发布,0未发布;1已发布; + */ + private String isPublish; + + /** + * 活动发布人 + */ + private String publishStaffId; + + /** + * 活动发布人姓名 + */ + private String publishStaffName; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActOrgEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActOrgEntity.java new file mode 100644 index 0000000000..23c131028a --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActOrgEntity.java @@ -0,0 +1,57 @@ +package com.epmet.modules.partyOrg.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 参加活动党组织表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_party_act_org") +public class IcPartyActOrgEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 活动id + */ + private String icPartyActId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 参加活动党组织ID,groupId + */ + private String joinOrgId; + + private String joinOrgName; + + /** + * 党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组 + */ + private String orgType; + + /** + * 参加活动党组织ID的上级节点 + */ + private String pid; + + /** + * PARTY_ORG_ID的全路径,包含自身。方便前端回显 + */ + private String joinOrgPath; + + /** + * PARTY_ORG_ID的全路径,前端用 + */ + private String joinOrgPathShow; +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActSignInRecordEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActSignInRecordEntity.java new file mode 100644 index 0000000000..52b44ffaf6 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActSignInRecordEntity.java @@ -0,0 +1,64 @@ +package com.epmet.modules.partyOrg.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 2022-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_party_act_sign_in_record") +public class IcPartyActSignInRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 活动id + */ + private String icPartyActId; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 签到用户id + */ + private String epmetUserId; + + /** + * 签到用户姓名 + */ + private String userRealName; + + /** + * 签到地点 + */ + private String address; + + /** + * 签到地点纬度 + */ + private String latitude; + + /** + * 签到地点经度 + */ + private String longitude; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActTypeDictEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActTypeDictEntity.java new file mode 100644 index 0000000000..715a79cd39 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyActTypeDictEntity.java @@ -0,0 +1,64 @@ +package com.epmet.modules.partyOrg.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 2022-08-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_party_act_type_dict") +public class IcPartyActTypeDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 活动类型key + */ + private String typeKey; + + /** + * 活动名称 + */ + private String typeName; + + /** + * 每年几次 + */ + private Integer yearCount; + + /** + * 频次单位 + */ + private String frequencyUnit; + + /** + * 频次数量 + */ + private Integer frequencyCount; + + /** + * 频率描述 + */ + private String frequencyDesc; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyOrgEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyOrgEntity.java index e9ea2f210c..bc8be3d038 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyOrgEntity.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcPartyOrgEntity.java @@ -73,6 +73,21 @@ public class IcPartyOrgEntity extends BaseEpmetEntity { */ private String address; + /** + * 负责人 + */ + private String principal; + + /** + * 负责人staffId + */ + private String principalStaffId; + + /** + * 联系电话 + */ + private String principalMobile; + /** * 党组织介绍 */ diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcScheduleEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcScheduleEntity.java new file mode 100644 index 0000000000..9f3191a33f --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/IcScheduleEntity.java @@ -0,0 +1,74 @@ +package com.epmet.modules.partyOrg.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 2022-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_schedule") +public class IcScheduleEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所属行政组织ID:当前工作人员所属组织id + */ + private String orgId; + + /** + * 组织ID的上级;如果org_id是根组织,那此列=0 + */ + private String pid; + + /** + * ORG_ID全路径,包含自身 + */ + private String orgIdPath; + + /** + * 当前登录用户userId + */ + private String staffId; + + /** + * 日程标题(35字) + */ + private String title; + + /** + * 提醒时间;其实就是日程所属日期 + */ + private Date remindTime; + + /** + * 发生时间 + */ + private Date happenedTime; + + /** + * 是否公开,0:仅自己可见;1:组织内其他人可见 + */ + private String isPublic; + + /** + * 备注(500字) + */ + private String remark; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/ResiPartymemberAttachmentEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/ResiPartymemberAttachmentEntity.java new file mode 100644 index 0000000000..aa190b4ea9 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/entity/ResiPartymemberAttachmentEntity.java @@ -0,0 +1,82 @@ +package com.epmet.modules.partyOrg.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 本库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("resi_partymember_attachment") +public class ResiPartymemberAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 业务id + */ + private String businessId; + + /** + * 党组织活动:ic_party_act + */ + private String attachTo; + + /** + * 附件名 + */ + private String name; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String format; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String type; + + /** + * 附件地址 + */ + private String url; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 附件状态(审核中:auditing; +auto_passed: 自动通过; +review:结果不确定,需要人工审核; +block: 结果违规; +rejected:人工审核驳回; +approved:人工审核通过) +现在图片是同步审核的,所以图片只有auto_passed一种状态 + */ + private String status; + + /** + * 失败原因 + */ + private String reason; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcPartyActExpoprtExcel.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcPartyActExpoprtExcel.java new file mode 100644 index 0000000000..995682ec4e --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcPartyActExpoprtExcel.java @@ -0,0 +1,75 @@ +package com.epmet.modules.partyOrg.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.util.Date; + +/** + * @Description + * @Author yzm + * @Date 2022/8/22 12:48 + */ +@Data +public class IcPartyActExpoprtExcel { + /** + * 活动主题 + */ + @ExcelProperty(value = "活动主题11") + @ColumnWidth(20) + private String topic; + + /** + * 发布活动党组织名称 + */ + @ExcelProperty(value = "所属组织") + @ColumnWidth(20) + private String publishPartyOrgName; + + /** + * 活动发布人姓名 + */ + @ExcelProperty(value = "发布人") + @ColumnWidth(10) + private String publishStaffName; + + /** + * 活动类型,来源于ic_party_act_type_dict + */ + @ExcelProperty(value = "活动类型") + @ColumnWidth(15) + private String actTypeName; + + /** + * 举办活动时间 + */ + @ExcelProperty(value = "活动开始时间") + @ColumnWidth(20) + @DateTimeFormat("yyyy-MM-dd HH:mm:ss") + private Date holdTime; + + /** + * 活动地点 + */ + @ExcelProperty(value = "活动地点") + @ColumnWidth(25) + private String address; + + /** + * 是否发布,0未发布;1已发布; + */ + @ExcelProperty(value = "发布状态") + @ColumnWidth(8) + private String isPublishName; + + @ExcelProperty(value = "参加人员") + @ColumnWidth(12) + private String joinUserTypeName; + + @ExcelProperty(value = "参加活动党组织") + @ColumnWidth(80) + private String joinOrgNameStr; +} + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcScheduleListExcel.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcScheduleListExcel.java new file mode 100644 index 0000000000..72e0a4002b --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/IcScheduleListExcel.java @@ -0,0 +1,26 @@ +package com.epmet.modules.partyOrg.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +@Data +public class IcScheduleListExcel { + + @ExcelProperty(value = "日程标题") + @ColumnWidth(20) + private String title; + + @ExcelProperty(value = "提醒时间") + @ColumnWidth(20) + private String remindTimeName; + + @ExcelProperty(value = "是否公开") + @ColumnWidth(20) + private String isPublicName; + + @ExcelProperty(value = "备注") + @ColumnWidth(25) + private String remark; + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/PartyActStatisExcel.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/PartyActStatisExcel.java new file mode 100644 index 0000000000..1614a61c51 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/excel/PartyActStatisExcel.java @@ -0,0 +1,43 @@ +package com.epmet.modules.partyOrg.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.HeadStyle; +import com.alibaba.excel.enums.poi.FillPatternTypeEnum; +import lombok.Data; + +import java.io.Serializable; + +/** + * 党建数据统计 + */ +@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) +@Data +public class PartyActStatisExcel implements Serializable { + + private static final long serialVersionUID = -12110233388005838L; + + @ExcelProperty(value = "党组织名称") + @ColumnWidth(20) + private String joinOrgName; + @ExcelProperty(value = "支部党员大会(次)") + @ColumnWidth(30) + private Integer dydhNum = 0; + @ExcelProperty(value = "支部委员会(次)") + @ColumnWidth(20) + private Integer wyhNum = 0; + @ExcelProperty(value = "党小组会(次)") + @ColumnWidth(20) + private Integer dxzhNum = 0; + @ExcelProperty(value = "党课(次)") + @ColumnWidth(20) + private Integer dkNum = 0; + @ExcelProperty(value = "主题党日(次)") + @ColumnWidth(20) + private Integer ztdrNum = 0; + @ExcelProperty(value = "为民服务活动(次)") + @ColumnWidth(30) + private Integer wmfwNum = 0; + + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActOrgService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActOrgService.java new file mode 100644 index 0000000000..9e5a6e2be2 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActOrgService.java @@ -0,0 +1,16 @@ +package com.epmet.modules.partyOrg.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; + +import java.util.List; + +/** + * 参加活动党组织表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +public interface IcPartyActOrgService extends BaseService { + int deleteByPartyActId(String customerId, List icPartyActIds); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActService.java new file mode 100644 index 0000000000..dbfde1274e --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActService.java @@ -0,0 +1,122 @@ +package com.epmet.modules.partyOrg.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.rocketmq.messages.PartyMeetingMessageMQMsg; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.partyOrg.entity.IcPartyActEntity; +import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartActTypeDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActPageResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.*; +import com.epmet.resi.partymember.dto.partyOrg.result.*; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * 党建组织活动 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +public interface IcPartyActService extends BaseService { + + /** + * 活动类型列表 + * @param customerId + * @return + */ + List actTypeList(String customerId); + + /** + * Desc: 【党建日历】首页-获取每月总数 + * @param formDTO + * @author zxc + * @date 2022/8/19 09:05 + */ + List getHomeMonthTotal(HomeMonthTotalFormDTO formDTO); + + /** + * 添加、修改活动 + * @param formDTO + * @return + */ + Map addOrUpdate(IcPartyActAddOrUpdateFormDTO formDTO); + + /** + * 【活动列表】分页查询(工作端小程序通用) + * @param formDTO + * @return + */ + PageData pageList(IcPartyActPageFormDTO formDTO); + + /** + * 活动列表活动详情 + * @param customerId + * @param userId + * @param icPartyActId + * @return + */ + IcPartyActDetailResDTO queryActDetail(String customerId, String userId, String icPartyActId); + + void partyMeetingMessage(PartyMeetingMessageMQMsg dto); + + /** + * Desc: 【党建日历】活动、日程列表 + * @param formDTO + * @author zxc + * @date 2022/8/19 13:57 + */ + ActAndScheduleListResultDTO getActAndScheduleList(ActAndScheduleListFormDTO formDTO); + + /** + * Desc: 【党建日历】某月/天数据搜索列表 + * @param formDTO + * @author zxc + * @date 2022/8/19 14:01 + */ + List homeSearch(ActAndScheduleListFormDTO formDTO); + + /** + * * pc活动列表-发布活动 + * pc党建日历左下角列表,点击发布 + * 工作端小程序点击发布 + * @param userId + * @param icPartyActId + */ + void publicshIcPartyAct(String userId, String icPartyActId); + + /** + * 删除活动 + * @param userId + * @param icPartyActIds + */ + void deleteIcPartyAct(String customerId,String userId, List icPartyActIds); + + /** + * Desc: 【党建日历】生成年度活动计划查询 + * @param formDTO + * @author zxc + * @date 2022/8/22 09:33 + */ + List yearSearch01(YearSearchFormDTO formDTO); + + List yearSearch(YearSearchFormDTO formDTO); + + PageData list(IcPartyActListFormDTO formDTO); + + /** + * 通知:您有一个活动3天后即将自动发布 + */ + void noticePartyActAutoPublish(); + + /** + * 自动发布活动 + */ + void autoPublishIcPartyAct(); + + LinkedList patryActStatis(PartyActStatisFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActSignInRecordService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActSignInRecordService.java new file mode 100644 index 0000000000..bb1f91a727 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActSignInRecordService.java @@ -0,0 +1,77 @@ +package com.epmet.modules.partyOrg.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.partyOrg.entity.IcPartyActSignInRecordEntity; +import com.epmet.resi.partymember.dto.IcPartyActSignInRecordDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.PartyActSignFormDTO; + +/** + * 党组织活动签到记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +public interface IcPartyActSignInRecordService extends BaseService { + + /** + * 默认查询 + * + * @param formDTO + * @return java.util.List + * @author generator + * @date 2022-08-18 + */ + PageData list(PartyActSignFormDTO formDTO); + + /** + * 单条查询 + * + * @param id + * @return IcPartyActSignInRecordDTO + * @author generator + * @date 2022-08-18 + */ + IcPartyActSignInRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-18 + */ + void save(IcPartyActSignInRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-18 + */ + void update(IcPartyActSignInRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-18 + */ + void delete(String[] ids); + + /** + * 判断该用户是否已经签到 + * TRUE:已签到 + * @param icPartyActId + * @param userId + * @return + */ + Boolean checkSignIn(String icPartyActId, String userId); + + void sign(PartyActSignFormDTO dto); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActTypeDictService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActTypeDictService.java new file mode 100644 index 0000000000..a74118179c --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyActTypeDictService.java @@ -0,0 +1,14 @@ +package com.epmet.modules.partyOrg.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.modules.partyOrg.entity.IcPartyActTypeDictEntity; + +/** + * 党组织活动类型字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +public interface IcPartyActTypeDictService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java index 6397916cc6..aa13fbfec8 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java @@ -6,10 +6,10 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.EditPrincipalFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.GetParentOrgFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO; -import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeDTO; -import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.*; import java.util.List; import java.util.Map; @@ -108,7 +108,7 @@ public interface IcPartyOrgService extends BaseService { * @return com.epmet.commons.tools.utils.Result> */ Result> getSearchTreelist(PartyOrgTreeListDTO formDTO); - + List getOrgTreeHaveGroup(PartyOrgTreeListDTO formDTO); /** * @describe: 上级党组织列表 * @author wangtong @@ -117,4 +117,45 @@ public interface IcPartyOrgService extends BaseService { * @return com.epmet.commons.tools.utils.Result> */ Result> getParentOrgList(GetParentOrgFormDTO formDTO); + + /** + * 获取客户下支部列表 + * + * @Param tokenDto + * @Return {@link Map} + * @Author zhaoqifeng + * @Date 2022/8/15 15:52 + */ + Map getPartyOrgList(TokenDto tokenDto); + + /** + * 党组织活动发布时, + * 查询当前登录用户所属行政组织下,默认的党组织,取第一个 + * @param tokenDto + * @return + */ + DefaultPartyOrgResDTO defaultPartyOrg(String customerId, String userId); + + /** + * 查询党组织partyOrgIdPath + * @param icPartyOrgId + * @return + */ + IcPartyOrgInfo queryIcPartyOrgInfo(String icPartyOrgId); + + /** + * 调整历史数据 ORG_PIDS + */ + void adjustOrgPath(List customerIds); + + List partOrgList(String gridId); + + /** + * Desc: 党组织修改负责人 + * @param formDTO + * @author zxc + * @date 2022/9/7 15:04 + */ + void editPrincipal(EditPrincipalFormDTO formDTO); + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcScheduleService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcScheduleService.java new file mode 100644 index 0000000000..ebd7f6f6dd --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcScheduleService.java @@ -0,0 +1,86 @@ +package com.epmet.modules.partyOrg.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.partyOrg.entity.IcScheduleEntity; +import com.epmet.resi.partymember.dto.IcScheduleDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO; + +import java.util.List; + +/** + * 日程表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +public interface IcScheduleService extends BaseService { + + /** + * 默认查询 + * + * @param formDTO + * @return java.util.List + * @author generator + * @date 2022-08-18 + */ + PageData list(IcScheduleFormDTO formDTO); + + /** + * 单条查询 + * + * @param id + * @return IcScheduleDTO + * @author generator + * @date 2022-08-18 + */ + IcScheduleDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-18 + */ + void save(IcScheduleDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-18 + */ + void update(IcScheduleDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-18 + */ + void delete(String[] ids); + + /** + * Desc: 新增或编辑日程 + * @param formDTO + * @author zxc + * @date 2022/8/18 16:31 + */ + void addOrEditSchedule(AddOrEditScheduleFormDTO formDTO); + + /** + * Desc: 删除日程 + * @param scheduleIds + * @author zxc + * @date 2022/8/18 17:00 + */ + void delSchedule(List scheduleIds); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/ResiPartymemberAttachmentService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/ResiPartymemberAttachmentService.java new file mode 100644 index 0000000000..6c70b77d3f --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/ResiPartymemberAttachmentService.java @@ -0,0 +1,16 @@ +package com.epmet.modules.partyOrg.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; + +import java.util.List; + +/** + * 本库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +public interface ResiPartymemberAttachmentService extends BaseService { + int deleteByBusinessId(String customerId, List businessIds); +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActOrgServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActOrgServiceImpl.java new file mode 100644 index 0000000000..dc767f47e0 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActOrgServiceImpl.java @@ -0,0 +1,31 @@ +package com.epmet.modules.partyOrg.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.modules.partyOrg.dao.IcPartyActOrgDao; +import com.epmet.modules.partyOrg.entity.IcPartyActOrgEntity; +import com.epmet.modules.partyOrg.service.IcPartyActOrgService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 参加活动党组织表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Service +public class IcPartyActOrgServiceImpl extends BaseServiceImpl implements IcPartyActOrgService { + + @Override + public int deleteByPartyActId(String customerId, List icPartyActIds) { + if (CollectionUtils.isEmpty(icPartyActIds)) { + return 0; + } + return baseDao.deleteByPartyActId(customerId, icPartyActIds); + } + + +} + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java new file mode 100644 index 0000000000..c5d1d7244b --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActServiceImpl.java @@ -0,0 +1,817 @@ +package com.epmet.modules.partyOrg.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.PartyMeetingMessageMQMsg; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.Constant; +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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.RenException; +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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.SystemMessageType; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.modules.partyOrg.dao.*; +import com.epmet.modules.partyOrg.entity.*; +import com.epmet.modules.partyOrg.service.*; +import com.epmet.modules.partymember.dao.IcPartyMemberDao; +import com.epmet.resi.group.dto.group.ResiGroupDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; +import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActAddOrUpdateFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.form.IcPartyActPageFormDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartActTypeDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActDetailResDTO; +import com.epmet.resi.partymember.dto.icpartyact.result.IcPartyActPageResultDTO; +import com.epmet.resi.partymember.dto.partyOrg.IcPartyActTypeDictDTO; +import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.*; +import com.epmet.resi.partymember.dto.partyOrg.result.*; +import com.epmet.resi.partymember.dto.partymember.result.IcPartyInfoResultDTO; +import com.epmet.send.SendMqMsgUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +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.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 党建组织活动 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Slf4j +@Service +public class IcPartyActServiceImpl extends BaseServiceImpl implements IcPartyActService { + @Autowired + private ResiGroupOpenFeignClient resiGroupOpenFeignClient; + @Autowired + private IcScheduleDao scheduleDao; + @Autowired + private IcPartyOrgService partyOrgService; + @Autowired + private IcPartyActOrgDao icPartyActOrgDao; + @Autowired + private IcPartyOrgDao partyOrgDao; + @Autowired + private ResiPartymemberAttachmentDao resiPartymemberAttachmentDao; + @Autowired + private EpmetMessageOpenFeignClient messageOpenFeignClient; + @Autowired + private IcPartyActTypeDictService partyActTypeDictService; + @Autowired + private IcPartyMemberDao icPartyMemberDao; + @Autowired + private IcPartyActSignInRecordDao icPartyActSignInRecordDao; + @Autowired + private IcScheduleDao icScheduleDao; + /** + * 活动类型列表 + * + * @param customerId + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public List actTypeList(String customerId) { + List list= baseDao.actTypeList(customerId); + if(CollectionUtils.isEmpty(list)){ + List icPartActTypeDTOS = baseDao.actTypeList(Constant.DEFAULT_CUSTOMER); + List entities = ConvertUtils.sourceToTarget(icPartActTypeDTOS, IcPartyActTypeDictEntity.class); + entities.forEach(e -> { + e.setId(IdWorker.getIdStr()); + e.setCustomerId(customerId); + }); + partyActTypeDictService.insertBatch(entities); + list = icPartActTypeDTOS; + } + return ConvertUtils.sourceToTarget(list,IcPartActTypeDTO.class); + } + + + + /** + * Desc: 【党建日历】首页-获取每月总数 = 日程总数 + 活动总数 + * 活动总数查询:支部下的 + 是不是本人条件 + * 日程查询:当前组织下 本人的 + 其他人公开的 + * @param formDTO + * @author zxc + * @date 2022/8/19 09:05 + */ + @Override + public List getHomeMonthTotal(HomeMonthTotalFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfo = queryStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + // IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId()); + // if (null == icPartyOrgDTO){ + // throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId()); + // } + // formDTO.setPath(icPartyOrgDTO.getOrgPids().equals("") || icPartyOrgDTO.getOrgPids().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId())); + List result = constructMonthData(formDTO.getYearId()); + List countList = scheduleDao.getScheduleAndActCount(formDTO); + if (CollectionUtils.isNotEmpty(countList)){ + countList.forEach(c -> result.stream().filter(r -> c.getMonthId().equals(r.getMonthId())).forEach(r -> r.setCount(c.getCount()))); + } + return result; + } + + /** + * Desc: 构造结果集 + * @param yearId + * @author zxc + * @date 2022/8/19 09:31 + */ + public List constructMonthData(String yearId){ + List result = new ArrayList<>(); + if (StringUtils.isNotBlank(yearId)){ + String[] array = new String[NumConstant.TWELVE]; + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM"); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR,Integer.parseInt(yearId)); + cal.set(Calendar.MONTH, NumConstant.ZERO); + for(int i=NumConstant.ZERO; i addOrUpdate(IcPartyActAddOrUpdateFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfo=queryStaffInfo(formDTO.getCustomerId(),formDTO.getPublishStaffId()); + IcPartyActEntity icPartyActEntity= ConvertUtils.sourceToTarget(formDTO,IcPartyActEntity.class); + //计算好自动发布的时间 + icPartyActEntity.setAutoPublicTime(DateUtils.calDateBaseDay(formDTO.getHoldTime(),formDTO.getAutoPublicType()*-1)); + icPartyActEntity.setPublishStaffName(staffInfo.getRealName()); + icPartyActEntity.setOrgId(staffInfo.getAgencyId()); + + //!!!!!!!不用前端传的了。 我自己查询吧 + IcPartyOrgInfo icPartyOrgInfo=SpringContextUtils.getBean(IcPartyOrgService.class).queryIcPartyOrgInfo(formDTO.getPublishPartyOrgId()); + if (null == icPartyOrgInfo || StringUtils.isBlank(icPartyOrgInfo.getPartyOrgIdPath())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "党组织信息查询异常publishPartyOrgId="+formDTO.getPublishPartyOrgId(), "党组织信息查询异常"); + } + icPartyActEntity.setPublishOrgPath(icPartyOrgInfo.getPartyOrgIdPath()); + + AgencyInfoCache agencyInfoCache= CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + icPartyActEntity.setPid(agencyInfoCache.getPid()); + if(StringUtils.isBlank(agencyInfoCache.getPid())||NumConstant.ZERO_STR.equals(agencyInfoCache.getPid())){ + // 根组织 + icPartyActEntity.setOrgIdPath(agencyInfoCache.getId()); + }else{ + icPartyActEntity.setOrgIdPath(agencyInfoCache.getPids().concat(StrConstant.COLON).concat(agencyInfoCache.getId())); + } + Boolean sendMsg=false; + if(StringUtils.isNotBlank(formDTO.getIcPartyActId())){ + icPartyActEntity.setId(formDTO.getIcPartyActId()); + //删除附件、删除参加组织 + SpringContextUtils.getBean(ResiPartymemberAttachmentService.class).deleteByBusinessId(formDTO.getCustomerId(), Arrays.asList(formDTO.getIcPartyActId())); + SpringContextUtils.getBean(IcPartyActOrgService.class).deleteByPartyActId(formDTO.getCustomerId(), Arrays.asList(formDTO.getIcPartyActId())); + //保留原来的发布状态 + IcPartyActEntity origin=baseDao.selectById(formDTO.getIcPartyActId()); + icPartyActEntity.setIsPublish(origin.getIsPublish()); + //修改活动 + baseDao.updateById(icPartyActEntity); + + //已发布,在编辑的时候,需要发送消息 + if(NumConstant.ONE_STR.equals(icPartyActEntity.getIsPublish())&&NumConstant.ONE_STR.equals(icPartyActEntity.getIsAutoInform())){ + sendMsg=true; + } + }else{ + //默认是未发布 + if(NumConstant.ZERO==formDTO.getAutoPublicType()){ + //选择立即发布,状态:已发布 + icPartyActEntity.setIsPublish(NumConstant.ONE_STR); + //立即发布的需要发送消息 + sendMsg=true; + }else{ + icPartyActEntity.setIsPublish(NumConstant.ZERO_STR); + } + //新增活动 + baseDao.insert(icPartyActEntity); + } + //新增参加参加活动党组织 + List orgList=ConvertUtils.sourceToTarget(formDTO.getJoinOrgList(),IcPartyActOrgEntity.class); + orgList.forEach(joinOrg->{ + joinOrg.setCustomerId(formDTO.getCustomerId()); + joinOrg.setIcPartyActId(icPartyActEntity.getId()); + //!!!!!!!不用前端传的了。 我自己查询吧 + IcPartyOrgInfo joinPartyOrgInfo=SpringContextUtils.getBean(IcPartyOrgService.class).queryIcPartyOrgInfo(joinOrg.getJoinOrgId()); + if (null == joinPartyOrgInfo || StringUtils.isBlank(joinPartyOrgInfo.getPartyOrgIdPath())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "党组织信息查询异常joinOrgId="+joinOrg.getJoinOrgId(), "党组织信息查询异常"); + } + joinOrg.setJoinOrgPath(joinPartyOrgInfo.getPartyOrgIdPath()); + icPartyActOrgDao.insert(joinOrg); + }); + + //批量新增附件 + List attachmentEntityList=CollectionUtils.isNotEmpty(formDTO.getAttachmentList())?ConvertUtils.sourceToTarget(formDTO.getAttachmentList(),ResiPartymemberAttachmentEntity.class):new ArrayList<>(); + int attSort = 1; + for (ResiPartymemberAttachmentEntity att : attachmentEntityList) { + att.setCustomerId(formDTO.getCustomerId()); + att.setBusinessId(icPartyActEntity.getId()); + att.setAttachTo("ic_party_act"); + att.setSort(attSort); + attSort++; + resiPartymemberAttachmentDao.insert(att); + } + + //已经发布的活动+且活动未开始的,编辑后需要发消息 + boolean flag=icPartyActEntity.getHoldTime().compareTo(new Date()) >0; + if (sendMsg && flag) { + PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg(); + msg.setCustomerId(formDTO.getCustomerId()); + msg.setIcPartyActId(icPartyActEntity.getId()); + msg.setType("publish"); + SendMqMsgUtil.build() + .openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class)) + .sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg); + } + + Map map=new HashMap<>(); + map.put("icPartyActId",icPartyActEntity.getId()); + return map; + } + + private CustomerStaffInfoCacheResult queryStaffInfo(String customerId, String staffId) { + CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(customerId,staffId); + if (null == staffInfo) { + String msg = "查询工作人员信息异常"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); + } + return staffInfo; + } + + + /** + * 【活动列表】分页查询(工作端小程序通用) + * + * @param formDTO + * @return + */ + @Override + public PageData pageList(IcPartyActPageFormDTO formDTO) { + CustomerStaffInfoCacheResult staffInfo = queryStaffInfo(formDTO.getCustomerId(), formDTO.getPublishStaffId()); + formDTO.setStaffAgencyId(staffInfo.getAgencyId()); + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), + formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.selectPageList(formDTO)); + if(!formDTO.getIsPage()){ + pageInfo.getList().forEach(l->{ + l.setJoinOrgList(icPartyActOrgDao.selectJoinOrgList(l.getIcPartyActId())); + }); + } + return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); + } + + /** + * 活动列表活动详情 + * + * @param customerId + * @param userId + * @param icPartyActId + * @return + */ + @Override + public IcPartyActDetailResDTO queryActDetail(String customerId, String userId, String icPartyActId) { + IcPartyActEntity icPartyActEntity = baseDao.selectById(icPartyActId); + if (null == icPartyActEntity) { + String msg = "活动已删除"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); + } + IcPartyActDetailResDTO resDTO=ConvertUtils.sourceToTarget(icPartyActEntity,IcPartyActDetailResDTO.class); + resDTO.setAutoPublicTypeDesc(icPartyActEntity.getAutoPublicType().compareTo(NumConstant.ZERO) != NumConstant.ZERO ? "活动开始前"+icPartyActEntity.getAutoPublicType()+"天" : "立即发布"); + resDTO.setIcPartyActId(icPartyActEntity.getId()); + resDTO.setActTypeName(baseDao.selectActTypeName(customerId,icPartyActEntity.getActType())); + //参加人员类型,0:全体党员;1:支部委员 + resDTO.setJoinUserTypeName(NumConstant.ZERO_STR.equals(resDTO.getJoinUserType()) ? "全体党员" : "支部委员"); + resDTO.setAttachmentList(resiPartymemberAttachmentDao.selectListByBusinessId(icPartyActId)); + resDTO.setIsSignIn(SpringContextUtils.getBean(IcPartyActSignInRecordService.class).checkSignIn(icPartyActId,userId)); + resDTO.setJoinOrgList(icPartyActOrgDao.selectJoinOrgList(icPartyActId)); + return resDTO; + } + + /** + * Desc: 【党建日历】活动、日程列表 + * @param formDTO + * @author zxc + * @date 2022/8/19 13:57 + */ + @Override + public ActAndScheduleListResultDTO getActAndScheduleList(ActAndScheduleListFormDTO formDTO) { + disposeActAndScheduleListFormDTO(formDTO); + List activityList = baseDao.getActivityList(formDTO); + if (CollectionUtils.isNotEmpty(activityList)){ + disposeActivityList(formDTO,activityList); + } + List scheduleList = scheduleDao.getScheduleList(formDTO); + if (CollectionUtils.isNotEmpty(scheduleList)){ + scheduleList.forEach(s -> { + s.setIsMe(formDTO.getStaffId().equals(s.getStaffId())); + }); + } + ActAndScheduleListResultDTO result = new ActAndScheduleListResultDTO(); + result.setActivityList(activityList); + result.setScheduleList(scheduleList); + return result; + } + + /** + * Desc: 【党建日历】某月/天数据搜索列表 + * @param formDTO + * @author zxc + * @date 2022/8/19 14:01 + */ + @Override + public List homeSearch(ActAndScheduleListFormDTO formDTO) { + disposeActAndScheduleListFormDTO(formDTO); + List result = constructHomeSearchData(formDTO.getStartDate(), formDTO.getEndDate()); + List activityList = baseDao.getActivityList(formDTO); + if (CollectionUtils.isNotEmpty(activityList)){ + disposeActivityList(formDTO,activityList); + Map> groupByDateId = activityList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ActivityListDTO::getDateId)); + result.forEach(r -> { + groupByDateId.forEach((dateId,list) -> { + if (r.getDateId().equals(dateId)){ + r.setActivityList(list); + r.setActivityTotal(list.size()); + } + }); + }); + } + List scheduleList = scheduleDao.getScheduleList(formDTO); + if (CollectionUtils.isNotEmpty(scheduleList)){ + scheduleList.forEach(s -> { + s.setIsMe(formDTO.getStaffId().equals(s.getStaffId())); + }); + Map> groupByDateId = scheduleList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ScheduleListDTO::getDateId)); + result.forEach(r -> { + groupByDateId.forEach((dateId,list) -> { + if (r.getDateId().equals(dateId)){ + r.setScheduleList(list); + r.setScheduleTotal(list.size()); + } + }); + }); + } + return result; + } + + /** + * Desc: 【党建日历】生成年度活动计划查询 + * @param formDTO + * @author zxc + * @date 2022/8/22 09:33 + */ + @Override + public List yearSearch01(YearSearchFormDTO formDTO) { + ActAndScheduleListFormDTO secondForm = ConvertUtils.sourceToTarget(formDTO, ActAndScheduleListFormDTO.class); + secondForm.setSearchType("yearSearch"); + disposeActAndScheduleListFormDTO(secondForm); + List activityList = baseDao.getActivityList(secondForm); + List activityTypeList = actTypeList(formDTO.getCustomerId()); + List result = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(activityList)) { + disposeActivityList(secondForm, activityList); + Map> groupByType = activityList.stream().collect(Collectors.groupingBy(ActAndScheduleListResultDTO.ActivityListDTO::getType)); + groupByType.forEach((type,list) -> { + YearSearchResultDTO dto = new YearSearchResultDTO(); + activityTypeList.forEach(at -> { + if (at.getValue().equals(type)){ + dto.setType(at.getLabel()); + dto.setFrequency(at.getFrequencyDesc()); + } + }); + dto.setActivityList(ConvertUtils.sourceToTarget(list, YearSearchResultDTO.YearSearchActivityListDTO.class)); + result.add(dto); + }); + } + return result; + } + + @Override + public List yearSearch(YearSearchFormDTO formDTO) { + ActAndScheduleListFormDTO secondForm = ConvertUtils.sourceToTarget(formDTO, ActAndScheduleListFormDTO.class); + secondForm.setSearchType("yearSearch"); + disposeActAndScheduleListFormDTO(secondForm); + List activityList = baseDao.getActivityList(secondForm); + List activityDetailList = new ArrayList<>(); + if (CollectionUtils.isEmpty(activityList)){ + return new ArrayList<>(); + } + activityList.forEach(al -> { + IcPartyActDetailResDTO icPartyActDetailResDTO = queryActDetail(formDTO.getCustomerId(), formDTO.getStaffId(), al.getActivityId()); + activityDetailList.add(icPartyActDetailResDTO); + }); + List result = new ArrayList<>(); + List activityTypeList = actTypeList(formDTO.getCustomerId()); + Map> groupByType = activityDetailList.stream().collect(Collectors.groupingBy(IcPartyActDetailResDTO::getActType)); + groupByType.forEach((type,list) -> { + YearSearchDetailResultDTO dto = new YearSearchDetailResultDTO(); + activityTypeList.forEach(at -> { + if (at.getValue().equals(type)){ + dto.setType(type); + dto.setTypeValue(at.getLabel()); + dto.setFrequency(at.getFrequencyDesc()); + } + }); + dto.setActivityList(list); + result.add(dto); + }); + return result; + } + + /** + * Desc: + * @param formDTO + * @author zxc + * @date 2022/8/19 17:26 + */ + public void disposeActAndScheduleListFormDTO(ActAndScheduleListFormDTO formDTO){ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo){ + throw new EpmetException("查询工作人员失败:"+formDTO.getStaffId()); + } + formDTO.setAgencyId(staffInfo.getAgencyId()); + if (!formDTO.getSearchType().equals("yearSearch")){ + if (StringUtils.isNotBlank(formDTO.getOrgId())){ + IcPartyOrgDTO icPartyOrgDTO = partyOrgService.get(formDTO.getOrgId()); + if (null == icPartyOrgDTO){ + throw new EpmetException("未查询到党组织信息:"+formDTO.getOrgId()); + } + formDTO.setPath(StringUtils.isBlank(icPartyOrgDTO.getOrgPid()) || icPartyOrgDTO.getOrgPid().equals(NumConstant.ZERO_STR) ? icPartyOrgDTO.getId() : icPartyOrgDTO.getOrgPids().concat(":").concat(icPartyOrgDTO.getId())); + } + } + + } + + /** + * Desc: 组装activityList + * @param formDTO + * @param activityList + * @author zxc + * @date 2022/8/19 17:19 + */ + public void disposeActivityList(ActAndScheduleListFormDTO formDTO,List activityList){ + List partyOrgIdsNoDistinct = new ArrayList<>(); + activityList.forEach(a -> { + partyOrgIdsNoDistinct.addAll(a.getJoinOrgList().stream().map(m -> m.getPartyOrgId()).collect(Collectors.toList())); + }); + List partyOrgIds = partyOrgIdsNoDistinct.stream().distinct().collect(Collectors.toList()); + List partyOrg = partyOrgDao.getPartyOrg(partyOrgIds); + if (CollectionUtils.isNotEmpty(activityList)) { + activityList.forEach(a -> { + a.setIsMe(formDTO.getStaffId().equals(a.getStaffId())); + a.getJoinOrgList().forEach(po -> partyOrg.stream().filter(p -> p.getPartyOrgId().equals(po.getPartyOrgId())).forEach(p -> po.setPartyOrgName(p.getPartyOrgName()))); + a.setJoinOrgs(a.getJoinOrgList().stream().map(m -> m.getPartyOrgName()).collect(Collectors.toList())); + }); + } + } + + public static List constructHomeSearchData(String startDate,String endDate){ + List result = new ArrayList<>(); + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ + List days = DateUtils.getDaysBetween(startDate, endDate); + days.forEach(d -> { + ActAndScheduleListResultDTO dto = new ActAndScheduleListResultDTO(); + dto.setDateId(d); + result.add(dto); + }); + } + return result; + } + + /** + * 党建小助手活动触发为用户推送消息 + */ + @Override + public void partyMeetingMessage(PartyMeetingMessageMQMsg formDTO) { + //1.校验活动/日程数据是否存在 + IcPartyActEntity entity = null; + IcScheduleEntity schedule = null; + if (!"notify".equals(formDTO.getType())) { + entity = baseDao.selectById(formDTO.getIcPartyActId()); + if (null == entity) { + // String msg = "活动信息不存在,活动Id:" + formDTO.getIcPartyActId(); + // throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg); + return; + } + } else { + schedule = scheduleDao.selectById(formDTO.getIcPartyActId()); + if (null == schedule) { + // String msg = "日程信息不存在,活动Id:" + formDTO.getIcPartyActId(); + // throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg); + return; + } + } + + List msgList = new ArrayList<>(); + //2.根据不同类型消息触发不同处理逻辑 + //2-1.发布活动给居民端涉及党员已经工作端活动发布站推送党建活动消息 + if ("publish".equals(formDTO.getType())) { + //查询活动对应的发布范围信息 + LambdaQueryWrapper orgWrapper = new LambdaQueryWrapper<>(); + orgWrapper.eq(IcPartyActOrgEntity::getDelFlag, NumConstant.ZERO_STR); + orgWrapper.eq(IcPartyActOrgEntity::getIcPartyActId, formDTO.getIcPartyActId()); + List list = icPartyActOrgDao.selectList(orgWrapper); + List groupIdList = list.stream().filter(ca -> ca.getOrgType().equals("6")).map(m -> m.getJoinOrgId()).collect(Collectors.toList()); + List partyOrgIdList = list.stream().filter(ca -> !ca.getOrgType().equals("6")).map(m -> m.getJoinOrgId()).collect(Collectors.toList()); + //分别查询党组织、党小组下的人 + List userIdList = new ArrayList<>(); + if (!CollectionUtils.isEmpty(groupIdList)) { + Result> result = resiGroupOpenFeignClient.groupMemberList(groupIdList); + if (!result.success()) { + throw new RenException("调用common service查询secret失败"); + } + userIdList = result.getData().stream().map(ResiGroupMemberDTO::getCustomerUserId).collect(Collectors.toList()); + } + if (!CollectionUtils.isEmpty(partyOrgIdList)) { + List partyIdList = partyOrgDao.getUserIdByPartyOrgIds(partyOrgIdList); + userIdList.addAll(partyIdList); + } + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); + + //组装消息 + for (String id : userIdList){ + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(formDTO.getCustomerId()); + msg.setApp(AppClientConstant.APP_RESI); + msg.setTitle("您收到一个新的活动通知"); + msg.setReadFlag(ReadFlagConstant.UN_READ); + StringBuffer str = new StringBuffer(); + str.append("主题:").append(entity.getTopic()).append("\n").append("时间:").append(DateUtils.format(entity.getHoldTime(), "yyyy年MM月dd日 HH:mm:ss")).append("\n").append("地点:").append(entity.getAddress()); + msg.setMessageContent(str.toString()); + msg.setMessageType("party_act"); + msg.setTargetId(formDTO.getIcPartyActId()); + msg.setUserId(id); + msgList.add(msg); + } + //工作人员 + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(formDTO.getCustomerId()); + msg.setApp(AppClientConstant.APP_GOV); + msg.setTitle("您有一个活动已经发布"); + msg.setReadFlag(ReadFlagConstant.UN_READ); + StringBuffer str = new StringBuffer(); + str.append("主题:").append(entity.getTopic()).append("\n").append("时间:").append(DateUtils.format(entity.getHoldTime(), "yyyy年MM月dd日 HH:mm:ss")).append("\n").append("地点:").append(entity.getAddress()); + msg.setMessageContent(str.toString()); + msg.setMessageType("party_act"); + msg.setTargetId(formDTO.getIcPartyActId()); + msg.setUserId(entity.getPublishStaffId()); + msgList.add(msg); + } + //2-2.活动开始前三天给工作人员推送提醒类消息 + if ("remind".equals(formDTO.getType())) { + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(formDTO.getCustomerId()); + msg.setApp(AppClientConstant.APP_GOV); + msg.setTitle("您有一个活动3天后即将自动发布"); + msg.setReadFlag(ReadFlagConstant.UN_READ); + StringBuffer str = new StringBuffer(); + str.append("主题:").append(entity.getTopic()).append("\n").append("时间:").append(DateUtils.format(entity.getHoldTime(), "yyyy年MM月dd日 HH:mm:ss")).append("\n").append("地点:").append(entity.getAddress()); + msg.setMessageContent(str.toString()); + msg.setMessageType("party_act"); + msg.setTargetId(formDTO.getIcPartyActId()); + msg.setUserId(entity.getPublishStaffId()); + msgList.add(msg); + } + //2-2.给工作人员推送日程消息 + if ("notify".equals(formDTO.getType())) { + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(formDTO.getCustomerId()); + msg.setApp(AppClientConstant.APP_GOV); + msg.setTitle("您有一个日程提醒"); + msg.setReadFlag(ReadFlagConstant.UN_READ); + StringBuffer str = new StringBuffer(); + str.append("日程:").append(schedule.getTitle()).append("\n").append("时间:").append(DateUtils.format(schedule.getHappenedTime(), "yyyy年MM月dd日 HH:mm:ss")); + msg.setMessageContent(str.toString()); + msg.setMessageType("party_schedule"); + msg.setTargetId(formDTO.getIcPartyActId()); + msg.setUserId(schedule.getStaffId()); + msgList.add(msg); + } + + //3.推送消息 + Result sendMessageRes = messageOpenFeignClient.saveIcMessageList(msgList); + if (!sendMessageRes.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "党建小助手推送消息失败"); + } + } + + /** + * * pc活动列表-发布活动 + * pc党建日历左下角列表,点击发布 + * 工作端小程序点击发布 + * + * @param userId + * @param icPartyActId + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void publicshIcPartyAct(String userId, String icPartyActId) { + //谁发布的活动谁编辑 + IcPartyActEntity icPartyActEntity = baseDao.selectById(icPartyActId); + if (null == icPartyActEntity) { + String msg = "未找到活动详情"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); + } + if(!userId.equals(icPartyActEntity.getCreatedBy())){ + String msg = String.format("当前活动是%s发布的,您无权操作",icPartyActEntity.getPublishStaffName()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); + } + icPartyActEntity.setIsPublish(NumConstant.ONE_STR); + icPartyActEntity.setUpdatedBy(userId); + baseDao.updateById(icPartyActEntity); + //发送消息:自动通知参加人员+活动未开始的 + if (NumConstant.ONE_STR.equals(icPartyActEntity.getIsAutoInform()) && icPartyActEntity.getHoldTime().compareTo(new Date()) >0) { + PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg(); + msg.setCustomerId(icPartyActEntity.getCustomerId()); + msg.setIcPartyActId(icPartyActEntity.getId()); + msg.setType("publish"); + SendMqMsgUtil.build().openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class)).sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg); + } + } + + /** + * 删除活动 + * + * @param userId + * @param icPartyActIds + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteIcPartyAct(String customerId,String userId, List icPartyActIds) { + if(CollectionUtils.isEmpty(icPartyActIds)){ + return; + } + icPartyActIds.forEach(icPartyActId->{ + //删除活动主表和参与活动党组织关系表记录 + //只有本人发布的活动才可以删除 + baseDao.deleteIcPartyAct(customerId,userId,icPartyActId); + icPartyActOrgDao.updateToDel(userId,icPartyActId); + //删除签到记录 + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(IcPartyActSignInRecordEntity::getIcPartyActId,icPartyActId); + icPartyActSignInRecordDao.delete(queryWrapper); + }); + + } + + @Override + public PageData list(IcPartyActListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + //1.查询当前用户所属党支部信息 + IcPartyInfoResultDTO dto = icPartyMemberDao.selectByUserId(formDTO.getUserId()); + if(null == dto){ + return new PageData<>(new ArrayList<>(), 0); + } + formDTO.setJoinOrgId(dto.getId()); + + //2.根据所属支部及查询条件筛选数据 + List list = baseDao.selectresiPartyActList(formDTO); + + //3.封装数据 + List dict = actTypeList(formDTO.getCustomerId()); + list.forEach(u -> dict.stream().filter(r -> u.getActType().equals(r.getValue())).forEach(d -> u.setActTypeName(d.getLabel()))); + + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 通知:您有一个活动3天后即将自动发布 + */ + @Override + public void noticePartyActAutoPublish() { + Date nowDate=new Date(); + Date afterThreeDayDate=DateUtils.calDateBaseDay(nowDate,3); + // log.info("现在时间:"+DateUtils.format(nowDate,"yyyy-MM-dd HH:mm:ss")+";3天后="+DateUtils.format(afterThreeDayDate,"yyyy-MM-dd HH:mm:ss")); + //现在时间:2022-08-22 17:11:49;3天后=2022-08-25 17:11:49 + //dateId:20220825 + String dateId=DateUtils.format(afterThreeDayDate,DateUtils.DATE_PATTERN_YYYYMMDD); + List list=baseDao.selectNeedRemindAutoPublishAct(dateId); + for(IcPartyActEntity act:list){ + PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg(); + msg.setCustomerId(act.getCustomerId()); + msg.setIcPartyActId(act.getId()); + msg.setType("remind"); + SendMqMsgUtil.build() + .openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class)) + .sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg); + } + //日程又增加了一个提醒时间 + String nowDateId=DateUtils.format(new Date(),DateUtils.DATE_PATTERN_YYYYMMDD); + List scheduleEntityList=icScheduleDao.selectNeedNotice(nowDateId); + for(IcScheduleEntity icScheduleEntity:scheduleEntityList){ + PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg(); + msg.setCustomerId(icScheduleEntity.getCustomerId()); + msg.setIcPartyActId(icScheduleEntity.getId()); + msg.setType("notify"); + SendMqMsgUtil.build() + .openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class)) + .sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg); + } + } + + /** + * 自动发布活动 + */ + @Override + public void autoPublishIcPartyAct() { + Date nowDate = new Date(); + String dateId = DateUtils.format(nowDate, DateUtils.DATE_PATTERN_YYYYMMDDHHMM); + String min = dateId.substring(0, dateId.length() - 1); + log.info("自动发布活动开始,当前时间dateId=" + dateId + ";sql入参:" + min); + List list = baseDao.selectNoPublishList(min); + if (CollectionUtils.isNotEmpty(list)) { + log.info("自动发布" + list.size() + "个活动"); + for (IcPartyActEntity act : list) { + // 置为已发布 + act.setIsPublish(NumConstant.ONE_STR); + baseDao.updateById(act); + // 选择了自动通知参加人员的,需要发送消息 + if (NumConstant.ONE_STR.equals(act.getIsAutoInform())) { + PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg(); + msg.setCustomerId(act.getCustomerId()); + msg.setIcPartyActId(act.getId()); + msg.setType("publish"); + SendMqMsgUtil.build() + .openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class)) + .sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg); + } + } + } + } + + + /** + * Desc: 统计各党组织参与各种党活动的次数 + */ + @Override + public LinkedList patryActStatis(PartyActStatisFormDTO formDTO) { + LinkedList resultList = new LinkedList<>(); + //1.查询当前党组织及直属下级基础数据 + List orgDTOList = partyOrgDao.getSelfAndSub(formDTO.getJoinOrgId()); + if (CollectionUtils.isEmpty(orgDTOList)) { + return resultList; + } + List partyOrgIdList = orgDTOList.stream().map(IcPartyOrgDTO::getId).collect(Collectors.toList()); + //如果党组织是支部类型,则直属下级是党小组 + if ("5".equals(orgDTOList.get(0).getPartyOrgType())) { + Result> result = resiGroupOpenFeignClient.partyGroupList(formDTO.getJoinOrgId()); + if (!result.success()) { + throw new RenException("获取党支部下党小组列表失败:" + result.getInternalMsg()); + } + List groupIdList = result.getData().stream().map(ResiGroupDTO::getId).collect(Collectors.toList()); + partyOrgIdList.addAll(groupIdList); + } + formDTO.setPartyOrgIdList(partyOrgIdList); + + //2.按党组织统计查询各类型活动参与次数 + List partActStatis = baseDao.getPartActStatis(formDTO); + Map map = partActStatis.stream().collect(Collectors.toMap(PartyActStatisResultDTO::getJoinOrgId, m -> m, (k1, k2) -> k1)); + + //3.封装数据并返回 + orgDTOList.forEach(org -> { + PartyActStatisResultDTO dto = new PartyActStatisResultDTO(); + if (map.containsKey(org.getId())) { + dto = ConvertUtils.sourceToTarget(map.get(org.getId()), PartyActStatisResultDTO.class); + } + dto.setJoinOrgName(org.getPartyOrgName()); + resultList.add(dto); + }); + return resultList; + } + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActSignInRecordServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActSignInRecordServiceImpl.java new file mode 100644 index 0000000000..14e22242e7 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActSignInRecordServiceImpl.java @@ -0,0 +1,193 @@ +package com.epmet.modules.partyOrg.service.impl; + +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.rocketmq.constants.TopicConstants; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.MqConstant; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.SystemMessageType; +import com.epmet.dto.form.IssueInitiatorFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; +import com.epmet.dto.result.CustomerUserDetailResultDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.modules.partyOrg.dao.IcPartyActSignInRecordDao; +import com.epmet.modules.partyOrg.entity.IcPartyActEntity; +import com.epmet.modules.partyOrg.entity.IcPartyActSignInRecordEntity; +import com.epmet.modules.partyOrg.service.IcPartyActService; +import com.epmet.modules.partyOrg.service.IcPartyActSignInRecordService; +import com.epmet.resi.partymember.dto.IcPartyActSignInRecordDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.PartyActSignFormDTO; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +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.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 党组织活动签到记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Service +@Slf4j +public class IcPartyActSignInRecordServiceImpl extends BaseServiceImpl implements IcPartyActSignInRecordService { + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private IcPartyActService icPartyActService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + + + @Override + public PageData list(PartyActSignFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list = baseDao.selectSignList(formDTO.getIcPartyActId()); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(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 IcPartyActSignInRecordDTO get(String id) { + IcPartyActSignInRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcPartyActSignInRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcPartyActSignInRecordDTO dto) { + IcPartyActSignInRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyActSignInRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcPartyActSignInRecordDTO dto) { + IcPartyActSignInRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyActSignInRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 判断该用户是否已经签到 + * TRUE:已签到 + * + * @param icPartyActId + * @param userId + * @return + */ + @Override + public Boolean checkSignIn(String icPartyActId, String userId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcPartyActSignInRecordEntity::getIcPartyActId,icPartyActId).eq(IcPartyActSignInRecordEntity::getEpmetUserId,userId); + if(baseDao.selectCount(wrapper)>0){ + return true; + } + return false; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void sign(PartyActSignFormDTO formDTO) { + //1.查询用户居民信息 + IssueInitiatorFormDTO user = new IssueInitiatorFormDTO(); + user.setUserId(formDTO.getUserId()); + Result result = epmetUserOpenFeignClient.customerUserDetail(user); + if (!result.success() && null == result.getData()) { + throw new RenException("获取当前登录人居民信息失败"); + } + //二次签到不给积分 + boolean bl = true; + //2.判断新增/修改签到记录数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcPartyActSignInRecordEntity::getIcPartyActId, formDTO.getIcPartyActId()); + wrapper.eq(IcPartyActSignInRecordEntity::getEpmetUserId, formDTO.getUserId()); + IcPartyActSignInRecordEntity entityOne = baseDao.selectOne(wrapper); + if (null == entityOne) { + IcPartyActSignInRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPartyActSignInRecordEntity.class); + entity.setEpmetUserId(formDTO.getUserId()); + entity.setIdCard(result.getData().getIdNum()); + entity.setUserRealName(result.getData().getName()); + insert(entity); + } else { + entityOne.setAddress(formDTO.getAddress()); + entityOne.setLatitude(formDTO.getLatitude()); + entityOne.setLongitude(formDTO.getLongitude()); + baseDao.updateById(entityOne); + bl = false; + } + + //3.推送mq加积分 + if (bl) { + IcPartyActEntity actEntity = icPartyActService.selectById(formDTO.getIcPartyActId()); + String actType = actEntity.getActType(); + String eventTag = ("dangke".equals(actType) ? SystemMessageType.DANGKE : ("dxzh".equals(actType) ? SystemMessageType.DXZH : ( + "wmfwhd".equals(actType) ? SystemMessageType.WMFWHD : ("zbdydh".equals(actType) ? SystemMessageType.ZBDYDH : ( + "zbwyh".equals(actType) ? SystemMessageType.ZBWYH : ("ztdr".equals(actType) ? SystemMessageType.ZTDR : "") + )) + ))); + //网格缓存信息 + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); + if (null == gridInfo) { + throw new EpmetException(String.format("未查询到网格{%s}信息", formDTO.getGridId())); + } + List pointEventMsgList = new ArrayList<>(); + BasePointEventMsg pointEventMsg = new BasePointEventMsg(); + pointEventMsg.setOpAgencyId(gridInfo.getPid()); + pointEventMsg.setOperatorId(formDTO.getUserId()); + pointEventMsg.setAgencyId(gridInfo.getPid()); + pointEventMsg.setCustomerId(formDTO.getCustomerId()); + pointEventMsg.setGridId(gridInfo.getId()); + pointEventMsg.setUserId(formDTO.getUserId()); + pointEventMsg.setActionFlag(MqConstant.PLUS); + pointEventMsg.setIsCommon(false); + pointEventMsg.setSourceType(actType); + pointEventMsg.setSourceId(formDTO.getIcPartyActId()); + pointEventMsg.setEventTag(eventTag); + pointEventMsg.setEventClass(TopicConstants.PARTY_BUILDING); + pointEventMsgList.add(pointEventMsg); + + SystemMsgFormDTO msgFormDTO = new SystemMsgFormDTO(); + msgFormDTO.setMessageType(eventTag); + msgFormDTO.setContent(pointEventMsgList); + Result sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(msgFormDTO); + if (!sendMsgResult.success()) { + log.error("党建活动签到发送积分失败,活动Id->" + formDTO.getIcPartyActId() + " 用户->" + formDTO.getUserId()); + } + } + } + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActTypeDictServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActTypeDictServiceImpl.java new file mode 100644 index 0000000000..220b5c7e1d --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyActTypeDictServiceImpl.java @@ -0,0 +1,18 @@ +package com.epmet.modules.partyOrg.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.modules.partyOrg.dao.IcPartyActTypeDictDao; +import com.epmet.modules.partyOrg.entity.IcPartyActTypeDictEntity; +import com.epmet.modules.partyOrg.service.IcPartyActTypeDictService; +import org.springframework.stereotype.Service; + +/** + * 党组织活动类型字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Service +public class IcPartyActTypeDictServiceImpl extends BaseServiceImpl implements IcPartyActTypeDictService { + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java index 70cb443864..8862404285 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java @@ -1,9 +1,12 @@ package com.epmet.modules.partyOrg.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; 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.PartyOrgTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -12,6 +15,7 @@ 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.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -23,22 +27,23 @@ import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; import com.epmet.modules.partyOrg.service.IcPartyOrgService; import com.epmet.modules.partymember.dao.IcPartyMemberDao; import com.epmet.modules.partymember.entity.IcPartyMemberEntity; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.EditPrincipalFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.GetParentOrgFormDTO; import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO; -import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeDTO; -import com.epmet.resi.partymember.dto.partyOrg.result.BranchlistTreeSubDTO; -import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.*; +import lombok.extern.slf4j.Slf4j; 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 org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import javax.annotation.Resource; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 党组织表 @@ -46,6 +51,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2022-05-17 */ +@Slf4j @Service public class IcPartyOrgServiceImpl extends BaseServiceImpl implements IcPartyOrgService { @@ -54,6 +60,8 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl>> groupResult = resiGroupOpenFeignClient.getBranchGroupList(); + if (!groupResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询支部小组错误", "查询支部小组错误"); + } for (String id : ids) { //判断该组织是否有下级党组织 List orgList = baseDao.selectAllByOrgId(id); @@ -210,6 +220,10 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl> getTreelist(PartyOrgTreeListDTO formDTO) { List list = baseDao.getTreelist(formDTO); + Result>> groupResult = resiGroupOpenFeignClient.getBranchGroupList(); + if (!groupResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询支部小组错误", "查询支部小组错误"); + } + for (IcPartyOrgTreeDTO org : list) { + getChildren(org, groupResult.getData()); + } return new Result>().ok(build(list)); } + private void getChildren(IcPartyOrgTreeDTO dto, Map> map) { + if (NumConstant.FIVE_STR.equals(dto.getPartyOrgType())) { + if (map.containsKey(dto.getId())) { + dto.setChildren(map.get(dto.getId())); + dto.getChildren().forEach(item -> { + item.setAgencyId(dto.getAgencyId()); + item.setAgencyPids(dto.getAgencyPids()); + }); + } + } else { + for (IcPartyOrgTreeDTO org : dto.getChildren()) { + getChildren(org, map); + } + } + } + @Override public Result> branchlist(TokenDto tokenDto) { CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); @@ -244,6 +281,28 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl>().ok(build(list)); } + @Override + public List getOrgTreeHaveGroup(PartyOrgTreeListDTO formDTO) { + if (StringUtils.isBlank(formDTO.getAgencyId())) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo) { + throw new EpmetException("获取工作人员信息失败"); + } + formDTO.setAgencyId(staffInfo.getAgencyId()); + } + List list = baseDao.getSearchTreelist(formDTO); + + Result>> groupResult = resiGroupOpenFeignClient.getBranchGroupList(); + if (!groupResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询支部小组错误", "查询支部小组错误"); + } + for (IcPartyOrgTreeDTO org : list) { + getChildren(org, groupResult.getData()); + } + + return list; + } + @Override public Result> getParentOrgList(GetParentOrgFormDTO formDTO) { Result agencyDTOResult = govOrgOpenFeignClient.getAgencyById(formDTO.getAgencyId()); @@ -270,6 +329,29 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl>().ok(list); } + /** + * 获取客户下支部列表 + * + * @param tokenDto + * @Param tokenDto + * @Return {@link Map} + * @Author zhaoqifeng + * @Date 2022/8/15 15:52 + */ + @Override + public Map getPartyOrgList(TokenDto tokenDto) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcPartyOrgEntity::getCustomerId, tokenDto.getCustomerId()); + wrapper.eq(IcPartyOrgEntity::getPartyOrgType, NumConstant.FIVE_STR); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + List result = ConvertUtils.sourceToTarget(list, IcPartyOrgDTO.class); + + return result.stream().collect(Collectors.toMap(IcPartyOrgDTO::getId, Function.identity())); + } + /** * 构建树节点 */ @@ -295,4 +377,130 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl pids=new ArrayList<>(); + pids.add(icPartyOrgId); + + List names=new ArrayList<>(); + names.add(orgEntity.getPartyOrgName()); + + Map map=getPartyOrgIdPath(pids,names,orgEntity.getOrgPid()); + String partyOrgIdPath = map.containsKey("idPath") ? map.get("idPath") : StrConstant.EPMETY_STR; + String partyOrgNamePath = map.containsKey("namePath") ? map.get("namePath") : StrConstant.EPMETY_STR; + orgInfo.setPartyOrgIdPath(partyOrgIdPath); + orgInfo.setPartyOrgNamePath(partyOrgNamePath); + return orgInfo; + } + + private Map getPartyOrgIdPath(List pids,List names,String pid) { + Map map=new HashMap<>(); + IcPartyOrgEntity orgEntity=baseDao.selectById(pid); + if(null==orgEntity){ + return map; + } + pids.add(pid); + names.add(orgEntity.getPartyOrgName()); + if(StringUtils.isNotBlank(orgEntity.getOrgPid())&&!NumConstant.ZERO_STR.equals(orgEntity.getOrgPid())){ + return getPartyOrgIdPath(pids,names,orgEntity.getOrgPid()); + } + //倒序排列 + Collections.reverse(pids); + Collections.reverse(names); + + map.put("idPath", StringUtils.join(pids.toArray(),StrConstant.COLON)); + map.put("namePath", StringUtils.join(names.toArray(),StrConstant.HYPHEN)); + return map; + } + + /** + * 调整历史数据 ORG_PIDS + */ + @Override + public void adjustOrgPath(List customerIds) { + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.in(org.apache.commons.collections4.CollectionUtils.isNotEmpty(customerIds),IcPartyOrgEntity::getCustomerId,customerIds); + List list=baseDao.selectList(queryWrapper); + int num=1; + for(IcPartyOrgEntity entity:list){ + List pids=new ArrayList<>(); + List names=new ArrayList<>(); + Map map=getPartyOrgIdPath(pids,names,entity.getOrgPid()); + String partyOrgIdPath = map.containsKey("idPath") ? map.get("idPath") : StrConstant.EPMETY_STR; + String partyOrgNamePath = map.containsKey("namePath") ? map.get("namePath") : StrConstant.EPMETY_STR; + log.info(num+":::"+entity.getId()+entity.getPartyOrgName()+";path="+partyOrgIdPath+";"+partyOrgNamePath); + entity.setOrgPids(partyOrgIdPath); + baseDao.updateById(entity); + num++; + } + } + + @Override + public List partOrgList(String gridId) { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId); + if (null == gridInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格缓存信息失败,网格Id->"+gridId, "获取网格缓存信息失败,网格Id->"+gridId); + } + return baseDao.partOrgList(gridInfo.getPid()); + } + + /** + * Desc: 党组织修改负责人 + * @param formDTO + * @author zxc + * @date 2022/9/7 15:04 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void editPrincipal(EditPrincipalFormDTO formDTO) { + baseDao.editPrincipal(formDTO); + } + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java new file mode 100644 index 0000000000..87fe5d0dfa --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcScheduleServiceImpl.java @@ -0,0 +1,142 @@ +package com.epmet.modules.partyOrg.service.impl; + +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.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; +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.utils.ConvertUtils; +import com.epmet.modules.partyOrg.dao.IcScheduleDao; +import com.epmet.modules.partyOrg.entity.IcScheduleEntity; +import com.epmet.modules.partyOrg.service.IcScheduleService; +import com.epmet.resi.partymember.dto.IcScheduleDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.AddOrEditScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.form.IcScheduleFormDTO; +import com.epmet.resi.partymember.dto.partyOrg.result.IcScheduleListDTO; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 日程表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-18 + */ +@Service +public class IcScheduleServiceImpl extends BaseServiceImpl implements IcScheduleService { + + + @Override + public PageData list(IcScheduleFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + //获取工作人员所属组织信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getStaffId())); + } + formDTO.setAgencyId(staffInfo.getAgencyId()); + + List list = baseDao.selectScheduleList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(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 IcScheduleDTO get(String id) { + IcScheduleEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcScheduleDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcScheduleDTO dto) { + IcScheduleEntity entity = ConvertUtils.sourceToTarget(dto, IcScheduleEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcScheduleDTO dto) { + IcScheduleEntity entity = ConvertUtils.sourceToTarget(dto, IcScheduleEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * Desc: 新增或编辑日程 + * @param formDTO + * @author zxc + * @date 2022/8/18 16:31 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void addOrEditSchedule(AddOrEditScheduleFormDTO formDTO) { + if (StringUtils.isNotBlank(formDTO.getScheduleId())){ + baseDao.editSchedule(formDTO); + return; + } + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo){ + throw new EpmetException("查询工作人员信息失败:"+formDTO.getStaffId()); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo){ + throw new EpmetException("查询组织信息失败:"+staffInfo.getAgencyId()); + } + IcScheduleEntity e = ConvertUtils.sourceToTarget(formDTO, IcScheduleEntity.class); + e.setOrgId(staffInfo.getAgencyId()); + e.setPid(agencyInfo.getPid()); + e.setOrgIdPath("".equals(agencyInfo.getPids()) ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId())); + baseDao.insert(e); + + // PartyMeetingMessageMQMsg msg = new PartyMeetingMessageMQMsg(); + // msg.setCustomerId(formDTO.getCustomerId()); + // msg.setIcPartyActId(e.getId()); + // msg.setType("notify"); + // SendMqMsgUtil.build() + // .openFeignClient(SpringContextUtils.getBean(EpmetMessageOpenFeignClient.class)) + // .sendRocketMqMsg(SystemMessageType.PARTY_MEETING_MESSAGE, msg); + } + + /** + * Desc: 删除日程 + * @param scheduleIds + * @author zxc + * @date 2022/8/18 17:00 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void delSchedule(List scheduleIds) { + if (CollectionUtils.isNotEmpty(scheduleIds)){ + baseDao.deleteBatchIds(scheduleIds); + } + } + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/ResiPartymemberAttachmentServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/ResiPartymemberAttachmentServiceImpl.java new file mode 100644 index 0000000000..df42c273c0 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/ResiPartymemberAttachmentServiceImpl.java @@ -0,0 +1,29 @@ +package com.epmet.modules.partyOrg.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.modules.partyOrg.dao.ResiPartymemberAttachmentDao; +import com.epmet.modules.partyOrg.entity.ResiPartymemberAttachmentEntity; +import com.epmet.modules.partyOrg.service.ResiPartymemberAttachmentService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 本库附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-19 + */ +@Service +public class ResiPartymemberAttachmentServiceImpl extends BaseServiceImpl implements ResiPartymemberAttachmentService { + + + @Override + public int deleteByBusinessId(String customerId, List businessIds) { + if(CollectionUtils.isEmpty(businessIds)){ + return 0; + } + return baseDao.deleteByBusinessId(customerId,businessIds); + } +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java index 2059c84f4b..fbddc60fb1 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartyMemberController.java @@ -30,6 +30,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.form.IcPartyMemberFormDTO; import com.epmet.dto.form.IcPartyMemberListFormDTO; +import com.epmet.dto.form.ReadIcMessageFormDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.PartyMemberAgeResultDTO; import com.epmet.dto.result.PartyMemberEducationResultDTO; @@ -39,6 +40,7 @@ import com.epmet.modules.partymember.excel.IcPartyMemberExcel; import com.epmet.modules.partymember.service.IcPartyMemberService; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import com.epmet.resi.partymember.dto.partymember.form.IcPartyMemberFromDTO; +import com.epmet.resi.partymember.dto.partymember.result.IcPartyInfoResultDTO; import com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO; import com.epmet.utils.ImportTaskUtils; import lombok.extern.slf4j.Slf4j; @@ -341,4 +343,15 @@ public class IcPartyMemberController implements ResultDataResolver { } } + + /** + * @Author sun + * @Description 消息】未读消息数[居民/工作端共用] + **/ + @PostMapping("partyinfo") + public Result partyInfo(@LoginUser TokenDto tokenDto) { + return new Result().ok(icPartyMemberService.partyInfo(tokenDto)); + } + + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java index 98b56b8475..d5c257c114 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java @@ -168,4 +168,15 @@ public class PartymemberInfoController { public Result> getPartyMemberInfoByCustomerId(@RequestParam("customerId")String customerId){ return new Result>().ok(partymemberInfoService.getPartyMemberInfoByCustomerId(customerId)); } + /** + * 更新partymember_info.ID_CARD + * @param userId + * @param idNum + * @return + */ + @PostMapping("updatePartyMemberIdCard") + public Result updatePartyMemberIdCard(@RequestParam("userId") String userId, @RequestParam("idNum")String idNum){ + partymemberInfoService.updatePartyMemberIdCard(userId,idNum); + return new Result(); + } } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java index 00ea198d81..0f18a60ac5 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java @@ -6,6 +6,7 @@ import com.epmet.dto.result.PartyMemberAgeResultDTO; import com.epmet.dto.result.PartyMemberEducationResultDTO; import com.epmet.modules.partymember.entity.IcPartyMemberEntity; import com.epmet.resi.partymember.dto.partymember.form.IcPartyMemberFromDTO; +import com.epmet.resi.partymember.dto.partymember.result.IcPartyInfoResultDTO; import com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -74,4 +75,6 @@ public interface IcPartyMemberDao extends BaseDao { * @return java.util.List */ List getPartyMemberAgeStatistics(@Param("agencyId") String agencyId,@Param("orgId") String orgId); + + IcPartyInfoResultDTO selectByUserId(@Param("userId") String userId); } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartyMemberService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartyMemberService.java index 20373c3ca5..c88113ae6a 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartyMemberService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartyMemberService.java @@ -11,6 +11,7 @@ import com.epmet.dto.result.PartyMemberEducationResultDTO; import com.epmet.modules.partymember.entity.IcPartyMemberEntity; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import com.epmet.resi.partymember.dto.partymember.form.IcPartyMemberFromDTO; +import com.epmet.resi.partymember.dto.partymember.result.IcPartyInfoResultDTO; import com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO; import java.nio.file.Path; @@ -147,4 +148,6 @@ public interface IcPartyMemberService extends BaseService { * @param filePath */ void execAsyncExcelImport(Path filePath, String importTaskId); + + IcPartyInfoResultDTO partyInfo(TokenDto tokenDto); } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java index eed9482da3..8e8d5f295d 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java @@ -178,4 +178,11 @@ public interface PartymemberInfoService extends BaseService getPartyMemberInfoByCustomerId(String customerId); + + /** + * 更新partymember_info.ID_CARD + * @param userId + * @param idNum + */ + void updatePartyMemberIdCard(String userId, String idNum); } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java index e6e8fd9c44..9685adfdd6 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartyMemberServiceImpl.java @@ -13,12 +13,14 @@ import com.epmet.commons.tools.dto.form.DictListFormDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.DictListResultDTO; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.enums.IcFormCodeEnum; import com.epmet.commons.tools.enums.PartyPostEnum; 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.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; @@ -31,10 +33,7 @@ import com.epmet.dto.form.IcPartyMemberListFormDTO; import com.epmet.dto.result.PartyMemberAgeResultDTO; import com.epmet.dto.result.PartyMemberEducationResultDTO; import com.epmet.dto.result.UploadImgResultDTO; -import com.epmet.feign.EpmetAdminOpenFeignClient; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.OperCustomizeOpenFeignClient; -import com.epmet.feign.OssFeignClient; +import com.epmet.feign.*; import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; import com.epmet.modules.partyOrg.service.IcPartyOrgService; @@ -49,6 +48,7 @@ import com.epmet.modules.partymember.excel.handler.IcPartyMemberImportListener; import com.epmet.modules.partymember.service.IcPartyMemberService; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import com.epmet.resi.partymember.dto.partymember.form.IcPartyMemberFromDTO; +import com.epmet.resi.partymember.dto.partymember.result.IcPartyInfoResultDTO; import com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO; import com.epmet.utils.ImportTaskUtils; import com.github.pagehelper.PageHelper; @@ -60,6 +60,7 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.ContentType; import org.apache.poi.util.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -101,6 +102,8 @@ public class IcPartyMemberServiceImpl extends BaseServiceImpl page(TokenDto tokenDto, IcPartyMemberFromDTO formDTO) { @@ -706,4 +709,27 @@ public class IcPartyMemberServiceImpl extends BaseServiceImpl result = epmetMessageOpenFeignClient.unReadCount(tokenDto.getUserId()); + if (!result.success()) { + throw new RenException("获取用户未读消息数据失败"); + } + resultDTO.setCount(result.getData()); + return resultDTO; + } + + } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java index b488b7e15f..d277201298 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java @@ -158,6 +158,12 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl(dtoList, pageInfo.getTotal()); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java index 74b9ba9844..a980778c64 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.modules.partymember.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -10,6 +11,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.*; import com.epmet.dto.*; @@ -20,6 +22,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.feign.ResiGroupFeignClient; +import com.epmet.modules.partymember.dao.IcPartyMemberDao; import com.epmet.modules.partymember.entity.*; import com.epmet.modules.partymember.redis.PartymemberInfoRedis; import com.epmet.modules.partymember.service.*; @@ -85,6 +88,8 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService private PartymemberAuthRecordService partymemberAuthRecordService; @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private IcPartyMemberDao icPartyMemberDao; @Override @Transactional(rollbackFor = Exception.class) @@ -167,6 +172,14 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService @Transactional(rollbackFor = Exception.class) public Result submit(PartymemberInfoDTO partyMemberInfoDTO) { log.info("submit param:{}",JSON.toJSONString(partyMemberInfoDTO)); + + // 证件类型判断----start---- + IdCardRegexUtils regex = IdCardRegexUtils.parse(partyMemberInfoDTO.getIdCard()); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + // 证件类型判断----end---- + Result result = new Result(); //校验手机验证码是否正常 @@ -182,8 +195,8 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService } //获取党员基本信息(匹配) - PartymemberConfirmAutoDTO confirmAutoDTO = - partymemberBaseInfoService.getPartyMemberBaseInfo(partyMemberInfoDTO); + //PartymemberConfirmAutoDTO confirmAutoDTO = partymemberBaseInfoService.getPartyMemberBaseInfo(partyMemberInfoDTO); + PartymemberConfirmAutoDTO confirmAutoDTO = partyAuth(partyMemberInfoDTO); //判断是否已注册居民,如果没有则注册居民 isResiRegister(partyMemberInfoDTO); @@ -285,6 +298,30 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService return result; } + /** + * 居民点党员提交认证校验逻辑调整改查数字平台党员信息库, + * 切只按身份证号查询 + */ + public PartymemberConfirmAutoDTO partyAuth(PartymemberInfoDTO dto) { + PartymemberConfirmAutoDTO resultDTO = new PartymemberConfirmAutoDTO(); + if (StringUtils.isBlank(dto.getIdCard())) { + resultDTO.setComparisonResults(false); + return resultDTO; + } + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(IcPartyMemberEntity::getCustomerId, dto.getCustomerId()); + tWrapper.eq(IcPartyMemberEntity::getIdCard, dto.getIdCard()); + tWrapper.last("limit 1"); + IcPartyMemberEntity entity = icPartyMemberDao.selectOne(tWrapper); + if (null == entity) { + resultDTO.setComparisonResults(false); + return resultDTO; + } + resultDTO.setComparisonResults(true); + resultDTO.setPatryMemberBaseInfoId(entity.getId()); + return resultDTO; + } + @Override @Transactional(rollbackFor = Exception.class) public Result partyMemberInfoExtra(PartymemberInfoDTO infoDTO) { diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java index dc592a254d..354236fe49 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.modules.partymember.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; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; @@ -35,9 +36,7 @@ import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.partymember.dao.PartymemberInfoDao; import com.epmet.modules.partymember.entity.PartymemberInfoEntity; -import com.epmet.modules.partymember.redis.PartymemberInfoRedis; import com.epmet.modules.partymember.service.PartymemberInfoService; -import com.epmet.redis.ResiPartyMemberRedis; import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; import com.epmet.resi.partymember.dto.partymember.form.CertifiedDetailFormDTO; import com.epmet.resi.partymember.dto.partymember.form.CertifiedFormDTO; @@ -60,8 +59,6 @@ import java.util.*; @Service public class PartymemberInfoServiceImpl extends BaseServiceImpl implements PartymemberInfoService { - @Autowired - private PartymemberInfoRedis partymemberInfoRedis; @Autowired private PartymemberInfoDao partyMemberInfoDao; @@ -70,8 +67,6 @@ public class PartymemberInfoServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -258,4 +253,19 @@ public class PartymemberInfoServiceImpl extends BaseServiceImpl getPartyMemberInfoByCustomerId(String customerId) { return baseDao.selectListPartyMemberInfoByCustomerId(customerId); } + + /** + * 更新partymember_info.ID_CARD + * + * @param userId + * @param idNum + */ + @Override + public void updatePartyMemberIdCard(String userId, String idNum) { + LambdaUpdateWrapper updateWrapper=new LambdaUpdateWrapper<>(); + updateWrapper.eq(PartymemberInfoEntity::getUserId,userId); + updateWrapper.set(PartymemberInfoEntity::getIdCard,idNum); + updateWrapper.set(PartymemberInfoEntity::getUpdatedTime,new Date()); + baseDao.update(null,updateWrapper); + } } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index 67ceeb7651..6761e5685f 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -4,6 +4,8 @@ import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; import com.epmet.commons.rocketmq.register.MQAbstractRegister; import com.epmet.commons.rocketmq.register.MQConsumerProperties; +import com.epmet.constant.SystemMessageType; +import com.epmet.mq.listener.PartyMeetingMessageListener; import com.epmet.mq.listener.ResiPartyMemberSyncListener; import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; import org.springframework.stereotype.Component; @@ -15,5 +17,8 @@ public class RocketMQConsumerRegister extends MQAbstractRegister { public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { register(consumerProperties, ConsomerGroupConstants.CREATE_RESI_PARTYMEMBER_SYNC_GROUP, MessageModel.CLUSTERING, TopicConstants.PARTYMEMBER_RESI, "*", new ResiPartyMemberSyncListener()); + + register(consumerProperties, ConsomerGroupConstants.PARTY_MEETING_MESSAGE, MessageModel.CLUSTERING, + TopicConstants.IC_MESSAGE, SystemMessageType.PARTY_MEETING_MESSAGE, new PartyMeetingMessageListener()); } } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/mq/listener/PartyMeetingMessageListener.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/mq/listener/PartyMeetingMessageListener.java new file mode 100644 index 0000000000..d968dac4a1 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/mq/listener/PartyMeetingMessageListener.java @@ -0,0 +1,100 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.MQUserPropertys; +import com.epmet.commons.rocketmq.messages.PartyMeetingMessageMQMsg; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.modules.partyOrg.service.IcPartyActService; +import org.apache.commons.lang.StringUtils; +import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; +import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; +import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; +import org.apache.rocketmq.common.message.MessageExt; +import org.redisson.api.RLock; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * @author sun + * @Description 党建小助手发布活动、活动提前提醒、活动发布提醒通知 + */ +public class PartyMeetingMessageListener implements MessageListenerConcurrently { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + private RedisUtils redisUtils; + + @Override + public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) { + + if (redisUtils == null) { + redisUtils = SpringContextUtils.getBean(RedisUtils.class); + } + + try { + msgs.forEach(msg -> consumeMessage(msg)); + } catch (Exception e) { + logger.error(ExceptionUtils.getErrorStackTrace(e)); + return ConsumeConcurrentlyStatus.RECONSUME_LATER; + } + return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; + } + + /** + * 逐条消费 + * @param messageExt + */ + private void consumeMessage(MessageExt messageExt) { + // msg即为消息体 + String msg = new String(messageExt.getBody()); + logger.info("msg is {}",msg); + String tags = messageExt.getTags(); + String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL); + + logger.info("【党建小助手消息】-活动消息-收到消息内容:{},操作:{}", msg, tags); + PartyMeetingMessageMQMsg obj = JSON.parseObject(msg, PartyMeetingMessageMQMsg.class); + logger.info("obj is {}",JSON.toJSONString(obj)); + + DistributedLock distributedLock = null; + RLock lock = null; + try { + distributedLock = SpringContextUtils.getBean(DistributedLock.class); + lock = distributedLock.getLock(String.format("lock:ic_warn_stats:%s", obj.getCustomerId()), + 30L, 30L, TimeUnit.SECONDS); + //待执行方法 + SpringContextUtils.getBean(IcPartyActService.class).partyMeetingMessage(obj); + + } catch (EpmetException e) { + // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 + logger.error("【党建小助手消息】-活动消息MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + } catch (Exception e) { + // 不是我们自己抛出的异常,可以让MQ重试 + logger.error("【党建小助手消息】-活动消息MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + throw e; + } finally { + assert distributedLock != null; + distributedLock.unLock(lock); + } + + if (StringUtils.isNotBlank(pendingMsgLabel)) { + try { + removePendingMqMsgCache(pendingMsgLabel); + } catch (Exception e) { + logger.error("【党建小助手消息】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } + } + } + + private void removePendingMqMsgCache(String pendingMsgLabel) { + String key = RedisKeys.blockedMqMsgKey(pendingMsgLabel); + Boolean rst = redisUtils.delete(key); + } +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml index 21df578de8..e6b1b16aa4 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml @@ -32,6 +32,8 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false datasource: druid: #MySQL @@ -120,6 +122,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -155,4 +163,4 @@ thread: # rocketmq rocketmq: enable: @rocketmq.enable@ - name-server: @rocketmq.nameserver@ \ No newline at end of file + name-server: @rocketmq.nameserver@ diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.10__add_principal.sql b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.10__add_principal.sql new file mode 100644 index 0000000000..f586c2fd44 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.10__add_principal.sql @@ -0,0 +1,2 @@ +ALTER TABLE ic_party_org ADD COLUMN PRINCIPAL VARCHAR(30) not null DEFAULT '' COMMENT '负责人' AFTER ADDRESS; +ALTER TABLE ic_party_org ADD COLUMN PRINCIPAL_MOBILE VARCHAR(30) not null DEFAULT '' COMMENT '联系方式' AFTER PRINCIPAL; \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.11__add_principal_staff_id.sql b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.11__add_principal_staff_id.sql new file mode 100644 index 0000000000..6530fb1923 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.11__add_principal_staff_id.sql @@ -0,0 +1,3 @@ +ALTER TABLE ic_party_org ADD COLUMN PRINCIPAL_STAFF_ID VARCHAR(32) DEFAULT '' COMMENT '负责人staffId' AFTER PRINCIPAL_MOBILE; +alter table ic_party_org modify PRINCIPAL_MOBILE VARCHAR(30) DEFAULT '' COMMENT '联系方式'; +alter table ic_party_org modify PRINCIPAL VARCHAR(30) DEFAULT '' COMMENT '负责人'; \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.6__party_helper.sql b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.6__party_helper.sql new file mode 100644 index 0000000000..984eda6608 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.6__party_helper.sql @@ -0,0 +1,122 @@ +CREATE TABLE `ic_schedule` ( + `ID` varchar(64) NOT NULL COMMENT 'ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `ORG_ID` varchar(64) NOT NULL COMMENT '所属行政组织ID:当前工作人员所属组织id', + `PID` varchar(64) NOT NULL COMMENT '组织ID的上级;如果org_id是根组织,那此列=0', + `ORG_ID_PATH` varchar(255) NOT NULL COMMENT 'ORG_ID全路径,包含自身', + `STAFF_ID` varchar(64) NOT NULL COMMENT '当前登录用户userId', + `TITLE` varchar(35) NOT NULL COMMENT '日程标题(35字)', + `REMIND_TIME` datetime NOT NULL COMMENT '提醒时间;其实就是日程所属日期', + `IS_PUBLIC` varchar(10) NOT NULL COMMENT '是否公开,0:仅自己可见;1:组织内其他人可见', + `REMARK` varchar(500) DEFAULT NULL COMMENT '备注(500字)', + `DEL_FLAG` int(11) NOT NULL COMMENT '0:未删除;1已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='日程表'; + + +CREATE TABLE `ic_party_act` ( + `ID` varchar(64) NOT NULL COMMENT 'ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `ORG_ID` varchar(64) NOT NULL COMMENT '组织ID:当前工作人员所属组织id', + `PID` varchar(64) NOT NULL COMMENT '组织ID的上级;如果org_id是根组织,那此列=0', + `ORG_ID_PATH` varchar(255) NOT NULL COMMENT 'ORG_ID全路径,包含自身', + `PUBLISH_PARTY_ORG_ID` varchar(64) NOT NULL COMMENT '发布活动党组织', + `PUBLISH_PARTY_ORG_NAME` varchar(20) NOT NULL COMMENT '发布活动党组织名称', + `PUBLISH_ORG_PID` varchar(64) DEFAULT NULL COMMENT '发布活动党组织ID的上级节点', + `PUBLISH_ORG_TYPE` varchar(10) NOT NULL COMMENT '发布活动党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组', + `PUBLISH_ORG_PATH` varchar(255) NOT NULL COMMENT '发布活动党组织PUBLISH_PARTY_ORG_ID的全路径,包含自身。方便前端回显', + `ACT_TYPE` varchar(10) NOT NULL COMMENT '活动类型,来源于ic_party_act_type_dict', + `HOLD_YEAR_ID` varchar(10) NOT NULL COMMENT '活动举办时间:yyyy', + `HOLD_MONTH_ID` varchar(10) NOT NULL COMMENT '活动举办时间:yyyyMM', + `HOLD_TIME` datetime NOT NULL COMMENT '举办活动时间', + `TOPIC` varchar(255) NOT NULL COMMENT '活动主题', + `ADDRESS` varchar(255) NOT NULL COMMENT '活动地点', + `LATITUDE` varchar(32) DEFAULT NULL COMMENT '活动地点纬度', + `LONGITUDE` varchar(32) DEFAULT NULL COMMENT '活动地点经度', + `AUTO_PUBLIC_TYPE` int(11) NOT NULL COMMENT '活动开始前几天', + `AUTO_PUBLIC_TIME` datetime DEFAULT NULL COMMENT '自动发布时间,保存时算好时间存在这里', + `JOIN_USER_TYPE` varchar(10) DEFAULT NULL COMMENT '参加人员类型,0:全体党员;1:支部委员', + `IS_AUTO_INFORM` varchar(1) DEFAULT NULL COMMENT '是否自动通知参加人员,0否;1是', + `INTRODUCE` varchar(1024) DEFAULT NULL COMMENT '活动介绍', + `IS_PUBLISH` varchar(10) NOT NULL COMMENT '是否发布,0未发布;1已发布;', + `PUBLISH_STAFF_ID` varchar(64) NOT NULL COMMENT '活动发布人', + `PUBLISH_STAFF_NAME` varchar(64) NOT NULL COMMENT '活动发布人姓名', + `DEL_FLAG` int(11) NOT NULL COMMENT '0未删除;1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='党建组织活动'; + + +CREATE TABLE `ic_party_act_org` ( + `ID` varchar(64) NOT NULL COMMENT 'ID', + `IC_PARTY_ACT_ID` varchar(64) NOT NULL COMMENT '活动id', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `JOIN_ORG_ID` varchar(64) NOT NULL COMMENT '参加活动党组织ID,groupId', + `JOIN_ORG_NAME` varchar(128) NOT NULL COMMENT '参加党组织名称', + `ORG_TYPE` varchar(10) NOT NULL COMMENT '党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部;6党小组', + `PID` varchar(64) NOT NULL COMMENT '参加活动党组织ID的上级节点', + `JOIN_ORG_PATH` varchar(255) NOT NULL COMMENT 'PARTY_ORG_ID的全路径,包含自身。方便前端回显', + `DEL_FLAG` int(11) NOT NULL COMMENT '0:未删除;1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='参加活动党组织表'; + +CREATE TABLE `ic_party_act_sign_in_record` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `IC_PARTY_ACT_ID` varchar(64) NOT NULL COMMENT '活动id', + `ID_CARD` varchar(32) NOT NULL COMMENT '身份证号', + `EPMET_USER_ID` varchar(64) NOT NULL COMMENT '签到用户id', + `USER_REAL_NAME` varchar(64) NOT NULL COMMENT '签到用户姓名', + `ADDRESS` varchar(255) NOT NULL COMMENT '签到地点', + `LATITUDE` varchar(32) NOT NULL COMMENT '签到地点纬度', + `LONGITUDE` varchar(32) NOT NULL COMMENT '签到地点经度', + `DEL_FLAG` int(11) NOT NULL COMMENT '0:未删除;1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='党组织活动签到记录表'; + + +CREATE TABLE `ic_party_act_type_dict` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `TYPE_KEY` varchar(32) NOT NULL COMMENT '活动类型key', + `TYPE_NAME` varchar(32) NOT NULL COMMENT '活动名称', + `YEAR_COUNT` int(11) NOT NULL COMMENT '每年几次', + `FREQUENCY_UNIT` varchar(32) NOT NULL COMMENT '频次单位', + `FREQUENCY_COUNT` int(11) NOT NULL COMMENT '频次数量', + `FREQUENCY_DESC` varchar(63) NOT NULL COMMENT '频率描述', + `SORT` int(11) NOT NULL COMMENT '排序', + `DEL_FLAG` int(11) NOT NULL COMMENT '0未删除;1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='党组织活动类型字典表'; + + +INSERT INTO `epmet_resi_partymember`.`ic_party_act_type_dict` (`ID`, `CUSTOMER_ID`, `TYPE_KEY`, `TYPE_NAME`, `YEAR_COUNT`, `FREQUENCY_UNIT`, `FREQUENCY_COUNT`, `FREQUENCY_DESC`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', 'default', 'zbdydh', '支部党员大会', 4, 'quarter', 1, '每季度1次', 1, 0, 0, 'APP_USER', '2022-08-18 17:43:46', 'APP_USER', '2022-08-18 17:43:54'); +INSERT INTO `epmet_resi_partymember`.`ic_party_act_type_dict` (`ID`, `CUSTOMER_ID`, `TYPE_KEY`, `TYPE_NAME`, `YEAR_COUNT`, `FREQUENCY_UNIT`, `FREQUENCY_COUNT`, `FREQUENCY_DESC`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', 'default', 'zbwyh', '支部委员会', 12, 'month', 1, '每月1次', 2, 0, 0, 'APP_USER', '2022-08-18 17:43:46', 'APP_USER', '2022-08-18 17:43:54'); +INSERT INTO `epmet_resi_partymember`.`ic_party_act_type_dict` (`ID`, `CUSTOMER_ID`, `TYPE_KEY`, `TYPE_NAME`, `YEAR_COUNT`, `FREQUENCY_UNIT`, `FREQUENCY_COUNT`, `FREQUENCY_DESC`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('3', 'default', 'dxzh', '党小组会', 12, 'month', 1, '每月一次', 3, 0, 0, 'APP_USER', '2022-08-18 17:43:46', 'APP_USER', '2022-08-18 17:43:54'); +INSERT INTO `epmet_resi_partymember`.`ic_party_act_type_dict` (`ID`, `CUSTOMER_ID`, `TYPE_KEY`, `TYPE_NAME`, `YEAR_COUNT`, `FREQUENCY_UNIT`, `FREQUENCY_COUNT`, `FREQUENCY_DESC`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('4', 'default', 'dangke', '党课', 4, 'quarter', 1, '每季度1次', 4, 0, 0, 'APP_USER', '2022-08-18 17:43:46', 'APP_USER', '2022-08-18 17:43:54'); +INSERT INTO `epmet_resi_partymember`.`ic_party_act_type_dict` (`ID`, `CUSTOMER_ID`, `TYPE_KEY`, `TYPE_NAME`, `YEAR_COUNT`, `FREQUENCY_UNIT`, `FREQUENCY_COUNT`, `FREQUENCY_DESC`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('5', 'default', 'ztdr', '主题党日', 12, 'month', 1, '每月1次', 5, 0, 0, 'APP_USER', '2022-08-18 17:43:46', 'APP_USER', '2022-08-18 17:43:54'); +INSERT INTO `epmet_resi_partymember`.`ic_party_act_type_dict` (`ID`, `CUSTOMER_ID`, `TYPE_KEY`, `TYPE_NAME`, `YEAR_COUNT`, `FREQUENCY_UNIT`, `FREQUENCY_COUNT`, `FREQUENCY_DESC`, `SORT`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('6', 'default', 'wmfwhd', '为民服务活动', 12, 'month', 1, '每月1次', 6, 0, 0, 'APP_USER', '2022-08-18 17:43:46', 'APP_USER', '2022-08-18 17:43:54'); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.7__party_att.sql b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.7__party_att.sql new file mode 100644 index 0000000000..d31f3050db --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.7__party_att.sql @@ -0,0 +1,21 @@ +CREATE TABLE `resi_partymember_attachment` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `BUSINESS_ID` varchar(64) NOT NULL COMMENT '业务id', + `ATTACH_TO` varchar(32) DEFAULT NULL COMMENT '党组织活动:ic_party_act', + `NAME` varchar(64) DEFAULT NULL COMMENT '附件名', + `FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `TYPE` varchar(64) NOT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `URL` varchar(255) NOT NULL COMMENT '附件地址', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `STATUS` varchar(32) NOT NULL DEFAULT 'auto_passed' COMMENT '附件状态(审核中:auditing; \r\nauto_passed: 自动通过;\r\nreview:结果不确定,需要人工审核;\r\nblock: 结果违规;\r\nrejected:人工审核驳回;\r\napproved:人工审核通过)\r\n现在图片是同步审核的,所以图片只有auto_passed一种状态', + `REASON` varchar(255) DEFAULT NULL COMMENT '失败原因', + `DURATION` int(11) DEFAULT NULL COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='本库附件表'; \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.8__party_act_path.sql b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.8__party_act_path.sql new file mode 100644 index 0000000000..072be997c1 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.8__party_act_path.sql @@ -0,0 +1,6 @@ +ALTER TABLE ic_party_act ADD COLUMN PUBLISH_ORG_PATH_SHOW VARCHAR ( 255 ) COMMENT '发布活动党组织路径,前端用此列' AFTER PUBLISH_ORG_PATH; +ALTER TABLE ic_party_act_org ADD COLUMN JOIN_ORG_PATH_SHOW VARCHAR ( 255 ) COMMENT 'PARTY_ORG_ID的全路径,前端用' AFTER JOIN_ORG_PATH; + +alter table ic_party_act MODIFY COLUMN PUBLISH_ORG_PATH VARCHAR(255) not null COMMENT'发布活动党组织PUBLISH_PARTY_ORG_ID的全路径,包含自身'; + +alter table ic_party_act_org MODIFY COLUMN JOIN_ORG_PATH VARCHAR(255) not null COMMENT 'PARTY_ORG_ID的全路径,包含自身'; \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.9__schedule_time.sql b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.9__schedule_time.sql new file mode 100644 index 0000000000..9a9cb3f6b3 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/db/migration/V0.0.9__schedule_time.sql @@ -0,0 +1 @@ +ALTER TABLE ic_schedule ADD COLUMN HAPPENED_TIME datetime not null COMMENT '发生时间' AFTER REMIND_TIME; diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/logback-spring.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/logback-spring.xml index f4fc5a99ea..b8b3161188 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/logback-spring.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/logback-spring.xml @@ -160,11 +160,12 @@ - + + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActDao.xml new file mode 100644 index 0000000000..a1517327d7 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActDao.xml @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update ic_party_act + set del_flag='1', + UPDATED_BY=#{userId}, + UPDATED_TIME=now() + where customer_id=#{customerId} + and id=#{icPartyActId} + and PUBLISH_STAFF_ID=#{userId} + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActOrgDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActOrgDao.xml new file mode 100644 index 0000000000..a71ce93d84 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActOrgDao.xml @@ -0,0 +1,39 @@ + + + + + + delete from ic_party_act_org + where customer_id = #{customerId} + + IC_PARTY_ACT_ID = #{icPartyActId} + + + + + + + update ic_party_act_org + set del_flag='1', + UPDATED_BY=#{userId}, + UPDATED_TIME=now() + where IC_PARTY_ACT_ID=#{icPartyActId} + and CREATED_BY=#{userId} + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActSignInRecordDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActSignInRecordDao.xml new file mode 100644 index 0000000000..aac80bfbe7 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActSignInRecordDao.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActTypeDictDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActTypeDictDao.xml new file mode 100644 index 0000000000..3c57ca3243 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyActTypeDictDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml index 1af1738da2..410a074121 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml @@ -24,6 +24,17 @@ + + + + update ic_party_org + set PRINCIPAL_MOBILE = #{principalMobile}, + PRINCIPAL = #{principal}, + PRINCIPAL_STAFF_ID = #{principalStaffId}, + UPDATED_TIME = NOW() + where id = #{partyOrgId} + + + + + + + + + + + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml new file mode 100644 index 0000000000..5367439c04 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcScheduleDao.xml @@ -0,0 +1,124 @@ + + + + + + + UPDATE ic_schedule + SET UPDATED_TIME = NOW(), + title = #{title}, + remind_time = #{remindTime}, + + REMARK = #{remark}, + + is_public = #{isPublic} + WHERE ID = #{scheduleId} + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/ResiPartymemberAttachmentDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/ResiPartymemberAttachmentDao.xml new file mode 100644 index 0000000000..adbfeeaa0d --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/ResiPartymemberAttachmentDao.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from resi_partymember_attachment + where customer_id=#{customerId} + + BUSINESS_ID = #{businessId} + + + + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml index 21ea480cca..3cbb077a50 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml @@ -267,5 +267,17 @@ GROUP BY ageGroup + diff --git a/epmet-module/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml b/epmet-module/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml index 01d9431086..051747d9ca 100644 --- a/epmet-module/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml @@ -72,6 +72,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 @@ -97,4 +103,4 @@ thread: queueCapacity: @thread.threadPool.queue-capacity@ keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ - rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ \ No newline at end of file + rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml index 46786ebd6b..1a9ecfdc59 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml +++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml @@ -76,6 +76,12 @@ hystrix: isolation: thread: timeoutInMilliseconds: 60000 #缺省为1000 + threadpool: + default: + coreSize: 20 + maximumSize: 50 + maxQueueSize: 500 + queueSizeRejectionThreshold: 200 ribbon: ReadTimeout: 300000 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncConfigDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncConfigDTO.java new file mode 100644 index 0000000000..ab09747448 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncConfigDTO.java @@ -0,0 +1,90 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import lombok.Data; + + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +public class DataSyncConfigDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID主键 + */ + private String id; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 部门编码 + */ + private String deptCode; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 数据名称 + */ + private String dataName; + + /** + * 开启:open;关闭:closed + */ + private String switchStatus; + + private String dataCode; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + private List scopeList; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncScopeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncScopeDTO.java new file mode 100644 index 0000000000..626b3d966c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncScopeDTO.java @@ -0,0 +1,94 @@ +package com.epmet.dto; + +import com.epmet.dto.form.ScopeSaveFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +public class DataSyncScopeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 数据更新配置表主键 + */ + private String dataSyncConfigId; + + /** + * 网格:grid, +社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province + */ + @NotBlank(message = "orgType不能为空",groups = ScopeSaveFormDTO.ScopeSaveForm.class) + private String orgType; + + /** + * 组织或者网格id + */ + @NotBlank(message = "orgId不能为空",groups = ScopeSaveFormDTO.ScopeSaveForm.class) + private String orgId; + + /** + * org_id的上级 + */ + private String pid; + + /** + * org_id的全路径,包含自身 + */ + private String orgIdPath; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DhTokenDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DhTokenDTO.java new file mode 100644 index 0000000000..eee5c3fc13 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DhTokenDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 大华设备鉴权信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-22 + */ +@Data +public class DhTokenDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * loginName + */ + private String loginName; + + /** + * token + */ + private String token; + + /** + * publicKey + */ + private String publicKey; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java index 9215512142..46bee9f321 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java @@ -71,7 +71,11 @@ public class IcBirthRecordDTO implements Serializable { @NotBlank(message = "所属家庭不能为空", groups = {AddGroup.class}) private String homeId; private String home; - + /** + * 所属房屋全路径名称 + * 详情回显 + */ + private String homeAllName; /** * 姓名 */ @@ -84,10 +88,9 @@ public class IcBirthRecordDTO implements Serializable { private String mobile; /** - * 性别 + * 性别 1男2女 */ private String gender; - /** * 身份证号 */ @@ -139,6 +142,12 @@ public class IcBirthRecordDTO implements Serializable { */ private String householderRelation; + /** + * 与户主关系【字典表】 + * 详情回显 + */ + private String householderRelationName; + /** * 是否勾选补充居民信息0否 1是 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java index 9b2a5274b6..5d880153a6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java @@ -28,7 +28,8 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { /** * ID */ - private String id; + @NotBlank(message = "id不能为空",groups = {IcEpidemicSpecialAttentionUpdate.class}) + private String id; /** * 客户ID @@ -56,7 +57,21 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { private Integer isAttention; /** - * 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 + * 是否历史关注,1是0否 + */ + private String isHistory; + + /** + * 隔离类型,来自字典表;集中隔离:0;居家隔离1;居家健康监测2;已出隔离期3 + */ + // @NotBlank(message = "isolatedState不能为空",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class}) + private String isolatedState; + + /** + * 关注类型, + * 核酸检测:2, + * 疫苗接种:1, + * 行程上报:0 */ @NotNull(message = "attentionType不能为空",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class}) private Integer attentionType; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java index aba428a576..89950e63c0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcFollowUpRecordDTO.java @@ -67,7 +67,7 @@ public class IcFollowUpRecordDTO implements Serializable { */ @ColumnWidth(25) @ExcelProperty("身份证号") - @NotBlank(message = "身份证号不能为空", groups = {AddUserRequired.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserRequired.class}) private String idCard; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java new file mode 100644 index 0000000000..3b7af8fea0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java @@ -0,0 +1,121 @@ +package com.epmet.dto; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 核酸比对记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +public class IcNatCompareRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelIgnore + private String customerId; + + /** + * 主键 + */ + @ExcelIgnore + private String relationId; + + /** + * 姓名 + */ + @ColumnWidth(15) + @ExcelProperty("姓名") + private String name; + + /** + * 真实身份证号 + */ + @ColumnWidth(20) + @ExcelProperty("身份证号") + private String realIdCard; + + /** + * 身份证 + */ + @ExcelIgnore + private String idCard; + + /** + * 手机号 + */ + @ExcelIgnore + private String mobile; + + /** + * 真实手机号 + */ + @ColumnWidth(20) + @ExcelProperty("手机号") + private String realMobile; + + /** + * 是否客户下居民(0:否 1:是) + */ + @ExcelIgnore + private String isAgencyUser; + + @ColumnWidth(10) + @ExcelProperty("本辖区居民") + private String isAgencyUserDesc; + + /** + * 是本辖区的居民时候,ic_resi_user.id + */ + @ExcelIgnore + private String icResiUserId; + + /** + * 最近一次核酸时间:接口填入 + */ + @ColumnWidth(30) + @ExcelProperty("最近一次核酸时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date latestNatTime; + + /** + * 检测结果(0:阴性 1:阳性):接口填入 + */ + @ExcelIgnore + private String natResult; + + + /** + * 检测地点:接口填入 + */ + @ColumnWidth(50) + @ExcelProperty("检测地点") + private String natAddress; + + + @ColumnWidth(15) + @ExcelProperty("检测结果") + private String natResultDesc; + + @ExcelIgnore + private String importDate; + + + @ColumnWidth(30) + @ExcelProperty("导入时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date importTime; + + @ColumnWidth(30) + @ExcelProperty("导入组织") + private String agencyName; +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java index 72520ef800..d4184734a9 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java @@ -106,4 +106,8 @@ public class IcNoticeDTO implements Serializable { @JsonIgnore private Date updatedTime; + /** + * 发送结果:1成功,0失败 + */ + private String sendRes; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcPointNucleicMonitoringDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcPointNucleicMonitoringDTO.java index 3a29fb0afc..08f51a1e5e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcPointNucleicMonitoringDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcPointNucleicMonitoringDTO.java @@ -66,6 +66,11 @@ public class IcPointNucleicMonitoringDTO implements Serializable { */ private String address; + /** + * 未禁用enable,已禁用disabled + */ + private String enableFlag; + /** * 经度 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java index 508f8dc2ad..9d2ab97099 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java @@ -35,6 +35,9 @@ public class IcTripReportRecordDTO implements Serializable { @ExcelIgnore private String id; + @ExcelIgnore + private String epidemicId; + /** * 居民端用户所在网格id,数字社区居民所属网格id */ @@ -73,6 +76,11 @@ public class IcTripReportRecordDTO implements Serializable { @ExcelProperty("手机号") private String mobile; + /** + * 真实手机号不打码 + */ + private String realMobile; + /** * 身份证号 */ @@ -80,6 +88,11 @@ public class IcTripReportRecordDTO implements Serializable { @ExcelProperty("身份证号") private String idCard; + /** + * 真实身份证号 + */ + private String realIdCard; + /** * 用户id */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java new file mode 100644 index 0000000000..a7d56eeec7 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccinePrarmeterDTO.java @@ -0,0 +1,197 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 新冠病毒疫苗接种人员信息台账 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Data +public class IcVaccinePrarmeterDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 组织Id + */ + private String agencyId; + + /** + * 组织的pids + */ + private String pids; + + /** + * 所属小区ID; + */ + private String villageId; + + /** + * 所属小区名称 + */ + private String villageName; + + /** + * 所属楼宇Id + */ + private String buildId; + + /** + * 所属楼宇名称 + */ + private String buildName; + + /** + * 单元id + */ + private String unitId; + + /** + * 单元名 + */ + private String unitName; + + /** + * 所属家庭Id + */ + private String homeId; + + /** + * 房间名 + */ + private String homeName; + + /** + * 户口性质:0户籍 1外来 + */ + private String householdType; + private String householdTypeName; + + /** + * 姓名 + */ + private String name; + + /** + * 联系电话 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 是否接种:0否1是 + */ + private String isVaccination; + private String isVaccinationName; + + /** + * 第一次接种时间 + */ + private String firstVacTime; + + /** + * 第一次接种地点 + */ + private String firstVacSite; + + /** + * 第二次接种时间 + */ + private String secondVacTime; + + /** + * 第二次接种地点 + */ + private String secondVacSite; + + /** + * 第三次接种时间 + */ + private String thirdVacTime; + + /** + * 第三次接种地点 + */ + private String thirdVacSite; + + /** + * 原因:禁忌症/拒绝接种/其他原因 + */ + private String reason; + + /** + * 备注 + */ + private String note; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 审核状态:0待审核 1审核不通过 2审核通过 + */ + private String checkState; + private String checkStateName; + + /** + * 审核理由 + */ + private String checkReason; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/SaveCollectVisitorFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/SaveCollectVisitorFormDTO.java index 2f7c71dfd8..a56f6607f1 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/SaveCollectVisitorFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/SaveCollectVisitorFormDTO.java @@ -52,43 +52,36 @@ public class SaveCollectVisitorFormDTO implements Serializable { /** * 所属楼宇Id */ - @NotBlank(message = "楼宇Id不能为空") private String buildId; /** * 所属楼宇名称 */ - @NotBlank(message = "楼宇名称不能为空") private String buildName; /** * 单元id */ - @NotBlank(message = "单元id不能为空") private String unitId; /** * 单元名 */ - @NotBlank(message = "单元名不能为空") private String unitName; /** * 所属家庭Id */ - @NotBlank(message = "家庭Id不能为空") private String homeId; /** * 房间名 */ - @NotBlank(message = "房间名不能为空") private String homeName; /** * 详细地址 */ - @NotBlank(message = "家庭地址不能为空") private String address; /** @@ -106,6 +99,7 @@ public class SaveCollectVisitorFormDTO implements Serializable { /** * 身份证号 */ + @NotBlank(message = "身份证号不能为空") private String idCard; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java index 482ef97839..cca2734f9c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java @@ -56,7 +56,7 @@ public class AddIcVaccineFormDTO implements Serializable { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = Vaccine.class) + @NotBlank(message = "证件号不能为空", groups = Vaccine.class) private String idCard; /** * 接种时间 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfigSwitchFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfigSwitchFormDTO.java new file mode 100644 index 0000000000..1ff6b9bcf4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfigSwitchFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/26 14:34 + * @DESC + */ +@Data +public class ConfigSwitchFormDTO implements Serializable { + + private static final long serialVersionUID = 7510856043372376415L; + + public interface ConfigSwitchForm{} + + @NotBlank(message = "deptCode不能为空",groups = ConfigSwitchForm.class) + private String deptCode; + + @NotBlank(message = "dataSyncConfigId不能为空",groups = ConfigSwitchForm.class) + private String dataSyncConfigId; + private String updatedBy; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java index 98526ad993..f4d0b7c1dc 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DelIcResiUserFormDTO.java @@ -29,5 +29,6 @@ public class DelIcResiUserFormDTO implements Serializable { private String customerId; private String formCode= IcFormCodeEnum.RESI_BASE_INFO.getCode(); + private String currentStaffId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhAuthFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhAuthFormDTO.java new file mode 100644 index 0000000000..9652e1c0d6 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhAuthFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import com.epmet.dto.result.DhChannelResultDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhAuthFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String cardNumber; + + private String timeQuantumId; + + private List cardPrivilegeDetails; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhCardPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhCardPageFormDTO.java new file mode 100644 index 0000000000..d5066cbaa8 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhCardPageFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhCardPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String personCode; + + private String cardNumber; + + private String cardStatus; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhChannelFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhChannelFormDTO.java new file mode 100644 index 0000000000..a3b1675b57 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhChannelFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhChannelFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String interfaceId; + + private String jsonParam; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhChannelPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhChannelPageFormDTO.java new file mode 100644 index 0000000000..5af8d5c6ab --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhChannelPageFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhChannelPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String deviceGenre; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhDeptFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhDeptFormDTO.java new file mode 100644 index 0000000000..a5071854e9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhDeptFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhDeptFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + private String description; + + private Long parentId; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhIdentityFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhIdentityFormDTO.java new file mode 100644 index 0000000000..0f73e060f6 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhIdentityFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhIdentityFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + private Double subsidyAmount; + + private Integer isCashRecharge; + + private Integer isMachineRecharge; + + private String description; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhLoginPassFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhLoginPassFormDTO.java new file mode 100644 index 0000000000..1e7d8e3216 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhLoginPassFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhLoginPassFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String loginName; + + private String loginPass; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhNodeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhNodeFormDTO.java new file mode 100644 index 0000000000..482aa4e64e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhNodeFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhNodeFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String typeCode; + + private String nodeId; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonCardFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonCardFormDTO.java new file mode 100644 index 0000000000..deaec222f5 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonCardFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonCardFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long personId; + + private String personName; + + private String cardNumber; + + private String cardType; + + private String category; + + private String cardStatus; + + private String startDate; + + private String endDate; + + private String cardPassword; + + private String subSystems; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonCardListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonCardListFormDTO.java new file mode 100644 index 0000000000..9e9d889412 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonCardListFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonCardListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private List objectList; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonDelFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonDelFormDTO.java new file mode 100644 index 0000000000..defc1509ce --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonDelFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonDelFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private List personIds; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonFormDTO.java new file mode 100644 index 0000000000..e3720e9c39 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String paperType; + + private String paperNumber; + + private String name; + + private String code; + + private Long deptId; + + private String sex; + + private String birthday; + + private String phone; + + private String status; + + private String personIdentityId; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonImgFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonImgFormDTO.java new file mode 100644 index 0000000000..d5ba9f49cf --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonImgFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonImgFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String personCode; + + private String base64file; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonPageFormDTO.java new file mode 100644 index 0000000000..7597af3680 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPersonPageFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String code; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPlanFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPlanFormDTO.java new file mode 100644 index 0000000000..007e44ad18 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPlanFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPlanFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String detail; + + private String memo; + + private String name; + + private Integer type; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPlanPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPlanPageFormDTO.java new file mode 100644 index 0000000000..559d50d6af --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPlanPageFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPlanPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String singleCondition; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPublicKeyFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPublicKeyFormDTO.java new file mode 100644 index 0000000000..1be6abcc35 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DhPublicKeyFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPublicKeyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String loginName; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DingLoginResiFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DingLoginResiFormDTO.java new file mode 100644 index 0000000000..7f756f2ed9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DingLoginResiFormDTO.java @@ -0,0 +1,60 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description 钉钉居民端应用注册 // 接口逻辑: + * // (1)根据clientId去XXX表找到customerId + * // (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId, + * // 是否注册居民:register_relation + * // (3)没有则生成user、user_Base_info表记录 + * @Author yzm + * @Date 2022/9/15 9:28 + */ +@Data +public class DingLoginResiFormDTO { + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "customerId不能为空", groups = AddUserShowGroup.class) + private String customerId; + + // 以下参数是微信返回的 + /** + * 头像URL。 + */ + public String avatarUrl; + /** + * 用户的个人邮箱。 + */ + public String email; + /** + * 用户的手机号。 + * 说明 如果要获取用户手机号,需要在开发者后台申请个人手机号信息权限,如下图。 + */ + @NotBlank(message = "手机号不能为空", groups = AddUserShowGroup.class) + public String mobile; + /** + * 用户的钉钉昵称。 + */ + public String nick; + /** + * + */ + public String openId; + /** + * 手机号对应的国家号。 + */ + public String stateCode; + /** + * + */ + public String unionId; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java index 7917113509..5cc4b7ea6a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java @@ -47,14 +47,14 @@ public class EditInfoFormDTO implements Serializable { private String name; //@NotBlank(message = "身份证号不能为空") - @Length(max=18,message = "身份证号不能超过18位",groups = AddUserShowGroup.class) + @Length(max=18,message = "证件号不能超过18位",groups = AddUserShowGroup.class) //别的小程序不统一升级,没办法限制必填。 private String idNum; /** * 路牌号 */ - @NotBlank(message = "路牌号不能为空",groups = AddUserShowGroup.class) +// @NotBlank(message = "路牌号不能为空",groups = AddUserShowGroup.class) private String street; /** * 小区名称 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java index 4d53cebb86..c6727abd24 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java @@ -11,8 +11,9 @@ import java.io.Serializable; * @Date 2021/10/27 2:06 下午 */ @Data -public class ExportResiUserFormDTO implements Serializable { +public class ExportResiUserFormDTO extends ReportDataFormDTO implements Serializable { private static final long serialVersionUID = 8777535966834678256L; + /** * 表单查询条件 */ @@ -27,5 +28,6 @@ public class ExportResiUserFormDTO implements Serializable { */ private IcExportTemplateSaveFormDTO exportConfig; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridInfoVaccinePrarmeterFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridInfoVaccinePrarmeterFormDTO.java new file mode 100644 index 0000000000..18e124e529 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GridInfoVaccinePrarmeterFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 所属网格 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-20 + */ +@Data +public class GridInfoVaccinePrarmeterFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所属网格名称 + */ + private String gridName; + + /** + * 当前登录人组织ID + */ + private String agencyId; + + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java index bcb62d6b45..083658ffda 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java @@ -71,8 +71,8 @@ public class IcMoveInAddEditFormDTO implements Serializable { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {AddGroup.class}) - @Length(min = 15, max = 18, message = "身份证号位数不正确", groups = AddGroup.class) + @NotBlank(message = "证件号不能为空", groups = {AddGroup.class}) + @Length(min = 9, max = 18, message = "证件号位数不正确", groups = AddGroup.class) private String idCard; /** * 性别(1男2女0未知) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java index 09919051b9..7cc5c08b82 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcNoticeFormDTO.java @@ -17,6 +17,6 @@ public class IcNoticeFormDTO extends PageFormDTO implements Serializable { private static final long serialVersionUID = 7392894573654015338L; private String customerId; private String noticeId; - @NotBlank(message = "身份证号不能为空", groups = DefaultGroup.class) + @NotBlank(message = "证件号不能为空", groups = DefaultGroup.class) private String idCard; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java index d9a7f4d565..5c7a53e335 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcTripReportFormDTO.java @@ -57,7 +57,7 @@ public class IcTripReportFormDTO implements Serializable { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) + @NotBlank(message = "证件号能为空", groups = {ResiUserRequired.class,PcAddRequired.class,PcUpdateRequired.class}) private String idCard; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcVaccineCheckFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcVaccineCheckFormDTO.java new file mode 100644 index 0000000000..7eb317b62e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcVaccineCheckFormDTO.java @@ -0,0 +1,79 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 新冠病毒疫苗接种人员信息台账-审核入参 + * + * @author wgf + * @since v1.0.0 2022-08-25 + */ +@Data +public class IcVaccineCheckFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @NotBlank(message = "Id不能为空") + private String id; + + /** + * 审核状态:0待审核 1未通过 2已通过 + */ + @NotBlank(message = "审核状态不能为空") + private String checkState; + + /** + * 审核原因 + */ + private String checkReason; + + /** + * 所属小区ID; + */ + private String villageId; + + /** + * 所属楼宇Id + */ + private String buildId; + + /** + * 单元号 + */ + private String unitId; + + /** + * 房间ID + */ + private String homeId; + + /** + * 房间号 + */ + private String homeName; + + /** + * 客户ID(审核人) + */ + private String customerId; + + /** + * 员工ID(审核人) + */ + private String userId; + + /** + * 员工姓名(审核人) + */ + private String realName; + + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java index c99a96878c..3ce4110f4c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/InfoSubmitFromDTO.java @@ -57,7 +57,7 @@ public class InfoSubmitFromDTO implements Serializable { private String name; //@NotBlank(message = "身份证号不能为空") - @Length(max=18,message = "身份证号不能超过18位") + @Length(max=18,message = "证件号不能超过18位") //别的小程序不统一升级,没办法限制必填。 private String idNum; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java new file mode 100644 index 0000000000..6d642b2e90 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/9/26 17:04 + * @DESC + */ +@Data +public class NatInfoScanTaskFormDTO implements Serializable { + + private static final long serialVersionUID = 3053943501957102943L; + + private String customerId; + + private List idCards; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java index ab4a416d9e..1a1de84a5e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageFollowUpFormDTO.java @@ -12,10 +12,10 @@ public class PageFollowUpFormDTO extends PageFormDTO { /** * 身份证号 */ - @NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserShowGroup.class}) private String idCard; - @NotBlank(message = "身份证号不能为空", groups = {AddUserShowGroup.class}) + @NotBlank(message = "证件号不能为空", groups = {AddUserShowGroup.class}) private String name; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java new file mode 100644 index 0000000000..6ef39cb1f4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/8/17 11:13 + */ +@Data +public class ReportDataFormDTO { + /** + * 客户Id + */ + private String customerId; + /** + * pageNo 报表用的 + */ + private Integer pageNo = 1; + private Integer pageSize = 1000; + private String id; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ScopeSaveFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ScopeSaveFormDTO.java new file mode 100644 index 0000000000..738ed51b59 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ScopeSaveFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import com.epmet.dto.DataSyncScopeDTO; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/9/26 15:35 + * @DESC + */ +@Data +public class ScopeSaveFormDTO implements Serializable { + + private static final long serialVersionUID = -489844541905303736L; + + public interface ScopeSaveForm{} + + @NotBlank(message = "dataSyncConfigId不能为空",groups = ScopeSaveForm.class) + private String dataSyncConfigId; + private String customerId; + + @Valid + private List scopeList; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java index 75a2eee8e0..56bdcc0fea 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java @@ -60,5 +60,8 @@ public class SendNoticeFormDTO implements Serializable { * 身份证 */ private String idCard; + + + private String realIdCard; } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java new file mode 100644 index 0000000000..23e77ed29c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/9/21 17:06 + */ +@Data +public class SendNoticeV2FormDTO { + // token获取 + private String customerId; + private String staffId; + // 前端传入 + /** + * 用户列表 + */ + @NotEmpty(message = "业务数据id不能为空", groups = CustomerClientShowGroup.class) + private List bdIds; + /** + * 通知渠道通知渠道 0小程序通知,1短信通知 + */ + @NotEmpty(message = "请选择通知渠道", groups = CustomerClientShowGroup.class) + private List channel; + /** + * v1:通知来源 0 行程上报,1 疫苗接种,2 核酸检测 + * v2:0行程上报,1疫苗接种关注名单,2重点人群关注名单-隔离防疫(原核酸检测关注名单) + */ + @NotEmpty(message = "通知来源不能为空", groups = CustomerClientShowGroup.class) + private String origin; + /** + * 通知内容 + */ + @Size(min = 1, max = 500, message = "通知内容不超过500字", groups = CustomerClientShowGroup.class) + private String content; + + // 接口内赋值 + /** + * 组织名 + */ + private String orgName; + +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java index 9d21502254..f3ecdc99c0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java @@ -22,7 +22,10 @@ public class StaffResetPwFormDTO implements Serializable { public interface AddUserShowGroup extends CustomerClientShowGroup { } - + /** + * 旧密码 + */ + private String oldPassword; @NotBlank(message = "新密码不能为空", groups = {AddUserShowGroup.class}) private String newPassword; @NotBlank(message = "确认新密码不能为空", groups = {AddUserShowGroup.class}) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java index ff71263f95..7d357089f6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java @@ -22,6 +22,14 @@ public class UserChartFormDTO implements Serializable { * 组织、网格、小区类型 agency grid village */ private String orgType; + /** + * 数据类型【居民总数: all 常住: cz 流动: ld】 + */ + private String type; + + private Integer pageNo = 1; + private Integer pageSize = 20; + private Boolean isPage = true; //id集合 private List idList; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java index c50649b4a9..cc06182a72 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java @@ -24,6 +24,12 @@ public class VaccinationListFormDTO extends PageFormDTO implements Serializable @NotNull(message = "attentionType不能为空",groups = VaccinationListForm.class) private Integer attentionType; + /** + * 隔离类型,来自字典表;集中隔离:0;居家隔离1;居家健康监测2;已出隔离期3 + */ + private String isolatedState; + private String isHistory; + /** * 手机号 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinePrarmeterListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinePrarmeterListFormDTO.java new file mode 100644 index 0000000000..859a30a01d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinePrarmeterListFormDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author wgf + * @DateTime 2022/8/22 10:30 + * @DESC + */ +@Data +public class VaccinePrarmeterListFormDTO extends PageFormDTO implements Serializable { + + private static final long serialVersionUID = -498378993902522370L; + + /** + * 手机号 + */ + private String mobile; + + /** + * 地点名称 + */ + private String name; + + /** + * 证件号 + */ + private String idCard; + + /** + * 客户ID + */ + private String customerId; + /** + * 部门ID + */ + private String agencyId; + + private String isVaccination; + private String gridId; + private String villageId; + private String buildId; + private String unitId; + private String homeId; + + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitListFormDTO.java index 09ca9bf294..4ec572ad88 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitListFormDTO.java @@ -23,4 +23,18 @@ public class VisitListFormDTO extends PageFormDTO { private String orgId; + private String idCard; + + private String name; + + private String villageId; + + private String buildId; + + private String unitId; + + private String homeId; + + private String mobile; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitVisitorChartFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitVisitorChartFormDTO.java new file mode 100644 index 0000000000..aee3bdb042 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitVisitorChartFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorChartFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 时间 + */ + private String date; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitVisitorFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitVisitorFormDTO.java new file mode 100644 index 0000000000..e1f9db62e0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitVisitorFormDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String name; + + /** + * 身份证 + */ + @NotBlank(message = "身份证号不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String idCard; + + /** + * 手机号 + */ + @NotBlank(message = "联系方式不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String mobile; + + /** + * 头像 + */ + private String faceImg; + + /** + * 节点 + */ + private String node; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitorInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitorInfoFormDTO.java new file mode 100644 index 0000000000..4c1467a774 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VisitorInfoFormDTO.java @@ -0,0 +1,14 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class VisitorInfoFormDTO implements Serializable { + + private String userId; + + private String customerId; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/IcResiPageNonDynamicFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/IcResiPageNonDynamicFormDTO.java new file mode 100644 index 0000000000..e5453cda85 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/resi/IcResiPageNonDynamicFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form.resi; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class IcResiPageNonDynamicFormDTO extends PageFormDTO { + + private String gridId; + + private String name; + + private String mobile; + + /** + * 是否模糊。true:模糊,false:精确 + */ + private Boolean fuzzy = false; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java new file mode 100644 index 0000000000..c5f6ddd53e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form.yqfk; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 15:55 + */ +@Data +public class IcNatCompareRecordPageFormDTO extends PageFormDTO { + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; + /** + * 导入时间 yyyyMMdd + */ + private String importDate; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 手机号 + */ + private String mobile; + + + private String customerId; + private String userId; + private String agencyId; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java index 89742845fa..f94a7dc803 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListMemberExcelResultDTO.java @@ -24,7 +24,7 @@ public class CollectListMemberExcelResultDTO implements Serializable { /** * 成员身份证 */ - @Excel(name = "成员身份证号", width = 30) + @Excel(name = "成员证件号", width = 30) private String memberIdNum; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DhChannelResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DhChannelResultDTO.java new file mode 100644 index 0000000000..0871cdd7ff --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DhChannelResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhChannelResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String privilegeType; + + private String resouceCode; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DingAutoRegResDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DingAutoRegResDTO.java new file mode 100644 index 0000000000..dd1be77a56 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DingAutoRegResDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/15 14:31 + */ +@Data +public class DingAutoRegResDTO { + private String customerId; + private String gridId; + /** + * 网格名 + */ + private String gridName; + /** + * 网格所属的组织id + */ + private String agencyId; + /** + * 居民端用户id + */ + private String epmetUserId; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DingLoginResiResDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DingLoginResiResDTO.java new file mode 100644 index 0000000000..a9ca3d693a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/DingLoginResiResDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/15 9:33 + */ +@Data +public class DingLoginResiResDTO { + private String customerId; + private String gridId; + /** + * XXX社区-网格名 + */ + private String gridName; + /** + * 网格所属的组织id + */ + private String agencyId; + /** + * 居民端用户id + */ + private String epmetUserId; + + /** + * 是否注册居民 + * true:已注册 + * false:未注册 + */ + private Boolean regFlag; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MapInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MapInfoResultDTO.java index 896d1195fc..12d9cf0db4 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MapInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MapInfoResultDTO.java @@ -77,6 +77,11 @@ public class MapInfoResultDTO implements Serializable { */ private String latitude; + /** + * 未禁用enable,已禁用disabled + */ + private String enableFlag; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatPieResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatPieResultDTO.java new file mode 100644 index 0000000000..084599de93 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatPieResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/9/19 15:47 + * @DESC + */ +@Data +public class NatPieResultDTO implements Serializable { + + private static final long serialVersionUID = -1617454069928624020L; + + private List isolatedList = new ArrayList<>(); + private List historyList = new ArrayList<>(); + + @Data + public static class IsolatedList{ + private Integer total = NumConstant.ZERO; + private String categoryCode; + private String categoryName; + private String color; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java new file mode 100644 index 0000000000..10e611aa46 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/27 10:23 + * @DESC + */ +@Data +public class NatUserInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 8904940082452398136L; + + private String idCard; + + private String userId; + + private String agencyId; + + private String pids; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java index 68ad326637..e9873965b7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java @@ -47,6 +47,8 @@ public class PersonDataResultDTO implements Serializable { * 姓名 */ private String name; + private String mobile; + private String isTenant; /** * 经济状况:包括 月收入:monthlyIncome 和 退休金额:retirementAmount @@ -93,4 +95,7 @@ public class PersonDataResultDTO implements Serializable { @JsonIgnore private String gridId; + + @JsonIgnore + private String homeId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java index 29ebb13231..7099e1650b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result; import com.epmet.commons.tools.constant.NumConstant; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.apache.commons.lang3.StringUtils; @@ -37,10 +38,21 @@ public class VaccinationListResultDTO implements Serializable { */ private String mobile; + /** + * 真实手机号 + */ + private String realMobile; + /** * 身份证 */ private String idCard; + + /** + * 真实的身份证 + */ + private String realIdCard; + private String sex; /** @@ -57,6 +69,7 @@ public class VaccinationListResultDTO implements Serializable { * 最后一次通知时间 */ private String lastInformTime; + private String lastNatTime; /** * 所属小区ID @@ -72,6 +85,8 @@ public class VaccinationListResultDTO implements Serializable { * 所属楼宇Id */ private String buildId; + private String gridId; + private String gridName; /** * 所属楼宇名称 @@ -102,7 +117,15 @@ public class VaccinationListResultDTO implements Serializable { * 小区名+楼栋名+单元名+房屋名 */ private String allName; + /** + * 隔离类型,来自字典表;集中隔离:0;居家隔离1;居家健康监测2;已出隔离期3 + */ + private String isolatedState; private String id; + private String userId; + + @JsonIgnore + private String customerId; public VaccinationListResultDTO() { this.vaccinationCount = NumConstant.ZERO; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VisitVisitorChartResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VisitVisitorChartResultDTO.java new file mode 100644 index 0000000000..7836d3a866 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VisitVisitorChartResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorChartResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 时间 + */ + private String hour; + + /** + * 数量 + */ + private String num; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/IcResiNonDynamicResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/IcResiNonDynamicResultDTO.java new file mode 100644 index 0000000000..52da33987e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/resi/IcResiNonDynamicResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result.resi; + +import lombok.Data; + +/** + * 居民基础信息V2 + */ +@Data +public class IcResiNonDynamicResultDTO { + private String id; + private String name; + private String customerId; + private String agencyId; + private String gridId; + private String villageId; + private String buildId; + private String unitId; + private String homeId; + private String mobile; + private String idCard; + private String gender; + private String idCardType; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/NatPieColorEnum.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/NatPieColorEnum.java new file mode 100644 index 0000000000..6f6b58f854 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/NatPieColorEnum.java @@ -0,0 +1,47 @@ +package com.epmet.enums; + +import com.epmet.commons.tools.constant.NumConstant; +import org.apache.commons.lang3.StringUtils; + +/** + * @Author zxc + * @DateTime 2022/3/29 16:17 + * @DESC + */ +public enum NatPieColorEnum { + + REd("0","#ee6666"), + YELLOW("2","#fac858"), + ORANGE("1","#fc8452"), + THREE("3","#73c0de"), + GREEN("100","#91cc75"), + ; + + private String key; + private String value; + + NatPieColorEnum(String key, String value) { + this.key = key; + this.value = value; + } + + public static String getValueByKey(String key){ + if (StringUtils.isBlank(key)){ + return NumConstant.ZERO_STR; + } + for (NatPieColorEnum a : NatPieColorEnum.values()) { + if (a.getKey().equals(key)){ + return a.getValue(); + } + } + return NumConstant.ZERO_STR; + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 2dc367db96..2800f479c3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -3,12 +3,15 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; +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.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; +import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.feign.fallback.EpmetUserOpenFeignClientFallbackFactory; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import org.springframework.cloud.openfeign.FeignClient; @@ -890,4 +893,34 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/customerstaff/edittostaff") Result editToStaff(@RequestBody CustomerStaffDTO formDTO); + + /** + * 居民列表,非动态 + * @param input + * @return + */ + @PostMapping("/epmetuser/icresiuser/nonDynamic/listResi") + Result> listResiNonDynamic(@RequestBody IcResiPageNonDynamicFormDTO input); + + @PostMapping("/epmetuser/icresiuser/updateYlfn") + Result updateYlfn(); + + /** + * 钉钉居民端登录 + * // 接入流程:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process + * // 1、获取个人用户token:https://open.dingtalk.com/document/isvapp-server/obtain-user-token + * // 2、获取用户通讯录个人信息:https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information + * // 接口逻辑: + * // (1)根据clientId去XXX表找到customerId + * // (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId, + * // 是否注册居民:register_relation + * // (3)没有则生成user、user_Base_info表记录 + * @param formDTO + * @return + */ + @PostMapping("/epmetuser/userbaseinfo/dingResiLogin") + Result dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO); + + @PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask") + Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 6eb69b88af..713e7d51a5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -2,13 +2,16 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.patrol.PatrolQueryFormDTO; +import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; import com.epmet.dto.result.*; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; import org.springframework.web.bind.annotation.RequestBody; @@ -679,4 +682,38 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result editToStaff(CustomerStaffDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editToStaff", formDTO); } + + @Override + public Result> listResiNonDynamic(IcResiPageNonDynamicFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "listResiNonDynamic", input); + } + + @Override + public Result updateYlfn() { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateYlfn", null); + } + + /** + * 钉钉居民端登录 + * // 接入流程:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process + * // 1、获取个人用户token:https://open.dingtalk.com/document/isvapp-server/obtain-user-token + * // 2、获取用户通讯录个人信息:https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information + * // 接口逻辑: + * // (1)根据clientId去XXX表找到customerId + * // (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId, + * // 是否注册居民:register_relation + * // (3)没有则生成user、user_Base_info表记录 + * + * @param formDTO + * @return + */ + @Override + public Result dingResiLogin(DingLoginResiFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "dingResiLogin", formDTO); + } + + @Override + public Result natInfoScanTask(NatInfoScanTaskFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "natInfoScanTask", formDTO); + } } diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index c6364f2d59..db7f0f7c45 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -28,11 +28,11 @@ epmet-commons-mybatis 2.0.0 - + org.springframework.boot spring-boot-starter-web @@ -353,6 +353,16 @@ epmet_user_user EpmEt-db-UsEr + + + + epmet_user_user + EpmEt-db-UsEr + + + + epmet_user_user + EpmEt-db-UsEr 0 172.22.76.1:6379,172.22.76.20:6379,172.22.76.36:6379,172.22.76.1:6389,172.22.76.20:6389,172.22.76.36:6389 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java index b9b1c5c87d..a51390f16f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java @@ -38,6 +38,7 @@ public interface UserConstant { */ String CLIENT_WX = "wxmp"; + /** * 居民角色 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 293b925353..6c9d46dbb5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -39,7 +40,9 @@ import com.epmet.excel.CustomerStaffExcel; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.send.SendMqMsgUtil; import com.epmet.service.CustomerStaffService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -57,7 +60,8 @@ import java.util.Map; @RestController @RequestMapping("customerstaff") public class CustomerStaffController { - + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private CustomerStaffService customerStaffService; @Autowired @@ -500,7 +504,12 @@ public class CustomerStaffController { * @Date 10:03 2020-08-25 **/ @PostMapping(value = "customerlist") - public Result> customerList(@RequestBody CustomerListFormDTO formDTO){ + public Result> customerList(@RequestBody CustomerListFormDTO formDTO) throws Exception { + //解密密码 + if (StringUtils.isNotBlank(formDTO.getPhone())&&formDTO.getPhone().length() > 50) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey); + formDTO.setPhone(phone); + } return customerStaffService.selectCustomerList(formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java new file mode 100644 index 0000000000..950de6f573 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java @@ -0,0 +1,115 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.dto.form.PageFormDTO; +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.DataSyncConfigDTO; +import com.epmet.dto.form.ConfigSwitchFormDTO; +import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.dto.form.ScopeSaveFormDTO; +import com.epmet.service.DataSyncConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@RestController +@RequestMapping("dataSyncConfig") +public class DataSyncConfigController { + + @Autowired + private DataSyncConfigService dataSyncConfigService; + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + DataSyncConfigDTO data = dataSyncConfigService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody DataSyncConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + dataSyncConfigService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody DataSyncConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dataSyncConfigService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + dataSyncConfigService.delete(ids); + return new Result(); + } + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + @PostMapping("configSwitch") + public Result configSwitch(@RequestBody ConfigSwitchFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, ConfigSwitchFormDTO.ConfigSwitchForm.class); + formDTO.setUpdatedBy(tokenDto.getUserId()); + dataSyncConfigService.configSwitch(formDTO); + return new Result(); + } + + /** + * Desc: 【数据配置】列表 + * @param tokenDto + * @author zxc + * @date 2022/9/26 15:04 + */ + @PostMapping("list") + public Result list(@LoginUser TokenDto tokenDto, @RequestBody PageFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,PageFormDTO.AddUserInternalGroup.class); + return new Result().ok(dataSyncConfigService.list(tokenDto,formDTO)); + } + + /** + * Desc: 【数据配置】范围保存 + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2022/9/26 15:40 + */ + @PostMapping("scopeSave") + public Result scopeSave(@LoginUser TokenDto tokenDto,@RequestBody ScopeSaveFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ScopeSaveFormDTO.ScopeSaveForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + dataSyncConfigService.scopeSave(formDTO); + return new Result(); + } + + @PostMapping("natInfoScanTask") + public Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO){ + dataSyncConfigService.natInfoScanTask(formDTO); + return new Result(); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncScopeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncScopeController.java new file mode 100644 index 0000000000..e7e3980574 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncScopeController.java @@ -0,0 +1,70 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +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.DataSyncScopeDTO; +import com.epmet.service.DataSyncScopeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@RestController +@RequestMapping("dataSyncScope") +public class DataSyncScopeController { + + @Autowired + private DataSyncScopeService dataSyncScopeService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = dataSyncScopeService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + DataSyncScopeDTO data = dataSyncScopeService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody DataSyncScopeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + dataSyncScopeService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody DataSyncScopeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dataSyncScopeService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + dataSyncScopeService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java index e2e046a047..3ebd6d4f84 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java @@ -15,13 +15,13 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcEpidemicSpecialAttentionDTO; +import com.epmet.dto.SysDictDataDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.dto.result.NatPieResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; -import com.epmet.excel.NatExportExcel; -import com.epmet.excel.NatImportExcel; -import com.epmet.excel.VaccinationExportExcel; -import com.epmet.excel.VaccinationImportExcel; +import com.epmet.excel.*; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcEpidemicSpecialAttentionService; import lombok.extern.slf4j.Slf4j; @@ -34,7 +34,9 @@ import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** @@ -52,6 +54,8 @@ public class IcEpidemicSpecialAttentionController { private IcEpidemicSpecialAttentionService icEpidemicSpecialAttentionService; @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; /** * Desc: 【疫苗接种关注名单,疫苗接种关注名单】列表 @@ -68,6 +72,15 @@ public class IcEpidemicSpecialAttentionController { return new Result().ok(icEpidemicSpecialAttentionService.vaccinationList(formDTO)); } + @PostMapping("historyList") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + public Result historyList(@RequestBody VaccinationListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class, VaccinationListFormDTO.VaccinationListForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(icEpidemicSpecialAttentionService.historyList(formDTO)); + } + /** * Desc: 【疫苗接种关注名单,疫苗接种关注名单】详情 * @param formDTO @@ -185,12 +198,24 @@ public class IcEpidemicSpecialAttentionController { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); formDTO.setIsPage(false); - PageData pageData = icEpidemicSpecialAttentionService.vaccinationList(formDTO); - // 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 + PageData pageData = icEpidemicSpecialAttentionService.vaccinationList(formDTO); + // 关注类型,核酸检测:2,疫苗接种:1,行程上报:0,历史核酸检测关注:99 if (formDTO.getAttentionType().equals(NumConstant.ONE)){ ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), VaccinationExportExcel.class); }else { - ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), NatExportExcel.class); + Result> isolatedState = epmetAdminOpenFeignClient.dictDataList("isolatedState"); + if (!isolatedState.success()){ + throw new EpmetException("查询字典表数据失败..."+"isolatedState"); + } + Map dictMap = isolatedState.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel)); + pageData.getList().forEach(l -> { + l.setIsolatedState(dictMap.get(l.getIsolatedState())); + }); + if (formDTO.getIsHistory().equals(NumConstant.ONE_STR)){ + ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), NatHistoryExportExcel.class); + }else { + ExcelUtils.exportExcelToTarget(response, null, pageData.getList(), NatExportExcel.class); + } } } @@ -213,4 +238,9 @@ public class IcEpidemicSpecialAttentionController { ExcelPoiUtils.exportExcel(templatePath ,map,fileName,response); } + @PostMapping("pie") + public Result pie(@LoginUser TokenDto tokenDto){ + return new Result().ok(icEpidemicSpecialAttentionService.pie(tokenDto)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatCompareRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatCompareRecordController.java new file mode 100644 index 0000000000..aa611e8252 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatCompareRecordController.java @@ -0,0 +1,194 @@ +package com.epmet.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.AppClientConstant; +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; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.page.PageData; +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.constants.ImportTaskConstants; +import com.epmet.dto.IcNatCompareRecordDTO; +import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.service.IcNatCompareRecordService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +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.Path; +import java.util.Date; +import java.util.UUID; + + +/** + * 核算比对记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Slf4j +@RestController +@RequestMapping("icNatCompareRecord") +public class IcNatCompareRecordController implements ResultDataResolver { + + @Autowired + private IcNatCompareRecordService icNatCompareRecordService; + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + /** + * 未做核酸比对-分页查询 + * @param tokenDto + * @param formDTO + * @return + */ + @RequestMapping("page") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + public Result> page(@LoginUser TokenDto tokenDto, @RequestBody IcNatCompareRecordPageFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + PageData page = icNatCompareRecordService.page(formDTO); + return new Result>().ok(page); + } + + /** + * pc:未做核酸比对-导出 + * @param tokenDto + * @param formDTO + * @param response + */ + @NoRepeatSubmit + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody IcNatCompareRecordPageFormDTO formDTO, HttpServletResponse response) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + // formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); + // formDTO.setUserId("35005df15fb0f7c791344f0b424870b7"); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + // 这里 需要指定写用哪个class去写 + String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); + String fileName = "核酸比对".concat(today); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcNatCompareRecordDTO.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + do { + data = icNatCompareRecordService.page(formDTO); + formDTO.setPageNo(++pageNo); + excelWriter.write(data.getList(), writeSheet); + } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); + + } catch (Exception e) { + log.error("export exception", e); + } finally { + // 千万别忘记finish 会帮忙关闭流 + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + + /** + * 导入excel + * @return + */ + @NoRepeatSubmit + @PostMapping("import") + public Result importExcel(@LoginUser TokenDto tokenDto, @RequestPart("file") MultipartFile file) { + String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + + // 1.暂存文件 + String originalFilename = file.getOriginalFilename(); + String extName = originalFilename.substring(originalFilename.lastIndexOf(".")); + + Path fileSavePath; + try { + Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_nat_compare_record", "import"); + fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName)); + } catch (IOException e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【未做核酸比对】创建临时存储文件失败:{}", errorMsg); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败"); + } + + InputStream is = null; + FileOutputStream os = null; + + try { + is = file.getInputStream(); + os = new FileOutputStream(fileSavePath.toString()); + IOUtils.copy(is, os); + } catch (Exception e) { + log.error("method exception", e); + } finally { + org.apache.poi.util.IOUtils.closeQuietly(is); + org.apache.poi.util.IOUtils.closeQuietly(os); + } + + // 2.生成导入任务记录 + ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); + importTaskForm.setOperatorId(userId); + importTaskForm.setBizType(ImportTaskConstants.IC_NAT_COMPARE_RECORD); + importTaskForm.setOriginFileName(originalFilename); + + ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm), + ServiceConstant.EPMET_COMMON_SERVICE, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + "excel未做核酸比对导入文件错误", + "未做核酸比对导入文件失败"); + + // 3.执行导入 + icNatCompareRecordService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),tokenDto.getCustomerId(),tokenDto.getUserId()); + return new Result(); + } + + /** + * @param response + * @throws IOException + */ + @RequestMapping(value = "template-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.ms-excel"); + response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("未做核酸比对", "UTF-8") + ".xlsx"); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_nat_compare_record_template.xlsx"); + try { + ServletOutputStream os = response.getOutputStream(); + IOUtils.copy(is, os); + } finally { + if (is != null) { + is.close(); + } + } + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java index 325eb71c31..ada0124d86 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java @@ -4,7 +4,6 @@ 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.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -15,6 +14,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.form.IcNoticeFormDTO; import com.epmet.dto.form.SendNoticeFormDTO; +import com.epmet.dto.form.SendNoticeV2FormDTO; import com.epmet.dto.form.SendPointNoticeFormDTO; import com.epmet.dto.result.CommunityInfoResultDTO; import com.epmet.feign.GovOrgFeignClient; @@ -108,4 +108,18 @@ public class IcNoticeController { return new Result(); } + /** + * 行程上报、重点人群关注名单、疫苗接种关注名单这几个页面的发送通知 + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("sendNoticeV2") + public Result sendNoticeV2(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeV2FormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerClientShowGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + icNoticeService.sendNoticeV2(formDTO); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointAppController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointAppController.java index b6f3edb0a7..c5c6ca64c3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointAppController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointAppController.java @@ -43,7 +43,17 @@ public class IcPointAppController { return icPointAppService.getMapInfoByPointType(formDTO); } - + /** + * Desc: 核酸监测点启用禁用 + * @param id + * @author zxc + * @date 2022/9/6 16:39 + */ + @PostMapping("enableOrDisabled/{id}") + public Result enableOrDisabled(@PathVariable("id") String id){ + icPointAppService.enableOrDisabled(id); + return new Result(); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java index cca091439f..d508f670e8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java @@ -4,15 +4,19 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.IcResiCollectService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -180,6 +184,18 @@ public class IcResiCollectController { //效验数据 ValidatorUtils.validateEntity(formDTO); formDTO.setOrigin("internal");//固定为内部 + + // 证件类型判断----start---- + for (IcResiCollectMemFormDTO member : formDTO.getMemberList()) { + if (StringUtils.isNotBlank(member.getIdNum())) { + IdCardRegexUtils regex = IdCardRegexUtils.parse(member.getIdNum()); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + } + } + // 证件类型判断----end---- + return icResiCollectService.saveCollectInfo(formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java index 60995a0211..1c46fb5f52 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectVisitorController.java @@ -1,11 +1,13 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -14,10 +16,8 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcResiCollectVisitorDTO; import com.epmet.dto.SaveCollectVisitorFormDTO; -import com.epmet.dto.form.CollectDetailFormDTO; -import com.epmet.dto.form.CollectListFormDTO; -import com.epmet.dto.form.VisitListFormDTO; -import com.epmet.dto.result.CollectListResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.VisitVisitorChartResultDTO; import com.epmet.excel.IcResiCollectVisitorExcel; import com.epmet.service.IcResiCollectVisitorService; import org.springframework.beans.factory.annotation.Autowired; @@ -42,7 +42,7 @@ public class IcResiCollectVisitorController { private IcResiCollectVisitorService icResiCollectVisitorService; @RequestMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { // PageData page = icResiCollectVisitorService.page(params); PageData page = icResiCollectVisitorService.getPhrasePage(params); return new Result>().ok(page); @@ -52,6 +52,7 @@ public class IcResiCollectVisitorController { /** * Desc: 访客记录列表 + * * @param formDTO * @param tokenDto * @author wgf @@ -60,22 +61,22 @@ public class IcResiCollectVisitorController { @PostMapping("list") // @MaskResponse(fieldNames = { "memberIdNum", "memberMobile" }, // fieldsMaskType = { MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE }) - public Result> getVisitorList(@RequestBody VisitListFormDTO formDTO, @LoginUser TokenDto tokenDto){ - ValidatorUtils.validateEntity(formDTO,CollectListFormDTO.CollectListForm.class); + public Result> getVisitorList(@RequestBody VisitListFormDTO formDTO, @LoginUser TokenDto tokenDto) { + ValidatorUtils.validateEntity(formDTO, CollectListFormDTO.CollectListForm.class); formDTO.setUserId(tokenDto.getUserId()); formDTO.setCustomerId(tokenDto.getCustomerId()); return new Result>().ok(icResiCollectVisitorService.getVisitorList(formDTO)); } - @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) - public Result get(@PathVariable("id") String id){ + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id) { IcResiCollectVisitorDTO data = icResiCollectVisitorService.get(id); return new Result().ok(data); } @NoRepeatSubmit @PostMapping("save") - public Result save(@RequestBody IcResiCollectVisitorDTO dto){ + public Result save(@RequestBody IcResiCollectVisitorDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); icResiCollectVisitorService.save(dto); @@ -84,7 +85,7 @@ public class IcResiCollectVisitorController { @NoRepeatSubmit @PostMapping("update") - public Result update(@RequestBody IcResiCollectVisitorDTO dto){ + public Result update(@RequestBody IcResiCollectVisitorDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); icResiCollectVisitorService.update(dto); @@ -92,7 +93,7 @@ public class IcResiCollectVisitorController { } @PostMapping("delete") - public Result delete(@RequestBody String[] ids){ + public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); icResiCollectVisitorService.delete(ids); @@ -106,32 +107,68 @@ public class IcResiCollectVisitorController { } /** - * @describe: 保存访客信息 - * @author wangtong - * @date 2022/8/3 10:33 - * @params [dto] - * @return com.epmet.commons.tools.utils.Result - */ + * @return com.epmet.commons.tools.utils.Result + * @describe: 保存访客信息 + * @author wangtong + * @date 2022/8/3 10:33 + * @params [dto] + */ @NoRepeatSubmit @PostMapping("saveInfo") - public Result saveInfo(@RequestBody SaveCollectVisitorFormDTO dto){ + public Result saveInfo(@RequestBody SaveCollectVisitorFormDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto); + // 证件类型判断----start---- + IdCardRegexUtils regex = IdCardRegexUtils.parse(dto.getIdCard()); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + // 证件类型判断----end---- return icResiCollectVisitorService.saveInfo(dto); } /** - * @describe: 访客信息详情 - * @author wangtong - * @date 2022/8/3 15:41 - * @params [dto] - * @return com.epmet.commons.tools.utils.Result - */ + * @return com.epmet.commons.tools.utils.Result + * @describe: 访客信息详情 + * @author wangtong + * @date 2022/8/3 15:41 + * @params [dto] + */ @PostMapping("getVisitorDetail") public Result getVisitorDetail(@RequestBody CollectDetailFormDTO dto) { ValidatorUtils.validateEntity(dto); return icResiCollectVisitorService.getVisitorDetail(dto); } + /** + * 登陆访客用户信息 + * + * @param tokenDto + * @param dto + * @return com.epmet.commons.tools.utils.Result + * @author zhy + * @date 2022/8/19 15:24 + */ + @PostMapping("visitorinfo") + public Result getVisitorInfo(@LoginUser TokenDto tokenDto, @RequestBody VisitorInfoFormDTO dto) { + ValidatorUtils.validateEntity(dto); + return icResiCollectVisitorService.getVisitorInfo(tokenDto, dto); + } + + /** + * 访客折线图 + * + * @param dto + * @return com.epmet.commons.tools.utils.Result> + * @author zhy + * @date 2022/8/22 9:56 + */ + @NoRepeatSubmit + @PostMapping("chart/traffic") + public Result> getTraffic(@RequestBody VisitVisitorChartFormDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + return new Result>().ok(icResiCollectVisitorService.getTraffic(dto)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index f958d975d3..c70bf78c83 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -25,12 +25,14 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.annotation.ReportRequest; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; import com.epmet.commons.tools.dto.form.mq.MqBaseFormDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; @@ -53,8 +55,10 @@ import com.epmet.constant.SystemMessageType; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; +import com.epmet.dto.form.resi.IcResiPageNonDynamicFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.enums.IcResiUserTableEnum; import com.epmet.excel.PartyMemberAgeExportExcel; import com.epmet.excel.PartyMemberEducationExportExcel; @@ -67,6 +71,7 @@ import com.epmet.send.SendMqMsgUtil; import com.epmet.service.IcResiUserExportService; import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserService; +import com.github.pagehelper.Page; import feign.RequestInterceptor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -187,10 +192,17 @@ public class IcResiUserController implements ResultDataResolver { IC_RESI_DOWNLOAD_DIR = exportDir; } + /** + * 批量删除居民信息 + * @param tokenDto + * @param formDTO + * @return + */ @NoRepeatSubmit @PostMapping("delete") public Result delete(@LoginUser TokenDto tokenDto, @RequestBody DelIcResiUserFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCurrentStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO, DelIcResiUserFormDTO.IdGroup.class); formDTO.getUserIds().forEach(userId -> { formDTO.setIcResiUserId(userId); @@ -297,12 +309,30 @@ public class IcResiUserController implements ResultDataResolver { */ @PostMapping("rent/updateimage") public Result updateImage(@LoginUser TokenDto tokenDto, @RequestBody RentTenantFormDTO formDTO) { + + // 身份证号验证 + if (StringUtils.isNotBlank(formDTO.getUser().getIdCard())) { + checkIdCard(formDTO.getUser().getIdCard()); + } + + if (StringUtils.isNotBlank(formDTO.getIdCard())) { + checkIdCard(formDTO.getIdCard()); + } + String resiUserId = icResiUserService.updateImage(tokenDto, formDTO); //推送MQ事件 editResiMq(formDTO.getCustomerId(), resiUserId); return new Result(); } + private void checkIdCard(String idCard) { + // 证件类型判断----start---- + IdCardRegexUtils regex = IdCardRegexUtils.parse(idCard); + if (regex == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "证件号解析错误", "证件号解析错误"); + } + } + private void editResiMq(String customerId, String userId) { //推送MQ事件 IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); @@ -368,6 +398,7 @@ public class IcResiUserController implements ResultDataResolver { return new Result<>(); } + @ReportRequest @PostMapping("listresi") @MaskResponse(fieldNames = {"MOBILE", "ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) public Result>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO) { @@ -524,7 +555,7 @@ public class IcResiUserController implements ResultDataResolver { log.info("通过原来的模板下载,tokenDto:{}", JSON.toJSONString(tokenDto)); this.exportExcelByEasyExcel(tokenDto, pageFormDTO.getSearchForm(), response); } else { - icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, response); + icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, response,false); } } catch (EpmetException e) { response.reset(); @@ -537,6 +568,61 @@ public class IcResiUserController implements ResultDataResolver { } } + /** + * desc: 自定义导出居民信息 不下载只有数据 + * + * @param tokenDto + * @param pageFormDTO + * @param response + * @return void + * @author LiuJanJun + * @date 2021/11/19 4:24 下午 + * @remark 用于报表调用的接口 试试 + */ + @ReportRequest + //@NoRepeatSubmit + @RequestMapping(value = "/exportExcelCustomData") + public Map exportExcelCustomData(@LoginUser TokenDto tokenDto, @RequestParam("templateId") String templateId, + @RequestBody ExportResiUserFormDTO pageFormDTO) throws Exception { + log.warn("pageFormDTO入参【"+JSON.toJSONString(pageFormDTO)+"】"); + // pageFormDTO.setTemplateId(templateId); + pageFormDTO.setTemplateId(tokenDto.getCustomerId().concat("_").concat(templateId)); + if (null == pageFormDTO.getSearchForm()) { + IcResiUserPageFormDTO searchForm = new IcResiUserPageFormDTO(); + searchForm.setFormCode("resi_base_info"); + searchForm.setCustomerId(tokenDto.getCustomerId()); + searchForm.setStaffId(tokenDto.getUserId()); + // searchForm.setPageNo(pageFormDTO.getPageNo()); + // searchForm.setPageSize(pageFormDTO.getPageSize()); + List conditions=new ArrayList<>(); + // ResiUserQueryValueDTO temp=new ResiUserQueryValueDTO(); + // temp.setColumnName(""); + // temp.setColumnValue(Arrays.asList("IS_UNEMPLOYED")); + // temp.setQueryType("resi_category"); + // temp.setTableName("ic_resi_user"); + // conditions.add(temp); + searchForm.setConditions(conditions); + pageFormDTO.setSearchForm(searchForm); + } + pageFormDTO.getSearchForm().setPageNo(pageFormDTO.getPageNo()); + pageFormDTO.getSearchForm().setPageSize(pageFormDTO.getPageSize()); + if (null == pageFormDTO.getExportConfig()) { + IcExportTemplateSaveFormDTO exportTemplateSaveFormDTO = new IcExportTemplateSaveFormDTO(); + exportTemplateSaveFormDTO.setFormCode("resi_base_info"); + exportTemplateSaveFormDTO.setIsSaveTemp(false); + pageFormDTO.setExportConfig(exportTemplateSaveFormDTO); + } + //固定通用客户Id + // pageFormDTO.setCustomerId("jmreport_resi_default"); + pageFormDTO.setCustomerId(tokenDto.getCustomerId()); + Page> maps = icResiUserExportService.exportIcResiUser(tokenDto, pageFormDTO, null, true); + Map result = new HashMap<>(); + result.put("total",maps.getPages()); + result.put("count",maps.getTotal()); + result.put("data",maps.getResult()); + return result; + } + /** * desc:根据客户id 先从oss下载模版,如果有没有则使用系统默认模板 如果不存在则返回null * @@ -1280,7 +1366,8 @@ public class IcResiUserController implements ResultDataResolver { * @return */ @PostMapping("listresi-zhzl") - @MaskResponse(fieldNames = {"MOBILE", "ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) + @MaskResponse(fieldNames = {"MOBILE", "ID_CARD", "NAME"}, + fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_CHINESE_NAME}) public Result>> listResiZhzl(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO) { pageFormDTO.setCustomerId(tokenDto.getCustomerId()); pageFormDTO.setStaffId(tokenDto.getUserId()); @@ -1306,4 +1393,47 @@ public class IcResiUserController implements ResultDataResolver { return new Result().ok(icResiUserService.icUserMatchGrid(formDTO)); } + /** + * 居民列表分页查询 非动态 + * @param input + * @return + */ + @PostMapping("/nonDynamic/listResi") + public Result> listResiNonDynamic(@RequestBody IcResiPageNonDynamicFormDTO input) { + + String gridId = input.getGridId(); + String name = input.getName(); + Integer pageNo = input.getPageNo(); + Integer pageSize = input.getPageSize(); + Boolean fuzzy = input.getFuzzy(); + String mobile = input.getMobile(); + + PageData page = icResiUserService.listResiNonDynamic(fuzzy, gridId, name, mobile, pageNo, pageSize); + return new Result>().ok(page); + } + + /** + * @Author sun + * @Description 【人房概览】居民统计数点击查询列表 + **/ + @PostMapping("icuserstatislist") + public Result> icUserStatisList(@LoginUser TokenDto tokenDto, @RequestBody UserChartFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(icResiUserService.icUserStatisList(formDTO)); + } + + /** + * 更新育龄妇女状态定时任务 + * @Param + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/9/8 17:19 + */ + @PostMapping("updateYlfn") + public Result updateYlfn() { + icResiUserService.updateYlfn(); + return new Result(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index 6e1aff48ff..aea630040c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java @@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.web.bind.annotation.*; @@ -159,6 +160,12 @@ public class IcTripReportRecordController implements ResultDataResolver { formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserType(IcResiUserConstant.USER_TYPE_RESI); ValidatorUtils.validateEntity(formDTO,IcTripReportFormDTO.ResiUserRequired.class,IcTripReportFormDTO.ResiUserInternalGroup.class); + if (StringUtils.isNotBlank(formDTO.getIdCard())){ + boolean b = IdCardRegexUtils.validateIdCard(formDTO.getIdCard()); + if (!b){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"请输入正确的证件号","请输入正确的证件号"); + } + } return new Result().ok(icTripReportRecordService.resiSave(formDTO)); } @@ -244,6 +251,7 @@ public class IcTripReportRecordController implements ResultDataResolver { * 导入excel * @return */ + @NoRepeatSubmit @PostMapping("import") public Result importExcel(@LoginUser TokenDto tokenDto, MultipartFile file) { String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java new file mode 100644 index 0000000000..217c0600cf --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccinePrarmeterController.java @@ -0,0 +1,203 @@ +package com.epmet.controller; + +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.dto.form.PageFormDTO; +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.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelPoiUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +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.constants.ImportTaskConstants; +import com.epmet.dao.IcVaccinePrarmeterDao; +import com.epmet.dto.IcVaccinePrarmeterDTO; +import com.epmet.dto.form.IcVaccineCheckFormDTO; +import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.form.VaccinePrarmeterListFormDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.excel.IcVaccinePrarmeterExcel; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.service.IcVaccinePrarmeterService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FilenameUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * 新冠病毒疫苗接种人员信息台账 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@RestController +@RequestMapping("icVaccinePrarmeter") +@Slf4j +public class IcVaccinePrarmeterController { + + @Autowired + private IcVaccinePrarmeterService icVaccinePrarmeterService; + + @Autowired + private IcVaccinePrarmeterDao icVaccinePrarmeterDao; + + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + @RequestMapping("page") +// @MaskResponse(fieldNames = {"MOBILE", "ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) + public Result> page(@RequestParam Map params, @LoginUser TokenDto tokenDto){ +// PageData page = icVaccinePrarmeterService.page(params); + PageData page = icVaccinePrarmeterService.getPhrasePage(params,tokenDto); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + IcVaccinePrarmeterDTO data = icVaccinePrarmeterService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody IcVaccinePrarmeterDTO dto, @LoginUser TokenDto tokenDto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icVaccinePrarmeterService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody IcVaccinePrarmeterDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icVaccinePrarmeterService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icVaccinePrarmeterService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = icVaccinePrarmeterService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IcVaccinePrarmeterExcel.class); + } + + /** + * Desc: 【新冠病毒疫苗接种人员信息台账】导出 + * @param response + * @param formDTO + * @param tokenDto + * @author wgf + * @date 2022/6/24 13:57 + */ + @PostMapping("vaccine-export") + public void vaccineExport(HttpServletResponse response, @RequestBody VaccinePrarmeterListFormDTO formDTO, @LoginUser TokenDto tokenDto) throws Exception { + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + // 获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", tokenDto.getUserId())); + } + formDTO.setAgencyId(staffInfo.getAgencyId()); + List list = icVaccinePrarmeterDao.vaccineExport(formDTO); + ExcelUtils.exportExcelToTarget(response, null, list, IcVaccinePrarmeterExcel.class); + + } + + /** + * 导出模板 + * @param response + * @throws Exception + */ + @PostMapping("exporttemplate") + public void exportTemplate( HttpServletResponse response) throws Exception { + TemplateExportParams templatePath = new TemplateExportParams("excel/ic_vaccine_prarmeter_excel.xls"); + ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"新冠病毒疫苗接种人员信息台账",response); + } + + /** + * Desc: 【新冠病毒疫苗接种人员信息台账】导入 + * @param + * @author wgf + * @date 2022/8/22 13:40 + */ + @PostMapping("importFile") + public Result importFile(@LoginUser TokenDto tokenDto, @RequestParam("file") MultipartFile file){ + if (file.isEmpty()) { + throw new EpmetException("请上传文件"); + } + // 校验文件类型 + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (!"xls".equals(extension) && !"xlsx".equals(extension)) { + throw new EpmetException("文件类型不匹配"); + } + + ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); + importTaskForm.setOriginFileName(file.getOriginalFilename()); + importTaskForm.setOperatorId(tokenDto.getUserId()); + importTaskForm.setBizType(ImportTaskConstants.IC_VACCINE_PRARMETER); + Result result = commonServiceOpenFeignClient.createImportTask(importTaskForm); + if (!result.success()) { + throw new EpmetException(9999,"存在进行中的导入"); + } + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + }catch (Exception e){ + ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); + input.setOperatorId(tokenDto.getUserId()); + input.setTaskId(result.getData().getTaskId()); + input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + commonServiceOpenFeignClient.finishImportTask(input); + log.error("读取文件失败"); + } + icVaccinePrarmeterService.importFile(tokenDto,inputStream,result.getData().getTaskId()); + return new Result(); + } + + /** + * 信息采集-审核 + * @param formDTO + * @param tokenDto + * @return + */ + @PostMapping("vaccineCheck") + public Result vaccineCheck(@RequestBody IcVaccineCheckFormDTO formDTO, @LoginUser TokenDto tokenDto) { + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + icVaccinePrarmeterService.vaccineCheck(formDTO,tokenDto); + + return new Result(); + } + + + + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java index 02d15a0b46..a1c2ceb6e8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java @@ -19,12 +19,14 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -38,6 +40,7 @@ import com.epmet.excel.OperUserExcel; import com.epmet.service.OperUserService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -54,6 +57,8 @@ import java.util.Map; @RestController @RequestMapping("operuser") public class OperUserController { + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private OperUserService operUserService; @@ -72,17 +77,43 @@ public class OperUserController { } @PostMapping - public Result save(@RequestBody OperUserDTO dto) { + public Result save(@RequestBody OperUserDTO dto) throws Exception { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + //解密密码 + if (StringUtils.isNotBlank(dto.getPassword()) && dto.getPassword().length() > NumConstant.FIFTY) { + String password = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey); + dto.setPassword(password); + } + if (StringUtils.isNotBlank(dto.getEmail()) && dto.getEmail().length() > NumConstant.FIFTY) { + String email = RSASignature.decryptByPrivateKey(dto.getEmail(), privateKey); + dto.setEmail(email); + } + if (StringUtils.isNotBlank(dto.getPhone()) && dto.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(dto.getPhone(), privateKey); + dto.setPhone(phone); + } operUserService.save(dto); return new Result(); } @PutMapping - public Result update(@RequestBody OperUserDTO dto) { + public Result update(@RequestBody OperUserDTO dto) throws Exception { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + //解密密码 + if (StringUtils.isNotBlank(dto.getPassword()) && dto.getPassword().length() > NumConstant.FIFTY) { + String password = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey); + dto.setPassword(password); + } + if (StringUtils.isNotBlank(dto.getEmail()) && dto.getEmail().length() > NumConstant.FIFTY) { + String email = RSASignature.decryptByPrivateKey(dto.getEmail(), privateKey); + dto.setEmail(email); + } + if (StringUtils.isNotBlank(dto.getPhone()) && dto.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(dto.getPhone(), privateKey); + dto.setPhone(phone); + } operUserService.update(dto); return new Result(); } @@ -94,10 +125,22 @@ public class OperUserController { * @return */ @PostMapping(value = "updatePwd") - public Result updatePwd(@LoginUser TokenDto tokenDto,@RequestBody PasswordDTO dto) { + public Result updatePwd(@LoginUser TokenDto tokenDto,@RequestBody PasswordDTO dto) throws Exception { if (StringUtils.isBlank(dto.getNewPassword()) && AppClientConstant.APP_OPER.equals(tokenDto.getClient())){ throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误","参数错误"); } + //解密密码 + if (dto.getPassword().length() > 50) { + String confirmNewPassWord = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey); + String newPassword = RSASignature.decryptByPrivateKey(dto.getNewPassword(), privateKey); + dto.setPassword(confirmNewPassWord); + dto.setNewPassword(newPassword); + if (StringUtils.isNotBlank(dto.getOldPassword())){ + String oldPassWord = RSASignature.decryptByPrivateKey(dto.getOldPassword(), privateKey); + dto.setOldPassword(oldPassWord); + } + } + //校验长度和 密码是否一致。 operUserService.updatePwd(tokenDto.getUserId(),dto); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java index a60efed8cc..edd488e9e4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java @@ -31,12 +31,10 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.RegisterRelationDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.CommonUserIdFormDTO; +import com.epmet.dto.form.DingLoginResiFormDTO; import com.epmet.dto.form.IssueInitiatorFormDTO; import com.epmet.dto.form.VolunteerRegResiFormDTO; -import com.epmet.dto.result.CustomerUserDetailResultDTO; -import com.epmet.dto.result.ExtUserInfoResultDTO; -import com.epmet.dto.result.ResiUserBaseInfoResultDTO; -import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.UserBaseInfoEntity; import com.epmet.excel.UserBaseInfoExcel; import com.epmet.service.UserBaseInfoService; @@ -221,5 +219,24 @@ public class UserBaseInfoController { public Result getUserInfo(@PathVariable("userId") String userId){ return new Result().ok(userBaseInfoService.getUserInfo(userId)); } + +// 接入流程:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process +// 1、获取个人用户token:https://open.dingtalk.com/document/isvapp-server/obtain-user-token +// 2、获取用户通讯录个人信息:https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information +// 接口逻辑: +// (1)根据clientId去XXX表找到customerId +// (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId, +// 是否注册居民:register_relation +// (3)没有则生成user、user_Base_info表记录 + /** + * yapi: http://yapi.elinkservice.cn/project/245/interface/api/8118 + * + * @param formDTO + * @return + */ + @PostMapping("dingResiLogin") + public Result dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO){ + return new Result().ok(userBaseInfoService.dingResiLogin(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java index 5f8a5ca171..de6daad253 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java @@ -29,6 +29,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.form.*; +import com.epmet.dto.result.DingAutoRegResDTO; import com.epmet.dto.result.IssueInitiatorResultDTO; import com.epmet.dto.result.StaffAndResiResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; @@ -243,4 +244,21 @@ public class UserResiInfoController { return new Result>().ok(userResiInfoService.getStaffAndResi(userIds)); } + /** + * 进入网格,自动注册居民 + * + * @Param tokenDto + * @Param userResiInfoDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2022/9/14 15:34 + */ + @PostMapping("autoreguser-ding") + public Result autoRegister(@LoginUser TokenDto tokenDto, @RequestBody UserResiInfoDTO userResiInfoDTO) { + userResiInfoDTO.setCustomerId(tokenDto.getCustomerId()); + userResiInfoDTO.setUserId(tokenDto.getUserId()); + userResiInfoDTO.setApp(tokenDto.getApp()); + return new Result().ok( userResiInfoService.autoRegister(userResiInfoDTO)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java new file mode 100644 index 0000000000..d3a2c600ef --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java @@ -0,0 +1,59 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.DataSyncConfigDTO; +import com.epmet.dto.DataSyncScopeDTO; +import com.epmet.dto.form.ConfigSwitchFormDTO; +import com.epmet.dto.result.NatUserInfoResultDTO; +import com.epmet.entity.DataSyncConfigEntity; +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 2022-09-26 + */ +@Mapper +public interface DataSyncConfigDao extends BaseDao { + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + void configSwitch(ConfigSwitchFormDTO formDTO); + + /** + * Desc: 【数据配置】列表 + * @param customerId + * @author zxc + * @date 2022/9/26 15:04 + */ + List list(@Param("customerId")String customerId); + + List scopeList(@Param("id")String id); + + /** + * Desc: 删除范围 + * @param dataSyncConfigId + * @author zxc + * @date 2022/9/26 15:46 + */ + void delScope(@Param("dataSyncConfigId")String dataSyncConfigId); + + /** + * Desc: 根据范围查询居民证件号 + * @param list + * @author zxc + * @date 2022/9/27 09:23 + */ + List getIdCardsByScope(@Param("list") List list); + + List getUserIdByIdCard(@Param("list") List list); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncScopeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncScopeDao.java new file mode 100644 index 0000000000..d9f41befd1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncScopeDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.DataSyncScopeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Mapper +public interface DataSyncScopeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java index 0fb3e579d1..d57e5b7f94 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcEpidemicSpecialAttentionDao.java @@ -3,6 +3,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.AttentionDetailFormDTO; import com.epmet.dto.form.VaccinationListFormDTO; +import com.epmet.dto.result.NatPieResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; import com.epmet.entity.IcEpidemicSpecialAttentionEntity; import org.apache.ibatis.annotations.Mapper; @@ -51,6 +52,8 @@ public interface IcEpidemicSpecialAttentionDao extends BaseDao list,@Param("attentionType")Integer attentionType); + void addAttention(@Param("list")List list,@Param("attentionType")Integer attentionType); + void addExistAttention(@Param("list") List list,@Param("attentionType")Integer attentionType); /** * Desc: 查询已经存在的关注 @@ -69,4 +72,8 @@ public interface IcEpidemicSpecialAttentionDao extends BaseDao getIdCardList(@Param("customerId") String customerId,@Param("idCardSet") List idCardSet, @Param("attentionType") Integer attentionType); + + List isolatedList(@Param("agencyId")String agencyId); + + Integer getHistoryCount(@Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecRelationDao.java new file mode 100644 index 0000000000..391127cfb3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecRelationDao.java @@ -0,0 +1,29 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcNatCompareRecRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 核酸比对组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-27 + */ +@Mapper +public interface IcNatCompareRecRelationDao extends BaseDao { + + /** + * + * @param customerId + * @param compareRecId + * @param agencyId + * @param importDate yyyyMMdd + * @return + */ + IcNatCompareRecRelationEntity selectExist(@Param("customerId") String customerId, + @Param("compareRecId") String compareRecId, + @Param("agencyId") String agencyId, + @Param("importDate") String importDate); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecordDao.java new file mode 100644 index 0000000000..ef0273fc0f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecordDao.java @@ -0,0 +1,30 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcNatCompareRecordDTO; +import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; +import com.epmet.entity.IcNatCompareRecordEntity; +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 2022-09-26 + */ +@Mapper +public interface IcNatCompareRecordDao extends BaseDao { + + /** + * 分页查询 + * @param formDTO + * @return + */ + List pageList(IcNatCompareRecordPageFormDTO formDTO); + + + IcNatCompareRecordEntity selectByIdCard(@Param("customerId") String customerId, @Param("idCard")String idCard); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java index 31ef9ec667..3507473187 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java @@ -5,6 +5,7 @@ import com.epmet.dto.IcNatDTO; import com.epmet.dto.form.MyNatListFormDTO; import com.epmet.dto.result.MyNatListResultDTO; import com.epmet.dto.result.NatListResultDTO; +import com.epmet.dto.result.NatUserInfoResultDTO; import com.epmet.entity.IcNatEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -59,4 +60,6 @@ public interface IcNatDao extends BaseDao { */ int updateIsResiFlag(@Param("customerId") String customerId, @Param("icResiUserId") String icResiUserId); + List getExistNatInfo(@Param("list") List entities); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java index eae4085362..908cf46e44 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java @@ -49,4 +49,12 @@ public interface IcPointNucleicMonitoringDao extends BaseDao getMapInfoList(MapInfoFormDTO formDTO); + /** + * Desc: 核酸监测点启用禁用 + * @param id + * @author zxc + * @date 2022/9/6 16:39 + */ + void enableOrDisabled(@Param("id") String id); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectVisitorDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectVisitorDao.java index acf3fe568c..f4ef4e0178 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectVisitorDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiCollectVisitorDao.java @@ -2,9 +2,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IcResiCollectVisitorDTO; -import com.epmet.dto.form.CollectListFormDTO; import com.epmet.dto.form.VisitListFormDTO; -import com.epmet.dto.result.CollectListResultDTO; +import com.epmet.dto.form.VisitVisitorChartFormDTO; +import com.epmet.dto.form.VisitorInfoFormDTO; +import com.epmet.dto.result.VisitVisitorChartResultDTO; import com.epmet.entity.IcResiCollectVisitorEntity; import org.apache.ibatis.annotations.Mapper; @@ -22,6 +23,7 @@ public interface IcResiCollectVisitorDao extends BaseDao getCollectList(VisitListFormDTO formDTO); + /** + * 最新一条访客信息 + * + * @param formDTO + * @return com.epmet.entity.IcResiCollectVisitorEntity + * @author zhy + * @date 2022/8/19 15:33 + */ + IcResiCollectVisitorEntity getLastInfo(VisitorInfoFormDTO formDTO); + + /** + * 人流量 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + List getTraffic(VisitVisitorChartFormDTO dto); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index ae94fe4ec2..dd9e97bbae 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -96,9 +96,9 @@ public interface IcResiUserDao extends BaseDao { @Param("icResiUserId") String icResiUserId, @Param("subTableName") String subTableName); - int updateToDel(String icResiUserId); + int updateToDel(@Param("icResiUserId") String icResiUserId,@Param("currentStaffId") String currentStaffId); - int updateSubTableToDel(@Param("subTalbeName") String subTalbeName, @Param("icResiUserId") String icResiUserId); + int updateSubTableToDel(@Param("subTalbeName") String subTalbeName, @Param("icResiUserId") String icResiUserId,@Param("currentStaffId")String currentStaffId); /** * 接口名称 @@ -428,4 +428,6 @@ public interface IcResiUserDao extends BaseDao { * @Date 2022/6/29 17:37 */ List getIcUserCount(IcUserCountFormDTO formDTO); + + List icUserStatisList(UserChartFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java index ecb3d1f561..4fa9fd0540 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeDetailedDao.java @@ -39,4 +39,6 @@ public interface IcUserChangeDetailedDao extends BaseDao icUserIds); + + int deleteByIcResiUserId(@Param("icResiUserId")String icResiUserId,@Param("currentStaffId")String currentStaffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java index cff359168c..9c171f54f0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserChangeRecordDao.java @@ -49,4 +49,6 @@ public interface IcUserChangeRecordDao extends BaseDao * @Description 删除客户是新增类型的变更历史数据 **/ void delByCustomerId(@Param("customerId") String customerId, @Param("type") String type, @Param("icUserIds") List icUserIds); + + int deleteByIcResiUserId(@Param("icResiUserId") String icResiUserId,@Param("currentStaffId")String currentStaffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java index dacd67bd6c..2042361b4c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcUserTransferRecordDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.IcUserTransferRecordEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 居民调动记录表 @@ -29,5 +30,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcUserTransferRecordDao extends BaseDao { - + + int deleteByIcResiUserId(@Param("icResiUserId") String icResiUserId, @Param("currentStaffId")String currentStaffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java index d4db61ad5b..55b4591be3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java @@ -64,4 +64,12 @@ public interface IcVaccineDao extends BaseDao { IcVaccineDTO getVaccineDTO(@Param("customerId") String customerId, @Param("icVaccineId") String icVaccineId, @Param("idCard") String idCard, @Param("inoculateTime") String inoculateTime); + /** + * 根据身份证号以及接种时间查询接种信息 + * @param idCard + * @param time + * @return + */ + List getVaccineListByIdCard(@Param("idCard") String idCard,@Param("time") String time); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java new file mode 100644 index 0000000000..c5bdfcdbf7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccinePrarmeterDao.java @@ -0,0 +1,31 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcPointNucleicMonitoringDTO; +import com.epmet.dto.IcVaccinePrarmeterDTO; +import com.epmet.dto.form.VaccinePrarmeterListFormDTO; +import com.epmet.entity.IcVaccinePrarmeterEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * 新冠病毒疫苗接种人员信息台账 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Mapper +public interface IcVaccinePrarmeterDao extends BaseDao { + + List vaccineExport(VaccinePrarmeterListFormDTO formDTO); + + /** + * 条件查询 + * @param params + * @return + */ + List getPhrasePage(Map params); + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java index 60d80b3f61..6d087a1055 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java @@ -14,4 +14,8 @@ import org.apache.ibatis.annotations.Param; @Mapper public interface IcVaccineRelationDao extends BaseDao { int delRelation(@Param("icVaccineId") String icNatId, @Param("agencyId") String agencyId); -} \ No newline at end of file + + void updateRelationInfoByVaccineId(IcVaccineRelationEntity icVaccineRelationEntity); + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java index ab4ca3ec5c..b415ca67c8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java @@ -92,4 +92,6 @@ public interface UserBaseInfoDao extends BaseDao { @Param("excludeUserId")String excludeUserId); String selectIdCard(String userId); + + UserBaseInfoEntity selectUserByMobile(@Param("customerId") String customerId, @Param("mobile")String mobile); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncConfigEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncConfigEntity.java new file mode 100644 index 0000000000..bcacb6ab95 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncConfigEntity.java @@ -0,0 +1,53 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_config") +public class DataSyncConfigEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 部门编码 + */ + private String deptCode; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 数据名称 + */ + private String dataName; + + /** + * 开启:open;关闭:closed + */ + private String switchStatus; + + private String dataCode; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncScopeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncScopeEntity.java new file mode 100644 index 0000000000..a106b7e7db --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncScopeEntity.java @@ -0,0 +1,52 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_scope") +public class DataSyncScopeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 数据更新配置表主键 + */ + private String dataSyncConfigId; + + /** + * 网格:grid, + * 组织:agency + */ + private String orgType; + + /** + * 组织或者网格id + */ + private String orgId; + + /** + * org_id的上级 + */ + private String pid; + + /** + * org_id的全路径,包含自身 + */ + private String orgIdPath; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java index 25a853dd55..a22f3f3537 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java @@ -43,6 +43,16 @@ public class IcEpidemicSpecialAttentionEntity extends BaseEpmetEntity { */ private Integer isAttention; + /** + * 是否历史关注,1是0否 + */ + private String isHistory; + + /** + * 隔离类型,来自字典表;集中隔离:0;居家隔离1;居家健康监测2;已出隔离期3 + */ + private String isolatedState; + /** * 关注类型,核酸检测:2,疫苗接种:1,行程上报:0 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecRelationEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecRelationEntity.java new file mode 100644 index 0000000000..daffebedd9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecRelationEntity.java @@ -0,0 +1,77 @@ +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 2022-09-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_nat_compare_rec_relation") +public class IcNatCompareRecRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * ic_nat_compare_record.id + */ + private String compareRecId; + + /** + * 导入日期:yyyyMMdd + */ + private String importDate; + + /** + * 导入时间,同一天内导入多次需要更新此列值 + */ + private Date importTime; + + /** + * 操作人员所属组织id + */ + private String agencyId; + /** + * 组织名称 + */ + private String agencyName; + /** + * agency_id的上级 + */ + private String pid; + + /** + * agency_id组织的所有上级 + */ + private String pids; + + /** + * 最近一次操作人 + */ + private String staffId; + + /** + * 最近一次操作人姓名 + */ + private String staffName; + + /** + * 是否本社区(agency_id)下居民(0:否 1:是) + */ + private String isAgencyUser; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java new file mode 100644 index 0000000000..0110312ed9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java @@ -0,0 +1,71 @@ +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 2022-09-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_nat_compare_record") +public class IcNatCompareRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + private String customerId; + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 手机号 + */ + private String mobile; + + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; + + /** + * 是否客户下居民,ic_resi_user.id + */ + private String icResiUserId; + + /** + * 最近一次核酸时间:接口填入 + */ + private Date latestNatTime; + + /** + * 检测结果(0:阴性 1:阳性):接口填入 + */ + private String natResult; + + /** + * 检测地点:接口填入 + */ + private String natAddress; + /** + * 联系地址:接口填入 + */ + private String contactAddress; + /** + * 最新一次导入时间,对应ic_nat_compare_rec_relation.IMPORT_TIME + */ + private Date latestImportTime; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java index 7744ce67c6..50a9eed8e7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java @@ -89,4 +89,13 @@ public class IcNatEntity extends BaseEpmetEntity { */ private String attachmentUrl; + @TableField(exist = false) + private String agencyId; + + @TableField(exist = false) + private String pids; + + @TableField(exist = false) + private Boolean existStatus = false; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java index 133d56dfcd..41deda8a70 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java @@ -57,4 +57,8 @@ public class IcNoticeEntity extends BaseEpmetEntity { */ private String orgName; + /** + * 发送结果:1成功,0失败 + */ + private String sendRes; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcPointNucleicMonitoringEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcPointNucleicMonitoringEntity.java index 4a05b5d850..e9e54456cc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcPointNucleicMonitoringEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcPointNucleicMonitoringEntity.java @@ -1,13 +1,10 @@ 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; - /** * 核酸监测点 * @@ -66,6 +63,11 @@ public class IcPointNucleicMonitoringEntity extends BaseEpmetEntity { */ private String address; + /** + * 未禁用enable,已禁用disabled + */ + private String enableFlag; + /** * 经度 */ 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 f787399b23..d7849f5592 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,10 +96,15 @@ public class IcResiUserEntity extends BaseEpmetEntity { private String gender; /** - * 身份证号 + * 证件号 */ private String idCard; + /** + * 证件类型。1:身份证号;2:护照 + */ + private String idCardType; + /** * 出生日期 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java new file mode 100644 index 0000000000..c6b982f80d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccinePrarmeterEntity.java @@ -0,0 +1,164 @@ +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 2022-08-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_vaccine_prarmeter") +public class IcVaccinePrarmeterEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 组织Id + */ + private String agencyId; + + /** + * 组织的pids + */ + private String pids; + + /** + * 所属小区ID; + */ + private String villageId; + + /** + * 所属小区名称 + */ + private String villageName; + + /** + * 所属楼宇Id + */ + private String buildId; + + /** + * 所属楼宇名称 + */ + private String buildName; + + /** + * 单元id + */ + private String unitId; + + /** + * 单元名 + */ + private String unitName; + + /** + * 所属家庭Id + */ + private String homeId; + + /** + * 房间名 + */ + private String homeName; + + /** + * 户口性质:0户籍 1外来 + */ + private String householdType; + + /** + * 姓名 + */ + private String name; + + /** + * 联系电话 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 是否接种:0否1是 + */ + private String isVaccination; + + /** + * 第一次接种时间 + */ + private String firstVacTime; + + /** + * 第一次接种地点 + */ + private String firstVacSite; + + /** + * 第二次接种时间 + */ + private String secondVacTime; + + /** + * 第二次接种地点 + */ + private String secondVacSite; + + /** + * 第三次接种时间 + */ + private String thirdVacTime; + + /** + * 第三次接种地点 + */ + private String thirdVacSite; + + /** + * 原因:禁忌症/拒绝接种/其他原因 + */ + private String reason; + + /** + * 备注 + */ + private String note; + + /** + * 审核状态:0待审核 1审核不通过 2审核通过 + */ + private String checkState; + + /** + * 审核理由 + */ + private String checkReason; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java index a198ceee2d..5ad2165e88 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeDeathExcel.java @@ -23,7 +23,7 @@ public class ChangeDeathExcel { @Excel(name = "姓名") private String name; - @Excel(name = "身份证") + @Excel(name = "证件号") private String idCard; @Excel(name = "手机号") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java index 1823d569e2..3b875fd0cd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeRelocationExcel.java @@ -32,7 +32,7 @@ public class ChangeRelocationExcel { @Excel(name = "手机号") private String mobile; - @Excel(name = "身份证号") + @Excel(name = "证件号") private String idCard; @Excel(name = "性别") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java index 99437aa726..acb7705b2f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ChangeWelfareExcel.java @@ -24,7 +24,7 @@ public class ChangeWelfareExcel { @Excel(name = "姓名") private String name; - @Excel(name = "身份证") + @Excel(name = "证件号") private String idCard; @Excel(name = "手机号") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java new file mode 100644 index 0000000000..06cb0b9e15 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterExcel.java @@ -0,0 +1,85 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 新冠病毒疫苗接种人员信息台账 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Data +public class IcVaccinePrarmeterExcel { + + + + @Excel(name = "网格名称") + private String gridName; + + + @Excel(name = "所属小区名称") + private String villageName; + + + @Excel(name = "所属楼宇名称") + private String buildName; + + + @Excel(name = "单元名") + private String unitName; + + + @Excel(name = "房间名") + private String homeName; + + @Excel(name = "户口性质", replace = {"户籍_0","外来_1"}) + private String householdType; + + @Excel(name = "姓名") + private String name; + + @Excel(name = "联系电话") + private String mobile; + + @Excel(name = "证件号") + private String idCard; + + @Excel(name = "是否接种", replace = {"否_0","是_1"}) + private String isVaccination; + + @Excel(name = "第一次接种时间") + private String firstVacTime; + + @Excel(name = "第一次接种地点") + private String firstVacSite; + + @Excel(name = "第二次接种时间") + private String secondVacTime; + + @Excel(name = "第二次接种地点") + private String secondVacSite; + + @Excel(name = "第三次接种时间") + private String thirdVacTime; + + @Excel(name = "第三次接种地点") + private String thirdVacSite; + + @Excel(name = "原因") + private String reason; + + @Excel(name = "备注") + private String note; + + @Excel(name = "审核状态", replace = {"待审核_0","审核不通过_1","审核通过_2"}) + private String checkState; + + @Excel(name = "审核理由") + private String checkReason; + + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterImportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterImportExcel.java new file mode 100644 index 0000000000..3d9ed7a6a7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVaccinePrarmeterImportExcel.java @@ -0,0 +1,97 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelIgnore; +import lombok.Data; + +import java.util.Date; + +/** + * 新冠病毒疫苗接种人员信息台账 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Data +public class IcVaccinePrarmeterImportExcel { + + @Excel(name = "所属网格") + private String gridName; + + @Excel(name = "所属小区") + private String villageName; + + @Excel(name = "所属楼宇") + private String buildName; + + @Excel(name = "单元") + private String unitName; + + @Excel(name = "所属家庭") + private String homeName; + + @Excel(name = "户口性质", replace = {"户籍_0","外来_1"}) + private String householdType; + + @Excel(name = "姓名") + private String name; + + @Excel(name = "联系电话") + private String mobile; + + @Excel(name = "证件号") + private String idCard; + + @Excel(name = "是否接种", replace = {"否_0","是_1"}) + private String isVaccination; + + @Excel(name = "第一次接种时间", format = "yyyy-MM-dd HH:mm:ss") + private String firstVacTime; + + @Excel(name = "第一次接种地点") + private String firstVacSite; + + @Excel(name = "第二次接种时间", format = "yyyy-MM-dd HH:mm:ss") + private String secondVacTime; + + @Excel(name = "第二次接种地点") + private String secondVacSite; + + @Excel(name = "第三次接种时间", format = "yyyy-MM-dd HH:mm:ss") + private String thirdVacTime; + + @Excel(name = "第三次接种地点") + private String thirdVacSite; + + @Excel(name = "原因") + private String reason; + + @Excel(name = "备注") + private String note; + + @ExcelIgnore + private Boolean addStatus = false; + + @ExcelIgnore + private Integer num; + + /** + * 所属网格ID + */ + @ExcelIgnore + private String gridId; + + /** + * 组织ID + */ + @ExcelIgnore + private String agencyId; + + /** + * 组织ID所有上级 + */ + @ExcelIgnore + private String pids; + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java index 2f690d2d7c..52135be6e5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/ImportEpidemicSpecialAttention.java @@ -45,6 +45,9 @@ public class ImportEpidemicSpecialAttention extends ExcelVerifyInfo { @Excel(name = "备注") private String remark; + @Excel(name = "隔离状态") + private String isolatedState; + @ExcelIgnore private Integer attentionType; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java index cc3d827af0..fd404ca278 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatExportExcel.java @@ -29,7 +29,10 @@ public class NatExportExcel { @Excel(name = "关注原因",width = 40) private String reason; - @Excel(name = "最近一次通知时间",width = 20) - private String lastInformTime; + @Excel(name = "最后一次核酸时间",width = 20) + private String lastNatTime; + + @Excel(name = "隔离状态",width = 20) + private String isolatedState; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatHistoryExportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatHistoryExportExcel.java new file mode 100644 index 0000000000..74bbd41676 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/NatHistoryExportExcel.java @@ -0,0 +1,40 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/3/29 10:24 + * @DESC + */ +@Data +public class NatHistoryExportExcel { + + @Excel(name = "排序",width = 10) + private Integer sort; + + @Excel(name = "姓名",width = 20) + private String name; + + @Excel(name = "电话",width = 20) + private String mobile; + @Excel(name = "所属房屋",width = 20) + private String allName; + + @Excel(name = "身份证",width = 30) + private String idCard; + + @Excel(name = "备注",width = 40) + private String remark; + + @Excel(name = "关注原因",width = 40) + private String reason; + + @Excel(name = "最后一次核酸时间",width = 20) + private String lastNatTime; + + @Excel(name = "隔离状态",width = 20) + private String isolatedState; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java new file mode 100644 index 0000000000..26b8ecf8f0 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java @@ -0,0 +1,48 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description + * @Author yzm + * @Date 2022/9/27 9:41 + */ +@Data +public class IcNatCompareRecordExcelData { + @NotBlank(message = "姓名为必填项") + @ExcelProperty("姓名") + private String name; + + @NotBlank(message = "身份证号为必填项") + @ExcelProperty("身份证号") + private String idCard; + + @NotBlank(message = "手机号为必填项") + @ExcelProperty("手机号") + private String mobile; + + @Data + public static class ErrorRow { + + @ExcelProperty("姓名") + @ColumnWidth(20) + private String name; + + @ColumnWidth(20) + @ExcelProperty("身份证号") + private String idCard; + + @ExcelProperty("手机号") + @ColumnWidth(20) + private String mobile; + + @ColumnWidth(60) + @ExcelProperty("错误信息") + private String errorInfo; + } +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcVaccinePrarmeterImportErrorModel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcVaccinePrarmeterImportErrorModel.java new file mode 100644 index 0000000000..8cce05d852 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcVaccinePrarmeterImportErrorModel.java @@ -0,0 +1,77 @@ +package com.epmet.excel.error; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * @Author wgf + * @DateTime 2022/6/21 16:57 + * @DESC + */ +@Data +public class IcVaccinePrarmeterImportErrorModel { + + @Excel(name = "行号",width = 10) + private Integer num; + + + @Excel(name = "所属网格",width = 30) + private String gridName; + + @Excel(name = "所属小区",width = 30) + private String villageName; + + @Excel(name = "所属楼宇",width = 30) + private String buildName; + + @Excel(name = "单元",width = 30) + private String unitName; + + @Excel(name = "所属家庭",width = 30) + private String homeName; + + @Excel(name = "户口性质", width = 30, replace = {"户籍_0","外来_1"}) + private String householdType; + + @Excel(name = "姓名",width = 30) + private String name; + + @Excel(name = "联系电话",width = 30) + private String mobile; + + @Excel(name = "证件号",width = 30) + private String idCard; + + @Excel(name = "是否接种", width = 30, replace = {"否_0","是_1"}) + private String isVaccination; + + @Excel(name = "第一次接种时间",width = 30) + private String firstVacTime; + + @Excel(name = "第一次接种地点",width = 30) + private String firstVacSite; + + @Excel(name = "第二次接种时间",width = 30) + private String secondVacTime; + + @Excel(name = "第二次接种地点",width = 30) + private String secondVacSite; + + @Excel(name = "第三次接种时间",width = 30) + private String thirdVacTime; + + @Excel(name = "第三次接种地点",width = 30) + private String thirdVacSite; + + @Excel(name = "原因",width = 30) + private String reason; + + @Excel(name = "备注",width = 30) + private String note; + + @Excel(name = "错误信息", width = 200) + private String errorMsg; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java new file mode 100644 index 0000000000..f18b256247 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java @@ -0,0 +1,160 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +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.dto.result.YtHsjcResDTO; +import com.epmet.commons.tools.dto.result.YtHsjcResDetailDTO; +import com.epmet.commons.tools.enums.EnvEnum; +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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ObjectUtil; +import com.epmet.commons.tools.utils.YtHsResUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.entity.IcNatCompareRecordEntity; +import com.epmet.excel.data.IcNatCompareRecordExcelData; +import com.epmet.service.impl.IcNatCompareRecordServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/9/27 9:42 + */ +@Slf4j +public class IcNatCompareRecordExcelImportListener implements ReadListener { + + /** + * 最大条数阈值 + */ + public static final int MAX_THRESHOLD = 200; + /** + * 当前操作用户 + */ + private CustomerStaffInfoCacheResult staffInfo; + private String customerId; + private IcNatCompareRecordServiceImpl icNatCompareRecordService; + /** + * 数据 + */ + private List datas = new ArrayList<>(); + + /** + * 错误项列表 + */ + private List errorRows = new ArrayList<>(); + private Date importTime; + /** + * 导入日期:yyyyMMdd + */ + private String importDate; + public IcNatCompareRecordExcelImportListener(String customerId, CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime, IcNatCompareRecordServiceImpl icNatCompareRecordService) { + this.customerId = customerId; + this.staffInfo = staffInfo; + this.icNatCompareRecordService = icNatCompareRecordService; + this.importDate=importDate; + this.importTime=importTime; + } + + + @Override + public void invoke(IcNatCompareRecordExcelData data, AnalysisContext analysisContext) { + try { + // log.warn("有数据吗?"+JSON.toJSONString(data)); + // 不能为空先校验数据 + ValidatorUtils.validateEntity(data); + // 去除空格 + ObjectUtil.objectToTrim(data); + IcNatCompareRecordEntity compareRecordEntity = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); + compareRecordEntity.setCustomerId(customerId); + compareRecordEntity.setLatestNatTime(null); + compareRecordEntity.setNatAddress(StrConstant.EPMETY_STR); + compareRecordEntity.setNatResult(StrConstant.EPMETY_STR); + // 开发和测试没法测试,只能写死只有生产才去调用了 烟台客户id:1535072605621841922 + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + if (EnvEnum.PROD.getCode().equals(currentEnv.getCode()) && "1535072605621841922".equals(customerId)) { + // 调用烟台api获取核酸检测结果 + YtHsjcResDTO hsjcResDTO = YtHsResUtils.hsjc(data.getIdCard(), 1, 1); + if (null != hsjcResDTO && CollectionUtils.isNotEmpty(hsjcResDTO.getData()) && null != hsjcResDTO.getData().get(0)) { + YtHsjcResDetailDTO ytHsjcResDetailDTO = hsjcResDTO.getData().get(0); + String testTime = ytHsjcResDetailDTO.getTest_time(); + compareRecordEntity.setLatestNatTime(DateUtils.parse(testTime, DateUtils.DATE_PATTERN)); + compareRecordEntity.setNatAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getSampling_org_pcr()) ? ytHsjcResDetailDTO.getSample_result_pcr() : StrConstant.EPMETY_STR); + + // "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性 + String sample_result_pcr = ytHsjcResDetailDTO.getSample_result_pcr(); + if (NumConstant.ONE_STR.equals(sample_result_pcr)) { + compareRecordEntity.setNatResult(NumConstant.ONE_STR); + } else if (NumConstant.TWO_STR.equals(sample_result_pcr)) { + compareRecordEntity.setNatResult(NumConstant.ZERO_STR); + } + compareRecordEntity.setContactAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getAddress()) ? ytHsjcResDetailDTO.getAddress() : StrConstant.EPMETY_STR); + } + } + datas.add(compareRecordEntity); + + if (datas.size() == MAX_THRESHOLD) { + execPersist(); + } + } catch (Exception e) { + String errorMsg = null; + if (e instanceof ValidateException) { + errorMsg = ((ValidateException) e).getMsg(); + } else if (e instanceof EpmetException) { + errorMsg = ((EpmetException) e).getMsg(); + } else { + errorMsg = "未知错误"; + log.error("【未做核酸比对导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); + } + IcNatCompareRecordExcelData.ErrorRow errorRow = new IcNatCompareRecordExcelData.ErrorRow(); + errorRow.setIdCard(data.getIdCard()); + errorRow.setName(data.getName()); + errorRow.setMobile(data.getMobile()); + errorRow.setErrorInfo(errorMsg); + errorRows.add(errorRow); + } + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + // 最后几条达不到阈值,这里必须再调用一次 + execPersist(); + } + + + /** + * 执行持久化 + */ + private void execPersist() { + // ic_nat_compare_record、ic_nat_compare_rec_relation + try { + if (datas != null && datas.size() > 0) { + icNatCompareRecordService.batchPersist(datas, staffInfo,importDate,importTime, this); + } + } finally { + datas.clear(); + } + } + + + /** + * 获取错误行 + * + * @return + */ + public List getErrorRows() { + return errorRows; + } +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index be03fdfc96..dd77ffba06 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.CommunityInfoResultDTO; +import com.epmet.dto.result.GridInfoByNameResultDTO; import com.epmet.dto.result.GridInfoResultDTO; import com.epmet.dto.result.IcHouseInfoCollectResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; @@ -74,6 +75,16 @@ public interface GovOrgFeignClient { @PostMapping("/gov/org/customeragency/getCommunityInfo") Result getCommunityInfo(OrgInfoPointFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据网格名称查询所属网格信息 + * @Date 2020/4/26 23:16 + **/ + @PostMapping("/gov/org/customeragency/getGridInfoByGridName") + Result getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO); + /** * @param userId * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 77d306b310..a89cf10924 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.CommunityInfoResultDTO; +import com.epmet.dto.result.GridInfoByNameResultDTO; import com.epmet.dto.result.GridInfoResultDTO; import com.epmet.dto.result.IcHouseInfoCollectResultDTO; import com.epmet.feign.GovOrgFeignClient; @@ -46,6 +47,11 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCommunityInfo",formDTO); } + @Override + public Result getGridInfoByGridName(GridInfoVaccinePrarmeterFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfoByGridName",formDTO); + } + @Override public Result getCommunityInfoByUserId(String userId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCommunityInfoByUserId",userId); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcVaccinePrarmeterRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcVaccinePrarmeterRedis.java new file mode 100644 index 0000000000..176cb28247 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcVaccinePrarmeterRedis.java @@ -0,0 +1,30 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 新冠病毒疫苗接种人员信息台账 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-22 + */ +@Component +public class IcVaccinePrarmeterRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java index 435b99f213..83b08d384e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java @@ -135,7 +135,7 @@ public class UserBaseInfoRedis { && StringUtils.isNotBlank(gridResult.getData().getBelongsGridName())){ String gridFullName = gridResult.getData().getBelongsGridName(); baseInfo.setRegisteredGridName(gridFullName); - StringBuffer buffer = new StringBuffer(gridFullName.split(ModuleConstant.DASH)[NumConstant.ONE]).append(ModuleConstant.DASH).append(baseInfo.getSurname()); + StringBuffer buffer = new StringBuffer(baseInfo.getSurname()); switch (baseInfo.getGender()) { case NumConstant.ONE_STR: buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_MALE); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java new file mode 100644 index 0000000000..1e0ad7162b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java @@ -0,0 +1,86 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.DataSyncConfigDTO; +import com.epmet.dto.form.ConfigSwitchFormDTO; +import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.dto.form.ScopeSaveFormDTO; +import com.epmet.entity.DataSyncConfigEntity; + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +public interface DataSyncConfigService extends BaseService { + + /** + * 单条查询 + * + * @param id + * @return DataSyncConfigDTO + * @author generator + * @date 2022-09-26 + */ + DataSyncConfigDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void save(DataSyncConfigDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void update(DataSyncConfigDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-09-26 + */ + void delete(String[] ids); + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + void configSwitch(ConfigSwitchFormDTO formDTO); + + /** + * Desc: 【数据配置】列表 + * @param tokenDto + * @author zxc + * @date 2022/9/26 15:04 + */ + PageData list(TokenDto tokenDto, PageFormDTO formDTO); + + /** + * Desc: 【数据配置】范围保存 + * @param formDTO + * @author zxc + * @date 2022/9/26 15:41 + */ + void scopeSave(ScopeSaveFormDTO formDTO); + + void natInfoScanTask(NatInfoScanTaskFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncScopeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncScopeService.java new file mode 100644 index 0000000000..d0588c10d9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncScopeService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.DataSyncScopeDTO; +import com.epmet.entity.DataSyncScopeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +public interface DataSyncScopeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-09-26 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-09-26 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DataSyncScopeDTO + * @author generator + * @date 2022-09-26 + */ + DataSyncScopeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void save(DataSyncScopeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void update(DataSyncScopeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-09-26 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java index 5391f1c1ae..8986660ec2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcEpidemicSpecialAttentionService.java @@ -8,6 +8,7 @@ import com.epmet.dto.form.AttentionDetailFormDTO; import com.epmet.dto.form.CancelAttentionPackageFormDTO; import com.epmet.dto.form.VaccinationAddFormDTO; import com.epmet.dto.form.VaccinationListFormDTO; +import com.epmet.dto.result.NatPieResultDTO; import com.epmet.dto.result.VaccinationListResultDTO; import com.epmet.entity.IcEpidemicSpecialAttentionEntity; @@ -90,6 +91,7 @@ public interface IcEpidemicSpecialAttentionService extends BaseService { + + /** + * 默认分页 + * + * @param formDTO + * @return PageData + * @author generator + * @date 2022-09-26 + */ + PageData page(IcNatCompareRecordPageFormDTO formDTO); + + void execAsyncExcelImport(Path fileSavePath, String taskId, String customerId, String userId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java index 9c65229972..9be6485b37 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.form.IcNoticeFormDTO; import com.epmet.dto.form.SendNoticeFormDTO; +import com.epmet.dto.form.SendNoticeV2FormDTO; import com.epmet.dto.form.SendPointNoticeFormDTO; import com.epmet.entity.IcNoticeEntity; @@ -115,4 +116,10 @@ public interface IcNoticeService extends BaseService { * @return */ Map getUserLatestNoticeTime(String customerId,List idCardSet); + + /** + * 行程上报、重点人群关注名单、疫苗接种关注名单这几个页面的发送通知 + * @param formDTO + */ + void sendNoticeV2(SendNoticeV2FormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointAppService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointAppService.java index 6d6f7626d9..f626bc4e01 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointAppService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointAppService.java @@ -1,18 +1,10 @@ package com.epmet.service; -import com.epmet.commons.mybatis.service.BaseService; -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.dto.IcPointNucleicMonitoringDTO; import com.epmet.dto.form.MapInfoFormDTO; import com.epmet.dto.result.MapInfoResultDTO; -import com.epmet.entity.IcPointNucleicMonitoringEntity; -import org.springframework.web.bind.annotation.RequestBody; -import java.io.InputStream; import java.util.List; -import java.util.Map; /** * 地图信息 @@ -29,5 +21,11 @@ public interface IcPointAppService { */ Result> getMapInfoByPointType(MapInfoFormDTO formDTO); - + /** + * Desc: 核酸监测点启用禁用 + * @param id + * @author zxc + * @date 2022/9/6 16:39 + */ + void enableOrDisabled(String id); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java index 8aaf21fe7d..3d862dd627 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java @@ -91,8 +91,8 @@ public interface IcPointNucleicMonitoringService extends BaseService getMapInfoList(MapInfoFormDTO formDTO); + + /** + * Desc: 核酸监测点启用禁用 + * @param id + * @author zxc + * @date 2022/9/6 16:39 + */ + void enableOrDisabled(String id); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectVisitorService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectVisitorService.java index 5f7f3e4d25..6b92a7b16b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectVisitorService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectVisitorService.java @@ -2,13 +2,15 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; 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.dto.IcResiCollectVisitorDTO; import com.epmet.dto.SaveCollectVisitorFormDTO; import com.epmet.dto.form.CollectDetailFormDTO; -import com.epmet.dto.form.CollectListFormDTO; import com.epmet.dto.form.VisitListFormDTO; -import com.epmet.dto.result.CollectListResultDTO; +import com.epmet.dto.form.VisitVisitorChartFormDTO; +import com.epmet.dto.form.VisitorInfoFormDTO; +import com.epmet.dto.result.VisitVisitorChartResultDTO; import com.epmet.entity.IcResiCollectVisitorEntity; import java.util.List; @@ -34,6 +36,7 @@ public interface IcResiCollectVisitorService extends BaseService getTraffic(VisitVisitorChartFormDTO dto); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java index 53f9bee81f..f67864cf82 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java @@ -2,8 +2,10 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.ExportResiUserFormDTO; +import com.github.pagehelper.Page; import javax.servlet.http.HttpServletResponse; +import java.util.Map; /** *@Description 居民信息导出service @@ -23,5 +25,5 @@ public interface IcResiUserExportService { * @author LiuJanJun * @date 2022/4/22 1:35 下午 */ - void exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response); + Page> exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response, boolean onlyGetData); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 37cf258e14..87dcd4cba3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -26,6 +26,7 @@ import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.entity.IcResiUserEntity; import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.resi.partymember.dto.partymember.IcPartyMemberDTO; @@ -505,4 +506,16 @@ public interface IcResiUserService extends BaseService { */ IcUserMatchGridResultDTO icUserMatchGrid(IcUserMatchGridFormDTO formDTO); + PageData listResiNonDynamic(Boolean fuzzy, String gridId, String name, String mobile, Integer pageNo, Integer pageSize); + + PageData icUserStatisList(UserChartFormDTO formDTO); + + /** + * 更新育龄妇女状态定时任务 + * @Param + * @Return + * @Author zhaoqifeng + * @Date 2022/9/8 15:45 + */ + void updateYlfn(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java index ce2747ddcd..2b164723f8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeDetailedService.java @@ -36,4 +36,6 @@ public interface IcUserChangeDetailedService extends BaseService icUserIds); + + int deleteByIcResiUserId(String icResiUserId,String currentStaffId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java index a75d3a1fe1..620c786e5f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcUserChangeRecordService.java @@ -54,4 +54,6 @@ public interface IcUserChangeRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-08-22 + */ + PageData page(Map params); + + /** + * 分页条件查询 + * @param params + * @return + */ + PageData getPhrasePage(Map params, TokenDto tokenDto); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-08-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcVaccinePrarmeterDTO + * @author generator + * @date 2022-08-22 + */ + IcVaccinePrarmeterDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-22 + */ + void save(IcVaccinePrarmeterDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-22 + */ + void update(IcVaccinePrarmeterDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-22 + */ + void delete(String[] ids); + + /** + * Desc: 【新冠病毒疫苗接种人员信息台账】导入 + * @param tokenDto + * @param inputStream + * @author wgf + * @date 2022/8/22 15:35 + */ + void importFile(TokenDto tokenDto, InputStream inputStream, String taskId); + + /** + * 新冠病毒疫苗接种人员信息台账审核 + * @param formDTO + * @return + */ + void vaccineCheck(IcVaccineCheckFormDTO formDTO, TokenDto tokenDto); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java index f66453c243..ccd55f362c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java @@ -24,11 +24,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.RegisterRelationDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.CommonUserIdFormDTO; +import com.epmet.dto.form.DingLoginResiFormDTO; import com.epmet.dto.form.VolunteerRegResiFormDTO; -import com.epmet.dto.result.CustomerUserDetailResultDTO; -import com.epmet.dto.result.ExtUserInfoResultDTO; -import com.epmet.dto.result.ResiUserBaseInfoResultDTO; -import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.UserBaseInfoEntity; import java.util.List; @@ -213,4 +211,13 @@ public interface UserBaseInfoService extends BaseService { * @Date 2022/6/15 16:09 */ ResiUserInfoCache getUserInfo(String userId); + + /** + * 钉钉用户注册 + * @Param formDTO + * @Return {@link DingLoginResiResDTO} + * @Author zhaoqifeng + * @Date 2022/9/15 11:17 + */ + DingLoginResiResDTO dingResiLogin(DingLoginResiFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java index 9e3a9f86fe..d29db102e1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.form.*; +import com.epmet.dto.result.DingAutoRegResDTO; import com.epmet.dto.result.IssueInitiatorResultDTO; import com.epmet.dto.result.StaffAndResiResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; @@ -213,4 +214,14 @@ public interface UserResiInfoService extends BaseService { */ List getStaffAndResi(List userIds); + /** + * 进入网格,自动注册居民 + * + * @Param userResiInfoDTO + * @Return + * @Author zhaoqifeng + * @Date 2022/9/14 14:19 + */ + DingAutoRegResDTO autoRegister(UserResiInfoDTO userResiInfoDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index bd9621bcfc..2a4585eb8a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -739,7 +739,16 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl staffInfoList = new ArrayList<>(); userIds.forEach(staffId -> { CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), staffId); - if (staffInfo == null) { - log.error("getStaffInfoList fail customerId:{}, staffId:{} not exist in db", formDTO.getCustomerId(), staffId); - return; + if (null != staffInfo) { + StaffSinGridResultDTO resultDTO = new StaffSinGridResultDTO(); + resultDTO.setStaffId(staffId); + resultDTO.setStaffName(staffInfo.getRealName()); + resultDTO.setHeadPhoto(staffInfo.getHeadPhoto()); + resultDTO.setGender(staffInfo.getGender()); + + List roleInfoList = new ArrayList<>(); + staffInfo.getRoleMap().forEach((key, value) -> { + RoleResultDTO dto = new RoleResultDTO(); + dto.setRoleKey(key); + dto.setRoleName(value); + roleInfoList.add(dto); + }); + resultDTO.setRoleList(roleInfoList); + staffInfoList.add(resultDTO); } - StaffSinGridResultDTO resultDTO = new StaffSinGridResultDTO(); - resultDTO.setStaffId(staffId); - resultDTO.setStaffName(staffInfo.getRealName()); - resultDTO.setHeadPhoto(staffInfo.getHeadPhoto()); - resultDTO.setGender(staffInfo.getGender()); - - List roleInfoList = new ArrayList<>(); - staffInfo.getRoleMap().forEach((key, value) -> { - RoleResultDTO dto = new RoleResultDTO(); - dto.setRoleKey(key); - dto.setRoleName(value); - roleInfoList.add(dto); - }); - resultDTO.setRoleList(roleInfoList); - staffInfoList.add(resultDTO); }); /*List staffInfoList = customerStaffDao.getStaffInfoList(userIds); @@ -990,6 +997,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl implements DataSyncConfigService { + + @Autowired + private DataSyncScopeService dataSyncScopeService; + @Autowired + private IcNatDao icNatDao; + @Autowired + private IcNatService icNatService; + @Autowired + private IcNatRelationService icNatRelationService; + + 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 DataSyncConfigDTO get(String id) { + DataSyncConfigEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DataSyncConfigDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DataSyncConfigDTO dto) { + DataSyncConfigEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncConfigEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DataSyncConfigDTO dto) { + DataSyncConfigEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncConfigEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void configSwitch(ConfigSwitchFormDTO formDTO) { + baseDao.configSwitch(formDTO); + } + + /** + * Desc: 【数据配置】列表 + * @param tokenDto + * @author zxc + * @date 2022/9/26 15:04 + */ + @Override + public PageData list(TokenDto tokenDto, PageFormDTO formDTO) { + PageData result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L); + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId())); + if (CollectionUtils.isNotEmpty(pageInfo.getList())){ + result.setList(pageInfo.getList()); + result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + } + return result; + } + + /** + * Desc: 【数据配置】范围保存 + * @param formDTO + * @author zxc + * @date 2022/9/26 15:41 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void scopeSave(ScopeSaveFormDTO formDTO) { + baseDao.delScope(formDTO.getDataSyncConfigId()); + if (CollectionUtils.isNotEmpty(formDTO.getScopeList())){ + formDTO.getScopeList().forEach(o -> { + o.setCustomerId(formDTO.getCustomerId()); + o.setDataSyncConfigId(formDTO.getDataSyncConfigId()); + if (o.getOrgType().equals("grid")){ + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(o.getOrgId()); + if (null == gridInfo){ + throw new EpmetException("查询网格信息失败"+o.getOrgId()); + } + o.setPid(gridInfo.getPid()); + o.setOrgIdPath(gridInfo.getPids() + ":" + gridInfo.getId()); + }else { + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(o.getOrgId()); + if (null == agencyInfo){ + throw new EpmetException("查询组织信息失败"+o.getOrgId()); + } + o.setPid(agencyInfo.getPid()); + o.setOrgIdPath(agencyInfo.getPids().equals(NumConstant.EMPTY_STR) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids() + ":" + agencyInfo.getId()); + } + }); + dataSyncScopeService.insertBatch(ConvertUtils.sourceToTarget(formDTO.getScopeList(), DataSyncScopeEntity.class)); + } + } + + /** + * Desc: + * 大数据局部门配置on + * 根据范围搜索居民,调接口查询最近一次核酸检测记录 + * 检测时间 + 身份证 不存在就插入 + * @param formDTO + * @author zxc + * @date 2022/9/26 17:16 + */ + @Override + public void natInfoScanTask(NatInfoScanTaskFormDTO formDTO) { + if (CollectionUtils.isNotEmpty(formDTO.getIdCards())){ + List userIdByIdCard = baseDao.getUserIdByIdCard(formDTO.getIdCards()); + List collect = formDTO.getIdCards().stream().map(id -> { + NatUserInfoResultDTO e = new NatUserInfoResultDTO(); + e.setIdCard(id); + e.setUserId(""); + return e; + }).collect(Collectors.toList()); + collect.forEach(c -> userIdByIdCard.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId()))); + hsjc(collect,formDTO.getCustomerId()); + return; + } + List allConfigList = baseDao.list(StringUtils.isNotBlank(formDTO.getCustomerId()) ? formDTO.getCustomerId() : null); + if (CollectionUtils.isEmpty(allConfigList)){ + return; + } + List configList = allConfigList.stream().filter(l -> l.getDeptCode().equals("dsjj") && l.getSwitchStatus().equals("open")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(configList)){ + configList.forEach(c -> { + if (CollectionUtils.isNotEmpty(c.getScopeList())){ + Integer no = NumConstant.ONE; + Integer size; + do { + PageInfo pageInfo = PageHelper.startPage(no, NumConstant.ONE_THOUSAND).doSelectPageInfo(() -> baseDao.getIdCardsByScope(c.getScopeList())); + size = pageInfo.getList().size(); + hsjc(pageInfo.getList(),c.getCustomerId()); + no++; + }while (size.compareTo(NumConstant.ONE_THOUSAND) == NumConstant.ZERO); + } + }); + } + } + + /** + * Desc: 根据证件号 查询nat 存在 ? 不处理 : 新增 + * @param idCards + * @param customerId + * @author zxc + * @date 2022/9/27 11:08 + */ + private void hsjc(List idCards,String customerId){ + if (CollectionUtils.isNotEmpty(idCards)){ + List entities = new ArrayList<>(); + idCards.forEach(idCard -> { + YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); + if (CollectionUtils.isNotEmpty(natInfoResult.getData())){ + natInfoResult.getData().forEach(natInfo -> { + IcNatEntity e = new IcNatEntity(); + e.setCustomerId(customerId); + e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); + e.setUserId(idCard.getUserId()); + e.setUserType("sync"); + e.setName(natInfo.getName()); + e.setMobile(natInfo.getTelephone()); + e.setIdCard(natInfo.getCard_no()); + e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(),DateUtils.DATE_TIME_PATTERN)); + e.setNatResult(natInfo.getSample_result_pcr()); + e.setNatAddress(natInfo.getSampling_org_pcr()); + e.setAgencyId(idCard.getAgencyId()); + e.setPids(idCard.getPids()); + entities.add(e); + }); + } + }); + if (CollectionUtils.isNotEmpty(entities)){ + List existNatInfos = icNatDao.getExistNatInfo(entities); + entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true))); + Map> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); + if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){ + icNatService.insertBatch(groupByStatus.get(false)); + } + //组织关系表 + List relationEntities = new ArrayList<>(); + entities.forEach(ne -> { + // 不是居民的先不加关系表吧 + if (ne.getIsResiUser().equals(NumConstant.ONE_STR)){ + IcNatRelationEntity e = new IcNatRelationEntity(); + e.setCustomerId(customerId); + e.setAgencyId(ne.getAgencyId()); + e.setPids(ne.getPids()); + e.setIcNatId(ne.getId()); + e.setUserType("sync"); + relationEntities.add(e); + } + }); + if (CollectionUtils.isNotEmpty(relationEntities)){ + icNatRelationService.insertBatch(relationEntities); + } + } + } + } +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncScopeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncScopeServiceImpl.java new file mode 100644 index 0000000000..4e6e0843d2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncScopeServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.DataSyncScopeDao; +import com.epmet.dto.DataSyncScopeDTO; +import com.epmet.entity.DataSyncScopeEntity; +import com.epmet.service.DataSyncScopeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Service +public class DataSyncScopeServiceImpl extends BaseServiceImpl implements DataSyncScopeService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DataSyncScopeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncScopeDTO.class); + } + + 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 DataSyncScopeDTO get(String id) { + DataSyncScopeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DataSyncScopeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DataSyncScopeDTO dto) { + DataSyncScopeEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncScopeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DataSyncScopeDTO dto) { + DataSyncScopeEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncScopeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java index 163d15c563..dc737eed05 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcBirthRecordServiceImpl.java @@ -5,14 +5,18 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; 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.GenderEnum; -import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; -import com.epmet.commons.tools.enums.RelationshipEnum; +import com.epmet.commons.tools.enums.*; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcBirthRecordDao; import com.epmet.dao.IcResiUserDao; @@ -26,6 +30,7 @@ import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.SyncResiResDTO; import com.epmet.entity.IcBirthRecordEntity; import com.epmet.entity.IcResiUserEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.ChangeWelfareService; import com.epmet.service.IcBirthRecordService; @@ -34,6 +39,7 @@ import com.epmet.service.IcUserTransferRecordService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; @@ -62,6 +68,8 @@ public class IcBirthRecordServiceImpl extends BaseServiceImpl page(BirthRecordFormDTO formDTO) { @@ -115,7 +123,24 @@ public class IcBirthRecordServiceImpl extends BaseServiceImpl> relationshipRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.RELATIONSHIP.getCode()); + if (relationshipRes.success() && MapUtils.isNotEmpty(relationshipRes.getData())) { + String householderRelationName = relationshipRes.getData().containsKey(recordDTO.getHouseholderRelation()) ? relationshipRes.getData().get(recordDTO.getHouseholderRelation()) : StrConstant.EPMETY_STR; + recordDTO.setHouseholderRelationName(householderRelationName); + } + return recordDTO; } @Override @@ -144,6 +169,15 @@ public class IcBirthRecordServiceImpl extends BaseServiceImpl page(Map params) { @@ -155,6 +162,9 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.natList(formDTO)); result.setList(pageInfo.getList()); @@ -164,6 +174,65 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl { + if (StringUtils.isNotBlank(r.getGridId())){ + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(r.getGridId()); + if (null == gridInfo){ + throw new EpmetException("查询网格失败:"+r.getGridId()); + } + r.setGridName(gridInfo.getGridNamePath()); + } + }); + } + } + if (CollectionUtils.isNotEmpty(result.getList())){ + result.getList().forEach(v -> { + v.setSex(); + }); + } + //需求调整 列表和导出增加所属房屋(小区+楼栋+单元+房间)一列值 sun + Map houseInfoMap = new HashMap<>(); + //查询房屋信息 + if (result.getList().size() > NumConstant.ZERO) { + Set houseIds = result.getList().stream().filter(l -> StringUtils.isNotBlank(l.getHomeId())).map(m -> m.getHomeId()).collect(Collectors.toSet()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); + List houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); + houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); + } + + int i = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + for (VaccinationListResultDTO v : result.getList()) { + i += 1; + v.setSort(i); + if (null != houseInfoMap && houseInfoMap.containsKey(v.getHomeId())) { + v.setVillageName(houseInfoMap.get(v.getHomeId()).getNeighborHoodName()); + v.setBuildName(houseInfoMap.get(v.getHomeId()).getBuildingName()); + v.setUnitName(houseInfoMap.get(v.getHomeId()).getUnitName()); + v.setHomeName(houseInfoMap.get(v.getHomeId()).getDoorName()); + v.setAllName(houseInfoMap.get(v.getHomeId()).getAllName()); + } + } + return result; + } + + @Override + public PageData historyList(VaccinationListFormDTO formDTO) { + PageData result = new PageData(new ArrayList(), NumConstant.ZERO_L); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到工作人员信息"+formDTO.getUserId()); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setIsHistory(NumConstant.ONE_STR); + if (formDTO.getIsPage()){ + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.natList(formDTO)); + result.setList(pageInfo.getList()); + result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + }else { + List list = baseDao.natList(formDTO); + result.setList(list); + result.setTotal(list.size()); } if (CollectionUtils.isNotEmpty(result.getList())){ result.getList().forEach(v -> { @@ -212,19 +281,26 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl entities = ConvertUtils.sourceToTarget(formDTO.getList(), IcEpidemicSpecialAttentionEntity.class); List idCards = entities.stream().map(m -> m.getIdCard()).collect(Collectors.toList()); Integer attentionType = entities.get(NumConstant.ZERO).getAttentionType(); List existList = baseDao.getExistList(attentionType, idCards); + List existsEntities = new ArrayList<>(); if (CollectionUtils.isNotEmpty(existList)){ for (String s : existList) { for (int i = NumConstant.ZERO; i < entities.size(); i++) { if (s.equals(entities.get(i).getIdCard())){ + existsEntities.add(entities.get(i)); entities.remove(i); continue; } } } + baseDao.addExistAttention(existsEntities,attentionType); } entities.forEach(e -> { e.setIsAttention(NumConstant.ONE); @@ -232,8 +308,10 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl w = new LambdaQueryWrapper<>(); IcEpidemicSpecialAttentionEntity e = new IcEpidemicSpecialAttentionEntity(); - w.eq(IcEpidemicSpecialAttentionEntity::getIdCard,formDTO.getIdCard()) + w.eq(IcEpidemicSpecialAttentionEntity::getId,formDTO.getId()) .eq(IcEpidemicSpecialAttentionEntity::getAttentionType,formDTO.getAttentionType()); e.setMobile(formDTO.getMobile()); e.setReason(formDTO.getReason()); e.setRemark(formDTO.getRemark()); + e.setIsolatedState(formDTO.getIsolatedState()); update(e,w); if (CollectionUtils.isNotEmpty(formDTO.getChannel())){ SendNoticeFormDTO dto = new SendNoticeFormDTO(); @@ -311,7 +390,6 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl errorInfo = new ArrayList<>(); - try { List list = ExcelPoiUtils.importExcel(inputStream, 0,1,ImportEpidemicSpecialAttention.class); if (CollectionUtils.isEmpty(list)){ @@ -336,7 +414,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl> isolatedState = epmetAdminOpenFeignClient.dictDataList("isolatedState"); + if (!isolatedState.success()){ + throw new EpmetException("查询字典表数据失败..."+"isolatedState"); + } + Map dictMap = isolatedState.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictLabel, SysDictDataDTO::getDictValue)); if (list.size() > errorInfo.size()){ - Map groupByIdCard = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getIdCard, Collectors.counting())); + Map groupByIdCard = list.stream().filter(l -> StringUtils.isNotBlank(l.getIdCard())).collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getIdCard, Collectors.counting())); groupByIdCard.forEach((idCard,count) -> { if (Integer.valueOf(count.toString()).compareTo(1) != 0){ for (ImportEpidemicSpecialAttention i : list) { @@ -359,6 +447,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl idCards = list.stream().map(m -> m.getIdCard()).collect(Collectors.toList()); + List existsEntities = new ArrayList<>(); List existList = baseDao.getExistList(attentionType, idCards); if (CollectionUtils.isNotEmpty(existList)){ for (String s : existList) { @@ -367,10 +456,17 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl> groupByStatus = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getAddStatus)); @@ -378,6 +474,9 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl entities = ConvertUtils.sourceToTarget(needInsert, IcEpidemicSpecialAttentionEntity.class); entities.forEach(e -> { + if (attentionType.compareTo(NumConstant.TWO) == NumConstant.ZERO){ + e.setIsolatedState(dictMap.get(e.getIsolatedState())); + } e.setIsAttention(NumConstant.ONE); e.setOrgId(agencyInfo.getId()); e.setPid(agencyInfo.getPid()); @@ -482,6 +581,41 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl> isolatedState = epmetAdminOpenFeignClient.dictDataList("isolatedState"); + if (!isolatedState.success()){ + throw new EpmetException("查询字典表数据失败..."+"isolatedState"); + } + List data = isolatedState.getData(); + if (CollectionUtils.isEmpty(data)){ + return result; + } + List conResult = new ArrayList<>(); + data.forEach(d -> { + NatPieResultDTO.IsolatedList dto = new NatPieResultDTO.IsolatedList(); + dto.setCategoryCode(d.getDictValue()); + dto.setCategoryName(d.getDictLabel()); + dto.setColor(NatPieColorEnum.getValueByKey(d.getDictValue())); + conResult.add(dto); + }); + List isolatedLists = baseDao.isolatedList(staffInfo.getAgencyId()); + conResult.forEach(c -> isolatedLists.stream().filter(i -> i.getCategoryCode().equals(c.getCategoryCode())).forEach(i -> c.setTotal(i.getTotal()))); + NatPieResultDTO.IsolatedList dto = new NatPieResultDTO.IsolatedList(); + dto.setCategoryCode(""); + dto.setCategoryName("历史关注人数"); + dto.setColor(NatPieColorEnum.getValueByKey(NumConstant.ONE_HUNDRED_STR)); + dto.setTotal(baseDao.getHistoryCount(staffInfo.getAgencyId())); + result.setIsolatedList(conResult); + result.setHistoryList(Arrays.asList(dto)); + return result; + } + /** * Desc: 文件上传并返回url * @param errorRows diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java index 02f9bbd2a6..b6776fb967 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; +import com.epmet.commons.tools.enums.IdCardTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; @@ -12,6 +13,7 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcMoveInRecordDao; import com.epmet.dto.ChangeWelfareDTO; @@ -168,6 +170,16 @@ public class IcMoveInRecordServiceImpl extends BaseServiceImpl implements IcNatCompareRecordService { + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private OssFeignClient ossFeignClient; + @Autowired + private IcNatCompareRecRelationDao icNatCompareRecRelationDao; + + private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (null == staffInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); + } + return staffInfo; + } + + + /** + * 列表分页查询 + * @param formDTO + * @return + */ + @Override + public PageData page(IcNatCompareRecordPageFormDTO formDTO) { + //1.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + //2.按条件查询业务数据 + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) + .doSelectPageInfo(() -> baseDao.pageList(formDTO)); + List list = data.getList(); + return new PageData(list, data.getTotal()); + } + + /** + * 未做核酸比对导入文件 + * @param filePath + * @param importTaskId + * @param customerId + * @param userId + */ + @Override + public void execAsyncExcelImport(Path filePath, String importTaskId, String customerId, String userId) { + try { + //获取当前登录用户所属组织id + CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId); + Date importTime=new Date(); + String importDate= DateUtils.format(importTime,DateUtils.DATE_PATTERN_YYYYMMDD); + IcNatCompareRecordExcelImportListener listener = new IcNatCompareRecordExcelImportListener(customerId, staffInfo, importDate, importTime, this); + + EasyExcel.read(filePath.toFile(), IcNatCompareRecordExcelData.class, listener).headRowNumber(1).sheet(0).doRead(); + + Path errorDescFile = null; + String errorDesFileUrl = null; + List errorRows = listener.getErrorRows(); + + boolean failed = errorRows.size() > 0; + if (failed) { + // 生成并上传错误文件 + try { + // 文件生成 + Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_nat_compare_record", "import", "error_des"); + String fileName = UUID.randomUUID().toString().concat(".xlsx"); + errorDescFile = errorDescDir.resolve(fileName); + + FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); + FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); + OutputStream os = fileItem.getOutputStream(); + + EasyExcel.write(os, IcNatCompareRecordExcelData.ErrorRow.class).sheet("导入失败列表").doWrite(errorRows); + + // 文件上传oss + Result errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); + if (errorDesFileUploadResult.success()) { + errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); + } + } finally { + if (Files.exists(errorDescFile)) { + Files.delete(errorDescFile); + } + } + } + + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); + importFinishTaskForm.setOperatorId(userId); + importFinishTaskForm.setResultDesc(""); + importFinishTaskForm.setResultDescFilePath(errorDesFileUrl); + + Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); + if (!result.success()) { + log.error("【未做核酸比对】finishImportTask失败"); + } + } catch (Exception e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【未做核酸比对】出错:{}", errorMsg); + + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + importFinishTaskForm.setOperatorId(userId); + importFinishTaskForm.setResultDesc("导入失败"); + + Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); + if (!result.success()) { + log.error("【未做核酸比对】导入记录状态修改为'完成'失败"); + } + } finally { + // 删除临时文件 + if (Files.exists(filePath)) { + try { + Files.delete(filePath); + } catch (IOException e) { + log.error("method exception", e); + } + } + } + + } + + + /** + * + * @param datas + * @param staffInfo 当前操作人 + * @param importDate yyyyMMdd + * @param importTime 导入时间yyyy-MM-dd HH:mm:ss + * @param listener + */ + public void batchPersist(List datas,CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime, IcNatCompareRecordExcelImportListener listener) { + datas.forEach(entity -> { + try { + persisNat(entity, staffInfo,importDate,importTime); + } catch (Exception exception) { + String errorMsg = ExceptionUtils.getErrorStackTrace(exception); + log.error(errorMsg); + + IcNatCompareRecordExcelData.ErrorRow errorRow = new IcNatCompareRecordExcelData.ErrorRow(); + errorRow.setName(entity.getName()); + errorRow.setMobile(entity.getMobile()); + errorRow.setIdCard(entity.getIdCard()); + errorRow.setErrorInfo("batchPersist未知系统错误"); + listener.getErrorRows().add(errorRow); + } + }); + } + + + /** + * + * @param data + * @param staffInfo 当前操作人 + * @param importDate yyyyMMdd + * @param importTime 导入时间yyyy-MM-dd HH:mm:ss + */ + @Transactional(rollbackFor = Exception.class) + public void persisNat(IcNatCompareRecordEntity data, CustomerStaffInfoCacheResult staffInfo, String importDate, Date importTime) { + // 查询是否本辖区居民 + IcResiUserDTO icResiUserDTO = SpringContextUtils.getBean(IcResiUserService.class).getByIdCard(data.getCustomerId(), data.getIdCard(), null); + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + //根据身份证号判断是否存在基础信息 + IcNatCompareRecordEntity existEntity=baseDao.selectByIdCard(data.getCustomerId(),data.getIdCard()); + if (null == existEntity) { + // 1、不存在该身份证的基础记录,直接插入ic_nat_compare_record 、ic_nat_compare_rec_relation 插入记录 + IcNatCompareRecordEntity compareRecordEntity = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); + compareRecordEntity.setIcResiUserId(null == icResiUserDTO ? StrConstant.EPMETY_STR : icResiUserDTO.getId()); + // 是否客户下居民(0:否 1:是) + compareRecordEntity.setIsResiUser(StringUtils.isNotBlank(compareRecordEntity.getIcResiUserId()) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); + compareRecordEntity.setLatestImportTime(importTime); + //插入基础信息 + insert(compareRecordEntity); + + IcNatCompareRecRelationEntity relationEntity = new IcNatCompareRecRelationEntity(); + relationEntity.setCustomerId(data.getCustomerId()); + relationEntity.setCompareRecId(compareRecordEntity.getId()); + relationEntity.setImportDate(importDate); + relationEntity.setImportTime(importTime); + relationEntity.setAgencyId(staffInfo.getAgencyId()); + relationEntity.setAgencyName(staffInfo.getAgencyName()); + relationEntity.setStaffId(staffInfo.getStaffId()); + relationEntity.setStaffName(staffInfo.getRealName()); + if (null != agencyInfoCache) { + relationEntity.setPid(agencyInfoCache.getPid()); + relationEntity.setPids(agencyInfoCache.getPids()); + } + // 是否本社区(agency_id)下居民(0:否 1:是) + if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { + relationEntity.setIsAgencyUser(NumConstant.ONE_STR); + } else { + relationEntity.setIsAgencyUser(NumConstant.ZERO_STR); + } + //插入关系表 + icNatCompareRecRelationDao.insert(relationEntity); + } else { + IcNatCompareRecordEntity origin = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); + origin.setId(existEntity.getId()); + origin.setIcResiUserId(null == icResiUserDTO ? StrConstant.EPMETY_STR : icResiUserDTO.getId()); + // 是否客户下居民(0:否 1:是) + origin.setIsResiUser(StringUtils.isNotBlank(origin.getIcResiUserId()) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); + origin.setLatestImportTime(importTime); + baseDao.updateById(origin); + IcNatCompareRecRelationEntity existRelationEntity=icNatCompareRecRelationDao.selectExist(data.getCustomerId(),origin.getId(),staffInfo.getAgencyId(),importDate); + if(null!=existRelationEntity){ + // 是否本社区(agency_id)下居民(0:否 1:是) + if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { + existRelationEntity.setIsAgencyUser(NumConstant.ONE_STR); + } else { + existRelationEntity.setIsAgencyUser(NumConstant.ZERO_STR); + } + //记录最后一次导入时间、最近一次操作人id,最近一次操作人姓名 + existRelationEntity.setImportTime(importTime); + existRelationEntity.setStaffId(staffInfo.getStaffId()); + existRelationEntity.setStaffName(staffInfo.getRealName()); + existRelationEntity.setAgencyName(staffInfo.getAgencyName()); + icNatCompareRecRelationDao.updateById(existRelationEntity); + }else{ + IcNatCompareRecRelationEntity relationEntity = new IcNatCompareRecRelationEntity(); + relationEntity.setCustomerId(data.getCustomerId()); + relationEntity.setCompareRecId(origin.getId()); + relationEntity.setImportDate(importDate); + relationEntity.setImportTime(importTime); + relationEntity.setAgencyId(staffInfo.getAgencyId()); + relationEntity.setAgencyName(staffInfo.getAgencyName()); + relationEntity.setStaffId(staffInfo.getStaffId()); + relationEntity.setStaffName(staffInfo.getRealName()); + if (null != agencyInfoCache) { + relationEntity.setPid(agencyInfoCache.getPid()); + relationEntity.setPids(agencyInfoCache.getPids()); + } + // 是否本社区(agency_id)下居民(0:否 1:是) + if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { + relationEntity.setIsAgencyUser(NumConstant.ONE_STR); + } else { + relationEntity.setIsAgencyUser(NumConstant.ZERO_STR); + } + //插入关系表 + icNatCompareRecRelationDao.insert(relationEntity); + } + } + + } + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java index 1abb00b5f3..1d2af49a28 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java @@ -7,17 +7,23 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.*; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.ChannelEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +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.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserMessageTypeConstant; +import com.epmet.dao.IcEpidemicSpecialAttentionDao; import com.epmet.dao.IcNoticeDao; +import com.epmet.dao.IcTripReportRecordDao; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.*; +import com.epmet.entity.IcEpidemicSpecialAttentionEntity; import com.epmet.entity.IcNoticeEntity; +import com.epmet.entity.IcTripReportRecordEntity; import com.epmet.feign.MessageFeignClient; import com.epmet.service.IcNoticeService; import com.epmet.service.UserBaseInfoService; @@ -26,6 +32,7 @@ import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -47,6 +54,10 @@ public class IcNoticeServiceImpl extends BaseServiceImpl page(IcNoticeFormDTO formDTO) { @@ -144,9 +155,11 @@ public class IcNoticeServiceImpl extends BaseServiceImpl { if (StringUtils.isNotBlank(item.getIdCard())) { - //根据身份证获取居民ID + //根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个 List userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard()); if (CollectionUtils.isNotEmpty(userList)) { - userList.forEach(user -> { + // userList.forEach(user -> { + UserBaseInfoDTO userBaseInfoDTO=userList.get(NumConstant.ZERO); UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); messageFormDTO.setCustomerId(item.getCustomerId()); messageFormDTO.setApp(AppClientConstant.APP_GOV); messageFormDTO.setGridId(StrConstant.STAR); - messageFormDTO.setUserId(user.getUserId()); + messageFormDTO.setUserId(userBaseInfoDTO.getUserId()); messageFormDTO.setTitle("您有一条通知消息!"); messageFormDTO.setMessageContent(item.getContent()); messageFormDTO.setReadFlag(Constant.UNREAD); messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); messageFormDTO.setTargetId(item.getId()); msgList.add(messageFormDTO); - }); + item.setUserId(userBaseInfoDTO.getUserId()); + // }); + }else{ + // 没有找到居民端的用户id,发送失败 + item.setSendRes(NumConstant.ZERO_STR); } + baseDao.updateById(item); } //TODO 短信消息 - if (StringUtils.isNotBlank(item.getMobile())) { + /*if (StringUtils.isNotBlank(item.getMobile())) { ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); sms.setCustomerId(item.getCustomerId()); sms.setMobile(item.getMobile()); sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_OVERDUE); sms.setParameterKey("send_msg"); smsList.add(sms); - } + }*/ }); //发送小程序消息 Result result = messageFeignClient.saveUserMessageList(msgList); if (!result.success()) { log.error("发送小程序消息失败" + JSON.toJSONString(result)); } - //TODO 发送短信 } /** @@ -326,4 +344,102 @@ public class IcNoticeServiceImpl extends BaseServiceImpl userBeanList = null; + List entityList = new ArrayList<>(); + for (String bdId : formDTO.getBdIds()) { + IcNoticeEntity entity = new IcNoticeEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setChannel(channel); + entity.setContent(formDTO.getContent()); + entity.setOrigin(formDTO.getOrigin()); + // 这时候还不知道居民端的用户id + entity.setUserId(StrConstant.EPMETY_STR); + entity.setOrgName(finalOrgName); + // 发送结果:1成功,0失败 默认插入发送成功。下面没有找到居民端的用户id,会更新 + entity.setSendRes(NumConstant.ONE_STR); + // v2:0行程上报,1疫苗接种关注名单,2隔离防疫原核酸检测 + // 身份证号手机号 + if (NumConstant.ZERO_STR.equals(formDTO.getOrigin())) { + IcTripReportRecordEntity icTripReportRecordEntity = icTripReportRecordDao.selectById(bdId); + if(null==icTripReportRecordEntity){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "ic_trip_report_record不存在id=" + bdId + "的记录", "获取身份证手机号为空"); + } + entity.setMobile(icTripReportRecordEntity.getMobile()); + entity.setIdCard(icTripReportRecordEntity.getIdCard()); + } else if (NumConstant.ONE_STR.equals(formDTO.getOrigin()) || NumConstant.TWO_STR.equals(formDTO.getOrigin())) { + IcEpidemicSpecialAttentionEntity icEpidemicSpecialAttentionEntity = icEpidemicSpecialAttentionDao.selectById(bdId); + if (null == icEpidemicSpecialAttentionEntity) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "ic_epidemic_special_attention不存在id=" + bdId + "的记录", "获取身份证手机号为空"); + } + entity.setMobile(icEpidemicSpecialAttentionEntity.getMobile()); + entity.setIdCard(icEpidemicSpecialAttentionEntity.getIdCard()); + } + entityList.add(entity); + } + if (CollectionUtils.isEmpty(entityList)) { + return; + } + insertBatch(entityList); + + // 通知渠道通知渠道 0小程序通知,1短信通知 + for (String channelValue : formDTO.getChannel()) { + if ("0".equals(channelValue)) { + // 小程序通知 + List msgList = new ArrayList<>(); + entityList.forEach(item -> { + // 根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个 + List userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard()); + if (CollectionUtils.isNotEmpty(userList)) { + UserBaseInfoDTO userBaseInfoDTO = userList.get(NumConstant.ZERO); + UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); + messageFormDTO.setCustomerId(item.getCustomerId()); + messageFormDTO.setApp(AppClientConstant.APP_GOV); + messageFormDTO.setGridId(StrConstant.STAR); + messageFormDTO.setUserId(userBaseInfoDTO.getUserId()); + messageFormDTO.setTitle("您有一条通知消息!"); + messageFormDTO.setMessageContent(item.getContent()); + messageFormDTO.setReadFlag(Constant.UNREAD); + messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); + messageFormDTO.setTargetId(item.getId()); + msgList.add(messageFormDTO); + item.setUserId(userBaseInfoDTO.getUserId()); + } else { + // 没有找到居民端的用户id,发送失败 + item.setSendRes(NumConstant.ZERO_STR); + } + baseDao.updateById(item); + }); + // 发送小程序消息-站内信 + Result result = messageFeignClient.saveUserMessageList(msgList); + if (!result.success()) { + log.warn("发送小程序消息失败" + JSON.toJSONString(result)); + } + } else { + // 短信通知再说 todo + } + + + } + + + } + + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointAppServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointAppServiceImpl.java index 7927aea977..16d73ed457 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointAppServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointAppServiceImpl.java @@ -1,58 +1,17 @@ package com.epmet.service.impl; -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -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.ExcelPoiUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.constants.ImportTaskConstants; -import com.epmet.dao.IcPointVaccinesInoculationDao; -import com.epmet.dto.IcPointVaccinesInoculationDTO; -import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.MapInfoFormDTO; import com.epmet.dto.result.MapInfoResultDTO; -import com.epmet.dto.result.UploadImgResultDTO; -import com.epmet.entity.IcPointVaccinesInoculationEntity; -import com.epmet.excel.IcPointVaccinesInoculationImportExcel; -import com.epmet.excel.error.PointVaccinesInoculationErrorModel; -import com.epmet.feign.EpmetCommonServiceOpenFeignClient; -import com.epmet.feign.GovOrgFeignClient; -import com.epmet.feign.OssFeignClient; -import com.epmet.redis.IcPointVaccinesInoculationRedis; import com.epmet.service.IcPointAppService; import com.epmet.service.IcPointNucleicMonitoringService; import com.epmet.service.IcPointVaccinesInoculationService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.entity.ContentType; -import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; 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.stream.Collectors; +import java.util.ArrayList; +import java.util.List; /** * 地图信息 @@ -85,4 +44,15 @@ public class IcPointAppServiceImpl implements IcPointAppService { } return new Result>().ok(mapInfoResultDTO); } + + /** + * Desc: 核酸监测点启用禁用 + * @param id + * @author zxc + * @date 2022/9/6 16:39 + */ + @Override + public void enableOrDisabled(String id) { + icPointNucleicMonitoringService.enableOrDisabled(id); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointNucleicMonitoringServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointNucleicMonitoringServiceImpl.java index cb2b516b13..df2214249c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointNucleicMonitoringServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcPointNucleicMonitoringServiceImpl.java @@ -5,7 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -16,7 +16,6 @@ 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.constant.FieldConstant; import com.epmet.commons.tools.utils.ExcelPoiUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constants.ImportTaskConstants; @@ -28,10 +27,8 @@ import com.epmet.dto.form.OrgInfoPointFormDTO; import com.epmet.dto.result.CommunityInfoResultDTO; import com.epmet.dto.result.MapInfoResultDTO; import com.epmet.dto.result.UploadImgResultDTO; -import com.epmet.entity.IcEpidemicSpecialAttentionEntity; import com.epmet.entity.IcPointNucleicMonitoringEntity; import com.epmet.excel.IcPointNucleicMonitoringImportExcel; -import com.epmet.excel.error.EpidemicSpecialAttentionErrorModel; import com.epmet.excel.error.PointNucleicMonitoringErrorModel; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.GovOrgFeignClient; @@ -373,5 +370,17 @@ public class IcPointNucleicMonitoringServiceImpl extends BaseServiceImpl newMemberList = ConvertUtils.sourceToTarget(formDTO.getMemberList(), IcResiMemberEntity.class); @@ -183,6 +186,26 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl memMap = queryOriginMem(collectInfo.getId()); saveOrUpdateMem(newMemberList, memMap,collectInfo); } + + // 如果是顺德居小区的人还要下放门禁 + if (formDTO.getVillageName().contains("顺德居")) { + try { + formDTO.getMemberList().forEach(item -> { + if (StringUtils.isNotBlank(item.getFaceImg())) { + VisitVisitorFormDTO visitor = new VisitVisitorFormDTO(); + visitor.setIdCard(item.getIdNum()); + visitor.setMobile(item.getMobile()); + visitor.setName(item.getName()); + visitor.setFaceImg(item.getFaceImg()); + dhDeviceUtil.sendAuth(visitor); + } + }); + return new Result().ok("今日您可通过人脸设备便捷出入小区,明天及后续进入请再次登记,谢谢!"); + } catch (Exception e) { + return new Result().ok("访客信息登记成功"); + } + } + return new Result().ok("提交成功"); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java index ccb7451952..34c56f8928 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectVisitorServiceImpl.java @@ -8,19 +8,20 @@ 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.dto.TokenDto; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcResiCollectVisitorDao; import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.IcResiCollectVisitorDTO; import com.epmet.dto.SaveCollectVisitorFormDTO; -import com.epmet.dto.form.CollectDetailFormDTO; -import com.epmet.dto.form.CollectListFormDTO; -import com.epmet.dto.form.VisitListFormDTO; -import com.epmet.dto.result.CollectListResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.VisitVisitorChartResultDTO; import com.epmet.entity.IcResiCollectVisitorEntity; import com.epmet.redis.IcResiCollectVisitorRedis; import com.epmet.service.IcResiCollectVisitorService; +import com.epmet.util.dh.DhDeviceUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; @@ -28,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -48,6 +50,12 @@ public class IcResiCollectVisitorServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -59,11 +67,13 @@ public class IcResiCollectVisitorServiceImpl extends BaseServiceImpl getPhrasePage(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); IPage page = getPage(params); List list = baseDao.getPhrasePage(params); return new PageData<>(list, page.getTotal()); @@ -71,6 +81,7 @@ public class IcResiCollectVisitorServiceImpl extends BaseServiceImpl getVisitorList(VisitListFormDTO formDTO) { PageData result = new PageData<>(new ArrayList<>(), 0); - if (StringUtils.isBlank(formDTO.getStartTime()) && StringUtils.isBlank(formDTO.getEndTime()) ){ + if (StringUtils.isBlank(formDTO.getStartTime()) && StringUtils.isBlank(formDTO.getEndTime())) { CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); - if (null == staffInfo){ - throw new EpmetException("查询人员信息失败"+formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException("查询人员信息失败" + formDTO.getUserId()); } formDTO.setOrgId(staffInfo.getAgencyId()); } @@ -98,8 +109,8 @@ public class IcResiCollectVisitorServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + 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); @@ -146,6 +157,21 @@ public class IcResiCollectVisitorServiceImpl extends BaseServiceImpl getTraffic(VisitVisitorChartFormDTO dto) { + if (StringUtils.isBlank(dto.getDate())) { + dto.setDate(LocalDate.now().toString()); + } + return baseDao.getTraffic(dto); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index a5ff0484c8..b0b9a12f77 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -31,6 +31,7 @@ import com.epmet.constant.IcResiUserConstant; import com.epmet.dto.form.ExportResiUserFormDTO; import com.epmet.dto.form.IcExportTemplateQueryFormDTO; import com.epmet.dto.form.IcResiUserPageFormDTO; +import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.result.FormItemResult; import com.epmet.dto.result.IcCustomExportResultDTO; import com.epmet.dto.result.OptionDTO; @@ -45,6 +46,7 @@ import com.google.common.base.Joiner; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.VerticalAlignment; @@ -91,7 +93,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { * @date 2022/4/22 1:35 下午 */ @Override - public void exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response) { + public Page> exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response, boolean onlyGetData) { + Page> mapListPage = null; + //校验参数 this.validateSearchForm(tokenDto, exportResiUserFormDTO); IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); @@ -99,9 +103,11 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { String templateId = exportResiUserFormDTO.getTemplateId(); ExcelWriter excelWriter = null; + WriteSheet writeSheet = null; try { + String dynamicCustomerId=StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId()) ? exportResiUserFormDTO.getCustomerId() : tokenDto.getCustomerId(); //获取用户配置的导出条件 - Result exportConfigResult = this.getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); + Result exportConfigResult = this.getIcCustomExportConfig(dynamicCustomerId, templateId, exportResiUserFormDTO.getExportConfig()); Map itemOriginMap = getItemMap(searchForm.getCustomerId()); IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); @@ -114,36 +120,42 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { List allShowColumns = new ArrayList<>(exportConfigData.getShowSqlColumns()); - //需要合并的列 - List mergeColumnIndexList = new ArrayList<>(); - for (int i = 0; i < allShowColumns.size(); i++) { - IcCustomExportResultDTO.SqlColumn sqlColumn = allShowColumns.get(i); - if (!sqlColumn.getManyToOne()) { - mergeColumnIndexList.add(i); + + + if (!onlyGetData){ + searchForm.setIsPage(false); + searchForm.setPageSize(NumConstant.TEN_THOUSAND); + + //需要合并的列 + List mergeColumnIndexList = new ArrayList<>(); + for (int i = 0; i < allShowColumns.size(); i++) { + IcCustomExportResultDTO.SqlColumn sqlColumn = allShowColumns.get(i); + if (!sqlColumn.getManyToOne()) { + mergeColumnIndexList.add(i); + } } - } + int[] mergeColumnIndex = mergeColumnIndexList.stream().filter(Objects::nonNull).mapToInt(i -> i).toArray(); + // 从那一列开始合并 + int mergeRowIndex = exportConfigData.getHeaderRow(); - int[] mergeColumnIndex = mergeColumnIndexList.stream().filter(Objects::nonNull).mapToInt(i -> i).toArray(); - // 从那一列开始合并 - int mergeRowIndex = exportConfigData.getHeaderRow(); - - // 头的策略 - WriteCellStyle headWriteCellStyle = new WriteCellStyle(); - // 背景设置为红色 - headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); - WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); - contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); - HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); - FreezeAndFilter writeHandler = new FreezeAndFilter(); - //从第几行开始冻结 - writeHandler.rowSplit = exportConfigData.getHeaderRow(); - excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)) - .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)) - .registerWriteHandler(horizontalCellStyleStrategy) - .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) - .registerWriteHandler(writeHandler).build(); - - WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").head(exportConfigData.getHeaders()).build(); + // 头的策略 + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); + // 背景设置为红色 + headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); + FreezeAndFilter writeHandler = new FreezeAndFilter(); + //从第几行开始冻结 + writeHandler.rowSplit = exportConfigData.getHeaderRow(); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)) + .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)) + .registerWriteHandler(horizontalCellStyleStrategy) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .registerWriteHandler(writeHandler).build(); + + writeSheet = EasyExcel.writerSheet("Sheet1").head(exportConfigData.getHeaders()).build(); + } String staffOrgPath = null; if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { @@ -151,15 +163,31 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { } else { staffOrgPath = staffInfoCacheResult.getAgencyId(); } - Page> mapListPage = null; allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); do { + if(StringUtils.isNotBlank(exportResiUserFormDTO.getId())){ + ResiUserQueryValueDTO idCondition=new ResiUserQueryValueDTO(); + idCondition.setTableName("ic_resi_user"); + idCondition.setQueryType("equal"); + idCondition.setColumnName("ID"); + idCondition.setColumnValue(Arrays.asList(exportResiUserFormDTO.getId())); + + if(CollectionUtils.isNotEmpty(searchForm.getConditions())){ + searchForm.getConditions().add(idCondition); + }else{ + List conditions=new ArrayList<>(); + conditions.add(idCondition); + searchForm.setConditions(conditions); + } + } String finalStaffOrgPath = staffOrgPath; mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); }); - searchForm.setPageNo(searchForm.getPageNo() + NumConstant.ONE); + if (!searchForm.getIsPage()){ + searchForm.setPageNo(searchForm.getPageNo() + NumConstant.ONE); + } List> result = mapListPage.getResult(); @@ -168,46 +196,12 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { List showSqlColumns = exportConfigData.getShowSqlColumns(); Set hiddenColumnSet = exportConfigData.getHiddenSqlColumns().stream().map(IcCustomExportResultDTO.SqlColumn::getColumnName).collect(Collectors.toSet()); result.forEach(o -> { - List singleRowData = new ArrayList<>(); - Map originalConditionMap = new ConcurrentHashMap<>(); - o.forEach((key, value) -> { - Map itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); - IcCustomExportResultDTO.SqlColumn columnDTO = itemMap.get(key); - //忽略 不需要显示的列的值得设置 要不然数据会写入到excel中 - if (singleRowData.size() >= showSqlColumns.size()) { - return; - } - - IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); - String tableName = sqlColumn.getTableName(); - String itemId = sqlColumn.getItemId(); - String columnName = columnDTO.getColumnName(); - if (hiddenColumnSet.contains(columnName)) { - return; - } - String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); - //保留原始值 便于remote条件获取 - originalConditionMap.putIfAbsent(columnName, vauleStr); - ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); - FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); - - String newValue = vauleStr; - - if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { - putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); - newValue = String.valueOf(o.get(columnName)); - } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { - newValue = putOptionValue(formItemResult, vauleStr); - } - if (FieldConstant.ID.equals(key)) { - newValue = Md5Util.md5(vauleStr); - } - singleRowData.add(newValue); - }); - resultData.add(singleRowData); + getDataForResi(itemOriginMap, staffInfoCacheResult, resultData, showSqlColumns, hiddenColumnSet, o); }); - excelWriter.write(resultData, writeSheet); - } while (mapListPage.getResult().size() == searchForm.getPageSize()); + if (!onlyGetData){ + excelWriter.write(resultData, writeSheet); + } + } while (!searchForm.getIsPage() && mapListPage.getResult().size() == searchForm.getPageSize()); } catch (IOException e) { log.error("exportIcResiUser exception", e); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMessage(), "导出失败"); @@ -216,6 +210,48 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { excelWriter.finish(); } } + return mapListPage; + } + + private void getDataForResi(Map itemOriginMap, CustomerStaffInfoCacheResult staffInfoCacheResult, List> resultData, List showSqlColumns, Set hiddenColumnSet, Map o) { + List singleRowData = new ArrayList<>(); + Map originalConditionMap = new ConcurrentHashMap<>(); + o.forEach((key, value) -> { + Map itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); + IcCustomExportResultDTO.SqlColumn columnDTO = itemMap.get(key); + //忽略 不需要显示的列的值得设置 要不然数据会写入到excel中 + if (singleRowData.size() >= showSqlColumns.size()) { + return; + } + + IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); + String tableName = sqlColumn.getTableName(); + String itemId = sqlColumn.getItemId(); + String columnName = columnDTO.getColumnName(); + if (hiddenColumnSet.contains(columnName)) { + return; + } + String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); + //保留原始值 便于remote条件获取 + originalConditionMap.putIfAbsent(columnName, vauleStr); + ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); + FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); + + String newValue = vauleStr; + + if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { + putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); + newValue = String.valueOf(o.get(columnName)); + } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { + newValue = putOptionValue(formItemResult, vauleStr); + } + o.put(key,newValue); + if (FieldConstant.ID.equals(key)) { + newValue = Md5Util.md5(vauleStr); + } + singleRowData.add(newValue); + }); + resultData.add(singleRowData); } /** @@ -229,8 +265,6 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { searchForm.setCustomerId(tokenDto.getCustomerId()); searchForm.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(searchForm, IcResiUserPageFormDTO.AddUserInternalGroup.class); - searchForm.setIsPage(false); - searchForm.setPageSize(NumConstant.TEN_THOUSAND); } @Nullable @@ -242,7 +276,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { param.setExportConfig(exportConfig); Result exportConfigResult = operCustomizeOpenFeignClient.getExcelHeaderAndSqlColumnForExport(param); if (!exportConfigResult.success()) { - log.error("获取模板失败,internalMsg:{},msg:{}", exportConfigResult.getInternalMsg(), exportConfigResult.getMsg()); + log.error("/oper/customize/icExportTemplate/getExcelHeaderAndSqlColumnForExport获取模板失败,入参{},internalMsg:{},msg:{}", JSON.toJSONString(param), exportConfigResult.getInternalMsg(), exportConfigResult.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), exportConfigResult.getInternalMsg(), exportConfigResult.getInternalMsg()); } IcCustomExportResultDTO data = exportConfigResult.getData(); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index 7f8921443f..2a57869b36 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -18,6 +18,7 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum; +import com.epmet.commons.tools.enums.IdCardTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -89,15 +90,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res public static final List controlGroup1 = Arrays.asList("input", "textarea", "datepicker", "daterange"); public static final List controlGroup2 = Arrays.asList("select", "radio", "cascader"); - /** - * 15位身份证号的正则表达式 - */ - private final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?\\d{2})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)$"); - /** - * 18位身份证号的正则表达式 - */ - private final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?\\d{4})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)[0-9a-xA-X]$"); - /** * 日期解析,不含时间 */ @@ -233,7 +225,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res private String tableName; - @Excel(name = "身份证号", width = 40) + @Excel(name = "证件号", width = 40) private String idCard; @Excel(name = "姓名", width = 25) @@ -623,14 +615,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res if (StringUtils.isBlank(idCard)) { log.debug("【居民信息导入】specifiedCheck身份证号为空的:{},{}", mobile, name); - String errorMsg = "身份证号不能为空"; + String errorMsg = "证件号不能为空"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } - if (idCard.length() != 18 && idCard.length() != 15) { - errors.add("身份证号长度错误"); - } - if (StringUtils.isNotBlank(mobile) && mobile.length() > 15) { errors.add("手机号长度错误"); } @@ -642,52 +630,48 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } // ================== 数据补充 =================== - String year; - String month; - String day; - String sex; + IdCardRegexUtils regexUtilInstance = IdCardRegexUtils.parse(idCard); + if (regexUtilInstance == null) { + String s = "证件号解析错误,或不支持的证件类型。(请使用身份证号或者护照号)"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); + } - if (idCard.length() == 15) { - Matcher matcher = PATTERN_15_ID.matcher(idCard); - if (matcher.matches()) { - year = "19".concat(matcher.group("year")); - month = matcher.group("month"); - day = matcher.group("day"); - sex = matcher.group("sex"); - } else { - String s = "身份证号解析错误"; - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); - } - } else if (idCard.length() == 18) { - Matcher matcher = PATTERN_18_ID.matcher(idCard); - if (matcher.matches()) { - year = matcher.group("year"); - month = matcher.group("month"); - day = matcher.group("day"); - sex = matcher.group("sex"); - } else { - String s = "身份证号解析错误"; - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); - } - } else { - String s = "身份证号位数错误"; + IdCardTypeEnum idCardType = regexUtilInstance.getTypeEnum(); + + if (idCardType == null || IdCardTypeEnum.OTHERS == idCardType) { + String s = "证件号解析错误,或不支持的证件类型。(请使用身份证号或者护照号)"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); } - // 出生日期 & 年龄 - LocalDate birthday = null; - try { - birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); - } catch (DateTimeException e) { - throw new EpmetException("身份证号中日期信息错误"); + IdCardRegexUtils.ParsedContent parsedResult = regexUtilInstance.getParsedResult(); + String year = null, month = null, day = null, sex = null; + if (parsedResult != null) { + year = parsedResult.getBirthdayYear(); + month = parsedResult.getBirthdayMonth(); + day = parsedResult.getBirthdayDay(); + sex = parsedResult.getSex(); } - int age = Period.between(birthday, LocalDate.now()).getYears(); - // 性别 & 生日 & 老年人 - Boolean isMale = (Integer.parseInt(sex) % 2) == 1; - columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month,day))); - columnAndValues.put("GENDER", isMale ? "1" : "2"); - columnAndValues.put("IS_OLD_PEOPLE", age >= 60 ? "1" : "0"); + // 存储证件类型 + columnAndValues.put("ID_CARD_TYPE", idCardType.getType()); + + if (idCardType == IdCardTypeEnum.SFZH) { + //只有证件类型是身份证号才做相关解析 + // 出生日期 & 年龄 + LocalDate birthday = null; + try { + birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); + } catch (DateTimeException e) { + throw new EpmetException("身份证号中日期信息错误"); + } + int age = Period.between(birthday, LocalDate.now()).getYears(); + + // 性别 & 生日 & 老年人 + Boolean isMale = (Integer.parseInt(sex) % 2) == 1; + columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month, day))); + columnAndValues.put("GENDER", isMale ? "1" : "2"); + columnAndValues.put("IS_OLD_PEOPLE", age >= 60 ? "1" : "0"); + } } /** 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 f0fcfceefc..ec9bf3043c 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 @@ -53,16 +53,14 @@ import com.epmet.commons.tools.utils.*; import com.epmet.constant.IcPlatformConstant; import com.epmet.constant.IcResiUserConstant; import com.epmet.constant.UserConstant; -import com.epmet.dao.IcPartyMemberDao; -import com.epmet.dao.IcResiUserDao; -import com.epmet.dao.IcVolunteerDao; -import com.epmet.dao.UserBaseInfoDao; +import com.epmet.dao.*; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.dto.result.resi.IcResiNonDynamicResultDTO; import com.epmet.entity.*; import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.feign.*; @@ -159,6 +157,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> subTableRes = operCustomizeOpenFeignClient.queryIcResiSubTables(queryDTO); if (subTableRes.success() && !CollectionUtils.isEmpty(subTableRes.getData())) { for (String subTalbeName : subTableRes.getData()) { - baseDao.updateSubTableToDel(subTalbeName, formDTO.getIcResiUserId()); + baseDao.updateSubTableToDel(subTalbeName, formDTO.getIcResiUserId(),formDTO.getCurrentStaffId()); } } + //删除ic_user_transfer_record、ic_user_change_record、ic_user_change_detailed + icUserTransferRecordService.deleteByIcResiUserId(formDTO.getIcResiUserId(),formDTO.getCurrentStaffId()); + icUserChangeRecordService.deleteByIcResiUserId(formDTO.getIcResiUserId(),formDTO.getCurrentStaffId()); + icUserChangeDetailedService.deleteByIcResiUserId(formDTO.getIcResiUserId(),formDTO.getCurrentStaffId()); } /** @@ -254,7 +260,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl entityList = baseDao.selectList(wrapper); if (CollectionUtils.isNotEmpty(entityList)) { - String errorMsg = "修改居民信息失败,身份证号已存在!"; + String errorMsg = "修改居民信息失败,证件号已存在!"; throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } } @@ -536,6 +552,15 @@ public class IcResiUserServiceImpl extends BaseServiceImpl hash : formMap.get("ic_party_member")) { + if (!hash.containsKey("ID") && !hash.containsKey("SSZB")) { + String errorMsg = "党员信息所属支部不能为空"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); + } + } + } } if ((map.containsKey("IS_PARTY") && NumConstant.ONE_STR.equals(map.get("IS_PARTY"))) || (!map.containsKey("IS_PARTY") && NumConstant.ONE_STR.equals(icResiUser.getIsParty()))) { @@ -607,6 +632,17 @@ public class IcResiUserServiceImpl extends BaseServiceImpl(pageInfo.getList(), pageInfo.getTotal(), formDTO.getPageSize()); + } return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); } @@ -1104,11 +1143,25 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard(), formDTO.getCustomerId()); + //2022.9.14 应产品要求之前返的是这个人是房东的房屋信息,现在改成返回这个人当前居住的房屋信息 syc + /*Result> listResult = govOrgOpenFeignClient.selectHouseInfoByIdCard(personData.getIdCard(), formDTO.getCustomerId()); if (!listResult.success()) { throw new RenException("查询房屋信息失败"); } personData.setHouseInfo(listResult.getData()); + */ + Set houseIds = new HashSet<>(); + houseIds.add(personData.getHomeId()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); + if (!houseInfoRes.success()) { + throw new RenException("查询房屋信息失败"); + } + List houseInfo = new ArrayList<>(); + if(null!=houseInfoRes.getData()&& !CollectionUtils.isEmpty(houseInfoRes.getData())){ + houseInfo.add(houseInfoRes.getData().get(0).getAllName()); + } + //2022.9.14 end + personData.setHouseInfo(houseInfo); // 志愿者处理 if (personData.getIsVolunteer().equals(NumConstant.ONE_STR)) { @@ -3296,4 +3349,195 @@ public class IcResiUserServiceImpl extends BaseServiceImpl" + customer); return customer; } + + @Override + public PageData listResiNonDynamic(Boolean fuzzy, String gridId, String name, String mobile, Integer pageNo, Integer pageSize) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getCustomerId, EpmetRequestHolder.getLoginUserCustomerId()); + query.eq(StringUtils.isNotBlank(gridId), IcResiUserEntity::getGridId, gridId); + // 一个模糊一个精确 + query.eq((!fuzzy && StringUtils.isNotBlank(name)), IcResiUserEntity::getName, name); + query.like((fuzzy && StringUtils.isNotBlank(name)), IcResiUserEntity::getName, name); + + query.eq((!fuzzy && StringUtils.isNotBlank(mobile)), IcResiUserEntity::getMobile, mobile); + query.like((fuzzy && StringUtils.isNotBlank(mobile)), IcResiUserEntity::getMobile, mobile); + + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.selectList(query).stream().map((e) -> ConvertUtils.sourceToTarget(e, IcResiNonDynamicResultDTO.class)).collect(Collectors.toList()); + return new PageData(list, new PageInfo<>(list).getTotal(), pageSize); + } + + @Override + public PageData icUserStatisList(UserChartFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 + if (StringUtils.isEmpty(formDTO.getOrgId())) { + //2.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + //获取无效组织网格Id列表 + if("agency".equals(formDTO.getOrgType())){ + //查询组织数据时排除掉当前组织及下级无效组织列表 + Result result = govOrgOpenFeignClient.getDelAgencyGridIdList(formDTO.getOrgId()); + if (!result.success()) { + throw new EpmetException(String.format("获取当前组织及下级已删除组织、网格列表失败,组织Id->%s", formDTO.getUserId())); + } + formDTO.setAgencyIdList(result.getData().getAgencyIdList()); + formDTO.setGridIdList(result.getData().getGridIdList()); + } + + //2.按条件查询业务数据 + List list = baseDao.icUserStatisList(formDTO); + if (CollectionUtils.isEmpty(list)) { + return new PageData(new ArrayList<>(), NumConstant.ZERO); + } + + //3.封装数据 + //查询小区,楼号,网格 + Result> gridResult = govOrgOpenFeignClient.getGridListByGridIds(list.stream().map(SearchByNameResultDTO::getGridId).collect(Collectors.toList())); + if (!gridResult.success()) { + throw new RenException(gridResult.getCode(), gridResult.getMsg()); + } + Map gridMap = gridResult.getData().stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName)); + Result> neighborHoodResult = govOrgOpenFeignClient.getListByIds(list.stream().map(SearchByNameResultDTO::getNeighborHoodId).collect(Collectors.toList())); + if (!neighborHoodResult.success()) { + throw new RenException(neighborHoodResult.getCode(), neighborHoodResult.getMsg()); + } + Map neighborHoodMap = neighborHoodResult.getData().stream().collect(Collectors.toMap(IcNeighborHoodDTO::getId, IcNeighborHoodDTO::getNeighborHoodName)); + Result> buildResult = govOrgOpenFeignClient.buildingListByIds(list.stream().map(SearchByNameResultDTO::getBuildId).collect(Collectors.toList())); + if (!buildResult.success()) { + throw new RenException(buildResult.getCode(), buildResult.getMsg()); + } + Map buildMap = buildResult.getData().stream().collect(Collectors.toMap(BuildingResultDTO::getBuildingId, BuildingResultDTO::getBuildingName)); + AtomicInteger i = new AtomicInteger(NumConstant.ONE); + list.forEach(item -> { + item.setGridName(gridMap.get(item.getGridId())); + item.setNeighborHoodName(neighborHoodMap.get(item.getNeighborHoodId())); + item.setBuildNum(buildMap.get(item.getBuildId())); + item.setSort(i.getAndIncrement()); + }); + + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + + + /** + * 更新育龄妇女状态定时任务 + * + * @Param + * @Return + * @Author zhaoqifeng + * @Date 2022/9/8 15:45 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void updateYlfn() { + //获取育龄妇女配置 + Result> value = operCustomizeOpenFeignClient.getYlfnValue(); + if(!value.success()) { + throw new EpmetException(value.getCode(), value.getMsg()); + } + value.getData().forEach(item -> { + //查询客户下的非育龄妇女的女性居民 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcResiUserEntity::getCustomerId, item.getCustomerId()); + wrapper.eq(IcResiUserEntity::getGender, NumConstant.TWO_STR); + wrapper.eq(IcResiUserEntity::getStatus, NumConstant.ZERO_STR); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(user -> { + IdCardRegexUtils pares = IdCardRegexUtils.parse(user.getIdCard()); + if (null != pares && NumConstant.ONE_STR.equals(pares.getTypeEnum().getType())) { + if (!NumConstant.ONE_STR.equals(user.getIsYlfn())) { + //将不是育龄妇女的变为育龄妇女 + if (pares.getParsedResult().getAge() >= item.getMin() && pares.getParsedResult().getAge() <= item.getMax()) { + //更新育龄妇女状态 + IcResiUserEntity icResiUserEntity = new IcResiUserEntity(); + icResiUserEntity.setId(user.getId()); + icResiUserEntity.setIsYlfn(NumConstant.ONE_STR); + baseDao.updateById(icResiUserEntity); + + //添加居民变更记录 + IcUserChangeRecordEntity record = new IcUserChangeRecordEntity(); + record.setCustomerId(user.getCustomerId()); + record.setOperatorId("APP_USER"); + record.setOperatorName("自动匹配"); + record.setIcUserId(user.getId()); + record.setIcUserName(user.getName()); + record.setType("category"); + record.setTypeName("类别"); + record.setBeforeChangeName("育龄妇女:否;"); + record.setAfterChangeName("育龄妇女:是;"); + record.setChangeTime(new Date()); + icUserChangeRecordDao.insert(record); + //添加变更明细 + IcUserChangeDetailedEntity detail = new IcUserChangeDetailedEntity(); + detail.setCustomerId(user.getCustomerId()); + detail.setIcUserChangeRecordId(record.getId()); + detail.setPids(user.getPids()); + detail.setAgencyId(user.getAgencyId()); + detail.setGridId(user.getGridId()); + detail.setNeighborHoodId(user.getVillageId()); + detail.setBuildingId(user.getBuildId()); + detail.setBuildingUnitId(user.getUnitId()); + detail.setHouseId(user.getHomeId()); + detail.setIcUserId(user.getId()); + detail.setType("category"); + detail.setTypeName("类别"); + detail.setFieldName("IS_YLFN"); + detail.setValue(NumConstant.ONE); + icUserChangeDetailedDao.insert(detail); + } + } else { + //将是育龄妇女的变为非育龄妇女 + if (pares.getParsedResult().getAge() < item.getMin() || pares.getParsedResult().getAge() > item.getMax()) { + //更新育龄妇女状态 + IcResiUserEntity icResiUserEntity = new IcResiUserEntity(); + icResiUserEntity.setId(user.getId()); + icResiUserEntity.setIsYlfn(NumConstant.ZERO_STR); + baseDao.updateById(icResiUserEntity); + //添加居民变更记录 + IcUserChangeRecordEntity record = new IcUserChangeRecordEntity(); + record.setCustomerId(user.getCustomerId()); + record.setOperatorId("APP_USER"); + record.setOperatorName("自动匹配"); + record.setIcUserId(user.getId()); + record.setIcUserName(user.getName()); + record.setType("category"); + record.setTypeName("类别"); + record.setBeforeChangeName("育龄妇女:是;"); + record.setAfterChangeName("育龄妇女:否;"); + record.setChangeTime(new Date()); + icUserChangeRecordDao.insert(record); + //添加变更明细 + IcUserChangeDetailedEntity detail = new IcUserChangeDetailedEntity(); + detail.setCustomerId(user.getCustomerId()); + detail.setIcUserChangeRecordId(record.getId()); + detail.setPids(user.getPids()); + detail.setAgencyId(user.getAgencyId()); + detail.setGridId(user.getGridId()); + detail.setNeighborHoodId(user.getVillageId()); + detail.setBuildingId(user.getBuildId()); + detail.setBuildingUnitId(user.getUnitId()); + detail.setHouseId(user.getHomeId()); + detail.setIcUserId(user.getId()); + detail.setType("category"); + detail.setTypeName("类别"); + detail.setFieldName("IS_YLFN"); + detail.setValue(NumConstant.ONE_NEG); + icUserChangeDetailedDao.insert(detail); + } + } + } + }); + } + }); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index 97f5ed43e0..93c30d9d3f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java @@ -221,6 +221,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl icUserIds) { baseDao.delByCustomerId(customerId, type, icUserIds); } + + @Override + public int deleteByIcResiUserId(String icResiUserId,String currentStaffId) { + return baseDao.deleteByIcResiUserId(icResiUserId,currentStaffId); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java index f72d695c5e..2ccf5d5119 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserChangeRecordServiceImpl.java @@ -171,6 +171,11 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl implements IcVaccinePrarmeterService,ResultDataResolver { + + @Resource + private IcVaccinePrarmeterRedis icVaccinePrarmeterRedis; + + @Resource + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + @Resource + private OssFeignClient ossFeignClient; + + @Resource + private GovOrgFeignClient govOrgFeignClient; + + @Resource + private IcResiUserDao icResiUserDao; + + @Resource + private IcUserChangeRecordService icUserChangeRecordService; + + @Resource + private IcVaccineDao icVaccineDao; + + @Resource + private IcVaccineRelationDao icVaccineRelationDao; + + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcVaccinePrarmeterDTO.class); + } + + /** + * 条件查询 + * @param params + * @return + */ + @Override + public PageData getPhrasePage(Map params, TokenDto tokenDto) { + params.put("customerId",tokenDto.getCustomerId()); + // 获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", tokenDto.getUserId())); + } + params.put("agencyId",staffInfo.getAgencyId()); + IPage page = getPage(params); + List list = baseDao.getPhrasePage(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcVaccinePrarmeterDTO.class); + } + + 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 IcVaccinePrarmeterDTO get(String id) { + IcVaccinePrarmeterEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcVaccinePrarmeterDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcVaccinePrarmeterDTO dto) { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId()); + if (null == gridInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息失败", "获取网格信息失败"); + } + IcVaccinePrarmeterEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterEntity.class); + entity.setCustomerId(gridInfo.getCustomerId()); + entity.setPids(gridInfo.getPids()); + entity.setCheckState(NumConstant.ZERO_STR); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcVaccinePrarmeterDTO dto) { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId()); + if (null == gridInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息失败", "获取网格信息失败"); + } + IcVaccinePrarmeterEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterEntity.class); + entity.setPids(gridInfo.getPids()); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + + /** + * Desc: 【新冠病毒疫苗接种人员信息台账】导入 + * @param tokenDto + * @param inputStream + * @param taskId + * @author wgf + * @date 2022/8/22 15:35 + */ + @Override + @Async + public void importFile(TokenDto tokenDto, InputStream inputStream, String taskId) { + List errorInfo = new ArrayList<>(); + + try { + List list = ExcelPoiUtils.importExcel(inputStream, 0,1, IcVaccinePrarmeterImportExcel.class); + if (CollectionUtils.isEmpty(list)){ + closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); + return; + } + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到工作人员信息"+tokenDto.getUserId()); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo){ + throw new EpmetException("未查询到组织信息"+staffInfo.getAgencyId()); + } + + // 校验空单元格以及网格名称是否正确 + checkInfo(list,errorInfo,tokenDto); + + if (list.size() > errorInfo.size()){ + Map groupByName = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getName, Collectors.counting())); + groupByName.forEach((name,count) -> { + if (Integer.valueOf(count.toString()).compareTo(1) != 0){ + for (IcVaccinePrarmeterImportExcel i : list) { + if (name.equals(i.getName()) && !i.getAddStatus()){ + errorInfo.add(getErrorInfo(i,"数据重复",i.getNum())); + i.setAddStatus(true); + } + } + } + }); + } + Map> groupByStatus = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getAddStatus)); + List needInsert = groupByStatus.get(false); + if (CollectionUtils.isNotEmpty(needInsert)){ + List entities = ConvertUtils.sourceToTarget(needInsert, IcVaccinePrarmeterEntity.class); + entities.forEach(e -> { + // 设置客户ID + e.setCustomerId(tokenDto.getCustomerId()); + // 设置审核状态为待审核 + e.setCheckState("0"); + }); + insertBatch(entities); + } + if (CollectionUtils.isNotEmpty(errorInfo)){ + String url = importOssUpload(errorInfo, IcVaccinePrarmeterImportErrorModel.class); + closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,url); + }else { + closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,""); + } + }catch (Exception e){ + log.error(e.getMessage()); + closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); + } + } + + /** + * 校验空单元格以及网格名称是否正确 + * @param list + * @param errorInfo + * @param tokenDto + */ + public void checkInfo(List list, List errorInfo, TokenDto tokenDto){ + LoginUserDetailsFormDTO form = new LoginUserDetailsFormDTO(); + form.setUserId(tokenDto.getUserId()); + form.setClient(tokenDto.getClient()); + form.setApp(tokenDto.getApp()); + LoginUserDetailsResultDTO userDetailsResultDTO = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(form), ServiceConstant.EPMET_USER_SERVER, + EpmetErrorCode.SERVER_ERROR.getCode(), + "获取当前登录人组织id失败", + null); + + for (int i = 0; i < list.size(); i++) { + list.get(i).setNum(i+1); + if (StringUtils.isBlank(list.get(i).getGridName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "所属网格不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getVillageName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "所属小区不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getBuildName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "所属楼宇不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getUnitName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "单元不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getHomeName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "门牌号不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "姓名不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getIdCard()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "证件号不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getMobile()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "咨询电话不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getIsVaccination()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "是否接种不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if("0".equals(list.get(i).getIsVaccination())){ + // 未接种 判断是否填写原因 + if (StringUtils.isBlank(list.get(i).getReason()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "选择未接种时,原因不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if("其他原因".equals(list.get(i).getReason())){ + // 未接种原因选择其他,判断是否填写备注 + if (StringUtils.isBlank(list.get(i).getNote()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "选择其他原因时,备注不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + } + + }else{ + // 已接种 判断是否填写接种时间地点 + if (StringUtils.isBlank(list.get(i).getFirstVacTime()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "第一次接种时间不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getFirstVacSite()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "第一次接种地点不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } +// if (StringUtils.isBlank(list.get(i).getSecondVacTime()) && !list.get(i).getAddStatus()){ +// errorInfo.add(getErrorInfo(list.get(i), "第二次接种时间不能为空",i+1)); +// list.get(i).setAddStatus(true); +// continue; +// } +// if (StringUtils.isBlank(list.get(i).getSecondVacSite()) && !list.get(i).getAddStatus()){ +// errorInfo.add(getErrorInfo(list.get(i), "第二次接种地点不能为空",i+1)); +// list.get(i).setAddStatus(true); +// continue; +// } +// if (StringUtils.isBlank(list.get(i).getThirdVacTime()) && !list.get(i).getAddStatus()){ +// errorInfo.add(getErrorInfo(list.get(i), "第三次接种时间不能为空",i+1)); +// list.get(i).setAddStatus(true); +// continue; +// } +// if (StringUtils.isBlank(list.get(i).getThirdVacSite()) && !list.get(i).getAddStatus()){ +// errorInfo.add(getErrorInfo(list.get(i), "第三次接种地点不能为空",i+1)); +// list.get(i).setAddStatus(true); +// continue; +// } + } + + // 校验所属网格通过名称能否匹配到ID + GridInfoVaccinePrarmeterFormDTO formDTO = new GridInfoVaccinePrarmeterFormDTO(); + formDTO.setGridName(list.get(i).getGridName()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setAgencyId(userDetailsResultDTO.getAgencyId()); + Result resultDTOResult = govOrgFeignClient.getGridInfoByGridName(formDTO); + GridInfoByNameResultDTO gridInfoByNameResultDTO = resultDTOResult.getData(); + if(gridInfoByNameResultDTO == null && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "所属网格匹配失败",i+1)); + list.get(i).setAddStatus(true); + continue; + }else{ + list.get(i).setGridId(gridInfoByNameResultDTO.getDeptId()); + list.get(i).setAgencyId(gridInfoByNameResultDTO.getPid()); + list.get(i).setPids(gridInfoByNameResultDTO.getPids()); + } + + } + } + + /** + * Desc: 文件上传并返回url + * @param errorRows + * @param tClass + * @author wgf + * @date 2022/8/23 09:16 + */ + public String importOssUpload(Collection errorRows, Class tClass) throws IOException { + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表","导入失败的数据列表"), + tClass, errorRows); + + // 文件名 + String resultDescFileName = UUID.randomUUID().toString().concat(".xls"); + + FileItemFactory factory = new DiskFileItemFactory(16, null); + FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, resultDescFileName); + OutputStream os = fileItem.getOutputStream(); + Result uploadResult = null; + try { + workbook.write(os); + uploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); + } catch (Exception e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件:{}", errormsg); + } finally { + try { + os.close(); + } catch (IOException e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件关闭输出流:{}", errormsg); + } + try { + fileItem.delete(); + } catch (Exception e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件删除临时文件:{}", errormsg); + } + } + + if (uploadResult == null || !uploadResult.success()) { + log.error("调用OSS上传结果描述文件失败"); + return null; + } + return uploadResult.getData().getUrl(); + } + + /** + * Desc: 关闭任务 + * @param taskId + * @param userId + * @param status + * @param url + * @author wgf + * @date 2022/8/23 09:05 + */ + public void closeTask(String taskId,String userId,String status,String url){ + ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); + input.setOperatorId(userId); + input.setTaskId(taskId); + input.setProcessStatus(status); + input.setResultDescFilePath(url); + commonServiceOpenFeignClient.finishImportTask(input); + } + + /** + * Desc: 构造错误信息 + * @param dto + * @param info + * @param num + * @author wgf + * @date 2022/8/23 17:17 + */ + public IcVaccinePrarmeterImportErrorModel getErrorInfo(IcVaccinePrarmeterImportExcel dto, String info, Integer num){ + IcVaccinePrarmeterImportErrorModel result = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterImportErrorModel.class); + result.setErrorMsg(info); + result.setNum(num); + return result; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void vaccineCheck(IcVaccineCheckFormDTO formDTO, TokenDto tokenDto) { + + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(),tokenDto.getUserId()); + formDTO.setRealName(staffInfo.getRealName()); + + // 获取新冠病毒疫苗接种人员信息台账表信息 + IcVaccinePrarmeterEntity icVaccinePrarmeterEntity = baseDao.selectById(formDTO.getId()); + + // 更新审核信息 + icVaccinePrarmeterEntity.setCheckState(formDTO.getCheckState()); + icVaccinePrarmeterEntity.setCheckReason(formDTO.getCheckReason()); + icVaccinePrarmeterEntity.setVillageId(formDTO.getVillageId()); + icVaccinePrarmeterEntity.setBuildId(formDTO.getBuildId()); + icVaccinePrarmeterEntity.setUnitId(formDTO.getUnitId()); + icVaccinePrarmeterEntity.setHomeId(formDTO.getHomeId()); + + baseDao.updateById(icVaccinePrarmeterEntity); + + // 审核状态:0待审核 1未通过 2已通过 + if("2".equals(formDTO.getCheckState())){ + + String icResiUserId = ""; + + // 根据身份证号和房屋ID获取人员信息 + IcResiUserEntity userIdCardEntity = queryOriginUserByIdCard(icVaccinePrarmeterEntity.getIdCard(),icVaccinePrarmeterEntity.getCustomerId()); + + if(StringUtils.isBlank(icVaccinePrarmeterEntity.getHomeId())){ + // 新增房屋(新增房屋操作已在审核接口之前,前端调用新增接口实现) + // 更新登记表房屋ID + icVaccinePrarmeterEntity = updateHomeId(icVaccinePrarmeterEntity,formDTO); + + if(userIdCardEntity != null){ + icResiUserId = userIdCardEntity.getId(); + // 已存在人员 人员房屋不一致(更新人员信息和变更记录) + updateUserInfo(icVaccinePrarmeterEntity,true,formDTO,userIdCardEntity); + }else{ + // 不存在人员 + icResiUserId = insertUserInfo(icVaccinePrarmeterEntity,formDTO); + } + }else{ + // 更新房屋 + updateHouseInfo(icVaccinePrarmeterEntity); + + Map userMap = queryOriginUserByHomeId(icVaccinePrarmeterEntity.getHomeId(),icVaccinePrarmeterEntity.getCustomerId()); + if(userIdCardEntity != null){ + icResiUserId = userIdCardEntity.getId(); + // 已存在人员 + if(userMap.containsKey(icVaccinePrarmeterEntity.getIdCard())){ + // 人员房屋一致(只更新人员信息) + updateUserInfo(icVaccinePrarmeterEntity,false,formDTO,userIdCardEntity); + }else{ + // 人员房屋不一致(更新人员信息和变更记录) + updateUserInfo(icVaccinePrarmeterEntity,true,formDTO,userIdCardEntity); + } + }else{ + // 不存在人员 + icResiUserId = insertUserInfo(icVaccinePrarmeterEntity,formDTO); + } + } + + // 同步接种记录 and 疫苗接种记录关系 + synchronizationVaccineInfo(icVaccinePrarmeterEntity,icResiUserId); + + + } + } + + /** + * 同步接种记录 and 疫苗接种记录关系 + * @param icVaccinePrarmeterEntity + * @param icResiUserId + */ + @SneakyThrows + private void synchronizationVaccineInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,String icResiUserId){ + if(!"1".equals(icVaccinePrarmeterEntity.getIsVaccination())){ + return; + } + // 同步接种记录 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + // 处理第一次接种时间格式 + String firstTime = icVaccinePrarmeterEntity.getFirstVacTime(); + if(StringUtils.isBlank(firstTime)){ + return; + } + Date firstDate = sdf.parse(firstTime); + icVaccinePrarmeterEntity.setFirstVacTime(sdf.format(firstDate)); + // 查询第一次接种信息 + List icVaccineEntityFirstList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(firstDate)); + if(icVaccineEntityFirstList.size() > 0){ + // 更新疫苗接种记录 and 疫苗接种记录关系 + for(IcVaccineEntity entity : icVaccineEntityFirstList){ + updateVaccineInfo(entity,icVaccinePrarmeterEntity); + + } + + }else{ + // 新增疫苗接种记录 and 疫苗接种记录关系 + insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate); + + } + + // 处理第二次接种时间格式 + String secondTime = icVaccinePrarmeterEntity.getSecondVacTime(); + if(StringUtils.isBlank(secondTime)){ + return; + } + Date secondDate = sdf.parse(secondTime); + icVaccinePrarmeterEntity.setSecondVacTime(sdf.format(secondDate)); + // 查询第二次接种信息 + List icVaccineEntitySecondList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(secondDate)); + if(icVaccineEntitySecondList.size() > 0){ + // 更新疫苗接种记录 and 疫苗接种记录关系 + for(IcVaccineEntity entity : icVaccineEntitySecondList){ + updateVaccineInfo(entity,icVaccinePrarmeterEntity); + + } + + }else{ + // 新增疫苗接种记录 and 疫苗接种记录关系 + insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate); + + } + + // 处理第三次接种时间格式 + String thirdTime = icVaccinePrarmeterEntity.getThirdVacTime(); + if(StringUtils.isBlank(thirdTime)){ + return; + } + Date thirdDate = sdf.parse(thirdTime); + icVaccinePrarmeterEntity.setThirdVacTime(sdf.format(thirdDate)); + // 查询第三次接种信息 + List icVaccineEntityThirdList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(thirdDate)); + if(icVaccineEntityThirdList.size() > 0){ + // 更新疫苗接种记录 and 疫苗接种记录关系 + for(IcVaccineEntity entity : icVaccineEntityThirdList){ + updateVaccineInfo(entity,icVaccinePrarmeterEntity); + + } + + }else{ + // 新增疫苗接种记录 and 疫苗接种记录关系 + insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate); + + } + } + + /** + * 更新疫苗接种记录 and 疫苗接种记录关系 + * @param entity + * @param icVaccinePrarmeterEntity + */ + private void updateVaccineInfo(IcVaccineEntity entity,IcVaccinePrarmeterEntity icVaccinePrarmeterEntity){ + // 更新疫苗接种记录 + entity.setInoculateAddress(icVaccinePrarmeterEntity.getFirstVacSite()); + entity.setUserType("prarmeter"); + entity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + icVaccineDao.updateById(entity); + + // 更新疫苗接种记录关系 + IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity(); + icVaccineRelationEntity.setIcVaccineId(entity.getId()); + icVaccineRelationEntity.setUserType("prarmeter"); + icVaccineRelationEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + icVaccineRelationDao.updateRelationInfoByVaccineId(icVaccineRelationEntity); + + } + + /** + * 新增疫苗接种记录 and 疫苗接种记录关系 + * @param icVaccinePrarmeterEntity + * @param icResiUserId + * @param time + */ + private void insertVaccineInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,String icResiUserId,Date time){ + IcVaccineEntity icVaccineEntity = new IcVaccineEntity(); + icVaccineEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + icVaccineEntity.setName(icVaccinePrarmeterEntity.getName()); + icVaccineEntity.setMobile(icVaccinePrarmeterEntity.getMobile()); + icVaccineEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard()); + icVaccineEntity.setIsResiUser("1"); + icVaccineEntity.setUserType("prarmeter"); + icVaccineEntity.setUserId(icResiUserId); + icVaccineEntity.setInoculateTime(time); + icVaccineEntity.setInoculateAddress(icVaccinePrarmeterEntity.getFirstVacSite()); + icVaccineDao.insert(icVaccineEntity); + + // 新增关系 + IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity(); + icVaccineRelationEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + icVaccineRelationEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId()); + icVaccineRelationEntity.setPids(icVaccinePrarmeterEntity.getPids()); + icVaccineRelationEntity.setIcVaccineId(icVaccineEntity.getId()); + icVaccineRelationEntity.setUserType("prarmeter"); + icVaccineRelationDao.insert(icVaccineRelationEntity); + } + + /** + * 更新新冠病毒疫苗接种人员信息台账表房屋ID + * @param icVaccinePrarmeterEntity + * @param formDTO + * @return + */ + private IcVaccinePrarmeterEntity updateHomeId(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,IcVaccineCheckFormDTO formDTO){ + + // fegin获取房屋信息 + GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); + getHouseInfoToCollectFormDTO.setBuildingUnitId(formDTO.getUnitId()); + getHouseInfoToCollectFormDTO.setDoorName(formDTO.getHomeName()); + Result resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); + IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); + + // 新增房屋后需要collect更新上房屋ID + // log + icVaccinePrarmeterEntity.setHomeId(icHouseInfoCollectResultDTO.getId()); + baseDao.updateById(icVaccinePrarmeterEntity); + return icVaccinePrarmeterEntity; + + } + + /** + * 更新房屋信息 + * @param icVaccinePrarmeterEntity + */ + private void updateHouseInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity){ + CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO(); + collectHouseFormDTO.setId(icVaccinePrarmeterEntity.getHomeId()); + + + // fegin获取房屋信息 + GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); + getHouseInfoToCollectFormDTO.setBuildingUnitId(icVaccinePrarmeterEntity.getUnitId()); + getHouseInfoToCollectFormDTO.setDoorName(icVaccinePrarmeterEntity.getHomeName()); + Result resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); + IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); + + collectHouseFormDTO.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + collectHouseFormDTO.setResiNumber((icHouseInfoCollectResultDTO.getResiNumber() + 1)); + collectHouseFormDTO.setRentFlag(icHouseInfoCollectResultDTO.getRentFlag()); + collectHouseFormDTO.setOwnerName(icHouseInfoCollectResultDTO.getOwnerName()); + govOrgFeignClient.updateCollect(collectHouseFormDTO); + + } + + /** + * 获取人员信息 + * @param idCard + * @return + */ + private IcResiUserEntity queryOriginUserByIdCard(String idCard,String customerId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getIdCard, idCard); + query.eq(IcResiUserEntity::getCustomerId, customerId); + IcResiUserEntity originUser = icResiUserDao.selectOne(query); + return originUser; + } + + private Map queryOriginUserByHomeId(String homeId,String customerId) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcResiUserEntity::getHomeId, homeId); + query.eq(IcResiUserEntity::getCustomerId, customerId); + List originUserList = icResiUserDao.selectList(query); + Map memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity())); + return memMap; + } + + /** + * 更新人员信息 + * @param icVaccinePrarmeterEntity 登记信息 + * @param isUpdateLog 是否更新记录 + * @param formDTO 入参 + * @param userEntity 根据身份证号查询到的user信息 + */ + private void updateUserInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,Boolean isUpdateLog, + IcVaccineCheckFormDTO formDTO,IcResiUserEntity userEntity){ + + userEntity.setPids(icVaccinePrarmeterEntity.getPids()); // ic_resi_user表的组织的pids 含agencyId本身 + userEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId()); + userEntity.setGridId(icVaccinePrarmeterEntity.getGridId()); + userEntity.setVillageId(icVaccinePrarmeterEntity.getVillageId()); + userEntity.setBuildId(icVaccinePrarmeterEntity.getBuildId()); + userEntity.setUnitId(icVaccinePrarmeterEntity.getUnitId()); + userEntity.setHomeId(icVaccinePrarmeterEntity.getHomeId()); + userEntity.setName(icVaccinePrarmeterEntity.getName()); + userEntity.setMobile(icVaccinePrarmeterEntity.getMobile()); + userEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard()); + icResiUserDao.updateById(userEntity); + + // 判断是否需要更新记录 + if(isUpdateLog){ + //变更记录表 + IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); + changeRecordEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + changeRecordEntity.setOperatorId(formDTO.getUserId()); + changeRecordEntity.setIcUserId(userEntity.getId()); + changeRecordEntity.setOperatorName(formDTO.getRealName()); + changeRecordEntity.setIcUserName(userEntity.getName()); + changeRecordEntity.setType("update"); + changeRecordEntity.setTypeName("修改"); + changeRecordEntity.setBeforeChangeName("-"); + changeRecordEntity.setAfterChangeName("-"); + changeRecordEntity.setChangeTime(new java.util.Date()); + icUserChangeRecordService.insert(changeRecordEntity); + } + + } + + /** + * 新增人员信息 + * @param icVaccinePrarmeterEntity + * @param formDTO + */ + private String insertUserInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,IcVaccineCheckFormDTO formDTO){ + + // 新增人员 + IcResiUserEntity userEntity = new IcResiUserEntity(); + userEntity.setPids(icVaccinePrarmeterEntity.getPids()); // ic_resi_user表的组织的pids 含agencyId本身 + userEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId()); + userEntity.setGridId(icVaccinePrarmeterEntity.getGridId()); + userEntity.setVillageId(icVaccinePrarmeterEntity.getVillageId()); + userEntity.setBuildId(icVaccinePrarmeterEntity.getBuildId()); + userEntity.setUnitId(icVaccinePrarmeterEntity.getUnitId()); + userEntity.setHomeId(icVaccinePrarmeterEntity.getHomeId()); + userEntity.setName(icVaccinePrarmeterEntity.getName()); + userEntity.setMobile(icVaccinePrarmeterEntity.getMobile()); + userEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard()); + userEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + icResiUserDao.insert(userEntity); + + //变更记录表 + IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); + changeRecordEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); + changeRecordEntity.setOperatorId(formDTO.getUserId()); + changeRecordEntity.setIcUserId(userEntity.getId()); + changeRecordEntity.setOperatorName(formDTO.getRealName()); + changeRecordEntity.setIcUserName(userEntity.getName()); + changeRecordEntity.setType("add"); + changeRecordEntity.setTypeName("新增"); + changeRecordEntity.setBeforeChangeName("-"); + changeRecordEntity.setAfterChangeName("-"); + changeRecordEntity.setChangeTime(new java.util.Date()); + icUserChangeRecordService.insert(changeRecordEntity); + + return userEntity.getId(); + + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java index 2ebbcb49ac..d44fe607eb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java @@ -24,7 +24,13 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.enums.SuperAdminEnum; +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.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -36,6 +42,7 @@ import com.epmet.entity.UserEntity; import com.epmet.feign.OperRoleUserFeignClient; import com.epmet.service.OperUserService; import com.epmet.service.UserService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -53,6 +60,7 @@ import java.util.Map; * @since v1.0.0 2020-03-18 */ @Service +@Slf4j public class OperUserServiceImpl extends BaseServiceImpl implements OperUserService { @Autowired @@ -61,6 +69,8 @@ public class OperUserServiceImpl extends BaseServiceImpl page(Map params) { @@ -129,6 +139,13 @@ public class OperUserServiceImpl extends BaseServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(OperUserEntity::getUserId,userId); - baseDao.update(param, lambdaQueryWrapper); + + + baseDao.update(param, lambdaQueryWrapper); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java index bf7f42d6f9..d853d884dc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java @@ -37,10 +37,10 @@ import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.RegisterRelationDTO; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.form.*; +import com.epmet.dto.result.NewUserRoleResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserInfoOnEnterGridResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; -import com.epmet.dto.result.NewUserRoleResultDTO; import com.epmet.entity.RegisterRelationEntity; import com.epmet.entity.UserCustomerEntity; import com.epmet.feign.GovOrgFeignClient; @@ -212,8 +212,14 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl registerRecordWithDiffCustAndGrid = diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 4cccbd7bf4..a328399810 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -18,6 +18,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -25,10 +26,15 @@ import com.epmet.commons.tools.constant.AppClientConstant; 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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.NameUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.*; import com.epmet.dto.RegisterRelationDTO; @@ -36,10 +42,13 @@ import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.CommonUserIdFormDTO; +import com.epmet.dto.form.DingLoginResiFormDTO; import com.epmet.dto.form.UserRoleFormDTO; import com.epmet.dto.form.VolunteerRegResiFormDTO; import com.epmet.dto.result.*; +import com.epmet.entity.RegisterRelationEntity; import com.epmet.entity.UserBaseInfoEntity; +import com.epmet.entity.UserEntity; import com.epmet.entity.UserWechatEntity; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.redis.UserBaseInfoRedis; @@ -57,6 +66,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import javax.annotation.Resource; import java.util.*; /** @@ -90,6 +100,8 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -194,16 +206,16 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl registerWrapper = new LambdaQueryWrapper<>(); + registerWrapper.eq(RegisterRelationEntity::getCustomerId, formDTO.getCustomerId()); + registerWrapper.eq(RegisterRelationEntity::getUserId, baseInfo.getUserId()); + registerWrapper.eq(RegisterRelationEntity::getFirstRegister, NumConstant.ONE_STR); + RegisterRelationEntity registerRelation = registerRelationDao.selectOne(registerWrapper); + if (null != registerRelation) { + result.setAgencyId(registerRelation.getAgencyId()); + result.setGridId(registerRelation.getGridId()); + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(registerRelation.getGridId()); + if (null == gridInfo) { + logger.error(String.format("获取用户注册网格信息为空,userId:%s,gridId:%s", baseInfo.getUserId(), registerRelation.getGridId())); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息为空", "获取小程序注册网格信息失败"); + } + result.setGridName(gridInfo.getGridNamePath()); + result.setRegFlag(true); + } + } + return result; + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index 44cd7c12a3..3efd7e01fa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -18,6 +18,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.common.token.util.UserUtil; @@ -27,32 +28,34 @@ 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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.IdCardRegexUtils; +import com.epmet.commons.tools.utils.NameUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserConstant; import com.epmet.constant.UserResiRegisterConstant; import com.epmet.constant.UserRoleConstant; -import com.epmet.dao.UserCustomerDao; -import com.epmet.dao.UserResiInfoDao; -import com.epmet.dao.UserWechatDao; +import com.epmet.dao.*; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserResiRegisterVisitDTO; import com.epmet.dto.UserRoleDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.entity.UserBaseInfoEntity; -import com.epmet.entity.UserResiInfoEntity; -import com.epmet.entity.UserResiRegisterVisitEntity; -import com.epmet.entity.UserWechatEntity; +import com.epmet.entity.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.GovIssueOpenFeignClient; import com.epmet.redis.UserBaseInfoRedis; import com.epmet.redis.UserResiInfoRedis; import com.epmet.resi.group.dto.topic.form.SharableTopicAndInviteeFormDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; +import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import com.epmet.service.*; import com.epmet.util.ModuleConstant; import org.apache.commons.collections4.CollectionUtils; @@ -63,6 +66,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.*; /** @@ -99,6 +103,15 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -173,8 +186,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl registerWrapper = new LambdaQueryWrapper<>(); + registerWrapper.eq(RegisterRelationEntity::getCustomerId, userResiInfoDTO.getCustomerId()); + registerWrapper.eq(RegisterRelationEntity::getUserId, userResiInfoDTO.getUserId()); + registerWrapper.eq(RegisterRelationEntity::getFirstRegister, NumConstant.ONE_STR); + RegisterRelationEntity registerRelation = registerRelationDao.selectOne(registerWrapper); + if (null != registerRelation) { + resDTO.setGridId(registerRelation.getGridId()); + GridInfoCache regGridInfo = CustomerOrgRedis.getGridInfo(registerRelation.getGridId()); + if (null == regGridInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取注册网格信息失败", "获取注册网格信息失败"); + } + resDTO.setGridName(regGridInfo.getGridNamePath()); + resDTO.setAgencyId(regGridInfo.getPid()); + } + } + //6:记录用户访问的网格grid_latest + LambdaQueryWrapper latestWrapper = new LambdaQueryWrapper<>(); + latestWrapper.eq(GridLatestEntity::getCustomerId, userResiInfoDTO.getCustomerId()); + latestWrapper.eq(GridLatestEntity::getGridId, userResiInfoDTO.getGridId()); + latestWrapper.eq(GridLatestEntity::getCustomerUserId, userResiInfoDTO.getUserId()); + GridLatestEntity latest = gridLatestDao.selectOne(latestWrapper); + if (null == latest) { + latest = new GridLatestEntity(); + latest.setCustomerId(userResiInfoDTO.getCustomerId()); + latest.setGridId(userResiInfoDTO.getGridId()); + latest.setCustomerUserId(userResiInfoDTO.getUserId()); + latest.setAreaCode(gridInfo.getAreaCode()); + latest.setPid(gridInfo.getPid()); + latest.setLatestTime(new Date()); + gridLatestDao.insert(latest); + } else { + GridLatestEntity latestEntity = new GridLatestEntity(); + latestEntity.setId(latest.getId()); + latestEntity.setLatestTime(new Date()); + gridLatestDao.updateById(latestEntity); + } + return resDTO; + } /** * 自动认证居民:志愿者注册,自动认证居民 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/Base64Util.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/Base64Util.java new file mode 100644 index 0000000000..edf47b2e16 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/Base64Util.java @@ -0,0 +1,768 @@ +package com.epmet.util.dh; + + +import java.math.BigInteger; + +/** + * Provides Base64 encoding and decoding as defined by RFC 2045. + * + *

+ * This class implements section 6.8. Base64 Content-Transfer-Encoding from RFC 2045 Multipurpose + * Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies by Freed and Borenstein. + *

+ *

+ * The class can be parameterized in the following manner with various constructors: + *

+ *
    + *
  • URL-safe mode: Default off.
  • + *
  • Line length: Default 76. Line length that aren't multiples of 4 will still essentially end up being multiples of + * 4 in the encoded data. + *
  • Line separator: Default is CRLF ("\r\n")
  • + *
+ *

+ * The URL-safe parameter is only applied to encode operations. Decoding seamlessly handles both modes. + *

+ *

+ * Since this class operates directly on byte streams, and not character streams, it is hard-coded to only + * encode/decode character encodings which are compatible with the lower 127 ASCII chart (ISO-8859-1, Windows-1252, + * UTF-8, etc). + *

+ *

+ * This class is thread-safe. + *

+ * + * @see RFC 2045 + * @since 1.0 + * @version $Id: Base64.java 1635986 2014-11-01 16:27:52Z tn $ + */ +public class Base64Util extends BaseNCodec { + + /** + * BASE32 characters are 6 bits in length. + * They are formed by taking a block of 3 octets to form a 24-bit string, + * which is converted into 4 BASE64 characters. + */ + private static final int BITS_PER_ENCODED_BYTE = 6; + private static final int BYTES_PER_UNENCODED_BLOCK = 3; + private static final int BYTES_PER_ENCODED_BLOCK = 4; + + /** + * Chunk separator per RFC 2045 section 2.1. + * + *

+ * N.B. The next major release may break compatibility and make this field private. + *

+ * + * @see RFC 2045 section 2.1 + */ + static final byte[] CHUNK_SEPARATOR = {'\r', '\n'}; + + /** + * This array is a lookup table that translates 6-bit positive integer index values into their "Base64 Alphabet" + * equivalents as specified in Table 1 of RFC 2045. + * + * Thanks to "commons" project in ws.apache.org for this code. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + */ + private static final byte[] STANDARD_ENCODE_TABLE = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' + }; + + /** + * This is a copy of the STANDARD_ENCODE_TABLE above, but with + and / + * changed to - and _ to make the encoded Base64 results more URL-SAFE. + * This table is only used when the Base64's mode is set to URL-SAFE. + */ + private static final byte[] URL_SAFE_ENCODE_TABLE = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_' + }; + + /** + * This array is a lookup table that translates Unicode characters drawn from the "Base64 Alphabet" (as specified + * in Table 1 of RFC 2045) into their 6-bit positive integer equivalents. Characters that are not in the Base64 + * alphabet but fall within the bounds of the array are translated to -1. + * + * Note: '+' and '-' both decode to 62. '/' and '_' both decode to 63. This means decoder seamlessly handles both + * URL_SAFE and STANDARD base64. (The encoder, on the other hand, needs to know ahead of time what to emit). + * + * Thanks to "commons" project in ws.apache.org for this code. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + */ + private static final byte[] DECODE_TABLE = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 + }; + + /** + * Base64 uses 6-bit fields. + */ + /** Mask used to extract 6 bits, used when encoding */ + private static final int MASK_6BITS = 0x3f; + + // The static final fields above are used for the original static byte[] methods on Base64. + // The private member fields below are used with the new streaming approach, which requires + // some state be preserved between calls of encode() and decode(). + + /** + * Encode table to use: either STANDARD or URL_SAFE. Note: the DECODE_TABLE above remains static because it is able + * to decode both STANDARD and URL_SAFE streams, but the encodeTable must be a member variable so we can switch + * between the two modes. + */ + private final byte[] encodeTable; + + // Only one decode table currently; keep for consistency with Base32 code + private final byte[] decodeTable = DECODE_TABLE; + + /** + * Line separator for encoding. Not used when decoding. Only used if lineLength > 0. + */ + private final byte[] lineSeparator; + + /** + * Convenience variable to help us determine when our buffer is going to run out of room and needs resizing. + * decodeSize = 3 + lineSeparator.length; + */ + private final int decodeSize; + + /** + * Convenience variable to help us determine when our buffer is going to run out of room and needs resizing. + * encodeSize = 4 + lineSeparator.length; + */ + private final int encodeSize; + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length is 0 (no chunking), and the encoding table is STANDARD_ENCODE_TABLE. + *

+ * + *

+ * When decoding all variants are supported. + *

+ */ + public Base64Util() { + this(0); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in the given URL-safe mode. + *

+ * When encoding the line length is 76, the line separator is CRLF, and the encoding table is STANDARD_ENCODE_TABLE. + *

+ * + *

+ * When decoding all variants are supported. + *

+ * + * @param urlSafe + * if true, URL-safe encoding is used. In most cases this should be set to + * false. + * @since 1.4 + */ + public Base64Util(final boolean urlSafe) { + this(MIME_CHUNK_SIZE, CHUNK_SEPARATOR, urlSafe); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length is given in the constructor, the line separator is CRLF, and the encoding table is + * STANDARD_ENCODE_TABLE. + *

+ *

+ * Line lengths that aren't multiples of 4 will still essentially end up being multiples of 4 in the encoded data. + *

+ *

+ * When decoding all variants are supported. + *

+ * + * @param lineLength + * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of + * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when + * decoding. + * @since 1.4 + */ + public Base64Util(final int lineLength) { + this(lineLength, CHUNK_SEPARATOR); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length and line separator are given in the constructor, and the encoding table is + * STANDARD_ENCODE_TABLE. + *

+ *

+ * Line lengths that aren't multiples of 4 will still essentially end up being multiples of 4 in the encoded data. + *

+ *

+ * When decoding all variants are supported. + *

+ * + * @param lineLength + * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of + * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when + * decoding. + * @param lineSeparator + * Each line of encoded data will end with this sequence of bytes. + * @throws IllegalArgumentException + * Thrown when the provided lineSeparator included some base64 characters. + * @since 1.4 + */ + public Base64Util(final int lineLength, final byte[] lineSeparator) { + this(lineLength, lineSeparator, false); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length and line separator are given in the constructor, and the encoding table is + * STANDARD_ENCODE_TABLE. + *

+ *

+ * Line lengths that aren't multiples of 4 will still essentially end up being multiples of 4 in the encoded data. + *

+ *

+ * When decoding all variants are supported. + *

+ * + * @param lineLength + * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of + * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when + * decoding. + * @param lineSeparator + * Each line of encoded data will end with this sequence of bytes. + * @param urlSafe + * Instead of emitting '+' and '/' we emit '-' and '_' respectively. urlSafe is only applied to encode + * operations. Decoding seamlessly handles both modes. + * Note: no padding is added when using the URL-safe alphabet. + * @throws IllegalArgumentException + * The provided lineSeparator included some base64 characters. That's not going to work! + * @since 1.4 + */ + public Base64Util(final int lineLength, final byte[] lineSeparator, final boolean urlSafe) { + super(BYTES_PER_UNENCODED_BLOCK, BYTES_PER_ENCODED_BLOCK, + lineLength, + lineSeparator == null ? 0 : lineSeparator.length); + // TODO could be simplified if there is no requirement to reject invalid line sep when length <=0 + // @see test case Base64Test.testConstructors() + if (lineSeparator != null) { + if (containsAlphabetOrPad(lineSeparator)) { + final String sep = newStringUtf8(lineSeparator); + throw new IllegalArgumentException("lineSeparator must not contain base64 characters: [" + sep + "]"); + } + if (lineLength > 0){ // null line-sep forces no chunking rather than throwing IAE + this.encodeSize = BYTES_PER_ENCODED_BLOCK + lineSeparator.length; + this.lineSeparator = new byte[lineSeparator.length]; + System.arraycopy(lineSeparator, 0, this.lineSeparator, 0, lineSeparator.length); + } else { + this.encodeSize = BYTES_PER_ENCODED_BLOCK; + this.lineSeparator = null; + } + } else { + this.encodeSize = BYTES_PER_ENCODED_BLOCK; + this.lineSeparator = null; + } + this.decodeSize = this.encodeSize - 1; + this.encodeTable = urlSafe ? URL_SAFE_ENCODE_TABLE : STANDARD_ENCODE_TABLE; + } + + /** + * Returns our current encode mode. True if we're URL-SAFE, false otherwise. + * + * @return true if we're in URL-SAFE mode, false otherwise. + * @since 1.4 + */ + public boolean isUrlSafe() { + return this.encodeTable == URL_SAFE_ENCODE_TABLE; + } + + /** + *

+ * Encodes all of the provided data, starting at inPos, for inAvail bytes. Must be called at least twice: once with + * the data to encode, and once with inAvail set to "-1" to alert encoder that EOF has been reached, to flush last + * remaining bytes (if not multiple of 3). + *

+ *

Note: no padding is added when encoding using the URL-safe alphabet.

+ *

+ * Thanks to "commons" project in ws.apache.org for the bitwise operations, and general approach. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + *

+ * + * @param in + * byte[] array of binary data to base64 encode. + * @param inPos + * Position to start reading data from. + * @param inAvail + * Amount of bytes available from input for encoding. + * @param context + * the context to be used + */ + @Override + void encode(final byte[] in, int inPos, final int inAvail, final Context context) { + if (context.eof) { + return; + } + // inAvail < 0 is how we're informed of EOF in the underlying data we're + // encoding. + if (inAvail < 0) { + context.eof = true; + if (0 == context.modulus && lineLength == 0) { + return; // no leftovers to process and not using chunking + } + final byte[] buffer = ensureBufferSize(encodeSize, context); + final int savedPos = context.pos; + switch (context.modulus) { // 0-2 + case 0 : // nothing to do here + break; + case 1 : // 8 bits = 6 + 2 + // top 6 bits: + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 2) & MASK_6BITS]; + // remaining 2: + buffer[context.pos++] = encodeTable[(context.ibitWorkArea << 4) & MASK_6BITS]; + // URL-SAFE skips the padding to further reduce size. + if (encodeTable == STANDARD_ENCODE_TABLE) { + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + } + break; + + case 2 : // 16 bits = 6 + 6 + 4 + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 10) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 4) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea << 2) & MASK_6BITS]; + // URL-SAFE skips the padding to further reduce size. + if (encodeTable == STANDARD_ENCODE_TABLE) { + buffer[context.pos++] = pad; + } + break; + default: + throw new IllegalStateException("Impossible modulus "+context.modulus); + } + context.currentLinePos += context.pos - savedPos; // keep track of current line position + // if currentPos == 0 we are at the start of a line, so don't add CRLF + if (lineLength > 0 && context.currentLinePos > 0) { + System.arraycopy(lineSeparator, 0, buffer, context.pos, lineSeparator.length); + context.pos += lineSeparator.length; + } + } else { + for (int i = 0; i < inAvail; i++) { + final byte[] buffer = ensureBufferSize(encodeSize, context); + context.modulus = (context.modulus+1) % BYTES_PER_UNENCODED_BLOCK; + int b = in[inPos++]; + if (b < 0) { + b += 256; + } + context.ibitWorkArea = (context.ibitWorkArea << 8) + b; // BITS_PER_BYTE + if (0 == context.modulus) { // 3 bytes = 24 bits = 4 * 6 bits to extract + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 18) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 12) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 6) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[context.ibitWorkArea & MASK_6BITS]; + context.currentLinePos += BYTES_PER_ENCODED_BLOCK; + if (lineLength > 0 && lineLength <= context.currentLinePos) { + System.arraycopy(lineSeparator, 0, buffer, context.pos, lineSeparator.length); + context.pos += lineSeparator.length; + context.currentLinePos = 0; + } + } + } + } + } + + /** + *

+ * Decodes all of the provided data, starting at inPos, for inAvail bytes. Should be called at least twice: once + * with the data to decode, and once with inAvail set to "-1" to alert decoder that EOF has been reached. The "-1" + * call is not necessary when decoding, but it doesn't hurt, either. + *

+ *

+ * Ignores all non-base64 characters. This is how chunked (e.g. 76 character) data is handled, since CR and LF are + * silently ignored, but has implications for other bytes, too. This method subscribes to the garbage-in, + * garbage-out philosophy: it will not check the provided data for validity. + *

+ *

+ * Thanks to "commons" project in ws.apache.org for the bitwise operations, and general approach. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + *

+ * + * @param in + * byte[] array of ascii data to base64 decode. + * @param inPos + * Position to start reading data from. + * @param inAvail + * Amount of bytes available from input for encoding. + * @param context + * the context to be used + */ + @Override + void decode(final byte[] in, int inPos, final int inAvail, final Context context) { + if (context.eof) { + return; + } + if (inAvail < 0) { + context.eof = true; + } + for (int i = 0; i < inAvail; i++) { + final byte[] buffer = ensureBufferSize(decodeSize, context); + final byte b = in[inPos++]; + if (b == pad) { + // We're done. + context.eof = true; + break; + } else { + if (b >= 0 && b < DECODE_TABLE.length) { + final int result = DECODE_TABLE[b]; + if (result >= 0) { + context.modulus = (context.modulus+1) % BYTES_PER_ENCODED_BLOCK; + context.ibitWorkArea = (context.ibitWorkArea << BITS_PER_ENCODED_BYTE) + result; + if (context.modulus == 0) { + buffer[context.pos++] = (byte) ((context.ibitWorkArea >> 16) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.ibitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) (context.ibitWorkArea & MASK_8BITS); + } + } + } + } + } + + // Two forms of EOF as far as base64 decoder is concerned: actual + // EOF (-1) and first time '=' character is encountered in stream. + // This approach makes the '=' padding characters completely optional. + if (context.eof && context.modulus != 0) { + final byte[] buffer = ensureBufferSize(decodeSize, context); + + // We have some spare bits remaining + // Output all whole multiples of 8 bits and ignore the rest + switch (context.modulus) { +// case 0 : // impossible, as excluded above + case 1 : // 6 bits - ignore entirely + // TODO not currently tested; perhaps it is impossible? + break; + case 2 : // 12 bits = 8 + 4 + context.ibitWorkArea = context.ibitWorkArea >> 4; // dump the extra 4 bits + buffer[context.pos++] = (byte) ((context.ibitWorkArea) & MASK_8BITS); + break; + case 3 : // 18 bits = 8 + 8 + 2 + context.ibitWorkArea = context.ibitWorkArea >> 2; // dump 2 bits + buffer[context.pos++] = (byte) ((context.ibitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.ibitWorkArea) & MASK_8BITS); + break; + default: + throw new IllegalStateException("Impossible modulus "+context.modulus); + } + } + } + + /** + * Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the + * method treats whitespace as valid. + * + * @param arrayOctet + * byte array to test + * @return true if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; + * false, otherwise + * @deprecated 1.5 Use {@link #isBase64(byte[])}, will be removed in 2.0. + */ + @Deprecated + public static boolean isArrayByteBase64(final byte[] arrayOctet) { + return isBase64(arrayOctet); + } + + /** + * Returns whether or not the octet is in the base 64 alphabet. + * + * @param octet + * The value to test + * @return true if the value is defined in the the base 64 alphabet, false otherwise. + * @since 1.4 + */ + public static boolean isBase64(final byte octet) { + return octet == PAD_DEFAULT || (octet >= 0 && octet < DECODE_TABLE.length && DECODE_TABLE[octet] != -1); + } + + /** + * Tests a given String to see if it contains only valid characters within the Base64 alphabet. Currently the + * method treats whitespace as valid. + * + * @param base64 + * String to test + * @return true if all characters in the String are valid characters in the Base64 alphabet or if + * the String is empty; false, otherwise + * @since 1.5 + */ + public static boolean isBase64(final String base64) { + return isBase64(getBytesUtf8(base64)); + } + + /** + * Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the + * method treats whitespace as valid. + * + * @param arrayOctet + * byte array to test + * @return true if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; + * false, otherwise + * @since 1.5 + */ + public static boolean isBase64(final byte[] arrayOctet) { + for (int i = 0; i < arrayOctet.length; i++) { + if (!isBase64(arrayOctet[i]) && !isWhiteSpace(arrayOctet[i])) { + return false; + } + } + return true; + } + + /** + * Encodes binary data using the base64 algorithm but does not chunk the output. + * + * @param binaryData + * binary data to encode + * @return byte[] containing Base64 characters in their UTF-8 representation. + */ + public static byte[] encodeBase64(final byte[] binaryData) { + return encodeBase64(binaryData, false); + } + + /** + * Encodes binary data using the base64 algorithm but does not chunk the output. + * + * NOTE: We changed the behaviour of this method from multi-line chunking (commons-codec-1.4) to + * single-line non-chunking (commons-codec-1.5). + * + * @param binaryData + * binary data to encode + * @return String containing Base64 characters. + * @since 1.4 (NOTE: 1.4 chunked the output, whereas 1.5 does not). + */ + public static String encodeBase64String(final byte[] binaryData) { + return newStringUtf8(encodeBase64(binaryData, false)); + } + + /** + * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The + * url-safe variation emits - and _ instead of + and / characters. + * Note: no padding is added. + * @param binaryData + * binary data to encode + * @return byte[] containing Base64 characters in their UTF-8 representation. + * @since 1.4 + */ + public static byte[] encodeBase64URLSafe(final byte[] binaryData) { + return encodeBase64(binaryData, false, true); + } + + /** + * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The + * url-safe variation emits - and _ instead of + and / characters. + * Note: no padding is added. + * @param binaryData + * binary data to encode + * @return String containing Base64 characters + * @since 1.4 + */ + public static String encodeBase64URLSafeString(final byte[] binaryData) { + return newStringUtf8(encodeBase64(binaryData, false, true)); + } + + /** + * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks + * + * @param binaryData + * binary data to encode + * @return Base64 characters chunked in 76 character blocks + */ + public static byte[] encodeBase64Chunked(final byte[] binaryData) { + return encodeBase64(binaryData, true); + } + + /** + * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. + * + * @param binaryData + * Array containing binary data to encode. + * @param isChunked + * if true this encoder will chunk the base64 output into 76 character blocks + * @return Base64-encoded data. + * @throws IllegalArgumentException + * Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} + */ + public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked) { + return encodeBase64(binaryData, isChunked, false); + } + + /** + * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. + * + * @param binaryData + * Array containing binary data to encode. + * @param isChunked + * if true this encoder will chunk the base64 output into 76 character blocks + * @param urlSafe + * if true this encoder will emit - and _ instead of the usual + and / characters. + * Note: no padding is added when encoding using the URL-safe alphabet. + * @return Base64-encoded data. + * @throws IllegalArgumentException + * Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} + * @since 1.4 + */ + public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe) { + return encodeBase64(binaryData, isChunked, urlSafe, Integer.MAX_VALUE); + } + + /** + * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. + * + * @param binaryData + * Array containing binary data to encode. + * @param isChunked + * if true this encoder will chunk the base64 output into 76 character blocks + * @param urlSafe + * if true this encoder will emit - and _ instead of the usual + and / characters. + * Note: no padding is added when encoding using the URL-safe alphabet. + * @param maxResultSize + * The maximum result size to accept. + * @return Base64-encoded data. + * @throws IllegalArgumentException + * Thrown when the input array needs an output array bigger than maxResultSize + * @since 1.4 + */ + public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, + final boolean urlSafe, final int maxResultSize) { + if (binaryData == null || binaryData.length == 0) { + return binaryData; + } + + // Create this so can use the super-class method + // Also ensures that the same roundings are performed by the ctor and the code + final Base64Util b64 = isChunked ? new Base64Util(urlSafe) : new Base64Util(0, CHUNK_SEPARATOR, urlSafe); + final long len = b64.getEncodedLength(binaryData); + if (len > maxResultSize) { + throw new IllegalArgumentException("Input array too big, the output array would be bigger (" + + len + + ") than the specified maximum size of " + + maxResultSize); + } + + return b64.encode(binaryData); + } + + /** + * Decodes a Base64 String into octets. + *

+ * Note: this method seamlessly handles data encoded in URL-safe or normal mode. + *

+ * + * @param base64String + * String containing Base64 data + * @return Array containing decoded data. + * @since 1.4 + */ + public static byte[] decodeBase64(final String base64String) { + return new Base64Util().decode(base64String); + } + + /** + * Decodes Base64 data into octets. + *

+ * Note: this method seamlessly handles data encoded in URL-safe or normal mode. + *

+ * + * @param base64Data + * Byte array containing Base64 data + * @return Array containing decoded data. + */ + public static byte[] decodeBase64(final byte[] base64Data) { + return new Base64Util().decode(base64Data); + } + + // Implementation of the Encoder Interface + + // Implementation of integer encoding used for crypto + /** + * Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. + * + * @param pArray + * a byte array containing base64 character data + * @return A BigInteger + * @since 1.4 + */ + public static BigInteger decodeInteger(final byte[] pArray) { + return new BigInteger(1, decodeBase64(pArray)); + } + + /** + * Encodes to a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. + * + * @param bigInt + * a BigInteger + * @return A byte array containing base64 character data + * @throws NullPointerException + * if null is passed in + * @since 1.4 + */ + public static byte[] encodeInteger(final BigInteger bigInt) { + if (bigInt == null) { + throw new NullPointerException("encodeInteger called with null parameter"); + } + return encodeBase64(toIntegerBytes(bigInt), false); + } + + /** + * Returns a byte-array representation of a BigInteger without sign bit. + * + * @param bigInt + * BigInteger to be converted + * @return a byte array representation of the BigInteger parameter + */ + static byte[] toIntegerBytes(final BigInteger bigInt) { + int bitlen = bigInt.bitLength(); + // round bitlen + bitlen = ((bitlen + 7) >> 3) << 3; + final byte[] bigBytes = bigInt.toByteArray(); + + if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) { + return bigBytes; + } + // set up params for copying everything but sign bit + int startSrc = 0; + int len = bigBytes.length; + + // if bigInt is exactly byte-aligned, just skip signbit in copy + if ((bigInt.bitLength() % 8) == 0) { + startSrc = 1; + len--; + } + final int startDst = bitlen / 8 - len; // to pad w/ nulls as per spec + final byte[] resizedBytes = new byte[bitlen / 8]; + System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len); + return resizedBytes; + } + + /** + * Returns whether or not the octet is in the Base64 alphabet. + * + * @param octet + * The value to test + * @return true if the value is defined in the the Base64 alphabet false otherwise. + */ + @Override + protected boolean isInAlphabet(final byte octet) { + return octet >= 0 && octet < decodeTable.length && decodeTable[octet] != -1; + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/BaseNCodec.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/BaseNCodec.java new file mode 100644 index 0000000000..08bfa92378 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/BaseNCodec.java @@ -0,0 +1,521 @@ +package com.epmet.util.dh; + + +import java.nio.charset.Charset; +import java.util.Arrays; + +/** + * Abstract superclass for Base-N encoders and decoders. + * + *

+ * This class is thread-safe. + *

+ * + * @version $Id: BaseNCodec.java 1634404 2014-10-26 23:06:10Z ggregory $ + */ +public abstract class BaseNCodec { + + /** + * Holds thread context so classes can be thread-safe. + * + * This class is not itself thread-safe; each thread must allocate its own copy. + * + * @since 1.7 + */ + static class Context { + + /** + * Place holder for the bytes we're dealing with for our based logic. + * Bitwise operations store and extract the encoding or decoding from this variable. + */ + int ibitWorkArea; + + /** + * Place holder for the bytes we're dealing with for our based logic. + * Bitwise operations store and extract the encoding or decoding from this variable. + */ + long lbitWorkArea; + + /** + * Buffer for streaming. + */ + byte[] buffer; + + /** + * Position where next character should be written in the buffer. + */ + int pos; + + /** + * Position where next character should be read from the buffer. + */ + int readPos; + + /** + * Boolean flag to indicate the EOF has been reached. Once EOF has been reached, this object becomes useless, + * and must be thrown away. + */ + boolean eof; + + /** + * Variable tracks how many characters have been written to the current line. Only used when encoding. We use + * it to make sure each encoded line never goes beyond lineLength (if lineLength > 0). + */ + int currentLinePos; + + /** + * Writes to the buffer only occur after every 3/5 reads when encoding, and every 4/8 reads when decoding. This + * variable helps track that. + */ + int modulus; + + Context() { + } + + /** + * Returns a String useful for debugging (especially within a debugger.) + * + * @return a String useful for debugging. + */ + @SuppressWarnings("boxing") // OK to ignore boxing here + public String toString() { + return String.format("%s[buffer=%s, currentLinePos=%s, eof=%s, ibitWorkArea=%s, lbitWorkArea=%s, " + + "modulus=%s, pos=%s, readPos=%s]", this.getClass().getSimpleName(), Arrays.toString(buffer), + currentLinePos, eof, ibitWorkArea, lbitWorkArea, modulus, pos, readPos); + } + } + + /** + * EOF + * + * @since 1.7 + */ + static final int EOF = -1; + + /** + * MIME chunk size per RFC 2045 section 6.8. + * + *

+ * The {@value} character limit does not count the trailing CRLF, but counts all other characters, including any + * equal signs. + *

+ * + * @see RFC 2045 section 6.8 + */ + public static final int MIME_CHUNK_SIZE = 76; + + /** + * PEM chunk size per RFC 1421 section 4.3.2.4. + * + *

+ * The {@value} character limit does not count the trailing CRLF, but counts all other characters, including any + * equal signs. + *

+ * + * @see RFC 1421 section 4.3.2.4 + */ + public static final int PEM_CHUNK_SIZE = 64; + + private static final int DEFAULT_BUFFER_RESIZE_FACTOR = 2; + + /** + * Defines the default buffer size - currently {@value} + * - must be large enough for at least one encoded block+separator + */ + private static final int DEFAULT_BUFFER_SIZE = 8192; + + /** Mask used to extract 8 bits, used in decoding bytes */ + protected static final int MASK_8BITS = 0xff; + + /** + * Byte used to pad output. + */ + protected static final byte PAD_DEFAULT = '='; // Allow static access to default + + /** + * @deprecated Use {@link #pad}. Will be removed in 2.0. + */ + @Deprecated + protected final byte PAD = PAD_DEFAULT; // instance variable just in case it needs to vary later + + protected final byte pad; // instance variable just in case it needs to vary later + + /** Number of bytes in each full block of unencoded data, e.g. 4 for Base64 and 5 for Base32 */ + private final int unencodedBlockSize; + + /** Number of bytes in each full block of encoded data, e.g. 3 for Base64 and 8 for Base32 */ + private final int encodedBlockSize; + + /** + * Chunksize for encoding. Not used when decoding. + * A value of zero or less implies no chunking of the encoded data. + * Rounded down to nearest multiple of encodedBlockSize. + */ + protected final int lineLength; + + /** + * Size of chunk separator. Not used unless {@link #lineLength} > 0. + */ + private final int chunkSeparatorLength; + + /** + * Note lineLength is rounded down to the nearest multiple of {@link #encodedBlockSize} + * If chunkSeparatorLength is zero, then chunking is disabled. + * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) + * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) + * @param lineLength if > 0, use chunking with a length lineLength + * @param chunkSeparatorLength the chunk separator length, if relevant + */ + protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize, + final int lineLength, final int chunkSeparatorLength) { + this(unencodedBlockSize, encodedBlockSize, lineLength, chunkSeparatorLength, PAD_DEFAULT); + } + + /** + * Note lineLength is rounded down to the nearest multiple of {@link #encodedBlockSize} + * If chunkSeparatorLength is zero, then chunking is disabled. + * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) + * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) + * @param lineLength if > 0, use chunking with a length lineLength + * @param chunkSeparatorLength the chunk separator length, if relevant + * @param pad byte used as padding byte. + */ + protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize, + final int lineLength, final int chunkSeparatorLength, final byte pad) { + this.unencodedBlockSize = unencodedBlockSize; + this.encodedBlockSize = encodedBlockSize; + final boolean useChunking = lineLength > 0 && chunkSeparatorLength > 0; + this.lineLength = useChunking ? (lineLength / encodedBlockSize) * encodedBlockSize : 0; + this.chunkSeparatorLength = chunkSeparatorLength; + + this.pad = pad; + } + + /** + * Returns true if this object has buffered data for reading. + * + * @param context the context to be used + * @return true if there is data still available for reading. + */ + boolean hasData(final Context context) { // package protected for access from I/O streams + return context.buffer != null; + } + + /** + * Returns the amount of buffered data available for reading. + * + * @param context the context to be used + * @return The amount of buffered data available for reading. + */ + int available(final Context context) { // package protected for access from I/O streams + return context.buffer != null ? context.pos - context.readPos : 0; + } + + /** + * Get the default buffer size. Can be overridden. + * + * @return {@link #DEFAULT_BUFFER_SIZE} + */ + protected int getDefaultBufferSize() { + return DEFAULT_BUFFER_SIZE; + } + + /** + * Increases our buffer by the {@link #DEFAULT_BUFFER_RESIZE_FACTOR}. + * @param context the context to be used + */ + private byte[] resizeBuffer(final Context context) { + if (context.buffer == null) { + context.buffer = new byte[getDefaultBufferSize()]; + context.pos = 0; + context.readPos = 0; + } else { + final byte[] b = new byte[context.buffer.length * DEFAULT_BUFFER_RESIZE_FACTOR]; + System.arraycopy(context.buffer, 0, b, 0, context.buffer.length); + context.buffer = b; + } + return context.buffer; + } + + /** + * Ensure that the buffer has room for size bytes + * + * @param size minimum spare space required + * @param context the context to be used + * @return the buffer + */ + protected byte[] ensureBufferSize(final int size, final Context context){ + if ((context.buffer == null) || (context.buffer.length < context.pos + size)){ + return resizeBuffer(context); + } + return context.buffer; + } + + /** + * Extracts buffered data into the provided byte[] array, starting at position bPos, up to a maximum of bAvail + * bytes. Returns how many bytes were actually extracted. + *

+ * Package protected for access from I/O streams. + * + * @param b + * byte[] array to extract the buffered data into. + * @param bPos + * position in byte[] array to start extraction at. + * @param bAvail + * amount of bytes we're allowed to extract. We may extract fewer (if fewer are available). + * @param context + * the context to be used + * @return The number of bytes successfully extracted into the provided byte[] array. + */ + int readResults(final byte[] b, final int bPos, final int bAvail, final Context context) { + if (context.buffer != null) { + final int len = Math.min(available(context), bAvail); + System.arraycopy(context.buffer, context.readPos, b, bPos, len); + context.readPos += len; + if (context.readPos >= context.pos) { + context.buffer = null; // so hasData() will return false, and this method can return -1 + } + return len; + } + return context.eof ? EOF : 0; + } + + /** + * Checks if a byte value is whitespace or not. + * Whitespace is taken to mean: space, tab, CR, LF + * @param byteToCheck + * the byte to check + * @return true if byte is whitespace, false otherwise + */ + protected static boolean isWhiteSpace(final byte byteToCheck) { + switch (byteToCheck) { + case ' ' : + case '\n' : + case '\r' : + case '\t' : + return true; + default : + return false; + } + } + + /** + * Encodes an Object using the Base-N algorithm. This method is provided in order to satisfy the requirements of + * the Encoder interface, and will throw an EncoderException if the supplied object is not of type byte[]. + * + * @param obj + * Object to encode + * @return An object (of type byte[]) containing the Base-N encoded data which corresponds to the byte[] supplied. + * @throws Exception + * if the parameter supplied is not of type byte[] + */ + public Object encode(final Object obj) throws Exception { + if (!(obj instanceof byte[])) { + throw new Exception("Parameter supplied to Base-N encode is not a byte[]"); + } + return encode((byte[]) obj); + } + + /** + * Encodes a byte[] containing binary data, into a String containing characters in the Base-N alphabet. + * Uses UTF8 encoding. + * + * @param pArray + * a byte array containing binary data + * @return A String containing only Base-N character data + */ + public String encodeToString(final byte[] pArray) { + return newStringUtf8(encode(pArray)); + } + + /** + * Encodes a byte[] containing binary data, into a String containing characters in the appropriate alphabet. + * Uses UTF8 encoding. + * + * @param pArray a byte array containing binary data + * @return String containing only character data in the appropriate alphabet. + */ + public String encodeAsString(final byte[] pArray){ + return newStringUtf8(encode(pArray)); + } + + /** + * Decodes an Object using the Base-N algorithm. This method is provided in order to satisfy the requirements of + * the Decoder interface, and will throw a DecoderException if the supplied object is not of type byte[] or String. + * + * @param obj + * Object to decode + * @return An object (of type byte[]) containing the binary data which corresponds to the byte[] or String + * supplied. + * @throws Exception + * if the parameter supplied is not of type byte[] + */ + public Object decode(final Object obj) throws Exception { + if (obj instanceof byte[]) { + return decode((byte[]) obj); + } else if (obj instanceof String) { + return decode((String) obj); + } else { + throw new Exception("Parameter supplied to Base-N decode is not a byte[] or a String"); + } + } + + /** + * Decodes a String containing characters in the Base-N alphabet. + * + * @param pArray + * A String containing Base-N character data + * @return a byte array containing binary data + */ + public byte[] decode(final String pArray) { + return decode(getBytesUtf8(pArray)); + } + + /** + * Decodes a byte[] containing characters in the Base-N alphabet. + * + * @param pArray + * A byte array containing Base-N character data + * @return a byte array containing binary data + */ + public byte[] decode(final byte[] pArray) { + if (pArray == null || pArray.length == 0) { + return pArray; + } + final Context context = new Context(); + decode(pArray, 0, pArray.length, context); + decode(pArray, 0, EOF, context); // Notify decoder of EOF. + final byte[] result = new byte[context.pos]; + readResults(result, 0, result.length, context); + return result; + } + + /** + * Encodes a byte[] containing binary data, into a byte[] containing characters in the alphabet. + * + * @param pArray + * a byte array containing binary data + * @return A byte array containing only the basen alphabetic character data + */ + public byte[] encode(final byte[] pArray) { + if (pArray == null || pArray.length == 0) { + return pArray; + } + final Context context = new Context(); + encode(pArray, 0, pArray.length, context); + encode(pArray, 0, EOF, context); // Notify encoder of EOF. + final byte[] buf = new byte[context.pos - context.readPos]; + readResults(buf, 0, buf.length, context); + return buf; + } + + // package protected for access from I/O streams + abstract void encode(byte[] pArray, int i, int length, Context context); + + // package protected for access from I/O streams + abstract void decode(byte[] pArray, int i, int length, Context context); + + /** + * Returns whether or not the octet is in the current alphabet. + * Does not allow whitespace or pad. + * + * @param value The value to test + * + * @return true if the value is defined in the current alphabet, false otherwise. + */ + protected abstract boolean isInAlphabet(byte value); + + /** + * Tests a given byte array to see if it contains only valid characters within the alphabet. + * The method optionally treats whitespace and pad as valid. + * + * @param arrayOctet byte array to test + * @param allowWSPad if true, then whitespace and PAD are also allowed + * + * @return true if all bytes are valid characters in the alphabet or if the byte array is empty; + * false, otherwise + */ + public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) { + for (int i = 0; i < arrayOctet.length; i++) { + if (!isInAlphabet(arrayOctet[i]) && + (!allowWSPad || (arrayOctet[i] != pad) && !isWhiteSpace(arrayOctet[i]))) { + return false; + } + } + return true; + } + + /** + * Tests a given String to see if it contains only valid characters within the alphabet. + * The method treats whitespace and PAD as valid. + * + * @param basen String to test + * @return true if all characters in the String are valid characters in the alphabet or if + * the String is empty; false, otherwise + * @see #isInAlphabet(byte[], boolean) + */ + public boolean isInAlphabet(final String basen) { + return isInAlphabet(getBytesUtf8(basen), true); + } + + /** + * Tests a given byte array to see if it contains any characters within the alphabet or PAD. + * + * Intended for use in checking line-ending arrays + * + * @param arrayOctet + * byte array to test + * @return true if any byte is a valid character in the alphabet or PAD; false otherwise + */ + protected boolean containsAlphabetOrPad(final byte[] arrayOctet) { + if (arrayOctet == null) { + return false; + } + for (final byte element : arrayOctet) { + if (pad == element || isInAlphabet(element)) { + return true; + } + } + return false; + } + + /** + * Calculates the amount of space needed to encode the supplied array. + * + * @param pArray byte[] array which will later be encoded + * + * @return amount of space needed to encoded the supplied array. + * Returns a long since a max-len array will require > Integer.MAX_VALUE + */ + public long getEncodedLength(final byte[] pArray) { + // Calculate non-chunked size - rounded up to allow for padding + // cast to long is needed to avoid possibility of overflow + long len = ((pArray.length + unencodedBlockSize-1) / unencodedBlockSize) * (long) encodedBlockSize; + if (lineLength > 0) { // We're using chunking + // Round up to nearest multiple + len += ((len + lineLength-1) / lineLength) * chunkSeparatorLength; + } + return len; + } + + public static Charset UTF8 = Charset.forName("UTF-8"); + + public static String newStringUtf8(byte[] bytes) { + return newString(bytes, UTF8); + } + + private static String newString(final byte[] bytes, final Charset charset) { + return bytes == null ? null : new String(bytes, charset); + } + + public static byte[] getBytesUtf8(final String string) { + return getBytes(string, UTF8); + } + + private static byte[] getBytes(final String string, final Charset charset) { + if (string == null) { + return null; + } + return string.getBytes(charset); + } +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/Cities.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/Cities.java new file mode 100644 index 0000000000..52f63fd167 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/Cities.java @@ -0,0 +1,7 @@ +package com.epmet.util.dh; + +class Cities { + static final int cities [] = { + 350602, 370782, 513431, 532624, 530426, 370203, 350128, 421002, 350624, 430225, 360300, 350203, 220211, 420822, 530625, 653126, 420203, 220182, 230603, 533323, 430121, 621225, 652827, 511500, 450205, 652824, 411402, 440781, 469022, 370214, 542521, 433101, 460100, 530381, 411722, 533400, 110229, 640300, 210700, 450127, 440105, 530828, 120000, 420000, 211402, 341823, 220402, 330500, 371324, 150500, 150927, 321284, 230231, 150926, 630123, 341700, 441400, 542330, 370684, 370828, 654326, 610831, 140300, 350581, 421182, 421200, 341124, 371423, 445302, 513225, 532522, 469026, 450102, 433130, 222406, 511325, 410328, 210422, 430405, 341100, 140212, 445222, 350403, 430521, 520111, 652924, 522201, 542327, 110103, 530826, 630122, 610527, 330481, 522424, 820000, 231081, 410103, 431223, 230524, 441284, 500226, 152524, 211382, 530300, 411102, 410727, 152223, 451200, 610203, 230805, 500116, 341222, 420324, 610500, 141128, 371202, 140426, 510181, 341021, 340421, 130623, 152529, 130626, 530902, 220102, 532801, 220183, 632122, 371622, 140721, 340121, 420503, 632524, 610327, 130500, 152923, 150422, 420528, 140221, 430502, 610921, 422822, 130627, 430105, 410926, 340603, 510321, 211202, 522729, 653100, 421123, 310104, 341282, 410602, 510304, 230712, 320481, 532627, 610800, 610522, 360829, 410105, 410106, 431126, 330127, 131126, 350428, 130930, 430621, 130724, 450681, 411381, 130208, 411200, 522327, 640105, 321282, 632323, 371481, 420800, 621124, 341825, 340300, 450923, 530500, 411423, 150302, 530821, 140802, 310115, 410203, 420116, 371724, 430922, 130800, 150502, 210711, 230207, 511529, 530325, 320402, 542300, 140723, 542221, 511800, 150430, 440700, 220421, 350181, 520329, 350784, 440115, 330304, 411221, 510107, 360803, 520221, 350603, 421003, 411522, 150205, 220503, 620421, 370303, 451031, 150525, 360700, 340711, 620403, 610924, 500117, 542626, 511922, 620800, 450123, 533123, 320900, 410423, 330902, 451002, 623027, 620923, 220204, 420923, 210922, 150429, 150929, 420684, 610427, 150624, 340702, 360313, 320300, 320600, 431228, 621000, 370323, 530421, 640104, 370503, 533421, 420102, 371428, 220105, 350981, 370113, 230503, 130925, 231025, 620300, 341524, 130127, 231200, 130224, 420606, 652922, 371426, 130402, 140826, 511304, 610724, 511823, 542100, 510303, 440113, 500114, 542337, 451381, 513336, 441427, 450311, 630105, 361122, 610829, 360425, 130128, 350105, 511525, 220202, 632724, 350205, 310112, 640303, 623023, 140726, 513229, 330103, 420204, 140725, 350500, 511826, 211322, 630102, 230822, 653022, 130426, 371121, 632200, 640521, 621100, 511524, 130803, 130982, 451202, 350600, 450324, 130424, 510800, 640324, 131028, 450305, 340828, 140423, 654028, 110114, 340503, 653128, 610823, 510184, 310105, 542622, 610821, 511602, 522730, 331000, 360100, 410421, 450107, 150826, 610525, 140922, 140107, 632522, 130283, 130121, 130431, 632523, 430223, 530112, 361023, 361181, 411421, 340302, 654325, 360733, 370322, 450126, 632721, 320924, 430321, 532625, 652927, 440523, 230302, 511702, 361025, 150725, 360731, 321183, 451024, 440404, 320205, 321302, 370306, 371322, 510311, 360102, 431124, 410883, 500238, 230110, 522422, 331123, 411403, 522229, 520424, 510682, 320000, 231102, 652101, 371000, 130107, 420527, 542121, 500112, 150425, 140225, 341623, 331100, 430522, 540123, 500000, 652923, 130726, 150223, 420529, 440783, 530921, 211003, 320281, 513223, 530700, 450400, 331004, 410303, 511681, 640205, 640424, 620821, 441424, 530522, 630000, 370634, 360726, 230604, 150523, 371302, 340323, 141023, 220581, 610431, 610524, 220724, 150922, 410600, 211103, 440800, 632222, 230505, 330211, 360721, 130406, 522627, 422826, 220122, 210882, 230826, 530102, 130921, 469002, 360424, 340123, 220502, 120112, 450422, 370830, 152201, 320107, 361028, 510104, 440923, 654000, 330621, 141034, 450803, 510727, 621222, 530000, 610825, 610302, 510400, 450109, 441202, 429021, 654201, 211300, 140624, 360302, 511528, 130108, 532527, 652826, 520303, 530825, 330322, 511600, 430281, 340406, 230624, 522223, 500235, 220281, 411503, 610322, 411330, 533100, 210122, 411726, 341102, 220181, 530626, 130826, 411622, 232722, 340825, 230102, 441500, 360826, 420111, 141082, 141182, 231281, 620200, 441581, 431129, 440183, 130604, 220800, 532329, 620321, 610526, 510000, 411224, 621022, 130428, 340521, 130205, 421087, 532621, 130628, 310118, 440902, 510502, 321000, 420583, 130804, 542522, 360103, 410800, 420113, 530829, 532524, 421125, 542301, 513424, 460107, 320830, 421000, 513230, 331024, 360222, 220303, 530602, 511522, 130823, 441802, 420881, 330200, 330727, 361124, 530113, 330803, 440114, 210211, 430726, 152526, 533321, 460000, 510600, 411282, 420281, 500118, 522625, 350426, 150522, 330382, 530424, 611023, 130532, 231084, 469031, 150300, 210600, 341302, 130185, 320400, 450330, 445102, 150404, 420506, 410311, 411623, 522401, 440803, 421022, 320114, 451226, 211421, 611024, 360200, 410700, 150222, 371203, 360123, 320703, 210282, 320322, 211221, 433100, 623025, 350505, 330108, 230803, 360732, 510124, 510302, 420106, 430211, 330183, 420205, 640323, 140224, 653226, 321102, 420984, 330424, 441882, 210800, 340500, 140932, 510703, 522631, 230127, 420582, 211302, 330503, 500242, 652302, 371626, 433123, 520321, 210900, 652900, 410184, 654221, 330881, 371081, 410104, 370829, 150104, 450521, 441223, 420600, 460106, 433125, 130630, 370211, 520114, 451423, 230381, 231085, 360321, 340223, 430412, 410811, 130303, 542127, 632621, 220103, 610830, 211121, 650106, 451324, 654322, 430224, 610626, 341821, 150981, 421023, 430203, 441827, 653201, 411000, 211081, 632127, 610624, 370321, 130638, 532530, 210204, 451321, 510525, 140924, 330326, 230203, 520328, 321081, 330782, 350583, 510623, 621025, 622926, 450222, 610404, 431322, 350123, 611021, 371400, 360900, 131023, 360111, 370902, 440281, 131081, 150421, 330329, 340104, 140200, 520200, 610822, 370700, 411600, 341721, 210811, 230705, 341502, 522623, 220622, 130184, 152200, 542424, 130200, 130730, 130400, 430721, 431026, 230902, 140729, 152502, 130522, 652925, 450303, 632626, 350504, 230100, 211011, 530428, 451030, 610422, 450405, 532327, 310108, 371327, 210100, 500113, 371102, 410221, 511821, 542122, 360122, 610828, 350721, 450502, 445321, 511825, 140108, 320504, 513432, 371325, 610623, 431202, 330825, 511725, 150621, 511129, 350623, 430682, 511133, 150103, 110116, 152202, 350481, 451425, 420504, 440300, 522425, 360823, 510403, 620103, 320382, 632722, 421024, 410326, 450421, 220882, 350724, 542329, 370900, 610304, 230500, 341800, 341000, 230882, 610622, 522626, 653124, 230700, 431123, 450122, 620402, 370523, 532628, 451227, 620422, 320721, 210681, 451302, 230707, 130525, 210727, 341421, 420922, 110109, 410402, 350925, 640400, 371122, 450100, 513430, 231224, 433122, 230208, 610727, 610303, 140226, 140429, 330102, 653225, 632726, 522230, 542125, 230703, 341723, 130207, 532502, 620724, 530321, 469028, 131128, 320115, 610402, 320723, 610328, 231002, 140702, 330683, 371312, 230421, 411121, 211303, 410922, 441624, 220700, 370405, 420300, 220282, 370784, 632625, 430529, 510524, 141123, 650200, 140430, 361123, 110000, 370283, 430124, 141181, 420105, 330122, 150100, 511521, 431122, 440308, 222424, 330903, 130625, 210102, 610423, 632624, 513200, 513231, 610521, 440229, 130727, 230230, 210202, 511621, 130404, 520422, 430681, 510521, 532532, 410204, 532323, 130126, 411625, 511100, 320623, 530822, 420381, 350423, 654202, 512022, 220702, 361030, 230711, 210111, 530128, 431302, 341321, 532328, 542334, 140121, 542523, 320507, 620902, 450221, 370612, 410724, 520122, 131182, 431002, 321300, 610502, 522222, 621121, 210403, 370284, 522300, 210423, 420302, 450602, 530326, 350902, 530722, 350781, 330109, 310230, 522723, 610326, 320111, 620822, 350525, 510823, 450981, 630100, 500240, 320305, 361128, 361024, 232700, 341023, 350782, 650202, 532926, 610103, 610923, 350200, 141028, 450512, 513332, 411721, 441481, 431381, 511000, 440205, 430703, 522325, 361129, 130132, 350924, 610632, 131121, 350211, 140421, 421100, 410803, 510626, 321181, 150428, 530624, 361027, 450902, 331082, 360921, 222403, 340881, 231182, 431025, 610926, 511400, 420625, 140322, 370786, 710000, 522328, 370304, 620121, 371523, 420683, 450702, 540124, 360428, 420505, 140105, 411323, 430921, 450921, 320206, 140223, 320506, 620623, 370212, 441200, 360983, 310120, 410400, 430423, 371723, 530422, 320724, 513325, 441324, 530600, 370400, 230722, 610728, 513335, 620982, 110107, 350429, 623021, 230708, 371328, 131082, 441825, 370783, 610400, 140781, 421122, 430300, 513429, 522634, 350825, 500115, 210504, 130722, 430923, 370686, 422827, 141030, 420802, 140603, 422828, 140923, 131026, 542200, 220623, 141027, 360203, 222402, 350824, 513331, 632801, 430603, 140823, 440513, 110102, 120225, 610429, 610826, 350430, 542231, 532531, 420100, 441881, 450200, 532525, 621002, 440606, 511822, 370681, 500101, 371326, 430100, 410900, 532822, 130824, 441226, 410482, 370831, 210321, 513427, 340404, 420104, 610621, 371700, 530622, 511421, 140500, 140829, 371103, 650100, 460108, 360600, 370881, 361021, 371082, 522732, 542226, 150800, 210323, 532301, 430722, 441625, 622901, 371425, 513333, 411321, 440811, 130721, 533325, 530111, 410782, 430624, 210702, 130130, 421222, 411327, 130624, 230108, 231222, 610582, 430981, 410224, 610700, 360830, 130705, 530802, 361125, 220106, 542427, 320411, 652926, 210903, 120223, 330682, 140600, 430700, 411602, 430702, 371726, 440282, 440982, 540122, 360827, 653121, 230715, 530323, 620721, 141031, 610112, 140902, 130183, 622923, 371625, 210603, 532325, 532500, 321100, 320113, 411023, 652122, 513434, 320321, 510105, 430304, 330104, 361127, 440608, 230123, 520112, 542129, 350122, 632128, 654300, 130635, 410381, 650105, 370205, 410181, 511181, 211321, 130733, 542128, 445323, 450821, 621221, 361000, 450329, 360622, 340207, 522428, 530827, 141130, 610631, 620111, 410000, 210522, 220104, 130631, 610102, 140825, 230710, 341702, 650103, 150727, 320802, 542126, 445122, 532528, 522722, 130433, 140921, 522725, 320684, 522200, 440605, 370685, 510903, 652825, 441521, 310103, 320103, 220221, 410711, 623026, 370124, 532600, 130421, 230111, 445100, 320505, 350104, 542422, 230621, 520421, 220323, 130302, 520302, 320405, 331021, 411624, 130203, 469027, 152523, 130133, 542338, 441323, 620500, 420981, 150221, 360782, 150802, 411082, 141100, 610323, 130923, 430611, 360423, 620722, 330206, 640381, 620700, 150921, 370406, 654002, 540127, 410222, 330411, 130629, 510802, 511025, 130322, 450000, 451402, 420321, 150124, 610723, 120110, 371100, 370000, 522601, 150823, 230206, 361026, 610000, 310114, 130223, 530924, 141021, 360802, 420902, 542623, 430725, 451300, 130125, 450332, 632700, 469033, 411329, 530721, 430406, 130637, 331023, 420114, 622921, 150822, 530630, 632725, 421221, 610104, 320705, 370481, 440400, 621126, 530328, 513437, 220723, 450105, 140728, 510812, 230605, 350722, 441623, 520121, 410325, 500236, 140727, 131181, 610116, 370403, 210000, 410411, 469023, 130100, 410122, 410523, 411681, 140122, 360730, 330324, 510421, 320700, 350527, 371500, 440402, 640302, 411024, 500107, 320124, 370921, 370682, 230225, 530900, 530124, 532523, 810000, 371422, 511527, 620823, 411081, 411724, 430822, 340403, 330802, 421083, 421281, 130928, 430811, 210802, 522624, 445281, 520102, 140927, 150625, 511523, 420325, 513330, 140623, 410324, 440825, 431221, 654003, 445300, 341004, 130521, 340208, 410802, 440000, 410183, 422823, 542222, 522426, 621200, 150928, 210803, 650203, 654301, 320903, 341422, 430202, 632121, 650204, 430524, 130481, 542430, 130981, 320324, 210400, 330381, 230183, 431128, 653130, 130929, 321088, 431127, 320921, 330824, 420322, 640181, 530126, 120111, 320804, 371321, 140621, 530628, 150304, 230300, 510114, 542331, 370826, 230704, 610426, 430511, 341622, 430602, 350821, 445202, 371323, 451229, 652829, 533423, 210283, 450600, 230321, 130523, 620100, 530400, 321322, 610824, 451027, 321011, 654223, 410725, 441300, 620522, 411729, 370882, 370785, 520113, 360430, 440233, 542524, 610329, 520325, 110112, 520203, 640122, 659001, 331126, 632822, 361126, 610222, 371524, 231004, 140181, 370305, 350926, 330282, 469006, 610114, 150303, 420624, 340321, 350400, 430421, 430781, 610204, 130534, 451400, 450500, 440785, 340405, 450300, 231000, 410200, 511111, 131003, 620922, 659004, 611000, 610100, 321111, 410825, 542333, 340811, 410225, 532324, 420804, 650205, 640100, 411324, 230804, 140425, 150627, 341802, 130530, 469007, 321023, 652300, 360426, 370213, 411525, 370704, 371424, 542124, 542133, 150200, 542527, 130634, 110104, 230184, 150423, 370102, 421121, 511028, 652328, 130123, 440604, 130535, 210726, 130432, 130706, 232723, 130229, 621228, 320323, 632622, 640121, 230304, 430424, 621224, 610702, 450223, 513224, 330783, 320800, 231202, 510723, 530621, 211422, 530129, 451026, 341221, 152531, 330600, 441900, 340803, 451102, 210213, 622922, 150700, 152221, 320482, 141033, 230900, 230124, 530103, 440222, 451025, 320582, 511902, 210604, 230422, 341822, 410108, 431027, 451225, 130723, 370200, 442000, 652123, 410526, 152530, 520402, 140424, 430381, 500225, 610902, 410302, 440983, 500232, 130225, 440512, 440232, 621026, 410182, 330900, 230221, 361022, 513401, 130300, 411727, 360429, 440802, 610929, 650121, 532927, 230523, 421102, 530925, 360727, 513300, 610722, 654023, 210505, 411122, 321324, 441423, 140123, 469000, 141122, 152900, 371525, 140830, 500233, 211102, 220881, 140722, 150821, 130527, 150207, 620981, 441203, 360728, 653224, 532331, 450503, 330212, 532823, 611002, 620702, 542332, 130429, 130430, 350723, 632600, 542624, 542526, 450226, 130632, 510725, 650107, 230903, 350402, 411100, 360403, 512081, 542132, 152921, 340400, 420500, 450721, 450722, 370112, 530823, 340602, 650104, 340700, 370125, 542232, 530423, 430103, 420700, 540121, 610481, 350305, 330602, 469029, 440882, 220822, 341225, 371721, 130822, 610802, 522726, 511722, 210300, 533124, 653123, 150924, 341003, 532322, 420525, 340800, 370285, 640200, 513433, 350923, 410702, 620621, 130529, 371600, 510724, 610625, 310116, 510122, 410306, 130984, 230904, 130321, 420117, 430426, 542225, 310109, 152522, 411104, 500231, 632802, 340122, 150902, 513328, 410425, 632221, 520330, 532526, 542425, 652100, 532932, 431300, 230702, 420682, 152222, 441426, 320502, 350503, 370687, 510106, 440600, 120115, 652800, 130304, 152525, 451222, 330182, 610126, 340304, 659003, 320200, 430382, 340504, 350425, 640422, 130000, 130423, 522633, 150923, 410928, 320811, 330681, 350900, 130204, 330784, 441602, 360322, 360502, 430581, 440305, 632300, 510704, 610428, 652928, 230128, 220721, 430723, 652929, 210411, 411723, 330110, 140106, 350783, 220722, 410422, 340823, 220300, 632800, 320105, 330522, 230223, 510683, 542123, 360781, 110106, 513322, 360923, 640106, 441823, 542400, 411502, 370602, 610122, 451023, 451481, 320923, 654200, 371502, 532922, 130202, 150526, 542336, 411425, 131002, 371623, 530502, 220582, 370703, 210112, 530922, 653122, 654021, 654022, 500109, 330303, 320585, 450403, 150723, 411728, 341125, 441700, 420581, 420626, 532623, 411500, 620924, 210224, 623022, 421224, 513221, 321323, 632123, 430821, 340621, 371522, 511102, 440306, 500111, 450881, 140900, 611025, 632525, 440511, 622924, 140400, 411103, 141081, 421181, 510811, 441303, 230306, 371402, 230303, 440224, 320826, 410923, 431081, 360724, 411002, 410102, 630104, 522622, 211282, 152528, 654024, 510108, 532326, 429006, 150125, 530181, 211481, 510182, 610528, 650109, 210781, 330300, 370404, 230716, 340822, 220100, 211005, 421126, 350100, 411481, 350524, 542627, 469021, 152224, 320621, 330502, 410527, 420112, 430481, 513323, 652200, 130636, 230407, 130582, 140321, 620600, 360800, 420921, 140100, 411422, 340802, 220284, 350921, 341024, 469003, 410726, 110117, 230307, 510921, 341522, 510132, 440903, 420526, 150900, 130633, 230281, 654025, 231024, 522224, 620400, 510411, 542335, 320211, 410500, 610730, 510300, 510681, 410223, 620104, 150400, 530402, 340000, 141125, 341402, 542421, 350700, 150782, 654321, 420222, 420821, 500241, 410505, 513329, 222400, 522632, 360725, 371200, 310117, 140800, 320503, 371728, 320381, 331122, 230600, 321182, 450302, 360926, 621021, 231005, 141002, 513428, 422801, 220521, 341503, 130903, 621024, 210113, 320202, 640202, 110113, 654027, 650000, 421124, 320304, 340102, 350303, 360602, 140929, 340311, 520327, 421202, 533122, 621102, 620000, 623001, 420107, 610726, 440106, 440100, 451000, 431028, 430400, 610430, 653125, 530723, 653200, 141121, 230200, 532925, 542233, 131100, 410581, 530322, 130926, 320682, 141102, 130181, 130621, 320611, 130983, 131025, 230781, 371482, 533324, 512000, 210503, 430221, 650201, 520181, 441781, 230400, 410404, 371526, 321202, 152527, 371521, 341181, 330921, 340604, 370923, 410704, 510522, 620824, 120105, 510900, 140622, 621023, 130227, 513334, 340200, 370302, 230125, 130182, 540125, 422825, 431230, 441302, 410822, 220681, 130324, 620826, 210181, 511781, 522728, 650102, 522600, 321112, 411281, 150602, 210203, 320829, 330726, 411725, 411523, 130703, 530425, 430122, 411527, 652722, 410728, 440804, 500106, 440900, 513233, 211404, 540000, 370725, 130425, 231121, 500103, 510781, 350111, 130683, 341400, 431022, 441702, 420103, 510504, 211122, 321084, 522727, 610324, 431003, 150206, 450922, 431102, 450224, 360922, 469005, 341521, 429004, 510700, 150783, 410211, 231100, 130524, 130528, 522225, 350213, 230713, 640221, 512002, 511402, 150724, 451224, 141022, 522226, 361100, 370521, 450423, 530324, 360824, 360500, 420702, 130732, 140928, 131022, 451228, 330402, 341203, 350625, 341002, 654225, 410403, 510821, 130827, 522629, 630103, 411325, 370832, 360734, 340111, 542600, 320584, 542328, 500102, 430407, 371727, 410506, 520323, 430302, 450481, 653127, 230714, 140222, 610725, 433126, 150600, 330100, 222404, 141026, 110101, 469030, 350103, 360681, 522322, 510129, 341200, 220322, 441225, 522630, 610827, 640423, 542223, 211004, 131127, 210281, 140428, 341722, 341103, 632821, 500243, 469001, 231123, 360481, 430500, 640522, 440184, 110111, 361002, 653131, 340703, 360729, 370983, 431121, 511123, 320100, 211223, 141025, 522423, 130434, 441422, 532928, 210402, 410781, 513400, 150825, 610331, 441821, 441502, 360825, 440500, 331003, 371624, 370126, 130922, 140211, 350702, 542228, 652901, 410304, 652723, 440104, 150121, 360521, 430104, 450321, 610424, 522702, 320412, 411303, 450124, 510322, 654226, 440103, 451323, 520123, 340303, 520322, 140881, 429005, 411700, 140581, 451021, 620523, 530926, 140981, 451028, 360202, 370300, 411025, 140602, 140524, 150781, 230706, 500237, 610900, 130581, 653101, 320925, 331102, 360881, 542429, 610928, 330203, 450700, 652700, 450802, 210602, 211381, 220602, 451424, 330483, 430528, 441402, 511622, 430111, 420602, 220400, 231221, 360281, 441800, 510402, 130700, 430800, 530627, 652327, 621227, 210421, 330723, 610425, 431224, 120103, 522636, 450804, 230202, 511126, 220422, 150626, 220802, 230305, 441224, 430408, 231083, 371427, 350822, 610628, 500200, 350212, 350000, 210304, 130825, 430626, 231003, 371311, 140110, 230227, 410927, 450621, 230229, 430802, 411626, 440307, 361029, 210804, 621122, 320203, 410603, 130900, 130681, 320583, 411426, 140822, 220605, 320982, 370100, 321003, 441322, 211281, 652223, 371621, 341600, 511300, 610630, 371083, 350124, 230204, 320102, 350521, 542525, 654224, 360735, 450103, 511425, 210911, 513426, 510100, 211403, 150424, 120114, 510121, 532800, 450326, 140522, 210624, 150721, 431100, 330800, 510115, 150123, 450703, 445224, 330105, 330328, 141029, 230406, 350725, 320922, 150403, 360925, 230623, 513326, 513338, 340824, 513232, 430600, 341423, 341424, 150521, 370282, 441283, 320282, 370827, 341324, 420900, 361102, 511424, 330000, 350626, 370281, 511721, 530121, 340203, 321200, 210124, 360121, 532622, 411322, 653024, 140521, 341202, 441600, 522326, 530125, 330226, 511422, 520425, 140427, 210404, 420303, 632521, 150581, 500108, 533300, 230205, 140824, 640402, 511302, 211224, 450924, 451123, 610922, 620524, 530824, 430482, 542426, 422800, 141126, 350622, 320404, 433124, 210104, 430527, 230521, 371300, 231124, 350182, 120221, 431321, 321203, 330283, 440112, 430204, 410202, 430724, 331181, 130927, 542621, 232721, 130924, 130129, 152500, 520100, 341323, 131000, 330523, 331125, 542625, 511024, 513327, 610925, 410300, 220600, 450203, 441721, 431200, 530523, 350982, 411702, 441622, 653000, 370781, 421300, 610581, 522700, 440304, 341122, 410503, 110228, 230800, 640502, 220524, 150785, 511323, 511423, 371581, 320116, 320681, 222405, 341525, 542428, 440116, 430503, 510922, 632100, 130725, 360981, 320104, 450108, 310106, 130728, 330624, 420323, 511923, 522635, 520326, 330400, 340502, 532300, 433127, 421381, 511303, 130702, 500222, 610927, 231223, 130403, 141024, 640000, 431225, 430422, 141129, 630121, 350628, 513436, 620122, 341824, 511124, 460105, 431281, 511322, 530927, 530427, 431024, 653223, 131124, 231283, 640425, 451223, 110108, 140000, 513222, 632321, 340827, 140926, 130435, 320125, 611026, 621123, 220621, 231225, 130427, 230828, 150524, 610111, 610403, 500234, 140525, 520103, 410882, 110115, 540100, 530800, 511526, 230104, 210682, 360821, 410185, 370982, 330482, 361121, 451221, 350424, 340402, 610202, 131122, 211100, 321281, 510503, 370522, 623024, 421081, 210782, 431103, 653023, 130821, 532930, 652823, 510722, 620725, 632224, 410323, 141127, 222426, 469032, 440981, 120113, 513226, 511011, 230709, 320902, 370500, 360124, 532900, 350322, 340202, 532501, 231282, 640500, 341204, 350526, 140930, 411400, 420607, 440784, 520381, 530629, 220500, 542325, 659000, 211400, 440203, 542322, 321002, 411627, 230502, 350800, 620302, 130828, 451121, 411628, 652325, 431226, 520400, 510112, 610721, 150925, 210521, 450603, 140109, 331002, 450800, 522400, 621223, 220000, 340322, 370105, 130729, 210114, 350206, 533422, 371722, 511381, 511724, 542423, 341621, 542229, 230403, 330204, 620825, 350302, 211002, 152501, 320303, 230109, 370800, 340721, 431000, 150702, 211324, 522323, 130682, 419001, 360000, 450331, 140724, 530524, 130684, 360828, 532626, 130533, 140481, 220200, 230833, 522731, 530127, 360402, 441826, 411521, 222401, 140827, 540126, 330521, 532929, 500119, 610602, 340221, 330185, 360421, 610729, 211021, 130531, 411202, 150000, 445121, 410327, 230382, 610330, 510904, 341523, 611022, 620105, 130731, 411528, 150426, 513337, 445221, 350427, 230000, 310101, 410305, 511132, 420703, 360723, 513324, 210502, 360105, 451122, 341226, 500223, 430525, 130230, 330822, 620503, 451281, 220203, 320803, 370502, 610627, 510603, 511502, 610124, 654026, 621226, 321283, 632623, 652222, 131125, 411621, 410322, 440507, 430623, 652301, 513435, 652201, 450900, 420502, 370181, 370705, 371329, 360104, 140931, 410100, 341602, 330702, 410502, 150105, 150623, 451322, 230129, 445200, 510500, 441523, 410821, 211000, 532931, 140821, 450328, 331022, 542323, 140227, 532901, 610113, 512021, 420704, 220821, 140431, 440883, 130526, 610115, 340103, 532923, 410329, 410522, 350823, 430102, 120104, 652801, 620423, 522228, 130600, 654323, 210881, 310000, 620521, 331124, 210200, 130131, 330703, 511112, 622925, 431382, 513321, 632324, 220382, 360400, 320706, 632322, 341022, 610600, 150722, 620622, 360924, 532529, 510726, 431227, 500110, 510113, 320831, 511900, 510923, 371421, 530923, 140828, 430902, 652828, 451421, 450225, 210381, 210905, 620123, 420200, 360427, 431222, 500229, 511321, 520324, 131123, 360902, 440204, 542224, 230405, 141124, 410611, 430903, 210921, 653001, 622900, 440607, 511827, 341322, 350681, 410721, 510824, 530521, 150622, 620900, 370683, 652323, 230606, 450325, 421127, 659002, 530623, 370811, 411424, 410823, 220302, 430523, 511802, 511921, 430200, 231226, 620802, 350582, 445381, 511700, 511623, 230103, 513422, 141000, 411526, 610523, 370613, 210904, 450322, 210703, 632723, 331127, 150726, 350629, 620525, 371725, 530100, 230602, 520382, 510822, 511824, 130281, 430900, 341500, 150784, 310110, 210123, 371602, 542227, 411300, 440515, 220381, 361130, 410902, 520201, 451422, 130603, 500105, 500230, 440703, 230182, 440303, 330421, 450304, 522324, 441723, 653221, 350802, 431229, 220112, 370600, 230921, 210500, 450327, 469025, 341300, 411302, 632823, 513227, 440823, 511723, 653129, 410621, 430000, 620602, 350922, 513423, 131102, 632126, 140925, 410703, 440705, 411328, 130622, 621125, 341182, 410804, 120106, 500104, 520423, 653222, 430181, 445322, 450204, 350502, 230224, 620921, 370202, 370883, 330700, 410205, 320981, 350300, 370724, 320311, 450404, 130124, 150203, 140700, 331121, 530724, 622927, 542324, 230126, 511113, 620502, 653227, 140303, 230622, 360323, 610125, 230881, 610629, 350627, 510183, 150122, 210103, 341881, 371702, 340222, 360702, 230522, 520222, 330225, 520000, 320581, 530122, 140882, 511324, 371002, 370611, 440514, 513425, 620723, 533103, 441621, 411326, 522227, 500224, 141032, 331081, 320722, 360982, 220283, 130323, 231181, 421223, 522628, 450125, 350421, 370911, 350125, 440403, 652324, 469024, 411222, 533102, 422802, 210212, 510422, 150402, 152922, 431023, 522427, 610300, 340826, 360722, 370104, 530302, 654324, 330281, 421303, 623000, 632500, 210311, 460200, 441421, 500227, 150824, 510131, 410481, 310113, 321311, 150202, 131024, 340600, 652701, 420982, 431125, 652822, 370702, 330302, 330327, 431021, 330922, 522301, 532924, 211200, 350881, 542326, 360822, 620102, 542500, 621202, 621027, 450323, 440200, 420202, 500228, 520300, 340100, 220523, 440704, 320500, 320204, 210105, 330781, 451022, 451029, 632223, 513228, 411524, 341126, 451100, 530702, 440881, 410622, 350121, 420115, 610200, 350304, 320602, 522701 + }; +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhCloudProperties.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhCloudProperties.java new file mode 100644 index 0000000000..f482ee1b8b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhCloudProperties.java @@ -0,0 +1,60 @@ +package com.epmet.util.dh; + +import org.springframework.stereotype.Component; + +/** + * 海康设备参数 + * + * @author zhy + * @date 2022/5/20 14:59 + */ +@Component +public class DhCloudProperties { + + /** + * URL + */ + private String url; + + /** + * 账号 + */ + private String loginName; + + + /** + * 账号密码 + */ + private String loginPass; + + public DhCloudProperties() { + url = "http://112.6.213.175:8314"; + loginName = "shundeju"; + loginPass = "hg123456"; + } + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getLoginPass() { + return loginPass; + } + + public void setLoginPass(String loginPass) { + this.loginPass = loginPass; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhDeviceUtil.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhDeviceUtil.java new file mode 100644 index 0000000000..dd6f82f6f1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhDeviceUtil.java @@ -0,0 +1,904 @@ +package com.epmet.util.dh; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.dto.DhTokenDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.DhChannelResultDTO; +import net.coobird.thumbnailator.Thumbnails; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.imageio.ImageIO; +import javax.xml.bind.DatatypeConverter; +import java.awt.image.BufferedImage; +import java.io.*; +import java.math.BigDecimal; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.*; + +/** + * 海康设备下放命令 + * + * @author zhy + * @date 2022/5/20 9:36 + */ +@Component +public class DhDeviceUtil { + private static Logger logger = LoggerFactory.getLogger(DhDeviceUtil.class); + + @Autowired + private DhCloudProperties dhCloudProperties; + + @Autowired + private RedisUtils redisUtils; + + private final String GET_PUBLIC_KEY = "/WPMS/getPublicKey"; + private final String GET_LOGIN_PASS = "/WPMS/login"; + private final String GET_DEPARTMENT = "/CardSolution/card/department"; + private final String GET_NODE = "/CardSolution/resource/tree/nodeList"; + private final String GET_CHANNEL = "/admin/rest/api"; + private final String GET_PERSON_IDENTITY = "/CardSolution/card/person/personidentity"; + private final String GET_DOOR_PLAN = "/CardSolution/card/accessControl/timeQuantum/1/page"; + private final String GET_DOOR_CHANNEL = "/CardSolution/card/accessControl/channel/bycondition/combined"; + private final String ADD_PERSON = "/CardSolution/card/person"; + private final String LIST_PERSON = "/CardSolution/card/person/bycondition/combined"; + private final String DEL_PERSON = "/CardSolution/card/person/delete"; + private final String ADD_PERSON_IMG = "/CardSolution/common/saveMobileBase64ImageToByte"; + private final String ADD_AUTH = "/CardSolution/card/accessControl/doorAuthority/update"; + private final String LIST_CARD = "/CardSolution/card/card/bycondition/combined"; + private final String DEL_CARD = "/CardSolution/card/card/returnByNumber/"; + private final String OPEN_CARD = "/CardSolution/card/card/open/batch"; + + + /** + * 主方法,准备下发开门权限 + * + * @param dto + * @return void + * @author zhy + * @date 2022/8/17 15:24 + */ + public void sendAuth(VisitVisitorFormDTO dto) { + if (StringUtils.isBlank(dto.getIdCard())) { + dto.setIdCard(IDUtils.getIdNo(new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD).format(new Date()), true)); + } + + DhPersonFormDTO formDTO = new DhPersonFormDTO(); + formDTO.setPaperType("身份证"); + formDTO.setPaperNumber(dto.getIdCard()); + formDTO.setName(dto.getName()); + formDTO.setCode(dto.getIdCard().substring(dto.getIdCard().length() - 10)); + formDTO.setSex(IDUtils.getSex(dto.getIdCard())); + formDTO.setBirthday(dto.getIdCard().substring(6, 10) + "-" + dto.getIdCard().substring(10, 12) + "-" + dto.getIdCard().substring(12, 14)); + formDTO.setPhone(dto.getMobile()); + formDTO.setStatus("在职"); + addPersonAuth(formDTO, dto.getFaceImg(), dto.getNode()); + } + + /** + * 获取publicKey + * + * @param + * @return void + * @author zhy + * @date 2022/5/20 16:40 + */ + private String getPublicKey() { + String key = RedisKeys.getDhPublicKey(); + Object obj = redisUtils.get(key); + if (null != obj) { + return (String) obj; + } + + String url = dhCloudProperties.getUrl().concat(GET_PUBLIC_KEY); + Map paramsMap = new HashMap<>(4); + + DhPublicKeyFormDTO dto = new DhPublicKeyFormDTO(); + dto.setLoginName(dhCloudProperties.getLoginName()); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "publicKey获取失败"); + } + + JSONObject toResult = JSON.parseObject(data); + if (!toResult.containsKey("publicKey")) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "publicKey获取失败"); + } + String publicKey = toResult.get("publicKey").toString(); + + redisUtils.set(key, publicKey, RedisUtils.MINUTE_THIRTY_EXPIRE); + return publicKey; + } + + /** + * 获取loginPass + * + * @param + * @return void + * @author zhy + * @date 2022/5/20 16:40 + */ + private DhTokenDTO getLoginPass(String publicKey) { + String key = RedisKeys.getDhToken(); + Object obj = redisUtils.get(key); + if (null != obj) { + return (DhTokenDTO) obj; + } + + String url = dhCloudProperties.getUrl().concat(GET_LOGIN_PASS); + Map paramsMap = new HashMap<>(4); + + DhLoginPassFormDTO dto = new DhLoginPassFormDTO(); + dto.setLoginName(dhCloudProperties.getLoginName()); + String pwd; + try { + pwd = RSAUtils.getPwdByRsa(publicKey, dhCloudProperties.getLoginPass()); + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "loginPass加密失败"); + } + dto.setLoginPass(pwd); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "loginPass获取失败"); + } + + JSONObject toResult = JSON.parseObject(data); + if (!toResult.containsKey("token")) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "loginPass获取失败"); + } + DhTokenDTO token = new DhTokenDTO(); + token.setId(toResult.get("id").toString()); + token.setLoginName(toResult.get("loginName").toString()); + token.setPublicKey(toResult.get("publicKey").toString()); + token.setToken(toResult.get("token").toString()); + redisUtils.set(key, token, RedisUtils.MINUTE_THIRTY_EXPIRE); + return token; + } + + /** + * 新增部门 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + private Long getDept() { + String url = dhCloudProperties.getUrl().concat(GET_DEPARTMENT); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); +// DhDeptFormDTO dto = new DhDeptFormDTO(); +// dto.setName("访客部门"); +// dto.setParentId(1L); + + String data = HttpClientManager.getInstance().sendGet(url, paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + for (int i = 0; i < jsonArray.size(); i++) { + if ("临时人员".equals(jsonArray.getJSONObject(i).get("name").toString())) { + return Long.parseLong(jsonArray.getJSONObject(i).get("id").toString()); + } + } + + return null; + } + + /** + * 查询节点 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + private String getNode(String nodeName) { + String url = dhCloudProperties.getUrl().concat(GET_NODE); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhNodeFormDTO dto = new DhNodeFormDTO(); + dto.setNodeId("ORG_001"); + dto.setTypeCode("01;0;8;7"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询节点列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询节点列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + for (int i = 0; i < jsonArray.size(); i++) { + if (nodeName.equals(jsonArray.getJSONObject(i).get("name").toString())) { + return jsonArray.getJSONObject(i).get("id").toString(); + } + } + + return null; + } + + /** + * 人员预处理 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + private void personHandle(String code) { + String url = dhCloudProperties.getUrl().concat(LIST_PERSON); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhPersonPageFormDTO dto = new DhPersonPageFormDTO(); + dto.setPageNum(1); + dto.setPageSize(100); + dto.setCode(code); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询人员列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询人员列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + List ids = new ArrayList<>(); + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + for (int i = 0; i < jsonArray.size(); i++) { + ids.add(Integer.parseInt(jsonArray.getJSONObject(i).get("id").toString())); + } + if (!ids.isEmpty()) { + DhPersonDelFormDTO del = new DhPersonDelFormDTO(); + del.setPersonIds(ids); + delPerson(del); + } + + } + + /** + * 卡片预处理 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + private void cardHandle(String code) { + String url = dhCloudProperties.getUrl().concat(LIST_CARD); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhCardPageFormDTO dto = new DhCardPageFormDTO(); + dto.setPageNum(1); + dto.setPageSize(100); + dto.setPersonCode(code); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询卡片列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询卡片列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + for (int i = 0; i < jsonArray.size(); i++) { + delCard(jsonArray.getJSONObject(i).get("cardNumber").toString()); + } + } + + /** + * 删除人员 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + private void delPerson(DhPersonDelFormDTO dto) { + String url = dhCloudProperties.getUrl().concat(DEL_PERSON); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "删除人员失败"); + } + } + + /** + * 退卡 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + private void delCard(String cardNum) { + String url = dhCloudProperties.getUrl().concat(DEL_CARD); + url = url + cardNum; + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "删除卡片失败"); + } + } + + /** + * 获取身份 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private String getIdentity() { + String url = dhCloudProperties.getUrl().concat(GET_PERSON_IDENTITY); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); +// DhIdentityFormDTO dto = new DhIdentityFormDTO(); +// dto.setName("访客"); +// dto.setSubsidyAmount(0D); +// dto.setIsCashRecharge(1); +// dto.setIsMachineRecharge(1); + + String data = HttpClientManager.getInstance().sendGet(url, paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + for (int i = 0; i < jsonArray.size(); i++) { + if ("默认身份".equals(jsonArray.getJSONObject(i).get("name").toString())) { + return jsonArray.getJSONObject(i).get("id").toString(); + } + } + + return ""; + } + + /** + * 获取开门计划 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private Long getPlan() { + String url = dhCloudProperties.getUrl().concat(GET_DOOR_PLAN); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhPlanPageFormDTO dto = new DhPlanPageFormDTO(); + dto.setPageNum(1); + dto.setPageSize(100); + dto.setSingleCondition("默认"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + + if (jsonArray.size() > 0) { + return Long.parseLong(jsonArray.getJSONObject(0).get("id").toString()); + } + + return null; + } + + /** + * 查询通道 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private List getChannel() { + String url = dhCloudProperties.getUrl().concat(GET_DOOR_CHANNEL); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhChannelPageFormDTO dto = new DhChannelPageFormDTO(); + dto.setPageSize(100); + dto.setPageNum(1); + dto.setDeviceGenre("0"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + + List list = new ArrayList<>(); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonItem = jsonArray.getJSONObject(i); + DhChannelResultDTO channel = new DhChannelResultDTO(); + channel.setPrivilegeType("1"); + channel.setResouceCode(jsonItem.get("channelCode").toString()); + list.add(channel); + } + + return list; + } + + /** + * 查询通道-从全部设备中获取 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private List getAllChannel(String nodeName) { + String nodeId = getNode(nodeName); + if (StringUtils.isBlank(nodeId)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询节点失败"); + } + nodeId = nodeId.replaceAll("ORG_", ""); + String url = dhCloudProperties.getUrl().concat(GET_CHANNEL); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhChannelFormDTO dto = new DhChannelFormDTO(); + dto.setInterfaceId("admin_001_006"); + dto.setJsonParam("{\"param\":{\"unitType\":7,\"orgCode\":\"" + nodeId + "\"}}"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + + List list = new ArrayList<>(); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonItem = jsonArray.getJSONObject(i); + DhChannelResultDTO channel = new DhChannelResultDTO(); + channel.setPrivilegeType("1"); + channel.setResouceCode(jsonItem.get("channelId").toString()); + list.add(channel); + } + + return list; + } + + /** + * 新增人员 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private Long addPerson(DhPersonFormDTO dto) { + // 数据预处理 + dataHandle(dto.getCode()); + + String url = dhCloudProperties.getUrl().concat(ADD_PERSON); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Long deptId = getDept(); + if (null == deptId) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询临时人员部门失败"); + } + String identity = getIdentity(); + if (StringUtils.isBlank(identity)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份失败"); + } + dto.setDeptId(deptId); + dto.setPersonIdentityId(identity); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "新增人员失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "新增人员失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + if (null != registerResult) { + return Long.parseLong(registerResult.toString()); + } + return null; + } + + /** + * 下发人员头像 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private String addPersonImg(DhPersonFormDTO dto, String imgUrl) { + DhPersonImgFormDTO imgFormDTO = new DhPersonImgFormDTO(); + String url = dhCloudProperties.getUrl().concat(ADD_PERSON_IMG); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + imgFormDTO.setPersonCode(dto.getCode()); + imgFormDTO.setBase64file(getBase64ByUrl(imgUrl)); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(imgFormDTO), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员头像失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员头像失败!" + result.getErrMsg()); + } else { + return "success"; + } + } + + /** + * 人员开卡 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private String addPersonCard(DhPersonFormDTO dto) { + Long personId = addPerson(dto); + if (personId == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "添加人员信息失败"); + } + DhPersonCardListFormDTO cardListFormDTO = new DhPersonCardListFormDTO(); + List cardList = new ArrayList<>(); + DhPersonCardFormDTO cardFormDTO = new DhPersonCardFormDTO(); + String url = dhCloudProperties.getUrl().concat(OPEN_CARD); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + cardFormDTO.setPersonId(personId); + cardFormDTO.setPersonName(dto.getName()); + cardFormDTO.setCardNumber(generateNiceString(8)); + cardFormDTO.setCardType("0"); + cardFormDTO.setCategory("0"); + cardFormDTO.setCardStatus("ACTIVE"); + cardFormDTO.setStartDate(LocalDate.now().minusDays(1L).toString()); + cardFormDTO.setEndDate(LocalDate.now().plusDays(1L).toString()); + String pwd; + try { + pwd = RSAUtils.getPwdByRsa(getPublicKey(), "123456"); + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "密码加密失败"); + } + cardFormDTO.setCardPassword(pwd); + cardFormDTO.setSubSystems("1"); + cardList.add(cardFormDTO); + cardListFormDTO.setObjectList(cardList); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(cardListFormDTO), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员开卡失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员开卡失败!" + result.getErrMsg()); + } else { + return cardFormDTO.getCardNumber(); + } + } + + /** + * 下发人员权限 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + private String addPersonAuth(DhPersonFormDTO dto, String imgUrl, String node) { + String personCard = addPersonCard(dto); + if (StringUtils.isBlank(personCard)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "开卡失败"); + } else if (StringUtils.isNotBlank(imgUrl)) { + addPersonImg(dto, imgUrl); + } + +// List channel = getAllChannel(node); + List channel = getChannel(); + if (channel.isEmpty()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取通道失败"); + } + + Long plan = getPlan(); + if (plan == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取开门计划失败"); + } + + DhAuthFormDTO authFormDTO = new DhAuthFormDTO(); + String url = dhCloudProperties.getUrl().concat(ADD_AUTH); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + authFormDTO.setCardNumber(personCard); + authFormDTO.setTimeQuantumId(plan.toString()); + authFormDTO.setCardPrivilegeDetails(channel); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(authFormDTO), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员权限失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员权限失败!" + result.getErrMsg()); + } else { + return "success"; + } + } + + /** + * 拼接url固定参数 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/7/28 16:09 + */ + private String getDhUrlParams() { + DhTokenDTO token = getLoginPass(getPublicKey()); + return "?userId=" + token.getId() + "&username=" + token.getLoginName() + "&token=" + token.getToken(); + } + + private String getBase64ByUrl(String imgUrl) { + String ossDomain; + byte[] fileBytes; + try { + URL url = new URL(imgUrl); + DataInputStream dataInputStream = new DataInputStream(url.openStream()); + byte[] originBytes = toByteArray(dataInputStream); + + fileBytes = compressPicCycle(originBytes, 100L, 0.3); + } catch (IOException e) { + logger.error("图片上传异常", e); + throw new RenException("图片上传异常"); + } + return DatatypeConverter.printBase64Binary(fileBytes); + } + + /** + * @param bytes 原图片字节数组 + * @param desFileSize 指定图片大小,单位 kb + * @param accuracy 精度,递归压缩的比率,建议小于0.9 + * @return + */ + private byte[] compressPicCycle(byte[] bytes, long desFileSize, double accuracy) throws IOException { + // 获取目标图片 + long fileSize = bytes.length; + System.out.println("=====fileSize======== " + fileSize); + // 判断图片大小是否小于指定图片大小 + if (fileSize <= desFileSize * 1024) { + return bytes; + } + //计算宽高 + BufferedImage bim = ImageIO.read(new ByteArrayInputStream(bytes)); + int imgWidth = bim.getWidth(); + System.out.println(imgWidth + "====imgWidth====="); + int imgHeight = bim.getHeight(); + int desWidth = new BigDecimal(imgWidth).multiply(new BigDecimal(accuracy)).intValue(); + System.out.println(desWidth + "====desWidth====="); + int desHeight = new BigDecimal(imgHeight).multiply(new BigDecimal(accuracy)).intValue(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); //字节输出流(写入到内存) + Thumbnails.of(new ByteArrayInputStream(bytes)).size(desWidth, desHeight).outputQuality(accuracy).toOutputStream(baos); + //如果不满足要求,递归直至满足要求 + return compressPicCycle(baos.toByteArray(), desFileSize, accuracy); + } + + /** + * inputstream输入流转换成byte[]字节数组 + * + * @param input + * @return byte[] + * @author yinzuomei + * @date 2020/2/27 16:09 + */ + private byte[] toByteArray(InputStream input) throws IOException { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024 * 4]; + int n = 0; + while (-1 != (n = input.read(buffer))) { + output.write(buffer, 0, n); + } + return output.toByteArray(); + } + + /** + * 随机生成16进制字符串 + * + * @param len + * @return java.lang.String + * @author zhy + * @date 2022/7/29 9:47 + */ + private String generateNiceString(int len) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < len; i++) { + sb.append(Integer.toHexString(new Random().nextInt(16))); + } + return sb.toString().toUpperCase(); + } + + /** + * 退卡,然后删除人员 + * + * @param code + * @return void + * @author zhy + * @date 2022/8/3 10:48 + */ + private void dataHandle(String code) { + // 先退卡 + cardHandle(code); + // 再删人员 + personHandle(code); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhResult.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhResult.java new file mode 100644 index 0000000000..99149c1814 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/DhResult.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.util.dh; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.commons.tools.utils.MessageUtils; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; + +/** + * 响应数据 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public class DhResult implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 编码:0表示成功,其他值表示失败 + */ + private Integer code = 0; + /** + * 消息内容 + */ + private String errMsg = "success"; + + /** + * 内部信息 + */ + private Boolean success = true; + + /** + * 响应数据 + */ + private T data; + + public DhResult ok(T data) { + this.setData(data); + return this; + } + + public boolean success(){ + return code == 0; + } + + /** + * 返回 + * "code": 8000, + * "msg": "服务器开小差了...", + */ + public DhResult error() { + this.code = EpmetErrorCode.SERVER_ERROR.getCode(); + this.errMsg = EpmetErrorCode.getMsg(code); + if (StringUtils.isBlank(this.errMsg)) { + this.errMsg = MessageUtils.getMessage(this.code); + } + return this; + } + + /** + * 根据错误编码查询msg返回 + */ + public DhResult error(int code) { + this.code = code; + this.errMsg = EpmetErrorCode.getMsg(code); + if (StringUtils.isBlank(this.errMsg)) { + this.errMsg = MessageUtils.getMessage(this.code); + } + return this; + } + + /** + * 传入错误编码+msg返回 + */ + public DhResult error(int code, String msg) { + this.code = code; + this.errMsg = msg; + return this; + } + + /** + * + * @param msg + * @return 此方法废弃,统一使用 + * logger.error(XXXX); + * throw new RenException(XXXX); + * XXXX定义常量里 + */ + @Deprecated + public DhResult error(String msg) { + this.code = ErrorCode.INTERNAL_SERVER_ERROR; + this.errMsg = msg; + return this; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getErrMsg() { + return errMsg; + } + + public void setErrMsg(String errMsg) { + this.errMsg = errMsg; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + @Override + public String toString() { + return JSON.toJSONString(this); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/IDUtils.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/IDUtils.java new file mode 100644 index 0000000000..706be9231e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/IDUtils.java @@ -0,0 +1,85 @@ +package com.epmet.util.dh; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Random; + +public class IDUtils { + public static String getIdNo(boolean male) { + //随机生成生日 1~99岁 + long begin = System.currentTimeMillis() - 3153600000000L;//100年内 + long end = System.currentTimeMillis() - 31536000000L; //1年内 + long rtn = begin + (long) (Math.random() * (end - begin)); + Date date = new Date(rtn); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); + String birth = simpleDateFormat.format(date); + return getIdNo(birth, male); + } + + public static String getIdNo(String birth, boolean male) { + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + int value = random.nextInt(Cities.cities.length); + sb.append(Cities.cities[value]); + sb.append(birth); + value = random.nextInt(999) + 1; + if (male && value % 2 == 0) { + value++; + } + if (!male && value % 2 == 1) { + value++; + } + if (value >= 100) { + sb.append(value); + } else if (value >= 10) { + sb.append('0').append(value); + } else { + sb.append("00").append(value); + } + sb.append(calcTrailingNumber(sb)); + return sb.toString(); + } + + private static final int[] calcC = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; + private static final char[] calcR = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'}; + + private static char calcTrailingNumber(StringBuilder sb) { + int[] n = new int[17]; + int result = 0; + for (int i = 0; i < n.length; i++) { + n[i] = Integer.parseInt(String.valueOf(sb.charAt(i))); + } + for (int i = 0; i < n.length; i++) { + result += calcC[i] * n[i]; + } + return calcR[result % 11]; + } + + /** + * 根据身份证号判断用户性别 + * + * @param cardNo + * @return + */ + public static String getSex(String cardNo) { + String sexStr = "0"; + if (cardNo.length() == 15) { + sexStr = cardNo.substring(14, 15); + } else if (cardNo.length() == 18) { + sexStr = cardNo.substring(16, 17); + } + int sexNo = Integer.parseInt(sexStr); + return sexNo % 2 == 0 ? "女" : "男"; + } + +// public static void main(String[] args) { +// long a = System.currentTimeMillis(); +// System.out.println(getIdNo("19790306", true)); +// System.out.println(getIdNo("20100112", false)); +// System.out.println(getIdNo(true)); +// System.out.println(getIdNo(false)); +// a = System.currentTimeMillis() - a; +// System.out.println(a); +// } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/RSAUtils.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/RSAUtils.java new file mode 100644 index 0000000000..88a2752e03 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/util/dh/RSAUtils.java @@ -0,0 +1,316 @@ +package com.epmet.util.dh; + +import cn.hutool.core.codec.Base64; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import javax.crypto.Cipher; +import java.security.*; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.Map; + +/** + * + *

Title:RSAUtils

+ *

Description:RSA工具类

+ *

Company:浙江大华技术股份有限公司

+ * @author 32174 + * @date 2018年12月18日 + */ +public class RSAUtils{ + public static final String KEY_ALGORITHM = "RSA"; + public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; + public static final String PADDING="RSA/None/PKCS1Padding"; + + private static final String PUBLIC_KEY = "RSAPublicKey"; + private static final String PRIVATE_KEY = "RSAPrivateKey"; + + private static final int KEY_SIZE = 1024; // 秘钥长度1024,最长加密117字节明文 + + static{ + Security.addProvider(new BouncyCastleProvider()); + } + /** + * 用私钥对信息生成数字签名 + * + * @param data + * 加密数据 + * @param privateKey + * 私钥 + * + * @return + * @throws Exception + */ + public static String sign(byte[] data, String privateKey) throws Exception { + // 解密由base64编码的私钥 + byte[] keyBytes = decryptBASE64(privateKey); + + // 构造PKCS8EncodedKeySpec对象 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + + // KEY_ALGORITHM 指定的加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + + // 取私钥匙对象 + PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 用私钥对信息生成数字签名 + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initSign(priKey); + signature.update(data); + + return encryptBASE64(signature.sign()); + } + + /** + * BASE64加密 + * + * @param key + * @return + * @throws Exception + */ + public static String encryptBASE64(byte[] key) throws Exception { + return Base64Util.encodeBase64String(key); + } + + /** + * BASE64解密 + * + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptBASE64(String key) throws Exception { + return Base64Util.decodeBase64(key.getBytes()); + } + + /** + * 校验数字签名 + * + * @param data + * 加密数据 + * @param publicKey + * 公钥 + * @param sign + * 数字签名 + * + * @return 校验成功返回true 失败返回false + * @throws Exception + * + */ + public static boolean verify(byte[] data, String publicKey, String sign) + throws Exception { + + // 解密由base64编码的公钥 + byte[] keyBytes = decryptBASE64(publicKey); + + // 构造X509EncodedKeySpec对象 + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); + + // KEY_ALGORITHM 指定的加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + + // 取公钥匙对象 + PublicKey pubKey = keyFactory.generatePublic(keySpec); + + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initVerify(pubKey); + signature.update(data); + + // 验证签名是否正常 + return signature.verify(decryptBASE64(sign)); + } + + /** + * 解密
+ * 用私钥解密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptByPrivateKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得私钥 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 对数据解密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + + return cipher.doFinal(data); + } + + /** + * 解密
+ * 用公钥解密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptByPublicKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得公钥 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicKey = keyFactory.generatePublic(x509KeySpec); + + // 对数据解密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.DECRYPT_MODE, publicKey); + + return cipher.doFinal(data); + } + + /** + * 加密
+ * 用公钥加密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] encryptByPublicKey(byte[] data, String key) + throws Exception { + // 对公钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得公钥 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicKey = keyFactory.generatePublic(x509KeySpec); + + // 对数据加密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + + return cipher.doFinal(data); + } + + /** + * 加密
+ * 用私钥加密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] encryptByPrivateKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得私钥 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 对数据加密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.ENCRYPT_MODE, privateKey); + + return cipher.doFinal(data); + } + + /** + * 取得私钥(BASE64编码) + * + * @param keyMap + * @return + * @throws Exception + */ + public static String getPrivateKey(Map keyMap) + throws Exception { + Key key = (Key) keyMap.get(PRIVATE_KEY); + + return encryptBASE64(key.getEncoded()); + } + + /** + * 取得公钥(BASE64编码) + * + * @param keyMap + * @return + * @throws Exception + */ + public static String getPublicKey(Map keyMap) + throws Exception { + Key key = (Key) keyMap.get(PUBLIC_KEY); + + return encryptBASE64(key.getEncoded()); + } + + /** + * 判断字符串是否被公钥加密 + * @param text + * @param privateKey + * @return + */ + public static boolean isTextEncryptByPublicKey(String text , String privateKey){ + boolean bol = true; + try{ + byte[] encryBytes = RSAUtils.decryptBASE64(text); + RSAUtils.decryptByPrivateKey(encryBytes, privateKey); + }catch(Exception e){ + bol = false; + } + return bol; + } + + /** + * 初始化密钥 + * + * @return + * @throws Exception + */ + public static Map initKey() throws Exception { + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM , BouncyCastleProvider.PROVIDER_NAME); + keyPairGen.initialize(KEY_SIZE , new SecureRandom()); + + KeyPair keyPair = keyPairGen.generateKeyPair(); + + // 公钥 + RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); + + // 私钥 + RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); + + Map keyMap = new HashMap(2); + + keyMap.put(PUBLIC_KEY, publicKey); + keyMap.put(PRIVATE_KEY, privateKey); + return keyMap; + } + + /** + * 密码加密 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/7/29 10:46 + */ + public static String getPwdByRsa(String publicKey, String str) throws Exception { + byte[] decoded = Base64.decode(publicKey); + RSAPublicKey pubKey =(RSAPublicKey)KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));// RSA加密 + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, pubKey); + return Base64.encode(cipher.doFinal(str.getBytes("UTF-8"))); + } +} diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 2dd7087887..9ac250d741 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -32,6 +32,102 @@ spring: cluster: nodes: @spring.redis.cluster.nodes@ max-redirects: @spring.redis.cluster.max-redirects@ + shardingsphere: + enabled: false +# sharding: +# default-data-source-name: master +# masterslave: +# name: ms +# master-data-source-name: master +# slave-data-source-names: slave1,slave2 +# #配置slave节点的负载均衡均衡策略,采用轮询机制 +# load-balance-algorithm-type: round_robin +# datasource: +# names: master,slave1,slave2 +# master: +# #MySQL +# type: com.alibaba.druid.pool.DruidDataSource +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: @spring.datasource.druid.url@ +# username: @spring.datasource.druid.username@ +# password: @spring.datasource.druid.password@ +# initial-size: 10 +# max-active: 100 +# min-idle: 10 +# max-wait: 60000 +# pool-prepared-statements: true +# max-pool-prepared-statement-per-connection-size: 20 +# time-between-eviction-runs-millis: 60000 +# min-evictable-idle-time-millis: 300000 +# #Oracle需要打开注释 +# #validation-query: SELECT 1 FROM DUAL +# test-while-idle: true +# test-on-borrow: false +# test-on-return: false +# filter: +# stat: +# log-slow-sql: false +# slow-sql-millis: 1000 +# merge-sql: false +# wall: +# config: +# multi-statement-allow: true +# slave1: +# #MySQL +# type: com.alibaba.druid.pool.DruidDataSource +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: @spring.datasource.slave1.url@ +# username: @spring.datasource.slave1.username@ +# password: @spring.datasource.slave1.password@ +# initial-size: 10 +# max-active: 100 +# min-idle: 10 +# max-wait: 60000 +# pool-prepared-statements: true +# max-pool-prepared-statement-per-connection-size: 20 +# time-between-eviction-runs-millis: 60000 +# min-evictable-idle-time-millis: 300000 +# #Oracle需要打开注释 +# #validation-query: SELECT 1 FROM DUAL +# test-while-idle: true +# test-on-borrow: false +# test-on-return: false +# filter: +# stat: +# log-slow-sql: false +# slow-sql-millis: 1000 +# merge-sql: false +# wall: +# config: +# multi-statement-allow: true +# slave2: +# #MySQL +# type: com.alibaba.druid.pool.DruidDataSource +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: @spring.datasource.slave2.url@ +# username: @spring.datasource.slave2.username@ +# password: @spring.datasource.slave2.password@ +# initial-size: 10 +# max-active: 100 +# min-idle: 10 +# max-wait: 60000 +# pool-prepared-statements: true +# max-pool-prepared-statement-per-connection-size: 20 +# time-between-eviction-runs-millis: 60000 +# min-evictable-idle-time-millis: 300000 +# #Oracle需要打开注释 +# #validation-query: SELECT 1 FROM DUAL +# test-while-idle: true +# test-on-borrow: false +# test-on-return: false +# filter: +# stat: +# log-slow-sql: false +# slow-sql-millis: 1000 +# merge-sql: false +# wall: +# config: +# multi-statement-allow: true datasource: druid: #MySQL @@ -190,3 +286,8 @@ thread: keepAliveSeconds: @thread.threadPool.keep-alive-seconds@ threadNamePrefix: @thread.threadPool.thread-name-prefix@ rejectedExecutionHandler: @thread.threadPool.rejected-execution-handler@ +epmet: + login: + publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKjgDaHWqWgquoatbC4zzQCgqE8C425VIOyzJVVgH1HUYCHpuNUnGCv3HBAl2RsziWQqQgd1xxl0C3a5J4J69o8CAwEAAQ== + privateKey: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAqOANodapaCq6hq1sLjPNAKCoTwLjblUg7LMlVWAfUdRgIem41ScYK/ccECXZGzOJZCpCB3XHGXQLdrkngnr2jwIDAQABAkAyYaWvgrtHuHetdk+v+QRQC54q9FGluP/5nfilX+f4IUf8j92o/ZohTtmJn9qcDiAP4wxCLIsfy4IW3psST78BAiEA0A/E0WvtI7spWnjfw+wMDhdVMIbIJvDbj/cqMwRZInUCIQDPyO2sbXpwDjmAvyn0jpGJJxU5POWYdI37rTf9fScMcwIhAMkWNHbjBHKANVuHb10ACjakPmWEHnXkW5AspdBg53TxAiARPbzq99KXBbcjxbj3f/T3inSqYTEz60f0wDTLJd1dnQIhAIFe6Jd1TduIxGk1PDh/b/3q0jNGgVXkFnUBnKWDaL9N + diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.65__resi_collect_alter.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.65__resi_collect_alter.sql new file mode 100644 index 0000000000..32b3ec3d59 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.65__resi_collect_alter.sql @@ -0,0 +1 @@ +ALTER TABLE epmet_user.ic_resi_collect_visitor MODIFY COLUMN ADDRESS varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '详细地址'; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.66__chart_hour.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.66__chart_hour.sql new file mode 100644 index 0000000000..85d2713385 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.66__chart_hour.sql @@ -0,0 +1,56 @@ +/* + Navicat Premium Data Transfer + + Source Server : epmet_cloud_dev_user + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : 192.168.1.140:3306 + Source Schema : epmet_user + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 22/08/2022 13:31:44 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pli_chart_hour +-- ---------------------------- +DROP TABLE IF EXISTS `pli_chart_hour`; +CREATE TABLE `pli_chart_hour` ( + `hour` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '图表日期链表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of pli_chart_hour +-- ---------------------------- +INSERT INTO `pli_chart_hour` VALUES ('01'); +INSERT INTO `pli_chart_hour` VALUES ('02'); +INSERT INTO `pli_chart_hour` VALUES ('03'); +INSERT INTO `pli_chart_hour` VALUES ('04'); +INSERT INTO `pli_chart_hour` VALUES ('05'); +INSERT INTO `pli_chart_hour` VALUES ('06'); +INSERT INTO `pli_chart_hour` VALUES ('07'); +INSERT INTO `pli_chart_hour` VALUES ('08'); +INSERT INTO `pli_chart_hour` VALUES ('09'); +INSERT INTO `pli_chart_hour` VALUES ('10'); +INSERT INTO `pli_chart_hour` VALUES ('11'); +INSERT INTO `pli_chart_hour` VALUES ('12'); +INSERT INTO `pli_chart_hour` VALUES ('13'); +INSERT INTO `pli_chart_hour` VALUES ('14'); +INSERT INTO `pli_chart_hour` VALUES ('15'); +INSERT INTO `pli_chart_hour` VALUES ('16'); +INSERT INTO `pli_chart_hour` VALUES ('17'); +INSERT INTO `pli_chart_hour` VALUES ('18'); +INSERT INTO `pli_chart_hour` VALUES ('19'); +INSERT INTO `pli_chart_hour` VALUES ('20'); +INSERT INTO `pli_chart_hour` VALUES ('21'); +INSERT INTO `pli_chart_hour` VALUES ('22'); +INSERT INTO `pli_chart_hour` VALUES ('23'); +INSERT INTO `pli_chart_hour` VALUES ('00'); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.67__add_ic_vaccine_prarmeter.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.67__add_ic_vaccine_prarmeter.sql new file mode 100644 index 0000000000..f009d72b0a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.67__add_ic_vaccine_prarmeter.sql @@ -0,0 +1,38 @@ +CREATE TABLE `ic_vaccine_prarmeter` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id customer.id', + `GRID_ID` varchar(64) DEFAULT NULL COMMENT '网格ID', + `GRID_NAME` varchar(255) DEFAULT NULL COMMENT '网格名称', + `AGENCY_ID` varchar(64) DEFAULT NULL COMMENT '组织Id', + `PIDS` varchar(255) DEFAULT NULL COMMENT '组织的pids', + `VILLAGE_ID` varchar(64) DEFAULT NULL COMMENT '所属小区ID;', + `VILLAGE_NAME` varchar(64) DEFAULT NULL COMMENT '所属小区名称', + `BUILD_ID` varchar(64) DEFAULT NULL COMMENT '所属楼宇Id', + `BUILD_NAME` varchar(64) DEFAULT NULL COMMENT '所属楼宇名称', + `UNIT_ID` varchar(64) DEFAULT NULL COMMENT '单元id', + `UNIT_NAME` varchar(64) DEFAULT NULL COMMENT '单元名', + `HOME_ID` varchar(64) DEFAULT NULL COMMENT '所属家庭Id', + `HOME_NAME` varchar(64) DEFAULT NULL COMMENT '房间名', + `HOUSEHOLD_TYPE` varchar(255) DEFAULT NULL COMMENT '户口性质:0户籍 1外来', + `NAME` varchar(64) NOT NULL COMMENT '姓名', + `MOBILE` varchar(15) DEFAULT NULL COMMENT '联系电话', + `ID_CARD` varchar(18) NOT NULL COMMENT '身份证号', + `IS_VACCINATION` varchar(1) DEFAULT NULL COMMENT '是否接种:0否1是', + `FIRST_VAC_TIME` varchar(64) DEFAULT NULL COMMENT '第一次接种时间', + `FIRST_VAC_SITE` varchar(10) DEFAULT NULL COMMENT '第一次接种地点', + `SECOND_VAC_TIME` varchar(64) DEFAULT NULL COMMENT '第二次接种时间', + `SECOND_VAC_SITE` varchar(10) DEFAULT NULL COMMENT '第二次接种地点', + `THIRD_VAC_TIME` varchar(64) DEFAULT NULL COMMENT '第三次接种时间', + `THIRD_VAC_SITE` varchar(10) DEFAULT NULL COMMENT '第三次接种地点', + `REASON` varchar(255) DEFAULT NULL COMMENT '原因:禁忌症/拒绝接种/其他原因', + `NOTE` varchar(255) DEFAULT NULL COMMENT '备注', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `CHECK_STATE` varchar(1) DEFAULT NULL COMMENT '审核状态:0待审核 1审核不通过 2审核通过', + `CHECK_REASON` varchar(255) DEFAULT NULL COMMENT '审核理由', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='新冠病毒疫苗接种人员信息台账'; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.68__alter_ic_point_nucleic_monitoring_enable.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.68__alter_ic_point_nucleic_monitoring_enable.sql new file mode 100644 index 0000000000..79ad21418f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.68__alter_ic_point_nucleic_monitoring_enable.sql @@ -0,0 +1 @@ +ALTER TABLE ic_point_nucleic_monitoring ADD COLUMN ENABLE_FLAG VARCHAR(10) not null DEFAULT 'enable' COMMENT '未禁用enable,已禁用disabled' AFTER ADDRESS; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.69__alter_ic_epidemic_special_attention.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.69__alter_ic_epidemic_special_attention.sql new file mode 100644 index 0000000000..24111f66ce --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.69__alter_ic_epidemic_special_attention.sql @@ -0,0 +1,3 @@ +ALTER TABLE ic_epidemic_special_attention ADD COLUMN IS_HISTORY tinyint not null DEFAULT '0' COMMENT '是否历史关注,1是0否' AFTER ATTENTION_TYPE; + +ALTER TABLE ic_epidemic_special_attention ADD COLUMN ISOLATED_STATE VARCHAR(20) COMMENT '隔离类型,来自字典表' AFTER IS_HISTORY; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.70__default_ic_epidemic_special_attention.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.70__default_ic_epidemic_special_attention.sql new file mode 100644 index 0000000000..99e215885a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.70__default_ic_epidemic_special_attention.sql @@ -0,0 +1,5 @@ +UPDATE ic_epidemic_special_attention +SET UPDATED_TIME = NOW(), + ISOLATED_STATE = '1' +WHERE ISOLATED_STATE IS NULL + AND ATTENTION_TYPE = 2; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.71__icnotice_sendres.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.71__icnotice_sendres.sql new file mode 100644 index 0000000000..d15af15aa1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.71__icnotice_sendres.sql @@ -0,0 +1,10 @@ +ALTER TABLE ic_notice ADD COLUMN SEND_RES VARCHAR ( 1 ) NOT NULL DEFAULT '1' COMMENT '发送结果:1成功,0失败' after ORG_NAME; +update ic_notice n +set n.SEND_RES='1' +where n.USER_ID is not null + and n.USER_ID !=''; + +update ic_notice n +set n.SEND_RES='0' +where (n.USER_ID is null + or n.USER_ID =''); diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.72__icepidemic_ISOLATED_STATE .sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.72__icepidemic_ISOLATED_STATE .sql new file mode 100644 index 0000000000..9fafca376f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.72__icepidemic_ISOLATED_STATE .sql @@ -0,0 +1 @@ +ALTER TABLE ic_epidemic_special_attention MODIFY COLUMN ISOLATED_STATE VARCHAR(20) COMMENT '隔离类型,来自字典表;集中隔离:0;居家隔离1;居家健康监测2;已出隔离期3'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.73__datasync_config.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.73__datasync_config.sql new file mode 100644 index 0000000000..751b7914d4 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.73__datasync_config.sql @@ -0,0 +1,36 @@ +CREATE TABLE `data_sync_config` ( + `ID` varchar(64) NOT NULL COMMENT 'ID主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。', + `DEPT_CODE` varchar(64) NOT NULL COMMENT '部门编码', + `DEPT_NAME` varchar(255) NOT NULL COMMENT '部门名称', + `DATA_NAME` varchar(255) NOT NULL COMMENT '数据名称', + `SWITCH_STATUS` varchar(10) NOT NULL COMMENT '开启:open;关闭:closed', + `SORT` int(11) NOT NULL COMMENT '排序', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据更新配置表'; + + +CREATE TABLE `data_sync_scope` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。', + `DATA_SYNC_CONFIG_ID` varchar(64) NOT NULL COMMENT '数据更新配置表主键', + `ORG_TYPE` varchar(10) NOT NULL COMMENT '网格:grid,组织:agency', + `ORG_ID` varchar(64) NOT NULL COMMENT '组织或者网格id', + `PID` varchar(64) NOT NULL COMMENT 'org_id的上级', + `ORG_ID_PATH` varchar(255) NOT NULL COMMENT 'org_id的全路径,包含自身', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据更新范围表'; + + diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.74__natcompare.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.74__natcompare.sql new file mode 100644 index 0000000000..f2d87662a2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.74__natcompare.sql @@ -0,0 +1,43 @@ +CREATE TABLE `ic_nat_compare_record` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `NAME` varchar(64) NOT NULL COMMENT '姓名', + `ID_CARD` varchar(64) NOT NULL COMMENT '身份证', + `MOBILE` varchar(32) DEFAULT NULL COMMENT '手机号', + `IS_RESI_USER` varchar(1) DEFAULT '0' COMMENT '是否客户下居民(0:否 1:是)', + `IC_RESI_USER_ID` varchar(64) DEFAULT NULL COMMENT '是否客户下居民,ic_resi_user.id', + `LATEST_NAT_TIME` datetime DEFAULT NULL COMMENT '最近一次核酸时间:接口填入', + `NAT_RESULT` varchar(1) DEFAULT NULL COMMENT '检测结果(0:阴性 1:阳性):接口填入', + `NAT_ADDRESS` varchar(255) DEFAULT NULL COMMENT '检测地点:接口填入', + `CONTACT_ADDRESS` varchar(255) DEFAULT NULL COMMENT '联系地址:接口填入', + `LATEST_IMPORT_TIME` datetime DEFAULT NULL COMMENT '最新一次导入时间,对应ic_nat_compare_rec_relation.IMPORT_TIME', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='核酸比对记录'; + +CREATE TABLE `ic_nat_compare_rec_relation` ( + `ID` varchar(64) NOT NULL COMMENT '主键(agency_id+compare_rec_id+import_date)唯一)', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `COMPARE_REC_ID` varchar(64) NOT NULL COMMENT 'ic_nat_compare_record.id', + `IMPORT_DATE` varchar(32) NOT NULL COMMENT '导入日期:yyyyMMdd', + `IMPORT_TIME` datetime NOT NULL COMMENT '导入时间,同一天内导入多次需要更新此列值', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '操作人员所属组织id', + `AGENCY_NAME` varchar(255) DEFAULT NULL COMMENT '组织名称', + `PID` varchar(64) DEFAULT NULL COMMENT 'agency_id的上级', + `PIDS` varchar(255) DEFAULT NULL COMMENT 'agency_id组织的所有上级', + `STAFF_ID` varchar(64) NOT NULL COMMENT '最近一次操作人', + `STAFF_NAME` varchar(64) NOT NULL COMMENT '最近一次操作人姓名', + `IS_AGENCY_USER` varchar(1) DEFAULT '0' COMMENT '是否本社区(agency_id)下居民(0:否 1:是)', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人,第一次导入到ic_nat_compare_record的人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='核酸比对组织关系表'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.75__datacode.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.75__datacode.sql new file mode 100644 index 0000000000..74ed8d1a42 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.75__datacode.sql @@ -0,0 +1 @@ +alter table data_sync_config add COLUMN `DATA_CODE` varchar(32) NOT NULL COMMENT '数据key'after SORT; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx index e41ebaf0a7..de79811f24 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/attention_nat_template.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat_compare_record_template.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat_compare_record_template.xlsx new file mode 100644 index 0000000000..2d80e32067 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_nat_compare_record_template.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls index a316e361b4..f93667a3bd 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine_prarmeter_excel.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine_prarmeter_excel.xls new file mode 100644 index 0000000000..539b291220 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine_prarmeter_excel.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 60b32c4d32..b7648f3fc6 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -231,14 +231,13 @@ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml new file mode 100644 index 0000000000..c429000b1a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncConfigDao.xml @@ -0,0 +1,89 @@ + + + + + + + + UPDATE data_sync_config + SET UPDATED_TIME = NOW(), + UPDATED_BY = #{updatedBy}, + SWITCH_STATUS = CASE WHEN SWITCH_STATUS = 'open' THEN 'closed' ELSE 'open' END + WHERE id = #{dataSyncConfigId} + AND DEPT_CODE = #{deptCode} + + + + + DELETE FROM data_sync_scope WHERE DATA_SYNC_CONFIG_ID = #{dataSyncConfigId} + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncScopeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncScopeDao.xml new file mode 100644 index 0000000000..0fd7649a79 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncScopeDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml index fe16fb2908..5db13945cb 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml @@ -8,7 +8,7 @@ UPDATE ic_epidemic_special_attention SET UPDATED_TIME = NOW(), IS_ATTENTION = 0, - del_flag = 1 + IS_HISTORY = '1' WHERE del_flag = 0 AND attention_type = #{attentionType} AND id IN ( @@ -18,12 +18,62 @@ ) + + UPDATE ic_epidemic_special_attention + SET UPDATED_TIME = NOW(), + IS_ATTENTION = 1 + WHERE del_flag = 0 + AND attention_type = #{attentionType} + AND id_card IN ( + + #{l} + + ) + + + + UPDATE ic_epidemic_special_attention + + + + when id_card = #{item.idCard} then 1 + + + + + when id_card = #{item.idCard} then #{item.reason} + + + + + when id_card = #{item.idCard} then #{item.remark} + + + + + when id_card = #{item.idCard} then #{item.isolatedState} + + + updated_time = now() + + WHERE del_flag = 0 + AND attention_type = #{attentionType} + AND is_history = 0 + AND id_card IN ( + + #{l.idCard} + + ) + + SELECT a.id, a.`NAME`, + a.customer_id as customerId, a.MOBILE, + a.MOBILE as realMobile, a.ID_CARD, + a.ID_CARD as realIdCard, a.REMARK, a.REASON, b.VILLAGE_ID, b.BUILD_ID, b.UNIT_ID, b.HOME_ID, - IFNULL((SELECT DATE_FORMAT(CREATED_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_notice WHERE DEL_FLAG = '0' AND ORIGIN = #{attentionType} AND ID_CARD = a.ID_CARD ORDER BY CREATED_TIME DESC LIMIT 1),'') AS lastInformTime + b.id as userId, + b.grid_id as gridId, + a.ISOLATED_STATE, + IFNULL((SELECT DATE_FORMAT(NAT_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_nat WHERE DEL_FLAG = '0' AND ID_CARD = a.ID_CARD ORDER BY CREATED_TIME DESC LIMIT 1),'') AS lastNatTime FROM ic_epidemic_special_attention a LEFT JOIN ic_resi_user b ON a.id_card = b.id_card AND b.del_flag = '0' and a.CUSTOMER_ID = b.CUSTOMER_ID WHERE a.DEL_FLAG = 0 AND concat(a.pids,':',ORG_ID) like concat('%',#{orgId},'%') AND a.ATTENTION_TYPE = #{attentionType} + + AND a.isolated_state = #{isolatedState} + + + AND a.isolated_state is not null + + + AND a.IS_ATTENTION = 1 + + + AND a.is_history = 1 + AND a.`NAME` LIKE CONCAT('%',#{name},'%') AND a.MOBILE LIKE CONCAT('%',#{mobile},'%') - + AND a.ID_CARD LIKE CONCAT('%',#{idCard},'%') @@ -125,6 +194,7 @@ ID_CARD FROM ic_epidemic_special_attention WHERE DEL_FLAG = 0 + AND IS_HISTORY = 0 AND ATTENTION_TYPE = #{attentionType} AND ID_CARD IN ( @@ -158,8 +228,30 @@ a.MOBILE, a.ID_CARD, a.REMARK, - a.REASON + a.REASON, + a.ISOLATED_STATE FROM ic_epidemic_special_attention a WHERE a.ID = #{id} + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecRelationDao.xml new file mode 100644 index 0000000000..e3f58f05b1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecRelationDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml new file mode 100644 index 0000000000..2a33a5680b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml @@ -0,0 +1,71 @@ + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml index 4459802f6d..e6dd5b0417 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml @@ -135,6 +135,19 @@ LIMIT 1 + + DELETE FROM ic_nat WHERE id = #{icNatId} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml index f57e3129bd..b3fe4f9c53 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml @@ -24,6 +24,14 @@ + + + update ic_point_nucleic_monitoring + set UPDATED_TIME = now(), + ENABLE_FLAG = case when ENABLE_FLAG = 'enable' then 'disabled' else 'enable' end + where id = #{id} + + @@ -95,14 +120,65 @@ UPDATED_TIME from ic_resi_collect_visitor where DEL_FLAG = '0' - - AND DATE_FORMAT( CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} + AND CUSTOMER_ID = #{customerId} + + AND ID_CARD = #{idCard} + + + AND NAME = #{name} + + + AND MOBILE = #{mobile} + + + AND VILLAGE_ID = #{villageId} - - AND CONCAT(PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%') + + AND BUILD_ID = #{buildId} + + AND UNIT_ID = #{unitId} + + + AND HOME_ID = #{homeId} + + + AND CREATED_TIME >= #{startTime} + + + AND CREATED_TIME <= #{endTime} + + order by CREATED_TIME desc + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index da04d1a58c..e8b69faefa 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -221,12 +221,20 @@ IC_RESI_USER.ID ASC - - update ic_resi_user set del_flag='1' where id=#{icResiUserId} + + update ic_resi_user + set del_flag='1', + UPDATED_TIME = now(), + UPDATED_BY = #{currentStaffId} + where id = #{icResiUserId} - update ${subTalbeName} set del_flag='1' where IC_RESI_USER=#{icResiUserId} + update ${subTalbeName} + set del_flag='1', + UPDATED_TIME = now(), + UPDATED_BY = #{currentStaffId} + where IC_RESI_USER=#{icResiUserId} update @@ -288,8 +296,11 @@ + + + @@ -302,9 +313,12 @@ YSR, TXJE, ID_CARD, + MOBILE, + IS_TENANT as isTenant, IFNULL(IS_VOLUNTEER,'0') AS isVolunteer, CUSTOMER_ID, - GRID_ID + GRID_ID, + HOME_ID FROM ic_resi_user WHERE DEL_FLAG = '0' AND ID = #{userId} @@ -360,7 +374,7 @@ and ${columnName}='1' AND `STATUS`='0' - ORDER BY `NAME` + ORDER BY `CREATED_TIME` DESC, `NAME` select id, NAME,MOBILE from ic_resi_user - WHERE DEL_FLAG = '0' + WHERE 1=1 id = #{icResiUserId} @@ -1281,4 +1323,58 @@ + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index 15a413748b..48805be438 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -26,35 +26,38 @@ + select + * + from ic_vaccine + where DEL_FLAG = '0' + and ID_CARD = #{idCard} + and DATE_FORMAT( INOCULATE_TIME, '%Y-%m-%d' ) = #{time} + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccinePrarmeterDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccinePrarmeterDao.xml new file mode 100644 index 0000000000..ebbebfe289 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccinePrarmeterDao.xml @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml index 011c1c7de1..acaf54c95f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml @@ -12,5 +12,10 @@ AND AGENCY_ID = #{agencyId} + + update ic_vaccine_relation + set CUSTOMER_ID = #{customerId},USER_TYPE = #{userType} + where IC_VACCINE_ID = #{icVaccineId} + - \ No newline at end of file + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml index 3164ebcddb..c8f4d403a1 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml @@ -128,6 +128,7 @@ WHERE DEL_FLAG = '0' AND customer_id = #{customerId} and id_num=#{idNum} + limit 1 + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml index 605350bde2..9bca7b1bf5 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml @@ -35,7 +35,7 @@ IFNULL(resi.ID,"") AS resiId, IFNULL(CONCAT(resi.SURNAME,resi.NAME),"") AS userRealName, IFNULL(relation.GRID_ID,"") AS gridId, - IFNULL(resi.id_num,'')AS idNum + IFNULL(wechat.id_num,'')AS idNum FROM USER user LEFT JOIN diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml index d308058d06..8267ec45ba 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml @@ -62,8 +62,6 @@ uri.RESI_VISIT_ID, ubi.BUILDING_ADDRESS, CONCAT( - ubi.STREET, - '-', ubi.SURNAME, ( CASE WHEN ubi.GENDER = '1' THEN '先生' WHEN ubi.GENDER = '2' THEN '女士' ELSE '先生/女士' END ) ) AS show_name, @@ -83,8 +81,6 @@ SELECT uri.USER_ID, CONCAT( - uri.STREET, - '-', uri.SURNAME, ( CASE WHEN uw.SEX = '1' THEN '先生' WHEN uw.SEX = '2' THEN '女士' ELSE '先生/女士' END ) ) AS show_name @@ -121,8 +117,6 @@ ubi.DISTRICT, ubi.BUILDING_ADDRESS, CONCAT( - ubi.STREET, - '-', ubi.SURNAME, ( CASE WHEN ubi.GENDER = '1' THEN '先生' WHEN ubi.GENDER = '2' THEN '女士' ELSE '先生/女士' END ) ) AS show_name, @@ -141,8 +135,6 @@ SELECT CONCAT( - uri.street, - '-', uri.surname, CASE WHEN uri.GENDER = '1' THEN @@ -184,8 +172,6 @@ END ) AS issueInitiator, CONCAT( - uri.street, - '-', uri.surname, uri.NAME ) AS realUserName diff --git a/pom.xml b/pom.xml index ff15bf358e..0eb19cb77e 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,8 @@ epmet-module epmet-user epmet-openapi - + epmet-commons/epmet-commons-feignclient + UTF-8 @@ -80,7 +81,7 @@ com.aliyun alibaba-dingtalk-service-sdk - 1.0.1 + 2.0.0