|
|
@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.dromara.common.core.config.DefaultConfig;
|
|
|
+import org.dromara.common.core.constant.DefaultConstants;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
import org.dromara.common.core.domain.model.ErrorInfo;
|
|
|
import org.dromara.server.consume.business.ConsumeBusiness;
|
|
|
@@ -25,13 +27,14 @@ import org.springframework.stereotype.Component;
|
|
|
@RequiredArgsConstructor
|
|
|
public class ScheduledTasks {
|
|
|
private final ConsumeBusiness consumeBusiness;
|
|
|
+ private final DefaultConfig defaultConfig;
|
|
|
|
|
|
/**
|
|
|
* 执行原始消费对账任务。
|
|
|
* 该方法在每天的9:45, 14:45, 20:45和23:45自动调用,用于处理有原始消费记录但没有消费明细的消费记录,并将这些记录写入消费明细。
|
|
|
* 如果对账过程中出现错误,会记录错误信息;如果成功,则记录警告消息。
|
|
|
*/
|
|
|
- @Scheduled(cron = "0 55 9,14,20,23 * * *")
|
|
|
+ @Scheduled(cron = "0 55 9,10,14,16,20,23 * * *")
|
|
|
public void originalReconciliation() {
|
|
|
String consumeDate = DateUtil.format(DateUtil.date(), "yyyy-MM-dd 00:00:00");
|
|
|
R<ErrorInfo> result = consumeBusiness.originalReconciliation(consumeDate);
|
|
|
@@ -41,4 +44,22 @@ public class ScheduledTasks {
|
|
|
log.warn(result.getMsg());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 执行云同步对账任务。
|
|
|
+ * 该方法在每天的9:45, 14:45, 20:45和23:45自动调用,用于处理云端部署环境下的消费记录对账。
|
|
|
+ * 如果对账过程中出现错误,会记录错误信息;如果成功,则记录警告消息。
|
|
|
+ */
|
|
|
+ @Scheduled(cron = "0 45 9,10,14,16,20,23 * * *")
|
|
|
+ public void CloudSyncReconciliation() {
|
|
|
+ if (defaultConfig.getLocationFlag().equals(DefaultConstants.CLOUD_FLAG)) {
|
|
|
+ String consumeDate = DateUtil.format(DateUtil.date(), "yyyy-MM-dd 00:00:00");
|
|
|
+ R<ErrorInfo> result = consumeBusiness.syncReconciliation(consumeDate);
|
|
|
+ if (R.isError(result)) {
|
|
|
+ log.error(JSONUtil.toJsonStr(result.getData()));
|
|
|
+ } else {
|
|
|
+ log.warn(result.getMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|