From 02ebb4acfb13dca5ea2f3d3dcac5844c3b844e7d Mon Sep 17 00:00:00 2001 From: gongzuming <gongzuming> Date: 星期一, 02 九月 2024 17:12:58 +0800 Subject: [PATCH] fix bug --- 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