fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java
@@ -186,23 +186,37 @@ } @Transactional public void effective(UserInfo invitee) { List<ThreeSale> list = dao.list("from ThreeSale ts where ts.worker.id = ? and ts.state=0 and ts.expire=0", new Serializable[] { invitee.getId() }); public void effective(UserInfo worker) { List<ThreeSale> list = threeSaleMapper.listByWorkerId(worker.getId()); if (list != null) for (int i = 0; i < list.size(); i++) { if (list.get(i).getState() != null && list.get(i).getState() == false && list.get(i).getExpire() == ThreeSale.EXPIRE_NORMAL) { ; } else { list.remove(i); i--; } } if (list.size() > 0) { ThreeSale threeSale = list.get(0); UserInfo inviter = threeSale.getBoss(); threeSale.setState(true); threeSale.setSucceedTime(System.currentTimeMillis()); dao.update(threeSale); if (inviter != null) reComputeUserRank(inviter.getId()); //添加到队列 ThreeSaleCMQManager.getInstance().addThreeSaleMsg(threeSale); ThreeSale oldSale = list.get(0); ThreeSale update = new ThreeSale(list.get(0).getId()); update.setState(true); update.setSucceedTime(System.currentTimeMillis()); threeSaleMapper.updateByPrimaryKeySelective(update); oldSale.setState(update.getState()); oldSale.setSucceedTime(update.getSucceedTime()); UserInfo inviter = list.get(0).getBoss(); // 不以邀请人数计算等级 // if (inviter != null) // reComputeUserRank(inviter.getId()); // 添加到队列 ThreeSaleCMQManager.getInstance().addThreeSaleMsg(oldSale); // 通知 userInviteMsgNotificationService.inviteSuccess(inviter.getId(), threeSale); // } // }); userInviteMsgNotificationService.inviteSuccess(inviter.getId(), oldSale); } } @@ -665,16 +679,16 @@ threeSaleMapper.deleteExpireRecord(inviter.getId(), invitee.getId()); } //添加到队列 // 添加到队列 ThreeSaleCMQManager.getInstance().addThreeSaleMsg(threeSale); // 邀请消息 userInviteMsgNotificationService.inviteSuccess(inviter.getId(), threeSale); } @Override public long countSuccessFirstTeam(Long uid) { return threeSaleMapper.countFirstTeam(uid,1); return threeSaleMapper.countFirstTeam(uid, 1); } } fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -4,6 +4,7 @@ import java.io.FileWriter; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -24,7 +25,6 @@ import com.yeshi.fanli.dao.mybatis.BindingAccountMapper; import com.yeshi.fanli.dao.mybatis.MoneyRecordMapper; import com.yeshi.fanli.dao.mybatis.PidOrderMapper; import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper; import com.yeshi.fanli.dao.mybatis.UserConnectHistoryMapper; import com.yeshi.fanli.dao.mybatis.UserInfoMapper; import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper; @@ -48,6 +48,7 @@ import com.yeshi.fanli.exception.UserAccountException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.hongbao.HongBaoService; import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce; import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService; import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService; import com.yeshi.fanli.service.inter.user.SpreadUserImgService; @@ -88,7 +89,7 @@ private OrderItemMapper orderItemMapper; @Resource private ThreeSaleMapper threeSaleMapper; private ThreeSaleSerivce threeSaleSerivce; @Resource private PidOrderMapper pidOrderMapper; @@ -198,7 +199,7 @@ if (lastUser == null) { if (userInfo != null) { // 使分销关系生效 threeSaleMapper.effectThreeSale(userInfo.getId()); threeSaleSerivce.effective(userInfo); // 更新头像与昵称 UserInfo updateUserInfo = new UserInfo(userInfo.getId()); updateUserInfo.setNickName(weiXinUser.getNickname()); @@ -274,7 +275,7 @@ session.removeAttribute("LAST_LOGIN_USER"); // 使分销关系生效 threeSaleMapper.effectThreeSale(userInfo.getId()); threeSaleSerivce.effective(userInfo); return new LoginResult(LoginResult.TYPE_NORMAL, userInfo); } else {// 两个账号拥有不同的UID @@ -288,7 +289,7 @@ result.setLessUser(lastUser); // 使分销关系生效 threeSaleMapper.effectThreeSale(userInfo.getId()); threeSaleSerivce.effective(userInfo); return result; } @@ -910,7 +911,7 @@ List<OrderItem> orderItemList = orderItemMapper.selectByUid(uid); // 备份邀请关系 List<ThreeSale> threeSaleList = threeSaleMapper.selectByUid(uid); List<ThreeSale> threeSaleList = new ArrayList<>(); // 备份分享赚 List<PidOrder> pidOrderList = pidOrderMapper.selectByUid(uid); fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/ThreeSaleSerivce.java
@@ -23,7 +23,7 @@ void bind(UserInfo invitee, UserInfo inviter) throws ThreeSaleException; void effective(UserInfo find); void effective(UserInfo worker); void validateTwentyFour(); fanli/src/main/java/com/yeshi/fanli/util/ThreeSaleCMQManager.java
@@ -9,6 +9,7 @@ import com.google.gson.Gson; import com.qcloud.cmq.Message; import com.yeshi.fanli.entity.bus.user.ThreeSale; import com.yeshi.fanli.log.LogHelper; public class ThreeSaleCMQManager { @@ -53,6 +54,7 @@ if (threeSale == null) return; cmqUtil.publishTopicMessage(TOPIC_NAME, new Gson().toJson(threeSale)); LogHelper.test("邀请消息投递成功"); } /**