| | |
| | | /** |
| | | * 定时计算用户过期积分 |
| | | */ |
| | | @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);//前一天 |
| | |
| | | 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); |
| | | |
| | | //更新用户积分记录 |
| | |
| | | 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); |
| | | } |
| | | |