yujian
2019-12-06 678dd30c708e7457228a7696573ada707f810269
会员审核 + 队员激活
45个文件已修改
8个文件已添加
1989 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java 220 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserActiveLogMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserInfoExtraMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserInviteSeparateMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/vip/UserVIPInfoMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/user/UserActiveNumHistoryDao.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherVIPDTO.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserActiveNumHistory.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfoExtra.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInviteSeparate.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserVIPInfo.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserInfoExtraMapper.xml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserInviteSeparateMapper.xml 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/vip/UserVIPInfoMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java 293 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/UserInviteSeparateServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserActiveLogService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoExtraService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInviteSeparateService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/TimeUtil.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/user/UserVipRateVO.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/log4j.properties 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.controller.admin;
import java.io.PrintWriter;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -13,6 +14,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.IPUtil;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
@@ -24,27 +26,34 @@
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserActiveNumHistory;
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.UserRank;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.count.UserInfoCountService;
import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
import com.yeshi.fanli.service.inter.money.extract.BindingAccountService;
import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserActiveLogService;
import com.yeshi.fanli.service.inter.user.UserInfoDeleteRecordService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserRankService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.vo.user.UserGoldCoinVO;
import com.yeshi.fanli.vo.user.UserInfoVO;
@@ -86,6 +95,13 @@
    @Resource
    private UserAccountService userAccountService;
    @Resource
    private UserActiveLogService userActiveLogService;
    @Resource
    private UserVIPInfoService userVIPInfoService;
    /**
     * 查询用户信息列表 正常用户/异常用户
@@ -1204,4 +1220,208 @@
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
    
    /**
     * 计当天活跃用户中有多少个用户是90天前才活跃过,期间从未活跃的用户数量
     * @param callback
     * @param dateType
     * @param year
     * @param startTime
     * @param endTime
     * @param out
     */
    @RequestMapping(value = "getUserActiveCharts")
    public void getUserActiveCharts(String callback, Integer dateType, String year, String startTime,
            String endTime, PrintWriter out){
        try {
            String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
            if (validateMsg != null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
                return;
            }
            if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
                startTime = null;
                endTime = null;
            }
            Date beginDate = null;
            Date endDate = null;
            if (dateType == 1) {
                beginDate = TimeUtil.parse(startTime);
                endDate = TimeUtil.parse(endTime);
            } else if (dateType == 2) {
               Calendar calendar=Calendar.getInstance();
               int currentYear = calendar.get(Calendar.YEAR);
               calendar.clear();
               calendar.set(Calendar.YEAR, currentYear);
               beginDate =calendar.getTime();
                calendar.clear();
                calendar.set(Calendar.YEAR, currentYear);
                calendar.roll(Calendar.DAY_OF_YEAR, -1);
                endDate=calendar.getTime();
            } else if (dateType == 3) {
                beginDate = TimeUtil.parse("2018-01-01");
                endDate = new Date();
            }
            Gson gson = new Gson();
            List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
            List<Object> list = new ArrayList<>();
            List<UserActiveNumHistory> listHistory = userActiveLogService.query(beginDate, endDate);
            for (String date: dateList) {
                ChartTDO chartTDO = new ChartTDO();
                chartTDO.setShowDate(date);
                int value = 0;
                if (listHistory != null) {
                    for (UserActiveNumHistory history: listHistory) {
                        if (dateType == 1) {
                            String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime());
                            if (gernalTime.equalsIgnoreCase(date)) {
                                value += history.getNum();
                                continue;
                            }
                        } else if (dateType == 2){
                            String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay());
                            if (gernalTime.equalsIgnoreCase(date)) {
                                value += history.getNum();
                                continue;
                            }
                        } else if (dateType == 3) {
                            String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay());
                            if (gernalTime.equalsIgnoreCase(date)) {
                                value += history.getNum();
                                continue;
                            }
                        }
                    }
                }
                chartTDO.setShowValue(value + "");
                list.add(value + "");
            }
            JSONObject innerList = new JSONObject();
            innerList.put("name", "数量");
            innerList.put("data", gson.toJson(list));
            JSONArray line_list = new JSONArray();
            line_list.add(innerList);
            JSONObject data = new JSONObject();
            data.put("xAxis_list", gson.toJson(dateList));
            data.put("line_list", line_list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
            e.printStackTrace();
        }
    }
    /**
     *
     * @param callback
     * @param pageIndex
     * @param pageSize
     * @param key 搜索:暂只提供uid
     * @param state 状态:
     * @param out
     */
    @RequestMapping(value = "queryVip")
    public void queryVip(String callback, Integer pageIndex, Integer pageSize, String key, Integer state, PrintWriter out) {
        try {
            List<UserVIPInfo> list = userVIPInfoService.listQuery(pageIndex, pageSize, key, state);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            long count = userVIPInfoService.countQuery(key, state);
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
            GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.serializeNulls();
            Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
            JSONObject data = new JSONObject();
            data.put("pe", pe);
            data.put("result_list", gson.toJson(list));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 超级会员升级通过
     * @param callback
     * @param id
     * @param out
     * @param request
     */
    @RequestMapping(value = "passVIP")
    public void passVIP(String callback, Long id,  PrintWriter out, HttpServletRequest request) {
        try {
            /* 检验是否登陆 */
            AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
            if (admin == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"));
                return;
            }
            userVIPInfoService.passVIPApply(id);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
            LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的升级超级会员申请!");
        } catch (UserVIPInfoException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
            return;
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            return;
        }
    }
    /**
     * 超级会员升级拒绝
     * @param callback
     * @param id
     * @param reason
     * @param out
     * @param request
     */
    @RequestMapping(value = "rejectVIP")
    public void rejectVIP(String callback, Long id, String reason, PrintWriter out,    HttpServletRequest request) {
        try {
            /* 检验是否登陆 */
            AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
            if (admin == null) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆"));
                return;
            }
            // 编码转换
            reason = URLDecoder.decode(reason, "UTF-8");
            userVIPInfoService.rejectVIPApply(id, reason);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝成功"));
            LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的升级超级会员申请不存在!");
        } catch (UserVIPInfoException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
            return;
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            return;
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/admin/utils/AdminUtils.java
@@ -60,6 +60,10 @@
            for (int i = 1; i <= 12; i++) {
                dateList.add(i + ""); // 12个月
            }
        } else if (dateType == 3) {
            for (int i = 2018; i <= 2030; i++) {
                dateList.add(i + ""); // 10年
            }
        }
        
        return dateList;                   
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java
@@ -11,7 +11,6 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.dto.money.InviteGetMoney;
@@ -141,7 +140,7 @@
        boolean hasCode = false;
        if (uid != null && uid.trim().length() > 0) {
            String inviteCode = userInfoExtraService.getUserInviteCode(Long.parseLong(uid));
            String inviteCode = userInfoExtraService.getInviteCodeByUid(Long.parseLong(uid));
            if (inviteCode != null && inviteCode.trim().length() > 0) {
                hasCode = true; // 已有邀请码
            }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java
@@ -645,13 +645,8 @@
        final UserInfo uuser = user;
        ThreadUtil.run(new Runnable() {
            public void run() {
                try {
                    // 获取邀请码:若无邀请码且存在有效的队员关系 则自动生成邀请码
                    userInfoExtraService.getUserInviteCode(uuser.getId());
                } catch (UserInfoExtraException e) {
                    e.printStackTrace();
                }
                // 获取邀请码:若无邀请码且存在有效的队员关系 则自动生成邀请码
                userInfoExtraService.getInviteCodeByUid(uuser.getId());
                LogHelper.userInfo(GsonUtil.toJsonExpose(uuser));
                uuser.setLastLoginIp(remotIP);
@@ -1706,7 +1701,7 @@
                }
                boolean hasCode = false;
                String inviteCode = userInfoExtraService.getUserInviteCode(uid);
                String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
                if (inviteCode != null && inviteCode.trim().length() > 0) {
                    hasCode = true; // 已有邀请码
                } else {
@@ -1723,8 +1718,6 @@
                resultData.put("boss", bossData);
            }
            out.print(JsonUtil.loadTrueResult(resultData));
        } catch (UserInfoExtraException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("统计失败"));
            e.printStackTrace();
@@ -1781,7 +1774,7 @@
                }
                boolean hasCode = false;
                String inviteCode = userInfoExtraService.getUserInviteCode(uid);
                String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
                if (inviteCode != null && inviteCode.trim().length() > 0) {
                    hasCode = true; // 已有邀请码
                } else {
@@ -1796,8 +1789,6 @@
                resultData.put("boss", bossData);
            }
            out.print(JsonUtil.loadTrueResult(resultData));
        } catch (UserInfoExtraException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("统计失败"));
            e.printStackTrace();
@@ -1848,7 +1839,7 @@
            resultData.put("boss", bossData);
            boolean hasCode = false;
            String inviteCode = userInfoExtraService.getUserInviteCode(uid);
            String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
            if (inviteCode != null && inviteCode.trim().length() > 0) {
                hasCode = true; // 已有邀请码
            } else {
@@ -1859,8 +1850,6 @@
            out.print(JsonUtil.loadTrueResult(resultData));
        } catch (UserInfoExtraException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("统计失败"));
            e.printStackTrace();
@@ -2036,7 +2025,7 @@
        try {
            String inviteCode = userInfoExtraService.getUserInviteCode(uid);
            String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
            JSONObject inviteData = new JSONObject();
            if (inviteCode == null || inviteCode.trim().length() == 0) {
@@ -2054,8 +2043,6 @@
            out.print(JsonUtil.loadTrueResult(data));
        } catch (UserInfoExtraException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("获取失败"));
            e.printStackTrace();
@@ -2180,8 +2167,7 @@
            data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo));
            data.put("invitCode", invitCode); // 邀请码
            if (userInfoExtra.getInviteCodeState() != null
                    && userInfoExtra.getInviteCodeState() == UserInfoExtra.INVITE_CODE_SATTE_VALID_UPDATED)
            if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip()))
                data.put("invitCodeUpdated", true);// 邀请码是否已经修改过
            else
                data.put("invitCodeUpdated", false);
@@ -2207,12 +2193,8 @@
            final UserInfo uuser = userInfo;
            ThreadUtil.run(new Runnable() {
                public void run() {
                    try {
                        // 获取邀请码:若无邀请码且存在有效的队员关系 则自动生成邀请码
                        userInfoExtraService.getUserInviteCode(uuser.getId());
                    } catch (UserInfoExtraException e) {
                        e.printStackTrace();
                    }
                    // 获取邀请码:若无邀请码且存在有效的队员关系 则自动生成邀请码
                    userInfoExtraService.getInviteCodeByUid(uuser.getId());
                    // 更新用户附加信息,老用户不存在的需要添加
                    try {
@@ -2382,7 +2364,7 @@
                    }
                    try {
                        userInfoExtraService.updateInviteCode(inviteCode, uid);
                        userInfoExtraService.updateInviteCodeVip(inviteCode, uid);
                        out.print(JsonUtil.loadTrueResult("保存成功"));
                        return;
                    } catch (UserInfoExtraException e) {
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
@@ -842,9 +842,12 @@
                }
            }
            
            String rule = configTaoLiJinService.getValueByKey("new_user_free_buy_list_rule");
            rule.replace("{链接}", configService.get("customer_service_link"));
            data.put("state", state);
            data.put("balance","新人红包:" + balance.setScale(2) + "元");
            data.put("rule", configTaoLiJinService.getValueByKey("new_user_free_buy_list_rule"));
            data.put("rule", rule);
        }
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.PrintWriter;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -16,6 +17,12 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.SMSHistory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -363,10 +370,7 @@
            return;
        }
        //
        String inviteCode = "";
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
            inviteCode = userInfoExtra.getInviteCode();
        String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
        UserVipRateVO vo = new UserVipRateVO();
        vo.setId(uid);
@@ -405,17 +409,15 @@
        if (userVIPInfo != null && userVIPInfo.getState() != null
                && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) { // VIP
            vo.setSuccessTime(TimeUtil.getGernalTime(userVIPInfo.getSuccessTime().getTime(), "yyyy.MM.dd"));
            vo.setConserveMoney(finishMoney.setScale(2));
            vo.setEarnMoney(MoneyBigDecimalUtil.add(rewardShare, rewardInvite).setScale(2));
            vo.setConserveMoney(finishMoney);
            vo.setEarnMoney(MoneyBigDecimalUtil.add(rewardShare, rewardInvite));
        } else {
            BigDecimal rate1 = new BigDecimal(5);
            BigDecimal rate2 = new BigDecimal(12);
            vo.setConserveMoney(
                    MoneyBigDecimalUtil.mul2(finishMoney, MoneyBigDecimalUtil.div(rate1, rate2)).setScale(2));
            vo.setEarnMoney(MoneyBigDecimalUtil.mul2(rewardShare, MoneyBigDecimalUtil.div(rate1, rate2)).setScale(2));
            vo.setConserveMoney(MoneyBigDecimalUtil.mul2(finishMoney, MoneyBigDecimalUtil.div(rate1, rate2)));
            vo.setEarnMoney(MoneyBigDecimalUtil.mul2(rewardShare, MoneyBigDecimalUtil.div(rate1, rate2)));
        }
        vo.setFinishMoney(finishMoney.setScale(2));
        vo.setFinishMoney(finishMoney);
        // 会员规则执行时间
        String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
@@ -445,10 +447,26 @@
        vo.setLimitMoney(new BigDecimal(userVipConfigService.getValueByKey("require_fan_money")));
        vo.setLimitgoldCoin(new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin")));
        GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
        gsonBuilder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
            @Override
            public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return new JsonPrimitive("");
                } else {
                    // 保留2位小数
                    value = value.setScale(2);
                    return new JsonPrimitive(value.toString());
                }
            }
        });
        Gson gson = gsonBuilder.create();
        if (!StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(vo)));
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(gson.toJson(vo))));
        } else {
            out.print(JsonUtil.loadTrueResult(vo));
            out.print(JsonUtil.loadTrueResult(gson.toJson(vo)));
        }
    }
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
@@ -119,14 +119,39 @@
        // 筛选时间
        if (slotTime != null) {
            SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
            try {
                endTime = sd.format(new Date());
                startTime = convertDate(slotTime, endTime);
                SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
                switch (slotTime) {
                case 1: // 最近三天
                    endTime = sd.format(new Date());
                    startTime = DateUtil.reduceDay(2, endTime);
                    break;
                case 2: // 最近七天
                    endTime = sd.format(new Date());
                    startTime = DateUtil.reduceDay(6, endTime);
                    break;
                case 3: // 最近15天 (半月)
                    endTime = sd.format(new Date());
                    startTime = DateUtil.reduceDay(14, endTime);
                    break;
                case 4: // 最近三十天 (本月)
                    dateType = 10;
                    break;
                case 5: // 最近九十天(近三月)
                    dateType = 11;
                    break;
                case 6: // 最近一百八十天(近半年)
                    dateType = 12;
                    break;
                default:
                    break;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (endTime != null && endTime.trim().length() > 0) {
            endTime += " 23:59:59";
        }
@@ -146,8 +171,13 @@
                if (postSaleMoney != null) 
                    invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString();
                
                if (dateType != null && dateType == 4)
                    dateType = 5; // 新版查询本月到账
                if (orderType != null && dateType != null && dateType == 4) {
                    if (orderType == 1) {
                        dateType = 6; // 返利订单有效
                    } else {
                        dateType = 5; // 新版查询本月到账
                    }
                }
            }
                        
            // 查询列表
@@ -181,43 +211,6 @@
        }
    }
    /**
     * 时间转换
     *
     * @param slotTime
     * @param startTime
     * @return
     * @throws Exception
     */
    private String convertDate(Integer slotTime, String endTime) throws Exception {
        String startTime = null;
        switch (slotTime) {
        case 1: // 最近三天
            startTime = DateUtil.reduceDay(2, endTime);
            break;
        case 2: // 最近七天
            startTime = DateUtil.reduceDay(6, endTime);
            break;
        case 3: // 最近15天 (半月)
            startTime = DateUtil.reduceDay(14, endTime);
            break;
        case 4: // 最近三十天 (本月)
            startTime = DateUtil.reduceDay(29, endTime);
            break;
        case 5: // 最近九十天(近三月)
            startTime = DateUtil.reduceDay(3 * 30 - 1, endTime);
            break;
        case 6: // 最近一百八十天(近半年)
            startTime = DateUtil.reduceDay(6 * 30 - 1, endTime);
            break;
        default:
            break;
        }
        return startTime;
    }
    
    /**
     * 用户订单统计
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java
@@ -264,4 +264,12 @@
     * @return
     */
    ThreeSale getByWorkerIdAndTime(@Param("workerId") Long workerId, @Param("time") long time);
    /**
     * 邀请关系脱离
     * @param bossId
     * @param workerId
     */
    void inviteSeparate(@Param("workerId") Long workerId, @Param("bossId")Long bossId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/UserInfoMapper.java
@@ -192,7 +192,7 @@
     * @param inviteCode
     * @return
     */
    UserInfo getInfoByPhoneOrInviteCode(@Param("phone") String phone, @Param("inviteCode") String inviteCode);
    UserInfo getUserInfoByInviteCode(@Param("inviteCode") String inviteCode);
    // 根据AppId与电话号码获取用户
    List<UserInfo> listByClosed(@Param("appId") String appId, @Param("phone") String phone);
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserActiveLogMapper.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.dao.mybatis.user;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
public interface UserActiveLogMapper {
@@ -19,4 +21,13 @@
    int updateByPrimaryKeySelective(UserActiveLog record);
    int updateByPrimaryKey(UserActiveLog record);
    /**
     * 统计当天活跃用户中有多少个用户是90天前才活跃过,期间从未活跃的用户数量。
     * @param date
     * @return
     */
    int countActiveNumByDate(@Param("date") String date);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserInfoExtraMapper.java
@@ -69,9 +69,9 @@
    
    
    /**
     * 根据邀请码查询
     * 根据邀请码+ vip邀请码查询
     * @param inviteCode
     * @return
     */
    UserInfoExtra selectByInviteCode(String inviteCode);
    long countByInviteCode(@Param("inviteCode")String inviteCode);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserInviteSeparateMapper.java
New file
@@ -0,0 +1,30 @@
package com.yeshi.fanli.dao.mybatis.user;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
public interface UserInviteSeparateMapper extends BaseMapper<UserInviteSeparate> {
    /**
     *   脱离不成功
     * @param uid
     */
    void updateInvalidByBossId(@Param("uid") Long uid);
    /**
     *   脱离不成功
     * @param uid
     */
    void updateStateByWorkerIdAndBossId(@Param("workerId") Long workerId, @Param("bossId") Long bossId, @Param("state") int state);
    /**
     *   脱离记录
     * @param uid
     */
    UserInviteSeparate selectByWorkerIdAndBossId(@Param("workerId") Long workerId, @Param("bossId") Long bossId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/vip/UserVIPInfoMapper.java
@@ -6,6 +6,7 @@
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.vo.user.UserSystemCouponCountVO;
public interface UserVIPInfoMapper extends BaseMapper<UserVIPInfo> {
    
@@ -24,4 +25,16 @@
     */
    List<UserVIPInfo> listByUids(@Param("uidList") List<Long> uidList);
    /**
     * 查询审核
     * @param start
     * @param count
     * @param key
     * @return
     */
    List<UserVIPInfo> listQuery(@Param("start") long start, @Param("count") int count,
            @Param("key") String key, @Param("state") Integer state);
    Long countQuery(@Param("key") String key, @Param("state") Integer state);
}
fanli/src/main/java/com/yeshi/fanli/dao/user/UserActiveNumHistoryDao.java
New file
@@ -0,0 +1,48 @@
package com.yeshi.fanli.dao.user;
import java.util.Date;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import com.yeshi.fanli.dao.MongodbBaseDao;
import com.yeshi.fanli.entity.bus.user.UserActiveNumHistory;
@Repository
public class UserActiveNumHistoryDao extends MongodbBaseDao<UserActiveNumHistory> {
    /**
     * 查询统计最大的一天
     * @return
     */
    public UserActiveNumHistory getMaxDate(){
        Query query = new Query();
        query.with(new Sort(Sort.Direction.DESC,"day")).limit(1);;
        return mongoTemplate.findOne(query, UserActiveNumHistory.class);
    }
    /**
     * 查询视图
     * @param dateType
     * @param year
     * @param startTime
     * @param endTime
     * @return
     */
    public List<UserActiveNumHistory> query(Date startTime, Date endTime){
        Query query = new Query();
         Criteria ca =new  Criteria();
         ca.andOperator(
                    Criteria.where("day").gte(startTime),
                    Criteria.where("day").lte(endTime)
            );
         query.addCriteria(ca);
        return mongoTemplate.find(query, UserActiveNumHistory.class);
    }
}
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherVIPDTO.java
New file
@@ -0,0 +1,38 @@
package com.yeshi.fanli.dto.msg;
/**
 * vip消息
 *
 * @author Administrator
 *
 */
public class MsgOtherVIPDTO {
    private String content1;
    private String content2;
    private String content3;
    public String getContent1() {
        return content1;
    }
    public void setContent1(String content1) {
        this.content1 = content1;
    }
    public String getContent2() {
        return content2;
    }
    public void setContent2(String content2) {
        this.content2 = content2;
    }
    public String getContent3() {
        return content3;
    }
    public void setContent3(String content3) {
        this.content3 = content3;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java
@@ -31,7 +31,11 @@
        exchange("金币兑换"),
        couponActivate("免单券激活"),
        firstOrderReward("队员首单奖励邀请人金币"),
        systemGive("系统赠送");
        systemGive("系统赠送"),
        passVIPApply("超级会员"),
        rejectVIPApply("超级会员"),
        teamVIPCallBoss ("温馨提醒"),
        teamSplitCallBoss ("邀请脱离");
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java
@@ -21,6 +21,7 @@
    public static int EXPIRE_NORMAL = 0;// 正常状态
    public static int EXPIRE_OUTOFDATE = 1;// 过期状态
    public static int EXPIRE_SEPARATE = 2;// 邀请关系脱离
    public static int STATE_SUCCESS = 1;// 成功
    public static int STATE_NOT_SUCCESS = 0;// 尚未成功
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserActiveNumHistory.java
New file
@@ -0,0 +1,44 @@
package com.yeshi.fanli.entity.bus.user;
import java.util.Date;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
@Document(collection = "UserActiveNumHistory")
public class UserActiveNumHistory {
    @Field("id")
    private String id;
    @Field("num")
    private int num;
    @Field("day")
    private Date day;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public int getNum() {
        return num;
    }
    public void setNum(int num) {
        this.num = num;
    }
    public Date getDay() {
        return day;
    }
    public void setDay(Date day) {
        this.day = day;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfoExtra.java
@@ -16,9 +16,6 @@
@Table("yeshi_ec_user_info_extra")
public class UserInfoExtra {
    public static int INVITE_CODE_SATTE_VALID_NO_UPDATE = 1;// 正常-未修改过
    public static int INVITE_CODE_SATTE_VALID_UPDATED = 2;// 不正常-未修改过
    @Column(name = "uie_id")
    private Long id;
@@ -49,6 +46,10 @@
    @Column(name = "uie_invite_code")
    private String inviteCode;
    // 邀请码-会员
    @Column(name = "uie_invite_code_vip")
    private String inviteCodeVip;
    // 新人抽奖次数
    @Column(name = "uie_lottery_newbies")
    private Integer lotteryNewbies;
@@ -92,10 +93,6 @@
    // 用户最近活跃时间
    @Column(name = "uie_active_time")
    private Date activeTime;
    // 邀请码状态
    @Column(name = "uie_invite_code_state")
    private Integer inviteCodeState;// 0-无效 1-未修改有效 2-修改有效
    // 创建时间
    @Column(name = "uie_create_time")
@@ -265,12 +262,12 @@
        this.activeTime = activeTime;
    }
    public Integer getInviteCodeState() {
        return inviteCodeState;
    public String getInviteCodeVip() {
        return inviteCodeVip;
    }
    public void setInviteCodeState(Integer inviteCodeState) {
        this.inviteCodeState = inviteCodeState;
    public void setInviteCodeVip(String inviteCodeVip) {
        this.inviteCodeVip = inviteCodeVip;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInviteSeparate.java
New file
@@ -0,0 +1,98 @@
package com.yeshi.fanli.entity.bus.user;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 邀请脱离记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_invite_separate")
public class UserInviteSeparate {
    public static int STATE_INIT = 0;// 初始
    public static int STATE_SUCCESS = 1;// 已脱离
    public static int STATE_INVALID = 2; // 脱离未生效
    @Column(name = "uis_id")
    private Long id;
    @Column(name = "uis_worker_id")
    private Long workerId;
    @Column(name = "uis_boss_id")
    private Long bossId;
    @Column(name = "uis_state")
    private Integer state; //
    @Column(name = "uis_end_time")
    private Date endTime;
    @Column(name = "uis_create_time")
    private Date createTime;
    @Column(name = "uis_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getWorkerId() {
        return workerId;
    }
    public void setWorkerId(Long workerId) {
        this.workerId = workerId;
    }
    public Long getBossId() {
        return bossId;
    }
    public void setBossId(Long bossId) {
        this.bossId = bossId;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserVIPInfo.java
@@ -5,6 +5,8 @@
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.user.UserInfo;
/**
 * 用户VIP
 * 
@@ -32,6 +34,10 @@
    @Column(name = "uvi_update_time")
    private Date updateTime;
    // 用户信息
    private UserInfo userInfo;
    public Long getId() {
        return id;
    }
@@ -87,4 +93,12 @@
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public UserInfo getUserInfo() {
        return userInfo;
    }
    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
}
fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java
@@ -45,6 +45,8 @@
    private static Logger jobLogger = Logger.getLogger("jobLog");
    private static Logger mqLogger = Logger.getLogger("mqLog");
    private static Logger vipInfoLogger = Logger.getLogger("vipInfoLog");
    public static void userInfo(Object obj) {
        userLogger.info(obj);
@@ -98,6 +100,10 @@
    public static void mqInfo(String extraInfo,String msgId, String topic, String tag, Object data) {
        String info = extraInfo+"\nmsgId:"+msgId + "\ntopic:" + topic + "\ntag:" + tag + "\nbody:" + data;
        mqLogger.info(info);
    }
    public static void vipInfo(Object obj) {
        vipInfoLogger.info(obj);
    }
@@ -231,4 +237,5 @@
        String content = String.format("链接:%s  参数:%s  响应时间:%s", url, paramsStr, time + "");
        requestTimeLogger.info(content);
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
@@ -161,6 +161,12 @@
        where t.state=0 and t.worker_id=#{0} AND (t.expire = 0 OR t.expire IS
        NULL)
    </update>
    <update id="inviteSeparate">
        update yeshi_ec_threeSale t set t.state = 0,t.expire = 2,t.succeedTime = null,
            t.updateTime = <![CDATA[UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) * 1000]]>
        where t.worker_id=#{workerId} AND t.boss_id = #{bossId}
    </update>
    <delete id="deleteExpireRecord" parameterType="java.lang.Long">
        DELETE FROM
@@ -467,10 +473,8 @@
    </select>
    <select id="getSuccessRelationshipNum" resultType="java.lang.Integer">
        SELECT IFNULL
        (COUNT(*),0) FROM `yeshi_ec_threesale` t
        WHERE t.`state` = 1 AND
        (t.`worker_id` =${uid} OR t.`boss_id` = ${uid})
        SELECT IFNULL(COUNT(*),0) FROM `yeshi_ec_threesale` t
        WHERE t.`state` = 1 AND    (t.`worker_id` =${uid} OR t.`boss_id` = ${uid})
    </select>
    <select id="getRelationshipByBossIdAndWorkerId" resultMap="BaseResultMap">
@@ -505,6 +509,4 @@
        WHERE t.`worker_id` = #{workerId} AND t.`state` = 1
             <![CDATA[AND t.succeedTime >= #{time}]]>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -680,15 +680,10 @@
        u.`createtime`
    </select>
    <select id="getInfoByPhoneOrInviteCode" resultMap="BaseResultMap">
        SELECT * FROM
        yeshi_ec_user u
        LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` =
        u.`id`
        WHERE
        uf.`uie_invite_code` IS NOT NULL
        AND (u.`phone` =#{phone} OR
        uf.`uie_invite_code` = #{inviteCode})
    <select id="getUserInfoByInviteCode" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_user u
        LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` =    u.`id`
        WHERE uf.`uie_invite_code_vip` = ${inviteCode} OR uf.`uie_invite_code` = ${inviteCode}
        LIMIT 1
    </select>
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -431,10 +431,10 @@
                AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22)
            </if>
            <if test="type == 2 and day == 4"> <!-- 本月月将要到账 -->
                AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v.`hb_pre_get_time`, '%Y%m')) = 1
                AND DATE_FORMAT(v.`hb_pre_get_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
            </if>
            <if test="type == 3 and day == 4"> <!-- 本月将要到账 -->
                AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v.`hb_pre_get_time`, '%Y%m')) = 1
                AND DATE_FORMAT(v.`hb_pre_get_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
            </if>
        )v2
        LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)
@@ -446,9 +446,15 @@
        <if test="day == 2"> <!-- 昨天产生-->
            AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1
        </if>
        <if test="day == 3"> <!-- 本月产生 -->
        <if test="day == 3 or day == 10"> <!-- 本月产生 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day == 11"> <!-- 近3个月产生 -->
            AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 3 MONTH) AND NOW()
        </if>
        <if test="day == 12"> <!-- 近半年产生  -->
            AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 6 MONTH) AND NOW()
        </if>
        <if test="day == 4 and type == 1"> <!-- 上月产生自购 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1
        </if>
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -386,22 +386,33 @@
        </if>
        <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]>
        </if>
        <if test="day != null and day == 1">
        <if test="day == 1">
            <!-- 今天 -->
            AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW())
        </if>
        <if test="day != null and day == 2">
        <if test="day == 2">
            <!-- 昨天 -->
            AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1
        </if>
        <if test="day != null and day == 3">
        <if test="day == 3 or day == 10">
            <!-- 本月 -->
            AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="day != null and day == 4">
        <if test="day == 4">
            <!-- 上月 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),    DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
        </if>
        <if test="day == 6">
            <!-- 上月 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),    DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1
        </if>
        <if test="day == 11"> <!-- 近3个月产生 -->
            AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 3 MONTH) AND NOW()
        </if>
        <if test="day == 12"> <!-- 近半年产生  -->
            AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 6 MONTH) AND NOW()
        </if>
    </sql>
    <sql id="SELECT_PARAM_HONGBAO_TYPE">
        <if test="type != null and type == 1"> <!-- 自购订单 -->
@@ -444,11 +455,11 @@
        FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]>
        <include refid="SELECT_PARAM_HONGBAO_TYPE" />
        
        <if test="type == 2 and day == 5"> <!-- 本月月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        <if test="type == 2 and day == 5"> <!-- 本月月将要到账分享订单 -->
            AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="type == 3 and day == 5"> <!-- 本月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        <if test="type == 3 and day == 5"> <!-- 本月将要到账邀请订单 -->
            AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        
        <!-- 红包类型 -->
@@ -477,12 +488,13 @@
        FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]>
        <include refid="SELECT_PARAM_HONGBAO_TYPE" /> <!-- 红包类型 -->
        
        <if test="type == 2 and day == 5"> <!-- 本月月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        <if test="type == 2 and day == 5"> <!-- 本月月将要到账分享订单 -->
            AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        <if test="type == 3 and day == 5"> <!-- 本月将要到账 -->
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(v2.`hb_pre_get_time`, '%Y%m')) = 1
        <if test="type == 3 and day == 5"> <!-- 本月将要到账邀请订单 -->
            AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =    DATE_FORMAT(CURDATE(),'%Y%m')
        </if>
        )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml
@@ -38,6 +38,19 @@
        from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id
        limit 1
    </select>
    <select id="countActiveNumByDate"  resultType="java.lang.Integer">
          SELECT IFNULL(COUNT(dd.`uie_uid`),0)
          FROM (SELECT t.`uie_uid`, MAX(d.`lua_createtime`) AS lastDate FROM `yeshi_ec_user_info_extra` t
            LEFT JOIN `yeshi_ec_log_user_active` d ON t.`uie_uid` = d.`lua_uid`
            WHERE TO_DAYS(t.`uie_active_time`) = TO_DAYS('${date}')
                AND TO_DAYS(d.`lua_createtime`) <![CDATA[<]]> TO_DAYS('${date}')
            GROUP BY d.`lua_uid`)dd
        WHERE dd.lastDate <![CDATA[<]]> DATE_SUB('${date}', INTERVAL 90 DAY)
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog"
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserInfoExtraMapper.xml
@@ -34,8 +34,8 @@
        <result column="uie_active_time" property="activeTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_mark" property="mark" jdbcType="VARCHAR" />
        <result column="uie_invite_code_state" property="inviteCodeState"
            jdbcType="INTEGER" />
        <result column="uie_invite_code_vip" property="inviteCodeVip"
            jdbcType="VARCHAR" />
        <association property="userInfo" column="uie_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="uie_uid" property="id" jdbcType="BIGINT" />
@@ -77,8 +77,8 @@
        <result column="uie_active_time" property="activeTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_mark" property="mark" jdbcType="VARCHAR" />
        <result column="uie_invite_code_state" property="inviteCodeState"
            jdbcType="INTEGER" />
        <result column="uie_invite_code_vip" property="inviteCodeVip"
            jdbcType="VARCHAR" />
        <association property="userInfo" column="uie_uid"
            resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
        <association property="userRank" column="uie_rank_id"
@@ -116,8 +116,8 @@
        <result column="uie_active_time" property="activeTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_mark" property="mark" jdbcType="VARCHAR" />
        <result column="uie_invite_code_state" property="inviteCodeState"
            jdbcType="INTEGER" />
        <result column="uie_invite_code_vip" property="inviteCodeVip"
            jdbcType="VARCHAR" />
        <association property="userInfo" column="uie_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="uie_uid" property="id" jdbcType="BIGINT" />
@@ -125,7 +125,7 @@
        <association property="userRank" column="uie_rank_id"
            resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap" />
    </resultMap>
    <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark,uie_invite_code_state
    <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark,uie_invite_code_vip
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
@@ -134,11 +134,9 @@
        from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByInviteCode" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_info_extra where uie_invite_code = #{0} limit 1
    <select id="countByInviteCode" resultType="Long">
        SELECT IFNULL(COUNT(uie_id),0) FROM yeshi_ec_user_info_extra
        WHERE uie_invite_code = ${inviteCode} OR uie_invite_code_vip = ${inviteCode}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
@@ -147,9 +145,9 @@
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_info_extra
        (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark,uie_invite_code_state)
        (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract,uie_close_time_extract,uie_active_time,uie_mark,uie_invite_code_vip)
        values
        (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{autoExtract,jdbcType=BOOLEAN},#{closeTimeExtract,jdbcType=TIMESTAMP},#{activeTime,jdbcType=TIMESTAMP},#{mark,jdbcType=VARCHAR},#{inviteCodeState,jdbcType=INTEGER})
        (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{autoExtract,jdbcType=BOOLEAN},#{closeTimeExtract,jdbcType=TIMESTAMP},#{activeTime,jdbcType=TIMESTAMP},#{mark,jdbcType=VARCHAR},#{inviteCodeVip,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
        useGeneratedKeys="true" keyProperty="id">
@@ -175,7 +173,7 @@
            <if test="closeTimeExtract != null">uie_close_time_extract,</if>
            <if test="activeTime != null">uie_active_time,</if>
            <if test="mark != null">uie_mark,</if>
            <if test="inviteCodeState != null">uie_invite_code_state,</if>
            <if test="inviteCodeVip != null">uie_invite_code_vip,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -199,7 +197,7 @@
            <if test="closeTimeExtract != null">#{closeTimeExtract,jdbcType=TIMESTAMP},</if>
            <if test="activeTime != null">#{activeTime,jdbcType=TIMESTAMP},</if>
            <if test="mark != null">#{mark,jdbcType=VARCHAR},</if>
            <if test="inviteCodeState != null">#{inviteCodeState,jdbcType=INTEGER}</if>
            <if test="inviteCodeVip != null">#{inviteCodeVip,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update
@@ -222,7 +220,7 @@
        #{autoExtract,jdbcType=BOOLEAN},uie_close_time_extract =
        #{closeTimeExtract,jdbcType=TIMESTAMP},uie_active_time =
        #{activeTime,jdbcType=TIMESTAMP},uie_mark = #{mark,jdbcType=VARCHAR}
        ,uie_invite_code_state =#{inviteCodeState,jdbcType=INTEGER} where
        ,uie_invite_code_vip =#{inviteCodeVip,jdbcType=VARCHAR} where
        uie_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
@@ -251,7 +249,7 @@
            </if>
            <if test="activeTime != null">uie_active_time=#{activeTime,jdbcType=TIMESTAMP},</if>
            <if test="mark != null">uie_mark=#{mark,jdbcType=VARCHAR},</if>
            <if test="inviteCodeState !=null">uie_invite_code_state=#{inviteCodeState,jdbcType=INTEGER},
            <if test="inviteCodeVip !=null">uie_invite_code_vip=#{inviteCodeVip,jdbcType=VARCHAR},
            </if>
        </set>
        where uie_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserInviteSeparateMapper.xml
New file
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserInviteSeparateMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInviteSeparate">
    <id column="uis_id" property="id" jdbcType="BIGINT"/>
    <result column="uis_worker_id" property="workerId" jdbcType="BIGINT"/>
    <result column="uis_boss_id" property="bossId" jdbcType="BIGINT"/>
    <result column="uis_state" property="state" jdbcType="INTEGER"/>
    <result column="uis_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="uis_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uis_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">uis_id,uis_worker_id,uis_boss_id,uis_state,uis_end_time,uis_create_time,uis_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_invite_separate where uis_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_invite_separate where uis_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteSeparate" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_separate (uis_id,uis_worker_id,uis_boss_id,uis_state,uis_end_time,uis_create_time,uis_update_time) values (#{id,jdbcType=BIGINT},#{workerId,jdbcType=BIGINT},#{bossId,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{endTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteSeparate" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_separate
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">uis_id,</if>
      <if test="workerId != null">uis_worker_id,</if>
      <if test="bossId != null">uis_boss_id,</if>
      <if test="state != null">uis_state,</if>
      <if test="endTime != null">uis_end_time,</if>
      <if test="createTime != null">uis_create_time,</if>
      <if test="updateTime != null">uis_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="workerId != null">#{workerId,jdbcType=BIGINT},</if>
      <if test="bossId != null">#{bossId,jdbcType=BIGINT},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteSeparate">update yeshi_ec_user_invite_separate set uis_worker_id = #{workerId,jdbcType=BIGINT},uis_boss_id = #{bossId,jdbcType=BIGINT},uis_state = #{state,jdbcType=INTEGER},uis_end_time = #{endTime,jdbcType=TIMESTAMP},uis_create_time = #{createTime,jdbcType=TIMESTAMP},uis_update_time = #{updateTime,jdbcType=TIMESTAMP} where uis_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteSeparate">update yeshi_ec_user_invite_separate
    <set>
      <if test="workerId != null">uis_worker_id=#{workerId,jdbcType=BIGINT},</if>
      <if test="bossId != null">uis_boss_id=#{bossId,jdbcType=BIGINT},</if>
      <if test="state != null">uis_state=#{state,jdbcType=INTEGER},</if>
      <if test="endTime != null">uis_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">uis_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uis_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uis_id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateInvalidByBossId" parameterType="Long">
      UPDATE yeshi_ec_user_invite_separate SET uis_state = 2
      WHERE uis_boss_id = #{uid} AND uis_state = 0 AND uis_end_time >= NOW()
  </update>
  <update id="updateStateByWorkerIdAndBossId" parameterType="Long">
      UPDATE yeshi_ec_user_invite_separate SET uis_state = #{state}
      WHERE uis_worker_id = #{workerId} AND uis_boss_id = #{uid}
  </update>
  <select id="selectByWorkerIdAndBossId" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_user_invite_separate d
    WHERE d.`uis_worker_id` = #{workerId} AND d.`uis_boss_id` =#{bossId} AND d.`uis_state` = 0
    ORDER BY d.uis_create_time DESC
    LIMIT 1
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/user/vip/UserVIPInfoMapper.xml
@@ -15,6 +15,21 @@
        <result column="uvi_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
    </resultMap>
    <resultMap id="InfoResultMap" type="com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo">
        <id column="uvi_uid" property="id" jdbcType="BIGINT" />
        <result column="uvi_state" property="state" jdbcType="INTEGER" />
        <result column="uvi_apply_time" property="applyTime" jdbcType="TIMESTAMP" />
        <result column="uvi_success_time" property="successTime"
            jdbcType="TIMESTAMP" />
        <result column="uvi_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="uvi_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="uvi_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <association property="userInfo" column="id" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/>
    </resultMap>
    <sql id="Base_Column_List">uvi_uid,uvi_state,uvi_apply_time,uvi_success_time,uvi_beizhu,uvi_create_time,uvi_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
@@ -40,10 +55,23 @@
        <foreach collection="uidList" separator=" or " item="uid">
            uvi_uid=#{uid}
        </foreach>
    </select>
    <select id="listQuery" resultMap="InfoResultMap">
          SELECT * FROM yeshi_ec_user_vip_info p
          LEFT JOIN yeshi_ec_user u ON u.id = p.uvi_uid
        WHERE p.uvi_uid like '%${key}%' AND p.uvi_state = #{state}
        ORDER BY p.uvi_update_time DESC
        LIMIT #{start},#{count}
     </select>
     <select id="countQuery" resultType="Long">
        SELECT IFNULL(COUNT(uvi_uid),0) FROM yeshi_ec_user_vip_info
        WHERE uvi_uid like '%${key}%' AND uvi_state = #{state}
     </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_vip_info where uvi_uid = #{id,jdbcType=BIGINT}
    </delete>
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -351,8 +351,8 @@
    
    
    @Override
    public BigDecimal getRewardMoneyByToSearch(Long uid, Integer dateType, Integer hbType, Integer orderState, String orderNo, Integer source, String startTime,  String endTime) {
        return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, hbType, orderState, orderNo, source,
    public BigDecimal getRewardMoneyByToSearch(Long uid, Integer dateType, Integer orderType, Integer orderState, String orderNo, Integer source, String startTime,  String endTime) {
        return hongBaoV2CountMapper.getRewardMoneyByDate(uid, dateType, orderType, orderState, orderNo, source,
                startTime, endTime);
    }
    
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java
@@ -58,6 +58,11 @@
        } else if (detail.getType() == MsgTypeOtherTypeEnum.taoLiJinExchange) {
            msgOtherDetailMapper.insertSelective(detail);
            userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
        } else if (detail.getType() == MsgTypeOtherTypeEnum.passVIPApply
                || detail.getType() == MsgTypeOtherTypeEnum.rejectVIPApply
                || detail.getType() == MsgTypeOtherTypeEnum.teamVIPCallBoss) {
            msgOtherDetailMapper.insertSelective(detail);
            userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java
@@ -15,6 +15,7 @@
import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -467,4 +468,71 @@
            e.printStackTrace();
        }
    }
    @Override
    public void passVIPApplyMsg(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
        try {
            MsgOtherDetail detail = new MsgOtherDetail();
            detail.setBeiZhu(beiZhu);
            detail.setCreateTime(new Date());
            detail.setRead(false);
            detail.setUser(new UserInfo(uid));
            detail.setContent(new Gson().toJson(dto));
            detail.setType(MsgTypeOtherTypeEnum.passVIPApply);
            msgOtherDetailService.addMsgOtherDetail(detail);
        } catch (MsgOtherDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void rejectVIPApply(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
        try {
            MsgOtherDetail detail = new MsgOtherDetail();
            detail.setBeiZhu(beiZhu);
            detail.setCreateTime(new Date());
            detail.setRead(false);
            detail.setUser(new UserInfo(uid));
            detail.setContent(new Gson().toJson(dto));
            detail.setType(MsgTypeOtherTypeEnum.rejectVIPApply);
            msgOtherDetailService.addMsgOtherDetail(detail);
        } catch (MsgOtherDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void teamVIPCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
        try {
            MsgOtherDetail detail = new MsgOtherDetail();
            detail.setBeiZhu(beiZhu);
            detail.setCreateTime(new Date());
            detail.setRead(false);
            detail.setUser(new UserInfo(uid));
            detail.setContent(new Gson().toJson(dto));
            detail.setType(MsgTypeOtherTypeEnum.teamVIPCallBoss);
            msgOtherDetailService.addMsgOtherDetail(detail);
        } catch (MsgOtherDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void teamSplitCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto) {
        try {
            MsgOtherDetail detail = new MsgOtherDetail();
            detail.setBeiZhu(beiZhu);
            detail.setCreateTime(new Date());
            detail.setRead(false);
            detail.setUser(new UserInfo(uid));
            detail.setContent(new Gson().toJson(dto));
            detail.setType(MsgTypeOtherTypeEnum.teamSplitCallBoss);
            msgOtherDetailService.addMsgOtherDetail(detail);
        } catch (MsgOtherDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java
@@ -4,8 +4,6 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
@@ -19,6 +17,7 @@
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinNewbies;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods;
@@ -37,6 +36,7 @@
import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
@@ -47,6 +47,8 @@
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.redpack.TaoLiJinWinDetailVO;
import net.sf.json.JSONObject;
@Service
public class UserTaoLiJinNewbiesServiceImpl implements UserTaoLiJinNewbiesService {
@@ -55,6 +57,9 @@
    
    @Resource
    private ConfigTaoLiJinService configTaoLiJinService;
    @Resource
    private UserInfoService userInfoService;
    
    @Resource    
    private UserInfoExtraService userInfoExtraService;
@@ -141,6 +146,10 @@
        if (uid == null || uid <= 0) 
            return null; // 未登录弹出
        
        UserInfo userInfo = userInfoService.selectByPKey(uid);
        if (userInfo == null)
            return null;
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null || userInfoExtra.getFirstLoginTime() == null) 
            return null;
@@ -220,9 +229,8 @@
        detail.setRemark("新人红包");
        userTaoLiJinDetailService.insertSelective(detail);
        
        Map<String,String> map = new HashMap<String,String>();
        map.put("url", configTaoLiJinService.getValueByKey("new_user_free_buy_list"));
        JSONObject json = new JSONObject();
        json.put("url", configTaoLiJinService.getValueByKey("new_user_free_buy_list"));
        
        TaoLiJinWinDetailVO winDetailVO = new TaoLiJinWinDetailVO();
        winDetailVO.setTitle("新人红包");
@@ -230,10 +238,10 @@
        winDetailVO.setMoney(money.toString());
        winDetailVO.setDesc("已领取:" + balance + "元");
        winDetailVO.setTips(configTaoLiJinService.getValueByKey("new_user_win_tips"));
        winDetailVO.setParams(map.toString());
        winDetailVO.setParams(json.toString());
        winDetailVO.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
        winDetailVO.setLogo(Constant.systemCommonConfig.getDefaultPortrait());
        winDetailVO.setLogoLight(Constant.systemCommonConfig.getDefaultPortrait());
        winDetailVO.setLogoLight(userInfo.getPortrait());
        return winDetailVO;
    }
    
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java
@@ -1,21 +1,30 @@
package com.yeshi.fanli.service.impl.user;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.user.UserActiveLogMapper;
import com.yeshi.fanli.dao.user.UserActiveNumHistoryDao;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.entity.bus.user.UserActiveNumHistory;
import com.yeshi.fanli.service.inter.user.UserActiveLogService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.util.TimeUtil;
@Service
public class UserActiveLogServiceImpl implements UserActiveLogService {
    @Resource
    private UserActiveLogMapper userActiveLogMapper;
    @Resource
    private UserActiveNumHistoryDao userActiveNumHistoryDao;
    
    @Resource
    private UserInfoExtraService userInfoExtraService;
@@ -57,8 +66,61 @@
    @Override
    public UserActiveLog getFirstActiveInfo(Long uid) {
        return userActiveLogMapper.selectFirstActiveInfo(uid);
    }
    @Override
    public List<UserActiveNumHistory> query(Date startTime, Date endTime){
        // 重新查询统计今日以及空缺
        initUserActiveNumCount();
        return userActiveNumHistoryDao.query(startTime, endTime);
    }
    // 初始化统计
    private void initUserActiveNumCount() {
        UserActiveNumHistory history = userActiveNumHistoryDao.getMaxDate();
        Date lastDay = null;
        if (history != null && history.getDay() != null)
            lastDay = history.getDay();
        Date today = new Date();
        try {
            if (lastDay == null)
                lastDay = TimeUtil.parse("2018-09-01");
            int betweenDays = DateUtil.daysBetween2(lastDay, today);
            // 统计今日之前的
            if (betweenDays > 0) {
                for (int i = 1; i <= betweenDays; i++ ) {
                    addUserActiveNumHistory(DateUtil.plusDay(i, history.getDay()));
                }
            }
            // 重新统计今日
            addUserActiveNumHistory(TimeUtil.getGernalTime(today.getTime()));
        } catch (Exception e) {
            //
        }
    }
    /*
     * 统计当天活跃用户中有多少个用户是90天前才活跃过,期间从未活跃的用户数量。
     */
    @Override
    public void addUserActiveNumHistory(String date){
        int num = userActiveLogMapper.countActiveNumByDate(date);
        UserActiveNumHistory history = new UserActiveNumHistory();
        history.setId(date);
        history.setNum(num);
        try {
            history.setDay(TimeUtil.parse(date));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        userActiveNumHistoryDao.save(history);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
@@ -22,7 +22,6 @@
import com.yeshi.fanli.dao.mybatis.user.UserInfoExtraMapper;
import com.yeshi.fanli.dao.mybatis.user.UserRankRecordMapper;
import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserRank;
@@ -326,30 +325,24 @@
    @Override
    public String activateInviteCode(Long uid, String inviteCode) throws UserInfoExtraException {
        if (uid == null || inviteCode == null) {
            throw new UserInfoExtraException(1, "用户id、邀请码不能为空");
        }
        if (uid == null || inviteCode == null)
            throw new UserInfoExtraException(1, "激活信息不能为空");
        // 被邀请人信息
        UserInfo invitee = userInfoService.selectByPKey(uid);
        if (invitee == null) {
        if (invitee == null)
            throw new UserInfoExtraException(1, "用户不存在");
        }
        // 额外信息
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null) {
            String inviteCodeHas = extra.getInviteCode();
            if (inviteCodeHas != null && inviteCodeHas.trim().length() > 0) {
                throw new UserInfoExtraException(1, "已存在邀请码,请刷新页面");
            }
        }
        if (extra != null && !StringUtil.isNullOrEmpty(extra.getInviteCode()))
            throw new UserInfoExtraException(1, "已经激活, 无需再次激活");
        // 邀请人信息
        UserInfo inviter = userInfoService.getInfoByPhoneOrInviteCode(inviteCode, inviteCode);
        if (inviter == null) {
        // 邀请码对应用户信息
        UserInfo inviter = userInfoService.getUserInfoByInviteCode(inviteCode);
        if (inviter == null)
            throw new UserInfoExtraException(1, "上级邀请码不存在");
        }
        // 绑定关系
        try {
            threeSaleSerivce.bindRelationshipByInviteCode(invitee, inviter);
@@ -362,47 +355,46 @@
            throw new UserInfoExtraException(1, "激活失败");
        }
        // 邀请码有效、生成邀请码
        String code = UserUtil.getInviteCode(uid);
        if (code == null || code.trim().length() == 0) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        // 生成邀请码
        String mycode = null;
        for (int i = 1; i <= 5; i ++) {
            mycode = UserUtil.getInviteCode(i, uid);
            long countCode = userInfoExtraMapper.countByInviteCode(mycode);
            if (countCode <= 0)
                break;
        }
        if (StringUtil.isNullOrEmpty(mycode))
            throw new UserInfoExtraException(1, "激活码生成失败");
        UserInfoExtra userInfoExtra = new UserInfoExtra();
        userInfoExtra.setUserInfo(invitee);
        userInfoExtra.setInviteCode(code);
        // 保存额外信息
        saveUserInfoExtra(userInfoExtra);
        Long id = userInfoExtra.getId();
        if (id == null) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        userInfoExtra.setInviteCode(mycode);
        userInfoExtra.setUpdateTime(new Date());
        if (extra != null) {
            userInfoExtra.setId(extra.getId());
            userInfoExtraMapper.updateByPrimaryKeySelective(userInfoExtra);
        } else {
            userInfoExtra.setCreateTime(new Date());
            userInfoExtraMapper.insertSelective(userInfoExtra);
        }
        return code;
        return mycode;
    }
    @Override
    public void activationInviteWX(WXAccountInfoDTO wxAccount, Long uid, String code) throws UserInfoExtraException {
        if (uid == null || code == null) {
        if (uid == null || code == null)
            throw new UserInfoExtraException(1, "激活信息不完整");
        }
        // 用户信息
        UserInfo invitee = userInfoService.selectByPKey(uid);
        if (invitee == null) {
        if (invitee == null)
            throw new UserInfoExtraException(1, "用户不存在");
        }
        // 用户额外信息
        // 额外信息
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null) {
            String inviteCodeHas = extra.getInviteCode();
            if (inviteCodeHas != null && inviteCodeHas.trim().length() > 0) {
                throw new UserInfoExtraException(1, "已经激活, 无需再次激活");
            }
        }
        if (extra != null && !StringUtil.isNullOrEmpty(extra.getInviteCode()))
            throw new UserInfoExtraException(1, "已经激活, 无需再次激活");
        // 获取微信信息
        WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
@@ -465,31 +457,14 @@
            throw new UserInfoExtraException(1, "绑定微信与激活微信不一致");
        }
        // 邀请人ID -1.5.3新版
        // 是否存在邀请人
        Long inviterId = userInviteRecordService.getNewestInviterId(wxUnionId);
        // 兼容1.5.3 之前版本
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
        if (inviterId == null && threeSale != null) {
            Long bossId = threeSale.getBoss().getId();
            UserInfoExtra inviterExtra = userInfoExtraMapper.getInfoExtraByUid(bossId);
            if (inviterExtra != null && inviterExtra.getInviteCode() == null) {
                // 更新邀请码
                UserInfoExtra inviterInfoExtra = new UserInfoExtra();
                inviterInfoExtra.setId(inviterExtra.getId());
                inviterInfoExtra.setInviteCode(UserUtil.getInviteCode(bossId));
                userInfoExtraMapper.updateByPrimaryKeySelective(inviterInfoExtra);
            }
        }
        // 没有被邀请过
        if (inviterId == null && threeSale == null) {
        if (inviterId == null)
            throw new UserInfoExtraException(1, "没有对应的邀请关系");
        }
        // 绑定关系
        try {
            threeSaleSerivce.bindRelationshipByWX(invitee, inviterId, threeSale);
            threeSaleSerivce.bindRelationshipByWX(invitee, inviterId);
        } catch (ThreeSaleException e) {
            try {
                LogHelper.errorDetailInfo(e);
@@ -499,12 +474,19 @@
            throw new UserInfoExtraException(1, "关系绑定时失败");
        }
        // 邀请码有效、生成邀请码
        String inviteCode = UserUtil.getInviteCode(uid);
        if (inviteCode == null || inviteCode.trim().length() == 0) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        // 生成邀请码
        String inviteCode = null;
        for (int i = 1; i <= 5; i ++) {
            inviteCode = UserUtil.getInviteCode(i, uid);
            long countCode = userInfoExtraMapper.countByInviteCode(inviteCode);
            if (countCode <= 0)
                break;
        }
        // 保存邀请码
        if (StringUtil.isNullOrEmpty(inviteCode))
            throw new UserInfoExtraException(1, "激活码生成失败");
        UserInfoExtra userInfoExtra = new UserInfoExtra();
        userInfoExtra.setUserInfo(invitee);
        userInfoExtra.setInviteCode(inviteCode);
@@ -597,29 +579,13 @@
        // 邀请人ID -1.5.3新版
        Long inviterId = userInviteRecordService.getNewestInviterId(wxUnionId);
        // 兼容1.5.3 之前版本
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
        if (inviterId == null && threeSale != null) {
            Long bossId = threeSale.getBoss().getId();
            UserInfoExtra inviterExtra = userInfoExtraMapper.getInfoExtraByUid(bossId);
            if (inviterExtra != null && inviterExtra.getInviteCode() == null) {
                // 更新邀请码
                UserInfoExtra inviterInfoExtra = new UserInfoExtra();
                inviterInfoExtra.setId(inviterExtra.getId());
                inviterInfoExtra.setInviteCode(UserUtil.getInviteCode(bossId));
                userInfoExtraMapper.updateByPrimaryKeySelective(inviterInfoExtra);
            }
        }
        // 没有被邀请过
        if (inviterId == null && threeSale == null) {
        if (inviterId == null) {
            throw new UserInfoExtraException(1, "没有对应的邀请关系");
        }
        // 绑定关系
        try {
            threeSaleSerivce.bindRelationshipByWX(invitee, inviterId, threeSale);
            threeSaleSerivce.bindRelationshipByWX(invitee, inviterId);
        } catch (ThreeSaleException e) {
            try {
                LogHelper.errorDetailInfo(e);
@@ -629,12 +595,19 @@
            throw new UserInfoExtraException(1, "关系绑定时失败");
        }
        // 邀请码有效、生成邀请码
        String inviteCode = UserUtil.getInviteCode(uid);
        if (inviteCode == null || inviteCode.trim().length() == 0) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        // 生成邀请码
        String inviteCode = null;
        for (int i = 1; i <= 5; i ++) {
            inviteCode = UserUtil.getInviteCode(i, uid);
            long countCode = userInfoExtraMapper.countByInviteCode(inviteCode);
            if (countCode <= 0)
                break;
        }
        // 保存邀请码
        if (StringUtil.isNullOrEmpty(inviteCode))
            throw new UserInfoExtraException(1, "激活码生成失败");
        UserInfoExtra userInfoExtra = new UserInfoExtra();
        userInfoExtra.setUserInfo(invitee);
        userInfoExtra.setInviteCode(inviteCode);
@@ -682,38 +655,54 @@
    }
    @Override
    public String getUserInviteCode(Long uid) throws UserInfoExtraException {
    public String getInviteCodeByUid(Long uid) {
        UserInfoExtra userInfoExtra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (userInfoExtra == null) {
            userInfoExtra = new UserInfoExtra();
        }
        // 邀请码
        String inviteCode = userInfoExtra.getInviteCode();
        if (inviteCode == null || inviteCode.trim().length() == 0) {
            // 判断用户
        if (userInfoExtra != null) {
            // vip邀请码优先
            if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCodeVip()))
                return userInfoExtra.getInviteCodeVip();
            if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
                return userInfoExtra.getInviteCode();
            // 是否满足生产邀请码
            int relationshipNum = threeSaleSerivce.getSuccessRelationshipNum(uid);
            if (relationshipNum > 0) {
                // 邀请码有效、生成邀请码
                inviteCode = UserUtil.getInviteCode(uid);
                if (inviteCode == null || inviteCode.trim().length() == 0) {
                    throw new UserInfoExtraException(1, "激活码生成失败");
                try {
                    String inviteCode = createInviteCode(uid);
                    if (!StringUtil.isNullOrEmpty(inviteCode)) {
                        userInfoExtra.setUserInfo(new UserInfo(uid));
                        userInfoExtra.setInviteCode(inviteCode);
                        saveUserInfoExtra(userInfoExtra);
                        return inviteCode;
                    }
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
                // 保存邀请码
                userInfoExtra.setUserInfo(new UserInfo(uid));
                userInfoExtra.setInviteCode(inviteCode);
                // 保存附加信息
                saveUserInfoExtra(userInfoExtra);
            }
        }
        return inviteCode;
        return "";
    }
    /**
     * 生产邀请码
     * @param uid
     * @return
     */
    private String createInviteCode(Long uid) {
        String inviteCode = null;
        for (int i = 1; i <= 5; i ++) {
            inviteCode = UserUtil.getInviteCode(i, uid);
            long countCode = userInfoExtraMapper.countByInviteCode(inviteCode);
            if (countCode <= 0)
                break;
        }
        return inviteCode;
    }
    @Override
    public long countByRankId(Long rankId) {
        return userInfoExtraMapper.countByRankId(rankId);
@@ -755,14 +744,13 @@
    @Override
    public UserInfo getUserByInviteCode(String inviteCode) throws UserInfoExtraException {
        if (StringUtil.isNullOrEmpty(inviteCode)) {
        if (StringUtil.isNullOrEmpty(inviteCode))
            throw new UserInfoExtraException(1, "邀请码不能为空");
        }
        // 邀请人信息
        UserInfo inviter = userInfoService.getInfoByPhoneOrInviteCode(inviteCode, inviteCode);
        if (inviter == null) {
        UserInfo inviter = userInfoService.getUserInfoByInviteCode(inviteCode);
        if (inviter == null)
            throw new UserInfoExtraException(1, "上级邀请码不存在");
        }
        return inviter;
    }
@@ -818,40 +806,31 @@
    @Transactional
    @Override
    public void updateInviteCode(String inviteCode, Long uid) throws UserInfoExtraException {
        if (inviteCode.length() >= 6 && inviteCode.length() <= 12) {
            UserInfoExtra extra = getUserInfoExtra(uid);
            if (extra == null) {
                throw new UserInfoExtraException(2, "用户信息不存在");
            }
    public void updateInviteCodeVip(String inviteCodeVip, Long uid) throws UserInfoExtraException {
        if (inviteCodeVip == null || inviteCodeVip.length() < 4 || inviteCodeVip.length() > 12)
            throw new UserInfoExtraException(1, "邀请码必须为4到12位");
        UserInfoExtra extra = getUserInfoExtra(uid);
        if (extra == null)
            throw new UserInfoExtraException(2, "用户信息不存在");
            if (StringUtil.isNullOrEmpty(extra.getInviteCode())) {
                throw new UserInfoExtraException(3, "邀请码尚未激活");
            }
            if (extra.getInviteCodeState() == null
                    || extra.getInviteCodeState() != UserInfoExtra.INVITE_CODE_SATTE_VALID_NO_UPDATE) {
                throw new UserInfoExtraException(4, "只能修改一次");
            }
            if (inviteCode.equalsIgnoreCase(extra.getInviteCode())) {
                throw new UserInfoExtraException(5, "不能为原邀请码");
            }
            UserInfoExtra update = new UserInfoExtra();
            update.setId(extra.getId());
            extra = userInfoExtraMapper.selectByInviteCode(inviteCode);
            if (extra != null) {
                throw new UserInfoExtraException(6, "邀请码已存在");
            }
            update.setInviteCode(inviteCode);
            update.setInviteCodeState(UserInfoExtra.INVITE_CODE_SATTE_VALID_UPDATED);
            update.setUpdateTime(new Date());
            userInfoExtraMapper.updateByPrimaryKeySelective(update);
        } else {
            throw new UserInfoExtraException(1, "邀请码必须为6到12位");
        }
        if (StringUtil.isNullOrEmpty(extra.getInviteCode()))
            throw new UserInfoExtraException(3, "邀请码尚未激活");
        if (!StringUtil.isNullOrEmpty(extra.getInviteCodeVip()))
            throw new UserInfoExtraException(4, "只能修改一次");
        if (inviteCodeVip.equalsIgnoreCase(extra.getInviteCode()))
            throw new UserInfoExtraException(5, "不能为原邀请码");
        long count = userInfoExtraMapper.countByInviteCode(inviteCodeVip);
        if (count > 0)
            throw new UserInfoExtraException(6, "邀请码已存在");
        UserInfoExtra update = new UserInfoExtra();
        update.setId(extra.getId());
        update.setInviteCodeVip(inviteCodeVip);
        update.setUpdateTime(new Date());
        userInfoExtraMapper.updateByPrimaryKeySelective(update);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
@@ -515,8 +515,8 @@
     * @return
     */
    @Override
    public UserInfo getInfoByPhoneOrInviteCode(String phone, String inviteCode) {
        return userInfoMapper.getInfoByPhoneOrInviteCode(phone, inviteCode);
    public UserInfo getUserInfoByInviteCode(String inviteCode) {
        return userInfoMapper.getUserInfoByInviteCode(inviteCode);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java
@@ -18,7 +18,6 @@
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.Producer;
import com.google.gson.Gson;
import com.yeshi.fanli.dao.mybatis.integral.IntegralTaskRecordMapper;
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
import com.yeshi.fanli.dto.mq.user.body.IntegralTaskMQMsg;
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -15,7 +15,6 @@
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.Producer;
import com.google.gson.Gson;
import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper;
import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
@@ -503,98 +502,45 @@
    @Override
    @Transactional
    public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter) throws ThreeSaleException {
        if (invitee == null || inviter == null)
            throw new ThreeSaleException(1, "用户信息为空");
        // 获取有效的邀请关系
        ThreeSale threeSale = threeSaleMapper.getRelationshipByBossIdAndWorkerId(inviter.getId(), invitee.getId());
        if (threeSale != null) {
            // 有效关系--生效
            threeSale.setBoss(inviter);
            threeSale.setWorker(invitee);
            threeSale.setState(true);
            threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
            threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
            threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
            threeSaleMapper.updateByPrimaryKeySelective(threeSale);
        } else {
            // 新建立确定关系
            threeSale = new ThreeSale();
            threeSale.setBoss(inviter);
            threeSale.setWorker(invitee);
            threeSale.setState(true);
            threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
            threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
            threeSale.setCreateTime(java.lang.System.currentTimeMillis());
            threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
            threeSaleMapper.insertSelective(threeSale);
        }
        List<ThreeSale> listExpire = threeSaleMapper.getExpireRecord(inviter.getId(), invitee.getId());
        if (listExpire != null && listExpire.size() > 0) {
            // 删除历史通知
            for (ThreeSale saleExpire : listExpire) {
                msgInviteDetailService.deleteByThreeSale(saleExpire);
            }
            // 删除已失效关系
            threeSaleMapper.deleteExpireRecord(inviter.getId(), invitee.getId());
        }
        // 新建立确定关系
        ThreeSale threeSale = new ThreeSale();
        threeSale.setBoss(inviter);
        threeSale.setWorker(invitee);
        threeSale.setState(true);
        threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
        threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
        threeSale.setCreateTime(java.lang.System.currentTimeMillis());
        threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
        threeSaleMapper.insertSelective(threeSale);
        inviteSuccess(inviter.getId(), invitee.getId(), threeSale);
    }
    @Override
    @Transactional
    public void bindRelationshipByWX(UserInfo invitee, Long inviterId, ThreeSale threeSaleOld)
            throws ThreeSaleException {
        if (invitee == null || (inviterId == null && threeSaleOld == null))
    public void bindRelationshipByWX(UserInfo invitee, Long inviterId)throws ThreeSaleException {
        if (invitee == null || inviterId == null)
            throw new ThreeSaleException(1, "用户信息为空");
        ThreeSale threeSale = null;
        if (inviterId != null) {
            // 新建立确定关系
            threeSale = new ThreeSale();
            threeSale.setBoss(new UserInfo(inviterId));
            threeSale.setWorker(invitee);
            threeSale.setState(true);
            threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
            threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
            threeSale.setCreateTime(java.lang.System.currentTimeMillis());
            threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
            threeSaleMapper.insertSelective(threeSale);
            // 邀请关系失效 1.5.3 之前失效
            if (threeSaleOld != null) {
                ThreeSale three = new ThreeSale();
                three.setId(threeSaleOld.getId());
                three.setExpire(ThreeSale.EXPIRE_OUTOFDATE);
                three.setUpdateTime(java.lang.System.currentTimeMillis());
                threeSaleMapper.updateByPrimaryKeySelective(three);
            }
        } else if (threeSaleOld != null && inviterId == null) {
            // 1.5.3 之前生效
            threeSaleOld.setState(true);
            threeSaleOld.setExpire(ThreeSale.EXPIRE_NORMAL);
            threeSaleOld.setSucceedTime(java.lang.System.currentTimeMillis());
            threeSaleOld.setUpdateTime(java.lang.System.currentTimeMillis());
            threeSaleMapper.updateByPrimaryKeySelective(threeSaleOld);
            threeSale = threeSaleOld;
        }
        if (threeSale == null) {
            throw new ThreeSaleException(1, "关系绑定失败");
        }
        ThreeSale threeSale = new ThreeSale();
        threeSale.setBoss(new UserInfo(inviterId));
        threeSale.setWorker(invitee);
        threeSale.setState(true);
        threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
        threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
        threeSale.setCreateTime(java.lang.System.currentTimeMillis());
        threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
        threeSaleMapper.insertSelective(threeSale);
        UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
        threeSale.setBoss(boss);
        threeSale.setWorker(invitee);
        // 邀请成功:消息、相关处理
        inviteSuccess(boss.getId(), invitee.getId(), threeSale);
    }
    /**
@@ -669,4 +615,10 @@
    public ThreeSale getByWorkerIdAndTime(Long workerId, long time) {
        return threeSaleMapper.getByWorkerIdAndTime(workerId, time);
    }
    @Override
    public void inviteSeparate(Long workerId, Long bossId) {
        threeSaleMapper.inviteSeparate(workerId, bossId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/UserInviteSeparateServiceImpl.java
New file
@@ -0,0 +1,39 @@
package com.yeshi.fanli.service.impl.user.invite;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.user.UserInviteSeparateMapper;
import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
@Service
public class UserInviteSeparateServiceImpl implements UserInviteSeparateService {
    @Resource
    private UserInviteSeparateMapper userInviteSeparateMapper;
    @Override
    public void insertSelective(UserInviteSeparate record) {
        userInviteSeparateMapper.insertSelective(record);
    }
    @Override
    public void updateInvalidByBossId(Long uid) {
        userInviteSeparateMapper.updateInvalidByBossId(uid);
    }
    @Override
    public void updateStateByWorkerIdAndBossId(Long workerId, Long bossId, int state) {
        userInviteSeparateMapper.updateStateByWorkerIdAndBossId(workerId, bossId, state);
    }
    @Override
    public UserInviteSeparate selectByWorkerIdAndBossId(Long workerId, Long bossId) {
        return userInviteSeparateMapper.selectByWorkerIdAndBossId(workerId, bossId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -13,24 +13,38 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.entity.shop.BanLiShopOrder;
import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserInviteSeparateService;
import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
import com.yeshi.fanli.util.TimeUtil;
@Service
public class UserVIPInfoServiceImpl implements UserVIPInfoService {
    @Resource
    private UserVIPInfoMapper userVIPInfoMapper;
    @Resource
    private UserInfoService userInfoService;
    
    @Resource
    private UserInfoExtraService userInfoExtraService;
@@ -46,6 +60,19 @@
    
    @Resource
    private BanLiShopOrderService banLiShopOrderService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserInviteSeparateService userInviteSeparateService;
    @Resource
    private ConfigService configService;
    
    @Override
@@ -66,20 +93,66 @@
    @Transactional
    @Override
    public void passVIPApply(Long uid) throws UserVIPInfoException {
        UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
        if (userInfo == null) {
        UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
        if (userVIPInfo == null) {
            throw new UserVIPInfoException(1, "用户信息不存在");
        }
        if (userInfo.getState() != UserVIPInfo.STATE_VERIFING) {
        if (userVIPInfo.getState() != UserVIPInfo.STATE_VERIFING) {
            throw new UserVIPInfoException(2, "申请未处于审核状态");
        }
        if (!verifyConform(uid))
            throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
        UserVIPInfo info = new UserVIPInfo();
        info.setId(userInfo.getId());
        info.setId(userVIPInfo.getId());
        info.setSuccessTime(new Date());
        info.setState(UserVIPInfo.STATE_SUCCESS);
        info.setUpdateTime(new Date());
        userVIPInfoMapper.updateByPrimaryKeySelective(info);
        // 下级的超级会员 不脱离
        userInviteSeparateService.updateInvalidByBossId(uid);
        // 消息
        MsgOtherVIPDTO msgOther = new MsgOtherVIPDTO();
        msgOther.setContent1("恭喜你,已成为超级会员");
        msgOther.setContent2("满足升级条件");
        msgOther.setContent3(TimeUtil.formatDateDot(new Date()));
        userOtherMsgNotificationService.passVIPApplyMsg(uid, "如有疑问请联系我的-人工客服", msgOther);
        // 是否存在上级
        ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
        if (threeSale == null)
            return;
        // 上级是否为会员
        Long bossId = threeSale.getBoss().getId();
        UserVIPInfo bossVIP = userVIPInfoMapper.selectByPrimaryKeyForUpdate(bossId);
        if (bossVIP != null && bossVIP.getState() != null && bossVIP.getState() == UserVIPInfo.STATE_SUCCESS)
            return;
        // 之前插入记录失效
        userInviteSeparateService.updateStateByWorkerIdAndBossId(uid, bossId, UserInviteSeparate.STATE_INVALID);
        // 限制时间
        int limitDays = Integer.parseInt(configService.get("invite_separate_limit_days"));
        UserInviteSeparate inviteSeparate = new UserInviteSeparate();
        inviteSeparate.setBossId(bossId);
        inviteSeparate.setWorkerId(uid);
        inviteSeparate.setState(UserInviteSeparate.STATE_INIT);
        inviteSeparate.setEndTime(DateUtil.plusDayDate(limitDays, new Date()));
        inviteSeparate.setCreateTime(new Date());
        inviteSeparate.setUpdateTime(new Date());
        userInviteSeparateService.insertSelective(inviteSeparate);
        UserInfo userInfo = userInfoService.selectByPKey(uid);
        // 消息
        MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
        msgboss.setContent1(userInfo.getNickName() +" "+ uid);
        msgboss.setContent2("于" + TimeUtil.formatDateDot(new Date()) + "成功升级成为超级会员");
        msgboss.setContent3("今日起"+limitDays+"天内,你未能成为超级会员将会与其以及其直接粉丝脱离邀请关系 ");
        userOtherMsgNotificationService.teamVIPCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
    }
    @Transactional
@@ -98,6 +171,12 @@
        info.setState(UserVIPInfo.STATE_INVALID);
        info.setUpdateTime(new Date());
        userVIPInfoMapper.updateByPrimaryKeySelective(info);
        // 消息
        MsgOtherVIPDTO msgOther = new MsgOtherVIPDTO();
        msgOther.setContent1("很抱歉,未通过超级会员申请");
        msgOther.setContent2("未满足超级会员升级条件或疑似出现违规 ");
        userOtherMsgNotificationService.rejectVIPApply(uid, "如有疑问请联系我的-人工客服", msgOther);
    }
    @Transactional
@@ -212,4 +291,68 @@
        // 符合条件
        return true;
    }
    @Override
    public List<UserVIPInfo> listQuery(int page, int count, String key, Integer state){
        return userVIPInfoMapper.listQuery((page-1) * count, count, key, state);
    }
    @Override
    public long countQuery(String key, Integer state){
        return userVIPInfoMapper.countQuery(key, state);
    }
    @Override
    public void InviteSeparate(Long workerId, Long bossId) {
        if (workerId == null || bossId == null)
            return;
        // 查询记录
        UserInviteSeparate userInviteSeparate = userInviteSeparateService.selectByWorkerIdAndBossId(workerId, bossId);
        if (userInviteSeparate == null)
            return;
        // 是否存在邀请关系
        ThreeSale threeSale = threeSaleSerivce.getMyBoss(workerId);
        if (threeSale == null)
            return;
        Long bossIdExist = threeSale.getBoss().getId();
        if (bossIdExist == null || bossId.longValue() != bossIdExist.longValue())
            return;
        // 上级会员情况
        boolean separate = false;
        UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKey(bossId);
        if (userVIPInfo != null && userVIPInfo.getState() != null && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) {
            if (userInviteSeparate.getEndTime().getTime() < userVIPInfo.getSuccessTime().getTime()) {
                separate = true; // 结束时间已经超过
            }
        } else {
            separate = true; // 上级非会员
        }
        if (!separate) {
            // 未脱离
            userInviteSeparateService.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_INVALID);
        } else {
            // 脱离关系
            userInviteSeparateService.updateStateByWorkerIdAndBossId(workerId, bossId, UserInviteSeparate.STATE_SUCCESS);
            // 脱离邀请关系
            threeSaleSerivce.inviteSeparate(workerId, bossId);
            int limitDays = Integer.parseInt(configService.get("invite_separate_limit_days"));
            // 消息
            UserInfo userInfo = userInfoService.selectByPKey(workerId);
            MsgOtherVIPDTO msgboss = new MsgOtherVIPDTO();
            msgboss.setContent1(userInfo.getNickName() + workerId + "于" +TimeUtil.formatDateDot(userInviteSeparate.getCreateTime())+"成功升级成为超级会员 ");
            msgboss.setContent2("很遗憾,你未能在"+limitDays+"天升级为超级会员 ");
            msgboss.setContent3(" 已与其以及其直接粉丝脱离了邀请关系  ");
            userOtherMsgNotificationService.teamSplitCallBoss(bossId, "如有疑问请联系我的-人工客服", msgboss);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java
@@ -8,6 +8,7 @@
import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
@@ -268,4 +269,36 @@
     */
    public void taoLiJinExchangeMsg(Long uid, String beiZhu, MsgOtherRewardIntegralDTO msgOther);
    /**
     * 会员申请通过消息
     * @param uid
     * @param beiZhu
     * @param dto
     */
    public void passVIPApplyMsg(Long uid, String beiZhu, MsgOtherVIPDTO dto);
    /**
     * 会员升级未通过
     * @param uid
     * @param beiZhu
     * @param dto
     */
    public void rejectVIPApply(Long uid, String beiZhu, MsgOtherVIPDTO dto);
    /**
     * 温馨提醒
     * @param uid
     * @param beiZhu
     * @param dto
     */
    public void teamVIPCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto);
    /**
     * 邀请脱离
     * @param uid
     * @param beiZhu
     * @param dto
     */
    public void teamSplitCallBoss(Long uid, String beiZhu, MsgOtherVIPDTO dto);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserActiveLogService.java
@@ -1,6 +1,10 @@
package com.yeshi.fanli.service.inter.user;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.entity.bus.user.UserActiveNumHistory;
/**
 * 用户活跃日志服务
@@ -32,4 +36,15 @@
     */
    public UserActiveLog getFirstActiveInfo(Long uid);
    /**
     *
     * @param dateType
     * @param year
     * @param startTime
     * @param endTime
     * @return
     */
    public List<UserActiveNumHistory> query(Date startTime, Date endTime);
    public void addUserActiveNumHistory(String date);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoExtraService.java
@@ -75,7 +75,7 @@
     * @return
     * @throws UserInfoExtraException
     */
    public String getUserInviteCode(Long uid) throws UserInfoExtraException;
    public String getInviteCodeByUid(Long uid);
    /**
     * 获取用户额外信息全部衍生信息
@@ -197,6 +197,7 @@
     * @param uid
     * @throws UserInfoExtraException
     */
    public void updateInviteCode(String inviteCode, Long uid) throws UserInfoExtraException;
    public void updateInviteCodeVip(String inviteCode, Long uid) throws UserInfoExtraException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java
@@ -122,13 +122,12 @@
    public List<Long> longTimeNoLogin(int daysNum, List<Long> list);
    /**
     * 根据电话号码、邀请码获取邀请用户
     * 根据邀请码获取邀请用户
     * 
     * @param phone
     * @param inviteCode
     * @return
     */
    public UserInfo getInfoByPhoneOrInviteCode(String phone, String inviteCode);
    public UserInfo getUserInfoByInviteCode(String inviteCode);
    /**
     * 根据电话号码 获取有效用户
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInviteSeparateService.java
New file
@@ -0,0 +1,28 @@
package com.yeshi.fanli.service.inter.user;
import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
public interface UserInviteSeparateService {
    /**
     *  队员脱离失效
     * @param uid
     */
    public void updateInvalidByBossId(Long uid);
    public void insertSelective(UserInviteSeparate record);
    public UserInviteSeparate selectByWorkerIdAndBossId(Long workerId, Long bossId);
    /**
     * 脱离关系未成功
     * @param workerId
     * @param bossId
     */
    public void updateStateByWorkerIdAndBossId(Long workerId, Long bossId, int state);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java
@@ -244,7 +244,7 @@
     * @param threeSaleOld
     * @throws ThreeSaleException
     */
    public void bindRelationshipByWX(UserInfo invitee, Long inviterId, ThreeSale threeSaleOld) throws ThreeSaleException;
    public void bindRelationshipByWX(UserInfo invitee, Long inviterId) throws ThreeSaleException;
    
    /**
    * 根据下级查找对象
@@ -299,4 +299,11 @@
     */
    public ThreeSale getByWorkerIdAndTime(Long workerId, long time);
    /**
     * 邀请关系脱离
     * @param workerId
     * @param bossId
     */
    public void inviteSeparate(Long workerId, Long bossId);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java
@@ -76,4 +76,22 @@
     */
    public boolean verifyConform(Long uid);
    /**
     * 待审核列表
     * @param page
     * @param count
     * @param key
     * @return
     */
    public List<UserVIPInfo> listQuery(int page, int count, String key, Integer state);
    public long countQuery(String key, Integer state);
    /**
     * 超级会员与上级关系脱离
     * @param workerId
     * @param bossId
     */
    public void InviteSeparate(Long workerId, Long bossId);
}
fanli/src/main/java/com/yeshi/fanli/util/TimeUtil.java
@@ -109,6 +109,12 @@
        return date;
    }
    public static String formatDateDot(Date time) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
        String date = sdf.format(time);
        return date;
    }
    public static long convertToTimeTemp(String st, String format) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat(format);
@@ -210,6 +216,18 @@
        return format;
    }
    public static String getMonthOnlyMM(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("MM");
        String format = sdf.format(date);
        return format;
    }
    public static String getYearOnlyYYYY(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
        String format = sdf.format(date);
        return format;
    }
    public static int getDayOfMonth() {
        Calendar aCalendar = Calendar.getInstance(Locale.CHINA);
        int day = aCalendar.getActualMaximum(Calendar.DATE);
fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java
@@ -75,9 +75,9 @@
                        + "/client/threeShareNew?uid=" + uid + "&_=" + java.lang.System.currentTimeMillis());
    }
    public static String getInviteCode(Long uid) {
    public static String getInviteCode(int base, Long uid) {
        long num = 1000000000L + uid;
        long num = base * 1000000000L + uid ;
        return convert10To36(num);
    }
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -14,6 +14,7 @@
import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
import com.yeshi.fanli.dto.msg.MsgOtherSystemGiveDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
import com.yeshi.fanli.dto.msg.MsgRedPackExchangeContentDTO;
import com.yeshi.fanli.dto.msg.MsgRedPackGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgRedPackTeamRewardContentDTO;
@@ -1532,6 +1533,108 @@
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
            userMsgVO.setContentItems(items);
            return userMsgVO;
        } else if (msg.getType() == MsgTypeOtherTypeEnum.passVIPApply
                || msg.getType() == MsgTypeOtherTypeEnum.rejectVIPApply) {
            if (StringUtil.isNullOrEmpty(msg.getContent()))
                return null;
            MsgOtherVIPDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherVIPDTO.class);
            if (dto == null)
                return null;
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent1(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("审核状态", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent2(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("原        因", COLOR_TITLE), contentList));
            if (!StringUtil.isNullOrEmpty(dto.getContent3())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getContent3() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("升级时间", COLOR_TITLE), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon("http://img.flqapp.com/resource/msg/icon_msg_other_system_give.png");
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
            userMsgVO.setContentItems(items);
            return userMsgVO;
        } else if (msg.getType() == MsgTypeOtherTypeEnum.teamVIPCallBoss) {
            if (StringUtil.isNullOrEmpty(msg.getContent()))
                return null;
            MsgOtherVIPDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherVIPDTO.class);
            if (dto == null)
                return null;
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent1(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("直接粉丝", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent2(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("会员状态", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent3() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("特别提醒", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon("http://img.flqapp.com/resource/msg/icon_msg_other_system_give.png");
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
            userMsgVO.setContentItems(items);
            return userMsgVO;
        } else if (msg.getType() == MsgTypeOtherTypeEnum.teamSplitCallBoss) {
            if (StringUtil.isNullOrEmpty(msg.getContent()))
                return null;
            MsgOtherVIPDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherVIPDTO.class);
            if (dto == null)
                return null;
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent1(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("直接粉丝", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent2(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("脱离原因", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getContent3() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请关系", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备        注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon("http://img.flqapp.com/resource/msg/icon_msg_other_system_give.png");
            userMsgVO.setTitle(msg.getType().getDesc());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
            userMsgVO.setContentItems(items);
            return userMsgVO;
        }
        return new UserMsgVO(icon, msg.getType().getDesc(),
fanli/src/main/java/com/yeshi/fanli/vo/user/UserVipRateVO.java
@@ -3,6 +3,7 @@
import java.io.Serializable;
import java.math.BigDecimal;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
public class UserVipRateVO implements Serializable {
@@ -12,29 +13,43 @@
    private static final long serialVersionUID = 1L;
    // 用户信息
    @Expose
    private Long id;
    @Expose
    private String nickName;
    @Expose
    private String portrait;
    @Expose
    private String successTime;
    @Expose
    private BigDecimal earnMoney;
    @Expose
    private BigDecimal conserveMoney;
    @Expose
    private String helpLink;
    @Expose
    private String csdLink;
    @Expose
    private String inviteCode;
    @Expose
    private long finishTeam;
    @Expose
    private long finishHongBao;
    @Expose
    private BigDecimal finishGoldCoin;
    @Expose
    private BigDecimal finishMoney;
    @Expose
    private BigDecimal limitMoney;
    @Expose
    private BigDecimal limitgoldCoin;
    @Expose
    private long limitTeam;
    @Expose
    private long limitHongBao;
    @Expose
    private UserVIPInfo vipInfo;//vip信息
    @Expose
    private String leftTime;//剩余审核时间
fanli/src/main/resource/log4j.properties
@@ -226,7 +226,13 @@
log4j.appender.mqLog.layout=org.apache.log4j.PatternLayout
log4j.appender.mqLog.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n
log4j.logger.vipInfoLog=info,vipInfoLog
log4j.appender.vipInfoLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.vipInfoLog.File=logs/vipInfoLog.log
log4j.appender.vipInfoLog.MaxFileSize=20MB
log4j.appender.vipInfoLog.MaxBackupIndex=100
log4j.appender.vipInfoLog.layout=org.apache.log4j.PatternLayout
log4j.appender.vipInfoLog.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n
log4j.appender.mongodb=org.apache.log4j.ConsoleAppender
log4j.appender.mongodb.Target=System.out
@@ -236,3 +242,7 @@
log4j.appender.mongodb.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %X{RequestId} - %m%n
log4j.logger.org.springframework.data.mongodb.core= DEBUG