34445ef6 张雷

电子围栏接口修改

1 个父辈 b2e107ad
......@@ -7,6 +7,7 @@ import com.jkdata.entity.SafeArea;
import com.jkdata.entity.ThirdPosition;
import com.jkdata.service.IThirdService;
import com.jkdata.tool.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -24,6 +25,7 @@ public class ThirdController {
@Autowired
private IThirdService thirdService;
@ApiOperation(value="接收定位数据", notes="接收定位数据")
@PostMapping("/receivePosition")
public Result<Map<String,Object>> save(HttpServletRequest request, HttpServletResponse response) {
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
......@@ -80,6 +82,7 @@ public class ThirdController {
* 获取人员实时定位
* @return
*/
@ApiOperation(value="获取人员实时定位", notes="获取人员实时定位")
@GetMapping("/realTimeLocation")
public Result<ThirdPosition> getRealTimeLocation(String deviceId) {
Result<ThirdPosition> result = new Result<ThirdPosition>();
......@@ -93,6 +96,7 @@ public class ThirdController {
* 获取静态资源信息
* @return
*/
@ApiOperation(value="获取静态资源信息", notes="获取静态资源信息")
@GetMapping("/buildingAllInfo")
public Result<JSONObject> getBuildingAllInfo() {
Result<JSONObject> result = new Result<JSONObject>();
......@@ -108,6 +112,7 @@ public class ThirdController {
* @param deviceId
* @return
*/
@ApiOperation(value="获取历史轨迹", notes="获取历史轨迹")
@GetMapping("/positionByDeviceId")
public Result<List<HistoryPoint>> getPositionByDeviceId(String deviceId, String startTime, String endTime) {
Result<List<HistoryPoint>> result = new Result<List<HistoryPoint>>();
......@@ -121,6 +126,7 @@ public class ThirdController {
* 获取告警信息-最新 n 条
* @return
*/
@ApiOperation(value="获取告警信息", notes="获取告警信息")
@GetMapping("/alarmListByCount")
public Result<Object> getAlarmListByCount() {
Result<Object> result = new Result<Object>();
......@@ -135,6 +141,7 @@ public class ThirdController {
* 获取最近7天的告警统计数据
* @return
*/
@ApiOperation(value="获取最近7天的告警统计数据", notes="获取最近7天的告警统计数据")
@GetMapping("/weekAlarmState")
public Result<Object> getWeekAlarmState() {
Result<Object> result = new Result<Object>();
......@@ -149,10 +156,11 @@ public class ThirdController {
* 获取安全区域
* @return
*/
@ApiOperation(value="获取安全区域", notes="获取安全区域")
@GetMapping("/safeArea")
public Result<List<SafeArea>> getSafeArea() {
Result<List<SafeArea>> result = new Result<List<SafeArea>>();
List<SafeArea> list = thirdService.getSafeArea();
List<SafeArea> list = thirdService.getSafeAreaNew();
result.setSuccess(true);
result.setResult(list);
return result;
......
......@@ -8,33 +8,21 @@ public class SafeArea {
/**主键*/
private Integer id;
/**设备ID*/
private String deviceIds;
/**区域坐标*/
private String areas;
/**区域名称*/
private String name;
/**区域简介*/
private String comment;
/**构筑物描述*/
private Integer threshold;
/**项目编码*/
private Integer buildingId;
/**楼层编码*/
private Integer floorId;
/**报警类型*/
private String alarmType;
/**创建时间*/
private String createTime;
/** */
private Integer isSwitch;
/** */
private Integer areaType;
/** */
private Integer typeId;
/** */
private String startTime;
/** */
private String endTime;
/**区域简介*/
private String mTypeDefine;
/**状态*/
private String isShow;
/**类型*/
private Integer mType;
/**区域颜色*/
private String bgColor;
}
......
package com.jkdata.entity;
import lombok.Data;
@Data
public class SafeAreaNew {
/**主键*/
private Integer id;
/**区域坐标*/
private String areas;
/**区域名称*/
private String mName;
/**区域简介*/
private String mTypeDefine;
/**状态*/
private String isShow;
/**类型*/
private Integer mType;
/**楼层编码*/
private Integer floorId;
/**项目编码*/
private Integer buildingId;
/**区域颜色*/
private String bgColor;
/**创建时间*/
private String createTime;
}
......@@ -23,4 +23,6 @@ public interface IThirdService {
ThirdPosition getRealTimeLocation(String deviceId);
List<SafeArea> getSafeArea();
List<SafeArea> getSafeAreaNew();
}
......
......@@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.jkdata.entity.HistoryPoint;
import com.jkdata.entity.SafeArea;
import com.jkdata.entity.SafeAreaNew;
import com.jkdata.tool.*;
import com.jkdata.entity.ThirdPosition;
import com.jkdata.mapper.ThirdMapper;
......@@ -216,5 +217,44 @@ public class IThirdServiceImpl implements IThirdService {
return list;
}
@Override
public List<SafeArea> getSafeAreaNew() {
List<SafeArea> list = new ArrayList<>();
String get = getBuildingAllInfo();
JSONObject json = JSONObject.parseObject(get);
Map jsonToMap = JSONObject.parseObject(json.toJSONString());
JSONObject dataJson = JSONObject.parseObject(jsonToMap.get("data").toString());
Map safeMap = JSONObject.parseObject(dataJson.toJSONString());
List<SafeAreaNew> dataList = JSONObject.parseArray(safeMap.get("monitoringArea").toString(), SafeAreaNew.class);
for (SafeAreaNew safeAreaNew : dataList) {
SafeArea safeArea = new SafeArea();
String areas = safeAreaNew.getAreas();//66&363,100&348,108&367,74&381
List<String> arealist = Arrays.asList(areas.split(","));
StringBuffer data = new StringBuffer();
for (String area:arealist) {
String x1 = area.split("&")[0];
String y1 = area.split("&")[1];
Map<String,Double> map = new HashMap<>();//初始化
if(safeAreaNew.getFloorId()==26){
map = CoordinateUtil.changCoordinate("B2",x1,y1);
}else{
map = CoordinateUtil.changCoordinate("B1",x1,y1);
}
data.append(String.valueOf(map.get("x"))+"&"+String.valueOf(map.get("y"))).append(",");
}
safeArea.setAreas(data.toString().substring(0,data.toString().length()-1));
safeArea.setBuildingId(safeAreaNew.getBuildingId());
safeArea.setId(safeAreaNew.getId());
safeArea.setName(safeAreaNew.getMName());
safeArea.setMTypeDefine(safeAreaNew.getMTypeDefine());
safeArea.setBgColor(safeAreaNew.getBgColor());
safeArea.setFloorId(safeAreaNew.getFloorId());
safeArea.setIsShow(safeAreaNew.getIsShow());
safeArea.setMType(safeAreaNew.getMType());
list.add(safeArea);
}
return list;
}
}
......
......@@ -7,12 +7,12 @@ spring:
datasource:
druid:
driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://115.28.25.233:6630/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false
# username: jk_test
# password: Jk_test1211rw
url: jdbc:mysql://127.0.0.1:13306/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: root
password: bkyh925.
url: jdbc:mysql://115.28.25.233:6630/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: jk_test
password: Jk_test1211rw
# url: jdbc:mysql://127.0.0.1:13306/zhsw-bkyh?characterEncoding=UTF-8&useUnicode=true&useSSL=false
# username: root
# password: bkyh925.
redis:
port: 6379
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!