Commit ce765f0c583fc097f803bfe098bfe24e8ffdd1a9
1 parent
905420ae
计划明细提交-增加重复提交判断
Showing
3 changed files
with
12 additions
and
1 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
| ... | ... | @@ -87,9 +87,11 @@ public interface ErrorCodeConstants { |
| 87 | 87 | ErrorCode INSPECTION_CYCLE_ERROR = new ErrorCode(1-200-100-003, "获取两个时间之间间隔天数错误"); |
| 88 | 88 | ErrorCode INSPECTION_PLAN_EXISTS = new ErrorCode(1-200-100-007, "道路对应类型已存在记录"); |
| 89 | 89 | ErrorCode INSPECTION_PLAN_NOT_ALLOW_DELETE = new ErrorCode(1-100-007-005, "计划已开始执行不能删除"); |
| 90 | + ErrorCode INSPECTION_COMMIT_PLAN__EXISTS = new ErrorCode(1-100-007-005, "巡检计划明细已提交"); | |
| 90 | 91 | |
| 91 | 92 | // ========== 养护计划汇总 TODO 补充编号 ========== |
| 92 | 93 | ErrorCode MAINTAIN_PLAN_NOT_EXISTS = new ErrorCode(1-100-007-001, "养护计划汇总不存在"); |
| 94 | + ErrorCode MAINTAIN_COMMIT_PLAN__EXISTS = new ErrorCode(1-100-007-007, "养护计划明细已提交"); | |
| 93 | 95 | |
| 94 | 96 | //========== 频次 TODO 补充编号 ========== |
| 95 | 97 | ErrorCode PLAN_RATE_EXISTS = new ErrorCode(1-100-007-001, "养护频次已存在"); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanCommitServiceImpl.java
| ... | ... | @@ -18,6 +18,7 @@ import com.zteits.urbanops.module.garden.convert.AppGardenWorkOrderConvert; |
| 18 | 18 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanCommitDO; |
| 19 | 19 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; |
| 20 | 20 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; |
| 21 | +import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanCommitDO; | |
| 21 | 22 | import com.zteits.urbanops.module.garden.dal.dataobject.road.RoadDO; |
| 22 | 23 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanCommitMapper; |
| 23 | 24 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper; |
| ... | ... | @@ -43,7 +44,7 @@ import java.util.*; |
| 43 | 44 | import java.util.stream.Collectors; |
| 44 | 45 | |
| 45 | 46 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 46 | -import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.INSPECTION_PLAN_NOT_EXISTS; | |
| 47 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | |
| 47 | 48 | |
| 48 | 49 | |
| 49 | 50 | /** |
| ... | ... | @@ -76,6 +77,10 @@ public class InspectionPlanCommitServiceImpl implements InspectionPlanCommitServ |
| 76 | 77 | |
| 77 | 78 | @Override |
| 78 | 79 | public Long createInspectionPlanCommit(InspectionPlanCommitSaveReqVO createReqVO) { |
| 80 | + List<InspectionPlanCommitDO> list = inspectionPlanCommitMapper.selectList(InspectionPlanCommitDO::getPlanNo, createReqVO.getPlanNo()); | |
| 81 | + if(!CollectionUtils.isEmpty(list)){ | |
| 82 | + throw exception(INSPECTION_COMMIT_PLAN__EXISTS); | |
| 83 | + } | |
| 79 | 84 | // 插入 |
| 80 | 85 | InspectionPlanCommitDO inspectionPlanCommit = BeanUtils.toBean(createReqVO, InspectionPlanCommitDO.class); |
| 81 | 86 | inspectionPlanCommitMapper.insert(inspectionPlanCommit); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/maintainplan/MaintainPlanCommitServiceImpl.java
| ... | ... | @@ -63,6 +63,10 @@ public class MaintainPlanCommitServiceImpl implements MaintainPlanCommitService |
| 63 | 63 | |
| 64 | 64 | @Override |
| 65 | 65 | public Long createMaintainPlanCommit(MaintainPlanCommitSaveReqVO createReqVO) { |
| 66 | + List<MaintainPlanCommitDO> list = maintainPlanCommitMapper.selectList(MaintainPlanCommitDO::getPlanNo, createReqVO.getPlanNo()); | |
| 67 | + if(!CollectionUtils.isEmpty(list)){ | |
| 68 | + throw exception(MAINTAIN_PLAN_NOT_EXISTS); | |
| 69 | + } | |
| 66 | 70 | // 插入 |
| 67 | 71 | MaintainPlanCommitDO maintainPlanCommit = BeanUtils.toBean(createReqVO, MaintainPlanCommitDO.class); |
| 68 | 72 | maintainPlanCommitMapper.insert(maintainPlanCommit); | ... | ... |