Browse Source

add 迁移api

GITZYY 6 months ago
parent
commit
3d4351b991
40 changed files with 5672 additions and 0 deletions
  1. 71 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/WuHanDongYuanCreditService.java
  2. 79 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/WuHanJingChengCreditService.java
  3. 231 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiaMenYiJieZhuDaiCreditService.java
  4. 252 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiangKeDaCreditService.java
  5. 163 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiangRongCreditService.java
  6. 141 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiaoMeiYiRongCreditService.java
  7. 90 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinChuangYinHuiCreditService.java
  8. 100 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinJiangWanHeCreditService.java
  9. 125 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinZheChangZhiCreditService.java
  10. 99 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XingChiCreditService.java
  11. 86 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinkedaiCreditService.java
  12. 177 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinluCreditService.java
  13. 111 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinyidaiCreditService.java
  14. 230 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XuzhoufuliCreditService.java
  15. 210 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XuzhoufuliV2CreditService.java
  16. 142 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XveYiRongCreditService.java
  17. 126 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YangZhouWanKeCreditService.java
  18. 91 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiBangDaiCreditService.java
  19. 127 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiLianRongCreditService.java
  20. 168 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiQiHuaCreditService.java
  21. 231 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiRongCreditService.java
  22. 129 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiRongWangCreditService.java
  23. 74 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiZhanShiShuZhiPingTaiCreditService.java
  24. 103 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YijieCreditService.java
  25. 224 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YinHuaCreditService.java
  26. 341 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YourongCreditService.java
  27. 147 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YuRongFuCreditService.java
  28. 91 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YukuaihuaCreditService.java
  29. 277 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YunHaiLianDongCreditService.java
  30. 81 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/ZhaoZhuangXinYiRongCreditService.java
  31. 124 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/ZhongXinQiFuCreditService.java
  32. 4 0
      egress-gateway-service-infrastructure/pom.xml
  33. 40 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/AESPKCS5Padding.java
  34. 95 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/AESUtilPkcs7.java
  35. 221 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/AesCBCUtil.java
  36. 110 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/SM3Util.java
  37. 268 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/SM4Util.java
  38. 258 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/UserNameUtil.java
  39. 29 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/UserUtils.java
  40. 6 0
      pom.xml

+ 71 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/WuHanDongYuanCreditService.java

@@ -0,0 +1,71 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 11 23 11 30
+ **/
+@Slf4j
+@Service
+public class WuHanDongYuanCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public  ServerCodeEnums  getType() {
+        return ServerCodeEnums.WuHanDongYuan;
+    }
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit WuHanDongYuanCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("武汉东远对接参数:{}", JSON.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck WuHanDongYuanCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, phoneMd5);
+            String response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,phoneMd5, String.class);
+            }catch (Exception e){
+                log.error("武汉东远准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck WuHanDongYuanCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            JSONObject jsonObject=JSONObject.parseObject(response);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getString("code").equals("200")) {
+                return DataVo.success(0, "武汉东远撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "武汉东远撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("武汉东远撞库失败", e);
+            return DataVo.fail(1, "武汉东远撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+}

+ 79 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/WuHanJingChengCreditService.java

@@ -0,0 +1,79 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 04 30 11 29
+ **/
+@Slf4j
+@Service
+public class WuHanJingChengCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.WuHanJingCheng;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String tel;// 手机号md5
+    }
+
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit WuHanJingChengCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("武汉锦城对接参数:{}", JSON.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setTel(phoneMd5);
+            String url = config.getString("checkUrl");
+            String checkUrl = url + "/" + config.getString("company") + "/" + config.getString("source");
+            log.info("credit qualityCheck WuHanJingChengCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, phoneMd5);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(checkUrl, checkInfo, String.class);
+            } catch (Exception e) {
+                log.error("武汉锦城准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck WuHanJingChengCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject jsonObject = JSONObject.parseObject(response);
+            if (jsonObject.getString("code").equals("1")) {
+                return DataVo.success(0, "武汉锦城撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "武汉锦城撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            return DataVo.fail(1, "武汉锦城撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+}

+ 231 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiaMenYiJieZhuDaiCreditService.java

@@ -0,0 +1,231 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.MessageDigest;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 09 25 15 22
+ * 厦门易捷助代API
+ **/
+@Slf4j
+@Service
+public class XiaMenYiJieZhuDaiCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.XiaMenYiJieZhuDai;
+    }
+
+
+    @Data
+    private static class CheckInfo{
+        private String mobile;//md5 的手机号
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XiaMenYiJieZhuDaiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("厦门易捷助代对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            checkInfo.setMobile(phoneMd5);
+            String url = config.getString("checkUrl");
+            String appid = config.getString("appid");
+            long timestamp = System.currentTimeMillis() / 1000;
+            String t = String.valueOf(timestamp);
+            String k = config.getString("key");
+            String sign = generateHash(appid, t, k);
+
+            log.info("credit qualityCheck XiaMenYiJieZhuDaiCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try{
+                Map<String, String> head = new HashMap<>();
+                head.put("Content-Type", "application/json");
+                head.put("appid",appid);
+                head.put("t", t);
+                head.put("sign", sign);
+                HttpResponse httpResponse = httpRestTemplate.restTemplate().postForObject(url, null, null, head, null, JSONObject.toJSONString(checkInfo));
+                response = EntityUtils.toString(httpResponse.getEntity());
+            }catch (Exception e){
+                log.error("厦门易捷助代准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XiaMenYiJieZhuDaiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            JSONObject jsonObject=JSONObject.parseObject(response);
+
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getInteger("code") == 200) {
+                return DataVo.success(0, "厦门易捷助代撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "厦门易捷助代撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("厦门易捷助代撞库失败", e);
+            return DataVo.fail(1, "厦门易捷助代撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    public static String encrypt(String data, String key, String ivStr) {
+        try {
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+            SecretKeySpec keySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
+            IvParameterSpec ivSpec = new IvParameterSpec(ivStr.getBytes("UTF-8"));
+            cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
+            byte[] encrypted = cipher.doFinal(data.getBytes("UTF-8"));
+
+            return java.util.Base64.getEncoder().encodeToString(encrypted);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+    //加密算法
+    public static class AesUtils {
+
+        /**
+         * ECB
+         */
+        /*** 加密 * @param sSrc 加密内容 * @param sKey 加密 key * @return * @throws Exception */
+        public static String Encrypt(String sSrc, String sKey) throws Exception {
+            if (sKey == null) {
+                System.out.print("Key 为空 null");
+                return null;
+            }// 判断 Key 是否为 16 位
+            if (sKey.length() != 16) {
+                System.out.print("Key 长度不是 16 位");
+                return null;
+            }
+            byte[] raw = sKey.getBytes("utf-8");
+            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); // "算法/模式/补码方式"
+            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+            cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+            byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8")); // 此处使用 BASE64 做转码功能,同时能起到 2 次加密的作用。
+            return Base64.encodeBase64String(encrypted);
+        }
+
+        /**
+         * sha1
+         * @param message
+         * @return
+         */
+        public static String  sha1(String message){
+            return DigestUtils.sha1Hex(message.getBytes());
+        }
+
+
+        /**
+         * 0填充
+         * @param data
+         * @param key
+         * @param ivStr
+         * @return
+         */
+        //加密
+        public static String encryptCBC2(String data, String key,String ivStr) {
+            String ivString = ivStr;
+            //偏移量
+            byte[] iv = ivString.getBytes();
+            try {
+                Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+                int blockSize = cipher.getBlockSize();
+                byte[] dataBytes = data.getBytes();
+                int length = dataBytes.length;
+                //计算需填充长度
+                if (length % blockSize != 0) {
+                    length = length + (blockSize - (length % blockSize));
+                }
+                byte[] plaintext = new byte[length];
+                //填充
+                System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
+                SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
+                //设置偏移量参数
+                IvParameterSpec ivSpec = new IvParameterSpec(iv);
+                cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
+                byte[] encryped = cipher.doFinal(plaintext);
+
+                return Base64.encodeBase64String(encryped);
+
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        }
+    }
+
+    public static String generateHash(String appId, String timestamp, String privateKey) throws Exception {
+        String hashString = appId + timestamp;
+        // 计算 SHA-1 hash
+        MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
+        byte[] hashedBytes = sha1.digest(hashString.getBytes("UTF-8"));
+        // 将 SHA-1 hash 转为 hex 字符串
+        StringBuffer hexStringBuffer = new StringBuffer();
+        for (int i = 0; i < hashedBytes.length; i++) {
+            String hex = Integer.toHexString(0xff & hashedBytes[i]);
+            if (hex.length() == 1) hexStringBuffer.append('0');
+            hexStringBuffer.append(hex);
+        }
+        String sha1HexString = hexStringBuffer.toString();
+
+        // 计算 MD5 hash
+        hashString = sha1HexString + privateKey;
+        MessageDigest md5 = MessageDigest.getInstance("MD5");
+        hashedBytes = md5.digest(hashString.getBytes("UTF-8"));
+
+        // 将 MD5 hash 转为 hex 字符串
+        hexStringBuffer = new StringBuffer();
+        for (int i = 0; i < hashedBytes.length; i++) {
+            String hex = Integer.toHexString(0xff & hashedBytes[i]);
+            if (hex.length() == 1) hexStringBuffer.append('0');
+            hexStringBuffer.append(hex);
+        }
+        return hexStringBuffer.toString();
+    }
+}

+ 252 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiangKeDaCreditService.java

@@ -0,0 +1,252 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import java.io.ByteArrayOutputStream;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+
+
+/**
+ * @Descrption
+ * @Author: zhangyy
+ * @Date: 2023/5/8
+ * @Version V1.0
+ **/
+@Service
+@Slf4j
+public class XiangKeDaCreditService implements LoanDockingApi {
+
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.CRM_XKD;
+    }
+
+
+    @Data
+    private static class CredentialStuffingDto {
+        private Integer companyId;
+
+        private String customerPhone;
+    }
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return {"url":"http://apitest.shlyxxjs.com","key":"fluxZhudai*_key","tenantId":"1405729496904110081","trafficPlatformId":"13872425018351111"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            // 同业买量数据适配
+            if(userInfo.getUserMobile() == null && userInfo.getPhoneMd5() != null){
+                return qualityCheck(userInfo.getPhoneMd5(), product);
+            }
+            log.info("credit XiangKeDaCreditService qualityCheck begin...userId:{},productId={}", userInfo.getUserId(), product.getPlanId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            if (StringUtils.isBlank(configJson)) {
+                return qualityCheck(userInfo.getPhoneMd5(), product);
+            }
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("享客达对接参数:{}", JSON.toJSONString(config));
+            CredentialStuffingDto dto = new CredentialStuffingDto();
+            dto.setCompanyId(config.getInteger("companyId"));
+            String param = AesUtil.publicEncrypt(userInfo.getUserMobile(), config.getString("publicKey"));
+            dto.setCustomerPhone(Md5Util.encoderByMd5(param));
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck XiangKeDaCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, JSON.toJSONString(dto));
+            String response = null;
+            try {
+//                + MSDSUtils.MD5.EncoderByMd5(param)
+                response = httpRestTemplate.restTemplate().postForObject(url, dto, String.class);
+            } catch (Exception e) {
+                log.error("【{}】-享客达惠准入异常,异常信息:{}", product.getPlanName(), e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XiangKeDaCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject res = JSONObject.parseObject(response);
+            if (res.getInteger("code") == 0 && res.getBoolean("data")) {
+                return DataVo.success(0, "【" + product.getPlanName() + "】-享客达撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(res.getString("msg"), product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("【{}】-享客达撞库失败", product.getPlanName(), e);
+            return DataVo.fail(1, "享客达撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    public DataVo qualityCheck(String md5Phone, PlanDto product) {
+        try {
+            log.info("credit XiangKeDaCreditService qualityCheck begin...md5Phone:{},productId={}", md5Phone, product.getPlanId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            if (StringUtils.isBlank(configJson)) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("享客达对接参数:{}", JSON.toJSONString(config));
+            CredentialStuffingDto dto = new CredentialStuffingDto();
+            dto.setCompanyId(config.getInteger("companyId"));
+            dto.setCustomerPhone(md5Phone);
+            String url = config.getString("checkUrl");
+
+            log.info("credit qualityCheck XiangKeDaCreditService request md5Phone:{}, url:{}, CheckInfo:{}", md5Phone, url, JSON.toJSONString(dto));
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, dto, String.class);
+            } catch (Exception e) {
+                log.error("【{}】-享客达准入异常,异常信息:{}", product.getPlanName(), e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XiangKeDaCreditService response md5Phone:{}, result:{}", md5Phone, response);
+            JSONObject res = JSONObject.parseObject(response);
+            if (res.getInteger("code") == 0 && res.getBoolean("data")) {
+                return DataVo.success(0, "【" + product.getPlanName() + "】-享客达撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(res.getString("msg"), product.getPlanName());
+            }
+        } catch (Exception e) {
+            log.error("【{}】-享客达撞库失败", product.getPlanName(), e);
+            return DataVo.fail(1, "享客达撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    public static class AesUtil {
+
+        // 算法类别
+        public static final String RSA_ALGORITHM = "RSA";
+        public static final String CHARSET = "UTF-8";
+        // 算法位数
+        private final static Integer KEY_SIZE = 2048;
+
+
+        /*
+         * 得到私钥
+         * @param privateKey 密钥字符串(经过base64编码)
+         * @throws Exception
+         */
+        public static RSAPrivateKey getPrivateKey(String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+            //通过PKCS#8编码的Key指令获得私钥对象
+            KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+            PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey));
+            RSAPrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
+            return key;
+        }
+
+        /**
+         * 得到公钥
+         *
+         * @param publicKey 密钥字符串(经过base64编码)
+         * @throws Exception
+         */
+        public static RSAPublicKey getPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+            //通过X509编码的Key指令获得公钥对象
+            KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+            X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
+            RSAPublicKey key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
+            return key;
+        }
+
+
+        /*
+         * 公钥加密
+         * @param data
+         * @param publicKey
+         * @return
+         */
+        public static String publicEncrypt(String data, String publicString) {
+            try {
+                RSAPublicKey publicKey = getPublicKey(publicString);
+                Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
+                cipher.init(Cipher.ENCRYPT_MODE, publicKey);
+                return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), publicKey.getModulus().bitLength()));
+            } catch (Exception e) {
+                throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        //rsa切割解码  , ENCRYPT_MODE 加密数据   ,DECRYPT_MODE 解密数据
+        private static byte[] rsaSplitCodec(Cipher cipher, int opmode, byte[] datas, int keySize) {
+            int maxBlock = 0;  //最大块
+            if (opmode == Cipher.DECRYPT_MODE) {
+                maxBlock = keySize / 8;
+            } else {
+                maxBlock = keySize / 8 - 11;
+            }
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            int offSet = 0;
+            byte[] buff;
+            int i = 0;
+            try {
+                while (datas.length > offSet) {
+                    if (datas.length - offSet > maxBlock) {
+                        //可以调用以下的doFinal()方法完成加密或解密数据:
+                        buff = cipher.doFinal(datas, offSet, maxBlock);
+                    } else {
+                        buff = cipher.doFinal(datas, offSet, datas.length - offSet);
+                    }
+                    out.write(buff, 0, buff.length);
+                    i++;
+                    offSet = i * maxBlock;
+                }
+            } catch (Exception e) {
+                throw new RuntimeException("加解密阀值为[" + maxBlock + "]的数据时发生异常", e);
+            }
+            byte[] resultDatas = out.toByteArray();
+            IOUtils.closeQuietly(out);
+            return resultDatas;
+        }
+
+        /*
+         * 解密
+         * */
+        public static String privateDecrypt(String data, String privateString) {
+            try {
+                RSAPrivateKey privateKey = getPrivateKey(privateString);
+                Cipher cipher = Cipher.getInstance("RSA");
+                cipher.init(Cipher.DECRYPT_MODE, privateKey);
+                return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), privateKey.getModulus().bitLength()), "UTF-8");
+            } catch (Exception e) {
+                throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
+            }
+        }
+    }
+
+
+}

+ 163 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiangRongCreditService.java

@@ -0,0 +1,163 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * 壹融API接单
+ */
+@Service
+@Slf4j
+public class XiangRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.XiangRong;
+    }
+
+
+    @Data
+    private static class CheckInfo {
+        private String mobile;
+        private String file_id;
+        private String channelSource;
+    }
+
+    @Data
+    private static class ResultHt {
+        private String code;
+        private String data;
+        private String msg;
+    }
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit xiangrongCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setMobile(userInfo.getPhoneMd5());
+            checkInfo.setFile_id(config.getString("fileId"));
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck xiangrongCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, checkInfo, String.class);
+                log.info("fanhui");
+            } catch (Exception e) {
+                log.error("宁波享融准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck xiangrongCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            JSONObject jsonObject = JSON.parseObject(response);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.get("code").equals("0")) {
+                return DataVo.success(0, "宁波享融撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "宁波享融撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("宁波古可撞库失败", e);
+            return DataVo.fail(1, "宁波享融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+
+    private static class ApiAesUtil {
+        //AES/128/ECB
+        private static final String AES = "AES";
+        private static final String SP = "SHA1PRNG";
+        private static final String CHARACTER = "utf-8";
+        private static final String ALGO = "AES/ECB/PKCS5Padding"; // 使用AES算法,ECB模式,PKCS5Padding填充
+
+        public static String decrypt(String sSrc, String sKey) {
+            try {
+                // 判断Key是否正确
+                if (sKey == null) {
+                    log.error("Key为空null");
+                    return null;
+                }
+                // 判断Key是否为16位
+                if (sKey.length() != 16) {
+                    log.error("Key长度不是16位");
+                    return null;
+                }
+                byte[] raw = sKey.getBytes("utf-8");
+                SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+                Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+                cipher.init(Cipher.DECRYPT_MODE, skeySpec);
+                byte[] encrypted1 = new Base64().decode(sSrc);//先用base64解密
+                try {
+                    byte[] original = cipher.doFinal(encrypted1);
+                    String originalString = new String(original, "utf-8");
+                    return originalString;
+                } catch (Exception e) {
+                    System.out.println(e.toString());
+                    return null;
+                }
+            } catch (Exception ex) {
+                System.out.println(ex.toString());
+                return null;
+            }
+        }
+
+        public static String encrypt(String sSrc, String sKey) {
+            try {
+                if (sKey == null) {
+                    log.error("Key为空null");
+                    return null;
+                }
+                // 判断Key是否为16位
+                if (sKey.length() != 16) {
+                    log.error("Key长度不是16位");
+                    return null;
+                }
+                byte[] raw = sKey.getBytes("utf-8");
+                SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+                Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
+                cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+                byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
+
+                return new Base64().encodeToString(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。
+            } catch (Exception e) {
+                log.error("加密失败{}", e.getMessage());
+                return null;
+            }
+        }
+
+    }
+
+}

+ 141 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XiaoMeiYiRongCreditService.java

@@ -0,0 +1,141 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 12 04 14 51
+ **/
+@Slf4j
+@Service
+public class XiaoMeiYiRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.XiaoMeiYiRong;
+    }
+
+    @Data
+    private static class RequestDate {
+        private String data;
+        private Integer providerAPIId;
+        private Integer encryptType;
+    }
+    @Data
+    private static class CheckInfo {
+        private String telMD5;
+    }
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XiaoMeiYiRongCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("小美易融对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo=new CheckInfo();
+            checkInfo.setTelMD5( userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5());
+            RequestDate requestDate=new RequestDate();
+            requestDate.setData(AESUtil.encrypt(JSON.toJSONString(checkInfo),config.getString("publicKey")));
+            requestDate.setProviderAPIId(config.getInteger("apiId"));
+            requestDate.setEncryptType(1);
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck XiaoMeiYiRongCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, requestDate);
+            JsonNode jsonNode = null;
+            try {
+
+                HttpHeaders headers = new HttpHeaders();
+                headers.set("Content-Type","application/json");
+                headers.set("User-Agent","Apifox/1.0.0 (https://apifox.com)");
+                HttpEntity<String> requestEntity = new HttpEntity<>(JSONObject.toJSONString(checkInfo), headers);
+                httpRestTemplate.restTemplate().postForEntity(url, checkInfo, String.class);
+
+//                okhttp3.OkHttpClient client = new OkHttpClient().newBuilder()
+//                        .build();
+//                okhttp3.MediaType mediaType = MediaType.parse("application/json");
+//                RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(requestDate));
+//                Request request = new Request.Builder()
+//                        .url(url)
+//                        .method("POST", body)
+//                        .addHeader("", )
+//                        .addHeader("Content-Type", "application/json")
+//                        .build();
+//                Response execute = client.newCall(request).execute();
+                String responseBody = requestEntity.getBody();
+                log.info("小美易融 =======================>{}",JSONObject.parseObject(responseBody));
+                ObjectMapper objectMapper = new ObjectMapper();
+                // 解析JSON字符串
+                jsonNode = objectMapper.readTree(responseBody);
+            } catch (Exception e) {
+                log.error("小美易融准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XiaoMeiYiRongCreditService response userId:{}, result:{}", userInfo.getUserId(), jsonNode);
+            if (jsonNode == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonNode.get("code").intValue()==0) {
+                return DataVo.success(0, "小美易融撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "小美易融撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("小美易融撞库失败", e);
+            return DataVo.fail(1, "小美易融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+
+
+    public static class AESUtil {
+
+        public static final String AES = "AES";
+
+        private static final String ALGORITHMSTR = "AES/ECB/PKCS7Padding";
+
+
+        /**
+         * encrypt input text
+         *
+         * @param input
+         * @param key
+         * @return
+         * @throws Exception
+         */
+        public static String encrypt(String input, String key) throws Exception {
+
+            SecretKeySpec skey = new SecretKeySpec(key.getBytes(), AES);
+            Cipher cipher = Cipher.getInstance(ALGORITHMSTR);
+            cipher.init(Cipher.ENCRYPT_MODE, skey);
+            byte[] crypted = cipher.doFinal(input.getBytes("UTF8"));
+
+            return new String(Base64.encodeBase64(crypted));
+        }
+    }
+}

+ 90 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinChuangYinHuiCreditService.java

@@ -0,0 +1,90 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 07 09 17 03
+ **/
+@Slf4j
+@Service
+public class XinChuangYinHuiCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.XinChuangYinHui;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String phoneMd5;// 手机号md5
+        private String channelCode;//渠道编号
+        private String city;//城市
+    }
+
+    @Override
+    @Async("selfExecutor")
+    public DataVo  qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XinChuangYinHuiCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("信创对接参数:{}", JSON.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            JSONObject json = new JSONObject();
+            json.put("phoneMd5", phoneMd5);
+            json.put("channelCode", config.getString("channelCode"));
+            json.put("city", userInfo.getCityOfWork());
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck XinChuangYinHuiCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, phoneMd5);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, json, String.class);
+            } catch (Exception e) {
+                log.error("信创准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XinChuangYinHuiCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject jsonObject = JSONObject.parseObject(response);
+
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
+            if (jsonObject.getInteger("code") == 0 && data.getInteger("status") == 0) {
+                return DataVo.success(0, "信创撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "信创撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("信创撞库失败", e);
+            return DataVo.fail(1, "信创撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+
+}

+ 100 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinJiangWanHeCreditService.java

@@ -0,0 +1,100 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.stereotype.Component;
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 04 19 13 45
+ **/
+@Slf4j
+@Component
+public class XinJiangWanHeCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.XinJiangWanHeCreditService;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String name;// 客户手机号md5
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XinJiangWanHeCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("新疆万合对接参数:{}", JSON.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setName(phoneMd5);
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck XinJiangWanHeCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, phoneMd5);
+            String response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,checkInfo, String.class);
+            }catch (Exception e){
+                log.error("新疆万合准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XinJiangWanHeCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            JSONObject jsonObject=JSONObject.parseObject(response);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getString("code").equals("1")) {
+                return DataVo.success(0, "新疆万合撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "新疆万合撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("新疆万合撞库失败", e);
+            return DataVo.fail(1, "新疆万合撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    public static String encrypt(String sSrc, String sKey) throws Exception {
+        if (sKey == null) {
+            System.out.print("Key为空null");
+            return null;
+        }
+        if (sKey.length() != 16) {
+            System.out.print("Key长度不是16位");
+            return null;
+        }
+        byte[] raw = sKey.getBytes("utf-8");
+        SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
+        cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+        byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
+
+        return Base64.encodeBase64String(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。
+    }
+}

+ 125 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinZheChangZhiCreditService.java

@@ -0,0 +1,125 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+/**
+ * @Author zjc
+ * @Date 2024 08 29 11 08
+ **/
+@Slf4j
+@Service
+public class XinZheChangZhiCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.XingZheChangZhi;
+    }
+
+    //撞库
+    @Data
+    private static class CheckInfo {
+        private String phone;//md5 的手机号
+
+    }
+
+    @Data
+    private static class RquestParam {
+        private String data;
+
+    }
+
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XingZheChangZhiCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("行者常至对接参数:{}", JSON.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setPhone(phoneMd5);
+            RquestParam requestParam=new RquestParam();
+            requestParam.setData(encrypt(JSON.toJSONString(checkInfo),config.getString("key"),config.getString("iv")));
+
+            String secretKey = config.getString("secretKey");
+            String jsonString = JSON.toJSONString(requestParam);
+            String sign = Md5Util.encoderByMd5(jsonString.concat(secretKey)).toLowerCase();
+            log.info("行者常至请求参数:sign:{},requestParam:{},checkInfoJson:{}",sign,jsonString,JSON.toJSONString(checkInfo));
+            String url = config.getString("checkUrl");
+            String appid=config.getString("appid");
+            url=url+"?appid="+appid+"&sign="+sign;
+            log.info("credit qualityCheck XingZheChangZhiCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, phoneMd5);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, requestParam, String.class);
+            } catch (Exception e) {
+                log.error("行者常至准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XingZheChangZhiCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject jsonObject = JSONObject.parseObject(response);
+            if (jsonObject == null || StringUtils.isBlank(jsonObject.getString("data"))) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            String data = jsonObject.getString("data");
+            JSONObject jsonData = JSONObject.parseObject(data);
+            if (jsonObject.getString("code").equals("200") && "0".equals(jsonData.getString("status"))) {
+                return DataVo.success(0, "行者常至撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "行者常至撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("行者常至撞库失败", e);
+            return DataVo.fail(1, "行者常至撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    public static String encrypt(String plainText, String key, String iv) throws Exception {
+        // 将 key 转换为 SecretKey 对象
+        SecretKey secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        // 将 IV 字符串转换为字节数组
+        byte[] ivBytes = iv.getBytes(StandardCharsets.UTF_8);
+        // 生成 IV
+        // 创建 Cipher 对象
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(ivBytes));
+        // 加密明文
+        byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
+        // 将加密后的字节转换为 Base64 编码
+        return Base64.getEncoder().encodeToString(encryptedBytes);
+    }
+}
+
+
+
+

+ 99 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XingChiCreditService.java

@@ -0,0 +1,99 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 04 25 15 50
+ **/
+@Slf4j
+@Service
+public class XingChiCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.XingChi;
+    }
+
+
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XingChiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("星驰对接参数:{}", JSON.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            String url = config.getString("checkUrl");
+            String checkurl = url+"?mobileMD5="+phoneMd5;
+            log.info("credit qualityCheck XingChiCreditService request userId:{}, url:{}, checkData:{}",userInfo.getUserId(), url,checkurl);
+            JSONObject response = null;
+            try{
+                Map<String, String> head = new HashMap<>();
+                head.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+                HttpResponse httpResponse = httpRestTemplate.restTemplate().getForObject(url, null, null, head, null);
+                String responseStr = EntityUtils.toString(httpResponse.getEntity());
+                response = JSONObject.parseObject(responseStr);
+            }catch (Exception e){
+                log.error("星驰准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XingChiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (response.getString("code").equals("200")) {
+                return DataVo.success(0, "星驰撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "星驰撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            return DataVo.fail(1, "星驰撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+    public static String encrypt(String plainText, String key, String iv) throws Exception {
+        // 将 key 转换为 SecretKey 对象
+        SecretKey secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        // 将 IV 字符串转换为字节数组
+        byte[] ivBytes = iv.getBytes(StandardCharsets.UTF_8);
+        // 生成 IV
+        // 创建 Cipher 对象
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(ivBytes));
+        // 加密明文
+        byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
+        // 将加密后的字节转换为 Base64 编码
+        return Base64.getEncoder().encodeToString(encryptedBytes);
+    }
+
+
+}

+ 86 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinkedaiCreditService.java

@@ -0,0 +1,86 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.*;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import javax.annotation.Resource;
+
+/**
+ * 欣客贷API接单
+ */
+@Service
+@Slf4j
+public class XinkedaiCreditService implements LoanDockingApi {
+    private final String qualityCheckPath = "/admin/pushApi/check_mobile";
+    private final String applyPath = "/admin/pushApi/import_tttg";
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.Xinkedai;
+    }
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *  {"url":"http://121.40.173.17:8811"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XingkedaiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+//            XdProductJointConfig xdProductJointConfig = xdProductJointConfigMapper.selectById(product.getJointType());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("欣客贷对接参数:{}", JSON.toJSONString(config));
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+            MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            params.add("mobile", phoneMd5);
+            String url = config.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck XingkedaiCreditService request userId:{}, url:{}, params:{}",userInfo.getUserId(), url, JSON.toJSONString(params));
+            ResponseEntity<String> response = null;
+            try{
+                HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
+                response = httpRestTemplate.restTemplate().postForEntity(url, requestEntity, String.class);
+            }catch (Exception e){
+                log.error("欣客贷准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XingkedaiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null || response.getStatusCode()!= HttpStatus.OK) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return JSON.parseObject(response.getBody()).getInteger("code") ==0 ? DataVo.success(0, "欣客贷撞库成功", product.getPlanId())
+                    : DataVo.fail("撞库失败", product.getPlanId());
+
+        } catch (Exception e) {
+            log.error("欣客贷撞库失败", e);
+            return DataVo.fail(1, "欣客贷撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+}

+ 177 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinluCreditService.java

@@ -0,0 +1,177 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+import java.util.*;
+
+/**
+ * 鑫鹿API接单
+ */
+@Service
+@Slf4j
+public class XinluCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.CRM_XL;
+    }
+
+    @Data
+    public static class CheckData{
+        private String tenantId;
+        private Integer type;
+        private String phone;
+    }
+
+    @Data
+    private static class ResultHt{
+        private Integer code;
+        private String msg;
+        private JSONObject data;
+    }
+
+    @Data
+    private static class ApplyData{
+        String data;
+        String sign;
+        String platformId;
+        String tenantId;
+    }
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *  {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XinluCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject xinluJointDTO = JSONObject.parseObject(configJson);
+            log.info("鑫鹿对接参数:{}", JSONObject.toJSONString(xinluJointDTO));
+            String url = xinluJointDTO.getString("url");
+            CheckData checkData = new CheckData();
+            checkData.setPhone(userInfo.getPhoneMd5());
+            checkData.setType(2);
+            checkData.setTenantId(xinluJointDTO.getString("tenantId"));
+            String requestJson = JSON.toJSONString(checkData);
+            log.info("credit qualityCheck XinluCreditService request userId:{}, url:{},requestParam",userInfo.getUserId(), url,requestJson);
+            ResultHt response = null;
+            try{
+                Map<String, String> head = new HashMap<>();
+                head.put("Content-Type", "application/json");
+                HttpResponse httpResponse = httpRestTemplate.restTemplate().postForObject(url, null, null, head, null,requestJson );
+                String responseStr = EntityUtils.toString(httpResponse.getEntity());
+                response = JSONObject.parseObject(responseStr,ResultHt.class);
+            }catch (Exception e){
+                log.error("鑫鹿准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XinluCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals(200, response.getCode()) ? DataVo.success(0, "鑫鹿撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMsg(), product.getPlanId());
+        } catch (Exception e) {
+            log.error("鑫鹿撞库失败", e);
+            return DataVo.fail(1, "鑫鹿撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+
+
+    public static class AesUtil {
+
+        /**
+         * 默认的字符编码
+         */
+        private static final String DEFAULT_CHARSET = "utf-8";
+        /**
+         * 算法/模式/填充
+         **/
+        private static final String CipherMode = "AES/ECB/PKCS5Padding";
+        /**
+         * 算法
+         */
+        private static String ALGORITHM = "AES";
+
+        /**
+         * 解密AES 32位
+         *
+         * @param sSrc      解密的内容
+         * @param secretKey 秘钥
+         * @return 解密后的明文 数据
+         */
+        public static String decrypt(String sSrc, String secretKey) {
+
+            if (secretKey == null) {
+
+                return null;
+            }
+            try {
+                byte[] raw = secretKey.getBytes(DEFAULT_CHARSET);
+                SecretKeySpec secretKeySpec = new SecretKeySpec(raw, ALGORITHM);
+                Cipher cipher = Cipher.getInstance(CipherMode);
+                cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
+                // 先用base64解密
+                byte[] encryptedArr = Base64.getDecoder().decode(sSrc);
+                byte[] original = cipher.doFinal(encryptedArr);
+                return new String(original, DEFAULT_CHARSET);
+            } catch (Exception ex) {
+                return null;
+            }
+        }
+
+
+        /**
+         * 加密32位
+         *
+         * @param sSrc 需要加密的内容
+         * @param sKey 秘钥
+         * @return 加密的内容
+         */
+        public static String encrypt(String sSrc, String sKey) {
+            if (sKey == null) {
+                return null;
+            }
+            try {
+                byte[] raw = sKey.getBytes(DEFAULT_CHARSET);
+                SecretKeySpec skeySpec = new SecretKeySpec(raw, ALGORITHM);
+                Cipher cipher = Cipher.getInstance(CipherMode);
+                cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+                byte[] encrypted = cipher.doFinal(sSrc.getBytes(DEFAULT_CHARSET));
+
+                return Base64.getEncoder().encodeToString(encrypted);
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                return null;
+            }
+        }
+    }
+}

+ 111 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XinyidaiCreditService.java

@@ -0,0 +1,111 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * 信易贷API接单
+ */
+@Service
+@Slf4j
+public class XinyidaiCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    private final String qualityCheckPath = "/api/customer/md5check";
+
+    private final String applyPath = "/api/customer/add";
+    @Value("${spring.profiles.active}")
+    private String activeProfile;
+
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.Xinyidai;
+    }
+
+
+    @Data
+    public static class CheckData{
+        private String mobile_md5;
+        private String city;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String client_id;
+
+        private String client_secret;
+
+        private CheckData data;
+
+
+    }
+    @Data
+    private static class ResultHt{
+        private Integer code;
+        private String message;
+    }
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *  {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XinyidaiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+//            XdProductJointConfig xdProductJointConfig = xdProductJointConfigMapper.selectById(product.getJointType());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject xinyidaiJointDTO = JSON.parseObject(configJson);
+            log.info("信易贷对接参数:{}", JSON.toJSONString(xinyidaiJointDTO));
+            String url = xinyidaiJointDTO.getString("url") + qualityCheckPath+"?md5=" +userInfo.getPhoneMd5() ;
+            log.info("credit qualityCheck XinyidaiCreditService request userId:{}, url:{}",userInfo.getUserId(), url);
+            ResultHt response = null;
+            try{
+                Map<String, String> head = new HashMap<>();
+                head.put("Content-Type", "application/x-www-form-urlencoded");
+                HttpResponse httpResponse = httpRestTemplate.restTemplate().postForObject(url, null, null, head, null, "");
+                String responseStr = EntityUtils.toString(httpResponse.getEntity());
+                response = JSONObject.parseObject(responseStr,ResultHt.class);
+            }catch (Exception e){
+                log.error("信易贷准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XinyidaiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals(12, response.getCode()) ? DataVo.success(0, "信易贷撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMessage(), product.getPlanId());
+        } catch (Exception e) {
+            log.error("信易贷撞库失败", e);
+            return DataVo.fail(1, "信易贷撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+}

+ 230 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XuzhoufuliCreditService.java

@@ -0,0 +1,230 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.*;
+
+/**
+ * 徐州富力API接单
+ */
+@Service
+@Slf4j
+public class XuzhoufuliCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    private final String qualityCheckPath = "/checkPhone";
+
+    private final String applyPath = "/push";
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.Xuzhoufuli;
+    }
+
+    @Data
+    public static class CheckData{
+        private String merNo;
+        private String params;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String phoneMd5;
+
+        private String sign;
+
+
+    }
+    @Data
+    private static class ResultHt{
+        private String code;
+        private String message;
+    }
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *  {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XuzhoufuliCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+//            XdProductJointConfig xdProductJointConfig = xdProductJointConfigMapper.selectById(product.getJointType());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject xuzhoufuliJointDTO = JSON.parseObject(configJson);
+            log.info("徐州富力对接参数:{}", JSON.toJSONString(xuzhoufuliJointDTO));
+
+            String phoneMd5 = userInfo.getPhoneMd5();
+            TreeMap<String, Object> paramMap = new TreeMap<>();
+            paramMap.put("phoneMd5", phoneMd5);
+            String paramString = mapToURL(paramMap);
+            String signKey = xuzhoufuliJointDTO.getString("signKey");
+            String signValue = paramString + "&key=" + signKey;
+            String sign = Md5Util.encoderByMd5(signValue);
+
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setSign(sign);
+            checkInfo.setPhoneMd5(phoneMd5);
+            CheckData data = new CheckData();
+            data.setMerNo(xuzhoufuliJointDTO.getString("merNo") );
+            String params = AesUtil.encrypt(JSON.toJSONString(checkInfo), xuzhoufuliJointDTO.getString("encKey"));
+            data.setParams(params);
+            String url = xuzhoufuliJointDTO.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck XuzhoufuliCreditService request userId:{}, url:{}, data:{}",userInfo.getUserId(), url, data);
+            ResultHt response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,data, ResultHt.class);
+            }catch (Exception e){
+                log.error("徐州富力准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XuzhoufuliCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals("200", response.getCode()) ? DataVo.success(0, "徐州富力撞库成功", product.getPlanId())
+                    :DataVo.fail(response.getMessage(), product.getPlanId());
+        } catch (Exception e) {
+            log.error("徐州富力撞库失败", e);
+            return DataVo.fail(1, "徐州富力撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+
+    public String mapToURL(Map<String, Object> paramMap) {
+        StringBuffer sb = new StringBuffer();
+        List<String> keySet = new ArrayList<String>(paramMap.keySet());
+        Collections.sort(keySet);
+        for (int i = 0; i < paramMap.size(); i++) {
+            sb.append("&").append(keySet.get(i)).append("=").append(
+                    paramMap.get(keySet.get(i)));
+        }
+        sb.delete(0, 1);
+        return sb.toString();
+    }
+
+    public static class AesUtil {
+
+        /**
+         * 默认的字符编码
+         */
+        private static final String DEFAULT_CHARSET = "utf-8";
+        /**
+         * 算法/模式/填充
+         **/
+        private static final String CipherMode = "AES/ECB/PKCS5Padding";
+        /**
+         * 算法
+         */
+        private static String ALGORITHM = "AES";
+
+        /**
+         * 解密AES 32位
+         *
+         * @param sSrc      解密的内容
+         * @param secretKey 秘钥
+         * @return 解密后的明文 数据
+         */
+        public static String decrypt(String sSrc, String secretKey) {
+
+            if (secretKey == null) {
+
+                return null;
+            }
+            try {
+                byte[] raw = secretKey.getBytes(DEFAULT_CHARSET);
+                SecretKeySpec secretKeySpec = new SecretKeySpec(raw, ALGORITHM);
+                Cipher cipher = Cipher.getInstance(CipherMode);
+                cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
+                // 先用base64解密
+                byte[] encryptedArr = Base64.getDecoder().decode(sSrc);
+                byte[] original = cipher.doFinal(encryptedArr);
+                return new String(original, DEFAULT_CHARSET);
+            } catch (Exception ex) {
+                return null;
+            }
+        }
+
+
+        /**
+         * 加密32位
+         *
+         * @param sSrc 需要加密的内容
+         * @param sKey 秘钥
+         * @return 加密的内容
+         */
+        public static String encrypt(String sSrc, String sKey) {
+            SecretKeySpec keySpec = null;
+            try {
+                keySpec = new SecretKeySpec(sKey.getBytes("UTF-8"), "AES");
+                Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+                cipher.init(Cipher.ENCRYPT_MODE, keySpec);
+                byte[] bytes = cipher.doFinal(sSrc.getBytes("utf-8"));
+                return parseByte2HexStr(bytes);
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            } catch (NoSuchPaddingException e) {
+                e.printStackTrace();
+            } catch (IllegalBlockSizeException e) {
+                e.printStackTrace();
+            } catch (NoSuchAlgorithmException e) {
+                e.printStackTrace();
+            } catch (BadPaddingException e) {
+                e.printStackTrace();
+            } catch (InvalidKeyException e) {
+                e.printStackTrace();
+            }
+            return null;
+        }
+
+        private static String parseByte2HexStr(byte[] buf) {
+            StringBuffer sb = new StringBuffer();
+
+            for (int i = 0; i < buf.length; i++) {
+
+                String hex = Integer.toHexString(buf[i] & 0xFF);
+
+                if (hex.length() == 1) {
+
+                    hex = '0' + hex;
+
+                }
+
+                sb.append(hex.toUpperCase());
+
+            }
+            return sb.toString();
+
+        }
+    }
+}

+ 210 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XuzhoufuliV2CreditService.java

@@ -0,0 +1,210 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.*;
+
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 10 23 10 33.
+ * 徐州富力V2API接单
+ **/
+@Service
+@Slf4j
+public class XuzhoufuliV2CreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.XuzhoufuliV2;
+    }
+
+    @Data
+    public static class CheckData{
+        private String merNo;
+        private String params;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String phoneMd5;
+
+        private String sign;
+
+        private String areaName;
+
+
+    }
+    @Data
+    private static class ResultHt{
+        private String code;
+        private String message;
+    }
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit XuzhoufuliV2CreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo  apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("徐州富丽对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            checkInfo.setPhoneMd5(phoneMd5);
+
+            checkInfo.setAreaName(userInfo.getCompanyCity());
+//实体类转为JSONObject
+            JSONObject jsons = JSONObject.parseObject(JSON.toJSONString(checkInfo));
+            jsons.remove("sign");
+            String sign = getSign(jsons,config.getString("signKey"));
+            checkInfo.setSign(Md5Util.encoderByMd5(sign));
+            CheckData checkData = new CheckData();
+            checkData.setParams(AESencrypt(JSONObject.toJSONString(checkInfo),config.getString("encKey")));
+            checkData.setMerNo(config.getString("merNo"));
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck XuzhoufuliV2CreditService request userId:{}, url:{}, checkData:{}",userInfo.getUserId(), url, checkData);
+            String response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,checkData, String.class);
+            }catch (Exception e){
+                log.error("徐州富丽准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck XuzhoufuliV2CreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            JSONObject jsonObject=JSONObject.parseObject(response);
+
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getInteger("code") == 200) {
+                return DataVo.success(0, "徐州富丽撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "徐州富丽撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("徐州富丽撞库失败", e);
+            return DataVo.fail(1, "徐州富丽撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    /**
+     * 字典排序
+     * 获得参数格式化字符串
+     * 参数名按字典排序,小写在后面
+     */
+    private static String getFormatParams(Map<String, Object> params) {
+        List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(params.entrySet());
+        Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() {
+            public int compare(Map.Entry<String, Object> arg0, Map.Entry<String, Object> arg1) {
+                return (arg0.getKey()).compareTo(arg1.getKey());
+            }
+        });
+        String ret = "";
+        for (Map.Entry<String, Object> entry : infoIds) {
+            ret += entry.getKey();
+            ret += "=";
+            ret += entry.getValue();
+            ret += "&";
+        }
+        ret = ret.substring(0, ret.length() - 1);
+        return ret;
+    }
+
+
+    public static String md5WithSalt(String password, String salt) {
+        try {
+            // 创建 MD5 MessageDigest 实例
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            // 设置盐值
+            md.update(salt.getBytes(StandardCharsets.UTF_8));
+            // 对密码进行 MD5 加密
+            byte[] digest = md.digest(password.getBytes(StandardCharsets.UTF_8));
+            // 将加密后的字节数组转换为十六进制字符串
+            StringBuilder sb = new StringBuilder();
+            for (byte b : digest) {
+                sb.append(String.format("%02x", b));
+            }
+            // 返回 32 位小写 MD5 加密结果
+            return sb.toString();
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException("MD5 algorithm not found", e);
+        }
+    }
+
+    public static String AESencrypt(String str, String key) throws Exception {
+        // Create the SecretKeySpec with the given key and algorithm
+        SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        // Get the AES cipher instance with ECB padding
+        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+        // Initialize the cipher with the given key
+        cipher.init(Cipher.ENCRYPT_MODE, keySpec);
+        // Encrypt the input string
+        byte[] bytes = cipher.doFinal(str.getBytes(StandardCharsets.UTF_8));
+        // Convert the encrypted bytes to a hexadecimal string
+        return parseByte2HexStr(bytes);
+    }
+
+    private static String parseByte2HexStr(byte[] bytes) {
+        StringBuilder sb = new StringBuilder();
+        for (byte b : bytes) {
+            sb.append(String.format("%02x", b));
+        }
+        return sb.toString();
+    }
+    /**
+     * 计算签名
+     *
+     * @param params
+     * @return
+     */
+    public static String getSign(JSONObject params,String key) {
+        String sortStr = getFormatParams(params);
+        System.out.println("sortStr = " + sortStr);
+        //第二步:将tradeKey拼接在1中排序后的字符串后面得到待签名字符串。
+        sortStr += "&key="+ key;
+        System.out.println("sortStr = " + sortStr);
+        //sortStr += "key=BF1BDE5A649724056F904A9335B1C1C9";
+        //第三步:使用md5算法加密待加密字符串并转为大写即为sign
+//        String sign = DigestUtils.md5DigestAsHex(sortStr.getBytes()).toUpperCase();
+//        System.out.println("sign = " + sign);
+        return sortStr;
+    }
+
+
+}

+ 142 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/XveYiRongCreditService.java

@@ -0,0 +1,142 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.UserUtils;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Objects;
+
+/**
+ * 雪易融 API 接单
+ * @author 黄洋
+ * @since 1.0
+ */
+@Slf4j
+@Component
+public class XveYiRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Data
+    private static class Result {
+        private Integer code;
+        private String msg;
+        private JSONObject data;
+    }
+
+    @Data
+    private static class CheckInfo {
+        /**
+         * 手机号
+         */
+        private String name;
+        /**
+         * 手机号
+         */
+        private String phone;
+
+    }
+
+    /**
+     * 撞库
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        log.info("credit XveYiRongCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+        try {
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            if (Objects.isNull(config)) {
+                return DataVo.fail(product.getPlanName(), product.getPlanId());
+            }
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setName( UserUtils.getUserName(userInfo.getRealName(), userInfo.getPoliceSex()));
+            checkInfo.setPhone(userInfo.getPhoneMd5());
+
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck XveYiRongCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            JsonNode jsonNode = null;
+            String msg = null;
+            String data = null;
+            try {
+                HttpHeaders headers = new HttpHeaders();
+                headers.set("Content-Type","text/plain");
+                headers.set("authKey",config.getString("authKey"));
+                headers.set("sessionId",config.getString("sessionId"));
+                headers.set("sessionId",config.getString("sessionId"));
+
+                HttpEntity<String> requestEntity = new HttpEntity<>(JSONObject.toJSONString(checkInfo), headers);
+                 httpRestTemplate.restTemplate().postForEntity(url, checkInfo, String.class);
+
+
+//                OkHttpClient client = new OkHttpClient().newBuilder()
+//                        .build();
+//                MediaType mediaType = MediaType.parse("text/plain");
+//                RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(checkInfo));
+//                Request request = new Request.Builder()
+//                        .url(url)
+//                        .method("POST", body)
+//                        .addHeader("authKey", config.getString("authKey"))
+//                        .addHeader("sessionId", config.getString("sessionId"))
+//                        .addHeader("Content-Type", "text/plain")
+//                        .build();
+//                Response execute = client.newCall(request).execute();
+                String responseBody = requestEntity.getBody();
+                log.info("雪易融 =======================>{}",JSONObject.parseObject(responseBody));
+                ObjectMapper objectMapper = new ObjectMapper();
+                // 解析JSON字符串
+                 jsonNode = objectMapper.readTree(responseBody);
+
+                if(!Objects.isNull(jsonNode.get("msg"))){
+                    msg = jsonNode.get("msg").asText();
+                }
+                if(!Objects.isNull(jsonNode.get("data"))){
+                    data = jsonNode.get("data").asText();
+                }
+
+
+            } catch (Exception e) {
+                log.error("雪易融准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck 雪易融CreditService response userId:{}, result:{}", userInfo.getUserId(), jsonNode);
+            if (jsonNode == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            return Objects.equals(0,  jsonNode.get("code").intValue()) ?
+                    DataVo.success(0, "雪易融撞库成功", product.getPlanId())
+                    : DataVo.fail((msg != null) ? msg : data, product.getPlanId());
+
+        } catch (Exception e) {
+            log.error("雪易融撞库失败", e);
+            return DataVo.fail(1, "雪易融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.XveYiRong;
+    }
+
+
+
+}

+ 126 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YangZhouWanKeCreditService.java

@@ -0,0 +1,126 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 11 29 13 39
+ **/
+@Service
+@Slf4j
+public class YangZhouWanKeCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.YangZhouWanKe;
+    }
+    @Data
+    private static class CheckInfo{
+        private String md5mobile;//md5 的手机号
+        private String brand;//品牌对应数字(比如 6)
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+    {
+    "checkUrl": "https://www2.zhudaicms.com/sem/check_canindb.html",
+    "applyUrl": "https://www2.zhudaicms.com/sem/loan_do_aes_cbc_new.html",
+    "source": "yrf-hryk",
+    "brand": "1285",
+    "publickey": "zhudai#aes#cbc#1",
+    "iv": "2022042215123456"
+    }
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YangZhouWanKeCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("扬州万客对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            checkInfo.setMd5mobile(phoneMd5);
+            checkInfo.setBrand(config.getString("brand"));
+            String url = config.getString("checkUrl");
+            MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
+            params.add("md5mobile", phoneMd5);
+            params.add("brand", config.getString("brand"));
+            log.info("credit qualityCheck YangZhouWanKeCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try{
+                HttpHeaders headers = new HttpHeaders();
+                headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+                HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
+                response = httpRestTemplate.restTemplate().postForEntity(url, requestEntity, String.class).getBody();
+            }catch (Exception e){
+                log.error("扬州万客准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YangZhouWanKeCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            if (response.equals("1")) {
+                return DataVo.success(0, "扬州万客撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "扬州万客撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("扬州万客撞库失败", e);
+            return DataVo.fail(1, "扬州万客撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    public static String encrypt(String plainText, String key, String iv) throws Exception {
+        // 将 key 转换为 SecretKey 对象
+        SecretKey secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        // 将 IV 字符串转换为字节数组
+        byte[] ivBytes = iv.getBytes(StandardCharsets.UTF_8);
+        // 生成 IV
+        // 创建 Cipher 对象
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(ivBytes));
+        // 加密明文
+        byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
+        // 将加密后的字节转换为 Base64 编码
+        return Base64.getEncoder().encodeToString(encryptedBytes);
+    }
+}

+ 91 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiBangDaiCreditService.java

@@ -0,0 +1,91 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 06 13 14 50
+ **/
+@Slf4j
+@Service
+public class YiBangDaiCreditService implements LoanDockingApi {
+
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YiBangDaiCreditService;
+    }
+    @Data
+    private static class CheckInfo{
+        private String mobile;// 手机号md5
+    }
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit FuChengCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("壹帮贷对接参数:{}", JSON.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            Map<String, String> requestData = new HashMap<>();
+            requestData.put("mobile", phoneMd5);
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck FuChengCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, phoneMd5);
+            JSONObject response = null;
+            try{
+                Map<String, String> head = new HashMap<>();
+                head.put("Content-Type", "application/x-www-form-urlencoded");
+                head.put("token", config.getString("token"));
+                HttpResponse httpResponse = httpRestTemplate.restTemplate().postForObject(url, null, null, head, null, requestData);
+                String responseStr = EntityUtils.toString(httpResponse.getEntity());
+                response = JSONObject.parseObject(responseStr);
+            }catch (Exception e){
+                log.error("壹帮贷准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck FuChengCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (response.getInteger("code")==1) {
+                String data = response.getString("data");
+                JSONObject datas = JSONObject.parseObject(data);
+                if (datas.getInteger("status")==0){
+                    return DataVo.success(0, "壹帮贷撞库成功", product.getPlanId());
+                }else {
+                    return DataVo.fail(1, "壹帮贷撞库失败,请联系系统管理员", product.getPlanId());
+                }
+            } else {
+                return DataVo.fail(1, "壹帮贷撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            return DataVo.fail(1, "壹帮贷撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+
+}

+ 127 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiLianRongCreditService.java

@@ -0,0 +1,127 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.infrastructure.utils.SM3Util;
+import com.hrsk.cloud.eg.infrastructure.utils.SM4Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import org.bouncycastle.util.encoders.Base64;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.catalina.manager.host.Constants;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 03 18 10 29
+ **/
+@Slf4j
+@Service
+public class YiLianRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.YiLianRong;
+    }
+
+    @Data
+    private static class RequestData{
+        private String appKey;//平台提供appKe
+        private String timestamp;//时间戳
+        private String requestId;//唯⼀请求标识,例如:UUID
+        private String sign;//签名字符串
+        private String data;//请求报⽂密⽂
+    }
+    @Data
+    private static class CheckInfo{
+        private String phone;//⼿机号码MD5加密密⽂
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YiLianRongCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("易联融对接参数:{}", JSON.toJSONString(config));
+            String appSecret = config.getString("appSecret");
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setPhone((userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5()));
+            JSONObject data = new JSONObject();
+            data.put("phone",checkInfo.getPhone());
+            // appKey,timestamp,requestId,data 参数按照 ASCII 升序排序,按照“参数=参
+            Map<String, String> signMap = new HashMap<>();
+            signMap.put("appKey", config.getString("appKey"));
+            signMap.put("timestamp", new Date().getTime() + "");
+            signMap.put("requestId", UUID.randomUUID().toString());
+            String encrypt = SM4Util.encryptStrToBase64(data.toJSONString(), appSecret);
+            signMap.put("data", encrypt);
+            String signStr = signForJx(signMap, appSecret);
+            signMap.put("sign",signStr);
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck YiLianRongCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, signMap);
+            String response = null;
+            try {
+                response =httpRestTemplate.restTemplate().postForObject(url,signMap, String.class);
+            } catch (Exception e) {
+                log.error("易联融准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YiLianRongCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject jsonObject = JSONObject.parseObject(response);
+            log.info("credit qualityCheck YiLianRongCreditService response userId:{}, jsonObject:{}", userInfo.getUserId(), jsonObject);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getString("code").equals("0")) {
+                return DataVo.success(0, "易联融撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "易联融撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("易联融撞库失败", e);
+            return DataVo.fail(1, "易联融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    /**
+     * ⽣成签名. Java
+     *
+     * @param data 待签名数据
+     * @param appSecret API密钥
+     * @return 签名
+     */
+    public static String signForJx(Map<String, String> data, String appSecret) {
+        Set<String> keySet = data.keySet();
+        String[] keyArray = keySet.toArray(new String[0]);
+        Arrays.sort(keyArray);
+        StringBuilder sb = new StringBuilder();
+        for (String k : keyArray) {
+            sb.append(k).append("=").append(data.get(k)).append("&");
+        }
+        sb.deleteCharAt(sb.length() - 1);
+        try {
+            return Base64.toBase64String(SM3Util.sm3(sb.toString().getBytes(Constants.CHARSET), appSecret.getBytes(Constants.CHARSET)));
+        } catch (Exception e) {
+            return "";
+        }
+    }
+
+}

+ 168 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiQiHuaCreditService.java

@@ -0,0 +1,168 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.AESUtilPkcs7;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * 一起花API接单
+ */
+@Service
+@Slf4j
+public class YiQiHuaCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YiQiHua;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String phone;
+        private String source;
+        private String city;
+    }
+
+    @Data
+    private static class ResultHt {
+        private String code;
+        private String data;
+        private String msg;
+    }
+
+    @Data
+    private static class YiQiHuaConfig {
+        private List<String> city;
+        private String checkUrl;
+        private String applyUrl;
+        private String key;
+        private String postion;
+        private String channel;
+    }
+
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YiQiHuaCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            YiQiHuaConfig config = getYiQiHuaConfig(configJson, userInfo.getCityCode());
+            log.info("对接参数:{}", JSON.toJSONString(config));
+            if (null == config) {
+                log.info("对接参数不满足城市:");
+                return DataVo.fail(1, "一起花撞库失败,请联系系统管理员", product.getPlanId());
+            }
+            String url = config.getCheckUrl();
+            String response = null;
+            try {
+                MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+                params.put("phone", Collections.singletonList(userInfo.getPhoneMd5()));
+                params.put("source", Collections.singletonList(config.getChannel()));
+                params.put("city", Collections.singletonList(userInfo.getCityAllName()));
+                HttpHeaders headers = new HttpHeaders();
+                headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+                HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(params, headers);
+                log.info("credit qualityCheck YiQiHuaCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, params);
+                response = httpRestTemplate.restTemplate().postForEntity(url, httpEntity, String.class).getBody();
+            } catch (Exception e) {
+                log.error("一起花准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YiQiHuaCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            JSONObject jsonObject = JSON.parseObject(response);
+            log.info("yiqihua check response{}", response);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getInteger("status") == 200) {
+                return DataVo.success(0, "一起花撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "一起花撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("一起花撞库失败", e);
+            return DataVo.fail(1, "一起花撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    private YiQiHuaConfig getYiQiHuaConfig(String configData, String cityCode) {
+        List<YiQiHuaConfig> config =JSON.parseArray(configData,YiQiHuaConfig.class);
+        if (CollectionUtils.isNotEmpty(config)) {
+            for (YiQiHuaConfig c : config) {
+                if (c.getCity().contains(cityCode)) {
+                    return c;
+                }
+            }
+        }
+        return null;
+    }
+
+
+    private static class ApiAesUtil {
+        //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同!
+
+        /**
+         * @param data 明文
+         * @return 密文
+         * @author miracle.qu
+         * @Description AES算法加密明文
+         */
+        public static String encryptAES(String data, String ekey, String eiv) {
+            try {
+
+                Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+
+                SecretKeySpec keyspec = new SecretKeySpec(ekey.getBytes("UTF-8"), "AES");
+                // CBC模式,需要一个向量iv,可增加加密算法的强度
+                IvParameterSpec ivspec = new IvParameterSpec(eiv.getBytes("UTF-8"));
+
+                cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
+                byte[] encrypted = cipher.doFinal(data.getBytes("UTF-8"));
+                // BASE64做转码。
+                return AESUtilPkcs7.encode(encrypted).trim();
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        }
+
+    }
+
+
+}

+ 231 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiRongCreditService.java

@@ -0,0 +1,231 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+/**
+ * 壹融API接单
+ */
+@Service
+@Slf4j
+public class YiRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    private final String qualityCheckPath = "/api/customer/phoneRepeatCheck";
+
+    private final String applyPath = "/api/customer/insertDataToCustomer2";
+
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YiRong;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String mobile_md5;
+        private String channelSource;
+    }
+
+    @Data
+    private static class ResultHt {
+        private String code;
+        private String data;
+        private String msg;
+    }
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YiRongCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("对接参数:{}", JSONObject.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setMobile_md5(userInfo.getPhoneMd5());
+            checkInfo.setChannelSource(config.getString("channelSource"));
+            String url = config.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck YiRongCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, checkInfo, String.class);
+                log.info("fanhui");
+            } catch (Exception e) {
+                log.error("壹融准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YiRongCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            JSONObject jsonObject = JSONObject.parseObject(response);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject data = jsonObject.getJSONObject("data");
+            if (jsonObject.get("code").equals("200") && data.get("status").equals("1")) {
+                return DataVo.success(0, "壹融撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "壹融撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("壹融撞库失败", e);
+            return DataVo.fail(1, "壹融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    private static class ApiAesUtil {
+        private static final String AES = "AES";
+        private static final String SP = "SHA1PRNG";
+        private static final String CHARACTER = "utf-8";
+        private static final String ALGO = "AES/ECB/PKCS5Padding"; // 使用AES算法,ECB模式,PKCS5Padding填充
+
+        public static String decrypt(String sSrc, String sKey) {
+            try {
+                // 判断Key是否正确
+                if (sKey == null) {
+                    log.error("Key为空null");
+                    return null;
+                }
+                // 判断Key是否为16位
+                if (sKey.length() != 16) {
+                    log.error("Key长度不是16位");
+                    return null;
+                }
+                byte[] raw = sKey.getBytes("utf-8");
+                SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+                Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+                cipher.init(Cipher.DECRYPT_MODE, skeySpec);
+                byte[] encrypted1 = new Base64().decode(sSrc);//先用base64解密
+                try {
+                    byte[] original = cipher.doFinal(encrypted1);
+                    String originalString = new String(original, "utf-8");
+                    return originalString;
+                } catch (Exception e) {
+                    System.out.println(e.toString());
+                    return null;
+                }
+            } catch (Exception ex) {
+                System.out.println(ex.toString());
+                return null;
+            }
+        }
+
+        public static String secureBytes(String key) {
+            if (key.length() > 16) {
+                key = key.substring(0, 16);
+            } else if (key.length() < 16) {
+                for (int i = (key.length() - 1); i < 15; i++) {
+                    key += "\000";
+                }
+            }
+            return key;
+
+        }
+
+        /**
+         * @param strhex
+         * @return
+         */
+        public static byte[] hex2byte(String strhex) {
+            if (strhex == null) {
+                return null;
+            }
+            int l = strhex.length();
+            if (l % 2 != 0) {
+                return null;
+            }
+            byte[] b = new byte[l / 2];
+            for (int i = 0; i != l / 2; i++) {
+                b[i] = (byte) Integer.parseInt(strhex.substring(i * 2, i * 2 + 2),
+                        16);
+            }
+            return b;
+        }
+
+        /**
+         * @param b
+         * @return
+         */
+        public static String byte2hex(byte[] b) {
+            String hs = "";
+            String stmp = "";
+            for (int n = 0; n < b.length; n++) {
+                stmp = (Integer.toHexString(b[n] & 0XFF));
+                System.out.println(stmp);
+                if (stmp.length() == 1) {
+                    hs = hs + "0" + stmp;
+                } else {
+                    hs = hs + stmp;
+                }
+            }
+            return hs.toUpperCase();
+        }
+
+        public static char[] bytes2hex(final byte[] data) {
+            final int l = data.length;
+            final char[] out = new char[l << 1];
+            // two characters form the hex value.
+            for (int i = 0, j = 0; i < l; i++) {
+                out[j++] = DIGITS_LOWER[(0xF0 & data[i]) >>> 4];
+                out[j++] = DIGITS_LOWER[0x0F & data[i]];
+            }
+            return out;
+        }
+
+        private static final char[] DIGITS_LOWER = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+        public static String encrypt(String sSrc, String sKey) {
+            try {
+
+
+                if (sKey == null) {
+                    log.error("Key为空null");
+                    return null;
+                }
+                // 判断Key是否为16位
+                if (sKey.length() != 16) {
+                    log.error("Key长度不是16位");
+                    return null;
+                }
+                byte[] raw = sKey.getBytes("utf-8");
+                SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+                Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
+                cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+                byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
+
+                return new Base64().encodeToString(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。
+            } catch (Exception e) {
+
+            }
+            return null;
+        }
+
+    }
+
+
+}

+ 129 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiRongWangCreditService.java

@@ -0,0 +1,129 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 12 11 09 55
+ **/
+@Slf4j
+@Service
+public class YiRongWangCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YiRongWang;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String md5mobile;//md5 的手机号
+        private String brand;//品牌对应数字(比如 6)
+    }
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return {
+     * "checkUrl": "https://www2.zhudaicms.com/sem/check_canindb.html",
+     * "applyUrl": "https://www2.zhudaicms.com/sem/loan_do_aes_cbc_new.html",
+     * "source": "yrf-hryk",
+     * "brand": "1285",
+     * "publickey": "zhudai#aes#cbc#1",
+     * "iv": "2022042215123456"
+     * }
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YiRongWangCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("忆融网对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            checkInfo.setMd5mobile(phoneMd5);
+            checkInfo.setBrand(config.getString("brand"));
+            String url = config.getString("checkUrl");
+            MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
+            params.add("md5mobile", phoneMd5);
+            params.add("brand", config.getString("brand"));
+            log.info("credit qualityCheck YiRongWangCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try {
+                HttpHeaders headers = new HttpHeaders();
+                headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+                HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
+                response = httpRestTemplate.restTemplate().postForEntity(url, requestEntity, String.class).getBody();
+            } catch (Exception e) {
+                log.error("忆融网准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YiRongWangCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (response.equals("1")) {
+                return DataVo.success(0, "忆融网撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "忆融网撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("忆融网撞库失败", e);
+            return DataVo.fail(1, "忆融网撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+
+
+    public static String encrypt(String plainText, String key, String iv) throws Exception {
+        // 将 key 转换为 SecretKey 对象
+        SecretKey secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        // 将 IV 字符串转换为字节数组
+        byte[] ivBytes = iv.getBytes(StandardCharsets.UTF_8);
+        // 生成 IV
+        // 创建 Cipher 对象
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(ivBytes));
+        // 加密明文
+        byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
+        // 将加密后的字节转换为 Base64 编码
+        return Base64.getEncoder().encodeToString(encryptedBytes);
+    }
+}

+ 74 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YiZhanShiShuZhiPingTaiCreditService.java

@@ -0,0 +1,74 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 03 21 13 43
+ **/
+@Slf4j
+@Service
+public class YiZhanShiShuZhiPingTaiCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YiZhanShiShuZhiPingTai;
+    }
+
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YiZhanShiShuZhiPingTaiCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("一站式数字平台对接参数:{}", JSONObject.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck YiZhanShiShuZhiPingTaiCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, phoneMd5);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, phoneMd5, String.class);
+            } catch (Exception e) {
+                log.error("一站式数字平台准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YiZhanShiShuZhiPingTaiCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject jsonObject = JSONObject.parseObject(response);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getString("code").equals("200")) {
+                return DataVo.success(0, "一站式数字平台撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "一站式数字平台撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("一站式数字平台撞库失败", e);
+            return DataVo.fail(1, "一站式数字平台撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+}

+ 103 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YijieCreditService.java

@@ -0,0 +1,103 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Objects;
+
+/**
+ * @Descrption
+ * @Author: chend
+ * @Date: 2023/2/8
+ * @Version V1.0
+ **/
+@Service
+@Slf4j
+public class YijieCreditService implements LoanDockingApi {
+
+    private final static String checkPath = "api/third/check_loan?server=1";
+    private final static String pushPath = "api/third/loan_do?server=1";
+    private final static String factor = "tVhNbn86r3R0";
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Data
+    private static class CheckInfo {
+        private String channel;
+        private JSONObject data;
+    }
+
+    @Data
+    private static class Result {
+        private Integer code;
+
+        private String message;
+    }
+
+
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YijieCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+//            XdProductJointConfig xdProductJointConfig = xdProductJointConfigMapper.selectById(product.getJointType());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("易借对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setChannel(config.getString("channel"));
+            JSONObject data = new JSONObject() {{
+                put("type", 102);
+                put("mobileMd5", userInfo.getPhoneMd5());
+            }};
+            checkInfo.setData(data);
+
+            String url = config.getString("url") + checkPath;
+            log.info("credit qualityCheck YijieCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            Result response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, checkInfo, Result.class);
+            } catch (Exception e) {
+                log.error("易借准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YijieCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            return Objects.equals(0, response.getCode()) ? DataVo.success(0, "易借撞库成功", product.getPlanId())
+                    : DataVo.fail("撞库失败", product.getPlanId());
+
+        } catch (Exception e) {
+            log.error("易借撞库失败", e);
+            return DataVo.fail(1, "易借撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.YiJie;
+    }
+
+    public String bulidSign(String jsonStr, String factor) {
+        return Md5Util.encoderByMd5(jsonStr + "_" + factor);
+    }
+
+
+}

+ 224 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YinHuaCreditService.java

@@ -0,0 +1,224 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.Random;
+
+import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
+
+
+/**
+ * @Descrption 银华咨询
+ * @Author: zhangyy
+ * @Date: 2023/5/15
+ * @Version V1.0
+ **/
+@Service
+@Slf4j
+public class YinHuaCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    private final String qualityCheckPath = "api/channel/clue/md5/_check";
+
+    private final String applyPath = "api/channel/clue";
+
+
+
+    @Data
+    private static class CheckInfo {
+        private String phoneMd5;
+        private String channelSource;
+    }
+
+    @Data
+    private static class ResultHt {
+        private String code;
+        private String msg;
+    }
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YinHua;
+    }
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit HuizhongCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("银华对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setPhoneMd5(userInfo.getPhoneMd5());
+            String url = config.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck YinHuaCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try {
+                HttpHeaders headers = new HttpHeaders();
+                headers.setContentType(MediaType.APPLICATION_JSON);
+                headers.set("channel", config.getString("channel"));
+                HttpEntity httpEntity = new HttpEntity<>(checkInfo, headers);
+                ResponseEntity<String> responseEntity = httpRestTemplate.restTemplate().postForEntity(url, httpEntity, String.class);
+                response = responseEntity.getBody();
+            } catch (Exception e) {
+                log.error("银华准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YinHuaCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject res = JSONObject.parseObject(response);
+            if (res.getInteger("code") == 200) {
+                if (res.getJSONObject("data").getInteger("status") == 0) {
+                    return DataVo.success(0, "银华撞库成功", product.getPlanId());
+                }
+                return DataVo.fail(1, "银华撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("银华撞库失败", e);
+            return DataVo.fail(1, "银华撞库失败,请联系系统管理员", product.getPlanId());
+        }
+        return DataVo.fail(1, "银华撞库失败,请联系系统管理员", product.getPlanId());
+    }
+
+
+    private static class ApiAesUtil {
+        private static final String AES = "AES";
+        private static final String CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";
+
+        /**
+         * 串接arr参数,生成sha256 digest.
+         * json,nonce,secretKey,timestamp
+         */
+        public static String getSignature(String... arr) {
+            StringBuilder sb = new StringBuilder();
+            for (String a : arr) {
+                sb.append(a);
+            }
+            return sha256Hex(sb.toString());
+        }
+
+
+        /**
+         * 随机生成16位字符串.
+         */
+        public static String getRandomStr() {
+            return getRandomStr(16);
+        }
+
+        /**
+         * 随机生成字符串.
+         *
+         * @param length 字符串长度
+         */
+        public static String getRandomStr(int length) {
+            String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+            Random random = new Random();
+            StringBuilder sb = new StringBuilder();
+            for (int i = 0; i < length; i++) {
+                int number = random.nextInt(base.length());
+                sb.append(base.charAt(number));
+            }
+            return sb.toString();
+        }
+
+        /**
+         * 获取当前时间戳
+         *
+         * @return
+         */
+        public static Long getTimeStamp() {
+            return System.currentTimeMillis() / 1000L;
+        }
+
+        /**
+         * 加密
+         *
+         * @param value     加密内容
+         * @param secretKey 密钥
+         * @return 加密后数据
+         */
+        public static String encrypt(String value, String secretKey) {
+            try {
+                if (StringUtils.isBlank(value)) {
+                    log.error("加密失败,参数为空");
+                    return null;
+                }
+                if (secretKey.length() != 16) {
+                    return null;
+                }
+
+                byte[] aesKey = secretKey.getBytes(StandardCharsets.UTF_8);
+                SecretKeySpec keySpec = new SecretKeySpec(aesKey, AES);
+                Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
+                cipher.init(Cipher.ENCRYPT_MODE, keySpec);
+                return Base64.encodeBase64String(cipher.doFinal(value.getBytes(StandardCharsets.UTF_8)));
+            } catch (Exception e) {
+                log.error("加密失败,参数为空");
+                return null;
+            }
+        }
+
+        /**
+         * 对密文进行解密.
+         *
+         * @param encryptedData 需要解密的密文
+         * @param secretKey     密钥
+         * @return 解密得到的明文
+         */
+        public static String decrypt(String encryptedData, String secretKey) {
+            if (StringUtils.isBlank(encryptedData)) {
+                log.error("解密失败,参数为空");
+                return null;
+            }
+            if (secretKey.length() != 16) {
+                return null;
+            }
+            try {
+                byte[] aesKey = secretKey.getBytes(StandardCharsets.UTF_8);
+                SecretKeySpec keySpec = new SecretKeySpec(aesKey, AES);
+                Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
+                cipher.init(Cipher.DECRYPT_MODE, keySpec);
+                return new String(cipher.doFinal(Base64.decodeBase64(encryptedData)));
+            } catch (Exception e) {
+                log.error("解密失败{}", e.getMessage());
+                return null;
+            }
+        }
+
+    }
+}

+ 341 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YourongCreditService.java

@@ -0,0 +1,341 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import java.io.ByteArrayOutputStream;
+import java.security.*;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * 有融API接单
+ */
+@Service
+@Slf4j
+public class YourongCreditService implements LoanDockingApi {
+    private final String qualityCheckPath = "/channel/openapi/checkuser";
+    private final String applyPath = "/channel/openapi/pushuser";
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.Yourong;
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YourongCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+//            XdProductJointConfig xdProductJointConfig = xdProductJointConfigMapper.selectById(product.getJointType());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("有融对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setPhone(userInfo.getPhoneMd5());
+            checkInfo.setChannelCode(config.getString("channelCode"));
+            String url = config.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck YourongCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            ResultYr response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,checkInfo, ResultYr.class);
+            }catch (Exception e){
+                log.error("有融准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YourongCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return response.getCode() == 0 ? DataVo.success(0, "有融撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMsg(), product.getPlanId());
+
+        } catch (Exception e) {
+            log.error("有融撞库失败", e);
+            return DataVo.fail(1, "有融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String phone;
+
+        private String channelCode;
+    }
+
+    @Data
+    private static class ResultYr{
+        private Integer code;
+        private String msg;
+    }
+
+    public static class RSAUtils {
+        public static final String CHARSET = "UTF-8";
+        public static final String RSA_ALGORITHM = "RSA";
+        public static final String RSA_ALGORITHM_SIGN = "SHA256WithRSA";
+        public static final int    ALGORITHM_RSA_PRIVATE_KEY_LENGTH = 2048;
+
+        public static Map<String, String> initRSAKey(int keysize) {
+            if (keysize != ALGORITHM_RSA_PRIVATE_KEY_LENGTH) {
+                throw new IllegalArgumentException(
+                        "RSA1024已经不安全了,请使用" + ALGORITHM_RSA_PRIVATE_KEY_LENGTH + "初始化RSA密钥对");
+            }
+            //为RSA算法创建一个KeyPairGenerator对象
+            KeyPairGenerator kpg;
+            try {
+                kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
+            } catch (NoSuchAlgorithmException e) {
+                throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
+            }
+            //初始化KeyPairGenerator对象,不要被initialize()源码表面上欺骗,其实这里声明的size是生效的
+            kpg.initialize(ALGORITHM_RSA_PRIVATE_KEY_LENGTH);
+            //生成密匙对
+            KeyPair keyPair = kpg.generateKeyPair();
+            //得到公钥
+            Key publicKey = keyPair.getPublic();
+            String publicKeyStr = Base64.encodeBase64URLSafeString(publicKey.getEncoded());
+            //得到私钥
+            Key privateKey = keyPair.getPrivate();
+            String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
+            Map<String, String> keyPairMap = new HashMap<String, String>();
+            keyPairMap.put("publicKey", publicKeyStr);
+            keyPairMap.put("privateKey", privateKeyStr);
+            return keyPairMap;
+        }
+
+        public static Map<String, String> createKeys(int keySize) {
+            //为RSA算法创建一个KeyPairGenerator对象
+            KeyPairGenerator kpg;
+            try {
+                kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
+            } catch (NoSuchAlgorithmException e) {
+                throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
+            }
+
+            //初始化KeyPairGenerator对象,密钥长度
+            kpg.initialize(keySize);
+            //生成密匙对
+            KeyPair keyPair = kpg.generateKeyPair();
+            //得到公钥
+            Key publicKey = keyPair.getPublic();
+            String publicKeyStr = Base64.encodeBase64URLSafeString(publicKey.getEncoded());
+            //得到私钥
+            Key privateKey = keyPair.getPrivate();
+            String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
+            Map<String, String> keyPairMap = new HashMap<String, String>();
+            keyPairMap.put("publicKey", publicKeyStr);
+            keyPairMap.put("privateKey", privateKeyStr);
+
+            return keyPairMap;
+        }
+
+
+        /**
+         * 得到公钥
+         *
+         * @param publicKey 密钥字符串(经过base64编码)
+         * @throws Exception
+         */
+        public static RSAPublicKey getPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+            //通过X509编码的Key指令获得公钥对象
+            KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+            X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
+            RSAPublicKey key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
+            return key;
+        }
+
+        /**
+         * 得到私钥
+         *
+         * @param privateKey 密钥字符串(经过base64编码)
+         * @throws Exception
+         */
+        public static RSAPrivateKey getPrivateKey(String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+            //通过PKCS#8编码的Key指令获得私钥对象
+            KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+            PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey));
+            RSAPrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
+            return key;
+        }
+
+        /**
+         * 公钥加密
+         *
+         * @param data
+         * @param publicKey
+         * @return
+         */
+        public static String publicEncrypt(String data, RSAPublicKey publicKey) {
+            try {
+                if (Objects.isNull(data)) {
+                    return null;
+                }
+                Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
+                cipher.init(Cipher.ENCRYPT_MODE, publicKey);
+                return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), publicKey.getModulus().bitLength()));
+            } catch (Exception e) {
+                throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        /**
+         * 私钥解密
+         *
+         * @param data
+         * @param privateKey
+         * @return
+         */
+        public static String privateDecrypt(String data, RSAPrivateKey privateKey) {
+            try {
+                Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
+                cipher.init(Cipher.DECRYPT_MODE, privateKey);
+                return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), privateKey.getModulus().bitLength()), CHARSET);
+            } catch (Exception e) {
+                throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        /**
+         * 私钥加密
+         *
+         * @param data
+         * @param privateKey
+         * @return
+         */
+        public static String privateEncrypt(String data, RSAPrivateKey privateKey) {
+            try {
+                Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
+                cipher.init(Cipher.ENCRYPT_MODE, privateKey);
+                return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), privateKey.getModulus().bitLength()));
+            } catch (Exception e) {
+                throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        /**
+         * 公钥解密
+         *
+         * @param data
+         * @param publicKey
+         * @return
+         */
+        public static String publicDecrypt(String data, RSAPublicKey publicKey) {
+            try {
+                Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
+                cipher.init(Cipher.DECRYPT_MODE, publicKey);
+                return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), publicKey.getModulus().bitLength()), CHARSET);
+            } catch (Exception e) {
+                throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
+            }
+        }
+        /**
+         * RSA算法使用私钥对数据生成数字签名
+         *
+         * @param data 待签名的明文字符串
+         * @param key  RSA私钥字符串
+         * @return RSA私钥签名后的经过Base64编码的字符串
+         */
+        public static String buildRSASignByPrivateKey(String data, String key) {
+            try {
+                //通过PKCS#8编码的Key指令获得私钥对象
+                PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(key));
+                KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+                PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
+                //sign
+                Signature signature = Signature.getInstance(RSA_ALGORITHM_SIGN);
+                signature.initSign(privateKey);
+                signature.update(data.getBytes(CHARSET));
+                return Base64.encodeBase64URLSafeString(signature.sign());
+            } catch (Exception e) {
+                throw new RuntimeException("签名字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        /**
+         * RSA算法使用公钥校验数字签名
+         *
+         * @param data 参与签名的明文字符串
+         * @param key  RSA公钥字符串
+         * @param sign RSA签名得到的经过Base64编码的字符串
+         * @return true--验签通过,false--验签未通过
+         */
+        public static boolean buildRSAverifyByPublicKey(String data, String key, String sign) {
+            try {
+                //通过X509编码的Key指令获得公钥对象
+                X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(key));
+                KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+                PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
+                //verify
+                Signature signature = Signature.getInstance(RSA_ALGORITHM_SIGN);
+                signature.initVerify(publicKey);
+                signature.update(data.getBytes(CHARSET));
+                return signature.verify(Base64.decodeBase64(sign));
+            } catch (Exception e) {
+                throw new RuntimeException("验签字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        private static byte[] rsaSplitCodec(Cipher cipher, int opmode, byte[] datas, int keySize) {
+            int maxBlock = 0;
+            if (opmode == Cipher.DECRYPT_MODE) {
+                maxBlock = keySize / 8;
+            } else {
+                maxBlock = keySize / 8 - 11;
+            }
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            int offSet = 0;
+            byte[] buff;
+            int i = 0;
+            try {
+                while (datas.length > offSet) {
+                    if (datas.length - offSet > maxBlock) {
+                        buff = cipher.doFinal(datas, offSet, maxBlock);
+                    } else {
+                        buff = cipher.doFinal(datas, offSet, datas.length - offSet);
+                    }
+                    out.write(buff, 0, buff.length);
+                    i++;
+                    offSet = i * maxBlock;
+                }
+            } catch (Exception e) {
+                throw new RuntimeException("加解密阀值为[" + maxBlock + "]的数据时发生异常", e);
+            }
+            byte[] resultDatas = out.toByteArray();
+            IOUtils.closeQuietly(out);
+            return resultDatas;
+        }
+    }
+}

+ 147 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YuRongFuCreditService.java

@@ -0,0 +1,147 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 11 27 16 43
+ **/
+@Slf4j
+@Service
+public class YuRongFuCreditService implements LoanDockingApi {
+
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YuRongFu;
+    }
+    @Data
+    private static class CheckInfo{
+        private String md5mobile;//md5 的手机号
+        private String brand;//品牌对应数字(比如 6)
+    }
+
+    @Data
+    private static class ApplyInfo {
+        private String name; //(必填)客户姓名
+        private String mobile; //(必填)手机号
+        private String city; //必填)城市(不包含市,比如“杭州市”应该是“杭州”)
+        private String car; //是否有车(“有”或“无”)
+        private Integer age; //年龄(如:39)
+        private String job; //工作(“有”或“无”)
+        private String house; //房(“有”或“无”)
+        private String baodan_is; //保单(“有”或“无”)
+        private String sex; //性别(“男”或“女”)
+        private Integer money; //贷款额度(如:20,即单位为万)
+        private String source; //(必填)贷款来源(固定值,问系统技术具体值: __________)
+        private String source_remark; //贷款来源特别说明(如 有公积金,有打卡工资社保,有企业)
+        private String shebao; //社保(“有”或“无”)
+        private String gongjijin; //公积金(“有”或“无”)
+        private String credit_card; //信用卡(“有”或“无”)
+        private Integer zhima; //芝麻分(整数,如:567)
+        private String isbankpay; //银行代发(“银行代发”或“无”)
+        private String time; //该条数据实际申请时间(10位数字,如:1467100609)
+
+    }
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+    {
+    "checkUrl": "https://www2.zhudaicms.com/sem/check_canindb.html",
+    "applyUrl": "https://www2.zhudaicms.com/sem/loan_do_aes_cbc_new.html",
+    "source": "yrf-hryk",
+    "brand": "1285",
+    "publickey": "zhudai#aes#cbc#1",
+    "iv": "2022042215123456"
+    }
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YuRongFuCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("宇融服对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            checkInfo.setMd5mobile(phoneMd5);
+            checkInfo.setBrand(config.getString("brand"));
+            String url = config.getString("checkUrl");
+            MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
+            params.add("md5mobile", phoneMd5);
+            params.add("brand", config.getString("brand"));
+            log.info("credit qualityCheck YuRongFuCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try{
+                HttpHeaders headers = new HttpHeaders();
+                headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+                HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
+                response = httpRestTemplate.restTemplate().postForEntity(url, requestEntity, String.class).getBody();
+            }catch (Exception e){
+                log.error("宇融服准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YuRongFuCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            if (response.equals("1")) {
+                return DataVo.success(0, "宇融服撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "宇融服撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("宇融服撞库失败", e);
+            return DataVo.fail(1, "宇融服撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    public static String encrypt(String plainText, String key, String iv) throws Exception {
+        // 将 key 转换为 SecretKey 对象
+        SecretKey secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        // 将 IV 字符串转换为字节数组
+        byte[] ivBytes = iv.getBytes(StandardCharsets.UTF_8);
+        // 生成 IV
+        // 创建 Cipher 对象
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(ivBytes));
+        // 加密明文
+        byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
+        // 将加密后的字节转换为 Base64 编码
+        return Base64.getEncoder().encodeToString(encryptedBytes);
+    }
+}

+ 91 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YukuaihuaCreditService.java

@@ -0,0 +1,91 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * @Descrption
+ * @Author: chend
+ * @Date: 2023/2/6
+ * @Version V1.0
+ **/
+@Slf4j
+@Service
+public class YukuaihuaCreditService implements LoanDockingApi {
+
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    private final static String checkPath = "api/External/hit_library";
+    private final static String applyPath = "api/External/create";
+
+    @Data
+    private static class Result {
+        private Integer code;
+
+        private String msg;
+
+        private Long time;
+
+        private Object data;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String userPhone;
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit YukuaihuaCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+//            XdProductJointConfig xdProductJointConfig = xdProductJointConfigMapper.selectById(product.getJointType());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("愉快花对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setUserPhone(userInfo.getPhoneMd5());
+            String url = config.getString("url") + checkPath;
+            log.info("credit qualityCheck YukuaihuaCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            Result response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, checkInfo, Result.class);
+            } catch (Exception e) {
+                log.error("愉快花准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YukuaihuaCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            return Objects.equals(1, response.getCode()) ? DataVo.success(0, "愉快花撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMsg(), product.getPlanId());
+
+        } catch (Exception e) {
+            log.error("愉快花撞库失败", e);
+            return DataVo.fail(1, "愉快花撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.YuKuaiHua;
+    }
+
+}

+ 277 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/YunHaiLianDongCreditService.java

@@ -0,0 +1,277 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import java.io.ByteArrayOutputStream;
+import java.security.*;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 03 14 09 53
+ **/
+@Slf4j
+@Component
+public class YunHaiLianDongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.YunHaiLianDong;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private Integer channel_id;//渠道ID
+        private String code;
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+//            log.info("credit YunHaiLianDongCreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+//            log.info("云海联动对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setCode((userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5()));
+            checkInfo.setChannel_id(config.getInteger("channel_id"));
+            String url = config.getString("checkUrl");
+//            log.info("credit qualityCheck YunHaiLianDongCreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try {
+                response =httpRestTemplate.restTemplate().postForObject(url,checkInfo, String.class);
+            } catch (Exception e) {
+                log.error("云海联动准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck YunHaiLianDongCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject jsonObject = JSONObject.parseObject(response);
+//            log.info("credit qualityCheck YunHaiLianDongCreditService response userId:{}, jsonObject:{}", userInfo.getUserId(), jsonObject);
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getInteger("code")==1) {
+                return DataVo.success(0, "云海联动撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "云海联动撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("云海联动撞库失败", e);
+            return DataVo.fail(1, "云海联动撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+    public static class RSAUtils {
+
+        public static final String CHARSET = "UTF-8";
+        public static final String RSA_ALGORITHM = "RSA";
+        public static final String RSA_ALGORITHM_SIGN = "SHA256WithRSA";
+        public static final int ALGORITHM_RSA_PRIVATE_KEY_LENGTH = 2048;
+
+        public Map<String, String> initRSAKey(int keysize) {
+            if (keysize != ALGORITHM_RSA_PRIVATE_KEY_LENGTH) {
+                throw new IllegalArgumentException(
+                        "RSA1024已经不安全了,请使用" + ALGORITHM_RSA_PRIVATE_KEY_LENGTH + "初始化RSA密钥对");
+            }
+            //为RSA算法创建一个KeyPairGenerator对象
+            KeyPairGenerator kpg;
+            try {
+                kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
+            } catch (NoSuchAlgorithmException e) {
+                throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
+            }
+            //初始化KeyPairGenerator对象,不要被initialize()源码表面上欺骗,其实这里声明的size是生效的
+            kpg.initialize(ALGORITHM_RSA_PRIVATE_KEY_LENGTH);
+            //生成密匙对
+            KeyPair keyPair = kpg.generateKeyPair();
+            //得到公钥
+            Key publicKey = keyPair.getPublic();
+            String publicKeyStr = Base64.encodeBase64URLSafeString(publicKey.getEncoded());
+            //得到私钥
+            Key privateKey = keyPair.getPrivate();
+            String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
+            Map<String, String> keyPairMap = new HashMap<String, String>();
+            keyPairMap.put("publicKey", publicKeyStr);
+            keyPairMap.put("privateKey", privateKeyStr);
+            return keyPairMap;
+        }
+
+        public  Map<String, String> createKeys(int keySize) {
+            //为RSA算法创建一个KeyPairGenerator对象
+            KeyPairGenerator kpg;
+            try {
+                kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
+            } catch (NoSuchAlgorithmException e) {
+                throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
+            }
+
+            //初始化KeyPairGenerator对象,密钥长度
+            kpg.initialize(keySize);
+            //生成密匙对
+            KeyPair keyPair = kpg.generateKeyPair();
+            //得到公钥
+            Key publicKey = keyPair.getPublic();
+            String publicKeyStr = Base64.encodeBase64URLSafeString(publicKey.getEncoded());
+            //得到私钥
+            Key privateKey = keyPair.getPrivate();
+            String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
+            Map<String, String> keyPairMap = new HashMap<String, String>();
+            keyPairMap.put("publicKey", publicKeyStr);
+            keyPairMap.put("privateKey", privateKeyStr);
+
+            return keyPairMap;
+        }
+
+
+        /**
+         * 得到公钥
+         *
+         * @param publicKey 密钥字符串(经过base64编码)
+         * @throws Exception
+         */
+        public static RSAPublicKey getPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+            //通过X509编码的Key指令获得公钥对象
+            KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+            X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
+            RSAPublicKey key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
+            return key;
+        }
+
+        /**
+         * 得到私钥
+         *
+         * @param privateKey 密钥字符串(经过base64编码)
+         * @throws Exception
+         */
+        public static RSAPrivateKey getPrivateKey(String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
+            //通过PKCS#8编码的Key指令获得私钥对象
+            KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+            PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey));
+            RSAPrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
+            return key;
+        }
+
+        /**
+         * 公钥加密
+         *
+         * @param data
+         * @param publicKey
+         * @return
+         */
+        public static String publicEncrypt(String data, RSAPublicKey publicKey) {
+            try {
+                Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
+                cipher.init(Cipher.ENCRYPT_MODE, publicKey);
+                return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), publicKey.getModulus().bitLength()));
+            } catch (Exception e) {
+                throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
+            }
+        }
+        /**
+         * RSA算法使用私钥对数据生成数字签名
+         *
+         * @param data 待签名的明文字符串
+         * @param key  RSA私钥字符串
+         * @return RSA私钥签名后的经过Base64编码的字符串
+         */
+        public static String buildRSASignByPrivateKey(String data, String key) {
+            try {
+                //通过PKCS#8编码的Key指令获得私钥对象
+                PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(key));
+                KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+                PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
+                //sign
+                Signature signature = Signature.getInstance(RSA_ALGORITHM_SIGN);
+                signature.initSign(privateKey);
+                signature.update(data.getBytes(CHARSET));
+                return Base64.encodeBase64URLSafeString(signature.sign());
+            } catch (Exception e) {
+                throw new RuntimeException("签名字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        /**
+         * RSA算法使用公钥校验数字签名
+         *
+         * @param data 参与签名的明文字符串
+         * @param key  RSA公钥字符串
+         * @param sign RSA签名得到的经过Base64编码的字符串
+         * @return true--验签通过,false--验签未通过
+         */
+        public static boolean buildRSAverifyByPublicKey(String data, String key, String sign) {
+            try {
+                //通过X509编码的Key指令获得公钥对象
+                X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(key));
+                KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
+                PublicKey publicKey = keyFactory.generatePublic(x509KeySpec);
+                //verify
+                Signature signature = Signature.getInstance(RSA_ALGORITHM_SIGN);
+                signature.initVerify(publicKey);
+                signature.update(data.getBytes(CHARSET));
+                return signature.verify(Base64.decodeBase64(sign));
+            } catch (Exception e) {
+                throw new RuntimeException("验签字符串[" + data + "]时遇到异常", e);
+            }
+        }
+
+        private static byte[] rsaSplitCodec(Cipher cipher, int opmode, byte[] datas, int keySize) {
+            int maxBlock = 0;
+            if (opmode == Cipher.DECRYPT_MODE) {
+                maxBlock = keySize / 8;
+            } else {
+                maxBlock = keySize / 8 - 11;
+            }
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            int offSet = 0;
+            byte[] buff;
+            int i = 0;
+            try {
+                while (datas.length > offSet) {
+                    if (datas.length - offSet > maxBlock) {
+                        buff = cipher.doFinal(datas, offSet, maxBlock);
+                    } else {
+                        buff = cipher.doFinal(datas, offSet, datas.length - offSet);
+                    }
+                    out.write(buff, 0, buff.length);
+                    i++;
+                    offSet = i * maxBlock;
+                }
+            } catch (Exception e) {
+                throw new RuntimeException("加解密阀值为[" + maxBlock + "]的数据时发生异常", e);
+            }
+            byte[] resultDatas = out.toByteArray();
+            IOUtils.closeQuietly(out);
+            return resultDatas;
+        }
+    }
+
+}

+ 81 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/ZhaoZhuangXinYiRongCreditService.java

@@ -0,0 +1,81 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 12 14 10 48
+ **/
+@Slf4j
+@Service
+public class ZhaoZhuangXinYiRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.ZhaoZhuangXinYiRong;
+    }
+    @Data
+    private static class CheckInfo{
+        private String mobile_md5;//md5 的手机号
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit ZhaoZhuangXinYiRongCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("枣庄信易融对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            checkInfo.setMobile_md5(phoneMd5);
+            String checkUrl = config.getString("checkUrl");
+            String url=checkUrl+"?company="+config.getInteger("checkCompany")+"&mobile_md5="+checkInfo.getMobile_md5();
+            log.info("credit qualityCheck ZhaoZhuangXinYiRongCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,checkInfo, String.class);
+            }catch (Exception e){
+                log.error("枣庄信易融准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck ZhaoZhuangXinYiRongCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            JSONObject jsonObject=JSONObject.parseObject(response);
+
+            if (jsonObject == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (jsonObject.getInteger("code") == 0) {
+                return DataVo.success(0, "枣庄信易融撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "枣庄信易融撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("枣庄信易融撞库失败", e);
+            return DataVo.fail(1, "枣庄信易融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+}

+ 124 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/ZhongXinQiFuCreditService.java

@@ -0,0 +1,124 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+import com.hrsk.cloud.eg.app.constant.ServerCodeEnums;
+import com.hrsk.cloud.eg.app.threedocking.LoanDockingApi;
+import com.hrsk.cloud.eg.dto.data.egPlan.PlanDto;
+import com.hrsk.cloud.eg.dto.data.user.UserInBaseInfoDto;
+import com.hrsk.cloud.eg.infrastructure.config.client.config.RetryRestTemplate;
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.ProductBusinessApiInfoDo;
+import com.hrsk.cloud.eg.infrastructure.service.ProductBusinessApiInfoService;
+import com.hrsk.cloud.eg.infrastructure.utils.Md5Util;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 11 28 11 42
+ **/
+@Service
+@Slf4j
+public class ZhongXinQiFuCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.ZhongXinQiFu;
+    }
+    @Data
+    private static class CheckInfo{
+        private String md5mobile;//md5 的手机号
+        private String brand;//品牌对应数字(比如 6)
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+    {
+    "checkUrl": "https://www2.zhudaicms.com/sem/check_canindb.html",
+    "applyUrl": "https://www2.zhudaicms.com/sem/loan_do_aes_cbc_new.html",
+    "source": "yrf-hryk",
+    "brand": "1285",
+    "publickey": "zhudai#aes#cbc#1",
+    "iv": "2022042215123456"
+    }
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit ZhongXinQiFuCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("众鑫企服对接参数:{}", JSON.toJSONString(config));
+            CheckInfo checkInfo = new CheckInfo();
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            checkInfo.setMd5mobile(phoneMd5);
+            checkInfo.setBrand(config.getString("brand"));
+            String url = config.getString("checkUrl");
+            MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
+            params.add("md5mobile", phoneMd5);
+            params.add("brand", config.getString("brand"));
+            log.info("credit qualityCheck ZhongXinQiFuCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            String response = null;
+            try{
+                HttpHeaders headers = new HttpHeaders();
+                headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+                HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
+                response = httpRestTemplate.restTemplate().postForEntity(url, requestEntity, String.class).getBody();
+            }catch (Exception e){
+                log.error("众鑫企服准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck ZhongXinQiFuCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            if (response.equals("1")) {
+                return DataVo.success(0, "众鑫企服撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "众鑫企服撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("众鑫企服撞库失败", e);
+            return DataVo.fail(1, "众鑫企服撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    public static String encrypt(String plainText, String key, String iv) throws Exception {
+        // 将 key 转换为 SecretKey 对象
+        SecretKey secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
+        // 将 IV 字符串转换为字节数组
+        byte[] ivBytes = iv.getBytes(StandardCharsets.UTF_8);
+        // 生成 IV
+        // 创建 Cipher 对象
+        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, new IvParameterSpec(ivBytes));
+        // 加密明文
+        byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(StandardCharsets.UTF_8));
+        // 将加密后的字节转换为 Base64 编码
+        return Base64.getEncoder().encodeToString(encryptedBytes);
+    }
+}

+ 4 - 0
egress-gateway-service-infrastructure/pom.xml

@@ -58,5 +58,9 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk15on</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 40 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/AESPKCS5Padding.java

@@ -0,0 +1,40 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+import org.apache.commons.codec.binary.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 05 14 15 29
+ **/
+public class AESPKCS5Padding {
+    public static String Encrypt(String sSrc, String sKey) throws Exception {
+        if (sKey == null) {
+            System.out.print("Key为空null");
+            return null;
+        }
+        if (sKey.length() != 16) {
+            System.out.print("Key长度不是16位");
+            return null;
+        }
+        byte[] raw = sKey.getBytes("utf-8");
+        SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
+        cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+        byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
+
+        return Base64.encodeBase64String(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。
+    }
+
+    public static void main(String[] args) {
+        String s="sasada";
+        String key="DDy5gzHdv4jzTtws";
+        try {
+            System.out.println(Encrypt(s, key));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 95 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/AESUtilPkcs7.java

@@ -0,0 +1,95 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+import org.apache.commons.codec.binary.Base64;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.Security;
+
+public class AESUtilPkcs7 {
+    /*
+     * 加密用的Key 可以用26个字母和数字组成 使用AES-128-CBC加密模式,key需要为16位。
+     */
+    private static final String key = "nLnE4JFFbF6eAzja";
+    private static final String iv = "EJ9iIPhzB4I5UDfs";
+
+    static{
+        try{
+            Security.addProvider(new BouncyCastleProvider());
+        }catch(Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * @author miracle.qu
+     * @Description AES算法加密明文
+     * @param data 明文
+     * @return 密文
+     */
+    public static String encryptAES(String data,String ekey,String eiv) throws Exception {
+        try {
+
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
+
+            SecretKeySpec keyspec = new SecretKeySpec(ekey.getBytes("UTF-8"), "AES");
+            // CBC模式,需要一个向量iv,可增加加密算法的强度
+            IvParameterSpec ivspec = new IvParameterSpec(eiv.getBytes("UTF-8"));
+
+            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
+            byte[] encrypted = cipher.doFinal(data.getBytes("UTF-8"));
+            // BASE64做转码。
+            return AESUtilPkcs7.encode(encrypted).trim();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * @author miracle.qu
+     * @Description AES算法解密密文
+     * @param data 密文
+     * @return 明文
+     */
+    public static String decryptAES(String data,String ekey,String eiv) throws Exception {
+        try
+        {
+            //先用base64解密
+            byte[] encrypted1 = AESUtilPkcs7.decode(data);
+
+            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
+            SecretKeySpec keyspec = new SecretKeySpec(ekey.getBytes("UTF-8"), "AES");
+            IvParameterSpec ivspec = new IvParameterSpec(eiv.getBytes("UTF-8"));
+
+            cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
+
+            byte[] original = cipher.doFinal(encrypted1);
+            String originalString = new String(original);
+            return originalString.trim();
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+    /**
+     * 编码
+     * @param byteArray
+     * @return
+     */
+    public static String encode(byte[] byteArray) {
+        return new String(new Base64().encode(byteArray));
+    }
+
+    /**
+     * 解码
+     * @param base64EncodedString
+     * @return
+     */
+    public static byte[] decode(String base64EncodedString) {
+        return new Base64().decode(base64EncodedString);
+    }
+}

+ 221 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/AesCBCUtil.java

@@ -0,0 +1,221 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+
+import org.apache.commons.codec.Charsets;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.crypto.*;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+
+public class AesCBCUtil {
+	//使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同!
+	private static String KEY = "dufy20170329java";
+
+	private static String IV = "dufy20170329java";
+
+	/**
+	 * 加密方法
+	 * @param data  要加密的数据
+	 * @param key 加密key
+	 * @param iv 加密iv
+	 * @return 加密的结果
+	 * @throws Exception
+	 */
+	public static String encryptNoPadding(String data, String key, String iv) throws Exception {
+		try {
+			Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式"
+			int blockSize = cipher.getBlockSize();
+
+			byte[] dataBytes = data.getBytes();
+			int plaintextLength = dataBytes.length;
+			if (plaintextLength % blockSize != 0) {
+				plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
+			}
+
+			byte[] plaintext = new byte[plaintextLength];
+			System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
+
+			SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+			IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+			cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
+			byte[] encrypted = cipher.doFinal(plaintext);
+			return new Base64().encodeToString(encrypted);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	/**
+	 * 解密方法
+	 * @param data 要解密的数据
+	 * @param key  解密key
+	 * @param iv 解密iv
+	 * @return 解密的结果
+	 * @throws Exception
+	 */
+	public static String desEncryptNoPadding(String data, String key, String iv) throws Exception {
+		try {
+			byte[] encrypted1 = new Base64().decode(data);
+			return desEncryptNoPadding(encrypted1,key, iv);
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	private static String desEncryptNoPadding(byte[] src,String key, String iv)
+			throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
+			InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
+		Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+		SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+		IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+		cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
+
+		byte[] original = cipher.doFinal(src);
+		String originalString = new String(original);
+		return originalString;
+	}
+	/**
+	 * 使用默认的key和iv加密
+	 * @param data
+	 * @return
+	 * @throws Exception
+	 */
+	public static String encryptNoPadding(String data) throws Exception {
+		return encryptNoPadding(data, KEY, IV);
+	}
+
+	/**
+	 * 使用默认的key和iv解密
+	 * @param data
+	 * @return
+	 * @throws Exception
+	 */
+	public static String desEncryptNoPadding(String data) throws Exception {
+		return desEncryptNoPadding(data, KEY, IV);
+	}
+	public static String encryptPKCS5PADDING(String data, String key, String iv) throws Exception {
+		try {
+			Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");//"算法/模式/补码方式"
+			int blockSize = cipher.getBlockSize();
+
+			byte[] dataBytes = data.getBytes();
+			int plaintextLength = dataBytes.length;
+			if (plaintextLength % blockSize != 0) {
+				plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
+			}
+			byte[] plaintext = new byte[plaintextLength];
+			System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
+
+			SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+			IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+			cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
+			byte[] encrypted = cipher.doFinal(plaintext);
+
+			return new Base64().encodeToString(encrypted);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	 /**
+     * 加密数据
+     *
+     * @param data 待加密数据
+     * @param key  密钥
+     */
+    public static byte[] encryptPKCS5PADDING(byte[] data, byte[] key) throws Exception {
+        if (key.length != 16) {
+            throw new RuntimeException("AES加密失败, 密钥不是128位");
+        }
+        Cipher cipher = Cipher.getInstance("AES");
+        SecretKeySpec keySpec = new SecretKeySpec(key, "AES");
+        cipher.init(Cipher.ENCRYPT_MODE, keySpec);
+        return cipher.doFinal(data);
+    }
+
+    /**
+     * 解密数据
+     *
+     * @param value 待解密数据
+     * @param key   密钥
+     */
+    public static byte[] decryptPKCS5PADDING(byte[] value, byte[] key) throws Exception {
+        if (key.length != 16) {
+            throw new RuntimeException("AES解密失败, 密钥不是128位");
+        }
+        Cipher cipher = Cipher.getInstance("AES");
+        SecretKey keySpec = new SecretKeySpec(key, "AES");
+        cipher.init(Cipher.DECRYPT_MODE, keySpec);
+        return cipher.doFinal(value);
+    }
+
+
+    /**
+     * 默认的AES加密字符串方法,可以内部使用
+     * 对明文的UTF-8编码字节进行加密,然后使用Base64转码
+     * 密钥使用UTF-8编码
+     *
+     * @param data 明文
+     * @param key  加密密钥
+     */
+    public static String encryptPKCS5PADDING(String data, String key) throws Exception {
+        if (StringUtils.isEmpty(data) || StringUtils.isEmpty(key)) {
+            throw new RuntimeException("AES加密失败, 参数有误. data: " + data + ", key: " + key);
+        }
+        byte[] keyBytes = key.getBytes(Charsets.UTF_8);
+        byte[] dataBytes = data.getBytes(Charsets.UTF_8);
+        byte[] encryptBytes = encryptPKCS5PADDING(dataBytes, keyBytes);
+        return new String(java.util.Base64.getEncoder().encode(encryptBytes));
+    }
+
+    /**
+     * 默认的AES解密字符串方法,可以内部使用
+     * 对密文使用Base64转码后,再进行解密,然后再转为UTF-8编码
+     * 密钥使用UTF-8编码
+     *
+     * @param
+     * @param key        加密密钥
+     */
+	public static byte[] desEncryptPKCS5PADDING(byte[] value, byte[] key) throws Exception {
+		if (key.length != 16) {
+			throw new RuntimeException("AES解密失败, 密钥不是128位");
+		}
+		Cipher cipher = Cipher.getInstance("AES");
+		SecretKey keySpec = new SecretKeySpec(key, "AES");
+		cipher.init(Cipher.DECRYPT_MODE, keySpec);
+		return cipher.doFinal(value);
+	}
+
+	public static String desEncryptPKCS5PADDING(String ciphertext, String key) throws Exception {
+		if (StringUtils.isEmpty(ciphertext) || StringUtils.isEmpty(key)) {
+			throw new RuntimeException("AES解密失败, 参数有误. ciphertext: " + ciphertext + ", key: " + key);
+		}
+		byte[] keyBytes = key.getBytes(Charsets.UTF_8);
+		byte[] dataBytes = java.util.Base64.getDecoder().decode(ciphertext);
+		byte[] keyBytesDecrypt = desEncryptPKCS5PADDING(dataBytes, keyBytes);
+		return new String(keyBytesDecrypt, Charsets.UTF_8);
+	}
+
+	/**
+	* 测试
+	*/
+	public static void main(String args[]) throws Exception {
+
+
+	}
+
+}

+ 110 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/SM3Util.java

@@ -0,0 +1,110 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+import org.apache.catalina.manager.host.Constants;
+import org.bouncycastle.crypto.digests.SM3Digest;
+import org.bouncycastle.crypto.macs.HMac;
+import org.bouncycastle.crypto.params.KeyParameter;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
+
+import java.io.UnsupportedEncodingException;
+import java.security.Security;
+import java.util.Arrays;
+import java.util.Objects;
+/**
+ * @author jiwancheng
+ * @date 2020/10/20
+ */
+public class SM3Util {
+    static {
+        Security.addProvider(new BouncyCastleProvider());
+    }
+    /**
+     * 计算SM3摘要值
+     *
+     * @param srcData 原⽂
+     * @return 摘要值,对于SM3算法来说是32字节
+     */
+    public static byte[] hash(byte[] srcData) {
+        SM3Digest digest = new SM3Digest();
+        digest.update(srcData, 0, srcData.length);
+        byte[] hash = new byte[digest.getDigestSize()];
+        digest.doFinal(hash, 0);
+        return hash;
+    }
+    /**
+     * 验证摘要
+     *
+     * @param srcData 原⽂
+     * @param sm3Hash 摘要值
+     * @return 返回true标识验证成功,false标识验证失败
+     */
+    public static boolean verify(byte[] srcData, byte[] sm3Hash) {
+        byte[] newHash = hash(srcData);
+        return Arrays.equals(newHash, sm3Hash);
+    }
+    /**
+     * 计算SM3 Mac值
+     *
+     * @param key
+     * @param srcData
+     * @return
+     */
+    public static String hmac(String key, String srcData) {
+        byte[] hmac = new byte[0];
+        try {
+            hmac = hmac(key.getBytes(Constants.CHARSET), srcData.getBytes(Constants.CHARSET));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        return ByteUtils.toHexString(hmac);
+    }
+    /**
+     * 计算SM3 Mac值
+     *
+     * @param key key值,可以是任意⻓度的字节数组
+     * @param srcData 原⽂
+     * @return Mac值,对于HMac-SM3来说是32字节
+     */
+    public static byte[] hmac(byte[] key, byte[] srcData) {
+        KeyParameter keyParameter = new KeyParameter(key);
+        SM3Digest digest = new SM3Digest();
+        HMac mac = new HMac(digest);
+        mac.init(keyParameter);
+        mac.update(srcData, 0, 1);
+        byte[] result = new byte[mac.getMacSize()];
+        mac.doFinal(result,0);
+        return result;
+    }
+    /**
+     * SM3摘要加密
+     * @param input 需要加密的数据
+     * @param key 密钥
+     * @return 签名
+     **/
+    public static byte[] sm3(byte[] input, byte[] key) {
+        HMac mac = new HMac(new SM3Digest());
+        mac.init(new KeyParameter(key));
+        mac.update(input, 0, input.length);
+        byte[] signByte = new byte[mac.getMacSize()];
+        mac.doFinal(signByte, 0);
+        return signByte;
+    }
+    /**
+     * 判断源数据与加密数据是否⼀致
+     *
+     * @param srcStr 原字符串
+     * @param sm3HexString 16进制字符串
+     * @return 校验结果
+     * @explain 通过验证原数组和⽣成的hash数组是否为同⼀数组,验证2者是否为同⼀数据
+     */
+    public static boolean verifyHmac(String srcStr, String sm3HexString,
+                                     String key) {
+        boolean flag = false;
+        String newHash = hmac(key, srcStr);
+        if (Objects.equals(newHash, sm3HexString)) {
+            flag = true;
+        }
+        return flag;
+    }
+}

+ 268 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/SM4Util.java

@@ -0,0 +1,268 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+import org.apache.catalina.manager.host.Constants;
+import org.apache.commons.codec.binary.Hex;
+import org.apache.commons.lang3.StringUtils;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.pqc.math.linearalgebra.ByteUtils;
+import org.bouncycastle.util.encoders.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.security.Key;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.util.Arrays;
+/**
+ * @Author Liu Tao
+ * @Date 2024 03 18 11 56
+ **/
+public class SM4Util {
+    static {
+        Security.addProvider(new BouncyCastleProvider());
+    }
+    public static final String ALGORITHM_NAME = "SM4";
+    private static final String SYSTEM_KEY = "D5AFF760F8A0F095E1268D5EA6A82269";
+    /**
+     * 加密算法/分组加密模式/分组填充⽅式
+     * PKCS5Padding-以8个字节为⼀组进⾏分组加密
+     * 定义分组加密模式使⽤:PKCS5Padding
+     */
+    public static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS5Padding";
+    private static final String ALGORITHM_CBC_PKCS5PADDING = "SM4/CBC/PKCS5Padding";
+/**
+ * 128-32位16进制;256-64位16进制
+ */
+public static final int DEFAULT_KEY_SIZE = 128;
+    /**
+     * ⾃动⽣成密钥
+     *
+     * @return
+     * @explain
+     */
+    public static String generateKey() {
+        try {
+            byte[] data = generateKey(DEFAULT_KEY_SIZE);
+            return new String(Hex.encodeHex(data, false));
+        } catch (Throwable e) {
+            return null;
+        }
+    }
+    /**
+     * @param keySize
+     * @return
+     * @throws Exception
+     * @explain
+     */
+    public static byte[] generateKey(int keySize) throws Exception {
+        KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME);
+        kg.init(keySize, new SecureRandom());
+        return kg.generateKey().getEncoded();
+    }
+    /**
+     * ⽣成ECB暗号
+     *
+     * @param algorithmName 算法名称
+     * @param mode 模式
+     * @param key
+     * @return
+     * @throws Exception
+     * @explain ECB模式(电⼦密码本模式:Electronic codebook)
+     */
+    private static Cipher generateEcbCipher(String algorithmName, int mode, byte[] key) throws Exception {
+        Cipher cipher = Cipher.getInstance(algorithmName, BouncyCastleProvider.PROVIDER_NAME);
+        Key sm4Key = new SecretKeySpec(key, ALGORITHM_NAME);
+        cipher.init(mode, sm4Key);
+        return cipher;
+    }
+    /**
+     * sm4加密
+     *
+     * @param hexKey 16进制密钥(忽略⼤⼩写)
+     * @param paramStr 待加密字符串
+     * @return 返回16进制的加密字符串
+     * @explain 加密模式:ECB
+     * 密⽂⻓度不固定,会随着被加密字符串⻓度的变化⽽变化
+     */
+    public static String encryptEcb(String hexKey, String paramStr) {
+        try {
+            // 16进制字符串-->byte[]
+            byte[] keyData = ByteUtils.fromHexString(hexKey);
+            // String-->byte[]
+            byte[] srcData = paramStr.getBytes(Constants.CHARSET);
+            // 加密后的数组
+            byte[] cipherArray = encrypt_Ecb_Padding(keyData, srcData);
+            // byte[]-->hexString
+            return ByteUtils.toHexString(cipherArray);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    /**
+     * 将明⽂字符串加密为BASE64
+     *
+     * @param data 要加密的明⽂
+     * @param secretKey 16位密钥
+     * @return 加密后BASE64密⽂
+     * @throws Exception 加密异常
+     */
+    public static String encryptStrToBase64(String data, String secretKey
+    ) throws Exception {
+        return Base64.toBase64String(encrypt(data.getBytes(Constants.CHARSET), secretKey));
+    }
+/**
+ * 加密
+ *
+ * @param data 要加密的明⽂
+ * @param secretKey 16位密钥
+ * @return 加密后的密⽂
+ * @throws Exception 加密异常
+ */
+public static byte[] encrypt(byte[] data, String secretKey) throws Exception {
+        return sm4(data, secretKey.getBytes(Constants.CHARSET), Cipher.ENCRYPT_MODE);
+    }
+    /**
+     * 将BASE64密⽂解密为明⽂字符串
+     *
+     * @param base64Encrypt 要解密的BASE64密⽂
+     * @param secretKey 16位密钥
+     * @return 解密后的明⽂字符串
+     * @throws Exception 加密异常
+     */
+    public static String decryptBase64ToStr(String base64Encrypt, String
+            secretKey) throws Exception {
+        byte[] decryptByte = decrypt(Base64.decode(base64Encrypt), secretKey);
+        return new String(decryptByte, StandardCharsets.UTF_8);
+    }
+    /**
+     * 解密
+     *
+     * @param data 要解密的密⽂
+     * @param secretKey 16位密钥
+     * @return 解密后的明⽂
+     * @throws Exception 解密异常
+     */
+    public static byte[] decrypt(byte[] data, String secretKey) throws Exception {
+        return sm4(data, secretKey.getBytes(Constants.CHARSET), Cipher.DECRYPT_MODE);
+    }
+    /**
+     * SM4对称加解密
+     *
+     * @param input 需要加密或解密的数据
+     * @param key 密钥
+     * @param mode Cipher.ENCRYPT_MODE - 加密;Cipher.DECRYPT_MODE - 解密
+     * @return 密⽂(加密模式)或明⽂(解密模式)
+     * @throws Exception 加解密异常
+     */
+    private static byte[] sm4(byte[] input, byte[] key, int mode) throws
+            Exception{
+        SecretKeySpec sm4Key = new SecretKeySpec(key, ALGORITHM_NAME);
+        Cipher cipher = Cipher.getInstance(ALGORITHM_CBC_PKCS5PADDING, BouncyCastleProvider.PROVIDER_NAME);
+        cipher.init(mode, sm4Key, new IvParameterSpec(new byte[16]));
+        return cipher.doFinal(input);
+    }
+    /**
+     * 加密模式之Ecb
+     *
+     * @param key
+     * @param data
+     * @return
+     * @throws Exception
+     * @explain
+     */
+    public static byte[] encrypt_Ecb_Padding(byte[] key, byte[] data) throws Exception {
+        Cipher cipher = generateEcbCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.ENCRYPT_MODE, key);
+        return cipher.doFinal(data);
+    }
+    /**
+     * sm4解密
+     *
+     * @param hexKey 16进制密钥
+     * @param cipherText 16进制的加密字符串(忽略⼤⼩写)
+     * @return 解密后的字符串
+     * @throws Exception
+     * @explain 解密模式:采⽤ECB
+     */
+    public static String decryptEcb(String hexKey, String cipherText) {
+        // ⽤于接收解密后的字符串
+        String decryptStr = "";
+        // hexString-->byte[]
+        byte[] keyData = ByteUtils.fromHexString(hexKey);
+        // hexString-->byte[]
+        byte[] cipherData = ByteUtils.fromHexString(cipherText);
+        // 解密
+        try {
+            byte[] srcData = decrypt_Ecb_Padding(keyData, cipherData);
+            // byte[]-->String
+            decryptStr = new String(srcData, Constants.CHARSET);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return decryptStr;
+    }
+    /**
+     * 解密
+     *
+     * @param key
+     * @param cipherText
+     * @return
+     * @throws Exception
+     * @explain
+     */
+    public static byte[] decrypt_Ecb_Padding(byte[] key, byte[] cipherText) throws Exception {
+        Cipher cipher = generateEcbCipher(ALGORITHM_NAME_ECB_PADDING, Cipher.DECRYPT_MODE, key);
+        return cipher.doFinal(cipherText);
+    }
+    /**
+     * 校验加密前后的字符串是否为同⼀数据
+     *
+     * @param hexKey 16进制密钥(忽略⼤⼩写)
+     * @param cipherText 16进制加密后的字符串
+     * @param paramStr 加密前的字符串
+     * @return 是否为同⼀数据
+     * @throws Exception
+     * @explain
+     */
+    public static boolean verifyEcb(String hexKey, String cipherText, String paramStr) throws Exception {
+        // ⽤于接收校验结果
+        boolean flag = false;
+        // hexString-->byte[]
+        byte[] keyData = ByteUtils.fromHexString(hexKey);
+        // 将16进制字符串转换成数组
+        byte[] cipherData = ByteUtils.fromHexString(cipherText);
+        // 解密
+        byte[] decryptData = decrypt_Ecb_Padding(keyData, cipherData);
+        // 将原字符串转换成byte[]
+        byte[] srcData = paramStr.getBytes(Constants.CHARSET);
+        // 判断2个数组是否⼀致
+        flag = Arrays.equals(decryptData, srcData);
+        return flag;
+    }
+/**
+ * ⽤系统密钥加密
+ *
+ * @param str
+ * @return
+ */
+public static String encryptSystemKey(String str) {
+    if (StringUtils.isEmpty(str)) {
+        return null;
+    }
+    return SM4Util.encryptEcb(SYSTEM_KEY, str);
+}
+    /**
+     * ⽤系统密钥解密
+     *
+     * @param str
+     * @return
+     */
+    public static String decryptSystemKey(String str) {
+        if (StringUtils.isEmpty(str)) {
+            return null;
+        }
+        return SM4Util.decryptEcb(SYSTEM_KEY, str);
+    }
+ }

+ 258 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/UserNameUtil.java

@@ -0,0 +1,258 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 复姓工具类
+ */
+public class UserNameUtil {
+
+    public static Set<String> DOUBLE_SURNAME_SET = new HashSet<>();
+
+    static {
+        DOUBLE_SURNAME_SET.add("单于");
+        DOUBLE_SURNAME_SET.add("叱干");
+        DOUBLE_SURNAME_SET.add("叱利");
+        DOUBLE_SURNAME_SET.add("车非");
+        DOUBLE_SURNAME_SET.add("车公");
+        DOUBLE_SURNAME_SET.add("车侯");
+        DOUBLE_SURNAME_SET.add("车长");
+        DOUBLE_SURNAME_SET.add("车绵");
+        DOUBLE_SURNAME_SET.add("独孤");
+        DOUBLE_SURNAME_SET.add("大野");
+        DOUBLE_SURNAME_SET.add("独吉");
+        DOUBLE_SURNAME_SET.add("达奚");
+        DOUBLE_SURNAME_SET.add("达官");
+        DOUBLE_SURNAME_SET.add("达仲");
+        DOUBLE_SURNAME_SET.add("达品");
+        DOUBLE_SURNAME_SET.add("哥舒");
+        DOUBLE_SURNAME_SET.add("哥夜");
+        DOUBLE_SURNAME_SET.add("哥翰");
+        DOUBLE_SURNAME_SET.add("哥汗");
+        DOUBLE_SURNAME_SET.add("赫连");
+        DOUBLE_SURNAME_SET.add("呼延");
+        DOUBLE_SURNAME_SET.add("贺兰");
+        DOUBLE_SURNAME_SET.add("黑齿");
+        DOUBLE_SURNAME_SET.add("斛律");
+        DOUBLE_SURNAME_SET.add("斛粟");
+        DOUBLE_SURNAME_SET.add("贺若");
+        DOUBLE_SURNAME_SET.add("贺奴");
+        DOUBLE_SURNAME_SET.add("贺远");
+        DOUBLE_SURNAME_SET.add("贺元");
+        DOUBLE_SURNAME_SET.add("夹谷");
+        DOUBLE_SURNAME_SET.add("吉胡");
+        DOUBLE_SURNAME_SET.add("吉利");
+        DOUBLE_SURNAME_SET.add("吉家");
+        DOUBLE_SURNAME_SET.add("可频");
+        DOUBLE_SURNAME_SET.add("慕容");
+        DOUBLE_SURNAME_SET.add("万俟");
+        DOUBLE_SURNAME_SET.add("万红");
+        DOUBLE_SURNAME_SET.add("万中");
+        DOUBLE_SURNAME_SET.add("抹捻");
+        DOUBLE_SURNAME_SET.add("纳兰");
+        DOUBLE_SURNAME_SET.add("纳西");
+        DOUBLE_SURNAME_SET.add("纳吉");
+        DOUBLE_SURNAME_SET.add("纳罕");
+        DOUBLE_SURNAME_SET.add("纳塞");
+        DOUBLE_SURNAME_SET.add("纳博");
+        DOUBLE_SURNAME_SET.add("纳称");
+        DOUBLE_SURNAME_SET.add("纳勉");
+        DOUBLE_SURNAME_SET.add("普周");
+        DOUBLE_SURNAME_SET.add("仆固");
+        DOUBLE_SURNAME_SET.add("仆散");
+        DOUBLE_SURNAME_SET.add("蒲察");
+        DOUBLE_SURNAME_SET.add("屈突");
+        DOUBLE_SURNAME_SET.add("屈卢");
+        DOUBLE_SURNAME_SET.add("钳耳");
+        DOUBLE_SURNAME_SET.add("是云");
+        DOUBLE_SURNAME_SET.add("索卢");
+        DOUBLE_SURNAME_SET.add("厍狄");
+        DOUBLE_SURNAME_SET.add("拓跋");
+        DOUBLE_SURNAME_SET.add("同蹄");
+        DOUBLE_SURNAME_SET.add("秃发");
+        DOUBLE_SURNAME_SET.add("完颜");
+        DOUBLE_SURNAME_SET.add("完明");
+        DOUBLE_SURNAME_SET.add("完忠");
+        DOUBLE_SURNAME_SET.add("宇文");
+        DOUBLE_SURNAME_SET.add("尉迟");
+        DOUBLE_SURNAME_SET.add("耶律");
+        DOUBLE_SURNAME_SET.add("耶红");
+        DOUBLE_SURNAME_SET.add("也先");
+        DOUBLE_SURNAME_SET.add("耶鲜");
+        DOUBLE_SURNAME_SET.add("耶闻");
+        DOUBLE_SURNAME_SET.add("长孙");
+        DOUBLE_SURNAME_SET.add("长南");
+        DOUBLE_SURNAME_SET.add("长北");
+        DOUBLE_SURNAME_SET.add("长西");
+        DOUBLE_SURNAME_SET.add("长红");
+        DOUBLE_SURNAME_SET.add("长元");
+        DOUBLE_SURNAME_SET.add("长秋");
+        DOUBLE_SURNAME_SET.add("长寸");
+        DOUBLE_SURNAME_SET.add("长李");
+        DOUBLE_SURNAME_SET.add("长云");
+        DOUBLE_SURNAME_SET.add("闻人");
+        DOUBLE_SURNAME_SET.add("巫马");
+        DOUBLE_SURNAME_SET.add("微生");
+        DOUBLE_SURNAME_SET.add("王孙");
+        DOUBLE_SURNAME_SET.add("无庸");
+        DOUBLE_SURNAME_SET.add("夏侯");
+        DOUBLE_SURNAME_SET.add("西门");
+        DOUBLE_SURNAME_SET.add("信平");
+        DOUBLE_SURNAME_SET.add("鲜于");
+        DOUBLE_SURNAME_SET.add("轩辕");
+        DOUBLE_SURNAME_SET.add("相里");
+        DOUBLE_SURNAME_SET.add("新垣");
+        DOUBLE_SURNAME_SET.add("徐离");
+        DOUBLE_SURNAME_SET.add("羊舌");
+        DOUBLE_SURNAME_SET.add("羊角");
+        DOUBLE_SURNAME_SET.add("延陵");
+        DOUBLE_SURNAME_SET.add("於陵");
+        DOUBLE_SURNAME_SET.add("伊祁");
+        DOUBLE_SURNAME_SET.add("吾丘");
+        DOUBLE_SURNAME_SET.add("乐正");
+        DOUBLE_SURNAME_SET.add("只斤");
+        DOUBLE_SURNAME_SET.add("诸葛");
+        DOUBLE_SURNAME_SET.add("颛孙");
+        DOUBLE_SURNAME_SET.add("仲孙");
+        DOUBLE_SURNAME_SET.add("仲长");
+        DOUBLE_SURNAME_SET.add("钟离");
+        DOUBLE_SURNAME_SET.add("宗政");
+        DOUBLE_SURNAME_SET.add("主父");
+        DOUBLE_SURNAME_SET.add("中叔");
+        DOUBLE_SURNAME_SET.add("左人");
+        DOUBLE_SURNAME_SET.add("左丘");
+        DOUBLE_SURNAME_SET.add("宰父");
+        DOUBLE_SURNAME_SET.add("长儿");
+        DOUBLE_SURNAME_SET.add("仉督");
+        DOUBLE_SURNAME_SET.add("百里");
+        DOUBLE_SURNAME_SET.add("北堂");
+        DOUBLE_SURNAME_SET.add("北野");
+        DOUBLE_SURNAME_SET.add("北宫");
+        DOUBLE_SURNAME_SET.add("辟闾");
+        DOUBLE_SURNAME_SET.add("孛尔");
+        DOUBLE_SURNAME_SET.add("淳于");
+        DOUBLE_SURNAME_SET.add("成公");
+        DOUBLE_SURNAME_SET.add("陈生");
+        DOUBLE_SURNAME_SET.add("褚师");
+        DOUBLE_SURNAME_SET.add("端木");
+        DOUBLE_SURNAME_SET.add("东方");
+        DOUBLE_SURNAME_SET.add("东郭");
+        DOUBLE_SURNAME_SET.add("东野");
+        DOUBLE_SURNAME_SET.add("东门");
+        DOUBLE_SURNAME_SET.add("第五");
+        DOUBLE_SURNAME_SET.add("大狐");
+        DOUBLE_SURNAME_SET.add("段干");
+        DOUBLE_SURNAME_SET.add("段阳");
+        DOUBLE_SURNAME_SET.add("带曰");
+        DOUBLE_SURNAME_SET.add("第二");
+        DOUBLE_SURNAME_SET.add("东宫");
+        DOUBLE_SURNAME_SET.add("公孙");
+        DOUBLE_SURNAME_SET.add("公冶");
+        DOUBLE_SURNAME_SET.add("公羊");
+        DOUBLE_SURNAME_SET.add("公良");
+        DOUBLE_SURNAME_SET.add("公西");
+        DOUBLE_SURNAME_SET.add("公孟");
+        DOUBLE_SURNAME_SET.add("高堂");
+        DOUBLE_SURNAME_SET.add("高阳");
+        DOUBLE_SURNAME_SET.add("公析");
+        DOUBLE_SURNAME_SET.add("公肩");
+        DOUBLE_SURNAME_SET.add("公坚");
+        DOUBLE_SURNAME_SET.add("郭公");
+        DOUBLE_SURNAME_SET.add("谷梁");
+        DOUBLE_SURNAME_SET.add("毌将");
+        DOUBLE_SURNAME_SET.add("公乘");
+        DOUBLE_SURNAME_SET.add("毌丘");
+        DOUBLE_SURNAME_SET.add("公户");
+        DOUBLE_SURNAME_SET.add("公广");
+        DOUBLE_SURNAME_SET.add("公仪");
+        DOUBLE_SURNAME_SET.add("公祖");
+        DOUBLE_SURNAME_SET.add("皇甫");
+        DOUBLE_SURNAME_SET.add("黄龙");
+        DOUBLE_SURNAME_SET.add("胡母");
+        DOUBLE_SURNAME_SET.add("何阳");
+        DOUBLE_SURNAME_SET.add("夹谷");
+        DOUBLE_SURNAME_SET.add("九方");
+        DOUBLE_SURNAME_SET.add("即墨");
+        DOUBLE_SURNAME_SET.add("梁丘");
+        DOUBLE_SURNAME_SET.add("闾丘");
+        DOUBLE_SURNAME_SET.add("洛阳");
+        DOUBLE_SURNAME_SET.add("陵尹");
+        DOUBLE_SURNAME_SET.add("冷富");
+        DOUBLE_SURNAME_SET.add("龙丘");
+        DOUBLE_SURNAME_SET.add("令狐");
+        DOUBLE_SURNAME_SET.add("林彭");
+        DOUBLE_SURNAME_SET.add("南宫");
+        DOUBLE_SURNAME_SET.add("南郭");
+        DOUBLE_SURNAME_SET.add("女娲");
+        DOUBLE_SURNAME_SET.add("南伯");
+        DOUBLE_SURNAME_SET.add("南容");
+        DOUBLE_SURNAME_SET.add("南门");
+        DOUBLE_SURNAME_SET.add("南野");
+        DOUBLE_SURNAME_SET.add("欧阳");
+        DOUBLE_SURNAME_SET.add("欧侯");
+        DOUBLE_SURNAME_SET.add("濮阳");
+        DOUBLE_SURNAME_SET.add("青阳");
+        DOUBLE_SURNAME_SET.add("漆雕");
+        DOUBLE_SURNAME_SET.add("亓官");
+        DOUBLE_SURNAME_SET.add("渠丘");
+        DOUBLE_SURNAME_SET.add("壤驷");
+        DOUBLE_SURNAME_SET.add("上官");
+        DOUBLE_SURNAME_SET.add("少室");
+        DOUBLE_SURNAME_SET.add("少叔");
+        DOUBLE_SURNAME_SET.add("司徒");
+        DOUBLE_SURNAME_SET.add("司马");
+        DOUBLE_SURNAME_SET.add("司空");
+        DOUBLE_SURNAME_SET.add("司寇");
+        DOUBLE_SURNAME_SET.add("士孙");
+        DOUBLE_SURNAME_SET.add("申屠");
+        DOUBLE_SURNAME_SET.add("申徒");
+        DOUBLE_SURNAME_SET.add("申鲜");
+        DOUBLE_SURNAME_SET.add("申叔");
+        DOUBLE_SURNAME_SET.add("夙沙");
+        DOUBLE_SURNAME_SET.add("叔先");
+        DOUBLE_SURNAME_SET.add("叔仲");
+        DOUBLE_SURNAME_SET.add("侍其");
+        DOUBLE_SURNAME_SET.add("叔孙");
+        DOUBLE_SURNAME_SET.add("澹台");
+        DOUBLE_SURNAME_SET.add("太史");
+        DOUBLE_SURNAME_SET.add("太叔");
+        DOUBLE_SURNAME_SET.add("太公");
+        DOUBLE_SURNAME_SET.add("屠岸");
+        DOUBLE_SURNAME_SET.add("唐古");
+    }
+
+    public static String parseUserFirstName(String userName){
+        if(StringUtils.isEmpty(userName)){
+            return userName;
+        }
+        if(userName.length() > 2){
+            String firstName = userName.substring(0, 2);
+            if (DOUBLE_SURNAME_SET.contains(firstName)) {
+                return firstName;
+            }else{
+                return getFirstWord(userName);
+            }
+        }
+        return userName.substring(0,1);
+    }
+
+    public static String getFirstWord(String name){
+        return name.substring(0,1);
+    }
+
+    public static boolean checkChineseName(String name){
+        if(null == name || StringUtils.isBlank(name)){
+            return true;
+        }
+        String regex = "^[\u4e00-\u9fa5·]{2,12}$";
+        Pattern pattern = Pattern.compile(regex);
+        Matcher matcher = pattern.matcher(name);
+        return matcher.matches();
+    }
+
+}

+ 29 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/UserUtils.java

@@ -0,0 +1,29 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * @Descrption
+ * @Author: chend
+ * @Date: 2023/4/7
+ * @Version V1.0
+ **/
+public class UserUtils {
+
+    public static String getUserName(String realName,String sex){
+        if(StringUtils.isBlank(realName) || StringUtils.isBlank(sex)){
+            return realName;
+        }
+        String firstName=realName.substring(0, 1);
+        if(realName.startsWith("诸葛")||
+                realName.startsWith("上官")||
+                realName.startsWith("欧阳")||
+                realName.startsWith("东方")||
+                realName.startsWith("公孙")||
+                realName.startsWith("司马")){
+            firstName=realName.substring(0, 2);
+        }
+        return "男".equals(sex)? firstName + "先生":firstName + "女士";
+    }
+
+}

+ 6 - 0
pom.xml

@@ -30,6 +30,7 @@
         <jedis.version>4.2.2</jedis.version>
         <jetcache.version>2.5.14</jetcache.version>
         <redis.version>2.7.6</redis.version>
+        <bcprov.version>1.56</bcprov.version>
     </properties>
 
     <dependencies>
@@ -145,6 +146,11 @@
                 <artifactId>spring-boot-starter-data-redis</artifactId>
                 <version>${redis.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.bouncycastle</groupId>
+                <artifactId>bcprov-jdk15on</artifactId>
+                <version>${bcprov.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>