DrawlineActivityRest.md 18.9 KB

平台端排队活动接口服务定义


获取排队活动列表接口

接口名: /DrawlineActivityRest/getDrawlineActivityList

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityName String 活动23451 活动名称 255
status String 1 状态(0-无效;1-有效;2-未过期) 1

响应码


响应码code 消息 说明
200 操作成功.

返回

{
    "code": 200,
    "message": "",
    "data": {
        "code": 200,
        "data": {
            "list": [
                {
                    "activityDesc": "",
                    "activityId": 110,
                    "activityName": "活动长江9号",
                    "backgroundStyle": "",
                    "beginTime": 1462503000,
                    "beginTimeStr": "2016-05-06 10:50",
                    "createTime": 1461896820,
                    "endTime": 1464926100,
                    "endTimeStr": "2016-06-03 11:55",
                    "numberLimit": 25,
                    "prizeList": [],
                    "status": 1,
                    "topBanner": "http://img13.static.yhbimg.com/activity/2016/04/29/10/02af486f1c3038ed1cbfb9cfdefe494d52.jpg",
                    "updateTime": 1461896820,
                    "winInfo": {
                        "realNum": 0,
                        "realSurplus": 0,
                        "realWinNum": 0,
                        "totalAttend": 0,
                        "totalSurplus": 0,
                        "totalWin": 0,
                        "virtualNum": 0,
                        "virtualSurplus": 0,
                        "virtualWinNum": 0
                    }
                },
                {
                    "activityId": 93,
                    "activityName": "SYJ-排队获得限购码",
                    "backgroundStyle": "http://img12.static.yhbimg.com/activity/2016/03/31/14/020ed3140cdb813dd8a7cd39a2117ec071.png,http://img10.static.yhbimg.com/activity/2016/03/31/14/011cdf949256e475b044264d496d20e69b.png,http://img11.static.yhbimg.com/activity/2016/03/31/14/0162502e6d3974f5092b0dcb9fae460a9b.png,http://img10.static.yhbimg.com/activity/2016/03/31/14/01b917384f01b1cbb6b8d3a67ad4621c2c.png,http://img11.static.yhbimg.com/activity/2016/03/31/14/0112ca79df77163f3854fec02ca6011ff5.png,http://img12.static.yhbimg.com/activity/2016/03/31/14/02e39b127235728d1baffd4458c6c3144c.png,http://img13.static.yhbimg.com/activity/2016/03/31/14/021e3c9ffa210834f25f2283de803b93de.png,http://img12.static.yhbimg.com/activity/2016/03/31/14/025b7c863c56984886b5a1bc5c8f77f5f4.png",
                    "beginTime": 1459267200,
                    "beginTimeStr": "2016-03-30 00:00",
                    "createTime": 1459405612,
                    "endTime": 1463284800,
                    "endTimeStr": "2016-05-15 12:00",
                    "numberLimit": 0,
                    "prizeList": [],
                    "status": 1,
                    "topBanner": "http://img13.static.yhbimg.com/activity/2016/03/31/14/029ebb894be4c65d730b2e89a092f1bec5.png",
                    "updateTime": 1459430585,
                    "winInfo": {
                        "realNum": 9,
                        "realSurplus": 90,
                        "realWinNum": 10,
                        "totalAttend": 9,
                        "totalSurplus": 90,
                        "totalWin": 10,
                        "virtualNum": 0,
                        "virtualSurplus": 0,
                        "virtualWinNum": 0
                    }
                },

            ],
            "page": 1,
            "size": 10,
            "total": 75,
            "totalPage": 8
        },
        "message": "操作成功"
    }
}

根据活动ID查询详情接口

接口名: /DrawlineActivityRest/getDrawlineActivityDetail

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityId Integer 83 活动Id 11

对应SQL的操作库表

<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List" />
        from drawline_activity
        where id = #{id,jdbcType=INTEGER}
    </select>
<select id="selectByActivityIds" resultMap="BaseResultMap">
        select <include refid="Base_Column_List" /> from drawline_prize_setting where activity_id in (${activityIds})
    </select>

响应码


响应码code 消息 说明
200 操作成功.

返回

{
    "code": 200,
    "message": "",
    "data": {
        "code": 200,
        "data": {
            "activityDesc": "",
            "activityId": 110,
            "activityName": "活动长江9号",
            "backgroundStyle": "",
            "beginTime": 1462503000,
            "beginTimeStr": "2016-05-06 10:50",
            "createTime": 1461896820,
            "endTime": 1464926100,
            "endTimeStr": "2016-06-03 11:55",
            "numberLimit": 25,
            "prizeList": [],
            "status": 1,
            "topBanner": "http://img13.static.yhbimg.com/activity/2016/04/29/10/02af486f1c3038ed1cbfb9cfdefe494d52.jpg",
            "updateTime": 1461896820,
            "winInfo": {
                "realNum": 0,
                "realSurplus": 0,
                "realWinNum": 0,
                "totalAttend": 0,
                "totalSurplus": 0,
                "totalWin": 0,
                "virtualNum": 0,
                "virtualSurplus": 0,
                "virtualWinNum": 0
            }
        },
        "message": "操作成功"
    }
}

根据活动ID检查活动是否存在接口

接口名: /DrawlineActivityRest/checkActivityIdExists

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityId Integer 83 活动Id 11

响应码


响应码code 消息 说明
200 操作成功.

返回

{
    "code": 200,
    "data": {
        "exists": false
    },
    "message": "操作成功"
}

新增排队活动接口

接口名: /DrawlineActivityRest/addDrawlineActivity

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityName String 活动名称 255
beginTime int 活动开始时间
endTime int 活动结束时间
activityDesc int 活动描述 255
prizeList int 奖品列表 255
numberLimit int 排队人数上限 8

对应SQL的操作库表

<insert id="insert" useGeneratedKeys="true" keyProperty="id"
        parameterType="com.yohobuy.platform.dal.activity.model.DrawlineActivity">
        insert into drawline_activity (activity_name,
        begin_time,
        end_time, top_banner,
        background_style, activity_desc,
        create_time, update_time,number_limit)
        values (#{activityName,jdbcType=VARCHAR},
        #{beginTime,jdbcType=INTEGER},
        #{endTime,jdbcType=INTEGER},
        #{topBanner,jdbcType=VARCHAR},
        #{backgroundStyle,jdbcType=VARCHAR},
        #{activityDesc,jdbcType=VARCHAR},#{createTime}, #{updateTime},#{numberLimit})
    </insert>
<insert id="batchInsert">
        insert into drawline_prize_setting (activity_id,prize, prize_type,white_list, real_user_num, sock_user_num, create_time, update_time)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.activityId},#{item.prize},#{item.prizeType},#{item.whiteList},#{item.realUserNum},#{item.sockUserNum},#{item.createTime},#{item.updateTime})
        </foreach>
    </insert>

响应码


响应码code 消息 说明
200 活动创建成功.
500 活动名称不能为空/活动名称已经存在

返回

{
    "code": 200,
    "data": [],
    "md5": "d751713988987e9331980363e24189ce",
    "message": "活动创建成功."
}

更新排队活动接口

接口名: /DrawlineActivityRest/updateDrawlineActivity

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityId int 活动ID 11
activityName String 活动名称 255
beginTime int 活动开始时间
endTime int 活动结束时间
activityDesc int 活动描述 255
prizeList int 奖品列表 255

响应码


响应码code 消息 说明
200 活动修正成功.
500 活动id不能为0/活动名称不能为空/活动名称已经存在
    <update id="updateByPrimaryKeySelective" parameterType="com.yohobuy.platform.dal.activity.model.DrawlineActivity">
        update drawline_activity
        <set>
            <if test="activityName != null">
                activity_name = #{activityName,jdbcType=VARCHAR},
            </if>
            <if test="beginTime != null">
                begin_time = #{beginTime,jdbcType=INTEGER},
            </if>
            <if test="endTime != null">
                end_time = #{endTime,jdbcType=INTEGER},
            </if>
            <if test="topBanner != null">
                top_banner = #{topBanner,jdbcType=VARCHAR},
            </if>
            <if test="backgroundStyle != null">
                background_style = #{backgroundStyle,jdbcType=VARCHAR},
            </if>
            <if test="activityDesc != null">
                activity_desc = #{activityDesc,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=TINYINT},
            </if>
            <if test="updateTime != null">
                update_time=#{updateTime},
            </if>
            <if test="numberLimit != null">
                number_limit=#{numberLimit},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
<update id="updateByPrimaryKeySelective"
        parameterType="com.yohobuy.platform.dal.activity.model.DrawlinePrizeSetting">
        update drawline_prize_setting
        <set>
            <if test="prize != null">
                prize = #{prize,jdbcType=VARCHAR},
            </if>
            <if test="prizeType != null">
                prize_type = #{prizeType,jdbcType=TINYINT},
            </if>
            <if test="activityId != null">
                activity_id = #{activityId,jdbcType=TINYINT},
            </if>
            <if test="whiteList != null">
                white_list = #{whiteList,jdbcType=VARCHAR},
            </if>
            <if test="realUserNum != null">
                real_user_num = #{realUserNum,jdbcType=INTEGER},
            </if>
            <if test="sockUserNum != null">
                sock_user_num = #{sockUserNum,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

返回

{
    "code": 200,
    "data": [],
    "md5": "d751713988987e9331980363e24189ce",
    "message": "活动修正成功."
}

开启活动状态接口

接口名: /DrawlineActivityRest/openActivity

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityId int 活动ID 11

响应码


响应码code 消息 说明
200 活动开启成功
500 输入的状态值不正确

返回

{
    "code": 200,
    "data": [],
    "md5": "d751713988987e9331980363e24189ce",
    "message": "活动开启成功."
}

关闭活动状态接口

接口名: /DrawlineActivityRest/closeActivity

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityId int 活动ID 11

响应码


响应码code 消息 说明
200 活动关闭成功
500 输入的状态值不正确

返回

{
    "code": 200,
    "data": [],
    "md5": "d751713988987e9331980363e24189ce",
    "message": "活动关闭成功."
}

按活动抽奖接口

接口名: /DrawlineActivityRest/luckyUserDraw

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
activityId int 活动ID 11

<select id="selectByActivityId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from drawline_lucky_user_bak
    where activity_id = #{activityId,jdbcType=INTEGER}
  </select>
<insert id="insertBatch" parameterType="java.util.List">
        insert into drawline_lucky_user (sid, activity_id, queue_time, status, create_time, update_time, uid, user_type)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.sid}, #{item.activityId}, #{item.queueTime}, #{item.status}, #{item.createTime}, #{item.updateTime}, #{item.uid},
            #{item.userType})
        </foreach>
    </insert>
<select id="selectLimitProductByActivityId" resultMap="BaseResultMap">
     select <include refid="Base_Column_List" />  
     from limit_product where activity_id = #{activityId,jdbcType=INTEGER}
  </select>
<select id="getSpecialCountLimitCodeNotUse" resultType="java.lang.String" >
    select code 
    from limit_code_batchno  
    where batchNo = #{batchNo, jdbcType=VARCHAR} and status=0
    limit #{limit,jdbcType=INTEGER}
  </select>
<insert id="batchAddLimitCodeReceiveRecord" parameterType="java.util.List" >
    insert into limit_code_receive_record (id, uid, limit_code, 
      batchno, limit_product_code, productSkn, 
      productSku, is_use, create_time, 
      update_time)
    values
    <foreach collection="list" item="item" index="index" separator=",">
     (#{item.id,jdbcType=INTEGER},#{item.uid,jdbcType=INTEGER}, #{item.limitCode,jdbcType=VARCHAR}, 
      #{item.batchno,jdbcType=VARCHAR}, #{item.limitProductCode,jdbcType=VARCHAR}, #{item.productskn,jdbcType=VARCHAR}, 
      #{item.productsku,jdbcType=VARCHAR}, #{item.isUse,jdbcType=TINYINT}, #{item.createTime,jdbcType=INTEGER}, 
      #{item.updateTime,jdbcType=INTEGER})
      </foreach>
  </insert>
<update id="batchUpdateLimitCodeUseFlag" parameterType="java.util.List">
    update limit_code_batchno
    set status = 1
    where batchNo = #{batchNo,jdbcType=VARCHAR} and code in
    <foreach collection="list" item="item" open="(" close=")" separator=",">
        #{item}
    </foreach>
  </update>
<update id="updatePrizeStatusByActIdAndUids">
        update drawline_lucky_user
        set is_send_prize = 1
        where status = 1 and user_type = 1
        and activity_id = #{activityId,jdbcType=INTEGER} 
        <if test="list != null and list.size() > 0">
            and uid in
            <foreach collection="list" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
    </update>
<select id="selectByActivityIds" resultMap="BaseResultMap">
        select <include refid="Base_Column_List" /> from drawline_prize_setting where activity_id in (${activityIds})
    </select>

响应码


响应码code 消息 说明
200 抽奖成功
400 入口参数的活动id不能为空.
500 没有导入的中奖用户数据./抽奖数据异常/该活动对应的限定商品情报没有./该活动的限购码数量不够!/该活动的奖项设置不存在

返回

{
    "code": 200,
    "data": [],
    "md5": "d751713988987e9331980363e24189ce",
    "message": "抽奖成功."
}

导出排队用户接口

接口名: /batch/export

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
queryConf String activityId:123 查询条件 11
type String drawlineUserQueue 类型 255

<select id="selectDrawlineQueueUser" resultMap="DrawlineQueueUserMap">
        SELECT
    a.activity_id,
    a.sort,
    a.uid,
    c.product_sku
FROM
    yoho_activity.drawline_user_queue a
LEFT JOIN yh_shops.limit_product b ON a.activity_id = b.activityId
LEFT JOIN yh_shops.limit_product_sku c ON a.uid = c.uid
AND b.productSkn = c.product_skn
WHERE
    a.activity_id= #{activityId,jdbcType=INTEGER}
    </select>

返回

EXCLE文件,文件格式如下: ACTIVITY_ID|SN|UID|SKU

导出中奖用户接口

接口名: /batch/import

方法

POST JSONRAW

入参


属性名称 类型 例子 说明 是否必填 长度限制
file MultipartFile 文件
type String drawlineUserQueue 类型 255

EXCEL中的文件格式如下: ACTIVITY_ID|SN|UID|SKU

<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List" />
        from drawline_activity
        where id = #{id,jdbcType=INTEGER}
    </select>
<select id="selectByActivityId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
        select 
        <include refid="Base_Column_List" />
        from drawline_user_queue
        where activity_id = #{activityId,jdbcType=INTEGER}
    </select>
 <delete id="deleteByActivityId" parameterType="java.lang.Integer" >
    delete from drawline_lucky_user_bak
    where activity_id = #{activity_id,jdbcType=INTEGER}
  </delete>
<insert id="insertBatch" parameterType="java.util.List">
        insert into drawline_lucky_user_bak (sid, activity_id, queue_time, status, create_time, update_time, uid, user_type)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.sid}, #{item.activityId}, #{item.queueTime}, #{item.status}, #{item.createTime}, #{item.updateTime}, #{item.uid},
            #{item.userType})
        </foreach>
    </insert>

### 响应码

-------------------------
|响应码code|消息|说明|
|--------|----|----|
|200| 处理成功| |
|400| 导入表格没有数据!/导入表格活动ID不一致!/活动不存在!activityId/该活动没有排队用户,不能开奖!activityId:/存在没有排队的用户:| |