zhitong.yu
2024-05-11 b72f8f8d58417eb6fb29672d8ac17cfafa46775c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.hxzk.controller;
 
import com.github.pagehelper.PageInfo;
import com.hxzk.pojo.TbAchor;
import com.hxzk.pojo.TbRtkanchor;
import com.hxzk.pojo.TbSystemOperationLog;
import com.hxzk.pojo.TbTag;
import com.hxzk.service.RtkService;
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 RtkController {
    @Autowired
    RtkService rtkService;
    //差分基站
    @GetMapping("findchafenjizhan")
    result<List<TbRtkanchor>> findTag(Integer page, Integer limit){
        PageInfo<TbRtkanchor> cz= rtkService.findAll(page, limit);
        return resultutil.returnSuccess(cz.getTotal(), cz.getList());
    }
 
    //删除差分基站
    @GetMapping("deletechafenjizhan")
    public void deletechafenjizhan(Integer id){
        String xieyi = "BSTOCS1,CFJZ,DELETE," + id + ",END";
        TbSystemOperationLog systemOperationLog = new TbSystemOperationLog();
        systemOperationLog.setName(UserController.username);
        systemOperationLog.setTime(gettime());
        systemOperationLog.setContent("删除了一个差分基站,该差分基站为:"+ id);
        Udp_Out.udp_to_cs(xieyi);
    }
    @PostMapping("addCFJZ")
    public void addCFJZ(TbRtkanchor rtkanchor, HttpServletResponse response) throws IOException {
        String xieyi = "BSTOCS1,CFJZ,ADD," + rtkanchor.getAcid() + "," + rtkanchor.getJingdu() + "," + rtkanchor.getWeidu() + "," + rtkanchor.getGaodu() + "," + rtkanchor.getPosx() + "," + rtkanchor.getPosy() + "," + rtkanchor.getFloor() + "," + rtkanchor.getDistance()+ "," + rtkanchor.getPort()+ ",END";
        Udp_Out.udp_to_cs(xieyi);
        TbSystemOperationLog systemOperationLog = new TbSystemOperationLog();
        systemOperationLog.setName(UserController.username);
        systemOperationLog.setTime(gettime());
        systemOperationLog.setContent("增加了一个差分基站,该差分基站为:"+ rtkanchor.getAcid() );
        response.sendRedirect("/hxzkuwb/HouTai/ChaFenJiZhan/ChaFenJiZhan.jsp");
    }
 
    @PostMapping("updateCFJZ")
    public void updateCFJZ(TbRtkanchor rtkanchor,HttpServletResponse response) throws IOException {
        String xieyi = "BSTOCS1,CFJZ,ALTER," + rtkanchor.getAcid() + "," + rtkanchor.getJingdu() + "," + rtkanchor.getWeidu() + "," + rtkanchor.getGaodu() + "," + rtkanchor.getPosx() + "," + rtkanchor.getPosy() + "," + rtkanchor.getFloor() + "," + rtkanchor.getDistance()+ "," + rtkanchor.getPort()+ ",END";
        Udp_Out.udp_to_cs(xieyi);
        TbSystemOperationLog systemOperationLog = new TbSystemOperationLog();
        systemOperationLog.setName(UserController.username);
        systemOperationLog.setTime(gettime());
        systemOperationLog.setContent("修改了一个差分基站,该差分基站为:"+ rtkanchor.getAcid() );
        response.sendRedirect("/hxzkuwb/HouTai/ChaFenJiZhan/ChaFenJiZhan.jsp");
    }
    //表格搜索
 
    @PostMapping("findtableCFJZSearch")
    result<List<TbRtkanchor>> findtableCFJZSearch(Integer page, Integer limit, TbRtkanchor rtkanchor){
        PageInfo<TbRtkanchor> cz= rtkService.findSearch(page, limit,rtkanchor);
        return resultutil.returnSuccess(cz.getTotal(), cz.getList());
    }
    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;
    }
}