Просмотр исходного кода

生日积分定时任务时间修改为每天上午8:30

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
02cbb8b1a3
1 измененных файлов: 19 добавлений и 5 удалений
  1. +19
    -5
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java

+ 19
- 5
mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java Просмотреть файл

@@ -1,6 +1,7 @@
package com.iformall.schedule;

import com.alibaba.fastjson.JSONObject;
import com.iformall.common.ErrorCode;
import com.iformall.domain.dto.WxCUserBasicInfoDto;
import com.iformall.domain.po.*;
import com.iformall.domain.po.msg.WxMsgRecord;
@@ -65,6 +66,8 @@ public class CouponSendSchedule {

@Autowired
private MqBaseProducer mqBaseProducer;
@Autowired
private PushLimitService pushLimitService;


//@Scheduled(cron = "0 0 6 1 * ?") // 每月1号发放会员的权益券
@@ -208,7 +211,7 @@ public class CouponSendSchedule {
/**
* 生日券发放
*/
@Scheduled(cron = "0 0 15 * * ?") // 测试每天6点发券
@Scheduled(cron = "0 30 8 * * ?") // 测试每天8:30点发券
public void birthdayCouponSendSchedule() {
logger.info("生日发券: 任务开始");
List<WxMall> mallList = wxMallMapper.findList(new WxMall());
@@ -256,7 +259,7 @@ public class CouponSendSchedule {
logger.info("生日发券: 会员生日券投放列表为空 couponSendList = {}, 任务跳过不执行", couponSendList);
return;
}
boolean sent = false;
boolean couponSent = false;
for (WxCouponSendVo cs : couponSendList) {
String conditions = cs.getConditions();
JSONObject configJo = null;
@@ -269,6 +272,12 @@ public class CouponSendSchedule {
logger.info("生日发券: 会员生日券配置不存在 conditions = {}, 任务跳过不执行", conditions);
return;
}

boolean couponLimit = pushLimitService.checkCoupon(cu.getTenantId(), cu.getId(), cs.getCouponId());
if (!couponLimit) {
logger.info("生日发券: {}", ErrorCode.PUSH_LIMIT_UP_TO_COUPONLIMIT.getMessage());
return;
}
//默认生日当天发送
int beforeDays = 0;
if (configJo.containsKey(WxCouponSend.KEY_BEFOREDAYS)) {
@@ -309,7 +318,7 @@ public class CouponSendSchedule {
logger.error("定时发券:发券失败 levelId=" + cu.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage());
continue;
}
sent = true;
couponSent = true;
logger.info("定时发券:商场[" + mall.getName() +
"]会员生日[" + cu.getBirthdate().toInstant() +
"]发送券[" + cs.getTitle() +
@@ -317,11 +326,16 @@ public class CouponSendSchedule {
" 电话-" + cu.getPhone() +
" id-" + cu.getId());
}
if (sent) {
if (couponSent) {
boolean couponLimit = pushLimitService.checkMsg(cu.getTenantId());
if (!couponLimit) {
logger.info("生日发券: {}", ErrorCode.PUSH_LIMIT_NOT_INRANG.getMessage());
return;
}
sendSMS(cu, mall);
// 记录积分倍率日期
try {
WxCUserBasicInfo toUpdate = new WxCUserBasicInfo() ;
WxCUserBasicInfo toUpdate = new WxCUserBasicInfo();
toUpdate.setId(cu.getId());
toUpdate.setScoreDate(cu.getBirthdate());
wxCUserBasicInfoMapper.updateByPrimaryKeySelective(toUpdate);


Загрузка…
Отмена
Сохранить