| | |
| | | return threeSaleMapper.selectBoss(uid);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bind(UserInfo worker, UserInfo inviter) throws ThreeSaleException {
|
| | | if (worker == null || inviter == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter) throws ThreeSaleException {
|
| | | if (invitee == null || inviter == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public void bindRelationshipByWX(UserInfo invitee, Long inviterId)throws ThreeSaleException {
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bindRelationshipByWX(UserInfo invitee, Long inviterId) throws ThreeSaleException {
|
| | | if (invitee == null || inviterId == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | | // 新建立确定关系
|
| | | // 新建立确定关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(new UserInfo(inviterId));
|
| | | threeSale.setWorker(invitee);
|
| | |
| | | UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
|
| | | threeSale.setBoss(boss);
|
| | | threeSale.setWorker(invitee);
|
| | | |
| | |
|
| | | // 邀请成功:消息、相关处理
|
| | | inviteSuccess(boss.getId(), invitee.getId(), threeSale);
|
| | | }
|
| | |
| | | private void inviteSuccess(Long bossId, Long workerId, ThreeSale threeSale) {
|
| | | // 邀请消息
|
| | | UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
|
| | | if (activeLog != null && VersionUtil.greaterThan_2_0_5("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
|
| | | activeLog.getVersionCode())) { // 2.1版本以上
|
| | | if (activeLog != null && VersionUtil.greaterThan_2_0_5(
|
| | | "appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android", activeLog.getVersionCode())) { // 2.1版本以上
|
| | | userInviteMsgNotificationService.inviteSuccess2_1(bossId, threeSale);
|
| | | } else { // 最初消息
|
| | | userInviteMsgNotificationService.inviteSuccess(threeSale.getBoss().getId(), threeSale);
|
| | | }
|
| | | |
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | |
| | | }
|
| | | });
|
| | | UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(), UserInviteMQMsg.STATE_SUCCESS);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess,
|
| | | msg);
|
| | | producer.send(message);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess, msg);
|
| | | if (!Constant.IS_TEST)
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | public ThreeSale selectByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.selectSuccessByWorkerId(workerId);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public ThreeSale getNearRelationByBossIdAndWorkerId(Long bossId, Long workerId) {
|
| | | return threeSaleMapper.getNearRelationByBossIdAndWorkerId(bossId, workerId);
|
| | |
| | | public ThreeSale getByWorkerIdAndTime(Long workerId, long time) {
|
| | | return threeSaleMapper.getByWorkerIdAndTime(workerId, time);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void inviteSeparate(Long workerId, Long bossId) {
|
| | | threeSaleMapper.inviteSeparate(workerId, bossId);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long getTeamOrderNumByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.getTeamOrderNumByWorkerId(workerId);
|
| | | }
|
| | | |
| | |
|
| | | }
|