Commit cf0d14a9ec2d065f059b0264209ce1791ab3951e
1 parent
2672c24e
养护频次增删改查提交
Showing
11 changed files
with
75 additions
and
13 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanController.java
| @@ -80,6 +80,17 @@ public class InspectionPlanController { | @@ -80,6 +80,17 @@ public class InspectionPlanController { | ||
| 80 | return success(true); | 80 | return success(true); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | + @DeleteMapping("/delete-stop-plan") | ||
| 84 | + @Parameter(name = "batchNo", description = "批次号", required = true) | ||
| 85 | + @Operation(summary = "根据batch_no删除巡检计划汇总") | ||
| 86 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan:delete')") | ||
| 87 | + public CommonResult<Boolean> stopPlanInspectionPlan(@RequestParam("batch_no") @NotBlank String batchNo) { | ||
| 88 | + inspectionPlanService.stopPlanInspectionPlan(batchNo); | ||
| 89 | + return success(true); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + | ||
| 83 | 94 | ||
| 84 | 95 | ||
| 85 | @GetMapping("/get") | 96 | @GetMapping("/get") |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanRespVO.java
| 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; |
| 2 | 2 | ||
| 3 | -import com.baomidou.mybatisplus.annotation.FieldFill; | ||
| 4 | -import com.baomidou.mybatisplus.annotation.TableField; | ||
| 5 | import com.fhs.core.trans.anno.Trans; | 3 | import com.fhs.core.trans.anno.Trans; |
| 6 | import com.fhs.core.trans.constant.TransType; | 4 | import com.fhs.core.trans.constant.TransType; |
| 7 | -import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; | 5 | +import com.fhs.core.trans.vo.VO; |
| 8 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | import lombok.*; | 7 | import lombok.*; |
| 10 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 11 | import cn.idev.excel.annotation.*; | 9 | import cn.idev.excel.annotation.*; |
| 12 | -import org.apache.ibatis.type.JdbcType; | ||
| 13 | 10 | ||
| 14 | @Schema(description = "管理后台 - 巡检计划汇总 Response VO") | 11 | @Schema(description = "管理后台 - 巡检计划汇总 Response VO") |
| 15 | @Data | 12 | @Data |
| 16 | @ExcelIgnoreUnannotated | 13 | @ExcelIgnoreUnannotated |
| 17 | -public class InspectionPlanRespVO { | 14 | +public class InspectionPlanRespVO implements VO { |
| 18 | 15 | ||
| 19 | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10938") | 16 | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10938") |
| 20 | @ExcelProperty("ID") | 17 | @ExcelProperty("ID") |
| @@ -92,10 +89,13 @@ public class InspectionPlanRespVO { | @@ -92,10 +89,13 @@ public class InspectionPlanRespVO { | ||
| 92 | @ExcelProperty("创建时间") | 89 | @ExcelProperty("创建时间") |
| 93 | private LocalDateTime createTime; | 90 | private LocalDateTime createTime; |
| 94 | 91 | ||
| 95 | - @Trans(type = TransType.SIMPLE, target = InspectionPlanDO.class, fields = {"creator", "creatorName"}, refs = {"creator", "creatorName"}) | ||
| 96 | - @TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR) | 92 | + @Schema(description = "创建人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 93 | + @Trans(type = TransType.SIMPLE, targetClassName = "com.zteits.urbanops.module.system.dal.dataobject.user.AdminUserDO", | ||
| 94 | + fields = "nickname", ref = "creatorName") | ||
| 97 | private String creator; | 95 | private String creator; |
| 98 | 96 | ||
| 97 | + @Schema(description = "创建人名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "ZIEITS") | ||
| 98 | + @ExcelProperty("创建人") | ||
| 99 | private String creatorName; | 99 | private String creatorName; |
| 100 | 100 | ||
| 101 | } | 101 | } |
| 102 | \ No newline at end of file | 102 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRatePageReqVO.java
| 1 | package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; | 1 | package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; |
| 2 | 2 | ||
| 3 | +import jakarta.validation.constraints.NotNull; | ||
| 3 | import lombok.*; | 4 | import lombok.*; |
| 4 | import java.util.*; | 5 | import java.util.*; |
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| @@ -25,4 +26,8 @@ public class PlanRatePageReqVO extends PageParam { | @@ -25,4 +26,8 @@ public class PlanRatePageReqVO extends PageParam { | ||
| 25 | @Schema(description = "是否为标准计划: 1:是;2:否") | 26 | @Schema(description = "是否为标准计划: 1:是;2:否") |
| 26 | private Integer stdPlan; | 27 | private Integer stdPlan; |
| 27 | 28 | ||
| 29 | + @Schema(description = "类型:1:养护;2:巡查", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 30 | + @NotNull(message = "类型:1:养护;2:巡查不能为空") | ||
| 31 | + private Integer type; | ||
| 32 | + | ||
| 28 | } | 33 | } |
| 29 | \ No newline at end of file | 34 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateSaveReqVO.java
| @@ -23,6 +23,10 @@ public class PlanRateSaveReqVO { | @@ -23,6 +23,10 @@ public class PlanRateSaveReqVO { | ||
| 23 | @NotNull(message = "是否为标准计划: 1:是;2:否不能为空") | 23 | @NotNull(message = "是否为标准计划: 1:是;2:否不能为空") |
| 24 | private Integer stdPlan; | 24 | private Integer stdPlan; |
| 25 | 25 | ||
| 26 | + @Schema(description = "类型:1:养护;2:巡查", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 27 | + @NotNull(message = "类型:1:养护;2:巡查不能为空") | ||
| 28 | + private Integer type; | ||
| 29 | + | ||
| 26 | @NotNull@NotNull(message = "频次明细不能为空") | 30 | @NotNull@NotNull(message = "频次明细不能为空") |
| 27 | @Size(min = 1) | 31 | @Size(min = 1) |
| 28 | @Valid | 32 | @Valid |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateUpdateReqVO.java
| @@ -34,6 +34,10 @@ public class PlanRateUpdateReqVO { | @@ -34,6 +34,10 @@ public class PlanRateUpdateReqVO { | ||
| 34 | @NotNull(message = "是否为标准计划: 1:是;2:否不能为空") | 34 | @NotNull(message = "是否为标准计划: 1:是;2:否不能为空") |
| 35 | private Integer stdPlan; | 35 | private Integer stdPlan; |
| 36 | 36 | ||
| 37 | + @Schema(description = "类型:1:养护;2:巡查", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 38 | + @NotNull(message = "类型:1:养护;2:巡查不能为空") | ||
| 39 | + private Integer type; | ||
| 40 | + | ||
| 37 | @NotNull@NotNull(message = "频次明细不能为空") | 41 | @NotNull@NotNull(message = "频次明细不能为空") |
| 38 | @Size(min = 1) | 42 | @Size(min = 1) |
| 39 | @Valid | 43 | @Valid |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/planrate/PlanRateDO.java
| @@ -43,6 +43,10 @@ public class PlanRateDO extends BaseDO { | @@ -43,6 +43,10 @@ public class PlanRateDO extends BaseDO { | ||
| 43 | * 是否为标准计划: 1:是;2:否 | 43 | * 是否为标准计划: 1:是;2:否 |
| 44 | */ | 44 | */ |
| 45 | private Integer stdPlan; | 45 | private Integer stdPlan; |
| 46 | + /** | ||
| 47 | + * 类型:1:养护;2:巡查 | ||
| 48 | + */ | ||
| 49 | + private Integer type; | ||
| 46 | 50 | ||
| 47 | 51 | ||
| 48 | } | 52 | } |
| 49 | \ No newline at end of file | 53 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/planrate/PlanRateMapper.java
| @@ -24,6 +24,7 @@ public interface PlanRateMapper extends BaseMapperX<PlanRateDO> { | @@ -24,6 +24,7 @@ public interface PlanRateMapper extends BaseMapperX<PlanRateDO> { | ||
| 24 | .eqIfPresent(PlanRateDO::getBusiLine, reqVO.getBusiLine()) | 24 | .eqIfPresent(PlanRateDO::getBusiLine, reqVO.getBusiLine()) |
| 25 | .eqIfPresent(PlanRateDO::getPlanTypeId, reqVO.getPlanTypeId()) | 25 | .eqIfPresent(PlanRateDO::getPlanTypeId, reqVO.getPlanTypeId()) |
| 26 | .eqIfPresent(PlanRateDO::getStdPlan, reqVO.getStdPlan()) | 26 | .eqIfPresent(PlanRateDO::getStdPlan, reqVO.getStdPlan()) |
| 27 | + .eq(PlanRateDO::getType, reqVO.getType()) | ||
| 27 | .orderByDesc(PlanRateDO::getId)); | 28 | .orderByDesc(PlanRateDO::getId)); |
| 28 | } | 29 | } |
| 29 | 30 |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
| @@ -63,6 +63,7 @@ public interface ErrorCodeConstants { | @@ -63,6 +63,7 @@ public interface ErrorCodeConstants { | ||
| 63 | ErrorCode INSPECTION_CYCLE_ID_ERROR = new ErrorCode(1-200-100-002, "周期id错误"); | 63 | ErrorCode INSPECTION_CYCLE_ID_ERROR = new ErrorCode(1-200-100-002, "周期id错误"); |
| 64 | ErrorCode INSPECTION_CYCLE_ERROR = new ErrorCode(1-200-100-003, "获取两个时间之间间隔天数错误"); | 64 | ErrorCode INSPECTION_CYCLE_ERROR = new ErrorCode(1-200-100-003, "获取两个时间之间间隔天数错误"); |
| 65 | ErrorCode INSPECTION_PLAN_EXISTS = new ErrorCode(1-200-100-004, "道路对应类型已存在记录"); | 65 | ErrorCode INSPECTION_PLAN_EXISTS = new ErrorCode(1-200-100-004, "道路对应类型已存在记录"); |
| 66 | + ErrorCode INSPECTION_PLAN_NOT_ALLOW_DELETE = new ErrorCode(1-200-100-005, "计划已开始执行不能删除"); | ||
| 66 | 67 | ||
| 67 | //========== 频次 TODO 补充编号 ========== | 68 | //========== 频次 TODO 补充编号 ========== |
| 68 | ErrorCode PLAN_RATE_EXISTS = new ErrorCode(1-200-200-001, "养护频次已存在"); | 69 | ErrorCode PLAN_RATE_EXISTS = new ErrorCode(1-200-200-001, "养护频次已存在"); |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanService.java
| @@ -66,4 +66,10 @@ public interface InspectionPlanService { | @@ -66,4 +66,10 @@ public interface InspectionPlanService { | ||
| 66 | */ | 66 | */ |
| 67 | void deleteInspectionPlanByBatchNo(String batchNo); | 67 | void deleteInspectionPlanByBatchNo(String batchNo); |
| 68 | 68 | ||
| 69 | + /** | ||
| 70 | + * 终止计划 | ||
| 71 | + * @param batchNo | ||
| 72 | + */ | ||
| 73 | + void stopPlanInspectionPlan(String batchNo); | ||
| 74 | + | ||
| 69 | } | 75 | } |
| 70 | \ No newline at end of file | 76 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| @@ -171,13 +171,27 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -171,13 +171,27 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 171 | 171 | ||
| 172 | private void validateInspectionPlanExists(InspectionPlanSaveReqVO req) { | 172 | private void validateInspectionPlanExists(InspectionPlanSaveReqVO req) { |
| 173 | Set<Long> roadIds = req.getRoadListReqVO().stream().map(InspectionPlanRoadReqVO::getRoadId).collect(Collectors.toSet()); | 173 | Set<Long> roadIds = req.getRoadListReqVO().stream().map(InspectionPlanRoadReqVO::getRoadId).collect(Collectors.toSet()); |
| 174 | - QueryWrapper<InspectionPlanDO> sql = new QueryWrapper<>(); | ||
| 175 | - sql.lambda().eq(InspectionPlanDO::getPlanTypeId, req.getPlanTypeId()) | ||
| 176 | - .in(InspectionPlanDO::getRoadId, roadIds) | ||
| 177 | - .le(InspectionPlanDO::getBeginTime, req.getEndTime()) // start_time <= endTime | ||
| 178 | - .ge(InspectionPlanDO::getEndTime, req.getBeginTime()); // end_time >= startTime | 174 | + Long count =0L; |
| 175 | + //标准计划 | ||
| 176 | + if(req.getPlanAttr().equals(1)){ | ||
| 177 | + QueryWrapper<InspectionPlanDO> sql = new QueryWrapper<>(); | ||
| 178 | + sql.lambda().eq(InspectionPlanDO::getPlanTypeId, req.getPlanTypeId()) | ||
| 179 | + .in(InspectionPlanDO::getRoadId, roadIds) | ||
| 180 | + .le(InspectionPlanDO::getBeginTime, req.getEndTime()) // start_time <= endTime | ||
| 181 | + .ge(InspectionPlanDO::getEndTime, req.getBeginTime()); // end_time >= startTime | ||
| 182 | + | ||
| 183 | + count = inspectionPlanMapper.selectCount(sql); | ||
| 184 | + }else{ | ||
| 185 | + QueryWrapper<InspectionPlanDO> sql = new QueryWrapper<>(); | ||
| 186 | + sql.lambda().eq(InspectionPlanDO::getPlanTypeId, req.getPlanTypeId()) | ||
| 187 | + .in(InspectionPlanDO::getRoadId, roadIds) | ||
| 188 | + .eq(InspectionPlanDO::getDeleted, 0) | ||
| 189 | + .le(InspectionPlanDO::getBeginTime, req.getEndTime()) // start_time <= endTime | ||
| 190 | + .ge(InspectionPlanDO::getEndTime, req.getBeginTime()); // end_time >= startTime | ||
| 191 | + | ||
| 192 | + count = inspectionPlanMapper.selectCount(sql); | ||
| 193 | + } | ||
| 179 | 194 | ||
| 180 | - Long count = inspectionPlanMapper.selectCount(sql); | ||
| 181 | if (count > 0) { | 195 | if (count > 0) { |
| 182 | throw exception(INSPECTION_PLAN_EXISTS); | 196 | throw exception(INSPECTION_PLAN_EXISTS); |
| 183 | } | 197 | } |
| @@ -202,9 +216,20 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -202,9 +216,20 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 202 | 216 | ||
| 203 | @Override | 217 | @Override |
| 204 | public void deleteInspectionPlanByBatchNo(String batchNo) { | 218 | public void deleteInspectionPlanByBatchNo(String batchNo) { |
| 219 | + InspectionPlanDO inspectionPlanDO = inspectionPlanMapper.selectOne(InspectionPlanDO::getBatchNo, batchNo); | ||
| 220 | + if(inspectionPlanDO !=null && inspectionPlanDO.getPlanFinishNum() >0){ | ||
| 221 | + throw exception(INSPECTION_PLAN_NOT_ALLOW_DELETE); | ||
| 222 | + } | ||
| 205 | inspectionPlanMapper.deleteByBatchNo(batchNo); | 223 | inspectionPlanMapper.deleteByBatchNo(batchNo); |
| 206 | inspectionPlanDetailMapper.deleteByBatchNo(batchNo); | 224 | inspectionPlanDetailMapper.deleteByBatchNo(batchNo); |
| 207 | inspectionPlanRoleMapper.deleteByBatchNo(batchNo); | 225 | inspectionPlanRoleMapper.deleteByBatchNo(batchNo); |
| 208 | } | 226 | } |
| 209 | 227 | ||
| 228 | + @Override | ||
| 229 | + public void stopPlanInspectionPlan(String batchNo) { | ||
| 230 | + inspectionPlanMapper.delete(InspectionPlanDO::getBatchNo, batchNo); | ||
| 231 | + inspectionPlanDetailMapper.delete(InspectionPlanDetailDO::getBatchNo,batchNo); | ||
| 232 | + inspectionPlanRoleMapper.delete(InspectionPlanRoleDO::getBatchNo, batchNo); | ||
| 233 | + } | ||
| 234 | + | ||
| 210 | } | 235 | } |
| 211 | \ No newline at end of file | 236 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/planrate/PlanRateServiceImpl.java
| @@ -52,6 +52,7 @@ public class PlanRateServiceImpl implements PlanRateService { | @@ -52,6 +52,7 @@ public class PlanRateServiceImpl implements PlanRateService { | ||
| 52 | planRate.setStdPlan(createReqVO.getStdPlan()); | 52 | planRate.setStdPlan(createReqVO.getStdPlan()); |
| 53 | planRate.setBusiLine(createReqVO.getBusiLine()); | 53 | planRate.setBusiLine(createReqVO.getBusiLine()); |
| 54 | planRate.setPlanTypeId(createReqVO.getPlanTypeId()); | 54 | planRate.setPlanTypeId(createReqVO.getPlanTypeId()); |
| 55 | + planRate.setType(createReqVO.getType()); | ||
| 55 | planRate.setCreator(userName); | 56 | planRate.setCreator(userName); |
| 56 | planRate.setCreateTime(now); | 57 | planRate.setCreateTime(now); |
| 57 | planRate.setUpdater(userName); | 58 | planRate.setUpdater(userName); |