From dff768014e8e714d6a7278375fad65022094f5b2 Mon Sep 17 00:00:00 2001 From: Hentua <wangdoubleone@gmail.com> Date: Fri, 07 Apr 2023 17:36:56 +0800 Subject: [PATCH] Merge branch 'hongloumeng' of http://120.27.238.55:7000/r/xc-mall into hongloumeng --- src/main/java/cc/mrbird/febs/mall/entity/MallMqRecord.java | 4 ++++ src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java | 6 +++--- src/test/java/cc/mrbird/febs/ProfitTest.java | 2 +- src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java | 1 + src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java | 4 ++++ src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallMqRecord.java b/src/main/java/cc/mrbird/febs/mall/entity/MallMqRecord.java index f8255a7..b6f6264 100644 --- a/src/main/java/cc/mrbird/febs/mall/entity/MallMqRecord.java +++ b/src/main/java/cc/mrbird/febs/mall/entity/MallMqRecord.java @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.util.Date; + @Data @TableName("mall_mq_record") public class MallMqRecord { @@ -17,4 +19,6 @@ private Integer retryTimes; + private Date createTime; + } diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java index 62c44f7..73d863b 100644 --- a/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java +++ b/src/main/java/cc/mrbird/febs/mall/quartz/ProfitJob.java @@ -86,7 +86,7 @@ * 补贴消息--重试 * 一个小时运行一次 */ - @Scheduled(cron = "0 0 * * * ?") + @Scheduled(cron = "0 /5 * * * ? ") public void mqPerkRetryJob() { memberProfitService.mqPerkRetryJob(); } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java index 3bbfed9..b61b090 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java @@ -184,9 +184,9 @@ if(ObjectUtil.isEmpty(mallOrderInfo)){ return; } - if(2 != mallOrderInfo.getStatus()){ - return; - } +// if(2 != mallOrderInfo.getStatus()){ +// return; +// } /** * 分享补贴 直推消费额10% */ diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java index 023ba52..8ff7be5 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java @@ -341,6 +341,7 @@ mallMqRecord.setOrderId(orderInfo.getId()); mallMqRecord.setState(2); mallMqRecord.setRetryTimes(2); + mallMqRecord.setCreateTime(orderInfo.getPayTime()); mallMqRecordMapper.insert(mallMqRecord); //发送补贴消息 agentProducer.sendPerkMoneyMsg(orderInfo.getId()); diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java index 68303f5..3a8ff18 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java @@ -775,7 +775,11 @@ if(CollUtil.isEmpty(mallMqRecords)){ return; } + DateTime dateTime = DateUtil.offsetMinute(new Date(), -5); for(MallMqRecord mallMqRecord : mallMqRecords){ + if(DateUtil.compare(dateTime,mallMqRecord.getCreateTime()) <= 0){ + continue; + } Integer retryTimes = mallMqRecord.getRetryTimes(); if(retryTimes <= 0){ continue; diff --git a/src/test/java/cc/mrbird/febs/ProfitTest.java b/src/test/java/cc/mrbird/febs/ProfitTest.java index 0ad3247..375d24b 100644 --- a/src/test/java/cc/mrbird/febs/ProfitTest.java +++ b/src/test/java/cc/mrbird/febs/ProfitTest.java @@ -55,7 +55,7 @@ @Test public void dynamicProfit() { - agentService.perkMoneyConsumer(Long.parseLong("712")); + agentService.perkMoneyConsumer(Long.parseLong("796")); // memberProfitService.dynamicProfit(Long.parseLong("709")); // memberProfitService.scoreRecordReleaseJob(); // memberProfitService.achieveReleaseJob(); -- Gitblit v1.9.1