dad1f09b 张雷

人员定位系统对接开发

1 个父辈 7dfb2818
...@@ -3,6 +3,7 @@ package com.skua.modules.location.controller; ...@@ -3,6 +3,7 @@ package com.skua.modules.location.controller;
3 import com.skua.core.api.vo.Result; 3 import com.skua.core.api.vo.Result;
4 import com.skua.core.aspect.annotation.AutoLog; 4 import com.skua.core.aspect.annotation.AutoLog;
5 import com.skua.modules.location.UserLocationFactory; 5 import com.skua.modules.location.UserLocationFactory;
6 import com.skua.modules.location.entity.UserBaseInfo;
6 import com.skua.modules.location.entity.UserLocation; 7 import com.skua.modules.location.entity.UserLocation;
7 import com.skua.modules.location.service.ILocationService; 8 import com.skua.modules.location.service.ILocationService;
8 import io.swagger.annotations.Api; 9 import io.swagger.annotations.Api;
...@@ -22,6 +23,19 @@ import java.util.List; ...@@ -22,6 +23,19 @@ import java.util.List;
22 public class UserLocationController { 23 public class UserLocationController {
23 24
24 //*****************************************义乌人员定位**********************************************// 25 //*****************************************义乌人员定位**********************************************//
26 @AutoLog(value = "义乌人员定位-获取所有人员列表")
27 @ApiOperation(value="义乌人员定位-获取所有人员列表", notes="义乌人员定位-获取所有人员列表")
28 @GetMapping(value = "/getAllUser")
29 public Result<List<UserBaseInfo>> getAllUser() {
30 Result<List<UserBaseInfo>> result = new Result<List<UserBaseInfo>>();
31 List<UserBaseInfo> list = new ArrayList<>();
32 ILocationService locationService = UserLocationFactory.getLocationService("YW");
33 list = locationService.getAllUser();
34 result.setResult(list);
35 result.setSuccess(true);
36 return result;
37 }
38
25 @AutoLog(value = "义乌人员定位-获取所有人员实时定位数据") 39 @AutoLog(value = "义乌人员定位-获取所有人员实时定位数据")
26 @ApiOperation(value="义乌人员定位-获取所有人员实时定位数据", notes="义乌人员定位-获取所有人员实时定位数据") 40 @ApiOperation(value="义乌人员定位-获取所有人员实时定位数据", notes="义乌人员定位-获取所有人员实时定位数据")
27 @GetMapping(value = "/getAllUserGPS") 41 @GetMapping(value = "/getAllUserGPS")
......
1 package com.skua.modules.location.entity;
2
3 import lombok.Data;
4
5 /**
6 * 人员定位数据
7 */
8 @Data
9 public class UserBaseInfo {
10
11 /**设备编码*/
12 private String deviceCode;
13 /**用户类型*/
14 private String userType;
15 /**人员名称*/
16 private String userName;
17 /**人员工号*/
18 private String userNo;
19 /**人员头像*/
20 private String userIcon;
21
22 }
1 package com.skua.modules.location.entity;
2
3 import lombok.Data;
4
5 /**
6 * 人员详细信息
7 */
8 @Data
9 public class UserBaseInfoYwResult {
10
11 private String branchtypeid;
12 private String worktypename;
13 private String elasttime;
14 private String worktype;
15 private Integer id;
16 private String empno;
17 private String empname;
18 private String locatorNum;
19 private String iccard;
20 private String deviceno;
21 private String empsex;
22 private String idcard;
23 private String tel;
24 private String addr;
25 private Integer h_id;
26 private Integer isvalid;
27 private String departmentId;
28 private String departmentName;
29 private String lasttime;
30
31 }
...@@ -10,8 +10,12 @@ public class UserLocation { ...@@ -10,8 +10,12 @@ public class UserLocation {
10 10
11 /**设备编码*/ 11 /**设备编码*/
12 private String deviceCode; 12 private String deviceCode;
13 /**设备类型*/
14 private String deviceType;
13 /**人员名称*/ 15 /**人员名称*/
14 private String userName; 16 private String userName;
17 /**人员头像*/
18 private String userIcon;
15 /**X坐标*/ 19 /**X坐标*/
16 private Double x; 20 private Double x;
17 /**Y坐标*/ 21 /**Y坐标*/
......
1 package com.skua.modules.location.service; 1 package com.skua.modules.location.service;
2 2
3 import com.skua.modules.location.entity.UserBaseInfo;
3 import com.skua.modules.location.entity.UserLocation; 4 import com.skua.modules.location.entity.UserLocation;
4 5
5 import java.util.List; 6 import java.util.List;
...@@ -9,4 +10,6 @@ public interface ILocationService { ...@@ -9,4 +10,6 @@ public interface ILocationService {
9 List<UserLocation> getAllUserGPS(); 10 List<UserLocation> getAllUserGPS();
10 11
11 List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime); 12 List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime);
13
14 List<UserBaseInfo> getAllUser();
12 } 15 }
......
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 com.skua.modules.location.entity.UserLocation; 4 import com.skua.modules.location.entity.UserLocation;
4 import com.skua.modules.location.service.ILocationService; 5 import com.skua.modules.location.service.ILocationService;
5 import org.springframework.stereotype.Service; 6 import org.springframework.stereotype.Service;
...@@ -61,5 +62,9 @@ public class BkyhLocationServiceImpl implements ILocationService { ...@@ -61,5 +62,9 @@ public class BkyhLocationServiceImpl implements ILocationService {
61 return list; 62 return list;
62 } 63 }
63 64
65 @Override
66 public List<UserBaseInfo> getAllUser() {
67 return null;
68 }
64 69
65 } 70 }
......
1 package com.skua.modules.location.service.impl; 1 package com.skua.modules.location.service.impl;
2 2
3 import cn.hutool.http.HttpUtil;
3 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
4 import com.skua.modules.location.entity.UserLocation; 5 import com.skua.modules.location.entity.*;
5 import com.skua.modules.location.entity.UserLocationYwResult;
6 import com.skua.modules.location.entity.UserLocationHistoryYwResult;
7 import com.skua.modules.location.service.ILocationService; 6 import com.skua.modules.location.service.ILocationService;
8 import com.skua.modules.location.util.ChangeLocationUtils; 7 import com.skua.modules.location.util.ChangeLocationUtils;
9 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
...@@ -62,29 +61,29 @@ public class YwLocationServiceImpl implements ILocationService { ...@@ -62,29 +61,29 @@ public class YwLocationServiceImpl implements ILocationService {
62 String get = "{\n" + 61 String get = "{\n" +
63 "\"data\":\n" + 62 "\"data\":\n" +
64 "[{\n" + 63 "[{\n" +
65 "\"empName\":\"张小凡\",\n" + 64 "\"empName\":\"贾伟峰\",\n" +
66 "\"area\":\"2\",\n" + 65 "\"area\":\"2\",\n" +
67 "\"deviceNo\":\"f1843311\",\n" + 66 "\"deviceNo\":\"16a7ebee\",\n" +
68 "\"crossY\":\"1100\",\n" + 67 "\"crossY\":\"-8438\",\n" +
69 "\"crossX\":\"2670\",\n" + 68 "\"crossX\":\"7186\",\n" +
70 "\"longitude\":104.04438600000114,\n" + 69 "\"longitude\":104.04438600000114,\n" +
71 "\"latitude\":30.630693000000115,\n" + 70 "\"latitude\":30.630693000000115,\n" +
72 "\"dateTime\":\"2019-05-05 11:35:52\",\n" + 71 "\"dateTime\":\"2022-05-05 11:35:52\",\n" +
73 "\"layer\":\"1\",\n" + 72 "\"layer\":\"-1\",\n" +
74 "\"empNo\":\"12123\",\n" + 73 "\"empNo\":\"108036\",\n" +
75 "\"specifictype\":\"0\"\n" + 74 "\"specifictype\":\"0\"\n" +
76 "},\n" + 75 "},\n" +
77 "{\n" + 76 "{\n" +
78 "\"empName\":\"张大凡\",\n" + 77 "\"empName\":\"何成翔\",\n" +
79 "\"area\":\"2\",\n" + 78 "\"area\":\"2\",\n" +
80 "\"deviceNo\":\"f1843310\",\n" + 79 "\"deviceNo\":\"169c0cba\",\n" +
81 "\"crossY\":\"1111\",\n" + 80 "\"crossY\":\"-8312\",\n" +
82 "\"crossX\":\"2666\",\n" + 81 "\"crossX\":\"32438\",\n" +
83 "\"longitude\":124.04438600000114,\n" + 82 "\"longitude\":124.01230000114,\n" +
84 "\"latitude\":31.630693000000115,\n" + 83 "\"latitude\":31.6301230000115,\n" +
85 "\"dateTime\":\"2019-05-05 11:35:52\",\n" + 84 "\"dateTime\":\"2022-05-05 11:35:52\",\n" +
86 "\"layer\":\"1\",\n" + 85 "\"layer\":\"-1\",\n" +
87 "\"empNo\":\"12121\",\n" + 86 "\"empNo\":\"147258\",\n" +
88 "\"specifictype\":\"0\"\n" + 87 "\"specifictype\":\"0\"\n" +
89 "}],\n" + 88 "}],\n" +
90 "\"status\":0,\n" + 89 "\"status\":0,\n" +
...@@ -95,13 +94,16 @@ public class YwLocationServiceImpl implements ILocationService { ...@@ -95,13 +94,16 @@ public class YwLocationServiceImpl implements ILocationService {
95 getLocationBasicInfo();//坐标转换基础信息 94 getLocationBasicInfo();//坐标转换基础信息
96 for (UserLocationYwResult userLocationYwResult : getList) { 95 for (UserLocationYwResult userLocationYwResult : getList) {
97 UserLocation userLocation = new UserLocation(); 96 UserLocation userLocation = new UserLocation();
97 userLocation.setDeviceType("员工");
98 userLocation.setFloor(userLocationYwResult.getLayer()); 98 userLocation.setFloor(userLocationYwResult.getLayer());
99 userLocation.setDeviceCode(userLocationYwResult.getDeviceNo()); 99 userLocation.setDeviceCode(userLocationYwResult.getDeviceNo());
100 userLocation.setUserName(userLocationYwResult.getEmpName()); 100 userLocation.setUserName(userLocationYwResult.getEmpName());
101 Map<String,Object> map = ChangeLocationUtils.changeUserLocation(userLocationYwResult.getLayer(), String.valueOf(userLocationYwResult.getCrossX()), 101 // Map<String,Object> map = ChangeLocationUtils.changeUserLocation(userLocationYwResult.getLayer(), String.valueOf(userLocationYwResult.getCrossX()),
102 String.valueOf(userLocationYwResult.getCrossY()), locationBasicInfo); 102 // String.valueOf(userLocationYwResult.getCrossY()), locationBasicInfo);
103 userLocation.setX(Double.valueOf(map.get("x").toString())); 103 // userLocation.setX(Double.valueOf(map.get("x").toString()));
104 userLocation.setY(Double.valueOf(map.get("y").toString())); 104 // userLocation.setY(Double.valueOf(map.get("y").toString()));
105 userLocation.setX(userLocationYwResult.getCrossX());
106 userLocation.setY(userLocationYwResult.getCrossY());
105 userLocation.setDateTime(userLocationYwResult.getDateTime()); 107 userLocation.setDateTime(userLocationYwResult.getDateTime());
106 list.add(userLocation); 108 list.add(userLocation);
107 } 109 }
...@@ -114,7 +116,7 @@ public class YwLocationServiceImpl implements ILocationService { ...@@ -114,7 +116,7 @@ public class YwLocationServiceImpl implements ILocationService {
114 String get = "{\n" + 116 String get = "{\n" +
115 "\"data\":[\n" + 117 "\"data\":[\n" +
116 "{\n" + 118 "{\n" +
117 "\"name\":\"何小龙\",\n" + 119 "\"name\":\"贾伟峰\",\n" +
118 "\"time\":\"2020-04-20 00:02:35\",\n" + 120 "\"time\":\"2020-04-20 00:02:35\",\n" +
119 "\"x\":\"3539.05\",\n" + 121 "\"x\":\"3539.05\",\n" +
120 "\"y\":\"2711.93\",\n" + 122 "\"y\":\"2711.93\",\n" +
...@@ -122,7 +124,7 @@ public class YwLocationServiceImpl implements ILocationService { ...@@ -122,7 +124,7 @@ public class YwLocationServiceImpl implements ILocationService {
122 "\"lon\":121.05223514735032\n" + 124 "\"lon\":121.05223514735032\n" +
123 "},\n" + 125 "},\n" +
124 "{\n" + 126 "{\n" +
125 "\"name\":\"何小龙\",\n" + 127 "\"name\":\"贾伟峰\",\n" +
126 "\"time\":\"2020-04-20 00:02:45\",\n" + 128 "\"time\":\"2020-04-20 00:02:45\",\n" +
127 "\"x\":\"3536.05\",\n" + 129 "\"x\":\"3536.05\",\n" +
128 "\"y\":\"2611.93\",\n" + 130 "\"y\":\"2611.93\",\n" +
...@@ -148,4 +150,27 @@ public class YwLocationServiceImpl implements ILocationService { ...@@ -148,4 +150,27 @@ public class YwLocationServiceImpl implements ILocationService {
148 } 150 }
149 return list; 151 return list;
150 } 152 }
153
154 @Override
155 public List<UserBaseInfo> getAllUser() {
156 List<UserBaseInfo> list = new ArrayList<>();
157 HashMap<String,Object> map = new HashMap<>();
158 map.put("username","ywsjh");
159 map.put("password","ywsjh@2023");
160 map.put("page",1);
161 map.put("rows",800);
162 map.put("emp","");
163 String post = HttpUtil.get("http://xylie.tpddns.cn:8084/YWSJH/open/information/getEmp.do",map);
164 JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString());
165 List<UserBaseInfoYwResult> userList = JSONObject.parseArray(json.get("rows").toString(), UserBaseInfoYwResult.class);
166 for (UserBaseInfoYwResult userBaseInfoYwResult : userList) {
167 UserBaseInfo userBaseInfo = new UserBaseInfo();
168 userBaseInfo.setDeviceCode(userBaseInfoYwResult.getDeviceno());
169 userBaseInfo.setUserName(userBaseInfoYwResult.getEmpname());
170 userBaseInfo.setUserNo(userBaseInfoYwResult.getEmpno());
171 userBaseInfo.setUserType("员工");
172 list.add(userBaseInfo);
173 }
174 return list;
175 }
151 } 176 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!