| | |
| | | */ |
| | | List<EamMaintenanceStandard> standardList = eamMaintenanceStandardService.queryListByCategory(MaintenanceCategoryEnum.POINT_INSPECTION.name()); |
| | | if (CollectionUtil.isEmpty(standardList)) { |
| | | log.warn("没有配置任何周保标准,任务结束"); |
| | | log.warn("没有配置任何点检标准,任务结束"); |
| | | return; |
| | | } |
| | | //当前日期 |
| | |
| | | standard.setInitialDate(DateUtils.localDateToDate(now.minusDays(1))); |
| | | } |
| | | LocalDate generateDate = DateUtils.dateToLocalDate(standard.getInitialDate()); |
| | | // if (standard.getLastGenerateTime() != null) { |
| | | // generateDate = DateUtils.dateToLocalDate(standard.getLastGenerateTime()); |
| | | // } |
| | | //加周期 |
| | | do { |
| | | //初始日期设置的比较早,或任务长时间没执行,必须周期到今天才会生成工单 |
| | |
| | | request.setCreationMethod(OrderCreationMethodEnum.AUTO.name()); |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.INSPECTION_ORDER_CODE_RULE); |
| | | request.setOrderNum(codeSeq); |
| | | List<EamInspectionOrderDetail> collect = standardDetailList.stream().map(EamInspectionOrderDetail::new).collect(Collectors.toList()); |
| | | request.setTableDetailList(collect); |
| | | eamInspectionOrderService.addInspectionOrder(request); |
| | | } |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | log.error("周保过生成执行定时任务失败,{}", e.getMessage(), e); |
| | | log.error("点检生成执行定时任务失败,{}", e.getMessage(), e); |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | } |