| | |
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInviteSeparateMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | | public class UserInviteSeparateServiceImpl implements UserInviteSeparateService {
|
| | |
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService;
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | | @Override
|
| | | public void insertSelective(UserInviteSeparate record) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void inviteSeparate(UserInviteSeparate record) {
|
| | |
| | |
|
| | | Long workerId = record.getWorkerId();
|
| | | Long bossId = record.getBossId();
|
| | | |
| | | ThreeSale threeSale = threeSaleSerivce.getMyBoss(workerId);
|
| | | if (threeSale == null) {
|
| | | // 成功脱离 不发消息
|
| | |
| | | } else {
|
| | | // 脱离关系
|
| | | userInviteSeparateMapper.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_SUCCESS);
|
| | |
|
| | | // 脱离邀请关系
|
| | | threeSaleSerivce.inviteSeparate(workerId, bossId);
|
| | |
|
| | | int limitDays = Integer.parseInt(userVipConfigService.getValueByKey("invite_separate_limit_days"));
|
| | |
|
| | | // 消息 TODO
|
| | | UserInfo userInfo = userInfoService.selectByPKey(workerId);
|
| | | MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
|
| | | msgboss.setContent1(userInfo.getNickName() + workerId + "于"+ TimeUtil.formatDateDot(record.getCreateTime()) + "成功升级成为会员 ");
|
| | | msgboss.setContent2("很遗憾,你未能在" + limitDays + "天升级为会员 ");
|
| | | msgboss.setContent3("已与其脱离邀请关系");
|
| | | userOtherMsgNotificationService.teamSplitCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
|
| | | UserInfo worker = userInfoService.selectByPKey(workerId);
|
| | | |
| | | // 提醒上级脱离
|
| | | userInviteMsgNotificationService.fansDivorced(bossId, worker.getNickName(), new Date());
|
| | | |
| | | // 提醒上上级脱离
|
| | | ThreeSale threeSaleSuper = threeSaleSerivce.getMyBoss(bossId);
|
| | | if (threeSaleSuper != null) { // 粉丝升级提醒
|
| | | Long bossIdSuper = threeSaleSuper.getBoss().getId();
|
| | | UserInfo boss = userInfoService.selectByPKey(workerId);
|
| | | userInviteMsgNotificationService.fansDivorcedIndirect(bossIdSuper, worker.getNickName(),
|
| | | boss.getNickName(), new Date());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|