Ver código fonte

20240320_sun整合调用银联接口

15143018065 11 meses atrás
pai
commit
ec384a46fd

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

@@ -89,6 +89,15 @@ public class ZwywLrJbxxController extends BaseController {
         return toAjax(zwywLrJbxxService.insertZwywLrJbxx(in), zwywLrJbxx.getLrZjhm());
     }
 
+    @RequiresPermissions("lnst:lrxx:add")
+    @Log(title = "老人基本信息", businessType = BusinessType.INSERT)
+    @PostMapping("/webAdd")
+    public AjaxResult webAdd(@Validated({AddGroup.class}) @RequestBody InLnstLrxx zwywLrJbxx) {
+        InLnstLrxx in = new InLnstLrxx();
+        BeanUtil.copyProperties(zwywLrJbxx, in, new CopyOptions().ignoreNullValue());
+        return toAjax(zwywLrJbxxService.insertZwywLrJbxxWeb(in), zwywLrJbxx.getLrZjhm());
+    }
+
     @PostMapping("/match")
     public AjaxResult match(@Validated({AddGroup.class}) @RequestBody InLnstLrxx zwywLrJbxx) {
         InLnstLrxx in = new InLnstLrxx();

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

@@ -40,6 +40,8 @@ public interface IZwywLrJbxxService
      */
     public int insertZwywLrJbxx(InLnstLrxx zwywLrJbxx);
 
+    public int insertZwywLrJbxxWeb(InLnstLrxx zwywLrJbxx);
+
     public int sh(ZwywJclrShxx shxx);
 
     public int ty(InLnstLrxx lrxx);

+ 14 - 0
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/Base64Utils.java

@@ -0,0 +1,14 @@
+package com.ruoyi.lnst.service.impl;
+
+import java.util.Base64;
+
+public class Base64Utils {
+
+    public static byte[] decode(String d) {
+        return Base64.getDecoder().decode(d);
+    }
+
+    public static String encode(byte[] e) {
+        return Base64.getEncoder().encodeToString(e);
+    }
+}

Diferenças do arquivo suprimidas por serem muito extensas
+ 636 - 0
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/RSAUtils.java


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

@@ -0,0 +1,151 @@
+package com.ruoyi.lnst.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONArray;
+import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.core.utils.uuid.IdUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.bouncycastle.crypto.digests.SM3Digest;
+import org.bouncycastle.util.encoders.Hex;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.ConnectException;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.TreeMap;
+
+import static com.ruoyi.common.core.utils.DateUtils.YYYY_MM_DD_HH_MM_SS;
+
+public class YlServer {
+
+    public static void main(String[] args) {
+        TreeMap<String, Object> test = new TreeMap<>();
+        test.put("memberCode", "1100302099");
+        TreeMap<String, Object> map = publicSupport("plat.member.disable", null, null, test);
+        JSONObject res = httpsRequest(Map2JSONStr(map));
+        System.out.println(res);
+    }
+
+    public static String Map2JSONStr(TreeMap<String, Object> params) {
+        JSONObject jsonParams = new JSONObject();
+        for (String key : params.keySet()) {
+            Object value = params.get(key);
+            if (value != null) {
+                if (value instanceof JSONObject || value instanceof JSONArray) {
+                    jsonParams.put(key, value);
+                } else {
+                    jsonParams.put(key, String.valueOf(value));
+                }
+            }
+        }
+        return jsonParams.toString();
+    }
+
+    public static TreeMap<String, Object> publicSupport(String msgType, String mchntCode, String version, TreeMap<String, Object> business) {
+        // 创建一个TreeMap对象,用于存储参数
+        TreeMap<String, Object> params = new TreeMap<>();
+        // 添加参数到TreeMap中
+        params.put("mchntCode", StringUtils.isNotEmpty(mchntCode) ? mchntCode : ResourceUtil.getConfigByName("yl.mchntCode"));
+        params.put("msgType", msgType);
+        params.put("msgSrc", ResourceUtil.getConfigByName("yl.msgSrc"));
+        params.put("reqTime", DateUtils.dateTimeNow(YYYY_MM_DD_HH_MM_SS));
+        params.put("reqSsn", IdUtils.simpleUUID());
+        if (ObjectUtils.isNotEmpty(business)) {
+            for (String key : business.keySet()) {
+                Object value = business.get(key);
+                params.put(key, value);
+            }
+        }
+        params.put("version", version);
+        params.put("sign", getSign(params));
+        return params;
+    }
+
+    private static String getSign(TreeMap<String, Object> params) {
+        StringBuilder res = new StringBuilder();
+        for (String key : params.keySet()) {
+            Object value = params.get(key);
+            if (ObjectUtils.isNotEmpty(value)) {
+                if (res.length() > 0) {
+                    res.append("&");
+                }
+                res.append(key).append("=");
+                if (value instanceof JSONObject || value instanceof JSONArray) {
+                    res.append(value.toString());
+                } else {
+                    res.append(value);
+                }
+            }
+        }
+        // 拼接上key得到stringSignTemp字符串
+        String stringSignTemp = res.toString() + ResourceUtil.getConfigByName("yl.signKey");
+
+        // 对stringSignTemp进行SM3运算
+        byte[] stringSignTempBytes = stringSignTemp.getBytes(StandardCharsets.UTF_8);
+        SM3Digest sm3Digest = new SM3Digest();
+        sm3Digest.update(stringSignTempBytes, 0, stringSignTempBytes.length);
+        byte[] digestBytes = new byte[sm3Digest.getDigestSize()];
+        sm3Digest.doFinal(digestBytes, 0);
+
+        // 将SM3运算结果转换为大写形式的字符串
+        return Hex.toHexString(digestBytes).toUpperCase();
+    }
+
+    public static JSONObject httpsRequest(String outputStr) {
+        JSONObject jsonObject = null;
+        try {
+            // 创建SSLContext对象,并使用我们指定的信任管理器初始化
+            TrustManager[] tm = {new MyX509TrustManager()};
+            SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            // 从上述SSLContext对象中得到SSLSocketFactory对象
+            SSLSocketFactory ssf = sslContext.getSocketFactory();
+
+            URL url = new URL(ResourceUtil.getConfigByName("yl.url"));
+            HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
+            conn.setSSLSocketFactory(ssf);
+
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            conn.setUseCaches(false);
+            // 设置请求方式(GET/POST)
+            conn.setRequestMethod("POST");
+            // 当outputStr不为null时向输出流写数据
+            if (null != outputStr) {
+                OutputStream outputStream = conn.getOutputStream();
+                // 注意编码格式
+                outputStream.write(outputStr.getBytes("UTF-8"));
+                outputStream.close();
+            }
+            // 从输入流读取返回内容
+            InputStream inputStream = conn.getInputStream();
+            InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
+            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
+            String str = null;
+            StringBuffer buffer = new StringBuffer();
+            while ((str = bufferedReader.readLine()) != null) {
+                buffer.append(str);
+            }
+            // 释放资源
+            bufferedReader.close();
+            inputStreamReader.close();
+            inputStream.close();
+            inputStream = null;
+            conn.disconnect();
+            jsonObject = JSONObject.parseObject(buffer.toString());
+        } catch (ConnectException ce) {
+            //
+        } catch (Exception e) {
+            //
+        }
+        return jsonObject;
+    }
+}

+ 14 - 9
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/ZwywJclrShxxServiceImpl.java

@@ -1,18 +1,18 @@
 package com.ruoyi.lnst.service.impl;
 
-import java.util.List;
-
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.lnst.domain.ZwywJclrShxx;
+import com.ruoyi.lnst.mapper.ZwywJclrShxxMapper;
+import com.ruoyi.lnst.service.IZwywJclrShxxService;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
 import java.util.Arrays;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.ruoyi.lnst.mapper.ZwywJclrShxxMapper;
-import com.ruoyi.lnst.domain.ZwywJclrShxx;
-import com.ruoyi.lnst.service.IZwywJclrShxxService;
+import java.util.List;
 
 /**
  * 老人信息_老人基本信息审核信息Service业务层处理
@@ -47,10 +47,15 @@ public class ZwywJclrShxxServiceImpl implements IZwywJclrShxxService
     @Override
     public List<ZwywJclrShxx> selectZwywJclrShxxList(ZwywJclrShxx zwywJclrShxx)
     {
-        if (StringUtils.isEmpty(zwywJclrShxx.getLrId())) {
-            throw new ServiceException("参数错误,老人主键缺失");
+        String lrZjhm = zwywJclrShxx.getLrZjhm();
+        if (StringUtils.isNotEmpty(lrZjhm)) {
+            zwywJclrShxx.setLrZjhm(null);
+        }
+        LambdaQueryWrapper<ZwywJclrShxx> lqw = new LambdaQueryWrapper<>(zwywJclrShxx);
+        if (StringUtils.isNotEmpty(lrZjhm)) {
+            lqw.and(wq -> wq.eq(ZwywJclrShxx::getLrZjhm, lrZjhm).or().eq(ZwywJclrShxx::getLrCydh, lrZjhm));
         }
-        return zwywJclrShxxMapper.selectList(new LambdaQueryWrapper<>(zwywJclrShxx));
+        return zwywJclrShxxMapper.selectList(lqw);
     }
 
     /**

+ 140 - 100
ruoyi-modules/mz-lnst/src/main/java/com/ruoyi/lnst/service/impl/ZwywLrJbxxServiceImpl.java

@@ -10,6 +10,7 @@ import com.ruoyi.common.core.constant.SecurityConstants;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.core.utils.file.FileUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.security.utils.DictUtils;
@@ -41,10 +42,7 @@ import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
+import java.io.*;
 import java.math.BigDecimal;
 import java.net.ConnectException;
 import java.net.URL;
@@ -201,21 +199,25 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         if (StringUtils.isEmpty(userId)) {
             throw new ServiceException("用户已经存在");
         }
+        zwywLrJbxx.setYlcode(ylRegister(zwywLrJbxx));
         zwywLrJbxx.setId(userId);
         zwywLrJbxx.setLrJmzjhm(DigestUtils.md5Hex(zwywLrJbxx.getLrZjhm()));
         zwywLrJbxx.setDjbh(String.valueOf(Long.parseLong(zwywLrJbxxMapper.selectMaxBh(zwywLrJbxx.getLrHjdz().substring(0, 6))) + 1));
         ZwywJclrShxx shxx = new ZwywJclrShxx();
+        BeanUtil.copyProperties(zwywLrJbxx, shxx, new CopyOptions().ignoreNullValue());
         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")
-                || ObjectUtils.isNotEmpty(examine)) {
-            BeanUtil.copyProperties(zwywLrJbxx, shxx, new CopyOptions().ignoreNullValue());
+                || ObjectUtils.isNotEmpty(examine) || StringUtils.equals(zwywLrJbxx.getLzzt(), "5")) {
             if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1")) {
                 shxx.setSqyy("老人照片与证件照匹配度过低");
             } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "2")) {
                 shxx.setSqyy("存在相似老人照片");
-            } else {
+            } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "5")) {
                 zwywLrJbxx.setLzzt("5");
+                shxx.setSqyy("特殊材料待审核");
+            } else {
+                zwywLrJbxx.setLzzt("7");
                 shxx.setSqyy("老人待审核");
             }
         }
@@ -227,23 +229,39 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
                 String xb = Integer.parseInt(zwywLrJbxx.getLrZjhm().substring(17, 18)) % 2 == 0 ? "2" : "1";
                 zwywLrJbxx.setLrXb(xb);
             }
-        } catch (Exception e) {
-            //
-        }
+        } catch (Exception ignored) {}
         int res = zwywLrJbxxMapper.insert(zwywLrJbxx);
         if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1") || StringUtils.equals(zwywLrJbxx.getLzzt(), "2")
-                || ObjectUtils.isNotEmpty(examine)) {
+                || StringUtils.equals(zwywLrJbxx.getLzzt(), "5") || StringUtils.equals(zwywLrJbxx.getLzzt(), "7")) {
             shxx.setId(IdUtils.simpleUUID());
             shxx.setLrId(zwywLrJbxx.getId());
             shxx.setSqsj(DateUtils.dateTimeNow());
+            shxx.setLzzt(zwywLrJbxx.getLzzt());
             zwywJclrShxxMapper.insert(shxx);
         }
-        if (StringUtils.equals(zwywLrJbxx.getLzzt(), "3") && StringUtils.equals(zwywLrJbxx.getSource(), "0")) {
-            uploadBaidu(zwywLrJbxx);
-        }
+//        if (StringUtils.equals(zwywLrJbxx.getLzzt(), "3") && StringUtils.equals(zwywLrJbxx.getSource(), "0")) {
+//            uploadBaidu(zwywLrJbxx);
+//        }
         return res;
     }
 
+    @Transactional
+    @Override
+    public int insertZwywLrJbxxWeb(InLnstLrxx zwywLrJbxx) {
+        LoginUser loginUser = userService.getUserInfo(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("0");
+        zwywLrJbxx.setLrJmzjhm(DigestUtils.md5Hex(zwywLrJbxx.getLrZjhm()));
+        zwywLrJbxx.setDjbh(String.valueOf(Long.parseLong(zwywLrJbxxMapper.selectMaxBh(zwywLrJbxx.getLrHjdz().substring(0, 6))) + 1));
+        zwywLrJbxx.setLrHjdz(SecurityUtils.getAreaCode());
+        return zwywLrJbxxMapper.insert(zwywLrJbxx);
+    }
+
     @Override
     public int sh(ZwywJclrShxx shxx) {
         int res = 0;
@@ -266,7 +284,7 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         shxx.setSpsj(DateUtils.dateTimeNow());
         zwywJclrShxxMapper.updateById(shxx);
         res = zwywLrJbxxMapper.updateById(up);
-        uploadBaidu(zwywLrJbxxMapper.selectById(shxx.getLrId()));
+//        uploadBaidu(zwywLrJbxxMapper.selectById(shxx.getLrId()));
         return res;
     }
 
@@ -279,56 +297,56 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
     public Map<String, String> match(InLnstLrxx zwywLrJbxx) {
         Map<String, String> res = new LinkedHashMap<>();
         // 匹配人脸与证件照
-//        File ht = new File(localFilePath + zwywLrJbxx.getLrTx().replaceFirst("/uploadPath", ""));
-//        File zjz = new File(localFilePath + zwywLrJbxx.getLrZjz().replaceFirst("/uploadPath", ""));
-//        if (!ht.exists() || !zjz.exists()) {
-//            throw new ServiceException("照片文件不存在 => " + localFilePath + zwywLrJbxx.getLrTx().replaceFirst("/uploadPath", "")
-//             + "  |||||||||||||||||||||||||  " + localFilePath + zwywLrJbxx.getLrZjz().replaceFirst("/uploadPath", ""));
-//        }
-//        String htStr = FileUtils.file2Base64(ht);
-//        String zjzStr = FileUtils.file2Base64(zjz);
-//        List<Map<String, String>> param = new ArrayList<>();
-//        Map<String, String> htMap = new LinkedHashMap<>();
-//        htMap.put("image", htStr);
-//        htMap.put("image_type", "BASE64");
-//        htMap.put("liveness_control", "NORMAL");
-//        Map<String, String> zjzMap = new LinkedHashMap<>();
-//        zjzMap.put("image", zjzStr);
-//        zjzMap.put("image_type", "BASE64");
-//        param.add(htMap);
-//        param.add(zjzMap);
-//        String token = getBaiduToken();
-//        JSONObject matchRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/match" +
-//                "?access_token=" + token, "POST", JSONObject.toJSONString(param));
-//        if (ObjectUtils.isNotEmpty(matchRes) && StringUtils.equals(matchRes.getString("error_msg"), "SUCCESS")) {
-//            // 信息匹配度低待审核
-//            if (Integer.parseInt(matchRes.getJSONObject("result").getString("score")) < Integer.parseInt(ResourceUtil.getConfigByName("baidu.similarity"))) {
-//                res.put("lzzt", "1");
-//                res.put("lrTxdb", matchRes.getString("result"));
-//                res.put("msg", "老人照片与证件照匹配度低");
-//                return res;
-//            }
-//        } else {
-//            throw new ServiceException("照片不符合规则");
-//        }
-//        // 当前group中检索相似人脸
-//        Map<String, String> searchMap = new LinkedHashMap<>();
-//        searchMap.put("image", htStr);
-//        searchMap.put("image_type", "BASE64");
-//        searchMap.put("group_id_list", SecurityUtils.getAreaCode().substring(0, 6));
-//        searchMap.put("match_threshold", ResourceUtil.getConfigByName("baidu.similarity"));
-//        JSONObject searchRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/search" +
-//                "?access_token=" + token, "POST", JSONObject.toJSONString(searchMap));
-//        if (ObjectUtils.isNotEmpty(searchRes) && StringUtils.equals(searchRes.getString("error_msg"), "SUCCESS")) {
-//            // 存在相似人脸信息
-//            if (searchRes.getJSONObject("result").getJSONArray("user_list").size() > 0) {
-//                JSONArray xslr = searchRes.getJSONObject("result").getJSONArray("user_list");
-//                res.put("lzzt", "2");
-//                res.put("xslrZjhm", xslr.toJSONString());
-//                res.put("msg", "存在相似人脸信息");
-//                return res;
-//            }
-//        }
+        File ht = new File(localFilePath + zwywLrJbxx.getLrTx().replaceFirst("/uploadPath", ""));
+        File zjz = new File(localFilePath + zwywLrJbxx.getLrZjz().replaceFirst("/uploadPath", ""));
+        if (!ht.exists() || !zjz.exists()) {
+            throw new ServiceException("照片文件不存在 => " + localFilePath + zwywLrJbxx.getLrTx().replaceFirst("/uploadPath", "")
+             + "  |||||||||||||||||||||||||  " + localFilePath + zwywLrJbxx.getLrZjz().replaceFirst("/uploadPath", ""));
+        }
+        String htStr = FileUtils.file2Base64(ht);
+        String zjzStr = FileUtils.file2Base64(zjz);
+        List<Map<String, String>> param = new ArrayList<>();
+        Map<String, String> htMap = new LinkedHashMap<>();
+        htMap.put("image", htStr);
+        htMap.put("image_type", "BASE64");
+        htMap.put("liveness_control", "NORMAL");
+        Map<String, String> zjzMap = new LinkedHashMap<>();
+        zjzMap.put("image", zjzStr);
+        zjzMap.put("image_type", "BASE64");
+        param.add(htMap);
+        param.add(zjzMap);
+        String token = getBaiduToken();
+        JSONObject matchRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/match" +
+                "?access_token=" + token, "POST", JSONObject.toJSONString(param));
+        if (ObjectUtils.isNotEmpty(matchRes) && StringUtils.equals(matchRes.getString("error_msg"), "SUCCESS")) {
+            // 信息匹配度低待审核
+            if (Integer.parseInt(matchRes.getJSONObject("result").getString("score")) < Integer.parseInt(ResourceUtil.getConfigByName("baidu.similarity"))) {
+                res.put("lzzt", "1");
+                res.put("lrTxdb", matchRes.getString("result"));
+                res.put("msg", "老人照片与证件照匹配度低");
+                return res;
+            }
+        } else {
+            throw new ServiceException("照片不符合规则");
+        }
+        // 当前group中检索相似人脸
+        Map<String, String> searchMap = new LinkedHashMap<>();
+        searchMap.put("image", htStr);
+        searchMap.put("image_type", "BASE64");
+        searchMap.put("group_id_list", SecurityUtils.getAreaCode().substring(0, 6));
+        searchMap.put("match_threshold", ResourceUtil.getConfigByName("baidu.similarity"));
+        JSONObject searchRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/search" +
+                "?access_token=" + token, "POST", JSONObject.toJSONString(searchMap));
+        if (ObjectUtils.isNotEmpty(searchRes) && StringUtils.equals(searchRes.getString("error_msg"), "SUCCESS")) {
+            // 存在相似人脸信息
+            if (searchRes.getJSONObject("result").getJSONArray("user_list").size() > 0) {
+                JSONArray xslr = searchRes.getJSONObject("result").getJSONArray("user_list");
+                res.put("lzzt", "2");
+                res.put("xslrZjhm", xslr.toJSONString());
+                res.put("msg", "存在相似人脸信息");
+                return res;
+            }
+        }
         res.put("lzzt", "3");
 //        res.put("lrTxdb", matchRes.getString("result"));
         res.put("lrTxdb", "89");
@@ -337,28 +355,28 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
     }
 
     private void uploadBaidu(InLnstLrxx lrjbxx) {
-//        if (ObjectUtils.isEmpty(lrjbxx)) {
-//            throw new ServiceException("老人不存在");
-//        }
-//        if (StringUtils.isEmpty(lrjbxx.getLrTx())) {
-//            throw new ServiceException("老人头像数据为空");
-//        }
-//        File file = new File(localFilePath + lrjbxx.getLrTx().replaceFirst("/uploadPath", ""));
-//        if (!file.exists()) {
-//            throw new ServiceException("老人头像不存在");
-//        }
-//        String image = FileUtils.file2Base64(file);
-//        Map<String, String> param = new LinkedHashMap<>();
-//        param.put("image", image);
-//        param.put("image_type", "BASE64");
-//        param.put("group_id", lrjbxx.getCreateAreaCode().substring(0, 6));
-//        param.put("user_id", lrjbxx.getLrJmzjhm());
-//        param.put("action_type", "REPLACE");
-//        JSONObject uploadRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add" +
-//                "?access_token=" + getBaiduToken(), "POST", JSONObject.toJSONString(param));
-//        if (ObjectUtils.isEmpty(uploadRes) || !StringUtils.equals(uploadRes.getString("error_msg"), "SUCCESS")) {
-//            throw new ServiceException("上传到百度人脸库失败");
-//        }
+        if (ObjectUtils.isEmpty(lrjbxx)) {
+            throw new ServiceException("老人不存在");
+        }
+        if (StringUtils.isEmpty(lrjbxx.getLrTx())) {
+            throw new ServiceException("老人头像数据为空");
+        }
+        File file = new File(localFilePath + lrjbxx.getLrTx().replaceFirst("/uploadPath", ""));
+        if (!file.exists()) {
+            throw new ServiceException("老人头像不存在");
+        }
+        String image = FileUtils.file2Base64(file);
+        Map<String, String> param = new LinkedHashMap<>();
+        param.put("image", image);
+        param.put("image_type", "BASE64");
+        param.put("group_id", lrjbxx.getCreateAreaCode().substring(0, 6));
+        param.put("user_id", lrjbxx.getLrJmzjhm());
+        param.put("action_type", "REPLACE");
+        JSONObject uploadRes = httpsRequest("https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add" +
+                "?access_token=" + getBaiduToken(), "POST", JSONObject.toJSONString(param));
+        if (ObjectUtils.isEmpty(uploadRes) || !StringUtils.equals(uploadRes.getString("error_msg"), "SUCCESS")) {
+            throw new ServiceException("上传到百度人脸库失败");
+        }
     }
 
     private String getBaiduToken() {
@@ -432,7 +450,7 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
             List<SysDept> dept = sysDeptJlMapper.selectSysDept(zwywLrJbxx.getLrHjdz());
             SysDeptJl deptJl = sysDeptJlMapper.selectSysDeptJlByCode(zwywLrJbxx.getLrHjdz());
             if (CollectionUtils.isEmpty(dept) || ObjectUtils.isEmpty(deptJl)) {
-                throw new ServiceException("户籍地址错误");
+                throw new ServiceException("该地区暂未开放");
             }
             String deptId = String.valueOf(dept.get(0).getDeptId());
             user.setJgId(IdUtils.simpleUUID());
@@ -474,28 +492,24 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
     @Override
     public int updateZwywLrJbxx(InLnstLrxx zwywLrJbxx)
     {
-        zwywLrJbxx.setLrHjdz(null);
-        InLnstLrxx old = zwywLrJbxxMapper.selectById(zwywLrJbxx.getId());
-        if (ObjectUtils.isNotEmpty(old)) {
-            if (old.getLzzt().equals("0") && StringUtils.equals(zwywLrJbxx.getLzzt(), "3")) {
-                if (StringUtils.isNoneEmpty(zwywLrJbxx.getLrTx())) {
-                    old.setLrTx(zwywLrJbxx.getLrTx());
-                    uploadBaidu(old);
-                }
-            }
-        }
-        if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1") || StringUtils.equals(zwywLrJbxx.getLzzt(), "2")) {
+        if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1") || StringUtils.equals(zwywLrJbxx.getLzzt(), "2")
+                || StringUtils.equals(zwywLrJbxx.getLzzt(), "5") || StringUtils.equals(zwywLrJbxx.getLzzt(), "7")) {
             ZwywJclrShxx shxx = new ZwywJclrShxx();
             BeanUtil.copyProperties(zwywLrJbxx, shxx, new CopyOptions().ignoreNullValue());
             if (StringUtils.equals(zwywLrJbxx.getLzzt(), "1")) {
                 shxx.setSqyy("老人照片与证件照匹配度过低");
-            } else {
+            } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "2")) {
                 shxx.setSqyy("存在相似老人照片");
+            } else if (StringUtils.equals(zwywLrJbxx.getLzzt(), "5")) {
+                shxx.setSqyy("特殊材料待审");
+            } else {
+                shxx.setSqyy("老人待审核");
             }
             shxx.setId(IdUtils.simpleUUID());
             shxx.setLrId(zwywLrJbxx.getId());
             zwywJclrShxxMapper.insert(shxx);
         }
+        zwywLrJbxx.setLrHjdz(null);
         return zwywLrJbxxMapper.updateById(zwywLrJbxx);
     }
 
@@ -723,4 +737,30 @@ public class ZwywLrJbxxServiceImpl implements IZwywLrJbxxService {
         }
         return res;
     }
+
+    private String ylRegister(InLnstLrxx lrxx) {
+        String r = "";
+        TreeMap<String, Object> lr = new TreeMap<>();
+        try {
+            lr.put("memberName", RSAUtils.encryptByPublicKey(lrxx.getLrXm(), ResourceUtil.getConfigByName("yl.enKey")));
+            lr.put("mobileNo", RSAUtils.encryptByPublicKey(lrxx.getLrCydh(), ResourceUtil.getConfigByName("yl.enKey")));
+            lr.put("certNo", RSAUtils.encryptByPublicKey(lrxx.getLrZjhm(), ResourceUtil.getConfigByName("yl.enKey")));
+            lr.put("remark", lrxx.getLrHjdz());
+            lr.put("householdAddress", lrxx.getLrHjbcxx());
+            lr.put("communityName", null);
+            lr.put("streetName", null);
+        } catch (Exception e) {
+            throw new ServiceException(e.getMessage());
+        }
+        TreeMap<String, Object> map = YlServer.publicSupport(ResourceUtil.getConfigByName("yl.hyzc"), null,
+                ResourceUtil.getConfigByName("yl.version"), lr);
+        JSONObject res = YlServer.httpsRequest(YlServer.Map2JSONStr(map));
+        if (res.containsKey("respCode") && StringUtils.equals(res.getString("respCode"), "0000")) {
+            r = res.getString("memberCode");
+        } else {
+//            throw new ServiceException(res.toJSONString());
+            r = "1100302099";
+        }
+        return r;
+    }
 }

Diferenças do arquivo suprimidas por serem muito extensas
+ 36 - 20
ruoyi-modules/mz-lnst/src/main/resources/platform.properties


+ 14 - 1
ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/controller/SysFileController.java

@@ -29,6 +29,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 文件请求处理
@@ -175,8 +177,19 @@ public class SysFileController
         }
     }
 
+    @PostMapping("/uploadMultipleFiles")
+    public List<String> uploadMultipleFiles(@RequestParam("file") List<MultipartFile> files) {
+        List<String> res = new ArrayList<>();
+        for (MultipartFile file : files) {
+            if (ObjectUtils.isNotEmpty(file)) {
+                res.add(uploadFile(file));
+            }
+        }
+        return res;
+    }
+
     @PostMapping("uploadForm")
-    public R<FileForm> uploadForm(@RequestBody FileForm from) {
+    public R<FileForm> uploadForm(FileForm from) {
         FileForm res = new FileForm();
         if (ObjectUtils.isNotEmpty(from.getFile1())) {
             res.setUrl1(uploadFile(from.getFile1()));