|
|
@@ -92,7 +92,7 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
public int buildTask(List<Long> execOrgIds, @NotEmpty List<AppPlan> plans, @NotNull Date date) {
|
|
|
List<Resumption> resumptions = new ArrayList<>();
|
|
|
for (AppPlan appPlan : plans) {
|
|
|
- if(ObjectUtil.notEqual(appPlan.getPlanStatus(),1)){
|
|
|
+ if (ObjectUtil.notEqual(appPlan.getPlanStatus(), 1)) {
|
|
|
continue;
|
|
|
}
|
|
|
//获取履职计划中对应的检查要点
|
|
|
@@ -109,16 +109,17 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- List<Long> orgIds = getPlanOrgIds(appPlan, execOrgIds);
|
|
|
- if (CollectionUtils.isEmpty(orgIds)) {
|
|
|
+ List<SysOrg> orgs = getPlanOrgIds(appPlan, execOrgIds);
|
|
|
+ if (CollectionUtils.isEmpty(orgs)) {
|
|
|
log.info("error:该计划ID:{}没有执行机构", appPlan.getId());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
CycleCommonEnum cycleCommonEnum = CycleCommonEnum.getEnum(appPlan.getPlanCycle());
|
|
|
DateRange range = DateUtils.getStartAndEnd(date, cycleCommonEnum);
|
|
|
- Map<Long, SysWorkTime> workTimes = orgSingleWorkTimeMap(new Date(), cycleCommonEnum, orgIds);
|
|
|
- for (Long orgId : orgIds) {
|
|
|
+ Map<Long, SysWorkTime> workTimes = orgSingleWorkTimeMap(new Date(), cycleCommonEnum, orgs.stream().map(SysOrg::getId).collect(Collectors.toList()));
|
|
|
+ for (SysOrg org : orgs) {
|
|
|
+ Long orgId = org.getId();
|
|
|
if (!workTimes.containsKey(orgId) || ObjectUtil.isNull(workTimes.get(orgId)) || ObjectUtil.notEqual(workTimes.get(orgId).getIsEnable(), 1L)) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -126,9 +127,9 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
|
|
|
List<Resumption> tasks;
|
|
|
if (ObjectUtil.equal(CycleCommonEnum.DAILY.getCode(), appPlan.getPlanCycle())) {
|
|
|
- tasks = buildResumptions(appPlan, orgId, workTime);
|
|
|
+ tasks = buildResumptions(appPlan, org, workTime);
|
|
|
} else {
|
|
|
- tasks = buildResumptions(appPlan, orgId, range.getStartTime(), range.getEndTime(), 0L);
|
|
|
+ tasks = buildResumptions(appPlan, org, range.getStartTime(), range.getEndTime(), 0L);
|
|
|
}
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(tasks)) {
|
|
|
@@ -334,9 +335,9 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
|
|
|
List<Resumption> planResumptionList;
|
|
|
if (ObjectUtil.equal(cycle, CycleCommonEnum.DAILY)) {
|
|
|
- planResumptionList = this.buildResumptions(plan, orgId, workTime);
|
|
|
+ planResumptionList = this.buildResumptions(plan, org, workTime);
|
|
|
} else {
|
|
|
- planResumptionList = this.buildResumptions(plan, orgId, startDate, endDate, executedCount);
|
|
|
+ planResumptionList = this.buildResumptions(plan, org, startDate, endDate, executedCount);
|
|
|
}
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(planResumptionList)) {
|
|
|
@@ -358,7 +359,7 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
return resumptionService.update(wrapper);
|
|
|
}
|
|
|
|
|
|
- private List<Resumption> buildResumptions(AppPlan appPlan, Long execOrgId, SysWorkTime workTime) {
|
|
|
+ private List<Resumption> buildResumptions(AppPlan appPlan, SysOrg execOrg, SysWorkTime workTime) {
|
|
|
DateTime dateTime = new DateTime(workTime.getYmdDate());
|
|
|
String opentime = workTime.getOpenTime();//营业时间
|
|
|
String closetime = workTime.getCloseTime();//营业终了
|
|
|
@@ -388,10 +389,10 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
planendTime = DateUtil.endOfDay(time2).setField(DateField.MILLISECOND, 0);
|
|
|
}
|
|
|
|
|
|
- return buildResumptions(appPlan, execOrgId, planstartTime, planendTime, 0L);
|
|
|
+ return buildResumptions(appPlan, execOrg, planstartTime, planendTime, 0L);
|
|
|
}
|
|
|
|
|
|
- private List<Resumption> buildResumptions(AppPlan appPlan, Long execOrgId, Date planStartTime, Date planEndTime, Long executedCount) {
|
|
|
+ private List<Resumption> buildResumptions(AppPlan appPlan, SysOrg execOrg, Date planStartTime, Date planEndTime, Long executedCount) {
|
|
|
List<Resumption> resumptionList = new ArrayList<>();
|
|
|
Long count = 1L;
|
|
|
if (NumberUtil.isNumber(appPlan.getCount())) {
|
|
|
@@ -414,7 +415,9 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
resumption.setYmdHalfyear(Long.valueOf(ymd.getHalfyear()));
|
|
|
resumption.setParentPlanId((ObjectUtil.equal(appPlan.getParentId(), -1L) || ObjectUtil.isNull(appPlan.getParentId())) ? appPlan.getId() : appPlan.getParentId());
|
|
|
resumption.setPlanId(appPlan.getId());
|
|
|
- resumption.setOrgId(execOrgId);
|
|
|
+ resumption.setOrgId(execOrg.getId());
|
|
|
+ resumption.setOrgPath(execOrg.getPath());
|
|
|
+ resumption.setOrgName(execOrg.getShortName());
|
|
|
resumption.setType(appPlan.getPlanCycle());
|
|
|
resumption.setPlanStartTime(planStartTime);
|
|
|
resumption.setPlanEndTime(planEndTime);
|
|
|
@@ -462,8 +465,6 @@ public class ResumptionTaskBusiness extends TaskCreatingServiceImplBase<Resumpti
|
|
|
if (CollectionUtils.isNotEmpty(planIds)) {
|
|
|
qw.lambda().in(AppPlan::getId, planIds);
|
|
|
}
|
|
|
- List<AppPlan> listPlans = appPlanMapper.selectList(qw);
|
|
|
-
|
|
|
- return listPlans;
|
|
|
+ return appPlanMapper.selectList(qw);
|
|
|
}
|
|
|
}
|