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