定时任务开启

This commit is contained in:
张松
2025-10-30 15:39:29 +08:00
parent f9a22f31f2
commit 60ac492f9a
4 changed files with 5 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@@ -18,6 +19,7 @@ import javax.annotation.PostConstruct;
@EnableTransactionManagement @EnableTransactionManagement
@MapperScan("com.czg.service.market.mapper") @MapperScan("com.czg.service.market.mapper")
@EnableDubbo @EnableDubbo
@EnableScheduling
@Slf4j @Slf4j
public class MarketApplication { public class MarketApplication {
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -17,7 +17,6 @@ public class AAMarketTasks {
// 分销延时发放 // 分销延时发放
//每天0时0分0秒 执行
@Scheduled(fixedRate = 30000) @Scheduled(fixedRate = 30000)
public void distributionTask() { public void distributionTask() {
distributionTask.deliver(); distributionTask.deliver();

View File

@@ -23,6 +23,7 @@ import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -56,6 +57,7 @@ public class DistributionTask {
* AAMarketTasks 统一调用位置 * AAMarketTasks 统一调用位置
*/ */
// @Scheduled(cron = "0 0 0 * * ?") // @Scheduled(cron = "0 0 0 * * ?")
@Scheduled(fixedRate = 30000)
public void deliver() { public void deliver() {
LocalDateTime localDateTime = DateUtil.date().toLocalDateTime(); LocalDateTime localDateTime = DateUtil.date().toLocalDateTime();
distributionFlowService.list(new QueryWrapper() distributionFlowService.list(new QueryWrapper()

View File

@@ -1066,7 +1066,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
// 分销员升级等级 // 分销员升级等级
distributionUserService.costUpgradeLevelBefore(orderInfo.getUserId(), orderInfo.getShopId()); distributionUserService.costUpgradeLevelBefore(orderInfo.getUserId(), orderInfo.getShopId());
// 分销奖励 // 分销奖励
distributionUserService.distribute(orderInfo.getId(), payment.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order"); distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
} else if ("memberIn".equals(payment.getPayType()) || "free".equals(payment.getPayType())) { } else if ("memberIn".equals(payment.getPayType()) || "free".equals(payment.getPayType())) {
boolean isFree = "free".equals(payment.getPayType()); boolean isFree = "free".equals(payment.getPayType());
ShopUser shopUser = shopUserService.getById(payment.getSourceId()); ShopUser shopUser = shopUserService.getById(payment.getSourceId());