2.1
yujian
2020-03-17 d0f12da013131cd291cec6e81a12d661c02c4bf4
2.1
11个文件已修改
2个文件已添加
624 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/common/CategoryInfoDTO.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgAccountVipDTO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgAccountDetail.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/order/CommonOrderGoods.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/msg/MsgAccountDetailServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java 95 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/msg/MsgAccountDetailService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/CommonGoodsFactory.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserVIPMessageListener.java 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/OrderAdminController.java
@@ -20,12 +20,16 @@
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.controller.admin.utils.AdminUtils;
import com.yeshi.fanli.dto.ChartTDO;
import com.yeshi.fanli.dto.common.CategoryInfoDTO;
import com.yeshi.fanli.dto.common.GoodsOtherInfoDTO;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.money.UserMoneyDebt;
import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.order.CommonOrderGoods;
import com.yeshi.fanli.entity.order.HongBaoOrder;
import com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
@@ -35,6 +39,7 @@
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.count.TaoBaoOrderCountService;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
@@ -104,6 +109,9 @@
    @Resource
    private UserOrderWeiQuanRecordService userOrderWeiQuanRecordService;
    @Resource
    private CommonGoodsService commonGoodsService;
    /**
     * 统计历史订单-淘宝订单
@@ -219,8 +227,27 @@
            long count = commonOrderService.countQuery(keyType, key, state, type, orderState, startTime, endTime,
                    sourceType, listShopId, listGoodsId, minTime, money, payment);
            // 查询是否维权
            for (CommonOrderVO order : list) {
                CommonOrderGoods goods = order.getCommonOrderGoods();
                if (goods != null) {
                    CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(Long.parseLong(goods.getGoodsId()),
                            goods.getGoodsType());
                    if (commonGoods != null) {
                        String categoryInfo = commonGoods.getCategoryInfo();
                        if (!StringUtil.isNullOrEmpty(categoryInfo)) {
                            JSONObject json = JSONObject.fromObject(categoryInfo);
                            CategoryInfoDTO otherDTO = (CategoryInfoDTO) JSONObject.toBean(json, CategoryInfoDTO.class);
                            if (otherDTO != null) {
                                goods.setCategory1(otherDTO.getCid1Name());
                                goods.setCategory2(otherDTO.getCid2Name());
                                goods.setCategory3(otherDTO.getCid3Name());
                            }
                        }
                    }
                }
                if (order.getUserId() == null)
                    continue;
fanli/src/main/java/com/yeshi/fanli/dto/common/CategoryInfoDTO.java
New file
@@ -0,0 +1,62 @@
package com.yeshi.fanli.dto.common;
public class CategoryInfoDTO {
    // 一级类目ID
    private Long cid1;
    private String cid1Name;
    // 二级类目ID
    private Long cid2;
    private String cid2Name;
    // 三级类目ID
    private Long cid3;
    private String cid3Name;
    public Long getCid1() {
        return cid1;
    }
    public void setCid1(Long cid1) {
        this.cid1 = cid1;
    }
    public String getCid1Name() {
        return cid1Name;
    }
    public void setCid1Name(String cid1Name) {
        this.cid1Name = cid1Name;
    }
    public Long getCid2() {
        return cid2;
    }
    public void setCid2(Long cid2) {
        this.cid2 = cid2;
    }
    public String getCid2Name() {
        return cid2Name;
    }
    public void setCid2Name(String cid2Name) {
        this.cid2Name = cid2Name;
    }
    public Long getCid3() {
        return cid3;
    }
    public void setCid3(Long cid3) {
        this.cid3 = cid3;
    }
    public String getCid3Name() {
        return cid3Name;
    }
    public void setCid3Name(String cid3Name) {
        this.cid3Name = cid3Name;
    }
}
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgAccountVipDTO.java
New file
@@ -0,0 +1,29 @@
package com.yeshi.fanli.dto.msg;
/**
 * vip消息
 *
 * @author Administrator
 *
 */
public class MsgAccountVipDTO {
    private String status; // 状态
    private String equity; // 权益
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getEquity() {
        return equity;
    }
    public void setEquity(String equity) {
        this.equity = equity;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgAccountDetail.java
@@ -22,7 +22,9 @@
        update("账号修改"),
        level("账号等级"),
        connect("账号合并"),
        taoBaoAuthFail("账号绑定");
        taoBaoAuthFail("账号绑定"),
        vipApply("账户升级"),
        vipPgrade("账户升级");
        private final String desc;
        private MsgTypeAccountTypeEnum(String desc) {
fanli/src/main/java/com/yeshi/fanli/entity/order/CommonOrderGoods.java
@@ -86,6 +86,11 @@
    @Column(name = "cog_update_time")
    private Date updateTime;
    // 分类
    private String category1;
    private String category2;
    private String category3;
    public CommonOrderGoods() {
    }
@@ -198,4 +203,28 @@
        this.actualPrice = actualPrice;
    }
    public String getCategory1() {
        return category1;
    }
    public void setCategory1(String category1) {
        this.category1 = category1;
    }
    public String getCategory2() {
        return category2;
    }
    public void setCategory2(String category2) {
        this.category2 = category2;
    }
    public String getCategory3() {
        return category3;
    }
    public void setCategory3(String category3) {
        this.category3 = category3;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/msg/MsgAccountDetailServiceImpl.java
@@ -7,9 +7,15 @@
import org.springframework.stereotype.Service;
import com.google.gson.Gson;
import com.yeshi.fanli.dao.mybatis.msg.MsgAccountDetailMapper;
import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
import com.yeshi.fanli.exception.msg.MsgOtherDetailException;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService;
import com.yeshi.fanli.util.Constant;
@@ -54,4 +60,20 @@
        msgAccountDetailMapper.setMsgReadByUid(uid);
    }
    @Override
    public void addMsgVIP(Long uid, String title, String beiZhu, MsgAccountVipDTO dto) {
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setTitle(title);
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setUpdateTime(new Date());
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        detail.setContent(new Gson().toJson(dto));
        detail.setType(MsgTypeAccountTypeEnum.vipPgrade);
        msgAccountDetailMapper.insertSelective(detail);
        userMsgReadStateService.addAccountMsgUnReadCount(detail.getUser().getId(), 1);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -17,7 +17,10 @@
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -30,6 +33,7 @@
import com.yeshi.fanli.entity.shop.BanLiShopOrder;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
@@ -41,6 +45,7 @@
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
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.msg.MsgAccountDetailService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
@@ -90,6 +95,11 @@
    
    @Resource
    private UserVIPPreInfoService userVIPPreInfoService;
    @Resource
    private MsgAccountDetailService msgAccountDetailService;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -440,12 +450,129 @@
        }
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void applyVIPNew(Long uid) throws UserVIPInfoException {
        UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
        if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
            throw new UserVIPInfoException(1, "该用户还不是高级会员");
        }
        if (!verifyVipNew(uid))
            throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
        UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
        if (userInfo == null) {
            userInfo = new UserVIPInfo();
            userInfo.setId(uid);
            // 添加记录
            addUserVIPInfo(userInfo);
        }
        if (userInfo.getState() != UserVIPInfo.STATE_INVALID)
            throw new UserVIPInfoException(2, "已经申请过");
        UserVIPInfo info = new UserVIPInfo();
        info.setId(userInfo.getId());
        info.setApplyTime(new Date());
        info.setState(UserVIPInfo.STATE_VERIFING);
        info.setUpdateTime(new Date());
        userVIPInfoMapper.updateByPrimaryKeySelective(info);
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setTitle("尊敬的高级会员,系统已收到你的超级会员升级申请,正在受理中");
        detail.setBeiZhu("如有疑问请联系我的-人工客服");
        detail.setRead(false);
        detail.setCreateTime(new Date());
        detail.setUser(new UserInfo(uid));
        detail.setContent("我们将会在48小时内完成审核");
        detail.setType(MsgTypeAccountTypeEnum.vipApply);
        try {
            msgAccountDetailService.addMsgAccountDetail(detail);
        } catch (MsgAccountDetailException e) {
            e.printStackTrace();
        }
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void passVIPApplyNew(Long uid) throws UserVIPInfoException {
        UserVIPInfo userVIPInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
        if (userVIPInfo == null) {
            throw new UserVIPInfoException(1, "用户信息不存在");
        }
        if (userVIPInfo.getState() != UserVIPInfo.STATE_VERIFING) {
            throw new UserVIPInfoException(2, "申请未处于审核状态");
        }
        UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
        if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
            throw new UserVIPInfoException(1, "该用户还不是高级会员");
        }
        if (!verifyVipNew(uid))
            throw new UserVIPInfoException(1, "系统验证:不满足升级条件");
        // 额外信息
        UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
        if (userInfoExtra == null)
            throw new UserVIPInfoException(1, "用户信息不存在");
        // 通过超级会员
        UserVIPInfo info = new UserVIPInfo();
        info.setId(userVIPInfo.getId());
        info.setSuccessTime(new Date());
        info.setState(UserVIPInfo.STATE_SUCCESS);
        info.setUpdateTime(new Date());
        userVIPInfoMapper.updateByPrimaryKeySelective(info);
        // 添加金币
        userInfoExtraService.addGoldCoinByUid(uid, Constant.VIP_COLDCOIN_NUM);
        // 添加金币明细
        IntegralDetail detail = new IntegralDetail();
        detail.setTitle("升级VIP福利");
        detail.setUid(uid);
        detail.setMoney(Constant.VIP_COLDCOIN_NUM);
        detail.setCreateTime(new Date());
        detail.setUniqueKey("VIP-" + uid);
        integralDetailService.insertSelective(detail);
        try {
            // 奖励券
            BigDecimal percent = new BigDecimal(configService.get(ConfigKeyEnum.exchangeRebatePercent.getKey()));
            for (int i = 0; i < Constant.VIP_COUPON_REWARD_NUM; i++) {
                userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
                        UserSystemCoupon.SOURCE_SYSTEM_PUSH, percent, false);
            }
            // 赠送免单券
            for (int i = 0; i < Constant.VIP_COUPON_GIVEFREE_NUM; i++) {
                userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
                        UserSystemCoupon.SOURCE_SYSTEM_PUSH, null, false);
            }
        } catch (Exception e) {
            throw new UserVIPInfoException(1, "券赠送失败");
        }
        // 消息
        MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
        msgDto.setStatus("已将你的账户由高级会员升级为超级会员");
        msgDto.setEquity("从收到本消息起,你将获得全部超级会员权益");
        msgAccountDetailService.addMsgVIP(uid, "恭喜你!经人工审核你满足升级超级会员条件", "如有疑问请联系我的-人工客服", msgDto);
    }
    /**
     * 验证是否符合VIP
     * @param uid
     * @return
     */
    private boolean verifyVip(Long uid) {
    private boolean verifyVipNew(Long uid) {
        // 邀请订单
        long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
                HongBaoV2.TYPE_ZIGOU);
@@ -457,13 +584,29 @@
        long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
        if (countZiGou >= Constant.VIP_PROCESS_3_ZIGOU || countShare >= Constant.VIP_PROCESS_3_SHARE
                || (firstTeam >= Constant.VIP_PROCESS_3_TEAM && secondTeam >= Constant.VIP_PROCESS_3_TEAM_SECOND)) {
            UserVIPPreInfo latestProcess = userVIPPreInfoService.getLatestProcessInfo(uid);
            if (latestProcess == null || latestProcess.getProcess() != UserVIPPreInfo.PROCESS_2) {
                userVIPPreInfoService.verifyVipPreInfo(uid, false);
            }
            return true;
        } 
        return false;
    }
    
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException {
        UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid);
        if (userInfo == null) {
            throw new UserVIPInfoException(1, "用户信息不存在");
        }
        if (userInfo.getState() != UserVIPInfo.STATE_VERIFING) {
            throw new UserVIPInfoException(2, "申请未处于审核状态");
        }
        UserVIPInfo info = new UserVIPInfo();
        info.setId(userInfo.getId());
        info.setState(UserVIPInfo.STATE_INVALID);
        info.setUpdateTime(new Date());
        userVIPInfoMapper.updateByPrimaryKeySelective(info);
        // TODO消息
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java
@@ -7,24 +7,22 @@
import javax.annotation.Resource;
import org.hibernate.annotations.LazyCollection;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPPreInfoMapper;
import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
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.msg.MsgAccountDetailService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService;
@Service
@@ -38,6 +36,11 @@
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private MsgAccountDetailService msgAccountDetailService;
    @Override
    public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
@@ -137,17 +140,38 @@
     * @param secondTeam
     */
    private boolean oneProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
        if (countZiGou >= Constant.VIP_PROCESS_1_ZIGOU || countShare >= Constant.VIP_PROCESS_1_SHARE
                || (firstTeam >= Constant.VIP_PROCESS_1_TEAM && secondTeam >= Constant.VIP_PROCESS_1_TEAM_SECOND)) {
            UserVIPPreInfo info = new UserVIPPreInfo();
            info.setUid(uid);
            info.setProcess(UserVIPPreInfo.PROCESS_1);
            info.setCreateTime(new Date());
            info.setUpdateTime(new Date());
            userVIPPreInfoMapper.insertSelective(info);
            return true;
        boolean process = false;
        String msg = "";
        if (countZiGou >= Constant.VIP_PROCESS_1_ZIGOU) {
            process = true;
            msg = "恭喜你!返利订单达到 "+ Constant.VIP_PROCESS_1_ZIGOU +"笔";
        } else if (countShare >= Constant.VIP_PROCESS_1_SHARE) {
            process = true;
            msg = "恭喜你!分享订单达到 "+ Constant.VIP_PROCESS_1_SHARE +"笔";
        } else if (firstTeam >= Constant.VIP_PROCESS_1_TEAM && secondTeam >= Constant.VIP_PROCESS_1_TEAM_SECOND) {
            process = true;
            msg = "直接粉丝达到"+ Constant.VIP_PROCESS_1_TEAM +"人,间接粉丝达到 "+ Constant.VIP_PROCESS_1_TEAM_SECOND +"人";
        }
        return false;
        if (process) {
            try {
                UserVIPPreInfo info = new UserVIPPreInfo();
                info.setUid(uid);
                info.setProcess(UserVIPPreInfo.PROCESS_1);
                info.setCreateTime(new Date());
                info.setUpdateTime(new Date());
                addUserVIPPreInfo(info);
                // 消息
                MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
                msgDto.setStatus("系统已将你的账户由快省达人升级为普通会员");
                msgDto.setEquity("从收到本消息起,你将获得全部普通会员权益");
                msgAccountDetailService.addMsgVIP(uid, msg, "如有疑问请联系我的-人工客服", msgDto);
            } catch (UserVIPPreInfoException e) {
                e.printStackTrace();
            }
        }
        return process;
    }
    /**
@@ -160,17 +184,38 @@
     * @param secondTeam
     */
    private boolean twoProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
        if (countZiGou >= Constant.VIP_PROCESS_2_ZIGOU || countShare >= Constant.VIP_PROCESS_2_SHARE
                || (firstTeam >= Constant.VIP_PROCESS_2_TEAM && secondTeam >= Constant.VIP_PROCESS_2_TEAM_SECOND)) {
            UserVIPPreInfo info = new UserVIPPreInfo();
            info.setUid(uid);
            info.setProcess(UserVIPPreInfo.PROCESS_2);
            info.setCreateTime(new Date());
            info.setUpdateTime(new Date());
            userVIPPreInfoMapper.insertSelective(info);
            return true;
        boolean process = false;
        String msg = "";
        if (countZiGou >= Constant.VIP_PROCESS_2_ZIGOU) {
            process = true;
            msg = "恭喜你!返利订单达到 "+ Constant.VIP_PROCESS_2_ZIGOU +"笔";
        } else if (countShare >= Constant.VIP_PROCESS_2_SHARE) {
            process = true;
            msg = "恭喜你!分享订单达到 "+ Constant.VIP_PROCESS_2_SHARE +"笔";
        } else if (firstTeam >= Constant.VIP_PROCESS_2_TEAM && secondTeam >= Constant.VIP_PROCESS_2_TEAM_SECOND) {
            process = true;
            msg = "直接粉丝达到"+ Constant.VIP_PROCESS_2_TEAM +"人,间接粉丝达到 "+ Constant.VIP_PROCESS_2_TEAM_SECOND +"人";
        }
        return false;
        if (process) {
            try {
                UserVIPPreInfo info = new UserVIPPreInfo();
                info.setUid(uid);
                info.setProcess(UserVIPPreInfo.PROCESS_2);
                info.setCreateTime(new Date());
                info.setUpdateTime(new Date());
                addUserVIPPreInfo(info);
                // 消息
                MsgAccountVipDTO msgDto = new MsgAccountVipDTO();
                msgDto.setStatus("系统已将你的账户由普通会员升级为高级会员");
                msgDto.setEquity("从收到本消息起,你将获得全部高级会员权益");
                msgAccountDetailService.addMsgVIP(uid, msg, "如有疑问请联系我的-人工客服", msgDto);
            } catch (UserVIPPreInfoException e) {
                e.printStackTrace();
            }
        }
        return process;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/msg/MsgAccountDetailService.java
@@ -2,6 +2,7 @@
import java.util.List;
import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
@@ -39,4 +40,13 @@
     */
    public void readMsgByUid(Long uid);
    /**
     * 会员升级消息
     * @param uid
     * @param title
     * @param beiZhu
     * @param dto
     */
    public void addMsgVIP(Long uid, String title, String beiZhu, MsgAccountVipDTO dto);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java
@@ -94,4 +94,26 @@
     */
    public void inviteSeparate(Long workerId, Long bossId);
    /**
     * 超级会员申请通过
     * @param uid
     * @throws UserVIPInfoException
     */
    public void passVIPApplyNew(Long uid) throws UserVIPInfoException;
    /**
     * 超级会员未通过
     * @param uid
     * @param reason
     * @throws UserVIPInfoException
     */
    public void rejectVIPApplyNew(Long uid, String reason) throws UserVIPInfoException;
    /**
     *  超级会员申请
     * @param uid
     * @throws UserVIPInfoException
     */
    public void applyVIPNew(Long uid) throws UserVIPInfoException;
}
fanli/src/main/java/com/yeshi/fanli/util/factory/CommonGoodsFactory.java
@@ -3,7 +3,9 @@
import java.math.BigDecimal;
import com.alibaba.fastjson.JSONObject;
import com.yeshi.fanli.dto.common.CategoryInfoDTO;
import com.yeshi.fanli.dto.common.GoodsOtherInfoDTO;
import com.yeshi.fanli.dto.jd.JDCategoryInfo;
import com.yeshi.fanli.dto.jd.JDCommissionInfo;
import com.yeshi.fanli.dto.jd.JDCouponInfo;
import com.yeshi.fanli.dto.jd.JDShopInfo;
@@ -53,6 +55,23 @@
        cg.setVideoUrl(null);
        cg.setState(goods.getState());
        cg.setMaterialLibType(goods.getMaterialLibType());
        // 分类信息
        CategoryInfoDTO categoryInfo = new CategoryInfoDTO();
        Integer rootCatId = goods.getRootCatId();
        if (rootCatId != null) {
            categoryInfo.setCid1(Long.parseLong(rootCatId.toString()));
        }
        categoryInfo.setCid1Name(goods.getRootCategoryName());
        Integer leafCatId = goods.getLeafCatId();
        if (leafCatId != null) {
            categoryInfo.setCid2(Long.parseLong(leafCatId.toString()));
        }
        categoryInfo.setCid2Name(goods.getLeafName());
        cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
        return cg;
    }
@@ -120,6 +139,20 @@
        other.setPinGouInfo( goods.getPinGouInfo());  // 拼购信息
        other.setIsFreeShipping(goods.getIsFreeShipping()); // 是否包邮
        cg.setOtherInfo(JSONObject.toJSON(other).toString());
        // 分类信息
        JDCategoryInfo categoryJD = goods.getCategoryInfo();
        if (categoryJD != null) {
            CategoryInfoDTO categoryInfo = new CategoryInfoDTO();
            categoryInfo.setCid1(categoryJD.getCid1());
            categoryInfo.setCid1Name(categoryJD.getCid1Name());
            categoryInfo.setCid2(categoryJD.getCid2());
            categoryInfo.setCid2Name(categoryJD.getCid2Name());
            categoryInfo.setCid3(categoryJD.getCid3());
            categoryInfo.setCid3Name(categoryJD.getCid3Name());
            cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
        }
        
        // 保留字段
        cg.setVideoCover(null);
@@ -190,6 +223,14 @@
        cg.setVideoUrl(null);
        cg.setState(goods.getState());
        cg.setMaterialLibType(1);
        // 分类信息
        CategoryInfoDTO categoryInfo = new CategoryInfoDTO();
        categoryInfo.setCid1(goods.getCategoryId());
        categoryInfo.setCid1Name(goods.getCategoryName());
        cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString());
        return cg;
    }
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -6,6 +6,7 @@
import java.util.List;
import com.google.gson.Gson;
import com.yeshi.fanli.dto.msg.MsgAccountVipDTO;
import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
@@ -983,6 +984,57 @@
    public static UserMsgVO create(MsgAccountDetail msg) {
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        if (msg.getType() == MsgTypeAccountTypeEnum.vipPgrade) {// 等级升级
            contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("详情", COLOR_TITLE), contentList));
            MsgAccountVipDTO dto = new Gson().fromJson(msg.getContent(), MsgAccountVipDTO.class);
            if (dto != null) {
                if (!StringUtil.isNullOrEmpty(dto.getStatus())) {
                    contentList = new ArrayList<>();
                    contentList.add(new ClientTextStyleVO(dto.getStatus() + "", COLOR_CONTENT));
                    items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
                }
                if (!StringUtil.isNullOrEmpty(dto.getEquity())) {
                    contentList = new ArrayList<>();
                    contentList.add(new ClientTextStyleVO(dto.getEquity() + "", 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));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
        if (msg.getType() == MsgTypeAccountTypeEnum.vipApply) {// vip升级申请
            contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("申请进度", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(msg.getContent() + "", 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));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
        contentList.add(new ClientTextStyleVO(msg.getTitle() + "", COLOR_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("事项", COLOR_TITLE), contentList));
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserVIPMessageListener.java
@@ -24,46 +24,46 @@
 * @author Administrator
 *
 */
//@Component implements MessageListener
public class UserVIPMessageListener  {
@Component
public class UserVIPMessageListener implements MessageListener {
    @Resource
    private UserVIPPreInfoService userVIPPreInfoService;
//    @Override
//    public Action consume(Message message, ConsumeContext context) {
//
//        LogHelper.mqInfo("consumer-UserVIPMessageListener", message.getMsgID(), message.getTopic(),
//                message.getTag(), new String(message.getBody()));
//        String tag = message.getTag();
//        if (tag == null)
//            tag = "";
//
//        // 邀请相关
//        if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
//            // 邀请成功
//            if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {
//                UserInviteMQMsg msg = new Gson().fromJson(new String(message.getBody()),UserInviteMQMsg.class);
//                // 会员等级升级
//                userVIPPreInfoService.verifyVipPreInfo(msg.getBossId(), true);
//            }
//        }
//
//        // 订单到账相关
//        if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
//            OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
//                    OrderMoneyRecievedMQMsg.class);
//            if (dto != null) {
//                if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
//                    // 会员等级升级
//                    userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
//                } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享到账
//                    // 会员等级升级
//                    userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
//                }
//            }
//        }
//
//        return Action.CommitMessage;
//    }
    @Override
    public Action consume(Message message, ConsumeContext context) {
        LogHelper.mqInfo("consumer-UserVIPMessageListener", message.getMsgID(), message.getTopic(),
                message.getTag(), new String(message.getBody()));
        String tag = message.getTag();
        if (tag == null)
            tag = "";
        // 邀请相关
        if (MQTopicName.TOPIC_USER.name().equalsIgnoreCase(message.getTopic())) {
            // 邀请成功
            if (tag.equalsIgnoreCase(UserTopicTagEnum.inviteSuccess.name())) {
                UserInviteMQMsg msg = new Gson().fromJson(new String(message.getBody()),UserInviteMQMsg.class);
                // 会员等级升级
                userVIPPreInfoService.verifyVipPreInfo(msg.getBossId(), true);
            }
        }
        // 订单到账相关
        if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
            OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
                    OrderMoneyRecievedMQMsg.class);
            if (dto != null) {
                if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
                    // 会员等级升级
                    userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
                } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_SHARE) {// 分享到账
                    // 会员等级升级
                    userVIPPreInfoService.verifyVipPreInfo(dto.getUid(), false);
                }
            }
        }
        return Action.CommitMessage;
    }
}