zhourui 5 лет назад
Родитель
Сommit
a7c7b79077

+ 13 - 20
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompleted.java

@@ -48,26 +48,19 @@ class V2LookupWorkOrWorkCompleted extends BaseAction {
 			if (optional.isPresent()) {
 				this.wo = (Wo) optional.get();
 			} else {
-				// 必须重新取出,因为getWorkWorkCompletedForm的form是从缓存中取出,关联值是老的,要重新计算etag需要重新获取更新后的值.
-				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-					this.form = emc.find(form.getId(), Form.class);
-				}
-				if (null != this.form) {
-					List<String> list = new ArrayList<>();
-					CompletableFuture<List<String>> relatedFormFuture = this
-							.relatedFormFuture(this.form.getProperties());
-					CompletableFuture<List<String>> relatedScriptFuture = this
-							.relatedScriptFuture(this.form.getProperties());
-					list.add(this.form.getId() + this.form.getUpdateTime().getTime());
-					list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS));
-					list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS));
-					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);
-				}
+				List<String> list = new ArrayList<>();
+				CompletableFuture<List<String>> relatedFormFuture = this.relatedFormFuture(this.form.getProperties());
+				CompletableFuture<List<String>> relatedScriptFuture = this
+						.relatedScriptFuture(this.form.getProperties());
+				list.add(this.form.getId() + this.form.getUpdateTime().getTime());
+				list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS));
+				list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS));
+				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);

+ 13 - 20
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/V2LookupWorkOrWorkCompletedMobile.java

@@ -48,26 +48,19 @@ class V2LookupWorkOrWorkCompletedMobile extends BaseAction {
 			if (optional.isPresent()) {
 				this.wo = (Wo) optional.get();
 			} else {
-				// 必须重新取出,因为getWorkWorkCompletedForm的form是从缓存中取出,关联值是老的,要重新计算etag需要重新获取更新后的值.
-				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-					this.form = emc.find(form.getId(), Form.class);
-				}
-				if (null != this.form) {
-					List<String> list = new ArrayList<>();
-					CompletableFuture<List<String>> relatedFormFuture = this
-							.relatedFormFuture(this.form.getProperties());
-					CompletableFuture<List<String>> relatedScriptFuture = this
-							.relatedScriptFuture(this.form.getProperties());
-					list.add(this.form.getId() + this.form.getUpdateTime().getTime());
-					list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS));
-					list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS));
-					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);
-				}
+				List<String> list = new ArrayList<>();
+				CompletableFuture<List<String>> relatedFormFuture = this.relatedFormFuture(this.form.getProperties());
+				CompletableFuture<List<String>> relatedScriptFuture = this
+						.relatedScriptFuture(this.form.getProperties());
+				list.add(this.form.getId() + this.form.getUpdateTime().getTime());
+				list.addAll(relatedFormFuture.get(10, TimeUnit.SECONDS));
+				list.addAll(relatedScriptFuture.get(10, TimeUnit.SECONDS));
+				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);