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/resources/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.xml | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 107 insertions(+), 7 deletions(-)
diff --git a/collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.xml b/collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.xml
index af763c6..a24fd99 100644
--- a/collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.xml
+++ b/collect/src/main/resources/com/qianwen/mdc/collect/mapper/iotdb/DeviceStateMapper.xml
@@ -4,8 +4,7 @@
<mapper namespace="com.qianwen.mdc.collect.mapper.iotdb.DeviceStateMapper">
<resultMap id="BaseResultMap" type="com.qianwen.mdc.collect.entity.iotdb.DeviceState">
<result column="workstation_id" jdbcType="BIGINT" property="workstationId"/>
- <result column="value_collect" jdbcType="BIGINT" property="valueCollect"/>
- <result column="param_type" jdbcType="INTEGER" property="paramType"/>
+ <result column="value_collect" jdbcType="INTEGER" property="valueCollect"/>
<result column="calendar_code" jdbcType="VARCHAR" property="calendarCode"/>
<result column="factory_year" jdbcType="INTEGER" property="factoryYear"/>
<result column="factory_month" jdbcType="INTEGER" property="factoryMonth"/>
@@ -14,10 +13,14 @@
<result column="shift_index" jdbcType="INTEGER" property="shiftIndex"/>
<result column="shift_time_type" jdbcType="INTEGER" property="shiftTimeType"/>
<result column="wcs" jdbcType="INTEGER" property="wcs"/>
- <result column="rps" jdbcType="INTEGER" property="wcs"/>
+ <result column="rps" jdbcType="INTEGER" property="rps"/>
<result column="is_sync" jdbcType="BOOLEAN" property="isSync"/>
<result column="feedback_id" jdbcType="BIGINT" property="feedbackId"/>
<result column="is_deleted" jdbcType="BOOLEAN" property="isDeleted"/>
+ <result column="is_plan" jdbcType="INTEGER" property="isPlan"/>
+
+ <result column="feedback_point_type" jdbcType="INTEGER" property="feedbackPointType"/><!-- new -->
+
<result column="employee_id" jdbcType="BIGINT" property="employeeId"/>
</resultMap>
<!--
@@ -70,19 +73,19 @@
</sql>
<!-- resultType="com.qianwen.mdc.collect.entity.iotdb.DeviceState" -->
<select id="lastSyncedNoFeedbackPointState" resultMap="BaseResultMap">
- select <include refid="all_columns" /> FROM root.f2.aggregate_state_${workstationId}
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
where is_sync=true and is_fix_point=false and feedback_point_type=0 and is_deleted=false
order by time desc limit 1
</select>
<select id="firstNotSyncedNofeedbackPointState" resultMap="BaseResultMap">
- select <include refid="all_columns" /> FROM root.f2.aggregate_state_${workstationId}
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
where is_sync=false and is_fix_point=false and feedback_point_type=0 and is_deleted=false
order by time asc limit 1
</select>
-
+ <!-- -->
<select id="statesInTimeRange" resultMap="BaseResultMap">
- select <include refid="all_columns" /> FROM root.f2.aggregate_state_${workstationId}
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
<where>
is_deleted=false
<if test="timeRange.startTime != null">
@@ -92,7 +95,104 @@
</where>
order by time asc
+ align by device
</select>
+ <select id="fixPointCountByDate" resultType="Long">
+ select count(factory_date) FROM root.f2.state_* where factory_date=#{factoryDate} and is_fix_point=true
+ </select>
+
+ <!-- 鑾峰彇宸ヤ綅涓婃椂闂村皬浜庢寚瀹氭椂闂寸殑闈炲弽棣堢偣(涓嶅惈鍥哄畾鐐�) -->
+ <!-- .eq(WorkstationState::getWorkstationId, feedback.getWorkstationId())
+ .lt(WorkstationState::getTs,cancelDetail.getStartTime().getTime())
+ .eq(WorkstationState::getIsFixPoint, Boolean.FALSE)
+ .eq(WorkstationState::getFeedbackPointType, FeedbackTimePointEnum.NO_FEED_BACK_POINT.getValue())
+ .ne(WorkstationState::getIsDeleted, Boolean.TRUE)); -->
+ <select id="lastNoFeedbackStateLessThanTime" resultMap="BaseResultMap">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where
+ is_deleted=false and is_fix_point=false
+ and feedback_point_type=0
+ AND time < #{time}
+ order by time desc limit 1
+
+ </select>
+
+ <select id="lastNoFeedbackStateLeTime" resultMap="BaseResultMap">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where
+ is_deleted=false and is_fix_point=false
+ and feedback_point_type=0
+ AND time <= #{time}
+ order by time desc limit 1
+
+ </select>
+
+ <!-- stateMapper.selectOne(Wrappers.<WorkstationState>lambdaQuery().eq(WorkstationState::getWorkstationId
+ , workstationId).ne(WorkstationState::getIsDeleted, Boolean.TRUE).eq(WorkstationState::getTs, time)); -->
+ <select id="getByWorkstationIdAndTime" resultMap="BaseResultMap">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where is_deleted=false AND time = #{time}
+ limit 1
+ </select>
+
+
+ <!--
+ Wrappers.<WorkstationState>lambdaQuery()
+ .eq(WorkstationState::getWorkstationId, feedback.getWorkstationId())
+ .le(WorkstationState::getTs, Long.valueOf(feedback.getEndTime().getTime()))
+ .isNotNull(WorkstationState::getShiftIndex)
+ .ne(WorkstationState::getIsDeleted, Boolean.TRUE));
+ -->
+ <select id="getLastByWorkstationIdAndLeTimeAndShiftIndexNotNull" resultMap="BaseResultMap">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where is_deleted=false AND time <= #{time} and shift_index is not null
+ order by time desc limit 1
+ </select>
+
+ <!--
+ stateMapper.selectOne(Wrappers.<WorkstationState>lambdaQuery()
+ .eq(WorkstationState::getWorkstationId, feedback.getWorkstationId())
+ .eq(WorkstationState::getIsFixPoint, Boolean.TRUE)
+ .eq(WorkstationState::getTs, Long.valueOf(feedback.getStartTime().getTime())));
+ -->
+ <select id="getFixPointByWorkstationIdAndTime" resultMap="BaseResultMap">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where is_fix_point=true AND time = #{time}
+ limit 1
+ </select>
+
+ <!--
+ 宸ヤ綅涓婃墍鏈夌鍚堟椂闂村尯闂寸殑闈炲弽棣堢偣鐘舵�佹暟鎹�
+ List<WorkstationState> effectiveStateList = stateMapper.selectList(Wrappers.<WorkstationState>lambdaQuery()
+ .le(WorkstationState::getTs, Long.valueOf(analyseResult.getEffectiveEndDate().getTime()))
+ .ge(WorkstationState::getTs, Long.valueOf(analyseResult.getEffectiveStartDate().getTime()))
+ .eq(WorkstationState::getWorkstationId, analyseResult.getWorkstationId())
+ .ne(WorkstationState::getIsDeleted, Boolean.TRUE)
+ .gt(WorkstationState::getFeedbackPointType, FeedbackTimePointEnum.NO_FEED_BACK_POINT.getValue()));
+ -->
+ <select id="workstationNoFeedbackPointStatesInTimeRange" resultMap="BaseResultMap">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where feedback_point_type=0 and is_deleted=false and time >= #{startTime} AND time <= #{endTime}
+ </select>
+
+ <!--
+ 鏃堕棿鍖洪棿鍐呯殑鍥哄畾鐐规暟鎹�
+ List<WorkstationState> fixPointStateList = stateMapper.selectList(Wrappers.<WorkstationState>lambdaQuery()
+ .le(WorkstationState::getTs, Long.valueOf(analyseResult.getEffectiveEndDate().getTime()))
+ .ge(WorkstationState::getTs, Long.valueOf(analyseResult.getEffectiveStartDate().getTime()))
+ .eq(WorkstationState::getWorkstationId, analyseResult.getWorkstationId())
+ .eq(WorkstationState::getIsFixPoint, Boolean.TRUE));
+ -->
+ <select id="workstationFixPointStatesInTimeRange" resultMap="BaseResultMap">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where is_fix_point=true and is_deleted=false and time >= #{startTime} AND time <= #{endTime}
+ </select>
+ <select id="lastNoFixedState" resultType="com.qianwen.mdc.collect.entity.iotdb.DeviceState">
+ select <include refid="all_columns" /> FROM root.f2.state_${workstationId}
+ where is_fix_point=false and is_deleted=false order by time desc limit 1
+ </select>
+
+
</mapper>
--
Gitblit v1.9.3