diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.15__add_item_typequery.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.15__add_item_typequery.sql
new file mode 100644
index 0000000000..bfd6d0dc3a
--- /dev/null
+++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.15__add_item_typequery.sql
@@ -0,0 +1,9 @@
+INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518396655261097986', 'item_type_query', '居民信息组件查询方式', '', 18, 0, 0, '1', '2022-04-25 09:09:08', '1', '2022-04-25 09:09:45');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518420223504064513', 1518396655261097986, 'equal', 'cascader', '0', '级联组件', 8, 0, 0, '1', '2022-04-25 10:42:47', '1', '2022-04-25 10:42:47');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518398370672713730', 1518396655261097986, 'list_equal', 'checkbox', '0', '多选框', 6, 0, 0, '1', '2022-04-25 09:15:57', '1', '2022-04-25 09:15:57');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397686728531969', 1518396655261097986, 'daterange', 'datepicker', '0', '日期', 3, 0, 0, '1', '2022-04-25 09:13:14', '1', '2022-04-25 09:13:14');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518398756393492482', 1518396655261097986, 'daterange', 'daterange', '0', '时间范围组件eg:参战时间', 7, 0, 0, '1', '2022-04-25 09:17:29', '1', '2022-04-25 09:17:29');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397589986910209', 1518396655261097986, 'like', 'input', '0', '文本输入框', 2, 0, 0, '1', '2022-04-25 09:12:51', '1', '2022-04-25 09:12:51');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518398274627346434', 1518396655261097986, 'equal', 'radio', '0', '单选框', 5, 0, 0, '1', '2022-04-25 09:15:34', '1', '2022-04-25 09:15:34');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397514623655938', 1518396655261097986, 'equal', 'select', '0', '下拉框', 1, 0, 0, '1', '2022-04-25 09:12:33', '1', '2022-04-25 09:12:33');
+INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397787941281794', 1518396655261097986, 'like', 'textarea', '0', '文本域', 4, 0, 0, '1', '2022-04-25 09:13:38', '1', '2022-04-25 09:13:38');
\ No newline at end of file
diff --git a/epmet-auth-client/pom.xml b/epmet-auth-client/pom.xml
index cdb0519c0d..d84ead3ff5 100644
--- a/epmet-auth-client/pom.xml
+++ b/epmet-auth-client/pom.xml
@@ -10,13 +10,12 @@
4.0.0
epmet-auth-client
+
com.epmet
epmet-commons-tools
2.0.0
- compile
-
-
+
\ No newline at end of file
diff --git a/epmet-auth-client/src/main/java/com/epmet/auth/dto/result/BlockChainStaffAuthResultDTO.java b/epmet-auth-client/src/main/java/com/epmet/auth/dto/result/BlockChainStaffAuthResultDTO.java
new file mode 100644
index 0000000000..2a1ca0dfcc
--- /dev/null
+++ b/epmet-auth-client/src/main/java/com/epmet/auth/dto/result/BlockChainStaffAuthResultDTO.java
@@ -0,0 +1,25 @@
+package com.epmet.auth.dto.result;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @ClassName BlockChainStaffAuthResultDTO
+ * @Description 区块链用户认证结果
+ * @Author wangxianzhang
+ * @Date 2022/1/20 10:41 上午
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class BlockChainStaffAuthResultDTO {
+
+ private String userId;
+ private String realName;
+ private String phone;
+ private String headUrl;
+ private String agencyId;
+ private String agencyName;
+
+}
diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
index 386e162c02..8745418f90 100644
--- a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
+++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.util.HashMap;
import java.util.List;
/**
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 2aefe95b79..89fb9b183c 100644
--- a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java
+++ b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java
@@ -1,15 +1,22 @@
package com.epmet.controller;
+import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO;
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.BcStaffAuthenticationFormDTO;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.GovWebService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
/**
@@ -28,8 +35,6 @@ public class GovWebController {
@Value("${epmet.login.privateKey}")
private String privateKey;
-
-
/**
* @param formDTO
* @return
@@ -65,24 +70,20 @@ public class GovWebController {
}
/**
- * desc: 根据用户id
- *
- * @return com.epmet.commons.tools.utils.Result
- * @author LiuJanJun
- * @date 2021/3/8 5:07 下午
+ * 区块链web 系统身份认证
+ * @param input
+ * @return
*/
- @PostMapping("generateTokenBySSOKey/{uuid}/{userId}/{app}/{client}")
- public Result generateTokenBySSOKey(@PathVariable(value = "uuid")String uuid,@PathVariable String userId,
- @RequestParam String customerId,
- @RequestParam String client,
- @RequestParam String app) {
- //判断是否非法登陆
- /*if (!redisUtils.hasKey(RedisKeys.getIcLoginAuthKey(customerId,uuid))){
- log.error("有人使用userid:{} 非法登陆",userId);
- throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode());
- }*/
- return new Result().ok(govWebService.generateTokenBySSOKey(customerId,userId,app,client));
- }
+ @PostMapping("/blockchain/authentication")
+ public Result blockChainGetStaffInfoByPwd(@RequestBody BcStaffAuthenticationFormDTO input) {
+ ValidatorUtils.validateEntity(input);
+ String customerId = input.getCustomerId();
+ String mobile = input.getMobile();
+ String password = input.getPassword();
+ BlockChainStaffAuthResultDTO r = govWebService.blockChainStaffAuthenticationByPwd(customerId, mobile, password);
+
+ return new Result().ok(r);
+ }
}
diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/BcStaffAuthenticationFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/BcStaffAuthenticationFormDTO.java
new file mode 100644
index 0000000000..202f8073c9
--- /dev/null
+++ b/epmet-auth/src/main/java/com/epmet/dto/form/BcStaffAuthenticationFormDTO.java
@@ -0,0 +1,24 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @ClassName BcAdminLoginFormDTO
+ * @Description 区块链管理系统staff身份认证
+ * @Author wangxianzhang
+ * @Date 2022/1/17 10:11 下午
+ */
+@Data
+public class BcStaffAuthenticationFormDTO {
+
+ @NotBlank(message = "客户ID必填")
+ private String customerId;
+
+ @NotBlank(message = "手机号必填")
+ private String mobile;
+
+ @NotBlank(message = "密码必填")
+ private String password;
+}
diff --git a/epmet-auth/src/main/java/com/epmet/service/GovWebService.java b/epmet-auth/src/main/java/com/epmet/service/GovWebService.java
index 6075ca79bb..10d86c20b4 100644
--- a/epmet-auth/src/main/java/com/epmet/service/GovWebService.java
+++ b/epmet-auth/src/main/java/com/epmet/service/GovWebService.java
@@ -1,5 +1,6 @@
package com.epmet.service;
+import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
@@ -18,12 +19,10 @@ public interface GovWebService {
UserTokenResultDTO login(GovWebLoginFormDTO formDTO);
/**
- * desc:根据用户Id 生成token
+ * 区块链系统通过用户密码认证身份
+ * @param mobile
+ * @param password
* @return
- * @param customerId
- * @param userId
- * @param app
- * @param client
*/
- String generateTokenBySSOKey(String customerId, String userId, String app, String client);
+ BlockChainStaffAuthResultDTO blockChainStaffAuthenticationByPwd(String customerId, String mobile, String password);
}
diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
index 86569434c2..8d78665550 100644
--- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
@@ -5,8 +5,10 @@ import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.AppClientConstant;
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.exception.RenException;
+import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
@@ -46,7 +48,7 @@ import java.util.stream.Collectors;
* @Date 2020/4/20 10:56
*/
@Service
-public class GovLoginServiceImpl implements GovLoginService {
+public class GovLoginServiceImpl implements GovLoginService, ResultDataResolver {
private static final Logger logger = LoggerFactory.getLogger(GovLoginServiceImpl.class);
private static final String SEND_SMS_CODE_ERROR = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]";
@Autowired
diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
index 2cfe6e3a14..d6edfb8657 100644
--- a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
@@ -1,26 +1,26 @@
package com.epmet.service.impl;
+import com.epmet.auth.dto.result.BlockChainStaffAuthResultDTO;
import com.epmet.common.token.constant.LoginConstant;
+import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.GovTokenDto;
-import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
-import com.epmet.dto.UserDTO;
-import com.epmet.dto.UserWechatDTO;
+import com.epmet.dto.CustomerStaffDTO;
+import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.form.GovWebOperLoginFormDTO;
-import com.epmet.dto.form.LoginCommonFormDTO;
import com.epmet.dto.result.GovWebOperLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
-import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.service.CaptchaService;
@@ -40,7 +40,7 @@ import java.util.Map;
*/
@Slf4j
@Service
-public class GovWebServiceImpl implements GovWebService {
+public class GovWebServiceImpl implements GovWebService, ResultDataResolver {
private static final Logger logger = LoggerFactory.getLogger(GovWebServiceImpl.class);
@Autowired
@@ -55,8 +55,6 @@ public class GovWebServiceImpl implements GovWebService {
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private ThirdLoginServiceImpl thirdLoginService;
- @Autowired
- private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
/**
* @param formDTO
@@ -104,74 +102,6 @@ public class GovWebServiceImpl implements GovWebService {
}
- @Override
- public String generateTokenBySSOKey(String customerId, String userId, String app, String client) {
- // 生成token
- Map map = new HashMap<>();
- map.put(LoginConstant.CLIENT_APP, app);
- map.put("client", client);
- map.put("userId", userId);
- String token = jwtTokenUtils.createToken(map);
-
- if (LoginConstant.APP_RESI.equals(app)){
- Result userDTOResult = epmetUserOpenFeignClient.queryUserClient(userId);
- if (!userDTOResult.success()&&userDTOResult.getData() != null){
- log.error("居民信息不存在,customerId:{},userId:{}", customerId, userId);
- throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode());
- }
- LoginCommonFormDTO formDTO = new LoginCommonFormDTO();
- formDTO.setApp(app);
- formDTO.setClient(client);
- this.saveResiTokenDto(formDTO,userId, new UserWechatDTO(),token,customerId);
- }else if (LoginConstant.APP_GOV.equals(app)){
- CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
- if (staffInfo == null){
- log.error("工作人员信息不存在,customerId:{},userId:{}", customerId, userId);
- throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode());
- }
- int expire = jwtTokenProperties.getExpire();
- GovTokenDto tokenDto = new GovTokenDto();
- tokenDto.setCustomerId(customerId);
- tokenDto.setApp("gov");
- tokenDto.setClient("web");
- tokenDto.setUserId(userId);
- tokenDto.setToken(token);
- tokenDto.setUpdateTime(System.currentTimeMillis());
- tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
- tokenDto.setAgencyId(staffInfo.getAgencyId());
- tokenDto.setRootAgencyId(staffInfo.getAgencyId());
- //tokenDto.setDeptIdList(thirdLoginService.getDeptartmentIdList(userId));
- //tokenDto.setGridIdList(thirdLoginService.getGridIdList(userId));
- //tokenDto.setRoleList(thirdLoginService.queryGovStaffRoles(userId, orgIdPathParts[orgIdPathParts.length - 1]));
- //tokenDto.setOrgIdPath(orgIdPath);
- cpUserDetailRedis.set(tokenDto, expire);
- }
-
- logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
- return token;
- }
-
- /**
- * @Description 将token存入redis
- **/
- private String saveResiTokenDto(LoginCommonFormDTO formDTO, String userId, UserWechatDTO userWechatDTO, String token, String customerId) {
- int expire = jwtTokenProperties.getExpire();
- TokenDto tokenDto = new TokenDto();
- tokenDto.setCustomerId(customerId);
- tokenDto.setApp(formDTO.getApp());
- tokenDto.setClient(formDTO.getClient());
- tokenDto.setUserId(userId);
- //tokenDto.setOpenId(userWechatDTO.getWxOpenId());
- //tokenDto.setSessionKey(userWechatDTO.getSessionKey());
- //tokenDto.setUnionId(userWechatDTO.getUnionId());
- tokenDto.setToken(token);
- tokenDto.setUpdateTime(System.currentTimeMillis());
- tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
- cpUserDetailRedis.set(tokenDto, expire);
- logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
- return token;
- }
-
/**
* 生成PC工作端token
* @author sun
@@ -209,5 +139,36 @@ public class GovWebServiceImpl implements GovWebService {
return token;
}
+ @Override
+ public BlockChainStaffAuthResultDTO blockChainStaffAuthenticationByPwd(String customerId, String mobile, String password) {
+
+ GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO();
+ form.setCustomerId(customerId);
+ form.setMobile(mobile);
+
+ // 用户认证
+ GovWebOperLoginResultDTO staff = getResultDataOrThrowsException(epmetUserFeignClient.getStaffIdAndPwd(form), ServiceConstant.EPMET_USER_SERVER,
+ EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
+ String.format("【区块链用户认证】根据手机号%s和指定客户ID:%s认证用户失败", mobile, customerId),
+ "认证失败");
+
+ if (staff == null) {
+ throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
+ String.format("【区块链用户认证】根据手机号%s和指定客户ID:%s认证用户失败", mobile, customerId));
+ }
+
+ if (!PasswordUtils.matches(password, staff.getPassWord())) {
+ // 密码不匹配
+ throw new EpmetException(EpmetErrorCode.ERR10004.getCode(), String.format("【区块链用户认证】密码不匹配,手机号:%s", mobile));
+ }
+
+ // 用户基础信息
+ CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staff.getUserId());
+
+ BlockChainStaffAuthResultDTO r = new BlockChainStaffAuthResultDTO(staff.getUserId(), staffInfo.getRealName(),
+ staffInfo.getMobile(), staffInfo.getHeadPhoto(), staffInfo.getAgencyId(), staffInfo.getAgencyName());
+
+ return r;
+ }
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java
new file mode 100644
index 0000000000..1cbbd2a887
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java
@@ -0,0 +1,44 @@
+package com.epmet.commons.tools.annotation;
+
+import com.epmet.commons.tools.enums.RequirePermissionEnum;
+import javassist.runtime.Inner;
+
+import java.lang.annotation.*;
+import java.util.function.Function;
+
+/**
+ * 标记一个接口,它的返回值中的某些字段需要打掩码
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface MaskResponse {
+
+ /**
+ * 掩码类型
+ */
+ String MASK_TYPE_ID_CARD = "ID_CARD";
+ String MASK_TYPE_MOBILE = "MOBILE";
+
+ ///**
+ // * 默认的一些字段,如果没有手动指定,就会使用默认的。如果手动指定了,就不再使用默认的
+ // */
+ //String[] defaultFieldnames = {"idCard","mobile","phone"};
+ //
+ ///**
+ // * 默认字段对应的掩码类型
+ // */
+ //String[] defaultFieldsMaskType = { MASK_TYPE_ID_CARD, MASK_TYPE_MOBILE, MASK_TYPE_MOBILE };
+
+ /**
+ * 要打码的字段列表。会递归的着这些字段
+ * @return
+ */
+ String[] fieldNames() default {"idCard","mobile","phone"};
+
+ /**
+ * 要打码的类型
+ * @return
+ */
+ String[] fieldsMaskType() default { MASK_TYPE_ID_CARD, MASK_TYPE_MOBILE, MASK_TYPE_MOBILE };
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/MaskResponseAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/MaskResponseAspect.java
new file mode 100644
index 0000000000..c3883c45b0
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/MaskResponseAspect.java
@@ -0,0 +1,36 @@
+package com.epmet.commons.tools.aspect;
+
+import com.epmet.commons.tools.annotation.MaskResponse;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
+import com.epmet.commons.tools.exception.EpmetException;
+import com.epmet.commons.tools.processor.MaskProcessor;
+import com.epmet.commons.tools.utils.Result;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+@Aspect
+@Component
+@Order(0)
+public class MaskResponseAspect {
+
+ @AfterReturning(pointcut = "@annotation(com.epmet.commons.tools.annotation.MaskResponse)", returning = "result")
+ public Object proceed(JoinPoint point, Result result) throws Throwable {
+ MethodSignature signature = (MethodSignature) point.getSignature();
+ MaskResponse maskResponseAnno = signature.getMethod().getAnnotation(MaskResponse.class);
+
+ String[] fieldNames = maskResponseAnno.fieldNames();
+ String[] fieldsMaskType = maskResponseAnno.fieldsMaskType();
+
+ if (fieldNames.length != fieldsMaskType.length) {
+ String msg = "掩码配置错误";
+ throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg);
+ }
+
+ new MaskProcessor(fieldNames, fieldsMaskType).mask(result);
+ return null;
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java
new file mode 100644
index 0000000000..47fd7777b4
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java
@@ -0,0 +1,73 @@
+package com.epmet.commons.tools.dto.form;
+
+import com.epmet.commons.tools.validator.group.AddGroup;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * 自定义表单导出模板
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2022-04-21
+ */
+@Data
+public class IcExportItemListFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @NotEmpty(message = "请至少添加一个导出项")
+ private List children;
+
+ /**
+ * 父id
+ */
+ private String pid;
+
+ /**
+ * ic_form_item.id
+ */
+ @NotBlank(message = "itemId不能为空",groups = AddGroup.class)
+ private String itemId;
+
+ /**
+ * 表头宽度
+ */
+ private Integer width;
+
+ /**
+ * 项标签
+ */
+ @NotBlank(message = "名称不能为空",groups = AddGroup.class)
+ private String label;
+
+ /**
+ * 排序
+ */
+ private Integer sort;
+
+ /**
+ * 表名
+ */
+ private String tableName;
+
+ /**
+ * 列名
+ */
+ private String columnName;
+
+ /**
+ * item选项 值
+ */
+ private String optionSourceValue;
+ /**
+ * item选项 值获取方式
+ */
+ private String optionSourceType;
+
+
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportTemplateSaveFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportTemplateSaveFormDTO.java
new file mode 100644
index 0000000000..8c82c71473
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportTemplateSaveFormDTO.java
@@ -0,0 +1,58 @@
+package com.epmet.commons.tools.dto.form;
+
+import com.epmet.commons.tools.validator.group.AddGroup;
+import lombok.Data;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * 自定义表单导出模板
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2022-04-21
+ */
+@Data
+public class IcExportTemplateSaveFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 是否保存为模板 是:true 否:false
+ */
+ private Boolean isSaveTemp = false;
+
+ /**
+ * 表单CODE,从字典获取
+ */
+ @NotBlank(message = "表单CODE不能为空",groups = AddGroup.class)
+ private String formCode;
+
+ /**
+ * 模板名称
+ */
+ @Length(max = 20, message = "模板名称最多为20个字", groups = { AddGroup.class })
+ private String name;
+
+ /**
+ * 0:动态;1:文件
+ */
+ private Integer type;
+
+ /**
+ * 排序
+ */
+ private Integer sort;
+
+
+ /**
+ * 父id
+ */
+ @NotEmpty(message = "请至少添加一个导出项")
+ private List itemList;
+
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
index 4226c2acac..739d44fc00 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
@@ -1,9 +1,11 @@
package com.epmet.commons.tools.dto.result;
import lombok.Data;
+import org.apache.commons.collections4.CollectionUtils;
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
/**
* @Description
@@ -21,4 +23,22 @@ public class OptionResultDTO implements Serializable {
private List children;
private Boolean usableFlag;
private String type;
+
+
+ /**
+ * desc:递归获取当前节点的 所有子节点
+ *
+ * @param option
+ * @param resultMap
+ */
+ public void getCurrenNodeAllChild(OptionResultDTO option, Map resultMap) {
+ resultMap.put(option.getValue(), option);
+ if (CollectionUtils.isNotEmpty(option.getChildren())) {
+ return;
+ }
+ option.getChildren().forEach(o -> {
+ resultMap.put(o.getValue(), o);
+ getCurrenNodeAllChild(o, resultMap);
+ });
+ }
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
index 7afc85aab1..6375462f14 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
@@ -22,6 +22,7 @@ public enum DictTypeEnum {
AGE_GROUP("age_group", "年龄范围", 11),
PATROL_WORK_TYPE("patrol_work_type", "例行工作分类", 13),
GRID_TYPE("grid_type", "网格类型", 12),
+ ITEM_TYPE_QUERY("item_type_query","居民信息组件查询方式",14),
;
private final String code;
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
index cb7146138d..abcc6fc90b 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
@@ -5,7 +5,6 @@ import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactor
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
-import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
@@ -39,15 +38,6 @@ public interface CommonAggFeignClient {
@PostMapping("/data/aggregator/org/agency")
Result getAgencyInfo(@RequestParam("agencyId")String agencyId);
- /**
- * @Description 查询网格信息
- * @param gridId
- * @author zxc
- * @date 2021/11/5 2:54 下午
- */
- @PostMapping("/data/aggregator/org/grid")
- Result getGridInfo(@RequestParam("gridId")String gridId);
-
/**
* 查询楼栋信息
* @param buildingId
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
index 8d6f5f1260..4aff62f235 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
@@ -5,7 +5,6 @@ import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
-import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.stereotype.Component;
@@ -29,11 +28,6 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId);
}
- @Override
- public Result getGridInfo(String gridId) {
- return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId);
- }
-
/**
* 查询楼栋信息
*
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java
new file mode 100644
index 0000000000..353fb06a47
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java
@@ -0,0 +1,183 @@
+package com.epmet.commons.tools.processor;
+
+import cn.hutool.core.util.StrUtil;
+import com.epmet.commons.tools.annotation.MaskResponse;
+import com.epmet.commons.tools.exception.ExceptionUtils;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+@Slf4j
+public class MaskProcessor {
+
+
+ public static final String EPMET_PACKAGE_PREFIX = "com.epmet";
+
+ private List fieldNames;
+ private List fieldsMaskType;
+
+ public MaskProcessor(String[] fields, String[] fieldsMaskType) {
+ if (fields != null && fields.length > 0) {
+ this.fieldNames = Arrays.asList(fields);
+ this.fieldsMaskType = Arrays.asList(fieldsMaskType);
+ }
+ }
+
+ /**
+ * 为dto中的属性打掩码
+ * @param object
+ */
+ public void mask(Object object) {
+ if (object == null) {
+ return;
+ }
+
+ if (object instanceof Result) {
+ mask(((Result>) object).getData());
+ return;
+ } else if (object instanceof PageData) {
+ mask(((PageData>) object).getList());
+ return;
+ } else if (object instanceof List) {
+ ((List)object).forEach(e -> mask(e));
+ return;
+ } else if (object instanceof Map) {
+ maskMap((Map) object);
+ return;
+ } else if (object.getClass().getName().startsWith(EPMET_PACKAGE_PREFIX)) {
+ // 自定义bean,走反射
+ maskEpmetBean(object);
+ return;
+ }
+ }
+
+ /**
+ * 为map打码,只打value中的码
+ * - 如果value是epmet的dto,那么去反射它
+ * - 如果value是字符串,那么直接给他打码
+ * - 如果value是其他类型,跳过
+ * @param map
+ */
+ private void maskMap(Map