|
@@ -2940,3 +2940,156 @@ public class YtiotVDataServiceImpl implements YtiotVDataService {
|
|
|
json.put("RESULT", jSONArray);
|
|
|
}
|
|
|
}
|
|
|
+ json.put("page", Page);
|
|
|
+ json.put("start", Start);
|
|
|
+ json.put("limit", Limit);
|
|
|
+ return json.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getSyncStatusVListByCompany(String queryJson) throws Exception {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ String company = null;
|
|
|
+ String company_code = null;
|
|
|
+ String company_code_list = null;
|
|
|
+ String Company_Code_List = null;
|
|
|
+ String dwtype = null;
|
|
|
+ String point_code = null;
|
|
|
+ String V_LOGINNAME = null;
|
|
|
+ String V_PASSWORD = null;
|
|
|
+ String QUERY_FROM = null;
|
|
|
+ String COMMSTATUS = null;
|
|
|
+ String hqlwhere = null;
|
|
|
+ String cqlwhere = null;
|
|
|
+ int E_STATUS=-1;
|
|
|
+ JSONObject q_json = null;
|
|
|
+ JSONArray jSONArray = new JSONArray();
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("action", "getSyncStatusVListByCompany");
|
|
|
+ if(queryJson!=null) {
|
|
|
+ q_json = JSONObject.fromObject(queryJson);
|
|
|
+ company = q_json.has("company")?q_json.getString("company"):null;
|
|
|
+ dwtype = q_json.has("dwtype")?q_json.getString("dwtype"):null;
|
|
|
+ point_code = q_json.has("point_code")?q_json.getString("point_code"):null;
|
|
|
+ QUERY_FROM = q_json.has("QUERY_FROM")?q_json.getString("QUERY_FROM"):null;
|
|
|
+ COMMSTATUS = q_json.has("COMMSTATUS")?q_json.getString("COMMSTATUS"):null;
|
|
|
+ if(q_json.has("company_code")) {
|
|
|
+ if((q_json.optJSONObject("company_code")!=null)&&(q_json.optJSONObject("company_code").isArray())) {
|
|
|
+ if(q_json.getJSONObject("company_code").isArray()) {
|
|
|
+ JSONArray j_tmp = q_json.getJSONArray("company_code");
|
|
|
+ for(int i=0;i<j_tmp.size();i++) {
|
|
|
+ if(i==0)
|
|
|
+ company_code_list = j_tmp.getString(i);
|
|
|
+ else
|
|
|
+ company_code_list += ","+j_tmp.getString(i);
|
|
|
+ }
|
|
|
+ }else
|
|
|
+ company_code = q_json.getString("company_code");
|
|
|
+ }else
|
|
|
+ company_code = q_json.getString("company_code");
|
|
|
+ }
|
|
|
+ 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 u.VLoginname='"+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(company!=null) {
|
|
|
+ cqlwhere = chkhw(cqlwhere)+" u.id."+fieldname("owner_name")+" like '%"+company+"%' ";
|
|
|
+ }
|
|
|
+ if(!V_LOGINNAME.equals("admin")) {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List vlist = ytiotVAlarmDao.queryBySQL("select count(*) as count, company_code from ytiot_v_video group by company_code");
|
|
|
+ if(company_code!=null)
|
|
|
+ cqlwhere = chkhw(cqlwhere) + " u.id."+fieldname("owner_id")+" like '%"+company_code+"%' ";
|
|
|
+ if(company_code_list!=null)
|
|
|
+ cqlwhere = chkhw(cqlwhere) + " u.id."+fieldname("owner_id")+" in ("+company_code_list+") ";
|
|
|
+ else if(Company_Code_List!=null)
|
|
|
+ cqlwhere = chkhw(cqlwhere) + " u.id."+fieldname("owner_id")+" in ("+Company_Code_List+") ";
|
|
|
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+// if((QUERY_FROM!=null)&&(COMMSTATUS!=null)&&(QUERY_FROM.equals("FRONTPAGE")&&(COMMSTATUS.equals("NO")))) {
|
|
|
+// @SuppressWarnings("rawtypes")
|
|
|
+// List c_list = ytiotVCompanyDao.query(cqlwhere, null, null, null, null);
|
|
|
+//
|
|
|
+// }else {
|
|
|
+ Company_Code_List = null;
|
|
|
+ @SuppressWarnings("rawtypes")
|
|
|
+ List c_list = ytiotVCompanyDao.query(cqlwhere, null, null, null, null);
|
|
|
+ float maxlng=0,minlng=0,maxlat=0,minlat=0;
|
|
|
+ int count=0;
|
|
|
+ if(c_list.size()>0) {
|
|
|
+ for(int i=0;i<c_list.size();i++) {
|
|
|
+ boolean fireAlarm=false,waterAlarm=false,rtuAlarm=false,efireAlarm=false,otherAlarm=false;
|
|
|
+ YtiotVCompany com = (YtiotVCompany)c_list.get(i);
|
|
|
+ YtiotVCompanyId ComId = com.getId();
|
|
|
+ if(i==0)
|
|
|
+ Company_Code_List = ComId.getOwnerId();
|
|
|
+ else
|
|
|
+ Company_Code_List += ","+ComId.getOwnerId();
|
|
|
+ Map<String, Comparable> cmap = new HashMap<String, Comparable>();
|
|
|
+ cmap.put("id", i+1);
|
|
|
+ cmap.put("company_name", ComId.getOwnerName());
|
|
|
+ cmap.put("fulladdress", ComId.getFulladdress());
|
|
|
+ cmap.put("xmlx", ComId.getXmlx());
|
|
|
+ cmap.put("username", ComId.getUsername());
|
|
|
+ cmap.put("phone", ComId.getPhone());
|
|
|
+ if(dwtype==null) {
|
|
|
+ String[] gis = ComId.getPosition().split(",");
|
|
|
+ if(gis.length==2) {
|
|
|
+ float lng = Float.parseFloat(gis[0]);
|
|
|
+ float lat = Float.parseFloat(gis[1]);
|
|
|
+ if((lng>100)&&(lng<150)&&(lat>20)&&(lat<70)) {
|
|
|
+ if(count==0) {
|
|
|
+ maxlng = lng;
|
|
|
+ minlng = lng;
|
|
|
+ maxlat = lat;
|
|
|
+ minlat = lat;
|
|
|
+ }else {
|
|
|
+ if(maxlng<lng)
|
|
|
+ maxlng=lng;
|
|
|
+ if(minlng>lng)
|
|
|
+ minlng=lng;
|
|
|
+ if(maxlat<lat)
|
|
|
+ maxlat=lat;
|
|
|
+ if(minlat>lat)
|
|
|
+ minlat=lat;
|
|
|
+ }
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ cmap.put("lng", lng);
|
|
|
+ cmap.put("lat", lat);
|
|
|
+ }else {
|
|
|
+ cmap.put("lng", 0.0);
|
|
|
+ cmap.put("lat", 0.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cmap.put("company_code", ComId.getOwnerId());
|
|
|
+ cmap.put("building_name", ComId.getBuildingName());
|
|
|
+ cmap.put("rtmp", ComId.getRtmp());
|
|
|
+ if(dwtype!=null) {
|
|
|
+ JSONArray a_point = new JSONArray();
|
|
|
+ hqlwhere = " where u.id."+fieldname("company_code")+" ='"+ComId.getOwnerId()+"' ";
|
|
|
+ if(dwtype.equals("2")||dwtype.equals("5"))
|
|
|
+ hqlwhere += " and ( u.id.dwtype='2' or u.id.dwtype='5' ) ";
|
|
|
+ else
|
|
|
+ hqlwhere += " and u.id.dwtype='"+dwtype+"' ";
|
|
|
+ if(point_code!=null)
|
|
|
+ hqlwhere += " and u.id.pointCode="+point_code+" ";
|