Cui Zhi Feng
2024-09-25 118623071a97b66f21c29e2bc02b8f15855ede5d
src/main/java/com/mzl/flower/schedule/PointScheduleService.java
@@ -40,7 +40,7 @@
    /**
     * 定时计算用户过期积分
     */
    @Scheduled(cron = "0 10 1 * * ?")
    @Scheduled(cron = "0 10 0 * * ?")
    public void calculatingExpiredPoint() {
        log.info("过期积分计算开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
        LocalDate now = LocalDate.now().minusDays(1);//前一天
@@ -58,7 +58,7 @@
                    customerPointDetail.setPoint(expiredPoint);
                    customerPointDetail.setRecordDate(lastYear);
                    customerPointDetail.create("sys");
                    customerPointDetail.setRemarks(DateUtils.toString(now,"yyyy-MM-dd")+"过期积分结算");
                    customerPointDetail.setRemarks(DateUtils.toString(now,"yyyy-MM-dd")+"过期积分结算,过期积分"+expiredPoint);
                    customerPointDetailMapper.insert(customerPointDetail);
                    //更新用户积分记录
@@ -68,7 +68,8 @@
                    if(customerPoint == null ){
                        log.error("用户积分记录不存在,userId={},customerId={}",pointDTO.getUserId(),pointDTO.getCustomerId());
                    }else {
                        customerPoint.setExpiredPoint(expiredPoint);
                        Integer expiredPointTotal = customerPoint.getExpiredPoint()==null?0:customerPoint.getExpiredPoint();
                        customerPoint.setExpiredPoint(expiredPoint+expiredPointTotal);
                        customerPointMapper.updateById(customerPoint);
                    }