Merge remote-tracking branch 'origin/div' into div
| | |
| | | }
|
| | |
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | // TODO 验证是否是导师
|
| | | UserVIPPreInfo info = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | |
|
| | | JSONObject inner = new JSONObject();
|
| | | inner.put("link", userVipConfigService.getValueByKey("vip_link"));
|
| | | inner.put("ion", "http://img.flqapp.com/resource/vip/icon_vip.png");
|
| | |
| | | inner.put("btnName", "升级会员");
|
| | |
|
| | | if (uid != null) {
|
| | | if (info!=null&&info.getProcess()==UserVIPPreInfo.PROCESS_3) {
|
| | | if (info != null && info.getProcess() >= UserVIPPreInfo.PROCESS_3) {
|
| | | inner.put("link", userVipConfigService.getValueByKey("vip_link"));
|
| | | inner.put("ion", "http://img.flqapp.com/resource/vip/icon_tearcher.png");
|
| | | inner.put("title", "拿五险与津贴 享导师权益");
|
| | | inner.put("btnName", "升级导师");
|
| | | if (info.getProcess() == UserVIPPreInfo.PROCESS_4)
|
| | | inner.put("btnName", "板栗快省");
|
| | | else
|
| | | inner.put("btnName", "升级导师");
|
| | | } else {
|
| | | UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(uid);
|
| | | if (userVIPPreInfo != null) {
|
| | |
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.annotation.UserActive;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @UserActive(uid="#uid")
|
| | | @RequestMapping("getsystemclientparams")
|
| | | public void getSystemClientParams(AcceptData acceptData, Long uid, String mac, HttpServletRequest request,
|
| | | PrintWriter out) {
|
New file |
| | |
| | | package com.yeshi.fanli.dao.user.vip;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | |
|
| | | @Repository
|
| | | public class TearcherInfoDao extends MongodbBaseDao<TearcherInfo> {
|
| | |
|
| | | public List<TearcherInfo> listByType(int type, int start, int count) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("type").is(type));
|
| | | query.skip(start);
|
| | | query.limit(count);
|
| | | return findList(query);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.user.vip;
|
| | |
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserTearcherMap;
|
| | |
|
| | | @Repository
|
| | | public class UserTearcherMapDao extends MongodbBaseDao<UserTearcherMap> {
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | /**
|
| | | * 导师信息
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Document(collection = "tearcherInfo")
|
| | | public class TearcherInfo {
|
| | |
|
| | | public final static int TYPE_OFFICIAL = 1;// 官方导师
|
| | |
|
| | | @Id
|
| | | private String id;
|
| | | @Field
|
| | | private Integer type;
|
| | | @Field
|
| | | private String wxID;// 微信号
|
| | |
|
| | | public TearcherInfo(String id) {
|
| | | super();
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public TearcherInfo() {
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(String id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getWxID() {
|
| | | return wxID;
|
| | | }
|
| | |
|
| | | public void setWxID(String wxID) {
|
| | | this.wxID = wxID;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.mapping.DBRef;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | /**
|
| | | * 用户与导师的对应关系
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Document(collection = "userTearcherMap")
|
| | | public class UserTearcherMap {
|
| | | @DBRef
|
| | | @Field("tearcher")
|
| | | private TearcherInfo tearcherInfo;
|
| | | @Id
|
| | | private Long uid;
|
| | | private Date createTime;
|
| | | private Date updateTime;
|
| | |
|
| | | public TearcherInfo getTearcherInfo() {
|
| | | return tearcherInfo;
|
| | | }
|
| | |
|
| | | public void setTearcherInfo(TearcherInfo tearcherInfo) {
|
| | | this.tearcherInfo = tearcherInfo;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserOrderMsgNotificationService userOrderMsgNotificationService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | |
|
| | |
| | | update.setUpdateTime(new Date());
|
| | | hongBaoV2Service.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | if (hongBao.getType() == HongBaoV2.TYPE_ZIGOU || hongBao.getType() == HongBaoV2.TYPE_SHARE_GOODS) {
|
| | | userOrderMsgNotificationService.orderInvalidToBusinessRunning(uid, orderId, sourceType, hongBao.getType());
|
| | | }
|
| | |
| | |
|
| | | userActivedRecordService.add(new UserActivedRecord(uid));
|
| | |
|
| | | if (!Constant.IS_TEST) { // 发送激活成功消息
|
| | | // if (!Constant.IS_TEST) { // 发送激活成功消息
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteCodeActive,
|
| | | new Gson().toJson(new InviteCodeActiveMQMsg(uid, new Date())));
|
| | | new InviteCodeActiveMQMsg(uid, new Date()));
|
| | | producer.send(message);
|
| | | }
|
| | | // }
|
| | |
|
| | | return inviteCode;
|
| | | }
|
| | |
| | |
|
| | | if (!Constant.IS_TEST) { // 发送邀请码更改成功的消息
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userInfoUpdate,
|
| | | new Gson().toJson(new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.inviteCode, inviteCodeVip,
|
| | | new Date())));
|
| | | new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.inviteCode, inviteCodeVip,
|
| | | new Date()));
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | |
| | | } else {// 修改
|
| | | if (type == ModifyTypeEnum.portrait) {
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
|
| | | UserTopicTagEnum.userInfoUpdate, new Gson().toJson(new UserInfoUpdateMQMsg(uid,
|
| | | UserInfoUpdateTypeEnum.portrait, value, new Date())));
|
| | | UserTopicTagEnum.userInfoUpdate,new UserInfoUpdateMQMsg(uid,
|
| | | UserInfoUpdateTypeEnum.portrait, value, new Date()));
|
| | | producer.send(message);
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
|
| | | String endTime, Integer validState) {
|
| | |
| | | return threeSaleMapper.getSuccessRelationshipNum(uid);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bindInviteRelationship(Long workerId, Long bossId) throws ThreeSaleException {
|
| | | if (workerId == null || bossId == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | | |
| | |
|
| | | // 新建立确定关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(new UserInfo(bossId));
|
| | |
| | | @Transactional
|
| | | private void inviteSuccess(Long workerId, Long bossId) {
|
| | | if (!Constant.IS_TEST) {
|
| | | UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(), UserInviteMQMsg.STATE_SUCCESS);
|
| | | 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);
|
| | | }
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | // 直接粉丝邀请成功
|
| | | UserInfo invitee = userInfoService.selectByPKey(workerId);
|
| | | userInviteMsgNotificationService.directInviteSuccess(bossId, invitee.getNickName(),
|
| | | invitee.getPortrait(), new Date());
|
| | | |
| | |
|
| | | // 间接粉丝邀请成功
|
| | | ThreeSale myBoss = threeSaleMapper.getMyBoss(bossId);
|
| | | if (myBoss != null) {
|
| | | UserInfo boss = userInfoService.selectByPKey(bossId);
|
| | | userInviteMsgNotificationService.indirectInviteSuccess(myBoss.getBoss().getId(), |
| | | boss.getNickName(), invitee.getNickName(), invitee.getPortrait(), new Date());
|
| | | userInviteMsgNotificationService.indirectInviteSuccess(myBoss.getBoss().getId(),
|
| | | boss.getNickName(), invitee.getNickName(), invitee.getPortrait(), new Date());
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | | return threeSaleMapper.getByWorkerId(workerId);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public ThreeSale selectByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.selectSuccessByWorkerId(workerId);
|
| | |
| | | public List<ThreeSale> listSecondTeam(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listSecondTeam(start, count, uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countFirstTeam(Long uid) {
|
| | | return threeSaleMapper.countFirstTeam(uid);
|
| | |
| | | public long countSecondTeam(Long uid) {
|
| | | return threeSaleMapper.countSecondTeam(uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
|
| | |
| | |
|
| | | @Override
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid) {
|
| | | //TODO 需要更加简便的方式处理
|
| | | // TODO 需要更加简便的方式处理
|
| | | return getMyBossDeepList(uid, 100);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long getTopBoss(Long uid) {
|
| | | Long bossUid = null;
|
| | | UserInfo boss = getBoss(uid);
|
| | | while (boss != null) {
|
| | | bossUid = boss.getId();
|
| | | boss = getBoss(boss.getId());
|
| | | }
|
| | | return bossUid;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.vip.TearcherInfoDao;
|
| | | import com.yeshi.fanli.dao.user.vip.UserTearcherMapDao;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserTearcherMap;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TearcherService;
|
| | |
|
| | | @Service
|
| | | public class TearcherServiceImpl implements TearcherService {
|
| | |
|
| | | @Resource
|
| | | private TearcherInfoDao tearcherInfoDao;
|
| | |
|
| | | @Resource
|
| | | private UserTearcherMapDao userTearcherMapDao;
|
| | |
|
| | | @Override
|
| | | public TearcherInfo addTearcherInfo(TearcherInfo info) {
|
| | |
|
| | | if (info.getId() == null)
|
| | | info.setId(UUID.randomUUID().toString());
|
| | |
|
| | | TearcherInfo old = tearcherInfoDao.get(info.getId());
|
| | | if (old != null)
|
| | | return old;
|
| | | tearcherInfoDao.save(info);
|
| | | return info;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addUserTearcherMap(String tearcherId, Long uid) {
|
| | | UserTearcherMap map = userTearcherMapDao.get(uid);
|
| | | if (map != null)
|
| | | return;
|
| | | map = new UserTearcherMap();
|
| | | map.setCreateTime(new Date());
|
| | | map.setUid(uid);
|
| | | map.setTearcherInfo(new TearcherInfo(tearcherId));
|
| | | userTearcherMapDao.save(map);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TearcherInfo> listByType(int type, int page, int count) {
|
| | | return tearcherInfoDao.listByType(type, (page - 1) * count, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TearcherInfo selectByUid(Long uid) {
|
| | | UserTearcherMap map = userTearcherMapDao.get(uid);
|
| | | if (map != null)
|
| | | return map.getTearcherInfo();
|
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (notify == null)
|
| | | return;
|
| | | // 查询低等级的是否已读,如若未读则设为已读
|
| | | if (notify.getToLevel() == UserLevelEnum.highVIP || notify.getToLevel() == UserLevelEnum.superVIP) {
|
| | | if (notify.getToLevel() == UserLevelEnum.superVIP || notify.getToLevel() == UserLevelEnum.tearcher) {
|
| | | List<UserLevelEnum> levels = new ArrayList<>();
|
| | | if (notify.getToLevel() == UserLevelEnum.superVIP) {
|
| | | if (notify.getToLevel() == UserLevelEnum.tearcher) {
|
| | | levels.add(UserLevelEnum.highVIP);
|
| | | levels.add(UserLevelEnum.superVIP);
|
| | | } else if (notify.getToLevel() == UserLevelEnum.superVIP) {
|
| | | levels.add(UserLevelEnum.highVIP);
|
| | | }
|
| | |
|
| | | List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(), levels);
|
| | | if (list != null)
|
| | | for (UserLevelUpgradedNotify item : list) {
|
| | | item.setValid(false);
|
| | | item.setUpdateTime(new Date());
|
| | | userLevelUpgradedNotifyDao.save(item);
|
| | | }
|
| | | if (levels.size() > 0) {
|
| | |
|
| | | List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(),
|
| | | levels);
|
| | | if (list != null)
|
| | | for (UserLevelUpgradedNotify item : list) {
|
| | | item.setValid(false);
|
| | | item.setUpdateTime(new Date());
|
| | | userLevelUpgradedNotifyDao.save(item);
|
| | | }
|
| | | }
|
| | | }
|
| | | notify.setUpdateTime(new Date());
|
| | | notify.setNotified(true);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void upgradeVipByTeamNum(Long uid) {
|
| | | vipTeamVerify(uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @RequestSerializableByKeyService(key = "#tid")
|
| | |
| | | vipTeamVerify(boss.getId());
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 验证用户是否满足升级队员条件
|
| | | * @param uid
|
| | |
| | |
|
| | | long limitFirst7 = 0;
|
| | | String first7 = userVipConfigService.getValueByKey("vip_pre_7_first_level_team_count");
|
| | | if (Constant.IS_TEST)
|
| | | first7 = "30";
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(first7)) {
|
| | | limitFirst7 = Long.parseLong(first7);
|
| | | }
|
| | | |
| | | long limitSecond7 = 0;
|
| | | String second7 = userVipConfigService.getValueByKey("vip_pre_7_second_level_team_count");
|
| | | if (Constant.IS_TEST)
|
| | | second7 = "30";
|
| | | if (!StringUtil.isNullOrEmpty(second7)) {
|
| | | limitSecond7 = Long.parseLong(second7);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 二阶段
|
| | | *
|
| | |
| | | */
|
| | | void effective(UserInfo worker);
|
| | |
|
| | |
|
| | | /**
|
| | | * 一级查询
|
| | | *
|
| | |
| | | public List<ThreeSale> listSuperiorQuery(long start, int count, Integer state, Long uid);
|
| | |
|
| | | public long countSuperiorQuery(Integer state, Long uid);
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 前端查询一级队员
|
| | |
| | | */
|
| | | public int getSuccessRelationshipNum(Long uid);
|
| | |
|
| | |
|
| | | /**
|
| | | * 根据邀请者查询关系
|
| | | *
|
| | |
| | | * @throws ThreeSaleException
|
| | | */
|
| | | public void bindInviteRelationship(Long workerId, Long bossId) throws ThreeSaleException;
|
| | | |
| | |
|
| | | /**
|
| | | * 根据下级查找对象
|
| | | * @param workerId
|
| | | * @return
|
| | | */
|
| | | public ThreeSale selectByWorkerId(Long workerId);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询最近一条数据(根据下级用户ID与状态)
|
| | | * @param workerId
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId,int state);
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state);
|
| | |
|
| | | /**
|
| | | * 时间段呢 邀请成功信息
|
| | |
| | | */
|
| | | public List<ThreeSale> listSecondTeam(long start, int count, Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计直接粉丝数量
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | public long countSecondTeam(Long uid);
|
| | | |
| | |
|
| | | /**
|
| | | * 查询邀请关系 时间筛选
|
| | | * @param workerId 下级id
|
| | |
| | | */
|
| | | public void inviteSeparate(Long workerId, Long bossId);
|
| | |
|
| | | |
| | | /*
|
| | | * 该队员 在队中排第几
|
| | | */
|
| | |
| | | * @return
|
| | | */
|
| | | public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 获取上几级邀请人
|
| | | * @Title: getMyBossDeepList
|
| | |
| | | * List<ThreeSale> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid,int deep);
|
| | | |
| | | |
| | | public List<ThreeSale> getMyBossDeepList(Long uid, int deep);
|
| | |
|
| | | /**
|
| | | * 获取上级列表
|
| | | * @Title: getMyBossDeepList
|
| | |
| | | */
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取用户的顶级boss
|
| | | * @Title: getTopBoss
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * Long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public Long getTopBoss(Long uid);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user.vip;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | |
|
| | | /**
|
| | | * 导师服务
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface TearcherService {
|
| | |
|
| | | /**
|
| | | * 添加导师信息
|
| | | * @Title: addTearcherInfo
|
| | | * @Description: |
| | | * @param info
|
| | | * @return |
| | | * TearcherInfo 返回类型
|
| | | * @throws
|
| | | */
|
| | | public TearcherInfo addTearcherInfo(TearcherInfo info);
|
| | |
|
| | | /**
|
| | | * 为用户分配导师
|
| | | * @Title: addUserTearcherMap
|
| | | * @Description: |
| | | * @param tearcherId
|
| | | * @param uid |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addUserTearcherMap(String tearcherId, Long uid);
|
| | |
|
| | | /**
|
| | | * 根据type查询
|
| | | * @Title: listByType
|
| | | * @Description: |
| | | * @param type
|
| | | * @param page
|
| | | * @param count
|
| | | * @return |
| | | * List<TearcherInfo> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<TearcherInfo> listByType(int type, int page, int count);
|
| | |
|
| | | /**
|
| | | * 根据用户ID查询分配的导师
|
| | | * @Title: selectByUid
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * TearcherInfo 返回类型
|
| | | * @throws
|
| | | */
|
| | | public TearcherInfo selectByUid(Long uid);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource
|
| | | private TeamUserLevelStatisticService teamUserLevelStatisticService;
|
| | |
|
| | | /**
|
| | | * 添加红包信息
|
| | |
| | | List<Long> uidList = new ArrayList<Long>();
|
| | | for (ThreeSale ts : threeSales)
|
| | | uidList.add(ts.getBoss().getId());
|
| | | List<TeamUserLevelStatistic> levelList = teamUserLevelStatisticService.listByUids(uidList);
|
| | | if (levelList != null)
|
| | | for (TeamUserLevelStatistic s : levelList) {
|
| | | resultList.add(new UserTeamLevel(s.getId(), s.getLevel()));
|
| | | }
|
| | |
|
| | | for (Long bossUid : uidList) {
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(bossUid);
|
| | | resultList.add(new UserTeamLevel(bossUid, level));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | return resultList;
|
| | |
| | | // 获取子红包
|
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null && children.size() > 0) {
|
| | | List<UserTeamLevel> bossList =getBossList(children);
|
| | | List<UserTeamLevel> bossList = getBossList(children);
|
| | |
|
| | | for (HongBaoV2 child : children) {
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | |
| | | // 获取子红包
|
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null && children.size() > 0) {
|
| | | List<UserTeamLevel> bossList =getBossList(children);
|
| | | List<UserTeamLevel> bossList = getBossList(children);
|
| | | for (HongBaoV2 child : children) {
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | continue;
|
| | |
| | | public static boolean ENABLE_MQ = false;
|
| | |
|
| | | public static int PAGE_SIZE = 20;
|
| | | |
| | | // 新的规则生效时间
|
| | | public static final long NEW_ORDER_FANLI_RULE_TIME = TimeUtil.convertToTimeTemp("2020-04-14", "yyyy-MM-dd");
|
| | |
|
| | | // 验证文本口令或链接uid
|
| | | public static Long LINK_TOKEN_VERIFY_UID = 437032L;
|
| | |
| | | public static final WXAPPInfo WXMP_APP_INFO = new WXAPPInfo("wxc22f3bd53cb25012",
|
| | | "4c7b166fecb6d9f53837e993f2214673", "", "");
|
| | |
|
| | | // 新的规则生效时间
|
| | | public static final long NEW_ORDER_FANLI_RULE_TIME = TimeUtil.convertToTimeTemp("2020-04-14", "yyyy-MM-dd");
|
| | |
|
| | | // 使用奖励券最大金额限制
|
| | | public static final BigDecimal REWARD_COUPON_LIMIT_MONEY = new BigDecimal("10");
|
| | |
| | | import com.yeshi.fanli.dto.mq.user.body.UserForbiddenMQMsg;
|
| | | import com.yeshi.fanli.dto.order.UserTeamLevel;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.ParamsException;
|
| | | import com.yeshi.fanli.exception.money.TeamDividentsDebtException;
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
|
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsManager;
|
| | | import com.yeshi.fanli.service.manger.order.TeamDividentsSourceManager;
|
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.order.CommonOrderUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private TeamUserLevelStatisticService teamUserLevelStatisticService;
|
| | | private UserLevelManager userLevelManager;
|
| | |
|
| | | public OrderDividentsMessageListener() {
|
| | |
|
| | |
| | | List<ThreeSale> threeSalesList = threeSaleSerivce.getMyBossDeepList(dto.getUid(), 100);
|
| | | if (threeSalesList != null)
|
| | | for (ThreeSale ts : threeSalesList) {
|
| | | TeamUserLevelStatistic levelStatistic = teamUserLevelStatisticService
|
| | | .selectByUid(ts.getBoss().getId());
|
| | | if (levelStatistic == null) {
|
| | | teamUserLevelStatisticService.initData(ts.getBoss().getId());
|
| | | levelStatistic = teamUserLevelStatisticService.selectByUid(ts.getBoss().getId());
|
| | | }
|
| | | bossList.add(new UserTeamLevel(ts.getBoss().getId(), levelStatistic.getLevel()));
|
| | | UserLevelEnum level = userLevelManager.getUserLevel(ts.getBoss().getId());
|
| | | bossList.add(new UserTeamLevel(ts.getBoss().getId(), level));
|
| | | }
|
| | | try {
|
| | | teamDividentsSourceManager.addSource(commonOrderList, bossList);
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.user;
|
| | |
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.InviteCodeActiveMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TearcherService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 用户超级会员
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class TearcherMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private TearcherService tearcherService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | private static Set<Long> officialUids = null;
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer-TearcherMessageListener", message.getMsgID(), message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | | if (tag == null)
|
| | | tag = "";
|
| | | String topic = message.getTopic();
|
| | |
|
| | | if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(topic)) {
|
| | |
|
| | | // 邀请激活
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteCodeActive.name())) {
|
| | |
|
| | | JSONObject json = JSONObject.fromObject(new String(message.getBody()));
|
| | |
|
| | | InviteCodeActiveMQMsg inviteCodeActiveMQMsg = new Gson().fromJson(json.toString(),
|
| | | InviteCodeActiveMQMsg.class);
|
| | | if (inviteCodeActiveMQMsg != null) {
|
| | | // 顶级为测试用户的全部分配官方导师微信
|
| | |
|
| | | // 获取顶级boss
|
| | | Long bossId = threeSaleSerivce.getTopBoss(inviteCodeActiveMQMsg.getUid());
|
| | | if (bossId != null) {
|
| | |
|
| | | if (officialUids == null) {
|
| | | officialUids = new HashSet<>();
|
| | | List<UserInfo> userList = userInfoService.listByType(1, 1, 10000);
|
| | |
|
| | | for (UserInfo user : userList)
|
| | | officialUids.add(user.getId());
|
| | | }
|
| | |
|
| | | if (officialUids.contains(bossId)) {
|
| | | List<TearcherInfo> tearcherList = tearcherService.listByType(TearcherInfo.TYPE_OFFICIAL, 1,
|
| | | 1);
|
| | | if (tearcherList != null && tearcherList.size() > 0) {
|
| | | tearcherService.addUserTearcherMap(tearcherList.get(0).getId(),
|
| | | inviteCodeActiveMQMsg.getUid());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | |
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | | |
| | | |
| | | <!-- 导师分配 -->
|
| | | <bean id="tearcherMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.user.TearcherMessageListener"></bean>
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="tearcherConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | | <property name="properties"> <!--消费者配置信息 -->
|
| | | <props>
|
| | | <prop key="AccessKey">${rocketmq.AccessKey}</prop>
|
| | | <prop key="SecretKey">${rocketmq.SecretKey}</prop>
|
| | | <prop key="GROUP_ID">GID_TEARCHER</prop>
|
| | | <prop key="NAMESRV_ADDR">${rocketmq.NAMESRV_ADDR}</prop>
|
| | | <prop key="ConsumeThreadNums">50</prop>
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!--用户活跃 -->
|
| | | <entry value-ref="tearcherMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="inviteCodeActive" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | |
|
| | |
|