From 70223b3ef4df02622869425fed4ba9b290e1aa74 Mon Sep 17 00:00:00 2001 From: fei.wang <wf18701153496@163.com> Date: 星期二, 16 四月 2024 14:07:59 +0800 Subject: [PATCH] V定制1.0 1:对讲功能 2:计算经纬度控制器systemcontrollen --- src/main/java/com/hxzk/controller/HkSxtController.java | 42 +++++++++++++++++++++++++++++++++--------- 1 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/hxzk/controller/HkSxtController.java b/src/main/java/com/hxzk/controller/HkSxtController.java index 5a10461..e68b8b5 100644 --- a/src/main/java/com/hxzk/controller/HkSxtController.java +++ b/src/main/java/com/hxzk/controller/HkSxtController.java @@ -3,6 +3,7 @@ import com.github.pagehelper.PageInfo; import com.hxzk.pojo.TbHksxt; import com.hxzk.pojo.TbShipin; +import com.hxzk.service.FenceService; import com.hxzk.service.HkSxtService; import com.hxzk.service.ShiPinService; import com.hxzk.udp.Udp_Out; @@ -10,8 +11,10 @@ import com.hxzk.util.resultutil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -27,23 +30,44 @@ @Autowired HkSxtService hkSxtService; + + @Autowired + FenceService fenceService; @GetMapping("findhk") result<List<TbHksxt>> findhk(Integer page, Integer limit){ PageInfo<TbHksxt> cz= hkSxtService.findAll(page, limit); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } - - @GetMapping("addHk") - public void addHk(TbHksxt hksxt, HttpServletResponse response) throws IOException { - String xieyi = "BSTOCS1,ADD,HKSXT,"+hksxt.getIp()+","+hksxt.getPort()+","+hksxt.getUsername()+","+hksxt.getPassword()+","+hksxt.getShebeiport()+",END"; - Udp_Out.udp_to_cs(xieyi); - response.sendRedirect("/hxzkuwb/HouTai/JianKongPeiZhi/JianKongPeiZhi.jsp"); + @PostMapping({"HksxtSearch"}) + public result<List<TbHksxt>> tableSearch(TbHksxt manager, int page, int limit) throws Exception { + PageInfo<TbHksxt> cz = this.hkSxtService.tableSearch(manager, page, limit); + return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } - @GetMapping("updateHk") - public void updateHk(TbHksxt hksxt,HttpServletResponse response) throws IOException { - String xieyi = "BSTOCS1,ALTER,HKSXT,"+hksxt.getIp()+","+hksxt.getPort()+","+hksxt.getUsername()+","+hksxt.getPassword()+","+hksxt.getShebeiport()+",END"; + @PostMapping("addHk") + public ModelAndView addHk(TbHksxt hksxt, HttpServletResponse response) throws Exception { + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + hksxt.setEnterdate(formatter.format(date)); + String xieyi = "BSTOCS1,ADD,HKSXT,"+hksxt.getIp()+","+hksxt.getPort()+","+hksxt.getUsername()+","+hksxt.getPassword()+","+hksxt.getShebeiport()+","+hksxt.getEnterdate()+hksxt.getBindregion()+",END"; Udp_Out.udp_to_cs(xieyi); response.sendRedirect("/hxzkuwb/HouTai/JianKongPeiZhi/JianKongPeiZhi.jsp"); + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("/hxzkuwb/HouTai/JianKongPeiZhi/JianKongPeiZhi.jsp"); + modelAndView.addObject("suoshu", fenceService.findSuoShu()); + return modelAndView; + } + @PostMapping("updateHk") + public ModelAndView updateHk(TbHksxt hksxt,HttpServletResponse response) throws Exception { + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + hksxt.setEnterdate(formatter.format(date)); + String xieyi = "BSTOCS1,ALTER,HKSXT,"+hksxt.getIp()+","+hksxt.getPort()+","+hksxt.getUsername()+","+hksxt.getPassword()+","+hksxt.getShebeiport()+","+hksxt.getEnterdate()+hksxt.getBindregion()+",END"; + Udp_Out.udp_to_cs(xieyi); + response.sendRedirect("/hxzkuwb/HouTai/JianKongPeiZhi/JianKongPeiZhi.jsp"); + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("/HouTai/JianKongPeiZhi/JianKongPeiZhi.jsp"); + modelAndView.addObject("suoshu", fenceService.findSuoShu()); + return modelAndView; } @GetMapping("deleteHk") public void deleteHk(String name){ -- Gitblit v1.9.3