yujian
2020-05-07 a9c9da611563738e2974103a45270d5857b746b6
队员相关 + 消息删除
31个文件已修改
13个文件已添加
2462 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java 586 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/user/ThreeSaleFocusInfoDao.java 267 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/TeamDailyRecordDao.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/TeamLevelDailyRecordDao.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/user/ThreeSaleFocusDTO.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSaleFocusInfo.java 212 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TeamDailyRecord.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TeamLevelDailyRecord.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TearcherInfo.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/msg/MsgMoneyDetailServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgExtraServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/MsgOrderDetailServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserCustomSettingsServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/MsgInviteDetailServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleFocusInfoServiceImpl.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/msg/MsgAccountDetailServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamDailyRecordServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamLevelDailyRecordServiceImpl.java 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/money/msg/MsgMoneyDetailService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgExtraService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgOtherDetailService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/msg/MsgOrderDetailService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserCustomSettingsService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/MsgInviteDetailService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleFocusInfoService.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/msg/MsgAccountDetailService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/TeamDailyRecordService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/TeamLevelDailyRecordService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserVIPMessageListener.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserMsgVO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
@@ -1065,4 +1065,54 @@
        out.print(JsonUtil.loadTrueResult(""));
    }
    /**
     * 删除消息
     * @param acceptData
     * @param type
     * @param id
     * @param out
     */
    @RequestMapping(value = "deleteMsg", method = RequestMethod.POST)
    public void deleteMsg(AcceptData acceptData, String type, Long id, Long uid, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(type) || id == null || uid == null) {
            out.print(JsonUtil.loadFalseResult("参数不完整"));
            return;
        }
        switch (type) {
        case MSG_TYPE_ORDER:
            MsgOrderDetail msgOrderDetail  = msgOrderDetailService.selectByPrimaryKey(id);
            if (msgOrderDetail != null && msgOrderDetail.getUser().getId().longValue() == uid.longValue()) {
                msgOrderDetailService.deleteByPrimaryKey(id);
            }
            break;
        case MSG_TYPE_MONEY:
            MsgMoneyDetail moneyDetail  = msgMoneyDetailService.selectByPrimaryKey(id);
            if (moneyDetail != null && moneyDetail.getUser().getId().longValue() == uid.longValue()) {
                msgMoneyDetailService.deleteByPrimaryKey(id);
            }
            break;
        case MSG_TYPE_ACCOUNT:
            MsgAccountDetail accountDetail  = msgAccountDetailService.selectByPrimaryKey(id);
            if (accountDetail != null && accountDetail.getUser().getId().longValue() == uid.longValue()) {
                msgAccountDetailService.deleteByPrimaryKey(id);
            }
            break;
        case MSG_TYPE_INVITE:
            MsgInviteDetail inviteDetail  = msgInviteDetailService.selectByPrimaryKey(id);
            if (inviteDetail != null && inviteDetail.getUser().getId().longValue() == uid.longValue()) {
                msgInviteDetailService.deleteByPrimaryKey(id);
            }
            break;
        case MSG_TYPE_OTHER:
            MsgOtherDetail otherDetail  = msgOtherDetailService.selectByPrimaryKey(id);
            if (otherDetail != null && otherDetail.getUser().getId().longValue() == uid.longValue()) {
                msgOtherDetailService.deleteByPrimaryKey(id);
            }
            break;
        }
        out.print(JsonUtil.loadTrueResult(""));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -3,6 +3,7 @@
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -13,8 +14,10 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.dto.user.ThreeSaleFocusDTO;
import com.yeshi.fanli.dto.vip.UserVIPLevel;
import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
import com.yeshi.fanli.entity.accept.AcceptData;
@@ -22,13 +25,19 @@
import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
import com.yeshi.fanli.entity.bus.user.ThreeSaleFocusInfo;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord;
import com.yeshi.fanli.entity.bus.user.WeiXinUser;
import com.yeshi.fanli.entity.bus.user.vip.TeamDailyRecord;
import com.yeshi.fanli.entity.bus.user.vip.TeamLevelDailyRecord;
import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic;
import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemClientParams;
@@ -42,15 +51,22 @@
import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleFocusInfoService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
import com.yeshi.fanli.service.inter.user.invite.UserInviteValidRecordService;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.inter.user.vip.TeamDailyRecordService;
import com.yeshi.fanli.service.inter.user.vip.TeamLevelDailyRecordService;
import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
import com.yeshi.fanli.service.inter.user.vip.TearcherService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisKeyEnum;
import com.yeshi.fanli.util.RedisManager;
@@ -97,28 +113,51 @@
    @Resource
    private SpreadImgService spreadImgService;
    @Resource
    private SpreadUserImgService spreadUserImgService;
    @Resource
    private SystemClientParamsService systemClientParamsService;
    @Resource
    private UserInviteService userInviteService;
    @Resource
    private UserInviteValidRecordService userInviteValidRecordService;
    @Resource
    private UserInviteValidNumService userInviteValidNumService;
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
    @Resource
    private CommonOrderCountService commonOrderCountService;
    @Resource
    private ThreeSaleFocusInfoService threeSaleFocusInfoService;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    @Resource
    private TearcherService tearcherService;
    @Resource
    private TeamUserLevelStatisticService teamUserLevelStatisticService;
    @Resource
    private UserVIPPreInfoService userVIPPreInfoService;
    @Resource
    private TeamLevelDailyRecordService teamLevelDailyRecordService;
    
    @Resource
    private TeamDailyRecordService teamDailyRecordService;
    /**
     * 邀请码验证
     * 
@@ -156,7 +195,8 @@
            if (wxUnionId == null || wxUnionId.trim().length() == 0)
                throw new UserInfoExtraException(1, "微信授权失败");
            String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("activeWX:" + weiXinUser.getUnionid()));
            String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey,
                    StringUtil.Md5("activeWX:" + weiXinUser.getUnionid()));
            redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
            // 邀请关系用户信息
@@ -178,8 +218,7 @@
     * 
     * @param acceptData
     * @param uid
     * @param key
     *            验证返回的key
     * @param key        验证返回的key
     * @param out
     */
    @RequestSerializableByKey(key = "'activeInviteWX-'+#uid")
@@ -208,7 +247,7 @@
    }
    /**
     * 用户队员列表查询
     * 用户队员列表查询
     * 
     * @param acceptData
     * @param id
@@ -220,38 +259,31 @@
            out.print(JsonUtil.loadFalseResult("粉丝类型不正确"));
            return;
        }
        List<Long> listId = new ArrayList<Long>();
        long count = 0;
        List<ThreeSale> listTeam = null;
        if (type == 1) {
            listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId);
            count = threeSaleSerivce.countFirstTeam(uid, listId);
            listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
            count = threeSaleSerivce.countFirstTeam(uid);
        } else if (type == 2) {
            listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId);
            count = threeSaleSerivce.countSecondTeam(uid, listId);
            listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
            count = threeSaleSerivce.countSecondTeam(uid);
        }
        // 数据加工
        JSONArray array = null;
        if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
            array = organizeTeamNew(listTeam, uid, type, true);
            array = organizeTeamNew(acceptData, listTeam, uid, type, true);
        } else {
            boolean needVIPInfo = false;
            if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
                needVIPInfo = true;
            array =  organizeTeam(listTeam, uid, type,needVIPInfo);
            array = organizeTeam(listTeam, uid, type, needVIPInfo);
        }
        JSONObject result = new JSONObject();
        result.put("count", count);
        result.put("list", array);
        if (type == 1 && page == 1) {
            boolean hasCode = false;
            UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
@@ -360,18 +392,18 @@
        }
        return resultArray;
    }
    /**
     *  加工数据
     * 加工数据
     *
     * @param count
     * @param list
     * @param uid
     * @param type 查询粉丝类型 1直接 2间接
     * @param type  查询粉丝类型 1直接 2间接
     * @param wxtip 是需要微信提示
     * @return
     */
    private JSONArray organizeTeamNew(List<ThreeSale> list, Long uid, int type, boolean wxtip) {
    private JSONArray organizeTeamNew(AcceptData acceptData, List<ThreeSale> list, Long uid, int type, boolean wxtip) {
        JSONArray resultArray = new JSONArray();
        if (list == null || list.size() == 0) {
            return resultArray;
@@ -386,37 +418,37 @@
        for (ThreeSale threeSale : list) {
            listWid.add(threeSale.getWorker().getId());
        }
        // 查询有效粉丝id
        int validType = UserInviteValidRecord.TYPE_TWO;
        if (type == 1) {
            validType = UserInviteValidRecord.TYPE_ONE;
        }
        List<Long> listVid = userInviteValidRecordService.getValidWorkerIdsByUid(uid, listWid, validType);
        for (ThreeSale threeSale : list) {
            UserInfo worker = threeSale.getWorker();
            Long workerId = worker.getId();
            // 邀请成功时间
            Long succeedTime = threeSale.getSucceedTime();
            Long succeedTime = threeSale.getSucceedTime();
            if (succeedTime == null) {
                succeedTime = threeSale.getCreateTime();
            }
            // 有效粉丝
            boolean validFans = false;
            boolean validFans = false;
            if (listVid != null && listVid.size() > 0 && listVid.contains(workerId)) {
                validFans = true;
            }
            // 最近粉丝登录时间
            Date lastLoginTime = new Date(threeSale.getCreateTime());
            UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId);
            if (userInfoExtra != null && userInfoExtra.getActiveTime() != null) {
                lastLoginTime = userInfoExtra.getActiveTime();
            }
            }
            JSONObject loginJson = new JSONObject();
            if (formatYears.format(todayTime).equals(formatYears.format(lastLoginTime))) {
                loginJson.put("content", "最近登录 " + sdf.format(lastLoginTime)); // 本年
@@ -424,7 +456,7 @@
                loginJson.put("content", "最近登录 " + format.format(lastLoginTime)); // 往年
            }
            loginJson.put("color", "#888888");
            JSONArray array = new JSONArray();
            array.add(loginJson);
@@ -434,11 +466,11 @@
            if (vipLevel != null && vipLevel.getLevel() != null) {
                level = UserLevelUtil.getByLevel(vipLevel.getLevel());
            }
            if(level == null) {
            if (level == null) {
                level = UserLevelEnum.daRen;
            }
            level = UserLevelUtil.getShowLevel(level);
            JSONObject object = new JSONObject();
            object.put("workerId", workerId);
            object.put("nickName", worker.getNickName());
@@ -449,7 +481,7 @@
            object.put("recentMsg", array);
            object.put("level", level.name());
            object.put("validFans", validFans);
            if (wxtip && type == 1 && threeSale.getState() != null && threeSale.getState()) {
                // 一级队员 查询昵称备注
                String memoName = null;
@@ -460,19 +492,21 @@
                    }
                }
                object.put("memoName", memoName);
                // 添加微信信息
                if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
                    object.put("weiXin", userInfoExtra.getWeiXin());
                    object.put("weiXinState", 3);
                    object.put("weiXinTip", "添加TA的微信,你可教授TA如何通过板栗快省赚钱技巧。");
                } else {
                    if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
                        object.put("weiXinState", 1);
                        object.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
                if (!VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) {
                    // 添加微信信息
                    if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
                        object.put("weiXin", userInfoExtra.getWeiXin());
                        object.put("weiXinState", 3);
                        object.put("weiXinTip", "添加TA的微信,你可教授TA如何通过板栗快省赚钱技巧。");
                    } else {
                        object.put("weiXinState", 2);
                        object.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
                        if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
                            object.put("weiXinState", 1);
                            object.put("weiXinTip", "点击提醒,系统会发送一封站内信,提醒其添加微信号。");
                        } else {
                            object.put("weiXinState", 2);
                            object.put("weiXinTip", "系统已发送提醒,邀请人添加微信后你可复制,如对方迟迟不添加,你可联系人工客服寻求帮助");
                        }
                    }
                }
            }
@@ -480,33 +514,33 @@
        }
        return resultArray;
    }
    /**
     * 查看下级的直接粉丝
     *
     * @param acceptData
     * @param page
     * @param uid 当前UId
     * @param tid 下级UId
     * @param uid        当前UId
     * @param tid        下级UId
     * @param out
     */
    @RequestMapping(value = "getOthersTeam", method = RequestMethod.POST)
    public void getOthersTeam(AcceptData acceptData, long page, Long uid, Long tid,  PrintWriter out) {
    public void getOthersTeam(AcceptData acceptData, long page, Long uid, Long tid, PrintWriter out) {
        if (tid == null) {
            out.print(JsonUtil.loadFalseResult("传递参数不正确"));
            return;
        }
        List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, tid);
        List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE,
                tid);
        long count = threeSaleSerivce.countFirstTeam(tid);
        JSONObject result = new JSONObject();
        result.put("count", count);
        result.put("list", organizeTeamNew(listTeam, tid, 1, false));
        result.put("list", organizeTeamNew(acceptData, listTeam, tid, 1, false));
        out.print(JsonUtil.loadTrueResult(result));
    }
    /**
     * 用户队员统计- IOS
     * 
@@ -571,6 +605,7 @@
    /**
     * 获取用户信息
     *
     * @param acceptData
     * @param uid
     * @param out
@@ -584,8 +619,7 @@
        JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
        out.print(JsonUtil.loadTrueResult(bossData));
    }
    /**
     * 上级信息组织
     * 
@@ -725,11 +759,11 @@
            out.print(JsonUtil.loadFalseResult("提醒失败"));
        }
    }
    @RequestSerializableByKey(key = "'getInviteImgs-'+#uid")
    @RequestMapping(value = "/getInviteImgs", method = RequestMethod.POST)
    public void getInviteImgs(AcceptData acceptData, Long uid, Integer page, PrintWriter out, HttpServletRequest request) {
    public void getInviteImgs(AcceptData acceptData, Long uid, Integer page, PrintWriter out,
            HttpServletRequest request) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult("用户未登录"));
            return;
@@ -737,33 +771,34 @@
        if (page == null || page < 1)
            page = 1;
        try {
            String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
            if (StringUtil.isNullOrEmpty(inviteCode)) {
                out.print(JsonUtil.loadFalseResult("邀请码未激活"));
                return;
            }
            int count = 3;
            if (page > 1)
            if (page > 1)
                count = Integer.MAX_VALUE;
            // 邀请图
            List<String> imgList = spreadUserImgService.getUserSpreadImgToPage(uid, page, count, request);
            // 邀请规则
            BusinessSystem system = new BusinessSystem();
            system.setId(4L);
            system.setPlatform(1);
            system.setCreatetime(java.lang.System.currentTimeMillis());
            SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, "inviteRules");
            SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
                    "inviteRules");
            JSONObject data = new JSONObject();
            data.put("count", spreadImgService.countAll());
            data.put("inviteCode", inviteCode);
            data.put("helpLink", configService.get(ConfigKeyEnum.inviteHelpLink.getKey()));
            data.put("inviteRules",  values.getValue().replace("\n", "<br><br>"));
            data.put("inviteRules", values.getValue().replace("\n", "<br><br>"));
            data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
            data.put("inviteLink", Constant.YINGYONGBAO_LINK);
            out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
@@ -772,7 +807,7 @@
            out.print(JsonUtil.loadFalseResult("邀请信息获取失败"));
        }
    }
    /**
     * 站内信提醒队员添加微信号
     * 
@@ -794,52 +829,277 @@
        if (userInviteValidNum != null) {
            doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
        }
        JSONObject data = new JSONObject();
        data.put("num", doneFirst);
        data.put("limit", Constant.INVITE_CODRE_TAILOR_LIMIT);
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
    /**
     * 用户队员列表查询
     *
     * @param acceptData
     * @param id
     * @param out
     */
    @RequestMapping(value = "getMyTeamV2", method = RequestMethod.POST)
    public void getMyTeamV2(AcceptData acceptData, int page, long uid, int type, ThreeSaleFocusDTO focus,
            PrintWriter out) {
        if (type != 1 && type != 2) {
            out.print(JsonUtil.loadFalseResult("粉丝类型不正确"));
            return;
        }
        long firstTeam = 0;
        long countSecond = 0;
        List<ThreeSale> listTeam = null;
        if (!existScreen(focus)) { // 普通查询
            if (type == 1) {
                listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
            } else if (type == 2) {
                listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
            }
            firstTeam = threeSaleSerivce.countFirstTeam(uid);
            countSecond = threeSaleSerivce.countSecondTeam(uid);
        } else { // 筛选条件
            List<Long> listId = null;
            List<ThreeSaleFocusInfo> listfocus = threeSaleFocusInfoService.query((page - 1) * Constant.PAGE_SIZE,
                    Constant.PAGE_SIZE, type, uid, focus);
            if (listfocus != null && listfocus.size() > 0) {
                listId = new ArrayList<Long>();
                for (ThreeSaleFocusInfo focusInfo : listfocus) {
                    listId.add(focusInfo.getWorkerId());
                }
            }
            if (listId != null && listId.size() > 0) {
                if (type == 1) {
                    listTeam = threeSaleSerivce.listFirstTeam(0, Constant.PAGE_SIZE, uid, listId);
                } else if (type == 2) {
                    listTeam = threeSaleSerivce.listSecondTeam(0, Constant.PAGE_SIZE, uid, listId);
                }
            }
            firstTeam = threeSaleFocusInfoService.count(1, uid, focus);
            countSecond = threeSaleFocusInfoService.count(2, uid, focus);
        }
        JSONArray array = organizeTeamNew(acceptData, listTeam, uid, type, true);
        long count = (type == 1) ? firstTeam : countSecond;
        JSONObject result = new JSONObject();
        result.put("firstTeam", firstTeam);
        result.put("secondTeam", countSecond);
        result.put("count", count);
        result.put("list", array);
        out.print(JsonUtil.loadTrueResult(result));
    }
    
    /**
     * 验证是否存在筛选条件
     * @param focus
     * @return
     */
    private boolean existScreen(ThreeSaleFocusDTO focus) {
        if (focus.getStateValid() != null || focus.getTaobaoBind() != null || focus.getWeixinBind() != null
                || focus.getMinFansNum() != null || focus.getMinFansNum() != null
                || focus.getMinActiveTime() != null || focus.getMaxActiveTime() != null
                || focus.getMinIncome() != null  || focus.getMaxIncome() != null || !StringUtil.isNullOrEmpty(focus.getKey()))
             return true;
        return false;
    }
    /**
     * 用户队员统计
     *
     * @param acceptData
     * @param id
     * @param out
     */
    @RequestMapping(value = "countMyTeamV2", method = RequestMethod.POST)
    public void countMyTeamV2(AcceptData acceptData, Long uid, PrintWriter out) {
        try {
            JSONObject bossObject = new JSONObject();
            ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
            if (threeSale == null) {
                bossObject.put("exist", false);
                bossObject.put("desc", "恭喜你!板栗快省优质用户;\r\n\r\n你并没有邀请人,但你的邀请能力默认是开启的;\r\n你拥有独特的无邀请人激活码。");
            } else {
                // 上级基本信息
                Long bossId = threeSale.getBoss().getId();
                UserInfo userInfo = userInfoService.selectByPKey(bossId);
                boolean phoneCopy = true;
                String phone = userInfo.getPhone();
                if (StringUtil.isNullOrEmpty(phone)) {
                    phone = "";
                } else {
                    if (!userCustomSettingsService.validateDisplayPhoneByUid(bossId)) {
                        phoneCopy = false;
                        phone = phone.substring(0, 7) + "****";
                    }
                }
                // 微信号
                UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(bossId);
                if (extra != null) {
                    bossObject.put("weixin", StringUtil.isNullOrEmpty(extra.getWeiXin()) ? "" : extra.getWeiXin());
                }
                // 当前等级
                UserLevelEnum level = null;
                UserVIPLevel vipLevel = userInviteService.getVIPLevelByUid(bossId);
                if (vipLevel != null && vipLevel.getLevel() != null) {
                    level = UserLevelUtil.getByLevel(vipLevel.getLevel());
                }
                if (level == null) {
                    level = UserLevelEnum.daRen;
                }
                level = UserLevelUtil.getShowLevel(level);
                bossObject.put("exist", true);
                bossObject.put("nickName", userInfo.getNickName());
                bossObject.put("portrait", userInfo.getPortrait());
                bossObject.put("phone", phone);
                bossObject.put("phoneCopy", phoneCopy);
                bossObject.put("level", level.name());
            }
            JSONObject json = new JSONObject();
            json.put("boss", bossObject);
            TearcherInfo tearcherInfo = tearcherService.selectByUid(uid);
            if (tearcherInfo != null) {
                JSONObject tearcherObject = new JSONObject();
                tearcherObject.put("nickName", tearcherInfo.getNickName());
                tearcherObject.put("portrait", tearcherInfo.getPortrait());
                tearcherObject.put("phone", tearcherInfo.getPhone());
                tearcherObject.put("weixin", tearcherInfo.getWxID());
                tearcherObject.put("level", UserLevelEnum.tearcher);
                json.put("tearcher", tearcherInfo);
            }
            JSONObject daren = new JSONObject();
            JSONObject highVIP = new JSONObject();
            JSONObject superVIP = new JSONObject();
            TeamUserLevelStatistic statistic = teamUserLevelStatisticService.selectByUid(uid);
            if (statistic == null) {
                daren.put("total", 0);
                highVIP.put("total", 0);
                superVIP.put("total", 0);
            } else {
                int totalDaren = statistic.getDaRenFirstCount() + statistic.getDaRenSecondCount()
                        + statistic.getNormalFirstCount() + statistic.getNormalSecondCount();
                daren.put("total", totalDaren);
                highVIP.put("total", statistic.getHighFirstCount() + statistic.getHighSecondCount());
                superVIP.put("total", statistic.getSuperFirstCount() + statistic.getSuperSecondCount());
            }
            // 统计达人
            long darenToday = threeSaleSerivce.countFirstTeamByDate(uid, 1)    + threeSaleSerivce.countSecondTeamByDate(uid, 1);
            long darenMonth = threeSaleSerivce.countFirstTeamByDate(uid, 2)    + threeSaleSerivce.countSecondTeamByDate(uid, 2);
            daren.put("today", darenToday);
            daren.put("month", darenMonth);
            SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
            String today = sd.format(new Date());
            // 当月1号
            Calendar calendar1 = Calendar.getInstance();
            calendar1.set(Calendar.DAY_OF_MONTH, 1);
            Date minTime = sd.parse(sd.format(calendar1.getTime()));
            int highVIPToday = 0;
            int highVIPMonth = 0;
            List<TeamLevelDailyRecord> list = teamLevelDailyRecordService.getbyUidAndType(uid, UserLevelEnum.highVIP, minTime);
            if (list == null || list.size() > 0) {
                for (TeamLevelDailyRecord record: list) {
                    if (today.equals(sd.format(record.getUpdateTime()))) {
                        highVIPToday = record.getFirstCount() + record.getSecondCount();
                    }
                    highVIPMonth = highVIPMonth + record.getFirstCount() + record.getSecondCount();
                }
            }
            highVIP.put("today", highVIPToday);
            highVIP.put("month", highVIPMonth);
            int superVIPToday = 0;
            int superVIPMonth = 0;
            List<TeamLevelDailyRecord> listSuper = teamLevelDailyRecordService.getbyUidAndType(uid, UserLevelEnum.superVIP, minTime);
            if (listSuper == null || listSuper.size() > 0) {
                for (TeamLevelDailyRecord record: listSuper) {
                    if (today.equals(sd.format(record.getUpdateTime()))) {
                        superVIPToday = record.getFirstCount() + record.getSecondCount();
                    }
                    superVIPMonth = superVIPMonth + record.getFirstCount() + record.getSecondCount();
                }
            }
            superVIP.put("today", superVIPToday);
            superVIP.put("month", superVIPMonth);
            json.put("daren", daren);
            json.put("highVIP", highVIP);
            json.put("superVIP", superVIP);
            out.print(JsonUtil.loadTrueResult(json));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("统计失败"));
            e.printStackTrace();
        }
    }
    /**
     * 获取粉丝信息
     *
     * @param acceptData
     * @param uid
     * @param workerId
     * @param out
     */
    @RequestMapping(value = "getFansInfo")
    public void getFansInfo(AcceptData acceptData,Long uid, Long workerId, PrintWriter out) {
    public void getFansInfo(AcceptData acceptData, Long uid, Long workerId, PrintWriter out) {
        if (uid == null || workerId == null) {
            out.print(JsonUtil.loadFalseResult("用户id缺失"));
            return;
        }
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(workerId);
        if (threeSale == null) {
            out.print(JsonUtil.loadFalseResult("邀请关系不存在"));
            return;
        }
        UserInfo user = userInfoService.selectByPKey(workerId);
        if (user == null) {
            out.print(JsonUtil.loadFalseResult("用户不存在"));
            return;
        }
        JSONArray tagArray = new JSONArray();
        JSONArray tagArray = new JSONArray();
        String memoName = user.getNickName();
        Long succeedTime = threeSale.getSucceedTime();
        JSONObject data = new JSONObject();
        String phone = user.getPhone();
        boolean phoneCopy = true;
        if (StringUtil.isNullOrEmpty(phone)) {
            phone = "";
        } else {
            if (!userCustomSettingsService.validateDisplayPhoneByUid(workerId)) {
                phoneCopy = false;
                phone = phone.substring(0, 7) + "****";
            }
        }
        data.put("nickName", user.getNickName());
        data.put("phone", user.getPhone());
        data.put("joinTime", TimeUtil.formatDate(succeedTime == null? threeSale.getCreateTime() : succeedTime));
        data.put("phone", phone);
        data.put("phoneCopy", phoneCopy);
        data.put("joinTime", TimeUtil.formatDate(succeedTime == null ? threeSale.getCreateTime() : succeedTime));
        ThreeSaleExtraInfo saleExtraInfo = threeSaleExtraInfoSerivce.getbyBossIdAndWorkerId(uid, workerId);
        if (saleExtraInfo != null) {
            if(!StringUtil.isNullOrEmpty(saleExtraInfo.getNickname())) {
            if (!StringUtil.isNullOrEmpty(saleExtraInfo.getNickname())) {
                memoName = saleExtraInfo.getNickname();
            }
            String tags = saleExtraInfo.getTags();
@@ -849,7 +1109,7 @@
        }
        data.put("memoName", memoName);
        data.put("tags", tagArray);
        Date activeTime = null;
        String weixin = null;
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId);
@@ -857,9 +1117,9 @@
            weixin = userInfoExtra.getWeiXin();
            activeTime = userInfoExtra.getActiveTime();
        }
        data.put("weixin", StringUtil.isNullOrEmpty(weixin)? "": weixin);
        data.put("loginTime", TimeUtil.formatDate(activeTime == null? userInfoExtra.getCreateTime():activeTime));
        data.put("weixin", StringUtil.isNullOrEmpty(weixin) ? "" : weixin);
        data.put("loginTime", TimeUtil.formatDate(activeTime == null ? userInfoExtra.getCreateTime() : activeTime));
        UserExtraTaoBaoInfo userExtraTaoBaoInfo = userExtraTaoBaoInfoService.getByUid(workerId);
        if (userExtraTaoBaoInfo != null && !StringUtil.isNullOrEmpty(userExtraTaoBaoInfo.getRelationId())
                && !StringUtil.isNullOrEmpty(userExtraTaoBaoInfo.getSpecialId())) {
@@ -867,7 +1127,35 @@
        } else {
            data.put("taobao", false);
        }
        String levelName = null;
        UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(workerId);
        if (userVIPPreInfo != null) {
            Integer process = userVIPPreInfo.getProcess();
            if (process == UserVIPPreInfo.PROCESS_1) {
                levelName = "快省达人";
            } else if (process == UserVIPPreInfo.PROCESS_2) {
                levelName = "高级会员";
            } else if (process == UserVIPPreInfo.PROCESS_3) {
                levelName = "超级会员";
            } else if (process == UserVIPPreInfo.PROCESS_4) {
                levelName = "资深导师";
            }
            Integer sourceType = userVIPPreInfo.getSourceType();
            if (sourceType != null) {
                if (sourceType == UserVIPPreInfo.SOURCE_TYPE_ORDER) {
                    levelName += "(自购分享型)";
                } else {
                    levelName += "(邀请团队型)";
                }
            }
        }
        if (StringUtil.isNullOrEmpty(levelName)) {
            levelName = "快省达人";
        }
        data.put("level", levelName);
        long indirectNum = 0;
        long directNum = threeSaleSerivce.countFirstTeam(workerId);
        if (directNum > 0) {
@@ -875,33 +1163,38 @@
        }
        data.put("directNum", directNum);
        data.put("indirectNum", indirectNum);
        long countTB = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_TAOBAO, 60);
        long countJD = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_JD, 60);
        long countPDD = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_PDD, 60);
        data.put("orderTB", countTB);
        data.put("orderJD", countJD);
        data.put("orderPDD", countPDD);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 获取粉丝信息
     *
     * @param acceptData
     * @param uid
     * @param workerId
     * @param out
     */
    @RequestMapping(value = "saveTags")
    public void saveTags(AcceptData acceptData,Long uid, Long workerId, String tags, PrintWriter out) {
    public void saveTags(AcceptData acceptData, Long uid, Long workerId, String tags, PrintWriter out) {
        if (uid == null || workerId == null) {
            out.print(JsonUtil.loadFalseResult("用户id缺失"));
            return;
        }
        int type = 1;
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(workerId);
        if (threeSale == null) {
            type = 2;
        }
        ThreeSaleExtraInfo saleExtraInfo = threeSaleExtraInfoSerivce.getbyBossIdAndWorkerId(uid, workerId);
        if (saleExtraInfo != null) {
            ThreeSaleExtraInfo upObject = new ThreeSaleExtraInfo();
@@ -914,9 +1207,98 @@
            saleExtraInfo.setBoss(new UserInfo(uid));
            saleExtraInfo.setWorker(new UserInfo(workerId));
            saleExtraInfo.setTags(tags);
            saleExtraInfo.setType(type);
            saleExtraInfo.setCreateTime(new Date());
            threeSaleExtraInfoSerivce.insertSelective(saleExtraInfo);
        }
        threeSaleFocusInfoService.updateTags(workerId, type, tags);
        out.print(JsonUtil.loadTrueResult("保存成功"));
    }
    /**
     * 用户队员统计-h5
     *
     * @param acceptData
     * @param id
     * @param out
     */
    @RequestMapping(value = "countTeamH5", method = RequestMethod.POST)
    public void countTeamH5(AcceptData acceptData, Long uid, PrintWriter out) {
        try {
            Date now = new Date();
            SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM");
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            // 今日
            String todayStr = sdf.format(now);
            // 昨日
            Date reduceDay = DateUtil.reduceDay(1, now);
            // 本月
            String monthStr = sdf1.format(now);
            TeamDailyRecord todayRecord = new TeamDailyRecord(0,0,0);
            TeamDailyRecord yesterdayRecord = new TeamDailyRecord(0,0,0);
            TeamDailyRecord monthRecord = new TeamDailyRecord(0,0,0);
            TeamDailyRecord totalityRecord = new TeamDailyRecord(0,0,0);
            List<TeamDailyRecord> list = teamDailyRecordService.getbyUid(uid);
            if (list != null && list.size() > 0) {
                for (TeamDailyRecord record: list) {
                    Date statisticDay = record.getStatisticDay();
                    if (todayStr.equals(sdf.format(statisticDay))) {
                        todayRecord = record;
                    }
                    if (reduceDay.equals(sdf.format(statisticDay))) {
                        yesterdayRecord = record;
                    }
                    if (monthStr.equals(sdf1.format(statisticDay))) {
                        monthRecord.setFirstCount(monthRecord.getFirstCount() + record.getFirstCount());
                        monthRecord.setSecondCount(monthRecord.getSecondCount() + record.getSecondCount());
                        monthRecord.setSecondBeyond(monthRecord.getSecondBeyond() + record.getSecondBeyond());
                    }
                    totalityRecord.setFirstCount(totalityRecord.getFirstCount() + record.getFirstCount());
                    totalityRecord.setSecondCount(totalityRecord.getSecondCount() + record.getSecondCount());
                    totalityRecord.setSecondBeyond(totalityRecord.getSecondBeyond() + record.getSecondBeyond());
                }
            }
            JSONObject today = new JSONObject();
            today.put("direct", todayRecord.getFirstCount());
            today.put("indirect", todayRecord.getSecondCount());
            today.put("beyond", todayRecord.getSecondBeyond());
            JSONObject yesterday = new JSONObject();
            yesterday.put("direct", yesterdayRecord.getFirstCount());
            yesterday.put("indirect", yesterdayRecord.getSecondCount());
            yesterday.put("beyond", yesterdayRecord.getSecondBeyond());
            JSONObject month = new JSONObject();
            month.put("direct", monthRecord.getFirstCount());
            month.put("indirect", monthRecord.getSecondCount());
            month.put("beyond", monthRecord.getSecondBeyond());
            JSONObject totality = new JSONObject();
            totality.put("direct", totalityRecord.getFirstCount());
            totality.put("indirect", totalityRecord.getSecondCount());
            totality.put("beyond", totalityRecord.getSecondBeyond());
            JSONObject json = new JSONObject();
            json.put("today", today);
            json.put("yesterday", yesterday);
            json.put("month", month);
            json.put("totality", totality);
            out.print(JsonUtil.loadTrueResult(json));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("统计失败"));
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -165,4 +165,12 @@
    Long countOrderByTypeAndDate(@Param("orderType") Integer orderType, @Param("preDay") String preDay);
    
    
    /**
     * 统计近日到账收入金额
     * @param uid
     * @param day
     * @return
     */
    BigDecimal sumMoneyArrivalByUidAndNearDay(@Param("uid") Long uid, @Param("day") int day);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java
@@ -143,6 +143,21 @@
    long countSecondTeam(@Param("uid") Long uid, @Param("listId")List<Long> listId);
    /**
     * 统计一级队员
     * @param uid
     * @return
     */
    long countFirstTeamByDate(@Param("uid") Long uid, @Param("dayType")int dayType);
    /**
     * 统计二级队员
     * @param uid
     * @return
     */
    long countSecondTeamByDate(@Param("uid") Long uid, @Param("dayType")int dayType);
    /**
     * 根据id、uid查询
     * 
fanli/src/main/java/com/yeshi/fanli/dao/user/ThreeSaleFocusInfoDao.java
New file
@@ -0,0 +1,267 @@
package com.yeshi.fanli.dao.user;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Repository;
import com.yeshi.fanli.dto.user.ThreeSaleFocusDTO;
import com.yeshi.fanli.entity.bus.user.ThreeSaleFocusInfo;
import com.yeshi.fanli.util.StringUtil;
@Repository
public class ThreeSaleFocusInfoDao {
    @Resource
    private MongoTemplate mongoTemplate;
    /**
     * 新增
     *
     * @param record
     */
    public void save(ThreeSaleFocusInfo record) {
        if (record == null) {
            return;
        }
        mongoTemplate.save(record);
    }
    /**
     * 更新标签
     *
     * @param record
     */
    public void updateMemoName(Long workerId, int type, String memoName) {
        if (memoName == null) {
            memoName = "";
        }
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update = null;
        if (type == 1) {
            update = Update.update("memoName", memoName);
        } else {
            update = Update.update("memoNameSup", memoName);
        }
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新标签
     *
     * @param record
     */
    public void updateTags(Long workerId, int type, String tags) {
        if (tags == null) {
            tags = "";
        }
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update = null;
        if (type == 1) {
            update = Update.update("tags", tags);
        } else {
            update = Update.update("tagsSup", tags);
        }
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新昵称
     * @param workerId
     * @param nickName
     */
    public void updateNickName(Long workerId, String nickName) {
        if (nickName == null) {
            nickName = "";
        }
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update =  Update.update("nickName", nickName);
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新是否有效粉丝
     * @param workerId
     * @param stateValid
     */
    public void updateStateValid(Long workerId, boolean stateValid) {
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update =  Update.update("stateValid", stateValid);
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新淘宝绑定
     * @param workerId
     * @param taobaoBind
     */
    public void updateTaobaoBind(Long workerId, boolean taobaoBind) {
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update =  Update.update("taobaoBind", taobaoBind);
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新微信绑定
     * @param workerId
     * @param weixinBind
     */
    public void updateWeixinBind(Long workerId, boolean weixinBind) {
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update =  Update.update("weixinBind", weixinBind);
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新活跃时间
     * @param workerId
     * @param activeTime
     */
    public void updateActiveTime(Long workerId, Date activeTime) {
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update =  Update.update("activeTime", activeTime);
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新粉丝数量
     * @param workerId
     * @param fansNum
     */
    public void updateFansNum(Long workerId, int fansNum) {
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update =  Update.update("fansNum", fansNum);
        mongoTemplate.updateFirst(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 更新收入
     * @param workerId
     * @param income
     */
    public void updateIncome(Long workerId, BigDecimal income) {
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        Update update =  Update.update("income", income).set("incomeTime", new Date());
        mongoTemplate.updateMulti(query, update, ThreeSaleFocusInfo.class);
    }
    /**
     * 统计
     * @return
     */
    public ThreeSaleFocusInfo getbyWorkerId(Long workerId) {
        Query query = new Query();
        query.addCriteria(Criteria.where("workerId").is(workerId));
        return mongoTemplate.findOne(query, ThreeSaleFocusInfo.class);
    }
    /**
     * 查询
     *
     * @return
     */
    public List<ThreeSaleFocusInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO) {
        Query query = createQuery(type, uid, focusDTO);
        query.skip(start).limit(count);
        query.with(new Sort(Sort.Direction.DESC,"weight"));
        return mongoTemplate.find(query, ThreeSaleFocusInfo.class);
    }
    /**
     * 统计
     * @return
     */
    public long count(int type, Long uid, ThreeSaleFocusDTO focusDTO) {
        Query query = createQuery(type, uid, focusDTO);
        return mongoTemplate.count(query, ThreeSaleFocusInfo.class);
    }
    private Query createQuery(int type, Long uid, ThreeSaleFocusDTO focusDTO) {
        Query query = new Query();
        if (type == 1) {
            query.addCriteria(Criteria.where("bossId").is(uid));
        } else {
            query.addCriteria(Criteria.where("bossSuperId").is(uid));
        }
        if (focusDTO == null) {
            return query;
        }
        if (focusDTO.getStateValid() != null)
            query.addCriteria(Criteria.where("stateValid").is(focusDTO.getStateValid()));
        if (focusDTO.getTaobaoBind() != null)
            query.addCriteria(Criteria.where("taobaoBind").is(focusDTO.getTaobaoBind()));
        if (focusDTO.getWeixinBind() != null)
            query.addCriteria(Criteria.where("weixinBind").is(focusDTO.getWeixinBind()));
        if (focusDTO.getMinFansNum() != null)
            query.addCriteria(Criteria.where("fansNum").lte(focusDTO.getMinFansNum()));
        if (focusDTO.getMinFansNum() != null)
            query.addCriteria(Criteria.where("fansNum").gte(focusDTO.getMinFansNum()));
        if (focusDTO.getMinActiveTime() != null)
            query.addCriteria(Criteria.where("activeTime").lte(focusDTO.getMinActiveTime()));
        if (focusDTO.getMaxActiveTime() != null)
            query.addCriteria(Criteria.where("activeTime").gte(focusDTO.getMaxActiveTime()));
        if (focusDTO.getMinIncome() != null)
            query.addCriteria(Criteria.where("income").lte(focusDTO.getMinIncome()));
        if (focusDTO.getMaxIncome() != null)
            query.addCriteria(Criteria.where("income").gte(focusDTO.getMaxIncome()));
        if (!StringUtil.isNullOrEmpty(focusDTO.getKey())) {
            if (type == 1) {
                query.addCriteria(new Criteria().orOperator(
                       Criteria.where("nickName").regex(Pattern.compile("^.*" + focusDTO.getKey() + ".*$", Pattern.CASE_INSENSITIVE)),
                               new Criteria().andOperator(Criteria.where("memoName").regex(Pattern.compile("^.*" + focusDTO.getKey() + ".*$", Pattern.CASE_INSENSITIVE))),
                               new Criteria().andOperator(Criteria.where("tags").regex(Pattern.compile("^.*" + focusDTO.getKey() + ".*$", Pattern.CASE_INSENSITIVE)))
                    ));
            } else {
                query.addCriteria(new Criteria().orOperator(
                           Criteria.where("nickName").regex(Pattern.compile("^.*" + focusDTO.getKey() + ".*$", Pattern.CASE_INSENSITIVE)),
                                   new Criteria().andOperator(Criteria.where("memoNameSup").regex(Pattern.compile("^.*" + focusDTO.getKey() + ".*$", Pattern.CASE_INSENSITIVE))),
                                   new Criteria().andOperator(Criteria.where("tagsSup").regex(Pattern.compile("^.*" + focusDTO.getKey() + ".*$", Pattern.CASE_INSENSITIVE)))
                        ));
            }
        }
        return query;
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/TeamDailyRecordDao.java
New file
@@ -0,0 +1,68 @@
package com.yeshi.fanli.dao.user.vip;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.data.mongodb.core.MongoTemplate;
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.entity.bus.user.vip.TeamDailyRecord;
@Repository
public class TeamDailyRecordDao {
    @Resource
    private MongoTemplate mongoTemplate;
    /**
     * 新增
     *
     * @param record
     */
    public void save(TeamDailyRecord record) {
        if (record == null) {
            return;
        }
        mongoTemplate.save(record);
    }
    /**
     * 根据id查询数据
     *
     * @param id
     * @return
     */
    public TeamDailyRecord getById(String id) {
        Query query = new Query();
        query.addCriteria(Criteria.where("id").is(id));
        return mongoTemplate.findOne(query, TeamDailyRecord.class);
    }
    /**
     * 查询
     * @return
     */
    public List<TeamDailyRecord> getbyUid(Long uid) {
        Query query = new Query();
        query.addCriteria(Criteria.where("uid").is(uid));
        return mongoTemplate.find(query, TeamDailyRecord.class);
    }
    /**
     * 查询
     * @return
     */
    public List<TeamDailyRecord> getbyUid(Long uid, Date minTime) {
        Query query = new Query();
        query.addCriteria(Criteria.where("uid").is(uid));
        query.addCriteria(Criteria.where("statisticDay").lte(minTime));
        return mongoTemplate.find(query, TeamDailyRecord.class);
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/TeamLevelDailyRecordDao.java
New file
@@ -0,0 +1,61 @@
package com.yeshi.fanli.dao.user.vip;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.data.mongodb.core.MongoTemplate;
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.entity.bus.user.vip.TeamLevelDailyRecord;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
@Repository
public class TeamLevelDailyRecordDao {
    @Resource
    private MongoTemplate mongoTemplate;
    /**
     * 新增
     *
     * @param record
     */
    public void save(TeamLevelDailyRecord record) {
        if (record == null) {
            return;
        }
        mongoTemplate.save(record);
    }
    /**
     * 根据id查询数据
     *
     * @param id
     * @return
     */
    public TeamLevelDailyRecord getById(String id) {
        Query query = new Query();
        query.addCriteria(Criteria.where("id").is(id));
        return mongoTemplate.findOne(query, TeamLevelDailyRecord.class);
    }
    /**
     * 查询
     * @return
     */
    public List<TeamLevelDailyRecord> getbyUidAndType(Long uid, UserLevelEnum level, Date minTime) {
        Query query = new Query();
        query.addCriteria(Criteria.where("uid").is(uid));
        query.addCriteria(Criteria.where("level").is(level.name()));
        query.addCriteria(Criteria.where("updateTime").lte(minTime));
        return mongoTemplate.find(query, TeamLevelDailyRecord.class);
    }
}
fanli/src/main/java/com/yeshi/fanli/dto/user/ThreeSaleFocusDTO.java
New file
@@ -0,0 +1,99 @@
package com.yeshi.fanli.dto.user;
import java.math.BigDecimal;
import java.util.Date;
public class ThreeSaleFocusDTO {
    private String key;
    private Boolean stateValid;
    private Boolean taobaoBind;
    private Boolean weixinBind;
    private Integer minFansNum;
    private Integer maxFansNum;
    private Date minActiveTime;
    private Date maxActiveTime;
    private BigDecimal minIncome;
    private BigDecimal maxIncome;
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public Boolean getStateValid() {
        return stateValid;
    }
    public void setStateValid(Boolean stateValid) {
        this.stateValid = stateValid;
    }
    public Boolean getTaobaoBind() {
        return taobaoBind;
    }
    public void setTaobaoBind(Boolean taobaoBind) {
        this.taobaoBind = taobaoBind;
    }
    public Boolean getWeixinBind() {
        return weixinBind;
    }
    public void setWeixinBind(Boolean weixinBind) {
        this.weixinBind = weixinBind;
    }
    public Integer getMinFansNum() {
        return minFansNum;
    }
    public void setMinFansNum(Integer minFansNum) {
        this.minFansNum = minFansNum;
    }
    public Integer getMaxFansNum() {
        return maxFansNum;
    }
    public void setMaxFansNum(Integer maxFansNum) {
        this.maxFansNum = maxFansNum;
    }
    public Date getMinActiveTime() {
        return minActiveTime;
    }
    public void setMinActiveTime(Date minActiveTime) {
        this.minActiveTime = minActiveTime;
    }
    public Date getMaxActiveTime() {
        return maxActiveTime;
    }
    public void setMaxActiveTime(Date maxActiveTime) {
        this.maxActiveTime = maxActiveTime;
    }
    public BigDecimal getMinIncome() {
        return minIncome;
    }
    public void setMinIncome(BigDecimal minIncome) {
        this.minIncome = minIncome;
    }
    public BigDecimal getMaxIncome() {
        return maxIncome;
    }
    public void setMaxIncome(BigDecimal maxIncome) {
        this.maxIncome = maxIncome;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSaleFocusInfo.java
New file
@@ -0,0 +1,212 @@
package com.yeshi.fanli.entity.bus.user;
import java.math.BigDecimal;
import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
@Document(collection = "three_sale_focus_info")
public class ThreeSaleFocusInfo {
    @Id
    @Field("id")
    private String id;
    @Field("bossId")
    private Long bossId; // 上级id
    @Field("bossSuperId")
    private Long bossSuperId; // 上上级id
    @Field("workerId")
    private Long workerId; // 下级id
    @Field("nickName")
    private String nickName; // 昵称
    @Field("stateValid")
    private Boolean stateValid; // 有效粉丝
    @Field("taobaoBind")
    private Boolean taobaoBind; // 绑定淘宝
    @Field("weixinBind")
    private Boolean weixinBind; // 绑定微信
    @Field("activeTime")
    private Date activeTime; // 活跃时间
    @Field("fansNum")
    private Integer fansNum; // 粉丝数量
    @Field("income")
    private BigDecimal income; // 账户收入
    @Field("incomeTime")
    private Date incomeTime; // 账户收入统计时间
    @Field("joinTime")
    private Date joinTime; // 邀请成功时间
    @Field("memoName")
    private String memoName; // 直接上级备注名
    @Field("tags")
    private String tags; // 直接上级标签
    @Field("memoNameSup")
    private String memoNameSup; // 间接上级备注名
    @Field("tagsSup")
    private String tagsSup; // 间接上级标签
    @Field("updateTime")
    private Date updateTime; // 更新时间
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Long getBossId() {
        return bossId;
    }
    public void setBossId(Long bossId) {
        this.bossId = bossId;
    }
    public Long getBossSuperId() {
        return bossSuperId;
    }
    public void setBossSuperId(Long bossSuperId) {
        this.bossSuperId = bossSuperId;
    }
    public Long getWorkerId() {
        return workerId;
    }
    public void setWorkerId(Long workerId) {
        this.workerId = workerId;
    }
    public String getNickName() {
        return nickName;
    }
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    public String getMemoName() {
        return memoName;
    }
    public void setMemoName(String memoName) {
        this.memoName = memoName;
    }
    public String getTags() {
        return tags;
    }
    public void setTags(String tags) {
        this.tags = tags;
    }
    public Boolean getStateValid() {
        return stateValid;
    }
    public void setStateValid(Boolean stateValid) {
        this.stateValid = stateValid;
    }
    public Boolean getTaobaoBind() {
        return taobaoBind;
    }
    public void setTaobaoBind(Boolean taobaoBind) {
        this.taobaoBind = taobaoBind;
    }
    public Boolean getWeixinBind() {
        return weixinBind;
    }
    public void setWeixinBind(Boolean weixinBind) {
        this.weixinBind = weixinBind;
    }
    public Date getActiveTime() {
        return activeTime;
    }
    public void setActiveTime(Date activeTime) {
        this.activeTime = activeTime;
    }
    public Integer getFansNum() {
        return fansNum;
    }
    public void setFansNum(Integer fansNum) {
        this.fansNum = fansNum;
    }
    public BigDecimal getIncome() {
        return income;
    }
    public void setIncome(BigDecimal income) {
        this.income = income;
    }
    public Date getIncomeTime() {
        return incomeTime;
    }
    public void setIncomeTime(Date incomeTime) {
        this.incomeTime = incomeTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Date getJoinTime() {
        return joinTime;
    }
    public void setJoinTime(Date joinTime) {
        this.joinTime = joinTime;
    }
    public String getMemoNameSup() {
        return memoNameSup;
    }
    public void setMemoNameSup(String memoNameSup) {
        this.memoNameSup = memoNameSup;
    }
    public String getTagsSup() {
        return tagsSup;
    }
    public void setTagsSup(String tagsSup) {
        this.tagsSup = tagsSup;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TeamDailyRecord.java
New file
@@ -0,0 +1,98 @@
package com.yeshi.fanli.entity.bus.user.vip;
import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
/**
 * 用户粉丝统计记录-每日
 *
 * @author Administrator
 *
 */
@Document(collection = "team_daily_record")
public class TeamDailyRecord {
    @Id
    private String id;
    @Field
    @Indexed
    private Long uid;
    @Field
    private Integer firstCount; // 一级
    @Field
    private Integer secondCount; // 二级
    @Field
    private Integer secondBeyond;  // 二级以外
    @Field
    private Date statisticDay; // 统计日期: 年-月-日
    @Field
    private Date updateTime;
    public TeamDailyRecord() {}
    public TeamDailyRecord(Integer firstCount, Integer secondCount, Integer secondBeyond) {
        this.firstCount = firstCount;
        this.secondCount = secondCount;
        this.secondBeyond = secondBeyond;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public Integer getFirstCount() {
        return firstCount;
    }
    public void setFirstCount(Integer firstCount) {
        this.firstCount = firstCount;
    }
    public Integer getSecondCount() {
        return secondCount;
    }
    public void setSecondCount(Integer secondCount) {
        this.secondCount = secondCount;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getSecondBeyond() {
        return secondBeyond;
    }
    public void setSecondBeyond(Integer secondBeyond) {
        this.secondBeyond = secondBeyond;
    }
    public Date getStatisticDay() {
        return statisticDay;
    }
    public void setStatisticDay(Date statisticDay) {
        this.statisticDay = statisticDay;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TeamLevelDailyRecord.java
New file
@@ -0,0 +1,101 @@
package com.yeshi.fanli.entity.bus.user.vip;
import java.util.Date;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
/**
 * 用户等级统计记录-每日
 *
 * @author Administrator
 *
 */
@Document(collection = "team_level_daily_record")
public class TeamLevelDailyRecord {
    @Id
    private String id;
    @Field
    @Indexed
    private Long uid;
    @Indexed
    @Field
    private UserLevelEnum level; // 统计的等级
    @Field
    private Integer firstCount; // 一级
    @Field
    private Integer secondCount; // 二级
    @Field
    private Integer secondBeyond;  // 二级以外
    @Field
    private Date statisticDay; // 统计日期: 年-月-日
    @Field
    private Date updateTime;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public UserLevelEnum getLevel() {
        return level;
    }
    public void setLevel(UserLevelEnum level) {
        this.level = level;
    }
    public Integer getFirstCount() {
        return firstCount;
    }
    public void setFirstCount(Integer firstCount) {
        this.firstCount = firstCount;
    }
    public Integer getSecondCount() {
        return secondCount;
    }
    public void setSecondCount(Integer secondCount) {
        this.secondCount = secondCount;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getSecondBeyond() {
        return secondBeyond;
    }
    public void setSecondBeyond(Integer secondBeyond) {
        this.secondBeyond = secondBeyond;
    }
    public Date getStatisticDay() {
        return statisticDay;
    }
    public void setStatisticDay(Date statisticDay) {
        this.statisticDay = statisticDay;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/TearcherInfo.java
@@ -6,6 +6,7 @@
/**
 * 导师信息
 *
 * @author Administrator
 *
 */
@@ -19,7 +20,13 @@
    @Field
    private Integer type;
    @Field
    private String nickName;// 昵称
    @Field
    private String portrait;// 头像
    @Field
    private String wxID;// 微信号
    @Field
    private String phone;// 手机号
    public TearcherInfo(String id) {
        super();
@@ -29,8 +36,6 @@
    public TearcherInfo() {
    }
    public Integer getType() {
        return type;
    }
@@ -38,8 +43,6 @@
    public void setType(Integer type) {
        this.type = type;
    }
    public String getId() {
        return id;
@@ -57,4 +60,27 @@
        this.wxID = wxID;
    }
    public String getNickName() {
        return nickName;
    }
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    public String getPortrait() {
        return portrait;
    }
    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
@@ -342,6 +342,34 @@
        )A
    </select>
    
    <select id="countFirstTeamByDate" resultType="java.lang.Long">
        SELECT IFNULL(count(id),0) FROM `yeshi_ec_threesale`
        WHERE `boss_id` = #{uid}
            <if test="dayType == 1"> <!-- 今日 -->
                AND TO_DAYS(FROM_UNIXTIME(createTime/1000)) = TO_DAYS(NOW())
            </if>
            <if test="dayType == 2"> <!-- 本月 -->
                AND DATE_FORMAT(FROM_UNIXTIME(createTime/1000),'%Y%m') = DATE_FORMAT( CURDATE(),'%Y%m')
            </if>
    </select>
    <select id="countSecondTeamByDate" resultType="java.lang.Long">
        SELECT COUNT(A.id) FROM (
            SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
            LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
            WHERE tf.`boss_id` = #{uid}
             <if test="dayType == 1"> <!-- 今日 -->
                AND TO_DAYS(FROM_UNIXTIME(ts.createTime/1000)) = TO_DAYS(NOW())
            </if>
            <if test="dayType == 2"> <!-- 本月 -->
                AND DATE_FORMAT(FROM_UNIXTIME(ts.createTime/1000),'%Y%m') = DATE_FORMAT( CURDATE(),'%Y%m')
            </if>
        )A
    </select>
    <select id="getMyBoss" resultMap="AllResultMap">
        select
        <include refid="Base_Column_List" />
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -410,4 +410,11 @@
        GROUP BY co.`co_order_no`, co.`co_source_type`)A
    </select>
    
    <select id="sumMoneyArrivalByUidAndNearDay" resultType="BigDecimal">
        SELECT  SUM(v2.`hb_money`) FROM yeshi_ec_hongbao_v2 v2
        WHERE v2.`hb_uid` = #{uid} AND v2.`hb_state` = 3
            AND  DATE_SUB(CURDATE(), INTERVAL #{day} DAY) <![CDATA[<=]]> DATE(v2.`hb_get_time`)
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -169,4 +169,9 @@
                startTime, endTime, listSource);
    }
    
    @Override
    public BigDecimal sumMoneyArrivalByUidAndNearDay(Long uid, int day) {
        return hongBaoV2CountMapper.sumMoneyArrivalByUidAndNearDay(uid, day);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/money/msg/MsgMoneyDetailServiceImpl.java
@@ -99,4 +99,15 @@
        msgMoneyDetailMapper.setMsgReadByUid(uid);
    }
    @Override
    public MsgMoneyDetail selectByPrimaryKey(Long id) {
        return msgMoneyDetailMapper.selectByPrimaryKey(id);
    }
    @Override
    public void deleteByPrimaryKey(Long id) {
        msgMoneyDetailMapper.deleteByPrimaryKey(id);
        msgExtraService.deleteByPidAndType(id, MsgExtra.MSG_TYPE_MONEY);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgExtraServiceImpl.java
@@ -34,4 +34,14 @@
        }
    }
    @Override
    public void deleteByPidAndType(Long rid, String type) {
        MsgExtra msgExtra = msgExtraMapper.getByRidAndType(rid, type);
        if (msgExtra == null) {
            return;
        }
        msgExtraMapper.deleteByPrimaryKey(msgExtra.getId());
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java
@@ -76,4 +76,14 @@
        msgOtherDetailMapper.setMsgReadByUid(uid);
    }
    @Override
    public MsgOtherDetail selectByPrimaryKey(Long id) {
        return msgOtherDetailMapper.selectByPrimaryKey(id);
    }
    @Override
    public void deleteByPrimaryKey(Long id) {
        msgOtherDetailMapper.deleteByPrimaryKey(id);
        msgExtraService.deleteByPidAndType(id, MsgExtra.MSG_TYPE_OTHER);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/MsgOrderDetailServiceImpl.java
@@ -139,5 +139,15 @@
        return msgOrderDetailMapper.listByOrderId(orderId);
    }
    @Override
    public MsgOrderDetail selectByPrimaryKey(Long id) {
        return msgOrderDetailMapper.selectByPrimaryKey(id);
    }
    @Override
    public void deleteByPrimaryKey(Long id) {
        msgOrderDetailMapper.deleteByPrimaryKey(id);
        msgExtraService.deleteByPidAndType(id, MsgExtra.MSG_TYPE_ORDER);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserCustomSettingsServiceImpl.java
@@ -148,4 +148,16 @@
    public List<UserCustomSettings> listByUidListAndTypeAndState(List<Long> uidList, String type, Integer state) {
        return userCustomSettingsMapper.listByUidListAndTypeAndState(uidList, type, state);
    }
    @Override
    public boolean validateDisplayPhoneByUid(Long uid) {
        UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid,
                UserSettingTypeEnum.noDisplayPhoneNum.name());
        if (settings != null && settings.getState() != null && settings.getState() == 1) {
            return false;
        }
        return true;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/MsgInviteDetailServiceImpl.java
@@ -77,4 +77,15 @@
        userMsgReadStateService.addInviteMsgUnReadCount(detail.getUser().getId(), 1);
    }
    @Override
    public MsgInviteDetail selectByPrimaryKey(Long id) {
        return msgInviteDetailMapper.selectByPrimaryKey(id);
    }
    @Override
    public void deleteByPrimaryKey(Long id) {
        msgInviteDetailMapper.deleteByPrimaryKey(id);
        msgExtraService.deleteByPidAndType(id, MsgExtra.MSG_TYPE_INVITE);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleFocusInfoServiceImpl.java
New file
@@ -0,0 +1,96 @@
package com.yeshi.fanli.service.impl.user.invite;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.user.ThreeSaleFocusInfoDao;
import com.yeshi.fanli.dto.user.ThreeSaleFocusDTO;
import com.yeshi.fanli.entity.bus.user.ThreeSaleFocusInfo;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleFocusInfoService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
@Service
public class ThreeSaleFocusInfoServiceImpl implements ThreeSaleFocusInfoService {
    @Resource
    private ThreeSaleFocusInfoDao threeSaleFocusInfoDao;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Override
    public void save(ThreeSaleFocusInfo record) {
        threeSaleFocusInfoDao.save(record);
    }
    @Override
    public void updateMemoName(Long workerId, int type, String memoName) {
        threeSaleFocusInfoDao.updateMemoName(workerId, type, memoName);
    }
    @Override
    public void updateTags(Long workerId, int type, String tags) {
        threeSaleFocusInfoDao.updateTags(workerId, type, tags);
    }
    @Override
    public void updateNickName(Long workerId, String nickName) {
        threeSaleFocusInfoDao.updateNickName(workerId, nickName);
    }
    @Override
    public void updateStateValid(Long workerId, boolean stateValid) {
        threeSaleFocusInfoDao.updateStateValid(workerId, stateValid);
    }
    @Override
    public void updateTaobaoBind(Long workerId, boolean taobaoBind) {
        threeSaleFocusInfoDao.updateTaobaoBind(workerId, taobaoBind);
    }
    @Override
    public void updateWeixinBind(Long workerId, boolean weixinBind) {
        threeSaleFocusInfoDao.updateWeixinBind(workerId, weixinBind);
    }
    @Override
    public void updateActiveTime(Long workerId, Date activeTime) {
        threeSaleFocusInfoDao.updateActiveTime(workerId, activeTime);
    }
    @Override
    public void updateFansNum(Long workerId) {
        long firstTeam = threeSaleSerivce.countFirstTeam(workerId);
        long secondTeam = threeSaleSerivce.countSecondTeam(workerId);
        int fansNum = (int) (firstTeam + secondTeam);
        threeSaleFocusInfoDao.updateFansNum(workerId, fansNum);
    }
    @Override
    public void updateIncome(Long workerId, BigDecimal income) {
        threeSaleFocusInfoDao.updateIncome(workerId, income);
    }
    @Override
    public List<ThreeSaleFocusInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO) {
        return threeSaleFocusInfoDao.query(start, count, type, uid, focusDTO);
    }
    @Override
    public long count(int type, Long uid, ThreeSaleFocusDTO focusDTO) {
        return threeSaleFocusInfoDao.count(type, uid, focusDTO);
    }
    @Override
    public ThreeSaleFocusInfo getbyWorkerId(Long workerId) {
        return threeSaleFocusInfoDao.getbyWorkerId(workerId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -529,6 +529,18 @@
    }
    @Override
    public long countFirstTeamByDate(Long uid, int dayType) {
        return threeSaleMapper.countFirstTeamByDate(uid, dayType);
    }
    @Override
    public long countSecondTeamByDate(Long uid, int dayType) {
        return threeSaleMapper.countSecondTeamByDate(uid, dayType);
    }
    @Override
    public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
        return threeSaleMapper.selectLatestByWorkerIdAndState(workerId, state);
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/msg/MsgAccountDetailServiceImpl.java
@@ -82,4 +82,17 @@
        
        userMsgReadStateService.addAccountMsgUnReadCount(detail.getUser().getId(), 1);
    }
    @Override
    public MsgAccountDetail selectByPrimaryKey(Long id) {
        return msgAccountDetailMapper.selectByPrimaryKey(id);
    }
    @Override
    public void deleteByPrimaryKey(Long id) {
        msgAccountDetailMapper.deleteByPrimaryKey(id);
        msgExtraService.deleteByPidAndType(id, MsgExtra.MSG_TYPE_ACCOUNT);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamDailyRecordServiceImpl.java
New file
@@ -0,0 +1,84 @@
package com.yeshi.fanli.service.impl.user.vip;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.user.vip.TeamDailyRecordDao;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.vip.TeamDailyRecord;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.TeamDailyRecordService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
@Service
public class TeamDailyRecordServiceImpl implements TeamDailyRecordService {
    @Resource
    private TeamDailyRecordDao TeamDailyRecordDao;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Override
    public void addDailyRecord(Long uid) {
        // 重新统计队员等级数量
        recountRecord(uid);
        // 统计上级队员数量
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
        if (threeSale != null) {
            recountRecord(threeSale.getBoss().getId());
        }
    }
    private void recountRecord(Long uid) {
        try {
            // 直接粉丝
            int firstCount = (int) threeSaleSerivce.countFirstTeamByDate(uid, 1);
            // 间接粉丝
            int secondCount = (int) threeSaleSerivce.countSecondTeamByDate(uid, 1);
            int secondBeyond = 0;
            // 每天只记录一次统计
            String time = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
            String id = StringUtil.Md5(uid + "#" + time);
            TeamDailyRecord record = TeamDailyRecordDao.getById(id);
            if (record == null) {
                record = new TeamDailyRecord();
            } else if (record.getSecondCount() != null) {
                secondBeyond = record.getSecondCount();
            }
            record.setId(id);
            record.setUid(uid);
            record.setFirstCount(firstCount);
            record.setSecondCount(secondCount);
            record.setSecondBeyond(secondBeyond);
            record.setStatisticDay(TimeUtil.parse(time));
            record.setUpdateTime(new Date());
            TeamDailyRecordDao.save(record);
        } catch (Exception e) {
            e.getSuppressed();
            LogHelper.errorDetailInfo(e);
        }
    }
    @Override
    public List<TeamDailyRecord> getbyUid(Long uid) {
        return TeamDailyRecordDao.getbyUid(uid);
    }
    @Override
    public List<TeamDailyRecord> getbyUid(Long uid, Date minTime) {
        return TeamDailyRecordDao.getbyUid(uid, minTime);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamLevelDailyRecordServiceImpl.java
New file
@@ -0,0 +1,180 @@
package com.yeshi.fanli.service.impl.user.vip;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.user.vip.TeamLevelDailyRecordDao;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.vip.TeamLevelDailyRecord;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.TeamLevelDailyRecordService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
import com.yeshi.fanli.service.manger.user.UserLevelManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
@Service
public class TeamLevelDailyRecordServiceImpl implements TeamLevelDailyRecordService {
    @Resource
    private TeamLevelDailyRecordDao teamLevelDailyRecordDao;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserLevelManager userLevelManager;
    @Resource
    private  UserVIPPreInfoService userVIPPreInfoService;
    @Override
    public List<TeamLevelDailyRecord> getbyUidAndType(Long uid, UserLevelEnum level, Date minTime) {
        return teamLevelDailyRecordDao.getbyUidAndType(uid, level, minTime);
    }
    @Override
    public void addStatisticByUid(Long uid) {
        // 重新统计队员等级数量
        initData(uid);
        // 统计上级队员数量
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
        if (threeSale != null) {
            initData(threeSale.getBoss().getId());
        }
    }
    private void initData(Long uid) {
        int pageSize = 1000;
        Date date = new Date();
        String countDay = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
        // 直接粉丝统计
        int daRenFirstCount = 0;
        int highFirstCount = 0;
        int superFirstCount = 0;
        int tearcherFirstCount = 0;
        for (int i = 0; i < 100; i++) {
            List<ThreeSale> list = threeSaleSerivce.listFirstTeam(i * pageSize, pageSize, uid);
            if (list == null || list.size() == 0) {
                break;
            }
            for (ThreeSale ts : list) {
                Long succeedTime = ts.getSucceedTime();
                if (succeedTime == null) {
                    succeedTime = ts.getCreateTime();
                }
                // 当日生产邀请关系
                if (countDay.equals(TimeUtil.getGernalTime(succeedTime))) {
                    daRenFirstCount++;
                    continue;
                }
                UserVIPPreInfo info = userVIPPreInfoService.getProcessInfo(uid, date);
                // 是否当日升级
                if (info != null && countDay.equals(TimeUtil.getGernalTime(info.getCreateTime().getTime())) ) {
                    for (UserLevelEnum level : UserLevelEnum.values()) {
                        if (level.getLevel() == info.getProcess()) {
                            if (level == UserLevelEnum.highVIP) {
                                highFirstCount++;
                            } else if (level == UserLevelEnum.superVIP) {
                                superFirstCount++;
                            } else if (level == UserLevelEnum.tearcher) {
                                tearcherFirstCount++;
                            }
                            break;
                        }
                    }
                }
            }
        }
        // 间接粉丝
        int daRenSecondCount = 0;
        int highSecondCount = 0;
        int superSecondCount = 0;
        int tearcherSecondCount = 0;
        for (int i = 0; i < 100; i++) {
            List<ThreeSale> list = threeSaleSerivce.listSecondTeam(i * pageSize, pageSize, uid);
            if (list == null || list.size() == 0) {
                break;
            }
            for (ThreeSale ts : list) {
                Long succeedTime = ts.getSucceedTime();
                if (succeedTime == null) {
                    succeedTime = ts.getCreateTime();
                }
                // 当日生产邀请关系
                if (countDay.equals(TimeUtil.getGernalTime(succeedTime))) {
                    daRenFirstCount++;
                    continue;
                }
                UserVIPPreInfo info = userVIPPreInfoService.getProcessInfo(uid, date);
                // 是否当日升级
                if (info != null && countDay.equals(TimeUtil.getGernalTime(info.getCreateTime().getTime())) ) {
                    for (UserLevelEnum level : UserLevelEnum.values()) {
                        if (level.getLevel() == info.getProcess()) {
                            if (level == UserLevelEnum.highVIP) {
                                highSecondCount++;
                            } else if (level == UserLevelEnum.superVIP) {
                                superSecondCount++;
                            } else if (level == UserLevelEnum.tearcher) {
                                tearcherSecondCount++;
                            }
                            break;
                        }
                    }
                }
            }
        }
        save(uid, UserLevelEnum.daRen, daRenFirstCount, daRenSecondCount);
        save(uid, UserLevelEnum.highVIP, highFirstCount, highSecondCount);
        save(uid, UserLevelEnum.superVIP, superFirstCount, superSecondCount);
        save(uid, UserLevelEnum.tearcher, tearcherFirstCount, tearcherSecondCount);
    }
    private void save(Long uid, UserLevelEnum level, int firstCount, int secondCount) {
        try {
            int secondBeyond = 0;
            // 每天只记录一次统计
            String time = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
            String id = StringUtil.Md5(uid + level.name() + time);
            TeamLevelDailyRecord record = teamLevelDailyRecordDao.getById(id);
            if (record == null) {
                record = new TeamLevelDailyRecord();
            } else if (record.getSecondCount() != null) {
                secondBeyond = record.getSecondCount();
            }
            record.setId(id);
            record.setUid(uid);
            record.setLevel(level);
            record.setFirstCount(firstCount);
            record.setSecondCount(secondCount);
            record.setStatisticDay(TimeUtil.parse(time));
            record.setUpdateTime(new Date());
            record.setSecondBeyond(secondBeyond);
            teamLevelDailyRecordDao.save(record);
        } catch (Exception e) {
            e.getSuppressed();
            LogHelper.errorDetailInfo(e);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java
@@ -78,7 +78,7 @@
            for (UserInviteValidRecord ts : list) {
                UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorkerId());
                if (level == UserLevelEnum.daRen) {
                if (level == UserLevelEnum.daRen || level == UserLevelEnum.normalVIP) {
                    daRenFirstCount++;
                } else if (level == UserLevelEnum.highVIP) {
                    highFirstCount++;
@@ -103,7 +103,7 @@
            for (UserInviteValidRecord ts : list) {
                UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorkerId());
                if (level == UserLevelEnum.daRen) {
                if (level == UserLevelEnum.daRen || level == UserLevelEnum.normalVIP) {
                    daRenSecondCount++;
                } else if (level == UserLevelEnum.highVIP) {
                    highSecondCount++;
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -199,6 +199,14 @@
    public long countMyDirectOrderByCashArrival(Long uid, BigDecimal payment);
    public BigDecimal geBonusByuid(Long uid, Integer dateType, Integer hbType, Integer moneyState);
    public BigDecimal geBonusByuid(Long uid, Integer dateType, Integer hbType, Integer moneyState);
    /**
     * 统计近日到账收入金额
     * @param uid
     * @param day
     * @return
     */
    public BigDecimal sumMoneyArrivalByUidAndNearDay(Long uid, int day);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/money/msg/MsgMoneyDetailService.java
@@ -37,4 +37,8 @@
     * @param uid
     */
    public void readMsgByUid(Long uid);
    public MsgMoneyDetail selectByPrimaryKey(Long id);
    public void deleteByPrimaryKey(Long id);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgExtraService.java
@@ -10,4 +10,11 @@
    public void addMsgExtra(long rid, String content, String type);
    /**
     * 根据上级id类型删除
     * @param rid
     * @param type
     */
    public void deleteByPidAndType(Long rid, String type);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgOtherDetailService.java
@@ -45,4 +45,8 @@
     * @param uid
     */
    public void readMsgByUid(Long uid);
    public void deleteByPrimaryKey(Long id);
    public MsgOtherDetail selectByPrimaryKey(Long id);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/msg/MsgOrderDetailService.java
@@ -52,4 +52,8 @@
     * @param uid
     */
    public void readMsgByUid(Long uid);
    public MsgOrderDetail selectByPrimaryKey(Long id);
    public void deleteByPrimaryKey(Long id);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserCustomSettingsService.java
@@ -71,4 +71,11 @@
     */
    public List<UserCustomSettings> listByUidListAndTypeAndState(List<Long> uidList, String type, Integer state);
    /**
     * 是否对外显示手机号
     * @param uid
     * @return
     */
    public boolean validateDisplayPhoneByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/MsgInviteDetailService.java
@@ -47,4 +47,8 @@
    public void deleteByThreeSale(ThreeSale sale);
    public void insertSelective(MsgInviteDetail detail);
    public void deleteByPrimaryKey(Long id);
    public MsgInviteDetail selectByPrimaryKey(Long id);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleFocusInfoService.java
New file
@@ -0,0 +1,56 @@
package com.yeshi.fanli.service.inter.user.invite;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.dto.user.ThreeSaleFocusDTO;
import com.yeshi.fanli.entity.bus.user.ThreeSaleFocusInfo;
public interface ThreeSaleFocusInfoService {
    /**
     * 查询
     * @param start
     * @param count
     * @param type
     * @param uid
     * @param focusDTO
     * @return
     */
    public List<ThreeSaleFocusInfo> query(int start, int count, int type, Long uid, ThreeSaleFocusDTO focusDTO);
    public long count(int type, Long uid, ThreeSaleFocusDTO focusDTO);
    /**
     * 根据下级id查询
     * @param workerId
     * @return
     */
    public ThreeSaleFocusInfo getbyWorkerId(Long workerId);
    public void updateMemoName(Long workerId, int type, String memoName);
    public void updateTags(Long workerId, int type, String tags);
    public void updateNickName(Long workerId, String nickName);
    public void updateStateValid(Long workerId, boolean stateValid);
    public void updateTaobaoBind(Long workerId, boolean taobaoBind);
    public void updateWeixinBind(Long workerId, boolean weixinBind);
    public void updateActiveTime(Long workerId, Date activeTime);
    public void updateFansNum(Long workerId);
    public void updateIncome(Long workerId, BigDecimal income);
    /**
     * 添加
     * @param record
     */
    public void save(ThreeSaleFocusInfo record);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java
@@ -297,5 +297,18 @@
     */
    public Long getTopBoss(Long uid);
    /**
     * 根日期类型进行统计直接
     */
    public long countFirstTeamByDate(Long uid, int dayType);
    /**
     *  根日期类型进行统计间接
     * @param uid
     * @param dayType
     * @return
     */
    public long countSecondTeamByDate(Long uid, int dayType);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/msg/MsgAccountDetailService.java
@@ -49,4 +49,8 @@
     */
    public void addMsgVIP(Long uid, String title, String beiZhu, MsgAccountVipDTO dto);
    public void deleteByPrimaryKey(Long id);
    public MsgAccountDetail selectByPrimaryKey(Long id);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/TeamDailyRecordService.java
New file
@@ -0,0 +1,33 @@
package com.yeshi.fanli.service.inter.user.vip;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.vip.TeamDailyRecord;
public interface TeamDailyRecordService {
    /**
     * 初始化统计粉丝等级数量
     * @param uid
     */
    public void addDailyRecord(Long uid);
    /**
     * 查询所有
     * @param uid
     * @return
     */
    public List<TeamDailyRecord> getbyUid(Long uid);
    /**
     * 查询数据
     * @param uid
     * @param level
     * @param minTime
     * @return
     */
    public List<TeamDailyRecord> getbyUid(Long uid, Date minTime);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/TeamLevelDailyRecordService.java
New file
@@ -0,0 +1,28 @@
package com.yeshi.fanli.service.inter.user.vip;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.vip.TeamLevelDailyRecord;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
public interface TeamLevelDailyRecordService {
    /**
     * 查询数据
     * @param uid
     * @param level
     * @param minTime
     * @return
     */
    public List<TeamLevelDailyRecord> getbyUidAndType(Long uid, UserLevelEnum level, Date minTime);
    /**
     * 初始化统计粉丝等级数量
     * @param uid
     */
    public void addStatisticByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java
@@ -106,6 +106,14 @@
            return false;
    }
    
    public static boolean greaterThan_2_1_1(String platform, String versionCode) {
        if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 57))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 80)))
            return true;
        else
            return false;
    }
    public static boolean smallerThan_1_5_1(String platform, String versionCode) {
        if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 36))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 44)))
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -75,6 +75,7 @@
            items.addAll(gson.fromJson(msg.getExtraInfo(), new TypeToken<ArrayList<CommonMsgItemVO>>() {}.getType()));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(msg.getType().getIcon());
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -88,8 +89,9 @@
        }
             
        
        UserMsgVO vo = new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order.png", "订单消息",
        UserMsgVO vo = new UserMsgVO(msg.getId(), "http://img.flqapp.com/resource/msg/icon_msg_order.png", "订单消息",
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), null);
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        if (msg.getType() == MsgTypeOrderTypeEnum.found) {
            contentList = new ArrayList<>();
@@ -231,6 +233,7 @@
            items.addAll(gson.fromJson(msg.getExtraInfo(), new TypeToken<ArrayList<CommonMsgItemVO>>() {}.getType()));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(msg.getMsgType().getIcon());
            userMsgVO.setTitle(msg.getMsgType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -294,7 +297,8 @@
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
            BindingAccount ba = new BindingAccount();
@@ -323,7 +327,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现账号验证",
            return new UserMsgVO(msg.getId(), "http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现账号验证",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.fanli) {
@@ -355,7 +359,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_fanli.png", "返利到账",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_fanli.png", "返利到账",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.fanliElme) {
@@ -382,7 +386,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_fanli.png", "返利到账",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_fanli.png", "返利到账",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.invite || msg.getMsgType() == MsgTypeMoneyTypeEnum.share) {
@@ -423,11 +427,11 @@
            String date = ca.get(Calendar.YEAR) + "年" + (ca.get(Calendar.MONTH) + 1) + "月";
            if (msg.getMsgType() == MsgTypeMoneyTypeEnum.share)
                return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
                return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
                        date + msg.getMsgType().getDesc(),
                        msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
            else
                return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
                return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
                        date + msg.getMsgType().getDesc(),
                        msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
@@ -457,7 +461,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_fanli.png", msg.getMsgType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_fanli.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.shareWeiQuan) {
            contentList = new ArrayList<>();
@@ -486,7 +490,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan) {
@@ -516,7 +520,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.orderReward) {// 奖励订单
@@ -542,7 +546,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order_reward.png",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_order_reward.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.systemEqualize) {// 系统补偿
@@ -563,7 +567,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/money_detail/icon_system.png",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/money_detail/icon_system.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extractAutoWX) { // 微信自动提现
@@ -588,7 +592,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/money_detail/icon_system.png",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/money_detail/icon_system.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.subSidy) { // 额外补贴
@@ -613,7 +617,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_subsidy.png", msg.getMsgType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_subsidy.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.orderTeamReward) { // 团队奖励
            contentList = new ArrayList<>();
@@ -637,7 +641,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_team_reward.png", msg.getMsgType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_team_reward.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackReceiveOff) { // 红包成功领取
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -664,7 +668,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_hongbao_give.png", dto.getTitle(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_hongbao_give.png", dto.getTitle(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackGiveOff) { // 红包被成功领取
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -691,7 +695,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_hongbao_give.png", dto.getTitle(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_hongbao_give.png", dto.getTitle(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackGiveBack) { // 红包未被领取退回
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -722,7 +726,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_hongbao_give.png",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_hongbao_give.png",
                    MsgTypeMoneyTypeEnum.redPackGiveBack.getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackExchangePass) { // 红包提现成功
@@ -759,7 +763,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png", dto.getTitle(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png", dto.getTitle(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackExchangeReject) { // 红包提现拒绝
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -794,7 +798,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png", dto.getTitle(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png", dto.getTitle(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackForbid) { // 红包封禁消息
@@ -824,7 +828,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", msg.getMsgType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/img/tlj/icon_tlj.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackForbidRemove) { // 红包封禁解除消息
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -853,7 +857,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", msg.getMsgType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/img/tlj/icon_tlj.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackDeduct) { // 红包扣除消息
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -882,7 +886,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", msg.getMsgType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/img/tlj/icon_tlj.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackOneStageReward
                || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackTwoStageReward
@@ -912,7 +916,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", "红包提醒",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/img/tlj/icon_tlj.png", "红包提醒",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseSuccess) { // 红包使用成功
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -968,7 +972,7 @@
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", "红包消息",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/img/tlj/icon_tlj.png", "红包消息",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseFail) { // 红包使用失败
            if (StringUtil.isNullOrEmpty(msg.getContent()))
@@ -1022,7 +1026,7 @@
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", "红包消息",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/img/tlj/icon_tlj.png", "红包消息",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
        return null;
@@ -1042,6 +1046,7 @@
            items.addAll(gson.fromJson(msg.getExtraInfo(), new TypeToken<ArrayList<CommonMsgItemVO>>() {}.getType()));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(msg.getType().getIcon());
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1082,7 +1087,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
        
@@ -1101,7 +1106,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
        
@@ -1152,7 +1157,7 @@
        contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu() + "",
                COLOR_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
        return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
        return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
    }
@@ -1172,6 +1177,7 @@
            items.addAll(gson.fromJson(msg.getExtraInfo(), new TypeToken<ArrayList<CommonMsgItemVO>>() {}.getType()));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(msg.getMsgType().getIcon());
            userMsgVO.setTitle(msg.getMsgType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1220,7 +1226,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", dto.getTitle(),
            return new UserMsgVO(msg.getId(), "http://img.flqapp.com/resource/msg/icon_msg_invite.png", dto.getTitle(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msgType == MsgTypeInviteTypeEnum.inviteSucceed) {
            if (msg.getInviteUser() == null || msg.getInviteUser().getWorker() == null)
@@ -1245,7 +1251,7 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", "邀请提醒 ",
            return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_invite.png", "邀请提醒 ",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
@@ -1268,7 +1274,7 @@
                COLOR_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
        return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", msg.getMsgType().getDesc(),
        return new UserMsgVO(msg.getId(),"http://img.flqapp.com/resource/msg/icon_msg_invite.png", msg.getMsgType().getDesc(),
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
    }
@@ -1286,6 +1292,7 @@
            items.addAll(gson.fromJson(msg.getExtraInfo(), new TypeToken<ArrayList<CommonMsgItemVO>>() {}.getType()));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(msg.getType().getIcon());
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1477,6 +1484,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1562,6 +1570,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1609,6 +1618,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1663,6 +1673,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1710,6 +1721,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1746,6 +1758,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon("http://img.flqapp.com/resource/msg/icon_msg_vip.png");
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1779,6 +1792,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon("http://img.flqapp.com/resource/msg/icon_msg_notify.png");
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1812,6 +1826,7 @@
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon("http://img.flqapp.com/resource/msg/icon_msg_invite_break.png");
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1825,6 +1840,7 @@
            items.addAll(gson.fromJson(msg.getContent(), new TypeToken<ArrayList<CommonMsgItemVO>>() {}.getType()));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setId(msg.getId());
            userMsgVO.setIcon(msg.getType().getIcon());
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
@@ -1832,7 +1848,7 @@
            return userMsgVO;
        }
        return new UserMsgVO(icon, msg.getType().getDesc(),
        return new UserMsgVO(msg.getId(),icon, msg.getType().getDesc(),
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
    }
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserTeamMessageListener.java
@@ -1,14 +1,28 @@
package com.yeshi.fanli.util.rocketmq.consumer.user;
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.BeComeValidUserMQMsg;
import com.yeshi.fanli.dto.mq.user.body.TaoBaoBindSuccessMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserActiveMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserInfoUpdateMQMsg.UserInfoUpdateTypeEnum;
import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
import com.yeshi.fanli.dto.mq.user.body.UserMoneyChangeMQMsg;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleFocusInfoService;
import com.yeshi.fanli.service.inter.user.vip.TeamLevelDailyRecordService;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
import net.sf.json.JSONObject;
/**
 * 用户粉丝消息
@@ -19,6 +33,12 @@
@Component
public class UserTeamMessageListener implements MessageListener {
    @Resource
    private ThreeSaleFocusInfoService threeSaleFocusInfoService;
    @Resource
    private TeamLevelDailyRecordService teamLevelDailyRecordService;
    @Override
    public Action consume(Message message, ConsumeContext context) {
@@ -32,27 +52,59 @@
        if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
            if (tag.equalsIgnoreCase(UserTopicTagEnum.userActve.name())) {// 用户活跃
                // TODO 更改用户活跃时间
                JSONObject json = JSONObject.fromObject(new String(message.getBody()));
                UserActiveMQMsg userActiveMQMsg = new Gson().fromJson(json.toString(),UserActiveMQMsg.class);
                if (userActiveMQMsg != null) {
                    // 更改用户活跃时间
                    threeSaleFocusInfoService.updateActiveTime(userActiveMQMsg.getUid(), userActiveMQMsg.getCreateTime());
                }
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userInfoUpdate.name())) {// 用户信息更新
                // TODO 更改微信号绑定
                JSONObject json = JSONObject.fromObject(new String(message.getBody()));
                UserInfoUpdateMQMsg mqMsg = new Gson().fromJson(json.toString(),UserInfoUpdateMQMsg.class);
                if (mqMsg != null) {
                    if (UserInfoUpdateTypeEnum.nickName == mqMsg.getType()) { // 更改昵称
                        threeSaleFocusInfoService.updateNickName(mqMsg.getUid(), mqMsg.getValue());
                    } else if (UserInfoUpdateTypeEnum.wxId == mqMsg.getType()) { // 微信号绑定
                        threeSaleFocusInfoService.updateWeixinBind(mqMsg.getUid(), true);
                    }
                }
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.taobaoBindSuccess.name())) {// 淘宝绑定成功
                // TODO 更改淘宝绑定状态与原用户淘宝绑定状态
                //  更改淘宝绑定状态与原用户淘宝绑定状态
                JSONObject json = JSONObject.fromObject(new String(message.getBody()));
                TaoBaoBindSuccessMQMsg mqMsg = new Gson().fromJson(json.toString(),TaoBaoBindSuccessMQMsg.class);
                if (mqMsg != null) {
                    // 更新淘宝绑定
                    threeSaleFocusInfoService.updateWeixinBind(mqMsg.getUid(), true);
                    Long fromUid = mqMsg.getFromUid();
                    if (fromUid != null) { // 淘宝被解绑
                        threeSaleFocusInfoService.updateWeixinBind(fromUid, false);
                    }
                }
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {// 邀请成功
                // TODO 更新粉丝数量
                // 更新粉丝数量
                JSONObject json = JSONObject.fromObject(new String(message.getBody()));
                UserInviteMQMsg mqMsg = new Gson().fromJson(json.toString(),UserInviteMQMsg.class);
                if (mqMsg != null) {
                    threeSaleFocusInfoService.updateFansNum(mqMsg.getBossId());
                    // 重新统计粉丝等级数量
                    teamLevelDailyRecordService.addStatisticByUid(mqMsg.getBossId());
                }
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.userMoneyAdd.name())) {// 资金到账
                // TODO 更新近60天到账
                // 更新近60天到账
                JSONObject json = JSONObject.fromObject(new String(message.getBody()));
                UserMoneyChangeMQMsg mqMsg = new Gson().fromJson(json.toString(),UserMoneyChangeMQMsg.class);
                if (mqMsg != null) {
                    threeSaleFocusInfoService.updateIncome(mqMsg.getUid(), mqMsg.getChangeMoney());
                }
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.becomeValidUser.name())) {// 成为有效用户
                // TODO 有效用户标识
                // 有效用户标识
                JSONObject json = JSONObject.fromObject(new String(message.getBody()));
                BeComeValidUserMQMsg mqMsg = new Gson().fromJson(json.toString(),BeComeValidUserMQMsg.class);
                if (mqMsg != null) {
                    // 更新成为有效粉丝
                    threeSaleFocusInfoService.updateStateValid(mqMsg.getUid(), true);
                }
            }
        }
        return Action.CommitMessage;
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserVIPMessageListener.java
@@ -21,6 +21,7 @@
import com.yeshi.fanli.service.inter.user.UserActiveLogService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
import com.yeshi.fanli.service.inter.user.vip.TeamLevelDailyRecordService;
import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
import com.yeshi.fanli.util.Constant;
@@ -50,6 +51,10 @@
    @Resource
    private UserActiveLogService userActiveLogService;
    @Resource
    private TeamLevelDailyRecordService teamLevelDailyRecordService;
    @Override
    public Action consume(Message message, ConsumeContext context) {
@@ -84,6 +89,9 @@
                    if (boss != null) {
                        teamUserLevelStatisticService.initData(boss.getId());
                    }
                    // 重新统计粉丝等级数量
                    teamLevelDailyRecordService.addStatisticByUid(boss.getId());
                }
                return Action.CommitMessage;
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.threeSaleSeparate.name())) {// 邀请关系脱离
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserMsgVO.java
@@ -13,6 +13,7 @@
    private List<CommonMsgItemVO> contentItems;
    private JumpDetailV2 jumpDetail;// 跳转详情
    private String params;// 跳转参数
    private Long id;
    public JumpDetailV2 getJumpDetail() {
        return jumpDetail;
@@ -30,7 +31,8 @@
        this.params = params;
    }
    public UserMsgVO(String icon, String title, Date time, List<CommonMsgItemVO> contentItems) {
    public UserMsgVO(Long id, String icon, String title, Date time, List<CommonMsgItemVO> contentItems) {
        this.id = id;
        this.icon = icon;
        this.title = title;
        this.time = time;
@@ -79,4 +81,12 @@
    public void setType(String type) {
        this.type = type;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
}