|
|
@@ -1,5 +1,7 @@
|
|
|
package com.ydtech.modules.fnc.service.impl;
|
|
|
|
|
|
+import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
+import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -11,6 +13,7 @@ import com.github.pagehelper.PageInfo;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
import com.ydtech.modules.fnc.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.fnc.entity.InsPlyIncome;
|
|
|
import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
|
|
|
@@ -21,9 +24,15 @@ import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
|
|
|
import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
|
|
|
import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
|
|
|
import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
|
|
|
+import com.ydtech.modules.ins.model.vo.res.BxOtherExcel;
|
|
|
+import com.ydtech.modules.ins.model.vo.res.BxSettlementFeesExcel;
|
|
|
+import com.ydtech.modules.ins.model.vo.res.InsCmainNocarDetailResVo;
|
|
|
+import com.ydtech.modules.ins.model.vo.res.SettlementFeesExcel;
|
|
|
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.inv.model.excel.InvDisburseExcel;
|
|
|
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
|
|
|
import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
@@ -35,10 +44,15 @@ import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
|
|
|
import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
|
|
|
import com.ydtech.utils.SnowFlakeUtil;
|
|
|
import com.ydtech.utils.excel.ExcelEasypoiUtils;
|
|
|
+import com.ydtech.utils.excel.ExcelStyleUtil;
|
|
|
+import com.ydtech.utils.excel.ExcelUtils2;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.ss.formula.functions.Now;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -46,8 +60,15 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import redis.clients.jedis.params.Params;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.awt.image.BandedSampleModel;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.Paths;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -60,6 +81,8 @@ import java.util.stream.Collectors;
|
|
|
* @author gws
|
|
|
* @since 2024-01-05
|
|
|
*/
|
|
|
+
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, InsPlyIncome> implements InsPlyIncomeService {
|
|
|
|
|
|
@@ -78,6 +101,13 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
private SettlementDocumentaryLogService settlementDocumentaryLogService;
|
|
|
@Autowired
|
|
|
private PtlAgreementService ptlAgreementService;
|
|
|
+ @Autowired
|
|
|
+ private EsmInsCompanyService EsmInsCompanyService;
|
|
|
+
|
|
|
+ @Value("${upload.file.path}")
|
|
|
+ private String uploadPath;
|
|
|
+ @Value("${upload.file.url}")
|
|
|
+ private String uploadUrl;
|
|
|
|
|
|
|
|
|
public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo){
|
|
|
@@ -109,14 +139,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
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);
|
|
|
- }
|
|
|
+ this.savePinTai(order,insFeeOrderNew,insAreaCompany); //手续费不分非车不非车 跟单也不分
|
|
|
}else { // 保险 逻辑: 手续费生成一条 跟单费生成一条 非车手续费一条 非车跟单费一条
|
|
|
if (insFeeOrderNew.getJqSuperviseCostsPremiums() != null || insFeeOrderNew.getSySuperviseCostsPremiums() != null) { //手续费
|
|
|
this.saveInsuranceProcedures(order,insFeeOrderNew,insAreaCompany);
|
|
|
@@ -154,9 +177,13 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
insPlyIncome.setCreateTime(LocalDateTime.now());
|
|
|
insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
insPlyIncome.setHandlingFeesStatus("0");
|
|
|
+ insPlyIncome.setNoNoTaxPremium(insPlyIncome.getNoNoTaxPremium());
|
|
|
+ insPlyIncome.setNoPremium(insPlyIncome.getNoPremium());
|
|
|
insPlyIncome.setIsNotCar("1");
|
|
|
insPlyIncome.setIsNotDocumentary("1");
|
|
|
insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoOtherCostsPremiums());
|
|
|
+ this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
|
|
|
+ baseMapper.insert(insPlyIncome);
|
|
|
}
|
|
|
|
|
|
private void saveNoSupervise(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
@@ -182,88 +209,59 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
insPlyIncome.setIsNotCar("1");
|
|
|
insPlyIncome.setIsNotDocumentary("0");
|
|
|
insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoSuperviseCostsPremiums());
|
|
|
+ insPlyIncome.setUserId(insFeeOrderNew.getUserId());
|
|
|
+ insPlyIncome.setNoPremium(insFeeOrderNew.getNoPremium()); //非车保费
|
|
|
+ insPlyIncome.setNoNoTaxPremium(insFeeOrderNew.getNoNoTaxPremium()); //非车不含税保费
|
|
|
+ this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
|
|
|
+
|
|
|
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.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("1");
|
|
|
- insPlyIncome.setAllFeeValue(otherAmount);
|
|
|
+ BigDecimal otherAmount = this.calculateTotal(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums(),null);
|
|
|
+ BigDecimal otherProportion = this.calculateTotal(insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getJqOtherCostsProportion(),null);
|
|
|
+ BigDecimal allNoTaxPremium = this.calculateTotal(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), null); //交强不含税保费
|
|
|
+ BigDecimal allPremium = this.calculateTotal(insFeeOrderNew.getJqPremium(), insFeeOrderNew.getSyPremium(), null);// 总保费
|
|
|
+
|
|
|
+
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getId(),insAreaCompany.getJqpolicyno(),insAreaCompany.getSypolicyno(),null,null,insFeeOrderNew.getDeptId(),null,order.getProductid(),insAreaCompany.getPayDate(),insAreaCompany.getSigningTime(),insAreaCompany.getCompanyId(),null,insFeeOrderNew.getAgreementId(),order.getLicenseno(),insAreaCompany.getTaxamount(),
|
|
|
+ allNoTaxPremium,null,otherProportion,null,otherAmount,otherAmount,null,null,LocalDateTime.now(),null,null,null,"0","0","0","1");
|
|
|
+
|
|
|
+ insPlyIncome.setTaxPremium(allPremium);
|
|
|
+ insPlyIncome.setJqPremium(insFeeOrderNew.getJqPremium());
|
|
|
+ insPlyIncome.setSyPremium(insFeeOrderNew.getSyPremium());
|
|
|
+ insPlyIncome.setJqNoTaxPremium(insFeeOrderNew.getJqNoTaxPremium());
|
|
|
+ insPlyIncome.setSyNoTaxPremium(insFeeOrderNew.getSyNoTaxPremium());
|
|
|
+ insPlyIncome.setJqOtherCostsProportion(insFeeOrderNew.getJqOtherCostsProportion()); //交强跟单费比例
|
|
|
+ insPlyIncome.setSyOtherCostsProportion(insFeeOrderNew.getSyOtherCostsProportion()); //商业跟单费比例
|
|
|
+ insPlyIncome.setSyOtherCostsPremium(insFeeOrderNew.getSyOtherCostsPremiums());
|
|
|
+ insPlyIncome.setJqOtherCostsPremium(insFeeOrderNew.getJqOtherCostsPremiums());
|
|
|
+ insPlyIncome.setUserId(insFeeOrderNew.getUserId());
|
|
|
+ this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
|
|
|
+
|
|
|
baseMapper.insert(insPlyIncome);
|
|
|
}
|
|
|
|
|
|
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.setDocumentaryFeesStatus("0");
|
|
|
- insPlyIncome.setHandlingFeesStatus("0");
|
|
|
- insPlyIncome.setIsNotCar("0");
|
|
|
- insPlyIncome.setIsNotDocumentary("0");
|
|
|
- insPlyIncome.setAllFeeValue(handlingAmount);
|
|
|
- baseMapper.insert(insPlyIncome);
|
|
|
- }
|
|
|
+ BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums(),null);
|
|
|
+ BigDecimal handlingProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion(),null);
|
|
|
+ BigDecimal allNoTaxPremium = this.calculateTotal(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), null);//不含税保费
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getId(),insAreaCompany.getJqpolicyno(),insAreaCompany.getSypolicyno(),null,null,insFeeOrderNew.getDeptId(),null,order.getProductid(),insAreaCompany.getPayDate(),insAreaCompany.getSigningTime(),insAreaCompany.getCompanyId(),null,insFeeOrderNew.getAgreementId(),order.getLicenseno(),insAreaCompany.getTaxamount()
|
|
|
+ ,allNoTaxPremium,handlingProportion,null,handlingAmount,null,handlingAmount,null,null,LocalDateTime.now(),null,null,null,"0","0","0","0");
|
|
|
+ BigDecimal allTaxPremium = this.calculateTotal(insFeeOrderNew.getJqPremium(), insFeeOrderNew.getSyPremium(), null);
|
|
|
+ insPlyIncome.setJqPremium(insFeeOrderNew.getJqPremium());
|
|
|
+ insPlyIncome.setSyPremium(insFeeOrderNew.getSyPremium());
|
|
|
+ insPlyIncome.setJqNoTaxPremium(insFeeOrderNew.getJqNoTaxPremium());
|
|
|
+ insPlyIncome.setSyNoTaxPremium(insFeeOrderNew.getSyNoTaxPremium());
|
|
|
+ insPlyIncome.setJqSuperviseCostsProportion(insFeeOrderNew.getJqSuperviseCostsProportion());
|
|
|
+ insPlyIncome.setJqSuperviseCostsPremiums(insFeeOrderNew.getJqSuperviseCostsPremiums());
|
|
|
+ insPlyIncome.setSySuperviseCostsProportion(insFeeOrderNew.getSySuperviseCostsProportion());
|
|
|
+ insPlyIncome.setSySuperviseCostsPremiums(insFeeOrderNew.getSySuperviseCostsPremiums());
|
|
|
+ insPlyIncome.setTaxPremium(allTaxPremium);
|
|
|
+ insPlyIncome.setUserId(insFeeOrderNew.getUserId());
|
|
|
+ this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),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);
|
|
|
}
|
|
|
|
|
|
@@ -296,37 +294,62 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
}
|
|
|
|
|
|
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));
|
|
|
+ BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums(),insFeeOrderNew.getNoSuperviseCostsPremiums()); //手续费
|
|
|
+ BigDecimal handlingProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion(),insFeeOrderNew.getNoSuperviseCostsProportion());//手续费比例
|
|
|
+ BigDecimal otherAmount = this.calculateTotal(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums(),insFeeOrderNew.getNoOtherCostsPremiums());//跟单费
|
|
|
+ BigDecimal otherProportion = this.calculateTotal(insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getJqOtherCostsProportion(),insFeeOrderNew.getNoOtherCostsProportion()); //跟单费比例
|
|
|
+// 不含税保费
|
|
|
+ BigDecimal allNoTaxPremium = this.calculateTotal(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), insFeeOrderNew.getNoNoTaxPremium());
|
|
|
+ BigDecimal allAmount = this.calculateTotal(otherAmount, handlingAmount, null);
|
|
|
+ BigDecimal jqReceivableProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getNoSuperviseCostsProportion(), null);// 交强应收 比例
|
|
|
+ BigDecimal syReceivableProportion = this.calculateTotal(insFeeOrderNew.getSySuperviseCostsProportion(), insFeeOrderNew.getSyOtherCostsProportion(), null);//商业应收比例
|
|
|
+ BigDecimal noReceivableProportion = this.calculateTotal(insFeeOrderNew.getNoSuperviseCostsProportion(), insFeeOrderNew.getNoOtherCostsProportion(), null);
|
|
|
+
|
|
|
+ String noPolicyno = this.setNoPolicyno(insAreaCompany);
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getId(),insAreaCompany.getJqpolicyno(),insAreaCompany.getSypolicyno(),
|
|
|
+ noPolicyno,null,insFeeOrderNew.getDeptId(), null,order.getProductid(),insAreaCompany.getPayDate(),insAreaCompany.getSigningTime(),insAreaCompany.getCompanyId(),
|
|
|
+ null,insFeeOrderNew.getAgreementId(),order.getLicenseno(),insAreaCompany.getTaxamount(),allNoTaxPremium,handlingProportion,
|
|
|
+ otherProportion,handlingAmount,otherAmount,allAmount,null,null,LocalDateTime.now(),null,null,null,"0","0","0","0");
|
|
|
+ insPlyIncome.setJqReceivableProportion(jqReceivableProportion);
|
|
|
+ insPlyIncome.setSyReceivableProportion(syReceivableProportion);
|
|
|
+ insPlyIncome.setNoReceivableProportion(noReceivableProportion);
|
|
|
+// 应收金额 = 商业手续费+商业跟单 + 交强手续费 +交强跟单费 + 非车手续费 + 非车跟单费 = allAmount
|
|
|
+ insPlyIncome.setJqSuperviseCostsPremiums(insFeeOrderNew.getJqSuperviseCostsPremiums()); // 交强手续费
|
|
|
+ insPlyIncome.setSySuperviseCostsPremiums(insFeeOrderNew.getSySuperviseCostsPremiums()); // 商业手续费
|
|
|
+ insPlyIncome.setNoSuperviseCostsPremiums(insFeeOrderNew.getNoSuperviseCostsPremiums()); // 非车手续费
|
|
|
+ insPlyIncome.setJqSuperviseCostsProportion(insFeeOrderNew.getJqSuperviseCostsProportion()); //交强手续费 比例
|
|
|
+ insPlyIncome.setSySuperviseCostsProportion(insFeeOrderNew.getSySuperviseCostsProportion()); // 商业手续费 比例
|
|
|
+ insPlyIncome.setNoSuperviseCostsProportion(insFeeOrderNew.getNoSuperviseCostsProportion());// 非车手续费 比例
|
|
|
+ insPlyIncome.setJqOtherCostsProportion(insFeeOrderNew.getJqOtherCostsProportion()); //交强跟单费比例
|
|
|
+ insPlyIncome.setSyOtherCostsProportion(insFeeOrderNew.getSyOtherCostsProportion()); //商业跟单费比例
|
|
|
+ insPlyIncome.setNoOtherCostsProportion(insFeeOrderNew.getNoOtherCostsProportion()); //非车跟单费比例
|
|
|
+ insPlyIncome.setUserId(insFeeOrderNew.getUserId());
|
|
|
+ this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
|
|
|
baseMapper.insert(insPlyIncome);
|
|
|
}
|
|
|
|
|
|
- private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2) {
|
|
|
+ private void saveByCompanyId(InsFeeOrderNew insFeeOrderNew,String companyId, InsPlyIncome insPlyIncome) {
|
|
|
+ PtlAgreement ptlAgreementQueryVo = this.ptlAgreementService.getByAgreementIdNew(insFeeOrderNew.getAgreementId());
|
|
|
+ if(ObjectUtils.isNotEmpty(ptlAgreementQueryVo)){
|
|
|
+ if(StringUtils.isNotEmpty(ptlAgreementQueryVo.getPartnerCompaniesId())){
|
|
|
+// 合作公司id
|
|
|
+ String partnerCompaniesId = ptlAgreementQueryVo.getPartnerCompaniesId();
|
|
|
+ insPlyIncome.setPartnerCompaniesId(partnerCompaniesId);
|
|
|
+ EsmInsCompany esmInsCompany = EsmInsCompanyService.getById(partnerCompaniesId);
|
|
|
+ String name = esmInsCompany.getName(); //合作名称
|
|
|
+ insPlyIncome.setPartnerCompaniesName(name);
|
|
|
+ insPlyIncome.setPartnerCompaniesId(ptlAgreementQueryVo.getPartnerCompaniesId());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(ptlAgreementQueryVo.getAssociationCompaniesId())){
|
|
|
+ String associationCompaniesId = ptlAgreementQueryVo.getAssociationCompaniesId();
|
|
|
+ EsmInsCompany esmInsCompany = EsmInsCompanyService.getById(associationCompaniesId);
|
|
|
+ String name = esmInsCompany.getName(); //保险公司名称
|
|
|
+ insPlyIncome.setCompanyName(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2, BigDecimal value3) {
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
|
|
|
|
if (value1 != null) {
|
|
|
@@ -336,6 +359,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
if (value2 != null) {
|
|
|
total = total.add(value2);
|
|
|
}
|
|
|
+ if (value3 != null) {
|
|
|
+ total = total.add(value3);
|
|
|
+ }
|
|
|
|
|
|
return total;
|
|
|
}
|
|
|
@@ -364,29 +390,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
PageHelper.startPage(insPlyIncomeVo.getPageNum(),insPlyIncomeVo.getPageSize());
|
|
|
params.put("pageNum",insPlyIncomeVo.getPageNum());
|
|
|
params.put("pageSize",insPlyIncomeVo.getPageSize());
|
|
|
- if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getStartDate())){
|
|
|
- params.put("startDate",insPlyIncomeVo.getStartDate().toString());
|
|
|
-
|
|
|
- }
|
|
|
- if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getEndDate())){
|
|
|
- params.put("endDate",insPlyIncomeVo.getEndDate().toString());
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getOrderno())){
|
|
|
- params.put("orderno",insPlyIncomeVo.getOrderno());
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getPolicyno())){
|
|
|
- params.put("policyno",insPlyIncomeVo.getPolicyno());
|
|
|
- }
|
|
|
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotDocumentary())){
|
|
|
- params.put("isOther",insPlyIncomeVo.getIsNotDocumentary());
|
|
|
- }
|
|
|
+ params =this.saveParams(insPlyIncomeVo,params);
|
|
|
|
|
|
- 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);
|
|
|
pageHelper=new PageInfo(list);
|
|
|
@@ -397,6 +402,119 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
return HttpResult.error("查询异常");
|
|
|
}
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public InsPlyIncome totalAmount(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params = this.saveParams(insPlyIncomeVo, params);
|
|
|
+ InsPlyIncome totalledAmount =baseMapper.totalAmount(params); //总金额
|
|
|
+ params.put("handlingFeesStatus","0");
|
|
|
+ InsPlyIncome noTotalAmount =baseMapper.totalAmount(params);
|
|
|
+ if(ObjectUtils.isNotEmpty(totalledAmount) && ObjectUtils.isNotEmpty(noTotalAmount)){
|
|
|
+ totalledAmount.setReadyTotalFeevalue(noTotalAmount.getTotalFeevalue());
|
|
|
+ totalledAmount.setReadyCommissionFeevalue(noTotalAmount.getReadyCommissionFeevalue());
|
|
|
+ totalledAmount.setReadyOtherFeevalue(noTotalAmount.getOtherFeevalue());
|
|
|
+ return totalledAmount;
|
|
|
+ }
|
|
|
+ return totalledAmount;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public HttpResult<Object> batchPinBalance(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ List<InsPlyIncome> list= this.baseMapper.queryNew(params);
|
|
|
+ for (InsPlyIncome item : list) {
|
|
|
+ item.setHandlingFeesStatus("1");
|
|
|
+ item.setSettlementTime(LocalDateTime.now());
|
|
|
+ baseMapper.updateById(item);
|
|
|
+ }
|
|
|
+ SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
|
|
|
+ settlementDocumentaryLogEntity.setIds(insPlyIncomeVo.getIds());
|
|
|
+ settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
|
|
|
+ settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getOtherFeevalue()); //跟单费金额
|
|
|
+ settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getCommissionFeevalue()); //手续费金额
|
|
|
+ settlementDocumentaryLogEntity.setCreateTime(new Date());
|
|
|
+ settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<InsPlyIncome> totalPinAmount(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params = this.saveParams(insPlyIncomeVo,params);
|
|
|
+ List<InsPlyIncome> result=baseMapper.totalPinAmount(params);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private HashMap<String, Object> saveParams(InsPlyIncomeVo insPlyIncomeVo, HashMap<String, Object> params) {
|
|
|
+ if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getStartDate())){
|
|
|
+ params.put("startDate",insPlyIncomeVo.getStartDate().toString());
|
|
|
+ }
|
|
|
+ if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getEndDate())){
|
|
|
+ params.put("endDate",insPlyIncomeVo.getEndDate().toString());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getOrderno())){
|
|
|
+ params.put("orderno",insPlyIncomeVo.getOrderno());
|
|
|
+ }
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getLicenseno())){
|
|
|
+ params.put("licenseno", insPlyIncomeVo.getLicenseno().split(","));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getUserId())){
|
|
|
+ params.put("userId",insPlyIncomeVo.getUserId());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
|
|
|
+ params.put("companyId",insPlyIncomeVo.getCompanyId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getRiskcode())){
|
|
|
+ params.put("riskcode",insPlyIncomeVo.getRiskcode());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getPolicyno())){
|
|
|
+ params.put("policyno",insPlyIncomeVo.getPolicyno().split(","));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getSyPolicyno())){
|
|
|
+ params.put("syPolicyno",insPlyIncomeVo.getSyPolicyno().split(","));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getNoPolicyno())){
|
|
|
+ params.put("noPolicyno",insPlyIncomeVo.getNoPolicyno().split(","));
|
|
|
+ }
|
|
|
+ if(insPlyIncomeVo.getSigndate()!=null){
|
|
|
+ params.put("signdate",insPlyIncomeVo.getSigndate());
|
|
|
+ }
|
|
|
+ if(insPlyIncomeVo.getCreateTime()!=null){
|
|
|
+ params.put("createTime",insPlyIncomeVo.getCreateTime());
|
|
|
+ }
|
|
|
+ if(insPlyIncomeVo.getSettlementTime()!=null){
|
|
|
+ params.put("settlementTime",insPlyIncomeVo.getSettlementTime());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getHandlingFeesStatus())){
|
|
|
+ params.put("handlingFeesStatus",insPlyIncomeVo.getHandlingFeesStatus());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getPartnerCompaniesId())){
|
|
|
+ params.put("partnerCompaniesId",insPlyIncomeVo.getHandlingFeesStatus());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
+ params.put("year",insPlyIncomeVo.getYear());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())){
|
|
|
+ params.put("month",insPlyIncomeVo.getMonth());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getDay())){
|
|
|
+ params.put("day",insPlyIncomeVo.getDay());
|
|
|
+ }
|
|
|
+ return params;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public HttpResult<BasePageResult<InsPlyIncome>> nonSettlementQuery(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
@@ -415,8 +533,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
params.put("year",insPlyIncomeVo.getYear());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
- params.put("year",insPlyIncomeVo.getYear());
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())){
|
|
|
+ params.put("month",insPlyIncomeVo.getMonth());
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(insPlyIncomeVo.getDocumentaryFeesStatus())){
|
|
|
params.put("documentaryFeesStatus",insPlyIncomeVo.getDocumentaryFeesStatus());
|
|
|
@@ -434,7 +552,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
@Override
|
|
|
public HttpResult<List<InsPlyIncome>> nonSettldetail(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
try {
|
|
|
- String ids = insPlyIncomeVo.getIds();
|
|
|
+ String ids = insPlyIncomeVo.getIncomeIds();
|
|
|
ArrayList<InsPlyIncome> resultList = new ArrayList<>();
|
|
|
if (ObjectUtils.isNotEmpty(ids)) {
|
|
|
String[] split = ids.split(",");
|
|
|
@@ -457,12 +575,14 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
List<InsPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(file, InsPlyIncomeExcelDto.class, 0, 1, 1);
|
|
|
for (InsPlyIncomeExcelDto excelItem : dtoList) {
|
|
|
String licenseno = excelItem.getLicenseno();//车牌号
|
|
|
+ String policyno = excelItem.getPolicyno(); //交强保单号
|
|
|
+ String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
|
|
|
+ String noPolicyno = excelItem.getNoPolicyno(); //非车保单号
|
|
|
+
|
|
|
if(ObjectUtils.isNotEmpty(licenseno)){
|
|
|
- InsPlyIncome insPlyIncome=baseMapper.findByLicenseno(licenseno);
|
|
|
+ InsPlyIncome insPlyIncome=baseMapper.findByLicenseno(licenseno,policyno,syPolicyno,noPolicyno);
|
|
|
if(ObjectUtils.isNotEmpty(insPlyIncome)){
|
|
|
- insPlyIncome.setContractFileId(insPlyIncomeVo.getContractFileId());
|
|
|
- insPlyIncome.setContractId(insPlyIncomeVo.getContractId());
|
|
|
- insPlyIncome.setVoucherNumber(insPlyIncomeVo.getVoucherNumber());
|
|
|
+ insPlyIncome.setHandlingFeesStatus("1"); //已结算
|
|
|
baseMapper.updateById(insPlyIncome);
|
|
|
}
|
|
|
}
|
|
|
@@ -475,6 +595,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void updateByEntity(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+// 根据协议 如果是含增值税结算 用保费 * 如果是 不含税保费
|
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
|
|
|
baseMapper.updateById(insPlyIncome);
|
|
|
@@ -485,6 +606,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
}
|
|
|
|
|
|
private void saveLog(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+
|
|
|
// 添加记录
|
|
|
SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
|
|
|
settlementDocumentaryLogEntity.setCrudStatus(insPlyIncomeVo.getCrudStatus());
|
|
|
@@ -629,7 +751,112 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
@Transactional
|
|
|
public HttpResult batchBalance(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
// 通过ids 查出跟单非结算单
|
|
|
- String ids = insPlyIncomeVo.getIds();
|
|
|
+ String ids = insPlyIncomeVo.getIncomeIds();
|
|
|
+ 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.setDocumentaryFeesStatus("1"); //1 为跟单费已经结算
|
|
|
+ insPlyIncome.setSettlementTime(LocalDateTime.now());
|
|
|
+ baseMapper.updateById(insPlyIncome);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo(); // 生成跟单费结算表
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
+ settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
|
|
|
+ }
|
|
|
+
|
|
|
+ settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
|
|
|
+ settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue()); //其他费用金额
|
|
|
+ settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getOtherFeevalue().subtract(insPlyIncomeVo.getInvoicCommissionFeevalue())); //未开票金额
|
|
|
+ settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());//已开票金额
|
|
|
+ settlementDocumentaryFeesVo.setSettlementStatus("2");
|
|
|
+ settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
|
|
|
+ return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<InsPlyIncome> totalBxAmount(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params=this.saveParams(insPlyIncomeVo,params);
|
|
|
+ List<InsPlyIncome> resultList = baseMapper.totalBxAmount(params);
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public HttpResult<Object> batchInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+// 开票时生成 记录 用来合计已经开票数据
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params = this.saveParams(insPlyIncomeVo, params);
|
|
|
+ List<InsPlyIncome> list= this.baseMapper.queryNew(params);
|
|
|
+ for (InsPlyIncome item : list){
|
|
|
+ item.setHandlingFeesStatus("2"); //已开票
|
|
|
+ item.setInvoicTime(LocalDate.now());
|
|
|
+ item.setInvoicAmount(item.getCommissionFeevalue());
|
|
|
+ baseMapper.updateById(item);
|
|
|
+ }
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult<InsPlyIncome> queryInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params = this.saveParams(insPlyIncomeVo, params);
|
|
|
+ InsPlyIncome result= baseMapper.queryInvoicing(params); //总金额
|
|
|
+ params.put("handlingFeesStatus","0");
|
|
|
+ InsPlyIncome noResult= baseMapper.queryInvoicing(params); //未结算金额
|
|
|
+ result.setReadyCommissionFeevalue(noResult.getCommissionFeevalue());
|
|
|
+ return HttpResult.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult<Object> batchBxBalance(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){
|
|
|
+ String[] split = insPlyIncomeVo.getIds().split(",");
|
|
|
+ for(String id : split){
|
|
|
+ insPlyIncome.setId(id);
|
|
|
+ insPlyIncome.setHandlingFeesStatus("2");
|
|
|
+ insPlyIncome.setSettlementTime(LocalDateTime.now());
|
|
|
+ baseMapper.updateById(insPlyIncome);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
|
|
|
+
|
|
|
+ settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getReadyCommissionFeevalue());
|
|
|
+ settlementDocumentaryLogEntity.setIds(insPlyIncomeVo.getIds());
|
|
|
+ settlementDocumentaryLogEntity.setCreateTime(new Date());
|
|
|
+ settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
|
|
|
+ settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult<InsPlyIncome> querySettInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params = this.saveParams(insPlyIncomeVo, params);
|
|
|
+ InsPlyIncome insPlyIncome = baseMapper.queryInvoicing(params); //已经开票
|
|
|
+ return HttpResult.ok(insPlyIncome);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult<List<InsPlyIncome>> allOtherAmount(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params=this.saveParams(insPlyIncomeVo,params);
|
|
|
+ List<InsPlyIncome> result= baseMapper.allOtherAmount(params);
|
|
|
+ return HttpResult.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public HttpResult<Object> batchInvoic(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
+ // 通过ids 查出跟单非结算单
|
|
|
+ String ids = insPlyIncomeVo.getIncomeIds();
|
|
|
if(StringUtils.isNotEmpty(ids)){
|
|
|
String[] split = ids.split(",");
|
|
|
for (int i =0; i <split.length ; i++) {
|
|
|
@@ -638,16 +865,107 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
insPlyIncome.setContractId(insPlyIncomeVo.getContractId()); // 合同id
|
|
|
insPlyIncome.setContractFileId(insPlyIncomeVo.getContractFileId());
|
|
|
insPlyIncome.setVoucherNumber(insPlyIncomeVo.getVoucherNumber());
|
|
|
- insPlyIncome.setDocumentaryFeesStatus("1"); //1 为跟单费已经结算
|
|
|
+ insPlyIncome.setSettlementTime(LocalDateTime.now());
|
|
|
baseMapper.updateById(insPlyIncome);
|
|
|
}
|
|
|
}
|
|
|
SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo(); // 生成跟单费结算表
|
|
|
- settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
|
|
|
+ settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
|
|
|
+ }
|
|
|
settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
|
|
|
- settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());
|
|
|
- settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getTotAmount());
|
|
|
+ settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue()); //其他费用金额
|
|
|
+ settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getNoInvoicCommissionFeevalue().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算
|
|
|
+ settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//已经开票
|
|
|
+ settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
|
|
|
+ settlementDocumentaryFeesVo.setSettlementStatus("1");
|
|
|
return settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
|
|
|
-//
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult pinHandlingexcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params =this.saveParams(insPlyIncomeVo,params);
|
|
|
+ List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
|
|
|
+
|
|
|
+ ExportParams exportParams = new ExportParams("保险手续费导出", null, ExcelType.HSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ List<SettlementFeesExcel> resultList = new ArrayList<>();
|
|
|
+ for (InsPlyIncome item :insPlyIncomes){
|
|
|
+ SettlementFeesExcel bxSettlementFeesExcel = new SettlementFeesExcel();
|
|
|
+ BeanUtils.copyProperties(item, bxSettlementFeesExcel);
|
|
|
+ resultList.add(bxSettlementFeesExcel);
|
|
|
+ }
|
|
|
+ String uploadPath = this.uploadPath + "/excel/";
|
|
|
+ Path path = Paths.get(uploadPath);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ try {
|
|
|
+ Files.createDirectories(path);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fileName = EasyExcelUtils.downExcel(uploadPath, "保险手续费导出", SettlementFeesExcel.class, resultList);
|
|
|
+ return HttpResult.ok("",uploadUrl + "excel/" + fileName);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult bxHandlingexcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params =this.saveParams(insPlyIncomeVo,params);
|
|
|
+ List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);
|
|
|
+
|
|
|
+ ExportParams exportParams = new ExportParams("平台手续费", null, ExcelType.HSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ List<BxSettlementFeesExcel> resultList = new ArrayList<>();
|
|
|
+ for (InsPlyIncome item :insPlyIncomes){
|
|
|
+ BxSettlementFeesExcel bxSettlementFeesExcel = new BxSettlementFeesExcel();
|
|
|
+ BeanUtils.copyProperties(item, bxSettlementFeesExcel);
|
|
|
+ resultList.add(bxSettlementFeesExcel);
|
|
|
+ }
|
|
|
+ String uploadPath = this.uploadPath + "/excel/";
|
|
|
+ Path path = Paths.get(uploadPath);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ try {
|
|
|
+ Files.createDirectories(path);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fileName = EasyExcelUtils.downExcel(uploadPath, "平台手续费导出", BxSettlementFeesExcel.class, resultList);
|
|
|
+ return HttpResult.ok("",uploadUrl + "excel/" + fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult bxOtherExcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ HashMap<String, Object> params = new HashMap<>();
|
|
|
+ params =this.saveParams(insPlyIncomeVo,params);
|
|
|
+ params.put("agreementType","2");
|
|
|
+ params.put("isOther","1");
|
|
|
+ params.put("isNotCar","0");
|
|
|
+ List<InsPlyIncome> insPlyIncomes = baseMapper.allOtherAmount(params);
|
|
|
+
|
|
|
+ ExportParams exportParams = new ExportParams("跟单费导出", null, ExcelType.HSSF);
|
|
|
+ exportParams.setStyle(ExcelStyleUtil.class);
|
|
|
+ List<BxOtherExcel> resultList = new ArrayList<>();
|
|
|
+ for (InsPlyIncome item :insPlyIncomes){
|
|
|
+ BxOtherExcel bxSettlementFeesExcel = new BxOtherExcel();
|
|
|
+ BeanUtils.copyProperties(item, bxSettlementFeesExcel);
|
|
|
+ resultList.add(bxSettlementFeesExcel);
|
|
|
+ }
|
|
|
+ String uploadPath = this.uploadPath + "/excel/";
|
|
|
+ Path path = Paths.get(uploadPath);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ try {
|
|
|
+ Files.createDirectories(path);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fileName = EasyExcelUtils.downExcel(uploadPath, "跟单费导出", BxOtherExcel.class, resultList);
|
|
|
+ return HttpResult.ok("",uploadUrl + "excel/" + fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|