|
@@ -19,10 +19,12 @@ import com.jzg.commons.entity.finance.dto.*;
|
|
|
import com.jzg.commons.entity.finance.po.*;
|
|
import com.jzg.commons.entity.finance.po.*;
|
|
|
import com.jzg.commons.entity.finance.vo.*;
|
|
import com.jzg.commons.entity.finance.vo.*;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrderAdjust;
|
|
import com.jzg.commons.entity.orders.po.InsOrderAdjust;
|
|
|
|
|
+import com.jzg.commons.entity.orders.po.InsOrders;
|
|
|
import com.jzg.commons.entity.po.EsmInsCompany;
|
|
import com.jzg.commons.entity.po.EsmInsCompany;
|
|
|
import com.jzg.commons.entity.po.InsFeeOrders;
|
|
import com.jzg.commons.entity.po.InsFeeOrders;
|
|
|
import com.jzg.commons.entity.po.PtlAgreement;
|
|
import com.jzg.commons.entity.po.PtlAgreement;
|
|
|
import com.jzg.commons.entity.po.SysUploadFiles;
|
|
import com.jzg.commons.entity.po.SysUploadFiles;
|
|
|
|
|
+import com.jzg.commons.exception.ServiceException;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
|
import com.jzg.commons.util.EasyExcelUtils;
|
|
import com.jzg.commons.util.EasyExcelUtils;
|
|
@@ -102,7 +104,6 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private PtlAgreementMapper ptlAgreementMapper;
|
|
private PtlAgreementMapper ptlAgreementMapper;
|
|
|
-
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SysUploadFilesMapper sysUploadFilesMapper;
|
|
private SysUploadFilesMapper sysUploadFilesMapper;
|
|
|
|
|
|
|
@@ -146,19 +147,19 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public InsPlyIncome getUnauditedOrder(ReceivableQueryVo receivableQueryVo) {
|
|
public InsPlyIncome getUnauditedOrder(ReceivableQueryVo receivableQueryVo) {
|
|
|
- InsPlyIncome auditedOrder = baseMapper.getAuditedOrder(receivableQueryVo.getOrderNo(), receivableQueryVo.getQueryType(), InsOrderStatusEnum.UNDERWRITED.getCode(), receivableQueryVo.getAgreementType());
|
|
|
|
|
- if (receivableQueryVo.getQueryType().equals("3") || receivableQueryVo.getQueryType().equals("4")) {
|
|
|
|
|
- if (Objects.isNull(auditedOrder.getJyPolicyNo()) && auditedOrder.getJyPolicyNo().isEmpty()) {
|
|
|
|
|
|
|
+ InsPlyIncome auditedOrder = baseMapper.getAuditedOrder(receivableQueryVo.getOrderNo(), InsOrderStatusEnum.UNDERWRITED.getCode(), "0", receivableQueryVo.getAgreementType());
|
|
|
|
|
+ if ("3".equals(receivableQueryVo.getQueryType()) || "4".equals(receivableQueryVo.getQueryType())) {
|
|
|
|
|
+ if (StrUtil.isBlank(auditedOrder.getJyPolicyNo())) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return baseMapper.getAuditedOrder(receivableQueryVo.getOrderNo(), InsOrderStatusEnum.UNDERWRITED.getCode(), "0", receivableQueryVo.getAgreementType());
|
|
|
|
|
|
|
+ return auditedOrder;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean saveAuditedOrder(List<String> orderNos) {
|
|
|
|
|
|
|
+ public boolean saveAuditedOrder(AddReceivableVo addReceivableVo) {
|
|
|
|
|
|
|
|
- List<InsPlyIncome> auditedOrder = this.getUnauditOrderList(orderNos, InsOrderStatusEnum.UNDERWRITED.getCode(), "0");
|
|
|
|
|
|
|
+ List<InsPlyIncome> auditedOrder = this.getUnauditOrderList(addReceivableVo.getOrderNo(), InsOrderStatusEnum.UNDERWRITED.getCode(), "0");
|
|
|
AssertionUtils.isEmpty(auditedOrder, "订单不存在");
|
|
AssertionUtils.isEmpty(auditedOrder, "订单不存在");
|
|
|
// 查看当前表是否已经存在了已审核订单数据
|
|
// 查看当前表是否已经存在了已审核订单数据
|
|
|
// Long count = baseMapper.selectCount(new LambdaQueryWrapper<InsPlyIncome>().eq(InsPlyIncome::getOrderNo, order.getOrderNo()));
|
|
// Long count = baseMapper.selectCount(new LambdaQueryWrapper<InsPlyIncome>().eq(InsPlyIncome::getOrderNo, order.getOrderNo()));
|
|
@@ -276,8 +277,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
};
|
|
};
|
|
|
// 签单时间
|
|
// 签单时间
|
|
|
Predicate<InsPlyIncome> signDatePredicate = insPlyIncome -> {
|
|
Predicate<InsPlyIncome> signDatePredicate = insPlyIncome -> {
|
|
|
- String signingTime = insPlyIncome.getSigningTime();
|
|
|
|
|
- if(StrUtil.isEmpty(signingTime)){
|
|
|
|
|
|
|
+ LocalDateTime signingTime = insPlyIncome.getSigningTime();
|
|
|
|
|
+ if(signingTime == null){
|
|
|
// 签单时间如果为空,说明是数据问题 先返回去,让业务去处理
|
|
// 签单时间如果为空,说明是数据问题 先返回去,让业务去处理
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -492,7 +493,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
if(!b){
|
|
if(!b){
|
|
|
List<String> invoiceIds = this.queryIncomeBindInvoice(invoicingVo);
|
|
List<String> invoiceIds = this.queryIncomeBindInvoice(invoicingVo);
|
|
|
invoice.setCanInvoice(false);
|
|
invoice.setCanInvoice(false);
|
|
|
- invoice.setErrMsg("订单已开票。发票序号是"+ invoiceIds.toString());
|
|
|
|
|
|
|
+ invoice.setErrMsg("订单已开票。发票编号是"+ invoiceIds.toString());
|
|
|
return invoice;
|
|
return invoice;
|
|
|
}
|
|
}
|
|
|
invoice.setCanInvoice(true);
|
|
invoice.setCanInvoice(true);
|
|
@@ -653,6 +654,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
public InvoiceingResult addInvoicing(InsPlyIncomeInvoiceVO invoicingVo) {
|
|
public InvoiceingResult addInvoicing(InsPlyIncomeInvoiceVO invoicingVo) {
|
|
|
log.info("开票:invoicingVo=[{}]", JSONUtil.toJsonStr(invoicingVo));
|
|
log.info("开票:invoicingVo=[{}]", JSONUtil.toJsonStr(invoicingVo));
|
|
|
try {
|
|
try {
|
|
|
|
|
+ this.valide4Invoicing(invoicingVo);
|
|
|
InvoiceingResult result = new InvoiceingResult();
|
|
InvoiceingResult result = new InvoiceingResult();
|
|
|
InsPlyIncomeInvoice invoice = new InsPlyIncomeInvoice();
|
|
InsPlyIncomeInvoice invoice = new InsPlyIncomeInvoice();
|
|
|
BeanUtils.copyProperties(invoicingVo, invoice);
|
|
BeanUtils.copyProperties(invoicingVo, invoice);
|
|
@@ -693,6 +695,21 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 开票前的校验
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author lipf
|
|
|
|
|
+ * @date 2026/5/28 9:25
|
|
|
|
|
+ */
|
|
|
|
|
+ private void valide4Invoicing(InsPlyIncomeInvoiceVO invoicingVo) {
|
|
|
|
|
+ if(invoicingVo == null){
|
|
|
|
|
+ throw new ServiceException("无法开票,开票参数为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StrUtil.isEmpty(invoicingVo.getInvoiceNo())){
|
|
|
|
|
+ throw new ServiceException("发票号不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public BigDecimal getInvoicingAmount(String invoicingId) {
|
|
public BigDecimal getInvoicingAmount(String invoicingId) {
|
|
|
BigDecimal ctualReceivedAmount = new BigDecimal(BigInteger.ZERO);
|
|
BigDecimal ctualReceivedAmount = new BigDecimal(BigInteger.ZERO);
|
|
@@ -712,36 +729,37 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
long result = 0;
|
|
long result = 0;
|
|
|
|
|
+ final String number = "1";
|
|
|
switch (invoiceType) {
|
|
switch (invoiceType) {
|
|
|
- case "1":
|
|
|
|
|
|
|
+ case number:
|
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
|
- .set(InsPlyIncome::getSuperviseSettlement, "1"));
|
|
|
|
|
|
|
+ .set(InsPlyIncome::getSuperviseSettlement, number));
|
|
|
break;
|
|
break;
|
|
|
case "2":
|
|
case "2":
|
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
|
- .set(InsPlyIncome::getOtherSettlement, "1"));
|
|
|
|
|
|
|
+ .set(InsPlyIncome::getOtherSettlement, number));
|
|
|
break;
|
|
break;
|
|
|
case "3":
|
|
case "3":
|
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
|
- .set(InsPlyIncome::getJySuperviseSettlement, "1"));
|
|
|
|
|
|
|
+ .set(InsPlyIncome::getJySuperviseSettlement, number));
|
|
|
break;
|
|
break;
|
|
|
case "4":
|
|
case "4":
|
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
|
- .set(InsPlyIncome::getJyOtherSettlement, "1"));
|
|
|
|
|
|
|
+ .set(InsPlyIncome::getJyOtherSettlement, number));
|
|
|
break;
|
|
break;
|
|
|
case "5":
|
|
case "5":
|
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
|
- .set(InsPlyIncome::getPlatformSuperviseSettlement, "1").set(InsPlyIncome::getSettlementStatus, "1"));
|
|
|
|
|
|
|
+ .set(InsPlyIncome::getPlatformSuperviseSettlement, number).set(InsPlyIncome::getSettlementStatus, number));
|
|
|
break;
|
|
break;
|
|
|
case "6":
|
|
case "6":
|
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
result = baseMapper.update(new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
.in(InsPlyIncome::getId, invoiceIds)
|
|
|
- .set(InsPlyIncome::getPlatformOtherSettlement, "1").set(InsPlyIncome::getSettlementStatus, "1"));
|
|
|
|
|
|
|
+ .set(InsPlyIncome::getPlatformOtherSettlement, number).set(InsPlyIncome::getSettlementStatus, number));
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
result = 0;
|
|
result = 0;
|
|
@@ -868,6 +886,137 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String exportTemplateReceivableList() {
|
|
|
|
|
+ List<InsPlyIncomeExportVo> emptyList = ListUtil.empty();
|
|
|
|
|
+
|
|
|
|
|
+ // 调用动态导出
|
|
|
|
|
+ return exportBaseService.upLoadFile(
|
|
|
|
|
+ InsPlyIncomeExportVo.class,
|
|
|
|
|
+ emptyList,
|
|
|
|
|
+ "私有协议应收-批量修改-导出模板-" + Instant.now()
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ImportUpdateExcelResultVo importReceivableListUpdate(MultipartFile file) {
|
|
|
|
|
+ String userName = baseController.getUserName();
|
|
|
|
|
+ log.info("用户[{}]导入平台协议文件",userName);
|
|
|
|
|
+ ImportUpdateExcelResultVo importExcelResultVo = new ImportUpdateExcelResultVo();
|
|
|
|
|
+ List<ReceivableExportExcelVo> receivableExportExcelVos = importReceivableExcel(file);
|
|
|
|
|
+ if (CollUtil.isEmpty(receivableExportExcelVos)){
|
|
|
|
|
+ throw new SystemException("数据不能为空,导入失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ AssertionUtils.isEmpty(receivableExportExcelVos, "数据处理失败,导入失败");
|
|
|
|
|
+ // 获取保司名称
|
|
|
|
|
+ HttpResult<List<EsmInsCompany>> listHttpResult = esmInsCompanyClient.liveCompanyList();
|
|
|
|
|
+ AssertionUtils.isFail(listHttpResult.getCode() != 200, listHttpResult.getMsg());
|
|
|
|
|
+
|
|
|
|
|
+ int failedNumber = 0;
|
|
|
|
|
+ List<ReceivableExportExcelVo> failedExcel = new ArrayList<>();
|
|
|
|
|
+ // 只存储需要【修改】的数据
|
|
|
|
|
+ List<InsPlyIncome> updateExcel = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 校验Excel内部保单号重复
|
|
|
|
|
+ Set<String> existPolicyNoSet = new HashSet<>();
|
|
|
|
|
+ Set<String> repeatPolicyNoSet = new HashSet<>();
|
|
|
|
|
+
|
|
|
|
|
+ for (ReceivableExportExcelVo vo : receivableExportExcelVos) {
|
|
|
|
|
+ String orderNo = vo.getOrderNo();
|
|
|
|
|
+ if (existPolicyNoSet.contains(orderNo)) {
|
|
|
|
|
+ repeatPolicyNoSet.add(orderNo);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ existPolicyNoSet.add(orderNo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理数据
|
|
|
|
|
+ for (ReceivableExportExcelVo vo : receivableExportExcelVos) {
|
|
|
|
|
+ // 1. 空数据校验
|
|
|
|
|
+ ImportResultVo resultVo = vo.checkEmpty();
|
|
|
|
|
+ if (!resultVo.isSuccess()) {
|
|
|
|
|
+ failedNumber++;
|
|
|
|
|
+ vo.setErrorMessage(resultVo.getMessage());
|
|
|
|
|
+ failedExcel.add(vo);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. Excel内部保单号重复
|
|
|
|
|
+ if (repeatPolicyNoSet.contains(vo.getOrderNo())) {
|
|
|
|
|
+ failedNumber++;
|
|
|
|
|
+ vo.setErrorMessage("订单号重复");
|
|
|
|
|
+ failedExcel.add(vo);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 查询数据库中是否已存在该订单号
|
|
|
|
|
+ InsPlyIncome existIncome = baseMapper.selectOne(new LambdaQueryWrapper<InsPlyIncome>()
|
|
|
|
|
+ .eq(InsPlyIncome::getOrderNo, vo.getOrderNo()));
|
|
|
|
|
+
|
|
|
|
|
+ // 数据库不存在 → 直接失败
|
|
|
|
|
+ if (Objects.isNull(existIncome)) {
|
|
|
|
|
+ failedNumber++;
|
|
|
|
|
+ vo.setErrorMessage("订单号不存在,不允许新增");
|
|
|
|
|
+ failedExcel.add(vo);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 数据库已存在 → 继续后续校验
|
|
|
|
|
+ // 判断已开票 / 已结算
|
|
|
|
|
+ String settlementFlag = "1";
|
|
|
|
|
+ if (settlementFlag.equals(existIncome.getSuperviseSettlement()) || settlementFlag.equals(existIncome.getOtherSettlement())
|
|
|
|
|
+ || settlementFlag.equals(existIncome.getJySuperviseSettlement()) || settlementFlag.equals(existIncome.getJyOtherSettlement())
|
|
|
|
|
+ || settlementFlag.equals(existIncome.getPlatformSuperviseSettlement()) || settlementFlag.equals(existIncome.getPlatformOtherSettlement())) {
|
|
|
|
|
+ failedNumber++;
|
|
|
|
|
+ vo.setErrorMessage("应收数据已结算");
|
|
|
|
|
+ failedExcel.add(vo);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 封装修改数据
|
|
|
|
|
+ InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
+ insPlyIncome.setId(existIncome.getId());
|
|
|
|
|
+ insPlyIncome.setLicenseNo(vo.getLicenseNo());
|
|
|
|
|
+ insPlyIncome.setJqPolicyNo(vo.getJqPolicyNo());
|
|
|
|
|
+ insPlyIncome.setJqSuperviseCostsProportion(vo.getJqSuperviseCostsProportion());
|
|
|
|
|
+ insPlyIncome.setJqOtherCostsProportion(vo.getJqOtherCostsProportion());
|
|
|
|
|
+ insPlyIncome.setSyPolicyNo(vo.getSyPolicyNo());
|
|
|
|
|
+ insPlyIncome.setSySuperviseCostsProportion(vo.getSySuperviseCostsProportion());
|
|
|
|
|
+ insPlyIncome.setSyOtherCostsProportion(vo.getSyOtherCostsProportion());
|
|
|
|
|
+ insPlyIncome.setJyPolicyNo(vo.getJyPolicyNo());
|
|
|
|
|
+ insPlyIncome.setJySuperviseCostsProportion(vo.getJySuperviseCostsProportion());
|
|
|
|
|
+ insPlyIncome.setJyOtherCostsProportion(vo.getJyOtherCostsProportion());
|
|
|
|
|
+ insPlyIncome.setContactPerson(vo.getDockingPerson());
|
|
|
|
|
+
|
|
|
|
|
+ // 加入修改列表
|
|
|
|
|
+ updateExcel.add(insPlyIncome);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 执行批量更新(只更新,不新增)
|
|
|
|
|
+ if (CollUtil.isNotEmpty(updateExcel)) {
|
|
|
|
|
+ baseMapper.updateById(updateExcel);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // ===================== 生成失败数据下载链接 =====================
|
|
|
|
|
+ String failFileUrl = "";
|
|
|
|
|
+ if (CollUtil.isNotEmpty(failedExcel)) {
|
|
|
|
|
+ failFileUrl = exportBaseService.upLoadFile(
|
|
|
|
|
+ ReceivableExportExcelVo.class,
|
|
|
|
|
+ failedExcel,
|
|
|
|
|
+ "平台协议应收-导入失败-" + Instant.now()
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 返回结果
|
|
|
|
|
+ importExcelResultVo.setFailedData(failedExcel);
|
|
|
|
|
+ importExcelResultVo.setFailFileUrl(failFileUrl);
|
|
|
|
|
+ importExcelResultVo.setSuccessNumber(updateExcel.size());
|
|
|
|
|
+ importExcelResultVo.setFailedNumber(failedNumber);
|
|
|
|
|
+
|
|
|
|
|
+ return importExcelResultVo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean settlement(SettlementVo settlementVo) {
|
|
public boolean settlement(SettlementVo settlementVo) {
|
|
@@ -1195,6 +1344,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
log.info("用户[{}]导入平台协议文件",userName);
|
|
log.info("用户[{}]导入平台协议文件",userName);
|
|
|
ImportUpdateExcelResultVo importExcelResultVo = new ImportUpdateExcelResultVo();
|
|
ImportUpdateExcelResultVo importExcelResultVo = new ImportUpdateExcelResultVo();
|
|
|
List<ReceivableExportExcelVo> receivableExportExcelVos = importReceivableExcel(file);
|
|
List<ReceivableExportExcelVo> receivableExportExcelVos = importReceivableExcel(file);
|
|
|
|
|
+ if (CollUtil.isEmpty(receivableExportExcelVos)){
|
|
|
|
|
+ throw new SystemException("数据不能为空,导入失败");
|
|
|
|
|
+ }
|
|
|
AssertionUtils.isEmpty(receivableExportExcelVos, "数据处理失败,导入失败");
|
|
AssertionUtils.isEmpty(receivableExportExcelVos, "数据处理失败,导入失败");
|
|
|
// 获取保司名称
|
|
// 获取保司名称
|
|
|
HttpResult<List<EsmInsCompany>> listHttpResult = esmInsCompanyClient.liveCompanyList();
|
|
HttpResult<List<EsmInsCompany>> listHttpResult = esmInsCompanyClient.liveCompanyList();
|
|
@@ -1251,9 +1403,10 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
|
|
|
|
|
// 数据库已存在 → 继续后续校验
|
|
// 数据库已存在 → 继续后续校验
|
|
|
// 判断已开票 / 已结算
|
|
// 判断已开票 / 已结算
|
|
|
- if ("1".equals(existIncome.getSuperviseSettlement()) || "1".equals(existIncome.getOtherSettlement())
|
|
|
|
|
- || "1".equals(existIncome.getJySuperviseSettlement()) || "1".equals(existIncome.getJyOtherSettlement())
|
|
|
|
|
- || "1".equals(existIncome.getPlatformSuperviseSettlement()) || "1".equals(existIncome.getPlatformOtherSettlement())) {
|
|
|
|
|
|
|
+ String settlementFlag = "1";
|
|
|
|
|
+ if (settlementFlag.equals(existIncome.getSuperviseSettlement()) || settlementFlag.equals(existIncome.getOtherSettlement())
|
|
|
|
|
+ || settlementFlag.equals(existIncome.getJySuperviseSettlement()) || settlementFlag.equals(existIncome.getJyOtherSettlement())
|
|
|
|
|
+ || settlementFlag.equals(existIncome.getPlatformSuperviseSettlement()) || settlementFlag.equals(existIncome.getPlatformOtherSettlement())) {
|
|
|
failedNumber++;
|
|
failedNumber++;
|
|
|
vo.setErrorMessage("应收数据已结算");
|
|
vo.setErrorMessage("应收数据已结算");
|
|
|
failedExcel.add(vo);
|
|
failedExcel.add(vo);
|
|
@@ -1397,68 +1550,74 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
return importExcelResultVo;
|
|
return importExcelResultVo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 私有协议批量修改
|
|
|
|
|
+ * 修改手续费比例(商业险手续费比例, 交强险手续费比例)
|
|
|
|
|
+ * 签单时间
|
|
|
|
|
+ * 对接人(对接人姓名,手机号)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author lipf
|
|
|
|
|
+ * @date 2026/5/27 20:25
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public boolean batchModify(BatchModifyVo batchModifyVo) {
|
|
public boolean batchModify(BatchModifyVo batchModifyVo) {
|
|
|
- List<InsPlyIncome> updateInsPlyIncome = new ArrayList<>();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ log.info("批量修改应收订单: batchModifyVo=[{}]", JSONUtil.toJsonStr(batchModifyVo));
|
|
|
|
|
+ List<String> incomeIds = batchModifyVo.getIncomeIds();
|
|
|
|
|
+ if(CollUtil.isEmpty(incomeIds)) {
|
|
|
|
|
+ throw new ServiceException("请勾选要批量修改的应收订单");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<String> insOrders = new ArrayList<>();
|
|
|
for (String incomeId : batchModifyVo.getIncomeIds()) {
|
|
for (String incomeId : batchModifyVo.getIncomeIds()) {
|
|
|
- InsPlyIncome insPlyIncome = baseMapper.selectById(incomeId);
|
|
|
|
|
- if (Objects.nonNull(insPlyIncome)) {
|
|
|
|
|
- if (Objects.nonNull(batchModifyVo.getJqSuperviseCostsProportion()) && batchModifyVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
- BigDecimal superviseReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJqPremium()), batchModifyVo.getJqSuperviseCostsProportion());
|
|
|
|
|
- insPlyIncome.setJqSuperviseCostsPremiums(superviseReceivablePremium.toString());
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.nonNull(batchModifyVo.getSySuperviseCostsProportion()) && batchModifyVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
- BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getSyPremium()), batchModifyVo.getSySuperviseCostsProportion());
|
|
|
|
|
- insPlyIncome.setSySuperviseCostsPremiums(otherReceivablePremium.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (Objects.nonNull(batchModifyVo.getJqOtherCostsProportion()) && batchModifyVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
- BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJqPremium()), batchModifyVo.getJqOtherCostsProportion());
|
|
|
|
|
- insPlyIncome.setJqOtherCostsPremiums(otherReceivablePremium.toString());
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.nonNull(batchModifyVo.getSyOtherCostsProportion()) && batchModifyVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
- BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getSyPremium()), batchModifyVo.getSyOtherCostsProportion());
|
|
|
|
|
- insPlyIncome.setSySuperviseCostsPremiums(otherReceivablePremium.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (Objects.nonNull(batchModifyVo.getJySuperviseCostsProportion()) && batchModifyVo.getJySuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
- BigDecimal jySuperviseReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJyPremium()), batchModifyVo.getJySuperviseCostsProportion());
|
|
|
|
|
- insPlyIncome.setJySuperviseCostsPremiums(jySuperviseReceivablePremium.toString());
|
|
|
|
|
- }
|
|
|
|
|
- if (Objects.nonNull(batchModifyVo.getJySuperviseCostsProportion()) && batchModifyVo.getJySuperviseCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
- BigDecimal jyOtherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJyPremium()), batchModifyVo.getJySuperviseCostsProportion());
|
|
|
|
|
- insPlyIncome.setJyOtherCostsPremiums(jyOtherReceivablePremium.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-// if (batchModifyVo.getSigningTime() != null){
|
|
|
|
|
-// insPlyIncome.setSigningTime(batchModifyVo.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ InsPlyIncome insPlyIncomeSource = baseMapper.selectById(incomeId);
|
|
|
|
|
+ if(insPlyIncomeSource == null) {
|
|
|
|
|
+ log.info("批量修改应收订单。序号为[{}]的应收订单不存在", incomeId);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ insOrders.add(insPlyIncomeSource.getOrderNo());
|
|
|
|
|
+ if (Objects.nonNull(batchModifyVo.getJqSuperviseCostsProportion()) && batchModifyVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ BigDecimal superviseReceivablePremium = calcReceivableAmount(new BigDecimal(Objects.toString(insPlyIncomeSource.getJqPremium(),"0") ), batchModifyVo.getJqSuperviseCostsProportion());
|
|
|
|
|
+ baseMapper.update(null, new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
|
|
+ .set(InsPlyIncome::getJqSuperviseCostsProportion, batchModifyVo.getJqSuperviseCostsProportion())
|
|
|
|
|
+ .set(InsPlyIncome::getJqSuperviseCostsPremiums, superviseReceivablePremium)
|
|
|
|
|
+ .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Objects.nonNull(batchModifyVo.getSySuperviseCostsProportion()) && batchModifyVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(Objects.toString(insPlyIncomeSource.getSyPremium(),"0")), batchModifyVo.getSySuperviseCostsProportion());
|
|
|
|
|
+ baseMapper.update(null, new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
|
|
+ .set(InsPlyIncome::getSySuperviseCostsProportion, batchModifyVo.getSySuperviseCostsProportion())
|
|
|
|
|
+ .set(InsPlyIncome::getSySuperviseCostsPremiums, otherReceivablePremium)
|
|
|
|
|
+ .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (batchModifyVo.getSigningTime() != null){
|
|
|
|
|
+ baseMapper.update(null, new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
|
|
+ .set(InsPlyIncome::getSigningTime, batchModifyVo.getSigningTime())
|
|
|
|
|
+ .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StrUtil.isNotEmpty(batchModifyVo.getContractUserName())){
|
|
|
|
|
+ baseMapper.update(null, new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
|
|
+ .set(InsPlyIncome::getContactPerson, batchModifyVo.getContractUserName())
|
|
|
|
|
+ .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
|
|
|
|
|
|
|
|
- updateInsPlyIncome.add(insPlyIncome);
|
|
|
|
|
}
|
|
}
|
|
|
- baseMapper.updateById(updateInsPlyIncome);
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ if(StrUtil.isNotEmpty(batchModifyVo.getContractPhone())){
|
|
|
|
|
+ baseMapper.update(null, new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
|
|
+ .set(InsPlyIncome::getContactPersonPhone, batchModifyVo.getContractPhone())
|
|
|
|
|
+ .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 批量修改
|
|
|
|
|
- baseMapper.update(new InsPlyIncome(), new LambdaUpdateWrapper<InsPlyIncome>()
|
|
|
|
|
- .set(InsPlyIncome::getJqSuperviseCostsProportion, batchModifyVo.getJqSuperviseCostsProportion())
|
|
|
|
|
- .set(InsPlyIncome::getSySuperviseCostsProportion, batchModifyVo.getSySuperviseCostsProportion())
|
|
|
|
|
- .set(InsPlyIncome::getJySuperviseCostsProportion, batchModifyVo.getJySuperviseCostsProportion())
|
|
|
|
|
- .set(InsPlyIncome::getJqOtherCostsProportion, batchModifyVo.getJqOtherCostsProportion())
|
|
|
|
|
- .set(InsPlyIncome::getSyOtherCostsProportion, batchModifyVo.getSyOtherCostsProportion())
|
|
|
|
|
- .set(InsPlyIncome::getJyOtherCostsProportion, batchModifyVo.getJyOtherCostsProportion())
|
|
|
|
|
-// .set(InsPlyIncome::getSigningTime, batchModifyVo.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
|
|
|
|
|
- .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
|
|
|
|
|
-
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ batchModifyVo.setOrderNos(insOrders);
|
|
|
|
|
+ HttpResult<String> updateOrdersRes = insFeeOrdersClient.updateOrdersBatch(batchModifyVo);
|
|
|
|
|
+ log.info("更新车险订单的结果:updateOrdersRes=[{}]", JSONUtil.toJsonStr(updateOrdersRes));
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public BigDecimal calcReceivableAmount(BigDecimal premium, BigDecimal ratio) {
|
|
public BigDecimal calcReceivableAmount(BigDecimal premium, BigDecimal ratio) {
|
|
|
|
|
+ if(premium==null||ratio==null) {
|
|
|
|
|
+ return BigDecimal.ZERO;
|
|
|
|
|
+ }
|
|
|
return premium.multiply(ratio);
|
|
return premium.multiply(ratio);
|
|
|
}
|
|
}
|
|
|
|
|
|