|  | @@ -3128,3 +3128,116 @@ public class YtiotVAlarmServiceImpl implements YtiotVAlarmService {
 | 
	
		
			
				|  |  |  //			        if (entity != null) {
 | 
	
		
			
				|  |  |  //			            entity.consumeContent();
 | 
	
		
			
				|  |  |  //			        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				}else {
 | 
	
		
			
				|  |  | +					json.put("success", "false");
 | 
	
		
			
				|  |  | +					json.put("MSG", "参数传递错误,请联系系统管理员。");
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}else {
 | 
	
		
			
				|  |  | +				json.put("success", "false");
 | 
	
		
			
				|  |  | +				json.put("MSG", "参数传递错误,请联系系统管理员。");
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}else {
 | 
	
		
			
				|  |  | +			json.put("success", "false");
 | 
	
		
			
				|  |  | +			json.put("MSG", "用户权限错误,请重新登录后再试。");
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return json.toString();
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@Override
 | 
	
		
			
				|  |  | +	public String updateEf(String queryJson) throws Exception {
 | 
	
		
			
				|  |  | +		// TODO Auto-generated method stub
 | 
	
		
			
				|  |  | +		String V_LOGINNAME = null;
 | 
	
		
			
				|  |  | +		String V_PASSWORD = null;
 | 
	
		
			
				|  |  | +		int E_STATUS=-1;
 | 
	
		
			
				|  |  | +		String clwb = null;
 | 
	
		
			
				|  |  | +		String clnr = null;
 | 
	
		
			
				|  |  | +		String id = null;
 | 
	
		
			
				|  |  | +		String status = null;
 | 
	
		
			
				|  |  | +		String device_code = null;
 | 
	
		
			
				|  |  | +		String name = null;
 | 
	
		
			
				|  |  | +		String confirmAll = null;
 | 
	
		
			
				|  |  | +		String data4 = null;
 | 
	
		
			
				|  |  | +		String data2 = null;
 | 
	
		
			
				|  |  | +		JSONObject q_json = null;
 | 
	
		
			
				|  |  | +		JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  | +		json.put("action", "updateEf");
 | 
	
		
			
				|  |  | +		if(queryJson!=null) {
 | 
	
		
			
				|  |  | +			q_json = JSONObject.fromObject(queryJson);
 | 
	
		
			
				|  |  | +			clwb = q_json.has("clwb")?q_json.getString("clwb"):null;
 | 
	
		
			
				|  |  | +			clnr = q_json.has("clnr")?q_json.getString("clnr"):null;
 | 
	
		
			
				|  |  | +			id = q_json.has("id")?q_json.getString("id"):null;
 | 
	
		
			
				|  |  | +			status = q_json.has("status")?q_json.getString("status"):null;
 | 
	
		
			
				|  |  | +			device_code = q_json.has("device_code")?q_json.getString("device_code"):null;
 | 
	
		
			
				|  |  | +			name = q_json.has("name")?q_json.getString("name"):null;
 | 
	
		
			
				|  |  | +			confirmAll = q_json.has("confirmAll")?q_json.getString("confirmAll"):null;
 | 
	
		
			
				|  |  | +			data4 = q_json.has("data4")?q_json.getString("data4"):null;
 | 
	
		
			
				|  |  | +			data2 = q_json.has("data2")?q_json.getString("data2"):null;
 | 
	
		
			
				|  |  | +			V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
 | 
	
		
			
				|  |  | +			V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if((V_LOGINNAME!=null)&&(V_PASSWORD!=null)) {
 | 
	
		
			
				|  |  | +			List list = ytiotTAdminDao.query(" where MD5(u.VLoginname)='"+MD5Util.EncoderByMd5(V_LOGINNAME)+"' and u.VPassword='"
 | 
	
		
			
				|  |  | +					+MD5Util.EncoderByMd5(MD5Util.EncoderByMd5(V_PASSWORD))+"' ", null, null, null, null);
 | 
	
		
			
				|  |  | +			if(list.size()>0) {
 | 
	
		
			
				|  |  | +				YtiotTAdmin o = (YtiotTAdmin)list.get(0);
 | 
	
		
			
				|  |  | +				E_STATUS = Integer.parseInt(o.getEStatus());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if(E_STATUS==1) {
 | 
	
		
			
				|  |  | +			if((clwb!=null)&&(clnr!=null)&&(id!=null)&&(status!=null)&&(device_code!=null)&&(name!=null)&&(confirmAll!=null)) {
 | 
	
		
			
				|  |  | +				String sqlwhere=null;
 | 
	
		
			
				|  |  | +				String hqlwhere=null;
 | 
	
		
			
				|  |  | +				if(Integer.parseInt(confirmAll)==1) {
 | 
	
		
			
				|  |  | +					hqlwhere = " where u.id.deviceCode='"+device_code+"' and u.id.name='"+name+"' and u.id.clzt=0";
 | 
	
		
			
				|  |  | +					sqlwhere = " where device_code='"+device_code+"' and name='"+name+"' and clzt=0";
 | 
	
		
			
				|  |  | +				}else {
 | 
	
		
			
				|  |  | +					hqlwhere = " where u.id.id="+id+" ";
 | 
	
		
			
				|  |  | +					sqlwhere = " where id="+id+" ";
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +				int RowCount = ytiotVAlarmDao.getEFireCount(hqlwhere);
 | 
	
		
			
				|  |  | +//				System.out.println(sqlwhere);
 | 
	
		
			
				|  |  | +				if(RowCount>0) {
 | 
	
		
			
				|  |  | +					ytiotVAlarmDao.execSQL(" update ytiot_v_efire2 set clwb='"+clwb+"', clnr='"+clnr+"', clzt=1 , clsj=now(), clr='"+V_LOGINNAME+"' "+sqlwhere);
 | 
	
		
			
				|  |  | +					if (Integer.parseInt(confirmAll)==0){
 | 
	
		
			
				|  |  | +						HashMap<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +						map.put("SubType",7);
 | 
	
		
			
				|  |  | +						map.put("DeviceId",device_code);
 | 
	
		
			
				|  |  | +						map.put("InsertId",id);
 | 
	
		
			
				|  |  | +						map.put("Confirmed",true);
 | 
	
		
			
				|  |  | +						com.alibaba.fastjson.JSONObject json1 = new com.alibaba.fastjson.JSONObject(map);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +						com.alibaba.fastjson.JSONObject jsonObject = HttpClientUtils.doPost("http://47.98.201.187:55335/report", null,json1);
 | 
	
		
			
				|  |  | +//					System.out.println("jsonObject = " + jsonObject);
 | 
	
		
			
				|  |  | +					}else {
 | 
	
		
			
				|  |  | +						String sql = "select id,company_code from ytiot_v_efire where device_code='"+device_code+"' and name='"+name+"' and clzt=1 order by time desc LIMIT 1";
 | 
	
		
			
				|  |  | +						List list1 = ytiotVAlarmDao.queryBySQL(sql);
 | 
	
		
			
				|  |  | +						if(list1.size()>0) {
 | 
	
		
			
				|  |  | +							for(int i=0;i<list1.size();i++) {
 | 
	
		
			
				|  |  | +								Object [] row = (Object [])list1.get(i);
 | 
	
		
			
				|  |  | +								HashMap<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +								map.put("SubType",7);
 | 
	
		
			
				|  |  | +								map.put("DeviceId",device_code);
 | 
	
		
			
				|  |  | +								map.put("InsertId",row[0].toString());
 | 
	
		
			
				|  |  | +								map.put("Confirmed",true);
 | 
	
		
			
				|  |  | +								com.alibaba.fastjson.JSONObject json1 = new com.alibaba.fastjson.JSONObject(map);
 | 
	
		
			
				|  |  | +								System.out.println("ceshi19950802"+row[0].toString());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +								com.alibaba.fastjson.JSONObject jsonObject = HttpClientUtils.doPost("http://47.98.201.187:55335/report", null,json1);
 | 
	
		
			
				|  |  | +							}
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +					json.put("activerow", RowCount);
 | 
	
		
			
				|  |  | +					json.put("success", "true");
 | 
	
		
			
				|  |  | +				}else {
 | 
	
		
			
				|  |  | +					json.put("success", "false");
 | 
	
		
			
				|  |  | +					json.put("MSG", "参数传递错误,请联系系统管理员。");
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}else {
 | 
	
		
			
				|  |  | +				json.put("success", "false");
 | 
	
		
			
				|  |  | +				json.put("MSG", "参数传递错误,请联系系统管理员。");
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}else {
 | 
	
		
			
				|  |  | +			json.put("success", "false");
 | 
	
		
			
				|  |  | +			json.put("MSG", "用户权限错误,请重新登录后再试。");
 | 
	
		
			
				|  |  | +		}
 |