ソースを参照

feat: 异步状态

shc 3 年 前
コミット
02266a5721

+ 27 - 26
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmScorePackageController.java

@@ -1413,39 +1413,40 @@ public class WmScorePackageController {
 
 	/**
 	 * 查询报告导出状态
+	 *
 	 * @param finalRecords 列表
 	 */
-	private void getReportOpt(List<WmScorePackage> finalRecords){
+	private void getReportOpt(List<WmScorePackage> finalRecords) {
 
 		ValueOperations<String, String> ops = redisTemplate.opsForValue();
 
-		finalRecords.forEach(record ->{
+		finalRecords.forEach(record -> {
 
 			WmReportOpt opt = new WmReportOpt();
-
-			final String key = String.format(CacheConstants.EXPORT_ZB_REPORT_CACHE,record.getId());
-
-			String url = ops.get(key);
-
-			// 存在key
-			if (redisTemplate.hasKey(key)){
-
-				Long expire = ops.getOperations().getExpire(key, TimeUnit.MINUTES);
-
-				LocalDateTime expiry;
-				// 永久有效为正在生成的状态否则就是生成成功了的
-				if (!Long.valueOf(-1L).equals(expire)){
-					opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATING);
-				} else {
-					expiry = LocalDateTime.now().plusSeconds(expire);
-					opt.setTtl(expiry);
-					opt.setLatestUrl(url);
-					opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATED);
-				}
-
-			} else {
-				opt.setStatus(WmReportOpt.WmReportOptStatus.NOT_GENERATE);
-			}
+			opt.setStatus(WmReportOpt.WmReportOptStatus.NOT_GENERATE);
+			// final String key = String.format(CacheConstants.EXPORT_ZB_REPORT_CACHE, record.getId());
+			// log.info("获取报告key:{}", key);
+			// String url = ops.get(key);
+			//
+			// // 存在key
+			// if (StrUtil.isNotEmpty("url")) {
+			//
+			// 	Long expire = ops.getOperations().getExpire(key, TimeUnit.MINUTES);
+			//
+			// 	LocalDateTime expiry;
+			// 	// 永久有效为正在生成的状态否则就是生成成功了的
+			// 	if (!Long.valueOf(-1L).equals(expire)) {
+			// 		opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATING);
+			// 	} else {
+			// 		expiry = LocalDateTime.now().plusSeconds(expire);
+			// 		opt.setTtl(expiry);
+			// 		opt.setLatestUrl(url);
+			// 		opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATED);
+			// 	}
+			//
+			// } else {
+			// 	opt.setStatus(WmReportOpt.WmReportOptStatus.NOT_GENERATE);
+			// }
 
 			record.setReportOpt(opt);