|
@@ -1,5 +1,6 @@
|
|
|
package com.ydtech.modules.fnc.service.impl;
|
|
package com.ydtech.modules.fnc.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
@@ -8,8 +9,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
-import com.ydtech.modules.admin.model.po.SysAmountAuditingEntity;
|
|
|
|
|
-import com.ydtech.modules.admin.model.po.SysUserAccountHistory;
|
|
|
|
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
|
|
+import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
|
|
+import com.ydtech.modules.fnc.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.fnc.entity.InsPlyIncome;
|
|
import com.ydtech.modules.fnc.entity.InsPlyIncome;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
|
import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
|
|
import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
|
|
@@ -19,25 +21,36 @@ import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
|
|
|
import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
|
|
import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
|
|
|
import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
|
|
import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
|
|
|
import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
|
|
import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
|
|
|
|
|
+import com.ydtech.modules.inv.model.InvChannelsExternalBillsDetails;
|
|
|
|
|
+import com.ydtech.modules.inv.model.dto.InsPlyIncomeExcelDto;
|
|
|
|
|
+import com.ydtech.modules.inv.model.dto.InvChannelExcelDto;
|
|
|
import com.ydtech.modules.order.entity.BasePageResult;
|
|
import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
-import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlAgreementQueryVo;
|
|
|
|
|
+import com.ydtech.modules.protocol.service.PtlAgreementService;
|
|
|
import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
|
|
import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
|
|
|
import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
|
|
import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
|
|
|
|
|
+import com.ydtech.utils.SnowFlakeUtil;
|
|
|
|
|
+import com.ydtech.utils.excel.ExcelEasypoiUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
+import redis.clients.jedis.params.Params;
|
|
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
@@ -52,6 +65,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ @Lazy
|
|
|
private InsOrdersService insOrdersService;
|
|
private InsOrdersService insOrdersService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsAreaCompanyService insAreaCompanyService;
|
|
private InsAreaCompanyService insAreaCompanyService;
|
|
@@ -62,6 +76,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
private SettlementDocumentaryFeesService settlementDocumentaryFeesService;
|
|
private SettlementDocumentaryFeesService settlementDocumentaryFeesService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SettlementDocumentaryLogService settlementDocumentaryLogService;
|
|
private SettlementDocumentaryLogService settlementDocumentaryLogService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private PtlAgreementService ptlAgreementService;
|
|
|
|
|
|
|
|
|
|
|
|
|
public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo){
|
|
public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo){
|
|
@@ -84,100 +100,262 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void saveBalance(String companyId, String orderno) {
|
|
|
|
|
- InsOrders insOrders = insOrdersService.getById(orderno);
|
|
|
|
|
- InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
|
|
|
|
|
- InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(companyId);
|
|
|
|
|
- this.saveBalanc(insFeeOrderNew, insOrders, insAreaCompany);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public void saveBalanceNew(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
|
|
+ if (ObjectUtils.isEmpty(order) || ObjectUtils.isEmpty(insFeeOrderNew) || ObjectUtils.isEmpty(insAreaCompany)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ String agreeType = this.judgeAgreeType(insAreaCompany.getAgreementId());
|
|
|
|
|
+ if (StringUtils.isNotEmpty(agreeType)) {
|
|
|
|
|
+// 判断协议类型 平台 保险
|
|
|
|
|
+ if ("1".equals(agreeType)) {
|
|
|
|
|
+ // 平台逻辑处理 判断是否是 和手续费 非车
|
|
|
|
|
+ if (insFeeOrderNew.getJqSuperviseCostsPremiums() != null || insFeeOrderNew.getSySuperviseCostsPremiums() != null) { //平台车险
|
|
|
|
|
+// 生成手续费 跟单费和手续费是一条单据
|
|
|
|
|
+ this.savePinTai(order,insFeeOrderNew,insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(insFeeOrderNew.getNoSuperviseCostsPremiums() != null || insFeeOrderNew.getNoOtherCostsPremiums() != null){ // 平台非车
|
|
|
|
|
+ this.saveNoPinTai(order,insFeeOrderNew,insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else { // 保险 逻辑: 手续费生成一条 跟单费生成一条 非车手续费一条 非车跟单费一条
|
|
|
|
|
+ if (insFeeOrderNew.getJqSuperviseCostsPremiums() != null || insFeeOrderNew.getSySuperviseCostsPremiums() != null) { //手续费
|
|
|
|
|
+ this.saveInsuranceProcedures(order,insFeeOrderNew,insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(insFeeOrderNew.getJqOtherCostsPremiums()!=null ){ //跟单费
|
|
|
|
|
+ this.saveOtherAmount(order,insFeeOrderNew,insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(insFeeOrderNew.getNoSuperviseCostsPremiums() !=null){ // 非车手续费
|
|
|
|
|
+ this.saveNoSupervise(order,insFeeOrderNew,insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(insFeeOrderNew.getNoOtherCostsPremiums() !=null){ // 非车跟单费
|
|
|
|
|
+ this.saveNoOtherAmount(order,insFeeOrderNew,insAreaCompany);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- private void saveBalanc(InsFeeOrderNew insFeeOrderNew, InsOrders insOrders, InsAreaCompany insAreaCompany) {
|
|
|
|
|
|
|
+ private void saveNoOtherAmount(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
|
|
|
|
|
+ String noPolicyno = this.setNoPolicyno(insAreaCompany);
|
|
|
|
|
+ if(StringUtils.isNotEmpty(noPolicyno)){
|
|
|
|
|
+ insPlyIncome.setNoPolicyno(noPolicyno); // 非车保单号
|
|
|
|
|
+ }
|
|
|
|
|
+ insPlyIncome.setOtherFeevalue(insFeeOrderNew.getNoOtherCostsPremiums()); //非车跟单费
|
|
|
|
|
+ insPlyIncome.setOtherFeerate(insFeeOrderNew.getNoOtherCostsProportion()); //非车跟单费用比例
|
|
|
|
|
+ insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
|
|
|
|
|
+ insPlyIncome.setRiskcode(order.getProductid());
|
|
|
|
|
+ insPlyIncome.setPayDate(insAreaCompany.getPayDate());
|
|
|
|
|
+ insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
|
|
|
|
|
+ insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
|
|
+ insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
|
|
|
|
|
+ insPlyIncome.setLicenseno(order.getLicenseno());
|
|
|
|
|
+ insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
|
|
|
|
|
+ insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setHandlingFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setIsNotCar("1");
|
|
|
|
|
+ insPlyIncome.setIsNotDocumentary("1");
|
|
|
|
|
+ insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoOtherCostsPremiums());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ private void saveNoSupervise(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
|
|
insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
|
|
|
-// 存储保单号
|
|
|
|
|
- try {
|
|
|
|
|
- this.setPolicyno(insPlyIncome,insAreaCompany);
|
|
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
|
|
|
+ insPlyIncome.setCommissionFeevalue(insFeeOrderNew.getNoSuperviseCostsPremiums());// 非车手续费
|
|
|
|
|
+ insPlyIncome.setCommissionFeerate(insFeeOrderNew.getNoSuperviseCostsProportion());// 非车手续费比例
|
|
|
|
|
+ String noPolicyno = this.setNoPolicyno(insAreaCompany);
|
|
|
|
|
+ if(StringUtils.isNotEmpty(noPolicyno)){
|
|
|
|
|
+ insPlyIncome.setNoPolicyno(noPolicyno); // 非车保单号
|
|
|
}
|
|
}
|
|
|
|
|
+ insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
|
|
|
|
|
+ insPlyIncome.setRiskcode(order.getProductid());
|
|
|
|
|
+ insPlyIncome.setPayDate(insAreaCompany.getPayDate());
|
|
|
|
|
+ insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
|
|
|
|
|
+ insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
|
|
+ insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
|
|
|
|
|
+ insPlyIncome.setLicenseno(order.getLicenseno());
|
|
|
|
|
+ insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
|
|
|
|
|
+ insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setHandlingFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setIsNotCar("1");
|
|
|
|
|
+ insPlyIncome.setIsNotDocumentary("0");
|
|
|
|
|
+ insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoSuperviseCostsPremiums());
|
|
|
|
|
+ baseMapper.insert(insPlyIncome);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private void saveOtherAmount(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
|
|
|
|
|
+ insPlyIncome.setPolicyno(insAreaCompany.getJqpolicyno()); // 商业保单号
|
|
|
|
|
+ insPlyIncome.setSyPolicyno(insAreaCompany.getSypolicyno()); // 商业保单号
|
|
|
|
|
+ BigDecimal otherAmount = this.calculateTotal(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums());
|
|
|
|
|
+ insPlyIncome.setOtherFeevalue(otherAmount);//跟单费用
|
|
|
|
|
+ BigDecimal otherProportion = this.calculateTotal(insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getJqOtherCostsProportion());
|
|
|
|
|
+ insPlyIncome.setOtherFeerate(otherProportion); // 跟单非比例
|
|
|
insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
|
|
insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
|
|
|
- insPlyIncome.setRiskcode(insOrders.getProductid());
|
|
|
|
|
|
|
+ insPlyIncome.setRiskcode(order.getProductid());
|
|
|
insPlyIncome.setPayDate(insAreaCompany.getPayDate());
|
|
insPlyIncome.setPayDate(insAreaCompany.getPayDate());
|
|
|
insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
|
|
insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
|
|
|
insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
|
|
insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
|
|
insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
|
|
|
- insPlyIncome.setLicenseno(insOrders.getLicenseno());
|
|
|
|
|
|
|
+ insPlyIncome.setLicenseno(order.getLicenseno());
|
|
|
insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
|
|
insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
|
|
|
|
|
+ insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setHandlingFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setIsNotCar("0");
|
|
|
|
|
+ insPlyIncome.setIsNotDocumentary("1");
|
|
|
|
|
+ insPlyIncome.setAllFeeValue(otherAmount);
|
|
|
|
|
+ baseMapper.insert(insPlyIncome);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- BigDecimal bigDecimal = this.sumAmount(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), insFeeOrderNew.getNoNoTaxPremium());
|
|
|
|
|
- // 不含保费
|
|
|
|
|
- insPlyIncome.setNoTaxPremium(bigDecimal);
|
|
|
|
|
-// 手续费比例
|
|
|
|
|
- BigDecimal CostsProportion = this.sumAmount(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion(), insFeeOrderNew.getNoSuperviseCostsProportion());
|
|
|
|
|
- insPlyIncome.setCommissionFeerate(CostsProportion);
|
|
|
|
|
-// 其他费用比例
|
|
|
|
|
- BigDecimal OtherCostsProportion = this.sumAmount(insFeeOrderNew.getJqOtherCostsProportion(), insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getNoOtherCostsProportion());
|
|
|
|
|
- insPlyIncome.setOtherFeerate(OtherCostsProportion);
|
|
|
|
|
-// 手续费金额
|
|
|
|
|
- BigDecimal SuperviseCostsPremiums = this.sumAmount(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums(), insFeeOrderNew.getNoSuperviseCostsPremiums());
|
|
|
|
|
- insPlyIncome.setCommissionFeevalue(SuperviseCostsPremiums);
|
|
|
|
|
-// 其他费用金额
|
|
|
|
|
- BigDecimal OtherCostsPremiums = this.sumAmount(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums(), insFeeOrderNew.getNoOtherCostsPremiums());
|
|
|
|
|
- insPlyIncome.setOtherFeevalue(OtherCostsPremiums);
|
|
|
|
|
- insPlyIncome.setAllFeeValue(SuperviseCostsPremiums.add(OtherCostsPremiums));
|
|
|
|
|
|
|
+ private void saveInsuranceProcedures(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
|
|
+// 保险手续费
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
|
|
|
|
|
+ insPlyIncome.setPolicyno(insAreaCompany.getJqpolicyno()); // 交强保单号
|
|
|
|
|
+ BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums());
|
|
|
|
|
+ insPlyIncome.setCommissionFeevalue(handlingAmount);//手续费
|
|
|
|
|
+ BigDecimal handlingProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion());
|
|
|
|
|
+ insPlyIncome.setCommissionFeerate(handlingProportion);// 手续费比例
|
|
|
|
|
+
|
|
|
|
|
+ insPlyIncome.setSyPolicyno(insAreaCompany.getSypolicyno()); //商业保单号
|
|
|
|
|
+ insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
|
|
|
|
|
+ insPlyIncome.setRiskcode(order.getProductid());
|
|
|
|
|
+ insPlyIncome.setPayDate(insAreaCompany.getPayDate());
|
|
|
|
|
+ insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
|
|
|
|
|
+ insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
|
|
+ insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
|
|
|
|
|
+ insPlyIncome.setLicenseno(order.getLicenseno());
|
|
|
|
|
+ insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
|
|
|
insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
|
insPlyIncome.setDocumentaryFeesStatus("0");
|
|
insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
insPlyIncome.setHandlingFeesStatus("0");
|
|
insPlyIncome.setHandlingFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setIsNotCar("0");
|
|
|
|
|
+ insPlyIncome.setIsNotDocumentary("0");
|
|
|
|
|
+ insPlyIncome.setAllFeeValue(handlingAmount);
|
|
|
baseMapper.insert(insPlyIncome);
|
|
baseMapper.insert(insPlyIncome);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private void saveNoPinTai(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
|
|
|
|
|
+ String noPolicyno = this.setNoPolicyno(insAreaCompany);
|
|
|
|
|
+ if(StringUtils.isNotEmpty(noPolicyno)){
|
|
|
|
|
+ insPlyIncome.setNoPolicyno(noPolicyno); // 非车保单号
|
|
|
|
|
+ }
|
|
|
|
|
+ insPlyIncome.setCommissionFeevalue(insFeeOrderNew.getNoSuperviseCostsPremiums());// 非车手续费
|
|
|
|
|
+ insPlyIncome.setCommissionFeerate(insFeeOrderNew.getNoSuperviseCostsProportion()); // 非车手续费比例
|
|
|
|
|
+ insPlyIncome.setOtherFeevalue(insFeeOrderNew.getNoOtherCostsPremiums()); //非车跟单费
|
|
|
|
|
+ insPlyIncome.setOtherFeerate(insFeeOrderNew.getNoOtherCostsProportion()); //非车跟单费用比例
|
|
|
|
|
+ insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
|
|
|
|
|
+ insPlyIncome.setRiskcode(order.getProductid());
|
|
|
|
|
+ insPlyIncome.setPayDate(insAreaCompany.getPayDate());
|
|
|
|
|
+ insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
|
|
|
|
|
+ insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
|
|
+ insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
|
|
|
|
|
+ insPlyIncome.setLicenseno(order.getLicenseno());
|
|
|
|
|
+ insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
|
|
|
|
|
+ insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setHandlingFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setIsNotCar("1");
|
|
|
|
|
+ insPlyIncome.setIsNotDocumentary("0");
|
|
|
|
|
+ insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoSuperviseCostsPremiums().add(insFeeOrderNew.getNoOtherCostsPremiums()));
|
|
|
|
|
+ baseMapper.insert(insPlyIncome);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void setPolicyno(InsPlyIncome insPlyIncome, InsAreaCompany insAreaCompany) throws JsonProcessingException {
|
|
|
|
|
- ObjectMapper objJson = new ObjectMapper();
|
|
|
|
|
|
|
+ private String setNoPolicyno(com.ydtech.modules.fnc.entity.InsAreaCompany insAreaCompany) {
|
|
|
|
|
+ String crossInsurance = insAreaCompany.getCrossInsurance();
|
|
|
|
|
|
|
|
- String jqpolicyno = insAreaCompany.getJqpolicyno(); // 交强保单号
|
|
|
|
|
- String sypolicyno = insAreaCompany.getSypolicyno(); // 商业保单号
|
|
|
|
|
- JSONArray crossInsurance = insAreaCompany.getCrossInsurance(); // 非车保单号
|
|
|
|
|
|
|
+ if (StringUtils.isEmpty(crossInsurance)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if(ObjectUtils.isNotEmpty(jqpolicyno)){
|
|
|
|
|
- insPlyIncome.setPolicyno(jqpolicyno);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ ObjectMapper objJson = new ObjectMapper();
|
|
|
|
|
+ JsonNode jsonArryNode = objJson.readTree(crossInsurance);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- 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);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (jsonArryNode.isArray() && jsonArryNode.size() > 0) {
|
|
|
|
|
+ JsonNode firstNode = jsonArryNode.get(0);
|
|
|
|
|
+ JsonNode policyNumberNode = firstNode.get("policyNumber");
|
|
|
|
|
+
|
|
|
|
|
+ if (policyNumberNode != null) {
|
|
|
|
|
+ return policyNumberNode.asText();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return firstNode.get("policy").asText();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ e.printStackTrace(); // 可以打印异常信息
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ private void savePinTai(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ insPlyIncome.setOrderno(insFeeOrderNew.getId()); // 子订单号
|
|
|
|
|
+ BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums());
|
|
|
|
|
+ insPlyIncome.setCommissionFeevalue(handlingAmount);//手续费
|
|
|
|
|
+ BigDecimal handlingProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion());
|
|
|
|
|
+ insPlyIncome.setCommissionFeerate(handlingProportion);// 手续费比例
|
|
|
|
|
+ BigDecimal otherAmount = this.calculateTotal(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums());
|
|
|
|
|
+ insPlyIncome.setOtherFeevalue(otherAmount);//跟单费用
|
|
|
|
|
+ BigDecimal otherProportion = this.calculateTotal(insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getJqOtherCostsProportion());
|
|
|
|
|
+ insPlyIncome.setOtherFeerate(otherProportion); // 跟单非比例
|
|
|
|
|
+ //保单号
|
|
|
|
|
+ insPlyIncome.setPolicyno(insAreaCompany.getJqpolicyno()); // 交强保单号
|
|
|
|
|
+ insPlyIncome.setSyPolicyno(insAreaCompany.getSypolicyno()); //商业保单号
|
|
|
|
|
+ insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
|
|
|
|
|
+ insPlyIncome.setRiskcode(order.getProductid());
|
|
|
|
|
+ insPlyIncome.setPayDate(insAreaCompany.getPayDate());
|
|
|
|
|
+ insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
|
|
|
|
|
+ insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
|
|
+ insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
|
|
|
|
|
+ insPlyIncome.setLicenseno(order.getLicenseno());
|
|
|
|
|
+ insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
|
|
|
|
|
+ insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setHandlingFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setIsNotCar("0");
|
|
|
|
|
+ insPlyIncome.setIsNotDocumentary("0");
|
|
|
|
|
+ insPlyIncome.setAllFeeValue(otherAmount.add(handlingAmount));
|
|
|
|
|
+ baseMapper.insert(insPlyIncome);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private BigDecimal sumAmount(BigDecimal amount1, BigDecimal amount2, BigDecimal amount3) {
|
|
|
|
|
- BigDecimal jqNoTaxPremium = (amount1 != null) ? amount1 : BigDecimal.ZERO;
|
|
|
|
|
- BigDecimal syNoTaxPremium = (amount2 != null) ? amount2 : BigDecimal.ZERO;
|
|
|
|
|
- BigDecimal noNoTaxPremium = (amount3 != null) ? amount3 : BigDecimal.ZERO;
|
|
|
|
|
|
|
+ private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2) {
|
|
|
|
|
+ BigDecimal total = BigDecimal.ZERO;
|
|
|
|
|
+
|
|
|
|
|
+ if (value1 != null) {
|
|
|
|
|
+ total = total.add(value1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return jqNoTaxPremium.add(syNoTaxPremium).add(noNoTaxPremium);
|
|
|
|
|
|
|
+ if (value2 != null) {
|
|
|
|
|
+ total = total.add(value2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return total;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private String judgeAgreeType(Long agreementId) {
|
|
|
|
|
+ if (agreementId == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ HttpResult<PtlAgreementQueryVo> byAgreementId = ptlAgreementService.getByAgreementId(agreementId.toString());
|
|
|
|
|
+ if (byAgreementId != null && ObjectUtils.isNotEmpty(byAgreementId.getData())) {
|
|
|
|
|
+ PtlAgreement agreement = byAgreementId.getData().getAgreement();
|
|
|
|
|
+ String agreementType = agreement.getAgreementType();
|
|
|
|
|
+ if (StringUtils.isNotEmpty(agreementType)) {
|
|
|
|
|
+ return agreementType;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public HttpResult<BasePageResult<InsPlyIncome>> queryNew(InsPlyIncomeVo insPlyIncomeVo){
|
|
public HttpResult<BasePageResult<InsPlyIncome>> queryNew(InsPlyIncomeVo insPlyIncomeVo){
|
|
|
try{
|
|
try{
|
|
@@ -199,6 +377,16 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
if(StringUtils.isNotEmpty(insPlyIncomeVo.getPolicyno())){
|
|
if(StringUtils.isNotEmpty(insPlyIncomeVo.getPolicyno())){
|
|
|
params.put("policyno",insPlyIncomeVo.getPolicyno());
|
|
params.put("policyno",insPlyIncomeVo.getPolicyno());
|
|
|
}
|
|
}
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotDocumentary())){
|
|
|
|
|
+ params.put("isOther",insPlyIncomeVo.getIsNotDocumentary());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
|
|
|
|
|
+ params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getAgreementType())){
|
|
|
|
|
+ params.put("agreementType",insPlyIncomeVo.getAgreementType());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
List<InsPlyIncome> list= this.baseMapper.queryNew(params);
|
|
List<InsPlyIncome> list= this.baseMapper.queryNew(params);
|
|
|
pageHelper=new PageInfo(list);
|
|
pageHelper=new PageInfo(list);
|
|
@@ -210,6 +398,176 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<BasePageResult<InsPlyIncome>> nonSettlementQuery(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
+ try{
|
|
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
|
|
+ PageInfo<List<InsPlyIncome>> pageHelper = null;
|
|
|
|
|
+ PageHelper.startPage(insPlyIncomeVo.getPageNum(),insPlyIncomeVo.getPageSize());
|
|
|
|
|
+ params.put("pageNum",insPlyIncomeVo.getPageNum());
|
|
|
|
|
+ params.put("pageSize",insPlyIncomeVo.getPageSize());
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
|
|
|
|
|
+ params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotDocumentary())){
|
|
|
|
|
+ params.put("isOther",insPlyIncomeVo.getIsNotDocumentary());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
|
|
+ params.put("year",insPlyIncomeVo.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
|
|
+ params.put("year",insPlyIncomeVo.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getDocumentaryFeesStatus())){
|
|
|
|
|
+ params.put("documentaryFeesStatus",insPlyIncomeVo.getDocumentaryFeesStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<InsPlyIncome> list= this.baseMapper.NonSettlementQuery(params);
|
|
|
|
|
+ pageHelper=new PageInfo(list);
|
|
|
|
|
+ BasePageResult<InsPlyIncome> pageResult=new BasePageResult<InsPlyIncome>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
|
|
|
|
|
+ return HttpResult.ok(pageResult);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return HttpResult.error("查询异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<List<InsPlyIncome>> nonSettldetail(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String ids = insPlyIncomeVo.getIds();
|
|
|
|
|
+ ArrayList<InsPlyIncome> resultList = new ArrayList<>();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(ids)) {
|
|
|
|
|
+ String[] split = ids.split(",");
|
|
|
|
|
+ for (int i =0; i <split.length ; i++) {
|
|
|
|
|
+ String id = split[i];
|
|
|
|
|
+ resultList.add(baseMapper.selectById(id));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok(resultList);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return HttpResult.error("查询异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void importData(MultipartFile file, InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
+ List<InsPlyIncome> list = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<InsPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(file, InsPlyIncomeExcelDto.class, 0, 1, 1);
|
|
|
|
|
+ for (InsPlyIncomeExcelDto excelItem : dtoList) {
|
|
|
|
|
+ String licenseno = excelItem.getLicenseno();//车牌号
|
|
|
|
|
+ if(ObjectUtils.isNotEmpty(licenseno)){
|
|
|
|
|
+ InsPlyIncome insPlyIncome=baseMapper.findByLicenseno(licenseno);
|
|
|
|
|
+ if(ObjectUtils.isNotEmpty(insPlyIncome)){
|
|
|
|
|
+ insPlyIncome.setContractFileId(insPlyIncomeVo.getContractFileId());
|
|
|
|
|
+ insPlyIncome.setContractId(insPlyIncomeVo.getContractId());
|
|
|
|
|
+ insPlyIncome.setVoucherNumber(insPlyIncomeVo.getVoucherNumber());
|
|
|
|
|
+ baseMapper.updateById(insPlyIncome);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ throw new SystemException("导入失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public void updateByEntity(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
|
|
|
|
|
+ baseMapper.updateById(insPlyIncome);
|
|
|
|
|
+
|
|
|
|
|
+ insPlyIncomeVo.setCrudStatus("2");
|
|
|
|
|
+ this.saveLog(insPlyIncomeVo);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void saveLog(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
+ // 添加记录
|
|
|
|
|
+ SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
|
|
|
|
|
+ settlementDocumentaryLogEntity.setCrudStatus(insPlyIncomeVo.getCrudStatus());
|
|
|
|
|
+ settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue());
|
|
|
|
|
+ settlementDocumentaryLogEntity.setSettlementDocumentaryId(insPlyIncomeVo.getId());
|
|
|
|
|
+ settlementDocumentaryLogEntity.setAmountType("2");
|
|
|
|
|
+ settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public HttpResult<InsPlyIncome> insertByEntity(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
+ Long id = new SnowFlakeUtil().nextId();
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ insPlyIncomeVo.setOrderno(id.toString());
|
|
|
|
|
+ BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
|
|
|
|
|
+ insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setHandlingFeesStatus("0");
|
|
|
|
|
+ insPlyIncome.setIsNotCar("0");
|
|
|
|
|
+ insPlyIncome.setIsNotDocumentary("1");
|
|
|
|
|
+ baseMapper.insert(insPlyIncome);
|
|
|
|
|
+ insPlyIncomeVo.setId(insPlyIncome.getId());
|
|
|
|
|
+ insPlyIncomeVo.setCrudStatus("1");
|
|
|
|
|
+ this.saveLog(insPlyIncomeVo); //添加日志
|
|
|
|
|
+
|
|
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
|
|
|
|
|
+ params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
|
|
|
|
|
+ }
|
|
|
|
|
+ params.put("isOther","1");
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
|
|
+ params.put("year",insPlyIncomeVo.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
|
|
|
|
|
+ params.put("companyId",insPlyIncomeVo.getCompanyId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<InsPlyIncome> list= this.baseMapper.NonSettlementQuery(params);
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(list)){
|
|
|
|
|
+ for (InsPlyIncome item :list){
|
|
|
|
|
+ return HttpResult.ok(item.getIds());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public HttpResult<InsPlyIncome> deleteById(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
|
|
+
|
|
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
|
|
|
|
|
+ params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
|
|
|
|
|
+ }
|
|
|
|
|
+ params.put("isOther","1");
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
|
|
+ params.put("year",insPlyIncomeVo.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
|
|
|
|
|
+ params.put("companyId",insPlyIncomeVo.getCompanyId());
|
|
|
|
|
+ }
|
|
|
|
|
+ baseMapper.deleteById(insPlyIncomeVo.getId());
|
|
|
|
|
+ insPlyIncomeVo.setCrudStatus("3");
|
|
|
|
|
+ this.saveLog(insPlyIncomeVo);
|
|
|
|
|
+ List<InsPlyIncome> list = this.baseMapper.NonSettlementQuery(params);
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
|
+ for (InsPlyIncome item : list) {
|
|
|
|
|
+ return HttpResult.ok(item.getIds());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return HttpResult.ok(null);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok("删除成功");
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public void uodateBalance(InsPlyIncomeVo insPlyIncomeVo) {
|
|
public void uodateBalance(InsPlyIncomeVo insPlyIncomeVo) {
|
|
@@ -225,7 +583,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue()); // 跟单费金额
|
|
settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue()); // 跟单费金额
|
|
|
}
|
|
}
|
|
|
settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getCommissionFeevalue()); // 手续费金额
|
|
settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getCommissionFeevalue()); // 手续费金额
|
|
|
- settlementDocumentaryLogEntity.setSettlementDocumentaryId(insPlyIncomeVo.getOrderno()); // 关联id
|
|
|
|
|
|
|
+ settlementDocumentaryLogEntity.setSettlementDocumentaryId(insPlyIncomeVo.getId()); // 关联id
|
|
|
settlementDocumentaryLogEntity.setAmountType("1"); //手续费结算
|
|
settlementDocumentaryLogEntity.setAmountType("1"); //手续费结算
|
|
|
settlementDocumentaryLogEntity.setCreateTime(new Date());
|
|
settlementDocumentaryLogEntity.setCreateTime(new Date());
|
|
|
settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
|
|
settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
|
|
@@ -236,14 +594,28 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
public HttpResult<BasePageResult<InsPlyIncome>> totalQuery(InsPlyIncomeVo insPlyIncomeVo) {
|
|
public HttpResult<BasePageResult<InsPlyIncome>> totalQuery(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
|
PageInfo<List<InsPlyIncome>> pageHelper = null;
|
|
PageInfo<List<InsPlyIncome>> pageHelper = null;
|
|
|
- params.put("startDate",insPlyIncomeVo.getStartDate().toString());
|
|
|
|
|
- params.put("endDate",insPlyIncomeVo.getEndDate().toString());
|
|
|
|
|
-// 判断非跟单结算日期是否已经存在
|
|
|
|
|
- String resultDate = this.JudgingDate(params);
|
|
|
|
|
- if(StringUtils.isNotEmpty(resultDate)){
|
|
|
|
|
- return HttpResult.error("该时间段已近有单据做过结算,请结算");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if(insPlyIncomeVo.getStartDate()!=null){
|
|
|
|
|
+ params.put("startDate",insPlyIncomeVo.getStartDate().toString());
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if(insPlyIncomeVo.getEndDate()!=null){
|
|
|
|
|
+ params.put("endDate",insPlyIncomeVo.getEndDate().toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
|
|
+ params.put("year",insPlyIncomeVo.getYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
|
|
|
|
|
+ params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotDocumentary())){
|
|
|
|
|
+ params.put("isOther",insPlyIncomeVo.getIsNotDocumentary());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getDocumentaryFeesStatus())){
|
|
|
|
|
+ params.put("documentaryFeesStatus",insPlyIncomeVo.getDocumentaryFeesStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
|
|
|
|
|
+ params.put("companyId",insPlyIncomeVo.getCompanyId());
|
|
|
|
|
+ }
|
|
|
params.put("pageNum",insPlyIncomeVo.getPageNum());
|
|
params.put("pageNum",insPlyIncomeVo.getPageNum());
|
|
|
params.put("pageSize",insPlyIncomeVo.getPageSize());
|
|
params.put("pageSize",insPlyIncomeVo.getPageSize());
|
|
|
List<InsPlyIncome> list= this.baseMapper.totalQuery(params);
|
|
List<InsPlyIncome> list= this.baseMapper.totalQuery(params);
|
|
@@ -252,33 +624,30 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
return HttpResult.ok(new BasePageResult<>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list));
|
|
return HttpResult.ok(new BasePageResult<>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private String JudgingDate(HashMap<String, Object> params) {
|
|
|
|
|
- if(ObjectUtils.isNotEmpty(params.get("startDate")) && ObjectUtils.isNotEmpty(params.get("endDate")) ){
|
|
|
|
|
- String checkResult = settlementDocumentaryFeesService.checkDate(params);
|
|
|
|
|
- if(StringUtils.isNotEmpty(checkResult)){
|
|
|
|
|
- return checkResult;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return null;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public HttpResult batchBalance(InsPlyIncomeVo insPlyIncomeVo) {
|
|
public HttpResult batchBalance(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
-// 生成新数据
|
|
|
|
|
- SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();
|
|
|
|
|
|
|
+// 通过ids 查出跟单非结算单
|
|
|
|
|
+ String ids = insPlyIncomeVo.getIds();
|
|
|
|
|
+ if(StringUtils.isNotEmpty(ids)){
|
|
|
|
|
+ String[] split = ids.split(",");
|
|
|
|
|
+ for (int i =0; i <split.length ; i++) {
|
|
|
|
|
+ String id = split[i];
|
|
|
|
|
+ InsPlyIncome insPlyIncome = baseMapper.selectById(id);
|
|
|
|
|
+ insPlyIncome.setContractId(insPlyIncomeVo.getContractId()); // 合同id
|
|
|
|
|
+ insPlyIncome.setContractFileId(insPlyIncomeVo.getContractFileId());
|
|
|
|
|
+ insPlyIncome.setVoucherNumber(insPlyIncomeVo.getVoucherNumber());
|
|
|
|
|
+ insPlyIncome.setDocumentaryFeesStatus("1"); //1 为跟单费已经结算
|
|
|
|
|
+ baseMapper.updateById(insPlyIncome);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo(); // 生成跟单费结算表
|
|
|
|
|
+ settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
|
|
|
|
|
+ settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
|
|
|
|
|
+ settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());
|
|
|
settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getTotAmount());
|
|
settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getTotAmount());
|
|
|
- settlementDocumentaryFeesVo.setTotalOrders(insPlyIncomeVo.getTotalorders());
|
|
|
|
|
- settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getTimeFrame());
|
|
|
|
|
- settlementDocumentaryFeesVo.setCreateTime(LocalDateTime.now());
|
|
|
|
|
- settlementDocumentaryFeesVo.setStartTime(insPlyIncomeVo.getStartDate().atStartOfDay());
|
|
|
|
|
- settlementDocumentaryFeesVo.setEndTime(insPlyIncomeVo.getEndDate().atStartOfDay());
|
|
|
|
|
- settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());// 结算金额
|
|
|
|
|
- settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getTotAmount().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算金额
|
|
|
|
|
-
|
|
|
|
|
return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
|
|
return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
|
|
|
-
|
|
|
|
|
//
|
|
//
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|