更新缓存查询
This commit is contained in:
@@ -1227,17 +1227,27 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
public Instruction findByDeviceCodeFromCache(String devicecode) {
|
||||
|
||||
List<Instruction> instructionList = instructions;
|
||||
ListUtil.sort(instructionList, new Comparator<Instruction>() {
|
||||
@Override
|
||||
public int compare(Instruction o1, Instruction o2) {
|
||||
return o1.getCreate_time().compareTo(o2.getCreate_time());
|
||||
}
|
||||
});
|
||||
for (int i = 0; i < instructionList.size(); i++) {
|
||||
Instruction inst = instructionList.get(i);
|
||||
if (StrUtil.equals(devicecode, inst.getStart_device_code()) && inst.getInstruction_status().equals("0")) {
|
||||
return inst;
|
||||
try {
|
||||
ListUtil.sort(
|
||||
instructionList,
|
||||
new Comparator<Instruction>() {
|
||||
@Override
|
||||
public int compare(Instruction o1, Instruction o2) {
|
||||
return o1.getCreate_time().compareTo(o2.getCreate_time());
|
||||
}
|
||||
});
|
||||
Iterator<Instruction> it = instructions.iterator();
|
||||
while (it.hasNext()) {
|
||||
Instruction inst = it.next();
|
||||
if (StrUtil.equals(devicecode, inst.getStart_device_code())
|
||||
&& inst.getInstruction_status().equals("0")) {
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("指令排序按照创建时间执执行失败!重新执行");
|
||||
//失败之后重新查找指令
|
||||
return findByDeviceCodeFromCache(devicecode);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user