|
@@ -288,18 +288,19 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
return R.fail("设备已停运");
|
|
|
}
|
|
|
DeviceStatusDto.Vo deviceStatus = deviceInfo.getDeviceStatus();
|
|
|
- SysDictRedis sysDictRedis = SysDictUtils.get(EnumDeviceFaultLevelPayThreshold.Code.CODE.getCode(), EnumDeviceFaultLevelPayThreshold.NOT_PAY.getCode());
|
|
|
- if (deviceInfo.getFaultLevel() >= Integer.valueOf(sysDictRedis.getValue())) {
|
|
|
- return R.fail("设备故障");
|
|
|
- }
|
|
|
- check(deviceStatus.getNetState(), 2, "设备已离线");
|
|
|
- check(obj.getDoor() != null && obj.getDoor() == 1 ? deviceStatus.getDoorStateR() : deviceStatus.getDoorStateL(), 1, "设备正在使用中,请稍后");
|
|
|
- //质检用户不检查
|
|
|
SysDictRedis qualitySets = SysDictUtils.get(EnumQualityMercSets.Code.CODE.getCode(), EnumQualityMercSets.MERC_CODE.getCode());
|
|
|
+ //设备当前商户是质检时不检查
|
|
|
if (!qualitySets.getValue().equals(deviceInfo.getMercCode())) {
|
|
|
+ check(deviceInfo.getActiveState(), 2, "设备未激活");
|
|
|
check(deviceInfo.getFreezeStatus(), 2, "设备已冻结");
|
|
|
check(obj.getDoor() != null && obj.getDoor() == 1 ? deviceStatus.getLockStateR() : deviceStatus.getLockStateL(), 2, "设备已锁机");
|
|
|
+ check(deviceStatus.getIsPay(), Boolean.FALSE, "设备不可交易");
|
|
|
+ check(deviceInfo.getBusyState(), 2, "设备已停运");
|
|
|
+ SysDictRedis sysDictRedis = SysDictUtils.get(EnumDeviceFaultLevelPayThreshold.Code.CODE.getCode(), EnumDeviceFaultLevelPayThreshold.NOT_PAY.getCode());
|
|
|
+ check(deviceInfo.getFaultLevel(), sysDictRedis.getValue(), "设备故障");
|
|
|
}
|
|
|
+ check(deviceStatus.getNetState(), 2, "设备已离线");
|
|
|
+ check(obj.getDoor() != null && obj.getDoor() == 1 ? deviceStatus.getDoorStateR() : deviceStatus.getDoorStateL(), 1, "设备正在使用中,请稍后");
|
|
|
return R.ok(deviceInfo);
|
|
|
}
|
|
|
|
|
@@ -475,6 +476,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
//更新商户设备授权
|
|
|
List<DeviceInfo> deviceInfos = this.listByIds(deviceIds);
|
|
|
+ List<DeviceStatus> deviceStatuses = new ArrayList<>();
|
|
|
for (DeviceInfo deviceInfo : deviceInfos) {
|
|
|
Integer deviceType = deviceInfo.getDeviceType();
|
|
|
Long deviceId = deviceInfo.getDeviceId();
|
|
@@ -514,24 +516,16 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
//绑定关系
|
|
|
deviceInfo.setMercId(mercId).setMercCode(mercCode).setAlgorithmId(algorithmId).setMercName(mercName);
|
|
|
+ //标记机器可交易
|
|
|
+ DeviceStatus deviceStatus = new DeviceStatus()
|
|
|
+ .setDeviceId(deviceInfo.getDeviceId())
|
|
|
+ .setIsPay(true);
|
|
|
+ deviceStatuses.add(deviceStatus);
|
|
|
}
|
|
|
saveOrUpdateBatch(deviceInfos);
|
|
|
-// //原来存在的设备关系,不在最终设备列表中的移除
|
|
|
-// if (CollUtil.isNotEmpty(devices)) {
|
|
|
-// List<Long> oldIds = new ArrayList<>();
|
|
|
-// List<Long> removeIds = new ArrayList<>();
|
|
|
-// devices.forEach(device -> oldIds.add(device.getDeviceId()));
|
|
|
-// oldIds.forEach(deviceId -> {
|
|
|
-// //不在最终设备列表中的待移除
|
|
|
-// if (!deviceIds.contains(deviceId)) {
|
|
|
-// removeIds.add(deviceId);
|
|
|
-// }
|
|
|
-// });
|
|
|
-// if (CollUtil.isNotEmpty(removeIds)) {
|
|
|
-// List<DeviceInfo> removeList = this.listByIds(removeIds);
|
|
|
-// removeMerRefDevices(removeList, parentId);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (Emptys.check(deviceStatuses)) {
|
|
|
+ deviceStatusService.updateBatchById(deviceStatuses);
|
|
|
+ }
|
|
|
return R.ok(Boolean.TRUE);
|
|
|
}
|
|
|
|