From f249c277d066e151a84b766a6b82c3bbdbe1326b Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期二, 03 九月 2024 13:24:01 +0800
Subject: [PATCH] 1.优惠券-所有修改方法dto自传id 2.优惠券-积分-批量接口改成post方法 3.优惠券-定时任务-会员优惠券每月一号凌晨未使用自动过期 4.优惠券-优惠券下单接口
---
src/main/java/com/mzl/flower/schedule/PointScheduleService.java | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/main/java/com/mzl/flower/schedule/PointScheduleService.java b/src/main/java/com/mzl/flower/schedule/PointScheduleService.java
index a122c69..4465d23 100644
--- a/src/main/java/com/mzl/flower/schedule/PointScheduleService.java
+++ b/src/main/java/com/mzl/flower/schedule/PointScheduleService.java
@@ -39,12 +39,12 @@
/**
* 定时计算用户过期积分
*/
- @Scheduled(cron = "0 0 2 * * ?")
+ @Scheduled(cron = "0 10 1 * * ?")
public void calculatingExpiredPoint() {
log.info("过期积分计算开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
LocalDate now = LocalDate.now().minusDays(1);//前一天
LocalDate lastYear = now.minus(1, ChronoUnit.YEARS); // 日期减去一年
- List<ExpiredPointDTO> pointDTOS = customerPointDetailMapper.tongjiExpiredPoint(lastYear);
+ List<ExpiredPointDTO> pointDTOS = customerPointDetailMapper.tongjiExpiredPoint(lastYear,null);
if(pointDTOS != null && pointDTOS.size() > 0){
for (ExpiredPointDTO pointDTO : pointDTOS) {
if(pointDTO.getAddPoint().intValue()> pointDTO.getReducePoint().intValue()){ //积分增加大于减少
@@ -55,9 +55,9 @@
customerPointDetail.setChangeType(Constants.POINT_CHANGE_TYPE.reduce.name());
customerPointDetail.setType(Constants.POINT_TYPE.expired.name());
customerPointDetail.setPoint(expiredPoint);
- customerPointDetail.setRecordDate(now);
+ customerPointDetail.setRecordDate(lastYear);
customerPointDetail.create("sys");
- customerPointDetail.setRemarks(DateUtils.toString(lastYear,"yyyy-MM-dd")+"过期积分结算");
+ customerPointDetail.setRemarks(DateUtils.toString(now,"yyyy-MM-dd")+"过期积分结算");
customerPointDetailMapper.insert(customerPointDetail);
//更新用户积分记录
@@ -65,14 +65,7 @@
.eq(CustomerPoint::getCustomerId, pointDTO.getCustomerId())
.eq(CustomerPoint::getUserId, pointDTO.getUserId()));
if(customerPoint == null ){
- customerPoint = new CustomerPoint();
- customerPoint.setCustomerId(pointDTO.getCustomerId());
- customerPoint.setUserId(pointDTO.getUserId());
- customerPoint.setTotalPoint(0);
- customerPoint.setUsedPoint(0);
- customerPoint.setExpiredPoint(0);
- customerPoint.create("sys");
- customerPointMapper.insert(customerPoint);
+ log.error("用户积分记录不存在,userId={},customerId={}",pointDTO.getUserId(),pointDTO.getCustomerId());
}else {
customerPoint.setExpiredPoint(expiredPoint);
customerPointMapper.updateById(customerPoint);
--
Gitblit v1.9.3