debug: 设备充值命令
This commit is contained in:
parent
bea3dd770f
commit
59d743e7d4
|
@ -73,12 +73,12 @@ public class IotConstants {
|
||||||
public static final String COMMAND_OUTAGE_WAY = "set";
|
public static final String COMMAND_OUTAGE_WAY = "set";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命令 累加充值电量
|
* 命令 累加充值电量,设备不会自行关闭
|
||||||
*/
|
*/
|
||||||
public static final String COMMAND_ADD_ELE = "money";
|
public static final String COMMAND_ADD_ELE = "money";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命令 直接设置电量
|
* 命令 直接设置电量,设备会自行关闭
|
||||||
*/
|
*/
|
||||||
public static final String COMMAND_SET_ELE = "mmney";
|
public static final String COMMAND_SET_ELE = "mmney";
|
||||||
|
|
||||||
|
|
|
@ -518,12 +518,12 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
ServiceUtil.assertion(insertRecord != 1, "记录电量变化失败");
|
ServiceUtil.assertion(insertRecord != 1, "记录电量变化失败");
|
||||||
|
|
||||||
if (withIot) {
|
if (withIot) {
|
||||||
// 若设备剩余电量小于0,则补偿电量充值
|
// 若设备剩余电量大于0,则补偿电量充值
|
||||||
CommandResponse res;
|
CommandResponse res;
|
||||||
if (device.getSurplusEle().compareTo(BigDecimal.ZERO) < 0) {
|
if (device.getSurplusEle().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
res = iotService.addEle(device, amount.subtract(device.getSurplusEle()), reason);
|
res = iotService.setEle(device, amount.add(device.getSurplusEle()), reason);
|
||||||
} else {
|
} else {
|
||||||
res = iotService.addEle(device, amount, reason);
|
res = iotService.setEle(device, amount, reason);
|
||||||
}
|
}
|
||||||
boolean iot = res.isSuccess();
|
boolean iot = res.isSuccess();
|
||||||
ServiceUtil.assertion(!iot, "为设备充值电量失败");
|
ServiceUtil.assertion(!iot, "为设备充值电量失败");
|
||||||
|
|
|
@ -953,7 +953,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
||||||
boolean addTime = deviceService.addTime(device, seconds, true, "充值订单:" + bill.getBillNo());
|
boolean addTime = deviceService.addTime(device, seconds, true, "充值订单:" + bill.getBillNo());
|
||||||
ServiceUtil.assertion(!addTime, "设备时长充值失败");
|
ServiceUtil.assertion(!addTime, "设备时长充值失败");
|
||||||
} else if (SuitFeeType.COUNT.getType().equals(bill.getSuitFeeType())) {
|
} else if (SuitFeeType.COUNT.getType().equals(bill.getSuitFeeType())) {
|
||||||
// 设备设置电量
|
// 设备增加电量
|
||||||
BigDecimal ele = transactionBillConverter.toRechargeEle(bill);
|
BigDecimal ele = transactionBillConverter.toRechargeEle(bill);
|
||||||
boolean addEle = deviceService.addEle(device, ele, true, "充值订单:" + bill.getBillNo());
|
boolean addEle = deviceService.addEle(device, ele, true, "充值订单:" + bill.getBillNo());
|
||||||
ServiceUtil.assertion(!addEle, "设备时长充值失败");
|
ServiceUtil.assertion(!addEle, "设备时长充值失败");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user