增加商家扣除积分 todo
This commit is contained in:
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
@@ -66,6 +67,26 @@ public class ARPromotionJobTask {
|
|||||||
}
|
}
|
||||||
publisher.publishEvent(new ArUserRedPackEvent().setPromotionId(arPromotion.getId()).setRemark("宝藏过期"));
|
publisher.publishEvent(new ArUserRedPackEvent().setPromotionId(arPromotion.getId()).setRemark("宝藏过期"));
|
||||||
|
|
||||||
|
if(arPromotion.getBenefitsType() == 3) {
|
||||||
|
|
||||||
|
int redPackNum = arPromotion.getRedPackNum() - arPromotion.getVerifyNum();
|
||||||
|
if (redPackNum > 0) {
|
||||||
|
BigDecimal givenAmountTotal = arPromotion.getGivenAmount().multiply(BigDecimal.valueOf(redPackNum));
|
||||||
|
|
||||||
|
log.info("定时任务,商家宝藏过期,剩余积分返还: 商家id:[{}] , 活动名称:[{}] , 剩余红包数量:[{}] , 每个用户赠送积分:[{}],总计需要返还积分:[{}],开始返还积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId(), arPromotion.getTitle(), redPackNum, arPromotion.getGivenAmount(), givenAmountTotal, DateUtil.convertFromDate(new Date(), "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
// todo AR商家积分操作 开始返还商家积分
|
||||||
|
log.info("定时任务,商家宝藏过期,剩余积分返还:商家id:[{}] , 活动名称:[{}] , 剩余红包数量:[{}] , 每个用户赠送积分:[{}],总计需要返还积分:[{}],结束返还积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId(), arPromotion.getTitle(), redPackNum, arPromotion.getGivenAmount(), givenAmountTotal, DateUtil.convertFromDate(new Date(), "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ public class ARMerchantManager {
|
|||||||
|
|
||||||
if (arUserRedPack.getBenefitsType() == 3){
|
if (arUserRedPack.getBenefitsType() == 3){
|
||||||
log.info("AR商家核销赠送用户推广值,id:[{}] , 核销商家id: [{}] , 开始赠送积分,开始时间:[{}]", arUserRedPack.getId() , merchantInfo.getId() , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
log.info("AR商家核销赠送用户推广值,id:[{}] , 核销商家id: [{}] , 开始赠送积分,开始时间:[{}]", arUserRedPack.getId() , merchantInfo.getId() , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
||||||
//todo 赠送推广值
|
//todo AR商家积分操作 赠送推广值
|
||||||
log.info("AR商家核销赠送用户推广值,id:[{}] , 核销商家id: [{}] , 赠送积分任务结束,开始时间:[{}]", arUserRedPack.getId() , merchantInfo.getId() , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
log.info("AR商家核销赠送用户推广值,id:[{}] , 核销商家id: [{}] , 赠送积分任务结束,开始时间:[{}]", arUserRedPack.getId() , merchantInfo.getId() , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.fly.boot.biz.ar.request.*;
|
|||||||
import com.fly.boot.biz.ar.service.ArMerchantInfoService;
|
import com.fly.boot.biz.ar.service.ArMerchantInfoService;
|
||||||
import com.fly.boot.biz.ar.service.ArPromotionService;
|
import com.fly.boot.biz.ar.service.ArPromotionService;
|
||||||
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
import com.fly.boot.biz.ar.vo.ARPromotionVO;
|
||||||
|
import com.fly.boot.common.util.date.DateUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
@@ -87,6 +88,26 @@ public class ARPromotionManager {
|
|||||||
promotionStatus = 2;
|
promotionStatus = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(request.getBenefitsType() == 3){
|
||||||
|
|
||||||
|
BigDecimal givenAmountTotal = request.getGivenAmount().multiply(BigDecimal.valueOf(request.getRedPackNum()));
|
||||||
|
log.info("商家新增宝藏 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],开始查询剩余积分时间:[{}]"
|
||||||
|
, merchantInfo.getId() , request.getTitle() , request.getRedPackNum() , request.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
||||||
|
|
||||||
|
//todo AR商家积分操作 校验商家积分是否充足
|
||||||
|
|
||||||
|
log.info("商家新增宝藏 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],结束查询剩余积分时间:[{}]"
|
||||||
|
, merchantInfo.getId() , request.getTitle() , request.getRedPackNum() , request.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
||||||
|
|
||||||
|
log.info("商家新增宝藏 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],开始扣除积分时间:[{}]"
|
||||||
|
, merchantInfo.getId() , request.getTitle() , request.getRedPackNum() , request.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
// todo AR商家积分操作 开始扣除商家积分
|
||||||
|
log.info("商家新增宝藏 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],结束扣除积分时间:[{}]"
|
||||||
|
, merchantInfo.getId() , request.getTitle() , request.getRedPackNum() , request.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if(!arPromotionService.save(
|
if(!arPromotionService.save(
|
||||||
new ArPromotion()
|
new ArPromotion()
|
||||||
.setUserId(request.getUserId())
|
.setUserId(request.getUserId())
|
||||||
@@ -129,6 +150,26 @@ public class ARPromotionManager {
|
|||||||
if (!arPromotionService.updateById(arPromotion)){
|
if (!arPromotionService.updateById(arPromotion)){
|
||||||
throw new RuntimeException("添加库存失败");
|
throw new RuntimeException("添加库存失败");
|
||||||
}
|
}
|
||||||
|
if(arPromotion.getBenefitsType() == 3){
|
||||||
|
|
||||||
|
BigDecimal givenAmountTotal = arPromotion.getGivenAmount().multiply(BigDecimal.valueOf(request.getRedPackNum()));
|
||||||
|
log.info("商家增加库存 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],开始查询剩余积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId() , arPromotion.getTitle() , request.getRedPackNum() , arPromotion.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
||||||
|
|
||||||
|
//todo AR商家积分操作 校验商家积分是否充足
|
||||||
|
|
||||||
|
log.info("商家增加库存 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],结束查询剩余积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId() , arPromotion.getTitle() , request.getRedPackNum() , arPromotion.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss"));
|
||||||
|
|
||||||
|
log.info("商家增加库存 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],开始扣除积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId() , arPromotion.getTitle() , request.getRedPackNum() , arPromotion.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
// todo AR商家积分操作 开始扣除商家积分
|
||||||
|
log.info("商家增加库存 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 每个用户赠送积分:[{}],总计需要赠送积分:[{}],结束扣除积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId() , arPromotion.getTitle() , request.getRedPackNum() , arPromotion.getGivenAmount(), givenAmountTotal , DateUtil.convertFromDate(new Date() , "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +194,31 @@ public class ARPromotionManager {
|
|||||||
if (!arPromotionService.removeById(request.getId())){
|
if (!arPromotionService.removeById(request.getId())){
|
||||||
throw new RuntimeException("删除宝藏失败");
|
throw new RuntimeException("删除宝藏失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(arPromotion.getBenefitsType() == 3) {
|
||||||
|
|
||||||
|
int redPackNum = arPromotion.getRedPackNum() - arPromotion.getVerifyNum();
|
||||||
|
if (redPackNum <= 0) {
|
||||||
|
log.info("商家删除宝藏,红包领取完毕 ,商家id:[{}] , 活动名称:[{}] , 红包数量:[{}] , 已领取且核销数量:[{}]"
|
||||||
|
, arPromotion.getMerchantId(), arPromotion.getTitle(), arPromotion.getRedPackNum(), arPromotion.getVerifyNum()
|
||||||
|
);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal givenAmountTotal = arPromotion.getGivenAmount().multiply(BigDecimal.valueOf(redPackNum));
|
||||||
|
|
||||||
|
log.info("商家删除宝藏,剩余积分返还: 商家id:[{}] , 活动名称:[{}] , 剩余红包数量:[{}] , 每个用户赠送积分:[{}],总计需要返还积分:[{}],开始返还积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId(), arPromotion.getTitle(), redPackNum, arPromotion.getGivenAmount(), givenAmountTotal, DateUtil.convertFromDate(new Date(), "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
// todo AR商家积分操作 开始返还商家积分
|
||||||
|
log.info("商家删除宝藏,剩余积分返还:商家id:[{}] , 活动名称:[{}] , 剩余红包数量:[{}] , 每个用户赠送积分:[{}],总计需要返还积分:[{}],结束返还积分时间:[{}]"
|
||||||
|
, arPromotion.getMerchantId(), arPromotion.getTitle(), redPackNum, arPromotion.getGivenAmount(), givenAmountTotal, DateUtil.convertFromDate(new Date(), "yyyy-mm-dd hh:MM:ss")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user