Commit eca2c176a2617bee2d36316d6bc17bd3e38281cc
1 parent
c599198e
✨ feat(mes): 新增维修工单确认完成请求及相关逻辑
新增 MesDvRepairConfirmReqVO 类以处理维修工单确认完成请求,更新相关服务和控制器逻辑以支持新的请求格式。确保维修工单名称和完成日期为必填项,增强了数据验证和状态管理。
Showing
5 changed files
with
33 additions
and
12 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/MesDvRepairController.java
| @@ -125,10 +125,9 @@ public class MesDvRepairController { | @@ -125,10 +125,9 @@ public class MesDvRepairController { | ||
| 125 | 125 | ||
| 126 | @PutMapping("/confirm") | 126 | @PutMapping("/confirm") |
| 127 | @Operation(summary = "确认维修完成(维修中→待验收)") | 127 | @Operation(summary = "确认维修完成(维修中→待验收)") |
| 128 | - @Parameter(name = "id", description = "编号", required = true) | ||
| 129 | @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | 128 | @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") |
| 130 | - public CommonResult<Boolean> confirmRepair(@RequestParam("id") Long id) { | ||
| 131 | - repairService.confirmRepair(id); | 129 | + public CommonResult<Boolean> confirmRepair(@Valid @RequestBody cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairConfirmReqVO confirmReqVO) { |
| 130 | + repairService.confirmRepair(confirmReqVO); | ||
| 132 | return success(true); | 131 | return success(true); |
| 133 | } | 132 | } |
| 134 | 133 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/MesDvRepairConfirmReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 维修工单确认完成 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesDvRepairConfirmReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + @NotNull(message = "维修工单编号不能为空") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "维修完成日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 18 | + @NotNull(message = "维修完成日期不能为空") | ||
| 19 | + private LocalDateTime finishDate; | ||
| 20 | + | ||
| 21 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/MesDvRepairSaveReqVO.java
| @@ -18,7 +18,8 @@ public class MesDvRepairSaveReqVO { | @@ -18,7 +18,8 @@ public class MesDvRepairSaveReqVO { | ||
| 18 | @NotBlank(message = "维修工单编码不能为空") | 18 | @NotBlank(message = "维修工单编码不能为空") |
| 19 | private String code; | 19 | private String code; |
| 20 | 20 | ||
| 21 | - @Schema(description = "维修工单名称", example = "注塑机液压系统维修") | 21 | + @Schema(description = "维修工单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "注塑机液压系统维修") |
| 22 | + @NotBlank(message = "维修工单名称不能为空") | ||
| 22 | private String name; | 23 | private String name; |
| 23 | 24 | ||
| 24 | @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 25 | @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/repair/MesDvRepairService.java
| 1 | package cn.iocoder.yudao.module.mes.service.dv.repair; | 1 | package cn.iocoder.yudao.module.mes.service.dv.repair; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairConfirmReqVO; | ||
| 4 | import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairPageReqVO; | 5 | import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairPageReqVO; |
| 5 | import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairSaveReqVO; | 6 | import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairSaveReqVO; |
| 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.repair.MesDvRepairDO; | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.repair.MesDvRepairDO; |
| 7 | - | ||
| 8 | import jakarta.validation.Valid; | 8 | import jakarta.validation.Valid; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -78,9 +78,9 @@ public interface MesDvRepairService { | @@ -78,9 +78,9 @@ public interface MesDvRepairService { | ||
| 78 | /** | 78 | /** |
| 79 | * 确认维修完成(维修中→待验收) | 79 | * 确认维修完成(维修中→待验收) |
| 80 | * | 80 | * |
| 81 | - * @param id 编号 | 81 | + * @param confirmReqVO 确认信息 |
| 82 | */ | 82 | */ |
| 83 | - void confirmRepair(Long id); | 83 | + void confirmRepair(@Valid MesDvRepairConfirmReqVO confirmReqVO); |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | * 完成验收(待验收→已确认) | 86 | * 完成验收(待验收→已确认) |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/repair/MesDvRepairServiceImpl.java
| @@ -144,16 +144,16 @@ public class MesDvRepairServiceImpl implements MesDvRepairService { | @@ -144,16 +144,16 @@ public class MesDvRepairServiceImpl implements MesDvRepairService { | ||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | @Override | 146 | @Override |
| 147 | - public void confirmRepair(Long id) { | 147 | + public void confirmRepair(cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairConfirmReqVO confirmReqVO) { |
| 148 | // 1. 校验存在,且状态为维修中 | 148 | // 1. 校验存在,且状态为维修中 |
| 149 | - MesDvRepairDO repair = validateRepairExists(id); | 149 | + MesDvRepairDO repair = validateRepairExists(confirmReqVO.getId()); |
| 150 | if (ObjUtil.notEqual(MesDvRepairStatusEnum.CONFIRMED.getStatus(), repair.getStatus())) { | 150 | if (ObjUtil.notEqual(MesDvRepairStatusEnum.CONFIRMED.getStatus(), repair.getStatus())) { |
| 151 | throw exception(DV_REPAIR_NOT_CONFIRMED); | 151 | throw exception(DV_REPAIR_NOT_CONFIRMED); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | - // 2. 更新状态为待验收,自动设置维修完成日期 | ||
| 155 | - repairMapper.updateById(new MesDvRepairDO().setId(id) | ||
| 156 | - .setStatus(MesDvRepairStatusEnum.APPROVING.getStatus()).setFinishDate(LocalDateTime.now())); | 154 | + // 2. 更新状态为待验收,设置维修完成日期 |
| 155 | + repairMapper.updateById(new MesDvRepairDO().setId(confirmReqVO.getId()) | ||
| 156 | + .setStatus(MesDvRepairStatusEnum.APPROVING.getStatus()).setFinishDate(confirmReqVO.getFinishDate())); | ||
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | @Override | 159 | @Override |