|
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DatePattern;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
+import cn.hutool.core.util.CharUtil;
|
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
|
import cn.hutool.core.util.HexUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -27,6 +28,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.CharSet;
|
|
|
import org.apache.commons.lang3.CharSetUtils;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
+import org.springframework.boot.ApplicationArguments;
|
|
|
+import org.springframework.boot.ApplicationRunner;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -44,7 +47,7 @@ import java.util.Set;
|
|
|
@Component
|
|
|
@RequiredArgsConstructor
|
|
|
@Slf4j
|
|
|
-public class NotifyTask {
|
|
|
+public class NotifyTask implements ApplicationRunner {
|
|
|
|
|
|
private final IAmsTradeRecordService tradeService;
|
|
|
|
|
@@ -53,7 +56,20 @@ public class NotifyTask {
|
|
|
private final IEmailProvider emailProvider;
|
|
|
private final ParamTemplate paramTemplate;
|
|
|
|
|
|
-
|
|
|
+ @Scheduled(cron = "0 0 0 * * ?")
|
|
|
+ public void reloadAesKey() {
|
|
|
+ String dayFormat = DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN);
|
|
|
+ byte[] byteDaysFor16 = new byte[16];
|
|
|
+ dayFormat = dayFormat + dayFormat;
|
|
|
+ char[] formatCharArray = dayFormat.toCharArray();
|
|
|
+ for (int i = 0; i < formatCharArray.length; i++) {
|
|
|
+ char c = formatCharArray[i];
|
|
|
+ byteDaysFor16[i]= (byte) Integer.parseInt(String.valueOf(c));
|
|
|
+ }
|
|
|
+ AmsConstant.aesKey = HexUtil.encodeHexStr(byteDaysFor16);
|
|
|
+ log.info("date: {}",dayFormat);
|
|
|
+ log.info("update aes key : {}", AmsConstant.aesKey);
|
|
|
+ }
|
|
|
|
|
|
@XxlJob("ams_weekly_report")
|
|
|
@SuppressWarnings("all")
|
|
@@ -173,4 +189,8 @@ public class NotifyTask {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public void run(ApplicationArguments args) throws Exception {
|
|
|
+ reloadAesKey();
|
|
|
+ }
|
|
|
}
|