From f44cf32b7209f48f4b2efe07971bed7a67862be2 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期三, 11 九月 2024 14:49:18 +0800
Subject: [PATCH] 过程参数调试完成

---
 smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java |   17 +++++++++++++++--
 smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml   |   14 ++++++++++++--
 smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/dto/ProcessParameterVO.java                   |    6 +++++-
 smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java       |   14 +++++++++++++-
 4 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/dto/ProcessParameterVO.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/dto/ProcessParameterVO.java
index 81cdff1..92b7534 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/dto/ProcessParameterVO.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/dto/ProcessParameterVO.java
@@ -103,7 +103,11 @@
     }
 
     public Long getRealTime() {
-        return this.realTime;
+    	if(this.time != null) {
+    		return this.time.getTime();
+    	}else {
+    		return null;
+    	}
     }
 
     public String getCollectItem() {
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java
index 01ef236..93a11b6 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.java
@@ -1,15 +1,19 @@
 package com.qianwen.smartman.modules.mdc.mapper;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
+
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
+
+import com.qianwen.smartman.common.constant.FmsConstant;
 import com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO;
 import com.qianwen.smartman.modules.mdc.dto.TimeDTO;
 import com.qianwen.smartman.modules.mdc.entity.LastProcessParam;
 import com.qianwen.smartman.modules.mdc.entity.WorkstationCollectData;
 
-//@DS("tdengine")
 @DS("iotdb")
+@InterceptorIgnore(tenantLine = FmsConstant.AUTOMATIC)
 public interface SuperProcessParameterMapper {
 	@Deprecated
     List<WorkstationCollectData> queryLastParameter(@Param("workstationId") String workstationId);
@@ -31,6 +35,14 @@
 
     List<ProcessParameterVO> processParameterListByShift(@Param("times") List<TimeDTO> times, @Param("collectItems") List<String> collectItems, @Param("workstationId") String workstationId);
 
+    /**
+     * 
+     * @param workstationId
+     * @param item
+     * @param startTime
+     * @param endTime
+     * @return
+     */
     List<ProcessParameterVO> oldOneCollectList(@Param("workstationId") Long workstationId, @Param("item") String item, @Param("startTime") Long startTime, @Param("endTime") Long endTime);
 
     /**
diff --git a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java
index 077ac14..d6d7c6d 100644
--- a/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java
+++ b/smart-man-boot/src/main/java/com/qianwen/smartman/modules/mdc/service/impl/ProcessParameterServiceImpl.java
@@ -180,7 +180,7 @@
         String workstationId = vo.getWorkstationId();
         LocalDate queryTime = vo.getQueryTime();
         Integer shift = vo.getShift();
-        Workstation workstation = (Workstation) this.workstationService.getById(Long.valueOf(Func.toLong(workstationId)));
+        Workstation workstation = (Workstation) this.workstationService.getById(Func.toLong(workstationId));
         return (ShiftTimeVO) Optional.ofNullable(workstation).map(w -> {
             CalendarShiftTimeSlicesDTO timeSliceShift = TimeSliceCache.getTimeSliceShift(workstation.getCalendarCode(), queryTime, shift);
             return (ShiftTimeVO) Optional.ofNullable(timeSliceShift).map(time -> {
@@ -674,7 +674,13 @@
 		return result;
 	}
 	
-	
+	/**
+	 * 鑾峰彇宸ヤ綅鏈�鏂板弬鏁板��
+	 * @param workstationId 宸ヤ綅id
+	 * @param item 鍙傛暟鍚嶇О,濡侱eviceStatus/Output
+	 * @param time 鏃堕棿锛屽弬鏁板簲灏忎簬璇ユ椂闂�
+	 * @return
+	 */
 	public ProcessParameterVO getLastParameterLessThanTime(long workstationId,String item,Long time) {
 		//yys
 		LastProcessParam lp = this.parameterMapper.lastParameterLessThanTime(workstationId,item,time);
@@ -697,6 +703,13 @@
 		return vo;
 	}
 	
+	/**
+	 * 鑾峰彇宸ヤ綅鏈�鏂板弬鏁板��(閲囬泦鏃堕棿搴斿ぇ浜庢寚瀹氭椂闂�)
+	 * @param workstationId
+	 * @param item  鍙傛暟鍚嶇О,濡侱eviceStatus/Output
+	 * @param time 鎸囧畾鐨勬椂闂�
+	 * @return
+	 */
 	public ProcessParameterVO getLastParameterGreaterThenTime(long workstationId,String item,Long time) {
 		//yys
 		LastProcessParam lp = this.parameterMapper.lastParameterGreaterThanTime(workstationId,item,time);
diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
index 2130bba..4ac9340 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
+++ b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
@@ -102,7 +102,7 @@
         </where>
         order by ts asc
     </select>
-
+<!-- 
     <select id="oldOneCollectList" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
         select ts as realTime,
                n  as collectItem,
@@ -115,7 +115,7 @@
         order by ts
     </select>
 
-      <!-- 
+      
     <select id="oldFirstStatue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
         select last(ts) as realTime,
                last(v)  as value_collect
@@ -159,5 +159,15 @@
           and ts &gt; #{endTime}
           and workstation_id = #{workstationId}
     </select>
+    <select id="oldOneCollectList" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
+        select n as collectItem,v  as valueCollect
+        from root.f2.process_param_*
+        where n = #{item}
+          and time &gt;= #{startTime}
+          and time &lt;= #{endTime}
+          and workstation_id = #{workstationId}
+        order by time
+        align by device
+    </select>
 </mapper>
 

--
Gitblit v1.9.3