|
|
@ -1,10 +1,15 @@ |
|
|
|
package com.ccsens.logistics.service; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.ccsens.logistics.bean.dto.MbpsDto; |
|
|
|
import com.ccsens.logistics.bean.po.LogisticsWarehouse; |
|
|
|
import com.ccsens.logistics.bean.po.LogisticsWarehouseExample; |
|
|
|
import com.ccsens.logistics.bean.vo.MbpsVo; |
|
|
|
import com.ccsens.logistics.persist.dao.LogisticsCarRecordDao; |
|
|
|
import com.ccsens.logistics.persist.dao.LogisticsEnvironmentRecordDao; |
|
|
|
import com.ccsens.logistics.persist.dao.LogisticsHeatImagingRecordDao; |
|
|
|
import com.ccsens.logistics.persist.dao.LogisticsWarehouseDao; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
@ -27,6 +32,8 @@ public class MbpsService implements IMbpsService { |
|
|
|
private LogisticsEnvironmentRecordDao environmentRecordDao; |
|
|
|
@Resource |
|
|
|
private LogisticsHeatImagingRecordDao heatImagingRecordDao; |
|
|
|
@Resource |
|
|
|
private LogisticsWarehouseDao warehouseDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public MbpsVo.AllMbps selAllMbps(MbpsDto.SelAllMbpsSerch param) { |
|
|
@ -83,4 +90,48 @@ public class MbpsService implements IMbpsService { |
|
|
|
return heatImagingRecordDao.selHeatImaging(param.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public MbpsVo.FireOrFlood selFireOrFlood(MbpsDto.SelFireOrFlood param) { |
|
|
|
MbpsVo.FireOrFlood fireOrFlood = new MbpsVo.FireOrFlood(); |
|
|
|
|
|
|
|
if (ObjectUtil.isNull(param.getWarehouseId())){ |
|
|
|
LogisticsWarehouseExample warehouseExample = new LogisticsWarehouseExample(); |
|
|
|
warehouseExample.createCriteria().andParkIdEqualTo(param.getParkId()); |
|
|
|
List<LogisticsWarehouse> warehouses = warehouseDao.selectByExample(warehouseExample); |
|
|
|
if (CollectionUtil.isNotEmpty(warehouses)){ |
|
|
|
for (LogisticsWarehouse warehouse : warehouses) { |
|
|
|
Byte fireAlarm = environmentRecordDao.selFire(warehouse.getId()); |
|
|
|
Byte floodAlarm = environmentRecordDao.selFlood(warehouse.getId()); |
|
|
|
if (ObjectUtil.isNotNull(fireAlarm)){ |
|
|
|
if (1 == fireAlarm){ |
|
|
|
fireOrFlood.setIsFire(true); |
|
|
|
fireOrFlood.setIsFlood(floodAlarm == 1); |
|
|
|
fireOrFlood.setWarehouseName(warehouse.getName()); |
|
|
|
return fireOrFlood; |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(floodAlarm)){ |
|
|
|
if (1 == floodAlarm){ |
|
|
|
fireOrFlood.setIsFlood(true); |
|
|
|
fireOrFlood.setIsFire(fireAlarm == 1); |
|
|
|
fireOrFlood.setWarehouseName(warehouse.getName()); |
|
|
|
return fireOrFlood; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
Byte fireAlarm = environmentRecordDao.selFire(param.getWarehouseId()); |
|
|
|
Byte floodAlarm = environmentRecordDao.selFlood(param.getWarehouseId()); |
|
|
|
if (ObjectUtil.isNotNull(fireAlarm)){ |
|
|
|
fireOrFlood.setIsFire(fireAlarm == 1); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotNull(floodAlarm)){ |
|
|
|
fireOrFlood.setIsFlood(floodAlarm == 1); |
|
|
|
} |
|
|
|
return fireOrFlood; |
|
|
|
} |
|
|
|
return fireOrFlood; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|