Răsfoiți Sursa

1、优化永诚代码。

ligang134 2 ani în urmă
părinte
comite
e1ce31daf2

+ 1 - 1
README.md

@@ -308,7 +308,7 @@
 * 需求bug收集表:https://kdocs.cn/l/cloAn4eaINVw
 * APP安卓APK包:http://sxzgkj.baoxianzhanggui.com/web-api/upload/app/2023/10/11/83c6c7bce9fefde9f0e5fb6fcecf0f44.apk
 * 更新日期:2023-10-17
-* 更新时间:10:40  ~  11:30
+* 更新时间:10:50  ~  11:20
 * 更新内容:
   1. 解决订单丢失问题。
   2. 永诚优化请求代码。

+ 16 - 13
src/main/java/com/ydtech/modules/ins/service/impl/InsAlltrustApiServiceImpl.java

@@ -60,9 +60,11 @@ import com.ydtech.modules.order.components.ConfigureParametersComponents;
 import com.ydtech.modules.order.components.InsOrdersComponents;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
 import com.ydtech.modules.order.entity.vo.*;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.order.service.InsTaskImagesService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.*;
 import com.ydtech.utils.baidu.FileUtil;
@@ -140,7 +142,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
     @Autowired
     private InsOrdersService insOrdersService;
     @Autowired
-    private InsTaskImageService insTaskImageService;
+    private InsTaskImagesService insTaskImagesService;
     @Autowired
     private EsmInsAttachInsureMapper esmInsAttachInsureMapper;
     @Autowired
@@ -281,8 +283,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
         //构造车辆信息
         gainVehicleModel(ycConfigureParameters, carInfo);
 
-
-        HttpResult httpResult = new HttpResult();
 //        ObjectMapper xmlMapper = this.gainXmlMapper();
 
         InsAreaCompany iac = null;
@@ -371,6 +371,11 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
 //        //车主
 //        CustomerInfoVo ownerInfo =
 
+        //查询码交强
+        String queryCodeJq = rr.getVhl().getCQryCdeJQ();
+        //查询码商业
+        String queryCodeSy = rr.getVhl().getCQryCdeSY();
+
         order.setOwnerinfo(JSONObject.parseObject(JSONObject.toJSONString(yaQuoteInfoVo.getOwnerInfo())));
         order.setInsureinfo(JSONObject.parseObject(JSONObject.toJSONString(yaQuoteInfoVo.getInsuredPersonInfo())));
         order.setApplyinfo(JSONObject.parseObject(JSONObject.toJSONString(yaQuoteInfoVo.getPolicyHolderInfo())));
@@ -575,9 +580,8 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
         try {
             //子订单
             InsAreaCompany iac = insAreaCompanyService.getById(quoteOrderNo);
-            if (iac == null) {
-                return HttpResult.error("订单不存在");
-            }
+            AssertionUtils.isEmpty(iac,"子订单不存在");
+            if(!iac.getOrderstatus().equals(InsOrderStatusEnum.QUOTE_ING)) return HttpResult.error("报价中的订单才允许核保");
             InsOrders order = insOrdersService.getById(iac.getOrderno());
 
             // 获取协议配置信息
@@ -611,7 +615,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
 
             //接口请求
             String responseData = httpPostResultLog(m, YcBuildData.API_AUDIT, "永诚API方式 - 核保(车牌号:"+order.getLicenseno()+") - ");
-            AssertionUtils.isEmpty(responseData,"(日志号"+logNo+")核保请求超时请重试。");
+            AssertionUtils.isEmpty(responseData,logNo + "核保请求超时请重试。");
 
             String cleanStr = YcBuildData.cleanResponseStr(responseData);
             AuditResponse rd = gainXmlMapper().readValue(cleanStr, AuditResponse.class);
@@ -681,10 +685,11 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
     @Override
     public HttpResult UploadImageApi(String quoteOrderNo) {
 
-        HttpResult resutl = HttpResult.ok();
+        String logNo = String.format("(日志号:%s)", IPUtil.gainServerNo());
         InsAreaCompany iac = insAreaCompanyService.getByIdIsExist(quoteOrderNo);
         InsOrders order = insOrdersService.getById(iac.getOrderno());
-        List<InsTaskImage> insTaskImages = insTaskImageService.selectByTaskId(order.getQuoteno());
+        List<InsTaskImagesBase64> insTaskImages = insTaskImagesService.findByOrderNo(iac.getOrderno());
+        if(CollUtil.isEmpty(insTaskImages)) return HttpResult.error("获取影像失败");
 
         //获取协议配置信息
         YcConfigureParameters ycConfigureParameters = gainYcConfigParams(iac.getAgreementId());
@@ -694,14 +699,12 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
             InsApiLog apiLog = null;
             //组装参数
             //接口请求
-            ImageUp iUp = ImageUp.buildImageUpParam(order, ycConfigureParameters, a.getImage(), a.getImgtype());
+            ImageUp iUp = ImageUp.buildImageUpParam(order, ycConfigureParameters, a.getBase64String(), a.getImageType());
             ObjectMapper xmlMapper = gainXmlMapper();
             //接口请求
 //            apiLog = httpPost(xmlMapper, iUp, YcBuildData.API_UPLOAD);
-            String responseData = httpPostResultLog(iUp, YcBuildData.API_UPLOAD, "永诚API方式 - 影像上传 - ");
-            verifyRequest(apiLog, iac, InsQuoteFlow.Q_S_2);
+            String responseData = httpPostResultLog(iUp, YcBuildData.API_UPLOAD, logNo +"永诚API方式(车牌号:)"+order.getLicenseno()+" - 影像上传 - "+iUp.getNewImgUpLoadInfoRequest().getRequestBase().getPicTureName()+" - ");
             try {
-//                String responseData = apiLog.getResponseData();
                 String cleanStr = YcBuildData.cleanResponseStr(responseData);
                 log.error("===永诚API方式--上传影像清洗返回参数:" + cleanStr);
                 ImageUpResponse iur = xmlMapper.readValue(cleanStr, ImageUpResponse.class);

+ 18 - 6
src/main/java/com/ydtech/utils/HttpXmlUtil.java

@@ -31,6 +31,16 @@ import java.util.regex.Pattern;
 
 @Slf4j
 public class HttpXmlUtil {
+
+    public final static OkHttpClient client = new OkHttpClient.Builder()
+            .connectTimeout(120, TimeUnit.SECONDS)
+            .writeTimeout(120, TimeUnit.SECONDS)
+            .readTimeout(120, TimeUnit.SECONDS)
+            .build();
+
+
+
+
     /**
      * 发送xml请求到server端
      *
@@ -173,14 +183,12 @@ public class HttpXmlUtil {
         if (null != log) log.debug(textHead + "XML请求url:{},\n请求参数:{}", url, xmlString);
 
         String responseString = null;
+//        Response response = new Response.Builder().addHeader("Connection", "close").build();
         Response response = null;
         Call call = null;
         try {
-            OkHttpClient client = new OkHttpClient.Builder()
-                    .connectTimeout(60, TimeUnit.SECONDS)
-                    .writeTimeout(60, TimeUnit.SECONDS)
-                    .readTimeout(60, TimeUnit.SECONDS)
-                    .build();
+
+
 
             MediaType mediaType = MediaType.parse("text/xml");
             RequestBody body = RequestBody.create(mediaType, xmlString);
@@ -189,7 +197,7 @@ public class HttpXmlUtil {
                     .post(body)
                     .addHeader("Content-Type", "text/xml")
                     .addHeader("cache-control", "no-cache")
-                    .addHeader("Connection", "close")
+//                    .addHeader("Connection", "close")
                     .build();
 
             call = client.newCall(request);
@@ -198,15 +206,19 @@ public class HttpXmlUtil {
                 responseString = response.body().string();
             }
 
+            client.dispatcher().executorService().shutdown();
+
         } catch (Exception e) {
             e.printStackTrace();
             log.error(textHead + "请求异常:" + e.getMessage() + ",原始返回:" + response);
+            e.printStackTrace();
             throw new SystemException("远程接口请求失败,请联系管理员。");
         } finally {
             if (null != log) textHead = StringUtils.toString(textHead, "123456789");
             url = StringUtils.toString(url, "");
             String responseStringMsg = StringUtils.isNotEmpty(responseString) ? responseString.replaceAll("\n", "").replaceAll("&lt;", "<").replaceAll("&gt;", ">") : "";
             log.debug(textHead + "XML返回url:{},\n响应参数:{}", url, responseStringMsg);
+
             response.close();
             call.cancel();
         }