|
@@ -395,6 +395,13 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
|
|
|
// 排序
|
|
|
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 machineNoCompare = compareMachineNo(d1.getMachineNo(), d2.getMachineNo());
|
|
|
if (machineNoCompare != 0) {
|
|
|
return machineNoCompare;
|
|
@@ -406,7 +413,10 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
}
|
|
|
|
|
|
int secondDeptCompare = Comparator.comparing(RectifyApiDataDto::getDeptsort, Comparator.nullsFirst(Integer::compareTo)).compare(d1, d2);
|
|
|
- return secondDeptCompare != 0 ? secondDeptCompare : Comparator.comparing(RectifyApiDataDto::getOutsidedeptsort, Comparator.nullsLast(Integer::compareTo)).compare(d1, d2);
|
|
|
+ if (secondDeptCompare != 0) {
|
|
|
+ return secondDeptCompare;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
});
|
|
|
|
|
|
// 处理基地内合计数据
|
|
@@ -438,7 +448,9 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
RectifyApiDataDto rectifyApiDataDto = createRectifyApiDataDto(rectifyList, machineNo, projectManageDo, true);
|
|
|
rectifyApiDataDto.setPrimarySector(firstDeptName);
|
|
|
rectifyApiDataDto.setPrimarySectorId(rectifyList.get(0).getFirstdeptid());
|
|
|
- rectifyApiDataDto.setSecondarySector("");
|
|
|
+ rectifyApiDataDto.setSecondarySector(firstDeptName);
|
|
|
+ rectifyApiDataDto.setSecondarySectorId(rectifyList.get(0).getFirstdeptid());
|
|
|
+ rectifyApiDataDto.setIfoutsidebase(machineList.get(0).getIfoutsidebase());
|
|
|
processRectifyData(machineList, rectifyApiDataDto);
|
|
|
firstDeptRectifyList.add(rectifyApiDataDto);
|
|
|
});
|
|
@@ -452,19 +464,19 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
.collect(Collectors.groupingBy(ZhcxProjectRectifyMachineVo::getDeptname));
|
|
|
|
|
|
List<RectifyApiDataDto> rectifyDtoList = new ArrayList<>();
|
|
|
- Set<String> processedFirstDeptIds = new HashSet<>();
|
|
|
-
|
|
|
+// Set<String> processedFirstDeptIds = new HashSet<>();
|
|
|
+ rectifyDtoList.addAll(firstDeptRectifyList);
|
|
|
groupDeptList.forEach((deptName, rectifyList) -> {
|
|
|
String firstDeptId = rectifyList.get(0).getFirstdeptid();
|
|
|
String firstdeptname = rectifyList.get(0).getFirstdeptname();
|
|
|
String deptid = rectifyList.get(0).getDeptid();
|
|
|
String deptname = rectifyList.get(0).getDeptname();
|
|
|
|
|
|
- if (processedFirstDeptIds.add(firstDeptId)) {
|
|
|
- rectifyDtoList.addAll(firstDeptRectifyList.stream()
|
|
|
- .filter(ev -> ev.getPrimarySectorId().equals(firstDeptId))
|
|
|
- .collect(Collectors.toList()));
|
|
|
- }
|
|
|
+// if (processedFirstDeptIds.add(firstDeptId)) {
|
|
|
+// rectifyDtoList.addAll(firstDeptRectifyList.stream()
|
|
|
+// .filter(ev -> ev.getPrimarySectorId().equals(firstDeptId))
|
|
|
+// .collect(Collectors.toList()));
|
|
|
+// }
|
|
|
|
|
|
Map<String, List<ZhcxProjectRectifyMachineVo>> groupMachineNoList = rectifyList.stream()
|
|
|
.collect(Collectors.groupingBy(ZhcxProjectRectifyMachineVo::getMachineno));
|
|
@@ -475,6 +487,7 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
rectifyApiDataDto.setPrimarySectorId(StringUtils.isNotBlank(firstDeptId) ? firstDeptId : "");
|
|
|
rectifyApiDataDto.setSecondarySector(StringUtils.isNotBlank(deptname) ? deptname : "");
|
|
|
rectifyApiDataDto.setSecondarySectorId(StringUtils.isNotBlank(deptid) ? deptid : "");
|
|
|
+ rectifyApiDataDto.setIfoutsidebase(machineList.get(0).getIfoutsidebase());
|
|
|
processRectifyData(machineList, rectifyApiDataDto);
|
|
|
rectifyDtoList.add(rectifyApiDataDto);
|
|
|
});
|
|
@@ -484,12 +497,16 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
}
|
|
|
|
|
|
private List<RectifyApiDataDto> processBaseData(List<ZhcxProjectRectifyMachineVo> list, boolean isBaseIn, ZhcxProjectManageDo projectManageDo) {
|
|
|
- List<String> deptIds = Arrays.asList("b0bd3ed27bfb4af08535c39f464b3d3a", "55c58ffb9d9b486abdd0dcb073f9b451");
|
|
|
-
|
|
|
+// List<String> deptIds = Arrays.asList("b0bd3ed27bfb4af08535c39f464b3d3a", "55c58ffb9d9b486abdd0dcb073f9b451");
|
|
|
+//
|
|
|
+// List<ZhcxProjectRectifyMachineVo> collect = list.stream()
|
|
|
+// .filter(e -> (isBaseIn && (deptIds.contains(e.getDeptid()) || Objects.nonNull(e.getFirstdeptid())))
|
|
|
+// || (!isBaseIn && Objects.isNull(e.getFirstdeptid()) && !deptIds.contains(e.getDeptid())))
|
|
|
+// .collect(Collectors.toList());
|
|
|
List<ZhcxProjectRectifyMachineVo> collect = list.stream()
|
|
|
- .filter(e -> (isBaseIn && (deptIds.contains(e.getDeptid()) || Objects.nonNull(e.getFirstdeptid())))
|
|
|
- || (!isBaseIn && Objects.isNull(e.getFirstdeptid()) && !deptIds.contains(e.getDeptid())))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ .filter(e -> (isBaseIn && ("inside".equals(e.getIfoutsidebase())))
|
|
|
+ || (!isBaseIn && ("outside".equals(e.getIfoutsidebase())))
|
|
|
+ ).collect(Collectors.toList());
|
|
|
|
|
|
Map<String, List<ZhcxProjectRectifyMachineVo>> baseList = collect.stream()
|
|
|
.collect(Collectors.groupingBy(ZhcxProjectRectifyMachineVo::getMachineno));
|
|
@@ -535,20 +552,16 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
rectifyApiDataDto.setProjectCode(projectManageDo.getProjectCode());
|
|
|
rectifyApiDataDto.setProjectName(projectManageDo.getProjectName());
|
|
|
rectifyApiDataDto.setMachineNo(machineNo);
|
|
|
+ if("inside".equals(rectifyList.get(0).getIfoutsidebase())){
|
|
|
+ rectifyApiDataDto.setBase("长兴分公司");
|
|
|
+ }else if("outside".equals(rectifyList.get(0).getIfoutsidebase())){
|
|
|
+ rectifyApiDataDto.setBase("基地外");
|
|
|
+ }
|
|
|
if (isFirstDept) {
|
|
|
rectifyApiDataDto.setFirstdeptsort(Optional.ofNullable(rectifyList.get(0).getFirstdeptsort()).orElse(null));
|
|
|
- if (Objects.nonNull(rectifyList.get(0).getFirstdeptid())) {
|
|
|
- rectifyApiDataDto.setBase("长兴分公司");
|
|
|
- }
|
|
|
} else {
|
|
|
rectifyApiDataDto.setFirstdeptsort(Optional.ofNullable(rectifyList.get(0).getFirstdeptsort()).orElse(null));
|
|
|
rectifyApiDataDto.setDeptsort(Optional.ofNullable(rectifyList.get(0).getDeptsort()).orElse(null));
|
|
|
- if (Objects.nonNull(rectifyList.get(0).getFirstdeptid())) {
|
|
|
- rectifyApiDataDto.setBase("长兴分公司");
|
|
|
- }else{
|
|
|
- rectifyApiDataDto.setBase(rectifyList.get(0).getDeptname());
|
|
|
- rectifyApiDataDto.setPrimarySector("");
|
|
|
- }
|
|
|
}
|
|
|
return rectifyApiDataDto;
|
|
|
}
|