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

Merge remote-tracking branch 'origin/test'

y пре 2 година
родитељ
комит
11bfdc4228

+ 15 - 14
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java

@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
@@ -1058,7 +1059,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         }
         List<PtlNewCarJudgeRules> ptlNewCarJudgeRulesList =
          ptlNewCarJudgeRulesService.getByCompanyId(ptlAgreementAttribution.getInsCompanyId());
-        if (ptlNewCarJudgeRulesList != null && ptlNewCarJudgeRulesList.size() > 0) {
+        if (ptlNewCarJudgeRulesList != null && !ptlNewCarJudgeRulesList.isEmpty()) {
             PtlNewCarJudgeRules ptlNewCarJudgeRules = ptlNewCarJudgeRulesList.get(0);
             if ("月".equals(ptlNewCarJudgeRules.getUnitTypeCode())) {
                 LocalDate registerDate =
@@ -1162,7 +1163,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
             syNoTaxPremium = insFeeOrder.getSyPremium();
             //如果协议中配置为不含税结算时,计算不含税保费
             if (StringUtils.isNotEmpty(agreement.getWithTax()) && "否".equals(agreement.getWithTax())) {
-                syNoTaxPremium = insFeeOrder.getSyPremium().divide(new BigDecimal(1 + 0.06), BigDecimal.ROUND_HALF_UP, 2);
+                syNoTaxPremium = insFeeOrder.getSyPremium().divide(BigDecimal.valueOf(1 + 0.06), BigDecimal.ROUND_HALF_UP, 2);
             }
             insFeeOrder.setSyNoTaxPremium(syNoTaxPremium);
             //商业险总费用
@@ -1250,7 +1251,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
             List<EsmRetail> esmRetailList = esmRetailService.selectList(" where t.deptid=? and t.status = '1' ",
              new Object[]{sysUser.getDeptId()});
 
-            if (esmRetailList != null && esmRetailList.size() > 0) {
+            if (esmRetailList != null && !esmRetailList.isEmpty()) {
                 EsmRetail esmRetail = esmRetailList.get(0);
                 if (esmRetail != null) {
                     int cycleIndex = 0;
@@ -1284,25 +1285,25 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
 
                     if ("3".equals(esmRetail.getRetailtype())) {//团队配置了三级分销模式
                         if (breakCycle == 99999999 || breakCycle == 3) {
-                            insFeeOrder.setFirstRetailProportion(new BigDecimal(esmRetail.getDisrate1()));
-                            insFeeOrder.setSecondRetailProportion(new BigDecimal(esmRetail.getDisrate2()));
-                            insFeeOrder.setThirdRetailProportion(new BigDecimal(esmRetail.getDisrate3()));
+                            insFeeOrder.setFirstRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate1()));
+                            insFeeOrder.setSecondRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate2()));
+                            insFeeOrder.setThirdRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate3()));
                         } else if (breakCycle == 2) {
-                            insFeeOrder.setSecondRetailProportion(new BigDecimal(esmRetail.getDisrate2()));
-                            insFeeOrder.setThirdRetailProportion(new BigDecimal(esmRetail.getDisrate3()));
+                            insFeeOrder.setSecondRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate2()));
+                            insFeeOrder.setThirdRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate3()));
                         } else if (breakCycle == 1) {
-                            insFeeOrder.setThirdRetailProportion(new BigDecimal(esmRetail.getDisrate3()));
+                            insFeeOrder.setThirdRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate3()));
                         }
                     } else if ("2".equals(esmRetail.getRetailtype())) {//团队配置了二级分销模式
                         if (breakCycle == 99999999 || breakCycle == 3 || breakCycle == 2) {
-                            insFeeOrder.setFirstRetailProportion(new BigDecimal(esmRetail.getDisrate1()));
-                            insFeeOrder.setSecondRetailProportion(new BigDecimal(esmRetail.getDisrate2()));
+                            insFeeOrder.setFirstRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate1()));
+                            insFeeOrder.setSecondRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate2()));
                         } else if (breakCycle == 1) {
-                            insFeeOrder.setSecondRetailProportion(new BigDecimal(esmRetail.getDisrate2()));
+                            insFeeOrder.setSecondRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate2()));
                         }
                     } else if ("1".equals(esmRetail.getRetailtype())) {//团队配置了一级分销模式
                         if (breakCycle == 99999999 || breakCycle == 3 || breakCycle == 2 || breakCycle == 1) {
-                            insFeeOrder.setFirstRetailProportion(new BigDecimal(esmRetail.getDisrate1()));
+                            insFeeOrder.setFirstRetailProportion(BigDecimal.valueOf(esmRetail.getDisrate1()));
                         }
                     }
                     insFeeOrder.setFirstRetailPremiums(getPremium(totalNoTaxPremium, insFeeOrder.getFirstRetailProportion()));
@@ -1356,7 +1357,7 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
     private BigDecimal getPremium(BigDecimal noTaxPremium, BigDecimal costsProportion) {
         BigDecimal premium = new BigDecimal(0);
         if (costsProportion != null && costsProportion.doubleValue() > 0) {
-            premium = noTaxPremium.multiply(costsProportion).divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP);
+            premium = noTaxPremium.multiply(costsProportion).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP);
         }
         return premium;
     }

+ 7 - 0
src/main/java/com/ydtech/modules/order/controller/IdentifyController.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.controller;
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.order.entity.BusinessLicense;
 import com.ydtech.modules.order.service.IdentifyService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -36,4 +37,10 @@ public class IdentifyController {
         return identifyService.drivingPermit(image1, image2);
     }
 
+    @PostMapping("/businessLicense")
+    @ApiOperation(value = "营业执照识别")
+    public HttpResult<BusinessLicense> businessLicense(MultipartFile image1) {
+        return identifyService.businessLicense(image1);
+    }
+
 }

+ 61 - 0
src/main/java/com/ydtech/modules/order/entity/BusinessLicense.java

@@ -0,0 +1,61 @@
+package com.ydtech.modules.order.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @description: 营业执照返回实体
+ * @author: wenks
+ * @date: 2024/2/21 9:13
+ **/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class BusinessLicense {
+
+    /**
+     * 社会信用代码
+     */
+    private String socialCreditCode;
+    /**
+     * 单位名称
+     */
+    private String company;
+
+    /**
+     * 住址
+     */
+    private String address;
+
+    /**
+     * 法定代表人
+     */
+    private String legalRepresentative;
+
+    /**
+     * 有效日期至
+     */
+    private String effectiveDate;
+
+    /**
+     * 成立日期
+     */
+    private String registerDate;
+
+    /**
+     * 类型
+     */
+    private String types;
+
+    /**
+     * 注册资本
+     */
+    private String registeredCapital;
+
+    /**
+     * 经营范围
+     */
+    private String businessScope;
+
+}

+ 17 - 0
src/main/java/com/ydtech/modules/order/entity/api/dajia/constants/COwnerCls.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.order.entity.api.dajia.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum COwnerCls {
+    CLS1(1,"个人"),
+    CLS2(2,"机关"),
+    CLS3(3,"企业");
+
+    private final Integer code;
+
+    private final String desc;
+
+}

+ 12 - 5
src/main/java/com/ydtech/modules/order/entity/api/dajia/request/ODR1008Request.java

@@ -481,7 +481,7 @@ public class ODR1008Request extends DaJiaBaseRequest {
         //车主姓名
         vehicleOwnerInfoDTO.setVehicleOwnerCOwnerNme(quoteInfoVo.getOwnerInfo().getName());
         //车主类型
-        vehicleOwnerInfoDTO.setVehicleOwnerCOwnerCls(1);
+        vehicleOwnerInfoDTO.setVehicleOwnerCOwnerCls(COwnerCls.CLS1.getCode());
         //邮编
         vehicleOwnerInfoDTO.setVehicleOwnerCZipCde("030024");
         //车主出生日期
@@ -726,16 +726,23 @@ public class ODR1008Request extends DaJiaBaseRequest {
         //车型名称
         vehicleInfoDTO.setVehicleModelNme(resultDTO.getVehicleName());
         //排气量
-        if ("0".equals(resultDTO.getVehicleExhaust()) && "0".equals(resultDTO.getCfuelType())) {
-            //如果排量为空,则默认为1.0
-            vehicleInfoDTO.setVehicleNDisplacement("1.0");
+        if ((null == resultDTO.getVehicleExhaust() || "0".equals(resultDTO.getVehicleExhaust())) && (null == resultDTO.getCfuelType() || "0".equals(resultDTO.getCfuelType()))) {
+            //如果排量为空,则获取前台的传值
+            vehicleInfoDTO.setVehicleNDisplacement(quoteInfoVo.getCarInfo().getExhaustScale());
         } else {
             vehicleInfoDTO.setVehicleNDisplacement(resultDTO.getVehicleExhaust());
         }
 
 //        vehicleInfoDTO.setVehicleNDisplacement("1.0");
         //功率
-        vehicleInfoDTO.setVehicleNPower(Double.parseDouble(resultDTO.getPower()));
+        if(resultDTO.getPower() == null){
+            if(quoteInfoVo.getCarInfo().getPowerScale() != null && !"".equals(quoteInfoVo.getCarInfo().getPowerScale()))
+            {
+                vehicleInfoDTO.setVehicleNPower(Double.parseDouble(quoteInfoVo.getCarInfo().getPowerScale()));
+            }
+        }else{
+            vehicleInfoDTO.setVehicleNPower(Double.parseDouble(resultDTO.getPower()));
+        }
         //座位数
         vehicleInfoDTO.setVehicleNSeatNum(quoteInfoVo.getCarInfo().getSeatCount());
         //车辆种类

+ 6 - 1
src/main/java/com/ydtech/modules/order/entity/api/huatai/request/HuaTaiQuotedPriceRequest.java

@@ -291,7 +291,12 @@ public class HuaTaiQuotedPriceRequest extends HuaTaiBaseRequest {
 
                 public PolicyCarDto(CarInfoVo carInfoVo, HuaTaiModelsQueryResponse.CarModelDto.FullCarDataDto fullCarDataDto) {
                     this.approvedPassengersCapacity = Integer.parseInt(carInfoVo.getSeatCount());
-                    this.displacement = fullCarDataDto.getDisplacement();
+                    if(fullCarDataDto.getDisplacement() != 0) {
+                        this.displacement = Double.parseDouble(carInfoVo.getDisplacement());
+                    }else{
+                        this.displacement = Double.parseDouble(carInfoVo.getExhaustScale());
+                    }
+//                    this.displacement = fullCarDataDto.getDisplacement();
                     this.plateNo = carInfoVo.getLicenseNo();
                     this.registerDate = carInfoVo.getRegisterDate() + " " + TimeConstants.START_TIME;
                     this.issueDate = carInfoVo.getIssueDate() + " " + TimeConstants.START_TIME;

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

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.service;
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.order.entity.BusinessLicense;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.Map;
@@ -26,4 +27,10 @@ public interface IdentifyService {
      */
     HttpResult<Map<String, Object>> drivingPermit(MultipartFile image1, MultipartFile image2);
 
+    /**
+     * 营业执照识别
+     * @param image 正面信息
+     * @return
+     */
+    HttpResult<BusinessLicense> businessLicense(MultipartFile image);
 }

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/impl/DaJiaOrderServiceImpl.java

@@ -322,7 +322,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
         ODR1009Response odr1009Response = daJiaRequestApiComponents.newPremiumXnyCalculation(odr1009Request);
         if(odr1009Response.getStatus().equals(Message.M0002.getCode())) {
             //获取重复投保信息
-            String jqAppStatusMessage = odr1009Response.getResult().getJqAppStatusMessage().toString() == null ? "" : odr1009Response.getResult().getJqAppStatusMessage().toString();
+            String jqAppStatusMessage = odr1009Response.getResult().getJqAppStatusMessage() == null ? "" : odr1009Response.getResult().getJqAppStatusMessage().toString();
             String syAppStatusMessage = odr1009Response.getResult().getReInsuredInfo() == null ? "" : odr1009Response.getResult().getReInsuredInfo();
             if(jqAppStatusMessage.contains("重复投保") || syAppStatusMessage.contains("重复投保")){
                 //交强重复投保

+ 3 - 4
src/main/java/com/ydtech/modules/order/service/impl/GuorenOrderApiServiceImpl.java

@@ -947,8 +947,8 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
                         confirmCarMuch = vehicleInfoList.get(0);
                     }
                 }
-                return carPriceQueryMuch(respMuch.getData().getInputvo(), confirmCarMuch,
-                        yaQuoteInfoVo.getCarInfo().getLicenseNo());
+                return carPriceQueryMuch(respMuch.getData().getInputvo(), confirmCarMuch
+                );
             }
         }
         return null;
@@ -958,8 +958,7 @@ public class GuorenOrderApiServiceImpl implements GuorenOrderApiService {
     /**
      * (多条)车价查询
      */
-    public CarPriceResp.DataDTO carPriceQueryMuch(String uuid, CarPriceMuchResp.DataDTO.CarsDTO carsDTO,
-                                                  String licenseNo) {
+    public CarPriceResp.DataDTO carPriceQueryMuch(String uuid, CarPriceMuchResp.DataDTO.CarsDTO carsDTO) {
         //构造请求参数
         CarPriceMuchReq req = new CarPriceMuchReq();
         req.setUuid(uuid);

+ 13 - 0
src/main/java/com/ydtech/modules/order/service/impl/IdentifyServiceImpl.java

@@ -4,9 +4,11 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.ins.model.CardUserInfo;
 import com.ydtech.modules.ins.model.CustomerInfoVO;
+import com.ydtech.modules.order.entity.BusinessLicense;
 import com.ydtech.modules.order.service.IdentifyService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.ImageCompressionUtils;
+import com.ydtech.utils.baidu.BusinessLicenseRecognition;
 import com.ydtech.utils.baidu.Idcard;
 import com.ydtech.utils.baidu.MultiObjectDetect;
 import org.springframework.stereotype.Service;
@@ -60,6 +62,15 @@ public class IdentifyServiceImpl implements IdentifyService {
     }
 
 
+    @Override
+    public HttpResult<BusinessLicense> businessLicense(MultipartFile image) {
+        String s1 = byteToBase64(image);
+        BusinessLicense businessLicense = new BusinessLicense();
+        BusinessLicenseRecognition.gettingData(s1, businessLicense);
+        return HttpResult.ok("success", businessLicense);
+    }
+
+
     private String byteToBase64(MultipartFile file) {
         if (ObjectUtils.isEmpty(file)) {
             return "";
@@ -72,4 +83,6 @@ public class IdentifyServiceImpl implements IdentifyService {
         }
 
     }
+
+
 }

+ 69 - 0
src/main/java/com/ydtech/utils/baidu/BusinessLicenseRecognition.java

@@ -0,0 +1,69 @@
+package com.ydtech.utils.baidu;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.ydtech.modules.order.entity.BusinessLicense;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * @description: 营业执照识别
+ * @author: wenks
+ * @date: 2024/2/21 9:46
+ **/
+
+public class BusinessLicenseRecognition {
+
+    private BusinessLicenseRecognition() {
+        throw new IllegalStateException("Utility class");
+    }
+
+    /**
+     * @param imgParam base64影像
+     * @return
+     */
+    public static JSONObject businessLicense(String imgParam) {
+        // 请求url
+        String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/business_license";
+        try {
+            String accessToken = AuthService.getAuth();
+
+            String param = "image=" + imgParam;
+            String result = HttpUtil.post(url, accessToken, param);
+            JSONObject ja = JSON.parseObject(result);
+            String wordsResult = ja.getString("words_result");
+            return JSON.parseObject(wordsResult);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return new JSONObject();
+    }
+
+
+    public static void gettingData(String images, BusinessLicense businessLicense) {
+        if (StringUtils.isEmpty(images)) {
+            return;
+        }
+
+        try {
+            JSONObject s = businessLicense(images);
+            businessLicense.setSocialCreditCode(getWords(s, "社会信用代码"));
+            businessLicense.setCompany(getWords(s, "单位名称"));
+            businessLicense.setAddress(getWords(s, "地址"));
+            businessLicense.setLegalRepresentative(getWords(s, "法人"));
+            businessLicense.setEffectiveDate(getWords(s, "有效期"));
+            businessLicense.setRegisterDate(getWords(s, "成立日期"));
+            businessLicense.setTypes(getWords(s, "类型"));
+            businessLicense.setRegisteredCapital(getWords(s, "注册资本"));
+            businessLicense.setRegisteredCapital(getWords(s, "注册资本"));
+            businessLicense.setBusinessScope(getWords(s, "经营范围"));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static String getWords(JSONObject jsonObject, String name) {
+        return JSON.parseObject(jsonObject.getString(name)).getString("words");
+    }
+
+}

+ 2 - 2
src/main/resources/mapper/modules/inv/InvReceivableMapper.xml

@@ -229,7 +229,7 @@
         a.max_sy_receivable_ratio,
         a.max_non_car_receivable_ratio,
         a.max_receivable,
-        (a.total_receivable_amount + a.subsidy_amount) as total_receivable_amount,
+        (a.receivable + a.subsidy_amount) as total_receivable_amount,
         a.settlement_amount,
         ( CASE a.clearing_state WHEN 1 THEN '已结算' WHEN 0 THEN '未结算' WHEN 2 THEN '孤儿单' END ) AS clearing_state,
         ( CASE a.insurance_clearing_state WHEN 1 THEN '已结算' WHEN 0 THEN '未结算' END ) AS insurance_clearing_state
@@ -281,7 +281,7 @@
         ivs.max_sy_receivable_ratio,
         ivs.max_non_car_receivable_ratio,
         ivs.max_receivable,
-        ivs.total_receivable_amount,
+        (ivs.receivable + iss.subsidy_amount) as total_receivable_amount,
         iss.settlement_amount,
         CASE