dad1f09b 张雷

人员定位系统对接开发

1 个父辈 7dfb2818
......@@ -3,6 +3,7 @@ package com.skua.modules.location.controller;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.modules.location.UserLocationFactory;
import com.skua.modules.location.entity.UserBaseInfo;
import com.skua.modules.location.entity.UserLocation;
import com.skua.modules.location.service.ILocationService;
import io.swagger.annotations.Api;
......@@ -22,6 +23,19 @@ import java.util.List;
public class UserLocationController {
//*****************************************义乌人员定位**********************************************//
@AutoLog(value = "义乌人员定位-获取所有人员列表")
@ApiOperation(value="义乌人员定位-获取所有人员列表", notes="义乌人员定位-获取所有人员列表")
@GetMapping(value = "/getAllUser")
public Result<List<UserBaseInfo>> getAllUser() {
Result<List<UserBaseInfo>> result = new Result<List<UserBaseInfo>>();
List<UserBaseInfo> list = new ArrayList<>();
ILocationService locationService = UserLocationFactory.getLocationService("YW");
list = locationService.getAllUser();
result.setResult(list);
result.setSuccess(true);
return result;
}
@AutoLog(value = "义乌人员定位-获取所有人员实时定位数据")
@ApiOperation(value="义乌人员定位-获取所有人员实时定位数据", notes="义乌人员定位-获取所有人员实时定位数据")
@GetMapping(value = "/getAllUserGPS")
......
package com.skua.modules.location.entity;
import lombok.Data;
/**
* 人员定位数据
*/
@Data
public class UserBaseInfo {
/**设备编码*/
private String deviceCode;
/**用户类型*/
private String userType;
/**人员名称*/
private String userName;
/**人员工号*/
private String userNo;
/**人员头像*/
private String userIcon;
}
package com.skua.modules.location.entity;
import lombok.Data;
/**
* 人员详细信息
*/
@Data
public class UserBaseInfoYwResult {
private String branchtypeid;
private String worktypename;
private String elasttime;
private String worktype;
private Integer id;
private String empno;
private String empname;
private String locatorNum;
private String iccard;
private String deviceno;
private String empsex;
private String idcard;
private String tel;
private String addr;
private Integer h_id;
private Integer isvalid;
private String departmentId;
private String departmentName;
private String lasttime;
}
......@@ -10,8 +10,12 @@ public class UserLocation {
/**设备编码*/
private String deviceCode;
/**设备类型*/
private String deviceType;
/**人员名称*/
private String userName;
/**人员头像*/
private String userIcon;
/**X坐标*/
private Double x;
/**Y坐标*/
......
package com.skua.modules.location.service;
import com.skua.modules.location.entity.UserBaseInfo;
import com.skua.modules.location.entity.UserLocation;
import java.util.List;
......@@ -9,4 +10,6 @@ public interface ILocationService {
List<UserLocation> getAllUserGPS();
List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime);
List<UserBaseInfo> getAllUser();
}
......
package com.skua.modules.location.service.impl;
import com.skua.modules.location.entity.UserBaseInfo;
import com.skua.modules.location.entity.UserLocation;
import com.skua.modules.location.service.ILocationService;
import org.springframework.stereotype.Service;
......@@ -61,5 +62,9 @@ public class BkyhLocationServiceImpl implements ILocationService {
return list;
}
@Override
public List<UserBaseInfo> getAllUser() {
return null;
}
}
......
package com.skua.modules.location.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.skua.modules.location.entity.UserLocation;
import com.skua.modules.location.entity.UserLocationYwResult;
import com.skua.modules.location.entity.UserLocationHistoryYwResult;
import com.skua.modules.location.entity.*;
import com.skua.modules.location.service.ILocationService;
import com.skua.modules.location.util.ChangeLocationUtils;
import org.springframework.stereotype.Service;
......@@ -62,29 +61,29 @@ public class YwLocationServiceImpl implements ILocationService {
String get = "{\n" +
"\"data\":\n" +
"[{\n" +
"\"empName\":\"张小凡\",\n" +
"\"empName\":\"贾伟峰\",\n" +
"\"area\":\"2\",\n" +
"\"deviceNo\":\"f1843311\",\n" +
"\"crossY\":\"1100\",\n" +
"\"crossX\":\"2670\",\n" +
"\"deviceNo\":\"16a7ebee\",\n" +
"\"crossY\":\"-8438\",\n" +
"\"crossX\":\"7186\",\n" +
"\"longitude\":104.04438600000114,\n" +
"\"latitude\":30.630693000000115,\n" +
"\"dateTime\":\"2019-05-05 11:35:52\",\n" +
"\"layer\":\"1\",\n" +
"\"empNo\":\"12123\",\n" +
"\"dateTime\":\"2022-05-05 11:35:52\",\n" +
"\"layer\":\"-1\",\n" +
"\"empNo\":\"108036\",\n" +
"\"specifictype\":\"0\"\n" +
"},\n" +
"{\n" +
"\"empName\":\"张大凡\",\n" +
"\"empName\":\"何成翔\",\n" +
"\"area\":\"2\",\n" +
"\"deviceNo\":\"f1843310\",\n" +
"\"crossY\":\"1111\",\n" +
"\"crossX\":\"2666\",\n" +
"\"longitude\":124.04438600000114,\n" +
"\"latitude\":31.630693000000115,\n" +
"\"dateTime\":\"2019-05-05 11:35:52\",\n" +
"\"layer\":\"1\",\n" +
"\"empNo\":\"12121\",\n" +
"\"deviceNo\":\"169c0cba\",\n" +
"\"crossY\":\"-8312\",\n" +
"\"crossX\":\"32438\",\n" +
"\"longitude\":124.01230000114,\n" +
"\"latitude\":31.6301230000115,\n" +
"\"dateTime\":\"2022-05-05 11:35:52\",\n" +
"\"layer\":\"-1\",\n" +
"\"empNo\":\"147258\",\n" +
"\"specifictype\":\"0\"\n" +
"}],\n" +
"\"status\":0,\n" +
......@@ -95,13 +94,16 @@ public class YwLocationServiceImpl implements ILocationService {
getLocationBasicInfo();//坐标转换基础信息
for (UserLocationYwResult userLocationYwResult : getList) {
UserLocation userLocation = new UserLocation();
userLocation.setDeviceType("员工");
userLocation.setFloor(userLocationYwResult.getLayer());
userLocation.setDeviceCode(userLocationYwResult.getDeviceNo());
userLocation.setUserName(userLocationYwResult.getEmpName());
Map<String,Object> map = ChangeLocationUtils.changeUserLocation(userLocationYwResult.getLayer(), String.valueOf(userLocationYwResult.getCrossX()),
String.valueOf(userLocationYwResult.getCrossY()), locationBasicInfo);
userLocation.setX(Double.valueOf(map.get("x").toString()));
userLocation.setY(Double.valueOf(map.get("y").toString()));
// Map<String,Object> map = ChangeLocationUtils.changeUserLocation(userLocationYwResult.getLayer(), String.valueOf(userLocationYwResult.getCrossX()),
// String.valueOf(userLocationYwResult.getCrossY()), locationBasicInfo);
// userLocation.setX(Double.valueOf(map.get("x").toString()));
// userLocation.setY(Double.valueOf(map.get("y").toString()));
userLocation.setX(userLocationYwResult.getCrossX());
userLocation.setY(userLocationYwResult.getCrossY());
userLocation.setDateTime(userLocationYwResult.getDateTime());
list.add(userLocation);
}
......@@ -114,7 +116,7 @@ public class YwLocationServiceImpl implements ILocationService {
String get = "{\n" +
"\"data\":[\n" +
"{\n" +
"\"name\":\"何小龙\",\n" +
"\"name\":\"贾伟峰\",\n" +
"\"time\":\"2020-04-20 00:02:35\",\n" +
"\"x\":\"3539.05\",\n" +
"\"y\":\"2711.93\",\n" +
......@@ -122,7 +124,7 @@ public class YwLocationServiceImpl implements ILocationService {
"\"lon\":121.05223514735032\n" +
"},\n" +
"{\n" +
"\"name\":\"何小龙\",\n" +
"\"name\":\"贾伟峰\",\n" +
"\"time\":\"2020-04-20 00:02:45\",\n" +
"\"x\":\"3536.05\",\n" +
"\"y\":\"2611.93\",\n" +
......@@ -148,4 +150,27 @@ public class YwLocationServiceImpl implements ILocationService {
}
return list;
}
@Override
public List<UserBaseInfo> getAllUser() {
List<UserBaseInfo> list = new ArrayList<>();
HashMap<String,Object> map = new HashMap<>();
map.put("username","ywsjh");
map.put("password","ywsjh@2023");
map.put("page",1);
map.put("rows",800);
map.put("emp","");
String post = HttpUtil.get("http://xylie.tpddns.cn:8084/YWSJH/open/information/getEmp.do",map);
JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString());
List<UserBaseInfoYwResult> userList = JSONObject.parseArray(json.get("rows").toString(), UserBaseInfoYwResult.class);
for (UserBaseInfoYwResult userBaseInfoYwResult : userList) {
UserBaseInfo userBaseInfo = new UserBaseInfo();
userBaseInfo.setDeviceCode(userBaseInfoYwResult.getDeviceno());
userBaseInfo.setUserName(userBaseInfoYwResult.getEmpname());
userBaseInfo.setUserNo(userBaseInfoYwResult.getEmpno());
userBaseInfo.setUserType("员工");
list.add(userBaseInfo);
}
return list;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!