|
@ -2,7 +2,6 @@ package com.ccsens.logistics.service; |
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.ccsens.logistics.Util.Constant; |
|
|
import com.ccsens.logistics.Util.Constant; |
|
@ -12,7 +11,6 @@ import com.ccsens.logistics.bean.po.LogisticsEquipmentExample; |
|
|
import com.ccsens.logistics.bean.po.LogisticsHeatImagingRecord; |
|
|
import com.ccsens.logistics.bean.po.LogisticsHeatImagingRecord; |
|
|
import com.ccsens.logistics.persist.mapper.LogisticsEquipmentMapper; |
|
|
import com.ccsens.logistics.persist.mapper.LogisticsEquipmentMapper; |
|
|
import com.ccsens.logistics.persist.mapper.LogisticsHeatImagingRecordMapper; |
|
|
import com.ccsens.logistics.persist.mapper.LogisticsHeatImagingRecordMapper; |
|
|
import lombok.Data; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
@ -23,6 +21,9 @@ import java.math.BigDecimal; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @author 逗 |
|
|
|
|
|
*/ |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|
@ -66,6 +67,11 @@ public class ThermalImageryService implements IThermalImageryService{ |
|
|
//TODO 心跳不处理
|
|
|
//TODO 心跳不处理
|
|
|
break; |
|
|
break; |
|
|
case Constant.THERMAL_IMAGERY: |
|
|
case Constant.THERMAL_IMAGERY: |
|
|
|
|
|
LogisticsEquipmentExample equipmentExample = new LogisticsEquipmentExample(); |
|
|
|
|
|
equipmentExample.createCriteria().andEquipmentNumberEqualTo(thermalImagery.getThing_id()); |
|
|
|
|
|
List<LogisticsEquipment> logisticsEquipments = logisticsEquipmentMapper.selectByExample(equipmentExample); |
|
|
|
|
|
if (CollectionUtil.isNotEmpty(logisticsEquipments)) { |
|
|
|
|
|
LogisticsEquipment equipment = logisticsEquipments.get(0); |
|
|
if (StrUtil.isNotEmpty(thermalImagery.getData())) { |
|
|
if (StrUtil.isNotEmpty(thermalImagery.getData())) { |
|
|
ThermalImageryDto.GetThermalImageryDate date = JSONObject.parseObject(thermalImagery.getData(), ThermalImageryDto.GetThermalImageryDate.class); |
|
|
ThermalImageryDto.GetThermalImageryDate date = JSONObject.parseObject(thermalImagery.getData(), ThermalImageryDto.GetThermalImageryDate.class); |
|
|
LogisticsHeatImagingRecord heatImagingRecord = new LogisticsHeatImagingRecord(); |
|
|
LogisticsHeatImagingRecord heatImagingRecord = new LogisticsHeatImagingRecord(); |
|
@ -73,14 +79,16 @@ public class ThermalImageryService implements IThermalImageryService{ |
|
|
heatImagingRecord.setMaxT(new BigDecimal(date.getMaxT())); |
|
|
heatImagingRecord.setMaxT(new BigDecimal(date.getMaxT())); |
|
|
heatImagingRecord.setMaxTx(date.getMaxTx()); |
|
|
heatImagingRecord.setMaxTx(date.getMaxTx()); |
|
|
heatImagingRecord.setMaxTy(date.getMaxTy()); |
|
|
heatImagingRecord.setMaxTy(date.getMaxTy()); |
|
|
heatImagingRecord.setImageData(date.getImageData()); |
|
|
heatImagingRecord.setImageData("data:image/png;base64," + date.getImageData()); |
|
|
|
|
|
heatImagingRecord.setRecordTime(System.currentTimeMillis()); |
|
|
|
|
|
heatImagingRecord.setEquipmentId(equipment.getId()); |
|
|
heatImagingRecordMapper.insertSelective(heatImagingRecord); |
|
|
heatImagingRecordMapper.insertSelective(heatImagingRecord); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
thermalImagery.getType(); |
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.info("解析热成像返回数据异常 {}", e); |
|
|
log.info("解析热成像返回数据异常 {}", e); |
|
|
} |
|
|
} |
|
|