From b72f8f8d58417eb6fb29672d8ac17cfafa46775c Mon Sep 17 00:00:00 2001 From: zhitong.yu <xynz17@163.com> Date: 星期六, 11 五月 2024 10:51:31 +0800 Subject: [PATCH] 增加:主界面选择系统页面,统计实时刷新,低电量人员数据显示 --- src/main/java/com/hxzk/controller/PergatherController.java | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hxzk/controller/PergatherController.java b/src/main/java/com/hxzk/controller/PergatherController.java index 60641ed..ee96e86 100644 --- a/src/main/java/com/hxzk/controller/PergatherController.java +++ b/src/main/java/com/hxzk/controller/PergatherController.java @@ -3,14 +3,22 @@ import com.github.pagehelper.PageInfo; import com.hxzk.pojo.TbAchor; import com.hxzk.pojo.TbPergather; +import com.hxzk.pojo.TbSystemOperationLog; import com.hxzk.service.PergatherService; +import com.hxzk.service.SystemLogService; +import com.hxzk.udp.Udp_Out; import com.hxzk.util.result; 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 javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; @RestController @@ -18,6 +26,8 @@ public class PergatherController { @Autowired PergatherService pergatherService; + @Autowired + SystemLogService systemLogService; @GetMapping("findPerAll") public List<TbPergather> findperAll(){ @@ -29,4 +39,25 @@ PageInfo<TbPergather> cz= pergatherService.findAllTbPergather(page, limit); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } + @PostMapping("upPersonJuJi") + public void upPersonJuJi(TbPergather pergather, HttpServletResponse response) throws IOException { + String upds = "BSTOCS1,ALTERGATHER,"+pergather.getName()+","+pergather.getPernum()+","+pergather.getTypec2()+","+pergather.getRedius()+","+pergather.getShichang()+","+pergather.getWeixianpin()+",END"; + Udp_Out.udp_to_cs(upds); + TbSystemOperationLog systemOperationLog = new TbSystemOperationLog(); + systemOperationLog.setName(UserController.username); + systemOperationLog.setTime(gettime()); + systemOperationLog.setContent("淇敼浜嗚仛闆嗚缃鍥存爮鍚嶇О鏄細"+pergather.getName()); + systemLogService.insertSystem(systemOperationLog); + response.sendRedirect("/hxzkuwb/HouTai/WeiLanList/PersonJuji.jsp"); + + } + + public String gettime(){ + Date now = new Date(); + // 鍒涘缓鏃ユ湡鏍煎紡鍖栧璞★紝璁剧疆鏍煎紡涓� "yyyy-MM-dd HH:mm" + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + // 鏍煎紡鍖栨棩鏈熷璞★紝杈撳嚭瀛楃涓茬粨鏋� + String formattedDate = sdf.format(now); + return formattedDate; + } } -- Gitblit v1.9.3