|  | @ -1,5 +1,6 @@
 | 
	
		
			
				|  |  | package com.yihu.iot.service.company;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.iot.dao.company.*;
 | 
	
		
			
				|  |  | import com.yihu.iot.dao.platform.IotCompanyAppInterfaceDao;
 | 
	
		
			
				|  |  | import com.yihu.iot.dao.platform.IotInterfaceLogDao;
 | 
	
	
		
			
				|  | @ -1159,17 +1160,24 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<AppServiceCount> getAppService(Integer size){
 | 
	
		
			
				|  |  |     public JSONObject getAppService(){
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         String str = "SELECT SUM(b.count) count,b.app_name appName\n" +
 | 
	
		
			
				|  |  |                 "FROM (SELECT COUNT(id) fali,app_name,interface_name FROM xmiot.iot_interface_log  WHERE state=0 GROUP BY app_name,interface_name) c\n" +
 | 
	
		
			
				|  |  |                 "RIGHT JOIN (SELECT count(id) count,app_name,interface_name,work_type FROM xmiot.iot_interface_log WHERE app_name IS NOT NULL\n" +
 | 
	
		
			
				|  |  |                 "GROUP BY app_name,interface_name) b ON c.app_name=b.app_name AND c.interface_name=b.interface_name\n" +
 | 
	
		
			
				|  |  |                 "GROUP BY b.app_name ORDER BY count DESC";
 | 
	
		
			
				|  |  |         if (size > 0){
 | 
	
		
			
				|  |  |             str += " LIMIT 0,3";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String str1 = "SELECT SUM(b.count) count,b.app_name appName\n" +
 | 
	
		
			
				|  |  |                 "FROM (SELECT COUNT(id) fali,app_name,interface_name FROM xmiot.iot_interface_log  WHERE state=0 GROUP BY app_name,interface_name) c\n" +
 | 
	
		
			
				|  |  |                 "RIGHT JOIN (SELECT count(id) count,app_name,interface_name,work_type FROM xmiot.iot_interface_log WHERE app_name IS NOT NULL\n" +
 | 
	
		
			
				|  |  |                 "GROUP BY app_name,interface_name) b ON c.app_name=b.app_name AND c.interface_name=b.interface_name\n" +
 | 
	
		
			
				|  |  |                 "GROUP BY b.app_name ORDER BY count DESC limit 0,3";
 | 
	
		
			
				|  |  |         List<AppServiceCount> counts = jdbcTemplate.query(str,new BeanPropertyRowMapper<>(AppServiceCount.class));
 | 
	
		
			
				|  |  |         return counts;
 | 
	
		
			
				|  |  |         List<AppServiceCount> counts1 = jdbcTemplate.query(str1,new BeanPropertyRowMapper<>(AppServiceCount.class));
 | 
	
		
			
				|  |  |         object.put("appcount",counts.size());
 | 
	
		
			
				|  |  |         object.put("sortList",counts1);
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |