|
@@ -220,7 +220,7 @@ public class CommSendService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 连接情况 的 定时任务。
|
|
* 连接情况 的 定时任务。
|
|
- * 执行频率: 2min debug:30s
|
|
|
|
|
|
+ * 执行频率: 3min
|
|
*/
|
|
*/
|
|
public void scheduledConnect() {
|
|
public void scheduledConnect() {
|
|
l.info("scheduled####Connect 连接情况 的 定时任务");
|
|
l.info("scheduled####Connect 连接情况 的 定时任务");
|
|
@@ -256,10 +256,15 @@ public class CommSendService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public AjaxResult checkOneSimStateActive(Sim s) {
|
|
public AjaxResult checkOneSimStateActive(Sim s) {
|
|
- long simId = s.getSimId();
|
|
|
|
- // 这句可能会调整模拟器状态
|
|
|
|
- checkOneSimState(s, true);
|
|
|
|
- //
|
|
|
|
|
|
+ final long simId = s.getSimId();
|
|
|
|
+ // 这句可能会调整模拟器状态,后面需要重新查询。
|
|
|
|
+ {
|
|
|
|
+ AjaxResult ar1 = checkOneSimState(s, true);
|
|
|
|
+ if (ar1.isError()) {
|
|
|
|
+ return ar1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 重新最新模拟器。
|
|
s = simService.selectSimBySimId(simId);
|
|
s = simService.selectSimBySimId(simId);
|
|
// 如果模拟器离线
|
|
// 如果模拟器离线
|
|
if (s != null && Sim.State.ONLINE.equals(s.getSimState())) {
|
|
if (s != null && Sim.State.ONLINE.equals(s.getSimState())) {
|
|
@@ -271,19 +276,21 @@ public class CommSendService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* @param s
|
|
* @param s
|
|
|
|
+ * @param important true 重试次数不同,也会进行序列号检查。
|
|
|
|
+ * @return
|
|
*/
|
|
*/
|
|
- public void checkOneSimState(final Sim s, final boolean important) {
|
|
|
|
|
|
+ public AjaxResult checkOneSimState(final Sim s, final boolean important) {
|
|
// check
|
|
// check
|
|
if (s == null) {
|
|
if (s == null) {
|
|
- return;
|
|
|
|
|
|
+ return AjaxResult.error("sim is null");
|
|
}
|
|
}
|
|
if (Sim.State.DISABLE.equals(s.getSimState())) {
|
|
if (Sim.State.DISABLE.equals(s.getSimState())) {
|
|
l.warn("sim DISABLE,模拟器被禁用,sim = {}", s);
|
|
l.warn("sim DISABLE,模拟器被禁用,sim = {}", s);
|
|
- return;
|
|
|
|
|
|
+ return AjaxResult.error("模拟器被禁用");
|
|
}
|
|
}
|
|
if (StringUtils.isBlank(s.getSimType()) || StringUtils.isBlank(s.getSimNum())) {
|
|
if (StringUtils.isBlank(s.getSimType()) || StringUtils.isBlank(s.getSimNum())) {
|
|
l.warn("sim error data {}", s);
|
|
l.warn("sim error data {}", s);
|
|
- return;
|
|
|
|
|
|
+ return AjaxResult.error("模拟器数据错误。");
|
|
}
|
|
}
|
|
//
|
|
//
|
|
SimMsg smS = commBuildService.buildSendMsgReadSimType(s.getSimNum());
|
|
SimMsg smS = commBuildService.buildSendMsgReadSimType(s.getSimNum());
|
|
@@ -298,21 +305,31 @@ public class CommSendService {
|
|
commFailCountClearOne(s.getSimId());
|
|
commFailCountClearOne(s.getSimId());
|
|
}
|
|
}
|
|
simReceiveService.checkOneSimState(smR, s);
|
|
simReceiveService.checkOneSimState(smR, s);
|
|
|
|
+ {
|
|
|
|
+ if (important) {
|
|
|
|
+ AjaxResult ar1 = simReceiveService.checkOneSimSn(smR, s);
|
|
|
|
+ if (ar1.isError()) {
|
|
|
|
+ return ar1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查找所有没有被手动禁用,并order by sim_num的模拟器列表。检查所有模拟器状态。
|
|
* 查找所有没有被手动禁用,并order by sim_num的模拟器列表。检查所有模拟器状态。
|
|
*/
|
|
*/
|
|
public void checkAllSimState() {
|
|
public void checkAllSimState() {
|
|
- RealExamCollection ecF = realExamCollectionService.selectRealExamCollectionOpened();
|
|
|
|
- l.info("ecF.getSimType() = {}", ecF.getSimType());
|
|
|
|
- if (ecF != null) {
|
|
|
|
- List<Sim> list = simService.listAllEnableBySimType(ecF.getSimType());
|
|
|
|
- l.info("checkAllSimState list.size() = {}", list.size());
|
|
|
|
- list.forEach(s -> {
|
|
|
|
- checkOneSimState(s, false);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ // RealExamCollection ecF = realExamCollectionService.selectRealExamCollectionOpened();
|
|
|
|
+ // l.info("ecF.getSimType() = {}", ecF.getSimType());
|
|
|
|
+ // if (ecF != null) {
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+ List<Sim> list = simService.listAllEnable(); // ecF.getSimType()
|
|
|
|
+ l.info("checkAllSimState list.size() = {}", list.size());
|
|
|
|
+ list.forEach(s -> {
|
|
|
|
+ checkOneSimState(s, false);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
@Async("tp-comm")
|
|
@Async("tp-comm")
|
|
@@ -403,7 +420,8 @@ public class CommSendService {
|
|
*/
|
|
*/
|
|
public SimMsg debugClearOneFault(final String simNum, final String bindHardwareMsg) {
|
|
public SimMsg debugClearOneFault(final String simNum, final String bindHardwareMsg) {
|
|
SimMsg sm = commBuildService.buildSendMsgClearFault(simNum, bindHardwareMsg);
|
|
SimMsg sm = commBuildService.buildSendMsgClearFault(simNum, bindHardwareMsg);
|
|
- return send(sm, null, RETRY_COUNT_CLEAR_ONE_FAULT, SLEEP_LONG);
|
|
|
|
|
|
+ Sim s = simService.uniqueBySimNum(simNum);
|
|
|
|
+ return send(sm, s, RETRY_COUNT_CLEAR_ONE_FAULT, SLEEP_LONG);
|
|
}
|
|
}
|
|
|
|
|
|
public AjaxResult debugClearAllOnlineSimAllFault() {
|
|
public AjaxResult debugClearAllOnlineSimAllFault() {
|
|
@@ -523,6 +541,7 @@ public class CommSendService {
|
|
final String[] faultIds,
|
|
final String[] faultIds,
|
|
final Boolean checkReplace) {
|
|
final Boolean checkReplace) {
|
|
//
|
|
//
|
|
|
|
+ l.info("faultIds.length = {}", faultIds.length);
|
|
{
|
|
{
|
|
int deleteCount = debugFaultService.deleteAll();
|
|
int deleteCount = debugFaultService.deleteAll();
|
|
l.info("deleteCount = {}", deleteCount);
|
|
l.info("deleteCount = {}", deleteCount);
|
|
@@ -837,6 +856,7 @@ public class CommSendService {
|
|
} catch (InterruptedException | IOException e) { // SocketTimeoutException
|
|
} catch (InterruptedException | IOException e) { // SocketTimeoutException
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
// 失败计数
|
|
// 失败计数
|
|
|
|
+ l.info("fail sim data = {}", s);
|
|
boolean limit = commFailCountAdd1(Objects.requireNonNull(s).getSimId());
|
|
boolean limit = commFailCountAdd1(Objects.requireNonNull(s).getSimId());
|
|
if (limit) {
|
|
if (limit) {
|
|
simService.updateSimStateBySimId(s.getSimId(), Sim.State.OFFLINE);
|
|
simService.updateSimStateBySimId(s.getSimId(), Sim.State.OFFLINE);
|