瀏覽代碼

20240326_sun

15143018065 11 月之前
父節點
當前提交
ba351d354b

+ 20 - 15
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/YlServer.java

@@ -33,20 +33,13 @@ public class YlServer {
     public static void main(String[] args) {
         TreeMap<String, Object> lr = new TreeMap<>();
         try {
-            lr.put("memberName", RSAUtils.encryptByPublicKey("测试二用", ResourceUtil.getConfigByName("yl.enKey")));
-            lr.put("mobileNo", null);
-            lr.put("certNo", RSAUtils.encryptByPublicKey("220503193811137117", ResourceUtil.getConfigByName("yl.enKey")));
-            lr.put("remark", "吉林省 吉林市 舒兰市");
-            lr.put("householdAddress", "吉林省 吉林市 舒兰市");
-            lr.put("communityName", null);
-            lr.put("streetName", null);
+            lr.put("memberUniqueId", RSAUtils.encryptByPublicKey("220283194001163436", ResourceUtil.getConfigByName("yl.enKey")));
         } catch (Exception e) {
-            throw new ServiceException(e.getMessage());
+            System.out.println("加密失败");
         }
-        TreeMap<String, Object> map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hyzc"), null,
+        TreeMap<String, Object> map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hycx"), null,
                 ResourceUtil.getConfigByName("yl.version"), lr);
-        JSONObject res = YlServer.httpsRequest(YlServer.Map2JSONStr(map));
-        System.out.println(res);
+        System.out.println(YlServer.httpsRequest(YlServer.Map2JSONStr(map)));
     }
 
     // 2.1	会员信息新增
@@ -69,6 +62,7 @@ public class YlServer {
         JSONObject res = YlServer.httpsRequest(YlServer.Map2JSONStr(map));
         if (res.containsKey("respCode") && StringUtils.equals(res.getString("respCode"), "0000")) {
             r = res;
+            // 先禁用
             ylDisabled(res.getString("memberCode"));
         } else {
             throw new ServiceException(res.toJSONString());
@@ -90,7 +84,7 @@ public class YlServer {
             lr.put("communityName", null);
             lr.put("streetName", null);
         } catch (Exception e) {
-            throw new ServiceException(e.getMessage());
+            throw new ServiceException("加密失败 ==> " + e.getMessage());
         }
         TreeMap<String, Object> map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hybj"), null,
                 ResourceUtil.getConfigByName("yl.version"), lr);
@@ -106,9 +100,20 @@ public class YlServer {
     // 2.3	会员信息查询
     public JSONObject ylQuery(InLnstLrxx lrxx) {
         TreeMap<String, Object> lr = new TreeMap<>();
-        lr.put("memberCode", lrxx.getYlcode());
-        TreeMap<String, Object> map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hycx"), null,
-                null, lr);
+        TreeMap<String, Object> map = new TreeMap<>();
+        if (StringUtils.isNotEmpty(lrxx.getYlcode())) {
+            lr.put("memberCode", lrxx.getYlcode());
+            map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hycx"), null,
+                    null, lr);
+        } else {
+            try {
+                lr.put("memberUniqueId", RSAUtils.encryptByPublicKey(lrxx.getLrZjhm(), ResourceUtil.getConfigByName("yl.enKey")));
+                map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hycx"), null,
+                        ResourceUtil.getConfigByName("yl.version"), lr);
+            } catch (Exception e) {
+                throw new ServiceException("加密失败 ==> " + e.getMessage());
+            }
+        }
         JSONObject res = YlServer.httpsRequest(YlServer.Map2JSONStr(map));
         if (res.containsKey("respCode") && StringUtils.equals(res.getString("respCode"), "0000")) {
             try {

+ 103 - 74
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/ZwywLrJbxxServiceImpl.java

@@ -189,14 +189,6 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         return res;
     }
 
-    @Override
-    public InLnstLrxx getLrByZjhm(InLnstLrxx zwywLrJbxx) {
-        if (StringUtils.isEmpty(zwywLrJbxx.getLrJmzjhm())) {
-            throw new ServiceException("缺失必要参数");
-        }
-        return zwywLrJbxxMapper.selectOne(new LambdaQueryWrapper<>(zwywLrJbxx));
-    }
-
     /**
      * 新增老人基本信息
      *
@@ -206,36 +198,41 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
     @Transactional
     @Override
     public int insertZwywLrJbxx(InLnstLrxx zwywLrJbxx) {
-        // 插用户
-        LoginUser loginUser = userService.getUserInfo(zwywLrJbxx.getLrZjhm(), SecurityConstants.INNER).getData();
+        // 微信端专用新增
+        // 重复性检测 老人信息表/本系统老人用户表/银联系统会员表
+        LoginUser loginUser = userService.getLrUserInfo(zwywLrJbxx.getLrZjhm(), SecurityConstants.INNER).getData();
         InLnstLrxx query = new InLnstLrxx();
         query.setLrZjhm(zwywLrJbxx.getLrZjhm());
         InLnstLrxx check = zwywLrJbxxMapper.selectOne(new LambdaQueryWrapper<>(query));
         if (ObjectUtils.isNotEmpty(loginUser) || ObjectUtils.isNotEmpty(check)) {
             throw new ServiceException("该证件号码账号已存在");
         }
+        // 前端未传流转状态
+        // 草稿
         if (StringUtils.isEmpty(zwywLrJbxx.getLzzt())) {
-            if (StringUtils.isNotEmpty(zwywLrJbxx.getLrTx()) && StringUtils.isNotEmpty(zwywLrJbxx.getLrZjz())) {
-                // 通过
-                zwywLrJbxx.setLzzt("3");
-            } else {
-                // 草稿
-                zwywLrJbxx.setLzzt("0");
-            }
+            zwywLrJbxx.setLzzt("0");
         }
+        // 调用银联会员注册接口,将返回值放到 银联code 和 银联会员卡code 中
+        zwywLrJbxx.setYlcode("1100302099");
+        zwywLrJbxx.setYlcard("1100302099");
+        // 老人加密证件号码
+        zwywLrJbxx.setLrJmzjhm(DigestUtils.md5Hex(zwywLrJbxx.getLrZjhm()));
+        // 本系统的老人注册
         String userId = insertUser(zwywLrJbxx);
         if (StringUtils.isEmpty(userId)) {
             throw new ServiceException("用户已经存在");
         }
-        zwywLrJbxx.setYlcode("1100302099");
-        zwywLrJbxx.setYlcard("1100302099");
+        // 主键直接使用该userId
         zwywLrJbxx.setId(userId);
-        zwywLrJbxx.setLrJmzjhm(DigestUtils.md5Hex(zwywLrJbxx.getLrZjhm()));
+        // 生成登记编号
         zwywLrJbxx.setDjbh(String.valueOf(Long.parseLong(zwywLrJbxxMapper.selectMaxBh(zwywLrJbxx.getLrHjdz().substring(0, 6))) + 1));
+        // 审核信息实例化并将当前新增的老人数据复制一份
         InLnstShxx shxx = new InLnstShxx();
         BeanUtil.copyProperties(zwywLrJbxx, shxx, new CopyOptions().ignoreNullValue());
+        // 判断老人注册的户籍地址是否是强制注册的区划
         LnstDeptExamine examine = lnstDeptExamineMapper.selectList(new LambdaQueryWrapper<LnstDeptExamine>()
-                .eq(LnstDeptExamine::getCode, zwywLrJbxx.getLrHjdz())).stream().findFirst().orElse(null);
+                .eq(LnstDeptExamine::getCode, zwywLrJbxx.getLrHjdz().substring(0, 6) + "000000")).stream().findFirst().orElse(null);
+        // 需要审核的情况
         if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1") || StringUtils.equals(zwywLrJbxx.getLzzt(), "2")
                 || ObjectUtils.isNotEmpty(examine) || StringUtils.equals(zwywLrJbxx.getLzzt(), "5")
                 || !StringUtils.isAllEmpty(zwywLrJbxx.getTkzm(), zwywLrJbxx.getDbzm(), zwywLrJbxx.getZczm())) {
@@ -252,6 +249,7 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
                 shxx.setSqyy("老人待审核");
             }
         }
+        // 插入出生日期和性别
         try {
             if (StringUtils.isEmpty(zwywLrJbxx.getLrCsrq())) {
                 zwywLrJbxx.setLrCsrq(zwywLrJbxx.getLrZjhm().substring(7, 15));
@@ -261,7 +259,9 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
                 zwywLrJbxx.setLrXb(xb);
             }
         } catch (Exception ignored) {}
+        // 插入该条老人数据
         int res = zwywLrJbxxMapper.insert(zwywLrJbxx);
+        // 当前需要审核的情况插入审核数据
         if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1") || StringUtils.equals(zwywLrJbxx.getLzzt(), "2")
                 || StringUtils.equals(zwywLrJbxx.getLzzt(), "5") || StringUtils.equals(zwywLrJbxx.getLzzt(), "7")) {
             shxx.setId(IdUtils.simpleUUID());
@@ -270,41 +270,60 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
             shxx.setLzzt(zwywLrJbxx.getLzzt());
             zwywJclrShxxMapper.insert(shxx);
         }
+        // 插入一条空的活体数据
         LnstYlht ht = new LnstYlht();
         ht.setId(IdUtils.simpleUUID());
         ht.setYlcode(zwywLrJbxx.getYlcode());
         ht.setYlid(zwywLrJbxx.getId());
         lnstYlhtMapper.insert(ht);
-//        if (StringUtils.equals(zwywLrJbxx.getLzzt(), "3") && StringUtils.equals(zwywLrJbxx.getSource(), "0")) {
-//            uploadBaidu(zwywLrJbxx);
-//        }
         return res;
     }
 
     @Transactional
     @Override
     public int insertZwywLrJbxxWeb(InLnstLrxx zwywLrJbxx) {
+        // web端专用新增
         int res = 0;
-        // 重复性检测
-        LoginUser loginUser = userService.getUserInfo(zwywLrJbxx.getLrZjhm(), SecurityConstants.INNER).getData();
+        // 重复性检测 老人信息表/本系统老人用户表/银联系统会员表
+        LoginUser loginUser = userService.getLrUserInfo(zwywLrJbxx.getLrZjhm(), SecurityConstants.INNER).getData();
         InLnstLrxx query = new InLnstLrxx();
         query.setLrZjhm(zwywLrJbxx.getLrZjhm());
         InLnstLrxx check = zwywLrJbxxMapper.selectOne(new LambdaQueryWrapper<>(query));
+
         if (ObjectUtils.isNotEmpty(loginUser) || ObjectUtils.isNotEmpty(check)) {
             throw new ServiceException("该证件号码账号已存在");
         }
         // insert默认草稿属性,活体检测后才确定流转状态
         zwywLrJbxx.setLzzt("0");
-
+        // 调用银联会员注册接口,将返回值放到 银联code 和 银联会员卡code 中
         zwywLrJbxx.setYlcode("1100302099");
         zwywLrJbxx.setYlcard("1100302099");
+        // 老人加密证件号码
         zwywLrJbxx.setLrJmzjhm(DigestUtils.md5Hex(zwywLrJbxx.getLrZjhm()));
+        // web端户籍地址直接使用当前账号的行政区划
         zwywLrJbxx.setLrHjdz(SecurityUtils.getAreaCode());
+        // 生成登记编号
         zwywLrJbxx.setDjbh(String.valueOf(Long.parseLong(zwywLrJbxxMapper.selectMaxBh(zwywLrJbxx.getLrHjdz().substring(0, 6))) + 1));
-
+        // 本系统的老人注册
         String userId = insertUser(zwywLrJbxx);
+        if (StringUtils.isEmpty(userId)) {
+            throw new ServiceException("用户已经存在");
+        }
+        // 主键直接使用该userId
         zwywLrJbxx.setId(userId);
+        // 插入出生日期和性别
+        try {
+            if (StringUtils.isEmpty(zwywLrJbxx.getLrCsrq())) {
+                zwywLrJbxx.setLrCsrq(zwywLrJbxx.getLrZjhm().substring(7, 15));
+            }
+            if (StringUtils.isEmpty(zwywLrJbxx.getLrXb())) {
+                String xb = Integer.parseInt(zwywLrJbxx.getLrZjhm().substring(17, 18)) % 2 == 0 ? "2" : "1";
+                zwywLrJbxx.setLrXb(xb);
+            }
+        } catch (Exception ignored) {}
+        // 插入本条老人数据
         res = zwywLrJbxxMapper.insert(zwywLrJbxx);
+        // 直接插入一条空的活体数据
         LnstYlht ht = new LnstYlht();
         ht.setId(IdUtils.simpleUUID());
         ht.setYlcode(zwywLrJbxx.getYlcode());
@@ -313,6 +332,54 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         return res;
     }
 
+    /**
+     * 修改老人基本信息
+     *
+     * @param zwywLrJbxx 老人基本信息
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int updateZwywLrJbxx(InLnstLrxx zwywLrJbxx) {
+        // 检测是否存在老人户籍地址
+        if (StringUtils.isEmpty(zwywLrJbxx.getLrHjdz())) {
+            InLnstLrxx old = zwywLrJbxxMapper.selectById(zwywLrJbxx.getId());
+            if (ObjectUtils.isNotEmpty(old)) {
+                zwywLrJbxx.setLrHjdz(old.getLrHjdz());
+            } else {
+                throw new ServiceException("该老人已被删除");
+            }
+        }
+        // 判断老人更新的户籍地址是否是强制注册的区划
+        LnstDeptExamine examine = lnstDeptExamineMapper.selectList(new LambdaQueryWrapper<LnstDeptExamine>()
+                .eq(LnstDeptExamine::getCode, zwywLrJbxx.getLrHjdz().substring(0, 6) + "000000")).stream().findFirst().orElse(null);
+        // 当前需要审核的情况
+        if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1") || StringUtils.equals(zwywLrJbxx.getLzzt(), "2")
+                || StringUtils.equals(zwywLrJbxx.getLzzt(), "5") || ObjectUtils.isNotEmpty(examine)
+                || !StringUtils.isAllEmpty(zwywLrJbxx.getTkzm(), zwywLrJbxx.getDbzm(), zwywLrJbxx.getZczm())) {
+            InLnstShxx shxx = new InLnstShxx();
+            BeanUtil.copyProperties(zwywLrJbxx, shxx, new CopyOptions().ignoreNullValue());
+            if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1")) {
+                shxx.setSqyy("老人照片与证件照匹配度过低");
+            } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "2")) {
+                shxx.setSqyy("存在相似老人照片");
+            } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "5")
+                    || !StringUtils.isAllEmpty(zwywLrJbxx.getTkzm(), zwywLrJbxx.getDbzm(), zwywLrJbxx.getZczm())) {
+                zwywLrJbxx.setLzzt("5");
+                shxx.setSqyy("特殊材料待审");
+            } else {
+                zwywLrJbxx.setLzzt("7");
+                shxx.setSqyy("老人待审核");
+            }
+            shxx.setId(IdUtils.simpleUUID());
+            shxx.setLrId(zwywLrJbxx.getId());
+            shxx.setSqsj(DateUtils.dateTimeNow());
+            shxx.setLzzt(zwywLrJbxx.getLzzt());
+            zwywJclrShxxMapper.insert(shxx);
+        }
+        return zwywLrJbxxMapper.updateById(zwywLrJbxx);
+    }
+
     @Override
     public int sh(InLnstShxx shxx) {
         int res = 0;
@@ -344,6 +411,14 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         return zwywLrJbxxMapper.updateById(lrxx);
     }
 
+    @Override
+    public InLnstLrxx getLrByZjhm(InLnstLrxx zwywLrJbxx) {
+        if (StringUtils.isEmpty(zwywLrJbxx.getLrJmzjhm())) {
+            throw new ServiceException("缺失必要参数");
+        }
+        return zwywLrJbxxMapper.selectOne(new LambdaQueryWrapper<>(zwywLrJbxx));
+    }
+
     @Override
     public Map<String, String> match(InLnstLrxx zwywLrJbxx) {
         Map<String, String> res = new LinkedHashMap<>();
@@ -665,52 +740,6 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         return res;
     }
 
-    /**
-     * 修改老人基本信息
-     *
-     * @param zwywLrJbxx 老人基本信息
-     * @return 结果
-     */
-    @Transactional
-    @Override
-    public int updateZwywLrJbxx(InLnstLrxx zwywLrJbxx)
-    {
-        if (StringUtils.isEmpty(zwywLrJbxx.getLrHjdz())) {
-            InLnstLrxx old = zwywLrJbxxMapper.selectById(zwywLrJbxx.getId());
-            if (ObjectUtils.isNotEmpty(old)) {
-                zwywLrJbxx.setLrHjdz(old.getLrHjdz());
-            } else {
-                throw new ServiceException("该老人已被删除");
-            }
-        }
-        LnstDeptExamine examine = lnstDeptExamineMapper.selectList(new LambdaQueryWrapper<LnstDeptExamine>()
-                .eq(LnstDeptExamine::getCode, zwywLrJbxx.getLrHjdz())).stream().findFirst().orElse(null);
-        if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1") || StringUtils.equals(zwywLrJbxx.getLzzt(), "2")
-                || StringUtils.equals(zwywLrJbxx.getLzzt(), "5") || ObjectUtils.isNotEmpty(examine)
-                || !StringUtils.isAllEmpty(zwywLrJbxx.getTkzm(), zwywLrJbxx.getDbzm(), zwywLrJbxx.getZczm())) {
-            InLnstShxx shxx = new InLnstShxx();
-            BeanUtil.copyProperties(zwywLrJbxx, shxx, new CopyOptions().ignoreNullValue());
-            if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1")) {
-                shxx.setSqyy("老人照片与证件照匹配度过低");
-            } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "2")) {
-                shxx.setSqyy("存在相似老人照片");
-            } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "5")
-                || !StringUtils.isAllEmpty(zwywLrJbxx.getTkzm(), zwywLrJbxx.getDbzm(), zwywLrJbxx.getZczm())) {
-                zwywLrJbxx.setLzzt("5");
-                shxx.setSqyy("特殊材料待审");
-            } else {
-                zwywLrJbxx.setLzzt("7");
-                shxx.setSqyy("老人待审核");
-            }
-            shxx.setId(IdUtils.simpleUUID());
-            shxx.setLrId(zwywLrJbxx.getId());
-            shxx.setSqsj(DateUtils.dateTimeNow());
-            shxx.setLzzt(zwywLrJbxx.getLzzt());
-            zwywJclrShxxMapper.insert(shxx);
-        }
-        return zwywLrJbxxMapper.updateById(zwywLrJbxx);
-    }
-
     /**
      * 批量删除老人基本信息
      *