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 8e6f4698..9955cce4 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/base/mapper/RepairWorkerMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java index 980d8c6b..a371e049 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java @@ -35,4 +35,13 @@ public interface RepairWorkerMapper extends BaseMapper { * @date 2024年10月10日 **/ List getAllWorkerIds(); + + /** + * 根据userId查询维修工信息 + * @author PQZ + * @date 17:28 2024/11/4 + * @param userId 用户id + * @return cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO + **/ + RepairWorkerRespVO getByUserId(Long userId); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java index c267c455..05a1946a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairWorkerService.java @@ -27,6 +27,15 @@ public interface RepairWorkerService extends IService { * @param userList 选中用户集合 **/ void saveWorkers(List userList); + + /** + * 根据用户id查询对应维修的角色,维修工人则查询班组,非维修工人查询角色 + * @author PQZ + * @date 17:21 2024/11/4 + * @param userId 用户id + * @return java.lang.String + **/ + String getWorkerRoleName(Long userId); /** * 更新维修工人 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java index ceca1561..d3c8d0fb 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.base.entity.RepairRecordsItem; import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper; import cn.iocoder.yudao.module.base.service.RepairRecordsItemService; import cn.iocoder.yudao.module.base.service.RepairRecordsService; +import cn.iocoder.yudao.module.base.service.RepairWorkerService; import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO; import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; @@ -36,6 +37,8 @@ public class RepairRecordsServiceImpl extends ServiceImpl list = repairRecordsMapper.queryRepairRecords(pageReqVO); //为每一条维修记录设置查询附件 list.forEach(item -> { + item.setRoleName(workerService.getWorkerRoleName(item.getDealUserId())); List itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen()); item.setItemList(itemList); //相对路径按照“,”分隔 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java index 3c96809e..62d1f243 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.base.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.yudao.common.RepairRoleEnum; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; @@ -15,6 +16,9 @@ import cn.iocoder.yudao.module.system.api.dict.DictDataApi; import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; +import cn.iocoder.yudao.module.system.api.permission.PermissionApi; +import cn.iocoder.yudao.module.system.api.permission.RoleApi; +import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO; import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; @@ -57,6 +61,13 @@ public class RepairWorkerServiceImpl extends ServiceImpl roleIds = permissionApi.getRoleIdsByUserId(userId); + // 所有的角色信息 + List roleList = roleApi.getRoleList(); + // 过滤出登录用户有的角色信息 + List collect = roleList.stream().filter(item -> roleIds.contains(item.getId())).collect(Collectors.toList()); + // 取出角色code + List codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList()); + //维修业务管理员 + if (codes.contains(RepairRoleEnum.ADMIN.getCode())) { + return RepairRoleEnum.ADMIN.getName(); + } + // 总检 + if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) { + return RepairRoleEnum.INSPECTION.getName(); + } + // 服务顾问 + if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) { + return RepairRoleEnum.ADVISOR.getName(); + } + // 维修仓库管理员 + if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) { + return RepairRoleEnum.WAREHOUSE.getName(); + } + // 维修财务 + if (codes.contains(RepairRoleEnum.WXCW.getCode())) { + return RepairRoleEnum.WXCW.getName(); + } + } + return null; + } + @Override public void updateWorker(RepairWorkerSaveReqVO updateReqVO) { // 更新 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java index 76e0cb96..c6498082 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairRecordsRespVO.java @@ -16,5 +16,7 @@ public class RepairRecordsRespVO extends RepairRecords { private List itemList; /**维修记录关联附件信息*/ private String images; + /**角色、岗位名称*/ + private String roleName; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java index cf02492d..c0df46b2 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/vo/RepairWorkerRespVO.java @@ -9,7 +9,7 @@ import lombok.Data; @Data @ExcelIgnoreUnannotated public class RepairWorkerRespVO extends RepairWorker { - + private String workerTypeStr; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index a6f90303..0b82966c 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -345,8 +345,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList()); - remark += "确认领料" + String.join(",", nameAndCount); + List nameAndCount = list.stream().map(item -> item.getWaresName() + "x" + item.getWaresCount()).collect(Collectors.toList()); + remark += "确认领料" + String.join(";", nameAndCount); // 记录日志 recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark, image); } 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/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 17c795d2..90a31cb4 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.*; import cn.iocoder.yudao.framework.common.util.number.MoneyUtils; -import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.base.entity.RepairWorker; import cn.iocoder.yudao.module.base.service.RepairRecordsService; @@ -962,6 +961,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl wares = repairWaresService.list(new LambdaQueryWrapper().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()))); + Map waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getName)); + String remarkStr=""; + for(DlRepairSoi item:respVO.getRepairSois()){ + //组装通知领取配件的文字 + if(!"".equals(remarkStr)){ + remarkStr +=";"; + } + remarkStr += waresNameMap.get(item.getGoodsId())+"x"+item.getGoodsCount(); + } if (type.equals("02")) { // 领料 // 构造新数据 List newData = oldData.stream().map(item -> { @@ -512,7 +521,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl itemList; + /** 签字图片相对路径 */ + private String image; + /** 备注内容 */ + private String remark; +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java index 0fa15d2b..cd51999a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/DlRepairTicketsReqVO.java @@ -36,4 +36,7 @@ public class DlRepairTicketsReqVO extends DlRepairTickets { /** 图片路径 */ private String image; + + /** 操作类型默认是指派施工 --zpsg */ + private String operateCode; } diff --git a/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml b/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml index c51f3010..68b75801 100644 --- a/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/base/RepairWorkerMapper.xml @@ -37,6 +37,17 @@ WHERE main.deleted = 0 +