yujian
2019-11-29 444da68b958e53c7fa122db62723fce25368ee1d
vip 配置信息 + 会员验证
13个文件已修改
7个文件已添加
838 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/vip/UserVipConfigMapper.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfo.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserVipConfig.java 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/user/vip/UserVipConfigException.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/vip/UserVipConfigMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVipConfigServiceImpl.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVipConfigService.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/user/UserVipRateVO.java 160 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -2,7 +2,10 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -16,6 +19,7 @@
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.SMSHistory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.shop.BanLiShopOrder;
@@ -44,6 +48,7 @@
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserInfoDeleteRecordService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
@@ -51,6 +56,7 @@
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.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
@@ -58,6 +64,7 @@
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.vo.user.UserVipRateVO;
import net.sf.json.JSONObject;
@@ -160,6 +167,12 @@
    @Resource
    private ConfigService configService;
    @Resource
    private UserVipConfigService userVipConfigService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    
    /**
     * 新版登录 V1.5.3
@@ -348,61 +361,61 @@
            return;
        }
        
        JSONObject data = new JSONObject();
        data.put("id", uid);
        data.put("nickName", userInfo.getNickName());
        data.put("portrait", userInfo.getPortrait());
        UserVipRateVO vo = new UserVipRateVO();
        vo.setId(uid);
        vo.setNickName(userInfo.getNickName());
        vo.setPortrait(userInfo.getPortrait());
        vo.setHelpLink(userVipConfigService.getValueByKey("help_link_vip_h5"));
    
        UserVIPInfo userVIPInfo = userVIPInfoService.selectByUid(uid);
        boolean vip = false;
        if (userVIPInfo != null && userVIPInfo.getState() != null
                && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) {
            vip = true;
            data.put("applyTime", userVIPInfo.getSuccessTime());
        }
        data.put("vip", vip);
        // 省钱 -自购产生返利   
        BigDecimal rewardPurchase = hongBaoV2CountService.getRewardMoneyBySelf(uid);
        data.put("rurchaseReward", rewardPurchase.setScale(2));
        BigDecimal conserveMoney = rewardPurchase;
        if (!vip) { // 少省钱:  自购产生返利  * 5/12
            BigDecimal rate1 = new BigDecimal(5);
            BigDecimal rate2 = new BigDecimal(12);
            conserveMoney = MoneyBigDecimalUtil.mul2(rewardPurchase,  MoneyBigDecimalUtil.div(rate1, rate2));
        }
        data.put("conserveMoney", conserveMoney.setScale(2));
        BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
        // 分享赚
        BigDecimal rewardShare = hongBaoV2CountService.getRewardMoneyByShare(uid);
        // 邀请赚
        BigDecimal rewardInvite = hongBaoV2CountService.getRewardMoneyByInvite(uid);        
        BigDecimal earnMoney = rewardShare;
        if (vip) { // 赚钱=分享+邀请
            earnMoney = MoneyBigDecimalUtil.add(rewardShare, rewardInvite );
        } else { // 少赚钱: 分享赚* 5/12
        UserVIPInfo userVIPInfo = userVIPInfoService.selectByUid(uid);
        if (userVIPInfo != null && userVIPInfo.getState() != null
                && userVIPInfo.getState() == UserVIPInfo.STATE_SUCCESS) { // VIP
            SimpleDateFormat format = new SimpleDateFormat("yyyy.mm.dd");
            vo.setVip(true);
            vo.setSuccessTime(format.format(userVIPInfo.getSuccessTime()));
            vo.setConserveMoney(finishMoney.setScale(2));
            vo.setEarnMoney(MoneyBigDecimalUtil.add(rewardShare, rewardInvite).setScale(2));
        } else {
            BigDecimal rate1 = new BigDecimal(5);
            BigDecimal rate2 = new BigDecimal(12);
            earnMoney = MoneyBigDecimalUtil.mul2(rewardShare,  MoneyBigDecimalUtil.div(rate1, rate2));
            vo.setConserveMoney(MoneyBigDecimalUtil.mul2(finishMoney,  MoneyBigDecimalUtil.div(rate1, rate2)).setScale(2));
            vo.setEarnMoney( MoneyBigDecimalUtil.mul2(rewardShare,  MoneyBigDecimalUtil.div(rate1, rate2)).setScale(2));
        }
        data.put("earnMoney", earnMoney.setScale(2));
        vo.setFinishMoney(finishMoney.setScale(2));
        
        // 注:1.有效一级队员定义:2019年1月1日起,自购或分享1笔且付款总金额不小于1元(退款为失效);
        long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, "2019-01-01", new BigDecimal(1));
        data.put("teamNum", teamNum);
        // 累计金币
        BigDecimal goldCoin = integralDetailService.getCumulativeMoney(uid);
        data.put("goldCoin", goldCoin.setScale(0));
        // 帮助链接
        data.put("helpLink", configService.get("help_link_vip_info"));
        // 使用红包次数
        // 会员规则执行时间
        String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
        Date executeDate = null;
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
            executeDate = format.parse(limtDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        List<Integer> list = new ArrayList<Integer>();
        list.add(BanLiShopOrder.STATE_SUCCESS);
        data.put("shopNum", banLiShopOrderService.countByUidAndState(uid, list));
        out.print(JsonUtil.loadTrueResult(data));
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        vo.setFinishGoldCoin(integralDetailService.getCumulativeMoney(uid));
        vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid, executeDate.getTime(), payMoney));
        vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list));
        UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
        if (extra !=null && (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) {
            vo.setLimitTeam(Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user")));
        } else {
            vo.setLimitTeam(Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user")));
        }
        vo.setLimitHongBao(Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy")));
        vo.setLimitMoney(new BigDecimal(userVipConfigService.getValueByKey("require_fan_money")));
        vo.setLimitgoldCoin(new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin")));
        out.print(JsonUtil.loadTrueResult(vo));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserOrderControllerV2.java
@@ -228,11 +228,11 @@
     */
    @RequestMapping(value = "getOrderCount", method = RequestMethod.POST)
    public void getOrderCount(AcceptData acceptData, Long uid, Integer type, PrintWriter out) {
        if (uid == null || type == null) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "请求参数不正确"));
            return;
        }
        try {
            UserInfo user = userInfoService.selectByPKey(uid);
            if (user == null) {
@@ -248,9 +248,9 @@
            }
            JSONObject data = new JSONObject();
            data.put("userInfo", userInfo);
            if (type == 0) {
                OrderCountVO total = commonOrderService.getOrderCount(uid, 1, type);
            if (type == null || type == 0) {
                OrderCountVO total = commonOrderService.getOrderCount(uid, null, type);
                data.put("total", total.getSelf() + total.getShared() + total.getInvite());
                data.put("self", total.getSelf());
                data.put("shared", total.getShared());
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoV2CountMapper.java
@@ -207,7 +207,7 @@
     * @param list 类型
     * @return
     */
    long countValidOrderTeamUserByUid(@Param("uid") Long uid, @Param("date") String date,
    long countValidOrderTeamUserByUid(@Param("uid") Long uid, @Param("time") Long time,
            @Param("payment") BigDecimal payment);
    
    
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/vip/UserVipConfigMapper.java
New file
@@ -0,0 +1,38 @@
package com.yeshi.fanli.dao.mybatis.user.vip;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.vip.UserVipConfig;
public interface UserVipConfigMapper extends BaseMapper<UserVipConfig> {
    /**
     * 根据key值查询
     * @param key
     * @return
     */
    UserVipConfig getByKey(@Param("key") String key,@Param("startTime")Date startTime);
    /**
     * 列表查询
     *
     * @param key
     * @param state
     * @param count
     * @return
     */
    List<UserVipConfig> query(@Param("start") long start,@Param("count") int count, @Param("key") String key);
    /**
     * 计数
     *
     * @param key
     * @param state
     * @return
     */
    long count(@Param("key") String key);
}
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandInfo.java
@@ -59,7 +59,10 @@
    private Integer shopTotal; // 拥有商品数量
    @Column(name = "bf_weight")
    private Double weight; // 权重:值越大越前
    private Double weight; // 排序:值越大越前
    @Column(name = "bf_order")
    private Integer order;// 排序:值越小越前
    @Column(name = "bf_state")
    private Integer state;// 状态:0停用 1启用
@@ -204,4 +207,12 @@
    public void setShopTotal(Integer shopTotal) {
        this.shopTotal = shopTotal;
    }
    public Integer getOrder() {
        return order;
    }
    public void setOrder(Integer order) {
        this.order = order;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/vip/UserVipConfig.java
New file
@@ -0,0 +1,114 @@
package com.yeshi.fanli.entity.bus.user.vip;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 配置信息
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_vip_config")
public class UserVipConfig {
    @Column(name = "uvc_id")
    private Long id;
    @Column(name = "uvc_name")
    private String name; // 名称
    @Column(name = "uvc_key")
    private String key; // 唯一值
    @Column(name = "uvc_value")
    private String value; // 值
    @Column(name = "uvc_remark")
    private String remark; // 备注
    @Column(name = "uvc_start_time")
    private Date startTime; // 开始使用时间
    @Column(name = "uvc_create_time")
    private Date createTime;
    @Column(name = "uvc_update_time")
    private Date updateTime;
    private String validTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    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 String getValidTime() {
        return validTime;
    }
    public void setValidTime(String validTime) {
        this.validTime = validTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/user/vip/UserVipConfigException.java
New file
@@ -0,0 +1,23 @@
package com.yeshi.fanli.exception.user.vip;
import com.yeshi.fanli.exception.BaseException;
/**
 * 用户VIP信息异常
 * @author Administrator
 *
 */
public class UserVipConfigException extends BaseException {
    private static final long serialVersionUID = 1L;
    public UserVipConfigException(int code, String msg) {
        super(code, msg);
    }
    public UserVipConfigException() {
        super();
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml
@@ -15,16 +15,16 @@
    <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/>
    <result column="bf_shop_total" property="shopTotal" jdbcType="INTEGER"/>
    <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
    <result column="bf_order" property="order" jdbcType="INTEGER"/>
    <result column="bf_state" property="state" jdbcType="INTEGER"/>
    <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
        <id column="bf_cid" property="id" jdbcType="BIGINT" />    
    </association>
  </resultMap>
  
  <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.brand.BrandInfoVO">
   <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.brand.BrandInfoVO">
    <id column="bf_id" property="id" jdbcType="BIGINT"/>
    <result column="bf_name" property="name" jdbcType="VARCHAR"/>
    <result column="bf_icon" property="icon" jdbcType="VARCHAR"/>
@@ -37,6 +37,7 @@
    <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/>
    <result column="bf_shop_total" property="shopTotal" jdbcType="INTEGER"/>
    <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
    <result column="bf_order" property="order" jdbcType="INTEGER"/>
    <result column="bf_state" property="state" jdbcType="INTEGER"/>
    <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
@@ -46,14 +47,12 @@
    </association>
  </resultMap>
  
  <sql id="Base_Column_List">bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_state,bf_create_time,bf_update_time</sql>
  <sql id="Base_Column_List">bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_order,bf_state,bf_create_time,bf_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info (bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_state,bf_create_time,bf_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{shopKey,jdbcType=VARCHAR},#{searchKey,jdbcType=VARCHAR},#{shopKeyJD,jdbcType=VARCHAR},#{searchKeyJD,jdbcType=VARCHAR},#{shopKeyPDD,jdbcType=VARCHAR},#{searchKeyPDD,jdbcType=VARCHAR},#{goodsTotal,jdbcType=INTEGER},#{shopTotal,jdbcType=INTEGER},#{weight,jdbcType=DOUBLE},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info (bf_id,bf_cid,bf_name,bf_icon,bf_shop_key,bf_search_key,bf_shop_key_jd,bf_search_key_jd,bf_shop_key_pdd,bf_search_key_pdd,bf_goods_total,bf_shop_total,bf_weight,bf_order,bf_state,bf_create_time,bf_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{shopKey,jdbcType=VARCHAR},#{searchKey,jdbcType=VARCHAR},#{shopKeyJD,jdbcType=VARCHAR},#{searchKeyJD,jdbcType=VARCHAR},#{shopKeyPDD,jdbcType=VARCHAR},#{searchKeyPDD,jdbcType=VARCHAR},#{goodsTotal,jdbcType=INTEGER},#{shopTotal,jdbcType=INTEGER},#{weight,jdbcType=DOUBLE},#{order,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">bf_id,</if>
@@ -69,6 +68,7 @@
      <if test="goodsTotal != null">bf_goods_total,</if>
      <if test="shopTotal != null">bf_shop_total,</if>
      <if test="weight != null">bf_weight,</if>
      <if test="order != null">bf_order,</if>
      <if test="state != null">bf_state,</if>
      <if test="createTime != null">bf_create_time,</if>
      <if test="updateTime != null">bf_update_time,</if>
@@ -87,12 +87,13 @@
      <if test="goodsTotal != null">#{goodsTotal,jdbcType=INTEGER},</if>
      <if test="shopTotal != null">#{shopTotal,jdbcType=INTEGER},</if>
      <if test="weight != null">#{weight,jdbcType=DOUBLE},</if>
      <if test="order != null">#{order,jdbcType=INTEGER},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</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.brand.BrandInfo">update yeshi_ec_brand_info set bf_cid = #{brandClass.id,jdbcType=BIGINT},bf_name = #{name,jdbcType=VARCHAR},bf_icon = #{icon,jdbcType=VARCHAR},bf_shop_key = #{shopKey,jdbcType=VARCHAR},bf_search_key = #{searchKey,jdbcType=VARCHAR},bf_shop_key_jd = #{shopKeyJD,jdbcType=VARCHAR},bf_search_key_jd = #{searchKeyJD,jdbcType=VARCHAR},bf_shop_key_pdd = #{shopKeyPDD,jdbcType=VARCHAR},bf_search_key_pdd = #{searchKeyPDD,jdbcType=VARCHAR},bf_goods_total = #{goodsTotal,jdbcType=INTEGER},bf_shop_total = #{shopTotal,jdbcType=INTEGER},bf_weight = #{weight,jdbcType=DOUBLE},bf_state = #{state,jdbcType=INTEGER},bf_create_time = #{createTime,jdbcType=TIMESTAMP},bf_update_time = #{updateTime,jdbcType=TIMESTAMP} where bf_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info set bf_cid = #{brandClass.id,jdbcType=BIGINT},bf_name = #{name,jdbcType=VARCHAR},bf_icon = #{icon,jdbcType=VARCHAR},bf_shop_key = #{shopKey,jdbcType=VARCHAR},bf_search_key = #{searchKey,jdbcType=VARCHAR},bf_shop_key_jd = #{shopKeyJD,jdbcType=VARCHAR},bf_search_key_jd = #{searchKeyJD,jdbcType=VARCHAR},bf_shop_key_pdd = #{shopKeyPDD,jdbcType=VARCHAR},bf_search_key_pdd = #{searchKeyPDD,jdbcType=VARCHAR},bf_goods_total = #{goodsTotal,jdbcType=INTEGER},bf_shop_total = #{shopTotal,jdbcType=INTEGER},bf_weight = #{weight,jdbcType=DOUBLE},bf_order = #{order,jdbcType=INTEGER},bf_state = #{state,jdbcType=INTEGER},bf_create_time = #{createTime,jdbcType=TIMESTAMP},bf_update_time = #{updateTime,jdbcType=TIMESTAMP} where bf_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info
    <set>
      <if test="brandClass != null">bf_cid=#{brandClass.id,jdbcType=BIGINT},</if>
@@ -107,6 +108,7 @@
      <if test="goodsTotal != null">bf_goods_total=#{goodsTotal,jdbcType=INTEGER},</if>
      <if test="shopTotal != null">bf_shop_total=#{shopTotal,jdbcType=INTEGER},</if>
      <if test="weight != null">bf_weight=#{weight,jdbcType=DOUBLE},</if>
      <if test="order != null">bf_order=#{order,jdbcType=INTEGER},</if>
      <if test="state != null">bf_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">bf_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">bf_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
@@ -123,7 +125,7 @@
      SELECT * FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1 AND d.bf_goods_total <![CDATA[>=]]> 3  AND d.bf_shop_total <![CDATA[>]]> 0
         <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
    ORDER BY d.`bf_weight`
    ORDER BY d.`bf_weight` DESC
    LIMIT ${start},${count}
  </select>
  
@@ -137,7 +139,7 @@
      SELECT * FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1 AND d.`bf_cid` = #{cid}  AND d.bf_goods_total <![CDATA[>=]]>3
          AND d.bf_shop_total <![CDATA[>]]> 0
    ORDER BY d.`bf_weight`
    ORDER BY d.`bf_order`
  </select>
  
  <select id="countValidByCid" resultType="Long">
@@ -170,7 +172,7 @@
          <if test="cid != null">
               AND bf_cid = #{cid}
          </if>
      ORDER BY bf_weight
      ORDER BY bf_order
      LIMIT ${start},${count}
  </select>
  
@@ -192,13 +194,13 @@
        SELECT * FROM yeshi_ec_brand_info
        WHERE bf_cid = #{cid}
        <if test="type == -1">
            AND bf_weight <![CDATA[<]]> #{order}
            ORDER BY bf_weight desc
            AND bf_order <![CDATA[<]]> #{order}
            ORDER BY bf_order desc
        </if>
        
        <if test="type == 1">
            AND bf_weight <![CDATA[>]]> #{order}
            ORDER BY bf_weight
            AND bf_order <![CDATA[>]]> #{order}
            ORDER BY bf_order
        </if>
        LIMIT 1
   </select>
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -403,20 +403,24 @@
    </select>
        
    <select id="countValidOrderTeamUserByUid" resultType="Long">
        SELECT IFNULL(COUNT(*),0) FROM (SELECT DISTINCT co.`co_uid` FROM `yeshi_ec_common_order` co
    SELECT IFNULL(COUNT(*),0) FROM
    (
        SELECT DISTINCT co.`co_uid` FROM `yeshi_ec_common_order` co
        LEFT JOIN `yeshi_ec_hongbao_order` ho  ON co.`co_id` = ho.`ho_order_id`
        LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.`hb_pid` = ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.`hb_pid` = ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_hongbao_v2 t2 ON t2.`hb_id` = v2.`hb_pid`
        WHERE v2.`hb_uid` = #{uid} AND co.`co_payment` <![CDATA[>=]]> #{payment} AND t2.`hb_state` = 3
            AND v2.`hb_create_time` > #{date}
            AND (t2.`hb_type` = 1 OR t2.`hb_type` = 20))A
        WHERE v2.`hb_uid` = ${uid} AND co.`co_payment`<![CDATA[>=]]> #{payment} AND t2.`hb_state` = 3
        AND (t2.`hb_type` = 1 OR t2.`hb_type` = 20)
        AND t2.`hb_uid` IN (SELECT tr.`worker_id` FROM `yeshi_ec_threesale` tr
                            WHERE tr.`state` = 1 AND tr.`boss_id` = ${uid} AND tr.`succeedTime` <![CDATA[>=]]> #{time})
     )A
    </select>
    
    
    <select id="getRewardMoneyByDate" resultType="BigDecimal">
        SELECT COALESCE(SUM(v2.`hb_money`),0)AS totalmoney FROM (
            SELECT * FROM yeshi_ec_hongbao_v2 v 
            WHERE v.hb_state <![CDATA[<>]]> 4 AND v.`hb_uid`= 389677
            WHERE v.hb_state <![CDATA[<>]]> 4 AND v.`hb_uid`= #{uid}
            <if test="type == 1"> <!-- 自购订单 -->
                AND (v.hb_type =1 or v.hb_type =2)
            </if>
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -626,7 +626,7 @@
            AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
        </if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        <if test="source != null and source != 0">AND co.co_source_type = #{source}</if>
    </sql>
    
    <select id="getOrderCount" resultMap="OrderCountMap">
fanli/src/main/java/com/yeshi/fanli/mapping/user/vip/UserVipConfigMapper.xml
New file
@@ -0,0 +1,74 @@
<?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.vip.UserVipConfigMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig">
    <id column="uvc_id" property="id" jdbcType="BIGINT"/>
    <result column="uvc_name" property="name" jdbcType="VARCHAR"/>
    <result column="uvc_key" property="key" jdbcType="VARCHAR"/>
    <result column="uvc_value" property="value" jdbcType="VARCHAR"/>
    <result column="uvc_remark" property="remark" jdbcType="VARCHAR"/>
    <result column="uvc_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="uvc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uvc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">uvc_id,uvc_name,uvc_key,uvc_value,uvc_remark,uvc_start_time,uvc_create_time,uvc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_vip_config where uvc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_vip_config where uvc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_vip_config (uvc_id,uvc_name,uvc_key,uvc_value,uvc_remark,uvc_start_time,uvc_create_time,uvc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_vip_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">uvc_id,</if>
      <if test="name != null">uvc_name,</if>
      <if test="key != null">uvc_key,</if>
      <if test="value != null">uvc_value,</if>
      <if test="remark != null">uvc_remark,</if>
      <if test="startTime != null">uvc_start_time,</if>
      <if test="createTime != null">uvc_create_time,</if>
      <if test="updateTime != null">uvc_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="key != null">#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">#{value,jdbcType=VARCHAR},</if>
      <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
      <if test="startTime != null">#{startTime,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.vip.UserVipConfig">update yeshi_ec_user_vip_config set uvc_name = #{name,jdbcType=VARCHAR},uvc_key = #{key,jdbcType=VARCHAR},uvc_value = #{value,jdbcType=VARCHAR},uvc_remark = #{remark,jdbcType=VARCHAR},uvc_start_time = #{startTime,jdbcType=TIMESTAMP},uvc_create_time = #{createTime,jdbcType=TIMESTAMP},uvc_update_time = #{updateTime,jdbcType=TIMESTAMP} where uvc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.vip.UserVipConfig">update yeshi_ec_user_vip_config
    <set>
      <if test="name != null">uvc_name=#{name,jdbcType=VARCHAR},</if>
      <if test="key != null">uvc_key=#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">uvc_value=#{value,jdbcType=VARCHAR},</if>
      <if test="remark != null">uvc_remark=#{remark,jdbcType=VARCHAR},</if>
      <if test="startTime != null">uvc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="createTime != null">uvc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uvc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uvc_id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getByKey" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_user_vip_config t
      WHERE t.`uvc_key` = #{key} and #{startTime} >= uvc_start_time
      ORDER BY uvc_start_time DESC
      LIMIT 1
  </select>
  <select id="query" resultMap="BaseResultMap">
    SELECT * FROM `yeshi_ec_user_vip_config` t
    WHERE t.`uvc_name` LIKE '${key}%' OR t.`uvc_value` LIKE '${key}%'
    LIMIT #{start},#{count}
  </select>
  <select id="count" resultType="Long">
       SELECT IFNULL(COUNT(t.uvc_id),0) FROM yeshi_ec_user_vip_config t
     WHERE t.`uvc_name` LIKE '${key}%' OR t.`uvc_value` LIKE '${key}%'
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -119,7 +119,8 @@
            
            BrandInfo resultObj = new BrandInfo();
            resultObj.setId(record.getId());
            resultObj.setWeight(Double.valueOf(record.getId()));
            resultObj.setOrder(Integer.valueOf(record.getId().toString()));
            resultObj.setWeight(500.00);
            brandInfoMapper.updateByPrimaryKeySelective(resultObj);
        } else {
            BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
@@ -145,6 +146,7 @@
                record.setShopTotal(resultObj.getShopTotal());
            }
            
            record.setOrder(resultObj.getOrder());
            record.setWeight(resultObj.getWeight());
            record.setCreateTime(resultObj.getCreateTime());
            record.setUpdateTime(new Date());
@@ -226,18 +228,18 @@
        if (resultObj == null) 
            throw new BrandInfoException(1, "操作数据已不存在");
        
        Double oldOrder = resultObj.getWeight();
        Integer oldOrder = resultObj.getOrder();
        BrandInfo changeObj = brandInfoMapper.getByAdjoinOrder(resultObj.getBrandClass().getId(),oldOrder, moveType);
        if (changeObj == null )
            throw new BrandInfoException(1, "已经在最边缘,无可交换的位置");
        
        BrandInfo changeObj1 = new BrandInfo();
        changeObj1.setId(id);
        changeObj1.setWeight(changeObj.getWeight());
        changeObj1.setOrder(changeObj.getOrder());
        
        BrandInfo changeObj2 = new BrandInfo();
        changeObj2.setId(changeObj.getId());
        changeObj2.setWeight(oldOrder);
        changeObj2.setOrder(oldOrder);
        
        brandInfoMapper.updateByPrimaryKeySelective(changeObj1);
        brandInfoMapper.updateByPrimaryKeySelective(changeObj2);
@@ -370,6 +372,7 @@
            brandInfo.setGoodsTotal(numInfo.getGoodsTotal());
            brandInfo.setShopTotal(numInfo.getShopTotal());
            brandInfo.setUpdateTime(new Date());
            brandInfo.setWeight(Math.random() * 1000);
            brandInfoMapper.updateByPrimaryKeySelective(brandInfo);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/count/HongBaoV2CountServiceImpl.java
@@ -339,8 +339,8 @@
    }
    
    @Override
    public long countValidOrderTeamUserByUid(Long uid, String date, BigDecimal payment) {
        return hongBaoV2CountMapper.countValidOrderTeamUserByUid(uid, date, payment);
    public long countValidOrderTeamUserByUid(Long uid, Long time, BigDecimal payment) {
        return hongBaoV2CountMapper.countValidOrderTeamUserByUid(uid, time, payment);
    }
    
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java
@@ -1152,9 +1152,7 @@
        String refundDate = DateUtil.reduceDayTostring(15, nowDate);
        // 提现金额
        BigDecimal money = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MONEY);
        // 余额最低限制
        BigDecimal minSurplus = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MIN_SURPLUS);
        BigDecimal money = BigDecimal.valueOf(1);
        List<String> listOpendIDs = new ArrayList<String>();
        // 首行appID
@@ -1179,7 +1177,7 @@
            }
            for (Long uid : listValid) {
                UserInfo userInfo = subHongBaoByUid(uid, money, minSurplus);
                UserInfo userInfo = subHongBaoByUid(uid, money, money);
                if (userInfo != null) {
                    listOpendIDs.add(userInfo.getWxOpenId());
                    if (listOpendIDs.size() >= maxSize)
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVIPInfoServiceImpl.java
@@ -1,5 +1,8 @@
package com.yeshi.fanli.service.impl.user.vip;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -12,15 +15,38 @@
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.user.vip.UserVIPInfoMapper;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
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.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
@Service
public class UserVIPInfoServiceImpl implements UserVIPInfoService {
    @Resource
    private UserVIPInfoMapper userVIPInfoMapper;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserVipConfigService userVipConfigService;
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    @Resource
    private IntegralDetailService integralDetailService;
    @Resource
    private BanLiShopOrderService banLiShopOrderService;
    @Override
    public void addUserVIPInfo(UserVIPInfo info) throws UserVIPInfoException {
@@ -129,4 +155,61 @@
        return map;
    }
    @Override
    public boolean verifyConform(Long uid) {
        if (uid == null || uid <= 0)
            return false;
        UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
        if (extra == null)
            return false;
        String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
        Date executeDate = null;
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
            executeDate = format.parse(limtDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        if (executeDate == null)
            return false;
        // 1、直接粉丝(从 2020 年 1 月 1 日起直接粉丝产生有效订单)
        BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
        long teamNum = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, executeDate.getTime(), payMoney);
        if (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime()) {
            long limitNum = Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user"));
            if (teamNum < limitNum)
                return false;
        } else {
            long limitNum = Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user"));
            if (teamNum < limitNum)
                return false;
        }
        // 2、累计自购返利≥100 元(从注册板栗快省起);
        BigDecimal fanMoney = new BigDecimal(userVipConfigService.getValueByKey("require_fan_money"));
        BigDecimal purchase = hongBaoV2CountService.getRewardMoneyBySelf(uid);
        if (purchase.compareTo(fanMoney) < 0)
            return false;
        // 3、累计金币≥10000 枚(从注册板栗快省起);
        BigDecimal goldCoin = integralDetailService.getCumulativeMoney(uid);
        BigDecimal limitGoldCoin = new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin"));
        if (goldCoin.compareTo(limitGoldCoin) < 0)
            return false;
        // 4、使用红包≥1 次
        List<Integer> list = new ArrayList<Integer>();
        list.add(BanLiShopOrder.STATE_SUCCESS);
        long useHongBao = banLiShopOrderService.countByUidAndState(uid, list);
        long limitHongBao = Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy"));
        if (useHongBao < limitHongBao)
            return false;
        // 符合条件
        return true;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserVipConfigServiceImpl.java
New file
@@ -0,0 +1,101 @@
package com.yeshi.fanli.service.impl.user.vip;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.user.vip.UserVipConfigMapper;
import com.yeshi.fanli.entity.bus.user.vip.UserVipConfig;
import com.yeshi.fanli.exception.user.vip.UserVipConfigException;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class UserVipConfigServiceImpl implements UserVipConfigService {
    @Resource
    private UserVipConfigMapper userVipConfigMapper;
    @Override
    public UserVipConfig getByKey(String key) {
        return userVipConfigMapper.getByKey(key, new Date());
    }
    @Override
    @Cacheable(value = "vipconfigCache", key = "'getValueByKey-' + #key")
    public String getValueByKey(String key) {
        UserVipConfig config = userVipConfigMapper.getByKey(key, new Date());
        if (config != null) {
            return config.getValue();
        }
        return null;
    }
    @Override
    public UserVipConfig getByKey(String key, Date date) {
        if (date == null)
            return getByKey(key);
        return userVipConfigMapper.getByKey(key, date);
    }
    @Override
    public String getValueByKey(String key, Date date) {
        if (date == null)
            return getValueByKey(key);
        UserVipConfig config = userVipConfigMapper.getByKey(key, date);
        if (config != null) {
            return config.getValue();
        }
        return null;
    }
    @Override
    public List<UserVipConfig> query(int page, int pageSize, String key) {
        return userVipConfigMapper.query((page - 1) * pageSize, pageSize, key);
    }
    @Override
    public long count(String key) {
        return userVipConfigMapper.count(key);
    }
    @Override
    public void save(UserVipConfig record) throws UserVipConfigException {
        String name = record.getName();
        if (StringUtil.isNullOrEmpty(name))
            throw new UserVipConfigException(1, "名称不能为空");
        if (StringUtil.isNullOrEmpty(record.getValue()))
            throw new UserVipConfigException(1, "值不能为空");
        if (StringUtil.isNullOrEmpty(record.getKey()))
            throw new UserVipConfigException(1, "标识不能为空");
        record.setUpdateTime(new Date());
        if (record.getId() == null) {
            record.setCreateTime(new Date());
            userVipConfigMapper.insert(record);
        } else {
            UserVipConfig resultObj = userVipConfigMapper.selectByPrimaryKey(record.getId());
            if (resultObj == null)
                throw new UserVipConfigException(1, "修改内容已不存在");
            record.setCreateTime(resultObj.getCreateTime());
            userVipConfigMapper.updateByPrimaryKey(record);
        }
    }
    @Override
    public void delete(List<Long> idsList) {
        if (idsList != null)
            for (Long id : idsList)
                userVipConfigMapper.deleteByPrimaryKey(id);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/count/HongBaoV2CountService.java
@@ -229,7 +229,7 @@
     * @param payment
     * @return
     */
    public long countValidOrderTeamUserByUid(Long uid, String date, BigDecimal payment);
    public long countValidOrderTeamUserByUid(Long uid, Long time, BigDecimal payment);
    /**
     * 统计不同时间:奖励
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVIPInfoService.java
@@ -69,4 +69,11 @@
     */
    public Map<Long,Boolean> listByUids(List<Long> uid);
    /**
     * 验证是否满足会员条件
     * @param uid
     * @return
     */
    public boolean verifyConform(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/vip/UserVipConfigService.java
New file
@@ -0,0 +1,41 @@
package com.yeshi.fanli.service.inter.user.vip;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.vip.UserVipConfig;
import com.yeshi.fanli.exception.user.vip.UserVipConfigException;
public interface UserVipConfigService {
    /**
     * 根据key值查询
     *
     * @param key
     * @return
     */
    public UserVipConfig getByKey(String key);
    /**
     * 根据key值 获取value
     *
     * @param key
     * @return
     */
    public String getValueByKey(String key);
    public UserVipConfig getByKey(String key, Date date);
    public String getValueByKey(String key, Date date);
    public void delete(List<Long> idsList);
    public List<UserVipConfig> query(int page, int pageSize, String key);
    public long count(String key);
    public void save(UserVipConfig record) throws UserVipConfigException;
}
fanli/src/main/java/com/yeshi/fanli/vo/user/UserVipRateVO.java
New file
@@ -0,0 +1,160 @@
package com.yeshi.fanli.vo.user;
import java.io.Serializable;
import java.math.BigDecimal;
public class UserVipRateVO implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    // 用户信息
    private Long id;
    private String nickName;
    private String portrait;
    private boolean vip;
    private String successTime;
    private BigDecimal earnMoney;
    private BigDecimal conserveMoney;
    private String helpLink;
    private long finishTeam;
    private long finishHongBao;
    private BigDecimal finishGoldCoin;
    private BigDecimal finishMoney;
    private BigDecimal limitMoney;
    private BigDecimal limitgoldCoin;
    private long limitTeam;
    private long limitHongBao;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getNickName() {
        return nickName;
    }
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    public String getPortrait() {
        return portrait;
    }
    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }
    public boolean isVip() {
        return vip;
    }
    public void setVip(boolean vip) {
        this.vip = vip;
    }
    public String getSuccessTime() {
        return successTime;
    }
    public void setSuccessTime(String successTime) {
        this.successTime = successTime;
    }
    public BigDecimal getEarnMoney() {
        return earnMoney;
    }
    public void setEarnMoney(BigDecimal earnMoney) {
        this.earnMoney = earnMoney;
    }
    public BigDecimal getConserveMoney() {
        return conserveMoney;
    }
    public void setConserveMoney(BigDecimal conserveMoney) {
        this.conserveMoney = conserveMoney;
    }
    public String getHelpLink() {
        return helpLink;
    }
    public void setHelpLink(String helpLink) {
        this.helpLink = helpLink;
    }
    public long getFinishTeam() {
        return finishTeam;
    }
    public void setFinishTeam(long finishTeam) {
        this.finishTeam = finishTeam;
    }
    public long getFinishHongBao() {
        return finishHongBao;
    }
    public void setFinishHongBao(long finishHongBao) {
        this.finishHongBao = finishHongBao;
    }
    public BigDecimal getFinishGoldCoin() {
        return finishGoldCoin;
    }
    public void setFinishGoldCoin(BigDecimal finishGoldCoin) {
        this.finishGoldCoin = finishGoldCoin;
    }
    public BigDecimal getFinishMoney() {
        return finishMoney;
    }
    public void setFinishMoney(BigDecimal finishMoney) {
        this.finishMoney = finishMoney;
    }
    public BigDecimal getLimitMoney() {
        return limitMoney;
    }
    public void setLimitMoney(BigDecimal limitMoney) {
        this.limitMoney = limitMoney;
    }
    public BigDecimal getLimitgoldCoin() {
        return limitgoldCoin;
    }
    public void setLimitgoldCoin(BigDecimal limitgoldCoin) {
        this.limitgoldCoin = limitgoldCoin;
    }
    public long getLimitTeam() {
        return limitTeam;
    }
    public void setLimitTeam(long limitTeam) {
        this.limitTeam = limitTeam;
    }
    public long getLimitHongBao() {
        return limitHongBao;
    }
    public void setLimitHongBao(long limitHongBao) {
        this.limitHongBao = limitHongBao;
    }
}