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