首页》标准部件列表
This commit is contained in:
parent
062275abd8
commit
3f2a33a25d
|
|
@ -25,6 +25,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -83,7 +84,7 @@ public class MaterialHomeApi extends BaseApi {
|
|||
return ResultVO.success(mp);
|
||||
}
|
||||
|
||||
@GetMapping("materialMessage")
|
||||
@GetMapping("standardPartList")
|
||||
@ApiOperation("标准部件")
|
||||
public ResultVO<Map<String, List<StandardPartPickRuleHomeVO>>> standardPartList(){
|
||||
//仅取90天内的数据
|
||||
|
|
@ -97,13 +98,20 @@ public class MaterialHomeApi extends BaseApi {
|
|||
if(sDept == null){
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
//规则集合,含共享部门及创建部门
|
||||
List<StandardPartPickRuleEntity> ruleList = standardPartPickRuleService.list(Wrappers.<StandardPartPickRuleEntity>lambdaQuery()
|
||||
//规则集合,含共享部门及创建部门各取前5条记录
|
||||
List<StandardPartPickRuleEntity> ruleList = Lists.newArrayList();
|
||||
List<StandardPartPickRuleEntity> desginRuleList = standardPartPickRuleService.list(Wrappers.<StandardPartPickRuleEntity>lambdaQuery()
|
||||
.ge(StandardPartPickRuleEntity::getCreatedTime,date90)
|
||||
.and(wp-> wp.eq(StandardPartPickRuleEntity::getDeptRowId,sDept.getRowId())
|
||||
.or(w -> w.like(StandardPartPickRuleEntity::getShareDeptRowId,sDept.getRowId())))
|
||||
.eq(StandardPartPickRuleEntity::getDeptRowId,sDept.getRowId())
|
||||
.orderByDesc(StandardPartPickRuleEntity::getCreatedTime)
|
||||
.last(String.format("limit %d",5)));
|
||||
List<StandardPartPickRuleEntity> shareRuleList = standardPartPickRuleService.list(Wrappers.<StandardPartPickRuleEntity>lambdaQuery()
|
||||
.ge(StandardPartPickRuleEntity::getCreatedTime,date90)
|
||||
.like(StandardPartPickRuleEntity::getShareDeptRowId,sDept.getRowId())
|
||||
.orderByDesc(StandardPartPickRuleEntity::getCreatedTime)
|
||||
.last(String.format("limit %d",5)));
|
||||
ruleList.addAll(desginRuleList.stream().collect(Collectors.toMap(StandardPartPickRuleEntity::getCategoryRowId,Function.identity(),(k1,k2)->k1)).values());
|
||||
ruleList.addAll(shareRuleList.stream().collect(Collectors.toMap(StandardPartPickRuleEntity::getCategoryRowId,Function.identity(),(k1,k2)-> k1)).values());
|
||||
if(ruleList.isEmpty()){
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
|
|
@ -120,7 +128,7 @@ public class MaterialHomeApi extends BaseApi {
|
|||
//本部门可用的选配规则
|
||||
List<StandardPartPickRuleHomeVO> shareList = Lists.newArrayList();
|
||||
|
||||
ruleList.forEach(rule -> {
|
||||
ruleList.stream().distinct().forEach(rule -> {
|
||||
StandardPartPickRuleHomeVO ruleHomeVO = new StandardPartPickRuleHomeVO();
|
||||
ruleHomeVO.setRowId(rule.getRowId());
|
||||
ruleHomeVO.setCategoryRowId(rule.getCategoryRowId());
|
||||
|
|
@ -130,15 +138,15 @@ public class MaterialHomeApi extends BaseApi {
|
|||
|
||||
ruleHomeVO.setArguments(argList.stream().filter(a -> Objects.equals(a.getRowId(),rule.getRowId()))
|
||||
.map(StandardPartPickRuleArgumentsEntity::getName).distinct().collect(Collectors.joining("/")));
|
||||
|
||||
|
||||
shareList.add(ruleHomeVO);
|
||||
//本部门设置的选配规则
|
||||
if(Objects.equals(rule.getDeptRowId(),sDept.getRowId())){
|
||||
desginList.add(ruleHomeVO);
|
||||
}
|
||||
});
|
||||
|
||||
//本部门设置的选配规则
|
||||
|
||||
|
||||
return ResultVO.success(null);
|
||||
mp.put("shareList",shareList);
|
||||
mp.put("desginList",desginList);
|
||||
return ResultVO.success(mp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue