|
@@ -3,6 +3,7 @@ package com.jzg.organization.service.impl;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
@@ -13,6 +14,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
import com.jzg.commons.core.base.BaseController;
|
|
import com.jzg.commons.core.base.BaseController;
|
|
|
import com.jzg.commons.core.page.HttpResult;
|
|
import com.jzg.commons.core.page.HttpResult;
|
|
|
|
|
+import com.jzg.commons.entity.Constant;
|
|
|
import com.jzg.commons.entity.finance.dto.*;
|
|
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.*;
|
|
@@ -33,6 +35,7 @@ import com.jzg.organization.excel.listener.ReceivbleExcelListener;
|
|
|
import com.jzg.organization.excel.listener.SuperviseExcelListener;
|
|
import com.jzg.organization.excel.listener.SuperviseExcelListener;
|
|
|
import com.jzg.organization.mapper.*;
|
|
import com.jzg.organization.mapper.*;
|
|
|
import com.jzg.organization.service.ReceivableService;
|
|
import com.jzg.organization.service.ReceivableService;
|
|
|
|
|
+import com.jzg.organization.service.SysUserJzgInfoSalesmanService;
|
|
|
import org.redisson.api.RBucket;
|
|
import org.redisson.api.RBucket;
|
|
|
import org.redisson.api.RKeys;
|
|
import org.redisson.api.RKeys;
|
|
|
import org.redisson.api.RedissonClient;
|
|
import org.redisson.api.RedissonClient;
|
|
@@ -61,6 +64,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.function.BiConsumer;
|
|
import java.util.function.BiConsumer;
|
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
|
|
|
+import java.util.function.Predicate;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -102,6 +106,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ExportBaseServiceImpl exportBaseService;
|
|
private ExportBaseServiceImpl exportBaseService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SysUserJzgInfoSalesmanService sysUserJzgInfoSalesmanService;
|
|
|
|
|
|
|
|
@Value("${upload.file.path}")
|
|
@Value("${upload.file.path}")
|
|
|
private String uploadPath;
|
|
private String uploadPath;
|
|
@@ -170,7 +176,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Page<InsPlyIncome> getReceivablePage(ReceivableQueryVo receivableQueryVo) {
|
|
public Page<InsPlyIncome> getReceivablePage(ReceivableQueryVo receivableQueryVo) {
|
|
|
- log.info("获取私有协议手续费列表。receivableQueryVo=[{}]", JSONUtil.toJsonStr(receivableQueryVo));
|
|
|
|
|
|
|
+ log.info("获取私有协议手续费应收列表。receivableQueryVo=[{}]", JSONUtil.toJsonStr(receivableQueryVo));
|
|
|
Page<InsPlyIncome> page = baseMapper.getReceivablePage(receivableQueryVo.getPage(), receivableQueryVo);
|
|
Page<InsPlyIncome> page = baseMapper.getReceivablePage(receivableQueryVo.getPage(), receivableQueryVo);
|
|
|
List<InsPlyIncome> records = page.getRecords();
|
|
List<InsPlyIncome> records = page.getRecords();
|
|
|
records = this.fillOtherInfo(records);
|
|
records = this.fillOtherInfo(records);
|
|
@@ -178,6 +184,200 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
return page;
|
|
return page;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 应收数据二次过滤
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param incomeDataVO 过滤条件
|
|
|
|
|
+ * @author lipf
|
|
|
|
|
+ * @date 2026/5/12 14:22
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<List<InsPlyIncome>> queryIncomeDatas(IncomeDataVO incomeDataVO) {
|
|
|
|
|
+ log.info("应收数据的二次过滤:incomeDataVO=[{}]", JSONUtil.toJsonStr(incomeDataVO));
|
|
|
|
|
+ List<String> orderNos = incomeDataVO.getOrderNos();
|
|
|
|
|
+ String companyId = incomeDataVO.getCompanyId();
|
|
|
|
|
+// if(CollUtil.isEmpty(orderNos)){
|
|
|
|
|
+// log.info("应收数据的二次过滤: 订单号不能为空");
|
|
|
|
|
+// return HttpResult.error("请勾选要处理的订单信息");
|
|
|
|
|
+// }
|
|
|
|
|
+// if (StrUtil.isEmpty(companyId)) {
|
|
|
|
|
+// log.info("应收数据的二次过滤. 保司不能为空");
|
|
|
|
|
+// return HttpResult.error("保司不能为空");
|
|
|
|
|
+// }
|
|
|
|
|
+// if(!"and".equalsIgnoreCase(incomeDataVO.getLogicJudge()) && "20".equalsIgnoreCase(incomeDataVO.getLogicJudge())){
|
|
|
|
|
+// log.info("应收数据的二次过滤. 逻辑条件必须是and或or");
|
|
|
|
|
+// return HttpResult.error("逻辑条件必须是and或or");
|
|
|
|
|
+// }
|
|
|
|
|
+ List<InsPlyIncome> incomes = baseMapper.queryIncomeDatasByOrderIds(orderNos,companyId);
|
|
|
|
|
+ log.info("根据订单号和保司id查询出[{}]条记录。 orderNos =[{}],companyId=[{}]",CollUtil.size(incomes), JSONUtil.toJsonStr(orderNos), companyId);
|
|
|
|
|
+ List<InsPlyIncome> filterIncomes = new ArrayList<>();
|
|
|
|
|
+ if(CollUtil.isEmpty(incomeDataVO.getSearchList())){
|
|
|
|
|
+ filterIncomes = incomes;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ List<IncomeDataVO.SearchVO> searchParams = incomeDataVO.getSearchList();
|
|
|
|
|
+ if(CollUtil.isNotEmpty(searchParams)){
|
|
|
|
|
+ Map<String, IncomeDataVO.SearchVO> searchVOMap = searchParams.stream()
|
|
|
|
|
+ .filter(action -> StrUtil.isNotEmpty(action.getName()))
|
|
|
|
|
+ .collect(Collectors.toMap(IncomeDataVO.SearchVO::getName, Function.identity(), (ole_item, new_item) -> ole_item));
|
|
|
|
|
+ Set<String> names =searchVOMap.keySet();
|
|
|
|
|
+
|
|
|
|
|
+ // 保险公司
|
|
|
|
|
+ Predicate<InsPlyIncome> companyIdPredicate = insPlyIncome -> {
|
|
|
|
|
+ if(!names.contains(IncomeDataVO.SearchVO.companyId)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ IncomeDataVO.SearchVO searchVO = searchVOMap.get(IncomeDataVO.SearchVO.companyId);
|
|
|
|
|
+ String type = searchVO.getType();
|
|
|
|
|
+ String search = searchVO.getSearch();
|
|
|
|
|
+ if("为空".equals(type)|| "不为空".equals(type)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果填写的查询条件,不完善,则该条件不进行过滤
|
|
|
|
|
+ if(StrUtil.isEmpty(search)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> companyIds = Arrays.asList(search.split(","));
|
|
|
|
|
+ return companyIds.contains(insPlyIncome.getCompanyId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> companyIds = Arrays.asList(search.split(","));
|
|
|
|
|
+ return !companyIds.contains(insPlyIncome.getCompanyId());
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ };
|
|
|
|
|
+ // 签单时间
|
|
|
|
|
+ Predicate<InsPlyIncome> signDatePredicate = insPlyIncome -> {
|
|
|
|
|
+ String signingTime = insPlyIncome.getSigningTime();
|
|
|
|
|
+ if(StrUtil.isEmpty(signingTime)){
|
|
|
|
|
+ // 签单时间如果为空,说明是数据问题 先返回去,让业务去处理
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!names.contains(IncomeDataVO.SearchVO.signDate)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ IncomeDataVO.SearchVO searchVO = searchVOMap.get(IncomeDataVO.SearchVO.signDate);
|
|
|
|
|
+ String type = searchVO.getType();
|
|
|
|
|
+ String search = searchVO.getSearch();
|
|
|
|
|
+ if("为空".equals(type)|| "不为空".equals(type)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果填写的查询条件,不完善,则该条件不进行过滤
|
|
|
|
|
+ if(StrUtil.isEmpty(search)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StrUtil.isEmpty(insPlyIncome.getSignDate())){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ String[] split = search.split(",");
|
|
|
|
|
+ String signDateStart = split.length>=1 && StrUtil.isNotEmpty(split[0]) ? split[0].substring(0,10):"";
|
|
|
|
|
+ String signDateEnd = split.length>=2 && StrUtil.isNotEmpty(split[1]) ? split[1].substring(0,10):"";
|
|
|
|
|
+ if("大于等于".equals(type)){
|
|
|
|
|
+ return insPlyIncome.getSignDate().compareTo(signDateStart) >=0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if("小于等于".equals(type)){
|
|
|
|
|
+ return insPlyIncome.getSignDate().compareTo(signDateEnd) <=0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if("固定范围".equals(type)){
|
|
|
|
|
+ return insPlyIncome.getSignDate().compareTo(signDateStart) >=0 && insPlyIncome.getSignDate().compareTo(signDateEnd) <=0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if("不在固定范围".equals(type)){
|
|
|
|
|
+ return insPlyIncome.getSignDate().compareTo(signDateStart) <0 || insPlyIncome.getSignDate().compareTo(signDateEnd) > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ };
|
|
|
|
|
+ // 出单协议
|
|
|
|
|
+ Predicate<InsPlyIncome> ptlAgreementPredicate = insPlyIncome -> {
|
|
|
|
|
+ if(!names.contains(IncomeDataVO.SearchVO.ptlAgreement)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ IncomeDataVO.SearchVO searchVO = searchVOMap.get(IncomeDataVO.SearchVO.ptlAgreement);
|
|
|
|
|
+ String type = searchVO.getType();
|
|
|
|
|
+ String search = searchVO.getSearch();
|
|
|
|
|
+ if("为空".equals(type)|| "不为空".equals(type)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果填写的查询条件,不完善,则该条件不进行过滤
|
|
|
|
|
+ if(StrUtil.isEmpty(search)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> ptlAgrements = Arrays.asList(search.split(","));
|
|
|
|
|
+ return ptlAgrements.contains(insPlyIncome.getAgreementId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> ptlAgrements = Arrays.asList(search.split(","));
|
|
|
|
|
+ return !ptlAgrements.contains(insPlyIncome.getAgreementId());
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 订单类型 entryStatus/orderType
|
|
|
|
|
+ Predicate<InsPlyIncome> orderTypePredicate = insPlyIncome -> {
|
|
|
|
|
+ if(!names.contains(IncomeDataVO.SearchVO.orderType)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ IncomeDataVO.SearchVO searchVO = searchVOMap.get(IncomeDataVO.SearchVO.orderType);
|
|
|
|
|
+ String type = searchVO.getType();
|
|
|
|
|
+ String search = searchVO.getSearch();
|
|
|
|
|
+ if("为空".equals(type)|| "不为空".equals(type)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果填写的查询条件,不完善,则该条件不进行过滤
|
|
|
|
|
+ if(StrUtil.isEmpty(search)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> entryStatus = Arrays.asList(search.split(","));
|
|
|
|
|
+ return entryStatus.contains(insPlyIncome.getEntryStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ if("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> entryStatus = Arrays.asList(search.split(","));
|
|
|
|
|
+ return !entryStatus.contains(insPlyIncome.getEntryStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 签单年份
|
|
|
|
|
+ Predicate<InsPlyIncome> signYearPredicate = insPlyIncome ->{
|
|
|
|
|
+ if(!names.contains(IncomeDataVO.SearchVO.signYear)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ IncomeDataVO.SearchVO searchVO = searchVOMap.get(IncomeDataVO.SearchVO.signYear);
|
|
|
|
|
+ String type = searchVO.getType();
|
|
|
|
|
+ String search = searchVO.getSearch();
|
|
|
|
|
+ if("为空".equals(type)|| "不为空".equals(type)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 如果填写的查询条件,不完善,则该条件不进行过滤
|
|
|
|
|
+ if(StrUtil.isEmpty(search)){
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> signYears = Arrays.asList(search.split(","));
|
|
|
|
|
+ return signYears.contains(insPlyIncome.getSignYear());
|
|
|
|
|
+ }
|
|
|
|
|
+ if("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)){
|
|
|
|
|
+ List<String> signYears = Arrays.asList(search.split(","));
|
|
|
|
|
+ return !signYears.contains(insPlyIncome.getSigningTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ };
|
|
|
|
|
+ if("and".equalsIgnoreCase(incomeDataVO.getLogicJudge())){
|
|
|
|
|
+ Predicate<InsPlyIncome> and = companyIdPredicate.and(signDatePredicate).and(ptlAgreementPredicate).and(orderTypePredicate).and(signYearPredicate);
|
|
|
|
|
+ filterIncomes = incomes.stream().filter(and).toList();
|
|
|
|
|
+ }else if ("or".equalsIgnoreCase(incomeDataVO.getLogicJudge())){
|
|
|
|
|
+ Predicate<InsPlyIncome> or = companyIdPredicate.or(signDatePredicate).or(ptlAgreementPredicate).or(orderTypePredicate).or(signYearPredicate);
|
|
|
|
|
+ filterIncomes = incomes.stream().filter(or).toList();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ filterIncomes = this.fillOtherInfo(filterIncomes);
|
|
|
|
|
+ return HttpResult.ok(filterIncomes);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 填充必要的字段
|
|
* 填充必要的字段
|
|
@@ -187,6 +387,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
*/
|
|
*/
|
|
|
List<InsPlyIncome> fillOtherInfo(List<InsPlyIncome> records){
|
|
List<InsPlyIncome> fillOtherInfo(List<InsPlyIncome> records){
|
|
|
if(CollUtil.isNotEmpty(records)){
|
|
if(CollUtil.isNotEmpty(records)){
|
|
|
|
|
+ Map<String, String> typeAttrMaps = sysUserJzgInfoSalesmanService.queryYwyTypeAttrMap();
|
|
|
records.forEach(insPlyIncome -> {
|
|
records.forEach(insPlyIncome -> {
|
|
|
if("0".equals(insPlyIncome.getSettlementStatus())){
|
|
if("0".equals(insPlyIncome.getSettlementStatus())){
|
|
|
insPlyIncome.setSettlementStatusName("未结算");
|
|
insPlyIncome.setSettlementStatusName("未结算");
|
|
@@ -195,8 +396,11 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
}else{
|
|
}else{
|
|
|
insPlyIncome.setSettlementStatusName(insPlyIncome.getSettlementStatus());
|
|
insPlyIncome.setSettlementStatusName(insPlyIncome.getSettlementStatus());
|
|
|
}
|
|
}
|
|
|
|
|
+ String typeAttr = typeAttrMaps.getOrDefault(Objects.toString(insPlyIncome.getRealQuoteUserName(),""),"");
|
|
|
|
|
+ String typeAttrName = Constant.ywyAttrTypeMap.get(typeAttr);
|
|
|
|
|
+ insPlyIncome.setTypeAttr(typeAttr);
|
|
|
|
|
+ insPlyIncome.setTypeAttrName(typeAttrName);
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
return records;
|
|
return records;
|
|
|
}
|
|
}
|