From 609055d2e9a01dc58782879e439e25e5cc8f3955 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 12 Nov 2021 16:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=A7=E8=A1=8C=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/redis/RedisKeys.java | 10 ++++++++++ .../java/com/epmet/controller/DemoController.java | 14 ++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 388927ce5a..2ac7d19f96 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.utils.DateUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; /** * @author Mark sunlightcs@gmail.com @@ -559,4 +560,13 @@ public class RedisKeys { public static String blockedMqMsgKey(String blockedMsgLabel) { return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel); } + + /** + * desc:获取执行完毕的 业务 参数结果key + * @param bizMethod + * @return + */ + public static String getBackDoorbizExcuteResult(String bizMethod) { + return rootPrefix.concat("backdoor:").concat(bizMethod); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 98cfbaf838..e47ce1845e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -60,9 +62,7 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -73,7 +73,8 @@ import java.util.concurrent.Future; public class DemoController { @Autowired private StatsDemoService demoService; - + @Autowired + private RedisUtils redisUtils; @Autowired private ExecutorService executorService; @@ -1084,16 +1085,21 @@ public class DemoController { @RequestParam(name = "startDate",required = false)String startDate, @RequestParam(name = "endDate",required = false)String endDate ){ + long start = System.currentTimeMillis(); + Set result = new LinkedHashSet<>(); if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){ List daysBetween = DateUtils.getDaysBetween(startDate, endDate); daysBetween.forEach(d -> { screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d); + result.add(d); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L); }); }else { screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId); screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId); + redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L); } long end = System.currentTimeMillis(); long l = (end - start) / 1000;