提交 a041c453 编写于 作者: Z zhourui

退回getForm

上级 235099d0
...@@ -48,26 +48,19 @@ class V2LookupWorkOrWorkCompleted extends BaseAction { ...@@ -48,26 +48,19 @@ class V2LookupWorkOrWorkCompleted extends BaseAction {
if (optional.isPresent()) { if (optional.isPresent()) {
this.wo = (Wo) optional.get(); this.wo = (Wo) optional.get();
} else { } else {
// 必须重新取出,因为getWorkWorkCompletedForm的form是从缓存中取出,关联值是老的,要重新计算etag需要重新获取更新后的值. List<String> list = new ArrayList<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { CompletableFuture<List<String>> relatedFormFuture = this.relatedFormFuture(this.form.getProperties());
this.form = emc.find(form.getId(), Form.class); CompletableFuture<List<String>> relatedScriptFuture = this
} .relatedScriptFuture(this.form.getProperties());
if (null != this.form) { list.add(this.form.getId() + this.form.getUpdateTime().getTime());
List<String> list = new ArrayList<>(); list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS));
CompletableFuture<List<String>> relatedFormFuture = this list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS));
.relatedFormFuture(this.form.getProperties()); list = list.stream().sorted().collect(Collectors.toList());
CompletableFuture<List<String>> relatedScriptFuture = this this.wo.setId(this.form.getId());
.relatedScriptFuture(this.form.getProperties()); CRC32 crc = new CRC32();
list.add(this.form.getId() + this.form.getUpdateTime().getTime()); crc.update(StringUtils.join(list, "#").getBytes());
list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS)); this.wo.setCacheTag(crc.getValue() + "");
list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS)); CacheManager.put(cacheCategory, cacheKey, wo);
list = list.stream().sorted().collect(Collectors.toList());
this.wo.setId(this.form.getId());
CRC32 crc = new CRC32();
crc.update(StringUtils.join(list, "#").getBytes());
this.wo.setCacheTag(crc.getValue() + "");
CacheManager.put(cacheCategory, cacheKey, wo);
}
} }
} }
result.setData(wo); result.setData(wo);
......
...@@ -48,26 +48,19 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction { ...@@ -48,26 +48,19 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction {
if (optional.isPresent()) { if (optional.isPresent()) {
this.wo = (Wo) optional.get(); this.wo = (Wo) optional.get();
} else { } else {
// 必须重新取出,因为getWorkWorkCompletedForm的form是从缓存中取出,关联值是老的,要重新计算etag需要重新获取更新后的值. List<String> list = new ArrayList<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) { CompletableFuture<List<String>> relatedFormFuture = this.relatedFormFuture(this.form.getProperties());
this.form = emc.find(form.getId(), Form.class); CompletableFuture<List<String>> relatedScriptFuture = this
} .relatedScriptFuture(this.form.getProperties());
if (null != this.form) { list.add(this.form.getId() + this.form.getUpdateTime().getTime());
List<String> list = new ArrayList<>(); list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS));
CompletableFuture<List<String>> relatedFormFuture = this list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS));
.relatedFormFuture(this.form.getProperties()); list = list.stream().sorted().collect(Collectors.toList());
CompletableFuture<List<String>> relatedScriptFuture = this this.wo.setId(this.form.getId());
.relatedScriptFuture(this.form.getProperties()); CRC32 crc = new CRC32();
list.add(this.form.getId() + this.form.getUpdateTime().getTime()); crc.update(StringUtils.join(list, "#").getBytes());
list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS)); this.wo.setCacheTag(crc.getValue() + "");
list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS)); CacheManager.put(cacheCategory, cacheKey, wo);
list = list.stream().sorted().collect(Collectors.toList());
this.wo.setId(this.form.getId());
CRC32 crc = new CRC32();
crc.update(StringUtils.join(list, "#").getBytes());
this.wo.setCacheTag(crc.getValue() + "");
CacheManager.put(cacheCategory, cacheKey, wo);
}
} }
} }
result.setData(wo); result.setData(wo);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册