Răsfoiți Sursa

中煤api报价修改

BifronsV 3 ani în urmă
părinte
comite
8ad4ff72a3

+ 6 - 1
pom.xml

@@ -486,7 +486,12 @@
             <scope>test</scope>
         </dependency>
 
-
+        <!--集成logstash-->
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+            <version>5.3</version>
+        </dependency>
 
         <!-- rabbitmq依赖 -->
         <!--        <dependency>-->

+ 31 - 19
src/main/java/com/ydtech/components/ZhongmeiRequestApiComponents.java

@@ -1,7 +1,6 @@
 package com.ydtech.components;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.ydtech.config.properties.ZmApiConfigurationProperties;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.order.entity.api.zm.BaseRequest;
@@ -18,7 +17,6 @@ import java.util.List;
 
 
 /**
- *
  * @author wenks
  * @version 0.0.2
  * @description 中煤 APi 请求
@@ -38,17 +36,25 @@ public class ZhongmeiRequestApiComponents {
         this.restTemplate = restTemplate;
     }
 
-    private <K extends BaseRequest, T extends BaseResponse> T post(K k, String url, Class<T> tClass) {
+    /**
+     * @param q      请求参数
+     * @param url    请求url
+     * @param tClass 响应类型
+     * @param <Q>    Request 请求体
+     * @param <S>    Response 响应体
+     * @return <S>
+     */
+    private <Q extends BaseRequest, S extends BaseResponse> S post(Q q, String url, Class<S> tClass) {
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.setContentType(MediaType.APPLICATION_JSON);
-        HttpEntity<K> yaQuoteInfoVoHttpEntity = new HttpEntity<>(k, httpHeaders);
-        String jsonString = JSON.toJSONString(k);
+        HttpEntity<Q> yaQuoteInfoVoHttpEntity = new HttpEntity<>(q, httpHeaders);
+        String jsonString = JSON.toJSONString(q);
         log.info("---------> 请求参数:{}", jsonString);
         ResponseEntity<String> response = restTemplate.postForEntity(url, yaQuoteInfoVoHttpEntity, String.class);
 
         String body = response.getBody();
         log.info("---------> 响应参数:{}", body);
-        T t = JSON.parseObject(body, tClass);
+        S t = JSON.parseObject(body, tClass);
 
         if (ObjectUtils.isEmpty(t)) {
             throw new SystemException("请求失败");
@@ -58,17 +64,17 @@ public class ZhongmeiRequestApiComponents {
     }
 
     /**
-     * @param <Request>  请求体
-     * @param <Response> 响应体
-     * @param request    请求内容
-     * @param tClass     响应类型
-     * @param verify     结果是否需要验证
+     * @param <Q>     Request 请求体
+     * @param <S>     Response 响应体
+     * @param request 请求内容
+     * @param tClass  响应类型
+     * @param verify  结果是否需要验证
      * @return 响应内容
      */
-    private <Request extends BaseRequest, Response extends BaseResponse> Response request(Request request, Class<Response> tClass, boolean verify, String domain) {
+    private <Q extends BaseRequest, S extends BaseResponse> S request(Q request, Class<S> tClass, boolean verify, String domain) {
         request.setHead(properties.getHead());
         String url = domain + request.getHead().getTransCode() + ".do";
-        Response response = post(request, url, tClass);
+        S response = post(request, url, tClass);
         if (verify) {
             validationResults(response);
         }
@@ -76,23 +82,29 @@ public class ZhongmeiRequestApiComponents {
     }
 
     /**
-     * 常规
+     * @param <Q> Request 请求体
+     * @param <S> Response 响应体
+     *            常规
      */
-    private <Request extends BaseRequest, Response extends BaseResponse> Response routineRequest(Request request, Class<Response> tClass, boolean verify) {
+    private <Q extends BaseRequest, S extends BaseResponse> S routineRequest(Q request, Class<S> tClass, boolean verify) {
         return request(request, tClass, verify, properties.getUrl());
     }
 
     /**
-     * 影像
+     * @param <Q> Request 请求体
+     * @param <S> Response 响应体
+     *            影像
      */
-    private <Request extends BaseRequest, Response extends BaseResponse> void imageRequest(Request request, Class<Response> tClass, boolean verify) {
+    private <Q extends BaseRequest, S extends BaseResponse> void imageRequest(Q request, Class<S> tClass, boolean verify) {
         request(request, tClass, verify, properties.getImageUrl());
     }
 
     /**
-     * 短信
+     * @param <Q> Request 请求体
+     * @param <S> Response 响应体
+     *            短信
      */
-    private  <Request extends BaseRequest, Response extends BaseResponse> Response smsRequest(Request request, Class<Response> tClass, boolean verify) {
+    private <Q extends BaseRequest, S extends BaseResponse> S smsRequest(Q request, Class<S> tClass, boolean verify) {
         return request(request, tClass, verify, properties.getSmsUrl());
     }
 

+ 21 - 7
src/main/java/com/ydtech/constants/RedisConstant.java

@@ -2,25 +2,39 @@ package com.ydtech.constants;
 
 public class RedisConstant {
 
-    public final static String INS_RENBAO_KEY = "ins:renbao:token:";
+    private RedisConstant() {
+        throw new IllegalStateException("Utility class");
+    }
 
-    public final static  String INS_HENGBANG_KEY = "ins:hengbang:token:";
+    public static final String INS_RENBAO_KEY = "ins:renbao:token:";
 
-    public final static String INS_YONGCHENG_KEY = "ins:yongcheng:token:";
+    public static final String INS_HENGBANG_KEY = "ins:hengbang:token:";
 
-    public final static String PHONE_VERIFICATION_CODE_KEY = "sys:login:phone:";
+    public static final String INS_YONGCHENG_KEY = "ins:yongcheng:token:";
+
+    public static final String PHONE_VERIFICATION_CODE_KEY = "sys:login:phone:";
 
     public static final String INS_ANSHENG_KEY = "ins:ansheng:token:";
 
-    public final static long PHONE_VERIFICATION_CODE_KEY_TIME = 5L;
+    public static final long PHONE_VERIFICATION_CODE_KEY_TIME = 5L;
 
     /**
      * 订单缓存
      */
-    public final static String QUOTE_INFO_KEY = "ins:orders:";
+    public static final String QUOTE_INFO_KEY = "ins:orders:";
     /**
      * 订单缓存时间
      */
-    public final static long QUOTE_INFO_KEY_TIME = 1L;
+    public static final long QUOTE_INFO_KEY_TIME = 1L;
+
+    /**
+     * 中煤核保返回
+     */
+    public static final String ZM_AUDIT_RETURN_MESSAGE = "zm:audit:returnMessage:";
+
+    /**
+     * 中煤核保返回存储
+     */
+    public static final long ZM_AUDIT_RETURN_MESSAGE_TIME = 10;
 
 }

+ 1 - 1
src/main/java/com/ydtech/modules/order/controller/ZhongMeiOrderApiController.java

@@ -33,7 +33,7 @@ public class ZhongMeiOrderApiController {
 
     @PostMapping(value = "/modelsQuery")
     @ApiOperation(value = "车型查询接口")
-    public HttpResult ModelsQuery(@RequestSingleParam(value = "modelName") String modelName) {
+    public HttpResult modelsQuery(@RequestSingleParam(value = "modelName") String modelName) {
         return this.zhongMeiOrderApiService.modelsQuery(modelName);
     }
 

+ 0 - 4
src/main/java/com/ydtech/modules/order/dao/InsAccidentalDrivingMapper.java

@@ -12,7 +12,3 @@ import com.ydtech.modules.order.entity.InsAccidentalDriving;
 public interface InsAccidentalDrivingMapper extends BaseMapper<InsAccidentalDriving> {
 
 }
-
-
-
-

+ 32 - 7
src/main/java/com/ydtech/modules/order/service/impl/ZhongMeiOrderApiServiceImpl.java

@@ -22,6 +22,7 @@ import com.ydtech.modules.order.entity.api.zm.constants.InsuranceTypeCorresponde
 import com.ydtech.modules.order.entity.api.zm.constants.enums.AuditStatusEnum;
 import com.ydtech.modules.order.entity.api.zm.constants.enums.DocumentTypeEnum;
 import com.ydtech.modules.order.entity.api.zm.constants.enums.PaymentStatusEnum;
+import com.ydtech.modules.order.entity.api.zm.constants.enums.ReturnCodeEnum;
 import com.ydtech.modules.order.entity.api.zm.request.*;
 
 import com.ydtech.modules.order.entity.api.zm.response.*;
@@ -35,16 +36,21 @@ import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.order.service.InsTaskImagesService;
 import com.ydtech.modules.order.service.ZhongMeiOrderApiService;
 import com.ydtech.utils.CalculateUtils;
-import com.ydtech.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
+import static com.ydtech.constants.RedisConstant.ZM_AUDIT_RETURN_MESSAGE;
+import static com.ydtech.constants.RedisConstant.ZM_AUDIT_RETURN_MESSAGE_TIME;
+
 @Service
 @Slf4j
 public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
@@ -61,17 +67,21 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
 
     private final ZhongmeiRequestComponents zhongmeiRequestComponents;
 
-    public ZhongMeiOrderApiServiceImpl(InsOrdersService insOrdersService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService, ZhongmeiRequestApiComponents zhongmeiRequestApiComponents, EsmInsCompanyService esmInsCompanyService, ZhongmeiRequestComponents zhongmeiRequestComponents) {
+    private final StringRedisTemplate redisTemplate;
+
+
+    public ZhongMeiOrderApiServiceImpl(InsOrdersService insOrdersService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService, ZhongmeiRequestApiComponents zhongmeiRequestApiComponents, EsmInsCompanyService esmInsCompanyService, ZhongmeiRequestComponents zhongmeiRequestComponents, StringRedisTemplate redisTemplate) {
         this.insOrdersService = insOrdersService;
         this.insAreaCompanyService = insAreaCompanyService;
         this.insTaskImagesService = insTaskImagesService;
         this.zhongmeiRequestApiComponents = zhongmeiRequestApiComponents;
         this.esmInsCompanyService = esmInsCompanyService;
         this.zhongmeiRequestComponents = zhongmeiRequestComponents;
+        this.redisTemplate = redisTemplate;
     }
 
     private void modelInquiry(String modelName, List<ModelsQueryResponse.SimpleStadarCarDTO> simpleStadarCarDTOS) {
-        if (!simpleStadarCarDTOS.isEmpty()){
+        if (!simpleStadarCarDTOS.isEmpty()) {
             return;
         }
 
@@ -116,8 +126,8 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
         // 1.2 过滤车型
         List<ModelsQueryResponse.SimpleStadarCarDTO> stadarCarDTOS = new ArrayList<>();
 
-        if(!StringUtils.isEmpty(carInfo.getCaryear())){
-             stadarCarDTOS = simpleStadarCarDTOS.stream().filter(car -> carInfo.getCaryear().equals(car.getLfDate())).collect(Collectors.toList());
+        if (!StringUtils.isEmpty(carInfo.getCaryear())) {
+            stadarCarDTOS = simpleStadarCarDTOS.stream().filter(car -> carInfo.getCaryear().equals(car.getLfDate())).collect(Collectors.toList());
         }
 
         if (!stadarCarDTOS.isEmpty()) {
@@ -136,6 +146,11 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
         QuoteRespVo quoteRespVo = getQuoteRespVo(quotedPriceResponse, quoteInfo);
         // 2. 第一次提交核保 并且获取投保单号
         SubmitResponse response = submitForUnderwriting(quotedPriceResponse.getOrderNo(), carInfo.getFrameNo(), quoteInfo.getPolicyHolderInfo());
+
+        // 3. 将错误的核保信息存入redis
+        if (StringUtils.isEmpty(response.getProposalNo())) {
+            redisTemplate.opsForValue().set(ZM_AUDIT_RETURN_MESSAGE + quoteRespVo.getCompanyId(), response.getHead().getReturnMessage(), ZM_AUDIT_RETURN_MESSAGE_TIME, TimeUnit.MINUTES);
+        }
         return responseOrder(quotedPriceResponse, quoteRespVo, esmInsCompany, response);
     }
 
@@ -146,10 +161,10 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
         InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
         JSONObject ownerinfo = insOrders.getApplyinfo();
         CustomerInfoVo customerInfoVo = JSON.toJavaObject(ownerinfo, CustomerInfoVo.class);
-        // 第二次 提交核保
+        // 1. 第二次 提交核保
         SubmitResponse response = submitForUnderwriting(insAreaCompany.getId(), insOrders.getFrameno(), customerInfoVo);
         HttpResult httpResult;
-        // 人工核保
+        // 2. 人工核保
         if (response.getHead().getReturnMessage().contains(InsuranceTypeCorrespondence.MANUAL_UNDERWRITING)) {
             insAreaCompany.setOrderstatus(InsOrderStatus.S_1.getCode());
             httpResult = HttpResult.error(response.getHead().getReturnMessage());
@@ -176,6 +191,16 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
         InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
         // 投保单号(总)
         String insOrderNo = insAreaCompany.getInsOrderNo();
+        // 没有投保单号
+        if (StringUtils.isEmpty(insOrderNo)) {
+            String s = redisTemplate.opsForValue().get(ZM_AUDIT_RETURN_MESSAGE + companyId);
+            if (StringUtils.isEmpty(s)) {
+                throw new SystemException("请重新报价,再核保。");
+            } else {
+                throw new SystemException(s);
+            }
+        }
+
         List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insOrders.getOrderno());
         if (insTaskImagesBase64s.isEmpty()) {
             throw new SystemException("请检查影像是否上传了");

+ 51 - 34
src/main/resources/application-dev.yml

@@ -23,10 +23,14 @@ spring:
       # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
       timeBetweenEvictionRunsMillis: 60000
       validationQuery: SELECT 1 FROM DUAL
-    ## 测试库
-    url: jdbc:p6spy:mysql://47.92.254.66:3306/zgdd?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+    ## 本地
+    url: jdbc:p6spy:mysql://192.168.182.128:3306/zgdd?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
     username: root
-    password: zgdd@2020
+    password: 123456
+#    ## 测试库
+#    url: jdbc:p6spy:mysql://47.92.254.66:3306/zgdd?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+#    username: root
+#    password: zgdd@2020
 
   # redis 配置
   redis:
@@ -202,13 +206,14 @@ server:
       charset: UTF-8
       force: true
 
-
-
 upload:
   # 路径带上前后斜杆
   basepath: ${filePath}
   file:
+    # 上传目录
     path: D:/upload/
+    # 映射路劲
+    url: /upload/
   host: ''
   password: ''
   url: ${netUrl}
@@ -231,37 +236,37 @@ ya:
 
 ##永诚
 yc:
-  #api方式
   api:
     agent:
+      # 机构代码(dptCde)
+      dptCde: 14A4
       # 渠道编码(agentCode)
       agentCode: 250000P00004
-      # 渠道分类(agentType)
-      agentNme: 191010
       # 协议编码(conferCode)
-      agentType: 250000P0000401
-      # 操作人员代码(cOprcde)
-      cBsnsTyp: 100030057
-      # 业务员代码(salesmanNo)
-      cChaType: 100030057
-      # 客户性质(custNature)
-      cOprcde: 192099
-      # 新业务来源(CChaType)
-      custNature: 191010
-      # 机构代码(dptCde)
-      dptCde: 14A4
-      # 代理人资格证号(qlftNo)
-      operatorCode: 2752454675645
+      conferCode: 250000P0000401
+      # 渠道分类(agentType)
+      agentType: 191010
       # 代理人名称(agentNme)
-      qlftNo: 永鑫保险销售服务有限公司山西分公司
+      agentNme: 永鑫保险销售服务有限公司山西分公司
+      # 代理人资格证号(qlftNo)
+      qlftNo: 2752454675645
       # 录入人(operatorCode)
+      operatorCode: 100030057
+      # 业务员代码(salesmanNo)
       salesmanNo: 100030057
-    userName: tianqin
-    password: 123456
+      # 新业务来源(CChaType)
+      CChaType: 191010
+      # 客户性质(custNature)
+      custNature: 192099
+      # 操作人员代码(cOprcde)
+      cOprcde: 100030057
+      # 业务来源(cBsnsTyp)
+      cBsnsTyp: 19002
+    password: yc@20230202!
     pay:
-      # 回调地址
-      callBack: http://47.92.254.66:8080/api/yongCheng/callBack
+      callBack: http://127.0.0.1:8080/api/yongCheng/callBack
     url: http://140.206.189.151:17000/
+    userName: yctest1
   audit:
     url: /yc/jiaofei
   domain: http://47.92.254.66:8088
@@ -272,14 +277,13 @@ yc:
   quote:
     url: /yc/bfjs
 
-
 #中煤
 zm:
   ascription:
     url: ${zm.domain}/ascription
   audit:
     url: ${zm.domain}/audit
-  domain: http://172.24.144.213:8888/zm
+  domain: http://47.92.254.66:8888/zm
   getPolicyPrint:
     url: ${zm.domain}/getPolicyPrint
   image:
@@ -294,16 +298,29 @@ zm:
     url: ${zm.domain}/verifyPayment
   vinSearch:
     url: ${zm.domain}/vinSearch
+# 测试
   api:
     source: 326
-    token: THIRDSCOuloft2020052818346904zmYBSX
-    url: https://test.echinacoal.com/singlePlatform
-    imageUrl: https://test.echinacoal.com/singlePlatform/others/
-    smsUrl: https://test.echinacoal.com/singlePlatform/prpall/
+    token: THIRDSCOuloft2020052818346904zmYBSXXHTQ
+    url: https://www.echinacoal.com/singlePlatform/
+    imageUrl: https://www.echinacoal.com/singlePlatform/others/
+    smsUrl: https://www.echinacoal.com/singlePlatform/prpall/
     pageUrl: http://www.baidu.com
-    callbackDomain: http://test.baoxianzhanggui.com:8090
+    callbackDomain: http://sxzgkj.baoxianzhanggui.com/web-api
     callbackUrl: /order/zhongMeiApi/underwritingCallback
     passMsgUrl: /order/zhongMeiApi/auditCallback
+#  api:
+#    source: 326
+#    token: THIRDSCOuloft2020052818346904zmYBSX
+#    url: https://test.echinacoal.com/singlePlatform/
+#    imageUrl: https://test.echinacoal.com/singlePlatform/others/
+#    smsUrl: https://test.echinacoal.com/singlePlatform/prpall/
+#    pageUrl: http://www.baidu.com
+#    callbackDomain: http://test.baoxianzhanggui.com:8090
+#    callbackUrl: /order/zhongMeiApi/underwritingCallback
+#    passMsgUrl: /order/zhongMeiApi/auditCallback
+
 
 logging:
-  path: D:/111/logs
+  file:
+    path: logs

+ 1 - 1
src/main/resources/application-prod.yml

@@ -227,7 +227,7 @@ zm:
     url: ${zm.domain}/ascription
   audit:
     url: ${zm.domain}/audit
-  domain: http://172.24.144.213:8888/zm
+  domain: http://sxzgkj.baoxianzhanggui.com/zm/zm
   getPolicyPrint:
     url: ${zm.domain}/getPolicyPrint
   image:

+ 3 - 3
src/main/resources/application-test.yml

@@ -184,7 +184,7 @@ spring:
   # redis 配置
   redis:
     database: 0
-#    host: 127.0.0.1
+    #    host: 127.0.0.1
     host: 172.24.144.218
     lettuce:
       pool:
@@ -192,7 +192,7 @@ spring:
         max-idle: 8
         max-wait: 100
         min-idle: 0
-#    password: ''
+    #    password: ''
     password: sxzgkj@2023
     port: 6379
     timeOut: 3000
@@ -265,7 +265,7 @@ yc:
     pay:
       # 回调地址
       callBack: http://39.98.239.48/web-api/api/yongCheng/callBack
-#      callBack: http://47.92.254.66:8080/api/yongCheng/callBack
+    #      callBack: http://47.92.254.66:8080/api/yongCheng/callBack
     url: http://140.206.189.151:17000/
   audit:
     url: /yc/jiaofei