|
@@ -836,3 +836,182 @@ public class YtiotVAlarmServiceImpl implements YtiotVAlarmService {
|
|
else
|
|
else
|
|
device_code_list += ","+tmp;
|
|
device_code_list += ","+tmp;
|
|
}
|
|
}
|
|
|
|
+ }else
|
|
|
|
+ device_code = q_json.getString("device_code");
|
|
|
|
+ }
|
|
|
|
+ time_start = q_json.has("time_start")?q_json.getString("time_start"):null;
|
|
|
|
+ time_end = q_json.has("time_end")?q_json.getString("time_end"):null;
|
|
|
|
+ }
|
|
|
|
+ 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(address!=null) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " address like '%"+address+"%' ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.address like '%"+address+"%' ";
|
|
|
|
+ }
|
|
|
|
+ if((clzt!=null)&&(clzt.length()>0)) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " clzt = "+clzt+" ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.clzt = "+clzt+" ";
|
|
|
|
+ }
|
|
|
|
+ if(Company_Code_List!=null) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " company_code in ("+Company_Code_List+") ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.companyCode in ("+Company_Code_List+") ";
|
|
|
|
+ }else {
|
|
|
|
+ if(company_code!=null) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " company_code = "+company_code+" ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.companyCode = "+company_code+" ";
|
|
|
|
+ }
|
|
|
|
+ if(company_code_list!=null) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " company_code in ("+company_code_list+") ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.companyCode in ("+company_code_list+") ";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(device_code!=null) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " device_code = "+device_code+" ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.deviceCode = "+device_code+" ";
|
|
|
|
+ }
|
|
|
|
+ if(device_code_list!=null) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " device_code in ("+device_code_list+") ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.deviceCode in ("+device_code_list+") ";
|
|
|
|
+ }
|
|
|
|
+ if((time_start!=null)&&(time_start.length()>0)) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " time >= '"+time_start+"' ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.time >= '"+time_start+"' ";
|
|
|
|
+ }
|
|
|
|
+ if((time_end!=null)&&(time_start.length()>0)) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere) + " time <= '"+time_end+"' ";
|
|
|
|
+ hhwhere = chkhw(hhwhere) + " u.id.time <= '"+time_end+"' ";
|
|
|
|
+ }
|
|
|
|
+ if(COMMSTATUS!=null) {
|
|
|
|
+ if(COMMSTATUS.equals("NO")) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere)+" data1 <> 'EF9' ";
|
|
|
|
+ hhwhere = chkhw(hhwhere)+" u.id.data1 <> 'EF9' ";
|
|
|
|
+ }
|
|
|
|
+ else if(COMMSTATUS.equals("ONLY")) {
|
|
|
|
+ hqlwhere = chkhw(hqlwhere)+" data1 = 'EF9' ";
|
|
|
|
+ hhwhere = chkhw(hhwhere)+" u.id.data1 = 'EF9' ";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ System.out.print("shazi"+hhwhere);
|
|
|
|
+ if(order!=null)
|
|
|
|
+ order_str = " order by "+order;
|
|
|
|
+ else
|
|
|
|
+ order_str = " order by id ";
|
|
|
|
+
|
|
|
|
+ int totalCount = ytiotVAlarmDao.getEFireCount(hhwhere);
|
|
|
|
+// System.out.println(totalCount);
|
|
|
|
+
|
|
|
|
+ json.put("totalCount", totalCount);
|
|
|
|
+ if(totalCount>0) {
|
|
|
|
+ List<?> ulist = ytiotVUserphoneDao.query(null, null, null, null, null);
|
|
|
|
+ List<?> list1 = ytiotVAlarmDao.EFireQuery(hhwhere, order_str, dir, Start, Limit);
|
|
|
|
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ if(list1.size()>0) {
|
|
|
|
+ for(int i=0;i<list1.size();i++) {
|
|
|
|
+ YtiotVEfire o = (YtiotVEfire)list1.get(i);
|
|
|
|
+ YtiotVEfireId oid = o.getId();
|
|
|
|
+ String cl_name = "";
|
|
|
|
+ Map<String, Comparable> map = new HashMap<String, Comparable>();
|
|
|
|
+ if((company_code!=null)&&(i==0))
|
|
|
|
+ json.put("company_name", oid.getCompanyName());
|
|
|
|
+ map.put("address", oid.getAddress());
|
|
|
|
+ map.put("cldh", oid.getCldh());
|
|
|
|
+ map.put("cllx", oid.getCllx());
|
|
|
|
+ map.put("cllxr", oid.getCllxr());
|
|
|
|
+ map.put("clnr", oid.getClnr());
|
|
|
|
+ map.put("clr", oid.getClr());
|
|
|
|
+ if(oid.getClwb().equals("0"))
|
|
|
|
+ map.put("clwb", "未误报");
|
|
|
|
+ else if(oid.getClwb().equals("1"))
|
|
|
|
+ map.put("clwb", "误报");
|
|
|
|
+ else
|
|
|
|
+ map.put("clwb", "");
|
|
|
|
+ map.put("clzt", oid.getClzt()==0?"未处理":"已处理");
|
|
|
|
+ map.put("company_code", oid.getCompanyCode());
|
|
|
|
+ map.put("company_name", oid.getCompanyName());
|
|
|
|
+ map.put("data2", oid.getData2());
|
|
|
|
+ map.put("data3", oid.getData3());
|
|
|
|
+ map.put("data4", oid.getData4());
|
|
|
|
+ map.put("data5", oid.getData5());
|
|
|
|
+ if(oid.getData1().equals("EF0"))
|
|
|
|
+ map.put("data1", "正常/报警撤销");
|
|
|
|
+ else if(oid.getData1().equals("EF1"))
|
|
|
|
+ map.put("data1", "欠压报警");
|
|
|
|
+ else if(oid.getData1().equals("EF2"))
|
|
|
|
+ map.put("data1","过压报警");
|
|
|
|
+ else if(oid.getData1().equals("EF3"))
|
|
|
|
+ map.put("data1","过流报警");
|
|
|
|
+ else if(oid.getData1().equals("EF4"))
|
|
|
|
+ map.put("data1","漏电报警");
|
|
|
|
+ else if(oid.getData1().equals("EF5"))
|
|
|
|
+ map.put("data1","温度1超高报警");
|
|
|
|
+ else if(oid.getData1().equals("EF6"))
|
|
|
|
+ map.put("data1","温度2超高报警");
|
|
|
|
+ else if(oid.getData1().equals("EF7"))
|
|
|
|
+ map.put("data1","温度3超高报警");
|
|
|
|
+ else if(oid.getData1().equals("EF8"))
|
|
|
|
+ map.put("data1","温度4超高报警");
|
|
|
|
+ else if(oid.getData1().equals("EF9"))
|
|
|
|
+ map.put("data1","离线");
|
|
|
|
+// String dw = "";
|
|
|
|
+// if(oid.getData1().equals("EF0"))
|
|
|
|
+// dw = "";
|
|
|
|
+// else if(oid.getData1().equals("EF1"))
|
|
|
|
+// dw = "V";
|
|
|
|
+// else if(oid.getData1().equals("EF2"))
|
|
|
|
+// dw = "V";
|
|
|
|
+// else if(oid.getData1().equals("EF3"))
|
|
|
|
+// dw = "mA";
|
|
|
|
+// else if(oid.getData1().equals("EF4"))
|
|
|
|
+// dw = "mA";
|
|
|
|
+// else if(oid.getData1().equals("EF5"))
|
|
|
|
+// dw = "℃";
|
|
|
|
+// else if(oid.getData1().equals("EF6"))
|
|
|
|
+// dw = "℃";
|
|
|
|
+// else if(oid.getData1().equals("EF7"))
|
|
|
|
+// dw = "℃";
|
|
|
|
+// else if(oid.getData1().equals("EF8"))
|
|
|
|
+// dw = "℃";
|
|
|
|
+// else if(oid.getData1().equals("EF9"))
|
|
|
|
+// dw = "";
|
|
|
|
+ map.put("data", oid.getData1());
|
|
|
|
+ if(oid.getClzt()==1)
|
|
|
|
+ map.put("clsj", df.format(oid.getClsj()));
|
|
|
|
+ else
|
|
|
|
+ map.put("clsj", "");
|
|
|
|
+ map.put("device_code", oid.getDeviceCode());
|
|
|
|
+ map.put("id", oid.getId());
|
|
|
|
+ map.put("name", oid.getName());
|
|
|
|
+ map.put("ncmd", oid.getNcmd());
|
|
|
|
+ map.put("port", oid.getPort());
|
|
|
|
+ map.put("position", oid.getPosition());
|
|
|
|
+ map.put("time", df.format(oid.getTime()));
|
|
|
|
+ map.put("vidoe", oid.getVideo());
|
|
|
|
+ if((oid.getClr().length()>0)
|
|
|
|
+ &&(ulist.size()>0)){
|
|
|
|
+ for(int j=0;j<ulist.size();j++) {
|
|
|
|
+ YtiotVUserphone po = (YtiotVUserphone)ulist.get(j);
|
|
|
|
+ YtiotVUserphoneId poid = po.getId();
|
|
|
|
+ if(oid.getCldh().equals(poid.getPhone())) {
|
|
|
|
+ cl_name = poid.getUsername();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ map.put("clr_name", cl_name.length()>0?cl_name:oid.getClr());
|
|
|
|
+ JSONObject jSONObject = JSONObject.fromObject(map);
|
|
|
|
+ jSONArray.add(jSONObject);
|
|
|
|
+ }
|
|
|
|
+ json.put("result", jSONArray);
|