|
@@ -159,11 +159,9 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
Iterator<MaintenancePlan> iterator = planList.iterator();
|
|
|
if (iterator.hasNext()) {
|
|
|
MaintenancePlan next = iterator.next();
|
|
|
- log.info("当前计划" + gson.toJson(next));
|
|
|
if (Objects.nonNull(next))
|
|
|
iterator.remove();
|
|
|
}
|
|
|
- log.info("删除前的保养计划" + gson.toJson(planList));
|
|
|
//获取当前时间后的维保计划列表,并清除计划
|
|
|
maintenancePlanService.removeByIds(planList.stream().map(MaintenancePlan::getId).collect(Collectors.toList()));
|
|
|
//按照修改时间重新生成计划
|
|
@@ -200,8 +198,21 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
MaintenancePlan plan = maintenancePlanService.getOne(record.getMtPlanId());
|
|
|
if (ObjectUtil.isEmpty(plan)) return RestResponse.fail(MessageUtils.get("msg.maintenance.plan.not.exist"));
|
|
|
|
|
|
+ //根据期数计算维保类型
|
|
|
+ Integer periods = request.getPeriods();
|
|
|
+ //保养类型 1.半月,2.季度,3.半年,4.全年
|
|
|
+ int[] maintenanceType = {1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 4};
|
|
|
+ int length = maintenanceType.length;
|
|
|
+ int type;
|
|
|
+ int mod = periods % length;
|
|
|
+ //设置维保类型
|
|
|
+ if (mod == 0) {
|
|
|
+ type = maintenanceType[length - 1];
|
|
|
+ } else {
|
|
|
+ type = maintenanceType[mod - 1];
|
|
|
+ }
|
|
|
plan.setStatus(Integer.parseInt(CommonEnum.MaintenancePlanStatus.MAINTENANCE_DOING.getCode()));
|
|
|
- plan.setType(record.getType());
|
|
|
+ plan.setType(type);
|
|
|
plan.setCount(request.getPeriods());
|
|
|
boolean planResult = maintenancePlanService.updateById(plan);
|
|
|
if (!planResult) {
|
|
@@ -221,6 +232,7 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
|
|
|
Lift l = lift.get();
|
|
|
record.setCode(l.getLiftCode());
|
|
|
record.setLiftType(l.getLiftType());
|
|
|
+ record.setType(type);
|
|
|
record.setStatus(CommonEnum.MaintenanceRecordStatus.MAINTENANCE_DOING.getCode());
|
|
|
record.setWorkerId1(record.getWorkerId1());
|
|
|
record.setWorkDate(LocalDate.now());
|