|  |  |  | @ -6,6 +6,10 @@ import com.yinuo.safetywatcher.TestUtils | 
		
	
		
			
				|  |  |  |  | import com.common.commonlib.db.DBUtils | 
		
	
		
			
				|  |  |  |  | import com.common.commonlib.db.dao.WarningDao | 
		
	
		
			
				|  |  |  |  | import com.common.commonlib.db.entity.Warning | 
		
	
		
			
				|  |  |  |  | import com.yinuo.safetywatcher.watcher.constant.CAMERA_DNS | 
		
	
		
			
				|  |  |  |  | import com.yinuo.safetywatcher.watcher.constant.CAMERA_GATEWAY | 
		
	
		
			
				|  |  |  |  | import com.yinuo.safetywatcher.watcher.constant.CAMERA_IP | 
		
	
		
			
				|  |  |  |  | import com.yinuo.safetywatcher.watcher.constant.CAMERA_NETMASK | 
		
	
		
			
				|  |  |  |  | import com.yinuo.safetywatcher.watcher.utils.LztekUtil | 
		
	
		
			
				|  |  |  |  | import kotlinx.coroutines.DelicateCoroutinesApi | 
		
	
		
			
				|  |  |  |  | import kotlinx.coroutines.GlobalScope | 
		
	
	
		
			
				
					|  |  |  | @ -25,7 +29,7 @@ class App : CommonApplication() { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     private fun ipConfig() { | 
		
	
		
			
				|  |  |  |  |         LztekUtil.getLztek() | 
		
	
		
			
				|  |  |  |  |             ?.setEthIpAddress("192.168.5.21", "255.255.255.0", "192.168.5.1", "8.8.8.8") | 
		
	
		
			
				|  |  |  |  |             ?.setEthIpAddress(CAMERA_IP, CAMERA_NETMASK, CAMERA_GATEWAY, CAMERA_DNS) | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     private fun tryFixDbData() { | 
		
	
	
		
			
				
					|  |  |  | @ -36,7 +40,7 @@ class App : CommonApplication() { | 
		
	
		
			
				|  |  |  |  |                 val warningList = warningDao.queryWarningsNoEndTime() | 
		
	
		
			
				|  |  |  |  |                 warningList?.apply { | 
		
	
		
			
				|  |  |  |  |                     forEach { warning -> | 
		
	
		
			
				|  |  |  |  |                         warning.endTime = tryAssignment(warningDao, warning) | 
		
	
		
			
				|  |  |  |  |                         warning.endTime = trySetEndTime(warningDao, warning) | 
		
	
		
			
				|  |  |  |  |                     } | 
		
	
		
			
				|  |  |  |  |                     warningDao.updateAll(warningList) | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
	
		
			
				
					|  |  |  | @ -65,7 +69,7 @@ class App : CommonApplication() { | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     private suspend fun tryAssignment(warningDao: WarningDao, warning: Warning): Long { | 
		
	
		
			
				|  |  |  |  |     private suspend fun trySetEndTime(warningDao: WarningDao, warning: Warning): Long { | 
		
	
		
			
				|  |  |  |  |         val latest = warningDao.findLatestByName(warning.gasName) | 
		
	
		
			
				|  |  |  |  |         return if (latest?.endTime!! > 0L) latest.endTime else System.currentTimeMillis() | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
	
		
			
				
					|  |  |  | 
 |