// // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // package com.hxzkoa.controller; 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.tb_wifi; 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.bmpToJPG; import com.hxzkoa.util.Config; import com.hxzkoa.util.ExcelUtils; 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 { @Autowired private LabelService labelService; @Autowired 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} ) 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"; Udp_Out.udp_to_cs(xieyi); } @ResponseBody @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"; Udp_Out.udp_to_cs(xieyi); } @ResponseBody @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"; Udp_Out.udp_to_cs(xieyi); } @ResponseBody @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"; Udp_Out.udp_to_cs(xieyi); } @RequestMapping( value = {"/labelManagement.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String labelManagement(HttpServletRequest request) { String toPage = "forward:/hxzk/label/labelManagement.jsp"; List labelManagementList = this.labelService.getLabelManagement(1); List labelManagementListaa = this.labelService.getLabelManagementa(); List realAttendance_k = new ArrayList(); List departments = this.basicInfoService.getDepartmentManagement2(); for(int i = 0; i < departments.size(); ++i) { realAttendance_k.add(((tb_department)departments.get(i)).getDepartmentName()); } List 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 = this.labelService.getLabelManagementCount(); int minPage = PageUtil.getMinPage(count); request.setAttribute("pageList", PageUtil.getPage(minPage)); request.setAttribute("curPage", Integer.valueOf(curPage)); return toPage; } @ResponseBody @RequestMapping( value = {"/labelManagementa.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public JSONObject labelManagementa(HttpServletRequest request) { List 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 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 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) { 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 searchLabelManagement = this.labelService.searchLabelManagement(tag_id); if (searchLabelManagement.size() == 0) { 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() + "," + tag.getType() + ",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"); } } @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 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 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 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.setState(request.getParameter("state")); tag.setGaodu(request.getParameter("gaodu")); tag.setSudu(request.getParameter("sudu")); tag.setPinglv(request.getParameter("pinglv")); 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); List 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); } } @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 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 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 searchtagManagement = this.basicInfoService.searchPersonManagementa(tag.getTag_id()); int aaa = 0; if (searchtagManagement != null) { aaa = this.labelService.labelManagement_modifytag(tag); List 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 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 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 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")); this.labelService.labelManagement_modifyAll(tag); String xieyi = "BSTOCS1,ALTERALLTAG," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + ",END"; Udp_Out.udp_to_cs(xieyi); List labelList = this.labelService.getLabelManagement(); for(int i = 0; i < labelList.size(); ++i) { String tag_id = ((tb_tag)labelList.get(i)).getTag_id(); List 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); } } } @ResponseBody @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 labelList = this.labelService.getLabelManagement(); for(int i = 0; i < labelList.size(); ++i) { String tag_id = ((tb_tag)labelList.get(i)).getTag_id(); List 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(","); 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); } this.labelService.labelperson_delete(checkVal); } @ResponseBody @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) { this.labelService.labelManagement_deleteAll(); String xieyi = "BSTOCS1,DELETEALLTAG,END"; Udp_Out.udp_to_cs(xieyi); this.basicInfoService.personManagement_deleteAll(); } @ResponseBody @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"); List labelManagementList; if (!"".equals(input) && input != null) { int curPage = 1; List 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); input = tag.getTag_id(); labelManagementList = this.labelService.searchLabelManagement(input); if (labelManagementList.size() > 0) { json.put("result", labelManagementList.get(0)); } else { json.put("result", "null"); } } return json.toString(); } @ResponseBody @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 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 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 = this.labelService.getLabelManagementCount(); int minPage = PageUtil.getMinPage(count); int curPage = Integer.parseInt(curPageStr); int page = 1; if ("pre".equals(pageStr)) { if (curPage > 1) { page = curPage - 1; } } else if ("next".equals(pageStr)) { if (curPage < minPage) { page = curPage + 1; } } else { page = Integer.parseInt(pageStr); } List labelManagementList = this.labelService.getLabelManagement(page); List pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); JSONObject json = new JSONObject(); json.put("dataList", labelManagementList); json.put("pageList", pageList); json.put("curPage", page); return json.toString(); } @ResponseBody @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 labelTemplateList = this.labelService.getLabelManagement(1); String[] rowName = new String[]{"标签ID", "绑定对象"}; List dataList = labelTemplateobjectToArray(labelTemplateList); ExcelUtils excel = new ExcelUtils("标签管理", rowName, dataList); 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); OutputStream out = response.getOutputStream(); excel.export(out); out.flush(); out.close(); } catch (Exception var11) { var11.printStackTrace(); } return toPage; } public static List labelTemplateobjectToArray(List labelList) { List reList = new ArrayList(); for(int i = 0; i < labelList.size(); ++i) { List words = new ArrayList(); tb_tag tag = (tb_tag)labelList.get(i); words.add(tag.getTag_id()); words.add(tag.getState()); String[] array = (String[])words.toArray(new String[0]); reList.add(array); } return reList; } @ResponseBody @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[] fileNameArr = path.split("\\\\"); String fileName = fileNameArr[fileNameArr.length - 1]; path = "C:/hxzkoa/" + fileName; } int result = 0; try { File file = new File(path); Workbook workbook = Workbook.getWorkbook(file); Sheet sheet = workbook.getSheet(0); int rows = sheet.getRows(); 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 power = sheet.getCell(3, i).getContents(); String gaodu = sheet.getCell(4, 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)) { tb_tag tag = new tb_tag(); tag.setStatus(status); tag.setTag_id(tag_id); tag.setState(state); tag.setPower(power); tag.setGaodu(gaodu); tag.setSudu(sudu); tag.setPinglv(pinglv); tag.setVersion(version); this.labelService.labelManagement_add(tag); } } workbook.close(); } catch (BiffException var18) { var18.printStackTrace(); } catch (IOException var19) { var19.printStackTrace(); } JSONObject json = new JSONObject(); json.put("result", Integer.valueOf(result)); return json.toString(); } @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(); } 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 var20) { var20.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 state = sheet.getCell(1, i).getContents(); if (!"".equals(tag_id)) { List 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 var18) { var18.printStackTrace(); } catch (IOException var19) { var19.printStackTrace(); } System.out.print(result + "-------------"); request.setAttribute("resultList", Integer.valueOf(result)); List 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; } @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 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} ) public String labelManagement_export(HttpServletRequest request, HttpServletResponse response) { String toPage = "forward:/hxzk/label/labelManagement.jsp"; List tb_tagList = this.labelService.getLabelManagement(); String[] rowName = new String[]{"标签ID", "绑定对象", "电量%", "佩戴高度/cm", "速度限制cm/s", "定位频率(HZ)", "版本", "添加时间"}; List dataList = objectToArray_labelManagement(tb_tagList); ExcelUtils excel = new ExcelUtils("标签管理", rowName, dataList); 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); OutputStream out = response.getOutputStream(); excel.export(out); out.flush(); out.close(); } catch (Exception var11) { var11.printStackTrace(); } return toPage; } public static List objectToArray_labelManagement(List tb_tagList) { List reList = new ArrayList(); for(int i = 0; i < tb_tagList.size(); ++i) { List 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.getGaodu()); words.add(tag.getSudu()); words.add(tag.getPinglv()); words.add(tag.getVersion()); words.add(tag.getAddtime()); String[] array = (String[])words.toArray(new String[0]); reList.add(array); } return reList; } @ResponseBody @RequestMapping( value = {"/labelManagement_tagid.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String labelManagement_tagid(HttpServletRequest request) { JSONObject json = new JSONObject(); List labelManagementList = this.labelService.getLabelManagement(); List 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} ) public void labelManagement_more(HttpServletRequest request) { tb_tag tag = new tb_tag(); tag.setTag_id(request.getParameter("tag_id")); tag.setSleep_satus(request.getParameter("sleep_satus")); tag.setSleep_time(request.getParameter("sleep_time")); tag.setGongfang(request.getParameter("gongfang")); tag.setPinglv(request.getParameter("pinglv")); tag.setImu(request.getParameter("imu")); tag.setDong_status(request.getParameter("dong_status")); if (request.getParameter("tag_id").equals("ALL")) { List 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} ) public String labelManagement_tag(HttpServletRequest request) { JSONObject json = new JSONObject(); String tagid = request.getParameter("tag_id"); String tag = request.getParameter("tag"); String hz = request.getParameter("hz"); String result = ""; List tagList = null; if ("ALL".equals(tagid)) { tagList = this.labelService.getLabelManagement(); } tb_wifi wifiManagement = this.anchorService.getWifiManagement(); String port = wifiManagement.getPort(); String wifi_mode = wifiManagement.getModel(); 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)) { jck_move = Integer.parseInt(hz); ControTag.set_tag_sleep_time(jck_move, tagid, tagList, port, wifi_mode); result = "休眠时间修改指令下发完成!"; } 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)) { if (hz != null && !"".equals(hz)) { jck_move = Integer.parseInt(hz); if (jck_move > 255) { result = "振动时间为0~255秒!"; } else { ControTag.set_tag_zhendong(jck_move, tagid, tagList, port, wifi_mode); result = "振动指令已下发完毕!"; } } else { result = "振动时间不能为空!"; } } else if ("5".equals(tag)) { ControTag.set_tag_hz(hz, tagid, tagList, port, wifi_mode); result = "修改频率指令已下发完毕!"; } 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)) { jck_move = Integer.parseInt(hz); ControTag.set_tag_jingzhi(jck_move, tagid, tagList, port, wifi_mode); result = "静止时间修改指令下发完成!"; } 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 = "开启振动改指令下发完成!"; } else { result = "关闭振动指令下发完成!"; } } json.put("result", result); return json.toString(); } @RequestMapping( value = {"/labelDeliver.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String labelDeliver(HttpServletRequest request) { String toPage = "forward:/hxzk/label/labelDeliver.jsp"; List department = this.basicInfoService.getAllDepartmentManagement(); request.setAttribute("department", department); return toPage; } @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"); tb_person person = new tb_person(); String p_sos = "0"; String p_online = "0"; String p_power = "100"; person.setP_tagid(p_tagid); person.setP_name(p_name); person.setP_sex(request.getParameter("p_sex")); person.setP_minzu(request.getParameter("p_minzu")); person.setP_phone(request.getParameter("p_phone")); person.setP_department(request.getParameter("p_department")); person.setP_idcardnum(request.getParameter("p_idcardnum")); person.setP_adress(request.getParameter("p_adress")); person.setP_sos(p_sos); person.setP_online(p_online); person.setP_power(p_power); int exist = this.labelService.labelDeliver_exist(p_tagid); if (exist > 0) { this.labelService.labelDeliver_modify(person); } else { this.labelService.labelDeliver_add(person); } this.labelService.labelManagement_state(p_name, p_tagid); } @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 = "未绑定"; tb_person person = new tb_person(); person.setP_tagid(p_tagid); person.setP_name(p_name); person.setP_sex(request.getParameter("p_sex")); person.setP_minzu(request.getParameter("p_minzu")); person.setP_phone(request.getParameter("p_phone")); person.setP_department(request.getParameter("p_department")); person.setP_idcardnum(request.getParameter("p_idcardnum")); person.setP_adress(request.getParameter("p_adress")); int exist = this.labelService.labelDeliver_exist(p_tagid); if (exist > 0) { this.labelService.labelDeliver_modify(person); this.labelService.labelManagement_state(p_name, p_tagid); } } @ResponseBody @RequestMapping( value = {"/labelDeliver_conn.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String labelDeliver_conn(HttpServletRequest request) { JSONObject json = new JSONObject(); List adress_and_port = this.labelService.getAdress_and_port(); String result = "0"; String state = IDcard.chushi(adress_and_port); if ("发卡设备准备就绪...".equals(state)) { result = "1"; } json.put("result", result); 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} ) public String labelDeliver_readIDcard(HttpServletRequest request) { JSONObject json = new JSONObject(); List adress_and_port = this.labelService.getAdress_and_port(); String state = IDcard.chushi(adress_and_port); String idcard = ""; String imageStr = ""; 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; } try { Thread.sleep(3000L); } catch (InterruptedException var12) { var12.printStackTrace(); } System.out.println(i + "请放身份证..."); result = i + "请放身份证..."; } if (i == 8) { result = "卡认证成功..."; if (IDcard.RedaCard() == 1) { idcard = IDcard.name + "_"; idcard = IDcard.sex + "_"; idcard = IDcard.minzu + "_"; idcard = IDcard.chushengdate + "_"; idcard = IDcard.startdate + "-" + IDcard.jizhidate + "_"; idcard = IDcard.idnum + "_"; idcard = IDcard.address + "_"; idcard = IDcard.fazhengjiguan; } try { bmpToJPG.bmp2jpg(); } catch (IOException var11) { var11.printStackTrace(); } ImageIcon images = bmpToJPG.getImages(); Image image = images.getImage(); imageStr = image.toString(); } else { result = "卡认证失败..."; } } 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} ) public String labelDeliver_readPoscard(HttpServletRequest request) { JSONObject json = new JSONObject(); List 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); } json.put("rfidnum", rfidnum); return json.toString(); } @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"); tb_adress_and_port port = new tb_adress_and_port(); port.setBaoliu(p_port); port.setBaoliu2(p_btl); port.setName("faka "); this.labelService.updateAdress_and_port(port); } @RequestMapping( value = {"/realTimePower.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String realTimePower(HttpServletRequest request) { String toPage = "forward:/hxzk/label/realTimePower.jsp"; List realTimePowerList = this.labelService.getRealTimePower(1); request.setAttribute("realTimePowerList", realTimePowerList); int curPage = 1; int count = this.labelService.getRealTimePowerCount(); int minPage = PageUtil.getMinPage(count); request.setAttribute("pageList", PageUtil.getPage(minPage)); request.setAttribute("curPage", Integer.valueOf(curPage)); return toPage; } @ResponseBody @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 pageList = new ArrayList(); List realTimePowerList = this.labelService.searchRealTimePower(input); pageList.add(1); JSONObject json = new JSONObject(); json.put("dataList", realTimePowerList); json.put("pageList", pageList); json.put("curPage", Integer.valueOf(curPage)); return json.toString(); } @ResponseBody @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 = this.labelService.getRealTimePowerCount(); int minPage = PageUtil.getMinPage(count); int curPage = Integer.parseInt(curPageStr); int page = 1; if ("pre".equals(pageStr)) { if (curPage > 1) { page = curPage - 1; } } else if ("next".equals(pageStr)) { if (curPage < minPage) { page = curPage + 1; } } else { page = Integer.parseInt(pageStr); } List realTimePowerList = this.labelService.getRealTimePower(page); List pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); JSONObject json = new JSONObject(); json.put("dataList", realTimePowerList); json.put("pageList", pageList); json.put("curPage", page); return json.toString(); } @ResponseBody @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 realTimePowerList = this.labelService.getRealTimePower(); String[] rowName = new String[]{"姓名", "标签ID", "标签频率(HZ)", "电量%", "更新时间"}; List dataList = objectToArray_realTimePower(realTimePowerList); ExcelUtils excel = new ExcelUtils("实时电量", rowName, dataList); 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); OutputStream out = response.getOutputStream(); excel.export(out); out.flush(); out.close(); } catch (Exception var11) { var11.printStackTrace(); } return toPage; } public static List objectToArray_realTimePower(List vo_tp_t_pList) { List reList = new ArrayList(); for(int i = 0; i < vo_tp_t_pList.size(); ++i) { List 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 = (String[])words.toArray(new String[0]); reList.add(array); } return reList; } @RequestMapping( value = {"/historicalPower.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String historicalPower(HttpServletRequest request) { String toPage = "forward:/hxzk/label/historicalPower.jsp"; List historicalPowerList = this.labelService.getHistoricalPower(1); request.setAttribute("historicalPowerList", historicalPowerList); int curPage = 1; int count = this.labelService.getHistoricalPowerCount(); int minPage = PageUtil.getMinPage(count); request.setAttribute("pageList", PageUtil.getPage(minPage)); request.setAttribute("curPage", Integer.valueOf(curPage)); return toPage; } @ResponseBody @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 pageList = new ArrayList(); List historicalPowerList = this.labelService.searchHistoricalPower(input); 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_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 pageList = new ArrayList(); List 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 pageList = new ArrayList(); List historicalPowerList = this.labelService.searchPowerAnalysis(input); String sysPath = request.getServletContext().getRealPath("/"); 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", Integer.valueOf(curPage)); json.put("path", filePath); return json.toString(); } @ResponseBody @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 = this.labelService.getHistoricalPowerCount(); int minPage = PageUtil.getMinPage(count); int curPage = Integer.parseInt(curPageStr); int page = 1; if ("pre".equals(pageStr)) { if (curPage > 1) { page = curPage - 1; } } else if ("next".equals(pageStr)) { if (curPage < minPage) { page = curPage + 1; } } else { page = Integer.parseInt(pageStr); } List historicalPowerList = this.labelService.getHistoricalPower(page); List pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); JSONObject json = new JSONObject(); json.put("dataList", historicalPowerList); json.put("pageList", pageList); json.put("curPage", page); return json.toString(); } @ResponseBody @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(","); this.labelService.historicalPower_delete(checkVal); } @ResponseBody @RequestMapping( value = {"/historicalPower_deleteAll.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public void historicalPower_deleteAll(HttpServletRequest request) { this.labelService.historicalPower_deleteAll(); } @ResponseBody @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 historicalPowerList = this.labelService.getHistoricalPower(); String[] rowName = new String[]{"序号", "标签ID", "电量%", "时间"}; List dataList = objectToArray_historicalPower(historicalPowerList); ExcelUtils excel = new ExcelUtils("历史电量", rowName, dataList); 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); OutputStream out = response.getOutputStream(); excel.export(out); out.flush(); out.close(); } catch (Exception var11) { var11.printStackTrace(); } return toPage; } public static List objectToArray_historicalPower(List history_powerList) { List reList = new ArrayList(); for(int i = 0; i < history_powerList.size(); ++i) { List 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 = (String[])words.toArray(new String[0]); reList.add(array); } return reList; } @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); String sqlString = "UPDATE tb_tag SET power=" + tag.getPower() + " WHERE tag_id=" + tag.getTag_id(); (new StringBuilder()).append(GetNowTime.timestamp2()).append(" 收:").append(sqlString).toString(); String BaowenPath = Config.getBaowenConfig(); String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch"); if (baowenStatus.equals("1")) { } this.labelService.label_bw_power(tag); } @ResponseBody @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 labelManagementList = null; if (!"".equals(tag_id) && tag_id != null) { int curPage = 1; List 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); tag_id = tag.getTag_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 { nn = 0; } return nn; } @RequestMapping( value = {"/toaddTask.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String toaddTask(HttpServletRequest request) { String toPage = "forward:/hxzk/label/addTask.jsp"; List 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 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 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); } }