|
|
@@ -5114,17 +5114,32 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
* 3. 将完整数据设置回分页对象并返回
|
|
|
* </p>
|
|
|
*
|
|
|
- * @param receivableQueryVo 列表查询条件,包含订单号、保险公司ID、结算状态、时间范围等筛选条件,以及分页参数
|
|
|
+ * @param vo 列表查询条件,包含订单号、保险公司ID、结算状态、时间范围等筛选条件,以及分页参数
|
|
|
* @return Page<InsPlyIncome> 返回分页后的平台协议应收订单列表,包含完整的订单信息及关联数据
|
|
|
*/
|
|
|
@Override
|
|
|
- public Page<InsPlyIncome> getPlatFormReceivableList(ReceivableQueryVo receivableQueryVo) {
|
|
|
- log.info("获取平台协议列表. receivableQueryVo=[{}]", JSONUtil.toJsonStr(receivableQueryVo));
|
|
|
- Page<InsPlyIncome> page = baseMapper.getReceivablePage(receivableQueryVo.getPage(), receivableQueryVo);
|
|
|
+ public Page<InsPlyIncome> getPlatFormReceivableList(ReceivableQueryVo vo) {
|
|
|
+ log.info("获取平台协议列表. vo=[{}]", JSONUtil.toJsonStr(vo));
|
|
|
+
|
|
|
+ // 对支付时间进行增强适配, 在日期后面添加上时分秒
|
|
|
+ if(StrUtil.isNotEmpty(vo.getPayTimeBegin())){
|
|
|
+ vo.setPayTimeBegin(DateTimeUtils.obtainStartTime(vo.getPayTimeBegin()));
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(vo.getPayTimeEnd())){
|
|
|
+ vo.setPayTimeEnd(DateTimeUtils.obtainNextDayStartTime(vo.getPayTimeEnd()));
|
|
|
+ }
|
|
|
+ // 对报价时间进行增强适配
|
|
|
+ if(StrUtil.isNotEmpty(vo.getQuotationTimeBegin())){
|
|
|
+ vo.setQuotationTimeBegin(DateTimeUtils.obtainStartTime(vo.getQuotationTimeBegin()));
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(vo.getQuotationTimeEnd())){
|
|
|
+ vo.setQuotationTimeEnd(DateTimeUtils.obtainNextDayStartTime(vo.getQuotationTimeEnd()));
|
|
|
+ }
|
|
|
+ Page<InsPlyIncome> page = baseMapper.getReceivablePage(vo.getPage(), vo);
|
|
|
List<InsPlyIncome> records = page.getRecords();
|
|
|
records = this.fillOtherInfo(records,null);
|
|
|
// 过滤业务来源
|
|
|
- records = records.stream().filter(income -> StrUtil.isBlank(receivableQueryVo.getTypeAttr()) || receivableQueryVo.getTypeAttr().equals(income.getTypeAttr())).collect(Collectors.toList());
|
|
|
+ records = records.stream().filter(income -> StrUtil.isBlank(vo.getTypeAttr()) || vo.getTypeAttr().equals(income.getTypeAttr())).collect(Collectors.toList());
|
|
|
page.setRecords(records);
|
|
|
return page;
|
|
|
}
|
|
|
@@ -5429,26 +5444,32 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
/**
|
|
|
* 平台协议结算记录
|
|
|
*
|
|
|
- * @param settlementQueryVo 查询条件
|
|
|
+ * @param vo 查询条件
|
|
|
* @return Page<ExportSuperviseSettlementExcelDto>
|
|
|
*/
|
|
|
@Override
|
|
|
- public Page<ExportSuperviseSettlementExcelDto> platformSettlementExcel(Page page, SettlementQueryVo settlementQueryVo) {
|
|
|
- log.info("查询平台结算记录:settlementQueryVo=[{}]", JSONUtil.toJsonStr(settlementQueryVo));
|
|
|
+ public Page<ExportSuperviseSettlementExcelDto> platformSettlementExcel(Page page, SettlementQueryVo vo) {
|
|
|
+ log.info("查询平台结算记录:vo=[{}]", JSONUtil.toJsonStr(vo));
|
|
|
|
|
|
- if(StrUtil.isEmpty(settlementQueryVo.getSettlementDateStart())
|
|
|
- && StrUtil.isEmpty(settlementQueryVo.getSettlementDateEnd())
|
|
|
- && settlementQueryVo.getSettlementTime() != null &&
|
|
|
- settlementQueryVo.getSettlementTime().length ==2){
|
|
|
- DateUtil.parse(settlementQueryVo.getSettlementDateStart());
|
|
|
- settlementQueryVo.setSettlementDateStart(DateUtil.format(LocalDate.parse(settlementQueryVo.getSettlementTime()[0], DateTimeFormatter.ISO_DATE).atStartOfDay(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
- settlementQueryVo.setSettlementDateEnd(DateUtil.format(LocalDate.parse(settlementQueryVo.getSettlementTime()[1], DateTimeFormatter.ISO_DATE).plusDays(1).atStartOfDay(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ if(StrUtil.isEmpty(vo.getSettlementDateStart())
|
|
|
+ && StrUtil.isEmpty(vo.getSettlementDateEnd())
|
|
|
+ && vo.getSettlementTime() != null &&
|
|
|
+ vo.getSettlementTime().length ==2){
|
|
|
+ DateUtil.parse(vo.getSettlementDateStart());
|
|
|
+ vo.setSettlementDateStart(DateUtil.format(LocalDate.parse(vo.getSettlementTime()[0], DateTimeFormatter.ISO_DATE).atStartOfDay(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ vo.setSettlementDateEnd(DateUtil.format(LocalDate.parse(vo.getSettlementTime()[1], DateTimeFormatter.ISO_DATE).plusDays(1).atStartOfDay(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ }
|
|
|
+ // 完善回款时间 receivePaymentDateBegin
|
|
|
+ if(StrUtil.isNotEmpty(vo.getReceivePaymentDateBegin())){
|
|
|
+ vo.setReceivePaymentDateBegin(DateTimeUtils.obtainStartTime(vo.getReceivePaymentDateBegin()));
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(vo.getReceivePaymentDateEnd())){
|
|
|
+ vo.setReceivePaymentDateEnd(DateTimeUtils.obtainNextDayStartTime(vo.getReceivePaymentDateEnd()));
|
|
|
}
|
|
|
-
|
|
|
// 设置空条件
|
|
|
- setNoneCondition(settlementQueryVo);
|
|
|
- settlementQueryVo.setSystemCode(baseController.getSystemCode());
|
|
|
- Page<ExportSuperviseSettlementExcelDto> exportSuperviseSettlementExcelDtos = baseMapper.platformSettlementExcelDtos(page, settlementQueryVo);
|
|
|
+ setNoneCondition(vo);
|
|
|
+ vo.setSystemCode(baseController.getSystemCode());
|
|
|
+ Page<ExportSuperviseSettlementExcelDto> exportSuperviseSettlementExcelDtos = baseMapper.platformSettlementExcelDtos(page, vo);
|
|
|
// 补充、转换列表的数据
|
|
|
supplementaryListData(exportSuperviseSettlementExcelDtos);
|
|
|
return exportSuperviseSettlementExcelDtos;
|
|
|
@@ -5645,7 +5666,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
* </p>
|
|
|
*
|
|
|
* @param page 分页对象,包含页码、每页数量等分页参数
|
|
|
- * @param settlementQueryVo 结算查询条件,包含订单号、保险公司ID、结算状态、时间范围等筛选条件,主要参数:
|
|
|
+ * @param vo 结算查询条件,包含订单号、保险公司ID、结算状态、时间范围等筛选条件,主要参数:
|
|
|
* - invoiceTypes: 开票类型列表,用于区分平台协议和普通协议
|
|
|
* - systemCode: 租户代码(方法内自动设置)
|
|
|
* @return Page<ExportSuperviseSettlementDetailExcelDto> 返回分页后的手续费结算明细数据,每个对象包含:
|
|
|
@@ -5654,9 +5675,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
* - 其他结算明细字段
|
|
|
*/
|
|
|
@Override
|
|
|
- public Page<ExportSuperviseSettlementDetailExcelDto> superviseSettlementDetailExcel(Page page, SettlementQueryVo settlementQueryVo) {
|
|
|
- log.info("superviseSettlementDetailExcel:settlementQueryVo=[{}]", JSONUtil.toJsonStr(settlementQueryVo));
|
|
|
- settlementQueryVo.setSystemCode(baseController.getSystemCode());
|
|
|
+ public Page<ExportSuperviseSettlementDetailExcelDto> superviseSettlementDetailExcel(Page page, SettlementQueryVo vo) {
|
|
|
+ log.info("superviseSettlementDetailExcel:vo=[{}]", JSONUtil.toJsonStr(vo));
|
|
|
+ vo.setSystemCode(baseController.getSystemCode());
|
|
|
Page<ExportSuperviseSettlementDetailExcelDto> exportSuperviseSettlementDetailExcelDtos = null;
|
|
|
|
|
|
// 1. 一次性获取保险公司全量Map,全局复用
|
|
|
@@ -5666,41 +5687,46 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
}
|
|
|
|
|
|
// 查询当前公司下所有的子公司
|
|
|
- if (StrUtil.isNotBlank(settlementQueryVo.getCompanyId())){
|
|
|
+ if (StrUtil.isNotBlank(vo.getCompanyId())){
|
|
|
// 将全量数据按照 parentId 进行分组,key 是 parentId,value 是该 parentId 下的所有公司列表
|
|
|
Map<String, List<EsmInsCompany>> parentGroupMap = companyMap.values().stream()
|
|
|
.filter(c -> c.getParentId() != null)
|
|
|
.collect(Collectors.groupingBy(EsmInsCompany::getParentId));
|
|
|
- List<String> allChildIdspOtimized = getAllChildIdsOptimized(settlementQueryVo.getCompanyId(), parentGroupMap);
|
|
|
- allChildIdspOtimized.add(settlementQueryVo.getCompanyId());
|
|
|
- settlementQueryVo.setCompanyIdList(allChildIdspOtimized);
|
|
|
+ List<String> allChildIdspOtimized = getAllChildIdsOptimized(vo.getCompanyId(), parentGroupMap);
|
|
|
+ allChildIdspOtimized.add(vo.getCompanyId());
|
|
|
+ vo.setCompanyIdList(allChildIdspOtimized);
|
|
|
}
|
|
|
-
|
|
|
- if (settlementQueryVo.getInvoiceTypes().contains("5") && settlementQueryVo.getInvoiceTypes().contains("6")) {
|
|
|
- exportSuperviseSettlementDetailExcelDtos = baseMapper.getPlatFormSettlementDetailExcelDtos(page, settlementQueryVo);
|
|
|
+ if(StrUtil.isNotEmpty(vo.getSigningTimeBegin())){
|
|
|
+ vo.setSigningTimeBegin(DateTimeUtils.obtainStartTime(vo.getSigningTimeBegin()));
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(vo.getSigningTimeEnd())){
|
|
|
+ vo.setSigningTimeEnd(DateTimeUtils.obtainNextDayStartTime(vo.getSigningTimeEnd()));
|
|
|
+ }
|
|
|
+ if (vo.getInvoiceTypes().contains("5") && vo.getInvoiceTypes().contains("6")) {
|
|
|
+ exportSuperviseSettlementDetailExcelDtos = baseMapper.getPlatFormSettlementDetailExcelDtos(page, vo);
|
|
|
}else{
|
|
|
- exportSuperviseSettlementDetailExcelDtos = baseMapper.getSuperviseSettlementDetailExcelDtos(page, settlementQueryVo);
|
|
|
+ exportSuperviseSettlementDetailExcelDtos = baseMapper.getSuperviseSettlementDetailExcelDtos(page, vo);
|
|
|
}
|
|
|
if (CollUtil.isNotEmpty(exportSuperviseSettlementDetailExcelDtos.getRecords())){
|
|
|
Map<String, InsPlyIncomeInvoiceSettlement> settlementMap = new HashMap<>();
|
|
|
- if (!(settlementQueryVo.getInvoiceTypes().contains("5") && settlementQueryVo.getInvoiceTypes().contains("6"))) {
|
|
|
+ if (!(vo.getInvoiceTypes().contains("5") && vo.getInvoiceTypes().contains("6"))) {
|
|
|
// 根据invoiceId关联查询ins_ply_income_invoice_settlement表
|
|
|
LambdaQueryWrapper<InsPlyIncomeInvoiceSettlement> insPlyIncomeInvoiceSettlementLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
insPlyIncomeInvoiceSettlementLambdaQueryWrapper.in(InsPlyIncomeInvoiceSettlement::getInvoiceId, exportSuperviseSettlementDetailExcelDtos.getRecords().stream().map(ExportSuperviseSettlementDetailExcelDto::getInvoiceId).toList());
|
|
|
insPlyIncomeInvoiceSettlementLambdaQueryWrapper.eq(InsPlyIncomeInvoiceSettlement::getIsDelete, 0);
|
|
|
- if (StrUtil.isNotBlank(settlementQueryVo.getSettlementPerson())) {
|
|
|
+ if (StrUtil.isNotBlank(vo.getSettlementPerson())) {
|
|
|
// 结算人
|
|
|
- insPlyIncomeInvoiceSettlementLambdaQueryWrapper.eq(InsPlyIncomeInvoiceSettlement::getCreateBy, settlementQueryVo.getSettlementPerson());
|
|
|
+ insPlyIncomeInvoiceSettlementLambdaQueryWrapper.eq(InsPlyIncomeInvoiceSettlement::getCreateBy, vo.getSettlementPerson());
|
|
|
}
|
|
|
- if (StrUtil.isNotBlank(settlementQueryVo.getSettlementTimeStart()) && StrUtil.isNotBlank(settlementQueryVo.getSettlementTimeEnd())) {
|
|
|
+ if (StrUtil.isNotBlank(vo.getSettlementTimeStart()) && StrUtil.isNotBlank(vo.getSettlementTimeEnd())) {
|
|
|
// 结算时间
|
|
|
- insPlyIncomeInvoiceSettlementLambdaQueryWrapper.between(StrUtil.isNotBlank(settlementQueryVo.getSettlementTimeStart()) && StrUtil.isNotBlank(settlementQueryVo.getSettlementTimeEnd()),
|
|
|
- InsPlyIncomeInvoiceSettlement::getCreateTime, settlementQueryVo.getSettlementTimeStart(), settlementQueryVo.getSettlementTimeEnd());
|
|
|
+ insPlyIncomeInvoiceSettlementLambdaQueryWrapper.between(StrUtil.isNotBlank(vo.getSettlementTimeStart()) && StrUtil.isNotBlank(vo.getSettlementTimeEnd()),
|
|
|
+ InsPlyIncomeInvoiceSettlement::getCreateTime, vo.getSettlementTimeStart(), vo.getSettlementTimeEnd());
|
|
|
}
|
|
|
List<InsPlyIncomeInvoiceSettlement> insPlyIncomeInvoiceSettlements = insPlyIncomeInvoiceSettlementMapper.selectList(insPlyIncomeInvoiceSettlementLambdaQueryWrapper);
|
|
|
// 如果结算记录不为空,且结算人、结算时间不为空,则根据结算记录的invoiceId过滤列表
|
|
|
if (CollUtil.isNotEmpty(insPlyIncomeInvoiceSettlements)) {
|
|
|
- if (StrUtil.isNotBlank(settlementQueryVo.getSettlementPerson()) || (StrUtil.isNotBlank(settlementQueryVo.getSettlementTimeStart()) && StrUtil.isNotBlank(settlementQueryVo.getSettlementTimeEnd()))) {
|
|
|
+ if (StrUtil.isNotBlank(vo.getSettlementPerson()) || (StrUtil.isNotBlank(vo.getSettlementTimeStart()) && StrUtil.isNotBlank(vo.getSettlementTimeEnd()))) {
|
|
|
List<String> invoiceList = insPlyIncomeInvoiceSettlements.stream().map(InsPlyIncomeInvoiceSettlement::getInvoiceId).toList();
|
|
|
// filter:lambda 返回 true 的元素留下,false 的剔除
|
|
|
exportSuperviseSettlementDetailExcelDtos.setRecords(exportSuperviseSettlementDetailExcelDtos.getRecords().stream().filter(detail -> invoiceList.contains(detail.getInvoiceId())).toList());
|