From 11d4be720620abf502d35000e2ed40d30c4023bf Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期一, 24 十一月 2025 16:33:34 +0800
Subject: [PATCH] 修复离线时间展示
---
collect/src/main/java/com/qianwen/mdc/collect/service/DeviceStateFixPointService.java | 65 +++++++++++++++++---------------
1 files changed, 35 insertions(+), 30 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 396eb93..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
@@ -53,12 +53,12 @@
/**
* 鍔犲叆鍥哄畾鐐�,鍘焪orkStationStateFixPoint
* @param dateTime 鎵撳浐瀹氱偣鐨勬棩鏈�
- * @param includeWorkstationIds
+ * @param includeWorkstationIds 鎸囧畾鎵撳浐瀹氱偣鐨勫伐浣峣d锛屽叏閮芥墦鐐逛紶null
*/
public void deviceStateFixPoint(DateTime dateTime, List<String> includeWorkstationIds) {
List<DeviceState> result;
- Map<Long, WorkstationDTO> workStations = workstationCache.getWorkStations();
+ Map<String, WorkstationDTO> workStations = workstationCache.getWorkstations();
if (ObjectUtil.isEmpty(workStations)) {
return;
}
@@ -202,22 +202,20 @@
tablet.addValue("rps", i, state.getRps());
tablet.addValue("is_fix_point", i, state.getIsFixPoint());
tablet.addValue("is_sync", i, state.getIsSync());
- tablet.addValue("is_plan", i, state.getIsPlan());
+ tablet.addValue("is_plan", i, state.getIsPlan()==null ? -1 : state.getIsPlan());
tablet.addValue("feedback_point_type", i, state.getFeedbackPointType());
- tablet.addValue("feedback_id", i, state.getFeedbackId());
+ tablet.addValue("feedback_id", i, state.getFeedbackId() == null?0:state.getFeedbackId());
tablet.addValue("is_deleted", i, state.getIsDeleted());
- tablet.addValue("employee_id", i, state.getEmployeeId());
+ tablet.addValue("employee_id", i, state.getEmployeeId() == null?0:state.getEmployeeId());
}
try {
this.iotdbConfig.getSessionPool().insertAlignedTablet(tablet);
} catch (Exception e) {
- log.error("淇濆瓨鍥哄畾鐐规暟鎹紓甯�",e);
+ log.error("淇濆瓨state鍥哄畾鐐规暟鎹紓甯�",e);
}
}
-
-
}
private List<DeviceState> getDefaultShift24HourPointDTOS(Long workStationId, String calendarCode, CalendarShiftInfoDTO shift) {
@@ -291,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()});
}
//涓嶄竴瀹氳兘鐢ㄤ笂
@@ -327,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