|
|
@@ -4,7 +4,6 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
@@ -13,6 +12,8 @@ import com.ydtech.constants.InsuranceEnum;
|
|
|
import com.ydtech.constants.enums.dict.agreement.ProductsType;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
+import com.ydtech.modules.admin.model.report.financialReceivables.*;
|
|
|
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
@@ -47,7 +48,6 @@ import com.ydtech.utils.excel.ExcelStyleUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@@ -61,18 +61,15 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.math.RoundingMode;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
import java.time.YearMonth;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -290,8 +287,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
|
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getInsOrderNo(), insAreaCompany.getJqpolicyno(),
|
|
|
insAreaCompany.getSypolicyno(), null, null, null, null, order.getProductid(), insAreaCompany.getPayDate(),
|
|
|
- insAreaCompany.getSigningTime(), insAreaCompany.getCompanyId(), null, insFeeOrderNew.getAgreementId(), order.getLicenseno(),
|
|
|
- insAreaCompany.getTaxamount(),
|
|
|
+ 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");
|
|
|
//add by hxl 2024-07-31 修改插入结算表中险种信息错误的bug 将大订单中的险种信息改为小订单的险种信息
|
|
|
@@ -327,17 +324,17 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
private void saveInsuranceProcedures(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
// 保险手续费
|
|
|
BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(),
|
|
|
- insFeeOrderNew.getSySuperviseCostsPremiums(), null);
|
|
|
+ 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.getInsOrderNo(), insAreaCompany.getJqpolicyno(),
|
|
|
- insAreaCompany.getSypolicyno(), null, null, null, null, order.getProductid(), insAreaCompany.getPayDate(),
|
|
|
- insAreaCompany.getSigningTime(), insAreaCompany.getCompanyId(), null, insFeeOrderNew.getAgreementId(), order.getLicenseno(),
|
|
|
- insAreaCompany.getTaxamount()
|
|
|
+ insAreaCompany.getSypolicyno(), null, null, null, 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");
|
|
|
+ null, null, "0", "0", "0", "0");
|
|
|
BigDecimal allTaxPremium = this.calculateTotal(insFeeOrderNew.getJqPremium(), insFeeOrderNew.getSyPremium(), null);
|
|
|
insPlyIncome.setJqPremium(insFeeOrderNew.getJqPremium());
|
|
|
insPlyIncome.setSyPremium(insFeeOrderNew.getSyPremium());
|
|
|
@@ -426,31 +423,31 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
|
|
|
|
|
|
private void savePinTai(InsOrders order, InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany) {
|
|
|
BigDecimal handlingAmount = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsPremiums(),
|
|
|
- insFeeOrderNew.getSySuperviseCostsPremiums(), insFeeOrderNew.getNoSuperviseCostsPremiums()); //手续费
|
|
|
+ insFeeOrderNew.getSySuperviseCostsPremiums(), insFeeOrderNew.getNoSuperviseCostsPremiums()); //手续费
|
|
|
BigDecimal handlingProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(),
|
|
|
- insFeeOrderNew.getSySuperviseCostsProportion(), insFeeOrderNew.getNoSuperviseCostsProportion());//手续费比例
|
|
|
+ insFeeOrderNew.getSySuperviseCostsProportion(), insFeeOrderNew.getNoSuperviseCostsProportion());//手续费比例
|
|
|
BigDecimal otherAmount = this.calculateTotal(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums(),
|
|
|
- insFeeOrderNew.getNoOtherCostsPremiums());//跟单费
|
|
|
+ insFeeOrderNew.getNoOtherCostsPremiums());//跟单费
|
|
|
BigDecimal otherProportion = this.calculateTotal(insFeeOrderNew.getSyOtherCostsProportion(),
|
|
|
- insFeeOrderNew.getJqOtherCostsProportion(), insFeeOrderNew.getNoOtherCostsProportion()); //跟单费比例
|
|
|
+ insFeeOrderNew.getJqOtherCostsProportion(), insFeeOrderNew.getNoOtherCostsProportion()); //跟单费比例
|
|
|
// 不含税保费
|
|
|
BigDecimal allNoTaxPremium = this.calculateTotal(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(),
|
|
|
- insFeeOrderNew.getNoNoTaxPremium());
|
|
|
+ insFeeOrderNew.getNoNoTaxPremium());
|
|
|
BigDecimal allAmount = this.calculateTotal(otherAmount, handlingAmount, null);
|
|
|
BigDecimal jqReceivableProportion = this.calculateTotal(insFeeOrderNew.getJqSuperviseCostsProportion(),
|
|
|
- insFeeOrderNew.getJqOtherCostsProportion(), null);// 交强应收 比例
|
|
|
+ insFeeOrderNew.getJqOtherCostsProportion(), null);// 交强应收 比例
|
|
|
BigDecimal syReceivableProportion = this.calculateTotal(insFeeOrderNew.getSySuperviseCostsProportion(),
|
|
|
- insFeeOrderNew.getSyOtherCostsProportion(), null);//商业应收比例
|
|
|
+ insFeeOrderNew.getSyOtherCostsProportion(), null);//商业应收比例
|
|
|
BigDecimal noReceivableProportion = this.calculateTotal(insFeeOrderNew.getNoSuperviseCostsProportion(),
|
|
|
- insFeeOrderNew.getNoOtherCostsProportion(), null);
|
|
|
+ insFeeOrderNew.getNoOtherCostsProportion(), null);
|
|
|
|
|
|
String noPolicyno = this.setNoPolicyno(insAreaCompany);
|
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome(insFeeOrderNew.getInsOrderNo(), insAreaCompany.getJqpolicyno(),
|
|
|
- insAreaCompany.getSypolicyno(),
|
|
|
+ insAreaCompany.getSypolicyno(),
|
|
|
noPolicyno, null, null, null, order.getProductid(), insAreaCompany.getPayDate(), insAreaCompany.getSigningTime(),
|
|
|
- insAreaCompany.getCompanyId(),
|
|
|
+ insAreaCompany.getCompanyId(),
|
|
|
null, insFeeOrderNew.getAgreementId(), order.getLicenseno(), insAreaCompany.getTaxamount(), allNoTaxPremium,
|
|
|
-handlingProportion,
|
|
|
+ handlingProportion,
|
|
|
otherProportion, handlingAmount, otherAmount, allAmount, null, null, LocalDateTime.now(), null, null, null, "0", "0", "0", "0");
|
|
|
insPlyIncome.setJqReceivableProportion(jqReceivableProportion);
|
|
|
insPlyIncome.setSyReceivableProportion(syReceivableProportion);
|
|
|
@@ -568,7 +565,7 @@ handlingProportion,
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(insPlyIncomeVo.getId())) {
|
|
|
SettlementDocumentaryFeesEntity settlementDocumentaryFeesEntity =
|
|
|
- settlementDocumentaryFeesService.getById(insPlyIncomeVo.getId());
|
|
|
+ settlementDocumentaryFeesService.getById(insPlyIncomeVo.getId());
|
|
|
// 通过任务id查询 明细
|
|
|
String taskId = settlementDocumentaryFeesEntity.getTaskId();
|
|
|
List<String> incomeIds = incomeTaskRelationshipService.getByTaskId(taskId);
|
|
|
@@ -582,7 +579,7 @@ handlingProportion,
|
|
|
|
|
|
pageHelper = new PageInfo(list);
|
|
|
BasePageResult<InsPlyIncome> pageResult = new BasePageResult<InsPlyIncome>(insPlyIncomeVo.getPageNum(),
|
|
|
- insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
|
|
|
+ insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
|
|
|
return HttpResult.ok(pageResult);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -800,7 +797,7 @@ handlingProportion,
|
|
|
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);
|
|
|
+ insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
|
|
|
return HttpResult.ok(pageResult);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -1334,7 +1331,7 @@ handlingProportion,
|
|
|
BigDecimal noPremium = initializationBigdecimal(insPlyIncomeVo.getNoPremium()); //非车保费
|
|
|
//手续费比例
|
|
|
insPlyIncome.setCommissionFeerate(this.calculateTotal(jqSuperviseCostsProportion, sySuperviseCostsProportion,
|
|
|
- noSuperviseCostsProportion)); //手续费比例 = 商业手续费比例 + 交强手续费比例 + 非车手续费比例
|
|
|
+ noSuperviseCostsProportion)); //手续费比例 = 商业手续费比例 + 交强手续费比例 + 非车手续费比例
|
|
|
if (jqSuperviseCostsProportion != null && jqPremium != null) {
|
|
|
insPlyIncome.setJqSuperviseCostsPremiums(algorithmAmount(jqPremium, jqSuperviseCostsProportion)); //交强手续费
|
|
|
insPlyIncome.setJqSuperviseCostsProportion(jqSuperviseCostsProportion);
|
|
|
@@ -1622,9 +1619,9 @@ handlingProportion,
|
|
|
}
|
|
|
} else {
|
|
|
// 因为跟单没有关联表 也无法关联到开票表所以只能按照 条件去进行判断
|
|
|
- if(StringUtils.isNotEmpty( insPlyIncome.getSettleOtherStatus()) && "1".equals( insPlyIncome.getSettleOtherStatus())){
|
|
|
- throw new SystemException("已经对账不能进行删除");
|
|
|
- }
|
|
|
+ if(StringUtils.isNotEmpty( insPlyIncome.getSettleOtherStatus()) && "1".equals( insPlyIncome.getSettleOtherStatus())){
|
|
|
+ throw new SystemException("已经对账不能进行删除");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1697,7 +1694,7 @@ handlingProportion,
|
|
|
pageHelper = new PageInfo(list);
|
|
|
|
|
|
return HttpResult.ok(new BasePageResult<>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(),
|
|
|
- pageHelper.getPages(), list));
|
|
|
+ pageHelper.getPages(), list));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1727,7 +1724,7 @@ handlingProportion,
|
|
|
params.put("id", insPlyIncomeVo.getId());
|
|
|
params.put("handlingFeesStatus", "1");
|
|
|
SettlementDocumentaryFeesEntity parentSettlementDocumentaryFeesEntity =
|
|
|
- settlementDocumentaryFeesService.getByParentSettlementAmount(params);
|
|
|
+ settlementDocumentaryFeesService.getByParentSettlementAmount(params);
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(parentSettlementDocumentaryFeesEntity)) { // 多次结算
|
|
|
BigDecimal totalAmount = parentSettlementDocumentaryFeesEntity.getTotalAmount();
|
|
|
@@ -2014,7 +2011,7 @@ handlingProportion,
|
|
|
|
|
|
// 表内总金额
|
|
|
SettlementDocumentaryFeesEntity byIdSettlementDocumentaryFeesEntity =
|
|
|
- settlementDocumentaryFeesService.getById(insPlyIncomeVo.getId());
|
|
|
+ settlementDocumentaryFeesService.getById(insPlyIncomeVo.getId());
|
|
|
BigDecimal invoicAmount = byIdSettlementDocumentaryFeesEntity.getTotalAmount();
|
|
|
|
|
|
|
|
|
@@ -2026,7 +2023,7 @@ handlingProportion,
|
|
|
params.put("id", insPlyIncomeVo.getId());
|
|
|
params.put("handlingFeesStatus", "0");
|
|
|
SettlementDocumentaryFeesEntity parentSettlementDocumentaryFeesEntity =
|
|
|
- settlementDocumentaryFeesService.getByParentSettlementAmount(params);
|
|
|
+ settlementDocumentaryFeesService.getByParentSettlementAmount(params);
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(parentSettlementDocumentaryFeesEntity)) { // 多次结算
|
|
|
BigDecimal totalAmount = parentSettlementDocumentaryFeesEntity.getTotalAmount();
|
|
|
@@ -3007,6 +3004,7 @@ handlingProportion,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public void batchUpdateVoucher(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
String s = insPlyIncomeVo.getSelectIds().get(0);
|
|
|
@@ -3048,7 +3046,7 @@ handlingProportion,
|
|
|
@Override
|
|
|
public List<PlatformSettlementRecordDto> platformSettlementRecord(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
if(insPlyIncomeVo.getPartnerCompaniesId()==null || "".equals(insPlyIncomeVo.getPartnerCompaniesId())){
|
|
|
- throw new SystemException("合作公司编码(partnerCompaniesId)不能为空");
|
|
|
+ throw new SystemException("合作公司编码(partnerCompaniesId)不能为空");
|
|
|
}
|
|
|
if(insPlyIncomeVo.getHandlingFeesStatus()==null || "".equals(insPlyIncomeVo.getHandlingFeesStatus())){
|
|
|
throw new SystemException("结算状态 0 未结算 1已结算(handlingFeesStatus)不能为空");
|
|
|
@@ -3272,6 +3270,71 @@ handlingProportion,
|
|
|
}
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/8/1 9:28
|
|
|
+ * @Description: 查询平台、私有数据
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public FinancialReceivablesAllVo queryDateByType(FinancialReceivablesQueryVo financialReceivablesQueryVo) {
|
|
|
+ //检查参数
|
|
|
+ if(StringUtils.isBlank(financialReceivablesQueryVo.getType())){
|
|
|
+ throw new SystemException("应收类型不能为空,1为平台2为私有,默认传1");
|
|
|
+ }
|
|
|
+ int year =0;
|
|
|
+ if(StringUtils.isBlank(financialReceivablesQueryVo.getYear())){
|
|
|
+ Calendar cale = Calendar.getInstance();
|
|
|
+ year = cale.get(Calendar.YEAR);
|
|
|
+ }else{
|
|
|
+ year = Integer.parseInt(financialReceivablesQueryVo.getYear());
|
|
|
+ }
|
|
|
+ financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getYearBeginDateStr(year)+" 00:00:00");
|
|
|
+ financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getYearEndDateStr(year)+" 23:59:59");
|
|
|
+ financialReceivablesQueryVo.setType("1");
|
|
|
+ //总应收
|
|
|
+ BigDecimal ptSumAmount = baseMapper.queryDateByTypeSumAmount(financialReceivablesQueryVo);
|
|
|
+ financialReceivablesQueryVo.setType("2");
|
|
|
+ //总应收
|
|
|
+ BigDecimal sySumAmount = baseMapper.queryDateByTypeSumAmount(financialReceivablesQueryVo);
|
|
|
+
|
|
|
+ List<FinancialReceivablesVo> list = baseMapper.queryDateByType(financialReceivablesQueryVo);
|
|
|
+
|
|
|
+ return new FinancialReceivablesAllVo(ptSumAmount.toString(),sySumAmount.toString(),year+"",list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/8/5 9:56
|
|
|
+ * @Description: 应收月份统计接口
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public FinancialReceivablesAllMonthVo queryDateByTypeByMonth(FinancialReceivablesQueryMonthVo financialReceivablesQueryVo) {
|
|
|
+ //检查参数
|
|
|
+ if(StringUtils.isBlank(financialReceivablesQueryVo.getType())){
|
|
|
+ throw new SystemException("应收类型不能为空,1为平台2为私有,默认传1");
|
|
|
+ }
|
|
|
+ //检查参数
|
|
|
+ if(StringUtils.isBlank(financialReceivablesQueryVo.getYearAndMonth())){
|
|
|
+ throw new SystemException("月份不能为空");
|
|
|
+ }
|
|
|
+ String yearAndMonth = financialReceivablesQueryVo.getYearAndMonth();
|
|
|
+ int year = Integer.parseInt(yearAndMonth.split("-")[0]);
|
|
|
+ int month = Integer.parseInt(yearAndMonth.split("-")[1]);
|
|
|
|
|
|
+ financialReceivablesQueryVo.setBeginDate(SliceUpDateUtil.getStartOfMonth(year,month));
|
|
|
+ financialReceivablesQueryVo.setEndDate(SliceUpDateUtil.getEndOfMonth(year,month));
|
|
|
+ //查询总数
|
|
|
+ FinancialReceivablesAllMonthVo vo= baseMapper.queryDateByTypeByMonth(financialReceivablesQueryVo);
|
|
|
+ vo.setYearAndMonth(yearAndMonth);
|
|
|
+ //查询列表
|
|
|
+ List<FinancialReceivablesMonthVo> list = baseMapper.queryDateByTypeByMonthList(financialReceivablesQueryVo);
|
|
|
|
|
|
+ //按区域
|
|
|
+ //if()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|