| | |
| | | return default24HourPointDTOList; |
| | | } |
| | | |
| | | /** |
| | | * 填充设备状态的班次信息 |
| | | * @param calendarShiftList |
| | | * @param default24HourPointDTOList |
| | | * @param state |
| | | */ |
| | | private void packCalendarShiftInfoForTimePoint(List<CalendarShiftInfoDTO> calendarShiftList, List<DeviceState> default24HourPointDTOList, DeviceState state) { |
| | | if (Func.isNotEmpty(calendarShiftList)) { |
| | | CalendarShiftInfoDTO relatedShift = calendarShiftList.stream().filter(item -> { |
| | | return item.getStartTime().getTime() <= state.getTime().longValue() && item.getEndTime().getTime() > state.getTime().longValue(); |
| | | }).findFirst().orElse(null); |
| | | |
| | | if (Func.isNotEmpty(relatedShift)) { |
| | | state.setShiftIndex(relatedShift.getShiftIndex()); |
| | | state.setShiftTimeType(relatedShift.getShiftTimeType()); |
| | | state.setFactoryYear(relatedShift.getFactoryYear()); |
| | | state.setFactoryMonth(relatedShift.getFactoryMonth()); |
| | | state.setFactoryWeek(relatedShift.getFactoryWeek()); |
| | | String factoryDate = relatedShift.getFactoryDate(); |
| | | String[] split = Func.split(factoryDate, "-"); |
| | | state.setFactoryDate(Integer.valueOf(String.join("", split))); |
| | | state.setIsDeleted(Boolean.FALSE); |
| | | default24HourPointDTOList.add(state); |
| | | return; |
| | | } |
| | | log.warn("工位{} 日历{} 未找到整点班次信息", state.getWorkstationId(), state.getCalendarCode()); |
| | | return; |
| | | if (Func.isEmpty(calendarShiftList)) { |
| | | log.error("工位{} 日历{} 无日期:[{}]的班次信息", new Object[]{state.getWorkstationId(), state.getCalendarCode(), state.getTime()}); |
| | | return; |
| | | } |
| | | |
| | | CalendarShiftInfoDTO relatedShift = calendarShiftList.stream().filter(item -> { |
| | | return item.getStartTime().getTime() <= state.getTime() && item.getEndTime().getTime() > state.getTime(); |
| | | }).findFirst().orElse(null); |
| | | |
| | | if (Func.isNotEmpty(relatedShift)) { |
| | | state.setShiftIndex(relatedShift.getShiftIndex()); |
| | | state.setShiftTimeType(relatedShift.getShiftTimeType()); |
| | | state.setFactoryYear(relatedShift.getFactoryYear()); |
| | | state.setFactoryMonth(relatedShift.getFactoryMonth()); |
| | | state.setFactoryWeek(relatedShift.getFactoryWeek()); |
| | | String factoryDate = relatedShift.getFactoryDate(); |
| | | String[] split = Func.split(factoryDate, "-"); |
| | | state.setFactoryDate(Integer.valueOf(String.join("", split))); |
| | | state.setIsDeleted(false); |
| | | default24HourPointDTOList.add(state); |
| | | }else { |
| | | log.warn("工位{} 日历{} 未找到固定点班次信息", state.getWorkstationId(), state.getCalendarCode()); |
| | | } |
| | | log.error("工位{} 日历{} 无自然天{}班次信息", new Object[]{state.getWorkstationId(), state.getCalendarCode(), state.getTime()}); |
| | | } |
| | | |
| | | //不一定能用上 |
| | |
| | | workstationState.setShiftIndex(CommonConstant.DEFAULT_SHIFT_INDEX); |
| | | workstationState.setShiftTimeType(CommonConstant.DEFAULT_SHIFT_TYPE); |
| | | workstationState.setFeedbackPointType(FeedbackTimePointEnum.NO_FEED_BACK_POINT.getValue()); |
| | | workstationState.setIsDeleted(Boolean.FALSE); |
| | | workstationState.setIsDeleted(false); |
| | | } |
| | | } |
| | | } |