Compare commits
No commits in common. "73ca957a7ce7a96a6c856ffa01b8584cfed5f6d5" and "212095bea9e3dd8bb8ec72ce6beadadd3c60aa15" have entirely different histories.
73ca957a7c
...
212095bea9
|
|
@ -22,7 +22,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -31,7 +30,6 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
/**
|
||||
* iot设备管理实现层
|
||||
*
|
||||
* @author ma_sh
|
||||
*/
|
||||
@Service
|
||||
|
|
@ -285,7 +283,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 获取定位
|
||||
*
|
||||
* @param iotDto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -295,20 +292,20 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
if (iotDto == null || StringUtils.isBlank(iotDto.getIotId())) {
|
||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||
}
|
||||
List<String> list = new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<String> list=new ArrayList<>();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
//从redis中获取token
|
||||
String redisCode = redisService.getCacheObject(TokenConstants.TOKEN_LOCATION);
|
||||
//如果token为空,先去调登录接口,获取token
|
||||
if (redisCode == null) {
|
||||
if (redisCode == null){
|
||||
redisCode = HttpHelper.getIotToken();
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION, redisCode, 23L, TimeUnit.HOURS);
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION,redisCode,23L, TimeUnit.HOURS);
|
||||
}
|
||||
map.clear();
|
||||
list.add(iotDto.getIotId());
|
||||
map.put("deviceids", list);
|
||||
map.put("deviceids",list);
|
||||
String param = JSON.toJSONString(map);
|
||||
String res = HttpHelper.doPost(HttpStatus.LAST_POSITION_URL + redisCode, param);
|
||||
String res = HttpHelper.doPost(HttpStatus.LAST_POSITION_URL+redisCode,param);
|
||||
//对返回的结果进行解析
|
||||
IotLocationVo iotLocationVo = resultDataHandler(res);
|
||||
log.info("resultDataHandler:{}", iotLocationVo);
|
||||
|
|
@ -317,7 +314,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 查询行程
|
||||
*
|
||||
* @param iotLocationVo
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -327,26 +323,25 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
//从redis中获取token
|
||||
String redisCode = redisService.getCacheObject(TokenConstants.TOKEN_LOCATION);
|
||||
//如果token为空,先去调登录接口,获取token
|
||||
if (redisCode == null) {
|
||||
if (redisCode == null){
|
||||
redisCode = HttpHelper.getIotToken();
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION, redisCode, 23L, TimeUnit.HOURS);
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION,redisCode,23L, TimeUnit.HOURS);
|
||||
}
|
||||
map.clear();
|
||||
map.put("deviceid", iotLocationVo.getIotId());
|
||||
map.put("begintime", iotLocationVo.getBeginTime());
|
||||
map.put("endtime", iotLocationVo.getEndTime());
|
||||
map.put("deviceid",iotLocationVo.getIotId());
|
||||
map.put("begintime",iotLocationVo.getBeginTime());
|
||||
map.put("endtime",iotLocationVo.getEndTime());
|
||||
String param = JSON.toJSONString(map);
|
||||
String res = HttpHelper.doPost(HttpStatus.QUERY_TRIPS_URL + redisCode, param);
|
||||
String res = HttpHelper.doPost(HttpStatus.QUERY_TRIPS_URL+redisCode,param);
|
||||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询停留点
|
||||
*
|
||||
* @param iotLocationVo
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -357,20 +352,20 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
if (iotLocationVo == null || iotLocationVo.getBeginTime() == null || iotLocationVo.getEndTime() == null) {
|
||||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
//从redis中获取token
|
||||
String redisCode = redisService.getCacheObject(TokenConstants.TOKEN_LOCATION);
|
||||
//如果token为空,先去调登录接口,获取token
|
||||
if (redisCode == null) {
|
||||
if (redisCode == null){
|
||||
redisCode = HttpHelper.getIotToken();
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION, redisCode, 23L, TimeUnit.HOURS);
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION,redisCode,23L, TimeUnit.HOURS);
|
||||
}
|
||||
map.clear();
|
||||
map.put("deviceid", iotLocationVo.getIotId());
|
||||
map.put("begintime", iotLocationVo.getBeginTime());
|
||||
map.put("endtime", iotLocationVo.getEndTime());
|
||||
map.put("deviceid",iotLocationVo.getIotId());
|
||||
map.put("begintime",iotLocationVo.getBeginTime());
|
||||
map.put("endtime",iotLocationVo.getEndTime());
|
||||
String param = JSON.toJSONString(map);
|
||||
String res = HttpHelper.doPost(HttpStatus.REPORT_PARK_DETAIL_BY_TIME_URL + redisCode, param);
|
||||
String res = HttpHelper.doPost(HttpStatus.REPORT_PARK_DETAIL_BY_TIME_URL+redisCode,param);
|
||||
//对返回的结果进行解析
|
||||
List<IotLocationVo> iotLocationVoList = resultReportParkDetailByTime(res);
|
||||
log.info("resultDataHandler:{}", iotLocationVo);
|
||||
|
|
@ -379,7 +374,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 解析停留点返回报文
|
||||
*
|
||||
* @param res
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -394,7 +388,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
if ("OK".equals(cause) && "0".equals(status)) {
|
||||
String records = object.getString("records");
|
||||
//判断返回结果是否为空
|
||||
if (records != null) {
|
||||
if (records != null){
|
||||
JSONArray jsonArray = JSON.parseArray(records);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
IotLocationVo iotLocationVo = new IotLocationVo();
|
||||
|
|
@ -402,8 +396,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
iotLocationVo.setBeginTime(jsonObject.getString("starttime"));
|
||||
iotLocationVo.setEndTime(jsonObject.getString("endtime"));
|
||||
iotLocationVo.setAddress(jsonObject.getString("address"));
|
||||
iotLocationVo.setCallat(new BigDecimal(jsonObject.getString("callat")));
|
||||
iotLocationVo.setCallon(new BigDecimal(jsonObject.getString("callon")));
|
||||
iotLocationVoList.add(iotLocationVo);
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +405,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 绑定设备APP
|
||||
*
|
||||
* @param iotDto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -454,7 +445,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 报警记录
|
||||
*
|
||||
* @param iotLocationVo
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -465,24 +455,24 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
throw new RuntimeException(ExceptionEnum.PARAM_NULL.getMsg());
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<String> list = new ArrayList<>();
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
List<String> list=new ArrayList<>();
|
||||
//从redis中获取token
|
||||
String redisCode = redisService.getCacheObject(TokenConstants.TOKEN_LOCATION);
|
||||
//如果token为空,先去调登录接口,获取token
|
||||
if (redisCode == null) {
|
||||
if (redisCode == null){
|
||||
redisCode = HttpHelper.getIotToken();
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION, redisCode, 23L, TimeUnit.HOURS);
|
||||
redisService.setCacheObject(TokenConstants.TOKEN_LOCATION,redisCode,23L, TimeUnit.HOURS);
|
||||
}
|
||||
map.clear();
|
||||
list.add(iotLocationVo.getIotId().toString());
|
||||
map.put("devices", list);
|
||||
map.put("startday", iotLocationVo.getBeginTime());
|
||||
map.put("endday", iotLocationVo.getEndTime());
|
||||
map.put("devices",list);
|
||||
map.put("startday",iotLocationVo.getBeginTime());
|
||||
map.put("endday",iotLocationVo.getEndTime());
|
||||
//报警类型
|
||||
map.put("needalarm", "");
|
||||
map.put("needalarm","");
|
||||
String param = JSON.toJSONString(map);
|
||||
String res = HttpHelper.doPost(HttpStatus.REPORT_ALARM_URL + redisCode, param);
|
||||
String res = HttpHelper.doPost(HttpStatus.REPORT_ALARM_URL+redisCode,param);
|
||||
//对返回的结果进行解析
|
||||
List<IotLocationVo> iotLocationVoList = resultReportAlarm(res);
|
||||
log.info("resultDataHandler:{}", iotLocationVo);
|
||||
|
|
@ -491,7 +481,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 解析报警返回报文
|
||||
*
|
||||
* @param res
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -506,7 +495,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
if ("OK".equals(cause) && "0".equals(status)) {
|
||||
String records = object.getString("alarmrecords");
|
||||
//判断返回结果是否为空
|
||||
if (records != null) {
|
||||
if (records != null){
|
||||
JSONArray jsonArray = JSON.parseArray(records);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = JSONObject.from(jsonArray.getJSONObject(i));
|
||||
|
|
@ -523,7 +512,6 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 解析定位返回报文
|
||||
*
|
||||
* @param res
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -538,7 +526,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
if ("0".equals(status) && "OK".equals(cause)) {
|
||||
String records = object.getString("records");
|
||||
//判断返回结果是否为空
|
||||
if (records != null) {
|
||||
if (records != null){
|
||||
JSONArray jsonArray = JSON.parseArray(records);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = JSONObject.from(jsonArray.getJSONObject(i));
|
||||
|
|
|
|||
Loading…
Reference in New Issue