Commit 3fdad5629cb9b9ac04e70909400fe2a56b8660e4
1 parent
774910da
feat(garden): 添加计划过期状态处理功能
- 新增过期状态枚举值(EXPIRED=3)用于标识过期的巡检和养护计划 - 实现巡检计划明细过期状态自动更新逻辑 - 实现巡检计划过期状态自动更新逻辑 - 实现养护计划明细过期状态自动更新逻辑 - 实现养护计划过期状态自动更新逻辑 - 添加巡检计划过期任务调度器(InspectionPlanExpiredJob) - 添加养护计划过期任务调度器(MaintainPlanExpiredJob) - 优化搜索条件设置,将_lonLatAddress_替换为_roadName_ - 完善MyBatis XML映射文件中的过期状态查询条件
Showing
14 changed files
with
173 additions
and
8 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/maintainplan/vo/AppMaintainPlanCommitDetailPageRespVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.app.maintainplan.vo; |
| 2 | 2 | |
| 3 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 3 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 5 | import lombok.Data; |
| 5 | 6 | |
| ... | ... | @@ -64,4 +65,10 @@ public class AppMaintainPlanCommitDetailPageRespVO { |
| 64 | 65 | @Schema(description = "执行时间") |
| 65 | 66 | private LocalDateTime endTime; |
| 66 | 67 | |
| 68 | + @Schema(description = "提交人用户ID", example = "王五") | |
| 69 | + private String userName; | |
| 70 | + | |
| 71 | + @Schema(description = "备注", example = "你猜") | |
| 72 | + private String remark; | |
| 73 | + | |
| 67 | 74 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/FinishStateEnum.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/job/plan/InspectionPlanExpiredJob.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.job.plan; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.framework.quartz.core.handler.JobHandler; | |
| 4 | +import com.zteits.urbanops.framework.tenant.core.aop.TenantIgnore; | |
| 5 | +import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanDetailService; | |
| 6 | +import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanService; | |
| 7 | +import com.zteits.urbanops.module.garden.service.maintainplan.MaintainPlanDetailService; | |
| 8 | +import jakarta.annotation.Resource; | |
| 9 | +import lombok.extern.slf4j.Slf4j; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 巡查计划过去 修改状态 | |
| 14 | + */ | |
| 15 | +@Component | |
| 16 | +@Slf4j | |
| 17 | +public class InspectionPlanExpiredJob implements JobHandler { | |
| 18 | + | |
| 19 | + @Resource | |
| 20 | + private InspectionPlanDetailService inspectionPlanDetailService; | |
| 21 | + | |
| 22 | + @Resource | |
| 23 | + private InspectionPlanService inspectionPlanService ; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 清理超过(14)天的日志 | |
| 27 | + */ | |
| 28 | + private static final Integer JOB_CLEAN_RETAIN_DAY = 14; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 每次删除间隔的条数,如果值太高可能会造成数据库的压力过大 | |
| 32 | + */ | |
| 33 | + private static final Integer DELETE_LIMIT = 100; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + @TenantIgnore | |
| 37 | + public String execute(String param) { | |
| 38 | + // 更新过期的计划明细状态为过期(3) | |
| 39 | + inspectionPlanDetailService.updateExpiredInspectionPlanDetails(); // Fixed method name | |
| 40 | + // 更新过期的计划状态为过期(3) | |
| 41 | + inspectionPlanService.updateExpiredInspectionPlans(); // Fixed method name | |
| 42 | + return "Successfully updated expired maintain plans and plan details"; | |
| 43 | + } | |
| 44 | + | |
| 45 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/job/plan/MaintainPlanExpiredJob.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.job.plan; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.framework.quartz.core.handler.JobHandler; | |
| 4 | +import com.zteits.urbanops.framework.tenant.core.aop.TenantIgnore; | |
| 5 | +import com.zteits.urbanops.module.garden.service.maintainplan.MaintainPlanDetailService; | |
| 6 | +import com.zteits.urbanops.module.infra.service.logger.ApiAccessLogService; | |
| 7 | +import jakarta.annotation.Resource; | |
| 8 | +import lombok.extern.slf4j.Slf4j; | |
| 9 | +import org.springframework.stereotype.Component; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 养护计划过期 修改状态 | |
| 13 | + */ | |
| 14 | +@Component | |
| 15 | +@Slf4j | |
| 16 | +public class MaintainPlanExpiredJob implements JobHandler { | |
| 17 | + | |
| 18 | + @Resource | |
| 19 | + private MaintainPlanDetailService maintainPlanDetailService; | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + @TenantIgnore | |
| 23 | + public String execute(String param) { | |
| 24 | + // 更新过期的计划明细状态为过期(3) | |
| 25 | + maintainPlanDetailService.updateExpiredMaintainPlanDetails(); | |
| 26 | + // 更新过期的计划状态为过期(3) | |
| 27 | + maintainPlanDetailService.updateExpiredMaintainPlans(); | |
| 28 | + return "Successfully updated expired maintain plans and plan details"; | |
| 29 | + } | |
| 30 | + | |
| 31 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanDetailService.java
| ... | ... | @@ -68,4 +68,7 @@ public interface InspectionPlanDetailService { |
| 68 | 68 | * @return 巡检计划分页 |
| 69 | 69 | */ |
| 70 | 70 | List<AppInspectionPlanDetailRespVO> getInspectionPlanDetailForApp(AppInspectionPlanDetailReqVO pageReqVO); |
| 71 | -} | |
| 72 | 71 | \ No newline at end of file |
| 72 | + | |
| 73 | + void updateExpiredInspectionPlanDetails(); | |
| 74 | + | |
| 75 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanDetailServiceImpl.java
| 1 | 1 | package com.zteits.urbanops.module.garden.service.inspectionplan; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 3 | 4 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | 5 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 5 | 6 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| ... | ... | @@ -8,8 +9,11 @@ import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.Insp |
| 8 | 9 | import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanDetailReqVO; |
| 9 | 10 | import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanDetailRespVO; |
| 10 | 11 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; |
| 12 | +import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDO; | |
| 13 | +import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDetailDO; | |
| 11 | 14 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper; |
| 12 | 15 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanRoleMapper; |
| 16 | +import com.zteits.urbanops.module.garden.enums.FinishStateEnum; | |
| 13 | 17 | import com.zteits.urbanops.module.system.api.permission.RoleApi; |
| 14 | 18 | import jakarta.annotation.Resource; |
| 15 | 19 | import org.apache.commons.lang3.StringUtils; |
| ... | ... | @@ -102,4 +106,17 @@ public class InspectionPlanDetailServiceImpl implements InspectionPlanDetailServ |
| 102 | 106 | return inspectionPlanDetailMapper.getInspectionPlanDetailForApp(pageReqVO); |
| 103 | 107 | } |
| 104 | 108 | |
| 105 | -} | |
| 106 | 109 | \ No newline at end of file |
| 110 | + @Override | |
| 111 | + public void updateExpiredInspectionPlanDetails() { | |
| 112 | + // 更新过期的计划明细状态为过期(3) | |
| 113 | + LocalDateTime now = LocalDateTime.now(); | |
| 114 | + LambdaUpdateWrapper<InspectionPlanDetailDO> updateWrapper = new LambdaUpdateWrapper<>(); | |
| 115 | + updateWrapper.lt(InspectionPlanDetailDO::getEndTime, now) | |
| 116 | + .ne(InspectionPlanDetailDO::getFinishState, FinishStateEnum.FINISHED.getStatus()) // 排除已完成的 | |
| 117 | + .set(InspectionPlanDetailDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()); // 设置为过期状态 | |
| 118 | + inspectionPlanDetailMapper.update(null, updateWrapper); | |
| 119 | + } | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanService.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| ... | ... | @@ -3,6 +3,7 @@ package com.zteits.urbanops.module.garden.service.inspectionplan; |
| 3 | 3 | import cn.hutool.core.thread.ThreadUtil; |
| 4 | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 6 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 6 | 7 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 7 | 8 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 8 | 9 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| ... | ... | @@ -399,4 +400,15 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 399 | 400 | return roleList.stream().map(InspectionPlanRoleDO::getBatchNo).collect(Collectors.toSet()); |
| 400 | 401 | } |
| 401 | 402 | |
| 402 | -} | |
| 403 | 403 | \ No newline at end of file |
| 404 | + @Override | |
| 405 | + public void updateExpiredInspectionPlans() { | |
| 406 | + // 更新过期的计划状态为过期(3) | |
| 407 | + LocalDateTime now = LocalDateTime.now(); | |
| 408 | + LambdaUpdateWrapper<InspectionPlanDO> updateWrapper = new LambdaUpdateWrapper<>(); | |
| 409 | + updateWrapper.lt(InspectionPlanDO::getEndTime, now) | |
| 410 | + .ne(InspectionPlanDO::getFinishState, FinishStateEnum.FINISHED.getStatus()) // 排除已完成的 | |
| 411 | + .set(InspectionPlanDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()); // 设置为过期状态 | |
| 412 | + inspectionPlanMapper.update(null, updateWrapper); | |
| 413 | + } | |
| 414 | + | |
| 415 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanDetailService.java
| ... | ... | @@ -77,4 +77,14 @@ public interface MaintainPlanDetailService { |
| 77 | 77 | */ |
| 78 | 78 | List<AppMaintainNotFinishPlanDetailRespVO> getMaintainNotFinishPlanCommitDetail(AppMaintainNotFinishPlanDetailReqVO reqVO); |
| 79 | 79 | |
| 80 | + /** | |
| 81 | + * 更新过期的计划明细状态为过期(3) | |
| 82 | + */ | |
| 83 | + void updateExpiredMaintainPlanDetails(); | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 更新过期的计划状态为过期(3) | |
| 87 | + */ | |
| 88 | + void updateExpiredMaintainPlans(); | |
| 89 | + | |
| 80 | 90 | } |
| 81 | 91 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanDetailServiceImpl.java
| ... | ... | @@ -12,10 +12,14 @@ import com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaint |
| 12 | 12 | import com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainNotFinishPlanDetailRespVO; |
| 13 | 13 | import com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanDetailListByRoadPageReqVO; |
| 14 | 14 | import com.zteits.urbanops.module.garden.controller.app.maintainplan.vo.AppMaintainPlanDetailRespVO; |
| 15 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 15 | 16 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDetailDO; |
| 17 | +import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDO; | |
| 16 | 18 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanRoleDO; |
| 17 | 19 | import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanDetailMapper; |
| 20 | +import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanMapper; | |
| 18 | 21 | import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanRoleMapper; |
| 22 | +import com.zteits.urbanops.module.garden.enums.FinishStateEnum; | |
| 19 | 23 | import com.zteits.urbanops.module.system.api.permission.RoleApi; |
| 20 | 24 | import jakarta.annotation.Resource; |
| 21 | 25 | import org.apache.commons.lang3.StringUtils; |
| ... | ... | @@ -44,6 +48,9 @@ public class MaintainPlanDetailServiceImpl implements MaintainPlanDetailService |
| 44 | 48 | private MaintainPlanDetailMapper maintainPlanDetailMapper; |
| 45 | 49 | |
| 46 | 50 | @Resource |
| 51 | + private MaintainPlanMapper maintainPlanMapper; | |
| 52 | + | |
| 53 | + @Resource | |
| 47 | 54 | private MaintainPlanRoleMapper maintainPlanRoleMapper; |
| 48 | 55 | |
| 49 | 56 | @Resource |
| ... | ... | @@ -147,4 +154,26 @@ public class MaintainPlanDetailServiceImpl implements MaintainPlanDetailService |
| 147 | 154 | return roleList.stream().map(MaintainPlanRoleDO::getBatchNo).collect(Collectors.toSet()); |
| 148 | 155 | } |
| 149 | 156 | |
| 157 | + @Override | |
| 158 | + public void updateExpiredMaintainPlanDetails() { | |
| 159 | + // 更新过期的计划明细状态为过期(3) | |
| 160 | + LocalDateTime now = LocalDateTime.now(); | |
| 161 | + LambdaUpdateWrapper<MaintainPlanDetailDO> updateWrapper = new LambdaUpdateWrapper<>(); | |
| 162 | + updateWrapper.lt(MaintainPlanDetailDO::getEndTime, now) | |
| 163 | + .ne(MaintainPlanDetailDO::getFinishState, FinishStateEnum.FINISHED.getStatus()) // 排除已完成的 | |
| 164 | + .set(MaintainPlanDetailDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()); // 设置为过期状态 | |
| 165 | + maintainPlanDetailMapper.update(null, updateWrapper); | |
| 166 | + } | |
| 167 | + | |
| 168 | + @Override | |
| 169 | + public void updateExpiredMaintainPlans() { | |
| 170 | + // 更新过期的计划状态为过期(3) | |
| 171 | + LocalDateTime now = LocalDateTime.now(); | |
| 172 | + LambdaUpdateWrapper<MaintainPlanDO> updateWrapper = new LambdaUpdateWrapper<>(); | |
| 173 | + updateWrapper.lt(MaintainPlanDO::getEndTime, now) | |
| 174 | + .ne(MaintainPlanDO::getFinishState, FinishStateEnum.FINISHED.getStatus()) // 排除已完成的 | |
| 175 | + .set(MaintainPlanDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()); // 设置为过期状态 | |
| 176 | + maintainPlanMapper.update(null, updateWrapper); | |
| 177 | + } | |
| 178 | + | |
| 150 | 179 | } | ... | ... |
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanCommitMapper.xml
| ... | ... | @@ -92,6 +92,7 @@ |
| 92 | 92 | b.plan_num, |
| 93 | 93 | b.busi_line, |
| 94 | 94 | b.plan_finish_num, |
| 95 | + b.rate, | |
| 95 | 96 | a.begin_time, |
| 96 | 97 | a.end_time, |
| 97 | 98 | a.company_id, |
| ... | ... | @@ -101,7 +102,8 @@ |
| 101 | 102 | c.begin_img, |
| 102 | 103 | c.img_host, |
| 103 | 104 | c.finish_time, |
| 104 | - c.user_name | |
| 105 | + c.user_name, | |
| 106 | + c.remark | |
| 105 | 107 | FROM |
| 106 | 108 | garden_maintain_plan_detail a, |
| 107 | 109 | garden_maintain_plan b, | ... | ... |
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanDetailMapper.xml
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | </if> |
| 51 | 51 | <!--状态 1:未完成;2:已完成;3:已失效--> |
| 52 | 52 | <if test="req.finishState == 3"> |
| 53 | + and a.finish_state = #{req.finishState} | |
| 53 | 54 | <![CDATA[and c.end_time < #{req.localDateTime}]]> |
| 54 | 55 | </if> |
| 55 | 56 | <if test="req.finishState == 2"> |
| ... | ... | @@ -86,4 +87,4 @@ |
| 86 | 87 | and c.finish_state = #{req.finishState} |
| 87 | 88 | <![CDATA[and c.end_time >= #{req.localDateTime}]]> |
| 88 | 89 | </select> |
| 89 | -</mapper> | |
| 90 | 90 | \ No newline at end of file |
| 91 | +</mapper> | ... | ... |
urbanops-module-garden/src/main/resources/mapper/maintainplan/MaintainPlanMapper.xml
| ... | ... | @@ -44,6 +44,7 @@ |
| 44 | 44 | </if> |
| 45 | 45 | <!--状态 1:未完成;2:已完成;3:已失效--> |
| 46 | 46 | <if test="req.finishState == 3"> |
| 47 | + and a.finish_state = #{req.finishState} | |
| 47 | 48 | <![CDATA[and a.end_time < #{req.localDate}]]> |
| 48 | 49 | </if> |
| 49 | 50 | <if test="req.finishState == 2"> |
| ... | ... | @@ -93,6 +94,7 @@ |
| 93 | 94 | </if> |
| 94 | 95 | <!--状态 1:未完成;2:已完成;3:已失效--> |
| 95 | 96 | <if test="req.finishState == 3"> |
| 97 | + and c.finish_state = #{req.finishState} | |
| 96 | 98 | <![CDATA[and c.end_time < #{req.localDateTime}]]> |
| 97 | 99 | </if> |
| 98 | 100 | <if test="req.finishState == 2"> |
| ... | ... | @@ -104,4 +106,4 @@ |
| 104 | 106 | </if> |
| 105 | 107 | </select> |
| 106 | 108 | |
| 107 | -</mapper> | |
| 108 | 109 | \ No newline at end of file |
| 110 | +</mapper> | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenServiceImpl.java
| ... | ... | @@ -392,7 +392,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ |
| 392 | 392 | String content = pageVO.getSearchContent(); |
| 393 | 393 | if(ObjectUtils.isNotAllEmpty(type)){ |
| 394 | 394 | if("1".equals(type)){ |
| 395 | - if(ObjectUtils.isNotAllEmpty(content)){mainInfoPageReqVo.setLonLatAddress(content);} | |
| 395 | + if(ObjectUtils.isNotAllEmpty(content)){mainInfoPageReqVo.setRoadName(content);} | |
| 396 | 396 | } else |
| 397 | 397 | if("2".equals(type)){ |
| 398 | 398 | if(ObjectUtils.isNotAllEmpty(content)){mainInfoPageReqVo.setOrderName(content);} | ... | ... |