Kaynağa Gözat

1.修改紫金报价代码

wks 2 yıl önce
ebeveyn
işleme
9f2e0ab414

+ 1 - 1
src/main/java/com/ydtech/modules/order/entity/InsAreaCompanyAccidentalDriving.java

@@ -92,4 +92,4 @@ public class InsAreaCompanyAccidentalDriving implements Serializable {
                 this.setRideRiskCode(jsonObject.getString("productCode"));
             }
     }
-}
+}

+ 52 - 36
src/main/java/com/ydtech/modules/order/service/impl/ZijinOrderApiServiceImpl.java

@@ -52,10 +52,7 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
@@ -160,7 +157,7 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
         // 设置核心报价车型
         quoteRespVo.setCoreModels(vehicleModelInfosDTO.toCoreModelsVo());
         return responseOrder(calculatePremiumResponse, quoteRespVo, ptlAgreementAttribution, calculatePremiumRequest.getOrderId(),
-                calculatePremiumRequest.getOrderNo(),quoteVo.getAccidentalDrivingVo());
+                calculatePremiumRequest.getOrderNo(), quoteVo.getAccidentalDrivingVo());
     }
 
     @Override
@@ -392,11 +389,12 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
 
         return HttpResult.ok("撤单成功");
     }
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/3/28 16:03
-     *  @Description:
+     * @version
+     * @author: hxl
+     * @Date: 2024/3/28 16:03
+     * @Description:
      */
     @Override
     public HttpResult<Object> paymentCallbacks(PaymentCallbacksRequest paymentCallbacksRequest) {
@@ -500,6 +498,31 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
             quoteRespVo.setAccidentInfoStr(priceInfoListDTO.getClaimTimes());
         }
 
+        // 车辆信息
+        for (CalculatePremiumResponse.PriceInfoListDTO priceInfoListDTO : priceInfoList) {
+
+            // 鼎然分
+            String score = Optional.ofNullable(priceInfoListDTO.getUbiPredictedInfo())
+                    .map(CalculatePremiumResponse.PriceInfoListDTO.UbiPredictedInfoDTO::getScore)
+                    .orElse(null);
+            quoteRespVo.setUbiPredictedInfoScore(score);
+
+            switch (priceInfoListDTO.getRiskCode()) {
+                case RiskCodeEnum.TRAFFIC_CODE:
+                    quoteRespVo.setJqScore(priceInfoListDTO.getRevPredScore());
+                    quoteRespVo.setJqLossRation(StringUtils.toDouble(priceInfoListDTO.getLrRecom()));
+                    quoteRespVo.setJqClaims(priceInfoListDTO.getClaimTimes());
+                    break;
+                case RiskCodeEnum.BUSINESS_CODE:
+                    quoteRespVo.setSyScore(priceInfoListDTO.getRevPredScore());
+                    quoteRespVo.setSyLossRation(StringUtils.toDouble(priceInfoListDTO.getLrRecom()));
+                    quoteRespVo.setSyClaims(priceInfoListDTO.getClaimTimes());
+                    break;
+                default:
+                    break;
+            }
+        }
+
         List<QuoteKindRespVo> kindList1 = new ArrayList<>();
         List<RiskInfoVo> riskList = yaQuoteInfoVo.getRiskList();
         //  报价险种放入保费
@@ -576,16 +599,8 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
                 Double.parseDouble(carShipTax.getLateFee()));
         List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
         insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
-        //add by hxl 2024-04-08 添加紫荆能源车的鼎然-车辆风险评分 返回前台
-        List<CalculatePremiumResponse.PriceInfoListDTO> priceInfoList = calculatePremiumResponse.getPriceInfoList();
-        if(priceInfoList!=null && !priceInfoList.isEmpty()){
-            CalculatePremiumResponse.PriceInfoListDTO priceInfoListDTO = priceInfoList.get(0);
-            if(priceInfoListDTO.getUbiPredictedInfo()!=null && priceInfoListDTO.getUbiPredictedInfo().getScore()!=null &&  !"".equals(priceInfoListDTO.getUbiPredictedInfo().getScore())){
-                String score = priceInfoListDTO.getUbiPredictedInfo().getScore();
-                quoteRespVo.setUbiPredictedInfoScore(score);
-                insAreaCompany.setUbiPredictedInfoScore(score);
-            }
-        }
+        insAreaCompany.setUbiPredictedInfoScore(quoteRespVo.getUbiPredictedInfoScore());
+
         List<InsAreaCompanyAccidentalDriving> insAreaCompanyAccidentalDrivings = new ArrayList<>();
         accidentalDrivingVo.forEach(accidentalDriving -> {
             InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving = new InsAreaCompanyAccidentalDriving();
@@ -595,22 +610,23 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
             insAreaCompanyAccidentalDrivings.add(insAreaCompanyAccidentalDriving);
         });
 
-        insAreaCompany.setIsDjq(calculatePremiumResponse.getBasePart().getIsDjq().equals("")?"0":calculatePremiumResponse.getBasePart().getIsDjq());
-        insAreaCompanyService.insertCompanyAndOrders(insAreaCompany,insAreaCompanyAccidentalDrivings);
+        insAreaCompany.setIsDjq(calculatePremiumResponse.getBasePart().getIsDjq().equals("") ? "0" :
+                calculatePremiumResponse.getBasePart().getIsDjq());
+        insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDrivings);
         quoteRespVo.setCompanyId(orderNo);
         //添加调用费用匹配功能
 //        feeRuleSchemeService.dealFeeOrderInfo(quoteInfoVo, quoteRespVo, ptlAgreementAttribution.getId(), insAreaCompany.getId());
         return HttpResult.ok("报价成功", quoteRespVo);
     }
+
     /**
-    * @Description  更新订单状态和支付时间
-    * @Author  xingming
-    * @Date   2024/3/28 17:17
-    * @Param
-    * @Return
-    * @Exception
-    *
-    */
+     * @Description 更新订单状态和支付时间
+     * @Author xingming
+     * @Date 2024/3/28 17:17
+     * @Param
+     * @Return
+     * @Exception
+     */
     @Override
     public void getOrderDetailNew(String companyId) {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
@@ -629,17 +645,17 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
         if (OrderStatusEnum.O_4.getCode().equals(orderStatus)) {
             // 3.1 非车险订单存入数据
             String payTime = resultObj.getPayTime();
+
             //更新支付时间
-            if (StringUtils.isNotEmpty(payTime)) {
-                insAreaCompany.setPayDate(LocalDateTime.parse(payTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-            }
+            //设置支付时间
+            LocalDateTime localDateTime = Optional.ofNullable(payTime)
+                    .map(x -> LocalDateTime.parse(x, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
+                    .orElse(LocalDateTime.now());
+            insAreaCompany.setPayDate(localDateTime);
+
             List<DrivingInsuranceDto> drivingInsuranceDto = queryOrderDetailResponse.getDrivingInsuranceDto();
             insAreaCompany.setCrossInsurance(JSON.parseArray(JSON.toJSONString(drivingInsuranceDto)));
             //更新承保状态
-            //设置支付时间
-            if(insAreaCompany.getPayDate()==null){
-                insAreaCompany.setPayDate(LocalDateTime.now());
-            }
             insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
             insAreaCompanyService.updateCompanyAndOrdersNew(insAreaCompany);
         }