fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserVIPPreInfo.java
@@ -18,6 +18,10 @@ public static int PROCESS_3 = 10;// 会员第三阶段 public static int PROCESS_4 = 11;// 会员第四阶段 public final static int SOURCE_TYPE_ORDER = 1;// 订单型 public final static int SOURCE_TYPE_TEAM = 2;// 团队型 @Column(name = "vpi_id") private Long id; @Column(name = "vpi_uid") @@ -30,6 +34,16 @@ private Date createTime; @Column(name = "vpi_update_time") private Date updateTime; @Column(name = "vpi_source_type") private Integer sourceType;// 来源类型 public Integer getSourceType() { return sourceType; } public void setSourceType(Integer sourceType) { this.sourceType = sourceType; } public Long getId() { return id; fanli/src/main/java/com/yeshi/fanli/mapping/user/vip/UserVIPPreInfoMapper.xml
@@ -12,8 +12,10 @@ jdbcType="TIMESTAMP" /> <result column="vpi_update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="vpi_source_type" property="sourceType" jdbcType="INTEGER" /> </resultMap> <sql id="Base_Column_List">vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time <sql id="Base_Column_List">vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time,vpi_source_type </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> @@ -27,9 +29,9 @@ <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_vip_pre_info (vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time) (vpi_id,vpi_uid,vpi_process,vpi_beizhu,vpi_create_time,vpi_update_time,vpi_source_type) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{process,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{process,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{sourceType,jdbcType=INTEGER}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo" useGeneratedKeys="true" keyProperty="id"> @@ -41,6 +43,7 @@ <if test="beizhu != null">vpi_beizhu,</if> <if test="createTime != null">vpi_create_time,</if> <if test="updateTime != null">vpi_update_time,</if> <if test="sourceType != null">vpi_source_type,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> @@ -50,6 +53,7 @@ <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo">update @@ -58,7 +62,8 @@ #{process,jdbcType=INTEGER},vpi_beizhu = #{beizhu,jdbcType=VARCHAR},vpi_create_time = #{createTime,jdbcType=TIMESTAMP},vpi_update_time = #{updateTime,jdbcType=TIMESTAMP} where vpi_id = #{id,jdbcType=BIGINT} #{updateTime,jdbcType=TIMESTAMP} ,vpi_source_type =#{sourceType,jdbcType=INTEGER} where vpi_id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo"> update yeshi_ec_user_vip_pre_info @@ -68,24 +73,20 @@ <if test="beizhu != null">vpi_beizhu=#{beizhu,jdbcType=VARCHAR},</if> <if test="createTime != null">vpi_create_time=#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">vpi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> <if test="id !=null">vpi_id =#{id,jdbcType=BIGINT},</if> <if test="sourceType !=null">vpi_source_type =#{sourceType,jdbcType=INTEGER},</if> </set> where vpi_id = #{id,jdbcType=BIGINT} </update> <select id="selectByUidAndProcess" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from yeshi_ec_user_vip_pre_info where vpi_uid = #{uid} and vpi_process=#{process} </select> <select id="listByUid" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_user_vip_pre_info where vpi_uid = #{uid} </select> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -23,7 +23,6 @@ import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify; import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo; import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo; import com.yeshi.fanli.entity.common.AdminUser; import com.yeshi.fanli.entity.common.Config; import com.yeshi.fanli.entity.system.ConfigKeyEnum; import com.yeshi.fanli.exception.user.vip.UserVIPInfoException; @@ -162,7 +161,8 @@ throw new UserVIPInfoException(1, "请先升级为高级会员"); } if (!verifyVip(uid)) int verifyResult = verifyVip(uid); if (verifyResult <= 0) throw new UserVIPInfoException(1, "不满足升级条件"); UserVIPInfo userInfo = userVIPInfoMapper.selectByPrimaryKeyForUpdate(uid); @@ -215,7 +215,9 @@ throw new UserVIPInfoException(1, "该用户还不是高级会员"); } if (!verifyVip(uid)) int verifyVipResult = verifyVip(uid); if (verifyVipResult <= 0) throw new UserVIPInfoException(1, "系统验证:不满足升级条件"); Date upgradeTime = new Date(); @@ -230,6 +232,7 @@ UserVIPPreInfo preInfo = new UserVIPPreInfo(); preInfo.setCreateTime(new Date()); preInfo.setProcess(UserLevelEnum.superVIP.getLevel()); preInfo.setSourceType(verifyVipResult); preInfo.setUid(uid); try { @@ -318,11 +321,15 @@ } /** * 验证是否符合VIP * 验证是否符合VIP * @Title: verifyVip * @Description: * @param uid * @return * @return 0-不符合 1-订单 2-团队 * int 返回类型 * @throws */ private boolean verifyVip(Long uid) { private int verifyVip(Long uid) { // 自购 + 分享订单 long doneOrder = hongBaoV2CountService.countMyDirectOrderByCashArrival(uid, Constant.VIP_ORDER_PAY); // 有效粉丝 @@ -351,10 +358,14 @@ limitSecond = Long.parseLong(second); } if (doneOrder >= limitOrder || (doneFirst >= limitFirst && doneSecond >= limitSecond)) { return true; if (doneOrder >= limitOrder) { return UserVIPPreInfo.SOURCE_TYPE_ORDER; } return false; if ((doneFirst >= limitFirst && doneSecond >= limitSecond)) return UserVIPPreInfo.SOURCE_TYPE_TEAM; return 0; } @Transactional(rollbackFor = Exception.class) fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPPreInfoServiceImpl.java
@@ -96,7 +96,7 @@ @Override public void addUserVIPPreInfo(UserVIPPreInfo info) throws UserVIPPreInfoException { if (info == null || info.getUid() == null || info.getProcess() == null) if (info == null || info.getUid() == null || info.getProcess() == null || info.getSourceType() == null) throw new UserVIPPreInfoException(1, "信息不完整"); for (Long fuid : Constant.NO_UPGRADE_UIDS) {// 禁止不能升级的用户升级 if (info.getUid().longValue() == fuid) @@ -277,6 +277,11 @@ info.setProcess(UserVIPPreInfo.PROCESS_2); info.setCreateTime(upgradeTime); info.setUpdateTime(upgradeTime); if (teamPass) info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_TEAM); else info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER); addUserVIPPreInfo(info); // 升级弹框提示 fanli/src/main/java/com/yeshi/fanli/service/manger/user/UserLevelManager.java
@@ -77,6 +77,8 @@ info.setCreateTime(date); info.setProcess(level.getLevel()); info.setUid(uid); //默认为订单型 info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER); try { userVIPPreInfoService.addUserVIPPreInfo(info); } catch (UserVIPPreInfoException e) { fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/SyncBeforeInfoMessageListener.java
@@ -120,6 +120,7 @@ vip.setCreateTime(new Date()); vip.setProcess(UserVIPPreInfo.PROCESS_1); vip.setUid(uid); vip.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER); try { userVIPPreInfoService.addUserVIPPreInfo(vip); } catch (UserVIPPreInfoException e) { @@ -152,6 +153,7 @@ vip.setCreateTime(new Date()); vip.setProcess(UserVIPPreInfo.PROCESS_1); vip.setUid(uid); vip.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER); try { userVIPPreInfoService.addUserVIPPreInfo(vip); } catch (UserVIPPreInfoException e) {