fix: 发送消息报错影响企标发消息

This commit is contained in:
2024-08-08 16:55:58 +08:00
parent 834d18015b
commit e05ba6fd48
@@ -11,6 +11,10 @@ import com.jero.modules.laws.standard.entity.LawsReplacedStandard;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import com.jero.modules.laws.standard.service.ILawsReplacedStandardService;
import com.jero.modules.laws.standardmasterplan.entity.LawsStandardMasterPlan;
import com.jero.modules.laws.standardmasterplan.entity.LawsStandardMasterPlanSublist;
import com.jero.modules.laws.standardmasterplan.servicce.ILawsStandardMasterPlanService;
import com.jero.modules.laws.standardmasterplan.servicce.ILawsStandardMasterPlanSublistService;
import com.jero.modules.personal.entity.LawsStandardCollection;
import com.jero.modules.personal.service.ILawsStandardCollectionService;
import lombok.extern.slf4j.Slf4j;
@@ -23,6 +27,8 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.jero.modules.laws.standardmasterplan.common.LawsStandardMasterPlanCommon.INFORMATION_INPUT;
@Slf4j
public class ReplaceImplementationDateMsgJob implements Job {
@@ -41,6 +47,12 @@ public class ReplaceImplementationDateMsgJob implements Job {
@Resource
private ILawsStandardCollectionService collectionService;
@Resource
private ILawsStandardMasterPlanService masterPlanService;
@Resource
private ILawsStandardMasterPlanSublistService masterPlanSublistService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
this.sendGbStandardMsg();
@@ -160,14 +172,14 @@ public class ReplaceImplementationDateMsgJob implements Job {
Date tomorrowMidnight = cal.getTime();
// 根据新认证车实施日期筛选出已经到期的标准
for (LawsDomesticStandard es : standardList) {
Date implementationDate = es.getImplementationDate();
for (LawsDomesticStandard gb : standardList) {
Date implementationDate = gb.getImplementationDate();
if (implementationDate == null) {
continue;
}
// 判断实施日期大于今天0点小于明天0点
if (implementationDate.equals(todayMidnight) && implementationDate.before(tomorrowMidnight)) {
allExpireStandardNumberList.add(es.getStandardNumber());
allExpireStandardNumberList.add(gb.getId());
}
}
@@ -206,7 +218,20 @@ public class ReplaceImplementationDateMsgJob implements Job {
standard = standard.split("")[0];
LawsDomesticStandard replaceStandard = standardMap.get(standard);
// 被代替标准的主起草人,责任人,收藏标准的人员
userIdList.add(replaceStandard.getResponsibleUser());
LambdaQueryWrapper<LawsStandardMasterPlan> mpWrapper = new LambdaQueryWrapper<>();
mpWrapper.eq(LawsStandardMasterPlan::getStandardId, replaceStandard.getId());
List<LawsStandardMasterPlan> masterPlanList = masterPlanService.list(mpWrapper);
if (!masterPlanList.isEmpty()) {
// 找到所有类型为1的主计划信息的责任人
LambdaQueryWrapper<LawsStandardMasterPlanSublist> sublistWrapper = new LambdaQueryWrapper<>();
sublistWrapper.eq(LawsStandardMasterPlanSublist::getType, INFORMATION_INPUT);
sublistWrapper.in(LawsStandardMasterPlanSublist::getMasterPlanId,
masterPlanList.stream().map(LawsStandardMasterPlan::getId).collect(Collectors.toList()));
List<LawsStandardMasterPlanSublist> sublistList = masterPlanSublistService.list(sublistWrapper);
for (LawsStandardMasterPlanSublist sublist : sublistList) {
userIdList.add(sublist.getResponsiblePerson());
}
}
// 获取收藏标准的所有人员
LambdaQueryWrapper<LawsStandardCollection> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(LawsStandardCollection::getStandardId, replaceStandard.getId());