Browse Source

3dDisplayEngine YtiotVCompanyServiceImpl.java 李海忠 commit at 2021-04-12

李海忠 4 years ago
parent
commit
e2f48b899c
1 changed files with 100 additions and 0 deletions
  1. 100 0
      3dDisplayEngine/buildingService/YtiotVCompanyServiceImpl.java

+ 100 - 0
3dDisplayEngine/buildingService/YtiotVCompanyServiceImpl.java

@@ -980,3 +980,103 @@ public class YtiotVCompanyServiceImpl implements YtiotVCompanyService {
 //					map.put("xmlx", g.getXmlx());
 					JSONObject jSONObject = JSONObject.fromObject(map);
 					jSONArray.add(jSONObject);
+					json.put("RESULT", jSONArray);
+				}
+				
+			}
+			if(list1.size()>0) {
+				int device_num=0;
+				for(int i=0;i<list1.size();i++) {
+					YtiotTProjectDevice o = (YtiotTProjectDevice)list1.get(i);
+					device_num+=o.getDeviceNum();
+//					YtiotVCompanyId Id = o.getId();
+					Map map1 = new HashMap();
+					map1.put("device_name", o.getDeviceName()==null?"":o.getDeviceName());
+					map1.put("specifications", o.getSpecifications()==null?"":o.getSpecifications());
+					map1.put("device_num", o.getDeviceNum()==0?"":o.getDeviceNum());
+					map1.put("data_info", o.getDataInfo()==null?"":o.getDataInfo());
+					JSONObject jSONObject1 = JSONObject.fromObject(map1);
+					jSONArray1.add(jSONObject1);
+					json.put("RESULT1", jSONArray1);
+					if(o.getDataInfo()!=null && o.getDataInfo().equals("efire")) {
+						device_type="efire";
+					}else if(o.getDataInfo()!=null && o.getDataInfo().equals("video")) {
+						video_type="video";
+					}
+				}
+				json.put("device_type", device_type);
+				json.put("device_num1", device_num);
+			}
+//			if(device_type.equals("efire")) {
+//				List list6 = ytiotVAlarmDao.EFireQuery(hswhere, null, null, null, null);
+//				
+//			}
+			if(list2.size()>0) {
+				int device_num2=0;
+				for(int i=0;i<list2.size();i++) {
+					YtiotTProjectMonitor h = (YtiotTProjectMonitor)list2.get(i);
+					device_num2+=h.getMonitorSum();
+//					YtiotVCompanyId Id = o.getId();
+					Map map2 = new HashMap();
+					map2.put("monitor_son", h.getMonitorSon()==null?"":h.getMonitorSon());
+					map2.put("monitor_type", h.getMonitorType()==null?"":h.getMonitorType());
+					map2.put("monitor_sum", h.getMonitorSum()==0?"":h.getMonitorSum());
+					map2.put("data_info", h.getDataInfo()==null?"":h.getDataInfo());
+					JSONObject jSONObject2 = JSONObject.fromObject(map2);
+					jSONArray2.add(jSONObject2);
+					json.put("RESULT2", jSONArray2);
+				}
+				json.put("device_num2", device_num2);
+			}
+			if(list3.size()>0) {
+				for(int i=0;i<list3.size();i++) {
+					YtiotVHj z = (YtiotVHj)list3.get(0);
+					YtiotVHjId id = z.getId();
+					Date d1=id.getTime();
+					Date d2=id.getClsj();
+					long diff = d2.getTime() - d1.getTime();
+					long days1 = diff / (1000 * 60 * 60 * 24);
+					days2 += days1;
+					m+=1;
+					
+				}
+				String days3= numberFormat.format((float)days2/(float)m);
+				json.put("days3", days3);
+			}else {
+				json.put("days3", "0");
+			}
+			if(list4.size()>0) {
+				for(int i=0;i<list4.size();i++) {
+					YtiotVSj s = (YtiotVSj)list4.get(0);
+					YtiotVSjId id1 = s.getId();
+					Date d1=id1.getTime();
+					Date d2=id1.getClsj();
+					long diff = d2.getTime() - d1.getTime();
+					long days4 = diff / (1000 * 60 * 60 * 24);
+					days5 += days4;
+					q+=1;					
+				}				
+				String days6= numberFormat.format((float)days5/(float)q);
+				json.put("days6", days6);
+			}else {
+				json.put("days6", "0");
+			}
+			if(list5.size()>0) {
+				for(int i=0;i<list5.size();i++) {
+					YtiotVRtu s = (YtiotVRtu)list5.get(0);
+					YtiotVRtuId id1 = s.getId();
+					Date d1=id1.getTime();
+					Date d2=id1.getClsj();
+					long diff = d2.getTime() - d1.getTime();
+					long days7 = diff / (1000 * 60 * 60 * 24);
+					days8 += days7;
+					x+=1;					
+				}				
+				String days9= numberFormat.format((float)days8/(float)x);
+				json.put("days9", days9);
+			}else {
+				json.put("days9", "0");
+			}
+
+		return json.toString();
+	}