|  | @@ -183,3 +183,77 @@ public class YtiotVAlarmServiceImpl implements YtiotVAlarmService {
 | 
	
		
			
				|  |  |  					order = s_json.has("property")?s_json.getString("property"):order;
 | 
	
		
			
				|  |  |  					dir = s_json.has("direction")?s_json.getString("direction"):dir;
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  | +				json.put("sort", sort);
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			Start = start;
 | 
	
		
			
				|  |  | +			Limit = limit;
 | 
	
		
			
				|  |  | +			Page = page;
 | 
	
		
			
				|  |  | +			if((V_LOGINNAME!=null)&&(company_code==null)&&(company_code_list==null)) {
 | 
	
		
			
				|  |  | +				String where = " where u.id.agentid='"+V_LOGINNAME+"' ";
 | 
	
		
			
				|  |  | +				List list = ytiotVUserCompanyDao.query(where, null, null, null, null);
 | 
	
		
			
				|  |  | +				if(list.size()>0) {
 | 
	
		
			
				|  |  | +					for(int i=0;i<list.size();i++) {
 | 
	
		
			
				|  |  | +						YtiotVUsercompany o = (YtiotVUsercompany)list.get(i);
 | 
	
		
			
				|  |  | +						YtiotVUsercompanyId oid = o.getId();
 | 
	
		
			
				|  |  | +						if(i==0)
 | 
	
		
			
				|  |  | +							Company_Code_List = oid.getOwnerCode();
 | 
	
		
			
				|  |  | +						else
 | 
	
		
			
				|  |  | +							Company_Code_List += ","+oid.getOwnerCode();
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(address!=null) {
 | 
	
		
			
				|  |  | +				hqlwhere = chkhw(hqlwhere) + " address like '%"+address+"%' ";
 | 
	
		
			
				|  |  | +				hhwhere = chkhw(hhwhere) + " u.id.address like '%"+address+"%' ";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if((clzt!=null)&&(clzt.length()>0)) {
 | 
	
		
			
				|  |  | +				hqlwhere = chkhw(hqlwhere) + " clzt = "+clzt+" ";
 | 
	
		
			
				|  |  | +				hhwhere = chkhw(hhwhere) + " u.id.clzt = "+clzt+" ";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(Company_Code_List!=null) {
 | 
	
		
			
				|  |  | +				hqlwhere = chkhw(hqlwhere) + " company_code in ("+Company_Code_List+") ";
 | 
	
		
			
				|  |  | +				hhwhere = chkhw(hhwhere) + " u.id.companyCode in ("+Company_Code_List+") ";
 | 
	
		
			
				|  |  | +			}else {
 | 
	
		
			
				|  |  | +				if(company_code!=null) {
 | 
	
		
			
				|  |  | +					hqlwhere = chkhw(hqlwhere) + " company_code = "+company_code+" ";
 | 
	
		
			
				|  |  | +					hhwhere = chkhw(hhwhere) + " u.id.companyCode = "+company_code+" ";
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +				if(company_code_list!=null) {
 | 
	
		
			
				|  |  | +					hqlwhere = chkhw(hqlwhere) + " company_code in ("+company_code_list+") ";
 | 
	
		
			
				|  |  | +					hhwhere = chkhw(hhwhere) + " u.id.companyCode in ("+company_code_list+") ";
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			if(device_code!=null) {
 | 
	
		
			
				|  |  | +				hqlwhere = chkhw(hqlwhere) + " device_code = "+device_code+" ";
 | 
	
		
			
				|  |  | +				hhwhere = chkhw(hhwhere) + " u.id.deviceCode = "+device_code+" ";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(device_code_list!=null) {
 | 
	
		
			
				|  |  | +				hqlwhere = chkhw(hqlwhere) + " device_code in ("+device_code_list+") ";
 | 
	
		
			
				|  |  | +				hhwhere = chkhw(hhwhere) + " u.id.deviceCode in ("+device_code_list+") ";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(time_start!=null) {
 | 
	
		
			
				|  |  | +				hqlwhere = chkhw(hqlwhere) + " time >= '"+time_start+"' ";
 | 
	
		
			
				|  |  | +				hhwhere = chkhw(hhwhere) + " u.id.time >= '"+time_start+"' ";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(time_end!=null) {
 | 
	
		
			
				|  |  | +				hqlwhere = chkhw(hqlwhere) + " time <= '"+time_end+"' ";
 | 
	
		
			
				|  |  | +				hhwhere = chkhw(hhwhere) + " u.id.time <= '"+time_end+"' ";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(COMMSTATUS!=null) {
 | 
	
		
			
				|  |  | +				if(COMMSTATUS.equals("NO")) {
 | 
	
		
			
				|  |  | +					hqlwhere = chkhw(hqlwhere)+" data1 <> 'EF9' ";
 | 
	
		
			
				|  |  | +					hhwhere = chkhw(hhwhere)+" u.id.data1 <> 'EF9' ";
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +				else if(COMMSTATUS.equals("ONLY")) {
 | 
	
		
			
				|  |  | +					hqlwhere = chkhw(hqlwhere)+" data1 = 'EF9' ";
 | 
	
		
			
				|  |  | +					hhwhere = chkhw(hhwhere)+" u.id.data1 = 'EF9' ";
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(order!=null)
 | 
	
		
			
				|  |  | +				order_str = " order by "+order;
 | 
	
		
			
				|  |  | +			else
 | 
	
		
			
				|  |  | +				order_str = " order by id ";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			int totalCount = ytiotVAlarmDao.getEFireCount(hhwhere);
 | 
	
		
			
				|  |  | +//			System.out.print("shazi");
 |