|
@@ -17,7 +17,7 @@ import com.izouma.zhumj.service.ammeter.dahua.DahuaApi;
|
|
|
import com.izouma.zhumj.service.ammeter.powerBee.PowerBeeApi;
|
|
import com.izouma.zhumj.service.ammeter.powerBee.PowerBeeApi;
|
|
|
import com.izouma.zhumj.service.ammeter.powerBee.model.DeviceData;
|
|
import com.izouma.zhumj.service.ammeter.powerBee.model.DeviceData;
|
|
|
import com.izouma.zhumj.utils.SecurityUtils;
|
|
import com.izouma.zhumj.utils.SecurityUtils;
|
|
|
-import jodd.util.StringUtil;
|
|
|
|
|
|
|
+import com.taobao.api.internal.toplink.embedded.websocket.util.StringUtil;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -72,7 +72,7 @@ public class AmmeterService {
|
|
|
public void switchOn(Long roomId) {
|
|
public void switchOn(Long roomId) {
|
|
|
checkRole();
|
|
checkRole();
|
|
|
RoomInfo roomInfo = roomInfoRepo.findById(roomId).orElseThrow(new BusinessException("房间不存在"));
|
|
RoomInfo roomInfo = roomInfoRepo.findById(roomId).orElseThrow(new BusinessException("房间不存在"));
|
|
|
- if (roomInfo.getAmmeterType() == null || StringUtil.isEmpty(roomInfo.getAmmeterId())) {
|
|
|
|
|
|
|
+ if (roomInfo.getAmmeterType() == null || StringUtils.isBlank(roomInfo.getAmmeterId())) {
|
|
|
throw new BusinessException("此房间没有绑定电表");
|
|
throw new BusinessException("此房间没有绑定电表");
|
|
|
}
|
|
}
|
|
|
AmmeterApi ammeterApi = (AmmeterApi) context.getBean(roomInfo.getAmmeterType().name());
|
|
AmmeterApi ammeterApi = (AmmeterApi) context.getBean(roomInfo.getAmmeterType().name());
|
|
@@ -82,7 +82,7 @@ public class AmmeterService {
|
|
|
public void switchOff(Long roomId) {
|
|
public void switchOff(Long roomId) {
|
|
|
checkRole();
|
|
checkRole();
|
|
|
RoomInfo roomInfo = roomInfoRepo.findById(roomId).orElseThrow(new BusinessException("房间不存在"));
|
|
RoomInfo roomInfo = roomInfoRepo.findById(roomId).orElseThrow(new BusinessException("房间不存在"));
|
|
|
- if (roomInfo.getAmmeterType() == null || StringUtil.isEmpty(roomInfo.getAmmeterId())) {
|
|
|
|
|
|
|
+ if (roomInfo.getAmmeterType() == null || StringUtils.isBlank(roomInfo.getAmmeterId())) {
|
|
|
throw new BusinessException("此房间没有绑定电表");
|
|
throw new BusinessException("此房间没有绑定电表");
|
|
|
}
|
|
}
|
|
|
AmmeterApi ammeterApi = (AmmeterApi) context.getBean(roomInfo.getAmmeterType().name());
|
|
AmmeterApi ammeterApi = (AmmeterApi) context.getBean(roomInfo.getAmmeterType().name());
|