package com.hxzk.controller;
|
|
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
|
@RequestMapping("/")
|
public class PergatherController {
|
@Autowired
|
PergatherService pergatherService;
|
@Autowired
|
SystemLogService systemLogService;
|
|
@GetMapping("findPerAll")
|
public List<TbPergather> findperAll(){
|
return pergatherService.findAll();
|
}
|
|
@GetMapping("findgather")
|
result<List<TbPergather>> findgather(Integer page, Integer limit){
|
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;
|
}
|
}
|