| | |
| | | package com.ruoyi.account.task; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import org.intellij.lang.annotations.RegExp; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | |
| | | @Resource |
| | | private TAppUserService appUserService; |
| | | |
| | | |
| | | /** |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void changeVipId(){ |
| | | LocalDate currentDate = LocalDate.now(); |
| | | List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery() |
| | | .le(TAppUserVipDetail::getStartTime, currentDate) |
| | | .ge(TAppUserVipDetail::getEndTime, currentDate) |
| | | .orderByDesc(TAppUserVipDetail::getStartTime).list(); |
| | | for (TAppUserVipDetail recentDetail : recentDetails) { |
| | | TAppUser byId = appUserService.getById(recentDetail.getAppUserId()); |
| | | if (byId!=null) { |
| | | byId.setVipId(recentDetail.getVipId()); |
| | | appUserService.updateById(byId); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |