From d187cd0fa46d01ec293e2aba1a1e54fdfab2ec80 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期日, 03 十一月 2024 20:37:26 +0800
Subject: [PATCH] 数据点位过滤修复,使用了计算规则的点位存储_n的。

---
 collect/src/main/java/com/qianwen/mdc/collect/service/IOTMqttReceiveService.java |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/collect/src/main/java/com/qianwen/mdc/collect/service/IOTMqttReceiveService.java b/collect/src/main/java/com/qianwen/mdc/collect/service/IOTMqttReceiveService.java
index be25cb6..31b7301 100644
--- a/collect/src/main/java/com/qianwen/mdc/collect/service/IOTMqttReceiveService.java
+++ b/collect/src/main/java/com/qianwen/mdc/collect/service/IOTMqttReceiveService.java
@@ -19,6 +19,7 @@
 
 @Service
 public class IOTMqttReceiveService {
+	public static final String NEWDP_SUFFIX = "_n";//璁$畻瑙勫垯浣跨敤涔嬪悗鏂版暟鎹偣鐨勭粨灏�
 	private static final Logger log = LoggerFactory.getLogger(IOTMqttReceiveService.class);
 	@Autowired
 	private CollectDataService collectDataService;
@@ -27,6 +28,7 @@
 	private PackedDataService packedDataService;
 	@Autowired
     private WorkstationDatapointsService dpService;
+	
 	/**
 	 * 澶勭悊鏀跺埌鐨勬秷鎭�,瀵瑰簲TelemetryDataPostingConsumer
 	 * @param payload
@@ -54,15 +56,13 @@
         Set<String> keySet = jsonObj.keySet();
         String[] keys = keySet.toArray(new String[] {});
         
-        //WorkstationDatapointsVO dpVo;
         
-        final String NEWDP_SUFFIX = "_n";//璁$畻瑙勫垯浣跨敤涔嬪悗鏂版暟鎹偣鐨勭粨灏�
         for(String key : keys) {
         	String appId = key;//iot绯荤粺涓殑搴旂敤id锛屾湰搴旂敤涓簲璇ョ敤琛ㄥ幓瀵瑰簲
         	
-        	
-        	//TODO 鑾峰彇宸ヤ綅鏁版嵁鐐归厤缃�,鍙繚瀛橀厤缃ソ鐨勬暟鎹偣锛屾病鏈夐厤缃殑閲囬泦鏁版嵁鎶涘純銆�
+        	//鑾峰彇宸ヤ綅鏁版嵁鐐归厤缃�,鍙繚瀛橀厤缃ソ鐨勬暟鎹偣锛屾病鏈夐厤缃殑閲囬泦鏁版嵁鎶涘純銆�
         	final WorkstationDatapointsVO dpVo = dpService.getDatapointsByAppIdFromCache(appId);
+        	//final WorkstationDatapointsVO dpVo = dpService.getDataPointByAppId(appId);
         	if(dpVo == null) {
         		//宸ヤ綅娌℃湁瀹氫箟杩囨暟鎹偣鎴栬�卆ppId涓嶅尮閰�
         		log.warn("appId={}鏈壘鍒版暟鎹偣瀹氫箟璁板綍锛屼涪寮冩暟鎹�",appId);
@@ -86,14 +86,16 @@
 	        	
 	        	Set<String> valueKeySet = values.keySet();
 	        	valueKeySet.forEach(valueKey ->{
-	        		String oriValueKey = valueKey;;//鐢变簬浣跨敤璁$畻瑙勫垯鐨勯噰闆嗙偣鍚嶇О浼氬悗闈㈠鍔犱竴涓�"_n",鎵�浠ヨ繖涓猳riValueKey浠h〃娌℃湁澧炲姞"_n"鐨�
-	        		if(StringUtils.endsWith(valueKey, NEWDP_SUFFIX)) {
-	        			oriValueKey = StringUtils.removeEnd(valueKey, NEWDP_SUFFIX);
-	        		}
-	        		if(!dpVo.containsDataPoint(oriValueKey)) {
+	        		if(!dpVo.containsDataPoint(valueKey)) {
 	    				//濡傛灉涓嶅瓨鍦ㄨ鏁版嵁鐐归厤缃紝璇ユ暟鎹洿鎺ュ拷鐣�
 	    				return;
 	    			}
+	        		
+	        		String oriValueKey = valueKey;//鐢变簬浣跨敤璁$畻瑙勫垯鐨勯噰闆嗙偣鍚嶇О浼氬悗闈㈠鍔犱竴涓�"_n",鎵�浠ヨ繖涓猳riValueKey浠h〃娌℃湁澧炲姞"_n"鐨�
+	        		if(StringUtils.endsWith(valueKey, NEWDP_SUFFIX)) {
+	        			oriValueKey = StringUtils.removeEnd(valueKey, NEWDP_SUFFIX);
+	        		}
+	        		
 	        		tdataItem.addPoint(oriValueKey,values.getString(valueKey));//浣跨敤鍘熷閰嶇疆鐐逛繚鎸佷繚瀛樻暟鎹�
 	        	});
 	        	

--
Gitblit v1.9.3