yujian
2020-04-27 d5c2554ebae75afbff31c3c2966cc3a747ba941c
Merge remote-tracking branch 'origin/div' into div
13个文件已修改
7个文件已添加
585 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/TearcherInfoDao.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/UserTearcherMapDao.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TearcherInfo.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserTearcherMap.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoModifyRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TearcherServiceImpl.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserLevelUpgradedNotifyServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/TearcherService.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/manger/order/HongBaoV2AddManager.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/Constant.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/order/OrderDividentsMessageListener.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/TearcherMessageListener.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/rocket/consumer.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java
@@ -371,9 +371,7 @@
            }
            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");
@@ -381,11 +379,14 @@
                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) {
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java
@@ -30,6 +30,7 @@
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;
@@ -58,6 +59,7 @@
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @UserActive(uid="#uid")
    @RequestMapping("getsystemclientparams")
    public void getSystemClientParams(AcceptData acceptData, Long uid, String mac, HttpServletRequest request,
            PrintWriter out) {
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/TearcherInfoDao.java
New file
@@ -0,0 +1,23 @@
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);
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/UserTearcherMapDao.java
New file
@@ -0,0 +1,11 @@
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> {
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TearcherInfo.java
New file
@@ -0,0 +1,60 @@
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;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserTearcherMap.java
New file
@@ -0,0 +1,57 @@
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;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -133,10 +133,10 @@
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Resource
    private UserOrderMsgNotificationService userOrderMsgNotificationService;
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
@@ -1281,8 +1281,7 @@
                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());
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
@@ -589,11 +589,11 @@
        
        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;
    }
@@ -841,8 +841,8 @@
        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);
        }
        
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoModifyRecordServiceImpl.java
@@ -117,8 +117,8 @@
                } 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);
                    }
                }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -208,7 +208,6 @@
        }
    }
    @Override
    public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
            String endTime, Integer validState) {
@@ -401,13 +400,12 @@
        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));
@@ -429,7 +427,8 @@
    @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);
        }
@@ -442,19 +441,19 @@
                } 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();
@@ -474,7 +473,6 @@
        return threeSaleMapper.getByWorkerId(workerId);
    }
    @Override
    public ThreeSale selectByWorkerId(Long workerId) {
        return threeSaleMapper.selectSuccessByWorkerId(workerId);
@@ -499,7 +497,7 @@
    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);
@@ -509,7 +507,6 @@
    public long countSecondTeam(Long uid) {
        return threeSaleMapper.countSecondTeam(uid);
    }
    @Override
    public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
@@ -552,8 +549,19 @@
    @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;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TearcherServiceImpl.java
New file
@@ -0,0 +1,65 @@
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;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserLevelUpgradedNotifyServiceImpl.java
@@ -60,19 +60,26 @@
        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);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java
@@ -177,14 +177,13 @@
            }
        }
    }
    @Override
    @RequestSerializableByKeyService(key = "#uid")
    @Transactional(rollbackFor = Exception.class)
    public void upgradeVipByTeamNum(Long uid) {
        vipTeamVerify(uid);
    }
    @Override
    @RequestSerializableByKeyService(key = "#tid")
@@ -197,8 +196,6 @@
        vipTeamVerify(boss.getId());
    }
    /**
     * 验证用户是否满足升级队员条件
     * @param uid
@@ -220,11 +217,17 @@
        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);
        }
@@ -238,9 +241,7 @@
            }
        }
    }
    /**
     * 二阶段
     * 
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java
@@ -28,7 +28,6 @@
     */
    void effective(UserInfo worker);
    /**
     * 一级查询
     * 
@@ -70,8 +69,6 @@
    public List<ThreeSale> listSuperiorQuery(long start, int count, Integer state, Long uid);
    public long countSuperiorQuery(Integer state, Long uid);
    /**
     * 前端查询一级队员
@@ -130,7 +127,6 @@
     */
    public int getSuccessRelationshipNum(Long uid);
    /**
     * 根据邀请者查询关系
     * 
@@ -147,22 +143,21 @@
     * @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);
    /**
     * 时间段呢 邀请成功信息
@@ -193,7 +188,6 @@
     */
    public List<ThreeSale> listSecondTeam(long start, int count, Long uid);
    /**
     * 统计直接粉丝数量
     * 
@@ -208,7 +202,7 @@
     * @return
     */
    public long countSecondTeam(Long uid);
    /**
     * 查询邀请关系 时间筛选
     * @param workerId 下级id
@@ -224,7 +218,6 @@
     */
    public void inviteSeparate(Long workerId, Long bossId);
    /*
     * 该队员 在队中排第几
     */
@@ -245,8 +238,7 @@
     * @return
     */
    public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime);
    /**
     * 获取上几级邀请人
     * @Title: getMyBossDeepList
@@ -257,9 +249,8 @@
     * List<ThreeSale> 返回类型
     * @throws
     */
    public List<ThreeSale> getMyBossDeepList(Long uid,int deep);
    public List<ThreeSale> getMyBossDeepList(Long uid, int deep);
    /**
     * 获取上级列表
     * @Title: getMyBossDeepList
@@ -271,4 +262,15 @@
     */
    public List<ThreeSale> getMyBossDeepList(Long uid);
    /**
     * 获取用户的顶级boss
     * @Title: getTopBoss
     * @Description:
     * @param uid
     * @return
     * Long 返回类型
     * @throws
     */
    public Long getTopBoss(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/TearcherService.java
New file
@@ -0,0 +1,60 @@
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);
}
fanli/src/main/java/com/yeshi/fanli/service/manger/order/HongBaoV2AddManager.java
@@ -25,7 +25,6 @@
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;
@@ -43,7 +42,6 @@
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;
@@ -96,9 +94,6 @@
    @Resource
    private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
    @Resource
    private TeamUserLevelStatisticService teamUserLevelStatisticService;
    /**
     * 添加红包信息
@@ -247,11 +242,12 @@
            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;
@@ -351,7 +347,7 @@
            // 获取子红包
            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)
@@ -457,7 +453,7 @@
            // 获取子红包
            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;
fanli/src/main/java/com/yeshi/fanli/util/Constant.java
@@ -27,6 +27,9 @@
    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;
@@ -256,8 +259,6 @@
    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");
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/order/OrderDividentsMessageListener.java
@@ -20,7 +20,7 @@
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;
@@ -28,9 +28,9 @@
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;
@@ -56,7 +56,7 @@
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private TeamUserLevelStatisticService teamUserLevelStatisticService;
    private UserLevelManager userLevelManager;
    public OrderDividentsMessageListener() {
@@ -97,13 +97,8 @@
                        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);
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/TearcherMessageListener.java
New file
@@ -0,0 +1,96 @@
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;
    }
}
fanli/src/main/resource/rocket/consumer.xml
@@ -281,6 +281,41 @@
            </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>