diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java index 975aa8de..2707df3f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MaTypeConfigController.java @@ -1,124 +1,124 @@ -package com.bonus.material.ma.controller; - -import com.bonus.common.biz.domain.TreeSelect; -import com.bonus.common.core.web.controller.BaseController; -import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.common.security.annotation.PreventRepeatSubmit; -import com.bonus.common.security.annotation.RequiresPermissions; -import com.bonus.material.ma.MaTypeConfigDto; -import com.bonus.material.ma.domain.Type; -import com.bonus.material.ma.domain.TypeKeeper; -import com.bonus.material.ma.domain.TypeRepair; -import com.bonus.material.ma.service.ITypeKeeperService; -import com.bonus.material.ma.service.ITypeRepairService; -import com.bonus.material.ma.service.ITypeService; -import com.bonus.material.ma.service.MaTypeConfigService; -import com.bonus.material.ma.vo.MaTypeConfigVo; -import com.google.common.collect.ImmutableList; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.*; - -/** - * @author : 阮世耀 - * @version : 1.0 - * @PackagePath: com.bonus.material.ma.controller - * @CreateTime: 2024-10-16 10:52 - * @Description: 物资类型配置API - */ -@Api(tags = "物资类型配置API") -@RestController -@RequestMapping("/ma_type_config") -public class MaTypeConfigController extends BaseController { - - @Resource - private MaTypeConfigService maTypeConfigService; - - @ApiOperation(value = "配置物资类型绑定信息") - @PreventRepeatSubmit - @RequiresPermissions("ma:typeConfig:edit") - @PostMapping("/updateMaTypeBindInfo") - public AjaxResult updateMaTypeBindInfo(@RequestBody @Valid @NotNull MaTypeConfigDto maTypeConfigDto) { - // -------------------- 数据校验开始 --------------------- - - // 1.判断绑定标识是否为空 - if (maTypeConfigDto.getBindFlag() == null) { - return error("绑定标识不能为空"); - } - // 2.判断绑定角色类型是否为空 - if (maTypeConfigDto.getBindRoleType() == null) { - return error("绑定角色类型不能为空"); - } - // 3.判断用户id是否为空 - if (maTypeConfigDto.getUserId() == null) { - return error("用户id不能为空"); - } - - // ---------------- 数据校验结束 --------------------- - - // 执行业务逻辑 - return maTypeConfigService.updateMaTypeBindInfo(maTypeConfigDto); - } - - - - /** - * 查询物资类型配置右侧列表 - */ - @ApiOperation(value = "查询物资类型配置右侧列表") - @RequiresPermissions("ma:typeConfig:list") - @GetMapping("/getMaTypeConfigList") - public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { - // 调用service处理业务逻辑 - return maTypeConfigService.getMaTypeConfigList(maTypeConfigDto); - } - - - /** - * 查询物资配置左侧组织人员树-tree - */ - @ApiOperation(value = "查询物资配置左侧组织人员树") - @RequiresPermissions("ma:typeConfig:list") - @GetMapping("/getDeptUserTree") - public AjaxResult getDeptUserTree() { - - // ---------- 模拟人员Tree数据 --------------- - - // 1.创建一个TreeSelect集合,用于外层放组织部门--公司级 - List treeSelectList1 = new ArrayList<>(); - TreeSelect treeSelect1 = new TreeSelect(1L, "机具设备分公司", 1, null); - TreeSelect treeSelect2 = new TreeSelect(2L, "输电分公司", 1, null); - TreeSelect treeSelect3 = new TreeSelect(5L, "变电分公司", 1, null); - - // 2. 给公司级部门添加子部门 ,创建TreeSelect集合,存放组织部门--部门级 - TreeSelect treeSelect01 = new TreeSelect(11L, "物流库管一班", 2, 1L); - TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); - TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); - - // 3. 创建部门人员 - TreeSelect treeSelect001 = new TreeSelect(117L, "袁泷", 3, 11L); - TreeSelect treeSelect002 = new TreeSelect(133L, "喵喵喵", 3, 11L); - TreeSelect treeSelect003 = new TreeSelect(129L, "村上春树", 3, 12L); - - // 4. 把子部门人员添加到子部门中 - treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); - treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); - treeSelect03.setChildren(ImmutableList.of(treeSelect003)); - treeSelect3.setChildren(Collections.singletonList(treeSelect03)); - - // 3.把根节点添加到集合中 - treeSelectList1.add(treeSelect1); - treeSelectList1.add(treeSelect2); - treeSelectList1.add(treeSelect3); - - // -------------- 模拟人员Tree数据结束 ------------------ - - return success(treeSelectList1); - } - -} +//package com.bonus.material.ma.controller; +// +//import com.bonus.common.biz.domain.TreeSelect; +//import com.bonus.common.core.web.controller.BaseController; +//import com.bonus.common.core.web.domain.AjaxResult; +//import com.bonus.common.security.annotation.PreventRepeatSubmit; +//import com.bonus.common.security.annotation.RequiresPermissions; +//import com.bonus.material.ma.MaTypeConfigDto; +//import com.bonus.material.ma.domain.Type; +//import com.bonus.material.ma.domain.TypeKeeper; +//import com.bonus.material.ma.domain.TypeRepair; +//import com.bonus.material.ma.service.ITypeKeeperService; +//import com.bonus.material.ma.service.ITypeRepairService; +//import com.bonus.material.ma.service.ITypeService; +//import com.bonus.material.ma.service.MaTypeConfigService; +//import com.bonus.material.ma.vo.MaTypeConfigVo; +//import com.google.common.collect.ImmutableList; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.web.bind.annotation.*; +// +//import javax.annotation.Resource; +//import javax.validation.Valid; +//import javax.validation.constraints.NotNull; +//import java.util.*; +// +///** +// * @author : 阮世耀 +// * @version : 1.0 +// * @PackagePath: com.bonus.material.ma.controller +// * @CreateTime: 2024-10-16 10:52 +// * @Description: 物资类型配置API +// */ +//@Api(tags = "物资类型配置API") +//@RestController +//@RequestMapping("/ma_type_config") +//public class MaTypeConfigController extends BaseController { +// +// @Resource +// private MaTypeConfigService maTypeConfigService; +// +// @ApiOperation(value = "配置物资类型绑定信息") +// @PreventRepeatSubmit +// @RequiresPermissions("ma:typeConfig:edit") +// @PostMapping("/updateMaTypeBindInfo") +// public AjaxResult updateMaTypeBindInfo(@RequestBody @Valid @NotNull MaTypeConfigDto maTypeConfigDto) { +// // -------------------- 数据校验开始 --------------------- +// +// // 1.判断绑定标识是否为空 +// if (maTypeConfigDto.getBindFlag() == null) { +// return error("绑定标识不能为空"); +// } +// // 2.判断绑定角色类型是否为空 +// if (maTypeConfigDto.getBindRoleType() == null) { +// return error("绑定角色类型不能为空"); +// } +// // 3.判断用户id是否为空 +// if (maTypeConfigDto.getUserId() == null) { +// return error("用户id不能为空"); +// } +// +// // ---------------- 数据校验结束 --------------------- +// +// // 执行业务逻辑 +// return maTypeConfigService.updateMaTypeBindInfo(maTypeConfigDto); +// } +// +// +// +// /** +// * 查询物资类型配置右侧列表 +// */ +// @ApiOperation(value = "查询物资类型配置右侧列表") +// @RequiresPermissions("ma:typeConfig:list") +// @GetMapping("/getMaTypeConfigList") +// public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { +// // 调用service处理业务逻辑 +// return maTypeConfigService.getMaTypeConfigList(maTypeConfigDto); +// } +// +// +// /** +// * 查询物资配置左侧组织人员树-tree +// */ +// @ApiOperation(value = "查询物资配置左侧组织人员树") +// @RequiresPermissions("ma:typeConfig:list") +// @GetMapping("/getDeptUserTree") +// public AjaxResult getDeptUserTree() { +// +// // ---------- 模拟人员Tree数据 --------------- +// +// // 1.创建一个TreeSelect集合,用于外层放组织部门--公司级 +// List treeSelectList1 = new ArrayList<>(); +// TreeSelect treeSelect1 = new TreeSelect(1L, "机具设备分公司", 1, null); +// TreeSelect treeSelect2 = new TreeSelect(2L, "输电分公司", 1, null); +// TreeSelect treeSelect3 = new TreeSelect(5L, "变电分公司", 1, null); +// +// // 2. 给公司级部门添加子部门 ,创建TreeSelect集合,存放组织部门--部门级 +// TreeSelect treeSelect01 = new TreeSelect(11L, "物流库管一班", 2, 1L); +// TreeSelect treeSelect02 = new TreeSelect(12L, "物流库管二班", 2, 1L); +// TreeSelect treeSelect03 = new TreeSelect(13L, "宏源库管一班", 2, 5L); +// +// // 3. 创建部门人员 +// TreeSelect treeSelect001 = new TreeSelect(117L, "袁泷", 3, 11L); +// TreeSelect treeSelect002 = new TreeSelect(133L, "喵喵喵", 3, 11L); +// TreeSelect treeSelect003 = new TreeSelect(129L, "村上春树", 3, 12L); +// +// // 4. 把子部门人员添加到子部门中 +// treeSelect01.setChildren(Arrays.asList(treeSelect001, treeSelect002)); +// treeSelect1.setChildren(Arrays.asList(treeSelect01, treeSelect02)); +// treeSelect03.setChildren(ImmutableList.of(treeSelect003)); +// treeSelect3.setChildren(Collections.singletonList(treeSelect03)); +// +// // 3.把根节点添加到集合中 +// treeSelectList1.add(treeSelect1); +// treeSelectList1.add(treeSelect2); +// treeSelectList1.add(treeSelect3); +// +// // -------------- 模拟人员Tree数据结束 ------------------ +// +// return success(treeSelectList1); +// } +// +//} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java index 029e5026..57cde1a9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/MaTypeConfigService.java @@ -1,18 +1,18 @@ -package com.bonus.material.ma.service; - -import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.material.ma.MaTypeConfigDto; - -/** - * @author : 阮世耀 - * @version : 1.0 - * @PackagePath: com.bonus.material.ma.service - * @CreateTime: 2024-10-16 18:50 - * @Description: 物资类型配置Service - */ -public interface MaTypeConfigService{ - - AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto); - - AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto); -} +//package com.bonus.material.ma.service; +// +//import com.bonus.common.core.web.domain.AjaxResult; +//import com.bonus.material.ma.MaTypeConfigDto; +// +///** +// * @author : 阮世耀 +// * @version : 1.0 +// * @PackagePath: com.bonus.material.ma.service +// * @CreateTime: 2024-10-16 18:50 +// * @Description: 物资类型配置Service +// */ +//public interface MaTypeConfigService{ +// +// AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto); +// +// AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto); +//} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java index 37d1f000..6021d8b7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MaTypeConfigServiceImpl.java @@ -1,187 +1,187 @@ -package com.bonus.material.ma.service.impl; - -import com.bonus.common.core.web.domain.AjaxResult; -import com.bonus.material.ma.MaTypeConfigDto; -import com.bonus.material.ma.domain.Type; -import com.bonus.material.ma.domain.TypeKeeper; -import com.bonus.material.ma.domain.TypeRepair; -import com.bonus.material.ma.service.ITypeKeeperService; -import com.bonus.material.ma.service.ITypeRepairService; -import com.bonus.material.ma.service.ITypeService; -import com.bonus.material.ma.service.MaTypeConfigService; -import com.bonus.material.ma.vo.MaTypeConfigVo; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -/** - * @author : 阮世耀 - * @version : 1.0 - * @PackagePath: com.bonus.material.ma.service.impl - * @CreateTime: 2024-10-16 18:50 - * @Description: 描述 - */ -@Service -public class MaTypeConfigServiceImpl implements MaTypeConfigService { - - /** - * 物资类型库管员配置Service - */ - @Resource - private ITypeKeeperService typeKeeperService; - - /** - * 物资类型维修员配置Service - */ - @Resource - private ITypeRepairService typeRepairService; - - // 物资类型Service - @Resource - private ITypeService typeService; - - - @Override - public AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto) { - int result; - switch (maTypeConfigDto.getBindFlag()) { - case 1: - result = handleBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); - return result == 1 ? AjaxResult.success("绑定成功") : AjaxResult.error("绑定失败"); - case 2: - result = handleUnBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); - return result == 1 ? AjaxResult.success("解绑成功") : AjaxResult.error("解绑失败"); - default: - // 处理其他情况或抛出异常 - return AjaxResult.error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); - } - } - - @Override - public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { - // 1.把所有物资类型查出来 - List list = typeService.selectThreeFourLevelTypeListAndParent(new Type()); - // 2.把维修配置信息查出来 - List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); - // 3.把库管配置信息查出来 - List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); - - // ------------------- 开启数据处理 --------------------- - - // 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失 - for (MaTypeConfigVo typeConfigVo1 : list) { - // 1.外层 先对比维修班组 - for (TypeRepair typeRepair : typeRepairList) { - // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { - // 3.如果相等,把维修员信息设置到物资类型配置信息中 - typeConfigVo1.setRepairUserId(typeRepair.getUserId()); - typeConfigVo1.setRepairUserName(typeRepair.getUserName()); - break; - } - } - // 1.外层 再对比库管班组 - for (TypeKeeper typeKeeper : typeKeeperList) { - // 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id - if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { - // 3.如果相等,把库管员信息设置到物资类型配置信息中 - typeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); - typeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); - } - } - - // 5.判断当前物资类型配置信息是否有子节点 - if (typeConfigVo1.getChildren() != null) { - // 6.有子节点,继续循环子节点,判断子节点是否有维修配置信息 - for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) { - // 7.有维修配置信息,把维修员信息设置到子节点中 - for (TypeRepair typeRepair : typeRepairList) { - if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { - typeConfigVo2.setRepairUserId(typeRepair.getUserId()); - typeConfigVo2.setRepairUserName(typeRepair.getUserName()); - } - } - } - - // 8.有子节点,继续循环子节点, - for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) { - // 9.判断子节点是否有库管配置信息 - for (TypeKeeper typeKeeper : typeKeeperList) { - if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { - typeConfigVo3.setKeeperUserId(typeKeeper.getUserId()); - typeConfigVo3.setKeeperUserName(typeKeeper.getUserName()); - } - } - } - } - - } - - // -------------------- 数据处理结束 --------------------- - - // TODO: 先暂时取消后续过滤流程 - if (true) { - return AjaxResult.success(list); - } - - - // ------------------- 数据过滤开始 --------------------- - if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { - // 如果参数无效,则返回原始列表 - return AjaxResult.success(list); - } - - List filteredList = new ArrayList<>(); - - for (MaTypeConfigVo maTypeConfigVo : list) { - if ( - maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || - maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId()) - ) - { - filteredList.add(maTypeConfigVo); - } - } - - // ------------------- 数据过滤结束 --------------------- - - - // 返回前端 - return AjaxResult.success(filteredList); - } - - - private int handleBind(int bindRoleType, Long typeId, Long userId) { - switch (bindRoleType) { - case 1: - // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 1:库管员 的情况 - // TODO: 实现具体逻辑 - return typeKeeperService.insertTypeKeeper(new TypeKeeper(typeId, userId)); - case 2: - // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 2:维修员 的情况 - // TODO: 实现具体逻辑 - return typeRepairService.insertTypeRepair(new TypeRepair(typeId, userId)); - default: - // 处理其他情况或抛出异常 - throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); - } - } - - private int handleUnBind(int bindRoleType, Long typeId, Long userId) { - switch (bindRoleType) { - case 1: - // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 1:库管员 的情况 - // TODO: 实现具体逻辑 - return typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(new TypeKeeper(typeId, userId)); - case 2: - // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 2:维修员 的情况 - // TODO: 实现具体逻辑 - return typeRepairService.deleteTypeRepairByUserIdAndTypeId(new TypeRepair(typeId, userId)); - default: - // 处理其他情况或抛出异常 - throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); - } - } -} +//package com.bonus.material.ma.service.impl; +// +//import com.bonus.common.core.web.domain.AjaxResult; +//import com.bonus.material.ma.MaTypeConfigDto; +//import com.bonus.material.ma.domain.Type; +//import com.bonus.material.ma.domain.TypeKeeper; +//import com.bonus.material.ma.domain.TypeRepair; +//import com.bonus.material.ma.service.ITypeKeeperService; +//import com.bonus.material.ma.service.ITypeRepairService; +//import com.bonus.material.ma.service.ITypeService; +//import com.bonus.material.ma.service.MaTypeConfigService; +//import com.bonus.material.ma.vo.MaTypeConfigVo; +//import org.springframework.stereotype.Service; +// +//import javax.annotation.Resource; +//import java.util.ArrayList; +//import java.util.List; +// +///** +// * @author : 阮世耀 +// * @version : 1.0 +// * @PackagePath: com.bonus.material.ma.service.impl +// * @CreateTime: 2024-10-16 18:50 +// * @Description: 描述 +// */ +//@Service +//public class MaTypeConfigServiceImpl implements MaTypeConfigService { +// +// /** +// * 物资类型库管员配置Service +// */ +// @Resource +// private ITypeKeeperService typeKeeperService; +// +// /** +// * 物资类型维修员配置Service +// */ +// @Resource +// private ITypeRepairService typeRepairService; +// +// // 物资类型Service +// @Resource +// private ITypeService typeService; +// +// +// @Override +// public AjaxResult updateMaTypeBindInfo(MaTypeConfigDto maTypeConfigDto) { +// int result; +// switch (maTypeConfigDto.getBindFlag()) { +// case 1: +// result = handleBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); +// return result == 1 ? AjaxResult.success("绑定成功") : AjaxResult.error("绑定失败"); +// case 2: +// result = handleUnBind(maTypeConfigDto.getBindRoleType(), maTypeConfigDto.getTypeId(), maTypeConfigDto.getUserId()); +// return result == 1 ? AjaxResult.success("解绑成功") : AjaxResult.error("解绑失败"); +// default: +// // 处理其他情况或抛出异常 +// return AjaxResult.error("输入值不合法 bindFlag: " + maTypeConfigDto.getBindFlag()); +// } +// } +// +// @Override +// public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) { +// // 1.把所有物资类型查出来 +// List list = typeService.selectThreeFourLevelTypeListAndParent(new Type()); +// // 2.把维修配置信息查出来 +// List typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair()); +// // 3.把库管配置信息查出来 +// List typeKeeperList = typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper()); +// +// // ------------------- 开启数据处理 --------------------- +// +// // 4.循环所有物资类型,重型数据集合保障只循环一次,减少性能损失 +// for (MaTypeConfigVo typeConfigVo1 : list) { +// // 1.外层 先对比维修班组 +// for (TypeRepair typeRepair : typeRepairList) { +// // 2.判断当前维修配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id +// if (typeRepair.getTypeId().equals(typeConfigVo1.getTypeId())) { +// // 3.如果相等,把维修员信息设置到物资类型配置信息中 +// typeConfigVo1.setRepairUserId(typeRepair.getUserId()); +// typeConfigVo1.setRepairUserName(typeRepair.getUserName()); +// break; +// } +// } +// // 1.外层 再对比库管班组 +// for (TypeKeeper typeKeeper : typeKeeperList) { +// // 2.判断当前库管配置信息中的物资类型id是否等于当前物资类型配置信息中的物资类型id +// if (typeKeeper.getTypeId().equals(typeConfigVo1.getTypeId())) { +// // 3.如果相等,把库管员信息设置到物资类型配置信息中 +// typeConfigVo1.setKeeperUserId(typeKeeper.getUserId()); +// typeConfigVo1.setKeeperUserName(typeKeeper.getUserName()); +// } +// } +// +// // 5.判断当前物资类型配置信息是否有子节点 +// if (typeConfigVo1.getChildren() != null) { +// // 6.有子节点,继续循环子节点,判断子节点是否有维修配置信息 +// for (MaTypeConfigVo typeConfigVo2 : typeConfigVo1.getChildren()) { +// // 7.有维修配置信息,把维修员信息设置到子节点中 +// for (TypeRepair typeRepair : typeRepairList) { +// if (typeRepair.getTypeId().equals(typeConfigVo2.getTypeId())) { +// typeConfigVo2.setRepairUserId(typeRepair.getUserId()); +// typeConfigVo2.setRepairUserName(typeRepair.getUserName()); +// } +// } +// } +// +// // 8.有子节点,继续循环子节点, +// for (MaTypeConfigVo typeConfigVo3 : typeConfigVo1.getChildren()) { +// // 9.判断子节点是否有库管配置信息 +// for (TypeKeeper typeKeeper : typeKeeperList) { +// if (typeKeeper.getTypeId().equals(typeConfigVo3.getTypeId())) { +// typeConfigVo3.setKeeperUserId(typeKeeper.getUserId()); +// typeConfigVo3.setKeeperUserName(typeKeeper.getUserName()); +// } +// } +// } +// } +// +// } +// +// // -------------------- 数据处理结束 --------------------- +// +// // TODO: 先暂时取消后续过滤流程 +// if (true) { +// return AjaxResult.success(list); +// } +// +// +// // ------------------- 数据过滤开始 --------------------- +// if (maTypeConfigDto == null || maTypeConfigDto.getUserId() == null || maTypeConfigDto.getUserId() == 0L) { +// // 如果参数无效,则返回原始列表 +// return AjaxResult.success(list); +// } +// +// List filteredList = new ArrayList<>(); +// +// for (MaTypeConfigVo maTypeConfigVo : list) { +// if ( +// maTypeConfigVo.getKeeperUserId().equals(maTypeConfigDto.getUserId()) || +// maTypeConfigVo.getRepairUserId().equals(maTypeConfigDto.getUserId()) +// ) +// { +// filteredList.add(maTypeConfigVo); +// } +// } +// +// // ------------------- 数据过滤结束 --------------------- +// +// +// // 返回前端 +// return AjaxResult.success(filteredList); +// } +// +// +// private int handleBind(int bindRoleType, Long typeId, Long userId) { +// switch (bindRoleType) { +// case 1: +// // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 1:库管员 的情况 +// // TODO: 实现具体逻辑 +// return typeKeeperService.insertTypeKeeper(new TypeKeeper(typeId, userId)); +// case 2: +// // 处理 bindFlag 为 1:绑定 且 bindRoleType 为 2:维修员 的情况 +// // TODO: 实现具体逻辑 +// return typeRepairService.insertTypeRepair(new TypeRepair(typeId, userId)); +// default: +// // 处理其他情况或抛出异常 +// throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); +// } +// } +// +// private int handleUnBind(int bindRoleType, Long typeId, Long userId) { +// switch (bindRoleType) { +// case 1: +// // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 1:库管员 的情况 +// // TODO: 实现具体逻辑 +// return typeKeeperService.deleteTypeKeeperByUserIdAndTypeId(new TypeKeeper(typeId, userId)); +// case 2: +// // 处理 bindFlag 为 2:解绑 且 bindRoleType 为 2:维修员 的情况 +// // TODO: 实现具体逻辑 +// return typeRepairService.deleteTypeRepairByUserIdAndTypeId(new TypeRepair(typeId, userId)); +// default: +// // 处理其他情况或抛出异常 +// throw new IllegalArgumentException("Unsupported bindRoleType: " + bindRoleType); +// } +// } +//}