|
@@ -784,20 +784,20 @@ handlingProportion,
|
|
|
try {
|
|
try {
|
|
|
List<InsPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsPlyIncomeExcelDto.class, 0, 1, 1);
|
|
List<InsPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsPlyIncomeExcelDto.class, 0, 1, 1);
|
|
|
for (InsPlyIncomeExcelDto excelItem : dtoList) {
|
|
for (InsPlyIncomeExcelDto excelItem : dtoList) {
|
|
|
- params.clear();
|
|
|
|
|
|
|
+ HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
|
|
if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
|
|
if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
|
|
|
- params.put("licenseno", excelItem.getLicenseno());//车牌号
|
|
|
|
|
|
|
+ objectObjectHashMap.put("licenseno", excelItem.getLicenseno());//车牌号
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isNotEmpty(excelItem.getPolicyno())) {
|
|
if (StringUtils.isNotEmpty(excelItem.getPolicyno())) {
|
|
|
- params.put("policyno", excelItem.getPolicyno()); //交强保单号
|
|
|
|
|
|
|
+ objectObjectHashMap.put("policyno", excelItem.getPolicyno()); //交强保单号
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isNotEmpty(excelItem.getSyPolicyno())) {
|
|
if (StringUtils.isNotEmpty(excelItem.getSyPolicyno())) {
|
|
|
- params.put("syPolicyno", excelItem.getSyPolicyno());//商业保单号
|
|
|
|
|
|
|
+ objectObjectHashMap.put("syPolicyno", excelItem.getSyPolicyno());//商业保单号
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isNotEmpty(excelItem.getNoPolicyno())) {
|
|
if (StringUtils.isNotEmpty(excelItem.getNoPolicyno())) {
|
|
|
- params.put("noPolicyno", excelItem.getNoPolicyno()); //非车保单号
|
|
|
|
|
|
|
+ objectObjectHashMap.put("noPolicyno", excelItem.getNoPolicyno()); //非车保单号
|
|
|
}
|
|
}
|
|
|
- InsPlyIncome insPlyIncome = baseMapper.findByLicenseno(params);
|
|
|
|
|
|
|
+ InsPlyIncome insPlyIncome = baseMapper.findByLicenseno(objectObjectHashMap);
|
|
|
if (ObjectUtils.isNotEmpty(insPlyIncome)) {
|
|
if (ObjectUtils.isNotEmpty(insPlyIncome)) {
|
|
|
if (insPlyIncome.getAllFeeValue() != null && insPlyIncome.getAllFeeValue().compareTo(BigDecimal.ZERO) != 0) {
|
|
if (insPlyIncome.getAllFeeValue() != null && insPlyIncome.getAllFeeValue().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
totalAmount = totalAmount.add(insPlyIncome.getAllFeeValue()); //总金额
|
|
totalAmount = totalAmount.add(insPlyIncome.getAllFeeValue()); //总金额
|
|
@@ -809,7 +809,7 @@ handlingProportion,
|
|
|
totalOtherAmount = totalOtherAmount.add(insPlyIncome.getOtherFeevalue()); //总跟单费
|
|
totalOtherAmount = totalOtherAmount.add(insPlyIncome.getOtherFeevalue()); //总跟单费
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- resultNoSelect.add(params); // 添加未匹配的车牌号
|
|
|
|
|
|
|
+ resultNoSelect.add(objectObjectHashMap); // 添加未匹配的车牌号
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1236,29 +1236,28 @@ handlingProportion,
|
|
|
insPlyIncome.setCommissionFeerate(this.calculateTotal(jqSuperviseCostsProportion, sySuperviseCostsProportion,
|
|
insPlyIncome.setCommissionFeerate(this.calculateTotal(jqSuperviseCostsProportion, sySuperviseCostsProportion,
|
|
|
noSuperviseCostsProportion)); //手续费比例 = 商业手续费比例 + 交强手续费比例 + 非车手续费比例
|
|
noSuperviseCostsProportion)); //手续费比例 = 商业手续费比例 + 交强手续费比例 + 非车手续费比例
|
|
|
if (jqSuperviseCostsProportion != null && jqPremium != null) {
|
|
if (jqSuperviseCostsProportion != null && jqPremium != null) {
|
|
|
- insPlyIncome.setJqSuperviseCostsPremiums(getBigDecimal(jqPremium, jqSuperviseCostsProportion)); //交强手续费
|
|
|
|
|
|
|
+ insPlyIncome.setJqSuperviseCostsPremiums(algorithmAmount(jqPremium, jqSuperviseCostsProportion)); //交强手续费
|
|
|
insPlyIncome.setJqSuperviseCostsProportion(jqSuperviseCostsProportion);
|
|
insPlyIncome.setJqSuperviseCostsProportion(jqSuperviseCostsProportion);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
if (sySuperviseCostsProportion != null && syPremium != null) {
|
|
if (sySuperviseCostsProportion != null && syPremium != null) {
|
|
|
- insPlyIncome.setSySuperviseCostsPremiums(getBigDecimal(syPremium, sySuperviseCostsProportion)); //商业手续费
|
|
|
|
|
|
|
+ insPlyIncome.setSySuperviseCostsPremiums(algorithmAmount(syPremium, sySuperviseCostsProportion)); //商业手续费
|
|
|
insPlyIncome.setSySuperviseCostsProportion(sySuperviseCostsProportion);
|
|
insPlyIncome.setSySuperviseCostsProportion(sySuperviseCostsProportion);
|
|
|
}
|
|
}
|
|
|
if (noSuperviseCostsProportion != null && noPremium != null) {
|
|
if (noSuperviseCostsProportion != null && noPremium != null) {
|
|
|
- insPlyIncome.setNoSuperviseCostsPremiums(getBigDecimal(noPremium, noSuperviseCostsProportion)); //非车手续费
|
|
|
|
|
|
|
+ insPlyIncome.setNoSuperviseCostsPremiums(algorithmAmount(noPremium, noSuperviseCostsProportion)); //非车手续费
|
|
|
insPlyIncome.setNoSuperviseCostsProportion(noSuperviseCostsProportion);
|
|
insPlyIncome.setNoSuperviseCostsProportion(noSuperviseCostsProportion);
|
|
|
}
|
|
}
|
|
|
if (jqOtherCostsProportion != null && jqPremium != null) {
|
|
if (jqOtherCostsProportion != null && jqPremium != null) {
|
|
|
- insPlyIncome.setJqOtherCostsPremium(this.algorithmAmount(jqPremium, jqOtherCostsProportion)); //交强跟单费
|
|
|
|
|
- insPlyIncome.setJqOtherCostsPremium(getBigDecimal(jqPremium, jqOtherCostsProportion)); //交强跟单费
|
|
|
|
|
|
|
+ insPlyIncome.setJqOtherCostsPremium(algorithmAmount(jqPremium, jqOtherCostsProportion)); //交强跟单费
|
|
|
insPlyIncome.setJqOtherCostsProportion(jqOtherCostsProportion);
|
|
insPlyIncome.setJqOtherCostsProportion(jqOtherCostsProportion);
|
|
|
}
|
|
}
|
|
|
if (syOtherCostsProportion != null && syPremium != null) {
|
|
if (syOtherCostsProportion != null && syPremium != null) {
|
|
|
- insPlyIncome.setSyOtherCostsPremium(getBigDecimal(syPremium, syOtherCostsProportion)); //商业跟单费
|
|
|
|
|
|
|
+ insPlyIncome.setSyOtherCostsPremium(algorithmAmount(syPremium, syOtherCostsProportion)); //商业跟单费
|
|
|
insPlyIncome.setSyOtherCostsProportion(syOtherCostsProportion);
|
|
insPlyIncome.setSyOtherCostsProportion(syOtherCostsProportion);
|
|
|
}
|
|
}
|
|
|
if (noOtherCostsProportion != null && noPremium != null) {
|
|
if (noOtherCostsProportion != null && noPremium != null) {
|
|
|
- insPlyIncome.setNoOtherCostsPremium(getBigDecimal(noPremium, noOtherCostsProportion)); //非车跟单费
|
|
|
|
|
|
|
+ insPlyIncome.setNoOtherCostsPremium(algorithmAmount(noPremium, noOtherCostsProportion)); //非车跟单费
|
|
|
insPlyIncome.setNoOtherCostsProportion(noOtherCostsProportion);
|
|
insPlyIncome.setNoOtherCostsProportion(noOtherCostsProportion);
|
|
|
}
|
|
}
|
|
|
insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(), insPlyIncome.getSySuperviseCostsPremiums(), insPlyIncome.getNoSuperviseCostsPremiums())); //手续费
|
|
insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(), insPlyIncome.getSySuperviseCostsPremiums(), insPlyIncome.getNoSuperviseCostsPremiums())); //手续费
|
|
@@ -1340,10 +1339,11 @@ handlingProportion,
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
private static BigDecimal getBigDecimal(BigDecimal jqNoTaxPremium, BigDecimal proportion) {
|
|
private static BigDecimal getBigDecimal(BigDecimal jqNoTaxPremium, BigDecimal proportion) {
|
|
|
- BigDecimal divisor = new BigDecimal("1.06"); // 最好是使用字符串来避免精度损失
|
|
|
|
|
- BigDecimal amount = jqNoTaxPremium.divide(divisor, 5, RoundingMode.HALF_UP).multiply(proportion.divide(new BigDecimal(100)));
|
|
|
|
|
- //交强保费 / 1.06
|
|
|
|
|
- return amount;
|
|
|
|
|
|
|
+ BigDecimal divisor = new BigDecimal("1.06"); // 示例除数
|
|
|
|
|
+ // 先进行除法,保留5位小数,不进行四舍五入(使用RoundingMode.DOWN)
|
|
|
|
|
+ BigDecimal dividedAmount = jqNoTaxPremium.divide(divisor, 5, RoundingMode.DOWN);
|
|
|
|
|
+ // 然后进行乘法,这里不需要额外的舍入,因为乘法不会增加小数位数
|
|
|
|
|
+ return dividedAmount.multiply(proportion.divide(new BigDecimal(100)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1352,8 +1352,8 @@ handlingProportion,
|
|
|
* @return 费用
|
|
* @return 费用
|
|
|
*/
|
|
*/
|
|
|
private BigDecimal algorithmAmount(BigDecimal value1, BigDecimal value2) {
|
|
private BigDecimal algorithmAmount(BigDecimal value1, BigDecimal value2) {
|
|
|
-
|
|
|
|
|
- return value1.multiply(value2.divide(new BigDecimal(100)));
|
|
|
|
|
|
|
+ BigDecimal divide = value2.divide(new BigDecimal(100),5,RoundingMode.DOWN);
|
|
|
|
|
+ return value1.multiply(divide);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2531,13 +2531,16 @@ handlingProportion,
|
|
|
// 如果比例不相等
|
|
// 如果比例不相等
|
|
|
BigDecimal jqOtherCostsProportion = item.getJqOtherCostsProportion();
|
|
BigDecimal jqOtherCostsProportion = item.getJqOtherCostsProportion();
|
|
|
BigDecimal syOtherCostsProportion = item.getSyOtherCostsProportion();
|
|
BigDecimal syOtherCostsProportion = item.getSyOtherCostsProportion();
|
|
|
- BigDecimal divisor = new BigDecimal("1.06"); // 最好是使用字符串来避免精度损失
|
|
|
|
|
|
|
|
|
|
- BigDecimal jqNoTaxPremium = byBxLicenseno.getJqPremium().divide(divisor, 5, RoundingMode.HALF_UP);//交强保费 / 1.06
|
|
|
|
|
- BigDecimal syNoTaxPremium = byBxLicenseno.getSyPremium().divide(divisor, 5, RoundingMode.HALF_UP);// 商业 保费 /1.06
|
|
|
|
|
- BigDecimal jqOtherAmount = jqNoTaxPremium.multiply(item.getJqOtherCostsProportion().divide(new BigDecimal(100)));
|
|
|
|
|
- //交强跟单费用
|
|
|
|
|
- BigDecimal syOtherAmount = syNoTaxPremium.multiply(item.getSyOtherCostsProportion().divide(new BigDecimal(100)));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal divisor = new BigDecimal("1.06"); // 最好是使用字符串来避免精度损失
|
|
|
|
|
+ // 计算交强保费和商业保费(四舍五入到5位小数)
|
|
|
|
|
+ BigDecimal jqNoTaxPremium = byBxLicenseno.getJqPremium().divide(divisor, 5, RoundingMode.DOWN); // 交强保费 / 1.06
|
|
|
|
|
+ BigDecimal syNoTaxPremium = byBxLicenseno.getSyPremium().divide(divisor, 5, RoundingMode.DOWN); // 商业保费 / 1.06
|
|
|
|
|
+ // 计算交强跟单费用和商业跟单费用(不进行四舍五入,而是截断到5位小数)
|
|
|
|
|
+ BigDecimal jqOtherAmount = jqNoTaxPremium.multiply(item.getJqOtherCostsProportion().divide(new BigDecimal(100))).setScale(5, RoundingMode.DOWN);
|
|
|
|
|
+ // 交强跟单费用
|
|
|
|
|
+ BigDecimal syOtherAmount = syNoTaxPremium.multiply(item.getSyOtherCostsProportion().divide(new BigDecimal(100))).setScale(5, RoundingMode.DOWN);
|
|
|
|
|
|
|
|
byBxLicenseno.setJqOtherCostsPremium(jqOtherAmount);
|
|
byBxLicenseno.setJqOtherCostsPremium(jqOtherAmount);
|
|
|
byBxLicenseno.setSyOtherCostsPremium(syOtherAmount);
|
|
byBxLicenseno.setSyOtherCostsPremium(syOtherAmount);
|
|
@@ -2605,10 +2608,10 @@ handlingProportion,
|
|
|
|
|
|
|
|
BigDecimal divisor = new BigDecimal("1.06"); // 最好是使用字符串来避免精度损失
|
|
BigDecimal divisor = new BigDecimal("1.06"); // 最好是使用字符串来避免精度损失
|
|
|
|
|
|
|
|
- BigDecimal noPremium = noNoTaxPremium.divide(divisor, 5, RoundingMode.HALF_UP);//交强保费 / 1.06
|
|
|
|
|
|
|
+ BigDecimal noPremium = noNoTaxPremium.divide(divisor, 5, RoundingMode.DOWN);//交强保费 / 1.06
|
|
|
|
|
|
|
|
|
|
|
|
|
- BigDecimal noOtherAmount = noPremium.multiply(item.getNoOtherCostsProportion().divide(new BigDecimal(100))); //交强跟单费用
|
|
|
|
|
|
|
+ BigDecimal noOtherAmount = noPremium.multiply(item.getNoOtherCostsProportion().divide(new BigDecimal(100))).setScale(5, RoundingMode.DOWN); //交强跟单费用
|
|
|
|
|
|
|
|
|
|
|
|
|
byBxLicenseno.setNoOtherCostsPremium(noOtherAmount);
|
|
byBxLicenseno.setNoOtherCostsPremium(noOtherAmount);
|
|
@@ -2695,6 +2698,7 @@ handlingProportion,
|
|
|
@Override
|
|
@Override
|
|
|
public HttpResult<InsPlyIncome> ptInsert(InsPlyIncomeVo insPlyIncomeVo) {
|
|
public HttpResult<InsPlyIncome> ptInsert(InsPlyIncomeVo insPlyIncomeVo) {
|
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
String agreementId = insPlyIncomeVo.getAgreementId();
|
|
String agreementId = insPlyIncomeVo.getAgreementId();
|
|
|
if(StringUtils.isNotEmpty(agreementId)){
|
|
if(StringUtils.isNotEmpty(agreementId)){
|
|
|
HttpResult<PtlAgreementQueryVo> byAgreementId = ptlAgreementService.getByAgreementId(agreementId);
|
|
HttpResult<PtlAgreementQueryVo> byAgreementId = ptlAgreementService.getByAgreementId(agreementId);
|
|
@@ -2731,6 +2735,9 @@ handlingProportion,
|
|
|
insPlyIncome.setIsNotDocumentary("0");
|
|
insPlyIncome.setIsNotDocumentary("0");
|
|
|
insPlyIncome.setDocumentaryFeesStatus("0");
|
|
insPlyIncome.setDocumentaryFeesStatus("0");
|
|
|
insPlyIncome.setAllFeeValue(insPlyIncome.getReceivableAmount());
|
|
insPlyIncome.setAllFeeValue(insPlyIncome.getReceivableAmount());
|
|
|
|
|
+ if(StringUtils.isNotEmpty(insPlyIncomeVo.getSignDate())){
|
|
|
|
|
+ insPlyIncome.setSignDate(LocalDateTime.parse(insPlyIncomeVo.getSignDate(), formatter));
|
|
|
|
|
+ }
|
|
|
baseMapper.insert(insPlyIncome);
|
|
baseMapper.insert(insPlyIncome);
|
|
|
return HttpResult.ok();
|
|
return HttpResult.ok();
|
|
|
}
|
|
}
|