|
@@ -657,6 +657,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
checkJob.setEndTime(endDate);
|
|
|
}
|
|
|
private void calcTime(CheckJob checkJob, LocalDateTime currentDate, CheckStandard checkStandard) {
|
|
|
+ LocalDate startDate = null;
|
|
|
LocalDate endDate = null;
|
|
|
//checkJob.setStartTime(currentDate.toLocalDate());
|
|
|
|
|
@@ -671,22 +672,30 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
localDateTime = vo.getActualEndTime();
|
|
|
}
|
|
|
if (CheckPlanPeriodTypeEnum.DAY.getValue().equals(checkStandard.getPeriodType())) {
|
|
|
- endDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod(), ChronoUnit.DAYS);
|
|
|
+ startDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod(), ChronoUnit.DAYS);
|
|
|
+ endDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod() + 2, ChronoUnit.DAYS);
|
|
|
}
|
|
|
if (CheckPlanPeriodTypeEnum.WEEK.getValue().equals(checkStandard.getPeriodType())) {
|
|
|
- endDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod() * 7, ChronoUnit.DAYS);
|
|
|
+ startDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod() * 7, ChronoUnit.DAYS);
|
|
|
+ endDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod() * 7 + 2, ChronoUnit.DAYS);
|
|
|
+
|
|
|
}
|
|
|
if (CheckPlanPeriodTypeEnum.MONTH.getValue().equals(checkStandard.getPeriodType())) {
|
|
|
- endDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod(), ChronoUnit.MONTHS);
|
|
|
+ startDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod(), ChronoUnit.MONTHS);
|
|
|
+ endDate = DateUtils.plus(startDate, 10, ChronoUnit.DAYS);
|
|
|
}
|
|
|
if (CheckPlanPeriodTypeEnum.SEASON.getValue().equals(checkStandard.getPeriodType())) {
|
|
|
- endDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod() * 3, ChronoUnit.MONTHS);
|
|
|
+ startDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod() * 3, ChronoUnit.MONTHS);
|
|
|
+ endDate = DateUtils.plus(startDate, 20, ChronoUnit.DAYS);
|
|
|
}
|
|
|
if (CheckPlanPeriodTypeEnum.YEAR.getValue().equals(checkStandard.getPeriodType())) {
|
|
|
- endDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod(), ChronoUnit.YEARS);
|
|
|
+ startDate = DateUtils.plus(localDateTime.toLocalDate(), checkStandard.getPeriod(), ChronoUnit.YEARS);
|
|
|
+ endDate = DateUtils.plus(startDate, 60, ChronoUnit.DAYS);
|
|
|
}
|
|
|
+ startDate = DateUtils.plus(endDate, -1, ChronoUnit.DAYS);
|
|
|
endDate = DateUtils.plus(endDate, -1, ChronoUnit.DAYS);
|
|
|
- checkJob.setStartTime(endDate);
|
|
|
+ checkJob.setStartTime(startDate);
|
|
|
+ checkJob.setEndTime(endDate);
|
|
|
checkStandard.setNextDate(endDate);
|
|
|
}
|
|
|
|
|
@@ -799,12 +808,22 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
|
|
|
// 非台时和公里,则需要生成下一次的任务
|
|
|
CheckStandard checkStandard = standardMapper.selectByPrimaryKey(checkJob.getStandardId());
|
|
|
- CheckJob nextCheckJob = BeanConverterUtil.copyObjectProperties(checkJob,CheckJob.class);
|
|
|
+ CheckJob nextCheckJob = new CheckJob();
|
|
|
if(!CheckPlanPeriodTypeEnum.MILES.getValue().equals(checkStandard.getPeriodType()) && !CheckPlanPeriodTypeEnum.TAISHI.getValue().equals(checkStandard.getPeriodType()) ){
|
|
|
- nextCheckJob.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ nextCheckJob.setStandardHours(checkStandard.getStandardHours());
|
|
|
nextCheckJob.setStatus(CheckJobStatusEnum.NOT_EXECUTE.getValue());
|
|
|
- nextCheckJob.setActualStartTime(null);
|
|
|
- nextCheckJob.setActualEndTime(null);
|
|
|
+ // 新任务
|
|
|
+ calcTime(nextCheckJob, checkJob.getActualEndTime(), checkStandard);
|
|
|
+ nextCheckJob.setCreatedTime(LocalDateTime.now());
|
|
|
+ nextCheckJob.setSbId(checkStandard.getSbId());
|
|
|
+ nextCheckJob.setCheckUserId(checkJob.getCheckUserId());
|
|
|
+ nextCheckJob.setPartId(checkStandard.getPart());
|
|
|
+ nextCheckJob.setStandardId(checkStandard.getId());
|
|
|
+ nextCheckJob.setType(checkStandard.getType());
|
|
|
+ nextCheckJob.setRequirement(checkStandard.getRequirement());
|
|
|
+ nextCheckJob.setRemark(checkStandard.getRemark());
|
|
|
+ nextCheckJob.setName(checkStandard.getName());
|
|
|
+ nextCheckJob.setId(IdGeneratorUtils.getObjectId());
|
|
|
calcTime(nextCheckJob,now,checkStandard);
|
|
|
mapper.insert(nextCheckJob);
|
|
|
}
|