From 4ac43bd04c897b9a3c59e66b1371cd923d92e640 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 31 Oct 2024 17:48:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E7=AE=A1=E5=91=98=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/controller/TypeController.java | 8 ++++ .../material/ma/service/ITypeService.java | 2 + .../ma/service/impl/TypeServiceImpl.java | 37 +++++++++++++++++-- .../bonus/material/ma/vo/MaTypeListVo.java | 13 ++++++- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java index 9e32a676..79439f3f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java @@ -53,6 +53,14 @@ public class TypeController extends BaseController { return getDataTable(list); } + @ApiOperation(value = "查询物资类型管理列表(无分页)") + @RequiresPermissions("ma:type:list") + @GetMapping("/listNoPage") + public AjaxResult listNoPage(MaTypeListVo type) { + List list = typeService.selectTypeListAndParentInfo(type); + return success(list); + } + /** * 根据左列表类型id查询右表格 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java index b6893b75..baac7699 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java @@ -99,4 +99,6 @@ public interface ITypeService { List buildMaTypeTree(List maTypeList); AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto); + + AjaxResult getMyTypeAndBindUsers(List list); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index d1aa2562..62176d58 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -470,7 +470,7 @@ public class TypeServiceImpl implements ITypeService { // 1.外层 先对比维修班组 for (TypeRepair typeRepair : typeRepairList) { // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { + if (Objects.nonNull(typeRepair.getTypeId()) && typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { // 3.如果相等,把维修员信息设置到物资类型配置信息中 typeConfigVo1.setRepairUserId(typeRepair.getUserId()); typeConfigVo1.setRepairUserName(typeRepair.getUserName()); @@ -480,7 +480,7 @@ public class TypeServiceImpl implements ITypeService { // 1.外层 再对比库管班组 for (TypeKeeper typeKeeper : typeKeeperList) { // 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { + if (Objects.nonNull(typeKeeper.getTypeId()) && typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { // 3.如果相等,把库管员信息设置到物资类型配置信息中 typeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); typeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); @@ -493,7 +493,7 @@ public class TypeServiceImpl implements ITypeService { for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) { // 7.有维修配置信息,把维修员信息设置到子节点中 for (TypeRepair typeRepair : typeRepairList) { - if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { + if (Objects.nonNull(typeRepair.getTypeId()) && typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { typeConfigVo2.setRepairUserId(typeRepair.getUserId()); typeConfigVo2.setRepairUserName(typeRepair.getUserName()); } @@ -504,7 +504,7 @@ public class TypeServiceImpl implements ITypeService { for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) { // 9.判断子节点是否有库管配置信息 for (TypeKeeper typeKeeper : typeKeeperList) { - if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { + if (Objects.nonNull(typeKeeper.getTypeId()) && typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { typeConfigVo3.setKeeperUserId(typeKeeper.getUserId()); typeConfigVo3.setKeeperUserName(typeKeeper.getUserName()); } @@ -546,4 +546,33 @@ public class TypeServiceImpl implements ITypeService { // 返回前端 return AjaxResult.success(filteredList); } + + @Override + public AjaxResult getMyTypeAndBindUsers(List list) { + List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); + List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); + for (MaTypeListVo maTypeListVo : list) { + if (CollectionUtils.isNotEmpty(typeRepairList)) { + for (TypeRepair typeRepair : typeRepairList) { + if (Objects.nonNull(typeRepair.getTypeId()) && typeRepair.getTypeId().equals(maTypeListVo.getTypeId())) { + maTypeListVo.setRepairUserId(typeRepair.getUserId()); + maTypeListVo.setRepairUserName(typeRepair.getUserName()); + break; + } + } + } + if (CollectionUtils.isNotEmpty(typeKeeperList)) { + for (TypeKeeper typeKeeper : typeKeeperList) { + if (Objects.nonNull(typeKeeper.getTypeId()) && typeKeeper.getTypeId().equals(maTypeListVo.getTypeId())) { + maTypeListVo.setKeeperUserId(typeKeeper.getUserId()); + maTypeListVo.setKeeperUserName(typeKeeper.getUserName()); + } + } + } + } + return AjaxResult.success(list); + } + + + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeListVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeListVo.java index 59248010..5a8c018b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeListVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/vo/MaTypeListVo.java @@ -3,7 +3,6 @@ package com.bonus.material.ma.vo; import com.bonus.common.core.annotation.Excel; import com.bonus.material.ma.domain.Type; import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiOperation; import lombok.Getter; import lombok.Setter; @@ -30,4 +29,16 @@ public class MaTypeListVo extends Type { @ApiModelProperty(value = "物资名称") private String materialName; + @ApiModelProperty(value = "库管员id") + private Long keeperUserId; + + @ApiModelProperty(value = "库管员姓名") + private String keeperUserName; + + @ApiModelProperty(value = "维修员id") + private Long repairUserId; + + @ApiModelProperty(value = "维修员姓名") + private String repairUserName; + }