Commit ee7cf5161d712532bfb3d9cb7bde65c70a92ac5f
1 parent
2742bd4f
fix(mes-cal): 计划班组增删前校验排班计划未确认
MesCalPlanTeamServiceImpl 的 create/delete 方法调用 planService.validatePlanPrepare(),确认后的排班计划禁止修改班组 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Showing
1 changed file
with
14 additions
and
6 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/cal/plan/MesCalPlanTeamServiceImpl.java
| ... | ... | @@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.team.MesCalPlanT |
| 5 | 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.cal.MesCalPlanTeamDO; |
| 6 | 6 | import cn.iocoder.yudao.module.mes.dal.mysql.cal.plan.MesCalPlanTeamMapper; |
| 7 | 7 | import jakarta.annotation.Resource; |
| 8 | +import org.springframework.context.annotation.Lazy; | |
| 8 | 9 | import org.springframework.stereotype.Service; |
| 9 | 10 | import org.springframework.validation.annotation.Validated; |
| 10 | 11 | |
| ... | ... | @@ -24,11 +25,15 @@ public class MesCalPlanTeamServiceImpl implements MesCalPlanTeamService { |
| 24 | 25 | |
| 25 | 26 | @Resource |
| 26 | 27 | private MesCalPlanTeamMapper planTeamMapper; |
| 28 | + @Resource | |
| 29 | + @Lazy | |
| 30 | + private MesCalPlanService planService; | |
| 27 | 31 | |
| 28 | 32 | @Override |
| 29 | 33 | public Long createPlanTeam(MesCalPlanTeamSaveReqVO createReqVO) { |
| 30 | - // TODO @AI:需要校验下,plan 未确定;(确认后,不允许编辑) | |
| 31 | - // 校验排班计划存在 | |
| 34 | + // 校验计划未确认 | |
| 35 | + planService.validatePlanPrepare(createReqVO.getPlanId()); | |
| 36 | + // 校验班组不重复 | |
| 32 | 37 | validatePlanTeamDuplicate(createReqVO.getPlanId(), createReqVO.getTeamId()); |
| 33 | 38 | |
| 34 | 39 | // 插入 |
| ... | ... | @@ -39,17 +44,20 @@ public class MesCalPlanTeamServiceImpl implements MesCalPlanTeamService { |
| 39 | 44 | |
| 40 | 45 | @Override |
| 41 | 46 | public void deletePlanTeam(Long id) { |
| 42 | - // TODO @AI:需要校验下,plan 未确定;(确认后,不允许编辑) | |
| 43 | 47 | // 校验存在 |
| 44 | - validatePlanTeamExists(id); | |
| 48 | + MesCalPlanTeamDO existPlanTeam = validatePlanTeamExists(id); | |
| 49 | + // 校验计划未确认 | |
| 50 | + planService.validatePlanPrepare(existPlanTeam.getPlanId()); | |
| 45 | 51 | // 删除 |
| 46 | 52 | planTeamMapper.deleteById(id); |
| 47 | 53 | } |
| 48 | 54 | |
| 49 | - private void validatePlanTeamExists(Long id) { | |
| 50 | - if (planTeamMapper.selectById(id) == null) { | |
| 55 | + private MesCalPlanTeamDO validatePlanTeamExists(Long id) { | |
| 56 | + MesCalPlanTeamDO planTeam = planTeamMapper.selectById(id); | |
| 57 | + if (planTeam == null) { | |
| 51 | 58 | throw exception(CAL_PLAN_TEAM_NOT_EXISTS); |
| 52 | 59 | } |
| 60 | + return planTeam; | |
| 53 | 61 | } |
| 54 | 62 | |
| 55 | 63 | private void validatePlanTeamDuplicate(Long planId, Long teamId) { | ... | ... |