Bladeren bron

add 迁移api

GITZYY 7 maanden geleden
bovenliggende
commit
5f08b5fde5
20 gewijzigde bestanden met toevoegingen van 2732 en 0 verwijderingen
  1. 117 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/HuNanDiShuiYanCreditService.java
  2. 174 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/HuizhongCreditService.java
  3. 150 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JianZhanCreditService.java
  4. 93 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JiechengCreditService.java
  5. 94 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JilingHuiRongCreditService.java
  6. 150 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JinDieV2CreditService.java
  7. 99 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JinDieV3CreditService.java
  8. 78 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JinDieV4CreditService.java
  9. 122 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JinZhuLiCreditService.java
  10. 95 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JindieCreditService.java
  11. 107 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JiuXinKeCreditService.java
  12. 98 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/KuaiYiRongCreditService.java
  13. 98 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/KuaiyidaiCreditService.java
  14. 100 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/KuaiyidaiFourToOneCreditService.java
  15. 105 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/KuaiyidaiNightCreditService.java
  16. 106 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/KuaiyidaiV2CreditService.java
  17. 96 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/KunMingXiaoSongShuCreditService.java
  18. 85 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/LeXiangRongCreditService.java
  19. 131 0
      egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/LianKeYunKongCreditService.java
  20. 634 0
      egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/utils/RSAUtils.java

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

@@ -0,0 +1,117 @@
+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.Service;
+
+import javax.annotation.Resource;
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 12 04 17 12
+ **/
+@Slf4j
+@Service
+public class HuNanDiShuiYanCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.HuNanDiShuiYan;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String phone_md5;//手机号
+        private String channel;//渠道代码QHXR59
+    }
+    @Data
+    private static class ApplyInfo{
+        private String username; //客户姓名
+        private String tel; //手机号
+        private String cityName; //城市(上海/苏州/…)
+        private Integer price; //需求金额(如50000)
+        private String sex;//性别(男/女)
+        private Integer hasHouse; //是否有房(1有/2无)
+        private Integer hasCar; //是否有车(1有/2无)
+        private Integer hasBaodan; //有无保单(1有/2无)
+        private Integer hasGongjijin; //是否有公积金(1有/2无)
+        private Integer hasWeilidai; //有无芝麻分(1有/2无)
+        private Integer hasNashui; //有无纳税(1有/2无)
+        private String channel; //渠道代码由我方提供:QHXR59
+        private Integer note; //备注可为空(其他信息可传这
+    }
+
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit HuNanDiShuiYanCreditService 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.setPhone_md5(userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5());
+            checkInfo.setChannel(config.getString("channel"));
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck HuNanDiShuiYanCreditService 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 HuNanDiShuiYanCreditService 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("state").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 {
+
+        // 判断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"));
+
+        return new Base64().encodeToString(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。
+    }
+
+
+
+}

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

@@ -0,0 +1,174 @@
+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.HttpTemPlateClient;
+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.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.AsyncResult;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.client.RestTemplate;
+
+import javax.annotation.Resource;
+import javax.crypto.*;
+import javax.crypto.spec.DESedeKeySpec;
+import javax.crypto.spec.IvParameterSpec;
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.util.Objects;
+
+/**
+ * 惠众API接单
+ */
+@Service
+@Slf4j
+public class HuizhongCreditService implements LoanDockingApi {
+
+    private final String qualityCheckPath = "/api/user/check";
+
+    private final String applyPath = "/api/yhzd/addCust";
+
+    private final String devUrl = "http://apitest.shlyxxjs.com";
+
+    private final String prodUrl = "https://api.shlyxxjs.com";
+
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.Huizhong;
+    }
+
+
+    @Data
+    private static class CheckInfo{
+        private String phoneNo;
+
+        private String channelSource;
+    }
+    @Data
+    private static class ResultHt{
+        private String code;
+        private String msg;
+    }
+    @Data
+    private static class ApplyInfo{
+        private String cust_name;
+
+        private String mobile;
+
+        private Integer age; //年龄(未知传0)
+
+        private Integer sex; //性别(1:为男,2:为女,未知传0)
+
+        private Integer apply_limit;//申请额度(单位元)如50000,若无特别说明,金额需3万起步
+
+        private String channel_source;
+
+        private String city;
+    }
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *  {"channelSource":"birong","url":"http://apitest.shlyxxjs.com","key":"mgjr@3des123#dhjr9763089"}
+     */
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit HuizhongCreditService 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.setPhoneNo(userInfo.getPhoneMd5());
+            checkInfo.setChannelSource(config.getString("channelSource"));
+            String url = config.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck HuizhongCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            ResultHt response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,checkInfo, ResultHt.class);
+            }catch (Exception e){
+                log.error("惠众准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck HuizhongCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals("0000", 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());
+        }
+
+    }
+
+    private static class ApiAesUtil {
+
+        public static String encrypt(String data, String secretKey) {
+            try {
+                byte[] encrpyted = tripleDES(Cipher.ENCRYPT_MODE, data.getBytes("UTF-8"), secretKey.getBytes());
+                byte[] encoded = Base64.encodeBase64(encrpyted); // Base64编码
+                return new String(encoded);
+            } catch (UnsupportedEncodingException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        public static String decrypt(String data, String secretKey ) {
+            try {
+                byte[] decoded = Base64.decodeBase64(data); // Base64解码
+                byte[] decrypted = tripleDES(Cipher.DECRYPT_MODE, decoded, secretKey.getBytes());// 3DES解密
+                return new String(decrypted, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        private static byte[] tripleDES(int opmode, byte[] data, byte[] secretKey) {
+            return cipher("DESede", "DESede/CBC/PKCS5Padding", opmode, data, "01234567".getBytes(), secretKey);
+        }
+
+        private static byte[] cipher(String algorithm, String transformation, int opmode, byte[] data, byte[] iv, byte[] secretKey) {
+            try {
+                Key key = SecretKeyFactory.getInstance(algorithm).generateSecret(new DESedeKeySpec(secretKey));
+                IvParameterSpec spec = new IvParameterSpec(iv);
+                Cipher cipher = Cipher.getInstance(transformation);
+                cipher.init(opmode, key, spec);
+                return cipher.doFinal(data);
+            } catch (InvalidKeyException | InvalidKeySpecException | NoSuchAlgorithmException | NoSuchPaddingException
+                    | IllegalBlockSizeException | BadPaddingException | InvalidAlgorithmParameterException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+}

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

@@ -0,0 +1,150 @@
+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.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 05 21 11 33
+ **/
+@Slf4j
+@Service
+public class JianZhanCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.JianZhan100;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String act;// 操作类型
+        private String c_phone;// 手机号(32位MD5加密字符串)
+
+        private String aid;// Access Id
+        private String timestamp;// 时间戳
+        private String noncestr;// 随机字符串
+        private String signature;// 签名
+    }
+
+    @Data
+    private static class ApplyInfo {
+        private String act;//姓名
+        private String c_name; //年龄
+        private String c_phone; //手机号
+        private Integer c_sex; //性别
+        private String type;//类型
+        private String c_city;//城市
+        private String c_birth_year;//出生年份如:1990)
+        private String c_daikuanedu;//贷款额度如:3000)
+        private Integer c_has_xinyongka;//有无信用卡1(有)2(无)
+        private Integer loanMoney;//借款金额(单位:万元)
+        private Integer c_has_fang;//有无房 1(有)2(无)
+        private Integer c_has_che; //有无车 1(有)2(无)
+        private Integer c_has_gongjijin; //有无公积金 1(有)2(无)
+
+        private Integer c_has_shebao; //有无社保 1(有)2(无)
+        private String c_has_baodan;//有无保单 1(有)2(无)
+        private Integer c_has_weilidai;//有无微粒贷 1(有)2(无)
+        private Integer c_faxinfangshi;//发薪方式1(银行转账)2(代发工资)3(现金发放)4(无)
+        private String c_shouru;//收入(如:3000)
+        private String c_zhiye;//职业(如:工程师)
+
+        private String aid;// Access Id
+        private String timestamp;// 时间戳
+        private String noncestr;// 随机字符串
+        private String signature;// 签名
+
+    }
+
+    @Data
+    private static class RequestData{
+        private String aid;// Access Id
+        private String act;// 操作类型,具体的功能点act值不一样。
+        private String timestamp;// 时间戳
+        private String noncestr;// 随机字符串
+        private String signature;// 签名
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto user, PlanDto product) {
+        try {
+            log.info("credit JianZhanCreditService qualityCheck begin...userId:{}", user.getPhoneMd5());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("建站100对接参数:{}", JSON.toJSONString(config));
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+            // 获取当前日期时间
+            LocalDateTime now = LocalDateTime.now();
+            // 使用format方法将LocalDateTime对象转换为字符串
+            String formattedDateTime = now.format(formatter);
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setAct(config.getString("checkAct"));
+            checkInfo.setC_phone(user.getPhoneMd5());
+            checkInfo.setAid(config.getString("aid"));
+            checkInfo.setNoncestr(formattedDateTime);
+            checkInfo.setTimestamp(formattedDateTime);
+            String signature=checkInfo.getAid()+checkInfo.getAct()+checkInfo.getTimestamp()+checkInfo.getNoncestr()+config.getString("akey");
+            checkInfo.setSignature(Md5Util.encoderByMd5(signature));
+            Map<String, String> requestData = new HashMap<>();
+            requestData.put("act", checkInfo.getAct());
+            requestData.put("c_phone",checkInfo.getC_phone());
+            requestData.put("aid", checkInfo.getAid());
+            requestData.put("noncestr",checkInfo.getNoncestr());
+            requestData.put("timestamp", checkInfo.getTimestamp());
+            requestData.put("signature",checkInfo.getSignature());
+
+            String url = config.getString("url");
+            log.info("credit qualityCheck JianZhanCreditService request userId:{}, url:{}, CheckInfo:{}", requestData, url, user.getPhoneMd5());
+            Map<String, String> header = new HashMap<>();
+            header.put("Content-Type", "application/x-www-form-urlencoded");
+            String res = "";
+            JSONObject jsonObject = new JSONObject();
+            try{
+                HttpResponse response = httpRestTemplate.restTemplate().postForObject(url, null, null, header, null, requestData);
+                res = EntityUtils.toString(response.getEntity());
+                jsonObject = JSON.parseObject(res);
+            }catch (Exception e){
+                log.error("建站100准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck JianZhanCreditService response userId:{}, result:{}",user
+                    .getPhoneMd5(), jsonObject);
+            if (jsonObject == null) {
+                 return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            if (jsonObject.getString("status").equals("0")) {
+                return DataVo.success(0, "建站100撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "建站100撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            return DataVo.fail(1, "建站100撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+}

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

@@ -0,0 +1,93 @@
+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;
+
+/**
+ * 捷诚API接单
+ */
+@Service
+@Slf4j
+public class JiechengCreditService implements LoanDockingApi {
+    private final String qualityCheckPath = "/api/yrh/index";
+    private final String applyPath = "/api/yrh/orderadd";
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.Jiecheng;
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *  {"key":"5lvNIA1Kmchq2gu3C9P5g+rttvQXq3lh","url":"http://www.cs.ahaiyu.com"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit JiechengCreditService 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.setPhoneMd5(userInfo.getPhoneMd5());
+            String url = config.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck JiechengCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            ResultJc response = null;
+            try{
+                response =httpRestTemplate.restTemplate().postForObject(url,checkInfo, ResultJc.class);
+            }catch (Exception e){
+                log.error("捷诚准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck JiechengCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return response.getCode() == 200 && response.getData().equals("1") ? DataVo.success(0, "捷诚撞库成功", product.getPlanId())
+                    : DataVo.fail("捷诚撞库失败:" + response.getMessage(), product.getPlanId());
+
+        } catch (Exception e) {
+            log.error("捷诚撞库失败", e);
+            return DataVo.fail(1, "捷诚撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+
+    @Data
+    private static class CheckInfo{
+        private String phoneMd5;
+    }
+
+    @Data
+    private static class ResultJc{
+        private int code;
+        private String message;
+        private String data;
+    }
+
+
+}

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

@@ -0,0 +1,94 @@
+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 09 19 09 10
+ * 济宁惠融API
+ **/
+@Slf4j
+@Service
+public class JilingHuiRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.JiNingHR;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private Integer channel_code;//渠道编码
+        private String channel_secret_key;//渠道密钥
+        private String md5_phone;//md5加密后的手机号,32位小写
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit JilingHuiRongCreditService 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.setMd5_phone(Md5Util.encoderByMd5(userInfo.getUserMobile()));
+            checkInfo.setChannel_code(Integer.valueOf(config.getString("channel_code")));
+            checkInfo.setChannel_secret_key(config.getString("channel_secret_key"));
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck JilingHuiRongCreditService 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 JilingHuiRongCreditService 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.success(1, "济宁惠融撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("济宁惠融撞库失败", e);
+            return DataVo.fail(1, "济宁惠融撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+}

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

@@ -0,0 +1,150 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+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.cglib.beans.BeanMap;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+
+/**
+ * @Descrption
+ * @Author: zhangyy
+ * @Date: 2023/5/8
+ * @Version V1.0
+ **/
+@Service
+@Slf4j
+public class JinDieV2CreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.CRM_JD;
+    }
+
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @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 {
+            log.info("credit JindieV2CreditService qualityCheck begin...userId:{},productId={}", userInfo.getUserId(), product.getPlanId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            if (StringUtils.isBlank(configJson)) {
+                return DataVo.fail(product.getPlanName(), product.getPlanId());
+            }
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("锦蝶V2.0对接参数:{}", JSON.toJSONString(config));
+            JSONObject jsonObject = new JSONObject() {{
+                put("Appid", config.getString("Appid"));
+                put("Appkey", config.getString("Appkey"));
+                put("Userphone", userInfo.getPhoneMd5());
+            }};
+            String url = config.getString("CheckUrl");
+            log.info("credit qualityCheck JindieV2CreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, jsonObject);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, jsonObject, String.class);
+            } catch (Exception e) {
+                log.error("【{}】-锦蝶V2.0准入异常,异常信息:{}", product.getPlanName(), e.getMessage(), e);
+            }
+            log.info("credit qualityCheck QingyuV2CreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            JSONObject res = JSONObject.parseObject(response);
+            if (res.getInteger("result") == 400) {
+                return DataVo.success(0, "【" + product.getPlanName() + "】-锦蝶V2.0撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(res.getString("message"), product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("【{}】-锦蝶V2.0撞库失败", product.getPlanName(), e);
+            return DataVo.fail(1, "锦蝶V2.0撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    public static <T> Map<String, Object> beanToMap(T bean) {
+        Map<String, Object> map = new HashMap<>();
+        if (bean != null) {
+            BeanMap beanMap = BeanMap.create(bean);
+            for (Object key : beanMap.keySet()) {
+                map.put(key + "", beanMap.get(key));
+            }
+        }
+        return map;
+    }
+
+
+    private String getSign(Map<String, Object> map) {
+        String text = "";
+        Iterator<Map.Entry<String, Object>> iterator = map.entrySet().iterator();
+        while (iterator.hasNext()) {
+            Map.Entry<String, Object> entry = iterator.next();
+            String value;
+            if (null == entry.getValue()) {
+                value = "";
+            } else {
+                value = (String) entry.getValue();
+            }
+            text = text + entry.getKey() + value;
+        }
+        return Md5Util.encoderByMd5(text).toUpperCase();
+    }
+
+
+    @Data
+    private static class V2Req {
+        private String requestId;
+
+        private String accessKey;
+
+        private JSONArray data;
+    }
+
+    @Data
+    private static class CheckInfoResp {
+        private Integer code;
+        private String msg;
+        private Boolean success;
+        private List<JSONObject> data;
+    }
+
+
+    @Data
+    private static class ResultYq {
+        private Integer code;
+        private String msg;
+        private Boolean success;
+        private String requestId;
+        private JSONArray data;
+    }
+}

+ 99 - 0
egress-gateway-service-app/src/main/java/com/hrsk/cloud/eg/app/threedocking/impl/JinDieV3CreditService.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.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+import javax.annotation.Resource;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 12 01 16 54
+ **/
+@Component
+@Slf4j
+public class JinDieV3CreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        //三方对接平台,或者第三方sass平台,此处不设置任何默认值
+        return ServerCodeEnums.CRM_JDV3;
+    }
+
+    @Data
+    private static class ApplyInfo {
+        private String Username;
+        private String Userphone;
+        private Integer Sex; //性别(1:为男,2:为女,未知传0)
+        private Integer Money;//申请额度(单位元)如50000,若无特别说明,金额需3万起步
+        private String City;
+        private String Channel;
+        private String ChannelInfo;
+        private String Info;
+        private Integer Price;
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @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 {
+            log.info("credit JinDieV3CreditService qualityCheck begin...userId:{},productId={}", userInfo.getUserId(), product.getPlanId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            if (StringUtils.isBlank(configJson)) {
+                return DataVo.fail(product.getPlanName(), product.getPlanId());
+            }
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("锦蝶V3.0对接参数:{}", JSON.toJSONString(config));
+            JSONObject jsonObject = new JSONObject() {{
+                put("Appid", config.getString("Appid"));
+                put("Appkey", config.getString("Appkey"));
+                put("Userphone", userInfo.getPhoneMd5());
+            }};
+            String url = config.getString("CheckUrl");
+            log.info("credit qualityCheck JinDieV3CreditService request userId:{}, url:{}, CheckInfo:{}", userInfo.getUserId(), url, jsonObject);
+            String response = null;
+            try {
+                response = httpRestTemplate.restTemplate().postForObject(url, jsonObject, String.class);
+            } catch (Exception e) {
+                log.error("【{}】-锦蝶V3.0准入异常,异常信息:{}", product.getPlanName(), e.getMessage(), e);
+            }
+            log.info("credit qualityCheck JinDieV3CreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            JSONObject res = JSONObject.parseObject(response);
+            if (res.getInteger("result") == 400) {
+                return DataVo.success(0, "【" + product.getPlanName() + "】-锦蝶V3.0撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(res.getString("message"), product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("【{}】-锦蝶V3.0撞库失败", product.getPlanName(), e);
+            return DataVo.fail(1, "锦蝶V3.0撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+}

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

@@ -0,0 +1,78 @@
+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.springframework.stereotype.Service;
+import javax.annotation.Resource;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 05 14 11 25
+ **/
+@Service
+@Slf4j
+public class JinDieV4CreditService implements LoanDockingApi {
+
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.JinDieV4CreditService;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String sign;// 渠道标识
+        private String tel;// 手机号MD5
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit JinDieV4CreditService qualityCheck begin...userId:{}", userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject config = JSONObject.parseObject(configJson);
+            log.info("锦蝶v4对接参数:{}", JSONObject.toJSONString(config));
+            String phoneMd5 = userInfo.getPhoneMd5() == null ? Md5Util.encoderByMd5(userInfo.getUserMobile()) : userInfo.getPhoneMd5();
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setSign(config.getString("sign"));
+            checkInfo.setTel(phoneMd5);
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck JinDieV4CreditService 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("锦蝶v4准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck JinDieV4CreditService 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("500")) {
+                return DataVo.success(0, "锦蝶v4撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail(1, "锦蝶v4撞库失败,请联系系统管理员", product.getPlanId());
+            }
+        } catch (Exception e) {
+            return DataVo.fail(1, "锦蝶v4撞库失败,请联系系统管理员", product.getPlanId());
+        }
+    }
+
+}

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

@@ -0,0 +1,122 @@
+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.springframework.stereotype.Service;
+import javax.annotation.Resource;
+
+/**
+ * @Author zjc
+ * @Date 2024 06 12 17 11
+ **/
+@Slf4j
+@Service
+public class JinZhuLiCreditService  implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.JinZhuLiCreditService;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String phone;//手机号, MD5加密(32位小写)
+        private String qdName;//城市:例如:北京
+        private String source;//固定值,具体需要和对接人确定
+    }
+
+    @Data
+    private static class ApplyInfo {
+        private String qdName;
+        private String name;
+        private Long phone;
+        private Long price;
+        private Integer house;
+        private Integer car;
+        private Integer insurance;
+        private Integer fund;
+        private Integer socital;
+        private Integer xyk;
+        private Integer wld;
+        private Integer qyns;
+        private Integer df;
+        private Integer business_license;
+        private String city;
+        private String source;
+        private Integer age;
+        private Integer loan_periods;
+
+    }
+
+    @Data
+    private static class ApplyInfoRequst {
+       private String is_jm;
+       private String source;
+       private String data;
+    }
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit JinZhuLiCreditService 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);
+            checkInfo.setQdName(config.getString("qdName"));
+            checkInfo.setSource(config.getString("source"));
+
+            String url = config.getString("checkUrl");
+
+            log.info("credit qualityCheck JinZhuLiCreditService 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 JinZhuLiCreditService 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("status").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());
+        }
+    }
+
+
+}

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

@@ -0,0 +1,95 @@
+package com.hrsk.cloud.eg.app.threedocking.impl;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+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;
+
+/**
+ * 锦蝶API接单
+ */
+@Service
+@Slf4j
+public class JindieCreditService implements LoanDockingApi {
+    private final String qualityCheckPath = "/erp/api/ifRepeatmd5";
+    private final String applyPath = "/erp/api/addclue";
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.Jindie;
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return {"url":"https://jyw.jinchen.cc","Appid":"zZyeD3+kkEQVRWno","Appkey":"y52RC3muwUdtOhWe1Z0qo8FlFA","Channel":"网络渠道","ChannelInfo":"融5"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit JindieCreditService 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.setAppid(config.getString("Appid"));
+            checkInfo.setAppkey(config.getString("Appkey"));
+            checkInfo.setUserphone(userInfo.getPhoneMd5());
+            String url = config.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck JindieCreditService 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 JindieCreditService response userId:{}, result:{}", userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(), product.getPlanName());
+            }
+            if (JSON.parseObject(response).getInteger("result") == 400 ) {
+                return DataVo.success(0, "锦蝶撞库成功", product.getPlanId());
+            } else {
+                return DataVo.fail("锦蝶撞库失败", product.getPlanId());
+            }
+        } catch (Exception e) {
+            log.error("锦蝶撞库失败", e);
+            return DataVo.fail(1, "锦蝶撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    @Data
+    private static class CheckInfo {
+        @JsonProperty(value ="Appid")
+        private String Appid;
+
+        @JsonProperty(value ="Appkey")
+        private String Appkey;
+
+        @JsonProperty(value ="Userphone")
+        private String Userphone;
+    }
+
+}

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

@@ -0,0 +1,107 @@
+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.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.AsyncResult;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.client.RestTemplate;
+
+import javax.annotation.Resource;
+import java.security.interfaces.RSAPublicKey;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Future;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 06 27 14 06
+ **/
+@Slf4j
+@Service
+public class JiuXinKeCreditService implements LoanDockingApi {
+
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.JiuXinKe;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String phoneMd5;// Md5(mobile)
+        private Integer file_id;//渠道id
+        private String promotion;//渠道标识
+    }
+
+
+
+    /**
+     * 助贷对接撞库模板1,标准流程,post请求,application/json,参数直接传对象
+     * @param userInfo
+     * @param product
+     * @return
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit JiuXinKeCreditService 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");
+            CheckInfo checkInfo = new CheckInfo();
+            checkInfo.setPhoneMd5(phoneMd5);
+            checkInfo.setPromotion(config.getString("promotion"));
+            checkInfo.setFile_id(config.getInteger("file_id"));
+            log.info("credit qualityCheck JiuXinKeCreditService 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 JiuXinKeCreditService 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("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());
+        }
+    }
+
+}

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

@@ -0,0 +1,98 @@
+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 08 31 10 54k
+ * 快易融API
+ **/
+@Slf4j
+@Service
+public class KuaiYiRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.KuaiYiRong;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private Integer channel_code;//渠道编码
+        private String channel_secret_key;//渠道密钥
+        private String md5_phone;//md5加密后的手机号,32位小写
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     *  {"channel_code":"34","checkUrl":"http://120.46.41.14:8888/api/customer/collisionLibrary","channel_secret_key":"HrYk20230829KYR6"}
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit KuaiYiRongCreditService 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.setMd5_phone(Md5Util.encoderByMd5(userInfo.getUserMobile()));
+            checkInfo.setChannel_code(Integer.valueOf(config.getString("channel_code")));
+            checkInfo.setChannel_secret_key(config.getString("channel_secret_key"));
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck KuaiYiRongCreditService 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 KuaiYiRongCreditService 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());
+        }
+
+    }
+
+}
+

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

@@ -0,0 +1,98 @@
+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.*;
+
+/**
+ * 快易贷API接单
+ */
+@Service
+@Slf4j
+public class KuaiyidaiCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    private final String qualityCheckPath = "/Admin/UserIncomeApi/comparePhoneMonitor";
+
+    private final String applyPath = "/Admin/UserIncomeApi/addUserAes";
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.Kuaiyidai;
+    }
+
+    @Data
+    public static class CheckData{
+        private String merNo;
+        private String params;
+    }
+
+    @Data
+    private static class ResultHt{
+        private String status;
+        private String mes;
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @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 KuaiyidaiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+//            XdProductJointConfig xdProductJointConfig = xdProductJointConfigMapper.selectById(product.getJointType());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject kuaiyidaiJointDTO = JSONObject.parseObject(configJson);
+            log.info("快易贷对接参数:{}", JSON.toJSONString(kuaiyidaiJointDTO));
+
+            Map<String, String> paramMap = new HashMap<>();
+            paramMap.put("city",userInfo.getCityAllName() );
+            paramMap.put("phone", userInfo.getPhoneMd5());
+            paramMap.put("qdName", kuaiyidaiJointDTO.getString("qdName"));
+
+
+            String url = kuaiyidaiJointDTO.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck KuaiyidaiCreditService request userId:{}, url:{}, data:{}",userInfo.getUserId(), url, JSON.toJSONString(paramMap));
+            ResultHt response = null;
+            try{
+                JSONObject resJson = httpRestTemplate.restTemplate().postForEntity(url,paramMap,JSONObject.class).getBody();
+                response = JSON.parseObject(resJson.toJSONString(), ResultHt.class);
+            }catch (Exception e){
+                log.error("快易贷准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck KuaiyidaiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals("200", response.getStatus()) ? DataVo.success(0, "快易贷撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMes(), 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/KuaiyidaiFourToOneCreditService.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.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * 快易贷API接单
+ */
+@Service
+@Slf4j
+public class KuaiyidaiFourToOneCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    private final String qualityCheckPath = "/Admin/UserIncomeApi/comparePhoneMonitor";
+
+    private final String applyPath = "/Admin/UserIncomeApi/addUserAes";
+
+    @Data
+    public static class CheckData{
+        private String merNo;
+        private String params;
+    }
+
+    @Data
+    private static class ResultHt{
+        private String status;
+        private String mes;
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @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 KuaiyidaiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject kuaiyidaiJointDTO = JSON.parseObject(configJson);
+            log.info("快易贷对接参数:{}", JSON.toJSONString(kuaiyidaiJointDTO));
+
+
+            Map<String, String> paramMap = new HashMap<>();
+            paramMap.put("city",userInfo.getCityAllName() );
+            paramMap.put("phone", userInfo.getPhoneMd5());
+            paramMap.put("qdName", kuaiyidaiJointDTO.getString("qdName"));
+
+
+            String url = kuaiyidaiJointDTO.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck KuaiyidaiCreditService request userId:{}, url:{}, data:{}",userInfo.getUserId(), url, JSON.toJSONString(paramMap));
+            ResultHt response = null;
+            try{
+                JSONObject resJson = httpRestTemplate.restTemplate().postForEntity(url,paramMap,JSONObject.class).getBody();
+                response = JSON.parseObject(resJson.toJSONString(), ResultHt.class);
+            }catch (Exception e){
+                log.error("快易贷准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck KuaiyidaiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals("200", response.getStatus()) ? DataVo.success(0, "快易贷撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMes(), product.getPlanId());
+        } catch (Exception e) {
+            log.error("快易贷撞库失败", e);
+            return DataVo.fail(1, "快易贷撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.KuaiyidaiFourToOne;
+    }
+
+}

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

@@ -0,0 +1,105 @@
+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.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * 快易贷API接单
+ */
+@Service
+@Slf4j
+public class KuaiyidaiNightCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Autowired
+    Environment environment;
+
+    private final String qualityCheckPath = "/Admin/UserIncomeApi/comparePhoneMonitor";
+
+    private final String applyPath = "/Admin/UserIncomeApi/addUserAes";
+
+
+    @Data
+    public static class CheckData{
+        private String merNo;
+        private String params;
+    }
+
+    @Data
+    private static class ResultHt{
+        private String status;
+        private String mes;
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @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 KuaiyidaiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject kuaiyidaiJointDTO = JSON.parseObject(configJson);
+            log.info("快易贷对接参数:{}", JSON.toJSONString(kuaiyidaiJointDTO));
+
+
+            Map<String, String> paramMap = new HashMap<>();
+            paramMap.put("city",userInfo.getCityAllName() );
+            paramMap.put("phone", userInfo.getPhoneMd5());
+            paramMap.put("qdName", kuaiyidaiJointDTO.getString("qdName"));
+
+
+            String url = kuaiyidaiJointDTO.getString("url") + qualityCheckPath;
+            log.info("credit qualityCheck KuaiyidaiCreditService request userId:{}, url:{}, data:{}",userInfo.getUserId(), url, JSON.toJSONString(paramMap));
+            ResultHt response = null;
+            try{
+                JSONObject resJson = httpRestTemplate.restTemplate().postForEntity(url,paramMap,JSONObject.class).getBody() ;
+                response = JSON.parseObject(resJson.toJSONString(), ResultHt.class);
+            }catch (Exception e){
+                log.error("快易贷准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck KuaiyidaiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals("200", response.getStatus()) ? DataVo.success(0, "快易贷撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMes(), product.getPlanId());
+        } catch (Exception e) {
+            log.error("快易贷撞库失败", e);
+            return DataVo.fail(1, "快易贷撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.KuaiyidaiNight;
+    }
+
+}

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

@@ -0,0 +1,106 @@
+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.*;
+
+/**
+ * 快易贷API接单
+ */
+@Service
+@Slf4j
+public class KuaiyidaiV2CreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    private final String qualityCheckPath = "/Admin/UserIncomeApi/comparePhoneMonitor";
+
+    private final String applyPath = "/Admin/UserIncomeApi/addUserAes";
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.KuaiyidaiV2;
+    }
+
+    @Data
+    public static class CheckData{
+        private String merNo;
+        private String params;
+    }
+
+    @Data
+    private static class ResultHt{
+        private String status;
+        private String mes;
+    }
+
+    @Data
+    private static class ApplyResultHt{
+        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 KuaiyidaiCreditService qualityCheck begin...userId:{}",userInfo.getUserId());
+            ProductBusinessApiInfoDo apiInfo = apiInfoService.getById(product.getApiId());
+            String configJson = apiInfo.getThreeSystemConfig();
+            JSONObject kuaiyidaiJointDTO = JSON.parseObject(configJson);
+            log.info("快易贷对接参数:{}", JSON.toJSONString(kuaiyidaiJointDTO));
+
+            Map<String, String> paramMap = new HashMap<>();
+            paramMap.put("city",userInfo.getCityAllName() );
+            paramMap.put("phone", userInfo.getPhoneMd5());
+            paramMap.put("qdName", kuaiyidaiJointDTO.getString("qdName"));
+
+
+            String url = kuaiyidaiJointDTO.getString("url");
+            log.info("credit qualityCheck KuaiyidaiCreditService request userId:{}, url:{}, data:{}",userInfo.getUserId(), url, JSON.toJSONString(paramMap));
+            ResultHt response = null;
+            try{
+                JSONObject resJson = httpRestTemplate.restTemplate().postForEntity(url,paramMap,JSONObject.class).getBody();
+                response = JSON.parseObject(resJson.toJSONString(), ResultHt.class);
+            }catch (Exception e){
+                log.error("快易贷准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck KuaiyidaiCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return  DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            return Objects.equals("200", response.getStatus()) ? DataVo.success(0, "快易贷撞库成功", product.getPlanId())
+                    : DataVo.fail(response.getMes(), product.getPlanId());
+        } catch (Exception e) {
+            log.error("快易贷撞库失败", e);
+            return DataVo.fail(1, "快易贷撞库失败,请联系系统管理员", product.getPlanId());
+        }
+
+    }
+
+
+}

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

@@ -0,0 +1,96 @@
+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.Component;
+import javax.annotation.Resource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author Liu Tao
+ * @Date 2023 10 20 10 46
+ * 昆明小松鼠API
+ **/
+@Slf4j
+@Component
+public class KunMingXiaoSongShuCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums getType() {
+        return ServerCodeEnums.KunMingXiaoSongShu;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String md5CusPhone;//md5 的手机号小写
+    }
+
+    /**
+     * 撞库 实现单个用户撞库
+     *
+     * @param userInfo
+     * @param product
+     * @return
+     */
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit KunMingXiaoSongShuCreditService 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.setMd5CusPhone(phoneMd5);
+            String url = config.getString("checkUrl")+"/"+checkInfo.getMd5CusPhone();
+            log.info("credit qualityCheck KunMingXiaoSongShuCreditService request userId:{}, url:{}, CheckInfo:{}",userInfo.getUserId(), url, checkInfo);
+            JSONObject response = null;
+            try{
+                Map<String, String> head = new HashMap<>();
+                head.put("Content-Type", "application/json; charset=utf-8");
+                head.put("access-control-allow-origin","*");
+                HttpResponse httpResponse =  httpRestTemplate.restTemplate().getForObject(url, null, null, head, null);
+                String responseStr = EntityUtils.toString(httpResponse.getEntity());
+                log.info("昆明小松鼠撞库响应数据:{}", responseStr);
+                response = JSON.parseObject(responseStr);
+            }catch (Exception e){
+                log.error("昆明小松鼠代准入异常,异常信息:{}", e.getMessage(), e);
+            }
+            log.info("credit qualityCheck KunMingXiaoSongShuCreditService response userId:{}, result:{}",userInfo.getUserId(), response);
+            if (response == null) {
+                return DataVo.timeout(product.getPlanId(),product.getPlanName());
+            }
+            if (response.getInteger("Code") == 1  && response.getString("Data").equals("false")) {
+                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());
+        }
+    }
+
+}

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

@@ -0,0 +1,85 @@
+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.Component;
+import javax.annotation.Resource;
+/**
+ * @Author Liu Tao
+ * @Date 2024 07 18 14 51
+ **/
+@Slf4j
+@Component
+public class LeXiangRongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.LeXiangRong;
+    }
+
+    @Data
+    private static class CheckInfo{
+        private String phone;//MD5加密
+    }
+
+
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit LeXiangRongCreditService 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.setPhone(phoneMd5);
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck LeXiangRongCreditService 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 LeXiangRongCreditService 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("state").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());
+        }
+
+    }
+
+
+}

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

@@ -0,0 +1,131 @@
+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.RSAUtils;
+import com.hrsk.cloud.eg.infrastructure.utils.SnowflakeIdWorker;
+import com.hrsk.cloud.eg.vo.response.DataVo;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.security.interfaces.RSAPublicKey;
+import java.time.Instant;
+
+/**
+ * @Author Liu Tao
+ * @Date 2024 06 19 17 49
+ **/
+@Slf4j
+@Component
+public class LianKeYunKongCreditService implements LoanDockingApi {
+    @Resource
+    private ProductBusinessApiInfoService apiInfoService;
+
+    @Resource
+    private RetryRestTemplate httpRestTemplate;
+
+    @Override
+    public ServerCodeEnums  getType() {
+        return ServerCodeEnums.LianKeYunKong;
+    }
+
+    @Data
+    private static class CheckInfo {
+        private String phoneMd5;// 手机号MD5
+    }
+
+    @Data
+    private static class ApplyInfo {
+        private String custName;//姓名
+        private String mobile; //手机号
+        private String age; //年龄
+        private String sex; //性别
+        private String city;//城市
+        private BigDecimal applyLimit;//申请额度
+        private String applyTime;//申请日期
+        private String channelSource;//渠道来源
+        private String hasFund;//是否有公积金
+        private String hasHouse;//是否有房
+        private String hasCar;//是否有车
+        private String hasSocial; //是否有社保
+        private String inspectionLevel; //芝麻信用分
+        private String mediaSource; //媒体来源
+    }
+
+    @Data
+    private static class RequestData{
+        private String tenantId;// 租户 ID
+        private String timestamp;// 时间戳
+        private String requestId;// 随机字符串
+        private String configName;// 撞库配置名
+        private JSONObject data;// 随机字符串
+        private String sign;//签名
+    }
+
+
+    @Override
+    public DataVo qualityCheck(UserInBaseInfoDto userInfo, PlanDto product) {
+        try {
+            log.info("credit LianKeYunKongCreditService 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.setPhoneMd5(phoneMd5);
+            String millisecondsSinceEpoch = String.valueOf(Instant.now().toEpochMilli());
+            long id = SnowflakeIdWorker.nextId();
+            String sign="timestamp:"+millisecondsSinceEpoch+"-"+"requestId:"+id;
+            RequestData requestParam=new RequestData();
+            requestParam.setTenantId(config.getString("tenantId"));
+            requestParam.setTimestamp(millisecondsSinceEpoch);
+            RSAPublicKey publicKey = RSAUtils.getPublicKey(config.getString("publicKey"));
+            String s = RSAUtils.publicEncrypt(checkInfo.getPhoneMd5(), publicKey);
+            JSONObject json=new JSONObject();
+            json.put("phoneMd5",s);
+            requestParam.setData(json);
+            requestParam.setRequestId(String.valueOf(id));
+            requestParam.setSign(Md5Util.encoderByMd5(sign));
+            requestParam.setConfigName(config.getString("configNameCheck"));
+            String url = config.getString("checkUrl");
+            log.info("credit qualityCheck LianKeYunKongCreditService 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 LianKeYunKongCreditService 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 = JSON.parseObject(jsonObject.getString("data"));
+            if (jsonObject.getString("code").equals("0")&&data.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());
+        }
+    }
+
+
+}

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

@@ -0,0 +1,634 @@
+package com.hrsk.cloud.eg.infrastructure.utils;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.springframework.util.Base64Utils;
+import sun.misc.BASE64Decoder;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+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;
+
+
+public class RSAUtils {
+    /**
+     * 字节数据转字符串专用集合
+     */
+    private static final char[] HEX_CHAR = { '0', '1', '2', '3', '4', '5', '6',
+            '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+    public static final String CHARSET = "UTF-8";
+    public static final String RSA_ALGORITHM = "RSA";
+
+    /**
+     * 加密的公钥 私钥 返回对应字符串
+     * @return
+     */
+    public static String genKeyPair( ) {
+
+        KeyPairGenerator keyPairGen = null;
+        try {
+            keyPairGen = KeyPairGenerator.getInstance("RSA");
+        } catch (NoSuchAlgorithmException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        // 初始化密钥对生成器,密钥大小为96-1024位
+        keyPairGen.initialize(1024,new SecureRandom());
+        // 生成一个密钥对,保存在keyPair中
+        KeyPair keyPair = keyPairGen.generateKeyPair();
+        // 得到私钥
+        RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
+        // 得到公钥
+        RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
+
+            // 得到公钥字符串
+            String publicKeyString =new String(Base64Utils.encode(publicKey.getEncoded()));
+            // 得到私钥字符串
+            String privateKeyString =new String(Base64Utils.encode(privateKey.getEncoded()));
+       return publicKeyString+","+privateKeyString;
+    }
+
+    /**
+     * 随机生成密钥对
+     */
+    public static void genKeyPair(String filePath) {
+        // KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
+        KeyPairGenerator keyPairGen = null;
+        try {
+            keyPairGen = KeyPairGenerator.getInstance("RSA");
+        } catch (NoSuchAlgorithmException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        // 初始化密钥对生成器,密钥大小为96-1024位
+        keyPairGen.initialize(1024,new SecureRandom());
+        // 生成一个密钥对,保存在keyPair中
+        KeyPair keyPair = keyPairGen.generateKeyPair();
+        // 得到私钥
+        RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
+        // 得到公钥
+        RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
+        try {
+            // 得到公钥字符串
+            String publicKeyString = new String(Base64Utils.encode(publicKey.getEncoded()));
+            // 得到私钥字符串
+            String privateKeyString =new String(Base64Utils.encode(privateKey.getEncoded()));
+            // 将密钥对写入到文件
+            FileWriter pubfw = new FileWriter(filePath + "/publicKey.key");
+            FileWriter prifw = new FileWriter(filePath + "/privateKey.key");
+            BufferedWriter pubbw = new BufferedWriter(pubfw);
+            BufferedWriter pribw = new BufferedWriter(prifw);
+            pubbw.write(publicKeyString);
+            pribw.write(privateKeyString);
+            pubbw.flush();
+            pubbw.close();
+            pubfw.close();
+            pribw.flush();
+            pribw.close();
+            prifw.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 从文件中输入流中加载公钥
+     *
+     * @param
+     *
+     * @throws Exception
+     *             加载公钥时产生的异常
+     */
+    public static String loadPublicKeyByFile(String path) throws Exception {
+        try {
+            BufferedReader br = new BufferedReader(new FileReader(path));
+            String readLine = null;
+            StringBuilder sb = new StringBuilder();
+            while ((readLine = br.readLine()) != null) {
+                sb.append(readLine);
+            }
+            br.close();
+            return sb.toString();
+        } catch (IOException e) {
+            throw new Exception("公钥数据流读取错误");
+        } catch (NullPointerException e) {
+            throw new Exception("公钥输入流为空");
+        }
+    }
+
+    /**
+     * 从字符串中加载公钥
+     *
+     * @param publicKeyStr
+     *            公钥数据字符串
+     * @throws Exception
+     *             加载公钥时产生的异常
+     */
+    public static RSAPublicKey loadPublicKeyByStr(String publicKeyStr)
+            throws Exception {
+        try {
+            byte[] buffer = Base64Utils.decode(publicKeyStr.getBytes(StandardCharsets.UTF_8));
+            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+            X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
+            return (RSAPublicKey) keyFactory.generatePublic(keySpec);
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此算法");
+        } catch (InvalidKeySpecException e) {
+            throw new Exception("公钥非法");
+        } catch (NullPointerException e) {
+            throw new Exception("公钥数据为空");
+        }
+    }
+
+    /**
+     * 从文件中加载私钥
+     *
+     *            私钥文件名
+     * @return 是否成功
+     * @throws Exception
+     */
+    public static String loadPrivateKeyByFile(String path) throws Exception {
+        try {
+            BufferedReader br = new BufferedReader(new FileReader(path));
+            String readLine = null;
+            StringBuilder sb = new StringBuilder();
+            while ((readLine = br.readLine()) != null) {
+                sb.append(readLine);
+            }
+            br.close();
+            return sb.toString();
+        } catch (IOException e) {
+            throw new Exception("私钥数据读取错误");
+        } catch (NullPointerException e) {
+            throw new Exception("私钥输入流为空");
+        }
+    }
+
+    public static RSAPrivateKey loadPrivateKeyByStr(String privateKeyStr)
+            throws Exception {
+    	try {
+            BASE64Decoder base64Decoder = new BASE64Decoder();
+            byte[] buffer = base64Decoder.decodeBuffer(privateKeyStr);
+            PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(buffer);
+            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+            return (RSAPrivateKey) keyFactory
+                    .generatePrivate(keySpec);
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此算法");
+        } catch (InvalidKeySpecException e) {
+            throw new Exception("私钥非法");
+        } catch (IOException e) {
+            throw new Exception("私钥数据内容读取错误");
+        } catch (NullPointerException e) {
+            throw new Exception("私钥数据为空");
+        }
+    }
+
+    /**
+     * 得到公钥
+     *
+     * @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");
+            cipher.init(Cipher.ENCRYPT_MODE, publicKey);
+            return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes("UTF-8"), publicKey.getModulus().bitLength()));
+        } catch (Exception e) {
+            throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
+        }
+    }
+
+
+    public static String publicEncryptUnsafe(String data, RSAPublicKey publicKey) {
+        try {
+            Cipher cipher = Cipher.getInstance("RSA");
+            cipher.init(Cipher.ENCRYPT_MODE, publicKey);
+            return Base64.encodeBase64String(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes("UTF-8"), 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");
+            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);
+        }
+    }
+
+    //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;
+    }
+    /**
+     * 公钥加密过程
+     *
+     * @param publicKey
+     *            公钥
+     * @param plainTextData
+     *            明文数据
+     * @return
+     * @throws Exception
+     *             加密过程中的异常信息
+     */
+    public static byte[] encrypt(RSAPublicKey publicKey, byte[] plainTextData)
+            throws Exception {
+        if (publicKey == null) {
+            throw new Exception("加密公钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+            // cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
+            cipher.init(Cipher.ENCRYPT_MODE, publicKey);
+            byte[] output = cipher.doFinal(plainTextData);
+            return output;
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此加密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("加密公钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("明文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("明文数据已损坏");
+        }
+    }
+
+    /**
+     * 私钥加密过程
+     *
+     * @param privateKey
+     *            私钥
+     * @param plainTextData
+     *            明文数据
+     * @return
+     * @throws Exception
+     *             加密过程中的异常信息
+     */
+    public static byte[] encrypt(RSAPrivateKey privateKey, byte[] plainTextData)
+            throws Exception {
+        if (privateKey == null) {
+            throw new Exception("加密私钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+            cipher.init(Cipher.ENCRYPT_MODE, privateKey);
+            byte[] output = cipher.doFinal(plainTextData);
+            return output;
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此加密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("加密私钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("明文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("明文数据已损坏");
+        }
+    }
+
+    /**
+     * 私钥解密过程
+     *
+     * @param privateKey
+     *            私钥
+     * @param cipherData
+     *            密文数据
+     * @return 明文
+     * @throws Exception
+     *             解密过程中的异常信息
+     */
+    public static byte[] decrypt(RSAPrivateKey privateKey, byte[] cipherData)
+            throws Exception {
+        if (privateKey == null) {
+            throw new Exception("解密私钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+            // cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
+            cipher.init(Cipher.DECRYPT_MODE, privateKey);
+            byte[] output = cipher.doFinal(cipherData);
+            return output;
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此解密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("解密私钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("密文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("密文数据已损坏");
+        }
+    }
+
+    /**
+     * 公钥解密过程
+     *
+     * @param publicKey
+     *            公钥
+     * @param cipherData
+     *            密文数据
+     * @return 明文
+     * @throws Exception
+     *             解密过程中的异常信息
+     */
+    public static byte[] decrypt(RSAPublicKey publicKey, byte[] cipherData)
+            throws Exception {
+        if (publicKey == null) {
+            throw new Exception("解密公钥为空, 请设置");
+        }
+        Cipher cipher = null;
+        try {
+            // 使用默认RSA
+            cipher = Cipher.getInstance("RSA");
+            // cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
+            cipher.init(Cipher.DECRYPT_MODE, publicKey);
+            byte[] output = cipher.doFinal(cipherData);
+            return output;
+        } catch (NoSuchAlgorithmException e) {
+            throw new Exception("无此解密算法");
+        } catch (NoSuchPaddingException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvalidKeyException e) {
+            throw new Exception("解密公钥非法,请检查");
+        } catch (IllegalBlockSizeException e) {
+            throw new Exception("密文长度非法");
+        } catch (BadPaddingException e) {
+            throw new Exception("密文数据已损坏");
+        }
+    }
+
+    /**
+     * 字节数据转十六进制字符串
+     *
+     * @param data
+     *            输入数据
+     * @return 十六进制内容
+     */
+    public static String byteArrayToString(byte[] data) {
+        StringBuilder stringBuilder = new StringBuilder();
+        for (int i = 0; i < data.length; i++) {
+            // 取出字节的高四位 作为索引得到相应的十六进制标识符 注意无符号右移
+            stringBuilder.append(HEX_CHAR[(data[i] & 0xf0) >>> 4]);
+            // 取出字节的低四位 作为索引得到相应的十六进制标识符
+            stringBuilder.append(HEX_CHAR[(data[i] & 0x0f)]);
+            if (i < data.length - 1) {
+                stringBuilder.append(' ');
+            }
+        }
+        return stringBuilder.toString();
+    }
+
+    /**
+     * 签名算法
+     */
+    public static final String SIGN_ALGORITHMS = "SHA1WithRSA";
+
+    /**
+     * rsa签名
+     *
+     * @param content
+     *            待签名的字符串
+     * @param
+     *
+     * @param
+     *
+     * @return 签名结果
+     * @throws Exception
+     *             签名失败则抛出异常
+     */
+    public static byte[] rsaSign(String content, RSAPrivateKey priKey)
+            throws SignatureException {
+        try {
+
+            Signature signature = Signature.getInstance("SHA1withRSA");
+            signature.initSign(priKey);
+            signature.update(content.getBytes("utf-8"));
+
+            byte[] signed = signature.sign();
+            return signed;
+        } catch (Exception e) {
+            throw new SignatureException("RSAcontent = " + content
+                    + "; charset = ", e);
+        }
+    }
+
+    /**
+     * rsa验签
+     *
+     * @param content
+     *            被签名的内容
+     * @param sign
+     *            签名后的结果
+     * @return 验签结果
+     * @throws SignatureException
+     *             验签失败,则抛异常
+     */
+    public static boolean doCheck(String content, byte[] sign, RSAPublicKey pubKey)
+            throws SignatureException {
+        try {
+            Signature signature = Signature.getInstance("SHA1withRSA");
+            signature.initVerify(pubKey);
+            signature.update(content.getBytes("utf-8"));
+            return signature.verify((sign));
+        } catch (Exception e) {
+            throw new SignatureException("RSA验证签名[content = " + content
+                    + "; charset = " + "; signature = " + sign + "]发生异常!", e);
+        }
+    }
+
+    /**
+    * RSA签名
+    * @param content 待签名数据
+    * @param privateKey 商户私钥
+    * @param encode 字符集编码
+    * @return 签名值
+    */
+    public static String sign(String content, String privateKey, String encode) {
+        try {
+            PKCS8EncodedKeySpec priPKCS8    = new PKCS8EncodedKeySpec( Base64Utils.decode(privateKey.getBytes(StandardCharsets.UTF_8)) );
+
+            KeyFactory keyf                 = KeyFactory.getInstance("RSA");
+            PrivateKey priKey               = keyf.generatePrivate(priPKCS8);
+
+            Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
+
+            signature.initSign(priKey);
+            signature.update( content.getBytes(encode));
+
+            byte[] signed = signature.sign();
+
+            return  new String(Base64Utils.encode(signed));
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+    public static String sign(String content, String privateKey) {
+        try {
+            PKCS8EncodedKeySpec priPKCS8    = new PKCS8EncodedKeySpec( Base64Utils.decode(privateKey.getBytes(StandardCharsets.UTF_8)) );
+            KeyFactory keyf = KeyFactory.getInstance("RSA");
+            PrivateKey priKey = keyf.generatePrivate(priPKCS8);
+            Signature signature = Signature.getInstance(SIGN_ALGORITHMS);
+            signature.initSign(priKey);
+            signature.update( content.getBytes());
+            byte[] signed = signature.sign();
+            return new String(Base64Utils.encode(signed));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+    * RSA验签名检查
+    * @param content 待签名数据
+    * @param sign 签名值
+    * @param publicKey 分配给开发商公钥
+    * @param encode 字符集编码
+    * @return 布尔值
+    */
+    public static boolean doCheck(String content, String sign, String publicKey, String encode) {
+        try {
+            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+            byte[] encodedKey = Base64Utils.decode(publicKey.getBytes(StandardCharsets.UTF_8));
+            PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
+
+
+            Signature signature = Signature
+            .getInstance(SIGN_ALGORITHMS);
+
+            signature.initVerify(pubKey);
+            signature.update( content.getBytes(encode) );
+
+            boolean bverify = signature.verify( Base64Utils.decode(sign.getBytes(StandardCharsets.UTF_8)) );
+            return bverify;
+
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+
+        return false;
+    }
+
+    public static boolean doCheck(String content, String sign, String publicKey) {
+        try {
+            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+            byte[] encodedKey = Base64Utils.decode(publicKey.getBytes(StandardCharsets.UTF_8));
+            PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
+
+
+            Signature signature = Signature
+            .getInstance(SIGN_ALGORITHMS);
+
+            signature.initVerify(pubKey);
+            signature.update( content.getBytes() );
+
+            boolean bverify = signature.verify( Base64Utils.decode(sign.getBytes(StandardCharsets.UTF_8)) );
+            return bverify;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+
+}