Compare commits
No commits in common. "284cd4b9d8778701cd7dc957b47d3e334a8b1730" and "53184270deb6b67a42c9ede26355fb77e895d94b" have entirely different histories.
284cd4b9d8
...
53184270de
|
@ -263,8 +263,7 @@ public class IotServiceImpl implements IotService {
|
||||||
private CommandResponse sendCommand(IotDevice device, String command, String reason, int tryCount) {
|
private CommandResponse sendCommand(IotDevice device, String command, String reason, int tryCount) {
|
||||||
if (tryCount > 0) {
|
if (tryCount > 0) {
|
||||||
CommandResponse res = sendCommand(device, command, null, reason);
|
CommandResponse res = sendCommand(device, command, null, reason);
|
||||||
// 若操作成功 or 设备离线 or 尝试次数小于等于1,则直接返回结果
|
if (IotUtil.isSuccess(res) || tryCount <= 1) {
|
||||||
if (IotUtil.isSuccess(res) || IotUtil.isOffline(res) || tryCount <= 1) {
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -211,13 +211,6 @@ public class IotUtil {
|
||||||
return result.isSuccess();
|
return result.isSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOffline(CommandResponse result) {
|
|
||||||
if (result == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return result.isNotOnline();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getMsg(CommandResponse result) {
|
public static String getMsg(CommandResponse result) {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return "未知错误";
|
return "未知错误";
|
||||||
|
@ -236,7 +229,7 @@ public class IotUtil {
|
||||||
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
if (sys.getBat() != null && sys.getBat().compareTo(BigDecimal.valueOf(100)) >= 0) {
|
||||||
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
sys.setBat(sys.getBat().divide(BigDecimal.valueOf(10), 2, BigDecimal.ROUND_HALF_UP));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sys;
|
return sys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user