Преглед изворни кода

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

ligang134 пре 3 година
родитељ
комит
85ecaa28cf

+ 4 - 5
src/main/java/com/ydtech/core/page/PageRequest.java

@@ -1,7 +1,6 @@
 package com.ydtech.core.page;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ydtech.modules.esm.model.EsmInsAttribution;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.poi.ss.formula.functions.T;
 
@@ -27,7 +26,7 @@ public class PageRequest {
      * map
      */
     @ApiModelProperty(value = "参数 Map集")
-    private Map<String, ColumnFilter> columnFilters = new HashMap<String, ColumnFilter>();
+    private Map<String, ColumnFilter> columnFilters = new HashMap<>();
 
     public int getPageNum() {
         return pageNum;
@@ -59,10 +58,10 @@ public class PageRequest {
 
 
     public static Page<T>  buildPageRequest(PageRequest pageRequest){
-        int pageNum = pageRequest.getPageNum() < 1?1:pageRequest.getPageNum();
-        int pageSize = pageRequest.getPageSize() <1?1:pageRequest.getPageSize();
+        int pageNum = Math.max(pageRequest.getPageNum(), 1);
+        int pageSize = Math.max(pageRequest.getPageSize(), 1);
 
-        Page<T> p = new Page();
+        Page<T> p = new Page<>();
         p.setSize(pageSize);
         p.setCurrent(pageNum);
         return p;

+ 1 - 4
src/main/java/com/ydtech/exception/SystemException.java

@@ -4,7 +4,7 @@ package com.ydtech.exception;
 public class SystemException extends RuntimeException {
 
     private static final long serialVersionUID = -8279298258775808815L;
-    private String code;
+    private final String code;
 
     public SystemException(String message) {
         super(message);
@@ -25,8 +25,5 @@ public class SystemException extends RuntimeException {
         return code;
     }
 
-    public void setCode(String code) {
-        this.code = code;
-    }
 }
 

+ 0 - 3
src/main/java/com/ydtech/modules/admin/controller/SysDictController.java

@@ -2,9 +2,7 @@ package com.ydtech.modules.admin.controller;
 
 
 import com.ydtech.config.DictEnumConfig;
-import com.ydtech.constants.SysConstants;
 import com.ydtech.constants.enums.dict.DictionaryManagement;
-import com.ydtech.constants.enums.dict.EnumUtils;
 import com.ydtech.core.page.BaseController;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
@@ -27,7 +25,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.collections4.list.TreeList;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 

+ 2 - 10
src/main/java/com/ydtech/modules/order/controller/IdentifyController.java

@@ -41,21 +41,13 @@ public class IdentifyController {
     @PostMapping("/idCard")
     @ApiOperation(value = "身份证正反面识别")
     public HttpResult idCard(MultipartFile image1, MultipartFile image2) {
-        try {
-            return identifyService.idCard(image1, image2);
-        }catch (IOException e){
-            throw new SystemException("图片压缩异常请重试.......");
-        }
+        return identifyService.idCard(image1, image2);
     }
 
     @PostMapping("/drivingPermit")
     @ApiOperation(value = "行驶证正反面识别")
     public HttpResult drivingPermit(MultipartFile image1, MultipartFile image2) {
-        try {
-            return identifyService.drivingPermit(image1, image2);
-        }catch (IOException e){
-            throw new SystemException("图片压缩异常请重试.......");
-        }
+        return identifyService.drivingPermit(image1, image2);
     }
 
 }

+ 3 - 3
src/main/java/com/ydtech/modules/order/entity/api/zm/constants/enums/PaymentStatusEnum.java

@@ -14,9 +14,9 @@ import lombok.Getter;
 @Getter
 public enum PaymentStatusEnum {
 
-    P_1(0, "支付失败/未缴费"),
-    P_2(1, "支付成功但承保确认失败"),
-    P_3(2, "承保成功");
+    P_0(0, "支付失败/未缴费"),
+    P_1(1, "支付成功但承保确认失败"),
+    P_2(2, "承保成功");
 
     private final int code;
 

+ 1 - 2
src/main/java/com/ydtech/modules/order/entity/vo/PolicyPrintVo.java

@@ -1,6 +1,5 @@
 package com.ydtech.modules.order.entity.vo;
 
-import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -10,7 +9,7 @@ import java.io.Serializable;
 /**
  * @author wenks
  * @version 0.0.2
- * @description TODO
+ * @description 获取保单实体
  * @date 2023/4/26 14:58
  */
 @Data

+ 2 - 2
src/main/java/com/ydtech/modules/order/service/IdentifyService.java

@@ -8,8 +8,8 @@ import java.io.IOException;
 public interface IdentifyService {
 
 
-    HttpResult idCard(MultipartFile image1, MultipartFile image2) throws IOException;
+    HttpResult idCard(MultipartFile image1, MultipartFile image2);
 
-    HttpResult drivingPermit(MultipartFile image1, MultipartFile image2) throws IOException;
+    HttpResult drivingPermit(MultipartFile image1, MultipartFile image2);
 
 }

+ 10 - 7
src/main/java/com/ydtech/modules/order/service/impl/IdentifyServiceImpl.java

@@ -28,7 +28,7 @@ import java.util.Map;
 public class IdentifyServiceImpl implements IdentifyService {
 
     @Override
-    public HttpResult idCard(MultipartFile image1, MultipartFile image2) throws IOException {
+    public HttpResult idCard(MultipartFile image1, MultipartFile image2){
         Map<String, Object> map = new HashMap<>();
         CustomerInfoVO customerInfoVO = new CustomerInfoVO();
 
@@ -54,7 +54,7 @@ public class IdentifyServiceImpl implements IdentifyService {
     }
 
     @Override
-    public HttpResult drivingPermit(MultipartFile image1, MultipartFile image2) throws IOException {
+    public HttpResult drivingPermit(MultipartFile image1, MultipartFile image2) {
         Map<String, Object> map = new HashMap<>();
         CardUserInfo cardUserInfo = new CardUserInfo();
 
@@ -80,18 +80,21 @@ public class IdentifyServiceImpl implements IdentifyService {
             cardUserInfo.setUnladenMass(drivingPermitBack.getUnladenMass());
         }
 
-
         map.put("carInfo", cardUserInfo);
         return HttpResult.ok("success", map);
     }
 
 
-    private String byteToBase64(MultipartFile file) throws IOException {
+    private String byteToBase64(MultipartFile file)   {
         if(ObjectUtils.isEmpty(file)){
             return "";
         }        // 转换后的图片
-        byte[] bytes_bytes = ImageCompressionUtils.compressPicForScale(file.getBytes(), 2048);
-        return Base64.getEncoder().encodeToString(bytes_bytes);
-    }
+        try {
+            byte[] bytesBytes = ImageCompressionUtils.compressPicForScale(file.getBytes(), 2048);
+            return Base64.getEncoder().encodeToString(bytesBytes);
+        } catch (IOException e) {
+            throw new SystemException("图片压缩异常请重试.......");
+        }
 
+    }
 }

+ 5 - 11
src/main/java/com/ydtech/modules/order/service/impl/YongAnOrderServiceImpl.java

@@ -10,17 +10,13 @@ import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.esm.model.EsmInsCompany;
-import com.ydtech.modules.esm.model.InsTaskImage;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
-import com.ydtech.modules.esm.service.InsTaskImageService;
 import com.ydtech.modules.ins.model.ya.*;
-import com.ydtech.modules.ins.service.YongAnService;
 import com.ydtech.modules.ins.vo.*;
 import com.ydtech.modules.order.convert.MapToYaExtendInfoDto;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.TaxArrears;
-import com.ydtech.modules.order.entity.po.InsTaskImages;
 import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
@@ -34,7 +30,6 @@ import com.ydtech.utils.HMAC256Uitil;
 import com.ydtech.utils.HttpXmlUtil;
 import com.ydtech.utils.idgen.IdGenerate;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
@@ -342,8 +337,8 @@ public class YongAnOrderServiceImpl implements YongAnOrderService {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         try {
             //1.组装RequestBody
-            ResponseDataC2 responseDataC2 = JSONObject.parseObject(insAreaCompany.getReptxt().toJSONString(), ResponseDataC2.class);
-            CustomerInfoVo insureinfo = JSONObject.parseObject(orders.getInsureinfo().toJSONString(), CustomerInfoVo.class);
+            ResponseDataC2 responseDataC2 = JSON.parseObject(insAreaCompany.getReptxt().toJSONString(), ResponseDataC2.class);
+            CustomerInfoVo insureinfo = JSON.parseObject(orders.getInsureinfo().toJSONString(), CustomerInfoVo.class);
 
             requestBodyC3.setQuotationNoCI(responseDataC2.getResponseBody().getQuotationNoCI());
             requestBodyC3.setQuotationNoBI(responseDataC2.getResponseBody().getQuotationNoBI());
@@ -518,10 +513,9 @@ public class YongAnOrderServiceImpl implements YongAnOrderService {
             ObjectMapper mapper = new XmlMapper();
             mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
             //1.组装RequestBody
-            ResponseDataC2 responseDataC2 = JSONObject.parseObject(insAreaCompany.getReptxt().toJSONString(), ResponseDataC2.class);
+            ResponseDataC2 responseDataC2 = JSON.parseObject(insAreaCompany.getReptxt().toJSONString(), ResponseDataC2.class);
             List<ExtendInfoDto> extendInfoList = responseDataC2.getResponseBody().getExtendInfo();
             Map<String, String> maps = extendInfoList.stream().collect(LinkedHashMap::new, (m, v) -> m.put(v.getKey(), v.getValue()), LinkedHashMap::putAll);
-//            Map<String, String> maps = extendInfoList.stream().collect(Collectors.toMap(ExtendInfoDto::getKey, ExtendInfoDto::getValue, (key1, key2) -> key2));
             requestBodyB7.setBzQueryNo(maps.get("querySequenceBZNo"));//交强
             requestBodyB7.setQueryNo(maps.get("querySequenceNo"));
             DispatchDTO dispatchDTO = new DispatchDTO();
@@ -529,10 +523,10 @@ public class YongAnOrderServiceImpl implements YongAnOrderService {
             requestBodyB7.setCityCode("140400");
             List<PrivyDTO> privy = new ArrayList<>();//关系人信息
 
-            CustomerInfoVo policyHolderInfo = JSONObject.parseObject(insOrders.getApplyinfo().toJSONString(), CustomerInfoVo.class);
+            CustomerInfoVo policyHolderInfo = JSON.parseObject(insOrders.getApplyinfo().toJSONString(), CustomerInfoVo.class);
             PrivyDTO privyDTO = new PrivyDTO("1000", policyHolderInfo.getName(), policyHolderInfo.getIdentifyNumber());
             privyDTO.setPhoneNo(policyHolderInfo.getMobile());
-            CustomerInfoVo insuredPersonInfo = JSONObject.parseObject(insOrders.getInsureinfo().toJSONString(), CustomerInfoVo.class);
+            CustomerInfoVo insuredPersonInfo = JSON.parseObject(insOrders.getInsureinfo().toJSONString(), CustomerInfoVo.class);
             PrivyDTO privyDTO2 = new PrivyDTO("0100", insuredPersonInfo.getName(), insuredPersonInfo.getIdentifyNumber());
             privyDTO2.setPhoneNo(insuredPersonInfo.getMobile());
             privy.add(privyDTO);

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

@@ -22,7 +22,6 @@ 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.*;
@@ -215,7 +214,7 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
         String s = JSON.toJSONString(coverageRequest);
         log.info("中煤承保回调参数------>{}", s);
 
-        if (coverageRequest.getStatus() == PaymentStatusEnum.P_3.getCode()) {
+        if (coverageRequest.getStatus() == PaymentStatusEnum.P_2.getCode()) {
             // 主投保单号
             String proposalNo = coverageRequest.getProposalNo();
             InsAreaCompany insAreaCompany = insAreaCompanyService.getByInsOrderNo(proposalNo);
@@ -255,7 +254,7 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
     public HttpResult paymentEnquiry(String companyId) {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getByInsOrderNo(companyId);
         if (insAreaCompany.getOrderstatus().equals(InsOrderStatus.S_3.getCode())) {
-            return HttpResult.ok("此订单已承保");
+            return HttpResult.ok(InsOrderStatus.S_3.getDesc());
         }
         OrderStatusRequest orderStatusRequest = new OrderStatusRequest();
         orderStatusRequest.setOrderNo(insAreaCompany.getId());
@@ -263,17 +262,18 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
         OrderStatusResponse orderStatusResponse = zhongmeiRequestApiComponents.orderStatus(orderStatusRequest, OrderStatusResponse.class);
         String status = orderStatusResponse.getStatus();
 
-        if (status.equals(String.valueOf(PaymentStatusEnum.P_3.getCode()))) {
+        // 承保成功修改状态
+        if (status.equals(String.valueOf(PaymentStatusEnum.P_2.getCode()))) {
             insAreaCompany.setJqpolicyno(orderStatusResponse.getSubContractNoJ());
             insAreaCompany.setSypolicyno(orderStatusResponse.getSubContractNoS());
             insAreaCompany.setJypolicyno(orderStatusResponse.getAccidentNo());
             insAreaCompany.setOrderstatus(InsOrderStatus.S_3.getCode());
             insOrdersService.updateByOrderStatus(insAreaCompany.getOrderno(), insAreaCompany.getOrderstatus());
             insAreaCompanyService.updateById(insAreaCompany);
-            return HttpResult.ok("");
+            return HttpResult.ok(PaymentStatusEnum.P_2.getMeaning());
         }
 
-        return HttpResult.error(Enum.valueOf(PaymentStatusEnum.class, "P_" + status));
+        return HttpResult.error(Enum.valueOf(PaymentStatusEnum.class, "P_" + status).getMeaning());
     }
 
     @Override

+ 3 - 0
src/main/java/com/ydtech/utils/CalculateUtils.java

@@ -4,6 +4,9 @@ import java.math.BigDecimal;
 
 public class CalculateUtils {
 
+    private CalculateUtils() {
+        throw new IllegalStateException("Utility class");
+    }
     /**
      * double转BigDecimal 相加
      *

+ 5 - 15
src/main/resources/application-dev.yml

@@ -27,10 +27,10 @@ spring:
     url: jdbc:p6spy:mysql://192.168.182.128:3306/zgdd?serverTimezone=Asia/Shanghai&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
     username: root
     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
+  #    ## 测试库
+  #    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:
@@ -298,7 +298,7 @@ zm:
     url: ${zm.domain}/verifyPayment
   vinSearch:
     url: ${zm.domain}/vinSearch
-# 测试
+  # 测试
   api:
     source: 326
     token: THIRDSCOuloft2020052818346904zmYBSXXHTQ
@@ -309,16 +309,6 @@ zm:
     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: