人员定位系统对接开发
正在显示
11 个修改的文件
包含
316 行增加
和
62 行删除
... | @@ -25,8 +25,8 @@ public class UserLocationController { | ... | @@ -25,8 +25,8 @@ public class UserLocationController { |
25 | //*****************************************义乌人员定位**********************************************// | 25 | //*****************************************义乌人员定位**********************************************// |
26 | @AutoLog(value = "义乌人员定位-获取所有人员列表") | 26 | @AutoLog(value = "义乌人员定位-获取所有人员列表") |
27 | @ApiOperation(value="义乌人员定位-获取所有人员列表", notes="义乌人员定位-获取所有人员列表") | 27 | @ApiOperation(value="义乌人员定位-获取所有人员列表", notes="义乌人员定位-获取所有人员列表") |
28 | @GetMapping(value = "/getAllUser") | 28 | @GetMapping(value = "/yw/getAllUser") |
29 | public Result<List<UserBaseInfo>> getAllUser() { | 29 | public Result<List<UserBaseInfo>> getAllUserYW() { |
30 | Result<List<UserBaseInfo>> result = new Result<List<UserBaseInfo>>(); | 30 | Result<List<UserBaseInfo>> result = new Result<List<UserBaseInfo>>(); |
31 | List<UserBaseInfo> list = new ArrayList<>(); | 31 | List<UserBaseInfo> list = new ArrayList<>(); |
32 | ILocationService locationService = UserLocationFactory.getLocationService("YW"); | 32 | ILocationService locationService = UserLocationFactory.getLocationService("YW"); |
... | @@ -36,9 +36,10 @@ public class UserLocationController { | ... | @@ -36,9 +36,10 @@ public class UserLocationController { |
36 | return result; | 36 | return result; |
37 | } | 37 | } |
38 | 38 | ||
39 | //*****************************************义乌人员定位**********************************************// | ||
39 | @AutoLog(value = "义乌人员定位-获取所有人员实时定位数据") | 40 | @AutoLog(value = "义乌人员定位-获取所有人员实时定位数据") |
40 | @ApiOperation(value="义乌人员定位-获取所有人员实时定位数据", notes="义乌人员定位-获取所有人员实时定位数据") | 41 | @ApiOperation(value="义乌人员定位-获取所有人员实时定位数据", notes="义乌人员定位-获取所有人员实时定位数据") |
41 | @GetMapping(value = "/getAllUserGPS") | 42 | @GetMapping(value = "/yw/getAllUserGPS") |
42 | public Result<List<UserLocation>> getAllUserGPS() { | 43 | public Result<List<UserLocation>> getAllUserGPS() { |
43 | Result<List<UserLocation>> result = new Result<List<UserLocation>>(); | 44 | Result<List<UserLocation>> result = new Result<List<UserLocation>>(); |
44 | List<UserLocation> list = new ArrayList<>(); | 45 | List<UserLocation> list = new ArrayList<>(); |
... | @@ -51,7 +52,7 @@ public class UserLocationController { | ... | @@ -51,7 +52,7 @@ public class UserLocationController { |
51 | 52 | ||
52 | @AutoLog(value = "义乌人员定位-获取人员历史轨迹") | 53 | @AutoLog(value = "义乌人员定位-获取人员历史轨迹") |
53 | @ApiOperation(value="义乌人员定位-获取人员历史轨迹", notes="义乌人员定位-获取人员历史轨迹") | 54 | @ApiOperation(value="义乌人员定位-获取人员历史轨迹", notes="义乌人员定位-获取人员历史轨迹") |
54 | @GetMapping(value = "/getUserHistory") | 55 | @GetMapping(value = "/yw/getUserHistory") |
55 | public Result<List<UserLocation>> getUserHistory(String deviceCode,String startTime,String endTime) { | 56 | public Result<List<UserLocation>> getUserHistory(String deviceCode,String startTime,String endTime) { |
56 | Result<List<UserLocation>> result = new Result<List<UserLocation>>(); | 57 | Result<List<UserLocation>> result = new Result<List<UserLocation>>(); |
57 | List<UserLocation> list = new ArrayList<>(); | 58 | List<UserLocation> list = new ArrayList<>(); |
... | @@ -62,4 +63,17 @@ public class UserLocationController { | ... | @@ -62,4 +63,17 @@ public class UserLocationController { |
62 | return result; | 63 | return result; |
63 | } | 64 | } |
64 | //***********************************************************************************************// | 65 | //***********************************************************************************************// |
66 | |||
67 | @AutoLog(value = "余杭人员定位-获取所有人员列表") | ||
68 | @ApiOperation(value="余杭人员定位-获取所有人员列表", notes="余杭人员定位-获取所有人员列表") | ||
69 | @GetMapping(value = "/yh/getAllUser") | ||
70 | public Result<List<UserBaseInfo>> getAllUserBKYH() { | ||
71 | Result<List<UserBaseInfo>> result = new Result<List<UserBaseInfo>>(); | ||
72 | List<UserBaseInfo> list = new ArrayList<>(); | ||
73 | ILocationService locationService = UserLocationFactory.getLocationService("BKYH"); | ||
74 | list = locationService.getAllUser(); | ||
75 | result.setResult(list); | ||
76 | result.setSuccess(true); | ||
77 | return result; | ||
78 | } | ||
65 | } | 79 | } | ... | ... |
1 | package com.skua.modules.location.entity; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | /** | ||
6 | * 人员详细信息 | ||
7 | */ | ||
8 | @Data | ||
9 | public class UserBaseInfoBkyhResult { | ||
10 | |||
11 | private Integer usestatus; | ||
12 | private Integer electricity; | ||
13 | private String avatar; | ||
14 | private String signalRssi; | ||
15 | private Integer type; | ||
16 | private String deviceId; | ||
17 | private String cardNo; | ||
18 | private String buildingId; | ||
19 | private String groupName; | ||
20 | private String phone; | ||
21 | private String createTime; | ||
22 | private String groupLurl; | ||
23 | private String jobNo; | ||
24 | private String name; | ||
25 | private String comment; | ||
26 | private Integer id; | ||
27 | |||
28 | } |
1 | package com.skua.modules.location.entity; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | /** | ||
6 | * 人员定位数据 | ||
7 | */ | ||
8 | @Data | ||
9 | public class UserLocationBkyhResult { | ||
10 | |||
11 | private int buildingId; | ||
12 | private String comment; | ||
13 | private String deviceId; | ||
14 | private String floorId; | ||
15 | private int groupId; | ||
16 | private String groupName; | ||
17 | private String locationType; | ||
18 | private String name; | ||
19 | private String number; | ||
20 | private long createTime; | ||
21 | private long updateTime; | ||
22 | private String userName; | ||
23 | private Double x; | ||
24 | private Double y; | ||
25 | |||
26 | } |
... | @@ -12,4 +12,6 @@ public interface ILocationService { | ... | @@ -12,4 +12,6 @@ public interface ILocationService { |
12 | List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime); | 12 | List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime); |
13 | 13 | ||
14 | List<UserBaseInfo> getAllUser(); | 14 | List<UserBaseInfo> getAllUser(); |
15 | |||
16 | |||
15 | } | 17 | } | ... | ... |
1 | package com.skua.modules.location.service.impl; | 1 | package com.skua.modules.location.service.impl; |
2 | 2 | ||
3 | import com.skua.modules.location.entity.UserBaseInfo; | 3 | import cn.hutool.http.HttpUtil; |
4 | import com.skua.modules.location.entity.UserLocation; | 4 | import com.alibaba.fastjson.JSONObject; |
5 | import com.skua.modules.location.entity.*; | ||
5 | import com.skua.modules.location.service.ILocationService; | 6 | import com.skua.modules.location.service.ILocationService; |
7 | import com.skua.modules.location.util.ChangeLocationUtils; | ||
8 | import com.skua.modules.location.util.MD5Util; | ||
9 | import org.apache.commons.lang.StringUtils; | ||
6 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
7 | 11 | ||
8 | import java.util.ArrayList; | 12 | import java.util.*; |
9 | import java.util.HashMap; | ||
10 | import java.util.List; | ||
11 | import java.util.Map; | ||
12 | 13 | ||
13 | @Service("BkyhLocationService") | 14 | @Service("BkyhLocationService") |
14 | public class BkyhLocationServiceImpl implements ILocationService { | 15 | public class BkyhLocationServiceImpl implements ILocationService { |
15 | 16 | ||
17 | private static final String BLD_ID = "10";//定位系统项目ID | ||
18 | private static final String KEY = "f9257afea27943d7bcd7cc510f1b50dc";//定位系统秘钥 | ||
19 | private static final String URL = "http://101.132.108.99";//人员定位测试IP地址 | ||
16 | //**********************联通坐标*************************** | 20 | //**********************联通坐标*************************** |
17 | private static final Double DW_B1_X = 42.8238;//定位系统B1层X坐标 | 21 | private static final Double DW_B1_X = 42.8238;//定位系统B1层X坐标 |
18 | private static final Double DW_B1_Y = 325.8339;//定位系统B1层Y坐标 | 22 | private static final Double DW_B1_Y = 325.8339;//定位系统B1层Y坐标 |
... | @@ -52,8 +56,36 @@ public class BkyhLocationServiceImpl implements ILocationService { | ... | @@ -52,8 +56,36 @@ public class BkyhLocationServiceImpl implements ILocationService { |
52 | 56 | ||
53 | @Override | 57 | @Override |
54 | public List<UserLocation> getAllUserGPS() { | 58 | public List<UserLocation> getAllUserGPS() { |
55 | List<UserLocation> list = new ArrayList<>(); | 59 | List<UserLocation> result = new ArrayList<>(); |
56 | return list; | 60 | String get = HttpUtil.get(URL + "/api/positionByBuildingId.shtml"+"?buildingId="+BLD_ID); |
61 | JSONObject json = JSONObject.parseObject(get); | ||
62 | List<UserLocationBkyhResult> list = JSONObject.parseArray(json.get("data").toString(), UserLocationBkyhResult.class); | ||
63 | getLocationBasicInfo();//坐标转换基础信息 | ||
64 | for (UserLocationBkyhResult realTimeLocation:list) { | ||
65 | long now = System.currentTimeMillis() - 300000; | ||
66 | if(now < realTimeLocation.getCreateTime()){ | ||
67 | UserLocation userLocation = new UserLocation(); | ||
68 | Map<String,Object> map = new HashMap<>();//初始化 | ||
69 | if("B2".equals(realTimeLocation.getName())){ | ||
70 | map = ChangeLocationUtils.changeUserLocation("B2",realTimeLocation.getX().toString(), | ||
71 | realTimeLocation.getY().toString(),locationBasicInfo); | ||
72 | realTimeLocation.setX(Double.valueOf(map.get("x").toString())); | ||
73 | realTimeLocation.setY(Double.valueOf(map.get("y").toString())); | ||
74 | }else{ | ||
75 | map = ChangeLocationUtils.changeUserLocation("B1",realTimeLocation.getX().toString(), | ||
76 | realTimeLocation.getY().toString(),locationBasicInfo); | ||
77 | realTimeLocation.setX(Double.valueOf(map.get("x").toString())); | ||
78 | realTimeLocation.setY(Double.valueOf(map.get("y").toString())); | ||
79 | } | ||
80 | userLocation.setFloor(realTimeLocation.getFloorId()); | ||
81 | userLocation.setDeviceCode(realTimeLocation.getDeviceId()); | ||
82 | userLocation.setX(realTimeLocation.getX()); | ||
83 | userLocation.setY(realTimeLocation.getY()); | ||
84 | userLocation.setUserName(realTimeLocation.getUserName()); | ||
85 | result.add(userLocation); | ||
86 | } | ||
87 | } | ||
88 | return result; | ||
57 | } | 89 | } |
58 | 90 | ||
59 | @Override | 91 | @Override |
... | @@ -62,9 +94,44 @@ public class BkyhLocationServiceImpl implements ILocationService { | ... | @@ -62,9 +94,44 @@ public class BkyhLocationServiceImpl implements ILocationService { |
62 | return list; | 94 | return list; |
63 | } | 95 | } |
64 | 96 | ||
97 | public String getBuildingAllInfo() { | ||
98 | HashMap<String,Object> map = new HashMap<>(); | ||
99 | String tmsp = String.valueOf(System.currentTimeMillis()/1000); | ||
100 | map.put("bldId",BLD_ID); | ||
101 | map.put("ts",tmsp); | ||
102 | String str = StringUtils.join(Arrays.asList(new String[]{BLD_ID,tmsp,KEY}),",") | ||
103 | .replace(",",""); | ||
104 | String strMd5 = MD5Util.getMD5LowerCase(str); | ||
105 | map.put("sgn",strMd5); | ||
106 | String post = HttpUtil.post(URL+"/api/v1/buildingAllInfo.shtml",map); | ||
107 | return post; | ||
108 | } | ||
109 | |||
65 | @Override | 110 | @Override |
66 | public List<UserBaseInfo> getAllUser() { | 111 | public List<UserBaseInfo> getAllUser() { |
67 | return null; | 112 | List<UserBaseInfo> list = new ArrayList<>(); |
113 | String post = getBuildingAllInfo(); | ||
114 | JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString()); | ||
115 | List<UserBaseInfoBkyhResult> userList = JSONObject.parseArray(json.get("devices").toString(), UserBaseInfoBkyhResult.class); | ||
116 | List<UserLocation> onLineList = getAllUserGPS(); | ||
117 | for (UserBaseInfoBkyhResult userBaseInfoBkyhResult : userList) { | ||
118 | UserBaseInfo userBaseInfo = new UserBaseInfo(); | ||
119 | String deviceCode = userBaseInfoBkyhResult.getDeviceId(); | ||
120 | if(onLineList.size()>0){ | ||
121 | for (UserLocation userLocation:onLineList) { | ||
122 | if (deviceCode.equals(userLocation.getDeviceCode())){ | ||
123 | userBaseInfo.setUserStatus("1"); | ||
124 | break; | ||
125 | } | ||
126 | } | ||
127 | }else{ | ||
128 | userBaseInfo.setUserStatus("0"); | ||
129 | } | ||
130 | userBaseInfo.setDeviceCode(userBaseInfoBkyhResult.getDeviceId()); | ||
131 | userBaseInfo.setUserName(userBaseInfoBkyhResult.getName()); | ||
132 | list.add(userBaseInfo); | ||
133 | } | ||
134 | return list; | ||
68 | } | 135 | } |
69 | 136 | ||
70 | } | 137 | } | ... | ... |
... | @@ -15,57 +15,58 @@ import java.util.Map; | ... | @@ -15,57 +15,58 @@ import java.util.Map; |
15 | @Service("YwLocationService") | 15 | @Service("YwLocationService") |
16 | public class YwLocationServiceImpl implements ILocationService { | 16 | public class YwLocationServiceImpl implements ILocationService { |
17 | 17 | ||
18 | private static final String username = "admin";//人员定位账号 | 18 | private static final String username = "ywsjh";//人员定位账号 |
19 | private static final String password = "admin";//人员定位密码 | 19 | private static final String password = "ywsjh@2023";//人员定位密码 |
20 | 20 | private static final String url = "http://xylie.tpddns.cn:8084/YWSJH/"; | |
21 | //**********************联通坐标*************************** | 21 | //**********************人员定位坐标*************************** |
22 | private static final Double DW_B1_X = 42.8238;//定位系统B1层X坐标 | 22 | private static final Double DW_X = 3990.0;//定位系统层X坐标 |
23 | private static final Double DW_B1_Y = 325.8339;//定位系统B1层Y坐标 | 23 | private static final Double DW_Y = -1683.0;//定位系统层Y坐标 |
24 | private static final Double DW_B2_X = 22.4297;//定位系统B2层X坐标 | ||
25 | private static final Double DW_B2_Y = 330.5528;//定位系统B2层Y坐标 | ||
26 | |||
27 | //**********************三维坐标*************************** | 24 | //**********************三维坐标*************************** |
28 | private static final Double SW_B1_X = -9850.00;//三维B1层X坐标 | 25 | private static final Double SW_X = 32218.0;//三维层X坐标 |
29 | private static final Double SW_B1_Y = -7400.00;//三维B1层Y坐标 | 26 | private static final Double SW_Y = 15308.0;//三维层Y坐标 |
30 | private static final Double SW_B2_X = -9850.00;//三维B2层X坐标 | ||
31 | private static final Double SW_B2_Y = -7430.00;//三维B2层Y坐标 | ||
32 | |||
33 | //**********************比例尺*************************** | 27 | //**********************比例尺*************************** |
34 | private static final Double BLC_X = 43.7;//X比例尺 | 28 | private static final Double BLC = 8.13395457;//比例尺 |
35 | private static final Double BLC_Y = 43.58;//Y比例尺 | ||
36 | //**********************旋转角度*************************** | ||
37 | private static final Double XZJD = 34.7989;//旋转角度 | ||
38 | |||
39 | private static final Map<String, Double> locationBasicInfo = new HashMap<>(); | 29 | private static final Map<String, Double> locationBasicInfo = new HashMap<>(); |
40 | 30 | ||
41 | /** | 31 | /** |
42 | * 坐标转换基础信息 | 32 | * 坐标转换基础信息 |
43 | */ | 33 | */ |
44 | public void getLocationBasicInfo() { | 34 | public void getLocationBasicInfo() { |
45 | locationBasicInfo.put("DW_B1_X",DW_B1_X); | 35 | locationBasicInfo.put("DW_X",DW_X); |
46 | locationBasicInfo.put("DW_B1_Y",DW_B1_Y); | 36 | locationBasicInfo.put("DW_Y",DW_Y); |
47 | locationBasicInfo.put("DW_B2_X",DW_B2_X); | 37 | locationBasicInfo.put("SW_X",SW_X); |
48 | locationBasicInfo.put("DW_B2_Y",DW_B2_Y); | 38 | locationBasicInfo.put("SW_Y",SW_Y); |
49 | locationBasicInfo.put("SW_B1_X",SW_B1_X); | 39 | locationBasicInfo.put("BLC",BLC); |
50 | locationBasicInfo.put("SW_B1_Y",SW_B1_Y); | ||
51 | locationBasicInfo.put("SW_B2_X",SW_B2_X); | ||
52 | locationBasicInfo.put("SW_B2_Y",SW_B2_Y); | ||
53 | locationBasicInfo.put("BLC_X",BLC_X); | ||
54 | locationBasicInfo.put("BLC_Y",BLC_Y); | ||
55 | locationBasicInfo.put("XZJD",XZJD); | ||
56 | } | 40 | } |
57 | 41 | ||
58 | @Override | 42 | @Override |
59 | public List<UserLocation> getAllUserGPS() { | 43 | public List<UserLocation> getAllUserGPS() { |
60 | List<UserLocation> list = new ArrayList<>(); | 44 | List<UserLocation> list = new ArrayList<>(); |
61 | String get = "{\n" + | 45 | HashMap<String,Object> pMap = new HashMap<>(); |
46 | pMap.put("username", username); | ||
47 | pMap.put("password", password); | ||
48 | String get = HttpUtil.get(url+"open/information/getRealGps.do",pMap); | ||
49 | get = "{\n" + | ||
62 | "\"data\":\n" + | 50 | "\"data\":\n" + |
63 | "[{\n" + | 51 | "[{\n" + |
64 | "\"empName\":\"贾伟峰\",\n" + | 52 | "\"empName\":\"贾伟峰\",\n" + |
65 | "\"area\":\"2\",\n" + | 53 | "\"area\":\"2\",\n" + |
66 | "\"deviceNo\":\"16a7ebee\",\n" + | 54 | "\"deviceNo\":\"16a7ebee\",\n" + |
67 | "\"crossY\":\"-8438\",\n" + | 55 | "\"crossY\":\"2564\",\n" + |
68 | "\"crossX\":\"7186\",\n" + | 56 | "\"crossX\":\"1508\",\n" + |
57 | "\"longitude\":104.04438600000114,\n" + | ||
58 | "\"latitude\":30.630693000000115,\n" + | ||
59 | "\"dateTime\":\"2022-05-05 11:35:52\",\n" + | ||
60 | "\"layer\":\"-1\",\n" + | ||
61 | "\"empNo\":\"108036\",\n" + | ||
62 | "\"specifictype\":\"0\"\n" + | ||
63 | "},\n" + | ||
64 | "{\n" + | ||
65 | "\"empName\":\"宋锡园\",\n" + | ||
66 | "\"area\":\"2\",\n" + | ||
67 | "\"deviceNo\":\"169c1502\",\n" + | ||
68 | "\"crossY\":\"2584\",\n" + | ||
69 | "\"crossX\":\"1538\",\n" + | ||
69 | "\"longitude\":104.04438600000114,\n" + | 70 | "\"longitude\":104.04438600000114,\n" + |
70 | "\"latitude\":30.630693000000115,\n" + | 71 | "\"latitude\":30.630693000000115,\n" + |
71 | "\"dateTime\":\"2022-05-05 11:35:52\",\n" + | 72 | "\"dateTime\":\"2022-05-05 11:35:52\",\n" + |
... | @@ -77,8 +78,8 @@ public class YwLocationServiceImpl implements ILocationService { | ... | @@ -77,8 +78,8 @@ public class YwLocationServiceImpl implements ILocationService { |
77 | "\"empName\":\"何成翔\",\n" + | 78 | "\"empName\":\"何成翔\",\n" + |
78 | "\"area\":\"2\",\n" + | 79 | "\"area\":\"2\",\n" + |
79 | "\"deviceNo\":\"169c0cba\",\n" + | 80 | "\"deviceNo\":\"169c0cba\",\n" + |
80 | "\"crossY\":\"-8312\",\n" + | 81 | "\"crossY\":\"2564\",\n" + |
81 | "\"crossX\":\"32438\",\n" + | 82 | "\"crossX\":\"2816\",\n" + |
82 | "\"longitude\":124.01230000114,\n" + | 83 | "\"longitude\":124.01230000114,\n" + |
83 | "\"latitude\":31.6301230000115,\n" + | 84 | "\"latitude\":31.6301230000115,\n" + |
84 | "\"dateTime\":\"2022-05-05 11:35:52\",\n" + | 85 | "\"dateTime\":\"2022-05-05 11:35:52\",\n" + |
... | @@ -98,12 +99,10 @@ public class YwLocationServiceImpl implements ILocationService { | ... | @@ -98,12 +99,10 @@ public class YwLocationServiceImpl implements ILocationService { |
98 | userLocation.setFloor(userLocationYwResult.getLayer()); | 99 | userLocation.setFloor(userLocationYwResult.getLayer()); |
99 | userLocation.setDeviceCode(userLocationYwResult.getDeviceNo()); | 100 | userLocation.setDeviceCode(userLocationYwResult.getDeviceNo()); |
100 | userLocation.setUserName(userLocationYwResult.getEmpName()); | 101 | userLocation.setUserName(userLocationYwResult.getEmpName()); |
101 | // Map<String,Object> map = ChangeLocationUtils.changeUserLocation(userLocationYwResult.getLayer(), String.valueOf(userLocationYwResult.getCrossX()), | 102 | Map<String,Object> map = ChangeLocationUtils.changeUserLocationNTZX(String.valueOf(userLocationYwResult.getCrossX()), |
102 | // String.valueOf(userLocationYwResult.getCrossY()), locationBasicInfo); | 103 | String.valueOf(userLocationYwResult.getCrossY()), locationBasicInfo); |
103 | // userLocation.setX(Double.valueOf(map.get("x").toString())); | 104 | userLocation.setX(Double.valueOf(map.get("x").toString())); |
104 | // userLocation.setY(Double.valueOf(map.get("y").toString())); | 105 | userLocation.setY(Double.valueOf(map.get("y").toString())); |
105 | userLocation.setX(userLocationYwResult.getCrossX()); | ||
106 | userLocation.setY(userLocationYwResult.getCrossY()); | ||
107 | userLocation.setDateTime(userLocationYwResult.getDateTime()); | 106 | userLocation.setDateTime(userLocationYwResult.getDateTime()); |
108 | list.add(userLocation); | 107 | list.add(userLocation); |
109 | } | 108 | } |
... | @@ -113,7 +112,14 @@ public class YwLocationServiceImpl implements ILocationService { | ... | @@ -113,7 +112,14 @@ public class YwLocationServiceImpl implements ILocationService { |
113 | @Override | 112 | @Override |
114 | public List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime) { | 113 | public List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime) { |
115 | List<UserLocation> list = new ArrayList<>(); | 114 | List<UserLocation> list = new ArrayList<>(); |
116 | String get = "{\n" + | 115 | HashMap<String,Object> pMap = new HashMap<>(); |
116 | pMap.put("username", username); | ||
117 | pMap.put("password", password); | ||
118 | pMap.put("begintime", startTime); | ||
119 | pMap.put("endtime", endTime); | ||
120 | pMap.put("deveuis", deviceCode); | ||
121 | String get = HttpUtil.get(url+"open/information/getHis.do",pMap); | ||
122 | get = "{\n" + | ||
117 | "\"data\":[\n" + | 123 | "\"data\":[\n" + |
118 | "{\n" + | 124 | "{\n" + |
119 | "\"name\":\"贾伟峰\",\n" + | 125 | "\"name\":\"贾伟峰\",\n" + |
... | @@ -141,7 +147,7 @@ public class YwLocationServiceImpl implements ILocationService { | ... | @@ -141,7 +147,7 @@ public class YwLocationServiceImpl implements ILocationService { |
141 | for (UserLocationHistoryYwResult userLocationHistoryYwResult : getList) { | 147 | for (UserLocationHistoryYwResult userLocationHistoryYwResult : getList) { |
142 | UserLocation userLocation = new UserLocation(); | 148 | UserLocation userLocation = new UserLocation(); |
143 | userLocation.setUserName(userLocationHistoryYwResult.getName()); | 149 | userLocation.setUserName(userLocationHistoryYwResult.getName()); |
144 | Map<String,Object> map = ChangeLocationUtils.changeUserLocation("", String.valueOf(userLocationHistoryYwResult.getX()), | 150 | Map<String,Object> map = ChangeLocationUtils.changeUserLocationNTZX(String.valueOf(userLocationHistoryYwResult.getX()), |
145 | String.valueOf(userLocationHistoryYwResult.getY()), locationBasicInfo); | 151 | String.valueOf(userLocationHistoryYwResult.getY()), locationBasicInfo); |
146 | userLocation.setX(Double.valueOf(map.get("x").toString())); | 152 | userLocation.setX(Double.valueOf(map.get("x").toString())); |
147 | userLocation.setY(Double.valueOf(map.get("y").toString())); | 153 | userLocation.setY(Double.valueOf(map.get("y").toString())); |
... | @@ -155,12 +161,12 @@ public class YwLocationServiceImpl implements ILocationService { | ... | @@ -155,12 +161,12 @@ public class YwLocationServiceImpl implements ILocationService { |
155 | public List<UserBaseInfo> getAllUser() { | 161 | public List<UserBaseInfo> getAllUser() { |
156 | List<UserBaseInfo> list = new ArrayList<>(); | 162 | List<UserBaseInfo> list = new ArrayList<>(); |
157 | HashMap<String,Object> map = new HashMap<>(); | 163 | HashMap<String,Object> map = new HashMap<>(); |
158 | map.put("username","ywsjh"); | 164 | map.put("username", username); |
159 | map.put("password","ywsjh@2023"); | 165 | map.put("password", password); |
160 | map.put("page",1); | 166 | map.put("page",1); |
161 | map.put("rows",800); | 167 | map.put("rows",1000); |
162 | map.put("emp",""); | 168 | map.put("emp",""); |
163 | String post = HttpUtil.get("http://xylie.tpddns.cn:8084/YWSJH/open/information/getEmp.do",map); | 169 | String post = HttpUtil.get(url+"open/information/getEmp.do",map); |
164 | JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString()); | 170 | JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString()); |
165 | List<UserBaseInfoYwResult> userList = JSONObject.parseArray(json.get("rows").toString(), UserBaseInfoYwResult.class); | 171 | List<UserBaseInfoYwResult> userList = JSONObject.parseArray(json.get("rows").toString(), UserBaseInfoYwResult.class); |
166 | for (UserBaseInfoYwResult userBaseInfoYwResult : userList) { | 172 | for (UserBaseInfoYwResult userBaseInfoYwResult : userList) { | ... | ... |
... | @@ -72,5 +72,37 @@ public class ChangeLocationUtils{ | ... | @@ -72,5 +72,37 @@ public class ChangeLocationUtils{ |
72 | return map; | 72 | return map; |
73 | } | 73 | } |
74 | 74 | ||
75 | /** | ||
76 | * 南通在线转换坐标 | ||
77 | * @param x1 X坐标 | ||
78 | * @param y1 Y坐标 | ||
79 | * @param locationBasicInfo 基础信息 | ||
80 | * @return | ||
81 | */ | ||
82 | public static Map<String,Object> changeUserLocationNTZX(String x1, String y1, Map<String, Double> locationBasicInfo) { | ||
83 | y1 = "-"+y1; | ||
84 | double DW_X = locationBasicInfo.get("DW_X");//定位系统X坐标 | ||
85 | double DW_Y = locationBasicInfo.get("DW_Y");//定位系统Y坐标 | ||
86 | double SW_X = locationBasicInfo.get("SW_X");//三维X坐标 | ||
87 | double SW_Y = locationBasicInfo.get("SW_Y");//三维Y坐标 | ||
88 | double BLC = locationBasicInfo.get("BLC");//比例尺 | ||
89 | |||
90 | Map<String,Object> map = new HashMap<>();//初始化 | ||
91 | map.put("x", 0.00); | ||
92 | map.put("y", 0.00); | ||
93 | //平移到原点 | ||
94 | double x0 = Double.valueOf(x1) - DW_X; | ||
95 | double y0 = Double.valueOf(y1) - DW_Y; | ||
96 | //平移后的坐标 | ||
97 | double py_x = x0 + SW_X / BLC; | ||
98 | double py_y = y0 + SW_Y / BLC; | ||
99 | //放大后的坐标 | ||
100 | double fd_x = BLC * py_x; | ||
101 | double fd_y = BLC * py_y; | ||
102 | map.put("x",fd_x); | ||
103 | map.put("y",0-fd_y); | ||
104 | return map; | ||
105 | } | ||
106 | |||
75 | 107 | ||
76 | } | 108 | } | ... | ... |
1 | package com.skua.modules.location.util; | ||
2 | |||
3 | import java.math.BigInteger; | ||
4 | import java.security.MessageDigest; | ||
5 | |||
6 | public class MD5Util { | ||
7 | |||
8 | /** | ||
9 | * 对字符串md5加密 | ||
10 | * | ||
11 | * @param str 传入要加密的字符串 | ||
12 | * @return MD5加密后的字符串(小写+字母) | ||
13 | */ | ||
14 | public static String getMD5LowerCase(String str) { | ||
15 | try { | ||
16 | // 生成一个MD5加密计算摘要 | ||
17 | MessageDigest md = MessageDigest.getInstance("MD5"); | ||
18 | // 计算md5函数 | ||
19 | md.update(str.getBytes()); | ||
20 | // digest()最后确定返回md5 hash值,返回值为8为字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符 | ||
21 | // BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值 | ||
22 | return new BigInteger(1, md.digest()).toString(16); | ||
23 | } catch (Exception e) { | ||
24 | e.printStackTrace(); | ||
25 | return null; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * 对字符串md5加密 | ||
31 | * | ||
32 | * @param s 传入要加密的字符串 | ||
33 | * @return MD5加密后的字符串(大写+数字) | ||
34 | */ | ||
35 | |||
36 | public static String getMD5UpperCase(String s) { | ||
37 | char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | ||
38 | 'A', 'B', 'C', 'D', 'E', 'F' }; | ||
39 | try { | ||
40 | byte[] btInput = s.getBytes(); | ||
41 | // 获得MD5摘要算法的 MessageDigest 对象 | ||
42 | MessageDigest mdInst = MessageDigest.getInstance("MD5"); | ||
43 | // 使用指定的字节更新摘要 | ||
44 | mdInst.update(btInput); | ||
45 | // 获得密文 | ||
46 | byte[] md = mdInst.digest(); | ||
47 | // 把密文转换成十六进制的字符串形式 | ||
48 | int j = md.length; | ||
49 | char str[] = new char[j * 2]; | ||
50 | int k = 0; | ||
51 | for (int i = 0; i < j; i++) { | ||
52 | byte byte0 = md[i]; | ||
53 | str[k++] = hexDigits[byte0 >>> 4 & 0xf]; | ||
54 | str[k++] = hexDigits[byte0 & 0xf]; | ||
55 | } | ||
56 | return new String(str); | ||
57 | } catch (Exception e) { | ||
58 | e.printStackTrace(); | ||
59 | return null; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public static void main(String[] args) { | ||
64 | String str = "\"我+Admin1234~!@#¥%……&*()\""; | ||
65 | System.out.println(str); | ||
66 | //"我+Admin1234~!@#¥%……&*()" | ||
67 | |||
68 | String s1 = getMD5LowerCase(str); | ||
69 | System.out.println(s1); | ||
70 | //6bb6f83c026357a15cdf12e5d6b2b310 | ||
71 | |||
72 | String s2 = getMD5UpperCase(str); | ||
73 | System.out.println(s2); | ||
74 | //6BB6F83C026357A15CDF12E5D6B2B310 | ||
75 | } | ||
76 | } |
-
请 注册 或 登录 后发表评论