From 74916b92e0a94053e206cd559622a671427f7d2b Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期二, 03 九月 2024 11:16:42 +0800 Subject: [PATCH] 1.优惠券相关代码提交 --- src/main/java/com/mzl/flower/schedule/PointScheduleService.java | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/mzl/flower/schedule/PointScheduleService.java b/src/main/java/com/mzl/flower/schedule/PointScheduleService.java index ca05ac0..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 20 9 * * ?") + @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,7 +55,7 @@ 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(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