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