From 04d53749b21921c9bceebe120d170c2ee6e533af Mon Sep 17 00:00:00 2001 From: yangys <y_ys79@sina.com> Date: 星期三, 13 十一月 2024 21:21:46 +0800 Subject: [PATCH] 增加离线检查定时任务的逻辑 --- collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java | 51 +++++++++++++++++++++++++++++---------------------- 1 files changed, 29 insertions(+), 22 deletions(-) diff --git a/collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java b/collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java index ca31fd4..8db7e81 100644 --- a/collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java +++ b/collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java @@ -289,29 +289,36 @@ 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()}); } //涓嶄竴瀹氳兘鐢ㄤ笂 @@ -325,7 +332,7 @@ 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); } } } -- Gitblit v1.9.3