diff --git a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java index 7f3dec5314..7559bad559 100644 --- a/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java +++ b/epmet-admin/epmet-admin-client/src/main/java/com/epmet/dto/PasswordDTO.java @@ -23,7 +23,10 @@ import java.io.Serializable; @Data public class PasswordDTO implements Serializable { private static final long serialVersionUID = 1L; - + /** + * 旧密码 + */ + private String oldPassword; @NotBlank(message="{sysuser.password.require}") private String password; diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java index 43b2719dc8..a3a36c9588 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -9,6 +10,7 @@ import com.epmet.dto.form.GovWebLoginFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.GovWebService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; @@ -44,10 +46,14 @@ public class GovWebController { ValidatorUtils.validateEntity(formDTO); try { - if (formDTO.getPassword().length() > 50) { + if (StringUtils.isNotBlank(formDTO.getPassword())&&formDTO.getPassword().length() > NumConstant.FIFTY) { String newPassword = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey); formDTO.setPassword(newPassword); } + if (StringUtils.isNotBlank(formDTO.getPhone())&&formDTO.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey); + formDTO.setPhone(phone); + } } catch (Exception e) { log.error("method exception", e); diff --git a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java index 36c4d2a8d0..08e40eb99d 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java @@ -1,8 +1,10 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -15,6 +17,7 @@ import com.epmet.service.LoginService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.imageio.ImageIO; @@ -36,6 +39,8 @@ import java.util.Arrays; @RestController @RequestMapping("login") public class LoginController { + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private CaptchaService captchaService; @@ -90,11 +95,23 @@ public class LoginController { * @Date 2020/3/14 19:46 **/ @PostMapping("/operweb/loginbypassword") - public Result loginByPassword(@RequestBody LoginByPassWordFormDTO formDTO) { + public Result loginByPassword(@RequestBody LoginByPassWordFormDTO formDTO) throws Exception { //效验数据 ValidatorUtils.validateEntity(formDTO); - Result result = loginService.loginByPassword(formDTO); - return result; + //解密密码 + if (StringUtils.isNotBlank(formDTO.getPhone())&&formDTO.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey); + formDTO.setPhone(phone); + } + if (StringUtils.isNotBlank(formDTO.getMobile())&&formDTO.getMobile().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getMobile(), privateKey); + formDTO.setMobile(phone); + } + if (StringUtils.isNotBlank(formDTO.getPassword())&&formDTO.getPassword().length() > NumConstant.FIFTY) { + String confirmNewPassWord = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey); + formDTO.setPassword(confirmNewPassWord); + } + return loginService.loginByPassword(formDTO); } /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasOperPermissionFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasOperPermissionFormDTO.java new file mode 100644 index 0000000000..62faa45150 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/HasOperPermissionFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.commons.tools.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class HasOperPermissionFormDTO { + + /** + * uri + */ + @NotBlank(message = "uri不能为空") + private String uri; + + /** + * http方法 + */ + @NotBlank(message = "请求http方法不能为空") + private String method; + + @NotBlank(message = "操作者ID不能为空") + private String operId; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OperResouce.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OperResouce.java new file mode 100644 index 0000000000..632f013746 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OperResouce.java @@ -0,0 +1,13 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; + +@Data +public class OperResouce { + + private String userId; + private String resourceUrl; + private String ResourceMethod; + + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java new file mode 100644 index 0000000000..4dcf8869a1 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDTO.java @@ -0,0 +1,22 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; + +import java.util.List; + + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 17:04 + */ +@Data +public class YtHsjcResDTO { + private int code = 200; + private String msg = "请求成功"; + /** + * 响应数据 + */ + private List data; + private int total; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDetailDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDetailDTO.java new file mode 100644 index 0000000000..4a958a3cf7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/YtHsjcResDetailDTO.java @@ -0,0 +1,48 @@ +package com.epmet.commons.tools.dto.result; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 17:10 + */ +@Data +public class YtHsjcResDetailDTO { + private String id; + private String name; + private String card_no; + private String telephone; + private String address; + private String test_time; + private String depart_name; + private String county; + private String upload_time; + private String sample_result_pcr; + private String sample_time; + private String sampling_org_pcr; + + /* { + "code":"200", + "msg":"请求成功", + "data":[ + { + "id":"6a31eb2d38c011eda054fa163ebc7ff4", + "name":"杨冠中",// 姓名 + "card_no":"372527198404130813",// 证件号码 + "telephone":"13697890860",// 电话 + "address":"保利香榭里公馆18-1-302",// 联系地址 + "test_time":"2022-09-20 12:52:28",// 检测时间 + "depart_name":"天仁医学检验实验室有限公司",// varchar + "county":"莱山区",// 所属区县 + "upload_time":"2022-09-20 21:23:10",// 时间戳 + "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性 + "sample_time":"2022-09-20 06:48:28",// 采样时间 + "sampling_org_pcr":"采样点327"// 核酸采样机构 + }, + ] + "total":1 + } +*/ +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonOperAccessOpenFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonOperAccessOpenFeignClient.java new file mode 100644 index 0000000000..15f76dcb62 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonOperAccessOpenFeignClient.java @@ -0,0 +1,46 @@ +package com.epmet.commons.tools.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; +import com.epmet.commons.tools.dto.result.OperResouce; +import com.epmet.commons.tools.feign.fallback.CommonOperAccessOpenFeignClientFallbackFactory; +import com.epmet.commons.tools.utils.Result; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * @Description 运营端权限模块 + * @Author yinzuomei + * @Date 2020/5/21 15:17 本服务对外开放的API,其他服务通过引用此client调用该服务 + */ +@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class) +//@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class, url = "http://localhost:8093") +public interface CommonOperAccessOpenFeignClient { + /** + * @param + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 清空运营人员权限信息、菜单信息 + * @Date 2020/5/21 17:08 + **/ + @GetMapping("/oper/access/menu/clearoperuseraccess") + Result clearOperUserAccess(); + + /** + * 是否有该接口的权限 + * @return + */ + @PostMapping("/oper/access/menu/hasPermission") + Result hasOperPermission(@RequestBody HasOperPermissionFormDTO form); + + /** + * 需要验证的菜单资源 + * @return + */ + @PostMapping("/oper/access/menu/getExamineResourceUrls") + Result> getExamineResourceUrls(); +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallback.java new file mode 100644 index 0000000000..ba047f1ada --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallback.java @@ -0,0 +1,35 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; +import com.epmet.commons.tools.dto.result.OperResouce; +import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; + +import java.util.List; + +/** + * @Description 运营端权限模块 + * @Author yinzuomei + * @Date 2020/5/21 15:47 + */ +//@Component +public class CommonOperAccessOpenFeignClientFallback implements CommonOperAccessOpenFeignClient { + @Override + public Result clearOperUserAccess() { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "clearOperUserAccess"); + + } + + @Override + public Result hasOperPermission(HasOperPermissionFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "hasOperPermission"); + } + + @Override + public Result> getExamineResourceUrls() { + return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "getExamineResourceUrls"); + } +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallbackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallbackFactory.java new file mode 100644 index 0000000000..d62f24900c --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonOperAccessOpenFeignClientFallbackFactory.java @@ -0,0 +1,19 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class CommonOperAccessOpenFeignClientFallbackFactory implements FallbackFactory { + private CommonOperAccessOpenFeignClientFallback fallback = new CommonOperAccessOpenFeignClientFallback(); + + @Override + public CommonOperAccessOpenFeignClient create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index ac55205beb..c09f13f2f4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -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"); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java index d7a685b2f2..fdae188e6b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/password/PasswordUtils.java @@ -37,6 +37,43 @@ public class PasswordUtils { return passwordEncoder.matches(str, password); } + /** + * desc:校验密码规则是否 + * 校验密码规则:密码必须8-20个字符,而且同时包含大小写字母和数字 + * @param password + * @return + */ + public static boolean checkPassWordRule(String password) { + boolean flag=false; + if(password.length()<8||password.length()>20){ + return flag; + } + boolean numFlag=false; + boolean bigLetter=false; + boolean smallLetter=false; + char[] passwordArray = password.toCharArray(); + for(int i=0;i < passwordArray.length;i++) { + char currentStr=passwordArray[i]; + // 判断ch是否是数字字符,如'1','2‘,是返回true。否则返回false + if(Character.isDigit(currentStr)){ + numFlag=true; + continue; + } + // 判断ch是否是字母字符,如'a','b‘,是返回true。否则返回false + if(Character.isUpperCase(currentStr)){ + bigLetter=true; + continue; + } + if(Character.isLowerCase(currentStr)){ + smallLetter=true; + } + } + if(numFlag&&bigLetter&&smallLetter){ + flag=true; + } + return flag; + } + public static void main(String[] args) { String str = "wangqing"; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java new file mode 100644 index 0000000000..dcde88f23f --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YtHsResUtils.java @@ -0,0 +1,42 @@ +package com.epmet.commons.tools.utils; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.dto.result.YtHsjcResDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 16:56 + */ +@Slf4j +public class YtHsResUtils { + static String url = "https://10.2.2.60:8191/sjzt/server/hsjcxx?appkey=DR4jF5Be7sCsqDmCamq2tmYCl"; + + /** + * desc:图片同步扫描 + * + * @return + */ + public static YtHsjcResDTO hsjc(String cardNo, Integer rowNum, Integer pageSize) { + try { + String param = String.format("&card_no=%s&ROWNUM=%s&PAGESIZE=%s", cardNo, rowNum, pageSize); + String apiUrl = url.concat(param); + Result result = HttpClientManager.getInstance().sendPostByJSON(apiUrl, null); + if (result.success()) { + return JSON.parseObject(result.getData(), YtHsjcResDTO.class); + } + YtHsjcResDTO resultResult = new YtHsjcResDTO(); + resultResult.setData(new ArrayList<>()); + return resultResult; + } catch (Exception e) { + log.error(String.format("烟台核算检测结果查询异常cardNo:%s,异常信息:%s", cardNo, e.getMessage())); + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取核算检测结果api异常"+e.getMessage()); + } + } +} + diff --git a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java index cf7493a300..399f574dd9 100644 --- a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java +++ b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java @@ -8,9 +8,15 @@ package com.epmet; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.aspect.ServletExceptionHandler; import com.epmet.commons.tools.config.RedissonConfig; import com.epmet.commons.tools.config.ThreadDispatcherConfig; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.filter.CpProperty; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @@ -18,6 +24,9 @@ import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; +import javax.annotation.PostConstruct; +import java.util.List; + /** * 网关服务 * @@ -31,7 +40,24 @@ import org.springframework.context.annotation.FilterType; @ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ThreadDispatcherConfig.class, ServletExceptionHandler.class})) public class GatewayApplication { + @Autowired + private CpProperty cpProperty; + + @Autowired + private RedisUtils redisUtils; + public static void main(String[] args) { SpringApplication.run(GatewayApplication.class, args); } + + /** + * 初始化运营端校验资源列表 + */ +// @PostConstruct +// public void initOperExamineResources() { +// if (!redisUtils.hasKey(RedisKeys.getOperExamineResourceUrls())) { +// List operExamineResourceUrls = cpProperty.getOperExamineResourceUrls(); +// redisUtils.setString(RedisKeys.getOperExamineResourceUrls(), JSON.toJSONString(operExamineResourceUrls)); +// } +// } } diff --git a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java index 305bf2b3a4..c857f97159 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -1,11 +1,22 @@ package com.epmet.auth; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; +import com.epmet.commons.tools.dto.result.OperResouce; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.dto.BaseTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.commons.tools.utils.Result; import com.epmet.filter.CpProperty; import com.epmet.jwt.JwtTokenUtils; import io.jsonwebtoken.Claims; @@ -15,18 +26,20 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.gateway.filter.GatewayFilterChain; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import org.springframework.util.AntPathMatcher; import org.springframework.web.server.ServerWebExchange; import java.util.Date; +import java.util.List; /** * 内部认证处理器 */ @Component -public class InternalAuthProcessor extends AuthProcessor { +public class InternalAuthProcessor extends AuthProcessor implements ResultDataResolver { private Logger logger = LoggerFactory.getLogger(getClass()); @@ -41,6 +54,12 @@ public class InternalAuthProcessor extends AuthProcessor { @Autowired private CpProperty cpProperty; + @Autowired + private CommonOperAccessOpenFeignClient operAccessOpenFeignClient; + + @Autowired + private RedisUtils redisUtils; + @Override public ServerWebExchange auth(ServerWebExchange exchange, GatewayFilterChain chain) { ServerHttpRequest request = exchange.getRequest(); @@ -104,10 +123,59 @@ public class InternalAuthProcessor extends AuthProcessor { builder.header(AppClientConstant.CUSTOMER_ID, customerId); } + // 针对运营端的url拦截和校验 + if (AppClientConstant.APP_OPER.equals(app)) { + HttpMethod method = request.getMethod(); + Boolean hasAccess = checkRequestOperResource(userId, requestUri, method.toString()); + if (!hasAccess) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "资源未授权", "资源未授权"); + } + } + ServerHttpRequest shr = builder.build(); return exchange.mutate().request(shr).build(); } + /** + * 校验运营端用户是否有权访问该资源 + * @param uri + * @param method + * @return + */ + private Boolean checkRequestOperResource(String userId, String uri, String method) { + String resourceJsonString = redisUtils.getString(RedisKeys.getOperExamineResourceUrls()); + List resources = JSON.parseObject(resourceJsonString, new TypeReference>() {}); + + if (resources == null) { + // redis中没有缓存,需要api获取 + resources = getResultDataOrThrowsException(operAccessOpenFeignClient.getExamineResourceUrls(), ServiceConstant.OPER_ACCESS_SERVER, + EpmetErrorCode.SERVER_ERROR.getCode(), "调用operaccess获取要校验的资源失败", "调用operaccess获取要校验的资源失败"); + + // 缓存 + redisUtils.setString(RedisKeys.getOperExamineResourceUrls(), JSON.toJSONString(resources)); + } + + for (OperResouce resource : resources) { + if (antPathMatcher.match(resource.getResourceUrl(), uri) + && resource.getResourceMethod().equals(method)) { + + //需要校验权限的url + HasOperPermissionFormDTO form = new HasOperPermissionFormDTO(); + form.setUri(uri); + form.setMethod(method); + form.setOperId(userId); + Result result = operAccessOpenFeignClient.hasOperPermission(form); + if (result == null || !result.success()) { + return false; + } + return true; + } + } + + // 如果当前请求url不需要校验权限,那么返回true + return true; + } + /** * 是否需要认证 * @param requestUri diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java index 2ea01e1c32..71dce075fe 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java @@ -42,4 +42,15 @@ public class CpProperty { */ private List swaggerUrls; + /** + * 运营端,需要校验的url资源列表 + */ + private List operExamineResourceUrls; + + @Data + public static class OperExamineResource { + private String resourceUrl; + private String resourceMethod; + } + } diff --git a/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java b/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java index 7cca3c4b36..ea02f75376 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java @@ -5,6 +5,7 @@ import com.epmet.auth.ExternalAuthProcessor; import com.epmet.auth.InternalAuthProcessor; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.IpUtils; @@ -64,6 +65,10 @@ public class EpmetGatewayFilter implements GatewayFilter { } return doFilter(exchange, chain); + } catch (EpmetException re) { + // 人为抛出,则携带错误码和错误信息响应给前端 + log.error("EpmetGatewayFilter认证出错RenException,错误信息:{}", ExceptionUtils.getErrorStackTrace(re)); + return response(exchange, new Result<>().error(re.getCode(), re.getMessage())); } catch (RenException re) { // 人为抛出,则携带错误码和错误信息响应给前端 log.error("EpmetGatewayFilter认证出错RenException,错误信息:{}", ExceptionUtils.getErrorStackTrace(re)); diff --git a/epmet-gateway/src/main/resources/bootstrap-urls.yml b/epmet-gateway/src/main/resources/bootstrap-urls.yml new file mode 100644 index 0000000000..dded0b1b86 --- /dev/null +++ b/epmet-gateway/src/main/resources/bootstrap-urls.yml @@ -0,0 +1,5 @@ +epmet: + oper-examine-resource-urls: + # 角色编辑 + - resourceUrl: /oper/access/operrole + resourceMethod: PUT \ No newline at end of file diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index bfc3d86130..483f545f43 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -12,6 +12,7 @@ spring: name: epmet-gateway-server #环境 dev|test|prod profiles: + include: urls active: @spring.profiles.active@ messages: encoding: UTF-8 diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index 58109b1b89..a8621ce09d 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java +++ b/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"; } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java new file mode 100644 index 0000000000..d7334fabd6 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/NatInfoScanTask.java @@ -0,0 +1,40 @@ +package com.epmet.task; + + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author zxc + * @dscription + * 大数据局部门配置on + * 根据范围搜索居民,调接口查询最近一次核酸检测记录 + * 检测时间 + 身份证 不存在就插入 + */ +@Slf4j +@Component("natInfoScanTask") +public class NatInfoScanTask implements ITask { + + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; + + @Override + public void run(String params) { + NatInfoScanTaskFormDTO formDTO = new NatInfoScanTaskFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, NatInfoScanTaskFormDTO.class); + } + Result result = userOpenFeignClient.natInfoScanTask(formDTO); + if (result.success()) { + log.info("NatInfoScanTask定时任务执行成功"); + } else { + log.error("NatInfoScanTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java index cbd2797bfb..1906e0a192 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java @@ -13,6 +13,10 @@ import java.io.Serializable; @Data public class UploadImgResultDTO implements Serializable { private String url; + /** + * 原始文件名 + */ + private String fileName; /** * 域名 */ diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index d55751762c..140d57ead6 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -279,6 +279,7 @@ public class OssServiceImpl extends BaseServiceImpl implement UploadImgResultDTO dto = new UploadImgResultDTO(); dto.setUrl(url); dto.setDomain(ossDomain); + dto.setFileName(file.getOriginalFilename()); return new Result().ok(dto); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql index 9d13ecb53c..8187e01d08 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql @@ -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; \ No newline at end of file + DEFAULT CHARSET = utf8mb4; diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java index 91ef00b75a..d5ca9f7008 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java @@ -65,6 +65,10 @@ public class GovMenuDTO extends TreeStringNode implements Serializab * 菜单图标 */ private String icon; + /** + * 菜单颜色 + */ + private String color; /** * 权限标识,如:sys:menu:save diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java index 73ff018a10..46698701ed 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java @@ -38,4 +38,9 @@ public class OftenUseFunctionListResultDTO implements Serializable { * 排序 */ private String sort; + + /** + * 菜单颜色 + */ + private String color; } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java index 9c1c3922ed..6eba2e36d1 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java @@ -47,6 +47,10 @@ public class GovMenuEntity extends BaseEpmetEntity { * 菜单图标 */ private String icon; + /** + * 菜单颜色 + */ + private String color; /** * 权限标识,如:sys:menu:save */ diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql new file mode 100644 index 0000000000..78036e8f34 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql @@ -0,0 +1,2 @@ +ALTER TABLE `epmet_gov_access`.`gov_menu` + ADD COLUMN `color` varchar(16) DEFAULT '' COMMENT '菜单颜色' AFTER `icon`; diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml index 5f25af85fc..35d01fb929 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml @@ -15,7 +15,8 @@ ic.MENU_ID, gm.url, gm.icon, - gl.field_value AS menuName + gl.field_value AS menuName, + gm.color FROM ic_often_use_function ic INNER JOIN gov_customer_menu gc ON (gc.TABLE_ID = ic.MENU_ID AND gc.DEL_FLAG = '0' AND ic.CUSTOMER_ID = gc.CUSTOMER_ID) INNER JOIN gov_menu gm ON (gc.TABLE_ID = gm.id AND gm.DEL_FLAG = 0 AND gm.SHOW_FLAG = 1) @@ -24,4 +25,4 @@ AND ic.USER_ID = #{userId} ORDER BY ic.SORT - \ No newline at end of file + diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java index 7fe2d7bf6c..755a12a89a 100644 --- a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffResetPassWordFormDTO.java @@ -22,6 +22,10 @@ public class StaffResetPassWordFormDTO implements Serializable { public interface AddUserShowGroup extends CustomerClientShowGroup { } + /** + * 旧密码 + */ + private String oldPassword; @NotBlank(message = "新密码不能为空", groups = {AddUserShowGroup.class}) private String newPassword; @NotBlank(message = "确认新密码不能为空", groups = {AddUserShowGroup.class}) diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java index cc9a8c9e94..3191db2685 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/MineController.java @@ -2,12 +2,15 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.StaffResetPassWordFormDTO; import com.epmet.dto.result.MineResultDTO; import com.epmet.service.MineService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -21,6 +24,8 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("mine") public class MineController { + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private MineService mineService; @@ -45,9 +50,27 @@ public class MineController { * @Date 2020/7/1 9:59 **/ @PostMapping("resetpassword") - public Result resetPassword(@LoginUser TokenDto tokenDto, @RequestBody StaffResetPassWordFormDTO formDTO) { + public Result resetPassword(@LoginUser TokenDto tokenDto, @RequestBody StaffResetPassWordFormDTO formDTO) throws Exception { formDTO.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO, StaffResetPassWordFormDTO.AddUserShowGroup.class, StaffResetPassWordFormDTO.AddUserInternalGroup.class); + //解密密码 + if (formDTO.getConfirmNewPassword().length() > 50) { + String confirmNewPassWord = RSASignature.decryptByPrivateKey(formDTO.getConfirmNewPassword(), privateKey); + String newPassword = RSASignature.decryptByPrivateKey(formDTO.getNewPassword(), privateKey); + formDTO.setConfirmNewPassword(confirmNewPassWord); + formDTO.setNewPassword(newPassword); + if (StringUtils.isNotBlank(formDTO.getOldPassword())){ + String oldPassWord = RSASignature.decryptByPrivateKey(formDTO.getOldPassword(), privateKey); + formDTO.setOldPassword(oldPassWord); + } + } return mineService.resetPassword(formDTO); } + + public static void main(String[] args) throws Exception { + String p= "R16c3yJqCMyRFTxElBeBexTVlW1GArItaVqEEyF3o3jXVwq0G08ck8wEdBAEyQI1y4uCsw3UBgx1mqiMbIfvdg=="; + String privateKey= "MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAqOANodapaCq6hq1sLjPNAKCoTwLjblUg7LMlVWAfUdRgIem41ScYK/ccECXZGzOJZCpCB3XHGXQLdrkngnr2jwIDAQABAkAyYaWvgrtHuHetdk+v+QRQC54q9FGluP/5nfilX+f4IUf8j92o/ZohTtmJn9qcDiAP4wxCLIsfy4IW3psST78BAiEA0A/E0WvtI7spWnjfw+wMDhdVMIbIJvDbj/cqMwRZInUCIQDPyO2sbXpwDjmAvyn0jpGJJxU5POWYdI37rTf9fScMcwIhAMkWNHbjBHKANVuHb10ACjakPmWEHnXkW5AspdBg53TxAiARPbzq99KXBbcjxbj3f/T3inSqYTEz60f0wDTLJd1dnQIhAIFe6Jd1TduIxGk1PDh/b/3q0jNGgVXkFnUBnKWDaL9N"; + String newPassword = RSASignature.decryptByPrivateKey(p, privateKey); + System.out.println(newPassword); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java index 77c8502971..44fb7f61a4 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/MineServiceImpl.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffResetPassWordFormDTO; @@ -50,7 +51,7 @@ public class MineServiceImpl implements MineService { throw new RenException(EpmetErrorCode.PASSWORD_NOT_FIT.getCode()); } //2、校验密码规则:密码必须8-20个字符,而且同时包含大小写字母和数字 - boolean flag=this.checkPassWord(formDTO.getNewPassword()); + boolean flag= PasswordUtils.checkPassWordRule(formDTO.getNewPassword()); if(!flag){ throw new RenException(EpmetErrorCode.PASSWORD_OUT_OF_ORDER.getCode()); } @@ -59,50 +60,15 @@ public class MineServiceImpl implements MineService { staffResetPwFormDTO.setNewPassword(formDTO.getNewPassword()); staffResetPwFormDTO.setConfirmNewPassword(formDTO.getConfirmNewPassword()); staffResetPwFormDTO.setStaffId(formDTO.getStaffId()); + staffResetPwFormDTO.setOldPassword(formDTO.getOldPassword()); Result updatePassWordResult=epmetUserOpenFeignClient.resetStaffPassword(staffResetPwFormDTO); if(updatePassWordResult.success()){ logger.info(String.format("调用%s服务,修改密码成功", ServiceConstant.EPMET_USER_SERVER)); }else{ logger.warn(String.format("调用%s服务,修改密码失败,返参:%s", ServiceConstant.EPMET_USER_SERVER, JSON.toJSONString(updatePassWordResult))); - return new Result().error(EpmetErrorCode.PASSWORD_UPDATE_FAILED.getCode()); + return new Result().error(EpmetErrorCode.PASSWORD_UPDATE_FAILED.getCode(),updatePassWordResult.getMsg()); } return new Result(); } - - private boolean checkPassWord(String password) { - boolean flag=false; - if(password.length()<8||password.length()>20){ - logger.warn(String.format("密码长度应为8-20位,当前输入密码%s,长度为%s",password,password.length())); - return flag; - } - boolean numFlag=false; - boolean bigLetter=false; - boolean smallLetter=false; - char[] passwordArray = password.toCharArray(); - for(int i=0;i < passwordArray.length;i++) { - char currentStr=passwordArray[i]; - logger.info(String.format("当前字符%s",currentStr)); - // 判断ch是否是数字字符,如'1','2‘,是返回true。否则返回false - if(Character.isDigit(currentStr)){ - numFlag=true; - continue; - } - // 判断ch是否是字母字符,如'a','b‘,是返回true。否则返回false - if(Character.isUpperCase(currentStr)){ - bigLetter=true; - continue; - } - if(Character.isLowerCase(currentStr)){ - smallLetter=true; - continue; - } - } - if(numFlag&&bigLetter&&smallLetter){ - flag=true; - }else{ - logger.warn(String.format("当前密码%s,是否包含数字%s,是否包含大写字母%s,是否包含小写字母%s",password,numFlag,bigLetter,smallLetter)); - } - return flag; - } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml b/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml index 88eabe8772..0537c64f52 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml @@ -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 + diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java new file mode 100644 index 0000000000..030fc58bd5 --- /dev/null +++ b/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; +} + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 56b92b7d5c..bcbaf69fde 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/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>().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 diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index 127e7422ee..4a9269c42c 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java @@ -255,4 +255,6 @@ public interface ArticleService extends BaseService { PageData articleListV2(ArticleListFormDTO formDTO); PublishedListResultDTO detailV2(ArticleListFormDTO formDTO); + + void topArticle(String articleId, String type); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index 3a01001543..b2099dd2a5 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -1775,4 +1775,21 @@ public class ArticleServiceImpl extends BaseServiceImpl resourceList = operResourceService.getMenuResourceList(id); - + data.setResourceList(resourceList); return new Result().ok(data); } @@ -161,4 +165,37 @@ public class OperMenuController { operMenuService.clearOperUserAccess(tokenDto.getApp(), tokenDto.getClient(), tokenDto.getUserId()); return new Result(); } + + /** + * 改运营人员是否有该接口的权限 + * @return + */ + @PostMapping("hasPermission") + public Result hasOperPermission(@RequestBody HasOperPermissionFormDTO form) { + ValidatorUtils.validateEntity(form); + String uri = form.getUri(); + String method = form.getMethod(); + + // if (!AppClientConstant.APP_OPER.equals(loginUserApp)) { + //// 只校验运营端,其他都返回true + // return new Result(); + // } + + Boolean isMathe = operMenuService.hasOperPermission(uri, method, form.getOperId()); + if (isMathe){ + return new Result(); + } else { + return new Result().error(); + } + } + + /** + * 需要验证的菜单资源 + * @return + */ + @PostMapping("getExamineResourceUrls") + public Result getExamineResourceUrls() { + List resources = operMenuService.getExamineResourceUrls(); + return new Result().ok(resources); + } } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java index 2858a76f24..4e38620c38 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java @@ -9,6 +9,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.OperResouce; import com.epmet.entity.OperMenuEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -49,4 +50,8 @@ public interface OperMenuDao extends BaseDao { * @param pid 父菜单ID */ List getListPid(String pid); + + List getOperResourcesByUserId(String operId); + + List getExamineResourceUrls(); } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java index f1b568f33a..4173845149 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java @@ -17,10 +17,13 @@ package com.epmet.redis; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.HttpContextUtils; import com.epmet.dto.OperMenuDTO; +import com.epmet.dto.result.OperResouce; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -71,4 +74,25 @@ public class OperMenuRedis { return (Set)redisUtils.get(key); } + public List getOperResourcesByUserId(String operId) { + String key = RedisKeys.operResourcesByUserId(operId); + String json = redisUtils.getString(key); + return JSON.parseObject(json, new TypeReference>(){}); + } + + public void setOperResourcesByUserId(String operId, List resouces) { + String key = RedisKeys.operResourcesByUserId(operId); + String jsonString = JSON.toJSONString(resouces); + redisUtils.setString(key, jsonString); + } + + /** + * 运营端用户资源删除 + * @param operId + * @param resouces + */ + public void deleteOperResourcesByUserId(String operId) { + String key = RedisKeys.operResourcesByUserId(operId); + redisUtils.delete(key); + } } \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java index 54e3a58067..a56dffb0ac 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.OperMenuDTO; +import com.epmet.dto.result.OperResouce; import com.epmet.entity.OperMenuEntity; import java.util.List; @@ -141,4 +142,8 @@ public interface OperMenuService extends BaseService { List getListPid(String pid); void clearOperUserAccess(String app, String client, String userId); + + Boolean hasOperPermission(String uri, String method, String loginUserId); + + List getExamineResourceUrls(); } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java index d83970486c..47667c980f 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java @@ -24,8 +24,11 @@ import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.enums.SuperAdminEnum; import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpContextUtils; @@ -34,6 +37,7 @@ import com.epmet.commons.tools.utils.TreeUtils; import com.epmet.dao.OperMenuDao; import com.epmet.dto.OperMenuDTO; import com.epmet.dto.OperUserDTO; +import com.epmet.dto.result.OperResouce; import com.epmet.entity.OperMenuEntity; import com.epmet.enums.MenuTypeEnum; import com.epmet.feign.EpmetUserFeignClient; @@ -48,6 +52,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.AntPathMatcher; import java.util.*; @@ -70,6 +75,10 @@ public class OperMenuServiceImpl extends BaseServiceImpl page(Map params) { @@ -112,6 +121,13 @@ public class OperMenuServiceImpl extends BaseServiceImpl operUserDTOResult = epmetUserFeignClient.info(operId); + if(!operUserDTOResult.success()||null==operUserDTOResult.getData()){ + logger.error("查询运营人员信息失败:operId:{}", operId); + return false; + } + + //系统管理员,拥有最高权限 + if(operUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){ + return true; + } + + // 不是系统管理员再具体查询 + List resouces = operMenuRedis.getOperResourcesByUserId(operId); + if (resouces == null) { + resouces = baseDao.getOperResourcesByUserId(operId); + operMenuRedis.setOperResourcesByUserId(operId, resouces); + } + + return pathMatcher(uri, method, resouces); + } + + private boolean pathMatcher(String requestUri, String method, List resources){ + for (OperResouce resource : resources) { + String resourceUrl = resource.getResourceUrl(); + String resourceMethod = resource.getResourceMethod(); + +// 路径匹配 && http方法 匹配 + if(antPathMatcher.match(resourceUrl, requestUri) && resourceMethod.equals(method)){ + return true; + } + } + return false; + } + + @Override + public List getExamineResourceUrls() { + return baseDao.getExamineResourceUrls(); + } } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java index 7af5d774c6..e9d80b6399 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java @@ -21,7 +21,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.OperRoleDao; import com.epmet.dto.OperRoleDTO; @@ -30,6 +33,7 @@ import com.epmet.redis.OperRoleRedis; import com.epmet.service.OperRoleMenuService; import com.epmet.service.OperRoleService; import com.epmet.service.OperRoleUserService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -46,6 +50,7 @@ import java.util.Map; * @since v1.0.0 2020-03-18 */ @Service +@Slf4j public class OperRoleServiceImpl extends BaseServiceImpl implements OperRoleService { @Autowired @@ -55,6 +60,9 @@ public class OperRoleServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -93,6 +101,13 @@ public class OperRoleServiceImpl extends BaseServiceImpl select t3.*, (select lang.field_value from oper_language lang where lang.table_name='oper_menu' and lang.field_name='name' and lang.table_id=t3.id and lang.language=#{language}) as name from oper_role_user t1 - left join oper_role_menu t2 on t1.role_id = t2.role_id - left join oper_menu t3 on t2.menu_id = t3.id - where t1.user_id = #{userId} and t3.del_flag = 0 + left join oper_role_menu t2 on (t1.role_id = t2.role_id AND t2.del_flag = 0) + left join oper_menu t3 on (t2.menu_id = t3.id) + where t1.user_id = #{userId} AND t1.del_flag = 0 and t3.del_flag = 0 and t2.DEL_FLAG = 0 and t3.type = #{type} @@ -39,4 +39,22 @@ select * from oper_menu where del_flag = 0 and pid = #{value} + + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml index b9075fceda..17f9602254 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml @@ -4,7 +4,7 @@ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 95b136c9ac..493d176a07 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -1171,7 +1171,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl scopeList; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncScopeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncScopeDTO.java new file mode 100644 index 0000000000..626b3d966c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/DataSyncScopeDTO.java @@ -0,0 +1,94 @@ +package com.epmet.dto; + +import com.epmet.dto.form.ScopeSaveFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +public class DataSyncScopeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 数据更新配置表主键 + */ + private String dataSyncConfigId; + + /** + * 网格:grid, +社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province + */ + @NotBlank(message = "orgType不能为空",groups = ScopeSaveFormDTO.ScopeSaveForm.class) + private String orgType; + + /** + * 组织或者网格id + */ + @NotBlank(message = "orgId不能为空",groups = ScopeSaveFormDTO.ScopeSaveForm.class) + private String orgId; + + /** + * org_id的上级 + */ + private String pid; + + /** + * org_id的全路径,包含自身 + */ + private String orgIdPath; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java index fddaa92fc9..5d880153a6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java @@ -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; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java new file mode 100644 index 0000000000..3b7af8fea0 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNatCompareRecordDTO.java @@ -0,0 +1,121 @@ +package com.epmet.dto; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 核酸比对记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +public class IcNatCompareRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelIgnore + private String customerId; + + /** + * 主键 + */ + @ExcelIgnore + private String relationId; + + /** + * 姓名 + */ + @ColumnWidth(15) + @ExcelProperty("姓名") + private String name; + + /** + * 真实身份证号 + */ + @ColumnWidth(20) + @ExcelProperty("身份证号") + private String realIdCard; + + /** + * 身份证 + */ + @ExcelIgnore + private String idCard; + + /** + * 手机号 + */ + @ExcelIgnore + private String mobile; + + /** + * 真实手机号 + */ + @ColumnWidth(20) + @ExcelProperty("手机号") + private String realMobile; + + /** + * 是否客户下居民(0:否 1:是) + */ + @ExcelIgnore + private String isAgencyUser; + + @ColumnWidth(10) + @ExcelProperty("本辖区居民") + private String isAgencyUserDesc; + + /** + * 是本辖区的居民时候,ic_resi_user.id + */ + @ExcelIgnore + private String icResiUserId; + + /** + * 最近一次核酸时间:接口填入 + */ + @ColumnWidth(30) + @ExcelProperty("最近一次核酸时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date latestNatTime; + + /** + * 检测结果(0:阴性 1:阳性):接口填入 + */ + @ExcelIgnore + private String natResult; + + + /** + * 检测地点:接口填入 + */ + @ColumnWidth(50) + @ExcelProperty("检测地点") + private String natAddress; + + + @ColumnWidth(15) + @ExcelProperty("检测结果") + private String natResultDesc; + + @ExcelIgnore + private String importDate; + + + @ColumnWidth(30) + @ExcelProperty("导入时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date importTime; + + @ColumnWidth(30) + @ExcelProperty("导入组织") + private String agencyName; +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java index 72520ef800..d4184734a9 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java @@ -106,4 +106,8 @@ public class IcNoticeDTO implements Serializable { @JsonIgnore private Date updatedTime; + /** + * 发送结果:1成功,0失败 + */ + private String sendRes; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java index 508f8dc2ad..9d2ab97099 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java @@ -35,6 +35,9 @@ public class IcTripReportRecordDTO implements Serializable { @ExcelIgnore private String id; + @ExcelIgnore + private String epidemicId; + /** * 居民端用户所在网格id,数字社区居民所属网格id */ @@ -73,6 +76,11 @@ public class IcTripReportRecordDTO implements Serializable { @ExcelProperty("手机号") private String mobile; + /** + * 真实手机号不打码 + */ + private String realMobile; + /** * 身份证号 */ @@ -80,6 +88,11 @@ public class IcTripReportRecordDTO implements Serializable { @ExcelProperty("身份证号") private String idCard; + /** + * 真实身份证号 + */ + private String realIdCard; + /** * 用户id */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfigSwitchFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfigSwitchFormDTO.java new file mode 100644 index 0000000000..1ff6b9bcf4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfigSwitchFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/26 14:34 + * @DESC + */ +@Data +public class ConfigSwitchFormDTO implements Serializable { + + private static final long serialVersionUID = 7510856043372376415L; + + public interface ConfigSwitchForm{} + + @NotBlank(message = "deptCode不能为空",groups = ConfigSwitchForm.class) + private String deptCode; + + @NotBlank(message = "dataSyncConfigId不能为空",groups = ConfigSwitchForm.class) + private String dataSyncConfigId; + private String updatedBy; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java new file mode 100644 index 0000000000..6d642b2e90 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/NatInfoScanTaskFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/9/26 17:04 + * @DESC + */ +@Data +public class NatInfoScanTaskFormDTO implements Serializable { + + private static final long serialVersionUID = 3053943501957102943L; + + private String customerId; + + private List idCards; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ScopeSaveFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ScopeSaveFormDTO.java new file mode 100644 index 0000000000..738ed51b59 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ScopeSaveFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import com.epmet.dto.DataSyncScopeDTO; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/9/26 15:35 + * @DESC + */ +@Data +public class ScopeSaveFormDTO implements Serializable { + + private static final long serialVersionUID = -489844541905303736L; + + public interface ScopeSaveForm{} + + @NotBlank(message = "dataSyncConfigId不能为空",groups = ScopeSaveForm.class) + private String dataSyncConfigId; + private String customerId; + + @Valid + private List scopeList; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java index 75a2eee8e0..56bdcc0fea 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java @@ -60,5 +60,8 @@ public class SendNoticeFormDTO implements Serializable { * 身份证 */ private String idCard; + + + private String realIdCard; } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java new file mode 100644 index 0000000000..23e77ed29c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeV2FormDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/9/21 17:06 + */ +@Data +public class SendNoticeV2FormDTO { + // token获取 + private String customerId; + private String staffId; + // 前端传入 + /** + * 用户列表 + */ + @NotEmpty(message = "业务数据id不能为空", groups = CustomerClientShowGroup.class) + private List bdIds; + /** + * 通知渠道通知渠道 0小程序通知,1短信通知 + */ + @NotEmpty(message = "请选择通知渠道", groups = CustomerClientShowGroup.class) + private List channel; + /** + * v1:通知来源 0 行程上报,1 疫苗接种,2 核酸检测 + * v2:0行程上报,1疫苗接种关注名单,2重点人群关注名单-隔离防疫(原核酸检测关注名单) + */ + @NotEmpty(message = "通知来源不能为空", groups = CustomerClientShowGroup.class) + private String origin; + /** + * 通知内容 + */ + @Size(min = 1, max = 500, message = "通知内容不超过500字", groups = CustomerClientShowGroup.class) + private String content; + + // 接口内赋值 + /** + * 组织名 + */ + private String orgName; + +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java index 9d21502254..f3ecdc99c0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffResetPwFormDTO.java @@ -22,7 +22,10 @@ public class StaffResetPwFormDTO implements Serializable { public interface AddUserShowGroup extends CustomerClientShowGroup { } - + /** + * 旧密码 + */ + private String oldPassword; @NotBlank(message = "新密码不能为空", groups = {AddUserShowGroup.class}) private String newPassword; @NotBlank(message = "确认新密码不能为空", groups = {AddUserShowGroup.class}) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java index 66742465ad..cc06182a72 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java @@ -24,6 +24,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; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java new file mode 100644 index 0000000000..c5f6ddd53e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/yqfk/IcNatCompareRecordPageFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form.yqfk; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/9/26 15:55 + */ +@Data +public class IcNatCompareRecordPageFormDTO extends PageFormDTO { + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; + /** + * 导入时间 yyyyMMdd + */ + private String importDate; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 手机号 + */ + private String mobile; + + + private String customerId; + private String userId; + private String agencyId; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java new file mode 100644 index 0000000000..10e611aa46 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/NatUserInfoResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/9/27 10:23 + * @DESC + */ +@Data +public class NatUserInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 8904940082452398136L; + + private String idCard; + + private String userId; + + private String agencyId; + + private String pids; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java index 636fc5d3c2..7099e1650b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java @@ -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; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 84b6d77d5e..a2398b2d92 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -921,4 +921,7 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/userbaseinfo/dingResiLogin") Result dingResiLogin(@RequestBody DingLoginResiFormDTO formDTO); + + @PostMapping("/epmetuser/dataSyncConfig/natInfoScanTask") + Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 5726a772cd..4601ca1ef3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -711,4 +711,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result dingResiLogin(DingLoginResiFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "dingResiLogin", formDTO); } + + @Override + public Result natInfoScanTask(NatInfoScanTaskFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "natInfoScanTask", formDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 293b925353..6c9d46dbb5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -39,7 +40,9 @@ import com.epmet.excel.CustomerStaffExcel; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.send.SendMqMsgUtil; import com.epmet.service.CustomerStaffService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -57,7 +60,8 @@ import java.util.Map; @RestController @RequestMapping("customerstaff") public class CustomerStaffController { - + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private CustomerStaffService customerStaffService; @Autowired @@ -500,7 +504,12 @@ public class CustomerStaffController { * @Date 10:03 2020-08-25 **/ @PostMapping(value = "customerlist") - public Result> customerList(@RequestBody CustomerListFormDTO formDTO){ + public Result> customerList(@RequestBody CustomerListFormDTO formDTO) throws Exception { + //解密密码 + if (StringUtils.isNotBlank(formDTO.getPhone())&&formDTO.getPhone().length() > 50) { + String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey); + formDTO.setPhone(phone); + } return customerStaffService.selectCustomerList(formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java new file mode 100644 index 0000000000..950de6f573 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncConfigController.java @@ -0,0 +1,115 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.DataSyncConfigDTO; +import com.epmet.dto.form.ConfigSwitchFormDTO; +import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.dto.form.ScopeSaveFormDTO; +import com.epmet.service.DataSyncConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@RestController +@RequestMapping("dataSyncConfig") +public class DataSyncConfigController { + + @Autowired + private DataSyncConfigService dataSyncConfigService; + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + DataSyncConfigDTO data = dataSyncConfigService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody DataSyncConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + dataSyncConfigService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody DataSyncConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dataSyncConfigService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + dataSyncConfigService.delete(ids); + return new Result(); + } + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + @PostMapping("configSwitch") + public Result configSwitch(@RequestBody ConfigSwitchFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, ConfigSwitchFormDTO.ConfigSwitchForm.class); + formDTO.setUpdatedBy(tokenDto.getUserId()); + dataSyncConfigService.configSwitch(formDTO); + return new Result(); + } + + /** + * Desc: 【数据配置】列表 + * @param tokenDto + * @author zxc + * @date 2022/9/26 15:04 + */ + @PostMapping("list") + public Result list(@LoginUser TokenDto tokenDto, @RequestBody PageFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,PageFormDTO.AddUserInternalGroup.class); + return new Result().ok(dataSyncConfigService.list(tokenDto,formDTO)); + } + + /** + * Desc: 【数据配置】范围保存 + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2022/9/26 15:40 + */ + @PostMapping("scopeSave") + public Result scopeSave(@LoginUser TokenDto tokenDto,@RequestBody ScopeSaveFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ScopeSaveFormDTO.ScopeSaveForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + dataSyncConfigService.scopeSave(formDTO); + return new Result(); + } + + @PostMapping("natInfoScanTask") + public Result natInfoScanTask(@RequestBody NatInfoScanTaskFormDTO formDTO){ + dataSyncConfigService.natInfoScanTask(formDTO); + return new Result(); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncScopeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncScopeController.java new file mode 100644 index 0000000000..e7e3980574 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/DataSyncScopeController.java @@ -0,0 +1,70 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.DataSyncScopeDTO; +import com.epmet.service.DataSyncScopeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@RestController +@RequestMapping("dataSyncScope") +public class DataSyncScopeController { + + @Autowired + private DataSyncScopeService dataSyncScopeService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = dataSyncScopeService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + DataSyncScopeDTO data = dataSyncScopeService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody DataSyncScopeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + dataSyncScopeService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody DataSyncScopeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dataSyncScopeService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + dataSyncScopeService.delete(ids); + return new Result(); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatCompareRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatCompareRecordController.java new file mode 100644 index 0000000000..aa611e8252 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatCompareRecordController.java @@ -0,0 +1,194 @@ +package com.epmet.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; +import com.epmet.constants.ImportTaskConstants; +import com.epmet.dto.IcNatCompareRecordDTO; +import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; +import com.epmet.service.IcNatCompareRecordService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.nio.file.Path; +import java.util.Date; +import java.util.UUID; + + +/** + * 核算比对记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Slf4j +@RestController +@RequestMapping("icNatCompareRecord") +public class IcNatCompareRecordController implements ResultDataResolver { + + @Autowired + private IcNatCompareRecordService icNatCompareRecordService; + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + /** + * 未做核酸比对-分页查询 + * @param tokenDto + * @param formDTO + * @return + */ + @RequestMapping("page") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + public Result> page(@LoginUser TokenDto tokenDto, @RequestBody IcNatCompareRecordPageFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + PageData page = icNatCompareRecordService.page(formDTO); + return new Result>().ok(page); + } + + /** + * pc:未做核酸比对-导出 + * @param tokenDto + * @param formDTO + * @param response + */ + @NoRepeatSubmit + @PostMapping("export") + public void export(@LoginUser TokenDto tokenDto, @RequestBody IcNatCompareRecordPageFormDTO formDTO, HttpServletResponse response) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + // formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); + // formDTO.setUserId("35005df15fb0f7c791344f0b424870b7"); + formDTO.setIsPage(false); + ExcelWriter excelWriter = null; + formDTO.setPageSize(NumConstant.TEN_THOUSAND); + int pageNo = formDTO.getPageNo(); + try { + // 这里 需要指定写用哪个class去写 + String today= DateUtils.format(new Date(),DateUtils.DATE_PATTERN_MMDD); + String fileName = "核酸比对".concat(today); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcNatCompareRecordDTO.class).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); + PageData data = null; + do { + data = icNatCompareRecordService.page(formDTO); + formDTO.setPageNo(++pageNo); + excelWriter.write(data.getList(), writeSheet); + } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); + + } catch (Exception e) { + log.error("export exception", e); + } finally { + // 千万别忘记finish 会帮忙关闭流 + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + + /** + * 导入excel + * @return + */ + @NoRepeatSubmit + @PostMapping("import") + public Result importExcel(@LoginUser TokenDto tokenDto, @RequestPart("file") MultipartFile file) { + String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + + // 1.暂存文件 + String originalFilename = file.getOriginalFilename(); + String extName = originalFilename.substring(originalFilename.lastIndexOf(".")); + + Path fileSavePath; + try { + Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_nat_compare_record", "import"); + fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName)); + } catch (IOException e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【未做核酸比对】创建临时存储文件失败:{}", errorMsg); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败"); + } + + InputStream is = null; + FileOutputStream os = null; + + try { + is = file.getInputStream(); + os = new FileOutputStream(fileSavePath.toString()); + IOUtils.copy(is, os); + } catch (Exception e) { + log.error("method exception", e); + } finally { + org.apache.poi.util.IOUtils.closeQuietly(is); + org.apache.poi.util.IOUtils.closeQuietly(os); + } + + // 2.生成导入任务记录 + ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); + importTaskForm.setOperatorId(userId); + importTaskForm.setBizType(ImportTaskConstants.IC_NAT_COMPARE_RECORD); + importTaskForm.setOriginFileName(originalFilename); + + ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm), + ServiceConstant.EPMET_COMMON_SERVICE, + EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + "excel未做核酸比对导入文件错误", + "未做核酸比对导入文件失败"); + + // 3.执行导入 + icNatCompareRecordService.execAsyncExcelImport(fileSavePath, rstData.getTaskId(),tokenDto.getCustomerId(),tokenDto.getUserId()); + return new Result(); + } + + /** + * @param response + * @throws IOException + */ + @RequestMapping(value = "template-download", method = {RequestMethod.GET, RequestMethod.POST}) + public void downloadTemplate(HttpServletResponse response) throws IOException { + response.setCharacterEncoding("UTF-8"); + response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); + //response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel"); + response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("未做核酸比对", "UTF-8") + ".xlsx"); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_nat_compare_record_template.xlsx"); + try { + ServletOutputStream os = response.getOutputStream(); + IOUtils.copy(is, os); + } finally { + if (is != null) { + is.close(); + } + } + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java index 325eb71c31..ada0124d86 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNoticeController.java @@ -4,7 +4,6 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -15,6 +14,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.form.IcNoticeFormDTO; import com.epmet.dto.form.SendNoticeFormDTO; +import com.epmet.dto.form.SendNoticeV2FormDTO; import com.epmet.dto.form.SendPointNoticeFormDTO; import com.epmet.dto.result.CommunityInfoResultDTO; import com.epmet.feign.GovOrgFeignClient; @@ -108,4 +108,18 @@ public class IcNoticeController { return new Result(); } + /** + * 行程上报、重点人群关注名单、疫苗接种关注名单这几个页面的发送通知 + * @param tokenDto + * @param formDTO + * @return + */ + @PostMapping("sendNoticeV2") + public Result sendNoticeV2(@LoginUser TokenDto tokenDto, @RequestBody SendNoticeV2FormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerClientShowGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + icNoticeService.sendNoticeV2(formDTO); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index cfc1313c69..aea630040c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java @@ -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); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java index 02d15a0b46..a1c2ceb6e8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java @@ -19,12 +19,14 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -38,6 +40,7 @@ import com.epmet.excel.OperUserExcel; import com.epmet.service.OperUserService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -54,6 +57,8 @@ import java.util.Map; @RestController @RequestMapping("operuser") public class OperUserController { + @Value("${epmet.login.privateKey}") + private String privateKey; @Autowired private OperUserService operUserService; @@ -72,17 +77,43 @@ public class OperUserController { } @PostMapping - public Result save(@RequestBody OperUserDTO dto) { + public Result save(@RequestBody OperUserDTO dto) throws Exception { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + //解密密码 + if (StringUtils.isNotBlank(dto.getPassword()) && dto.getPassword().length() > NumConstant.FIFTY) { + String password = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey); + dto.setPassword(password); + } + if (StringUtils.isNotBlank(dto.getEmail()) && dto.getEmail().length() > NumConstant.FIFTY) { + String email = RSASignature.decryptByPrivateKey(dto.getEmail(), privateKey); + dto.setEmail(email); + } + if (StringUtils.isNotBlank(dto.getPhone()) && dto.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(dto.getPhone(), privateKey); + dto.setPhone(phone); + } operUserService.save(dto); return new Result(); } @PutMapping - public Result update(@RequestBody OperUserDTO dto) { + public Result update(@RequestBody OperUserDTO dto) throws Exception { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + //解密密码 + if (StringUtils.isNotBlank(dto.getPassword()) && dto.getPassword().length() > NumConstant.FIFTY) { + String password = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey); + dto.setPassword(password); + } + if (StringUtils.isNotBlank(dto.getEmail()) && dto.getEmail().length() > NumConstant.FIFTY) { + String email = RSASignature.decryptByPrivateKey(dto.getEmail(), privateKey); + dto.setEmail(email); + } + if (StringUtils.isNotBlank(dto.getPhone()) && dto.getPhone().length() > NumConstant.FIFTY) { + String phone = RSASignature.decryptByPrivateKey(dto.getPhone(), privateKey); + dto.setPhone(phone); + } operUserService.update(dto); return new Result(); } @@ -94,10 +125,22 @@ public class OperUserController { * @return */ @PostMapping(value = "updatePwd") - public Result updatePwd(@LoginUser TokenDto tokenDto,@RequestBody PasswordDTO dto) { + public Result updatePwd(@LoginUser TokenDto tokenDto,@RequestBody PasswordDTO dto) throws Exception { if (StringUtils.isBlank(dto.getNewPassword()) && AppClientConstant.APP_OPER.equals(tokenDto.getClient())){ throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误","参数错误"); } + //解密密码 + if (dto.getPassword().length() > 50) { + String confirmNewPassWord = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey); + String newPassword = RSASignature.decryptByPrivateKey(dto.getNewPassword(), privateKey); + dto.setPassword(confirmNewPassWord); + dto.setNewPassword(newPassword); + if (StringUtils.isNotBlank(dto.getOldPassword())){ + String oldPassWord = RSASignature.decryptByPrivateKey(dto.getOldPassword(), privateKey); + dto.setOldPassword(oldPassWord); + } + } + //校验长度和 密码是否一致。 operUserService.updatePwd(tokenDto.getUserId(),dto); return new Result(); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java new file mode 100644 index 0000000000..d3a2c600ef --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncConfigDao.java @@ -0,0 +1,59 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.DataSyncConfigDTO; +import com.epmet.dto.DataSyncScopeDTO; +import com.epmet.dto.form.ConfigSwitchFormDTO; +import com.epmet.dto.result.NatUserInfoResultDTO; +import com.epmet.entity.DataSyncConfigEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Mapper +public interface DataSyncConfigDao extends BaseDao { + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + void configSwitch(ConfigSwitchFormDTO formDTO); + + /** + * Desc: 【数据配置】列表 + * @param customerId + * @author zxc + * @date 2022/9/26 15:04 + */ + List list(@Param("customerId")String customerId); + + List scopeList(@Param("id")String id); + + /** + * Desc: 删除范围 + * @param dataSyncConfigId + * @author zxc + * @date 2022/9/26 15:46 + */ + void delScope(@Param("dataSyncConfigId")String dataSyncConfigId); + + /** + * Desc: 根据范围查询居民证件号 + * @param list + * @author zxc + * @date 2022/9/27 09:23 + */ + List getIdCardsByScope(@Param("list") List list); + + List getUserIdByIdCard(@Param("list") List list); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncScopeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncScopeDao.java new file mode 100644 index 0000000000..d9f41befd1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/DataSyncScopeDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.DataSyncScopeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Mapper +public interface DataSyncScopeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecRelationDao.java new file mode 100644 index 0000000000..391127cfb3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecRelationDao.java @@ -0,0 +1,29 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcNatCompareRecRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 核酸比对组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-27 + */ +@Mapper +public interface IcNatCompareRecRelationDao extends BaseDao { + + /** + * + * @param customerId + * @param compareRecId + * @param agencyId + * @param importDate yyyyMMdd + * @return + */ + IcNatCompareRecRelationEntity selectExist(@Param("customerId") String customerId, + @Param("compareRecId") String compareRecId, + @Param("agencyId") String agencyId, + @Param("importDate") String importDate); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecordDao.java new file mode 100644 index 0000000000..ef0273fc0f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatCompareRecordDao.java @@ -0,0 +1,30 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcNatCompareRecordDTO; +import com.epmet.dto.form.yqfk.IcNatCompareRecordPageFormDTO; +import com.epmet.entity.IcNatCompareRecordEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 核算比对记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Mapper +public interface IcNatCompareRecordDao extends BaseDao { + + /** + * 分页查询 + * @param formDTO + * @return + */ + List pageList(IcNatCompareRecordPageFormDTO formDTO); + + + IcNatCompareRecordEntity selectByIdCard(@Param("customerId") String customerId, @Param("idCard")String idCard); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java index 31ef9ec667..3507473187 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcNatDao.java @@ -5,6 +5,7 @@ import com.epmet.dto.IcNatDTO; import com.epmet.dto.form.MyNatListFormDTO; import com.epmet.dto.result.MyNatListResultDTO; import com.epmet.dto.result.NatListResultDTO; +import com.epmet.dto.result.NatUserInfoResultDTO; import com.epmet.entity.IcNatEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -59,4 +60,6 @@ public interface IcNatDao extends BaseDao { */ int updateIsResiFlag(@Param("customerId") String customerId, @Param("icResiUserId") String icResiUserId); + List getExistNatInfo(@Param("list") List entities); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncConfigEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncConfigEntity.java new file mode 100644 index 0000000000..bcacb6ab95 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncConfigEntity.java @@ -0,0 +1,53 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_config") +public class DataSyncConfigEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 部门编码 + */ + private String deptCode; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 数据名称 + */ + private String dataName; + + /** + * 开启:open;关闭:closed + */ + private String switchStatus; + + private String dataCode; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncScopeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncScopeEntity.java new file mode 100644 index 0000000000..a106b7e7db --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/DataSyncScopeEntity.java @@ -0,0 +1,52 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("data_sync_scope") +public class DataSyncScopeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 数据更新配置表主键 + */ + private String dataSyncConfigId; + + /** + * 网格:grid, + * 组织:agency + */ + private String orgType; + + /** + * 组织或者网格id + */ + private String orgId; + + /** + * org_id的上级 + */ + private String pid; + + /** + * org_id的全路径,包含自身 + */ + private String orgIdPath; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java index b4eb253957..a22f3f3537 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcEpidemicSpecialAttentionEntity.java @@ -49,7 +49,7 @@ public class IcEpidemicSpecialAttentionEntity extends BaseEpmetEntity { private String isHistory; /** - * 隔离类型,来自字典表 + * 隔离类型,来自字典表;集中隔离:0;居家隔离1;居家健康监测2;已出隔离期3 */ private String isolatedState; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecRelationEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecRelationEntity.java new file mode 100644 index 0000000000..daffebedd9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecRelationEntity.java @@ -0,0 +1,77 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 核酸比对组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_nat_compare_rec_relation") +public class IcNatCompareRecRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * ic_nat_compare_record.id + */ + private String compareRecId; + + /** + * 导入日期:yyyyMMdd + */ + private String importDate; + + /** + * 导入时间,同一天内导入多次需要更新此列值 + */ + private Date importTime; + + /** + * 操作人员所属组织id + */ + private String agencyId; + /** + * 组织名称 + */ + private String agencyName; + /** + * agency_id的上级 + */ + private String pid; + + /** + * agency_id组织的所有上级 + */ + private String pids; + + /** + * 最近一次操作人 + */ + private String staffId; + + /** + * 最近一次操作人姓名 + */ + private String staffName; + + /** + * 是否本社区(agency_id)下居民(0:否 1:是) + */ + private String isAgencyUser; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java new file mode 100644 index 0000000000..0110312ed9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatCompareRecordEntity.java @@ -0,0 +1,71 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 核酸比对记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_nat_compare_record") +public class IcNatCompareRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + private String customerId; + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 手机号 + */ + private String mobile; + + /** + * 是否客户下居民(0:否 1:是) + */ + private String isResiUser; + + /** + * 是否客户下居民,ic_resi_user.id + */ + private String icResiUserId; + + /** + * 最近一次核酸时间:接口填入 + */ + private Date latestNatTime; + + /** + * 检测结果(0:阴性 1:阳性):接口填入 + */ + private String natResult; + + /** + * 检测地点:接口填入 + */ + private String natAddress; + /** + * 联系地址:接口填入 + */ + private String contactAddress; + /** + * 最新一次导入时间,对应ic_nat_compare_rec_relation.IMPORT_TIME + */ + private Date latestImportTime; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java index 7744ce67c6..50a9eed8e7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNatEntity.java @@ -89,4 +89,13 @@ public class IcNatEntity extends BaseEpmetEntity { */ private String attachmentUrl; + @TableField(exist = false) + private String agencyId; + + @TableField(exist = false) + private String pids; + + @TableField(exist = false) + private Boolean existStatus = false; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java index 133d56dfcd..41deda8a70 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcNoticeEntity.java @@ -57,4 +57,8 @@ public class IcNoticeEntity extends BaseEpmetEntity { */ private String orgName; + /** + * 发送结果:1成功,0失败 + */ + private String sendRes; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java new file mode 100644 index 0000000000..26b8ecf8f0 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcNatCompareRecordExcelData.java @@ -0,0 +1,48 @@ +package com.epmet.excel.data; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description + * @Author yzm + * @Date 2022/9/27 9:41 + */ +@Data +public class IcNatCompareRecordExcelData { + @NotBlank(message = "姓名为必填项") + @ExcelProperty("姓名") + private String name; + + @NotBlank(message = "身份证号为必填项") + @ExcelProperty("身份证号") + private String idCard; + + @NotBlank(message = "手机号为必填项") + @ExcelProperty("手机号") + private String mobile; + + @Data + public static class ErrorRow { + + @ExcelProperty("姓名") + @ColumnWidth(20) + private String name; + + @ColumnWidth(20) + @ExcelProperty("身份证号") + private String idCard; + + @ExcelProperty("手机号") + @ColumnWidth(20) + private String mobile; + + @ColumnWidth(60) + @ExcelProperty("错误信息") + private String errorInfo; + } +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java new file mode 100644 index 0000000000..f18b256247 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcNatCompareRecordExcelImportListener.java @@ -0,0 +1,160 @@ +package com.epmet.excel.handler; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.dto.result.YtHsjcResDTO; +import com.epmet.commons.tools.dto.result.YtHsjcResDetailDTO; +import com.epmet.commons.tools.enums.EnvEnum; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.ObjectUtil; +import com.epmet.commons.tools.utils.YtHsResUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.entity.IcNatCompareRecordEntity; +import com.epmet.excel.data.IcNatCompareRecordExcelData; +import com.epmet.service.impl.IcNatCompareRecordServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2022/9/27 9:42 + */ +@Slf4j +public class IcNatCompareRecordExcelImportListener implements ReadListener { + + /** + * 最大条数阈值 + */ + public static final int MAX_THRESHOLD = 200; + /** + * 当前操作用户 + */ + private CustomerStaffInfoCacheResult staffInfo; + private String customerId; + private IcNatCompareRecordServiceImpl icNatCompareRecordService; + /** + * 数据 + */ + private List datas = new ArrayList<>(); + + /** + * 错误项列表 + */ + private List errorRows = new ArrayList<>(); + private Date importTime; + /** + * 导入日期:yyyyMMdd + */ + private String importDate; + public IcNatCompareRecordExcelImportListener(String customerId, CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime, IcNatCompareRecordServiceImpl icNatCompareRecordService) { + this.customerId = customerId; + this.staffInfo = staffInfo; + this.icNatCompareRecordService = icNatCompareRecordService; + this.importDate=importDate; + this.importTime=importTime; + } + + + @Override + public void invoke(IcNatCompareRecordExcelData data, AnalysisContext analysisContext) { + try { + // log.warn("有数据吗?"+JSON.toJSONString(data)); + // 不能为空先校验数据 + ValidatorUtils.validateEntity(data); + // 去除空格 + ObjectUtil.objectToTrim(data); + IcNatCompareRecordEntity compareRecordEntity = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); + compareRecordEntity.setCustomerId(customerId); + compareRecordEntity.setLatestNatTime(null); + compareRecordEntity.setNatAddress(StrConstant.EPMETY_STR); + compareRecordEntity.setNatResult(StrConstant.EPMETY_STR); + // 开发和测试没法测试,只能写死只有生产才去调用了 烟台客户id:1535072605621841922 + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + if (EnvEnum.PROD.getCode().equals(currentEnv.getCode()) && "1535072605621841922".equals(customerId)) { + // 调用烟台api获取核酸检测结果 + YtHsjcResDTO hsjcResDTO = YtHsResUtils.hsjc(data.getIdCard(), 1, 1); + if (null != hsjcResDTO && CollectionUtils.isNotEmpty(hsjcResDTO.getData()) && null != hsjcResDTO.getData().get(0)) { + YtHsjcResDetailDTO ytHsjcResDetailDTO = hsjcResDTO.getData().get(0); + String testTime = ytHsjcResDetailDTO.getTest_time(); + compareRecordEntity.setLatestNatTime(DateUtils.parse(testTime, DateUtils.DATE_PATTERN)); + compareRecordEntity.setNatAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getSampling_org_pcr()) ? ytHsjcResDetailDTO.getSample_result_pcr() : StrConstant.EPMETY_STR); + + // "sample_result_pcr":"2",// 核酸检测结果 1:阳性,2:阴性 + String sample_result_pcr = ytHsjcResDetailDTO.getSample_result_pcr(); + if (NumConstant.ONE_STR.equals(sample_result_pcr)) { + compareRecordEntity.setNatResult(NumConstant.ONE_STR); + } else if (NumConstant.TWO_STR.equals(sample_result_pcr)) { + compareRecordEntity.setNatResult(NumConstant.ZERO_STR); + } + compareRecordEntity.setContactAddress(StringUtils.isNotBlank(ytHsjcResDetailDTO.getAddress()) ? ytHsjcResDetailDTO.getAddress() : StrConstant.EPMETY_STR); + } + } + datas.add(compareRecordEntity); + + if (datas.size() == MAX_THRESHOLD) { + execPersist(); + } + } catch (Exception e) { + String errorMsg = null; + if (e instanceof ValidateException) { + errorMsg = ((ValidateException) e).getMsg(); + } else if (e instanceof EpmetException) { + errorMsg = ((EpmetException) e).getMsg(); + } else { + errorMsg = "未知错误"; + log.error("【未做核酸比对导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); + } + IcNatCompareRecordExcelData.ErrorRow errorRow = new IcNatCompareRecordExcelData.ErrorRow(); + errorRow.setIdCard(data.getIdCard()); + errorRow.setName(data.getName()); + errorRow.setMobile(data.getMobile()); + errorRow.setErrorInfo(errorMsg); + errorRows.add(errorRow); + } + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + // 最后几条达不到阈值,这里必须再调用一次 + execPersist(); + } + + + /** + * 执行持久化 + */ + private void execPersist() { + // ic_nat_compare_record、ic_nat_compare_rec_relation + try { + if (datas != null && datas.size() > 0) { + icNatCompareRecordService.batchPersist(datas, staffInfo,importDate,importTime, this); + } + } finally { + datas.clear(); + } + } + + + /** + * 获取错误行 + * + * @return + */ + public List getErrorRows() { + return errorRows; + } +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java new file mode 100644 index 0000000000..1e0ad7162b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncConfigService.java @@ -0,0 +1,86 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.DataSyncConfigDTO; +import com.epmet.dto.form.ConfigSwitchFormDTO; +import com.epmet.dto.form.NatInfoScanTaskFormDTO; +import com.epmet.dto.form.ScopeSaveFormDTO; +import com.epmet.entity.DataSyncConfigEntity; + +/** + * 数据更新配置表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +public interface DataSyncConfigService extends BaseService { + + /** + * 单条查询 + * + * @param id + * @return DataSyncConfigDTO + * @author generator + * @date 2022-09-26 + */ + DataSyncConfigDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void save(DataSyncConfigDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void update(DataSyncConfigDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-09-26 + */ + void delete(String[] ids); + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + void configSwitch(ConfigSwitchFormDTO formDTO); + + /** + * Desc: 【数据配置】列表 + * @param tokenDto + * @author zxc + * @date 2022/9/26 15:04 + */ + PageData list(TokenDto tokenDto, PageFormDTO formDTO); + + /** + * Desc: 【数据配置】范围保存 + * @param formDTO + * @author zxc + * @date 2022/9/26 15:41 + */ + void scopeSave(ScopeSaveFormDTO formDTO); + + void natInfoScanTask(NatInfoScanTaskFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncScopeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncScopeService.java new file mode 100644 index 0000000000..d0588c10d9 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/DataSyncScopeService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.DataSyncScopeDTO; +import com.epmet.entity.DataSyncScopeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +public interface DataSyncScopeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-09-26 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-09-26 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return DataSyncScopeDTO + * @author generator + * @date 2022-09-26 + */ + DataSyncScopeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void save(DataSyncScopeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-09-26 + */ + void update(DataSyncScopeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-09-26 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatCompareRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNatCompareRecordService.java new file mode 100644 index 0000000000..be71cf3227 --- /dev/null +++ b/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 { + + /** + * 默认分页 + * + * @param formDTO + * @return PageData + * @author generator + * @date 2022-09-26 + */ + PageData page(IcNatCompareRecordPageFormDTO formDTO); + + void execAsyncExcelImport(Path fileSavePath, String taskId, String customerId, String userId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java index 9c65229972..9be6485b37 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcNoticeService.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.form.IcNoticeFormDTO; import com.epmet.dto.form.SendNoticeFormDTO; +import com.epmet.dto.form.SendNoticeV2FormDTO; import com.epmet.dto.form.SendPointNoticeFormDTO; import com.epmet.entity.IcNoticeEntity; @@ -115,4 +116,10 @@ public interface IcNoticeService extends BaseService { * @return */ Map getUserLatestNoticeTime(String customerId,List idCardSet); + + /** + * 行程上报、重点人群关注名单、疫苗接种关注名单这几个页面的发送通知 + * @param formDTO + */ + void sendNoticeV2(SendNoticeV2FormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index a4b00240f9..2a4585eb8a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -739,7 +739,16 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl implements DataSyncConfigService { + + @Autowired + private DataSyncScopeService dataSyncScopeService; + @Autowired + private IcNatDao icNatDao; + @Autowired + private IcNatService icNatService; + @Autowired + private IcNatRelationService icNatRelationService; + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public DataSyncConfigDTO get(String id) { + DataSyncConfigEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DataSyncConfigDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DataSyncConfigDTO dto) { + DataSyncConfigEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncConfigEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DataSyncConfigDTO dto) { + DataSyncConfigEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncConfigEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * Desc: 【数据配置】配置开关 + * @param formDTO + * @author zxc + * @date 2022/9/26 14:36 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void configSwitch(ConfigSwitchFormDTO formDTO) { + baseDao.configSwitch(formDTO); + } + + /** + * Desc: 【数据配置】列表 + * @param tokenDto + * @author zxc + * @date 2022/9/26 15:04 + */ + @Override + public PageData list(TokenDto tokenDto, PageFormDTO formDTO) { + PageData result = new PageData<>(new ArrayList<>(), NumConstant.ZERO_L); + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.list(tokenDto.getCustomerId())); + if (CollectionUtils.isNotEmpty(pageInfo.getList())){ + result.setList(pageInfo.getList()); + result.setTotal(Integer.valueOf(String.valueOf(pageInfo.getTotal()))); + } + return result; + } + + /** + * Desc: 【数据配置】范围保存 + * @param formDTO + * @author zxc + * @date 2022/9/26 15:41 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void scopeSave(ScopeSaveFormDTO formDTO) { + baseDao.delScope(formDTO.getDataSyncConfigId()); + if (CollectionUtils.isNotEmpty(formDTO.getScopeList())){ + formDTO.getScopeList().forEach(o -> { + o.setCustomerId(formDTO.getCustomerId()); + o.setDataSyncConfigId(formDTO.getDataSyncConfigId()); + if (o.getOrgType().equals("grid")){ + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(o.getOrgId()); + if (null == gridInfo){ + throw new EpmetException("查询网格信息失败"+o.getOrgId()); + } + o.setPid(gridInfo.getPid()); + o.setOrgIdPath(gridInfo.getPids() + ":" + gridInfo.getId()); + }else { + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(o.getOrgId()); + if (null == agencyInfo){ + throw new EpmetException("查询组织信息失败"+o.getOrgId()); + } + o.setPid(agencyInfo.getPid()); + o.setOrgIdPath(agencyInfo.getPids().equals(NumConstant.EMPTY_STR) || agencyInfo.getPids().equals(NumConstant.ZERO_STR) ? agencyInfo.getId() : agencyInfo.getPids() + ":" + agencyInfo.getId()); + } + }); + dataSyncScopeService.insertBatch(ConvertUtils.sourceToTarget(formDTO.getScopeList(), DataSyncScopeEntity.class)); + } + } + + /** + * Desc: + * 大数据局部门配置on + * 根据范围搜索居民,调接口查询最近一次核酸检测记录 + * 检测时间 + 身份证 不存在就插入 + * @param formDTO + * @author zxc + * @date 2022/9/26 17:16 + */ + @Override + public void natInfoScanTask(NatInfoScanTaskFormDTO formDTO) { + if (CollectionUtils.isNotEmpty(formDTO.getIdCards())){ + List userIdByIdCard = baseDao.getUserIdByIdCard(formDTO.getIdCards()); + List collect = formDTO.getIdCards().stream().map(id -> { + NatUserInfoResultDTO e = new NatUserInfoResultDTO(); + e.setIdCard(id); + e.setUserId(""); + return e; + }).collect(Collectors.toList()); + collect.forEach(c -> userIdByIdCard.stream().filter(u -> u.getIdCard().equals(c.getIdCard())).forEach(u -> c.setUserId(u.getUserId()))); + hsjc(collect,formDTO.getCustomerId()); + return; + } + List allConfigList = baseDao.list(StringUtils.isNotBlank(formDTO.getCustomerId()) ? formDTO.getCustomerId() : null); + if (CollectionUtils.isEmpty(allConfigList)){ + return; + } + List configList = allConfigList.stream().filter(l -> l.getDeptCode().equals("dsjj") && l.getSwitchStatus().equals("open")).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(configList)){ + configList.forEach(c -> { + if (CollectionUtils.isNotEmpty(c.getScopeList())){ + Integer no = NumConstant.ONE; + Integer size; + do { + PageInfo pageInfo = PageHelper.startPage(no, NumConstant.ONE_THOUSAND).doSelectPageInfo(() -> baseDao.getIdCardsByScope(c.getScopeList())); + size = pageInfo.getList().size(); + hsjc(pageInfo.getList(),c.getCustomerId()); + no++; + }while (size.compareTo(NumConstant.ONE_THOUSAND) == NumConstant.ZERO); + } + }); + } + } + + /** + * Desc: 根据证件号 查询nat 存在 ? 不处理 : 新增 + * @param idCards + * @param customerId + * @author zxc + * @date 2022/9/27 11:08 + */ + private void hsjc(List idCards,String customerId){ + if (CollectionUtils.isNotEmpty(idCards)){ + List entities = new ArrayList<>(); + idCards.forEach(idCard -> { + YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); + if (CollectionUtils.isNotEmpty(natInfoResult.getData())){ + natInfoResult.getData().forEach(natInfo -> { + IcNatEntity e = new IcNatEntity(); + e.setCustomerId(customerId); + e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); + e.setUserId(idCard.getUserId()); + e.setUserType("sync"); + e.setName(natInfo.getName()); + e.setMobile(natInfo.getTelephone()); + e.setIdCard(natInfo.getCard_no()); + e.setNatTime(DateUtils.parseDate(natInfo.getTest_time(),DateUtils.DATE_TIME_PATTERN)); + e.setNatResult(natInfo.getSample_result_pcr()); + e.setNatAddress(natInfo.getSampling_org_pcr()); + e.setAgencyId(idCard.getAgencyId()); + e.setPids(idCard.getPids()); + entities.add(e); + }); + } + }); + if (CollectionUtils.isNotEmpty(entities)){ + List existNatInfos = icNatDao.getExistNatInfo(entities); + entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true))); + Map> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); + if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){ + icNatService.insertBatch(groupByStatus.get(false)); + } + //组织关系表 + List relationEntities = new ArrayList<>(); + entities.forEach(ne -> { + // 不是居民的先不加关系表吧 + if (ne.getIsResiUser().equals(NumConstant.ONE_STR)){ + IcNatRelationEntity e = new IcNatRelationEntity(); + e.setCustomerId(customerId); + e.setAgencyId(ne.getAgencyId()); + e.setPids(ne.getPids()); + e.setIcNatId(ne.getId()); + e.setUserType("sync"); + relationEntities.add(e); + } + }); + if (CollectionUtils.isNotEmpty(relationEntities)){ + icNatRelationService.insertBatch(relationEntities); + } + } + } + } +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncScopeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncScopeServiceImpl.java new file mode 100644 index 0000000000..4e6e0843d2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncScopeServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.DataSyncScopeDao; +import com.epmet.dto.DataSyncScopeDTO; +import com.epmet.entity.DataSyncScopeEntity; +import com.epmet.service.DataSyncScopeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 数据更新范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-09-26 + */ +@Service +public class DataSyncScopeServiceImpl extends BaseServiceImpl implements DataSyncScopeService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, DataSyncScopeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, DataSyncScopeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public DataSyncScopeDTO get(String id) { + DataSyncScopeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, DataSyncScopeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(DataSyncScopeDTO dto) { + DataSyncScopeEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncScopeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(DataSyncScopeDTO dto) { + DataSyncScopeEntity entity = ConvertUtils.sourceToTarget(dto, DataSyncScopeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java index 25a3a82403..65070ee096 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java @@ -309,6 +309,10 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl implements IcNatCompareRecordService { + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @Autowired + private OssFeignClient ossFeignClient; + @Autowired + private IcNatCompareRecRelationDao icNatCompareRecRelationDao; + + private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (null == staffInfo) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); + } + return staffInfo; + } + + + /** + * 列表分页查询 + * @param formDTO + * @return + */ + @Override + public PageData page(IcNatCompareRecordPageFormDTO formDTO) { + //1.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(formDTO.getCustomerId(),formDTO.getUserId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + //2.按条件查询业务数据 + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) + .doSelectPageInfo(() -> baseDao.pageList(formDTO)); + List list = data.getList(); + return new PageData(list, data.getTotal()); + } + + /** + * 未做核酸比对导入文件 + * @param filePath + * @param importTaskId + * @param customerId + * @param userId + */ + @Override + public void execAsyncExcelImport(Path filePath, String importTaskId, String customerId, String userId) { + try { + //获取当前登录用户所属组织id + CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId); + Date importTime=new Date(); + String importDate= DateUtils.format(importTime,DateUtils.DATE_PATTERN_YYYYMMDD); + IcNatCompareRecordExcelImportListener listener = new IcNatCompareRecordExcelImportListener(customerId, staffInfo, importDate, importTime, this); + + EasyExcel.read(filePath.toFile(), IcNatCompareRecordExcelData.class, listener).headRowNumber(1).sheet(0).doRead(); + + Path errorDescFile = null; + String errorDesFileUrl = null; + List errorRows = listener.getErrorRows(); + + boolean failed = errorRows.size() > 0; + if (failed) { + // 生成并上传错误文件 + try { + // 文件生成 + Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_nat_compare_record", "import", "error_des"); + String fileName = UUID.randomUUID().toString().concat(".xlsx"); + errorDescFile = errorDescDir.resolve(fileName); + + FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); + FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); + OutputStream os = fileItem.getOutputStream(); + + EasyExcel.write(os, IcNatCompareRecordExcelData.ErrorRow.class).sheet("导入失败列表").doWrite(errorRows); + + // 文件上传oss + Result errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); + if (errorDesFileUploadResult.success()) { + errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); + } + } finally { + if (Files.exists(errorDescFile)) { + Files.delete(errorDescFile); + } + } + } + + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); + importFinishTaskForm.setOperatorId(userId); + importFinishTaskForm.setResultDesc(""); + importFinishTaskForm.setResultDescFilePath(errorDesFileUrl); + + Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); + if (!result.success()) { + log.error("【未做核酸比对】finishImportTask失败"); + } + } catch (Exception e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【未做核酸比对】出错:{}", errorMsg); + + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + importFinishTaskForm.setOperatorId(userId); + importFinishTaskForm.setResultDesc("导入失败"); + + Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); + if (!result.success()) { + log.error("【未做核酸比对】导入记录状态修改为'完成'失败"); + } + } finally { + // 删除临时文件 + if (Files.exists(filePath)) { + try { + Files.delete(filePath); + } catch (IOException e) { + log.error("method exception", e); + } + } + } + + } + + + /** + * + * @param datas + * @param staffInfo 当前操作人 + * @param importDate yyyyMMdd + * @param importTime 导入时间yyyy-MM-dd HH:mm:ss + * @param listener + */ + public void batchPersist(List datas,CustomerStaffInfoCacheResult staffInfo,String importDate,Date importTime, IcNatCompareRecordExcelImportListener listener) { + datas.forEach(entity -> { + try { + persisNat(entity, staffInfo,importDate,importTime); + } catch (Exception exception) { + String errorMsg = ExceptionUtils.getErrorStackTrace(exception); + log.error(errorMsg); + + IcNatCompareRecordExcelData.ErrorRow errorRow = new IcNatCompareRecordExcelData.ErrorRow(); + errorRow.setName(entity.getName()); + errorRow.setMobile(entity.getMobile()); + errorRow.setIdCard(entity.getIdCard()); + errorRow.setErrorInfo("batchPersist未知系统错误"); + listener.getErrorRows().add(errorRow); + } + }); + } + + + /** + * + * @param data + * @param staffInfo 当前操作人 + * @param importDate yyyyMMdd + * @param importTime 导入时间yyyy-MM-dd HH:mm:ss + */ + @Transactional(rollbackFor = Exception.class) + public void persisNat(IcNatCompareRecordEntity data, CustomerStaffInfoCacheResult staffInfo, String importDate, Date importTime) { + // 查询是否本辖区居民 + IcResiUserDTO icResiUserDTO = SpringContextUtils.getBean(IcResiUserService.class).getByIdCard(data.getCustomerId(), data.getIdCard(), null); + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + //根据身份证号判断是否存在基础信息 + IcNatCompareRecordEntity existEntity=baseDao.selectByIdCard(data.getCustomerId(),data.getIdCard()); + if (null == existEntity) { + // 1、不存在该身份证的基础记录,直接插入ic_nat_compare_record 、ic_nat_compare_rec_relation 插入记录 + IcNatCompareRecordEntity compareRecordEntity = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); + compareRecordEntity.setIcResiUserId(null == icResiUserDTO ? StrConstant.EPMETY_STR : icResiUserDTO.getId()); + // 是否客户下居民(0:否 1:是) + compareRecordEntity.setIsResiUser(StringUtils.isNotBlank(compareRecordEntity.getIcResiUserId()) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); + compareRecordEntity.setLatestImportTime(importTime); + //插入基础信息 + insert(compareRecordEntity); + + IcNatCompareRecRelationEntity relationEntity = new IcNatCompareRecRelationEntity(); + relationEntity.setCustomerId(data.getCustomerId()); + relationEntity.setCompareRecId(compareRecordEntity.getId()); + relationEntity.setImportDate(importDate); + relationEntity.setImportTime(importTime); + relationEntity.setAgencyId(staffInfo.getAgencyId()); + relationEntity.setAgencyName(staffInfo.getAgencyName()); + relationEntity.setStaffId(staffInfo.getStaffId()); + relationEntity.setStaffName(staffInfo.getRealName()); + if (null != agencyInfoCache) { + relationEntity.setPid(agencyInfoCache.getPid()); + relationEntity.setPids(agencyInfoCache.getPids()); + } + // 是否本社区(agency_id)下居民(0:否 1:是) + if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { + relationEntity.setIsAgencyUser(NumConstant.ONE_STR); + } else { + relationEntity.setIsAgencyUser(NumConstant.ZERO_STR); + } + //插入关系表 + icNatCompareRecRelationDao.insert(relationEntity); + } else { + IcNatCompareRecordEntity origin = ConvertUtils.sourceToTarget(data, IcNatCompareRecordEntity.class); + origin.setId(existEntity.getId()); + origin.setIcResiUserId(null == icResiUserDTO ? StrConstant.EPMETY_STR : icResiUserDTO.getId()); + // 是否客户下居民(0:否 1:是) + origin.setIsResiUser(StringUtils.isNotBlank(origin.getIcResiUserId()) ? NumConstant.ONE_STR : NumConstant.ZERO_STR); + origin.setLatestImportTime(importTime); + baseDao.updateById(origin); + IcNatCompareRecRelationEntity existRelationEntity=icNatCompareRecRelationDao.selectExist(data.getCustomerId(),origin.getId(),staffInfo.getAgencyId(),importDate); + if(null!=existRelationEntity){ + // 是否本社区(agency_id)下居民(0:否 1:是) + if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { + existRelationEntity.setIsAgencyUser(NumConstant.ONE_STR); + } else { + existRelationEntity.setIsAgencyUser(NumConstant.ZERO_STR); + } + //记录最后一次导入时间、最近一次操作人id,最近一次操作人姓名 + existRelationEntity.setImportTime(importTime); + existRelationEntity.setStaffId(staffInfo.getStaffId()); + existRelationEntity.setStaffName(staffInfo.getRealName()); + existRelationEntity.setAgencyName(staffInfo.getAgencyName()); + icNatCompareRecRelationDao.updateById(existRelationEntity); + }else{ + IcNatCompareRecRelationEntity relationEntity = new IcNatCompareRecRelationEntity(); + relationEntity.setCustomerId(data.getCustomerId()); + relationEntity.setCompareRecId(origin.getId()); + relationEntity.setImportDate(importDate); + relationEntity.setImportTime(importTime); + relationEntity.setAgencyId(staffInfo.getAgencyId()); + relationEntity.setAgencyName(staffInfo.getAgencyName()); + relationEntity.setStaffId(staffInfo.getStaffId()); + relationEntity.setStaffName(staffInfo.getRealName()); + if (null != agencyInfoCache) { + relationEntity.setPid(agencyInfoCache.getPid()); + relationEntity.setPids(agencyInfoCache.getPids()); + } + // 是否本社区(agency_id)下居民(0:否 1:是) + if (null != icResiUserDTO && icResiUserDTO.getAgencyId().equals(staffInfo.getAgencyId())) { + relationEntity.setIsAgencyUser(NumConstant.ONE_STR); + } else { + relationEntity.setIsAgencyUser(NumConstant.ZERO_STR); + } + //插入关系表 + icNatCompareRecRelationDao.insert(relationEntity); + } + } + + } + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java index 1abb00b5f3..1d2af49a28 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNoticeServiceImpl.java @@ -7,17 +7,23 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.*; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.ChannelEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserMessageTypeConstant; +import com.epmet.dao.IcEpidemicSpecialAttentionDao; import com.epmet.dao.IcNoticeDao; +import com.epmet.dao.IcTripReportRecordDao; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.UserBaseInfoDTO; import com.epmet.dto.form.*; +import com.epmet.entity.IcEpidemicSpecialAttentionEntity; import com.epmet.entity.IcNoticeEntity; +import com.epmet.entity.IcTripReportRecordEntity; import com.epmet.feign.MessageFeignClient; import com.epmet.service.IcNoticeService; import com.epmet.service.UserBaseInfoService; @@ -26,6 +32,7 @@ import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -47,6 +54,10 @@ public class IcNoticeServiceImpl extends BaseServiceImpl page(IcNoticeFormDTO formDTO) { @@ -144,9 +155,11 @@ public class IcNoticeServiceImpl extends BaseServiceImpl { if (StringUtils.isNotBlank(item.getIdCard())) { - //根据身份证获取居民ID + //根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个 List userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard()); if (CollectionUtils.isNotEmpty(userList)) { - userList.forEach(user -> { + // userList.forEach(user -> { + UserBaseInfoDTO userBaseInfoDTO=userList.get(NumConstant.ZERO); UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); messageFormDTO.setCustomerId(item.getCustomerId()); messageFormDTO.setApp(AppClientConstant.APP_GOV); messageFormDTO.setGridId(StrConstant.STAR); - messageFormDTO.setUserId(user.getUserId()); + messageFormDTO.setUserId(userBaseInfoDTO.getUserId()); messageFormDTO.setTitle("您有一条通知消息!"); messageFormDTO.setMessageContent(item.getContent()); messageFormDTO.setReadFlag(Constant.UNREAD); messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); messageFormDTO.setTargetId(item.getId()); msgList.add(messageFormDTO); - }); + item.setUserId(userBaseInfoDTO.getUserId()); + // }); + }else{ + // 没有找到居民端的用户id,发送失败 + item.setSendRes(NumConstant.ZERO_STR); } + baseDao.updateById(item); } //TODO 短信消息 - if (StringUtils.isNotBlank(item.getMobile())) { + /*if (StringUtils.isNotBlank(item.getMobile())) { ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); sms.setCustomerId(item.getCustomerId()); sms.setMobile(item.getMobile()); sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_OVERDUE); sms.setParameterKey("send_msg"); smsList.add(sms); - } + }*/ }); //发送小程序消息 Result result = messageFeignClient.saveUserMessageList(msgList); if (!result.success()) { log.error("发送小程序消息失败" + JSON.toJSONString(result)); } - //TODO 发送短信 } /** @@ -326,4 +344,102 @@ public class IcNoticeServiceImpl extends BaseServiceImpl userBeanList = null; + List entityList = new ArrayList<>(); + for (String bdId : formDTO.getBdIds()) { + IcNoticeEntity entity = new IcNoticeEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setChannel(channel); + entity.setContent(formDTO.getContent()); + entity.setOrigin(formDTO.getOrigin()); + // 这时候还不知道居民端的用户id + entity.setUserId(StrConstant.EPMETY_STR); + entity.setOrgName(finalOrgName); + // 发送结果:1成功,0失败 默认插入发送成功。下面没有找到居民端的用户id,会更新 + entity.setSendRes(NumConstant.ONE_STR); + // v2:0行程上报,1疫苗接种关注名单,2隔离防疫原核酸检测 + // 身份证号手机号 + if (NumConstant.ZERO_STR.equals(formDTO.getOrigin())) { + IcTripReportRecordEntity icTripReportRecordEntity = icTripReportRecordDao.selectById(bdId); + if(null==icTripReportRecordEntity){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "ic_trip_report_record不存在id=" + bdId + "的记录", "获取身份证手机号为空"); + } + entity.setMobile(icTripReportRecordEntity.getMobile()); + entity.setIdCard(icTripReportRecordEntity.getIdCard()); + } else if (NumConstant.ONE_STR.equals(formDTO.getOrigin()) || NumConstant.TWO_STR.equals(formDTO.getOrigin())) { + IcEpidemicSpecialAttentionEntity icEpidemicSpecialAttentionEntity = icEpidemicSpecialAttentionDao.selectById(bdId); + if (null == icEpidemicSpecialAttentionEntity) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "ic_epidemic_special_attention不存在id=" + bdId + "的记录", "获取身份证手机号为空"); + } + entity.setMobile(icEpidemicSpecialAttentionEntity.getMobile()); + entity.setIdCard(icEpidemicSpecialAttentionEntity.getIdCard()); + } + entityList.add(entity); + } + if (CollectionUtils.isEmpty(entityList)) { + return; + } + insertBatch(entityList); + + // 通知渠道通知渠道 0小程序通知,1短信通知 + for (String channelValue : formDTO.getChannel()) { + if ("0".equals(channelValue)) { + // 小程序通知 + List msgList = new ArrayList<>(); + entityList.forEach(item -> { + // 根据身份证获取居民ID 如果一个客户下,存在多个身份证号相同的而用户,该接口只返回一个 + List userList = userBaseInfoService.getCommonIdNumUser(item.getCustomerId(), item.getIdCard()); + if (CollectionUtils.isNotEmpty(userList)) { + UserBaseInfoDTO userBaseInfoDTO = userList.get(NumConstant.ZERO); + UserMessageFormDTO messageFormDTO = new UserMessageFormDTO(); + messageFormDTO.setCustomerId(item.getCustomerId()); + messageFormDTO.setApp(AppClientConstant.APP_GOV); + messageFormDTO.setGridId(StrConstant.STAR); + messageFormDTO.setUserId(userBaseInfoDTO.getUserId()); + messageFormDTO.setTitle("您有一条通知消息!"); + messageFormDTO.setMessageContent(item.getContent()); + messageFormDTO.setReadFlag(Constant.UNREAD); + messageFormDTO.setMessageType(UserMessageTypeConstant.ANTIEPIDEMIC); + messageFormDTO.setTargetId(item.getId()); + msgList.add(messageFormDTO); + item.setUserId(userBaseInfoDTO.getUserId()); + } else { + // 没有找到居民端的用户id,发送失败 + item.setSendRes(NumConstant.ZERO_STR); + } + baseDao.updateById(item); + }); + // 发送小程序消息-站内信 + Result result = messageFeignClient.saveUserMessageList(msgList); + if (!result.success()) { + log.warn("发送小程序消息失败" + JSON.toJSONString(result)); + } + } else { + // 短信通知再说 todo + } + + + } + + + } + + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index 8157ac1ccf..b0b9a12f77 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -276,7 +276,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { param.setExportConfig(exportConfig); Result exportConfigResult = operCustomizeOpenFeignClient.getExcelHeaderAndSqlColumnForExport(param); if (!exportConfigResult.success()) { - log.error("获取模板失败,internalMsg:{},msg:{}", exportConfigResult.getInternalMsg(), exportConfigResult.getMsg()); + log.error("/oper/customize/icExportTemplate/getExcelHeaderAndSqlColumnForExport获取模板失败,入参{},internalMsg:{},msg:{}", JSON.toJSONString(param), exportConfigResult.getInternalMsg(), exportConfigResult.getMsg()); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), exportConfigResult.getInternalMsg(), exportConfigResult.getInternalMsg()); } IcCustomExportResultDTO data = exportConfigResult.getData(); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index 97f5ed43e0..93c30d9d3f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java @@ -221,6 +221,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl implements OperUserService { @Autowired @@ -61,6 +69,8 @@ public class OperUserServiceImpl extends BaseServiceImpl page(Map params) { @@ -129,6 +139,13 @@ public class OperUserServiceImpl extends BaseServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(OperUserEntity::getUserId,userId); - baseDao.update(param, lambdaQueryWrapper); + + + baseDao.update(param, lambdaQueryWrapper); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index a814563558..a328399810 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -224,7 +224,7 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl + + + + + + + UPDATE data_sync_config + SET UPDATED_TIME = NOW(), + UPDATED_BY = #{updatedBy}, + SWITCH_STATUS = CASE WHEN SWITCH_STATUS = 'open' THEN 'closed' ELSE 'open' END + WHERE id = #{dataSyncConfigId} + AND DEPT_CODE = #{deptCode} + + + + + DELETE FROM data_sync_scope WHERE DATA_SYNC_CONFIG_ID = #{dataSyncConfigId} + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncScopeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncScopeDao.xml new file mode 100644 index 0000000000..0fd7649a79 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/DataSyncScopeDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml index 951a4adee8..5db13945cb 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml @@ -71,7 +71,9 @@ SELECT a.id, a.`NAME`, a.MOBILE, + a.MOBILE as realMobile, a.ID_CARD, + a.ID_CARD as realIdCard, IFNULL(a.reason,'') AS reason, a.REMARK, b.VILLAGE_ID, @@ -86,13 +88,14 @@ WHERE a.DEL_FLAG = 0 AND concat(a.pids,':',ORG_ID) like concat('%',#{orgId},'%') AND a.ATTENTION_TYPE = #{attentionType} + AND a.IS_ATTENTION = 1 AND a.`NAME` LIKE CONCAT('%',#{name},'%') AND a.MOBILE LIKE CONCAT('%',#{mobile},'%') - + AND a.ID_CARD LIKE CONCAT('%',#{idCard},'%') @@ -125,7 +128,9 @@ a.`NAME`, a.customer_id as customerId, a.MOBILE, + a.MOBILE as realMobile, a.ID_CARD, + a.ID_CARD as realIdCard, a.REMARK, a.REASON, b.VILLAGE_ID, diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecRelationDao.xml new file mode 100644 index 0000000000..e3f58f05b1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecRelationDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml new file mode 100644 index 0000000000..2a33a5680b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatCompareRecordDao.xml @@ -0,0 +1,71 @@ + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml index 4459802f6d..e6dd5b0417 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml @@ -135,6 +135,19 @@ LIMIT 1 + + DELETE FROM ic_nat WHERE id = #{icNatId} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index caba921430..e8b69faefa 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -945,6 +945,33 @@ AND GRID_ID = #{gridId} + + AND a.VILLAGE_ID = #{neighborId} + + + AND a.BUILD_ID = #{buildingId} + + + AND a.UNIT_ID = #{unitId} + + + AND a.HOME_ID = #{houseId} + + + AND a.`NAME` LIKE concat( '%', #{name}, '%' ) + + + AND a.MOBILE LIKE concat( '%', #{mobile}, '%' ) + + + AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' ) + + + AND a.BIRTHDAY = ]]> #{startBirthDay} + + + AND a.BIRTHDAY #{endBirthDay} + ) t WHERE 1=1 diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml index 15a413748b..48805be438 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml @@ -26,35 +26,38 @@