|
@@ -5,21 +5,12 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.jzg.commons.constants.ProductsType;
|
|
|
|
|
-import com.jzg.commons.core.base.BaseController;
|
|
|
|
|
-import com.jzg.commons.core.page.HttpResult;
|
|
|
|
|
import com.jzg.commons.entity.finance.po.InsPlyIncome;
|
|
import com.jzg.commons.entity.finance.po.InsPlyIncome;
|
|
|
import com.jzg.commons.entity.finance.vo.importimcome.*;
|
|
import com.jzg.commons.entity.finance.vo.importimcome.*;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
|
|
import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
|
|
|
-import com.jzg.commons.entity.quote.vo.orders.InsOrdersVo;
|
|
|
|
|
-import com.jzg.commons.entity.vo.AgreementVo;
|
|
|
|
|
-import com.jzg.commons.entity.vo.InsFeeOrdersVo;
|
|
|
|
|
-import com.jzg.commons.util.idgen.IdGenerate;
|
|
|
|
|
-import com.jzg.organization.client.InsOrdersClient;
|
|
|
|
|
import com.jzg.organization.excel.listener.InvoiceReceivbleExcel4AllListener;
|
|
import com.jzg.organization.excel.listener.InvoiceReceivbleExcel4AllListener;
|
|
|
import com.jzg.organization.mapper.InsOrdersPolicyMapper;
|
|
import com.jzg.organization.mapper.InsOrdersPolicyMapper;
|
|
|
import com.jzg.organization.mapper.InsPlyIncomeMapper;
|
|
import com.jzg.organization.mapper.InsPlyIncomeMapper;
|
|
|
-import com.jzg.organization.mapper.PtlAgreementMapper;
|
|
|
|
|
import com.jzg.organization.service.impl.ExportBaseServiceImpl;
|
|
import com.jzg.organization.service.impl.ExportBaseServiceImpl;
|
|
|
import com.jzg.organization.service.importincome.ImportIncomeService;
|
|
import com.jzg.organization.service.importincome.ImportIncomeService;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -30,8 +21,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
|
-import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -45,13 +34,9 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ExportBaseServiceImpl exportBaseService;
|
|
private ExportBaseServiceImpl exportBaseService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private BaseController baseController;
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsOrdersClient insOrdersClient;
|
|
|
|
|
- @Autowired
|
|
|
|
|
private InsOrdersPolicyMapper insOrdersPolicyMapper;
|
|
private InsOrdersPolicyMapper insOrdersPolicyMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private PtlAgreementMapper ptlAgreementMapper;
|
|
|
|
|
|
|
+ private InsPlyIncomeMapper insPlyIncomeMapper;
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(ImportIncomeServiceImpl.class);
|
|
private static final Logger log = LoggerFactory.getLogger(ImportIncomeServiceImpl.class);
|
|
|
|
|
|
|
@@ -107,89 +92,6 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
|
|
|
return importExcelResultVo;
|
|
return importExcelResultVo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 对表格中的内容进行扩展
|
|
|
|
|
- *
|
|
|
|
|
- * @param excelContents
|
|
|
|
|
- * @author lipf
|
|
|
|
|
- * @date 2026/8/4 9:22
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public List<ImportContentExt> fillExcelContent4Private(List<ExcelContent4PrivateSuperviseNoCar> excelContents) {
|
|
|
|
|
- log.info("为私有订单填充数据:excelContents.size=[{}]", CollUtil.size(excelContents));
|
|
|
|
|
- return List.of();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 批量处理数据
|
|
|
|
|
- * @param updateExcel 要修改的数据
|
|
|
|
|
- * @param insertExcel 要新增的数据
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public ImportContentExt spliceData(ImportContentExt vo,
|
|
|
|
|
- List<InsPlyIncome> insertExcel,
|
|
|
|
|
- List<InsPlyIncome> updateExcel) {
|
|
|
|
|
-
|
|
|
|
|
- // 查询数据库中是否已存在该保单号
|
|
|
|
|
- InsPlyIncome existIncome = baseMapper.selectOne(new LambdaQueryWrapper<InsPlyIncome>()
|
|
|
|
|
- .eq(InsPlyIncome::getJqPolicyNo, vo.getJqPolicyNo()));
|
|
|
|
|
-
|
|
|
|
|
- // 封装修改数据
|
|
|
|
|
- InsPlyIncome insPlyIncome = new InsPlyIncome();
|
|
|
|
|
- BeanUtil.copyProperties(vo,insPlyIncome);
|
|
|
|
|
- insPlyIncome.setId(IdGenerate.nextId());
|
|
|
|
|
- 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());
|
|
|
|
|
- // 签单时间
|
|
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
- insPlyIncome.setSigningTime(LocalDateTime.parse(vo.getSigningTime(), formatter));
|
|
|
|
|
-// // 协议编号
|
|
|
|
|
-// insPlyIncome.setAgreementId(ptlAgreement.getId());
|
|
|
|
|
-// insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
|
|
|
|
|
-// insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
|
|
|
|
|
-// insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
|
|
|
|
|
- // 险种编号
|
|
|
|
|
- insPlyIncome.setProductId(ProductsType.getCodeByDesc(vo.getProductName()));
|
|
|
|
|
- // 险种名称
|
|
|
|
|
- insPlyIncome.setProductName(vo.getProductName());
|
|
|
|
|
- // 被保险人姓名
|
|
|
|
|
- insPlyIncome.setInsuredPerson(vo.getInsuredPerson());
|
|
|
|
|
- // 对接人信息
|
|
|
|
|
- insPlyIncome.setContactPerson(vo.getContactPerson());
|
|
|
|
|
- insPlyIncome.setContactPersonPhone(vo.getContactPersonPhone());
|
|
|
|
|
- // 数据库不存在 → 直接失败
|
|
|
|
|
- if (Objects.isNull(existIncome)) {
|
|
|
|
|
- // 加入修改列表
|
|
|
|
|
- // 机构id
|
|
|
|
|
- insPlyIncome.setDeptId(baseController.getUserDeptId());
|
|
|
|
|
- insPlyIncome.setOrderNo(vo.getOrderNo());
|
|
|
|
|
- insertExcel.add(insPlyIncome);
|
|
|
|
|
- }else{
|
|
|
|
|
- // 数据库已存在 → 继续后续校验
|
|
|
|
|
- // 判断已开票 / 已结算
|
|
|
|
|
- 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())) {
|
|
|
|
|
- vo.setErrorMessage("应收数据已结算");
|
|
|
|
|
- return vo;
|
|
|
|
|
- }
|
|
|
|
|
- insPlyIncome.setId(existIncome.getId());
|
|
|
|
|
- // 加入修改列表
|
|
|
|
|
- updateExcel.add(insPlyIncome);
|
|
|
|
|
- }
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 对表格中的内容进行扩展
|
|
* 对表格中的内容进行扩展
|
|
|
* <p>
|
|
* <p>
|
|
@@ -244,28 +146,31 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
|
|
|
}
|
|
}
|
|
|
log.info("处理订单号是[{}]的订单",orderNO);
|
|
log.info("处理订单号是[{}]的订单",orderNO);
|
|
|
ext.setOrderNo(orderNO);
|
|
ext.setOrderNo(orderNO);
|
|
|
- HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(orderNO);
|
|
|
|
|
- InsOrdersVo data = insOrdersVoHttpResult.getData();
|
|
|
|
|
- if (data!= null){
|
|
|
|
|
- BeanUtil.copyProperties(data,ext);
|
|
|
|
|
- if(data.getSigningTime() != null){
|
|
|
|
|
- ext.setSigningTime(data.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
|
|
- }
|
|
|
|
|
- String agreementId = data.getAgreementId();
|
|
|
|
|
- if(StrUtil.isNotEmpty(agreementId)){
|
|
|
|
|
- AgreementVo agreementVo = ptlAgreementMapper.queryById(agreementId);
|
|
|
|
|
- if(agreementVo != null){
|
|
|
|
|
- ext.setPartnerCompanyId(agreementVo.getPartnerCompanyId());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- InsFeeOrdersVo feeOrdersVo = data.getFeeOrdersVo();
|
|
|
|
|
- if(BeanUtil.isEmpty(feeOrdersVo)){
|
|
|
|
|
- ext.setJqPremium(feeOrdersVo.getJqPremium());
|
|
|
|
|
- ext.setSyPremium(feeOrdersVo.getSyPremium());
|
|
|
|
|
- ext.setJyPremium(feeOrdersVo.getJyPremium());
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ LambdaQueryWrapper<InsPlyIncome> wrapper = new LambdaQueryWrapper();
|
|
|
|
|
+ wrapper.eq(InsPlyIncome::getOrderNo,orderNO);
|
|
|
|
|
+ List<InsPlyIncome> insPlyIncomes = insPlyIncomeMapper.selectList(wrapper);
|
|
|
|
|
+ if(CollUtil.isEmpty(insPlyIncomes)){
|
|
|
|
|
+ log.info("订单号为[{}]的数据没有进入应收",orderNO);
|
|
|
|
|
+ continue;
|
|
|
}
|
|
}
|
|
|
|
|
+ InsPlyIncome insPlyIncome = insPlyIncomes.get(0);
|
|
|
|
|
+
|
|
|
|
|
+ ext.setIncomeId(insPlyIncome.getId());
|
|
|
|
|
+ ext.setContactPerson(insPlyIncome.getContactPerson());
|
|
|
|
|
+ ext.setParternerCompanyId(insPlyIncome.getPartnerCompanyId());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 校验 手续费等比例是否一致
|
|
|
|
|
+ String jqSuperviseCostsProportion = insPlyIncome.getJqSuperviseCostsProportion();
|
|
|
|
|
+ String sySuperviseCostsProportion = insPlyIncome.getSySuperviseCostsProportion();
|
|
|
|
|
+ String jySuperviseCostsProportion = insPlyIncome.getJySuperviseCostsProportion();
|
|
|
|
|
+ String jqOtherCostsProportion = insPlyIncome.getJqOtherCostsProportion();
|
|
|
|
|
+ String syOtherCostsProportion = insPlyIncome.getSyOtherCostsProportion();
|
|
|
|
|
+ String jyOtherCostsProportion = insPlyIncome.getJyOtherCostsProportion();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
res.add(ext);
|
|
res.add(ext);
|
|
|
}
|
|
}
|
|
|
return res;
|
|
return res;
|