15832144755
2022-03-17 bc131131c5c96f8cb3bed679d4a359820c22e335
src/main/java/com/hxzkoa/services/GpsService.java
@@ -232,6 +232,22 @@
      }
   }
   
   @Transactional
   public int gpsManagement_deletea(String[] checkVal) {
      String sql = null;
      Query query = null;
      int aaa = checkVal.length;
      for (int i = 0; i < checkVal.length; i++) {
         int tagid = Integer.parseInt(checkVal[i]);
         sql = "DELETE FROM tb_gps WHERE tagid = :tagid";
         cs.tb_caozuo("tb_gps", 2);
         query = this.em.createNativeQuery(sql);
         query.setParameter("tagid", tagid);
         query.executeUpdate();
      }
      return aaa;
   }
   public List<tb_gps> getTrack(String date,int page,int perPage) {
      // 日期格式 例20210101 
      String sql = null;
@@ -271,6 +287,43 @@
      return tb_trackList;
   }
   
   public List<tb_gps> getTracka(String date) {
      // 日期格式 例20210101
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_gps_track_"+ date +"";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_gps> tb_trackList = new ArrayList<tb_gps>();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
            tb_gps gps = new tb_gps();
            Object[] obj = (Object[]) resultList.get(i);
            gps.setId((int) obj[0]);
            gps.setGps_utc_time(obj[1] == null ? "" : obj[1].toString());
            gps.setGps_weidu(obj[2] == null ? "" : obj[2].toString());
            gps.setGps_NS(obj[3] == null ? "" : obj[3].toString());
            gps.setGsp_jingdu(obj[4] == null ? "" : obj[4].toString());
            gps.setGps_EW(obj[5] == null ? "" : obj[5].toString());
            gps.setGps_state(obj[6] == null ? "" : obj[6].toString());
            gps.setGps_num(obj[7] == null ? "" : obj[7].toString());
            gps.setGps_hdop(obj[8] == null ? "" : obj[8].toString());
            gps.setGps_haiba_gao(obj[9] == null ? "" : obj[9].toString());
            gps.setGps_tuoqiu(obj[10] == null ? "" : obj[10].toString());
            gps.setGps_chafen_time(obj[11] == null ? "" : obj[11].toString());
            gps.setGps_chafen_id(obj[12] == null ? "" : obj[12].toString());
            gps.setGps_jiaoyan(obj[13] == null ? "" : obj[13].toString());
            gps.setTagid(obj[14] == null ? "" : obj[14].toString());
            gps.setGps_kahao(obj[15] == null ? "" : obj[15].toString());
            gps.setGps_power(obj[16] == null ? "" : obj[16].toString());
            gps.setGps_sos(obj[17] == null ? "" : obj[17].toString());
            gps.setAddtime(obj[18] == null ? "" : obj[18].toString());
            tb_trackList.add(gps);
         }
      }
      return tb_trackList;
   }
   public int getgpsRealTimeLocationCount(String date) {
      String sql = null;
      Query query = null;
@@ -302,6 +355,21 @@
   }
   
   @Transactional
   public int realTimegpsLocation_deletea(String[] checkVal,String date) {
      String sql = null;
      Query query = null;
      int aaa = checkVal.length;
      for (int i = 0; i < checkVal.length; i++) {
         int id = Integer.parseInt(checkVal[i]);
         sql = "DELETE FROM tb_gps_track_" +date+ " WHERE id = :id";
         query = this.em.createNativeQuery(sql);
         query.setParameter("id", id);
         query.executeUpdate();
      }
      return aaa;
   }
   @Transactional
   public void realTimegpsLocation_deleteAll(String date) {
      String sql = null;
      Query query = null;
@@ -310,6 +378,16 @@
      query.executeUpdate();
   }
   
   @Transactional
   public int realTimegpsLocation_deleteAlla(String date) {
      String sql = null;
      Query query = null;
      sql = "DELETE FROM tb_gps_track_" +date+ "";
      query = this.em.createNativeQuery(sql);
      int aaa = query.executeUpdate();
      return aaa;
   }
   public List<tb_gps> searchRealTimegpsLocation(String input,String date) {
      String sql = null;
      Query query = null;