diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java index 7e43c8a0..32841686 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/common/RecordTypeEnum.java @@ -61,6 +61,10 @@ public enum RecordTypeEnum { TZTL("tztl","通知退料"), /**审批配件申请单*/ SPPJSQD("sppjsqd","审批配件申请单"), + /** + * 添加维修项目 + */ + TJWXXM("tjwxxm", "添加维修项目"), /** * 接单 */ diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java index 7dcd45f3..3425bef1 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTitemController.java @@ -1,17 +1,22 @@ package cn.iocoder.yudao.module.tickets.controller.admin; +import cn.iocoder.yudao.common.RecordTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; +import cn.iocoder.yudao.module.tickets.vo.AddProjVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -30,6 +35,8 @@ public class DlRepairTitemController { */ @Resource private DlRepairTitemService dlRepairTitemService; + @Resource + private RepairRecordsService repairRecordsService; /** * 维修工单子表 分页 @@ -113,6 +120,26 @@ public class DlRepairTitemController { return CommonResult.ok(); } + /** + * 添加维修项目 + * @author vinjor-M + * @date 14:28 2024/11/4 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @PostMapping("/addNewProj") + @Operation(summary = "添加维修项目") + public CommonResult addNewProj(@RequestBody AddProjVO addProjVO){ + dlRepairTitemService.saveBatch(addProjVO.getItemList()); + List projNameList = addProjVO.getItemList().stream().map(DlRepairTitem::getItemName).collect(Collectors.toList()); + //最后记录操作日志--创建工单 + String remark = "添加维修项目"+String.join(", ",projNameList )+"。"; + if(StringUtils.isNotEmpty(addProjVO.getRemark())){ + remark += "备注:"+addProjVO.getRemark(); + } + repairRecordsService.saveRepairRecord(addProjVO.getItemList().get(0).getTicketId(), null, RecordTypeEnum.TJWXXM.getCode(), remark, addProjVO.getImage()); + return CommonResult.success(addProjVO.getItemList().get(0).getTicketId()); + } + /** * 维修工单单个子项 * @@ -126,5 +153,6 @@ public class DlRepairTitemController { dlRepairTitemService.removeItemById(id); return CommonResult.ok(); } + } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AddProjVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AddProjVO.java new file mode 100644 index 00000000..8302167c --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AddProjVO.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.tickets.vo; + +import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; +import lombok.Data; + +import java.util.List; + +/** + * 维修过程中添加维修项目vo + * @author vinjor-M + * @date 14:43 2024/11/4 +**/ +@Data +public class AddProjVO { + /** 添加的项目信息 */ + private List itemList; + /** 签字图片相对路径 */ + private String image; + /** 备注内容 */ + private String remark; +}