| | |
| | | List<WorkstationShiftDTO> workstationShifts = new ArrayList<>(); |
| | | workstationData.forEach(workstation -> { |
| | | Boolean isBlendShiftModel = isBlendShiftModel(shiftInfoDtoList, workstation.getWorkstationId()); |
| | | List<ShiftInfoDTO> collect = (List) shiftInfoDtoList.parallelStream().filter(shift -> { |
| | | List<ShiftInfoDTO> collect = shiftInfoDtoList.parallelStream().filter(shift -> { |
| | | return shift.getWorkstationId().equals(workstation.getWorkstationId()); |
| | | }).collect(Collectors.collectingAndThen(Collectors.toCollection(() -> { |
| | | return new TreeSet(Comparator.comparing((v0) -> { |
| | | return new TreeSet<>(Comparator.comparing((v0) -> { |
| | | return v0.getShiftIndex(); |
| | | })); |
| | | }), (v1) -> { |
| | | return new ArrayList(v1); |
| | | return new ArrayList<>(v1); |
| | | })); |
| | | collect.forEach(c -> { |
| | | WorkstationShiftDTO workstationShiftDTO = WorkstationShiftDTO.of(c.getShiftIndex()).setShiftName(buildShiftName(c.getShiftIndex(), isBlendShiftModel, c.getIndexName())); |
| | |
| | | } |
| | | |
| | | public static Boolean isBlendShiftModel(List<ShiftInfoDTO> shiftInfos, Long workstationId) { |
| | | int size = ((ArrayList) shiftInfos.parallelStream().filter(s -> { |
| | | int size = ( shiftInfos.parallelStream().filter(s -> { |
| | | return s.getWorkstationId().equals(workstationId); |
| | | }).collect(Collectors.collectingAndThen(Collectors.toCollection(() -> { |
| | | return new TreeSet(Comparator.comparing((v0) -> { |
| | | return new TreeSet<>(Comparator.comparing((v0) -> { |
| | | return v0.getModelId(); |
| | | })); |
| | | }), (v1) -> { |
| | | return new ArrayList(v1); |
| | | return new ArrayList<>(v1); |
| | | }))).size(); |
| | | return Boolean.valueOf(size >= 2); |
| | | } |
| | | |
| | | public static List<WorkstationShiftDTO> fillShift(List<ShiftInfoDTO> collect, WorkstationDataDTO workstationDataDTO) { |
| | | if (collect.size() == 4) { |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | List<WorkstationShiftDTO> result = new ArrayList<>(); |
| | | if (CollectionUtil.isEmpty(collect)) { |
| | |
| | | } |
| | | |
| | | public static void fillWorkStationGroup(IPage<WorkstationDataDTO> source) { |
| | | List<WorkstationDataDTO> list = (List) source.getRecords().parallelStream().peek(w -> { |
| | | List<WorkstationDataDTO> list = source.getRecords().parallelStream().peek(w -> { |
| | | if (StrUtil.isEmpty(w.getWorkstationGroup())) { |
| | | w.setWorkstationGroup(CommonGroupConstant.DEFAULT_NAME); |
| | | } |
| | |
| | | } |
| | | |
| | | public static HttpServletRequest getRequest() { |
| | | ServletRequestAttributes attributes = RequestContextHolder.getRequestAttributes(); |
| | | ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); |
| | | if (attributes != null) { |
| | | HttpServletRequest request = attributes.getRequest(); |
| | | return request; |