Explorar el Código

Merge remote-tracking branch 'origin/test' into test

wks hace 2 años
padre
commit
d011cb9862

+ 22 - 2
README.md

@@ -317,17 +317,37 @@
 
 
 
+**《掌柜鼎PC平台》系统维护公告**
+
+* 版本号:v0.0.5.5
+* 访问地址:http://sxzgkj.baoxianzhanggui.com/
+* 需求bug收集表:https://kdocs.cn/l/cloAn4eaINVw
+* APP安卓APK包:http://sxzgkj.baoxianzhanggui.com/web-api/upload/app/2023/10/11/83c6c7bce9fefde9f0e5fb6fcecf0f44.apk
+* 更新日期:2023-10-18
+* 更新时间:08:30  ~  09:30
+* 更新内容:
+  1. 选择为过户车,转移登记日期和发证日期一样
+  2. 添加车辆用途字段,选择使用性质为营业使用营业数据
+  3. 添加即时起保按钮,时间为当前时间后两小时整点
+  4. 报价单上添加截图按钮
+
+
+
+
 --------未发布
 **《掌柜鼎PC平台》系统维护公告**
 
-* 版本号:v0.0.5.2
+* 版本号:v0.0.5.4
 * 访问地址:http://sxzgkj.baoxianzhanggui.com/
 * 需求bug收集表:https://kdocs.cn/l/cloAn4eaINVw
 * APP安卓APK包:http://sxzgkj.baoxianzhanggui.com/web-api/upload/app/2023/10/11/83c6c7bce9fefde9f0e5fb6fcecf0f44.apk
 * 更新日期:2023-10-16
 * 更新时间:08:30  ~  09:30
 * 更新内容:
-  1. 
+   1. 选择为过户车,转移登记日期和发证日期一样
+   2. 添加车辆用途字段,选择使用性质为营业使用营业数据
+   3. 添加即时起保按钮,时间为当前时间后两小时整点
+   4. 报价单上添加截图按钮
 
 
 

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

@@ -581,7 +581,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
             //子订单
             InsAreaCompany iac = insAreaCompanyService.getById(quoteOrderNo);
             AssertionUtils.isEmpty(iac,"子订单不存在");
-            if(!iac.getOrderstatus().equals(InsOrderStatusEnum.QUOTE_ING)) return HttpResult.error("报价中的订单才允许核保");
             InsOrders order = insOrdersService.getById(iac.getOrderno());
 
             // 获取协议配置信息
@@ -687,6 +686,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
 
         String logNo = String.format("(日志号:%s)", IPUtil.gainServerNo());
         InsAreaCompany iac = insAreaCompanyService.getByIdIsExist(quoteOrderNo);
+        if(!iac.getOrderstatus().equals(InsOrderStatusEnum.QUOTE_ING.getCode())) return HttpResult.error("报价中的订单才允许核保");
         InsOrders order = insOrdersService.getById(iac.getOrderno());
         List<InsTaskImagesBase64> insTaskImages = insTaskImagesService.findByOrderNo(iac.getOrderno());
         if(CollUtil.isEmpty(insTaskImages)) return HttpResult.error("获取影像失败");

+ 34 - 84
src/main/java/com/ydtech/utils/HttpXmlUtil.java

@@ -32,11 +32,29 @@ 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();
+//    public final static OkHttpClient client = new OkHttpClient.Builder()
+//            .connectTimeout(120, TimeUnit.SECONDS)
+//            .writeTimeout(120, TimeUnit.SECONDS)
+//            .readTimeout(120, TimeUnit.SECONDS)
+//            .build();
+
+    private static OkHttpClient client;
+
+
+    private static OkHttpClient getInstance() {
+        if (client == null) {
+            synchronized (OkHttpClient.class) {
+                if (client == null) {
+                    client = new OkHttpClient.Builder()
+                            .connectTimeout(240, TimeUnit.SECONDS)
+                            .writeTimeout(240, TimeUnit.SECONDS)
+                            .readTimeout(240, TimeUnit.SECONDS)
+                            .build();
+                }
+            }
+        }
+        return client;
+    }
 
 
 
@@ -101,73 +119,6 @@ public class HttpXmlUtil {
     }
 
 
-//    /**
-//     * 发送xml请求到server端
-//     *
-//     * @param url       xml请求数据地址
-//     * @param xmlString 发送的xml数据流
-//     * @return map   key:requestData  key:responseData
-//     */
-//    public static InsApiLog sendXmlPost(String url, String xmlString) {
-//
-//        System.out.println("请求参数=" + xmlString);
-//        log.debug("XML请求url:{},请求参数:{}", url, xmlString);
-//        InsApiLog lon = new InsApiLog();
-//
-//        lon.setUrl(url);
-//        lon.setRequestData(xmlString);
-//        Response response = null;
-//        String responseString = 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);
-//            Request request = new Request.Builder()
-//                    .url(url)
-//                    .post(body)
-//                    .addHeader("Content-Type", "text/xml")
-//                    .addHeader("cache-control", "no-cache")
-//                    .build();
-//
-//            response = client.newCall(request).execute();
-//            if (response.isSuccessful()) {
-//                responseString = response.body().string();
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            lon.setExceptionMsg(e.getMessage());
-//            return lon;
-//        } finally {
-//            System.out.println("返回参数=" + responseString);
-//            response.close();
-//            log.debug("XML返回url:{},响应参数:{}", url, responseString);
-//        }
-//
-//
-//        String[] patterns = new String[]{
-//                // This will remove empty elements that look like <ElementName/>
-//                "\\s*<\\w+/>",
-//                // This will remove empty elements that look like <ElementName></ElementName>
-//                "\\s*<\\w+></\\w+>",
-//                // This will remove empty elements that look like
-//                // <ElementName>
-//                // </ElementName>
-//                "\\s*<\\w+>\n*\\s*</\\w+>"
-//        };
-//        for (String pattern : patterns) {
-//            Matcher matcher = Pattern.compile(pattern).matcher(responseString);
-//            responseString = matcher.replaceAll("");
-//        }
-//
-//        lon.setResponseData(responseString);
-//        return lon;
-//    }
 
 
     /**
@@ -185,32 +136,32 @@ public class HttpXmlUtil {
         String responseString = null;
 //        Response response = new Response.Builder().addHeader("Connection", "close").build();
         Response response = null;
-        Call call = null;
         try {
 
 
-
             MediaType mediaType = MediaType.parse("text/xml");
-            RequestBody body = RequestBody.create(mediaType, xmlString);
+            RequestBody reqBody = RequestBody.create(mediaType, xmlString);
             Request request = new Request.Builder()
                     .url(url)
-                    .post(body)
+                    .post(reqBody)
                     .addHeader("Content-Type", "text/xml")
                     .addHeader("cache-control", "no-cache")
 //                    .addHeader("Connection", "close")
                     .build();
 
-            call = client.newCall(request);
-            response = call.execute();
-            if (response.isSuccessful()) {
-                responseString = response.body().string();
+            response = getInstance().newCall(request).execute();
+            ResponseBody respBody = response.body();
+            if (respBody != null) {
+                if (response.isSuccessful()) {
+                    responseString = response.body().string();
+                }
+            } else {
+                log.error(textHead + "请求返回null");
             }
 
-            client.dispatcher().executorService().shutdown();
 
         } catch (Exception e) {
-            e.printStackTrace();
-            log.error(textHead + "请求异常:" + e.getMessage() + ",原始返回:" + response);
+            log.error(textHead + "请求异常:" + e.getMessage() + ",异常信息:" + e);
             e.printStackTrace();
             throw new SystemException("远程接口请求失败,请联系管理员。");
         } finally {
@@ -220,7 +171,6 @@ public class HttpXmlUtil {
             log.debug(textHead + "XML返回url:{},\n响应参数:{}", url, responseStringMsg);
 
             response.close();
-            call.cancel();
         }
 
         return responseString;