|
|
@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
@ -57,7 +58,7 @@ public class MbpsService implements IMbpsService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public MbpsVo.SelMbpsByTime selMbpsByTime(MbpsDto.SelMbpsByTime param) { |
|
|
|
String[] countArr = new String[10]; |
|
|
|
String[] countArr = new String[param.getQueryOfDay()]; |
|
|
|
//查找当前时间
|
|
|
|
Date date = new Date(); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
@ -92,12 +93,33 @@ public class MbpsService implements IMbpsService { |
|
|
|
@Override |
|
|
|
public MbpsVo.SelTempAndHumidity selTeamAndHumidity(MbpsDto.SelTeamAndHumidity param) { |
|
|
|
MbpsVo.SelTempAndHumidity tempAndHumidity = new MbpsVo.SelTempAndHumidity(); |
|
|
|
|
|
|
|
String[] countArr = new String[param.getQueryOfDay()]; |
|
|
|
//查找当前时间
|
|
|
|
Date date = new Date(); |
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH"); |
|
|
|
String nowDate = format.format(date); |
|
|
|
|
|
|
|
//查询温度
|
|
|
|
List<MbpsVo.Temps> tempsList = environmentRecordDao.selTempByTime(param.getWarehouseId(),param.getStartTime(),param.getEndTime()); |
|
|
|
List<MbpsVo.Temps> tempsList = environmentRecordDao.selTempByTime(param.getWarehouseId(),countArr,nowDate); |
|
|
|
if (CollectionUtil.isNotEmpty(tempsList)){ |
|
|
|
for (MbpsVo.Temps temps : tempsList) { |
|
|
|
if (ObjectUtil.isNull(temps.getTemp())){ |
|
|
|
temps.setTemp(new BigDecimal(0)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
tempAndHumidity.getTemps().addAll(tempsList); |
|
|
|
|
|
|
|
//查询湿度
|
|
|
|
List<MbpsVo.Humiditys> humidityList = environmentRecordDao.selHumidityByTime(param.getWarehouseId(),param.getStartTime(),param.getEndTime()); |
|
|
|
List<MbpsVo.Humiditys> humidityList = environmentRecordDao.selHumidityByTime(param.getWarehouseId(),countArr,nowDate); |
|
|
|
if (CollectionUtil.isNotEmpty(humidityList)){ |
|
|
|
for (MbpsVo.Humiditys humidity : humidityList) { |
|
|
|
if (ObjectUtil.isNull(humidity.getHumidity())){ |
|
|
|
humidity.setHumidity(new BigDecimal(0)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
tempAndHumidity.getHumiditys().addAll(humidityList); |
|
|
|
|
|
|
|
return tempAndHumidity; |
|
|
|