Explorar el Código

3dDisplayEngine YtiotVAlarmServiceImpl.java 吉超博 commit at 2021-04-26

吉超博 hace 4 años
padre
commit
a741e301d3
Se han modificado 1 ficheros con 111 adiciones y 0 borrados
  1. 111 0
      3dDisplayEngine/buildingService/YtiotVAlarmServiceImpl.java

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

@@ -4684,3 +4684,114 @@ public class YtiotVAlarmServiceImpl implements YtiotVAlarmService {
 //		json.put("action", "getLiftVList");
 		if(queryJson!=null) {
 			q_json = JSONObject.fromObject(queryJson);
+			V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
+			deviceName = q_json.has("deviceCode")?q_json.getString("deviceCode"):null;
+			if(deviceName!=null)
+				hqlwhere = chkhw(hqlwhere) + " u.deviceName"+" = '"+deviceName+"'";
+		int totalCount = ytiotVAlarmDao.getWjAnalogCount(hqlwhere);
+//		json.put("totalCount", totalCount);
+		if(Start!=null){
+			if(Integer.parseInt(Start)>totalCount){
+				Start = "0";
+				Page = "0";
+			}else if(page==null)
+				Page="0";
+		}else{
+			Start = "0";
+			Page = "0";
+		}
+		order_str = " order by u.dataTime";
+		dir = " desc";
+//		json.put("page", Page);
+//		json.put("start", Start);
+//		json.put("limit", Limit);
+		if(totalCount>0) {
+			json.put("code", 200);
+			List<?> list = ytiotVAlarmDao.wjAnalogQuery(hqlwhere, order_str, dir, "0", "1");
+			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			if(list.size()>0) {
+				for(int i=0;i<list.size();i++) {
+					WjPowerMonitoringAnalog o = (WjPowerMonitoringAnalog)list.get(i);
+					Map map = new HashMap();
+					map.put("Uab", o.getUab());
+					map.put("Ubc", o.getUbc());
+					map.put("Uca", o.getUca());
+					map.put("Ia", o.getIa());
+					map.put("Ib", o.getIb());
+					map.put("Ic", o.getIc());
+					map.put("P", o.getP());
+					map.put("Q", o.getQ());
+					map.put("COS", o.getCos());
+					map.put("F", o.getF());
+					map.put("dataTime", df.format(o.getDataTime()));
+					map.put("totalCount", totalCount);
+					JSONObject jSONObject = JSONObject.fromObject(map);
+					jSONArray.add(jSONObject);
+				}
+				json.put("data", jSONArray);
+			}
+		}
+		return json.toString();
+		}else {
+			json.put("code", 60001);
+			json.put("data", "缺少参数");
+			return json.toString();
+		}
+	}
+	
+	@Override
+	public String updateWjAlarm(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 pictureUrl = 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("handleMisinformation")?q_json.getString("handleMisinformation"):null;
+			clnr = q_json.has("handleContent")?q_json.getString("handleContent"):null;
+			pictureUrl = q_json.has("pictureUrl")?q_json.getString("pictureUrl"):null;
+			id = q_json.has("alarmId")?q_json.getString("alarmId"):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((clwb!=null)&&(clnr!=null)&&(id!=null)) {
+			String sqlwhere=null;
+			String hqlwhere=null;
+			hqlwhere = " where u.id="+id+" ";
+			sqlwhere = " where id="+id+" ";
+			int RowCount = ytiotVAlarmDao.getWjAlarmCount(hqlwhere);
+				System.out.println("clwb"+clwb);
+			if(RowCount>0) {
+				ytiotVAlarmDao.execSQL(" update wj_power_monitoring_alarm set handleContent='"+clnr+"',pictureUrl='"+pictureUrl+"',handleMisinformation='"+clwb+"', handleState=1 , handleTime=now(), handlePerson='"+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", "参数传递错误,请联系系统管理员。");
+		}
+		return json.toString();
+	}
+	
+}