Commit 5c63a885850c22be4132568ea2ca5293e9510c48
1 parent
7a75ca93
养护计划提交
Showing
7 changed files
with
127 additions
and
42 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanSaveReqVO.java
| ... | ... | @@ -15,6 +15,7 @@ import jakarta.validation.constraints.*; |
| 15 | 15 | public class InspectionPlanSaveReqVO { |
| 16 | 16 | |
| 17 | 17 | @Schema(description = "计划名称后缀", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "张三") |
| 18 | + @Size(max = 15) | |
| 18 | 19 | private String planNameSuffix; |
| 19 | 20 | |
| 20 | 21 | @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanController.java
| ... | ... | @@ -48,7 +48,7 @@ public class MaintainPlanController { |
| 48 | 48 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan:create')") |
| 49 | 49 | public CommonResult<Integer> createMaintainPlan(@Valid @RequestBody MaintainPlanSaveReqVO createReqVO) { |
| 50 | 50 | if(!createReqVO.verify()){ |
| 51 | - log.warn("次数值范围:1-20或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); | |
| 51 | + log.warn("次数值范围:1-10或者分数格式:1/3, rateValue={}", createReqVO.getRateValue()); | |
| 52 | 52 | return error(PLAN_RATE_VALUE_ERROR); |
| 53 | 53 | } |
| 54 | 54 | return maintainPlanService.createMaintainPlan(createReqVO); |
| ... | ... | @@ -57,7 +57,7 @@ public class MaintainPlanController { |
| 57 | 57 | @PutMapping("/update") |
| 58 | 58 | @Operation(summary = "更新养护计划汇总") |
| 59 | 59 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan:update')") |
| 60 | - public CommonResult<Boolean> updateMaintainPlan(@Valid @RequestBody MaintainPlanSaveReqVO updateReqVO) { | |
| 60 | + public CommonResult<Boolean> updateMaintainPlan(@Valid @RequestBody MaintainPlanUpdateReqVO updateReqVO) { | |
| 61 | 61 | maintainPlanService.updateMaintainPlan(updateReqVO); |
| 62 | 62 | return success(true); |
| 63 | 63 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanSaveReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRoadReqVO; | |
| 3 | 4 | import com.zteits.urbanops.module.garden.util.StringValidateUtil; |
| 4 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 6 | import jakarta.validation.Valid; |
| ... | ... | @@ -14,21 +15,22 @@ import jakarta.validation.constraints.*; |
| 14 | 15 | public class MaintainPlanSaveReqVO { |
| 15 | 16 | |
| 16 | 17 | @Schema(description = "计划名称后缀", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "张三") |
| 18 | + @Size(max = 15) | |
| 17 | 19 | private String planNameSuffix; |
| 18 | 20 | |
| 19 | 21 | @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) |
| 20 | 22 | @NotEmpty(message = "业务线: yl-园林;wy-物业:sz-市政不能为空") |
| 21 | 23 | private String busiLine; |
| 22 | 24 | |
| 23 | - @Schema(description = "计划属性:1:标准计划;2:临时计划", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 25 | + @Schema(description = "计划属性:1:标准计划;2:临时计划", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | 26 | @NotNull(message = "计划属性:1:标准计划;2:临时计划不能为空") |
| 25 | 27 | private Integer planAttr; |
| 26 | 28 | |
| 27 | - @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", requiredMode = Schema.RequiredMode.REQUIRED, example = "7439") | |
| 29 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", requiredMode = Schema.RequiredMode.REQUIRED, example = "24742") | |
| 28 | 30 | @NotNull(message = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;不能为空") |
| 29 | 31 | private Integer planTypeId; |
| 30 | 32 | |
| 31 | - @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1713") | |
| 33 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | |
| 32 | 34 | @NotNull(message = "归属(一级部门id)不能为空") |
| 33 | 35 | private Long companyId; |
| 34 | 36 | |
| ... | ... | @@ -38,8 +40,7 @@ public class MaintainPlanSaveReqVO { |
| 38 | 40 | @Valid |
| 39 | 41 | private List<MaintainPlanRoadReqVO> roadListReqVO; |
| 40 | 42 | |
| 41 | - | |
| 42 | - @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", requiredMode = Schema.RequiredMode.REQUIRED, example = "16420") | |
| 43 | + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", requiredMode = Schema.RequiredMode.REQUIRED, example = "8588") | |
| 43 | 44 | @NotNull(message = "养护级别: 10:特级;11:一级:12:二级;13:三级不能为空") |
| 44 | 45 | private Integer levelId; |
| 45 | 46 | |
| ... | ... | @@ -47,8 +48,10 @@ public class MaintainPlanSaveReqVO { |
| 47 | 48 | @NotEmpty(message = "频次值不能为空") |
| 48 | 49 | private String rateValue; |
| 49 | 50 | |
| 50 | - @Schema(description = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次", requiredMode = Schema.RequiredMode.REQUIRED, example = "28220") | |
| 51 | + @Schema(description = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 51 | 52 | @NotNull(message = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次不能为空") |
| 53 | + @Min(1) | |
| 54 | + @Max(4) | |
| 52 | 55 | private Integer cycleId; |
| 53 | 56 | |
| 54 | 57 | @Schema(description = "开始时间") |
| ... | ... | @@ -57,7 +60,7 @@ public class MaintainPlanSaveReqVO { |
| 57 | 60 | @Schema(description = "开始时间") |
| 58 | 61 | private LocalDate endTime; |
| 59 | 62 | |
| 60 | - @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 63 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | |
| 61 | 64 | private String remark; |
| 62 | 65 | |
| 63 | 66 | @NotNull(message = "角色Ids不能为空") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanUpdateReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.module.garden.util.StringValidateUtil; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import jakarta.validation.Valid; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.time.LocalDate; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Set; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - 养护计划汇总新增/修改 Request VO") | |
| 15 | +@Data | |
| 16 | +public class MaintainPlanUpdateReqVO { | |
| 17 | + | |
| 18 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10938") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + | |
| 22 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 23 | + @NotEmpty(message = "业务线: yl-园林;wy-物业:sz-市政不能为空") | |
| 24 | + private String busiLine; | |
| 25 | + | |
| 26 | + @Schema(description = "计划属性:1:标准计划;2:临时计划", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 27 | + @NotNull(message = "计划属性:1:标准计划;2:临时计划不能为空") | |
| 28 | + private Integer planAttr; | |
| 29 | + | |
| 30 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", requiredMode = Schema.RequiredMode.REQUIRED, example = "24742") | |
| 31 | + @NotNull(message = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;不能为空") | |
| 32 | + private Integer planTypeId; | |
| 33 | + | |
| 34 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | |
| 35 | + @NotNull(message = "归属(一级部门id)不能为空") | |
| 36 | + private Long companyId; | |
| 37 | + | |
| 38 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16445") | |
| 39 | + @NotNull(message = "部门ID(道路负责部门id)不能为空") | |
| 40 | + private Long deptId; | |
| 41 | + | |
| 42 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15557") | |
| 43 | + @NotNull(message = "道路ID不能为空") | |
| 44 | + private Long roadId; | |
| 45 | + | |
| 46 | + @Schema(description = "道路名称", example = "赵六") | |
| 47 | + private String roadName; | |
| 48 | + | |
| 49 | + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", requiredMode = Schema.RequiredMode.REQUIRED, example = "8588") | |
| 50 | + @NotNull(message = "养护级别: 10:特级;11:一级:12:二级;13:三级不能为空") | |
| 51 | + private Integer levelId; | |
| 52 | + | |
| 53 | + @Schema(description = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次", requiredMode = Schema.RequiredMode.REQUIRED, example = "6415") | |
| 54 | + @NotNull(message = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次不能为空") | |
| 55 | + private Integer cycleId; | |
| 56 | + | |
| 57 | + @Schema(description = "计划次数", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 58 | + @NotNull(message = "计划次数不能为空") | |
| 59 | + private Integer planNum; | |
| 60 | + | |
| 61 | + @Schema(description = "已完成次数", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 62 | + @NotNull(message = "已完成次数不能为空") | |
| 63 | + private Integer planFinishNum; | |
| 64 | + | |
| 65 | + @Schema(description = "完成状态 1:未完成;2:已完成", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 66 | + @NotNull(message = "完成状态 1:未完成;2:已完成不能为空") | |
| 67 | + private Integer finishState; | |
| 68 | + | |
| 69 | + @Schema(description = "开始时间") | |
| 70 | + private LocalDateTime beginTime; | |
| 71 | + | |
| 72 | + @Schema(description = "开始时间") | |
| 73 | + private LocalDateTime endTime; | |
| 74 | + | |
| 75 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | |
| 76 | + @NotEmpty(message = "备注不能为空") | |
| 77 | + private String remark; | |
| 78 | +} | |
| 0 | 79 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| ... | ... | @@ -138,7 +138,6 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 138 | 138 | roleList.add(inspectionPlanRoleDO); |
| 139 | 139 | }); |
| 140 | 140 | /*3.插入巡查计划明细*/ |
| 141 | - | |
| 142 | 141 | for (PeriodResult periodResult : calculate) { |
| 143 | 142 | InspectionPlanDetailDO entity = getInspectionPlanDetailDO(batchNo, createReqVO, roadReqVO, now); |
| 144 | 143 | ThreadUtil.sleep(2); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanService.java
| ... | ... | @@ -29,7 +29,7 @@ public interface MaintainPlanService { |
| 29 | 29 | * |
| 30 | 30 | * @param updateReqVO 更新信息 |
| 31 | 31 | */ |
| 32 | - void updateMaintainPlan(@Valid MaintainPlanSaveReqVO updateReqVO); | |
| 32 | + void updateMaintainPlan(@Valid MaintainPlanUpdateReqVO updateReqVO); | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * 删除养护计划汇总 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanServiceImpl.java
| ... | ... | @@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 7 | 7 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 8 | 8 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; |
| 9 | 9 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 10 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; | |
| 10 | 11 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; |
| 12 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 11 | 13 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDetailDO; |
| 12 | 14 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanRoleDO; |
| 13 | 15 | import com.zteits.urbanops.module.garden.dal.mysql.maintainplan.MaintainPlanDetailMapper; |
| ... | ... | @@ -71,24 +73,20 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 71 | 73 | @Resource |
| 72 | 74 | private RoleApi roleApi; |
| 73 | 75 | |
| 74 | - @Resource | |
| 75 | - private MaintainPlanRoleMapper MaintainPlanRoleMapper; | |
| 76 | - | |
| 77 | 76 | @Override |
| 78 | 77 | public CommonResult<Integer> createMaintainPlan(MaintainPlanSaveReqVO createReqVO) { |
| 79 | 78 | //存在性校验 |
| 80 | 79 | validateMaintainPlanExists(createReqVO); |
| 81 | 80 | LocalDateTime now = LocalDateTime.now(); |
| 82 | - String userId = SecurityFrameworkUtils.getLoginUserId()+""; | |
| 81 | + String userId = SecurityFrameworkUtils.getLoginUserId() + ""; | |
| 83 | 82 | String userName = SecurityFrameworkUtils.getLoginUserNickname(); |
| 84 | 83 | String rateValue; |
| 85 | 84 | if (createReqVO.getRateValue().contains("/")) { |
| 86 | 85 | rateValue = createReqVO.getRateValue().trim(); |
| 87 | 86 | } else { |
| 88 | - rateValue = createReqVO.getRateValue().trim()+"/1"; | |
| 87 | + rateValue = createReqVO.getRateValue().trim() + "/1"; | |
| 89 | 88 | } |
| 90 | 89 | //计算开始和计算时间 在间隔周期下每天的次数 |
| 91 | - //计算开始和计算时间 在间隔周期下每天的次数 | |
| 92 | 90 | List<PeriodResult> calculate = TimeIntervalFrequencyUtil.calculate(createReqVO.getBeginTime().toString(), createReqVO.getEndTime().toString(), rateValue, createReqVO.getCycleId()); |
| 93 | 91 | if (CollectionUtils.isEmpty(calculate)) { |
| 94 | 92 | log.warn("获取两个时间之间间隔天数错误"); |
| ... | ... | @@ -96,8 +94,6 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 96 | 94 | } |
| 97 | 95 | //计算计划次数 |
| 98 | 96 | Integer planNum = calculate.size(); |
| 99 | - | |
| 100 | - | |
| 101 | 97 | //巡检计划list |
| 102 | 98 | List<MaintainPlanDO> maintainPlanList = new ArrayList<>(); |
| 103 | 99 | //角色列表 |
| ... | ... | @@ -107,7 +103,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 107 | 103 | //按照道路创建计划 |
| 108 | 104 | createReqVO.getRoadListReqVO().forEach(roadReqVO -> { |
| 109 | 105 | MaintainPlanDO maintainPlan = BeanUtils.toBean(createReqVO, MaintainPlanDO.class); |
| 110 | - String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(10000)+roadReqVO.getRoadId(); | |
| 106 | + String batchNo = "BN" + System.currentTimeMillis() + RandomUtil.randomInt(10000) + roadReqVO.getRoadId(); | |
| 111 | 107 | maintainPlan.setBatchNo(batchNo); |
| 112 | 108 | maintainPlan.setPlanFinishNum(0); |
| 113 | 109 | maintainPlan.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus()); |
| ... | ... | @@ -124,8 +120,8 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 124 | 120 | maintainPlan.setRoadName(roadReqVO.getRoadName()); |
| 125 | 121 | //计划属性label |
| 126 | 122 | String planAttrLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); |
| 127 | - String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.MAINTAIN_TYPE, createReqVO.getPlanTypeId()); | |
| 128 | - String planNameSuffix = StringUtil.isNotEmpty(createReqVO.getPlanNameSuffix()) ? createReqVO.getPlanNameSuffix() :""; | |
| 123 | + String planTypeIdLabel = DictFrameworkUtils.parseDictDataLabel(PlanConstants.INSPECTION_MAINTAIN_TYPE, createReqVO.getPlanTypeId()); | |
| 124 | + String planNameSuffix = StringUtil.isNotEmpty(createReqVO.getPlanNameSuffix()) ? createReqVO.getPlanNameSuffix() : ""; | |
| 129 | 125 | maintainPlan.setPlanName(roadReqVO.getRoadName() + planAttrLabel + planTypeIdLabel + planNameSuffix); |
| 130 | 126 | maintainPlanList.add(maintainPlan); |
| 131 | 127 | /*2.插入角色*/ |
| ... | ... | @@ -162,11 +158,11 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 162 | 158 | |
| 163 | 159 | private MaintainPlanDetailDO getMaintainPlanDetailDO(String batchNo, MaintainPlanSaveReqVO saveReqVO, |
| 164 | 160 | MaintainPlanRoadReqVO roadReqVO, LocalDateTime now) { |
| 165 | - String userId = SecurityFrameworkUtils.getLoginUserId()+""; | |
| 161 | + String userId = SecurityFrameworkUtils.getLoginUserId() + ""; | |
| 166 | 162 | String userName = SecurityFrameworkUtils.getLoginUserNickname(); |
| 167 | 163 | MaintainPlanDetailDO entity = new MaintainPlanDetailDO(); |
| 168 | 164 | entity.setBatchNo(batchNo); |
| 169 | - entity.setPlanNo("Y" + DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + RandomUtil.randomInt(1000)); | |
| 165 | + entity.setPlanNo("Y" + System.currentTimeMillis() + RandomUtil.randomInt(1000)); | |
| 170 | 166 | entity.setBusiLine(saveReqVO.getBusiLine()); |
| 171 | 167 | entity.setCompanyId(saveReqVO.getCompanyId()); |
| 172 | 168 | entity.setDeptId(roadReqVO.getDeptId()); |
| ... | ... | @@ -182,34 +178,41 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 182 | 178 | } |
| 183 | 179 | |
| 184 | 180 | @Override |
| 185 | - public void updateMaintainPlan(MaintainPlanSaveReqVO updateReqVO) { | |
| 181 | + public void updateMaintainPlan(MaintainPlanUpdateReqVO updateReqVO) { | |
| 186 | 182 | // 校验存在 |
| 187 | - //validateMaintainPlanExists(updateReqVO.getId()); | |
| 183 | + validateMaintainPlanExists(updateReqVO.getId()); | |
| 188 | 184 | // 更新 |
| 189 | 185 | MaintainPlanDO updateObj = BeanUtils.toBean(updateReqVO, MaintainPlanDO.class); |
| 190 | 186 | maintainPlanMapper.updateById(updateObj); |
| 191 | 187 | } |
| 192 | 188 | |
| 189 | + private void validateMaintainPlanExists(Long id) { | |
| 190 | + if (maintainPlanMapper.selectById(id) == null) { | |
| 191 | + throw exception(INSPECTION_PLAN_NOT_EXISTS); | |
| 192 | + } | |
| 193 | + } | |
| 194 | + | |
| 195 | + | |
| 193 | 196 | @Override |
| 194 | 197 | public void deleteMaintainPlan(Long id) { |
| 195 | 198 | // 校验存在 |
| 196 | - //validateMaintainPlanExists(id); | |
| 199 | + validateMaintainPlanExists(id); | |
| 197 | 200 | // 删除 |
| 198 | 201 | maintainPlanMapper.deleteById(id); |
| 199 | 202 | } |
| 200 | 203 | |
| 201 | 204 | @Override |
| 202 | - public void deleteMaintainPlanListByIds(List<Long> ids) { | |
| 205 | + public void deleteMaintainPlanListByIds(List<Long> ids) { | |
| 203 | 206 | // 删除 |
| 204 | 207 | maintainPlanMapper.deleteByIds(ids); |
| 205 | - } | |
| 208 | + } | |
| 206 | 209 | |
| 207 | 210 | |
| 208 | 211 | private void validateMaintainPlanExists(MaintainPlanSaveReqVO req) { |
| 209 | 212 | Set<Long> roadIds = req.getRoadListReqVO().stream().map(MaintainPlanRoadReqVO::getRoadId).collect(Collectors.toSet()); |
| 210 | - Long count =0L; | |
| 213 | + Long count = 0L; | |
| 211 | 214 | //标准计划 |
| 212 | - if(req.getPlanAttr().equals(1)){ | |
| 215 | + if (req.getPlanAttr().equals(1)) { | |
| 213 | 216 | QueryWrapper<MaintainPlanDO> sql = new QueryWrapper<>(); |
| 214 | 217 | sql.lambda().eq(MaintainPlanDO::getPlanTypeId, req.getPlanTypeId()) |
| 215 | 218 | .in(MaintainPlanDO::getRoadId, roadIds) |
| ... | ... | @@ -217,7 +220,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 217 | 220 | .ge(MaintainPlanDO::getEndTime, req.getBeginTime()); // end_time >= startTime |
| 218 | 221 | |
| 219 | 222 | count = maintainPlanMapper.selectCount(sql); |
| 220 | - }else{ | |
| 223 | + } else { | |
| 221 | 224 | QueryWrapper<MaintainPlanDO> sql = new QueryWrapper<>(); |
| 222 | 225 | sql.lambda().eq(MaintainPlanDO::getPlanTypeId, req.getPlanTypeId()) |
| 223 | 226 | .in(MaintainPlanDO::getRoadId, roadIds) |
| ... | ... | @@ -248,11 +251,12 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 248 | 251 | |
| 249 | 252 | /** |
| 250 | 253 | * 回填部门/公司/角色 |
| 254 | + * | |
| 251 | 255 | * @param list 分页对象 |
| 252 | 256 | */ |
| 253 | - private void addDataInspectionPlan(List<MaintainPlanRespVO> list ){ | |
| 254 | - if(org.springframework.util.CollectionUtils.isEmpty(list)){ | |
| 255 | - return ; | |
| 257 | + private void addDataInspectionPlan(List<MaintainPlanRespVO> list) { | |
| 258 | + if (org.springframework.util.CollectionUtils.isEmpty(list)) { | |
| 259 | + return; | |
| 256 | 260 | } |
| 257 | 261 | |
| 258 | 262 | //公司 |
| ... | ... | @@ -264,22 +268,22 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 264 | 268 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds); |
| 265 | 269 | |
| 266 | 270 | list.forEach(plan -> { |
| 267 | - DeptRespDTO dept = deptMap.get(plan.getDeptId()); | |
| 271 | + DeptRespDTO dept = deptMap.get(plan.getDeptId()); | |
| 268 | 272 | if (dept != null) { |
| 269 | 273 | plan.setDeptName(dept.getName()); |
| 270 | 274 | |
| 271 | 275 | } |
| 272 | - DeptRespDTO company = deptMap.get(plan.getCompanyId()); | |
| 273 | - if(company != null){ | |
| 276 | + DeptRespDTO company = deptMap.get(plan.getCompanyId()); | |
| 277 | + if (company != null) { | |
| 274 | 278 | plan.setCompanyName(company.getName()); |
| 275 | 279 | } |
| 276 | 280 | List<MaintainPlanRoleDO> roleList = maintainPlanRoleMapper.selectList(new QueryWrapper<MaintainPlanRoleDO>().lambda() |
| 277 | 281 | .eq(MaintainPlanRoleDO::getBatchNo, plan.getBatchNo())); |
| 278 | 282 | |
| 279 | 283 | Set<Long> roleIds = roleList.stream().map(MaintainPlanRoleDO::getRoleId).collect(Collectors.toSet()); |
| 280 | - if(!org.springframework.util.CollectionUtils.isEmpty(roleIds)){ | |
| 284 | + if (!org.springframework.util.CollectionUtils.isEmpty(roleIds)) { | |
| 281 | 285 | List<RoleDO> roles = roleApi.getRoleList(roleIds); |
| 282 | - if(!org.springframework.util.CollectionUtils.isEmpty(roles)){ | |
| 286 | + if (!org.springframework.util.CollectionUtils.isEmpty(roles)) { | |
| 283 | 287 | plan.setRoleNameList(roles.stream().map(RoleDO::getName).collect(Collectors.toList())); |
| 284 | 288 | } |
| 285 | 289 | } |
| ... | ... | @@ -290,7 +294,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 290 | 294 | @Override |
| 291 | 295 | public void deleteInspectionPlanByBatchNo(String batchNo) { |
| 292 | 296 | MaintainPlanDO inspectionPlanDO = maintainPlanMapper.selectOne(MaintainPlanDO::getBatchNo, batchNo); |
| 293 | - if(inspectionPlanDO !=null && inspectionPlanDO.getPlanFinishNum() >0){ | |
| 297 | + if (inspectionPlanDO != null && inspectionPlanDO.getPlanFinishNum() > 0) { | |
| 294 | 298 | throw exception(INSPECTION_PLAN_NOT_ALLOW_DELETE); |
| 295 | 299 | } |
| 296 | 300 | maintainPlanMapper.deleteByBatchNo(batchNo); |
| ... | ... | @@ -301,7 +305,7 @@ public class MaintainPlanServiceImpl implements MaintainPlanService { |
| 301 | 305 | @Override |
| 302 | 306 | public void stopPlanInspectionPlan(String batchNo) { |
| 303 | 307 | maintainPlanMapper.delete(MaintainPlanDO::getBatchNo, batchNo); |
| 304 | - maintainPlanDetailMapper.delete(MaintainPlanDetailDO::getBatchNo,batchNo); | |
| 308 | + maintainPlanDetailMapper.delete(MaintainPlanDetailDO::getBatchNo, batchNo); | |
| 305 | 309 | maintainPlanRoleMapper.delete(MaintainPlanRoleDO::getBatchNo, batchNo); |
| 306 | 310 | } |
| 307 | 311 | ... | ... |