Merge remote-tracking branch 'origin/master' into dev
This commit is contained in:
commit
a72dfb8602
|
@ -697,18 +697,16 @@ public class DeviceServiceImpl implements DeviceService
|
|||
transactionBillService.batchEndBillByDevice(deviceId);
|
||||
|
||||
// 物联网设备归零
|
||||
CommandResponse commandResponse = iotService.setTime(device.getMac(), 0L);
|
||||
CommandResponse commandResponse = iotService.setTime(device.getMac(), 1L);
|
||||
ServiceUtil.assertion(!commandResponse.isSuccess(), "设备归零失败,请检查设备是否在线或联系管理员");
|
||||
|
||||
// 强制关闭
|
||||
iotService.close(device.getMac());
|
||||
|
||||
// 归零记录
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
// 设备剩余时长
|
||||
Duration duration = Duration.between(now, device.getExpireTime());
|
||||
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, -duration.getSeconds(), "设备归零", loginUser));
|
||||
long seconds = duration.getSeconds() > 0 ? duration.getSeconds() : 0;
|
||||
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, -seconds, "设备归零", loginUser));
|
||||
}, 0, TimeUnit.SECONDS);
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user