ソースを参照

平安封装参数,处理回调封装

hxl13994548489 2 年 前
コミット
ea069f5e2e

+ 1 - 1
src/main/java/com/ydtech/modules/ins/model/ya/YaQuoteInfoVo.java

@@ -64,7 +64,7 @@ public class YaQuoteInfoVo implements Serializable {
         this.riskList = JSON.parseArray(JSON.toJSONString(insOrders.getRisk()), RiskInfoVo.class);
         this.kindList = JSON.parseArray(JSON.toJSONString(insOrders.getKing()), KindInfoVo.class);
         this.quoteno = insOrders.getQuoteno();
-        this.userid = insOrders.getUserid();
+        //this.userid = insOrders.getUserid();
     }
 
 }

+ 29 - 12
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/PayReturnRequest.java

@@ -3,6 +3,8 @@ package com.ydtech.modules.order.entity.api.pingan.request;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  *  @version
  *  @author: hxl
@@ -25,7 +27,7 @@ public class PayReturnRequest extends PingAnBaseRequest {
     /***
      *O	备注
      */
-    private String remark;
+    private RemarkInfoDto remark;
 
 
     /***
@@ -66,16 +68,31 @@ public class PayReturnRequest extends PingAnBaseRequest {
     public PayReturnRequest() {
     }
 
-    public PayReturnRequest(String businessNo, String bankOrderNo, String remark, String paymentDate, String paymentSum, String payType, String paymentState, String resultMsg, String errorMsg, String signMsg) {
-        this.businessNo = businessNo;
-        this.bankOrderNo = bankOrderNo;
-        this.remark = remark;
-        this.paymentDate = paymentDate;
-        this.paymentSum = paymentSum;
-        this.payType = payType;
-        this.paymentState = paymentState;
-        this.resultMsg = resultMsg;
-        this.errorMsg = errorMsg;
-        this.signMsg = signMsg;
+    /***
+     * 车辆信息
+     */
+    @Data
+    public static class RemarkInfoDto implements Serializable {
+        /***
+         * C	实名认证标志(Y需要实名认证N不需要实名认证。默认为Y需要认证)
+         */
+        private String autonymAuthFlag;
+        /**
+         * M	缴费方式代码
+         * POS  移动POS机
+         * EPO  EPOS机
+         * WXP  微信
+         * ALP  支付宝
+         * SCP  银行卡快捷
+         * EBK  网银
+         * NCP  无卡
+         * PPY  预付费
+         */
+        private String appType;
+        /**
+         * C
+         * (江苏)缴费方式非支付宝、微信时(其他地区传支付宝或微信ID)	银行卡号
+         */
+        private String channelSourceCode;
     }
 }

+ 100 - 34
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/QuoteRequest.java

@@ -13,6 +13,7 @@ import com.ydtech.modules.order.entity.config.PingAnConfigureParameters;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.pingan.InsDrivingIntentionInsuranceSonVo;
 import lombok.Data;
+import org.apache.commons.collections4.CollectionUtils;
 
 import java.io.Serializable;
 import java.util.*;
@@ -765,6 +766,10 @@ public class QuoteRequest extends PingAnBaseRequest {
      * 【自用充电桩设备信息列表,最多3个桩】
      */
     private List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList=new ArrayList<Amount23XNYChargingPostListDTO>();
+
+    public QuoteRequest() {
+    }
+
     //todo
     public QuoteRequest(PingAnConfigureParameters parameters, BaseQuoteInfoVo quoteInfo,String flowid,String accommodationFlag,List<Amount22XNYChargingPostListDTO> amount22XNYChargingPostList, List<Amount23XNYChargingPostListDTO> amount23XNYChargingPostList,Map<String,Object> jymap) {
         this.setUserId(parameters.getUserId());
@@ -780,36 +785,9 @@ public class QuoteRequest extends PingAnBaseRequest {
         this.bizQuote=bizQuoteDto;
         this.setAccommodationFlag(accommodationFlag);
         //处理驾意险信息
-        List<QuoteRequest.UnAutoListInfoDTO>  unAutoListInfoList=new ArrayList<>();
-        List<QuoteRequest.UnAutoListInfoDTO>  xiaoWeiListInfoList=new ArrayList<>();
-        List<QuoteRequest.CombinationInfoDTO>  combinationInfoList=new ArrayList<>();
-
-        if(jymap!=null && jymap.get("0")!=null ){
-            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("0");
-            if(linkedMap!=null && linkedMap.size()>0){
-                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
-                QuoteRequest.UnAutoListInfoDTO unAutoListInfoDTO =new QuoteRequest.UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
-                unAutoListInfoList.add(unAutoListInfoDTO);
-            }
-        }
-        if(jymap!=null && jymap.get("1")!=null ){
-            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("1");
-            if(linkedMap!=null && linkedMap.size()>0){
-                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
-                QuoteRequest.UnAutoListInfoDTO unAutoListInfoDTO =new QuoteRequest.UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
-                unAutoListInfoList.add(unAutoListInfoDTO);
-            }
-        }
-        if(jymap!=null && jymap.get("2")!=null ){
-            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("2");
-            if(linkedMap!=null && linkedMap.size()>0){
-                List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>)linkedMap.get("2");
-                for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
-                    QuoteRequest.CombinationInfoDTO combinationInfo =new QuoteRequest.CombinationInfoDTO(zhVo.getProductCode(),zhVo.getCode(),zhVo.getQuantity(),zhVo.getCombineProductType());
-                    combinationInfoList.add(combinationInfo);
-                }
-            }
-        }
+        List<UnAutoListInfoDTO> unAutoListInfoList = getUnAutoListInfoDTOS(jymap);
+        List<UnAutoListInfoDTO> xiaoWeiListInfoList = getXiaoWeiListInfoList(jymap);
+        List<CombinationInfoDTO> combinationInfoList = getCombinationInfoDTOS(jymap);
         if(unAutoListInfoList!=null && unAutoListInfoList.size()>0){
             this.setApplyUnAuto("true");
         }else{
@@ -843,12 +821,100 @@ public class QuoteRequest extends PingAnBaseRequest {
     /**
      *  @version
      *  @author: hxl
-     *  @Date: 2024/7/19 16:17
-     *  @Description:  处理财意险列表、小微险列表、组合险
+     *  @Date: 2024/8/8 11:21
+     *  @Description: 获取驾意险的险种信息
+     */
+    public List<Map<String,Object>> getJsonList(Map<String,Object> map,Double cyPremium,Double xwPremium,Double zhPremium){
+        List<Map<String,Object>>  list=new ArrayList<Map<String,Object>>();
+        List<QuoteRequest.UnAutoListInfoDTO> unAutoListInfoList = getUnAutoListInfoDTOS(map);
+        List<QuoteRequest.UnAutoListInfoDTO> xiaoWeiListInfoList = getXiaoWeiListInfoList(map);
+        List<QuoteRequest.CombinationInfoDTO> combinationInfoList = getCombinationInfoDTOS(map);
+
+        //赋值驾意险信息
+        Map<String,Object> jyMap=new HashMap<>();
+        Map<String,Object> xwMap=new HashMap<>();
+        Map<String,Object> zhMap=new HashMap<>();
+        if(CollectionUtils.isNotEmpty(unAutoListInfoList)){
+            jyMap.put("sumAmount",cyPremium);
+            jyMap.put("list",unAutoListInfoList);
+        }
+        if(CollectionUtils.isNotEmpty(xiaoWeiListInfoList)){
+            xwMap.put("sumAmount",xwPremium);
+            xwMap.put("list",xiaoWeiListInfoList);
+        }
+        if(CollectionUtils.isNotEmpty(combinationInfoList)){
+            zhMap.put("sumAmount",zhPremium);
+            zhMap.put("list",combinationInfoList);
+        }
+        if(jyMap!=null && jyMap.size()>0){
+            list.add(jyMap);
+        }
+        if(xwMap!=null && xwMap.size()>0){
+            list.add(xwMap);
+        }
+        if(zhMap!=null && zhMap.size()>0){
+            list.add(zhMap);
+        }
+        return list;
+    }
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:06
+     *  @Description:  获取组合险信息
+     */
+    public static List<CombinationInfoDTO> getCombinationInfoDTOS(Map<String, Object> jymap) {
+        List<CombinationInfoDTO>  combinationInfoList=new ArrayList<>();
+        if(jymap !=null && jymap.get("2")!=null ){;
+            List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>) jymap.get("2");
+            if(zhlist!=null && zhlist.size()>0){
+                for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
+                    CombinationInfoDTO combinationInfo =new CombinationInfoDTO(zhVo.getProductCode(),zhVo.getCode(),zhVo.getQuantity(),zhVo.getCombineProductType());
+                    combinationInfoList.add(combinationInfo);
+                }
+            }
+        }
+        return combinationInfoList;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:05
+     *  @Description:  获取小微险信息
      */
-    public QuoteRequest transYJPingAnRequestMsg(Map<String,Object> map, QuoteRequest quoteRequest, String type) {
+    public static List<UnAutoListInfoDTO> getXiaoWeiListInfoList(Map<String, Object> jymap) {
+        List<UnAutoListInfoDTO>  xiaoWeiListInfoList=new ArrayList<>();
+        if(jymap !=null && jymap.get("1")!=null ){
+            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("1");
+            if(linkedMap!=null && linkedMap.size()>0){
+                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
+                UnAutoListInfoDTO unAutoListInfoDTO =new UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
+                xiaoWeiListInfoList.add(unAutoListInfoDTO);
+            }
+        }
+        return xiaoWeiListInfoList;
+    }
 
-        return quoteRequest;
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/8 11:04
+     *  @Description: 获取财意险信息
+     */
+    public static List<UnAutoListInfoDTO> getUnAutoListInfoDTOS(Map<String, Object> jymap) {
+        List<UnAutoListInfoDTO>  unAutoListInfoList=new ArrayList<>();
+        if(jymap !=null && jymap.get("0")!=null ){
+            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) jymap.get("0");
+            if(linkedMap!=null && linkedMap.size()>0){
+                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
+                UnAutoListInfoDTO unAutoListInfoDTO =new UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
+                unAutoListInfoList.add(unAutoListInfoDTO);
+            }
+        }
+        return unAutoListInfoList;
     }
 
     public QuoteRequest transferPingAnRequestMsgNY(List<KindInfoVo> kinds, QuoteRequest quoteRequest, CarConfirmResponse.BizQuoteConfigDTO bizQuoteConfig) {

+ 16 - 78
src/main/java/com/ydtech/modules/order/service/impl/PingAnOrderApiServiceImpl.java

@@ -54,6 +54,7 @@ import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
@@ -289,11 +290,10 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
             throw new SystemException("未选择协议不能报价");
         }
         Map<String, Object> map = quoteVo.getAccidentalDrivingVo();
-        if(map!=null && map.get("2")!=null ){
-            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) map.get("2");
+        if(map!=null && map.get("2")!=null){
+            List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>) map.get("2");
             int  count =0;
-            if(linkedMap!=null && linkedMap.size()>0){
-                List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>)linkedMap.get("2");
+            if(zhlist!=null && zhlist.size()>0){
                 for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
                     if("01".equals(zhVo.getCombineProductType())){
                         count++;
@@ -413,7 +413,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         quoteRespVo.setZhPremium(zhAmount);
         //  报价险种放入保费
         List<QuoteRiskRespVo> riskList1 = QuoteRiskRespVo.toQuoteRiskRespVoList(riskList, jqPremium, syPremium);
-
         quoteRespVo.setRiskList(riskList1);
         quoteRespVo.setJqPremium(jqPremium);
         quoteRespVo.setSyPremium(syPremium);
@@ -427,8 +426,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         //订单号
         quoteRespVo.setOrderno(yaQuoteInfoVo.getOrderNo());
         quoteRespVo.setCoreModels(modelsDto.toCoreModelsVo());
-        String orderId = yaQuoteInfoVo.getOrderNo();
-        return responseOrder(response, quoteRespVo, ptlAgreementAttribution, orderId,userId,pinganApiLog,carConfirmResponse,quoteVo);
+        return responseOrder(response, quoteRespVo, ptlAgreementAttribution, carConfirmResponse,quoteVo);
     }
     /**
      *  @version
@@ -598,81 +596,20 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
     public HttpResult<QuoteRespVo> responseOrder(QuoteResponse response,
                                                  PingAnQuoteRespVo quoteRespVo,
                                                  PtlAgreementAttribution ptlAgreementAttribution,
-                                                 String orderId,
-                                                 String userId,
-                                                 PinganApiLog pinganApiLog,
                                                  CarConfirmResponse carConfirmResponse,
                                                  PingAnQuoteVo<Map<String,Object>> quoteVo
 
     ) {
         // 保存订单信息
         InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
-        //平安业务id
-        String flowid = response.getFlowid();
-        insAreaCompany.setReptxt(JSON.parseObject(JSON.toJSONString(response)));
+        //报价状态
         insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
-        insAreaCompany.setInsOrderNo(flowid);
-
-        Map<String, Object> map = quoteVo.getAccidentalDrivingVo();
-        List<QuoteRequest.UnAutoListInfoDTO>  unAutoListInfoList=new ArrayList<>();
-        List<QuoteRequest.UnAutoListInfoDTO>  xiaoWeiListInfoList=new ArrayList<>();
-        List<QuoteRequest.CombinationInfoDTO>  combinationInfoList=new ArrayList<>();
-        if(map!=null && map.get("0")!=null ){
-            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) map.get("0");
-            if(linkedMap!=null && linkedMap.size()>0){
-                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
-                QuoteRequest.UnAutoListInfoDTO unAutoListInfoDTO =new QuoteRequest.UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
-                unAutoListInfoList.add(unAutoListInfoDTO);
-            }
-        }
-
-        if(map!=null && map.get("1")!=null ){
-            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) map.get("1");
-            if(linkedMap!=null && linkedMap.size()>0){
-                InsDrivingIntentionInsuranceSonVo vo = BeanUtil.mapToBean(linkedMap, InsDrivingIntentionInsuranceSonVo.class, true);
-                QuoteRequest.UnAutoListInfoDTO unAutoListInfoDTO =new QuoteRequest.UnAutoListInfoDTO(vo.getProductCode(),vo.getCode(),vo.getQuantity());
-                unAutoListInfoList.add(unAutoListInfoDTO);
-            }
-        }
-        if(map!=null && map.get("2")!=null ){
-            LinkedHashMap<String,Object> linkedMap = (LinkedHashMap<String,Object>) map.get("2");
-            if(linkedMap!=null && linkedMap.size()>0){
-                List<InsDrivingIntentionInsuranceSonVo> zhlist = (List<InsDrivingIntentionInsuranceSonVo>)linkedMap.get("2");
-                for(InsDrivingIntentionInsuranceSonVo zhVo : zhlist ){
-                    QuoteRequest.CombinationInfoDTO combinationInfo =new QuoteRequest.CombinationInfoDTO(zhVo.getProductCode(),zhVo.getCode(),zhVo.getQuantity(),zhVo.getCombineProductType());
-                    combinationInfoList.add(combinationInfo);
-                }
-            }
-        }
-        //赋值驾意险信息
-        Map<String,Object> jyMap=new HashMap<>();
-        Map<String,Object> xwMap=new HashMap<>();
-        Map<String,Object> zhMap=new HashMap<>();
-        if(unAutoListInfoList!=null && unAutoListInfoList.size()>0){
-            jyMap.put("sumAmount",quoteRespVo.getCyPremium());
-            jyMap.put("list",unAutoListInfoList);
-        }
-        if(xiaoWeiListInfoList!=null && xiaoWeiListInfoList.size()>0){
-            xwMap.put("sumAmount",quoteRespVo.getXwPremium());
-            xwMap.put("list",xiaoWeiListInfoList);
-        }
-        if(combinationInfoList!=null && combinationInfoList.size()>0){
-            zhMap.put("sumAmount",quoteRespVo.getZhPremium());
-            zhMap.put("list",combinationInfoList);
-        }
-
-        List<Map<String,Object>>  list=new ArrayList<Map<String,Object>>();
-        if(jyMap!=null && jyMap.size()>0){
-            list.add(jyMap);
-        }
-        if(xwMap!=null && xwMap.size()>0){
-            list.add(xwMap);
-        }
-        if(zhMap!=null && zhMap.size()>0){
-            list.add(zhMap);
-        }
-        if(list!=null && list.size()>0){
-            insAreaCompany.setAccidentInfo(JSON.parseArray(JSON.toJSONString(list)));
+        //流程id
+        insAreaCompany.setFlowid(response.getFlowid());
+        //获取驾意险列表
+        List<Map<String, Object>> yjList = new QuoteRequest().getJsonList(quoteVo.getAccidentalDrivingVo(), quoteRespVo.getCyPremium(), quoteRespVo.getXwPremium(), quoteRespVo.getZhPremium());
+        if(CollectionUtils.isNotEmpty(yjList)){
+            insAreaCompany.setAccidentInfo(JSON.parseArray(JSON.toJSONString(yjList)));
         }
         // 车船税
         QuoteResponse.ForceQuoteResultDTO.TaxDTO tax = response.getForceQuoteResult().getTax();
@@ -680,7 +617,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 Double.parseDouble(tax.getDelayPayMoney()));
         List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
         insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
-        insAreaCompany.setFlowid(flowid);
         // centile  商业险评分      商业险出现次数
         //商业出险次数
         if(response.getBizQuoteResult()!=null && response.getBizQuoteResult().getClaimNumber()!=null){
@@ -693,7 +629,6 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         insAreaCompany.setSyRenewal("2".equals(carConfirmResponse.getBizRenewalType())?"1":carConfirmResponse.getBizRenewalType());
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
         quoteRespVo.setCompanyId(insAreaCompany.getId());
-
         return HttpResult.ok("报价成功", quoteRespVo);
     }
 
@@ -1882,16 +1817,19 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 if (documentStatusListResponse != null && "0".equals(documentStatusListResponse.getResultCode())) {
                     ArrayList<DocumentStatusListResponse.DocumentDTO> documentList = documentStatusListResponse.getDocumentList();
                     String status = "";
+                    String policyNo ="";
                     if (documentList != null && documentList.size() > 0) {
                         Boolean flag = false;
                         for (DocumentStatusListResponse.DocumentDTO dto : documentList) {
                             status = dto.getStatus();
+                            policyNo = dto.getPolicyNo();
                             if (OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(dto.getStatus())) {
                                 flag = false;
                             }
                         }
+                        insAreaCompany.setJqpolicyno(policyNo);
                         //已承保更新承保状态
-                        if (OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status)) {
+                        if (OrderStatusCodeEnum.ORDER_STATUS_CODE_B5.getCode().equals(status) && ("0".equals(insAreaCompany.getOrderstatus()) || "1".equals(insAreaCompany.getOrderstatus()) || "2".equals(insAreaCompany.getOrderstatus())) ) {
                             insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                             insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
                             return HttpResult.ok("支付成功");