Sfoglia il codice sorgente

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

李海忠 4 anni fa
parent
commit
0289f6a473
1 ha cambiato i file con 143 aggiunte e 0 eliminazioni
  1. 143 0
      3dDisplayEngine/buildingService/YtiotVCompanyServiceImpl.java

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

@@ -514,3 +514,146 @@ public class YtiotVCompanyServiceImpl implements YtiotVCompanyService {
 			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());
+			}
+			String where = " where u.id.agentid='"+V_LOGINNAME+"' ";
+			List list1 = ytiotVUserCompanyDao.query(where, null, null, null, null);
+			if(list1.size()>0) {
+				for(int i=0;i<list1.size();i++) {
+					YtiotVUsercompany o = (YtiotVUsercompany)list1.get(i);
+					YtiotVUsercompanyId oid = o.getId();
+					if(i==0)
+						owner_id_List = oid.getOwnerCode();
+					else
+						owner_id_List += ","+oid.getOwnerCode();
+				}
+			}
+		}
+
+		if(addr1!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("addr1")+" like '%"+addr1+"%' ";
+		if(addr1list!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("addr1")+" in ("+addr1list+") ";
+		if(owner_id_List!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("owner_id")+" in ("+owner_id_List+") ";
+		if(addr2!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("addr2")+" like '%"+addr2+"%' ";
+		if(addr2list!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("addr2")+" in ("+addr2list+") ";
+		if(addr3!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("addr3")+" like '%"+addr3+"%' ";
+		if(addr3list!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("addr3")+" in ("+addr3list+") ";
+		if(address!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("address")+" like '%"+address+"%' ";
+		if(building_id!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("building_id")+" like '%"+building_id+"%' ";
+		if(building_id_list!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("building_id")+" in ("+building_id_list+") ";
+		if(building_name!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("building_name")+" like '%"+building_name+"%' ";
+		if(create_man!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("create_man")+" like '%"+create_man+"%' ";
+		if(data1!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("data1")+" like '%"+data1+"%' ";
+		if(data2!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("data2")+" like '%"+data2+"%' ";
+		if(data3!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("data3")+" like '%"+data3+"%' ";
+		if(fulladdress!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("fulladdress")+" like '%"+fulladdress+"%' ";
+		if(id!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("id")+" = '"+id+"' ";
+		if(owner_id!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("owner_id")+" = "+owner_id+" ";
+		if(owner_id_list!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("owner_id")+" in ("+owner_id_list+") ";
+		if(owner_address!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("owner_address")+" like '%"+owner_address+"%' ";
+		if(owner_office!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("owner_office")+" like '%"+owner_office+"%' ";
+		if(xmlx!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("xmlx")+" like '%"+xmlx+"%' ";
+		if(xmlx_list!=null)
+			hqlwhere = chkhw(hqlwhere)+"u.id."+fieldname("xmlx")+" in ("+xmlx_list+") ";
+		int totalCount = ytiotVCompanyDao.getCount(hqlwhere);
+		json.put("totalCount", totalCount);
+		if(totalCount>0) {
+			List list = ytiotVCompanyDao.query(hqlwhere, null, null, null, null);
+			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			if(list.size()>0) {
+				for(int i=0;i<list.size();i++) {
+					YtiotVCompany o = (YtiotVCompany)list.get(i);
+					YtiotVCompanyId Id = o.getId();
+					Map map = new HashMap();
+					map.put("owner_id", Id.getOwnerId());
+					map.put("owner_name", Id.getOwnerName());
+					map.put("xmlx", Id.getXmlx());
+					JSONObject jSONObject = JSONObject.fromObject(map);
+					jSONArray.add(jSONObject);
+				}
+				json.put("RESULT", jSONArray);
+			}
+		}
+		return json.toString();
+	}
+	
+	
+	@Override
+	public String getVBuildingNameList(String queryJson) throws Exception {
+		String V_LOGINNAME = null;
+		String company_code_list = null;
+		
+		String hqlwhere = null;
+
+		JSONObject q_json = null;		
+		JSONArray jSONArray = new JSONArray();
+		JSONObject json = new JSONObject();
+//		json.put("action", "getPatrolPointList");
+		if(queryJson!=null) {
+			q_json = JSONObject.fromObject(queryJson);
+			V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
+			json.put("query", queryJson);
+		}	
+		
+			if(V_LOGINNAME!=null) {
+				String where1 = " where u.id.agentid='"+V_LOGINNAME+"' ";
+				List list1 = ytiotVUserCompanyDao.query(where1, null, null, null, null);
+				if(list1.size()>0) {
+					for(int i=0;i<list1.size();i++) {
+						YtiotVUsercompany o = (YtiotVUsercompany)list1.get(i);
+						YtiotVUsercompanyId oid = o.getId();
+						if(i==0)
+							company_code_list = "'"+oid.getOwnerCode()+"'";
+						else
+							company_code_list += ",'"+oid.getOwnerCode()+"'";
+					}
+				}
+			}
+			
+
+			if(company_code_list!=null)
+				hqlwhere = " where u.id.ownerId in ("+company_code_list+")";
+				List list = ytiotVCompanyDao.query(hqlwhere, null, null, null, null);
+				if(list.size()>0) {
+					for(int i=0;i<list.size();i++) {
+						YtiotVCompany o = (YtiotVCompany)list.get(i);
+						YtiotVCompanyId Id = o.getId();
+						Map map = new HashMap();
+						map.put("building_id", Id.getBuildingId());
+						map.put("building_name", Id.getBuildingName());
+						JSONObject jSONObject = JSONObject.fromObject(map);
+						jSONArray.add(jSONObject);
+					}
+					json.put("RESULT", jSONArray);
+				}
+		return json.toString();
+	}
+
+	public static int getDates(Date date1,Date date2) {
+		Calendar cal=Calendar.getInstance();
+		cal.setTime(date1);
+		long time1 = cal.getTimeInMillis();
+		cal.setTime(date2);
+		long time2 = cal.getTimeInMillis();