| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | @Component
|
| | | public class UpdateThreeSaleJob {
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce ThreeSaleSerivce;
|
| | | @Resource
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | // 每天00点20执行 过期邀请筛选
|
| | | @Scheduled(cron = "0 20 0 * * ? ")
|
| | | public void updateReward() {
|
| | |
|
| | | @Resource
|
| | | private UserInviteSeparateService userInviteSeparateService;
|
| | | |
| | | // 邀请关系脱离
|
| | | @Scheduled(cron = "0 0/10 * * * ? ")
|
| | | public void inviteSeparate() {
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<Long> list = new ArrayList<Long>();
|
| | |
|
| | | // 发出邀请未成功 超过60天
|
| | | List<Long> listFailed = ThreeSaleSerivce.queryLongTimeFailed(60);
|
| | | if (listFailed != null && listFailed.size() > 0) {
|
| | | list.addAll(listFailed);
|
| | | }
|
| | |
|
| | | // 更新邀请过期: 60天未被邀请成功、60天未登陆系统
|
| | | if (list.size() > 0) {
|
| | | ThreeSaleSerivce.updateExpire(list);
|
| | | for (Long id : listFailed) {
|
| | | // 通知
|
| | | ThreeSale ts = ThreeSaleSerivce.selectByPrimaryKey(id);
|
| | | if (ts != null)
|
| | | userInviteMsgNotificationService.inviteFail(ts.getBoss().getId(), ts);
|
| | | int count = 100;
|
| | | for (int i = 0; i < 1000; i++) {
|
| | | List<UserInviteSeparate> list = userInviteSeparateService.getHandleOverdue(i, count);
|
| | | if (list == null || list.size() == 0)
|
| | | break;
|
| | | |
| | | for (UserInviteSeparate separate: list) {
|
| | | try {
|
| | | userVIPInfoService.inviteSeparate(separate.getWorkerId(), separate.getBossId());
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | |
| | | if (list.size() < count) {
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|