2023-05-12 16:02:05 补充在设备今日无数据的情况下,增加空判断处理!

master
魔神煜修罗皇 2 years ago
parent 2295843b5c
commit 957e2f72b2
  1. 2
      psdc-business/src/main/java/com/psdc/service/IPsdcElectricRtdataService.java
  2. 6
      psdc-business/src/main/java/com/psdc/service/impl/PsdcElectricRtdataServiceImpl.java

@ -12,6 +12,6 @@ import com.psdc.entity.res.PsdcDevicePowerRes;
*/ */
public interface IPsdcElectricRtdataService { public interface IPsdcElectricRtdataService {
PsdcDevicePowerRes queryById(Integer deviceId); Object queryById(Integer deviceId);
} }

@ -36,12 +36,16 @@ public class PsdcElectricRtdataServiceImpl implements IPsdcElectricRtdataService
* @return * @return
*/ */
@Override @Override
public PsdcDevicePowerRes queryById(Integer deviceId) { public Object queryById(Integer deviceId) {
long userId = SecurityUtils.getUserId(); long userId = SecurityUtils.getUserId();
Date date = new Date(); Date date = new Date();
PsdcDevicePowerRes devicePowerRes = electricRtdataMapper.queryById(deviceId, sdf.format(date)); PsdcDevicePowerRes devicePowerRes = electricRtdataMapper.queryById(deviceId, sdf.format(date));
PsdcDevicePowerHdata96 hdata96 = devicePowerHdata96Mapper.queryById(userId, deviceId, sdf2.format(date)); PsdcDevicePowerHdata96 hdata96 = devicePowerHdata96Mapper.queryById(userId, deviceId, sdf2.format(date));
if (null != devicePowerRes && null != hdata96){
devicePowerRes.setTodayUsePowers(hdata96); devicePowerRes.setTodayUsePowers(hdata96);
return devicePowerRes; return devicePowerRes;
} else {
return "该设备今日暂无数据!";
}
} }
} }

Loading…
Cancel
Save