| 对比新文件 |
| | |
| | | package com.hxzkoa.services; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.hxzkoa.json.tb_achor; |
| | | import com.hxzkoa.json.tb_bsbaowen; |
| | | import com.hxzkoa.json.tb_collector; |
| | | import com.hxzkoa.json.tb_department; |
| | | import com.hxzkoa.json.tb_forward_data; |
| | | import com.hxzkoa.json.tb_suanfa; |
| | | import com.hxzkoa.json.tb_system; |
| | | import com.hxzkoa.json.tb_tag; |
| | | import com.hxzkoa.json.tb_user; |
| | | import com.hxzkoa.json.tb_yuan_shi_bao_wen; |
| | | import com.hxzkoa.util.Config; |
| | | import com.hxzkoa.util.ModifyConfig; |
| | | |
| | | @Service |
| | | public class SysSettingService { |
| | | @PersistenceContext |
| | | private EntityManager em; |
| | | @Autowired |
| | | private CaozuoService cs; |
| | | |
| | | public List<tb_bsbaowen> bsbaowen() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,Receive_time,type,tagid,neirong FROM (SELECT id,Receive_time,type,tagid,neirong FROM tb_bsbaowen ORDER BY id DESC) s LIMIT 13"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_bsbaowen> tb_bsbaowenList = new ArrayList<tb_bsbaowen>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_bsbaowen bsbaowen = new tb_bsbaowen(); |
| | | bsbaowen.setId((Integer)obj[0]); |
| | | bsbaowen.setReceive_time(obj[1] == null ? "" : obj[1].toString()); |
| | | bsbaowen.setType(obj[2] == null ? "" : obj[2].toString()); |
| | | bsbaowen.setTagid(obj[3] == null ? "" : obj[3].toString()); |
| | | bsbaowen.setNeirong(obj[4] == null ? "" : obj[4].toString()); |
| | | tb_bsbaowenList.add(bsbaowen); |
| | | } |
| | | } |
| | | return tb_bsbaowenList; |
| | | } |
| | | |
| | | public List<tb_forward_data> getmessageTransfer(int page) { |
| | | int perPage = Integer.parseInt(ModifyConfig.readData(Config.getPageConfig(), "perPage")); |
| | | int start = (page - 1) * perPage; |
| | | int end = perPage; |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,type,ip,port,datatype,addtime FROM tb_forward_data LIMIT :start,:end"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("start", start); |
| | | query.setParameter("end", end); |
| | | List resultList = query.getResultList(); |
| | | List<tb_forward_data> tb_forward_dataList = new ArrayList<tb_forward_data>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_forward_data forward_data = new tb_forward_data(); |
| | | forward_data.setId((Integer)obj[0]); |
| | | forward_data.setType(obj[1] == null ? "" : obj[1].toString()); |
| | | forward_data.setIp(obj[2] == null ? "" : obj[2].toString()); |
| | | forward_data.setPort(obj[3] == null ? "" : obj[3].toString()); |
| | | forward_data.setDatatype(obj[4] == null ? "" : obj[4].toString()); |
| | | forward_data.setAddtime(obj[5] == null ? "" : obj[5].toString()); |
| | | tb_forward_dataList.add(forward_data); |
| | | } |
| | | } |
| | | return tb_forward_dataList; |
| | | } |
| | | |
| | | public List<tb_forward_data> getALLMessageTransfer(String dataType) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,type,ip,port,datatype,addtime FROM tb_forward_data WHERE datatype=:dataType OR datatype='鍏ㄩ儴鏁版嵁'"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("dataType", dataType); |
| | | List resultList = query.getResultList(); |
| | | List<tb_forward_data> tb_forward_dataList = new ArrayList<tb_forward_data>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_forward_data forward_data = new tb_forward_data(); |
| | | forward_data.setId((Integer)obj[0]); |
| | | forward_data.setType(obj[1] == null ? "" : obj[1].toString()); |
| | | forward_data.setIp(obj[2] == null ? "" : obj[2].toString()); |
| | | forward_data.setPort(obj[3] == null ? "" : obj[3].toString()); |
| | | forward_data.setDatatype(obj[4] == null ? "" : obj[4].toString()); |
| | | forward_data.setAddtime(obj[5] == null ? "" : obj[5].toString()); |
| | | tb_forward_dataList.add(forward_data); |
| | | } |
| | | } |
| | | return tb_forward_dataList; |
| | | } |
| | | |
| | | public List<tb_forward_data> searchmessageTransfer(String input) { |
| | | int id = Integer.parseInt(input); |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,type,ip,port,datatype,addtime FROM tb_forward_data WHERE id = :id"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", id); |
| | | List resultList = query.getResultList(); |
| | | List<tb_forward_data> tb_forward_dataList = new ArrayList<tb_forward_data>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_forward_data forward_data = new tb_forward_data(); |
| | | forward_data.setId((Integer)obj[0]); |
| | | forward_data.setType(obj[1] == null ? "" : obj[1].toString()); |
| | | forward_data.setIp(obj[2] == null ? "" : obj[2].toString()); |
| | | forward_data.setPort(obj[3] == null ? "" : obj[3].toString()); |
| | | forward_data.setDatatype(obj[4] == null ? "" : obj[4].toString()); |
| | | forward_data.setAddtime(obj[5] == null ? "" : obj[5].toString()); |
| | | tb_forward_dataList.add(forward_data); |
| | | } |
| | | } |
| | | return tb_forward_dataList; |
| | | } |
| | | |
| | | public int getmessageTransferCount() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT count(1) FROM tb_forward_data"; |
| | | query = this.em.createNativeQuery(sql); |
| | | return Integer.parseInt(query.getSingleResult().toString()); |
| | | } |
| | | |
| | | @Transactional |
| | | public void messageTransfer_delete(String[] checkVal) { |
| | | String sql = null; |
| | | Query query = null; |
| | | for (int i = 0; i < checkVal.length; i++) { |
| | | int id = Integer.parseInt(checkVal[i]); |
| | | sql = "DELETE FROM tb_forward_data WHERE id = :id"; |
| | | cs.tb_caozuo("tb_forward_data", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", id); |
| | | query.executeUpdate(); |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | public void messageTransfer_deleteAll() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "DELETE FROM tb_forward_data"; |
| | | cs.tb_caozuo("tb_forward_data", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.executeUpdate(); |
| | | } |
| | | |
| | | @Transactional |
| | | public int messageTransfer_add(tb_forward_data data) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "INSERT INTO tb_forward_data(type,ip,port,datatype,addtime) VALUES(:type,:ip,:port,:datatype,now())"; |
| | | cs.tb_caozuo("tb_forward_data", 1); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("type", data.getType()); |
| | | query.setParameter("ip", data.getIp()); |
| | | query.setParameter("port", data.getPort()); |
| | | query.setParameter("datatype", data.getDatatype()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public int messageTransfer_modify(tb_forward_data data) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_forward_data SET type = :type,port = :port,datatype = :datatype,ip = :ip,addtime = now() WHERE id= :id"; |
| | | cs.tb_caozuo("tb_forward_data", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", data.getId()); |
| | | query.setParameter("type", data.getType()); |
| | | query.setParameter("ip", data.getIp()); |
| | | query.setParameter("port", data.getPort()); |
| | | query.setParameter("datatype", data.getDatatype()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | public List<tb_user> getuserManagement() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,username,superuser,deleteq,alertq,deleteall,justlook,addtime,fenceq FROM tb_user"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_user> tb_userList = new ArrayList<tb_user>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_user user = new tb_user(); |
| | | user.setId((Integer)obj[0]); |
| | | user.setUsername(obj[1] == null ? "" : obj[1].toString()); |
| | | user.setSuperuser(obj[2] == null ? "" : obj[2].toString()); |
| | | user.setDeleteq(obj[3] == null ? "" : obj[3].toString()); |
| | | user.setAlertq(obj[4] == null ? "" : obj[4].toString()); |
| | | user.setDeleteall(obj[5] == null ? "" : obj[5].toString()); |
| | | user.setJustlook(obj[6] == null ? "" : obj[6].toString()); |
| | | user.setAddtime(obj[7] == null ? "" : obj[7].toString()); |
| | | user.setFenceq(obj[8] == null ? "" : obj[8].toString()); |
| | | tb_userList.add(user); |
| | | } |
| | | } |
| | | return tb_userList; |
| | | } |
| | | |
| | | public List<tb_user> getuserManagement(int page) { |
| | | int perPage = Integer.parseInt(ModifyConfig.readData(Config.getPageConfig(), "perPage")); |
| | | int start = (page - 1) * perPage; |
| | | int end = perPage; |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,username,superuser,deleteq,alertq,deleteall,justlook,addtime,fenceq FROM tb_user LIMIT :start,:end"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("start", start); |
| | | query.setParameter("end", end); |
| | | List resultList = query.getResultList(); |
| | | List<tb_user> tb_userList = new ArrayList<tb_user>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_user user = new tb_user(); |
| | | user.setId((Integer)obj[0]); |
| | | user.setUsername(obj[1] == null ? "" : obj[1].toString()); |
| | | user.setSuperuser(obj[2] == null ? "" : obj[2].toString()); |
| | | user.setDeleteq(obj[3] == null ? "" : obj[3].toString()); |
| | | user.setAlertq(obj[4] == null ? "" : obj[4].toString()); |
| | | user.setDeleteall(obj[5] == null ? "" : obj[5].toString()); |
| | | user.setJustlook(obj[6] == null ? "" : obj[6].toString()); |
| | | user.setAddtime(obj[7] == null ? "" : obj[7].toString()); |
| | | user.setFenceq(obj[8] == null ? "" : obj[8].toString()); |
| | | tb_userList.add(user); |
| | | } |
| | | } |
| | | return tb_userList; |
| | | } |
| | | |
| | | public List<tb_user> getuserManagement2() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,username,superuser,deleteq,alertq,deleteall,justlook,addtime FROM tb_user"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_user> tb_userList = new ArrayList<tb_user>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_user user = new tb_user(); |
| | | user.setId((Integer)obj[0]); |
| | | user.setUsername(obj[1] == null ? "" : obj[1].toString()); |
| | | user.setSuperuser(obj[2] == null ? "" : obj[2].toString()); |
| | | user.setDeleteq(obj[3] == null ? "" : obj[3].toString()); |
| | | user.setAlertq(obj[4] == null ? "" : obj[4].toString()); |
| | | user.setDeleteall(obj[5] == null ? "" : obj[5].toString()); |
| | | user.setJustlook(obj[6] == null ? "" : obj[6].toString()); |
| | | user.setAddtime(obj[7] == null ? "" : obj[7].toString()); |
| | | tb_userList.add(user); |
| | | } |
| | | } |
| | | return tb_userList; |
| | | } |
| | | |
| | | public List<tb_user> searchuserManagement(String input) { |
| | | String username = input; |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,username,superuser,deleteq,alertq,deleteall,justlook,addtime,fenceq FROM tb_user WHERE username = :username"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("username", username); |
| | | List resultList = query.getResultList(); |
| | | List<tb_user> tb_userList = new ArrayList<tb_user>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_user user = new tb_user(); |
| | | user.setId((Integer)obj[0]); |
| | | user.setUsername(obj[1] == null ? "" : obj[1].toString()); |
| | | user.setSuperuser(obj[2] == null ? "" : obj[2].toString()); |
| | | user.setDeleteq(obj[3] == null ? "" : obj[3].toString()); |
| | | user.setAlertq(obj[4] == null ? "" : obj[4].toString()); |
| | | user.setDeleteall(obj[5] == null ? "" : obj[5].toString()); |
| | | user.setJustlook(obj[6] == null ? "" : obj[6].toString()); |
| | | user.setAddtime(obj[7] == null ? "" : obj[7].toString()); |
| | | user.setFenceq(obj[8] == null ? "" : obj[8].toString()); |
| | | tb_userList.add(user); |
| | | } |
| | | } |
| | | return tb_userList; |
| | | } |
| | | |
| | | public int getuserManagementCount() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT count(1) FROM tb_user"; |
| | | query = this.em.createNativeQuery(sql); |
| | | return Integer.parseInt(query.getSingleResult().toString()); |
| | | } |
| | | |
| | | @Transactional |
| | | public void userManagement_delete(String[] checkVal) { |
| | | String sql = null; |
| | | Query query = null; |
| | | for (int i = 0; i < checkVal.length; i++) { |
| | | int id = Integer.parseInt(checkVal[i]); |
| | | sql = "DELETE FROM tb_user WHERE id = :id"; |
| | | cs.tb_caozuo("tb_user", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", id); |
| | | query.executeUpdate(); |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | public int userManagement_deletea(String[] checkVal) { |
| | | String sql = null; |
| | | Query query = null; |
| | | int aaa = 0; |
| | | for (int i = 0; i < checkVal.length; i++) { |
| | | int id = Integer.parseInt(checkVal[i]); |
| | | sql = "DELETE FROM tb_user WHERE id = :id"; |
| | | cs.tb_caozuo("tb_user", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", id); |
| | | aaa = query.executeUpdate(); |
| | | } |
| | | return aaa; |
| | | } |
| | | |
| | | @Transactional |
| | | public void userManagement_deleteAll() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "DELETE FROM tb_user"; |
| | | cs.tb_caozuo("tb_user", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.executeUpdate(); |
| | | } |
| | | |
| | | @Transactional |
| | | public int userManagement_deleteAlla() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "DELETE FROM tb_user"; |
| | | cs.tb_caozuo("tb_user", 2); |
| | | query = this.em.createNativeQuery(sql); |
| | | int aaa = query.executeUpdate(); |
| | | return aaa; |
| | | } |
| | | |
| | | @Transactional |
| | | public int userManagement_add(tb_user user) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "INSERT INTO tb_user(username,password,superuser,deleteq,alertq,deleteall,justlook,addtime,fenceq) " |
| | | + "VALUES(:username,:password,:superuser,:deleteq,:alertq,:deleteall,:justlook,now(),:fenceq)"; |
| | | cs.tb_caozuo("tb_user", 1); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("username", user.getUsername()); |
| | | query.setParameter("password", user.getPassword()); |
| | | query.setParameter("superuser", user.getSuperuser()); |
| | | query.setParameter("deleteq", user.getDeleteq()); |
| | | query.setParameter("alertq", user.getAlertq()); |
| | | query.setParameter("deleteall", user.getDeleteall()); |
| | | query.setParameter("justlook", user.getJustlook()); |
| | | query.setParameter("fenceq", user.getFenceq()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | @Transactional |
| | | public int userManagement_check(String name) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT count(1) FROM tb_user WHERE username= :username"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("username", name); |
| | | return Integer.parseInt(query.getSingleResult().toString()); |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public int userManagement_modify(tb_user user) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_user SET username = :username,password = :password,superuser = :superuser," |
| | | + "deleteq = :deleteq,alertq = :alertq,deleteall = :deleteall,justlook = :justlook,addtime = now(),fenceq = :fenceq WHERE id= :id"; |
| | | cs.tb_caozuo("tb_user", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("id", user.getId()); |
| | | query.setParameter("username", user.getUsername()); |
| | | query.setParameter("password", user.getPassword()); |
| | | query.setParameter("superuser", user.getSuperuser()); |
| | | query.setParameter("deleteq", user.getDeleteq()); |
| | | query.setParameter("alertq", user.getAlertq()); |
| | | query.setParameter("deleteall", user.getDeleteall()); |
| | | query.setParameter("justlook", user.getJustlook()); |
| | | query.setParameter("fenceq", user.getFenceq()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | public List<tb_yuan_shi_bao_wen> getreplay() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,ip,str,addtime FROM tb_yuan_shi_bao_wen"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_yuan_shi_bao_wen> tb_yuan_shi_bao_wenList = new ArrayList<tb_yuan_shi_bao_wen>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_yuan_shi_bao_wen yuan_shi_bao_wen = new tb_yuan_shi_bao_wen(); |
| | | yuan_shi_bao_wen.setId((Integer)obj[0]); |
| | | yuan_shi_bao_wen.setIp(obj[1] == null ? "" : obj[1].toString()); |
| | | yuan_shi_bao_wen.setStr(obj[2] == null ? "" : obj[2].toString()); |
| | | yuan_shi_bao_wen.setAddtime(obj[3] == null ? "" : obj[3].toString()); |
| | | tb_yuan_shi_bao_wenList.add(yuan_shi_bao_wen); |
| | | } |
| | | } |
| | | return tb_yuan_shi_bao_wenList; |
| | | } |
| | | |
| | | public List<tb_system> getSetting() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT dataname,datapass,gui_ji,bei_fen_di_zhi,data_time,title,udpPort,udpAdress,openudp," |
| | | + "know_tag_zu,wifi_mdel,tagZb,diskaoqing,viewAnckid,viewName,tunlDw,guiji_sava,viewPower," |
| | | + "viewTagid,viewAnckzb,offView,anckicon,gas_show,quiet,real_trak_time," |
| | | + "real_trak_color,gas_open,gas_port,gas_hz,rssid,bs_udp,origin_jingdu,origin_weidu,origin_jiaodu,fence_show,yulan_map,baidu_j,baidu_w,cs_udp,baoliu10,baoliu13,baoliu14,baoliu15,baoliu16,baoliu17,baoliu19,baoliu20 FROM tb_system"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_system> tb_systemList = new ArrayList<tb_system>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_system setting = new tb_system(); |
| | | setting.setDataname(obj[0] == null ? "" : obj[0].toString()); |
| | | setting.setDatapass(obj[1] == null ? "" : obj[1].toString()); |
| | | setting.setGui_ji(obj[2] == null ? "" : obj[2].toString()); |
| | | setting.setBei_fen_di_zhi(obj[3] == null ? "" : obj[3].toString()); |
| | | setting.setData_time(obj[4] == null ? "" : obj[4].toString()); |
| | | setting.setTitle(obj[5] == null ? "" : obj[5].toString()); |
| | | setting.setUdpPort(obj[6] == null ? "" : obj[6].toString()); |
| | | setting.setUdpAdress(obj[7] == null ? "" : obj[7].toString()); |
| | | setting.setOpenudp(obj[8] == null ? "" : obj[8].toString()); |
| | | setting.setKnow_tag_zu(obj[9] == null ? "" : obj[9].toString()); |
| | | setting.setWifi_mdel(obj[10] == null ? "" : obj[10].toString()); |
| | | setting.setTagZb(obj[11] == null ? "" : obj[11].toString()); |
| | | setting.setDiskaoqing(obj[12] == null ? "" : obj[12].toString()); |
| | | setting.setViewAnckid(obj[13] == null ? "" : obj[13].toString()); |
| | | setting.setViewName(obj[14] == null ? "" : obj[14].toString()); |
| | | setting.setTunlDw(obj[15] == null ? "" : obj[15].toString()); |
| | | setting.setGuiji_sava(obj[16] == null ? "" : obj[16].toString()); |
| | | setting.setViewPower(obj[17] == null ? "" : obj[17].toString()); |
| | | setting.setViewTagid(obj[18] == null ? "" : obj[18].toString()); |
| | | setting.setViewAnckzb(obj[19] == null ? "" : obj[19].toString()); |
| | | setting.setOffView(obj[20] == null ? "" : obj[20].toString()); |
| | | setting.setAnckicon(obj[21] == null ? "" : obj[21].toString()); |
| | | setting.setGas_show(obj[22] == null ? "" : obj[22].toString()); |
| | | setting.setQuiet(obj[23] == null ? "" : obj[23].toString()); |
| | | setting.setReal_trak_time(obj[24] == null ? "" : obj[24].toString()); |
| | | setting.setReal_trak_color(obj[25] == null ? "" : obj[25].toString()); |
| | | setting.setGas_open(obj[26] == null ? "" : obj[26].toString()); |
| | | setting.setGas_port(obj[27] == null ? "" : obj[27].toString()); |
| | | setting.setGas_hz(obj[28] == null ? "" : obj[28].toString()); |
| | | setting.setRssid(obj[29] == null ? "" : obj[29].toString()); |
| | | setting.setBs_udp(obj[30] == null ? "" : obj[30].toString()); |
| | | setting.setOrigin_jingdu(obj[31] == null ?"" :obj[31].toString()); |
| | | setting.setOrigin_weidu(obj[32] == null ?"" :obj[32].toString()); |
| | | setting.setOrigin_jiaodu(obj[33] == null ?"" :obj[33].toString()); |
| | | setting.setFence_show(obj[34] == null ?"" :obj[34].toString()); |
| | | setting.setYulan_map(obj[35] == null ?"" :obj[35].toString()); |
| | | setting.setBaidu_j(obj[36] == null ?"" :obj[36].toString()); |
| | | setting.setBaidu_w(obj[37] == null ?"" :obj[37].toString()); |
| | | setting.setCs_udp(obj[38] == null ?"" :obj[38].toString()); |
| | | setting.setBaoliu10(obj[39] == null ?"" :obj[39].toString()); |
| | | setting.setBaoliu13(obj[40] == null ?"" :obj[40].toString()); |
| | | setting.setBaoliu14(obj[41] == null ?"" :obj[41].toString()); |
| | | setting.setBaoliu15(obj[42] == null ?"" :obj[42].toString()); |
| | | setting.setBaoliu16(obj[43] == null ?"" :obj[43].toString()); |
| | | setting.setBaoliu17(obj[44] == null ?"" :obj[44].toString()); |
| | | setting.setBaoliu19(obj[45] == null ?"" :obj[45].toString()); |
| | | setting.setBaoliu20(obj[46] == null ?"" :obj[46].toString()); |
| | | tb_systemList.add(setting); |
| | | } |
| | | } |
| | | return tb_systemList; |
| | | } |
| | | @Transactional |
| | | public int addVersion(String time,String BsVersion){ |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "INSERT INTO tb_version(BsVersion,BsTime) VALUES(:BsVersion,:time)"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("time", time); |
| | | query.setParameter("BsVersion", BsVersion); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | @Transactional |
| | | public int sysSetting_modify(tb_system setting) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_system SET gui_ji=:gui_ji,title=:title," |
| | | + "diskaoqing=:diskaoqing,viewAnckid=:viewAnckid,viewName=:viewName,tunlDw=:tunlDw,guiji_sava=:guiji_sava,viewPower=:viewPower," |
| | | + "viewTagid=:viewTagid,viewAnckzb=:viewAnckzb,offView=:offView,anckicon=:anckicon,gas_show=:gas_show,real_trak_time=:real_trak_time," |
| | | + "real_trak_color=:real_trak_color,fence_show=:fence_show,yulan_map=:yulan_map,baidu_j=:baidu_j,baidu_w=:baidu_w WHERE id= 1"; |
| | | query = this.em.createNativeQuery(sql); |
| | | |
| | | query.setParameter("gui_ji", setting.getGui_ji()); |
| | | query.setParameter("title", setting.getTitle()); |
| | | |
| | | |
| | | query.setParameter("diskaoqing", setting.getDiskaoqing()); |
| | | query.setParameter("viewAnckid", setting.getViewAnckid()); |
| | | query.setParameter("viewName", setting.getViewName()); |
| | | query.setParameter("tunlDw", setting.getTunlDw()); |
| | | query.setParameter("guiji_sava", setting.getGuiji_sava()); |
| | | query.setParameter("viewPower", setting.getViewPower()); |
| | | query.setParameter("viewTagid", setting.getViewTagid()); |
| | | query.setParameter("viewAnckzb", setting.getViewAnckzb()); |
| | | query.setParameter("offView", setting.getOffView()); |
| | | query.setParameter("anckicon", setting.getAnckicon()); |
| | | query.setParameter("gas_show", setting.getGas_show()); |
| | | // query.setParameter("quiet", setting.getQuiet()); |
| | | query.setParameter("real_trak_time", setting.getReal_trak_time()); |
| | | query.setParameter("real_trak_color", setting.getReal_trak_color()); |
| | | query.setParameter("fence_show", setting.getFence_show()); |
| | | query.setParameter("yulan_map", setting.getYulan_map()); |
| | | query.setParameter("baidu_j", setting.getBaidu_j()); |
| | | query.setParameter("baidu_w", setting.getBaidu_w()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | @Transactional |
| | | public int sysSetting_modifya(tb_system setting) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_system SET udpAdress=:udpAdress,baoliu13=:baoliu13,baoliu14=:baoliu14,baoliu15=:baoliu15,real_trak_time=:real_trak_time,fence_show=:fence_show,viewAnckid=:viewAnckid,baoliu16=:baoliu16,baoliu17=:baoliu17,yulan_map=:yulan_map,baoliu20=:baoliu20 WHERE id= 1"; |
| | | cs.tb_caozuo("tb_system", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("udpAdress", setting.getUdpAdress()); |
| | | query.setParameter("baoliu20", setting.getBaoliu20()); |
| | | query.setParameter("baoliu13", setting.getBaoliu13()); |
| | | query.setParameter("baoliu14", setting.getBaoliu14()); |
| | | query.setParameter("baoliu15", setting.getBaoliu15()); |
| | | query.setParameter("real_trak_time", setting.getReal_trak_time()); |
| | | query.setParameter("fence_show", setting.getFence_show()); |
| | | query.setParameter("viewAnckid", setting.getViewAnckid()); |
| | | query.setParameter("baoliu16", setting.getBaoliu16()); |
| | | query.setParameter("baoliu17", setting.getBaoliu17()); |
| | | query.setParameter("yulan_map", setting.getYulan_map()); |
| | | |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | public List<tb_achor> getLayer() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT DISTINCT layer,zu FROM tb_achor"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_achor> layerList = new ArrayList<tb_achor>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_achor layer = new tb_achor(); |
| | | layer.setLayer(obj[0] == null ? "" : obj[0].toString()); |
| | | layerList.add(layer); |
| | | } |
| | | } |
| | | return layerList; |
| | | } |
| | | |
| | | public List<tb_achor> getGroup() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT DISTINCT layer,zu FROM tb_achor"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_achor> zuList = new ArrayList<tb_achor>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_achor zu = new tb_achor(); |
| | | zu.setZu(obj[1] == null ? "" : obj[1].toString()); |
| | | zuList.add(zu); |
| | | } |
| | | } |
| | | return zuList; |
| | | } |
| | | |
| | | @Transactional |
| | | public int algorithmConfiguration_modify(tb_suanfa suanfa) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_suanfa SET sufa=:sufa,anchor_num=:anchor_num,jieji=:jieji,xinhao_qiangdu=:xinhao_qiangdu,youxiao_qu=:youxiao_qu,wuxiao_qu=:wuxiao_qu," |
| | | + "caiyang_guolv=:caiyang_guolv,caiyang_canshu=:caiyang_canshu,kuansong_model=:kuansong_model,pingmian_buju=:pingmian_buju,dunjiao=:dunjiao,bujuqu_youxiao=:bujuqu_youxiao," |
| | | + "bujuqu_youxian=:bujuqu_youxian WHERE floor=:floor AND zu=:zu"; |
| | | cs.tb_caozuo("tb_suanfa", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("floor", suanfa.getFloor()); |
| | | query.setParameter("zu", suanfa.getZu()); |
| | | query.setParameter("sufa", suanfa.getSufa()); |
| | | query.setParameter("anchor_num", suanfa.getAnchor_num()); |
| | | query.setParameter("jieji", suanfa.getJieji()); |
| | | query.setParameter("xinhao_qiangdu", suanfa.getXinhao_qiangdu()); |
| | | query.setParameter("youxiao_qu", suanfa.getYouxiao_qu()); |
| | | query.setParameter("wuxiao_qu", suanfa.getWuxiao_qu()); |
| | | query.setParameter("caiyang_guolv", suanfa.getCaiyang_guolv()); |
| | | query.setParameter("caiyang_canshu", suanfa.getCaiyang_canshu()); |
| | | query.setParameter("kuansong_model", suanfa.getKuansong_model()); |
| | | query.setParameter("pingmian_buju", suanfa.getPingmian_buju()); |
| | | query.setParameter("dunjiao", suanfa.getDunjiao()); |
| | | query.setParameter("bujuqu_youxiao", suanfa.getBujuqu_youxiao()); |
| | | query.setParameter("bujuqu_youxian", suanfa.getBujuqu_youxian()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | public List<tb_tag> getLabel() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT id,tag_id,state,power,status,gaodu,sudu,pinglv,sleep_satus,sleep_time,gongfang,dong_status,version,addtime,imu FROM tb_tag"; |
| | | query = this.em.createNativeQuery(sql); |
| | | List resultList = query.getResultList(); |
| | | List<tb_tag> tb_tagList = new ArrayList<tb_tag>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setId((int) obj[0]); |
| | | tag.setStatus(obj[4] == null ? "" : obj[4].toString()); |
| | | tag.setTag_id(obj[1] == null ? "" : obj[1].toString()); |
| | | tag.setState(obj[2] == null ? "" : obj[2].toString()); |
| | | tag.setPower(obj[3] == null ? "" : obj[3].toString()); |
| | | tag.setGaodu(obj[5] == null ? "" : obj[5].toString()); |
| | | tag.setSudu(obj[6] == null ? "" : obj[6].toString()); |
| | | tag.setPinglv(obj[7] == null ? "" : obj[7].toString()); |
| | | tag.setVersion(obj[12] == null ? "" : obj[12].toString()); |
| | | tag.setAddtime(obj[13] == null ? "" : obj[13].toString()); |
| | | tb_tagList.add(tag); |
| | | } |
| | | } |
| | | return tb_tagList; |
| | | } |
| | | |
| | | @Transactional |
| | | public int baowen_add(tb_yuan_shi_bao_wen yuanshibaowen) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "INSERT INTO tb_baowen (ip,str,addtime) VALUES((SELECT udpAdress FROM tb_system WHERE id = 1),:yuanshibaowen,now())"; |
| | | cs.tb_caozuo("tb_baowen", 1); |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("yuanshibaowen", yuanshibaowen.getStr()); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | |
| | | public List<tb_suanfa> searchAlgorithmConfiguration(String input) { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "SELECT sufa,anchor_num,jieji,xinhao_qiangdu,youxiao_qu,wuxiao_qu,caiyang_guolv,caiyang_canshu,kuansong_model,pingmian_buju,dunjiao,bujuqu_youxiao,bujuqu_youxian,floor,zu FROM tb_suanfa WHERE anchorid = :anchorid"; |
| | | query = this.em.createNativeQuery(sql); |
| | | query.setParameter("anchorid", input); |
| | | List resultList = query.getResultList(); |
| | | List<tb_suanfa> tb_suanfaList = new ArrayList<tb_suanfa>(); |
| | | if (resultList.size() > 0) { |
| | | for (int i = 0; i < resultList.size(); i++) { |
| | | Object[] obj = (Object[]) resultList.get(i); |
| | | tb_suanfa suanfa = new tb_suanfa(); |
| | | suanfa.setSufa(obj[0] == null ? "" : obj[0].toString()); |
| | | suanfa.setAnchor_num(obj[1] == null ? "" : obj[1].toString()); |
| | | suanfa.setZu(obj[14] == null ? "" : obj[14].toString()); |
| | | tb_suanfaList.add(suanfa); |
| | | } |
| | | } |
| | | return tb_suanfaList; |
| | | } |
| | | |
| | | @Transactional |
| | | public int guiling() { |
| | | String sql = null; |
| | | Query query = null; |
| | | sql = "UPDATE tb_system SET baoliu10=null WHERE id = 1"; |
| | | cs.tb_caozuo("tb_suanfa", 3); |
| | | query = this.em.createNativeQuery(sql); |
| | | int executeUpdate = query.executeUpdate(); |
| | | return executeUpdate; |
| | | } |
| | | } |