Переглянути джерело

3dDisplayEngine YtiotVAlarmServiceImpl.java 吉超博 commit at 2021-03-17

吉超博 4 роки тому
батько
коміт
db2b08910e

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

@@ -3945,3 +3945,168 @@ public class YtiotVAlarmServiceImpl implements YtiotVAlarmService {
 				E_STATUS = Integer.parseInt(o.getEStatus());
 			}
 		}
+		if(E_STATUS==1) {
+			if((clwb!=null)&&(clnr!=null)&&(id!=null)&&(data5!=null)&&(device_code!=null)&&(name!=null)&&(confirmAll!=null)) {
+				String sqlwhere=null;
+				String hqlwhere=null;
+				if(Integer.parseInt(confirmAll)==1) {
+					if(Integer.parseInt(dwtype)==1||Integer.parseInt(dwtype)==3) {
+						hqlwhere = " where u.id.deviceCode='"+device_code+"' and u.id.name='"+name+"' and u.id.data5='"+data5+"' 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='"+data5+"' and data4='"+data4+"' and data2='"+data2+"' and clzt=0";
+					}else if(Integer.parseInt(dwtype)==2||Integer.parseInt(dwtype)==5) {
+						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 if(Integer.parseInt(dwtype)==6) {
+						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 if(Integer.parseInt(dwtype)==7) {
+						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 if(Integer.parseInt(dwtype)==16) {
+						hqlwhere = " where u.id.deviceCode='"+device_code+"' and u.id.name='"+name+"' ";
+						sqlwhere = " where device_code='"+device_code+"' and name='"+name+"' ";
+					}
+				}else {
+					hqlwhere = " where u.id.id="+id+" ";
+					sqlwhere = " where id="+id+" ";
+				}
+				int RowCount = 0;
+				if(Integer.parseInt(dwtype)==1||Integer.parseInt(dwtype)==3) {
+					RowCount = ytiotVAlarmDao.getHJCount(hqlwhere);
+				}else if(Integer.parseInt(dwtype)==2||Integer.parseInt(dwtype)==5) {
+					RowCount = ytiotVAlarmDao.getSJCount(hqlwhere);
+				}else if(Integer.parseInt(dwtype)==6) {
+					RowCount = ytiotVAlarmDao.getRTUCount(hqlwhere);
+				}else if(Integer.parseInt(dwtype)==7) {
+					RowCount = ytiotVAlarmDao.getEFireCount(hqlwhere);
+				}else if(Integer.parseInt(dwtype)==16) {
+					RowCount = ytiotVAlarmDao.getVideoCount(hqlwhere);
+				}
+				
+				if(RowCount>0) {
+					if(Integer.parseInt(dwtype)==1||Integer.parseInt(dwtype)==3) {
+						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<>();
+							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 data5='"+data5+"' 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<>();
+									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);
+								}
+							}
+						}
+					}else if(Integer.parseInt(dwtype)==2||Integer.parseInt(dwtype)==5) {
+						ytiotVAlarmDao.execSQL(" update ytiot_v_sj2 set clwb='"+clwb+"', clnr='"+clnr+"', clzt=1 , clsj=now(), clr='"+V_LOGINNAME+"' "+sqlwhere);
+					}else if(Integer.parseInt(dwtype)==6) {
+						ytiotVAlarmDao.execSQL(" update ytiot_v_rtu2 set clwb='"+clwb+"', clnr='"+clnr+"', clzt=1 , clsj=now(), clr='"+V_LOGINNAME+"' "+sqlwhere);
+					}else if(Integer.parseInt(dwtype)==7) {
+						ytiotVAlarmDao.execSQL(" update ytiot_v_efire2 set clwb='"+clwb+"', clnr='"+clnr+"', clzt=1 , clsj=now(), clr='"+V_LOGINNAME+"' "+sqlwhere);
+					}else if(Integer.parseInt(dwtype)==16) {
+						ytiotVAlarmDao.execSQL(" update ytiot_v_video20172 set clwb='"+clwb+"', clnr='"+clnr+"', clzt=1 , clsj=now(), clr='"+V_LOGINNAME+"' "+sqlwhere);
+					}
+					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", "用户权限错误,请重新登录后再试。");
+		}
+		return json.toString();
+	}
+	
+	@Override
+	public String getHjOfflineList(String queryJson, String page, String start, String limit, String sort) throws Exception {
+		// TODO Auto-generated method stub
+		String company_code = null;
+		String company_code_list = null;
+		String Company_Code_List = null;
+		int dwtype = 0;
+		String status = "在线";
+		String V_LOGINNAME = null;
+		String hql = null;
+		String hjhql = null;
+		String sonhql = null;
+		String order = null;
+		String dir = null;
+		String Start = null;
+		String Limit = null;
+		String Page = null;
+		String order_str = null;
+		JSONObject q_json = null;
+		JSONArray Sort = null;
+		JSONArray jSONArray = new JSONArray();
+		JSONObject json = new JSONObject();
+		json.put("action", "getHjOfflineList");
+		if(queryJson!=null) {
+			q_json = JSONObject.fromObject(queryJson);
+			V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
+			dwtype = q_json.has("dwtype")?q_json.getInt("dwtype"):0;
+			if(q_json.has("company_code")) {
+				if((q_json.optJSONObject("company_code")!=null)
+						&&(q_json.optJSONObject("company_code").isArray())) {
+					JSONArray j_tmp = q_json.getJSONArray("company_code");
+					for(int i=0;i<j_tmp.size();i++) {
+						String tmp = j_tmp.getString(i);
+						if(i==0)
+							company_code_list = tmp;
+						else
+							company_code_list += ","+tmp;
+					}
+				}else {
+					company_code = q_json.getString("company_code");
+				}
+			}
+		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(dwtype==1) {
+			if(Company_Code_List!=null) {
+				hql = "SELECT COUNT(*) FROM ytiot_v_device_condition WHERE company_code" +" in ("+Company_Code_List+") "+ "AND dwtype !='火系统' AND `status`>24";
+				hjhql = "SELECT COUNT(*) FROM ytiot_v_userinfocondition WHERE company_code" +" in ("+Company_Code_List+") "+ "AND `status` ='离线'";
+				
+			}else {
+				if(company_code!=null) {
+					hql = "SELECT COUNT(*) FROM ytiot_v_device_condition WHERE company_code" +"  =  '"+company_code+ "' AND dwtype !='火系统' AND `status`>24";
+					hjhql = "SELECT COUNT(*) FROM ytiot_v_userinfocondition WHERE company_code" +"  =  '"+company_code+ "' AND `status` ='离线'";
+				}
+				if(company_code_list!=null) {
+					hql = "SELECT COUNT(*) FROM ytiot_v_device_condition WHERE company_code" +" in ("+company_code_list+") "+ "AND dwtype !='火系统' AND `status`>24";