sdf api
This commit is contained in:
@@ -4,7 +4,6 @@ import com.sunyard.chsm.enums.DeviceTmkStatus;
|
||||
import com.sunyard.chsm.mapper.SpDeviceMapper;
|
||||
import com.sunyard.chsm.model.dto.DeviceCheckRes;
|
||||
import com.sunyard.chsm.model.entity.Device;
|
||||
import com.sunyard.chsm.sdf.adapter.BcSdfApiAdaptor;
|
||||
import com.sunyard.chsm.sdf.adapter.SdfApiAdapter;
|
||||
import com.sunyard.chsm.sdf.adapter.SdfApiAdapterFactory;
|
||||
import com.sunyard.chsm.sdf.context.AlgId;
|
||||
@@ -218,21 +217,17 @@ public class SingleSdfApiService implements SdfApiService, InitializingBean {
|
||||
Executors.newSingleThreadScheduledExecutor()
|
||||
.scheduleWithFixedDelay(() -> {
|
||||
boolean tmkInit = tmkService.isTmkInit();
|
||||
if (sdfApiAdapter != null) {
|
||||
if (sdfApiAdapter instanceof BcSdfApiAdaptor) {
|
||||
changeDevice(tmkInit);
|
||||
return;
|
||||
}
|
||||
if (tmkInit && StringUtils.isEmpty(tmkHandle)) {
|
||||
changeDevice(tmkInit);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
DeviceInfo deviceInfo = sdfApiAdapter.getDeviceInfo(sessionHandle);
|
||||
} catch (Exception ex) {
|
||||
changeDevice(tmkInit);
|
||||
}
|
||||
} else {
|
||||
if (sdfApiAdapter == null) {
|
||||
changeDevice(tmkInit);
|
||||
return;
|
||||
}
|
||||
if (tmkInit && StringUtils.isEmpty(tmkHandle)) {
|
||||
changeDevice(tmkInit);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
DeviceInfo deviceInfo = sdfApiAdapter.getDeviceInfo(sessionHandle);
|
||||
} catch (Exception ex) {
|
||||
changeDevice(tmkInit);
|
||||
}
|
||||
}, 0L, 5L, TimeUnit.MINUTES);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.sunyard.chsm.task;
|
||||
|
||||
import com.sun.jna.Platform;
|
||||
import com.sunyard.chsm.service.DeviceService;
|
||||
import com.sunyard.chsm.service.TmkService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -28,12 +27,14 @@ public class DeviceTask implements InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (Platform.isLinux() || Platform.isWindows()) {
|
||||
threadPoolTaskScheduler.scheduleWithFixedDelay(deviceService::checkDeviceStatus, Duration.ofMinutes(5L));
|
||||
threadPoolTaskScheduler.scheduleWithFixedDelay(tmkService::checkSoftDeviceTmk, Duration.ofMinutes(5L));
|
||||
} else {
|
||||
log.warn("操作系统: {} 不支持启动检查设备状态定时任务", System.getProperty("os.name"));
|
||||
}
|
||||
threadPoolTaskScheduler.scheduleWithFixedDelay(deviceService::checkDeviceStatus, Duration.ofMinutes(5L));
|
||||
threadPoolTaskScheduler.scheduleWithFixedDelay(tmkService::checkSoftDeviceTmk, Duration.ofMinutes(5L));
|
||||
// if (Platform.isLinux() || Platform.isWindows()) {
|
||||
// threadPoolTaskScheduler.scheduleWithFixedDelay(deviceService::checkDeviceStatus, Duration.ofMinutes(5L));
|
||||
// threadPoolTaskScheduler.scheduleWithFixedDelay(tmkService::checkSoftDeviceTmk, Duration.ofMinutes(5L));
|
||||
// } else {
|
||||
// log.warn("操作系统: {} 不支持启动检查设备状态定时任务", System.getProperty("os.name"));
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,6 @@ logging:
|
||||
level:
|
||||
root: info
|
||||
com.sunyard.chsm.mapper: debug
|
||||
com.sunyard.chsm.service.TmkService: debug
|
||||
# org.springframework.web: trace
|
||||
# config: classpath:log4j2.xml
|
||||
|
||||
|
||||
Reference in New Issue
Block a user