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 | 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 | 96 | @GetMapping("/get") | ... | ... |
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 com.baomidou.mybatisplus.annotation.FieldFill; | |
| 4 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | 3 | import com.fhs.core.trans.anno.Trans; |
| 6 | 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 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | 7 | import lombok.*; |
| 10 | 8 | import java.time.LocalDateTime; |
| 11 | 9 | import cn.idev.excel.annotation.*; |
| 12 | -import org.apache.ibatis.type.JdbcType; | |
| 13 | 10 | |
| 14 | 11 | @Schema(description = "管理后台 - 巡检计划汇总 Response VO") |
| 15 | 12 | @Data |
| 16 | 13 | @ExcelIgnoreUnannotated |
| 17 | -public class InspectionPlanRespVO { | |
| 14 | +public class InspectionPlanRespVO implements VO { | |
| 18 | 15 | |
| 19 | 16 | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10938") |
| 20 | 17 | @ExcelProperty("ID") |
| ... | ... | @@ -92,10 +89,13 @@ public class InspectionPlanRespVO { |
| 92 | 89 | @ExcelProperty("创建时间") |
| 93 | 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 | 95 | private String creator; |
| 98 | 96 | |
| 97 | + @Schema(description = "创建人名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "ZIEITS") | |
| 98 | + @ExcelProperty("创建人") | |
| 99 | 99 | private String creatorName; |
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 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 | 1 | package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; |
| 2 | 2 | |
| 3 | +import jakarta.validation.constraints.NotNull; | |
| 3 | 4 | import lombok.*; |
| 4 | 5 | import java.util.*; |
| 5 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| ... | ... | @@ -25,4 +26,8 @@ public class PlanRatePageReqVO extends PageParam { |
| 25 | 26 | @Schema(description = "是否为标准计划: 1:是;2:否") |
| 26 | 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 | 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 | 23 | @NotNull(message = "是否为标准计划: 1:是;2:否不能为空") |
| 24 | 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 | 30 | @NotNull@NotNull(message = "频次明细不能为空") |
| 27 | 31 | @Size(min = 1) |
| 28 | 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 | 34 | @NotNull(message = "是否为标准计划: 1:是;2:否不能为空") |
| 35 | 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 | 41 | @NotNull@NotNull(message = "频次明细不能为空") |
| 38 | 42 | @Size(min = 1) |
| 39 | 43 | @Valid | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/planrate/PlanRateDO.java
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 | 24 | .eqIfPresent(PlanRateDO::getBusiLine, reqVO.getBusiLine()) |
| 25 | 25 | .eqIfPresent(PlanRateDO::getPlanTypeId, reqVO.getPlanTypeId()) |
| 26 | 26 | .eqIfPresent(PlanRateDO::getStdPlan, reqVO.getStdPlan()) |
| 27 | + .eq(PlanRateDO::getType, reqVO.getType()) | |
| 27 | 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 | 63 | ErrorCode INSPECTION_CYCLE_ID_ERROR = new ErrorCode(1-200-100-002, "周期id错误"); |
| 64 | 64 | ErrorCode INSPECTION_CYCLE_ERROR = new ErrorCode(1-200-100-003, "获取两个时间之间间隔天数错误"); |
| 65 | 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 | 68 | //========== 频次 TODO 补充编号 ========== |
| 68 | 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
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 | 171 | |
| 172 | 172 | private void validateInspectionPlanExists(InspectionPlanSaveReqVO req) { |
| 173 | 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 | 195 | if (count > 0) { |
| 182 | 196 | throw exception(INSPECTION_PLAN_EXISTS); |
| 183 | 197 | } |
| ... | ... | @@ -202,9 +216,20 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 202 | 216 | |
| 203 | 217 | @Override |
| 204 | 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 | 223 | inspectionPlanMapper.deleteByBatchNo(batchNo); |
| 206 | 224 | inspectionPlanDetailMapper.deleteByBatchNo(batchNo); |
| 207 | 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 | 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 | 52 | planRate.setStdPlan(createReqVO.getStdPlan()); |
| 53 | 53 | planRate.setBusiLine(createReqVO.getBusiLine()); |
| 54 | 54 | planRate.setPlanTypeId(createReqVO.getPlanTypeId()); |
| 55 | + planRate.setType(createReqVO.getType()); | |
| 55 | 56 | planRate.setCreator(userName); |
| 56 | 57 | planRate.setCreateTime(now); |
| 57 | 58 | planRate.setUpdater(userName); | ... | ... |