Merge branch 'master' into branch_syruan
This commit is contained in:
commit
03a47de19f
|
|
@ -9,6 +9,7 @@ import javax.validation.constraints.NotNull;
|
||||||
import com.bonus.common.biz.domain.TreeSelect;
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
import com.bonus.material.ma.MaTypeConfigDto;
|
||||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||||
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||||
import com.bonus.material.warehouse.domain.WhHouseSet;
|
import com.bonus.material.warehouse.domain.WhHouseSet;
|
||||||
|
|
@ -201,4 +202,15 @@ public class TypeController extends BaseController {
|
||||||
public AjaxResult remove(@PathVariable Long[] typeIds) {
|
public AjaxResult remove(@PathVariable Long[] typeIds) {
|
||||||
return toAjax(typeService.deleteTypeByTypeIds(typeIds));
|
return toAjax(typeService.deleteTypeByTypeIds(typeIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询物资类型配置右侧列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询物资类型配置右侧列表")
|
||||||
|
@RequiresPermissions("ma:typeConfig:list")
|
||||||
|
@GetMapping("/getMaTypeConfigList")
|
||||||
|
public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) {
|
||||||
|
// 调用service处理业务逻辑
|
||||||
|
return typeService.getMaTypeConfigList(maTypeConfigDto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.bonus.material.ma.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.bonus.common.biz.domain.TreeSelect;
|
import com.bonus.common.biz.domain.TreeSelect;
|
||||||
|
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.Type;
|
||||||
import com.bonus.material.ma.vo.MaTypeConfigVo;
|
import com.bonus.material.ma.vo.MaTypeConfigVo;
|
||||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||||
|
|
@ -93,4 +95,6 @@ public interface ITypeService {
|
||||||
* @return 树结构列表
|
* @return 树结构列表
|
||||||
*/
|
*/
|
||||||
List<Type> buildMaTypeTree(List<Type> maTypeList);
|
List<Type> buildMaTypeTree(List<Type> maTypeList);
|
||||||
|
|
||||||
|
AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@ import com.bonus.common.biz.domain.TreeSelect;
|
||||||
import com.bonus.common.biz.enums.DataCodeEnum;
|
import com.bonus.common.biz.enums.DataCodeEnum;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.ma.MaTypeConfigDto;
|
||||||
|
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.vo.MaTypeConfigVo;
|
import com.bonus.material.ma.vo.MaTypeConfigVo;
|
||||||
import com.bonus.material.ma.vo.MaTypeListVo;
|
import com.bonus.material.ma.vo.MaTypeListVo;
|
||||||
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
import com.bonus.material.ma.vo.MaTypeSelectVo;
|
||||||
|
|
@ -33,6 +39,12 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
@Resource
|
@Resource
|
||||||
private TypeMapper typeMapper;
|
private TypeMapper typeMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITypeKeeperService typeKeeperService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITypeRepairService typeRepairService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询物资类型 -- 根据id
|
* 查询物资类型 -- 根据id
|
||||||
*
|
*
|
||||||
|
|
@ -373,4 +385,96 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
return !getChildList(list, t).isEmpty();
|
return !getChildList(list, t).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getMaTypeConfigList(MaTypeConfigDto maTypeConfigDto) {
|
||||||
|
// 1.把所有物资类型查出来
|
||||||
|
List<MaTypeConfigVo> list = selectThreeFourLevelTypeListAndParent(new Type());
|
||||||
|
// 2.把维修配置信息查出来
|
||||||
|
List<TypeRepair> typeRepairList = typeRepairService.selectTypeRepairListAndUserName(new TypeRepair());
|
||||||
|
// 3.把库管配置信息查出来
|
||||||
|
List<TypeKeeper> 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<MaTypeConfigVo> 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue