yujian
2019-11-06 11261b1ecf556ebb6cc4d619c6e685ed0e08e9a9
红包领取
12个文件已修改
1个文件已添加
729 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/FloatADMapper.java 136 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/redpack/RedPackWinInviteMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/FloatADMapper.xml 331 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackWinInviteMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinNewUserServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/FloatADService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinInviteService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinNewUserService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/homemodule/FloatImgDetailVO.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java
@@ -1,6 +1,8 @@
package com.yeshi.fanli.controller.client.v2;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
@@ -14,12 +16,14 @@
import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.config.AppHomeFloatImg;
import com.yeshi.fanli.entity.taobao.ClientTBPid;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.homemodule.FloatADService;
import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
import com.yeshi.fanli.service.inter.redpack.RedPackWinNewUserService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.user.TBPidService;
@@ -32,6 +36,7 @@
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.jd.JDUtil;
import com.yeshi.fanli.vo.homemodule.FloatImgDetailVO;
import net.sf.json.JSONObject;
@@ -72,6 +77,10 @@
    @Resource
    private UserActiveLogService userActiveLogService;
    @Resource
    private RedPackWinNewUserService redPackWinNewUserService;
    /**
     * s 首页配置信息
     * 
@@ -147,55 +156,45 @@
    public void getHomeConfigNew(AcceptData acceptData, Long uid, PrintWriter out) {
        if (uid != null && uid == 0L)
            uid = null;
        AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg();
        if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && !Constant.IS_TEST) {
            appHomeFloatImg = null;
        // 活动弹框
        List<FloatAD> listAD = null;
        if (redPackWinNewUserService.verifyHasReward(uid)) {
            listAD = floatADService.getValidByPosition(FloatAD.POSITION_INDEX);
        } else {
            listAD = floatADService.getValidCommonByPosition(FloatAD.POSITION_INDEX);
        }
        List<FloatImgDetailVO> listVO = new ArrayList<FloatImgDetailVO>();
        if (listAD != null && !listAD.isEmpty()) {
            for (FloatAD floatAD: listAD) {
                JumpDetailV2 jumpDetail = floatAD.getJumpDetail();
                if (jumpDetail != null) {
                    jumpDetail = jumpDetailV2Service.selectByPrimaryKey(jumpDetail.getId());
                    if (jumpDetail != null) {
                        jumpDetail.setNeedLogin(floatAD.isJumpNeedLogin());
                    }
                }
                FloatImgDetailVO floatImgVO = new FloatImgDetailVO();
                floatImgVO.setId(floatAD.getId().toString());
                floatImgVO.setImg(floatAD.getPicture());
                floatImgVO.setParams(floatAD.getParams());
                floatImgVO.setJumpDetail(jumpDetail);
                floatImgVO.setShowTime(floatAD.getShowMode());
                floatImgVO.setAccountLogin(floatAD.isJumpNeedLogin());
                listVO.add(floatImgVO);
            }
        }
        JSONObject data = new JSONObject();
        if (appHomeFloatImg != null) {
            data.put("floatImg", appHomeFloatImg);
        }
        String notifyImg = configService.getAppHomeFloatNotifyImg();
        if (!StringUtil.isNullOrEmpty(notifyImg)) {
            data.put("floatNotifyImg", notifyImg);
        }
        // 无新人弹框 则查询默认
        FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 0);
        if (floatAD != null) {
            JSONObject detail = new JSONObject();
            detail.put("img", floatAD.getPicture());
            detail.put("jumpDetail", floatAD.getJumpDetail());
            detail.put("params", floatAD.getParams());
            detail.put("showTime", floatAD.getShowMode());
            detail.put("accountLogin", floatAD.isJumpNeedLogin());
            data.put("floatImgDetail", detail);
        }
        data.put("listAD", JsonUtil.getApiCommonGson().toJson(listVO));
        // 领券帮助链接,1.5.2后生效
        String couponHelp = configService.get("taobao_coupon_help");
        data.put("couponHelpUrl", couponHelp);
        // 底部网页链接
        // 是否显示热门功能按钮
        String platform = acceptData.getPlatform();
        if ("android".equalsIgnoreCase(platform)) {
            data.put("htmlLink", configService.get("index_html_link_android"));
        }
        // 判断新老用户
        UserActiveLog da = null;
        if (uid != null)
            da = userActiveLogService.getFirstActiveInfo(uid);
        // 新人
        if (da == null || (System.currentTimeMillis() - da.getCreateTime().getTime()) <= 1000 * 60 * 60 * 24 * 15L) {
            data.put("userTimeType", 0);
        } else {// 老人
            data.put("userTimeType", 1);
        }
        data.put("hotFuctionLink",
                configService.getByVersion("hot_function_url", platform, Integer.parseInt(acceptData.getVersion())));
        out.print(JsonUtil.loadTrueResult(data));
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java
@@ -356,12 +356,14 @@
        }
        JSONObject data = new JSONObject();
        data.put("winMoney", redPackWinInviteService.getRewardMoney(uid).setScale(2));
        data.put("count", redPackWinInviteService.countRewardRecord(uid));
        data.put("list", JsonUtil.getApiCommonGson().toJson(list));
        if (!StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
        } else
        } else {
            out.print(JsonUtil.loadTrueResult(data));
        }
    }
    /**
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/FloatADMapper.java
@@ -1,65 +1,73 @@
package com.yeshi.fanli.dao.mybatis.homemodule;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
public interface FloatADMapper extends BaseMapper<FloatAD>{
    /**
     * 批量删除
     * @param list
     * @return
     */
    int deleteByPrimaryKeyList(List<Long> list);
    /**
     * 根据主键查询
     * @param list
     * @return
     */
    List<FloatAD> ListByPrimaryKey(List<Long> list);
   /**
           *  后端列表查询
    * @param start
    * @param count
    * @param key
    * @param state
    * @return
    */
    List<FloatAD> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key,
            @Param("state") Integer state);
    long countQuery(@Param("key") String key, @Param("state") Integer state);
    /**
     * 获取相邻序号
     * @param position
     * @param type
     * @return
     */
    FloatAD getByAdjoinOrder(@Param("position") String position, @Param("order") Integer order,
            @Param("type") Integer type);
    /**
     * 根据位置统计个数
     * @param position
     * @return
     */
    int getMaxOrderByPosition(@Param("position") String position);
    /**
     * 查询有效弹出框
     * @param position
     * @return
     */
    FloatAD getEffectiveFloatAD(@Param("position") String position, @Param("type") Integer type);
}
package com.yeshi.fanli.dao.mybatis.homemodule;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
public interface FloatADMapper extends BaseMapper<FloatAD>{
    /**
     * 批量删除
     * @param list
     * @return
     */
    int deleteByPrimaryKeyList(List<Long> list);
    /**
     * 根据主键查询
     * @param list
     * @return
     */
    List<FloatAD> ListByPrimaryKey(List<Long> list);
   /**
           *  后端列表查询
    * @param start
    * @param count
    * @param key
    * @param state
    * @return
    */
    List<FloatAD> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key,
            @Param("state") Integer state);
    long countQuery(@Param("key") String key, @Param("state") Integer state);
    /**
     * 获取相邻序号
     * @param position
     * @param type
     * @return
     */
    FloatAD getByAdjoinOrder(@Param("position") String position, @Param("order") Integer order,
            @Param("type") Integer type);
    /**
     * 根据位置统计个数
     * @param position
     * @return
     */
    int getMaxOrderByPosition(@Param("position") String position);
    /**
     * 查询有效弹出框
     * @param position
     * @return
     */
    FloatAD getEffectiveFloatAD(@Param("position") String position, @Param("type") Integer type);
    /**
     * 查询有效弹出框
     * @param position
     * @return
     */
    List<FloatAD> getValidFloatAD(@Param("position") String position, @Param("type") Integer type);
}
    
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/redpack/RedPackWinInviteMapper.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.dao.mybatis.redpack;
import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@@ -37,4 +38,13 @@
    
    
    Long countRewardRecord(@Param("uid")Long uid); 
    /**
     * 统计领取总金额
     * @param uid
     * @return
     */
    BigDecimal getRewardMoney(@Param("uid")Long uid);
}
fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/FloatADMapper.xml
@@ -1,160 +1,171 @@
<?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.homemodule.FloatADMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.FloatAD">
    <id column="fa_id" property="id" jdbcType="BIGINT"/>
    <result column="fa_name" property="name" jdbcType="VARCHAR"/>
    <result column="fa_picture" property="picture" jdbcType="VARCHAR"/>
    <result column="fa_show_mode" property="showMode" jdbcType="VARCHAR"/>
    <result column="fa_params" property="params" jdbcType="VARCHAR"/>
    <result column="fa_jump_need_login" property="jumpNeedLogin" jdbcType="VARCHAR"/>
    <result column="fa_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="fa_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="fa_position" property="position" jdbcType="VARCHAR"/>
    <result column="fa_order" property="order" jdbcType="INTEGER"/>
    <result column="fa_type" property="type" jdbcType="INTEGER"/>
    <result column="fa_state" property="state" jdbcType="INTEGER"/>
    <result column="fa_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="fa_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association property="jumpDetail"  column="fa_jumpid" javaType="com.yeshi.fanli.entity.common.JumpDetailV2">
            <id column="fa_jumpid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad (fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{showMode,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpNeedLogin,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{position,jdbcType=VARCHAR},#{order,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">fa_id,</if>
      <if test="name != null">fa_name,</if>
      <if test="picture != null">fa_picture,</if>
      <if test="showMode != null">fa_show_mode,</if>
      <if test="jumpDetail != null">fa_jumpid,</if>
      <if test="params != null">fa_params,</if>
      <if test="jumpNeedLogin != null">fa_jump_need_login,</if>
      <if test="startTime != null">fa_start_time,</if>
      <if test="endTime != null">fa_end_time,</if>
      <if test="position != null">fa_position,</if>
      <if test="order != null">fa_order,</if>
      <if test="type != null">fa_type,</if>
      <if test="state != null">fa_state,</if>
      <if test="createTime != null">fa_create_time,</if>
      <if test="updateTime != null">fa_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="picture != null">#{picture,jdbcType=VARCHAR},</if>
      <if test="showMode != null">#{showMode,jdbcType=VARCHAR},</if>
      <if test="jumpDetail != null">#{jumpDetail.id,jdbcType=BIGINT},</if>
      <if test="params != null">#{params,jdbcType=VARCHAR},</if>
      <if test="jumpNeedLogin != null">#{jumpNeedLogin,jdbcType=VARCHAR},</if>
      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="position != null">#{position,jdbcType=VARCHAR},</if>
      <if test="order != null">#{order,jdbcType=INTEGER},</if>
      <if test="type != null">#{type,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.bus.homemodule.FloatAD">update yeshi_ec_float_ad set fa_name = #{name,jdbcType=VARCHAR},fa_picture = #{picture,jdbcType=VARCHAR},fa_show_mode = #{showMode,jdbcType=VARCHAR},fa_jumpid = #{jumpDetail.id,jdbcType=BIGINT},fa_params = #{params,jdbcType=VARCHAR},fa_jump_need_login = #{jumpNeedLogin,jdbcType=VARCHAR},fa_start_time = #{startTime,jdbcType=TIMESTAMP},fa_end_time = #{endTime,jdbcType=TIMESTAMP},fa_position = #{position,jdbcType=VARCHAR},fa_order = #{order,jdbcType=INTEGER},fa_type = #{type,jdbcType=INTEGER},fa_state = #{state,jdbcType=INTEGER},fa_create_time = #{createTime,jdbcType=TIMESTAMP},fa_update_time = #{updateTime,jdbcType=TIMESTAMP} where fa_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">update yeshi_ec_float_ad
    <set>
      <if test="name != null">fa_name=#{name,jdbcType=VARCHAR},</if>
      <if test="picture != null">fa_picture=#{picture,jdbcType=VARCHAR},</if>
      <if test="showMode != null">fa_show_mode=#{showMode,jdbcType=VARCHAR},</if>
      <if test="jumpDetail != null">fa_jumpid=#{jumpDetail.id,jdbcType=BIGINT},</if>
      <if test="params != null">fa_params=#{params,jdbcType=VARCHAR},</if>
      <if test="jumpNeedLogin != null">fa_jump_need_login=#{jumpNeedLogin,jdbcType=VARCHAR},</if>
      <if test="startTime != null">fa_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">fa_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="position != null">fa_position=#{position,jdbcType=VARCHAR},</if>
      <if test="order != null">fa_order=#{order,jdbcType=INTEGER},</if>
      <if test="type != null">fa_type=#{type,jdbcType=INTEGER},</if>
      <if test="state != null">fa_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">fa_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">fa_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where fa_id = #{id,jdbcType=BIGINT}
  </update>
  <delete id="deleteByPrimaryKeyList" parameterType="java.util.List">
    delete from yeshi_ec_float_ad
    WHERE fa_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach>
  </delete>
  <select id="listQuery" resultMap="BaseResultMap">
      SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_float_ad fd
      WHERE 1=1
          <if test="key != null and key !='' ">
              AND fd.`fa_name` LIKE '%${key}%'
          </if>
          <if test="state != null">
               AND fd.`fa_state` =  #{state}
          </if>
      ORDER BY fd.`fa_position`,fd.`fa_order`
      LIMIT ${start},${count}
  </select>
  <select id="countQuery" resultType="java.lang.Long">
      SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd
      WHERE 1=1
          <if test="key != null and key !='' ">
              AND fd.`fa_name` LIKE '%${key}%'
          </if>
          <if test="state != null">
               AND fd.`fa_state` =  #{state}
          </if>
  </select>
   <select id="getMaxOrderByPosition" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(fa_order),0) FROM yeshi_ec_float_ad
        WHERE fa_position = #{position}
  </select>
   <select id="getByAdjoinOrder" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_float_ad fd
        WHERE  fd.`fa_position` = #{position}
        <if test="type == -1">
            AND fd.`fa_order` <![CDATA[<]]> #{order}
            ORDER BY fd.`fa_order` desc
        </if>
        <if test="type == 1">
            AND fd.`fa_order` <![CDATA[>]]> #{order}
            ORDER BY fd.`fa_order`
        </if>
        LIMIT 1
   </select>
    <select id="countByPosition" resultType="java.lang.Integer">
         SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd
         WHERE fd.`fa_position` = #{position}
   </select>
   <select id="ListByPrimaryKey" parameterType="java.util.List" resultMap="BaseResultMap">
       SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_float_ad
       WHERE fa_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach>
   </select>
       <select id="getEffectiveFloatAD" resultMap="BaseResultMap">
           SELECT * FROM yeshi_ec_float_ad fd
        WHERE fd.`fa_position` = #{position} AND fd.`fa_state` = 1
               AND IF(fd.`fa_start_time` IS NULL,TRUE,fd.`fa_start_time` <![CDATA[<=]]> NOW())
               AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]> NOW())
               <if test="type != null">
                   AND fa_type = #{type}
               </if>
        ORDER BY fd.`fa_order`
        LIMIT 1
       </select>
</mapper>
<?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.homemodule.FloatADMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.FloatAD">
    <id column="fa_id" property="id" jdbcType="BIGINT"/>
    <result column="fa_name" property="name" jdbcType="VARCHAR"/>
    <result column="fa_picture" property="picture" jdbcType="VARCHAR"/>
    <result column="fa_show_mode" property="showMode" jdbcType="VARCHAR"/>
    <result column="fa_params" property="params" jdbcType="VARCHAR"/>
    <result column="fa_jump_need_login" property="jumpNeedLogin" jdbcType="VARCHAR"/>
    <result column="fa_start_time" property="startTime" jdbcType="TIMESTAMP"/>
    <result column="fa_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="fa_position" property="position" jdbcType="VARCHAR"/>
    <result column="fa_order" property="order" jdbcType="INTEGER"/>
    <result column="fa_type" property="type" jdbcType="INTEGER"/>
    <result column="fa_state" property="state" jdbcType="INTEGER"/>
    <result column="fa_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="fa_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association property="jumpDetail"  column="fa_jumpid" javaType="com.yeshi.fanli.entity.common.JumpDetailV2">
            <id column="fa_jumpid" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad (fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{showMode,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpNeedLogin,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{position,jdbcType=VARCHAR},#{order,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">fa_id,</if>
      <if test="name != null">fa_name,</if>
      <if test="picture != null">fa_picture,</if>
      <if test="showMode != null">fa_show_mode,</if>
      <if test="jumpDetail != null">fa_jumpid,</if>
      <if test="params != null">fa_params,</if>
      <if test="jumpNeedLogin != null">fa_jump_need_login,</if>
      <if test="startTime != null">fa_start_time,</if>
      <if test="endTime != null">fa_end_time,</if>
      <if test="position != null">fa_position,</if>
      <if test="order != null">fa_order,</if>
      <if test="type != null">fa_type,</if>
      <if test="state != null">fa_state,</if>
      <if test="createTime != null">fa_create_time,</if>
      <if test="updateTime != null">fa_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="picture != null">#{picture,jdbcType=VARCHAR},</if>
      <if test="showMode != null">#{showMode,jdbcType=VARCHAR},</if>
      <if test="jumpDetail != null">#{jumpDetail.id,jdbcType=BIGINT},</if>
      <if test="params != null">#{params,jdbcType=VARCHAR},</if>
      <if test="jumpNeedLogin != null">#{jumpNeedLogin,jdbcType=VARCHAR},</if>
      <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="position != null">#{position,jdbcType=VARCHAR},</if>
      <if test="order != null">#{order,jdbcType=INTEGER},</if>
      <if test="type != null">#{type,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.bus.homemodule.FloatAD">update yeshi_ec_float_ad set fa_name = #{name,jdbcType=VARCHAR},fa_picture = #{picture,jdbcType=VARCHAR},fa_show_mode = #{showMode,jdbcType=VARCHAR},fa_jumpid = #{jumpDetail.id,jdbcType=BIGINT},fa_params = #{params,jdbcType=VARCHAR},fa_jump_need_login = #{jumpNeedLogin,jdbcType=VARCHAR},fa_start_time = #{startTime,jdbcType=TIMESTAMP},fa_end_time = #{endTime,jdbcType=TIMESTAMP},fa_position = #{position,jdbcType=VARCHAR},fa_order = #{order,jdbcType=INTEGER},fa_type = #{type,jdbcType=INTEGER},fa_state = #{state,jdbcType=INTEGER},fa_create_time = #{createTime,jdbcType=TIMESTAMP},fa_update_time = #{updateTime,jdbcType=TIMESTAMP} where fa_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">update yeshi_ec_float_ad
    <set>
      <if test="name != null">fa_name=#{name,jdbcType=VARCHAR},</if>
      <if test="picture != null">fa_picture=#{picture,jdbcType=VARCHAR},</if>
      <if test="showMode != null">fa_show_mode=#{showMode,jdbcType=VARCHAR},</if>
      <if test="jumpDetail != null">fa_jumpid=#{jumpDetail.id,jdbcType=BIGINT},</if>
      <if test="params != null">fa_params=#{params,jdbcType=VARCHAR},</if>
      <if test="jumpNeedLogin != null">fa_jump_need_login=#{jumpNeedLogin,jdbcType=VARCHAR},</if>
      <if test="startTime != null">fa_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">fa_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="position != null">fa_position=#{position,jdbcType=VARCHAR},</if>
      <if test="order != null">fa_order=#{order,jdbcType=INTEGER},</if>
      <if test="type != null">fa_type=#{type,jdbcType=INTEGER},</if>
      <if test="state != null">fa_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">fa_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">fa_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where fa_id = #{id,jdbcType=BIGINT}
  </update>
  <delete id="deleteByPrimaryKeyList" parameterType="java.util.List">
    delete from yeshi_ec_float_ad
    WHERE fa_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach>
  </delete>
  <select id="listQuery" resultMap="BaseResultMap">
      SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_float_ad fd
      WHERE 1=1
          <if test="key != null and key !='' ">
              AND fd.`fa_name` LIKE '%${key}%'
          </if>
          <if test="state != null">
               AND fd.`fa_state` =  #{state}
          </if>
      ORDER BY fd.`fa_position`,fd.`fa_order`
      LIMIT ${start},${count}
  </select>
  <select id="countQuery" resultType="java.lang.Long">
      SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd
      WHERE 1=1
          <if test="key != null and key !='' ">
              AND fd.`fa_name` LIKE '%${key}%'
          </if>
          <if test="state != null">
               AND fd.`fa_state` =  #{state}
          </if>
  </select>
   <select id="getMaxOrderByPosition" resultType="java.lang.Integer">
        SELECT IFNULL(MAX(fa_order),0) FROM yeshi_ec_float_ad
        WHERE fa_position = #{position}
  </select>
   <select id="getByAdjoinOrder" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_float_ad fd
        WHERE  fd.`fa_position` = #{position}
        <if test="type == -1">
            AND fd.`fa_order` <![CDATA[<]]> #{order}
            ORDER BY fd.`fa_order` desc
        </if>
        <if test="type == 1">
            AND fd.`fa_order` <![CDATA[>]]> #{order}
            ORDER BY fd.`fa_order`
        </if>
        LIMIT 1
   </select>
    <select id="countByPosition" resultType="java.lang.Integer">
         SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd
         WHERE fd.`fa_position` = #{position}
   </select>
   <select id="ListByPrimaryKey" parameterType="java.util.List" resultMap="BaseResultMap">
       SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_float_ad
       WHERE fa_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach>
   </select>
       <select id="getEffectiveFloatAD" resultMap="BaseResultMap">
           SELECT * FROM yeshi_ec_float_ad fd
        WHERE fd.`fa_position` = #{position} AND fd.`fa_state` = 1
               AND IF(fd.`fa_start_time` IS NULL,TRUE,fd.`fa_start_time` <![CDATA[<=]]> NOW())
               AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]> NOW())
               <if test="type != null">
                   AND fa_type = #{type}
               </if>
        ORDER BY fd.`fa_order`
        LIMIT 1
       </select>
       <select id="getValidFloatAD" resultMap="BaseResultMap">
           SELECT * FROM yeshi_ec_float_ad fd
        WHERE fd.`fa_position` = #{position} AND fd.`fa_state` = 1
               AND IF(fd.`fa_start_time` IS NULL,TRUE,fd.`fa_start_time` <![CDATA[<=]]> NOW())
               AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]> NOW())
               <if test="type != null">
                   AND fa_type = #{type}
               </if>
        ORDER BY fd.`fa_order`
       </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackWinInviteMapper.xml
@@ -79,4 +79,9 @@
    WHERE d.`rwr_uid` = #{uid}
  </select>
  
  <select id="getRewardMoney" resultType="BigDecimal">
      SELECT IFNULL(SUM(d.`rwr_money`),0) FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid}
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java
@@ -283,5 +283,15 @@
        return floatAD;
    }
    
    @Override
    public List<FloatAD> getValidCommonByPosition(String position) {
        return floatADMapper.getValidFloatAD(position, 1);
    }
    @Override
    public List<FloatAD> getValidByPosition(String position) {
        return floatADMapper.getValidFloatAD(position, null);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
@@ -78,6 +78,12 @@
        return redPackWinInviteMapper.countRewardRecord(uid);
    }
    
    @Override
    public BigDecimal getRewardMoney(Long uid) {
        return redPackWinInviteMapper.getRewardMoney(uid);
    }
    @RedPackGetVersionLimit(uid = "#uid")
    @RequestSerializableByKeyService(key = "#uid")
    @Transactional(rollbackFor = Exception.class)
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinNewUserServiceImpl.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.dao.mongodb.redpack.RedPackWinNewUserDao;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.redpack.RedPackWinNewUser;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
@@ -42,10 +43,52 @@
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    
    
    @Override
    public boolean verifyHasReward(Long uid) {
        try {
            if (uid == null || uid <= 0)
                return true; // 未登录弹出
            UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
            if (userInfoExtra == null || userInfoExtra.getFirstLoginTime() == null)
                return false;
            Date nowTime = new Date();
            Date firstLoginTime = userInfoExtra.getFirstLoginTime();
            int days = DateUtil.daysBetween2(firstLoginTime, nowTime);
            if (days > Constant.RED_PACK_NEW_USER_DAYS)
                return false; // 已经超出设置天数
            RedPackWinNewUser redPackWin = redPackWinNewUserDao.getByUid(uid);
            if (redPackWin != null) {
                if (redPackWin.getMoney().compareTo(Constant.RED_PACK_NEW_USER_MONEY) >= 0)
                    return false; // 已领取完
                Date updateTime = redPackWin.getUpdateTime();
                int daysNum = DateUtil.daysBetween2(updateTime, nowTime);
                if (daysNum == 0)
                    return false; // 今日已领取
                Integer num = redPackWin.getNum();
                if (num >= Constant.RED_PACK_NEW_USER_DAYS)
                    return false; // 领取次数超限
            }
            return true;
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        return false;
    }
    @RequestSerializableByKeyService(key = "#uid")
    @Transactional(rollbackFor = Exception.class)
    @Override
    public RedPackWinDetailVO receiveReward(Long uid) throws Exception {
        if (uid == null || uid <= 0)
            return null; // 未登录弹出
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null || userInfoExtra.getFirstLoginTime() == null) 
            return null;
@@ -77,14 +120,15 @@
                money = Constant.RED_PACK_NEW_USER_MONEY;
            } else { // 计算随机奖励
                double randomNum = Constant.RED_PACK_NEW_USER_MIN +  Math.random() * (Constant.RED_PACK_NEW_USER_MAX - Constant.RED_PACK_NEW_USER_MIN);
                BigDecimal rate = new BigDecimal(randomNum/100).setScale(2);
                randomNum = randomNum/100;
                BigDecimal rate = new BigDecimal(randomNum).setScale(2, BigDecimal.ROUND_DOWN);
                money = MoneyBigDecimalUtil.mul(Constant.RED_PACK_NEW_USER_MONEY,rate);
            }
        } else if (days == Constant.RED_PACK_NEW_USER_DAYS) { // 最后一天
            money = MoneyBigDecimalUtil.sub(Constant.RED_PACK_NEW_USER_MONEY, redPackWin.getMoney());
        } else { // 计算剩余随机奖励 10%-25% 
            double randomNum = 10 +  Math.random() * (20 - 10);
            BigDecimal rate = new BigDecimal(randomNum/100).setScale(2);
            BigDecimal rate = new BigDecimal(randomNum/100).setScale(2, BigDecimal.ROUND_DOWN);
            money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.sub(Constant.RED_PACK_NEW_USER_MONEY,redPackWin.getMoney()),rate);
        }
        
fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/FloatADService.java
@@ -58,5 +58,20 @@
     */
    public FloatAD getEffectiveFloatAD(String position, Integer type);
    /**
     * 返回多个 - 常规活动(不包含新人)
     * @param position
     * @param type
     * @return
     */
    public List<FloatAD> getValidCommonByPosition(String position);
    /**
     * 返回多个 - 所有活动
     * @param position
     * @return
     */
    public List<FloatAD> getValidByPosition(String position);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinInviteService.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.inter.redpack;
import java.math.BigDecimal;
import java.util.List;
import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
@@ -37,5 +38,12 @@
     * @throws Exception
     */
    public void inviteSucceedReward(Long uid) throws Exception;
    /**
     * 统计总领取金额
     * @param uid
     * @return
     */
    public BigDecimal getRewardMoney(Long uid);
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinNewUserService.java
@@ -12,6 +12,13 @@
     */
    public RedPackWinDetailVO receiveReward(Long uid) throws Exception;
    /**
     * 验证是否可领取红包
     * @param uid
     * @return
     */
    public boolean verifyHasReward(Long uid);
    
    
}
fanli/src/main/java/com/yeshi/fanli/vo/homemodule/FloatImgDetailVO.java
New file
@@ -0,0 +1,66 @@
package com.yeshi.fanli.vo.homemodule;
import com.google.gson.annotations.Expose;
public class FloatImgDetailVO {
    @Expose
    private String id;
    @Expose
    private String img;
    @Expose
    private String params;
    @Expose
    private Object jumpDetail;
    @Expose
    private String showTime;
    @Expose
    private boolean accountLogin;
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getParams() {
        return params;
    }
    public void setParams(String params) {
        this.params = params;
    }
    public Object getJumpDetail() {
        return jumpDetail;
    }
    public void setJumpDetail(Object jumpDetail) {
        this.jumpDetail = jumpDetail;
    }
    public String getShowTime() {
        return showTime;
    }
    public void setShowTime(String showTime) {
        this.showTime = showTime;
    }
    public boolean getAccountLogin() {
        return accountLogin;
    }
    public void setAccountLogin(boolean accountLogin) {
        this.accountLogin = accountLogin;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
}