Преглед изворни кода

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

吉超博 пре 4 година
родитељ
комит
863536f718
1 измењених фајлова са 171 додато и 0 уклоњено
  1. 171 0
      3dDisplayEngine/buildingService/YtiotVAlarmServiceImpl.java

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

@@ -3410,3 +3410,174 @@ public class YtiotVAlarmServiceImpl implements YtiotVAlarmService {
 	}
 
 	@Override
+	public String getVideoList(String queryJson) throws Exception {
+		// TODO Auto-generated method stub
+		String company_code = null;
+		String sql = null;
+		JSONObject q_json = null;
+		JSONArray jSONArray = new JSONArray();
+		JSONObject json = new JSONObject();
+		List list = null;
+		json.put("action", "getVideoList");
+		if(queryJson!=null) {
+			q_json = JSONObject.fromObject(queryJson);
+			company_code = q_json.has("company_code")?q_json.getString("company_code"):null;
+		}
+		if(company_code!=null) {
+			sql = "select device_code, dev_name, company, rtsp_path, comm_type from ytiot_v_video where company_code='"+company_code+"'";
+			list = ytiotVAlarmDao.queryBySQL(sql);
+			if(list.size()>0) {
+				for(int i=0;i<list.size();i++) {
+					Object [] row = (Object [])list.get(i);
+					Map map = new HashMap();
+					if(i==0)
+						json.put("company", row[2].toString());
+					map.put("device_code", row[0].toString());
+					map.put("dev_name", row[1].toString());
+					map.put("rtsp_path", row[3].toString());
+					map.put("comm_type", row[4].toString());
+					JSONObject jSONObject = JSONObject.fromObject(map);
+					jSONArray.add(jSONObject);
+				}
+			}else
+				json.put("company", "");
+			json.put("RESULT", jSONArray);
+		}
+		return json.toString();
+	}
+
+	/**
+	 * 视频状态修改
+	 * @param queryJson
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public String updateVideo(String queryJson) throws Exception {
+		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;
+		JSONObject q_json = null;
+		JSONObject json = new JSONObject();
+		json.put("action", "updateSj");
+		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;
+			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.status='"+status+"' ";
+					sqlwhere = " where device_code='"+device_code+"' and name='"+name+"' and status='"+status+"' ";
+				}else {
+					hqlwhere = " where u.id.id="+id+" ";
+					sqlwhere = " where id="+id+" ";
+				}
+				int RowCount = ytiotVAlarmDao.getVideoCount(hqlwhere);
+//				System.out.println(sqlwhere);
+				if(RowCount>0) {
+					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();
+	}
+
+
+	/**
+	 * 视频设备状态处理
+	 * @param queryJson
+	 * @return
+	 * @throws Exception
+	 */
+	@Override
+	public String updateVideoOffline(String queryJson) throws Exception {
+		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;
+		JSONObject q_json = null;
+		JSONObject json = new JSONObject();
+		json.put("action", "updateSj");
+		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;
+			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.status='"+status+"' ";
+					sqlwhere = " where device_code='"+device_code+"' and name='"+name+"' and status='"+status+"' ";
+				}else {
+					hqlwhere = " where u.id.id="+id+" ";
+					sqlwhere = " where id="+id+" ";
+				}
+				int RowCount = ytiotVAlarmDao.getVideoCount(hqlwhere);
+				if(RowCount>0) {
+					ytiotVAlarmDao.execSQL(" update ytiot_v_video2017s2 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", "参数传递错误,请联系系统管理员。");
+				}