调整
This commit is contained in:
parent
febbb1777f
commit
4024a94338
|
@ -135,6 +135,9 @@ public class AppVerifyController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisLock redisLock;
|
private RedisLock redisLock;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IEtLocationLogService etLocationLogService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障上报
|
* 故障上报
|
||||||
|
@ -1726,6 +1729,7 @@ public class AppVerifyController extends BaseController
|
||||||
}
|
}
|
||||||
logger.info("【根据时间查询车辆轨迹】:{}",sn,startTime,endTime);
|
logger.info("【根据时间查询车辆轨迹】:{}",sn,startTime,endTime);
|
||||||
List<EtLocationLog> trajectoryDetails = asDeviceService.trajectoryDetails(sn,startTime,endTime);
|
List<EtLocationLog> trajectoryDetails = asDeviceService.trajectoryDetails(sn,startTime,endTime);
|
||||||
|
etLocationLogService.analytic(trajectoryDetails);
|
||||||
ajax.put(AjaxResult.DATA_TAG,trajectoryDetails);
|
ajax.put(AjaxResult.DATA_TAG,trajectoryDetails);
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2775,8 +2775,8 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
@Override
|
@Override
|
||||||
public List<EtLocationLog> trajectoryDetails(String sn, String startTime,String endTime) {
|
public List<EtLocationLog> trajectoryDetails(String sn, String startTime,String endTime) {
|
||||||
AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
|
AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
|
||||||
List<EtLocationLog> etLocationLogs = etLocationLogMapper.selectEtLocationLogListByCreateTime(device.getMac(), startTime, endTime);
|
if(device == null) throw new RuntimeException("设备不存在");
|
||||||
return etLocationLogs;
|
return etLocationLogMapper.selectEtLocationLogListByCreateTime(device.getMac(), startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2884,40 +2884,37 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
public boolean updateLatestLocation(String sn) {
|
public boolean updateLatestLocation(String sn) {
|
||||||
AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
|
AsDevice device = asDeviceMapper.selectAsDeviceBySn(sn);
|
||||||
if(device!=null){
|
if(device!=null){
|
||||||
String version = device.getVersion();
|
String token = Token.getToken();
|
||||||
if(StrUtil.isBlank(version)){
|
DataPointRes datapoints = historyDatapoints(asDeviceMapper.selectAsDeviceBySn(sn).getMac(), token);
|
||||||
String token = Token.getToken();
|
if(datapoints.getCode() == 0){
|
||||||
DataPointRes datapoints = historyDatapoints(asDeviceMapper.selectAsDeviceBySn(sn).getMac(), token);
|
Data data = datapoints.getData();
|
||||||
if(datapoints.getCode() == 0){
|
List<Datastream> datastreams = data.getDevices();
|
||||||
Data data = datapoints.getData();
|
for (Datastream datastream: datastreams) {
|
||||||
List<Datastream> datastreams = data.getDevices();
|
List<Datapoint> datapointList = datastream.getDatastreams();
|
||||||
for (Datastream datastream: datastreams) {
|
if(ObjectUtil.isNotNull(datapointList)){
|
||||||
List<Datapoint> datapointList = datastream.getDatastreams();
|
for (Datapoint datapoint:datapointList) {
|
||||||
if(ObjectUtil.isNotNull(datapointList)){
|
if(datapoint.getId().equals(IotConstants.ONENET_LOCATION)){
|
||||||
for (Datapoint datapoint:datapointList) {
|
String string = JSON.toJSONString(datapoint.getValue());
|
||||||
if(datapoint.getId().equals(IotConstants.ONENET_LOCATION)){
|
String at = datapoint.getAt();
|
||||||
String string = JSON.toJSONString(datapoint.getValue());
|
if(StrUtil.isNotBlank(string)){
|
||||||
String at = datapoint.getAt();
|
LocationVo locationVo = JSONObject.parseObject(string, LocationVo.class);
|
||||||
if(StrUtil.isNotBlank(string)){
|
log.info("【手动更新】: locationVo---【{}】" , JSON.toJSONString(locationVo));
|
||||||
LocationVo locationVo = JSONObject.parseObject(string, LocationVo.class);
|
double[] doubles = CommonUtil.coordinateConvert(locationVo.getLon(), locationVo.getLat());
|
||||||
log.info("【手动更新】: locationVo---【{}】" , JSON.toJSONString(locationVo));
|
BigDecimal lat = new BigDecimal(doubles[0]).setScale(8, RoundingMode.HALF_UP);
|
||||||
double[] doubles = CommonUtil.coordinateConvert(locationVo.getLon(), locationVo.getLat());
|
BigDecimal lon = new BigDecimal(doubles[1]).setScale(8, RoundingMode.HALF_UP);
|
||||||
BigDecimal lat = new BigDecimal(doubles[0]).setScale(8, RoundingMode.HALF_UP);
|
log.info("转换后的GCJ02经纬度:" + lon + "---" + lat);
|
||||||
BigDecimal lon = new BigDecimal(doubles[1]).setScale(8, RoundingMode.HALF_UP);
|
if(BigDecimal.ZERO.compareTo(lon) != 0 && BigDecimal.ZERO.compareTo(lat) != 0){
|
||||||
log.info("转换后的GCJ02经纬度:" + lon + "---" + lat);
|
/** 计算电量和里程后更新设备*/
|
||||||
if(BigDecimal.ZERO.compareTo(lon) != 0 && BigDecimal.ZERO.compareTo(lat) != 0){
|
int i = updateDevice(at,locationVo, device, lon, lat);
|
||||||
/** 计算电量和里程后更新设备*/
|
if(i > 0){
|
||||||
int i = updateDevice(at,locationVo, device, lon, lat);
|
log.info("【手动更新】===>更新设备成功");
|
||||||
if(i > 0){
|
return true;
|
||||||
log.info("【手动更新】===>更新设备成功");
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
log.info("【手动更新】===>更新设备失败");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
noLocationUpdateDevice(at,locationVo,device);
|
log.info("【手动更新】===>更新设备失败");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
noLocationUpdateDevice(at,locationVo,device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="type != null and type != ''"> and type like concat('%', #{type}, '%')</if>
|
<if test="type != null and type != ''"> and type like concat('%', #{type}, '%')</if>
|
||||||
<if test="result != null and result != ''"> and result like concat('%', #{result}, '%')</if>
|
<if test="result != null and result != ''"> and result like concat('%', #{result}, '%')</if>
|
||||||
<if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
|
<if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
|
||||||
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
||||||
<if test="callStatus != null and callStatus != ''"> and call_status = #{callStatus}</if>
|
<if test="callStatus != null and callStatus != ''"> and call_status = #{callStatus}</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
|
|
|
@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEtLocationLogListByCreateTime" parameterType="EtLocationLog" resultMap="EtLocationLogResult">
|
<select id="selectEtLocationLogListByCreateTime" parameterType="EtLocationLog" resultMap="EtLocationLogResult">
|
||||||
<include refid="selectEtLocationLogVoNoMsg"/>
|
<include refid="selectEtLocationLogVo"/>
|
||||||
where longitude != '0E-8' and latitude != '0E-8'
|
where longitude != '0E-8' and latitude != '0E-8'
|
||||||
<if test="mac != null and mac != ''"> and mac = #{mac}</if>
|
<if test="mac != null and mac != ''"> and mac = #{mac}</if>
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user