重构第一版,没有明显bug

This commit is contained in:
Leo
2025-03-11 14:22:11 +08:00
parent 2316951e7f
commit a47efda7b5

View File

@@ -87,9 +87,9 @@ public class JDUtil {
private final ObjectMapper objectMapper = new ObjectMapper();
@Value("${isRunning.wx")
private boolean isRunning_wx = false;
private String isRunning_wx = false;
@Value("isRunning.jd")
private boolean isRunning_jd = false;
private String isRunning_jd = false;
// 构造函数中注入StringRedisTemplate
@@ -244,7 +244,7 @@ public class JDUtil {
*/
@Scheduled(cron = "0 * * * * ?")
public void fetchLatestOrder() {
if (isRunning_jd) {
if (isRunning_jd.equals("true")) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime startTime = now.minusMinutes(10).withSecond(0).withNano(0);
@@ -283,7 +283,7 @@ public class JDUtil {
*/
@Scheduled(cron = "3 * * * * ?")
public void sendOrderToWx() {
if (isRunning_wx) {
if (isRunning_wx.equals("true")) {
//long start = System.currentTimeMillis();
int[] validCodes = {-1};
// 只要三个月的,更多的也刷新不出来的
@@ -307,7 +307,7 @@ public class JDUtil {
*/
@Scheduled(cron = "0 0 */4 * * ?")
public void fetchHistoricalOrders3090() {
if (isRunning_jd) {
if (isRunning_jd.equals("true")) {
try {
OrderFetchStrategy strategy = new Days3090Strategy();
for (WXUtil.SuperAdmin admin : super_admins.values()) {
@@ -329,7 +329,7 @@ public class JDUtil {
*/
@Scheduled(cron = "0 0 * * * ?")
public void fetchHistoricalOrders1430() {
if (isRunning_jd) {
if (isRunning_jd.equals("true")) {
try {
OrderFetchStrategy strategy = new Days1430Strategy(); // 需补充Days1430Strategy实现
@@ -351,7 +351,7 @@ public class JDUtil {
*/
@Scheduled(cron = "0 0 * * * ?")
public void fetchHistoricalOrders0714() {
if (isRunning_jd) {
if (isRunning_jd.equals("true")) {
try {
OrderFetchStrategy strategy = new Days0714Strategy();
@@ -372,7 +372,7 @@ public class JDUtil {
@Scheduled(cron = "0 */5 * * * ?")
public void fetchHistoricalOrders0007() {
if (isRunning_jd) {
if (isRunning_jd.equals("true")) {
try {
OrderFetchStrategy strategy = new Days0007Strategy();