Ver código fonte

Merge branch '20240418_sun' of sckj/mz-cloud into master

15143018065 1 ano atrás
pai
commit
426bc3fcf8

+ 8 - 0
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/controller/ZwywLrJbxxController.java

@@ -119,6 +119,14 @@ public class ZwywLrJbxxController extends BaseController {
         return toAjax(zwywLrJbxxService.insertZwywLrJbxxWeb(in), in.getId());
     }
 
+    @Log(title = "老人基本信息", businessType = BusinessType.INSERT)
+    @PostMapping("/sb")
+    public AjaxResult sb(@Validated({AddGroup.class}) @RequestBody InLnstLrxx zwywLrJbxx) {
+        InLnstLrxx in = new InLnstLrxx();
+        BeanUtil.copyProperties(zwywLrJbxx, in, new CopyOptions().ignoreNullValue());
+        return toAjax(zwywLrJbxxService.insertZwywLrJbxxSb(in), in.getId());
+    }
+
     @RequiresPermissions("lnst:lrxx:edit")
     @Log(title = "老人基本信息", businessType = BusinessType.UPDATE)
     @PostMapping("/sh")

+ 2 - 0
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/IZwywLrJbxxService.java

@@ -44,6 +44,8 @@ public interface IZwywLrJbxxService
 
     public int insertZwywLrJbxxWeb(InLnstLrxx zwywLrJbxx);
 
+    public int insertZwywLrJbxxSb(InLnstLrxx zwywLrJbxx);
+
     public int sh(InLnstShxx shxx);
 
     public int ty(InLnstLrxx lrxx);

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

@@ -43,33 +43,33 @@ public class YlServer {
 //        System.out.println(YlServer.httpsRequest(YlServer.Map2JSONStr(map)));
 
         // 查询
-        InLnstLrxx lrxx = new InLnstLrxx();
-//        lrxx.setYlcode("1201626019");
-        lrxx.setLrZjhm("220281199506020537");
-        lrxx.setMchnt("10002253");
-        TreeMap<String, Object> lr = new TreeMap<>();
-        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 {
-            lr.put("memberUniqueId", lrxx.getLrZjhm());
-            map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hycx"), lrxx.getMchntCode(),
-                    null, lr);
-        }
-        System.out.println( YlServer.httpsRequest(YlServer.Map2JSONStr(map)));
-
+//        InLnstLrxx lrxx = new InLnstLrxx();
+////        lrxx.setYlcode("1201626019");
+//        lrxx.setLrZjhm("220281199506020537");
+//        lrxx.setMchnt("10002253");
 //        TreeMap<String, Object> lr = new TreeMap<>();
-//        lr.put("storeCode", "");
-//        lr.put("startDate", "2024-04-10 00:00:00");
-//        lr.put("endDate", "2024-04-12 00:00:00");
-//        lr.put("transType", "");
-//        lr.put("transState", "");
-//        lr.put("startRecId", "0");
-//        TreeMap<String, Object> map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.syncYc"), null,
-//                null, lr);
-//        System.out.println(YlServer.httpsRequest(YlServer.Map2JSONStr(map)));
+//        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 {
+//            lr.put("memberUniqueId", lrxx.getLrZjhm());
+//            map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hycx"), lrxx.getMchntCode(),
+//                    null, lr);
+//        }
+//        System.out.println( YlServer.httpsRequest(YlServer.Map2JSONStr(map)));
+
+        TreeMap<String, Object> lr = new TreeMap<>();
+        lr.put("storeCode", "");
+        lr.put("startDate", "2024-04-22 00:00:00");
+        lr.put("endDate", "2024-04-23 00:00:00");
+        lr.put("transType", "");
+        lr.put("transState", "");
+        lr.put("startRecId", "0");
+        TreeMap<String, Object> map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.syncYc"), null,
+                null, lr);
+        System.out.println(YlServer.httpsRequest(YlServer.Map2JSONStr(map)));
         // 人脸采集状态同步
 //        TreeMap<String, Object> lr = new TreeMap<>();
 //        lr.put("memberCode", "1100302372");

+ 101 - 9
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/ZwywLrJbxxServiceImpl.java

@@ -288,6 +288,62 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         return zwywLrJbxxMapper.insert(zwywLrJbxx);
     }
 
+    @Transactional
+    @Override
+    public int insertZwywLrJbxxSb(InLnstLrxx zwywLrJbxx) {
+        // 微信端自主申报专用新增
+        // 重复性检测 老人信息表/本系统老人用户表/银联系统会员表
+        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("该证件号码账号已存在");
+        }
+        // 自主申报待审核
+        zwywLrJbxx.setLzzt("8");
+        // 调用银联会员注册接口,将返回值放到 银联code 和 银联会员卡code 中
+        JSONObject ylRes = ylServer.ylQuery(zwywLrJbxx);
+        System.out.println("银联查询 ====》 " + ylRes);
+        if (ObjectUtils.isNotEmpty(ylRes) && ylRes.containsKey("respCode") && StringUtils.equals(ylRes.getString("respCode"), "0000")) {
+            throw new ServiceException("该证件号码账号已存在");
+        }
+        // 老人加密证件号码
+        zwywLrJbxx.setLrJmzjhm(DigestUtils.md5Hex(zwywLrJbxx.getLrZjhm()));
+        // 本系统的老人注册
+        String userId = insertUser(zwywLrJbxx);
+        if (StringUtils.isEmpty(userId)) {
+            throw new ServiceException("用户已经存在");
+        }
+        // 主键直接使用该userId
+        zwywLrJbxx.setId(userId);
+        // 生成登记编号
+        zwywLrJbxx.setDjbh(String.valueOf(Long.parseLong(zwywLrJbxxMapper.selectMaxBh(zwywLrJbxx.getLrHjdz().substring(0, 6))) + 1));
+        // 用餐状态禁用
+        zwywLrJbxx.setState("0");
+        // 插入出生日期和性别
+        try {
+            if (StringUtils.isEmpty(zwywLrJbxx.getLrCsrq())) {
+                zwywLrJbxx.setLrCsrq(zwywLrJbxx.getLrZjhm().substring(6, 14));
+            }
+            if (StringUtils.isEmpty(zwywLrJbxx.getLrXb())) {
+                String xb = Integer.parseInt(zwywLrJbxx.getLrZjhm().substring(17, 18)) % 2 == 0 ? "2" : "1";
+                zwywLrJbxx.setLrXb(xb);
+            }
+        } catch (Exception ignored) {}
+        int res = zwywLrJbxxMapper.insert(zwywLrJbxx);
+        InLnstShxx shxx = new InLnstShxx();
+        BeanUtil.copyProperties(zwywLrJbxx, shxx, new CopyOptions().ignoreNullValue());
+        // 拒绝后修改必须审核
+        shxx.setSqyy("老人自主申报");
+        shxx.setId(IdUtils.simpleUUID());
+        shxx.setLrId(zwywLrJbxx.getId());
+        shxx.setSqsj(DateUtils.dateTimeNow());
+        shxx.setLzzt(zwywLrJbxx.getLzzt());
+        insertShxx(shxx);
+        return res;
+    }
+
     @Transactional
     @Override
     public int insertZwywLrJbxxWeb(InLnstLrxx zwywLrJbxx) {
@@ -651,16 +707,52 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         up.setId(shxx.getLrId());
         up.setLrSp(shxx.getSpjg());
         up.setLrSpyj(shxx.getSpyj());
-        if (StringUtils.equals(shxx.getSpjg(), ExamineStatus.SYES.getCode())) {
-            up.setLzzt("3");
-            up.setLrTx(shxx.getLrTx());
-            up.setLrZjz(shxx.getLrZjz());
-            up.setState("1");
-            // 通过的情况把银联那边的账号启用
-            ylServer.ylEnabled(lr.getYlcode(), lr.getMchnt());
+        if (StringUtils.equals(lr.getLzzt(), "8")) {
+            // 老人自主申报专用审核
+            if (StringUtils.equals(shxx.getSpjg(), ExamineStatus.SYES.getCode())) {
+                EncryptionUtils.decryptForPlaintext(lr);
+                up.setLzzt("0");
+                // 插入园区码
+                up.setMchnt(getMchntCode(lr.getLrHjdz()));
+                // 调用银联会员注册接口,将返回值放到 银联code 和 银联会员卡code 中
+                JSONObject ylRes = ylServer.ylQuery(lr);
+                System.out.println("银联查询 ====》 " + ylRes);
+                if (ObjectUtils.isNotEmpty(ylRes) && ylRes.containsKey("respCode") && StringUtils.equals(ylRes.getString("respCode"), "0000")) {
+//            throw new ServiceException("银联系统中该证件号码账号已存在");
+                    up.setYlcode(ylRes.getJSONObject("member").getString("memberCode"));
+                    up.setYlcard(ylRes.getJSONObject("member").getString("cardCode"));
+                    System.out.println("---测试版本银联账号复用");
+                } else {
+                    // 调用银联会员注册接口,将返回值放到 银联code 和 银联会员卡code 中
+                    InLnstLrxx inYl = new InLnstLrxx();
+                    inYl.setLrXm(lr.getLrXm());
+                    inYl.setLrZjhm(lr.getLrZjhm());
+                    inYl.setLrHjdz(lr.getLrHjdz());
+                    inYl.setLrHjbcxx(lr.getLrHjbcxx());
+                    JSONObject yl = ylServer.ylRegister(inYl);
+                    if (ObjectUtils.isNotEmpty(yl) && yl.containsKey("respCode") && StringUtils.equals(yl.getString("respCode"), "0000")) {
+                        up.setYlcode(yl.getString("memberCode"));
+                        up.setYlcard(yl.getString("cardCode"));
+                    } else {
+                        throw new ServiceException("银联账号注册失败 ===》 " + yl);
+                    }
+                }
+            } else {
+                up.setLzzt("9");
+            }
         } else {
-            up.setState("0");
-            up.setLzzt("4");
+            // 其他审核
+            if (StringUtils.equals(shxx.getSpjg(), ExamineStatus.SYES.getCode())) {
+                up.setLzzt("3");
+                up.setLrTx(shxx.getLrTx());
+                up.setLrZjz(shxx.getLrZjz());
+                up.setState("1");
+                // 通过的情况把银联那边的账号启用
+                ylServer.ylEnabled(lr.getYlcode(), lr.getMchnt());
+            } else {
+                up.setState("0");
+                up.setLzzt("4");
+            }
         }
         shxx.setState("99");
         shxx.setSpsj(DateUtils.dateTimeNow());