diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index a13d6cf1db..163dee5e2f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -259,6 +259,7 @@ public enum EpmetErrorCode { NOT_REGEIST_RESI(8927,"未注册居民"), UNIT_EXIST_HOUSES_ERROR(8928,"单元下存在房屋,不可修改单元数"), IC_VACCINE(8929,"已存在相同记录,请去修改原有记录"), + NOT_MATCH_IC_USER_ERROR(8930,"请联系社区工作人员"), MISMATCH(10086,"人员与房屋信息不匹配,请与工作人员联系。"), diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index a1d2a74c11..b0b2492d33 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -502,6 +502,7 @@ epmet: # 内部认证url白名单(在白名单中的,就不会再校验登录了) internalAuthUrlsWhiteList: - /epmetuser/customerstaff/customerlist + - /epmetuser/icresiuser/icUserMatchGrid - /auth/wechat/** - /**/druid/** - /gov/project/project/platformcallback diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PaCustomerDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PaCustomerDTO.java new file mode 100644 index 0000000000..66abf30d75 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/PaCustomerDTO.java @@ -0,0 +1,71 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2022/8/5 15:03 + * @DESC + */ +@Data +public class PaCustomerDTO implements Serializable { + + /** + * 客户id,本主键和oper_crm.customer.id一致 + */ + private String id; + + /** + * 客户名称,默认是根组织名称 + */ + private String customerName; + + /** + * 是否已经完成客户信息初始化 0:未初始化,1:已初始化 + */ + private Integer isInitialize; + + /** + * 客户类型 mini 微信小程序客户 app 第三方app客户 + */ + private String type; + + /** + * 数据来源(dev:开发 test:体验 prod:生产) + */ + private String source; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserMatchGridFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserMatchGridFormDTO.java new file mode 100644 index 0000000000..1aa4d2db1e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserMatchGridFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/8/5 11:11 + * @DESC + */ +@Data +public class IcUserMatchGridFormDTO implements Serializable { + + private static final long serialVersionUID = -5252136149475817567L; + + public interface IcUserMatchGridForm{} + + @NotBlank(message = "idCard不能为空",groups = IcUserMatchGridForm.class) + private String idCard; + + @NotBlank(message = "appId不能为空",groups = IcUserMatchGridForm.class) + private String appId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserMatchGridResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserMatchGridResultDTO.java new file mode 100644 index 0000000000..d3fd271987 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserMatchGridResultDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2022/8/5 11:14 + * @DESC + */ +@Data +public class IcUserMatchGridResultDTO implements Serializable { + + private static final long serialVersionUID = -3215965796907113918L; + + private String gridId; + + private String customerId; + + private String gridName; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 834ac2326c..f958d975d3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -1293,5 +1293,17 @@ public class IcResiUserController implements ResultDataResolver { return new Result>>().ok(icResiUserService.listResiZhzl(pageFormDTO)); } + /** + * Desc: 居民首次进入小程序,可以根据输入身份证信息查询在数字社区居民信息中的网格,匹配不成功提示 + * @param tokenDto + * @param formDTO + * @author zxc + * @date 2022/8/5 11:17 + */ + @PostMapping("icUserMatchGrid") + public Result icUserMatchGrid(@RequestBody IcUserMatchGridFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, IcUserMatchGridFormDTO.IcUserMatchGridForm.class); + return new Result().ok(icResiUserService.icUserMatchGrid(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index f68830d81c..37cf258e14 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -496,4 +496,13 @@ public interface IcResiUserService extends BaseService { * @return */ PageData> listResiZhzl(IcResiUserPageFormDTO pageFormDTO); + + /** + * Desc: 居民首次进入小程序,可以根据输入身份证信息查询在数字社区居民信息中的网格,匹配不成功提示 + * @param formDTO + * @author zxc + * @date 2022/8/5 11:17 + */ + IcUserMatchGridResultDTO icUserMatchGrid(IcUserMatchGridFormDTO formDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index b329bee2b8..f0fcfceefc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -20,6 +20,7 @@ package com.epmet.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; @@ -3244,4 +3245,55 @@ public class IcResiUserServiceImpl extends BaseServiceImpl(pageInfo.getList(), pageInfo.getTotal()); } + + /** + * Desc: 居民首次进入小程序,可以根据输入身份证信息查询在数字社区居民信息中的网格,匹配不成功提示 + * @param formDTO + * @author zxc + * @date 2022/8/5 11:17 + */ + @Override + public IcUserMatchGridResultDTO icUserMatchGrid(IcUserMatchGridFormDTO formDTO) { + PaCustomerDTO customerInfo = getCustomerInfo(formDTO.getAppId()); + if (null == customerInfo){ + throw new EpmetException("根据APPID查询客户信息失败:"+formDTO.getAppId()); + } + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.eq(IcResiUserEntity::getCustomerId,customerInfo.getId()) + .eq(IcResiUserEntity::getIdCard,formDTO.getIdCard()); + IcResiUserEntity icResiUserEntity = baseDao.selectOne(qw); + if (null == icResiUserEntity){ + throw new EpmetException(EpmetErrorCode.NOT_MATCH_IC_USER_ERROR.getCode()); + } + IcUserMatchGridResultDTO result = new IcUserMatchGridResultDTO(); + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(icResiUserEntity.getGridId()); + if (null == gridInfo){ + throw new EpmetException("查询网格信息失败:"+icResiUserEntity.getGridId()); + } + result.setCustomerId(customerInfo.getId()); + result.setGridId(icResiUserEntity.getGridId()); + result.setGridName(gridInfo.getGridNamePath()); + return result; + } + + public PaCustomerDTO getCustomerInfo(String appId) { + JSONObject jsonObject = new JSONObject(); + String data = HttpClientManager.getInstance().sendPostByJSON("https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/" + appId, JSON.toJSONString(jsonObject)).getData(); + logger.info("ThirdLoginServiceImpl.getCustomerInfo:httpclient->url:https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/ ,结果->" + data); + JSONObject toResult = JSON.parseObject(data); + Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); + if (null != toResult.get("code")) { + mapToResult.setCode(((Integer) toResult.get("code")).intValue()); + } + if (!mapToResult.success()) { + logger.error(String.format("根据appId查询客户Id失败,对应appId->" + appId)); + throw new RenException(mapToResult.getMsg()); + } + Object PublicCustomerResultDTO = mapToResult.getData(); + JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString()); + Map map = (Map) json.get("customer"); + PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class); + logger.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->" + customer); + return customer; + } }