update 优化到账开票查询速度

This commit is contained in:
lijiarao
2023-12-27 16:57:57 +08:00
parent 3c8dd59769
commit 7c6e35558f
@@ -1,5 +1,6 @@
package com.jero.payment.service.impl;
import cn.hutool.core.collection.CollStreamUtil;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@@ -157,26 +158,26 @@ public class PayPaymentRecordServiceImpl extends ServiceImpl<PayPaymentRecordMap
//查审核记录表,每阶段最新的一条
LambdaQueryWrapper<PayPaymentRecordSub> wrapper = new LambdaQueryWrapper<>();
wrapper.select(PayPaymentRecordSub::getProjectId,PayPaymentRecordSub::getPaymentStatus);
wrapper.eq(PayPaymentRecordSub::getLastSign, LastSignEnum.LAST.getCode());
wrapper.eq(PayPaymentRecordSub::getDelFlag, PayProjectCommon.NO);
List<PayPaymentRecordSub> RecordSubList = payPaymentCheckService.list(wrapper);
Map<String, String> projectIdPaymentStatusMap = CollStreamUtil.toMap(RecordSubList, PayPaymentRecordSub::getProjectId, PayPaymentRecordSub::getPaymentStatus);
for (PayCommonProject commonProject : list) {
//如果是会议类型,就查询会议的具体类型
String id = commonProject.getId();
if (commonProject.getProjectType().equals(Integer.parseInt(ProjectCommon.PROJECT_TYPE3))) {
String id = commonProject.getId();
PayMeeting payMeeting = payMeetingService.getMeetingBySituationId(id);
commonProject.setMeetingType(payMeeting.getMeetingType());
commonProject.setSituationId(id);
}
//插入待审核状态,供前端判断是否显示审核按钮
//先查审核记录表有没有待审核的
for(PayPaymentRecordSub recordSub : RecordSubList){
if(commonProject.getId().equals(recordSub.getProjectId())){
if(PaymentStatusEnum.TO_BE_REVIEWED.getCode().equals(recordSub.getPaymentStatus())){
commonProject.setCheckPaymentStatus(recordSub.getPaymentStatus());
continue;
}
if(projectIdPaymentStatusMap.containsKey(id)){
String paymentStatus = projectIdPaymentStatusMap.get(id);
if(PaymentStatusEnum.TO_BE_REVIEWED.getCode().equals(paymentStatus)){
commonProject.setCheckPaymentStatus(paymentStatus);
continue;
}
}
//再查项目主表状态是不是待审核