|
|
@@ -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;
|