Merge branch 'dev-nx' of http://192.168.0.56:3000/bonus/devicesmgt into dev-nx
This commit is contained in:
commit
f97ccbc0bc
|
|
@ -22,6 +22,7 @@ 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;
|
||||
|
|
@ -30,6 +31,7 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
/**
|
||||
* iot设备管理实现层
|
||||
*
|
||||
* @author ma_sh
|
||||
*/
|
||||
@Service
|
||||
|
|
@ -283,6 +285,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 获取定位
|
||||
*
|
||||
* @param iotDto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -292,20 +295,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);
|
||||
|
|
@ -314,6 +317,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 查询行程
|
||||
*
|
||||
* @param iotLocationVo
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -323,25 +327,26 @@ 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
|
||||
*/
|
||||
|
|
@ -352,20 +357,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);
|
||||
|
|
@ -374,6 +379,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 解析停留点返回报文
|
||||
*
|
||||
* @param res
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -388,7 +394,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();
|
||||
|
|
@ -396,6 +402,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -405,6 +413,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 绑定设备APP
|
||||
*
|
||||
* @param iotDto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -445,6 +454,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 报警记录
|
||||
*
|
||||
* @param iotLocationVo
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -455,24 +465,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);
|
||||
|
|
@ -481,6 +491,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 解析报警返回报文
|
||||
*
|
||||
* @param res
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -495,7 +506,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));
|
||||
|
|
@ -512,6 +523,7 @@ public class IotMachineServiceImpl implements IotMachineService {
|
|||
|
||||
/**
|
||||
* 解析定位返回报文
|
||||
*
|
||||
* @param res
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -526,7 +538,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));
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND mt.level IN ('1','2','3','4')
|
||||
</if>
|
||||
</if>
|
||||
ORDER BY mt.create_time
|
||||
</select>
|
||||
<!--资产属性-->
|
||||
<select id="getAssetAttributesCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue