Commit 50b6254e62a3a874f5de9fd69661cb72f5999799
1 parent
ad2389a4
增加查询条件
Showing
7 changed files
with
41 additions
and
33 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanRespVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; |
| 2 | 2 | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 3 | 5 | import com.fhs.core.trans.vo.VO; |
| 4 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | -import lombok.*; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.time.LocalDate; | |
| 6 | 10 | import java.time.LocalDateTime; |
| 7 | 11 | import java.util.List; |
| 8 | 12 | |
| 9 | -import cn.idev.excel.annotation.*; | |
| 10 | - | |
| 11 | 13 | @Schema(description = "管理后台 - 巡检计划汇总 Response VO") |
| 12 | 14 | @Data |
| 13 | 15 | @ExcelIgnoreUnannotated |
| ... | ... | @@ -86,11 +88,11 @@ public class InspectionPlanRespVO implements VO { |
| 86 | 88 | |
| 87 | 89 | @Schema(description = "开始时间") |
| 88 | 90 | @ExcelProperty("开始时间") |
| 89 | - private LocalDateTime beginTime; | |
| 91 | + private LocalDate beginTime; | |
| 90 | 92 | |
| 91 | 93 | @Schema(description = "开始时间") |
| 92 | 94 | @ExcelProperty("开始时间") |
| 93 | - private LocalDateTime endTime; | |
| 95 | + private LocalDate endTime; | |
| 94 | 96 | |
| 95 | 97 | @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") |
| 96 | 98 | @ExcelProperty("备注") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/inspectionplan/vo/AppInspectionPlanRespVO.java
| ... | ... | @@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | import org.springframework.format.annotation.DateTimeFormat; |
| 7 | 7 | |
| 8 | -import java.time.LocalDateTime; | |
| 8 | +import java.time.LocalDate; | |
| 9 | 9 | |
| 10 | 10 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| 11 | 11 | |
| ... | ... | @@ -37,11 +37,11 @@ public class AppInspectionPlanRespVO { |
| 37 | 37 | |
| 38 | 38 | @Schema(description = "执行开始时间") |
| 39 | 39 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 40 | - private LocalDateTime beginTime; | |
| 40 | + private LocalDate beginTime; | |
| 41 | 41 | |
| 42 | 42 | @Schema(description = "执行时间") |
| 43 | 43 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 44 | - private LocalDateTime endTime; | |
| 44 | + private LocalDate endTime; | |
| 45 | 45 | |
| 46 | 46 | @Schema(description = "完成状态 1:未完成;2:进行中;3:已完成", requiredMode = Schema.RequiredMode.REQUIRED) |
| 47 | 47 | private Integer finishState; | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/maintainplan/vo/AppMaintainPlanPageRoadRespVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.app.maintainplan.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.idev.excel.annotation.ExcelProperty; |
| 4 | -import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 5 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | 5 | import jakarta.validation.constraints.Max; |
| 7 | 6 | import jakarta.validation.constraints.Min; |
| ... | ... | @@ -9,6 +8,7 @@ import jakarta.validation.constraints.NotNull; |
| 9 | 8 | import lombok.Data; |
| 10 | 9 | import org.springframework.format.annotation.DateTimeFormat; |
| 11 | 10 | |
| 11 | +import java.time.LocalDate; | |
| 12 | 12 | import java.time.LocalDateTime; |
| 13 | 13 | |
| 14 | 14 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| ... | ... | @@ -52,10 +52,10 @@ public class AppMaintainPlanPageRoadRespVO{ |
| 52 | 52 | |
| 53 | 53 | @Schema(description = "执行开始时间") |
| 54 | 54 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 55 | - private LocalDateTime beginTime; | |
| 55 | + private LocalDate beginTime; | |
| 56 | 56 | |
| 57 | 57 | @Schema(description = "执行时间") |
| 58 | 58 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 59 | - private LocalDateTime endTime; | |
| 59 | + private LocalDate endTime; | |
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/inspectionplan/InspectionPlanDO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.time.LocalDateTime; | |
| 5 | -import com.baomidou.mybatisplus.annotation.*; | |
| 3 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 6 | 6 | import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; |
| 7 | +import lombok.*; | |
| 8 | + | |
| 9 | +import java.time.LocalDate; | |
| 7 | 10 | |
| 8 | 11 | /** |
| 9 | 12 | * 巡检计划汇总 DO |
| ... | ... | @@ -89,11 +92,11 @@ public class InspectionPlanDO extends BaseDO { |
| 89 | 92 | /** |
| 90 | 93 | * 开始时间 |
| 91 | 94 | */ |
| 92 | - private LocalDateTime beginTime; | |
| 95 | + private LocalDate beginTime; | |
| 93 | 96 | /** |
| 94 | 97 | * 开始时间 |
| 95 | 98 | */ |
| 96 | - private LocalDateTime endTime; | |
| 99 | + private LocalDate endTime; | |
| 97 | 100 | /** |
| 98 | 101 | * 备注 |
| 99 | 102 | */ | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanDetailServiceImpl.java
| ... | ... | @@ -9,8 +9,6 @@ import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.Insp |
| 9 | 9 | import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanDetailReqVO; |
| 10 | 10 | import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanDetailRespVO; |
| 11 | 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; | |
| 14 | 12 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper; |
| 15 | 13 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanRoleMapper; |
| 16 | 14 | import com.zteits.urbanops.module.garden.enums.FinishStateEnum; |
| ... | ... | @@ -20,7 +18,9 @@ import org.apache.commons.lang3.StringUtils; |
| 20 | 18 | import org.springframework.stereotype.Service; |
| 21 | 19 | import org.springframework.validation.annotation.Validated; |
| 22 | 20 | |
| 21 | +import java.time.LocalDate; | |
| 23 | 22 | import java.time.LocalDateTime; |
| 23 | +import java.time.LocalTime; | |
| 24 | 24 | import java.util.Arrays; |
| 25 | 25 | import java.util.List; |
| 26 | 26 | |
| ... | ... | @@ -109,11 +109,11 @@ public class InspectionPlanDetailServiceImpl implements InspectionPlanDetailServ |
| 109 | 109 | @Override |
| 110 | 110 | public void updateExpiredInspectionPlanDetails() { |
| 111 | 111 | // 更新过期的计划明细状态为过期(3) |
| 112 | - LocalDateTime now = LocalDateTime.now(); | |
| 112 | + LocalDateTime localDateTime = LocalDate.now().atStartOfDay(); //00:00:00 | |
| 113 | 113 | LambdaUpdateWrapper<InspectionPlanDetailDO> updateWrapper = new LambdaUpdateWrapper<>(); |
| 114 | - updateWrapper.lt(InspectionPlanDetailDO::getEndTime, now) | |
| 115 | - .ne(InspectionPlanDetailDO::getFinishState, FinishStateEnum.FINISHED.getStatus()) // 排除已完成的 | |
| 116 | - .set(InspectionPlanDetailDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()); // 设置为过期状态 | |
| 114 | + updateWrapper.lt(InspectionPlanDetailDO::getEndTime, localDateTime) | |
| 115 | + .set(InspectionPlanDetailDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()) // 设置为过期状态 | |
| 116 | + .eq(InspectionPlanDetailDO::getFinishState, FinishStateEnum.NOT_FINISHED.getStatus()); | |
| 117 | 117 | inspectionPlanDetailMapper.update(null, updateWrapper); |
| 118 | 118 | } |
| 119 | 119 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| ... | ... | @@ -415,9 +415,9 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 415 | 415 | @Override |
| 416 | 416 | public void updateExpiredInspectionPlans() { |
| 417 | 417 | // 更新过期的计划状态为过期(3) |
| 418 | - LocalDateTime now = LocalDateTime.now(); | |
| 418 | + LocalDate yesterday = LocalDate.now(); // 昨天日期 | |
| 419 | 419 | LambdaUpdateWrapper<InspectionPlanDO> updateWrapper = new LambdaUpdateWrapper<>(); |
| 420 | - updateWrapper.lt(InspectionPlanDO::getEndTime, now) | |
| 420 | + updateWrapper.lt(InspectionPlanDO::getEndTime, yesterday) | |
| 421 | 421 | .ne(InspectionPlanDO::getFinishState, FinishStateEnum.FINISHED.getStatus()) // 排除已完成的 |
| 422 | 422 | .set(InspectionPlanDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()); // 设置为过期状态 |
| 423 | 423 | inspectionPlanMapper.update(null, updateWrapper); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanDetailServiceImpl.java
| ... | ... | @@ -27,7 +27,9 @@ import org.springframework.stereotype.Service; |
| 27 | 27 | import org.springframework.util.CollectionUtils; |
| 28 | 28 | import org.springframework.validation.annotation.Validated; |
| 29 | 29 | |
| 30 | +import java.time.LocalDate; | |
| 30 | 31 | import java.time.LocalDateTime; |
| 32 | +import java.time.LocalTime; | |
| 31 | 33 | import java.util.Arrays; |
| 32 | 34 | import java.util.Collections; |
| 33 | 35 | import java.util.List; |
| ... | ... | @@ -157,23 +159,24 @@ public class MaintainPlanDetailServiceImpl implements MaintainPlanDetailService |
| 157 | 159 | @Override |
| 158 | 160 | public void updateExpiredMaintainPlanDetails() { |
| 159 | 161 | // 更新过期的计划明细状态为过期(3) |
| 160 | - LocalDateTime now = LocalDateTime.now(); | |
| 162 | + LocalDateTime localDateTime = LocalDate.now().atStartOfDay(); //00:00:00 | |
| 161 | 163 | 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); | |
| 164 | + updateWrapper.lt(MaintainPlanDetailDO::getEndTime, localDateTime) | |
| 165 | + .set(MaintainPlanDetailDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()) // 设置为过期状态 | |
| 166 | + .eq(MaintainPlanDetailDO::getFinishState, FinishStateEnum.NOT_FINISHED.getStatus()); | |
| 167 | + | |
| 168 | + maintainPlanDetailMapper.update(updateWrapper); | |
| 166 | 169 | } |
| 167 | 170 | |
| 168 | 171 | @Override |
| 169 | 172 | public void updateExpiredMaintainPlans() { |
| 170 | 173 | // 更新过期的计划状态为过期(3) |
| 171 | - LocalDateTime now = LocalDateTime.now(); | |
| 174 | + LocalDate now = LocalDate.now(); | |
| 172 | 175 | LambdaUpdateWrapper<MaintainPlanDO> updateWrapper = new LambdaUpdateWrapper<>(); |
| 173 | 176 | 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 | + .set(MaintainPlanDO::getFinishState, FinishStateEnum.EXPIRED.getStatus()) // 设置为过期状态 | |
| 178 | + .eq(MaintainPlanDO::getFinishState, FinishStateEnum.NOT_FINISHED.getStatus()); | |
| 179 | + maintainPlanMapper.update(updateWrapper); | |
| 177 | 180 | } |
| 178 | 181 | |
| 179 | 182 | } | ... | ... |