|  |  |  | @ -136,24 +136,29 @@ class QueryDataActivity : BaseActivity() { | 
		
	
		
			
				|  |  |  |  |             val gasDao = DBUtils.gasDao() | 
		
	
		
			
				|  |  |  |  |             val gasList = gasDao.getAllByTime(startTime, endTime) | 
		
	
		
			
				|  |  |  |  |             // 多气体,分开创建list,存储之后。 再分步 | 
		
	
		
			
				|  |  |  |  |             val gasTypeDao = DBUtils.gasTypeDao() | 
		
	
		
			
				|  |  |  |  |             val gasTypes = gasTypeDao.getAll() | 
		
	
		
			
				|  |  |  |  |             // 每种气体建立一个list | 
		
	
		
			
				|  |  |  |  |             val gasMap = HashMap<String, MutableList<Gas>>() | 
		
	
		
			
				|  |  |  |  |             // 预先创建分步合一之后的list | 
		
	
		
			
				|  |  |  |  |             val gasNewMap = HashMap<String, MutableList<Gas>>() | 
		
	
		
			
				|  |  |  |  |             gasTypes.forEach { | 
		
	
		
			
				|  |  |  |  |                 gasMap[it.type] = mutableListOf() | 
		
	
		
			
				|  |  |  |  |                 gasNewMap[it.type] = mutableListOf() | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             // 分开各个气体的数据 | 
		
	
		
			
				|  |  |  |  |             gasList.forEach { | 
		
	
		
			
				|  |  |  |  |                 val list = gasMap[it.gasName] | 
		
	
		
			
				|  |  |  |  |                 list?.add(it) | 
		
	
		
			
				|  |  |  |  |             val gasMap = gasList.groupBy { | 
		
	
		
			
				|  |  |  |  |                 it.gasName | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             val gasNewMap = HashMap<String, MutableList<Gas>>() | 
		
	
		
			
				|  |  |  |  | //            // 多气体,分开创建list,存储之后。 再分步 | 
		
	
		
			
				|  |  |  |  | //            val gasTypeDao = DBUtils.gasTypeDao() | 
		
	
		
			
				|  |  |  |  | //            val gasTypes = gasTypeDao.getAll() | 
		
	
		
			
				|  |  |  |  | //            // 每种气体建立一个list | 
		
	
		
			
				|  |  |  |  | //            val gasMap = HashMap<String, MutableList<Gas>>() | 
		
	
		
			
				|  |  |  |  | //            // 预先创建分步合一之后的list | 
		
	
		
			
				|  |  |  |  | //            val gasNewMap = HashMap<String, MutableList<Gas>>() | 
		
	
		
			
				|  |  |  |  | //            gasTypes.forEach { | 
		
	
		
			
				|  |  |  |  | //                gasMap[it.type] = mutableListOf() | 
		
	
		
			
				|  |  |  |  | //                gasNewMap[it.type] = mutableListOf() | 
		
	
		
			
				|  |  |  |  | //            } | 
		
	
		
			
				|  |  |  |  | //            // 分开各个气体的数据 | 
		
	
		
			
				|  |  |  |  | //            gasList.forEach { | 
		
	
		
			
				|  |  |  |  | //                val list = gasMap[it.gasName] | 
		
	
		
			
				|  |  |  |  | //                list?.add(it) | 
		
	
		
			
				|  |  |  |  | //            } | 
		
	
		
			
				|  |  |  |  |             //根据步长分割数据填充新的列表 | 
		
	
		
			
				|  |  |  |  |             gasMap.forEach { (type, list) -> | 
		
	
		
			
				|  |  |  |  |                 val newMapList = gasNewMap[type] | 
		
	
		
			
				|  |  |  |  |                 val newMapList = mutableListOf<Gas>() | 
		
	
		
			
				|  |  |  |  |                 var startGas: Gas? = null | 
		
	
		
			
				|  |  |  |  |                 var gasValue = 0.0 | 
		
	
		
			
				|  |  |  |  |                 var tempTime = 0L | 
		
	
	
		
			
				
					|  |  |  | @ -169,14 +174,14 @@ class QueryDataActivity : BaseActivity() { | 
		
	
		
			
				|  |  |  |  |                         if (gasValue >= 0.0) { | 
		
	
		
			
				|  |  |  |  |                             startGas!!.gasValue = gasValue / count | 
		
	
		
			
				|  |  |  |  |                             startGas!!.time = tempTime | 
		
	
		
			
				|  |  |  |  |                             newMapList?.add(startGas!!) | 
		
	
		
			
				|  |  |  |  |                             newMapList.add(startGas!!) | 
		
	
		
			
				|  |  |  |  |                         } | 
		
	
		
			
				|  |  |  |  |                         val offsetTime = gas.time - tempTime | 
		
	
		
			
				|  |  |  |  |                         val num = offsetTime / intervalMs | 
		
	
		
			
				|  |  |  |  |                         if (num > 0) { | 
		
	
		
			
				|  |  |  |  |                             for (i in num downTo 1) { | 
		
	
		
			
				|  |  |  |  |                                 tempTime += intervalMs | 
		
	
		
			
				|  |  |  |  |                                 newMapList?.add(gas.copy(time = tempTime, gasValue = -1.0)) | 
		
	
		
			
				|  |  |  |  |                                 newMapList.add(gas.copy(time = tempTime, gasValue = -1.0)) | 
		
	
		
			
				|  |  |  |  |                             } | 
		
	
		
			
				|  |  |  |  |                         } | 
		
	
		
			
				|  |  |  |  |                         tempTime += intervalMs | 
		
	
	
		
			
				
					|  |  |  | @ -193,10 +198,11 @@ class QueryDataActivity : BaseActivity() { | 
		
	
		
			
				|  |  |  |  |                         if (gasValue >= 0.0) { | 
		
	
		
			
				|  |  |  |  |                             startGas!!.gasValue = gasValue / count | 
		
	
		
			
				|  |  |  |  |                             startGas!!.time = tempTime | 
		
	
		
			
				|  |  |  |  |                             newMapList?.add(startGas!!) | 
		
	
		
			
				|  |  |  |  |                             newMapList.add(startGas!!) | 
		
	
		
			
				|  |  |  |  |                         } | 
		
	
		
			
				|  |  |  |  |                     } | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |                 gasNewMap[type] = newMapList | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             mGasNewMap = gasNewMap | 
		
	
		
			
				|  |  |  |  |             var newList = mutableListOf<Gas>() | 
		
	
	
		
			
				
					|  |  |  | 
 |