Browse Source

Merge remote-tracking branch 'remotes/origin/master' into dev_dingding

dev
jianjun 3 years ago
parent
commit
e365a9c0e8
  1. 5
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java
  2. 8
      epmet-auth/src/main/java/com/epmet/controller/GovWebController.java
  3. 23
      epmet-auth/src/main/java/com/epmet/controller/LoginController.java
  4. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasOperPermissionFormDTO.java
  5. 13
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OperResouce.java
  6. 22
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java
  7. 48
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDetailDTO.java
  8. 46
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonOperAccessOpenFeignClient.java
  9. 35
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallback.java
  10. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallbackFactory.java
  11. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  12. 37
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java
  13. 42
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java
  14. 26
      epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
  15. 70
      epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java
  16. 11
      epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java
  17. 5
      epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java
  18. 5
      epmet-gateway/src/main/resources/bootstrap-urls.yml
  19. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  20. 5
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java
  21. 40
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java
  22. 4
      epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java
  23. 1
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java
  24. 4
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql
  25. 4
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java
  26. 5
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java
  27. 4
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java
  28. 2
      epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql
  29. 5
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml
  30. 4
      epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java
  31. 25
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java
  32. 42
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java
  33. 5
      epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml
  34. 26
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java
  35. 11
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  36. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  37. 17
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  38. 24
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/HasOperPermissionFormDTO.java
  39. 13
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperResouce.java
  40. 17
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/OperAccessOpenFeignClient.java
  41. 11
      epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/feign/fallback/OperAccessOpenFeignClientFallback.java
  42. 39
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java
  43. 5
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java
  44. 24
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java
  45. 5
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java
  46. 81
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java
  47. 23
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java
  48. 24
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml
  49. 2
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml
  50. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  51. 90
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncConfigDTO.java
  52. 94
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncScopeDTO.java
  53. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java
  54. 121
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java
  55. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java
  56. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  57. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfigSwitchFormDTO.java
  58. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java
  59. 29
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ScopeSaveFormDTO.java
  60. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java
  61. 50
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java
  62. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java
  63. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java
  64. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java
  65. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java
  66. 14
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java
  67. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  68. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  69. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  70. 115
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java
  71. 70
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncScopeController.java
  72. 194
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatCompareRecordController.java
  73. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java
  74. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  75. 49
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java
  76. 59
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java
  77. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncScopeDao.java
  78. 29
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecRelationDao.java
  79. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecordDao.java
  80. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java
  81. 53
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncConfigEntity.java
  82. 52
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncScopeEntity.java
  83. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java
  84. 77
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecRelationEntity.java
  85. 71
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java
  86. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java
  87. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java
  88. 48
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java
  89. 160
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java
  90. 86
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java
  91. 78
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncScopeService.java
  92. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatCompareRecordService.java
  93. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java
  94. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  95. 265
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java
  96. 82
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncScopeServiceImpl.java
  97. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java
  98. 305
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatCompareRecordServiceImpl.java
  99. 132
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java
  100. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

5
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;

8
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);

23
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<UserTokenResultDTO> loginByPassword(@RequestBody LoginByPassWordFormDTO formDTO) {
public Result<UserTokenResultDTO> loginByPassword(@RequestBody LoginByPassWordFormDTO formDTO) throws Exception {
//效验数据
ValidatorUtils.validateEntity(formDTO);
Result<UserTokenResultDTO> 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);
}
/**

24
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;
}

13
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;
}

22
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<YtHsjcResDetailDTO> data;
private int total;
}

48
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
}
*/
}

46
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<List<OperResouce>> getExamineResourceUrls();
}

35
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<List<OperResouce>> getExamineResourceUrls() {
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "getExamineResourceUrls");
}
}

19
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<CommonOperAccessOpenFeignClient> {
private CommonOperAccessOpenFeignClientFallback fallback = new CommonOperAccessOpenFeignClientFallback();
@Override
public CommonOperAccessOpenFeignClient create(Throwable cause) {
log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause)));
return fallback;
}
}

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -889,4 +889,25 @@ public class RedisKeys {
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");
}
}

37
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";

42
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<String> 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());
}
}
}

26
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<CpProperty.OperExamineResource> operExamineResourceUrls = cpProperty.getOperExamineResourceUrls();
// redisUtils.setString(RedisKeys.getOperExamineResourceUrls(), JSON.toJSONString(operExamineResourceUrls));
// }
// }
}

70
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<OperResouce> resources = JSON.parseObject(resourceJsonString, new TypeReference<List<OperResouce>>() {});
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

11
epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java

@ -42,4 +42,15 @@ public class CpProperty {
*/
private List<String> swaggerUrls;
/**
* 运营端需要校验的url资源列表
*/
private List<OperExamineResource> operExamineResourceUrls;
@Data
public static class OperExamineResource {
private String resourceUrl;
private String resourceMethod;
}
}

5
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));

5
epmet-gateway/src/main/resources/bootstrap-urls.yml

@ -0,0 +1,5 @@
epmet:
oper-examine-resource-urls:
# 角色编辑
- resourceUrl: /oper/access/operrole
resourceMethod: PUT

1
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

5
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java

@ -73,4 +73,9 @@ public interface ImportTaskConstants {
* 社会组织
*/
String IC_SOCIETY_ORG="ic_society_org";
/**
* 未做核酸比对
*/
String IC_NAT_COMPARE_RECORD="ic_nat_compare_record";
}

40
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());
}
}
}

4
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;
/**
* 域名
*/

1
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<OssDao, OssEntity> implement
UploadImgResultDTO dto = new UploadImgResultDTO();
dto.setUrl(url);
dto.setDomain(ossDomain);
dto.setFileName(file.getOriginalFilename());
return new Result<UploadImgResultDTO>().ok(dto);
}

4
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql

@ -33,7 +33,7 @@ INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_AP
CREATE TABLE `open_sync_biz_data`
(
`ID` varchar(255) NOT NULL,
`ID` varchar(64) 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',
@ -48,4 +48,4 @@ CREATE TABLE `open_sync_biz_data`
`UPDATED_BY` varchar(255) NOT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
DEFAULT CHARSET = utf8mb4;

4
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java

@ -65,6 +65,10 @@ public class GovMenuDTO extends TreeStringNode<GovMenuDTO> implements Serializab
* 菜单图标
*/
private String icon;
/**
* 菜单颜色
*/
private String color;
/**
* 权限标识sys:menu:save

5
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;
}

4
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
*/

2
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`;

5
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
</select>
</mapper>
</mapper>

4
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})

25
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);
}
}

42
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;
}
}

5
epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml

@ -119,3 +119,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

26
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description
* @Author yzm
* @Date 2022/9/21 15:13
*/
@Data
public class TopArticleFormDTO {
/**
* 文章id
*/
@NotBlank(message = "文章id不能为空")
private String articleId;
/**
* top
* cancel_top
*/
@NotBlank(message = "type不能为空,置顶:top,取消置顶:cancel_top")
private String type;
}

11
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -424,6 +424,17 @@ public class ArticleController {
return new Result<PageData<PublishedListResultDTO>>().ok(articleService.articleListV2(formDTO));
}
/**
* 文章置顶取消置顶
* @param formDTO
* @return
*/
@PostMapping("topArticle")
public Result topArticle(@RequestBody TopArticleFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
articleService.topArticle(formDTO.getArticleId(),formDTO.getType());
return new Result();
}
/**
* @param tokenDTO
* @return

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -255,4 +255,6 @@ public interface ArticleService extends BaseService<ArticleEntity> {
PageData<PublishedListResultDTO> articleListV2(ArticleListFormDTO formDTO);
PublishedListResultDTO detailV2(ArticleListFormDTO formDTO);
void topArticle(String articleId, String type);
}

17
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -1775,4 +1775,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return resultDTO;
}
@Override
public void topArticle(String articleId, String type) {
ArticleEntity articleEntity = baseDao.selectById(articleId);
if (null != articleEntity) {
/**
* top
* cancel_top
*/
if ("top".equals(type)) {
articleEntity.setIsTop(NumConstant.ONE);
} else if ("cancel_top".equals(type)) {
articleEntity.setIsTop(NumConstant.ZERO);
}
baseDao.updateById(articleEntity);
}
}
}

24
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;
}

13
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;
}

17
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();
}

11
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");
}
}

39
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<MenuResourceDTO> resourceList = operResourceService.getMenuResourceList(id);
data.setResourceList(resourceList);
return new Result<OperMenuDTO>().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<OperResouce> resources = operMenuService.getExamineResourceUrls();
return new Result().ok(resources);
}
}

5
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<OperMenuEntity> {
* @param pid 父菜单ID
*/
List<OperMenuEntity> getListPid(String pid);
List<OperResouce> getOperResourcesByUserId(String operId);
List<OperResouce> getExamineResourceUrls();
}

24
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<String>)redisUtils.get(key);
}
public List<OperResouce> getOperResourcesByUserId(String operId) {
String key = RedisKeys.operResourcesByUserId(operId);
String json = redisUtils.getString(key);
return JSON.parseObject(json, new TypeReference<List<OperResouce>>(){});
}
public void setOperResourcesByUserId(String operId, List<OperResouce> 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);
}
}

5
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<OperMenuEntity> {
List<OperMenuDTO> getListPid(String pid);
void clearOperUserAccess(String app, String client, String userId);
Boolean hasOperPermission(String uri, String method, String loginUserId);
List<OperResouce> getExamineResourceUrls();
}

81
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<OperMenuDao, OperMenuEn
private OperResourceService operResourceService;
@Autowired
private OperLanguageService operLanguageService;
@Autowired
private RedisUtils redisUtils;
private final AntPathMatcher antPathMatcher = new AntPathMatcher();
@Override
public PageData<OperMenuDTO> page(Map<String, Object> params) {
@ -112,6 +121,13 @@ public class OperMenuServiceImpl extends BaseServiceImpl<OperMenuDao, OperMenuEn
insert(entity);
saveLanguage(entity.getId(), "name", entity.getName());
try {
redisUtils.delete(RedisKeys.getOperExamineResourceUrls());
} catch (Exception e) {
String msg = ExceptionUtils.getErrorStackTrace(e);
logger.error("保存菜单配置异常:{}", msg);
}
//保存菜单资源
operResourceService.saveMenuResource(entity.getId(), entity.getName(), dto.getResourceList());
@ -133,6 +149,21 @@ public class OperMenuServiceImpl extends BaseServiceImpl<OperMenuDao, OperMenuEn
updateById(entity);
saveLanguage(entity.getId(), "name", entity.getName());
try {
redisUtils.delete(RedisKeys.getOperExamineResourceUrls());
} catch (Exception e) {
String msg = ExceptionUtils.getErrorStackTrace(e);
logger.error("修改菜单配置异常:{}", msg);
}
try {
redisUtils.deleteByPattern(RedisKeys.operResourcesBaseDir().concat("*"));
} catch (Exception e) {
String msg = ExceptionUtils.getErrorStackTrace(e);
logger.error("修改菜单配置异常:{}", msg);
}
//更新菜单资源
operResourceService.saveMenuResource(entity.getId(), entity.getName(), dto.getResourceList());
@ -150,6 +181,13 @@ public class OperMenuServiceImpl extends BaseServiceImpl<OperMenuDao, OperMenuEn
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String id, TokenDto tokenDto) {
try {
redisUtils.delete(RedisKeys.getOperExamineResourceUrls());
} catch (Exception e) {
String msg = ExceptionUtils.getErrorStackTrace(e);
logger.error("删除菜单配置异常:{}", msg);
}
//逻辑删除
baseDao.deleteBatchIds(Collections.singletonList(id));
//删除角色菜单关系
@ -242,6 +280,9 @@ public class OperMenuServiceImpl extends BaseServiceImpl<OperMenuDao, OperMenuEn
public void clearOperUserAccess(String app, String client, String userId) {
//清空当前用户,菜单导航、权限标识
operMenuRedis.delete(userId, app, client);
// 根据用户id删除用户资源列表,后期可以跟deleteAccess合并起来,先为烟台的安全检测做。
operMenuRedis.deleteOperResourcesByUserId(userId);
logger.info(String.format("运营端用户退出系统%s,清空菜单、权限成功",userId));
}
@ -249,4 +290,44 @@ public class OperMenuServiceImpl extends BaseServiceImpl<OperMenuDao, OperMenuEn
operLanguageService.saveOrUpdate("oper_menu", tableId, fieldName, fieldValue, HttpContextUtils.getLanguage());
}
@Override
public Boolean hasOperPermission(String uri, String method, String operId) {
Result<OperUserDTO> 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<OperResouce> 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<OperResouce> 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<OperResouce> getExamineResourceUrls() {
return baseDao.getExamineResourceUrls();
}
}

23
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<OperRoleDao, OperRoleEntity> implements OperRoleService {
@Autowired
@ -55,6 +60,9 @@ public class OperRoleServiceImpl extends BaseServiceImpl<OperRoleDao, OperRoleEn
@Autowired
private OperRoleUserService operRoleUserService;
@Autowired
private RedisUtils redisUtils;
@Override
public PageData<OperRoleDTO> page(Map<String, Object> params) {
IPage<OperRoleEntity> page = baseDao.selectPage(
@ -93,6 +101,13 @@ public class OperRoleServiceImpl extends BaseServiceImpl<OperRoleDao, OperRoleEn
insert(entity);
//保存角色菜单关系
OperRoleMenuService.saveOrUpdate(entity.getId(), dto.getMenuIdList());
try {
redisUtils.deleteByPattern(RedisKeys.operResourcesBaseDir().concat("*"));
} catch (Exception e) {
String msg = ExceptionUtils.getErrorStackTrace(e);
log.error("新增运营角色信息配置异常:{}", msg);
}
}
@Override
@ -102,6 +117,13 @@ public class OperRoleServiceImpl extends BaseServiceImpl<OperRoleDao, OperRoleEn
updateById(entity);
//保存角色菜单关系
OperRoleMenuService.saveOrUpdate(entity.getId(), dto.getMenuIdList());
try {
redisUtils.deleteByPattern(RedisKeys.operResourcesBaseDir().concat("*"));
} catch (Exception e) {
String msg = ExceptionUtils.getErrorStackTrace(e);
log.error("修改运营角色信息配置异常:{}", msg);
}
}
@Override
@ -113,6 +135,7 @@ public class OperRoleServiceImpl extends BaseServiceImpl<OperRoleDao, OperRoleEn
OperRoleMenuService.deleteByRoleIds(ids);
operRoleUserService.deleteByRoleIds(ids);
}
}

24
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml

@ -26,9 +26,9 @@
<select id="getUserMenuList" resultType="com.epmet.entity.OperMenuEntity">
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
<if test="type != null">
and t3.type = #{type}
</if>
@ -39,4 +39,22 @@
select * from oper_menu where del_flag = 0 and pid = #{value}
</select>
<select id="getOperResourcesByUserId" resultType="com.epmet.dto.result.OperResouce">
select ru.user_id
, res.resource_url
, res.resource_method
from oper_role_user ru
inner join oper_role_menu orm on (ru.role_id = orm.role_id and orm.DEL_FLAG = 0)
inner join oper_resource res on (orm.menu_id = res.resource_code and res.DEL_FLAG=0)
where ru.user_id = #{operId}
and ru.DEL_FLAG = 0
</select>
<!--需要验证的资源列表(配置给了菜单,并且没有被删除的资源列表)-->
<select id="getExamineResourceUrls" resultType="com.epmet.dto.result.OperResouce">
select distinct res.resource_url, res.resource_method
from oper_menu menu
inner join oper_resource res on (menu.id = res.resource_code and res.DEL_FLAG = 0)
where menu.DEL_FLAG = 0
</select>
</mapper>

2
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml

@ -4,7 +4,7 @@
<mapper namespace="com.epmet.dao.OperRoleMenuDao">
<select id="getMenuIdList" resultType="java.lang.String">
select menu_id from oper_role_menu where role_id = #{value}
select menu_id from oper_role_menu where del_flag = 0 AND role_id = #{value}
</select>
<update id="deleteByRoleIds">

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -1171,7 +1171,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
dto.setLeaderName(groupLeaderUserInfo.getData().getShowName());
} else {
logger.error("组长注册信息查询失败,msg:{},groupId:{}", groupLeaderUserInfo.getMsg(), dto.getGroupId());
logger.warn("组长注册信息查询失败,msg:{},groupId:{}", groupLeaderUserInfo.getMsg(), dto.getGroupId());
}
});
return recommendGroupList;

90
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<DataSyncScopeDTO> scopeList;
}

94
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;
}

7
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java

@ -62,13 +62,16 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable {
private String isHistory;
/**
* 隔离类型,来自字典表
* 隔离类型,来自字典表;集中隔离0;居家隔离1;居家健康监测2;已出隔离期3
*/
// @NotBlank(message = "isolatedState不能为空",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class})
private String isolatedState;
/**
* 关注类型核酸检测2疫苗接种1行程上报0
* 关注类型
* 核酸检测2
* 疫苗接种1
* 行程上报0
*/
@NotNull(message = "attentionType不能为空",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class})
private Integer attentionType;

121
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;
}

4
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;
}

13
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
*/

26
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;
}

21
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<String> idCards;
}

29
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<DataSyncScopeDTO> scopeList;
}

3
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;
}
}

50
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<String> bdIds;
/**
* 通知渠道通知渠道 0小程序通知1短信通知
*/
@NotEmpty(message = "请选择通知渠道", groups = CustomerClientShowGroup.class)
private List<String> 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;
}

5
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})

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java

@ -24,6 +24,9 @@ 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;

42
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;
}

24
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;
}

14
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java

@ -38,10 +38,21 @@ public class VaccinationListResultDTO implements Serializable {
*/
private String mobile;
/**
* 真实手机号
*/
private String realMobile;
/**
* 身份证
*/
private String idCard;
/**
* 真实的身份证
*/
private String realIdCard;
private String sex;
/**
@ -106,6 +117,9 @@ public class VaccinationListResultDTO implements Serializable {
* 小区名+楼栋名+单元名+房屋名
*/
private String allName;
/**
* 隔离类型,来自字典表;集中隔离0;居家隔离1;居家健康监测2;已出隔离期3
*/
private String isolatedState;
private String id;
private String userId;

3
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -921,4 +921,7 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/userbaseinfo/dingResiLogin")
Result<DingLoginResiResDTO> dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO);
@PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask")
Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -711,4 +711,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<DingLoginResiResDTO> 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);
}
}

13
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<List<CustomerListResultDTO>> customerList(@RequestBody CustomerListFormDTO formDTO){
public Result<List<CustomerListResultDTO>> 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);
}

115
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<DataSyncConfigDTO> get(@PathVariable("id") String id){
DataSyncConfigDTO data = dataSyncConfigService.get(id);
return new Result<DataSyncConfigDTO>().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<PageData> list(@LoginUser TokenDto tokenDto, @RequestBody PageFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,PageFormDTO.AddUserInternalGroup.class);
return new Result<PageData>().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();
}
}

70
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<PageData<DataSyncScopeDTO>> page(@RequestParam Map<String, Object> params){
PageData<DataSyncScopeDTO> page = dataSyncScopeService.page(params);
return new Result<PageData<DataSyncScopeDTO>>().ok(page);
}
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET})
public Result<DataSyncScopeDTO> get(@PathVariable("id") String id){
DataSyncScopeDTO data = dataSyncScopeService.get(id);
return new Result<DataSyncScopeDTO>().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();
}
}

194
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<PageData<IcNatCompareRecordDTO>> page(@LoginUser TokenDto tokenDto, @RequestBody IcNatCompareRecordPageFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
PageData<IcNatCompareRecordDTO> page = icNatCompareRecordService.page(formDTO);
return new Result<PageData<IcNatCompareRecordDTO>>().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<IcNatCompareRecordDTO> 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();
}
}
}
}

16
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();
}
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java

@ -251,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);

49
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();
}

59
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<DataSyncConfigEntity> {
/**
* 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<DataSyncConfigDTO> list(@Param("customerId")String customerId);
List<DataSyncScopeDTO> 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<NatUserInfoResultDTO> getIdCardsByScope(@Param("list") List<DataSyncScopeDTO> list);
List<NatUserInfoResultDTO> getUserIdByIdCard(@Param("list") List<String> list);
}

16
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<DataSyncScopeEntity> {
}

29
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<IcNatCompareRecRelationEntity> {
/**
*
* @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);
}

30
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<IcNatCompareRecordEntity> {
/**
* 分页查询
* @param formDTO
* @return
*/
List<IcNatCompareRecordDTO> pageList(IcNatCompareRecordPageFormDTO formDTO);
IcNatCompareRecordEntity selectByIdCard(@Param("customerId") String customerId, @Param("idCard")String idCard);
}

3
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<IcNatEntity> {
*/
int updateIsResiFlag(@Param("customerId") String customerId, @Param("icResiUserId") String icResiUserId);
List<NatUserInfoResultDTO> getExistNatInfo(@Param("list") List<IcNatEntity> entities);
}

53
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;
}

52
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;
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java

@ -49,7 +49,7 @@ public class IcEpidemicSpecialAttentionEntity extends BaseEpmetEntity {
private String isHistory;
/**
* 隔离类型,来自字典表
* 隔离类型,来自字典表;集中隔离0;居家隔离1;居家健康监测2;已出隔离期3
*/
private String isolatedState;

77
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;
}

71
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;
}

9
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;
}

4
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;
}

48
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;
}
}

160
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<IcNatCompareRecordExcelData> {
/**
* 最大条数阈值
*/
public static final int MAX_THRESHOLD = 200;
/**
* 当前操作用户
*/
private CustomerStaffInfoCacheResult staffInfo;
private String customerId;
private IcNatCompareRecordServiceImpl icNatCompareRecordService;
/**
* 数据
*/
private List<IcNatCompareRecordEntity> datas = new ArrayList<>();
/**
* 错误项列表
*/
private List<IcNatCompareRecordExcelData.ErrorRow> 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<IcNatCompareRecordExcelData.ErrorRow> getErrorRows() {
return errorRows;
}
}

86
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<DataSyncConfigEntity> {
/**
* 单条查询
*
* @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);
}

78
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<DataSyncScopeEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<DataSyncScopeDTO>
* @author generator
* @date 2022-09-26
*/
PageData<DataSyncScopeDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<DataSyncScopeDTO>
* @author generator
* @date 2022-09-26
*/
List<DataSyncScopeDTO> list(Map<String, Object> 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);
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatCompareRecordService.java

@ -0,0 +1,30 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcNatCompareRecordDTO;
import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO;
import com.epmet.entity.IcNatCompareRecordEntity;
import java.nio.file.Path;
/**
* 核算比对记录
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-09-26
*/
public interface IcNatCompareRecordService extends BaseService<IcNatCompareRecordEntity> {
/**
* 默认分页
*
* @param formDTO
* @return PageData<IcNatCompareRecordDTO>
* @author generator
* @date 2022-09-26
*/
PageData<IcNatCompareRecordDTO> page(IcNatCompareRecordPageFormDTO formDTO);
void execAsyncExcelImport(Path fileSavePath, String taskId, String customerId, String userId);
}

7
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<IcNoticeEntity> {
* @return
*/
Map<String, Date> getUserLatestNoticeTime(String customerId,List<String> idCardSet);
/**
* 行程上报重点人群关注名单疫苗接种关注名单这几个页面的发送通知
* @param formDTO
*/
void sendNoticeV2(SendNoticeV2FormDTO formDTO);
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -739,7 +739,16 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
if (null == customerStaffDTO) {
return;
}
//密码加密
String oldPasswordFormDB = customerStaffDTO.getPassword();
if (StringUtils.isNotBlank(staffResetPwFormDTO.getOldPassword())){
//密码加密
String oldPasswordFormParam = staffResetPwFormDTO.getOldPassword();
log.info("resetStaffPassword:oldP:{},DB:{}",oldPasswordFormParam,oldPasswordFormDB);
if (!PasswordUtils.matches(oldPasswordFormParam, oldPasswordFormDB)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),EpmetErrorCode.ERR10004.getMsg(),EpmetErrorCode.ERR10004.getMsg());
}
}
String password = PasswordUtils.encode(staffResetPwFormDTO.getNewPassword());
logger.info(String.format("密码%s加密后为%s", staffResetPwFormDTO.getNewPassword(), password));
customerStaffDTO.setPassword(password);

265
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java

@ -0,0 +1,265 @@
package com.epmet.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.constant.NumConstant;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.dto.result.YtHsjcResDTO;
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.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.DateUtils;
import com.epmet.commons.tools.utils.YtHsResUtils;
import com.epmet.dao.DataSyncConfigDao;
import com.epmet.dao.IcNatDao;
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.dto.result.NatUserInfoResultDTO;
import com.epmet.entity.DataSyncConfigEntity;
import com.epmet.entity.DataSyncScopeEntity;
import com.epmet.entity.IcNatEntity;
import com.epmet.entity.IcNatRelationEntity;
import com.epmet.service.DataSyncConfigService;
import com.epmet.service.DataSyncScopeService;
import com.epmet.service.IcNatRelationService;
import com.epmet.service.IcNatService;
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.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;
import java.util.stream.Collectors;
/**
* 数据更新配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-09-26
*/
@Service
public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao, DataSyncConfigEntity> implements DataSyncConfigService {
@Autowired
private DataSyncScopeService dataSyncScopeService;
@Autowired
private IcNatDao icNatDao;
@Autowired
private IcNatService icNatService;
@Autowired
private IcNatRelationService icNatRelationService;
private QueryWrapper<DataSyncConfigEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<DataSyncConfigEntity> 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<DataSyncConfigDTO> result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L);
PageInfo<DataSyncConfigDTO> 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<NatUserInfoResultDTO> userIdByIdCard = baseDao.getUserIdByIdCard(formDTO.getIdCards());
List<NatUserInfoResultDTO> 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<DataSyncConfigDTO> allConfigList = baseDao.list(StringUtils.isNotBlank(formDTO.getCustomerId()) ? formDTO.getCustomerId() : null);
if (CollectionUtils.isEmpty(allConfigList)){
return;
}
List<DataSyncConfigDTO> 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<NatUserInfoResultDTO> 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<NatUserInfoResultDTO> idCards,String customerId){
if (CollectionUtils.isNotEmpty(idCards)){
List<IcNatEntity> 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<NatUserInfoResultDTO> 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<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus));
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){
icNatService.insertBatch(groupByStatus.get(false));
}
//组织关系表
List<IcNatRelationEntity> 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);
}
}
}
}
}

82
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<DataSyncScopeDao, DataSyncScopeEntity> implements DataSyncScopeService {
@Override
public PageData<DataSyncScopeDTO> page(Map<String, Object> params) {
IPage<DataSyncScopeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, DataSyncScopeDTO.class);
}
@Override
public List<DataSyncScopeDTO> list(Map<String, Object> params) {
List<DataSyncScopeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, DataSyncScopeDTO.class);
}
private QueryWrapper<DataSyncScopeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<DataSyncScopeEntity> 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));
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java

@ -309,6 +309,10 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
e.setPids(agencyInfo.getPids());
e.setCustomerId(formDTO.getCustomerId());
e.setIsHistory(NumConstant.ZERO_STR);
if(StringUtils.isBlank(e.getIsolatedState())){
//从行程上报界面,点击加入重点人群关注,默认隔离状态是居家隔离
e.setIsolatedState(NumConstant.ONE_STR);
}
});
insertBatch(entities);
//新增通知表信息

305
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatCompareRecordServiceImpl.java

@ -0,0 +1,305 @@
package com.epmet.service.impl;
import com.alibaba.excel.EasyExcel;
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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.*;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcNatCompareRecRelationDao;
import com.epmet.dao.IcNatCompareRecordDao;
import com.epmet.dto.IcNatCompareRecordDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO;
import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.entity.IcNatCompareRecRelationEntity;
import com.epmet.entity.IcNatCompareRecordEntity;
import com.epmet.excel.data.IcNatCompareRecordExcelData;
import com.epmet.excel.handler.IcNatCompareRecordExcelImportListener;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcNatCompareRecordService;
import com.epmet.service.IcResiUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* 核算比对记录
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-09-26
*/
@Slf4j
@Service
public class IcNatCompareRecordServiceImpl extends BaseServiceImpl<IcNatCompareRecordDao, IcNatCompareRecordEntity> 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<IcNatCompareRecordDTO> page(IcNatCompareRecordPageFormDTO formDTO) {
//1.获取工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId());
formDTO.setAgencyId(staffInfo.getAgencyId());
//2.按条件查询业务数据
PageInfo<IcNatCompareRecordDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> baseDao.pageList(formDTO));
List<IcNatCompareRecordDTO> 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<IcNatCompareRecordExcelData.ErrorRow> 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<UploadImgResultDTO> 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<IcNatCompareRecordEntity> 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);
}
}
}
}

132
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<IcNoticeDao, IcNoticeEn
private MessageFeignClient messageFeignClient;
@Resource
private UserBaseInfoService userBaseInfoService;
@Autowired
private IcTripReportRecordDao icTripReportRecordDao;
@Autowired
private IcEpidemicSpecialAttentionDao icEpidemicSpecialAttentionDao;
@Override
public PageData<IcNoticeDTO> page(IcNoticeFormDTO formDTO) {
@ -144,9 +155,11 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
entity.setContent(formDTO.getContent());
entity.setOrigin(formDTO.getOrigin());
entity.setUserId(item.getUserId());
entity.setMobile(item.getMobile());
entity.setMobile(StringUtils.isNotBlank(item.getMobile()) ? item.getMobile() : "");
entity.setIdCard(item.getIdCard());
entity.setOrgName(finalOrgName);
// 发送结果:1成功,0失败 默认插入发送成功。下面没有找到居民端的用户id,会更新
entity.setSendRes(NumConstant.ONE_STR);
return entity;
}).collect(Collectors.toList());
insertBatch(entityList);
@ -158,40 +171,45 @@ public class IcNoticeServiceImpl extends BaseServiceImpl<IcNoticeDao, IcNoticeEn
entityList.forEach(item -> {
if (StringUtils.isNotBlank(item.getIdCard())) {
//根据身份证获取居民ID
//根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个
List<UserBaseInfoDTO> 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<IcNoticeDao, IcNoticeEn
return map;
}
/**
* 行程上报重点人群关注名单疫苗接种关注名单这几个页面的发送通知
*
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void sendNoticeV2(SendNoticeV2FormDTO formDTO) {
String orgName = "";
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null != staffInfo) {
orgName = staffInfo.getAgencyName();
}
// 保存消息
String channel = StringUtils.join(formDTO.getChannel(), StrConstant.COMMA);
String finalOrgName = orgName;
List<SendNoticeFormDTO.UserListBean> userBeanList = null;
List<IcNoticeEntity> 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<UserMessageFormDTO> msgList = new ArrayList<>();
entityList.forEach(item -> {
// 根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个
List<UserBaseInfoDTO> 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
}
}
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

@ -276,7 +276,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
param.setExportConfig(exportConfig);
Result<IcCustomExportResultDTO> 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();

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save