fei.wang
2024-04-16 70223b3ef4df02622869425fed4ba9b290e1aa74
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package com.hxzk.controller;
 
import com.hxzk.deo.TbPersonAndDepartment;
import com.hxzk.pojo.TbPerson;
import com.hxzk.pojo.tb_realpositoin;
import com.hxzk.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
 
@RestController
@RequestMapping("/")
public class SanWeiController {
    @Autowired
    PersonService personService;
 
    private Map<String, String[]> persons = new HashMap();
 
    @RequestMapping(value = {"/getRealPositionsan2.do"}, method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public List<tb_realpositoin> getRealPositionsan2(HttpServletRequest request) {
        long timeStart = 0L;
        List<TbPersonAndDepartment> realLocationList = personService.findSanWei();
        List<tb_realpositoin> finalPositionList = new ArrayList();
        Iterator var6 = realLocationList.iterator();
        while(var6.hasNext()) {
            TbPersonAndDepartment node = (TbPersonAndDepartment)var6.next();
            double jiao = 0.0;
//            if (this.persons.containsKey(node.getPTagid())) {
//                double x1 = Double.valueOf(node.getPX());
//                double y1 = Double.valueOf(node.getPY());
//                double x2 = Double.valueOf(((String[])this.persons.get(node.getPTagid()))[0]);
//                double y2 = Double.valueOf(((String[])this.persons.get(node.getPTagid()))[1]);
//                double c = x1 - x2;
//                double a = y1 - y2;
//                if (node.getBaoliu22() != null && node.getBaoliu22() != "") {
//                    if (node.getBaoliu22().equals("0")) {
//                        jiao = Math.toDegrees(Math.atan2(c, a));
//                    } else {
//                        String[] xy = node.getBaoliu23().split(",");
//                        jiao = Math.toDegrees(Math.atan2(Double.valueOf(xy[0]), Double.valueOf(xy[1])));
//                    }
//
//                    if (String.valueOf(jiao).equals("0.0")) {
//                        jiao = Double.valueOf(((String[])this.persons.get(node.getPTagid()))[2]);
//                    }
//                }
//            }
            String tagid = node.getPTagid();
            tb_realpositoin position = new tb_realpositoin();
            position.setTagid(tagid);
            position.setPower(node.getPPower());
            position.setLife(node.getPOnline());
            position.setName(node.getPName());
            position.setSex(node.getPSex());
            position.setMinzu(node.getPMinzu());
            position.setPhone(node.getPPhone());
            position.setBumen(node.getPDepartment());
            position.setPosx(node.getPX());
            position.setPosy(node.getPY());
            position.setSos(node.getPSos());
            position.setTime(node.getPAddtiem());
            position.setFence(node.getPFence());
            position.setSousuo(node.getPSousuo());
            position.setShipin(node.getPShipin());
            position.setInkaoqing(node.getPKaoqing());
            position.setJiao(String.valueOf(jiao));
            position.setBaoliu19(node.getBaoliu19());
            position.setBaoliu22(node.getBaoliu22());
            position.setBaoliu23(node.getBaoliu23());
            position.setBaoliu24(node.getBaoliu24());
            position.setBaoliu2(node.getBaoliu2());
            position.setBaoliu3(node.getBaoliu3());
            position.setImage(node.getPImage());
            position.setBumencolor(node.getBumencolor());
            position.setBaoliu35(node.getBaoliu35());
            String[] bb = new String[]{node.getPX(), node.getPY(), String.valueOf(jiao)};
            this.persons.put(node.getPTagid(), bb);
            finalPositionList.add(position);
        }
 
        return finalPositionList;
    }
 
    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;
    }
}