|
@@ -232,6 +232,27 @@ public class AliPayOpenDeviceFatoryImpl implements DeviceFactory, SpiDeviceServi
|
|
|
return SpiResponseConst.SUCCESS;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设备故障恢复通知
|
|
|
+ * 触发条件:设备故障会恢复时,货柜云平台也会展示
|
|
|
+ * 使用场景:接收设备恢复,进行相应业务处理和任务触发
|
|
|
+ * <p>
|
|
|
+ * 1 NFC1001 NFC和上位机断连 请检查NFC设备硬件连接情况,无法恢复请报修
|
|
|
+ * 2 NFC1002 NFC模块初始化失败 请重启设备,若故障未恢复,请报修;
|
|
|
+ * 3 NFC1003 NFC写入失败 请重启设备,若故障未恢复,请报修;
|
|
|
+ * 4 DST1001 设备停止营业 后台设置为停业
|
|
|
+ * 5 NFC1004 Nx设备无网络或与服务器失联 请检查网络连接
|
|
|
+ *
|
|
|
+ * @param deviceAlarmRecoverNotifyDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String recoveryInform(DeviceAlarmRecoverNotifyDTO deviceAlarmRecoverNotifyDTO) {
|
|
|
+ //TODO 设备故障恢复通知
|
|
|
+ log.info("设备故障恢复通知:{}", JSONUtil.toJsonPrettyStr(deviceAlarmRecoverNotifyDTO));
|
|
|
+ return SpiResponseConst.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("设备异常通知SPI")
|
|
|
@Override
|
|
|
public String deviceExceptionNotify(DeviceExceptionNotifyDTO deviceExceptionNotifyDTO) {
|
|
@@ -319,18 +340,18 @@ public class AliPayOpenDeviceFatoryImpl implements DeviceFactory, SpiDeviceServi
|
|
|
String value = dto.getValue();
|
|
|
|
|
|
//查询设备信息
|
|
|
- DeviceInfo deviceInfo = deviceInfoService.getById(Long.valueOf(terminalId));
|
|
|
+ DeviceInfoDto.Vo deviceInfo = R.feignCheckData(deviceInfoService.obj(new DeviceInfoDto.Obj().setIsSysinfo(true).setDeviceId(Long.valueOf(terminalId))));
|
|
|
if (deviceInfo == null) {
|
|
|
log.warn("温度、音量查询SPI通知,无设备信息");
|
|
|
return SpiResponseConst.SUCCESS;
|
|
|
}
|
|
|
+ DeviceSysinfoDto.Vo deviceSysinfo = deviceInfo.getDeviceSysinfo();
|
|
|
+ boolean isHaveNfc = false;
|
|
|
+ if (deviceSysinfo != null && StrUtil.isNotEmpty(deviceSysinfo.getNfcSn())) {
|
|
|
+ isHaveNfc = true;
|
|
|
+ }
|
|
|
//温度更新
|
|
|
FunctionUtils.NoParamsNoResult updateTmp = () -> {
|
|
|
-// deviceStatus.setTempValue(Integer.valueOf(value));
|
|
|
-// deviceStatusService.updateById(deviceStatus);
|
|
|
-// DeviceSysinfoDto.Up sysUp = new DeviceSysinfoDto.Up();
|
|
|
-// sysUp.setDeviceId(deviceInfo.getDeviceId()).setIsHaveTemp(true);
|
|
|
-// deviceSysinfoService.up(sysUp);
|
|
|
DeviceStatusDto.Up up = new DeviceStatusDto.Up();
|
|
|
up.setDeviceId(deviceInfo.getDeviceId())
|
|
|
.setTempState(0)
|
|
@@ -339,21 +360,19 @@ public class AliPayOpenDeviceFatoryImpl implements DeviceFactory, SpiDeviceServi
|
|
|
};
|
|
|
|
|
|
DeviceStatus deviceStatus = deviceStatusService.getById(deviceInfo.getDeviceId());
|
|
|
- if (deviceStatus == null) {
|
|
|
+ if (deviceStatus == null && !isHaveNfc) {
|
|
|
log.warn("温度、音量查询SPI通知,无设备状态记录");
|
|
|
return SpiResponseConst.SUCCESS;
|
|
|
}
|
|
|
//音量更新
|
|
|
FunctionUtils.NoParamsNoResult updateVoice = () -> {
|
|
|
-// deviceStatus.setVoiceVolume(Integer.valueOf(value));
|
|
|
-// deviceStatusService.updateById(deviceStatus);
|
|
|
DeviceStatusDto.Up up = new DeviceStatusDto.Up();
|
|
|
up.setDeviceId(deviceInfo.getDeviceId())
|
|
|
.setVoiceVolume(Integer.valueOf(value));
|
|
|
deviceStatusService.up(up);
|
|
|
};
|
|
|
|
|
|
- if (BooleanUtil.isTrue(success)) {
|
|
|
+ if (BooleanUtil.isTrue(success) && !isHaveNfc) {
|
|
|
//温度:TEMP 音量:VOL
|
|
|
if ("VOL".equals(type)) {
|
|
|
updateVoice.run();
|
|
@@ -373,13 +392,19 @@ public class AliPayOpenDeviceFatoryImpl implements DeviceFactory, SpiDeviceServi
|
|
|
String value = dto.getValue();
|
|
|
|
|
|
//查询设备信息
|
|
|
- DeviceInfo deviceInfo = deviceInfoService.getById(Long.valueOf(terminalId));
|
|
|
+ DeviceInfoDto.Vo deviceInfo = R.feignCheckData(deviceInfoService.obj(new DeviceInfoDto.Obj().setIsSysinfo(true).setDeviceId(Long.valueOf(terminalId))));
|
|
|
if (deviceInfo == null) {
|
|
|
- log.warn("温度、音量设置SPI通知,无设备信息");
|
|
|
+ log.warn("温度、音量查询SPI通知,无设备信息");
|
|
|
return SpiResponseConst.SUCCESS;
|
|
|
}
|
|
|
+ DeviceSysinfoDto.Vo deviceSysinfo = deviceInfo.getDeviceSysinfo();
|
|
|
+ boolean isHaveNfc = false;
|
|
|
+ if (deviceSysinfo != null && StrUtil.isNotEmpty(deviceSysinfo.getNfcSn())) {
|
|
|
+ isHaveNfc = true;
|
|
|
+ }
|
|
|
+
|
|
|
DeviceStatus deviceStatus = deviceStatusService.getById(deviceInfo.getDeviceId());
|
|
|
- if (deviceStatus == null) {
|
|
|
+ if (deviceStatus == null && !isHaveNfc) {
|
|
|
log.warn("温度、音量设置SPI通知,无设备状态记录");
|
|
|
return SpiResponseConst.SUCCESS;
|
|
|
}
|
|
@@ -394,7 +419,7 @@ public class AliPayOpenDeviceFatoryImpl implements DeviceFactory, SpiDeviceServi
|
|
|
deviceStatusService.updateById(deviceStatus);
|
|
|
};
|
|
|
|
|
|
- if (BooleanUtil.isTrue(success)) {
|
|
|
+ if (BooleanUtil.isTrue(success) && !isHaveNfc) {
|
|
|
//温度:TEMP 音量:VOL
|
|
|
if ("VOL".equals(type)) {
|
|
|
updateVoice.run();
|