| | |
| | | import com.hxzkoa.json.tb_history_power; |
| | | import com.hxzkoa.json.tb_historyinwarning; |
| | | import com.hxzkoa.json.tb_icon; |
| | | import com.hxzkoa.json.tb_jingwei; |
| | | import com.hxzkoa.json.tb_map; |
| | | import com.hxzkoa.json.tb_message; |
| | | import com.hxzkoa.json.tb_nav; |
| | | import com.hxzkoa.json.tb_person; |
| | | import com.hxzkoa.json.tb_qihou; |
| | | import com.hxzkoa.json.tb_realinwarning; |
| | |
| | | return tb_mapList; |
| | | } |
| | | |
| | | public List<tb_person> getpersonid(String tagid) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT p_x,p_y,p_tagid,p_addtiem FROM tb_person WHERE p_tagid="+tagid; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_person> tb_mapList = new ArrayList<tb_person>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_person map = new tb_person(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | map.setP_x((String) obj[0]); |
| | | map.setP_y((String) obj[1]); |
| | | map.setP_tagid((String) obj[2]); |
| | | map.setP_addtiem((String) obj[3]); |
| | | tb_mapList.add(map); |
| | | } |
| | | } |
| | | return tb_mapList; |
| | | } |
| | | |
| | | public List<tb_gps> getgpsid(String tagid) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT gps_weidu,gsp_jingdu,tagid,gps_haiba_gao FROM tb_gps WHERE tagid="+tagid; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_gps> tb_mapList = new ArrayList<tb_gps>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_gps map = new tb_gps(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | map.setGps_weidu((String) obj[0]); |
| | | map.setGsp_jingdu((String) obj[1]); |
| | | map.setTagid((String) obj[2]); |
| | | map.setGps_haiba_gao((String) obj[3]); |
| | | tb_mapList.add(map); |
| | | } |
| | | } |
| | | return tb_mapList; |
| | | } |
| | | |
| | | public List<tb_map> getMap_all() { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | return tb_mapList; |
| | | } |
| | | |
| | | public List<tb_map> getMap_all2(String floor) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel FROM tb_map WHERE mapname = :floor"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("floor", floor); |
| | | List resultList = query.getResultList(); |
| | | List<tb_map> tb_mapList = new ArrayList<tb_map>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_map map = new tb_map(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | map.setFloor((String) obj[0]); |
| | | map.setMapname((String) obj[1]); |
| | | map.setX_Truelength((String) obj[2]); |
| | | map.setY_Truewidth((String) obj[3]); |
| | | map.setX0_length((String) obj[4]); |
| | | map.setY0_width((String) obj[5]); |
| | | map.setX_Pixel((String) obj[6]); |
| | | map.setY_Pixel((String) obj[7]); |
| | | tb_mapList.add(map); |
| | | } |
| | | } |
| | | return tb_mapList; |
| | | } |
| | | |
| | | public List<tb_map> getFloor() { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | return tb_mapList; |
| | | } |
| | | |
| | | public List<tb_map> getFloor2(String floor) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT floor,mapname FROM tb_map WHERE mapname = :floor"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("floor", floor); |
| | | List resultList = query.getResultList(); |
| | | List<tb_map> tb_mapList = new ArrayList<tb_map>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_map map = new tb_map(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | map.setFloor((String) obj[0]); |
| | | map.setMapname((String) obj[1]); |
| | | tb_mapList.add(map); |
| | | } |
| | | } |
| | | return tb_mapList; |
| | | } |
| | | |
| | | public List<tb_map> getFloorByMapname(String mapname) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | fence.setType((String) obj[1]); |
| | | fence.setBumen((String) obj[2]); |
| | | fence.setName((String) obj[3]); |
| | | fence.setZuobiao((String) obj[4]); |
| | | fence.setZuobiao(obj[4].toString().replaceAll(";", ",")); |
| | | fence.setShape((String) obj[5]); |
| | | fence.setStart(obj[6] == null ? "" : obj[6].toString()); |
| | | fence.setStop(obj[7] == null ? "" : obj[7].toString()); |
| | |
| | | public List<tb_fence> getFence_all() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence"; |
| | | sql = "SELECT floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence where type != '变电站'"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_fence> tb_fenceList = new ArrayList<tb_fence>(); |
| | |
| | | fence.setType((String) obj[1]); |
| | | fence.setBumen((String) obj[2]); |
| | | fence.setName((String) obj[3]); |
| | | fence.setZuobiao((String) obj[4]); |
| | | fence.setZuobiao(obj[4].toString().replaceAll(";", ",")); |
| | | fence.setShape((String) obj[5]); |
| | | fence.setStart(obj[6] == null ? "" : obj[6].toString()); |
| | | fence.setStop(obj[7] == null ? "" : obj[7].toString()); |
| | | fence.setAddtime((String) obj[8]); |
| | | fence.setColor((String) obj[9]); |
| | | tb_fenceList.add(fence); |
| | | } |
| | | } |
| | | return tb_fenceList; |
| | | } |
| | | |
| | | public List<tb_fence> getFenceaaa(String name) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence WHERE name=:name"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("name", name); |
| | | List resultList = query.getResultList(); |
| | | List<tb_fence> tb_fenceList = new ArrayList<tb_fence>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_fence fence = new tb_fence(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | fence.setFloor((String) obj[0]); |
| | | fence.setType((String) obj[1]); |
| | | fence.setBumen((String) obj[2]); |
| | | fence.setName((String) obj[3]); |
| | | fence.setZuobiao(obj[4].toString().replaceAll(";", ",")); |
| | | fence.setShape((String) obj[5]); |
| | | fence.setStart(obj[6] == null ? "" : obj[6].toString()); |
| | | fence.setStop(obj[7] == null ? "" : obj[7].toString()); |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public int drawFence_add2(tb_fence fence) { |
| | | if (fence.getBaoliu7() == "") { |
| | | fence.setBaoliu7("0"); |
| | | } |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "INSERT INTO tb_fence(floor,type,name,zuobiao,shape,start,stop,addtime,color,baoliu1,baoliu3,baoliu4,bumen,baoliu6,baoliu7) VALUES(:floor,:type,:name,:zuobiao,:shape,:start,:stop,now(),:color,:baoliu1,:baoliu3,:baoliu4,:bumen,:baoliu6,:baoliu7)"; |
| | | cs.tb_caozuo("tb_fence", 1); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("floor", fence.getFloor()); |
| | | query.setParameter("type", fence.getType()); |
| | | query.setParameter("name", fence.getName()); |
| | | query.setParameter("zuobiao", fence.getZuobiao()); |
| | | query.setParameter("shape", fence.getShape()); |
| | | query.setParameter("start", fence.getStart()); |
| | | query.setParameter("stop", fence.getStop()); |
| | | query.setParameter("color", fence.getColor()); |
| | | query.setParameter("baoliu1", fence.getBaoliu1()); |
| | | // query.setParameter("baoliu2", fence.getBaoliu2()); |
| | | query.setParameter("baoliu3", fence.getBaoliu3()); |
| | | query.setParameter("baoliu4", fence.getBaoliu4()); |
| | | query.setParameter("bumen", fence.getBumen()); |
| | | query.setParameter("baoliu6", fence.getBaoliu6()); |
| | | query.setParameter("baoliu7", fence.getBaoliu7()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | @Transactional |
| | | public int sanweiFence_add(tb_fence fence) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | // //System.out.print(tag_id); |
| | | // //System.out.print(floor); |
| | | |
| | | sql = "SELECT tagid,x,y,z,layer,time FROM tb_track_"+now2+" WHERE layer= '"+floor+"' AND tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"' ORDER BY time"; |
| | | sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_"+now2+" WHERE layer= '"+floor+"' AND tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"' ORDER BY time"; |
| | | // sql = "SELECT tagid,x,y,z,layer,time FROM tb_track WHERE layer= '"+floor+"' AND tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"'"; |
| | | |
| | | //System.out.print(sql); |
| | |
| | | map.setZ((String) obj[3]); |
| | | map.setLayer((String) obj[4]); |
| | | map.setTime((String) obj[5]); |
| | | map.setFangkeid((String) obj[6]); |
| | | map.setJingdu((String) obj[7]); |
| | | map.setWeidu((String) obj[8]); |
| | | map.setGaocheng((String) obj[9]); |
| | | tb_trackList.add(map); |
| | | } |
| | | } |
| | | return tb_trackList; |
| | | } |
| | | |
| | | public List<tb_track> getTagtrack2(String name,String begin_time,String end_time,String floor) throws ParseException { |
| | | String sql = null; |
| | | Query query = null; |
| | | SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date now=dateFormat.parse(begin_time); |
| | | //System.out.print(now); |
| | | SimpleDateFormat dateFormat2=new SimpleDateFormat("yyyyMMdd"); |
| | | String now2 = dateFormat2.format(now); |
| | | //System.out.print(now2); |
| | | // //System.out.print(begin_time); |
| | | // //System.out.print(end_time); |
| | | // //System.out.print(tag_id); |
| | | // //System.out.print(floor); |
| | | |
| | | sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_"+now2+" WHERE layer= '"+floor+"' AND baoliu8= '"+name+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"' ORDER BY time"; |
| | | // sql = "SELECT tagid,x,y,z,layer,time FROM tb_track WHERE layer= '"+floor+"' AND tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"'"; |
| | | |
| | | //System.out.print(sql); |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_track> tb_trackList = new ArrayList<tb_track>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_track map = new tb_track(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | map.setTagid((String) obj[0]); |
| | | map.setX((String) obj[1]); |
| | | map.setY((String) obj[2]); |
| | | map.setZ((String) obj[3]); |
| | | map.setLayer((String) obj[4]); |
| | | map.setTime((String) obj[5]); |
| | | map.setFangkeid((String) obj[6]); |
| | | map.setJingdu((String) obj[7]); |
| | | map.setWeidu((String) obj[8]); |
| | | map.setGaocheng((String) obj[9]); |
| | | tb_trackList.add(map); |
| | | } |
| | | } |
| | | return tb_trackList; |
| | | } |
| | | |
| | | public List<tb_track> getTagtrack3(String tag_id,String begin_time,String end_time) throws ParseException { |
| | | String sql = null; |
| | | Query query = null; |
| | | SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date now=dateFormat.parse(begin_time); |
| | | SimpleDateFormat dateFormat2=new SimpleDateFormat("yyyyMMdd"); |
| | | String now2 = dateFormat2.format(now); |
| | | |
| | | sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_"+now2+" WHERE tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"' ORDER BY time"; |
| | | |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_track> tb_trackList = new ArrayList<tb_track>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_track map = new tb_track(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | map.setTagid((String) obj[0]); |
| | | map.setX((String) obj[1]); |
| | | map.setY((String) obj[2]); |
| | | map.setZ((String) obj[3]); |
| | | map.setLayer((String) obj[4]); |
| | | map.setTime((String) obj[5]); |
| | | map.setFangkeid((String) obj[6]); |
| | | map.setJingdu((String) obj[7]); |
| | | map.setWeidu((String) obj[8]); |
| | | map.setGaocheng((String) obj[9]); |
| | | tb_trackList.add(map); |
| | | } |
| | | } |
| | |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | realocation.setP_name((String) obj[1]); |
| | | realocation.setP_tagid((String) obj[2]); |
| | | realocation.setP_phone((String) obj[5]); |
| | | realocation.setP_department((String) obj[6]); |
| | | realocation.setP_idcardnum((String) obj[9]); |
| | | realocation.setP_x((String) obj[12]); |
| | | realocation.setP_y((String) obj[13]); |
| | | realocation.setP_floor((String) obj[14]); |
| | |
| | | realocation.setP_addtiem((String) obj[23]); |
| | | realocation.setP_sousuo((String) obj[25]); |
| | | realocation.setP_shipin((String) obj[26]); |
| | | realocation.setP_jingdu((String) obj[29]); |
| | | realocation.setP_weidu((String) obj[30]); |
| | | realocation.setP_gaocheng((String) obj[31]); |
| | | realocation.setBaoliu10((String) obj[37]); |
| | | realocation.setBaoliu22((String) obj[49]); |
| | | tb_realocationList.add(realocation); |
| | | } |
| | | } |
| | |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | realocation.setP_name((String) obj[1]); |
| | | realocation.setP_tagid((String) obj[2]); |
| | | realocation.setP_sex((String) obj[3]); |
| | | realocation.setP_minzu((String) obj[4]); |
| | | realocation.setP_phone((String) obj[5]); |
| | | realocation.setP_department((String) obj[6]); |
| | | realocation.setP_x((String) obj[12]); |
| | | realocation.setP_y((String) obj[13]); |
| | | realocation.setP_floor((String) obj[14]); |
| | |
| | | realocation.setP_addtiem((String) obj[23]); |
| | | realocation.setP_sousuo((String) obj[25]); |
| | | realocation.setP_shipin((String) obj[26]); |
| | | realocation.setP_fangkeid((String) obj[28]); |
| | | realocation.setP_jingdu((String) obj[29]); |
| | | realocation.setP_weidu((String) obj[30]); |
| | | realocation.setP_gaocheng((String) obj[31]); |
| | | realocation.setBaoliu22((String) obj[49]); |
| | | realocation.setBaoliu23((String) obj[50]); |
| | | realocation.setBaoliu24((String) obj[51]); |
| | | tb_realocationList.add(realocation); |
| | | } |
| | | } |
| | | return tb_realocationList; |
| | | } |
| | | |
| | | public List<tb_person> getpersonLocationsan3(String floor) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT * FROM tb_person where p_floor="+floor; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_person> tb_realocationList = new ArrayList<tb_person>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_person realocation = new tb_person(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | realocation.setP_name((String) obj[1]); |
| | | realocation.setP_tagid((String) obj[2]); |
| | | realocation.setP_sex((String) obj[3]); |
| | | realocation.setP_minzu((String) obj[4]); |
| | | realocation.setP_phone((String) obj[5]); |
| | | realocation.setP_department((String) obj[6]); |
| | | realocation.setP_x((String) obj[12]); |
| | | realocation.setP_y((String) obj[13]); |
| | | realocation.setP_floor((String) obj[14]); |
| | | realocation.setP_sos((String) obj[15]); |
| | | realocation.setP_online((String) obj[16]); |
| | | realocation.setP_power((String) obj[17]); |
| | | realocation.setP_kaoqing((String) obj[18]); |
| | | realocation.setP_fence((String) obj[19]); |
| | | realocation.setP_fencename((String) obj[20]); |
| | | realocation.setP_kaoqqingname((String) obj[21]); |
| | | realocation.setP_image((String) obj[22]); |
| | | realocation.setP_addtiem((String) obj[23]); |
| | | realocation.setP_sousuo((String) obj[25]); |
| | | realocation.setP_shipin((String) obj[26]); |
| | | realocation.setP_fangkeid((String) obj[28]); |
| | | realocation.setP_jingdu((String) obj[29]); |
| | | realocation.setP_weidu((String) obj[30]); |
| | | realocation.setP_gaocheng((String) obj[31]); |
| | | realocation.setBaoliu22((String) obj[49]); |
| | | realocation.setBaoliu23((String) obj[50]); |
| | | realocation.setBaoliu24((String) obj[51]); |
| | | tb_realocationList.add(realocation); |
| | | } |
| | | } |
| | | return tb_realocationList; |
| | | } |
| | | |
| | | public List<tb_person> getpersonLocationsan2() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT a.p_name,a.p_tagid,a.p_idcardnum,a.p_x,a.p_y,a.p_floor,a.p_sos,a.p_online,a.p_power,a.p_kaoqing,a.p_fence,a.p_fencename,a.p_kaoqqingname,a.p_image,a.p_addtiem,a.p_sousuo,a.p_shipin,a.baoliu1,a.baoliu2,a.baoliu3,a.baoliu4,a.p_phone,b.type FROM tb_person AS a,tb_tag AS b WHERE a.p_tagid=b.tag_id"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_person> tb_realocationList = new ArrayList<tb_person>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_person realocation = new tb_person(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | realocation.setP_name((String) obj[0]); |
| | | realocation.setP_tagid((String) obj[1]); |
| | | realocation.setP_idcardnum((String) obj[2]); |
| | | realocation.setP_x((String) obj[3]); |
| | | realocation.setP_y((String) obj[4]); |
| | | realocation.setP_floor((String) obj[5]); |
| | | realocation.setP_sos((String) obj[6]); |
| | | realocation.setP_online((String) obj[7]); |
| | | realocation.setP_power((String) obj[8]); |
| | | realocation.setP_kaoqing((String) obj[9]); |
| | | realocation.setP_fence((String) obj[10]); |
| | | realocation.setP_fencename((String) obj[11]); |
| | | realocation.setP_kaoqqingname((String) obj[12]); |
| | | realocation.setP_image((String) obj[13]); |
| | | realocation.setP_addtiem((String) obj[14]); |
| | | realocation.setP_sousuo((String) obj[15]); |
| | | realocation.setP_shipin((String) obj[16]); |
| | | realocation.setP_fangkeid((String) obj[17]); |
| | | realocation.setP_jingdu((String) obj[18]); |
| | | realocation.setP_weidu((String) obj[19]); |
| | | realocation.setP_gaocheng((String) obj[20]); |
| | | realocation.setP_phone((String)obj[21]); |
| | | realocation.setP_type((String) obj[22]); |
| | | tb_realocationList.add(realocation); |
| | | } |
| | | } |
| | |
| | | realocation.setP_kaoqqingname((String) obj[21]); |
| | | realocation.setP_image((String) obj[22]); |
| | | realocation.setP_addtiem((String) obj[23]); |
| | | realocation.setP_shipin((String) obj[26]); |
| | | realocation.setP_shipingname((String) obj[27]); |
| | | realocation.setBaoliu6((String) obj[33]); |
| | | realocation.setBaoliu20((String) obj[47]); |
| | | realocation.setBaoliu21((String) obj[48]); |
| | | tb_realocationList.add(realocation); |
| | | } |
| | | } |
| | |
| | | public List<tb_gps> getGPS() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT a.*,c.p_name,c.p_online,p_sex,p_minzu,p_phone,p_department FROM tb_gps AS a,( SELECT tagid, max(addtime) time FROM tb_gps GROUP BY tagid ) AS b, tb_person as c WHERE a.addtime = b.time AND a.tagid = b.tagid AND c.p_tagid=a.tagid"; |
| | | sql = "SELECT a.id,a.gps_utc_time,a.gps_weidu,a.gps_NS,a.gsp_jingdu,a.gps_EW,a.gps_state,a.gps_num,a.gps_hdop,a.gps_haiba_gao,a.gps_tuoqiu,a.gps_chafen_time,a.gps_chafen_id,a.gps_jiaoyan,a.tagid,a.gps_kahao,a.gps_power,a.gps_sos,a.addtime,c.p_name,c.p_online,c.p_sex,c.p_minzu,c.p_phone,c.p_department,c.baoliu13,c.baoliu14,c.baoliu15,c.p_addtiem FROM tb_gps AS a,( SELECT tagid, max(addtime) time FROM tb_gps GROUP BY tagid ) AS b, tb_person as c WHERE a.addtime = b.time AND a.tagid = b.tagid AND c.p_tagid=a.tagid"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_gps> tb_gpsList = new ArrayList<tb_gps>(); |
| | |
| | | gps.setGps_NS((String) obj[3]); |
| | | gps.setGsp_jingdu((String) obj[4]); |
| | | gps.setGps_EW((String) obj[5]); |
| | | gps.setGps_state((String) obj[35]); |
| | | gps.setGps_state((String) obj[20]); |
| | | gps.setGps_num((String) obj[7]); |
| | | gps.setGps_hdop((String) obj[8]); |
| | | gps.setGps_haiba_gao((String) obj[9]); |
| | |
| | | gps.setGps_power((String) obj[16]); |
| | | gps.setGps_sos((String) obj[17]); |
| | | gps.setAddtime((String) obj[18]); |
| | | gps.setName((String) obj[34]); |
| | | gps.setSex((String) obj[36]); |
| | | gps.setMinzu((String) obj[37]); |
| | | gps.setDianhua((String) obj[38]); |
| | | gps.setBumen((String) obj[39]); |
| | | gps.setName((String) obj[19]); |
| | | gps.setSex((String) obj[21]); |
| | | gps.setMinzu((String) obj[22]); |
| | | gps.setDianhua((String) obj[23]); |
| | | gps.setBumen((String) obj[24]); |
| | | gps.setBaoliu13((String) obj[25]); |
| | | gps.setBaoliu14((String) obj[26]); |
| | | gps.setBaoliu15((String) obj[27]); |
| | | gps.setP_addtiem((String) obj[28]); |
| | | tb_gpsList.add(gps); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public int jinmengao(String tagid) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_person SET baoliu20=0 WHERE p_tagid=:tagid"; |
| | | cs.tb_caozuo("tb_person", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("tagid", tagid); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | @Transactional |
| | | public int chumengao(String tagid) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_person SET baoliu21=0 WHERE p_tagid=:tagid"; |
| | | cs.tb_caozuo("tb_person", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("tagid", tagid); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | @Transactional |
| | | public int shipin(String tagid) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | return status; |
| | | } |
| | | |
| | | public String getfencezuobiao() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT zuobiao from tb_linshi_fence_22414 WHERE id=1"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | String status = resultList.get(0).toString(); |
| | | return status; |
| | | } |
| | | |
| | | public String getfencehaibagao() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT baoliu4 from tb_linshi_fence_22414 WHERE id=1"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | String status = resultList.get(0).toString(); |
| | | return status; |
| | | } |
| | | |
| | | public List<tb_person> getfencename(String tagid) { |
| | | String sql = null; |
| | | Query query = null; |
| | |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_shipin shipin = new tb_shipin(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | shipin.setShebeiid((String) obj[0]); |
| | | shipin.setTongdaoid((String) obj[1]); |
| | | shipin.setYonghuming((String) obj[0]); |
| | | shipin.setMima((String) obj[1]); |
| | | tb_shipinList.add(shipin); |
| | | } |
| | | } |
| | |
| | | } |
| | | return soslist; |
| | | } |
| | | |
| | | public List<tb_person> getjinchumengaojing() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "select p_tagid from tb_person where baoliu20 = '1' and baoliu21 = '1'"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_person> soslist = new ArrayList<tb_person>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_person person = new tb_person(); |
| | | person.setP_tagid(resultList.get(i) == null ? "" : resultList.get(i).toString()); |
| | | soslist.add(person); |
| | | } |
| | | } |
| | | return soslist; |
| | | } |
| | | |
| | | public List<tb_jingwei> getjingwei() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,qishi,zhongzhi,jieguo,addtime FROM tb_jingwei ORDER BY addtime DESC"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_jingwei> tb_jingweiList = new ArrayList<tb_jingwei>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_jingwei jingwei = new tb_jingwei(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | jingwei.setId((int) obj[0]); |
| | | jingwei.setQishi((String) obj[1]); |
| | | jingwei.setZhongzhi((String) obj[2]); |
| | | jingwei.setJieguo((String) obj[3]); |
| | | jingwei.setAddtime((String) obj[4]); |
| | | tb_jingweiList.add(jingwei); |
| | | } |
| | | } |
| | | return tb_jingweiList; |
| | | } |
| | | |
| | | @Transactional |
| | | public int addjingwei(tb_jingwei jingwei) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "insert into tb_jingwei(qishi,zhongzhi,jieguo,addtime) values(:qishi,:zhongzhi,:jieguo,:addtime)"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("qishi", jingwei.getQishi()); |
| | | query.setParameter("zhongzhi", jingwei.getZhongzhi()); |
| | | query.setParameter("jieguo", jingwei.getJieguo()); |
| | | query.setParameter("addtime", jingwei.getAddtime()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | public List<tb_nav> getnav() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,label,achor,gps,fence,warning,history,attendance,basiclnfo,video,gas FROM tb_nav"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_nav> navlist = new ArrayList<tb_nav>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | tb_nav nav = new tb_nav(); |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | nav.setId((int) obj[0]); |
| | | nav.setLabel((String) obj[1]); |
| | | nav.setAchor((String) obj[2]); |
| | | nav.setGps((String) obj[3]); |
| | | nav.setFence((String) obj[4]); |
| | | nav.setWarning((String) obj[5]); |
| | | nav.setHistory((String) obj[6]); |
| | | nav.setAttendance((String) obj[7]); |
| | | nav.setBasiclnfo((String) obj[8]); |
| | | nav.setVideo((String) obj[9]); |
| | | nav.setGas((String) obj[10]); |
| | | navlist.add(nav); |
| | | } |
| | | } |
| | | return navlist; |
| | | } |
| | | |
| | | @Transactional |
| | | public int updatenav(tb_nav nav) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "update tb_nav set label = :label,achor = :achor,gps = :gps,fence = :fence,warning = :warning,history = :history,attendance = :attendance,basiclnfo = :basiclnfo,video = :video,gas = :gas where id = 1"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("label", nav.getLabel()); |
| | | query.setParameter("achor", nav.getAchor()); |
| | | query.setParameter("gps", nav.getGps()); |
| | | query.setParameter("fence", nav.getFence()); |
| | | query.setParameter("warning", nav.getWarning()); |
| | | query.setParameter("history", nav.getHistory()); |
| | | query.setParameter("attendance", nav.getAttendance()); |
| | | query.setParameter("basiclnfo", nav.getBasiclnfo()); |
| | | query.setParameter("video", nav.getVideo()); |
| | | query.setParameter("gas", nav.getGas()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | public List<tb_person> getbumen(){ |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "select p_name,p_department,p_tagid from tb_person"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultlist = query.getResultList(); |
| | | List<tb_person> persons = new ArrayList<>(); |
| | | if(resultlist.size() > 0) { |
| | | for(int i=0; i<resultlist.size(); i++) { |
| | | Object[] obj = (Object[]) resultlist.get(i); |
| | | tb_person person = new tb_person(); |
| | | person.setP_name(obj[0] == null?null:obj[0].toString()); |
| | | person.setP_department(obj[1] == null?null:obj[1].toString()); |
| | | person.setP_tagid(obj[2] == null?null:obj[2].toString()); |
| | | persons.add(person); |
| | | } |
| | | } |
| | | return persons; |
| | | } |
| | | |
| | | public List<tb_message> getmessage(){ |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT * FROM tb_message_history WHERE Replytime IS NOT NULL order by Replytime desc"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultlist = query.getResultList(); |
| | | List<tb_message> messages = new ArrayList<>(); |
| | | if (resultlist.size() > 0) { |
| | | for (int i=0; i<resultlist.size(); i++) { |
| | | Object[] obj = (Object[]) resultlist.get(i); |
| | | tb_message mess = new tb_message(); |
| | | mess.setId((int)obj[0]); |
| | | mess.setMessage(obj[7]==null?null:obj[7].toString()); |
| | | mess.setAddtime(obj[6]==null?null:obj[6].toString()); |
| | | mess.setBaoliu2(obj[8]==null?null:obj[8].toString()); |
| | | messages.add(mess); |
| | | } |
| | | } |
| | | return messages; |
| | | } |
| | | |
| | | @Transactional |
| | | public void deletemessage(String date) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "delete from tb_message_history where Replytime < :date"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("date", date); |
| | | query.executeUpdate(); |
| | | } |
| | | |
| | | public String getlixian(){ |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT baoliu5 FROM tb_linshi_fence_22414 WHERE id = 1"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultlist = query.getResultList(); |
| | | return resultlist.get(0).toString(); |
| | | } |
| | | } |