瀏覽代碼

1. 結算需求 2.0

wuhp 2 年之前
父節點
當前提交
ad6c3f188a

+ 14 - 1
src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java

@@ -31,10 +31,18 @@ public class InsPlyIncome implements Serializable {
     @TableField("orderno")
     private String orderno;
 
-    @ApiModelProperty("保单号")
+    @ApiModelProperty("交强保单号")
     @TableField("policyno")
     private String policyno;
 
+    @ApiModelProperty("商业保单号")
+    @TableField("sy_policyno")
+    private String syPolicyno;
+
+    @ApiModelProperty("非车保单号")
+    @TableField("no_policyno")
+    private String noPolicyno;
+
     @ApiModelProperty("结算单号")
     @TableField(exist = false)
     private String settleno;
@@ -136,6 +144,11 @@ public class InsPlyIncome implements Serializable {
     private String documentaryFeesStatus;
 
 
+    @ApiModelProperty("是否是非车")
+    @TableField("is_not_car")
+    private String isNotCar;
+
+
     @ApiModelProperty("总单数")
     @TableField(exist = false)
     private String totalorders;

+ 46 - 16
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -1,6 +1,10 @@
 package com.ydtech.modules.fnc.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ydtech.core.page.HttpResult;
@@ -90,25 +94,17 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
 
     private void saveBalanc(InsFeeOrderNew insFeeOrderNew, InsOrders insOrders, InsAreaCompany insAreaCompany) {
-        StringBuffer stringBuffer = new StringBuffer();
         InsPlyIncome insPlyIncome = new InsPlyIncome();
 
-        if (ObjectUtils.isNotEmpty(insAreaCompany)) {
-            // 使用链式条件判断来减少嵌套
-            if (StringUtils.isNotEmpty(insAreaCompany.getJqpolicyno())) {
-                stringBuffer.append(insAreaCompany.getJqpolicyno());
-                if (StringUtils.isNotEmpty(insAreaCompany.getSypolicyno())) {
-                    stringBuffer.append(",");
-                    stringBuffer.append(insAreaCompany.getSypolicyno());
-                }
-            } else if (StringUtils.isNotEmpty(insAreaCompany.getSypolicyno())) {
-                // 如果jqpolicyno为空但sypolicyno不为空,则只添加sypolicyno
-                stringBuffer.append(insAreaCompany.getSypolicyno());
-            }
-        }
-        String policyno = stringBuffer.toString();  // 保单号
+
         insPlyIncome.setOrderno(insOrders.getOrderno());
-        insPlyIncome.setPolicyno(policyno);
+//      存储保单号
+        try {
+            this.setPolicyno(insPlyIncome,insAreaCompany);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+
         insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
         insPlyIncome.setRiskcode(insOrders.getProductid());
         insPlyIncome.setPayDate(insAreaCompany.getPayDate());
@@ -140,6 +136,40 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         baseMapper.insert(insPlyIncome);
 
     }
+
+    private void setPolicyno(InsPlyIncome insPlyIncome, InsAreaCompany insAreaCompany) throws JsonProcessingException {
+        ObjectMapper objJson = new ObjectMapper();
+
+        String jqpolicyno = insAreaCompany.getJqpolicyno();  // 交强保单号
+        String sypolicyno = insAreaCompany.getSypolicyno();  // 商业保单号
+        JSONArray crossInsurance = insAreaCompany.getCrossInsurance();  // 非车保单号
+
+        if(ObjectUtils.isNotEmpty(jqpolicyno)){
+            insPlyIncome.setPolicyno(jqpolicyno);
+
+        }
+        if(ObjectUtils.isNotEmpty(sypolicyno)){
+            insPlyIncome.setSyPolicyno(sypolicyno);
+        }
+        if(ObjectUtils.isNotEmpty(crossInsurance)){
+         JsonNode   jsonArryNode= objJson.readTree(crossInsurance.toJSONString());
+            if (jsonArryNode.isArray()) {
+                for (JsonNode jsonNode : jsonArryNode) {
+                    JsonNode jsonNode1 = jsonNode.get("policyNumber");//非车保单号
+                    if(ObjectUtils.isNotEmpty(jsonNode1)){
+                        insPlyIncome.setNoPolicyno(jsonNode1.asText());
+                    }else {
+                       String  nopolicy =   jsonNode.get("policy").asText();   //非车保单号
+                        insPlyIncome.setNoPolicyno(nopolicy);
+                    }
+                }
+            }
+
+        }
+
+
+    }
+
     private BigDecimal sumAmount(BigDecimal amount1, BigDecimal amount2, BigDecimal amount3) {
         BigDecimal jqNoTaxPremium = (amount1 != null) ? amount1 : BigDecimal.ZERO;
         BigDecimal syNoTaxPremium = (amount2 != null) ? amount2 : BigDecimal.ZERO;

+ 11 - 1
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -44,7 +44,7 @@ public class InsPlyIncomeVo implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private LocalDate endDate;
 
-    @ApiModelProperty("保单号")
+    @ApiModelProperty("交强保单号")
     private String policyno;
 
     @ApiModelProperty("机构")
@@ -112,4 +112,14 @@ public class InsPlyIncomeVo implements Serializable {
     private BigDecimal  totAmount;
     @ApiModelProperty("结算金额")
     private BigDecimal settlementAmount;
+
+    @ApiModelProperty("商业保单号")
+    private String syPolicyno;
+
+    @ApiModelProperty("非车保单号")
+    private String noPolicyno;
+
+    @ApiModelProperty("是否非车")
+    private String isNotCar;
+
 }

+ 4 - 0
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -29,6 +29,8 @@
         <result column="contract_file_id" property="contractFileId"/>
         <result column="handling_fees_status" property="handlingFeesStatus"/>
         <result column="documentary_fees_status" property="documentaryFeesStatus"/>
+        <result column="no_policyno" property="noPolicyno"/>
+        <result column="sy_policyno" property="syPolicyno"/>
     </resultMap>
 
     <select id="queryNew"  resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
@@ -55,6 +57,8 @@
                 a.contract_id  as  "contractId",
                 a.contract_file_id  as  "contractFileId",
                 a.handling_fees_status  as  "handlingFeesStatus",
+                a.no_policyno  as  "noPolicyno",
+                a.sy_policyno  as  "syPolicyno",
                 a.documentary_fees_status  as  "documentaryFeesStatus",
                 a.create_time  as  "createTime"
                 from  ins_ply_income a