|
@@ -246,49 +246,64 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
|
Map<String, List<ZhcxProjectRectifyMachineVo>> groupFirstDeptList = list.stream()
|
|
|
.filter(e -> Objects.nonNull(e.getFirstdeptid()))
|
|
|
.collect(Collectors.groupingBy(ZhcxProjectRectifyMachineVo::getFirstdeptname));
|
|
|
- //汇总一级部门数据
|
|
|
+ //汇总一级部门数据包括自身的数据
|
|
|
List<RectifyDto> firstDeptRectifyList = new ArrayList<>();
|
|
|
groupFirstDeptList.forEach((firstDeptName, machines) -> {
|
|
|
RectifyDto rectifyDto = new RectifyDto();
|
|
|
rectifyDto.setFirstdeptsort(machines.get(0).getFirstdeptsort());
|
|
|
rectifyDto.setFirstdeptid(machines.get(0).getFirstdeptid());
|
|
|
rectifyDto.setFirstdeptname(machines.get(0).getFirstdeptname());
|
|
|
+ //自身的部门数据设值和一级部门一致 参与汇总
|
|
|
+ //rectifyDto.setDeptsort(machines.get(0).getFirstdeptsort());
|
|
|
+ rectifyDto.setDeptid(machines.get(0).getFirstdeptid());
|
|
|
+ rectifyDto.setDeptname(machines.get(0).getFirstdeptname());
|
|
|
+ rectifyDto.setIfoutsidebase(machines.get(0).getIfoutsidebase());
|
|
|
rectifyDto.setData(createRectifyMachineDtoList(machines, ZhcxProjectRectifyMachineVo::getFirstdeptid));
|
|
|
firstDeptRectifyList.add(rectifyDto);
|
|
|
});
|
|
|
|
|
|
- // 根据施工部门分组
|
|
|
+ // 根据施工部门分组 过滤一级部门和施工部门相同的 此为上面汇总一级部门数据
|
|
|
Map<String, List<ZhcxProjectRectifyMachineVo>> groupDeptList = list.stream()
|
|
|
+ .filter(e -> Objects.nonNull(e.getFirstdeptid())
|
|
|
+ && !e.getFirstdeptid().equals(e.getDeptid()))
|
|
|
.collect(Collectors.groupingBy(ZhcxProjectRectifyMachineVo::getDeptname));
|
|
|
|
|
|
List<RectifyDto> rectifyDtoList = new ArrayList<>();
|
|
|
- Set<String> processedFirstDeptIds = new HashSet<>();
|
|
|
+ rectifyDtoList.addAll(firstDeptRectifyList);
|
|
|
+ //Set<String> processedFirstDeptIds = new HashSet<>();
|
|
|
//汇总施工部门数据
|
|
|
groupDeptList.forEach((deptName, machines) -> {
|
|
|
String firstDeptId = machines.get(0).getFirstdeptid();
|
|
|
- if (processedFirstDeptIds.add(firstDeptId)) {
|
|
|
- List<RectifyDto> collect = firstDeptRectifyList.stream()
|
|
|
- .filter(ev -> ev.getFirstdeptid().equals(firstDeptId))
|
|
|
- .collect(Collectors.toList());
|
|
|
- rectifyDtoList.addAll(collect);
|
|
|
- }
|
|
|
+// if (processedFirstDeptIds.add(firstDeptId)) {
|
|
|
+// List<RectifyDto> collect = firstDeptRectifyList.stream()
|
|
|
+// .filter(ev -> ev.getFirstdeptid().equals(firstDeptId))
|
|
|
+// .collect(Collectors.toList());
|
|
|
+// rectifyDtoList.addAll(collect);
|
|
|
+// }
|
|
|
|
|
|
RectifyDto rectifyDto = new RectifyDto();
|
|
|
rectifyDto.setFirstdeptsort(machines.get(0).getFirstdeptsort());
|
|
|
rectifyDto.setFirstdeptid(firstDeptId);
|
|
|
rectifyDto.setFirstdeptname(machines.get(0).getFirstdeptname());
|
|
|
rectifyDto.setDeptsort(machines.get(0).getDeptsort());
|
|
|
- rectifyDto.setOutsidedeptsort(machines.get(0).getOutsidedeptsort());
|
|
|
+ //rectifyDto.setOutsidedeptsort(machines.get(0).getOutsidedeptsort());
|
|
|
rectifyDto.setDeptid(machines.get(0).getDeptid());
|
|
|
rectifyDto.setDeptname(deptName);
|
|
|
+ rectifyDto.setIfoutsidebase(machines.get(0).getIfoutsidebase());
|
|
|
rectifyDto.setData(createRectifyMachineDtoList(machines,ZhcxProjectRectifyMachineDo::getDeptid));
|
|
|
rectifyDtoList.add(rectifyDto);
|
|
|
});
|
|
|
//排序
|
|
|
//rectifyDtoList.sort(Comparator.comparing(RectifyDto::getFirstdeptid, Comparator.nullsLast(String::compareTo)));
|
|
|
rectifyDtoList.sort((d1, d2) -> {
|
|
|
+ int ifoutsidebase1 = "inside".equals(d1.getIfoutsidebase()) ? 0 : 1;
|
|
|
+ int ifoutsidebase2 = "inside".equals(d2.getIfoutsidebase()) ? 0 : 1;
|
|
|
+ int ifoutsideBaseCompare = Integer.compare(ifoutsidebase1, ifoutsidebase2);
|
|
|
+ if (ifoutsideBaseCompare != 0) {
|
|
|
+ return ifoutsideBaseCompare;
|
|
|
+ }
|
|
|
// 先按一级部门排序,空的排到最后
|
|
|
- int firstDeptCompare = Comparator.comparing(RectifyDto::getFirstdeptsort, Comparator.nullsLast(Integer::compareTo)).compare(d1, d2);
|
|
|
+ int firstDeptCompare = Comparator.comparing(RectifyDto::getFirstdeptsort, Comparator.nullsFirst(Integer::compareTo)).compare(d1, d2);
|
|
|
if (firstDeptCompare != 0) {
|
|
|
return firstDeptCompare;
|
|
|
}
|
|
@@ -297,28 +312,33 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
|
if (secondDeptCompare != 0) {
|
|
|
return secondDeptCompare;
|
|
|
}
|
|
|
+ return 0;
|
|
|
// 最后按基地外排序
|
|
|
- return Comparator.comparing(RectifyDto::getOutsidedeptsort, Comparator.nullsLast(Integer::compareTo)).compare(d1, d2);
|
|
|
+ //return Comparator.comparing(RectifyDto::getOutsidedeptsort, Comparator.nullsLast(Integer::compareTo)).compare(d1, d2);
|
|
|
});
|
|
|
//基地内合计
|
|
|
+// List<ZhcxProjectRectifyMachineVo> collect = list.stream()
|
|
|
+// .filter(e -> Objects.nonNull(e.getFirstdeptid())).collect(Collectors.toList());
|
|
|
List<ZhcxProjectRectifyMachineVo> collect = list.stream()
|
|
|
- .filter(e -> Objects.nonNull(e.getFirstdeptid())).collect(Collectors.toList());
|
|
|
- //长兴基地 大车行走配套事业部
|
|
|
- List<String> deptIds = Arrays.asList("b0bd3ed27bfb4af08535c39f464b3d3a"
|
|
|
- ,"55c58ffb9d9b486abdd0dcb073f9b451");
|
|
|
- List<ZhcxProjectRectifyMachineVo> collect2 = list.stream()
|
|
|
- .filter(e -> deptIds.contains(e.getDeptid())).collect(Collectors.toList());
|
|
|
- collect.addAll(collect2);
|
|
|
+ .filter(e -> "inside".equals(e.getIfoutsidebase())).collect(Collectors.toList());
|
|
|
+// //长兴基地 大车行走配套事业部
|
|
|
+// List<String> deptIds = Arrays.asList("b0bd3ed27bfb4af08535c39f464b3d3a"
|
|
|
+// ,"55c58ffb9d9b486abdd0dcb073f9b451");
|
|
|
+// List<ZhcxProjectRectifyMachineVo> collect2 = list.stream()
|
|
|
+// .filter(e -> deptIds.contains(e.getDeptid())).collect(Collectors.toList());
|
|
|
+// collect.addAll(collect2);
|
|
|
RectifyDto rectifyDto = new RectifyDto();
|
|
|
rectifyDto.setDeptid(null);
|
|
|
rectifyDto.setDeptname("基地内合计");
|
|
|
rectifyDto.setData(createRectifyMachineDtoList(collect,null));
|
|
|
rectifyDtoList.add(rectifyDto);
|
|
|
//基地外合计
|
|
|
+// List<ZhcxProjectRectifyMachineVo> collect3 = list.stream()
|
|
|
+// .filter(e -> !"b0bd3ed27bfb4af08535c39f464b3d3a".equals(e.getDeptid())
|
|
|
+// && !"55c58ffb9d9b486abdd0dcb073f9b451".equals(e.getDeptid())
|
|
|
+// && Objects.isNull(e.getFirstdeptid())).collect(Collectors.toList());
|
|
|
List<ZhcxProjectRectifyMachineVo> collect3 = list.stream()
|
|
|
- .filter(e -> !"b0bd3ed27bfb4af08535c39f464b3d3a".equals(e.getDeptid())
|
|
|
- && !"55c58ffb9d9b486abdd0dcb073f9b451".equals(e.getDeptid())
|
|
|
- && Objects.isNull(e.getFirstdeptid())).collect(Collectors.toList());
|
|
|
+ .filter(e -> "outside".equals(e.getIfoutsidebase())).collect(Collectors.toList());
|
|
|
RectifyDto outSideRectifyDto = new RectifyDto();
|
|
|
outSideRectifyDto.setDeptid(null);
|
|
|
outSideRectifyDto.setDeptname("基地外合计");
|
|
@@ -599,7 +619,8 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
|
// 设置颜色
|
|
|
for (int j = colIndex; j < colIndex + 6; j++) {
|
|
|
Style cellStyle = cells.get(rowIndex, j).getStyle();
|
|
|
- if (StringUtils.isNotBlank(row.getDeptid())) {
|
|
|
+ if ((StringUtils.isNotBlank(row.getDeptid()) && !row.getDeptid().equals(row.getFirstdeptid())) ||
|
|
|
+ "outside".equals(row.getIfoutsidebase()) ) {
|
|
|
cellStyle.setForegroundColor(COLORS[colorIndex % 2]);
|
|
|
}else if(StringUtils.isBlank(row.getDeptid())
|
|
|
&& StringUtils.isBlank(row.getFirstdeptid())
|
|
@@ -635,9 +656,10 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
|
Style style = cells.get(rowIndex, 1).getStyle();
|
|
|
style.setPattern(BackgroundType.SOLID);
|
|
|
//车间颜色
|
|
|
- if(StringUtils.isNotBlank(row.getDeptid()) && StringUtils.isNotBlank(row.getFirstdeptid())){
|
|
|
+ if(StringUtils.isNotBlank(row.getDeptid()) && StringUtils.isNotBlank(row.getFirstdeptid())
|
|
|
+ && !row.getDeptid().equals(row.getFirstdeptid()) && "inside".equals(row.getIfoutsidebase())){
|
|
|
style.setForegroundColor(COLORS[3]);
|
|
|
- }else if(StringUtils.isNotBlank(row.getDeptid()) && StringUtils.isBlank(row.getFirstdeptid())){
|
|
|
+ }else if("outside".equals(row.getIfoutsidebase())){
|
|
|
//基地外颜色
|
|
|
style.setForegroundColor(COLORS[4]);
|
|
|
}else if(StringUtils.isBlank(row.getDeptid()) && StringUtils.isBlank(row.getFirstdeptid())
|