Browse Source

3dDisplayEngine YtiotVAlarmServiceImpl.java 吉超博 commit at 2021-02-09

吉超博 4 years ago
parent
commit
51b12d2a31
1 changed files with 119 additions and 0 deletions
  1. 119 0
      3dDisplayEngine/buildingService/YtiotVAlarmServiceImpl.java

+ 119 - 0
3dDisplayEngine/buildingService/YtiotVAlarmServiceImpl.java

@@ -3009,3 +3009,122 @@ public class YtiotVAlarmServiceImpl implements YtiotVAlarmService {
 		String id = null;
 		String id = null;
 		String status = null;
 		String status = null;
 		String device_code = null;
 		String device_code = null;
+		String name = null;
+		String confirmAll = null;
+		String data4 = null;
+		String data2 = null;
+		String sql = null;
+		List list1 = null;
+		JSONObject q_json = null;
+		JSONObject json = new JSONObject();
+		json.put("action", "updateHj");
+		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());
+			}
+		}
+		System.out.println("用户测试"+V_LOGINNAME+V_PASSWORD);
+		System.out.println("接口火警测试"+E_STATUS);
+		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.status='"+status+"' and u.id.data4='"+data4+"' and u.id.data2='"+data2+"' and u.id.clzt=0";
+					sqlwhere = " where device_code='"+device_code+"' and name='"+name+"' and status='"+status+"' and data4='"+data4+"' and data2='"+data2+"' and clzt=0";
+				}else {
+					hqlwhere = " where u.id.id="+id+" ";
+					sqlwhere = " where id="+id+" ";
+				}
+				int RowCount = ytiotVAlarmDao.getHJCount(hqlwhere);
+				System.out.println("火警测试1"+hqlwhere);
+//				System.out.println("火警测试2"+sqlwhere);
+				if(RowCount>0) {
+					ytiotVAlarmDao.execSQL(" update ytiot_v_hj2 set clwb='"+clwb+"', clnr='"+clnr+"', clzt=1 , clsj=now(), clr='"+V_LOGINNAME+"' "+sqlwhere);
+					if (Integer.parseInt(confirmAll)==0){
+						HashMap<String, Object> map = new HashMap<>();
+						if(V_LOGINNAME.equals("ypxy")) {
+							map.put("SubType",3);
+						}else {
+							map.put("SubType",1);
+						}
+						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 {
+						sql = "select id,company_code from ytiot_v_hj where device_code='"+device_code+"' and name='"+name+"' and status='"+status+"' and data4='"+data4+"' and data2='"+data2+"' and clzt=1 order by time desc LIMIT 1";
+						list1 = ytiotVAlarmDao.queryBySQL(sql);
+						System.out.println("ceshi19950802"+sql);
+						if(list1.size()>0) {
+							System.out.println("ceshi1995");
+							for(int i=0;i<list1.size();i++) {
+								Object [] row = (Object [])list1.get(i);
+								HashMap<String, Object> map = new HashMap<>();
+								if(V_LOGINNAME.equals("ypxy")) {
+									map.put("SubType",3);
+								}else {
+									map.put("SubType",1);
+								}
+								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");
+
+
+//					DefaultHttpClient httpclient = new DefaultHttpClient();
+//					HttpPost httppost = new HttpPost("http://localhost:8011/testServlet");
+//					List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
+//			        nvps.add(new BasicNameValuePair("content", "11111111")); // 参数
+//			        nvps.add(new BasicNameValuePair("path", "D:/file")); // 参数
+//			        nvps.add(new BasicNameValuePair("name", "8")); // 参数
+//			        nvps.add(new BasicNameValuePair("age", "9")); // 参数
+//			        nvps.add(new BasicNameValuePair("username", "wzt")); // 参数
+//
+//			        httppost.setEntity((HttpEntity) new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); // 设置参数给Post
+//			        HttpResponse response = httpclient.execute(httppost);
+//			        HttpEntity entity = response.getEntity();
+//			        System.out.println(response.getStatusLine());
+//			        if (entity != null) {
+//			            System.out.println("Response content length: "
+//			                    + entity.getContentLength());
+//			        }
+//
+//			        BufferedReader reader = new BufferedReader(new InputStreamReader(
+//			                entity.getContent(), "UTF-8"));
+//
+//			        String line = null;
+//			        while ((line = reader.readLine()) != null) {
+//			            System.out.println(line);
+//			        }
+//			        if (entity != null) {
+//			            entity.consumeContent();
+//			        }