| | |
| | | import com.aizuda.snailjob.client.job.core.dto.JobArgs; |
| | | import com.aizuda.snailjob.client.model.ExecuteResult; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | |
| | | // 获取今天日期 |
| | | |
| | | Date today = new Date(); |
| | | LambdaQueryWrapper<EimsMaintPlan> planBoQueryWrapper = Wrappers.lambdaQuery(); |
| | | QueryWrapper<EimsMaintPlan> planBoQueryWrapper = Wrappers.query(); |
| | | // 查询启用的保养计划 |
| | | planBoQueryWrapper.eq(EimsMaintPlan::getStatus, DictConstants.SYS_NORMAL_DISABLE_DETAIL.NORMAL); |
| | | // 过滤没有下次运行时间 |
| | | planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintNextTime); |
| | | // 过滤没有保养周期的数据 |
| | | planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintCycle); |
| | | planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintCycleUnit); |
| | | planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintRule); |
| | | |
| | | List<EimsMaintPlanVo> planVoList = planMapper.selectVoList(planBoQueryWrapper); |
| | | planBoQueryWrapper.eq("mp.status", DictConstants.SYS_NORMAL_DISABLE_DETAIL.NORMAL); |
| | | planBoQueryWrapper .eq("equ.status", DictConstants.EIMS_EQU_STATUS_DETAIL.SHIYONG); |
| | | // 过滤下次运行时间等于当天时间的 |
| | | // planBoQueryWrapper.eq("mp.maint_next_time", DateUtils.getDate()); |
| | | // 过滤没有保养周期的数据 |
| | | planBoQueryWrapper.isNotNull("mp.maint_cycle"); |
| | | planBoQueryWrapper.isNotNull("mp.maint_cycle_unit"); |
| | | planBoQueryWrapper.isNotNull("mp.maint_rule"); |
| | | |
| | | List<EimsMaintPlanVo> planVoList = planMapper.selectVoListJoinEqu(planBoQueryWrapper); |
| | | for (int i = 0; i < planVoList.size(); i++) { |
| | | EimsMaintPlanVo planVo = planVoList.get(i); |
| | | // 保养计划add的时候会自动生成下次运行时间 |
| | |
| | | |
| | | // 计算生成工单时间 |
| | | Long maintCycle = planVo.getMaintCycle(); |
| | | String maintRule = planVo.getMaintRule(); |
| | | Date firstTime = planVo.getMaintFirstTime(); |
| | | Date lastTime = planVo.getMaintLastTime(); |
| | | Date newNext = null; |
| | | String maintCycleUnit = planVo.getMaintCycleUnit(); |
| | | switch (maintCycleUnit) { |