| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by FernFlower decompiler) |
| | | // |
| | | |
| | | package com.hxzkoa.controller; |
| | | |
| | | import java.awt.Image; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.swing.ImageIcon; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.hxzkoa.json.tb_achor; |
| | | import com.hxzkoa.json.tb_adress_and_port; |
| | | import com.hxzkoa.json.tb_department; |
| | | import com.hxzkoa.json.tb_fence; |
| | | import com.hxzkoa.json.tb_history_power; |
| | | import com.hxzkoa.json.tb_map; |
| | | import com.hxzkoa.json.tb_person; |
| | | import com.hxzkoa.json.tb_tag; |
| | | import com.hxzkoa.json.tb_tagpower; |
| | |
| | | import com.hxzkoa.json.vo_tp_t_p; |
| | | import com.hxzkoa.services.AnchorService; |
| | | import com.hxzkoa.services.BasicInfoService; |
| | | import com.hxzkoa.services.FenceService; |
| | | import com.hxzkoa.services.LabelService; |
| | | import com.hxzkoa.services.MapService; |
| | | import com.hxzkoa.udp.ControTag; |
| | | import com.hxzkoa.udp.GetNowTime; |
| | | import com.hxzkoa.udp.IDcard; |
| | | import com.hxzkoa.udp.Udp_Out; |
| | | /*import com.hxzkoa.udp.Udp_Receive;*/ |
| | | import com.hxzkoa.udp.bmpToJPG; |
| | | import com.hxzkoa.util.Config; |
| | | import com.hxzkoa.util.ExcelUtils; |
| | | import com.hxzkoa.util.HttpUtil; |
| | | import com.hxzkoa.util.LineXy; |
| | | import com.hxzkoa.util.ModifyConfig; |
| | | import com.hxzkoa.util.PageUtil; |
| | | import com.hxzkoa.util.RequestUtils; |
| | | |
| | | import java.awt.Image; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.swing.ImageIcon; |
| | | import jxl.Sheet; |
| | | import jxl.Workbook; |
| | | import jxl.read.biff.BiffException; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | @Controller |
| | | public class LabelController { |
| | |
| | | private BasicInfoService basicInfoService; |
| | | @Autowired |
| | | private AnchorService anchorService; |
| | | |
| | | @Autowired |
| | | private MapService mapService; |
| | | @Autowired |
| | | private FenceService fenceService; |
| | | |
| | | public LabelController() { |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_pinlv.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_pinlv.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void pinlv(HttpServletRequest request) { |
| | | String tag_id = request.getParameter("tag_id"); |
| | | String hz = request.getParameter("hz"); |
| | | String xieyi = "55BB,ALERT_TAG_HZ,"+hz+","+tag_id+",END"; |
| | | String xieyi = "55BB,ALERT_TAG_HZ," + hz + "," + tag_id + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_xiumian_time.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_xiumian_time.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void xiumiantime(HttpServletRequest request) { |
| | | String tag_id = request.getParameter("tag_id"); |
| | | String hz = request.getParameter("hz"); |
| | | String xieyi = "55BB,ALERT_SLEEP_TIME,"+hz+","+tag_id+",END"; |
| | | String xieyi = "55BB,ALERT_SLEEP_TIME," + hz + "," + tag_id + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_xiumian_.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_xiumian_.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void xiumian(HttpServletRequest request) { |
| | | String tag_id = request.getParameter("tag_id"); |
| | | String hz = request.getParameter("hz"); |
| | | String xieyi = "55BB,OPEN_OR_CLOSE_SLEEP,"+hz+","+tag_id+",END"; |
| | | String xieyi = "55BB,OPEN_OR_CLOSE_SLEEP," + hz + "," + tag_id + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_zhendong_.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_zhendong_.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void zhendong(HttpServletRequest request) { |
| | | String tag_id = request.getParameter("tag_id"); |
| | | String hz = request.getParameter("hz"); |
| | | String xieyi = "55BB,TAG_SHAKE,"+hz+","+tag_id+",END"; |
| | | String xieyi = "55BB,TAG_SHAKE," + hz + "," + tag_id + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelManagement.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/labelManagement.jsp"; |
| | | List<tb_tag> labelManagementList = labelService.getLabelManagement(1); |
| | | List<tb_tag> labelManagementList = this.labelService.getLabelManagement(1); |
| | | List<tb_tag> labelManagementListaa = this.labelService.getLabelManagementa(); |
| | | List<String> realAttendance_k = new ArrayList(); |
| | | List<tb_department> departments = this.basicInfoService.getDepartmentManagement2(); |
| | | |
| | | for(int i = 0; i < departments.size(); ++i) { |
| | | realAttendance_k.add(((tb_department)departments.get(i)).getDepartmentName()); |
| | | } |
| | | |
| | | List<String> leixings = this.labelService.findleixing(); |
| | | String[] strs = new String[4]; |
| | | int renyuannum = 0; |
| | | int chezainum = 0; |
| | | int wuzinum = 0; |
| | | |
| | | for(int i = 0; i < labelManagementListaa.size(); ++i) { |
| | | if (!((tb_tag)labelManagementListaa.get(i)).getType().equals("车载带屏") && !((tb_tag)labelManagementListaa.get(i)).getType().equals("车载无屏")) { |
| | | if (((tb_tag)labelManagementListaa.get(i)).getType().equals("物资标签")) { |
| | | ++wuzinum; |
| | | } else { |
| | | ++renyuannum; |
| | | } |
| | | } else { |
| | | ++chezainum; |
| | | } |
| | | } |
| | | |
| | | int weibangdingnum = this.labelService.getweibangding(); |
| | | strs[0] = String.valueOf(renyuannum); |
| | | strs[1] = String.valueOf(chezainum); |
| | | strs[2] = String.valueOf(wuzinum); |
| | | strs[3] = String.valueOf(weibangdingnum); |
| | | request.setAttribute("tongji", strs); |
| | | request.setAttribute("leixing", leixings); |
| | | request.setAttribute("bumen", realAttendance_k); |
| | | request.setAttribute("labelManagementList", labelManagementList); |
| | | request.setAttribute("labelManagementListaa", labelManagementListaa); |
| | | int curPage = 1; |
| | | int count = labelService.getLabelManagementCount(); |
| | | int count = this.labelService.getLabelManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | //System.out.print(minPage); |
| | | request.setAttribute("pageList", PageUtil.getPage(minPage)); |
| | | request.setAttribute("curPage", curPage); |
| | | request.setAttribute("curPage", Integer.valueOf(curPage)); |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagementa.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject labelManagementa(HttpServletRequest request) { |
| | | List<tb_tag> labelManagementList = this.labelService.getLabelManagementa(); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", labelManagementList); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagementad.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject labelManagementad(HttpServletRequest request) { |
| | | List<tb_person> labelManagementList = this.labelService.getLabelManagementa2(); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", labelManagementList); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagementaa.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject labelManagementaa(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_tag> labelManagementList = this.labelService.getLabelManagement(1); |
| | | int curPage = 1; |
| | | int count = this.labelService.getLabelManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | json.put("dataList", labelManagementList); |
| | | json.put("pageList", PageUtil.getPage(minPage)); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | return json; |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"/labelManagement_add.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_add(HttpServletRequest request) throws IOException { |
| | | tb_tag tag = new tb_tag(); |
| | | String tag_id = request.getParameter("tag_id"); |
| | | if (("").equals(tag_id) || tag_id == null) { |
| | | // 接口处理逻辑 |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | tag_id = tag.getTag_id(); |
| | | } else { |
| | | // 网页请求逻辑 |
| | | if (!"".equals(tag_id) && tag_id != null) { |
| | | tag.setTag_id(request.getParameter("tag_id")); |
| | | tag.setState(request.getParameter("state")); |
| | | tag.setGaodu(request.getParameter("gaodu")); |
| | | tag.setSudu(request.getParameter("sudu")); |
| | | tag.setPinglv(request.getParameter("pinglv")); |
| | | tag.setType(request.getParameter("type")); |
| | | tag.setVersion(Config.getVersion()); |
| | | } else { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | tag_id = tag.getTag_id(); |
| | | } |
| | | // 如果该tag_id不存在,新增一条 |
| | | List<tb_tag> searchLabelManagement = labelService.searchLabelManagement(tag_id); |
| | | |
| | | List<tb_tag> searchLabelManagement = this.labelService.searchLabelManagement(tag_id); |
| | | if (searchLabelManagement.size() == 0) { |
| | | labelService.labelManagement_add(tag); |
| | | if(("").equals(tag.getState())){ |
| | | if ("".equals(tag.getState())) { |
| | | tag.setState("未绑定"); |
| | | } |
| | | if(("").equals(tag.getGaodu())){ |
| | | |
| | | if ("".equals(tag.getGaodu())) { |
| | | tag.setGaodu("150"); |
| | | } |
| | | if(("").equals(tag.getSudu())){ |
| | | |
| | | if ("".equals(tag.getSudu())) { |
| | | tag.setSudu("1000"); |
| | | } |
| | | String xieyi = "BSTOCS1,ADDTAG,"+tag.getTag_id()+","+tag.getState()+","+tag.getGaodu()+","+tag.getSudu()+","+tag.getPinglv()+",END"; |
| | | |
| | | String xieyi = "BSTOCS1,ADDTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + "," + tag.getType() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | // 新增标签同时需要在tb_person中插入一条数据 |
| | | tb_person person = new tb_person(); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | |
| | | person.setP_kaoqing("0"); |
| | | person.setP_fence("0"); |
| | | person.setP_image("image/targeticon/default.png"); |
| | | basicInfoService.personManagement_add(person); |
| | | } |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_adda.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int labelManagement_adda(HttpServletRequest request) throws IOException { |
| | | tb_tag tag = new tb_tag(); |
| | | int aaa = 0; |
| | | String tag_id = request.getParameter("tag_id"); |
| | | if (!"".equals(tag_id) && tag_id != null) { |
| | | tag.setTag_id(request.getParameter("tag_id")); |
| | | tag.setState(request.getParameter("state")); |
| | | tag.setGaodu(request.getParameter("gaodu")); |
| | | tag.setSudu(request.getParameter("sudu")); |
| | | tag.setPinglv(request.getParameter("pinglv")); |
| | | tag.setType(request.getParameter("type")); |
| | | tag.setVersion(Config.getVersion()); |
| | | } else { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | tag_id = tag.getTag_id(); |
| | | } |
| | | |
| | | List<tb_tag> searchLabelManagement = this.labelService.searchLabelManagement(tag_id); |
| | | if (searchLabelManagement.size() == 0) { |
| | | aaa = this.labelService.labelManagement_adda(tag); |
| | | if ("".equals(tag.getState())) { |
| | | tag.setState("未绑定"); |
| | | } |
| | | |
| | | if ("".equals(tag.getGaodu())) { |
| | | tag.setGaodu("150"); |
| | | } |
| | | |
| | | if ("".equals(tag.getSudu())) { |
| | | tag.setSudu("1000"); |
| | | } |
| | | |
| | | String xieyi = "BSTOCS1,ADDTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | tb_person person = new tb_person(); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_power(tag.getPower()); |
| | | person.setP_sex("男"); |
| | | person.setP_minzu("汉"); |
| | | person.setP_phone("131******88"); |
| | | person.setP_department("系统默认"); |
| | | person.setP_x("0"); |
| | | person.setP_y("0"); |
| | | person.setP_floor("0"); |
| | | person.setP_sos("0"); |
| | | person.setP_online("0"); |
| | | person.setP_kaoqing("0"); |
| | | person.setP_fence("0"); |
| | | person.setP_image("image/targeticon/default.png"); |
| | | this.basicInfoService.personManagement_add(person); |
| | | } |
| | | |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_addad.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_addad(HttpServletRequest request) throws IOException { |
| | | tb_tag tag = new tb_tag(); |
| | | String str = "1"; |
| | | String bumen = ""; |
| | | String fence = ""; |
| | | Boolean abc = isLetterDigit(request.getParameter("tagid")); |
| | | List<tb_tag> lables = this.labelService.searchLabelManagement(request.getParameter("tagid")); |
| | | if (abc.equals(true) && lables.size() == 0) { |
| | | String tag_id = request.getParameter("tagid"); |
| | | if (!"".equals(tag_id) && tag_id != null) { |
| | | tag.setTag_id(request.getParameter("tagid")); |
| | | tag.setState(request.getParameter("name")); |
| | | tag.setGaodu(request.getParameter("height")); |
| | | tag.setSudu("1000"); |
| | | tag.setPinglv("1"); |
| | | bumen = request.getParameter("department"); |
| | | fence = request.getParameter("fencename"); |
| | | tag.setVersion(Config.getVersion()); |
| | | } else { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | tag_id = tag.getTag_id(); |
| | | } |
| | | |
| | | List<tb_tag> searchLabelManagement = this.labelService.searchLabelManagement(tag_id); |
| | | if (searchLabelManagement.size() == 0) { |
| | | this.labelService.labelManagement_adda(tag); |
| | | if ("".equals(tag.getState())) { |
| | | tag.setState("未绑定"); |
| | | } |
| | | |
| | | if ("".equals(tag.getGaodu())) { |
| | | tag.setGaodu("150"); |
| | | } |
| | | |
| | | if ("".equals(tag.getSudu())) { |
| | | tag.setSudu("1000"); |
| | | } |
| | | |
| | | if ("".equals(tag.getPinglv())) { |
| | | tag.setPinglv("1"); |
| | | } |
| | | |
| | | String xieyi = "BSTOCS1,U1ADDTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + "," + bumen + "," + fence + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | tb_person person = new tb_person(); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_department(bumen); |
| | | person.setBaoliu4(tag.getGaodu()); |
| | | person.setBaoliu12(fence); |
| | | person.setP_sex("男"); |
| | | person.setP_minzu("汉"); |
| | | person.setP_phone("131******88"); |
| | | person.setP_department("系统默认"); |
| | | person.setP_x("0"); |
| | | person.setP_y("0"); |
| | | person.setP_floor("0"); |
| | | person.setP_sos("0"); |
| | | person.setP_online("0"); |
| | | person.setP_kaoqing("0"); |
| | | person.setP_fence("0"); |
| | | person.setP_image("image/targeticon/default.png"); |
| | | this.basicInfoService.personManagement_add(person); |
| | | } |
| | | } else if (lables.size() != 0) { |
| | | str = "标签ID已存在"; |
| | | } else { |
| | | str = "标签ID只能使用数字或字母"; |
| | | } |
| | | |
| | | return str; |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"/labelManagement_modify.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_modify(HttpServletRequest request) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setTag_id(request.getParameter("tag_id")); |
| | |
| | | tag.setGaodu(request.getParameter("gaodu")); |
| | | tag.setSudu(request.getParameter("sudu")); |
| | | tag.setPinglv(request.getParameter("pinglv")); |
| | | labelService.labelManagement_modify(tag); |
| | | String xieyi = "BSTOCS1,ALTERTAG,"+tag.getTag_id()+","+tag.getState()+","+tag.getGaodu()+","+tag.getSudu()+","+tag.getPinglv()+",END"; |
| | | tag.setType(request.getParameter("type")); |
| | | this.labelService.labelManagement_modify(tag); |
| | | String xieyi = "BSTOCS1,ALTERTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + "," + tag.getType() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | // 修改标签同时需要修改tb_person 需要先查再改否则覆盖空 |
| | | List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag.getTag_id()); |
| | | if(searchPersonManagement!=null){ |
| | | tb_person person = searchPersonManagement.get(0); |
| | | List<tb_person> searchPersonManagement = this.basicInfoService.searchPersonManagement(tag.getTag_id()); |
| | | if (searchPersonManagement != null) { |
| | | tb_person person = (tb_person)searchPersonManagement.get(0); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_power(tag.getPower()); |
| | | basicInfoService.personManagement_modify(person); |
| | | this.basicInfoService.personManagement_modify(person); |
| | | } |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelManagement_modifyAll.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_modifya.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int labelManagement_modifya(HttpServletRequest request) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setTag_id(request.getParameter("tag_id")); |
| | | tag.setState(request.getParameter("state")); |
| | | tag.setGaodu(request.getParameter("gaodu")); |
| | | tag.setSudu(request.getParameter("sudu")); |
| | | tag.setPinglv(request.getParameter("pinglv")); |
| | | tag.setType(request.getParameter("type")); |
| | | int aaa = this.labelService.labelManagement_modifya(tag); |
| | | String xieyi = "BSTOCS1,ALTERTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | List<tb_person> searchPersonManagement = this.basicInfoService.searchPersonManagement(tag.getTag_id()); |
| | | if (searchPersonManagement != null) { |
| | | tb_person person = (tb_person)searchPersonManagement.get(0); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_power(tag.getPower()); |
| | | this.basicInfoService.personManagement_modify(person); |
| | | } |
| | | |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_modifyad.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_modifyad(HttpServletRequest request) { |
| | | tb_tag tag = new tb_tag(); |
| | | String str = "1"; |
| | | if (isLetterDigit(request.getParameter("tagid"))) { |
| | | tag.setTag_id(request.getParameter("tagid")); |
| | | tag.setState(request.getParameter("name")); |
| | | tag.setGaodu(request.getParameter("height")); |
| | | String bumen = request.getParameter("department"); |
| | | String fence = request.getParameter("fencename"); |
| | | if ("".equals(tag.getState())) { |
| | | tag.setState("未绑定"); |
| | | } |
| | | |
| | | if ("".equals(tag.getGaodu())) { |
| | | tag.setGaodu("150"); |
| | | } |
| | | |
| | | if ("".equals(tag.getSudu())) { |
| | | tag.setSudu("1000"); |
| | | } |
| | | |
| | | if ("".equals(tag.getPinglv())) { |
| | | tag.setPinglv("1"); |
| | | } |
| | | |
| | | String xieyi = "BSTOCS1,U1ALTERTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + "," + bumen + "," + fence + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | List<tb_person> searchPersonManagement = this.basicInfoService.searchPersonManagement(tag.getTag_id()); |
| | | if (searchPersonManagement != null) { |
| | | } |
| | | } else { |
| | | str = "标签ID只能使用数字或字母"; |
| | | } |
| | | |
| | | return str; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_modifyaa.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET}, |
| | | produces = {"application/json; charset=utf-8"} |
| | | ) |
| | | public int labelManagement_modifyaa(@RequestBody Map map) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setTag_id(map.get("tag_id").toString()); |
| | | tag.setState(map.get("name").toString()); |
| | | List<tb_tag> searchtagManagement = this.basicInfoService.searchPersonManagementa(tag.getTag_id()); |
| | | int aaa = 0; |
| | | if (searchtagManagement != null) { |
| | | aaa = this.labelService.labelManagement_modifytag(tag); |
| | | List<tb_tag> tags = this.labelService.searchLabelManagement(tag.getTag_id()); |
| | | tb_person person = new tb_person(); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_fangkeid(map.get("fangkeid").toString()); |
| | | person.setP_idcardnum(map.get("idcardnum").toString()); |
| | | List<tb_person> searchPersonManagement = this.basicInfoService.searchPersonManagement(tag.getTag_id()); |
| | | if (searchPersonManagement != null) { |
| | | this.labelService.labelManagement_modifyperson(person); |
| | | } |
| | | } |
| | | |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_modifyaaa.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET}, |
| | | produces = {"application/json; charset=utf-8"} |
| | | ) |
| | | public int labelManagement_modifyaaa(@RequestBody Map map) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setTag_id(map.get("tag_id").toString()); |
| | | tag.setState("未绑定"); |
| | | List<tb_tag> searchtagManagement = this.basicInfoService.searchPersonManagementa(tag.getTag_id()); |
| | | int aaa = 0; |
| | | if (searchtagManagement != null) { |
| | | aaa = this.labelService.labelManagement_modifytag(tag); |
| | | tb_person person = new tb_person(); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_sex("-"); |
| | | person.setP_minzu("-"); |
| | | person.setP_phone("-"); |
| | | person.setP_idcardnum("-"); |
| | | person.setP_adress("-"); |
| | | List<tb_person> searchPersonManagement = this.basicInfoService.searchPersonManagement(tag.getTag_id()); |
| | | if (searchPersonManagement != null) { |
| | | this.labelService.labelManagement_modifyperson(person); |
| | | } |
| | | } |
| | | |
| | | return aaa; |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"/labelManagement_modifyAll.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_modifyAll(HttpServletRequest request) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setGaodu(request.getParameter("gaodu")); |
| | | tag.setSudu(request.getParameter("sudu")); |
| | | tag.setPinglv(request.getParameter("pinglv")); |
| | | labelService.labelManagement_modifyAll(tag); |
| | | String xieyi = "BSTOCS1,ALTERALLTAG,"+tag.getGaodu()+","+tag.getSudu()+","+tag.getPinglv()+",END"; |
| | | this.labelService.labelManagement_modifyAll(tag); |
| | | String xieyi = "BSTOCS1,ALTERALLTAG," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | // 需要遍历修改 |
| | | List<tb_tag> labelList = labelService.getLabelManagement(); |
| | | for (int i = 0; i < labelList.size(); i++) { |
| | | String tag_id = labelList.get(i).getTag_id(); |
| | | // 修改标签同时需要修改tb_person 需要先查再改否则覆盖空 |
| | | List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag_id); |
| | | if(searchPersonManagement!=null){ |
| | | tb_person person = searchPersonManagement.get(0); |
| | | List<tb_tag> labelList = this.labelService.getLabelManagement(); |
| | | |
| | | for(int i = 0; i < labelList.size(); ++i) { |
| | | String tag_id = ((tb_tag)labelList.get(i)).getTag_id(); |
| | | List<tb_person> searchPersonManagement = this.basicInfoService.searchPersonManagement(tag_id); |
| | | if (searchPersonManagement != null) { |
| | | tb_person person = (tb_person)searchPersonManagement.get(0); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_power(tag.getPower()); |
| | | basicInfoService.personManagement_modify(person); |
| | | this.basicInfoService.personManagement_modify(person); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_modifyAlla.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int labelManagement_modifyAlla(HttpServletRequest request) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setGaodu(request.getParameter("gaodu")); |
| | | tag.setSudu(request.getParameter("sudu")); |
| | | tag.setPinglv(request.getParameter("pinglv")); |
| | | int aaa = this.labelService.labelManagement_modifyAlla(tag); |
| | | String xieyi = "BSTOCS1,ALTERALLTAG," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | List<tb_tag> labelList = this.labelService.getLabelManagement(); |
| | | |
| | | for(int i = 0; i < labelList.size(); ++i) { |
| | | String tag_id = ((tb_tag)labelList.get(i)).getTag_id(); |
| | | List<tb_person> searchPersonManagement = this.basicInfoService.searchPersonManagement(tag_id); |
| | | if (searchPersonManagement != null) { |
| | | tb_person person = (tb_person)searchPersonManagement.get(0); |
| | | person.setP_tagid(tag.getTag_id()); |
| | | person.setP_name(tag.getState()); |
| | | person.setP_power(tag.getPower()); |
| | | this.basicInfoService.personManagement_modify(person); |
| | | } |
| | | } |
| | | |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_delete.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_delete(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | labelService.labelManagement_delete(checkVal); |
| | | for (int i = 0; i < checkVal.length; i++) { |
| | | String xieyi = "BSTOCS1,DELETETAG,"+checkVal[i]+",END"; |
| | | this.labelService.labelManagement_delete(checkVal); |
| | | |
| | | for(int i = 0; i < checkVal.length; ++i) { |
| | | String xieyi = "BSTOCS1,DELETETAG," + checkVal[i] + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | // 删除标签同时需要删除tb_person |
| | | labelService.labelperson_delete(checkVal); |
| | | |
| | | this.labelService.labelperson_delete(checkVal); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_deletea.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_deletea(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | |
| | | int aaa; |
| | | for(aaa = 0; aaa < checkVal.length; ++aaa) { |
| | | String xieyi = "BSTOCS1,U1DELETETAG," + checkVal[aaa] + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | aaa = this.labelService.labelManagement_deletea(checkVal); |
| | | this.labelService.labelperson_delete(checkVal); |
| | | return "" + aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_deleteAll.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_deleteAll(HttpServletRequest request) { |
| | | labelService.labelManagement_deleteAll(); |
| | | this.labelService.labelManagement_deleteAll(); |
| | | String xieyi = "BSTOCS1,DELETEALLTAG,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | // 删除标签同时需要删除tb_person |
| | | basicInfoService.personManagement_deleteAll(); |
| | | this.basicInfoService.personManagement_deleteAll(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_deleteAlla.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int labelManagement_deleteAlla(HttpServletRequest request) { |
| | | int aaa = this.labelService.labelManagement_deleteAlla(); |
| | | String xieyi = "BSTOCS1,DELETEALLTAG,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | this.basicInfoService.personManagement_deleteAll(); |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_search(HttpServletRequest request) throws IOException { |
| | | JSONObject json = new JSONObject(); |
| | | String input = request.getParameter("input"); |
| | | if (("").equals(input) || input == null) { |
| | | List labelManagementList; |
| | | if (!"".equals(input) && input != null) { |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList(); |
| | | labelManagementList = this.labelService.searchLabelManagement(input); |
| | | pageList.add(1); |
| | | json.put("dataList", labelManagementList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | } else { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | tb_tag tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | input = tag.getTag_id(); |
| | | List<tb_tag> labelManagementList = labelService.searchLabelManagement(input); |
| | | labelManagementList = this.labelService.searchLabelManagement(input); |
| | | if (labelManagementList.size() > 0) { |
| | | json.put("result", labelManagementList.get(0)); |
| | | } else { |
| | | json.put("result", "null"); |
| | | } |
| | | |
| | | } else { |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | List<tb_tag> labelManagementList = labelService.searchLabelManagement(input); |
| | | pageList.add(1); |
| | | json.put("dataList", labelManagementList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | } |
| | | |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_searcha.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject labelManagement_searcha(HttpServletRequest request) throws IOException { |
| | | JSONObject json = new JSONObject(); |
| | | String input = request.getParameter("tagid"); |
| | | if (!"".equals(input) && input != null) { |
| | | List<tb_tag> labelManagementList = this.labelService.searchLabelManagementaa(input); |
| | | json.put("dataList", labelManagementList); |
| | | } else { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tb_tag tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | input = tag.getTag_id(); |
| | | List<tb_tag> labelManagementList = this.labelService.searchLabelManagementaa(input); |
| | | if (labelManagementList.size() > 0) { |
| | | json.put("result", labelManagementList.get(0)); |
| | | } else { |
| | | json.put("result", "null"); |
| | | } |
| | | } |
| | | |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/labelManagement_page.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_page(HttpServletRequest request) { |
| | | String pageStr = request.getParameter("page"); |
| | | String curPageStr = request.getParameter("curPage"); |
| | | int count = labelService.getLabelManagementCount(); |
| | | int count = this.labelService.getLabelManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | int curPage = Integer.parseInt(curPageStr); |
| | | int page = 1; |
| | |
| | | } else { |
| | | page = Integer.parseInt(pageStr); |
| | | } |
| | | List<tb_tag> labelManagementList = labelService.getLabelManagement(page); |
| | | |
| | | List<tb_tag> labelManagementList = this.labelService.getLabelManagement(page); |
| | | List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", labelManagementList); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_exportTemplate.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_exportTemplate.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_exportTemplate(HttpServletRequest request, HttpServletResponse response) { |
| | | String toPage = "forward:/hxzk/label/labelManagement.jsp"; |
| | | List<tb_tag> labelTemplateList = labelService.getLabelManagement(1); |
| | | String[] rowName = { "标签ID", "绑定对象"}; |
| | | List<tb_tag> labelTemplateList = this.labelService.getLabelManagement(1); |
| | | String[] rowName = new String[]{"标签ID", "绑定对象"}; |
| | | List<Object[]> dataList = labelTemplateobjectToArray(labelTemplateList); |
| | | ExcelUtils excel = new ExcelUtils("标签管理", rowName, dataList); |
| | | OutputStream out; |
| | | |
| | | try { |
| | | String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls"; |
| | | String headStr = "attachment; filename=\"" + fileName + "\""; |
| | | response.setContentType("APPLICATION/OCTET-STREAM"); |
| | | response.setHeader("Content-Disposition", headStr); |
| | | out = response.getOutputStream(); |
| | | OutputStream out = response.getOutputStream(); |
| | | excel.export(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | |
| | | return toPage; |
| | | } |
| | | |
| | | // 对象转数组 |
| | | public static List<Object[]> labelTemplateobjectToArray(List<tb_tag> labelList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < labelList.size(); i++) { |
| | | List<String> words = new ArrayList<String>(); |
| | | tb_tag tag = (tb_tag) labelList.get(i); |
| | | List<Object[]> reList = new ArrayList(); |
| | | |
| | | for(int i = 0; i < labelList.size(); ++i) { |
| | | List<String> words = new ArrayList(); |
| | | tb_tag tag = (tb_tag)labelList.get(i); |
| | | words.add(tag.getTag_id()); |
| | | words.add(tag.getState()); |
| | | String[] array = words.toArray(new String[0]); |
| | | String[] array = (String[])words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | |
| | | return reList; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_import.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_import.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_import(HttpServletRequest request) { |
| | | String path = request.getParameter("path"); |
| | | if (path.indexOf("fakepath") != -1) { |
| | |
| | | String fileName = fileNameArr[fileNameArr.length - 1]; |
| | | path = "C:/hxzkoa/" + fileName; |
| | | } |
| | | ; |
| | | |
| | | int result = 0; |
| | | // 选取Excel文件得到工作薄 |
| | | Workbook workbook; |
| | | |
| | | try { |
| | | File file = new File(path); |
| | | workbook = Workbook.getWorkbook(file); |
| | | // 选择工作表,通过Workbook的getSheet方法选择第一个工作表(从0开始) |
| | | Workbook workbook = Workbook.getWorkbook(file); |
| | | Sheet sheet = workbook.getSheet(0); |
| | | int rows = sheet.getRows(); |
| | | // 选择Cell,读取单元格 通过Sheet的getCell方法选择位置为C2的单元格(两个参数都从0开始) |
| | | for (int i = 1; i < rows; i++) { |
| | | // 读取信息,通过Cell的getContents方法读取单元格的值把单元格中的信息以字符的形式读取出来 |
| | | |
| | | for(int i = 1; i < rows; ++i) { |
| | | String status = sheet.getCell(0, i).getContents(); |
| | | String tag_id = sheet.getCell(1, i).getContents(); |
| | | String state = sheet.getCell(2, i).getContents(); |
| | |
| | | String sudu = sheet.getCell(5, i).getContents(); |
| | | String pinglv = sheet.getCell(6, i).getContents(); |
| | | String version = sheet.getCell(7, i).getContents(); |
| | | if (!("").equals(tag_id)) { |
| | | if (!"".equals(tag_id)) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setStatus(status); |
| | | tag.setTag_id(tag_id); |
| | |
| | | tag.setSudu(sudu); |
| | | tag.setPinglv(pinglv); |
| | | tag.setVersion(version); |
| | | labelService.labelManagement_add(tag); |
| | | this.labelService.labelManagement_add(tag); |
| | | } |
| | | } |
| | | // 释放资源 |
| | | |
| | | workbook.close(); |
| | | } catch (BiffException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (BiffException var18) { |
| | | var18.printStackTrace(); |
| | | } catch (IOException var19) { |
| | | var19.printStackTrace(); |
| | | } |
| | | |
| | | JSONObject json = new JSONObject(); |
| | | json.put("result", result); |
| | | json.put("result", Integer.valueOf(result)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/uploadLabel.do") |
| | | @RequestMapping({"/uploadLabel.do"}) |
| | | public String uploadPerson(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/labelManagement.jsp"; |
| | | String filePath = request.getServletContext().getRealPath("/") + "hxzk\\upload\\"; |
| | | String filename = files[0].getOriginalFilename(); |
| | | |
| | | try { |
| | | File existFile = new File(filePath); |
| | | if (!existFile.exists()) { |
| | | existFile.mkdir(); |
| | | } |
| | | for (MultipartFile file : files) { |
| | | |
| | | MultipartFile[] var7 = files; |
| | | int var8 = files.length; |
| | | |
| | | for(int var9 = 0; var9 < var8; ++var9) { |
| | | MultipartFile file = var7[var9]; |
| | | file.transferTo(new File(filePath + file.getOriginalFilename())); |
| | | //System.out.print(file.getOriginalFilename()); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException var20) { |
| | | var20.printStackTrace(); |
| | | } |
| | | |
| | | int result = 0; |
| | | String path = filePath + filename; |
| | | // 选取Excel文件得到工作薄 |
| | | Workbook workbook; |
| | | |
| | | int rows; |
| | | int i; |
| | | try { |
| | | File file = new File(path); |
| | | workbook = Workbook.getWorkbook(file); |
| | | // 选择工作表,通过Workbook的getSheet方法选择第一个工作表(从0开始) |
| | | Workbook workbook = Workbook.getWorkbook(file); |
| | | Sheet sheet = workbook.getSheet(0); |
| | | int rows = sheet.getRows(); |
| | | // 选择Cell,读取单元格 通过Sheet的getCell方法选择位置为C2的单元格(两个参数都从0开始) |
| | | for (int i = 3; i < rows; i++) { |
| | | // 读取信息,通过Cell的getContents方法读取单元格的值把单元格中的信息以字符的形式读取出来 |
| | | // String status = sheet.getCell(0, i).getContents(); |
| | | rows = sheet.getRows(); |
| | | |
| | | for(i = 3; i < rows; ++i) { |
| | | String tag_id = sheet.getCell(0, i).getContents(); |
| | | String state = sheet.getCell(1, i).getContents(); |
| | | if (!("").equals(tag_id)) { |
| | | tb_tag tag = new tb_tag(); |
| | | // tag.setStatus(status); |
| | | tag.setTag_id(tag_id); |
| | | tag.setState(state); |
| | | tag.setPower("100"); |
| | | tag.setGaodu("150"); |
| | | tag.setSudu("无"); |
| | | tag.setPinglv("无"); |
| | | tag.setVersion("无"); |
| | | result = labelService.labelManagement_add(tag); |
| | | if (!"".equals(tag_id)) { |
| | | List<tb_tag> labelManagementList = this.labelService.searchLabelManagement(tag_id); |
| | | if (labelManagementList.size() == 0) { |
| | | result = 1; |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setTag_id(tag_id); |
| | | tag.setState(state); |
| | | tag.setPower("100"); |
| | | tag.setGaodu("150"); |
| | | tag.setSudu("无"); |
| | | tag.setPinglv("1"); |
| | | tag.setVersion("无"); |
| | | tag.setType(""); |
| | | String xieyi = "BSTOCS1,ADDTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + "," + tag.getType() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | } |
| | | } |
| | | // 释放资源 |
| | | |
| | | workbook.close(); |
| | | } catch (BiffException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (BiffException var18) { |
| | | var18.printStackTrace(); |
| | | } catch (IOException var19) { |
| | | var19.printStackTrace(); |
| | | } |
| | | request.setAttribute("resultList", result); |
| | | List<tb_tag> labelManagementList = labelService.getLabelManagement(1); |
| | | |
| | | System.out.print(result + "-------------"); |
| | | request.setAttribute("resultList", Integer.valueOf(result)); |
| | | List<tb_tag> labelManagementList = this.labelService.getLabelManagement(1); |
| | | request.setAttribute("labelManagementList", labelManagementList); |
| | | int curPage = 1; |
| | | int count = labelService.getLabelManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | request.setAttribute("pageList", PageUtil.getPage(minPage)); |
| | | request.setAttribute("curPage", curPage); |
| | | rows = this.labelService.getLabelManagementCount(); |
| | | i = PageUtil.getMinPage(rows); |
| | | request.setAttribute("pageList", PageUtil.getPage(i)); |
| | | request.setAttribute("curPage", Integer.valueOf(curPage)); |
| | | File file = new File(path); |
| | | file.delete(); |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping({"/uploadLabel2.do"}) |
| | | public String uploadPerson2(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/labelManagement.jsp"; |
| | | String filePath = request.getServletContext().getRealPath("/") + "hxzk\\upload\\"; |
| | | String filename = files[0].getOriginalFilename(); |
| | | |
| | | try { |
| | | File existFile = new File(filePath); |
| | | if (!existFile.exists()) { |
| | | existFile.mkdir(); |
| | | } |
| | | |
| | | MultipartFile[] var7 = files; |
| | | int var8 = files.length; |
| | | |
| | | for(int var9 = 0; var9 < var8; ++var9) { |
| | | MultipartFile file = var7[var9]; |
| | | file.transferTo(new File(filePath + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException var19) { |
| | | var19.printStackTrace(); |
| | | } |
| | | |
| | | int result = 0; |
| | | String path = filePath + filename; |
| | | |
| | | int rows; |
| | | int i; |
| | | try { |
| | | File file = new File(path); |
| | | Workbook workbook = Workbook.getWorkbook(file); |
| | | Sheet sheet = workbook.getSheet(0); |
| | | rows = sheet.getRows(); |
| | | |
| | | for(i = 3; i < rows; ++i) { |
| | | String tag_id = sheet.getCell(0, i).getContents(); |
| | | String jingdu = sheet.getCell(1, i).getContents(); |
| | | jingdu = todufen(jingdu.substring(0, 3), jingdu.substring(3, 5), jingdu.substring(5)); |
| | | String weidu = sheet.getCell(2, i).getContents(); |
| | | weidu = todufen(weidu.substring(0, 2), weidu.substring(2, 4), weidu.substring(4)); |
| | | if (!"".equals(tag_id)) { |
| | | tb_achor achor = new tb_achor(); |
| | | achor.setAnchorid(tag_id); |
| | | achor.setBaoliu6(jingdu); |
| | | achor.setBaoliu7(weidu); |
| | | result = this.labelService.anchorManagement_modifyaa(achor); |
| | | } |
| | | } |
| | | |
| | | workbook.close(); |
| | | } catch (BiffException var17) { |
| | | var17.printStackTrace(); |
| | | } catch (IOException var18) { |
| | | var18.printStackTrace(); |
| | | } |
| | | |
| | | request.setAttribute("resultList", result); |
| | | List<tb_tag> labelManagementList = this.labelService.getLabelManagement(1); |
| | | request.setAttribute("labelManagementList", labelManagementList); |
| | | int curPage = 1; |
| | | rows = this.labelService.getLabelManagementCount(); |
| | | i = PageUtil.getMinPage(rows); |
| | | request.setAttribute("pageList", PageUtil.getPage(i)); |
| | | request.setAttribute("curPage", Integer.valueOf(curPage)); |
| | | File file = new File(path); |
| | | file.delete(); |
| | | return toPage; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_export.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_export(HttpServletRequest request, HttpServletResponse response) { |
| | | String toPage = "forward:/hxzk/label/labelManagement.jsp"; |
| | | List<tb_tag> tb_tagList = labelService.getLabelManagement(); |
| | | String[] rowName = { "标签ID", "绑定对象", "电量%", "佩戴高度/cm", "速度限制cm/s", "定位频率(HZ)", "版本", "添加时间" }; |
| | | List<tb_tag> tb_tagList = this.labelService.getLabelManagement(); |
| | | String[] rowName = new String[]{"标签ID", "绑定对象", "电量%", "佩戴高度/cm", "速度限制cm/s", "定位频率(HZ)", "版本", "添加时间"}; |
| | | List<Object[]> dataList = objectToArray_labelManagement(tb_tagList); |
| | | ExcelUtils excel = new ExcelUtils("标签管理", rowName, dataList); |
| | | OutputStream out; |
| | | |
| | | try { |
| | | String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls"; |
| | | String headStr = "attachment; filename=\"" + fileName + "\""; |
| | | response.setContentType("APPLICATION/OCTET-STREAM"); |
| | | response.setHeader("Content-Disposition", headStr); |
| | | out = response.getOutputStream(); |
| | | OutputStream out = response.getOutputStream(); |
| | | excel.export(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | |
| | | return toPage; |
| | | } |
| | | |
| | | // tb_tag 导出表格 对象转数组 |
| | | public static List<Object[]> objectToArray_labelManagement(List<tb_tag> tb_tagList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < tb_tagList.size(); i++) { |
| | | List<String> words = new ArrayList<String>(); |
| | | tb_tag tag = (tb_tag) tb_tagList.get(i); |
| | | List<Object[]> reList = new ArrayList(); |
| | | |
| | | for(int i = 0; i < tb_tagList.size(); ++i) { |
| | | List<String> words = new ArrayList(); |
| | | tb_tag tag = (tb_tag)tb_tagList.get(i); |
| | | words.add(tag.getTag_id()); |
| | | words.add(tag.getState()); |
| | | words.add(tag.getPower()); |
| | |
| | | words.add(tag.getPinglv()); |
| | | words.add(tag.getVersion()); |
| | | words.add(tag.getAddtime()); |
| | | String[] array = words.toArray(new String[0]); |
| | | String[] array = (String[])words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | |
| | | return reList; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_tagid.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_tagid.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_tagid(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_tag> labelManagementList = labelService.getLabelManagement(); |
| | | List<String> reList = new ArrayList<String>(); |
| | | for (int i = 0; i < labelManagementList.size(); i++) { |
| | | reList.add(labelManagementList.get(i).getTag_id()); |
| | | List<tb_tag> labelManagementList = this.labelService.getLabelManagement(); |
| | | List<String> reList = new ArrayList(); |
| | | |
| | | for(int i = 0; i < labelManagementList.size(); ++i) { |
| | | reList.add(((tb_tag)labelManagementList.get(i)).getTag_id()); |
| | | } |
| | | |
| | | json.put("dataList", reList); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelManagement_more.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_more.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_more(HttpServletRequest request) { |
| | | tb_tag tag = new tb_tag(); |
| | | tag.setTag_id(request.getParameter("tag_id")); |
| | |
| | | tag.setPinglv(request.getParameter("pinglv")); |
| | | tag.setImu(request.getParameter("imu")); |
| | | tag.setDong_status(request.getParameter("dong_status")); |
| | | labelService.labelManagement_more(tag); |
| | | if (request.getParameter("tag_id").equals("ALL")) { |
| | | List<tb_tag> persons = this.labelService.getLabelManagement(); |
| | | |
| | | for(int i = 0; i < persons.size(); ++i) { |
| | | tag.setTag_id(((tb_tag)persons.get(i)).getTag_id()); |
| | | this.labelService.labelManagement_more(tag); |
| | | } |
| | | } else { |
| | | tag.setTag_id(request.getParameter("tag_id")); |
| | | this.labelService.labelManagement_more(tag); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelManagement_tag.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelManagement_tag.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_tag(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | String tagid = request.getParameter("tag_id"); |
| | |
| | | String hz = request.getParameter("hz"); |
| | | String result = ""; |
| | | List<tb_tag> tagList = null; |
| | | if (("ALL").equals(tagid)) { |
| | | tagList = labelService.getLabelManagement(); |
| | | if ("ALL".equals(tagid)) { |
| | | tagList = this.labelService.getLabelManagement(); |
| | | } |
| | | // 获取 port,wifi_mode |
| | | tb_wifi wifiManagement = anchorService.getWifiManagement(); |
| | | |
| | | tb_wifi wifiManagement = this.anchorService.getWifiManagement(); |
| | | String port = wifiManagement.getPort(); |
| | | String wifi_mode = wifiManagement.getModel(); |
| | | // 1.开启或者关闭标签休眠 |
| | | // 2.修改标签休眠时间 |
| | | // 3.修改标签的功率 |
| | | // 4.下发标签振动 |
| | | // 5.修改标签的频率 |
| | | // 6.修改加速度计阈值 |
| | | // 7.修改静止时间 |
| | | // 8.开启或者关闭标签振动功能 |
| | | if (("1").equals(tag)) { |
| | | // 1.开启或者关闭标签休眠 |
| | | int sleep_open = Integer.parseInt(hz); |
| | | ControTag.set_tag_sleep_open(sleep_open, tagid, tagList, port, wifi_mode); |
| | | int jck_move; |
| | | if ("1".equals(tag)) { |
| | | jck_move = Integer.parseInt(hz); |
| | | ControTag.set_tag_sleep_open(jck_move, tagid, tagList, port, wifi_mode); |
| | | result = "休眠指令已经下发完成!"; |
| | | } else if (("2").equals(tag)) { |
| | | // 2.修改标签休眠时间 |
| | | int sleeptime = Integer.parseInt(hz); |
| | | ControTag.set_tag_sleep_time(sleeptime, tagid, tagList, port, wifi_mode); |
| | | } else if ("2".equals(tag)) { |
| | | jck_move = Integer.parseInt(hz); |
| | | ControTag.set_tag_sleep_time(jck_move, tagid, tagList, port, wifi_mode); |
| | | result = "休眠时间修改指令下发完成!"; |
| | | } else if (("3").equals(tag)) { |
| | | // 3.修改标签的功率 |
| | | int gonglv = Integer.parseInt(hz); |
| | | ControTag.set_tag_gonglv(gonglv, tagid, tagList, port, wifi_mode); |
| | | } else if ("3".equals(tag)) { |
| | | jck_move = Integer.parseInt(hz); |
| | | ControTag.set_tag_gonglv(jck_move, tagid, tagList, port, wifi_mode); |
| | | result = "功率修改指令下发完成!"; |
| | | } else if (("4").equals(tag)) { |
| | | // 4.下发标签振动 |
| | | if (hz == null || ("").equals(hz)) { |
| | | result = "振动时间不能为空!"; |
| | | } else { |
| | | int time = Integer.parseInt(hz); |
| | | if (time > 255) { |
| | | } else if ("4".equals(tag)) { |
| | | if (hz != null && !"".equals(hz)) { |
| | | jck_move = Integer.parseInt(hz); |
| | | if (jck_move > 255) { |
| | | result = "振动时间为0~255秒!"; |
| | | } else { |
| | | ControTag.set_tag_zhendong(time, tagid, tagList, port, wifi_mode); |
| | | ControTag.set_tag_zhendong(jck_move, tagid, tagList, port, wifi_mode); |
| | | result = "振动指令已下发完毕!"; |
| | | } |
| | | } else { |
| | | result = "振动时间不能为空!"; |
| | | } |
| | | } else if (("5").equals(tag)) { |
| | | // 5.修改标签的频率 |
| | | } else if ("5".equals(tag)) { |
| | | ControTag.set_tag_hz(hz, tagid, tagList, port, wifi_mode); |
| | | result = "修改频率指令已下发完毕!"; |
| | | } else if (("6").equals(tag)) { |
| | | // 6.修改加速度计阈值 |
| | | int yuzhi = Integer.parseInt(hz); |
| | | ControTag.set_tag_jiasu(yuzhi, tagid, tagList, port, wifi_mode); |
| | | } else if ("6".equals(tag)) { |
| | | jck_move = Integer.parseInt(hz); |
| | | ControTag.set_tag_jiasu(jck_move, tagid, tagList, port, wifi_mode); |
| | | result = "修改加速度计阈值指令下发完成!"; |
| | | } else if (("7").equals(tag)) { |
| | | // 7.修改静止时间 |
| | | int time = Integer.parseInt(hz); |
| | | ControTag.set_tag_jingzhi(time, tagid, tagList, port, wifi_mode); |
| | | } else if ("7".equals(tag)) { |
| | | jck_move = Integer.parseInt(hz); |
| | | ControTag.set_tag_jingzhi(jck_move, tagid, tagList, port, wifi_mode); |
| | | result = "静止时间修改指令下发完成!"; |
| | | } else if (("8").equals(tag)) { |
| | | // 8.开启或者关闭标签振动功能 |
| | | int jck_move = Integer.parseInt(hz); |
| | | } else if ("8".equals(tag)) { |
| | | jck_move = Integer.parseInt(hz); |
| | | ControTag.set_tag_move(jck_move, tagid, tagList, port, wifi_mode); |
| | | if (jck_move == 1) { |
| | | result = "开启振动改指令下发完成!"; |
| | |
| | | result = "关闭振动指令下发完成!"; |
| | | } |
| | | } |
| | | |
| | | json.put("result", result); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelDeliver.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelDeliver.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelDeliver(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/labelDeliver.jsp"; |
| | | List<tb_department> department = basicInfoService.getAllDepartmentManagement(); |
| | | List<tb_department> department = this.basicInfoService.getAllDepartmentManagement(); |
| | | request.setAttribute("department", department); |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelDeliver_add.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelDeliver_add.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelDeliver_add(HttpServletRequest request) { |
| | | String p_tagid = request.getParameter("p_tagid"); |
| | | String p_name = request.getParameter("p_name"); |
| | |
| | | person.setP_sos(p_sos); |
| | | person.setP_online(p_online); |
| | | person.setP_power(p_power); |
| | | int exist = labelService.labelDeliver_exist(p_tagid); |
| | | int exist = this.labelService.labelDeliver_exist(p_tagid); |
| | | if (exist > 0) { |
| | | labelService.labelDeliver_modify(person); |
| | | this.labelService.labelDeliver_modify(person); |
| | | } else { |
| | | labelService.labelDeliver_add(person); |
| | | this.labelService.labelDeliver_add(person); |
| | | } |
| | | labelService.labelManagement_state(p_name, p_tagid); |
| | | |
| | | this.labelService.labelManagement_state(p_name, p_tagid); |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelDeliver_remove.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelDeliver_remove.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelDeliver_remove(HttpServletRequest request) { |
| | | String p_tagid = request.getParameter("p_tagid"); |
| | | String p_name = "未绑定"; |
| | |
| | | person.setP_department(request.getParameter("p_department")); |
| | | person.setP_idcardnum(request.getParameter("p_idcardnum")); |
| | | person.setP_adress(request.getParameter("p_adress")); |
| | | int exist = labelService.labelDeliver_exist(p_tagid); |
| | | int exist = this.labelService.labelDeliver_exist(p_tagid); |
| | | if (exist > 0) { |
| | | labelService.labelDeliver_modify(person); |
| | | labelService.labelManagement_state(p_name, p_tagid); |
| | | this.labelService.labelDeliver_modify(person); |
| | | this.labelService.labelManagement_state(p_name, p_tagid); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelDeliver_conn.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelDeliver_conn.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelDeliver_conn(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_adress_and_port> adress_and_port = labelService.getAdress_and_port(); |
| | | List<tb_adress_and_port> adress_and_port = this.labelService.getAdress_and_port(); |
| | | String result = "0"; |
| | | String state = IDcard.chushi(adress_and_port); |
| | | if (("发卡设备准备就绪...").equals(state)) { |
| | | if ("发卡设备准备就绪...".equals(state)) { |
| | | result = "1"; |
| | | } |
| | | |
| | | json.put("result", result); |
| | | json.put("port", adress_and_port.get(0).getPort()); |
| | | json.put("btl", adress_and_port.get(0).getBaoliu()); |
| | | json.put("port", ((tb_adress_and_port)adress_and_port.get(0)).getPort()); |
| | | json.put("btl", ((tb_adress_and_port)adress_and_port.get(0)).getBaoliu()); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelDeliver_readIDcard.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelDeliver_readIDcard.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelDeliver_readIDcard(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_adress_and_port> adress_and_port = labelService.getAdress_and_port(); |
| | | String result; |
| | | List<tb_adress_and_port> adress_and_port = this.labelService.getAdress_and_port(); |
| | | String state = IDcard.chushi(adress_and_port); |
| | | String idcard = ""; |
| | | String imageStr = ""; |
| | | if (("发卡设备准备就绪...").equals(state)) { |
| | | int i = 0; |
| | | // 卡认证 |
| | | while (i < 3) { |
| | | String result; |
| | | if ("发卡设备准备就绪...".equals(state)) { |
| | | int i; |
| | | for(i = 0; i < 3; ++i) { |
| | | boolean rz = IDcard.CVR_Authenticate(); |
| | | if (rz) { |
| | | i = 8; |
| | | System.out.println("卡认证成功..."); |
| | | break; |
| | | } else { |
| | | try { |
| | | Thread.sleep(3000); |
| | | } catch (InterruptedException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | System.out.println(i + "请放身份证..."); |
| | | result = i + "请放身份证..."; |
| | | i++; |
| | | } |
| | | |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException var12) { |
| | | var12.printStackTrace(); |
| | | } |
| | | |
| | | System.out.println(i + "请放身份证..."); |
| | | result = i + "请放身份证..."; |
| | | } |
| | | |
| | | if (i == 8) { |
| | |
| | | idcard = IDcard.address + "_"; |
| | | idcard = IDcard.fazhengjiguan; |
| | | } |
| | | |
| | | try { |
| | | bmpToJPG.bmp2jpg(); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } catch (IOException var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | // 身份证照片 |
| | | // image.setIcon(bmpToJPG.getImages()); |
| | | |
| | | ImageIcon images = bmpToJPG.getImages(); |
| | | Image image = images.getImage(); |
| | | imageStr = image.toString(); |
| | |
| | | } else { |
| | | result = "发卡设备状态不正常!请先连接设备..."; |
| | | } |
| | | |
| | | json.put("idcard", idcard); |
| | | json.put("result", result); |
| | | json.put("image", imageStr); |
| | | return json.toString(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labelDeliver_readPoscard.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelDeliver_readPoscard.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelDeliver_readPoscard(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_adress_and_port> adress_and_port = labelService.getAdress_and_port(); |
| | | List<tb_adress_and_port> adress_and_port = this.labelService.getAdress_and_port(); |
| | | String rfidnum = ""; |
| | | if(IDcard.M1_MF_HL_Request(adress_and_port)==144) { |
| | | rfidnum=String.valueOf(IDcard.kaohao); |
| | | }; |
| | | if (IDcard.M1_MF_HL_Request(adress_and_port) == 144) { |
| | | rfidnum = String.valueOf(IDcard.kaohao); |
| | | } |
| | | |
| | | json.put("rfidnum", rfidnum); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/labelDeliver_savePort.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labelDeliver_savePort.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelDeliver_savePort(HttpServletRequest request) throws IOException { |
| | | String p_port = request.getParameter("p_port"); |
| | | String p_btl = request.getParameter("p_btl"); |
| | |
| | | port.setBaoliu(p_port); |
| | | port.setBaoliu2(p_btl); |
| | | port.setName("faka "); |
| | | labelService.updateAdress_and_port(port); |
| | | this.labelService.updateAdress_and_port(port); |
| | | } |
| | | |
| | | @RequestMapping(value = "/realTimePower.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/realTimePower.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String realTimePower(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/realTimePower.jsp"; |
| | | List<tb_tagpower> realTimePowerList = labelService.getRealTimePower(1); |
| | | List<tb_tagpower> realTimePowerList = this.labelService.getRealTimePower(1); |
| | | request.setAttribute("realTimePowerList", realTimePowerList); |
| | | int curPage = 1; |
| | | int count = labelService.getRealTimePowerCount(); |
| | | int count = this.labelService.getRealTimePowerCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | request.setAttribute("pageList", PageUtil.getPage(minPage)); |
| | | request.setAttribute("curPage", curPage); |
| | | request.setAttribute("curPage", Integer.valueOf(curPage)); |
| | | return toPage; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/realTimePower_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/realTimePower_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String realTimePower_search(HttpServletRequest request) { |
| | | String input = request.getParameter("input"); |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | List<vo_tp_t_p> realTimePowerList = labelService.searchRealTimePower(input); |
| | | List<Integer> pageList = new ArrayList(); |
| | | List<vo_tp_t_p> realTimePowerList = this.labelService.searchRealTimePower(input); |
| | | pageList.add(1); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", realTimePowerList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/realTimePower_page.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/realTimePower_page.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String realTimePower_page(HttpServletRequest request) { |
| | | String pageStr = request.getParameter("page"); |
| | | String curPageStr = request.getParameter("curPage"); |
| | | int count = labelService.getRealTimePowerCount(); |
| | | int count = this.labelService.getRealTimePowerCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | int curPage = Integer.parseInt(curPageStr); |
| | | int page = 1; |
| | |
| | | } else { |
| | | page = Integer.parseInt(pageStr); |
| | | } |
| | | List<tb_tagpower> realTimePowerList = labelService.getRealTimePower(page); |
| | | |
| | | List<tb_tagpower> realTimePowerList = this.labelService.getRealTimePower(page); |
| | | List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", realTimePowerList); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/realTimePower_export.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/realTimePower_export.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String realTimePower_export(HttpServletRequest request, HttpServletResponse response) { |
| | | String toPage = "forward:/hxzk/label/realTimePower.jsp"; |
| | | List<vo_tp_t_p> realTimePowerList = labelService.getRealTimePower(); |
| | | String[] rowName = { "姓名", "标签ID", "标签频率(HZ)", "电量%", "更新时间" }; |
| | | List<vo_tp_t_p> realTimePowerList = this.labelService.getRealTimePower(); |
| | | String[] rowName = new String[]{"姓名", "标签ID", "标签频率(HZ)", "电量%", "更新时间"}; |
| | | List<Object[]> dataList = objectToArray_realTimePower(realTimePowerList); |
| | | ExcelUtils excel = new ExcelUtils("实时电量", rowName, dataList); |
| | | OutputStream out; |
| | | |
| | | try { |
| | | String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls"; |
| | | String headStr = "attachment; filename=\"" + fileName + "\""; |
| | | response.setContentType("APPLICATION/OCTET-STREAM"); |
| | | response.setHeader("Content-Disposition", headStr); |
| | | out = response.getOutputStream(); |
| | | OutputStream out = response.getOutputStream(); |
| | | excel.export(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | |
| | | return toPage; |
| | | } |
| | | |
| | | // vo_tp_t_p 导出表格 对象转数组 |
| | | public static List<Object[]> objectToArray_realTimePower(List<vo_tp_t_p> vo_tp_t_pList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < vo_tp_t_pList.size(); i++) { |
| | | List<String> words = new ArrayList<String>(); |
| | | vo_tp_t_p tp_t_p = (vo_tp_t_p) vo_tp_t_pList.get(i); |
| | | List<Object[]> reList = new ArrayList(); |
| | | |
| | | for(int i = 0; i < vo_tp_t_pList.size(); ++i) { |
| | | List<String> words = new ArrayList(); |
| | | vo_tp_t_p tp_t_p = (vo_tp_t_p)vo_tp_t_pList.get(i); |
| | | words.add(tp_t_p.getP_name()); |
| | | words.add(tp_t_p.getTagid()); |
| | | words.add(tp_t_p.getPinglv()); |
| | | words.add(tp_t_p.getPower()); |
| | | words.add(tp_t_p.getTime()); |
| | | String[] array = words.toArray(new String[0]); |
| | | String[] array = (String[])words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | |
| | | return reList; |
| | | } |
| | | |
| | | @RequestMapping(value = "/historicalPower.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/historicalPower.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String historicalPower(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/historicalPower.jsp"; |
| | | List<tb_history_power> historicalPowerList = labelService.getHistoricalPower(1); |
| | | List<tb_history_power> historicalPowerList = this.labelService.getHistoricalPower(1); |
| | | request.setAttribute("historicalPowerList", historicalPowerList); |
| | | int curPage = 1; |
| | | int count = labelService.getHistoricalPowerCount(); |
| | | int count = this.labelService.getHistoricalPowerCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | request.setAttribute("pageList", PageUtil.getPage(minPage)); |
| | | request.setAttribute("curPage", curPage); |
| | | request.setAttribute("curPage", Integer.valueOf(curPage)); |
| | | return toPage; |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/historicalPower_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/historicalPower_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String historicalPower_search(HttpServletRequest request) { |
| | | String input = request.getParameter("input"); |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | List<tb_history_power> historicalPowerList = labelService.searchHistoricalPower(input); |
| | | List<Integer> pageList = new ArrayList(); |
| | | List<tb_history_power> historicalPowerList = this.labelService.searchHistoricalPower(input); |
| | | pageList.add(1); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", historicalPowerList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/historicalPower_powerAnalysis.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/historicalPower_searchname.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String historicalPower_searchname(HttpServletRequest request) { |
| | | String begin = request.getParameter("begin"); |
| | | String end = request.getParameter("end"); |
| | | String tagida = request.getParameter("tagida"); |
| | | System.out.print(begin + "-----" + end + "--------" + tagida); |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList(); |
| | | List<tb_history_power> historicalPowerList = this.labelService.searchnameHistoricalPower(begin, end, tagida); |
| | | System.out.print(historicalPowerList.get(0)); |
| | | pageList.add(1); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", historicalPowerList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"/historicalPower_powerAnalysis.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String historicalPower_powerAnalysis(HttpServletRequest request) throws Exception { |
| | | String input = request.getParameter("input"); |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | List<tb_history_power> historicalPowerList = labelService.searchPowerAnalysis(input); |
| | | List<Integer> pageList = new ArrayList(); |
| | | List<tb_history_power> historicalPowerList = this.labelService.searchPowerAnalysis(input); |
| | | String sysPath = request.getServletContext().getRealPath("/"); |
| | | LineXy.getJFreeChart_hp(input, historicalPowerList,sysPath); |
| | | LineXy.getJFreeChart_hp(input, historicalPowerList, sysPath); |
| | | pageList.add(1); |
| | | JSONObject json = new JSONObject(); |
| | | String filePath = "hxzk/image/powerAnalysis/" + input + "电量分析.jpeg"; |
| | | json.put("dataList", historicalPowerList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | json.put("path", filePath); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/historicalPower_page.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/historicalPower_page.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String historicalPower_page(HttpServletRequest request) { |
| | | String pageStr = request.getParameter("page"); |
| | | String curPageStr = request.getParameter("curPage"); |
| | | int count = labelService.getHistoricalPowerCount(); |
| | | int count = this.labelService.getHistoricalPowerCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | int curPage = Integer.parseInt(curPageStr); |
| | | int page = 1; |
| | |
| | | } else { |
| | | page = Integer.parseInt(pageStr); |
| | | } |
| | | List<tb_history_power> historicalPowerList = labelService.getHistoricalPower(page); |
| | | |
| | | List<tb_history_power> historicalPowerList = this.labelService.getHistoricalPower(page); |
| | | List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", historicalPowerList); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/historicalPower_delete.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/historicalPower_delete.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void historicalPower_delete(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | labelService.historicalPower_delete(checkVal); |
| | | this.labelService.historicalPower_delete(checkVal); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/historicalPower_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/historicalPower_deleteAll.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void historicalPower_deleteAll(HttpServletRequest request) { |
| | | labelService.historicalPower_deleteAll(); |
| | | this.labelService.historicalPower_deleteAll(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/historicalPower_export.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/historicalPower_export.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String historicalPower_export(HttpServletRequest request, HttpServletResponse response) { |
| | | String toPage = "forward:/hxzk/label/historicalPower.jsp"; |
| | | List<tb_history_power> historicalPowerList = labelService.getHistoricalPower(); |
| | | String[] rowName = { "序号", "标签ID", "电量%", "时间" }; |
| | | List<tb_history_power> historicalPowerList = this.labelService.getHistoricalPower(); |
| | | String[] rowName = new String[]{"序号", "标签ID", "电量%", "时间"}; |
| | | List<Object[]> dataList = objectToArray_historicalPower(historicalPowerList); |
| | | ExcelUtils excel = new ExcelUtils("历史电量", rowName, dataList); |
| | | OutputStream out; |
| | | |
| | | try { |
| | | String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls"; |
| | | String headStr = "attachment; filename=\"" + fileName + "\""; |
| | | response.setContentType("APPLICATION/OCTET-STREAM"); |
| | | response.setHeader("Content-Disposition", headStr); |
| | | out = response.getOutputStream(); |
| | | OutputStream out = response.getOutputStream(); |
| | | excel.export(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | |
| | | return toPage; |
| | | } |
| | | |
| | | // tb_history_power 导出表格 对象转数组 |
| | | public static List<Object[]> objectToArray_historicalPower(List<tb_history_power> history_powerList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < history_powerList.size(); i++) { |
| | | List<String> words = new ArrayList<String>(); |
| | | tb_history_power history_power = (tb_history_power) history_powerList.get(i); |
| | | List<Object[]> reList = new ArrayList(); |
| | | |
| | | for(int i = 0; i < history_powerList.size(); ++i) { |
| | | List<String> words = new ArrayList(); |
| | | tb_history_power history_power = (tb_history_power)history_powerList.get(i); |
| | | words.add(history_power.getId() + ""); |
| | | words.add(history_power.getTagid()); |
| | | words.add(history_power.getPower()); |
| | | words.add(history_power.getTime()); |
| | | String[] array = words.toArray(new String[0]); |
| | | String[] array = (String[])words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | |
| | | return reList; |
| | | } |
| | | |
| | | // 报文收取 改标签的状态和电量信息 |
| | | @RequestMapping(value = "/label_bw_power.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/label_bw_power.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void label_bw_power(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | // 显示sql |
| | | tb_tag tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | String sqlString = "UPDATE tb_tag SET power=" + tag.getPower() + " WHERE tag_id=" + tag.getTag_id(); |
| | | String messageJson = GetNowTime.timestamp2()+ " 收:"+ sqlString ; |
| | | (new StringBuilder()).append(GetNowTime.timestamp2()).append(" 收:").append(sqlString).toString(); |
| | | String BaowenPath = Config.getBaowenConfig(); |
| | | String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch"); |
| | | if (baowenStatus.equals("1")){ |
| | | /* Udp_Receive.mysqlMessage.add(messageJson); */ |
| | | if (baowenStatus.equals("1")) { |
| | | } |
| | | // |
| | | labelService.label_bw_power(tag); |
| | | |
| | | this.labelService.label_bw_power(tag); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/labeltag_id_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/labeltag_id_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int labeltag_id_search(HttpServletRequest request) throws IOException { |
| | | JSONObject json = new JSONObject(); |
| | | String tag_id = request.getParameter("tag_id"); |
| | | List<tb_tag> labelManagementList = null; |
| | | int nn; |
| | | if (("").equals(tag_id) || tag_id == null) { |
| | | if (!"".equals(tag_id) && tag_id != null) { |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList(); |
| | | labelManagementList = this.labelService.searchLabelManagement(tag_id); |
| | | pageList.add(1); |
| | | json.put("dataList", labelManagementList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | } else { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | tb_tag tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class); |
| | | tag_id = tag.getTag_id(); |
| | | labelManagementList = labelService.searchLabelManagement(tag_id); |
| | | labelManagementList = this.labelService.searchLabelManagement(tag_id); |
| | | if (labelManagementList.size() > 0) { |
| | | json.put("result", labelManagementList.get(0)); |
| | | } else { |
| | | json.put("result", "null"); |
| | | } |
| | | } |
| | | |
| | | byte nn; |
| | | if (null != labelManagementList && labelManagementList.size() != 0) { |
| | | nn = 1; |
| | | } else { |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | labelManagementList = labelService.searchLabelManagement(tag_id); |
| | | pageList.add(1); |
| | | json.put("dataList", labelManagementList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | nn = 0; |
| | | } |
| | | if(null == labelManagementList || labelManagementList.size() ==0 ) { |
| | | nn=0; |
| | | }else { |
| | | nn=1; |
| | | } |
| | | |
| | | return nn; |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"/toaddTask.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String toaddTask(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/addTask.jsp"; |
| | | List<tb_map> maps = this.mapService.getMapManagement(); |
| | | request.setAttribute("mapList", maps); |
| | | return toPage; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"getMapFence.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String getMapFence(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | String map = request.getParameter("value"); |
| | | List<tb_fence> fences = this.fenceService.searchFenceLista(map); |
| | | json.put("fenceList", fences); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping( |
| | | value = {"shailabel.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String shailabel(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | String leixing = request.getParameter("leixing"); |
| | | String bumen = request.getParameter("bumen"); |
| | | List<tb_tag> tags = new ArrayList(); |
| | | List tags1; |
| | | List tags2; |
| | | List tags3; |
| | | List tags4; |
| | | List tags5; |
| | | List tags6; |
| | | int i; |
| | | if (!leixing.equals("全部") && !bumen.equals("全部")) { |
| | | if (leixing.equals("人员标签")) { |
| | | tags1 = this.labelService.shailabel1("系统默认", bumen); |
| | | tags2 = this.labelService.shailabel1("融合终端", bumen); |
| | | tags3 = this.labelService.shailabel1("心率带屏", bumen); |
| | | tags4 = this.labelService.shailabel1("工牌标签", bumen); |
| | | tags5 = this.labelService.shailabel1("安全帽标签", bumen); |
| | | tags6 = this.labelService.shailabel1("URT+CO", bumen); |
| | | if (tags2.size() > 0) { |
| | | for(i = 0; i < tags2.size(); ++i) { |
| | | tags1.add(tags2.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags3.size() > 0) { |
| | | for(i = 0; i < tags3.size(); ++i) { |
| | | tags1.add(tags3.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags4.size() > 0) { |
| | | for(i = 0; i < tags4.size(); ++i) { |
| | | tags1.add(tags4.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags5.size() > 0) { |
| | | for(i = 0; i < tags5.size(); ++i) { |
| | | tags1.add(tags5.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags6.size() > 0) { |
| | | for(i = 0; i < tags6.size(); ++i) { |
| | | tags1.add(tags6.get(i)); |
| | | } |
| | | } |
| | | |
| | | tags = tags1; |
| | | } else if (leixing.equals("车辆标签")) { |
| | | tags1 = this.labelService.shailabel1("车载带屏", bumen); |
| | | tags2 = this.labelService.shailabel1("车载无屏", bumen); |
| | | if (tags2.size() > 0) { |
| | | for(i = 0; i < tags2.size(); ++i) { |
| | | tags1.add(tags2.get(i)); |
| | | } |
| | | } |
| | | |
| | | tags = tags1; |
| | | } else if (leixing.equals("物资标签")) { |
| | | tags = this.labelService.shailabel1("物资标签", bumen); |
| | | } |
| | | } else if (leixing.equals("全部")) { |
| | | tags = this.labelService.shailabel2(bumen); |
| | | } else if (bumen.equals("全部")) { |
| | | if (leixing.equals("人员标签")) { |
| | | tags1 = this.labelService.shailabel3("系统默认"); |
| | | tags2 = this.labelService.shailabel3("融合终端"); |
| | | tags3 = this.labelService.shailabel3("心率带屏"); |
| | | tags4 = this.labelService.shailabel3("工牌标签"); |
| | | tags5 = this.labelService.shailabel3("安全帽标签"); |
| | | tags6 = this.labelService.shailabel1("URT+CO", bumen); |
| | | if (tags2.size() > 0) { |
| | | for(i = 0; i < tags2.size(); ++i) { |
| | | tags1.add(tags2.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags3.size() > 0) { |
| | | for(i = 0; i < tags3.size(); ++i) { |
| | | tags1.add(tags3.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags4.size() > 0) { |
| | | for(i = 0; i < tags4.size(); ++i) { |
| | | tags1.add(tags4.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags5.size() > 0) { |
| | | for(i = 0; i < tags5.size(); ++i) { |
| | | tags1.add(tags5.get(i)); |
| | | } |
| | | } |
| | | |
| | | if (tags6.size() > 0) { |
| | | for(i = 0; i < tags6.size(); ++i) { |
| | | tags1.add(tags6.get(i)); |
| | | } |
| | | } |
| | | |
| | | tags = tags1; |
| | | } else if (leixing.equals("车辆标签")) { |
| | | tags1 = this.labelService.shailabel3("车载带屏"); |
| | | tags2 = this.labelService.shailabel3("车载无屏"); |
| | | if (tags2.size() > 0) { |
| | | for(i = 0; i < tags2.size(); ++i) { |
| | | tags1.add(tags2.get(i)); |
| | | } |
| | | } |
| | | |
| | | tags = tags1; |
| | | } else if (leixing.equals("物资标签")) { |
| | | tags = this.labelService.shailabel3("物资标签"); |
| | | } |
| | | } |
| | | |
| | | json.put("dataList", tags); |
| | | return json.toString(); |
| | | } |
| | | |
| | | public static String todufen(String Du, String Fen, String Miao) { |
| | | Float strDu = Float.valueOf(Du); |
| | | Float strFen = Float.valueOf(Fen) / 60.0F; |
| | | Float strMiao = Float.valueOf(Miao) / 60.0F; |
| | | Float dufenmiao = strDu + strFen + strMiao; |
| | | String format = String.format("%.6f", dufenmiao); |
| | | return format; |
| | | } |
| | | |
| | | public static boolean isLetterDigit(String str) { |
| | | String regex = "^[a-z0-9A-Z]+$"; |
| | | return str.matches(regex); |
| | | } |
| | | } |