| | |
| | | mongoTemplate.save(record); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | * @param record |
| | | */ |
| | | public void remove(GoodsEvaluate record) { |
| | | if (record == null) { |
| | | return; |
| | | } |
| | | mongoTemplate.remove(record); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据id查询数据 |
| | | * |
| | |
| | | return mongoTemplate.find(query, GoodsEvaluate.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询有效 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> queryOverdue() { |
| | | Date now = new Date(); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("endTime").lte(now)); |
| | | query.with(new Sort(Sort.Direction.ASC,"createTime")); |
| | | return mongoTemplate.find(query, GoodsEvaluate.class); |
| | | } |
| | | } |
| | |
| | | private Integer materialLibType;// 物料库类型 1-营销商品库 0-非营销商品库
|
| | | @Column(name = "cg_other_info")
|
| | | private String otherInfo; // 商品其他信息-json字符串
|
| | | @Column(name = "cg_category_info")
|
| | | private String categoryInfo; // 商品分类信息
|
| | | |
| | | @Column(name = "cg_createtime")
|
| | | private Date createTime;
|
| | | @Column(name = "cg_updatetime")
|
| | |
| | | public void setOtherInfo(String otherInfo) {
|
| | | this.otherInfo = otherInfo;
|
| | | }
|
| | |
|
| | | public String getCategoryInfo() {
|
| | | return categoryInfo;
|
| | | }
|
| | |
|
| | | public void setCategoryInfo(String categoryInfo) {
|
| | | this.categoryInfo = categoryInfo;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <result column="cg_updatetime" property="updateTime" jdbcType="TIMESTAMP" />
|
| | | <result column="cg_material_lib_type" property="materialLibType"
|
| | | jdbcType="INTEGER" />
|
| | | <result column="cg_category_info" property="categoryInfo" jdbcType="VARCHAR"/>
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">cg_id,cg_title,cg_goods_id,cg_goods_type,cg_shop_type,cg_seller_id,cg_seller_name,cg_sales,cg_rate,cg_picture,cg_picture_white,cg_state,cg_price,cg_coupon_info,cg_coupon_startprice,cg_coupon_amount,cg_coupon_left_count,cg_coupon_total_count,cg_video_cover,cg_video_url,cg_other_info,cg_createtime,cg_updatetime,cg_material_lib_type
|
| | | <sql id="Base_Column_List">cg_id,cg_title,cg_goods_id,cg_goods_type,cg_shop_type,cg_seller_id,cg_seller_name,cg_sales,cg_rate,cg_picture,cg_picture_white,cg_state,cg_price,cg_coupon_info,cg_coupon_startprice,cg_coupon_amount,cg_coupon_left_count,cg_coupon_total_count,cg_video_cover,cg_video_url,cg_other_info,cg_createtime,cg_updatetime,cg_material_lib_type,cg_category_info
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | |
| | | yeshi_ec_common_goods where cg_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.goods.CommonGoods"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_goods
|
| | | (cg_id,cg_title,cg_goods_id,cg_goods_type,cg_shop_type,cg_seller_id,cg_seller_name,cg_sales,cg_rate,cg_picture,cg_picture_white,cg_state,cg_price,cg_coupon_info,cg_coupon_startprice,cg_coupon_amount,cg_coupon_left_count,cg_coupon_total_count,cg_video_cover,cg_video_url,cg_other_info,cg_createtime,cg_updatetime,cg_material_lib_type)
|
| | | (cg_id,cg_title,cg_goods_id,cg_goods_type,cg_shop_type,cg_seller_id,cg_seller_name,cg_sales,cg_rate,cg_picture,cg_picture_white,cg_state,cg_price,cg_coupon_info,cg_coupon_startprice,cg_coupon_amount,cg_coupon_left_count,cg_coupon_total_count,cg_video_cover,cg_video_url,cg_other_info,cg_createtime,cg_updatetime,cg_material_lib_type,cg_category_info)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{goodsId,jdbcType=BIGINT},#{goodsType,jdbcType=INTEGER},#{shopType,jdbcType=INTEGER},#{sellerId,jdbcType=BIGINT},#{sellerName,jdbcType=VARCHAR},#{sales,jdbcType=INTEGER},#{rate,jdbcType=DECIMAL},#{picture,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{price,jdbcType=DECIMAL},#{couponInfo,jdbcType=VARCHAR},#{couponStartPrice,jdbcType=DECIMAL},#{couponAmount,jdbcType=DECIMAL},#{couponLeftCount,jdbcType=INTEGER},#{couponTotalCount,jdbcType=INTEGER},#{videoCover,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{otherInfo,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{materialLibType,jdbcType=INTEGER})
|
| | | (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{goodsId,jdbcType=BIGINT},#{goodsType,jdbcType=INTEGER},#{shopType,jdbcType=INTEGER},#{sellerId,jdbcType=BIGINT},#{sellerName,jdbcType=VARCHAR},#{sales,jdbcType=INTEGER},#{rate,jdbcType=DECIMAL},#{picture,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{price,jdbcType=DECIMAL},#{couponInfo,jdbcType=VARCHAR},#{couponStartPrice,jdbcType=DECIMAL},#{couponAmount,jdbcType=DECIMAL},#{couponLeftCount,jdbcType=INTEGER},#{couponTotalCount,jdbcType=INTEGER},#{videoCover,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{otherInfo,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{materialLibType,jdbcType=INTEGER},#{categoryInfo,jdbcType=VARCHAR})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.goods.CommonGoods"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | |
| | | <if test="createTime != null">cg_createtime,</if>
|
| | | <if test="updateTime != null">cg_updatetime,</if>
|
| | | <if test="materialLibType != null">cg_material_lib_type,</if>
|
| | | <if test="categoryInfo != null">cg_category_info,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="materialLibType != null">#{materialLibType,jdbcType=INTEGER}</if>
|
| | | <if test="categoryInfo != null">#{categoryInfo,jdbcType=VARCHAR},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.goods.CommonGoods">update
|
| | |
| | | #{otherInfo,jdbcType=VARCHAR},cg_createtime =
|
| | | #{createTime,jdbcType=TIMESTAMP},cg_updatetime =
|
| | | #{updateTime,jdbcType=TIMESTAMP} ,cg_material_lib_type
|
| | | =#{materialLibType,jdbcType=INTEGER} where cg_id =
|
| | | #{id,jdbcType=BIGINT}</update>
|
| | | =#{materialLibType,jdbcType=INTEGER},
|
| | | cg_category_info = #{categoryInfo,jdbcType=VARCHAR}
|
| | | where cg_id =#{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.goods.CommonGoods">
|
| | | update yeshi_ec_common_goods
|
| | | <set>
|
| | |
| | | <if test="id !=null">cg_id =#{id,jdbcType=BIGINT},</if>
|
| | | <if test="materialLibType !=null">cg_material_lib_type
|
| | | =#{materialLibType,jdbcType=INTEGER},</if>
|
| | | <if test="categoryInfo != null">cg_category_info=#{categoryInfo,jdbcType=VARCHAR},</if>
|
| | | </set>
|
| | | where cg_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // 更新信息 |
| | | updateGoodInfo(list); |
| | | |
| | | // 删除已过期 |
| | | removeOverdue(); |
| | | } |
| | | }); |
| | | |
| | |
| | | @Override |
| | | public void run() { |
| | | updateGoodInfo(listOBJ); |
| | | |
| | | // 删除已过期 |
| | | removeOverdue(); |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private void removeOverdue() { |
| | | List<GoodsEvaluate> list = goodsEvaluateDao.queryOverdue(); |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | long nm = 1000 * 60;// 一分钟的毫秒数 |
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数 |
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数 |
| | | |
| | | long time = java.lang.System.currentTimeMillis(); |
| | | for (GoodsEvaluate goodsEvaluate: list) { |
| | | long diff = time - goodsEvaluate.getEndTime().getTime(); |
| | | long min = diff % nd % nh / nm; |
| | | |
| | | // 过期超过10分钟就删除 |
| | | if (min > 10) { |
| | | goodsEvaluateDao.remove(goodsEvaluate); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherVIPDTO;
|
| | | 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.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteSeparate;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | |
| | | 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.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | @Lazy
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 验证是否符合VIP
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | private boolean verifyVip(Long uid) {
|
| | | // 邀请订单
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | long countShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | | // 队员
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | 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;
|
| | | }
|
| | | |
| | | }
|
| | |
| | |
|
| | | 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.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;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoMapper userVIPPreInfoMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | | |
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Override
|
| | | public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException {
|
| | |
| | | return infoList.get(0);
|
| | | }
|
| | |
|
| | | |
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void verifyVipCondition(Long uid) {
|
| | | public void verifyVipPreInfo(Long uid, boolean inviteSuccess) {
|
| | | if (uid == null || uid <= 0)
|
| | | return;
|
| | |
|
| | | // 验证是否VIP
|
| | | boolean vip = userVIPInfoService.isVIP(uid);
|
| | | if (vip) {
|
| | | return;
|
| | | }
|
| | | verifyCondition(uid);
|
| | |
|
| | | // 邀请订单
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY, HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | long countShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY, HongBaoV2.TYPE_SHARE_GOODS);
|
| | | // 队员
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | | |
| | | // 一阶段
|
| | | boolean process1 = oneProcess(uid, countZiGou, countShare, firstTeam, secondTeam);
|
| | | if (!process1) {
|
| | | return;
|
| | | // 验证上级
|
| | | if (inviteSuccess) {
|
| | | UserInfo boss = threeSaleSerivce.getBoss(uid);
|
| | | if (boss != null) {
|
| | | verifyVipPreInfoBoss(boss.getId());
|
| | | }
|
| | | }
|
| | | |
| | | // 一阶段
|
| | | boolean process2 = twoProcess(uid, countZiGou, countShare, firstTeam, secondTeam);
|
| | | if (!process2) {
|
| | | return;
|
| | | }
|
| | | |
| | | vipProcess(uid, countZiGou, countShare, firstTeam, secondTeam);
|
| | | }
|
| | | |
| | |
|
| | | // 上级验证
|
| | | private void verifyVipPreInfoBoss(Long uid) {
|
| | | if (uid == null || uid <= 0)
|
| | | return;
|
| | |
|
| | | verifyCondition(uid);
|
| | | }
|
| | |
|
| | | private void verifyCondition(Long uid) {
|
| | | try {
|
| | | // 验证二阶段
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(uid, UserVIPPreInfo.PROCESS_2);
|
| | | if (oldInfo != null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | long countZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | long countShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | | // 队员
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
|
| | |
|
| | | // 一阶段
|
| | | boolean process1 = oneProcess(uid, countZiGou, countShare, firstTeam, secondTeam);
|
| | | if (!process1) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 二阶段
|
| | | twoProcess(uid, countZiGou, countShare, firstTeam, secondTeam);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 一阶段
|
| | | * |
| | | * @param uid
|
| | | * @param countZiGou
|
| | | * @param countShare
|
| | |
| | | * @param secondTeam
|
| | | */
|
| | | private boolean oneProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(uid, UserVIPPreInfo.PROCESS_1);
|
| | | if (oldInfo != null) {
|
| | | return true;
|
| | | }
|
| | | |
| | | 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();
|
| | |
| | | }
|
| | | return false;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 一阶段
|
| | | * 二阶段
|
| | | * |
| | | * @param uid
|
| | | * @param countZiGou
|
| | | * @param countShare
|
| | |
| | | * @param secondTeam
|
| | | */
|
| | | private boolean twoProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(uid, UserVIPPreInfo.PROCESS_2);
|
| | | if (oldInfo != null) {
|
| | | return true;
|
| | | }
|
| | | |
| | | 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();
|
| | |
| | | }
|
| | | return false;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 一阶段
|
| | | * @param uid
|
| | | * @param countZiGou
|
| | | * @param countShare
|
| | | * @param firstTeam
|
| | | * @param secondTeam
|
| | | */
|
| | | private boolean vipProcess(Long uid, long countZiGou, long countShare, long firstTeam, long secondTeam) {
|
| | | 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)) {
|
| | | |
| | | |
| | | |
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | }
|
| | |
| | | */
|
| | | public UserVIPPreInfo getLatestProcessInfo(Long uid);
|
| | |
|
| | | public void verifyVipCondition(Long uid);
|
| | | /**
|
| | | * 会员等级添加并验证
|
| | | * @param uid
|
| | | * @param inviteSuccess
|
| | | */
|
| | | public void verifyVipPreInfo(Long uid, boolean inviteSuccess);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.user;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserInviteMQMsg;
|
| | | import com.yeshi.fanli.exception.money.OrderMoneySettleException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 用户超级会员
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @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;
|
| | | }
|
| | | }
|