|
@@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.HashSet;
|
|
import java.util.HashSet;
|
|
|
|
|
|
import static com.ruoyi.sim.constant.CommConst.*;
|
|
import static com.ruoyi.sim.constant.CommConst.*;
|
|
@@ -49,7 +50,7 @@ public class CommReceiveService {
|
|
* @param s
|
|
* @param s
|
|
* @param reF debug模式下为null。
|
|
* @param reF debug模式下为null。
|
|
* @param f
|
|
* @param f
|
|
- * @param faultIds debug模式下为null。
|
|
|
|
|
|
+ * @param faultIds debug模式必须有值
|
|
*/
|
|
*/
|
|
public void setFaultQuestionValue(SimMsg sm, Sim s, RealExamFault reF, Fault f, String[] faultIds) {
|
|
public void setFaultQuestionValue(SimMsg sm, Sim s, RealExamFault reF, Fault f, String[] faultIds) {
|
|
// check
|
|
// check
|
|
@@ -73,40 +74,24 @@ public class CommReceiveService {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//
|
|
//
|
|
-
|
|
|
|
- //
|
|
|
|
- HashSet<String> fSet = new HashSet<>();
|
|
|
|
- for (String fId : faultIds) {
|
|
|
|
- fSet.add(fId);
|
|
|
|
- }
|
|
|
|
- l.info("fSet.size() = {}", fSet.size());
|
|
|
|
|
|
+ HashSet<String> fTempSet = new HashSet<>(Arrays.asList(faultIds));
|
|
|
|
+ l.info("fTempSet.toArray = {}", fTempSet.toArray());
|
|
String faultId = f.getFaultId();
|
|
String faultId = f.getFaultId();
|
|
l.info("faultId = {}", faultId);
|
|
l.info("faultId = {}", faultId);
|
|
- DebugFault df = debugFaultService.exist(s.getSimId(), faultId);
|
|
|
|
- if (df == null) {
|
|
|
|
- df = new DebugFault();
|
|
|
|
- df.setSimId(s.getSimId());
|
|
|
|
- df.setFaultId(f.getFaultId());
|
|
|
|
- if (fSet.contains(faultId)) {
|
|
|
|
- df.setFlag(DebugFault.Flag.YES);
|
|
|
|
- } else {
|
|
|
|
- df.setFlag(DebugFault.Flag.NO);
|
|
|
|
- }
|
|
|
|
- df.setSimFaultQuestionValue(faultQuestionValue);
|
|
|
|
- df.setSimFaultAnswerValue("");
|
|
|
|
- df.setAnswerRight(DebugFault.AnswerRight.UNKNOWN);
|
|
|
|
- debugFaultService.insertDebugFault(df);
|
|
|
|
|
|
+ // 不判断是否存在,因为之前已经删除所有表中数据,所以应该直接插入数据。
|
|
|
|
+ DebugFault df = new DebugFault();
|
|
|
|
+ df.setSimId(s.getSimId());
|
|
|
|
+ df.setFaultId(f.getFaultId());
|
|
|
|
+ if (fTempSet.contains(faultId)) {
|
|
|
|
+ df.setFlag(DebugFault.Flag.YES);
|
|
} else {
|
|
} else {
|
|
- if (fSet.contains(faultId)) {
|
|
|
|
- df.setFlag(DebugFault.Flag.YES);
|
|
|
|
- } else {
|
|
|
|
- df.setFlag(DebugFault.Flag.NO);
|
|
|
|
- }
|
|
|
|
- df.setSimFaultQuestionValue(faultQuestionValue);
|
|
|
|
- df.setSimFaultAnswerValue("");
|
|
|
|
- df.setAnswerRight(DebugFault.AnswerRight.UNKNOWN);
|
|
|
|
- debugFaultService.updateDebugFault(df);
|
|
|
|
|
|
+ df.setFlag(DebugFault.Flag.NO);
|
|
}
|
|
}
|
|
|
|
+ df.setSimFaultQuestionValue(faultQuestionValue);
|
|
|
|
+ // 答题值为空。
|
|
|
|
+ df.setSimFaultAnswerValue("");
|
|
|
|
+ df.setAnswerRight(DebugFault.AnswerRight.UNKNOWN);
|
|
|
|
+ debugFaultService.insertDebugFault(df);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|