x1ongzhu há 6 anos atrás
pai
commit
8b61729b34
26 ficheiros alterados com 2373 adições e 614 exclusões
  1. 2 2
      src/main/java/com/izouma/awesomeadmin/dao/AwardInfoMapper.xml
  2. 37 0
      src/main/java/com/izouma/awesomeadmin/dao/DrawRecordMapper.java
  3. 345 0
      src/main/java/com/izouma/awesomeadmin/dao/DrawRecordMapper.xml
  4. 7 3
      src/main/java/com/izouma/awesomeadmin/dao/DrawSessionMapper.java
  5. 143 126
      src/main/java/com/izouma/awesomeadmin/dao/DrawSessionMapper.xml
  6. 38 17
      src/main/java/com/izouma/awesomeadmin/dao/SystemConfigMapper.xml
  7. 116 0
      src/main/java/com/izouma/awesomeadmin/model/DrawRecord.java
  8. 13 5
      src/main/java/com/izouma/awesomeadmin/model/SystemConfig.java
  9. 30 0
      src/main/java/com/izouma/awesomeadmin/service/DrawRecordService.java
  10. 12 0
      src/main/java/com/izouma/awesomeadmin/service/DrawService.java
  11. 4 3
      src/main/java/com/izouma/awesomeadmin/service/DrawSessionService.java
  12. 12 3
      src/main/java/com/izouma/awesomeadmin/service/SystemConfigService.java
  13. 150 0
      src/main/java/com/izouma/awesomeadmin/service/impl/DrawRecordServiceImpl.java
  14. 146 0
      src/main/java/com/izouma/awesomeadmin/service/impl/DrawServiceImpl.java
  15. 26 18
      src/main/java/com/izouma/awesomeadmin/service/impl/DrawSessionServiceImpl.java
  16. 74 18
      src/main/java/com/izouma/awesomeadmin/service/impl/SystemConfigServiceImpl.java
  17. 41 0
      src/main/java/com/izouma/awesomeadmin/web/DrawController.java
  18. 120 0
      src/main/java/com/izouma/awesomeadmin/web/DrawRecordController.java
  19. 11 29
      src/main/java/com/izouma/awesomeadmin/web/DrawSessionController.java
  20. 6 5
      src/main/java/com/izouma/awesomeadmin/web/SystemConfigController.java
  21. 355 373
      src/main/vue/src/pages/AwardInfos.vue
  22. 170 0
      src/main/vue/src/pages/DrawRecord.vue
  23. 473 0
      src/main/vue/src/pages/DrawRecords.vue
  24. 12 7
      src/main/vue/src/pages/SystemConfig.vue
  25. 20 5
      src/main/vue/src/pages/SystemConfigs.vue
  26. 10 0
      src/main/vue/src/router/index.js

+ 2 - 2
src/main/java/com/izouma/awesomeadmin/dao/AwardInfoMapper.xml

@@ -644,8 +644,8 @@
         SELECT
         <include refid="Base_Column_List"/>, rand() AS rand
         FROM award_info
-        WHERE del_flag = 'N' AND collected = 0 AND transferred = 0
-        ORDER BY rand LIMIT #{num}
+        WHERE del_flag = 'N' AND transferred = 0
+        ORDER BY collected, rand LIMIT #{num}
     </select>
 </mapper>
 

+ 37 - 0
src/main/java/com/izouma/awesomeadmin/dao/DrawRecordMapper.java

@@ -0,0 +1,37 @@
+package com.izouma.awesomeadmin.dao;
+
+import java.util.*;
+
+import com.izouma.awesomeadmin.datasource.DataSource;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+import com.izouma.awesomeadmin.model.DrawRecord;
+
+
+/**
+ * Dao接口
+ */
+@Repository("com.zoumaframe.dao.DrawRecordMapper")
+public interface DrawRecordMapper {
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(DrawRecord record);
+
+    DrawRecord selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(DrawRecord record);
+
+    List<DrawRecord> queryAllDrawRecord(DrawRecord record);
+
+    List<DrawRecord> queryDrawRecordByPage(Map<String, Object> parameter);
+
+    int delete(DrawRecord record);
+
+    DrawRecord queryDrawRecord(DrawRecord record);
+
+    List<DrawRecord> query(DrawRecord record);
+
+    List<DrawRecord> queryTodayDrawRecord(@Param("userId") int userId);
+}
+

+ 345 - 0
src/main/java/com/izouma/awesomeadmin/dao/DrawRecordMapper.xml

@@ -0,0 +1,345 @@
+<?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.izouma.awesomeadmin.dao.DrawRecordMapper">
+    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.DrawRecord">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
+        <result column="user_id" property="userId" jdbcType="INTEGER"/>
+        <result column="session_id" property="sessionId" jdbcType="INTEGER"/>
+        <result column="integral" property="integral" jdbcType="INTEGER"/>
+        <result column="win" property="win" jdbcType="BIT"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        id, del_flag, user_id, session_id, integral, win, create_time    </sql>
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
+        select
+        <include refid="Base_Column_List"/>
+        from draw_record
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        DELETE
+        FROM draw_record
+        WHERE id = #{id,jdbcType=INTEGER}
+    </delete>
+    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.DrawRecord" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into draw_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id!= null">
+                id,
+            </if>
+            <if test="delFlag!= null">
+                del_flag,
+            </if>
+            <if test="userId!= null">
+                user_id,
+            </if>
+            <if test="sessionId!= null">
+                session_id,
+            </if>
+            <if test="integral!= null">
+                integral,
+            </if>
+            <if test="win!= null">
+                win,
+            </if>
+            <if test="createTime!= null">
+                create_time,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=INTEGER},
+            </if>
+            <if test="delFlag != null">
+                #{delFlag,jdbcType=CHAR},
+            </if>
+            <if test="userId != null">
+                #{userId,jdbcType=INTEGER},
+            </if>
+            <if test="sessionId != null">
+                #{sessionId,jdbcType=INTEGER},
+            </if>
+            <if test="integral != null">
+                #{integral,jdbcType=INTEGER},
+            </if>
+            <if test="win != null">
+                #{win,jdbcType=BIT},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.DrawRecord">
+        update draw_record
+        <set>
+            <if test="id != null">
+                id= #{id,jdbcType=INTEGER},
+            </if>
+            <if test="delFlag != null">
+                del_flag= #{delFlag,jdbcType=CHAR},
+            </if>
+            <if test="userId != null">
+                user_id= #{userId,jdbcType=INTEGER},
+            </if>
+            <if test="sessionId != null">
+                session_id= #{sessionId,jdbcType=INTEGER},
+            </if>
+            <if test="integral != null">
+                integral= #{integral,jdbcType=INTEGER},
+            </if>
+            <if test="win != null">
+                win= #{win,jdbcType=BIT},
+            </if>
+            <if test="createTime != null">
+                create_time= #{createTime,jdbcType=TIMESTAMP},
+            </if>
+        </set>
+        where
+        <if test="id != null and !&quot;&quot;.equals(id)">
+            id = #{id,jdbcType=INTEGER}
+        </if>
+
+        <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+            id in (${idStr})
+        </if>
+    </update>
+    <select id="queryDrawRecordByPage" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.DrawRecord">
+        select
+        <include refid="Base_Column_List"/>
+        from draw_record
+        <where>
+            and del_flag = 'N'
+            <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
+                and id in (${record.idStr})
+            </if>
+            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
+                and id = #{record.id}
+            </if>
+            <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
+                and del_flag = #{record.delFlag}
+            </if>
+            <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
+                and user_id = #{record.userId}
+            </if>
+            <if test="record.sessionId != null and !&quot;&quot;.equals(record.sessionId)">
+                and session_id = #{record.sessionId}
+            </if>
+            <if test="record.integral != null and !&quot;&quot;.equals(record.integral)">
+                and integral = #{record.integral}
+            </if>
+            <if test="record.win != null and !&quot;&quot;.equals(record.win)">
+                and win = #{record.win}
+            </if>
+            <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
+                and create_time = #{record.createTime}
+            </if>
+            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR user_id LIKE concat('%',#{record.searchKey},'%')
+                    OR session_id LIKE concat('%',#{record.searchKey},'%')
+                </trim>
+            </if>
+
+            <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
+                <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
+            </if>
+
+        </where>
+        order by
+
+        <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
+
+
+            <trim suffixOverrides=",">
+                <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
+                    <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                        ${itemDetail}
+                    </foreach>
+                </foreach>
+            </trim>
+            ,
+        </if>
+        id desc
+    </select>
+    <select id="queryAllDrawRecord" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawRecord">
+        select
+        <include refid="Base_Column_List"/>
+        from draw_record
+        <where>
+            and del_flag = 'N'
+            <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+                and id in (${idStr})
+            </if>
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                and user_id = #{userId}
+            </if>
+            <if test="sessionId != null and !&quot;&quot;.equals(sessionId)">
+                and session_id = #{sessionId}
+            </if>
+            <if test="integral != null and !&quot;&quot;.equals(integral)">
+                and integral = #{integral}
+            </if>
+            <if test="win != null and !&quot;&quot;.equals(win)">
+                and win = #{win}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR user_id LIKE concat('%',#{searchKey},'%')
+                    OR session_id LIKE concat('%',#{searchKey},'%')
+                </trim>
+            </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
+            </if>
+        </where>
+        order by
+
+        <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
+
+
+            <trim suffixOverrides=",">
+                <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
+                    <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                        ${itemDetail}
+                    </foreach>
+                </foreach>
+            </trim>
+            ,
+        </if>
+
+        id desc
+    </select>
+    <select id="queryDrawRecord" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawRecord">
+        select
+        <include refid="Base_Column_List"/>
+        from draw_record
+        <where>
+            and del_flag = 'N'
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                and user_id = #{userId}
+            </if>
+            <if test="sessionId != null and !&quot;&quot;.equals(sessionId)">
+                and session_id = #{sessionId}
+            </if>
+            <if test="integral != null and !&quot;&quot;.equals(integral)">
+                and integral = #{integral}
+            </if>
+            <if test="win != null and !&quot;&quot;.equals(win)">
+                and win = #{win}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+
+        </where>
+        LIMIT 1
+    </select>
+    <update id="delete">
+        UPDATE draw_record SET del_flag = 'Y'
+        where
+        <if test="id != null and !&quot;&quot;.equals(id)">
+            id = #{id,jdbcType=INTEGER}
+        </if>
+
+        <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+            id in (${idStr})
+        </if>
+    </update>
+    <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawRecord">
+        select
+        <include refid="Base_Column_List"/>
+        from draw_record
+        <where>
+            and del_flag = 'N'
+        </where>
+        order by id desc
+    </select>
+    <select id="queryTodayDrawRecord" resultType="com.izouma.awesomeadmin.model.DrawRecord">
+        SELECT *
+        FROM draw_record
+        WHERE to_days(create_time) = to_days(now()) AND del_flag = 'N';
+    </select>
+</mapper>
+

+ 7 - 3
src/main/java/com/izouma/awesomeadmin/dao/DrawSessionMapper.java

@@ -1,16 +1,18 @@
 package com.izouma.awesomeadmin.dao;
 
 import java.util.*;
+
 import com.izouma.awesomeadmin.datasource.DataSource;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 import com.izouma.awesomeadmin.model.DrawSession;
 
 
 /**
-*  Dao接口
-*/
+ * Dao接口
+ */
 @Repository("com.zoumaframe.dao.DrawSessionMapper")
-public interface DrawSessionMapper{
+public interface DrawSessionMapper {
 
     int deleteByPrimaryKey(Integer id);
 
@@ -29,5 +31,7 @@ public interface DrawSessionMapper{
     DrawSession queryDrawSession(DrawSession record);
 
     List<DrawSession> query(DrawSession record);
+
+    int setExpire(@Param("userId") Integer userId);
 }
 

+ 143 - 126
src/main/java/com/izouma/awesomeadmin/dao/DrawSessionMapper.xml

@@ -1,91 +1,93 @@
 <?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.izouma.awesomeadmin.dao.DrawSessionMapper" >
-    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.DrawSession" >
-                <id column="id" property="id" jdbcType="INTEGER" />
-                                        <result column="del_flag" property="delFlag" jdbcType="CHAR" />
-                                <result column="user_id" property="userId" jdbcType="INTEGER" />
-                                <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP" />
-                                <result column="expired" property="expired" jdbcType="BIT" />
-                                <result column="award_ids" property="awardIds" jdbcType="VARCHAR" />
-            </resultMap>
-    <sql id="Base_Column_List" >
+<mapper namespace="com.izouma.awesomeadmin.dao.DrawSessionMapper">
+    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.DrawSession">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
+        <result column="user_id" property="userId" jdbcType="INTEGER"/>
+        <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP"/>
+        <result column="expired" property="expired" jdbcType="BIT"/>
+        <result column="award_ids" property="awardIds" jdbcType="VARCHAR"/>
+    </resultMap>
+    <sql id="Base_Column_List">
         id, del_flag, user_id, expire_time, expired, award_ids    </sql>
-    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
         select
-        <include refid="Base_Column_List" />
+        <include refid="Base_Column_List"/>
         from draw_session
         where id = #{id,jdbcType=INTEGER}
     </select>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
-        delete from draw_session
-        where id = #{id,jdbcType=INTEGER}
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        DELETE
+        FROM draw_session
+        WHERE id = #{id,jdbcType=INTEGER}
     </delete>
-    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.DrawSession" useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.DrawSession" useGeneratedKeys="true"
+            keyProperty="id">
         insert into draw_session
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-                <if test="id!= null" >
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id!= null">
                 id,
             </if>
-                <if test="delFlag!= null" >
+            <if test="delFlag!= null">
                 del_flag,
             </if>
-                <if test="userId!= null" >
+            <if test="userId!= null">
                 user_id,
             </if>
-                <if test="expireTime!= null" >
+            <if test="expireTime!= null">
                 expire_time,
             </if>
-                <if test="expired!= null" >
+            <if test="expired!= null">
                 expired,
             </if>
-                <if test="awardIds!= null" >
+            <if test="awardIds!= null">
                 award_ids,
             </if>
-            </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-                    <if test="id != null" >
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
                 #{id,jdbcType=INTEGER},
             </if>
-                    <if test="delFlag != null" >
+            <if test="delFlag != null">
                 #{delFlag,jdbcType=CHAR},
             </if>
-                    <if test="userId != null" >
+            <if test="userId != null">
                 #{userId,jdbcType=INTEGER},
             </if>
-                    <if test="expireTime != null" >
+            <if test="expireTime != null">
                 #{expireTime,jdbcType=TIMESTAMP},
             </if>
-                    <if test="expired != null" >
+            <if test="expired != null">
                 #{expired,jdbcType=BIT},
             </if>
-                    <if test="awardIds != null" >
+            <if test="awardIds != null">
                 #{awardIds,jdbcType=VARCHAR},
             </if>
-                </trim>
+        </trim>
     </insert>
-    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.DrawSession" >
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.DrawSession">
         update draw_session
-        <set >
-                    <if test="id != null" >
-               id= #{id,jdbcType=INTEGER},
+        <set>
+            <if test="id != null">
+                id= #{id,jdbcType=INTEGER},
             </if>
-                     <if test="delFlag != null" >
-               del_flag= #{delFlag,jdbcType=CHAR},
+            <if test="delFlag != null">
+                del_flag= #{delFlag,jdbcType=CHAR},
             </if>
-                     <if test="userId != null" >
-               user_id= #{userId,jdbcType=INTEGER},
+            <if test="userId != null">
+                user_id= #{userId,jdbcType=INTEGER},
             </if>
-                     <if test="expireTime != null" >
-               expire_time= #{expireTime,jdbcType=TIMESTAMP},
+            <if test="expireTime != null">
+                expire_time= #{expireTime,jdbcType=TIMESTAMP},
             </if>
-                     <if test="expired != null" >
-               expired= #{expired,jdbcType=BIT},
+            <if test="expired != null">
+                expired= #{expired,jdbcType=BIT},
             </if>
-                     <if test="awardIds != null" >
-               award_ids= #{awardIds,jdbcType=VARCHAR},
+            <if test="awardIds != null">
+                award_ids= #{awardIds,jdbcType=VARCHAR},
             </if>
-                 </set>
+        </set>
         where
         <if test="id != null and !&quot;&quot;.equals(id)">
             id = #{id,jdbcType=INTEGER}
@@ -95,39 +97,42 @@
             id in (${idStr})
         </if>
     </update>
-    <select id="queryDrawSessionByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
-        select <include refid="Base_Column_List"/> from draw_session
+    <select id="queryDrawSessionByPage" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.DrawSession">
+        select
+        <include refid="Base_Column_List"/>
+        from draw_session
         <where>
             and del_flag = 'N'
             <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
                 and id in (${record.idStr})
             </if>
-                    <if test="record.id != null and !&quot;&quot;.equals(record.id)">
-                and  id = #{record.id}
+            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
+                and id = #{record.id}
+            </if>
+            <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
+                and del_flag = #{record.delFlag}
             </if>
-                     <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
-                and  del_flag = #{record.delFlag}
+            <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
+                and user_id = #{record.userId}
             </if>
-                     <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
-                and  user_id = #{record.userId}
+            <if test="record.expireTime != null and !&quot;&quot;.equals(record.expireTime)">
+                and expire_time = #{record.expireTime}
             </if>
-                     <if test="record.expireTime != null and !&quot;&quot;.equals(record.expireTime)">
-                and  expire_time = #{record.expireTime}
+            <if test="record.expired != null and !&quot;&quot;.equals(record.expired)">
+                and expired = #{record.expired}
             </if>
-                     <if test="record.expired != null and !&quot;&quot;.equals(record.expired)">
-                and  expired = #{record.expired}
+            <if test="record.awardIds != null and !&quot;&quot;.equals(record.awardIds)">
+                and award_ids = #{record.awardIds}
             </if>
-                     <if test="record.awardIds != null and !&quot;&quot;.equals(record.awardIds)">
-                and  award_ids = #{record.awardIds}
+            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR user_id LIKE concat('%',#{record.searchKey},'%')
+                    OR expire_time LIKE concat('%',#{record.searchKey},'%')
+                    OR expired LIKE concat('%',#{record.searchKey},'%')
+                    OR award_ids LIKE concat('%',#{record.searchKey},'%')
+                </trim>
             </if>
-                  <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
-             <trim prefix="and (" suffix=")" prefixOverrides="OR" >
-                                                                                                                                                                OR  user_id LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  expire_time LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  expired LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  award_ids LIKE concat('%',#{record.searchKey},'%')
-                                                             </trim>
-         </if>
 
             <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
                 <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
@@ -181,73 +186,76 @@
         </if>
         id desc
     </select>
-    <select id="queryAllDrawSession" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
-        select <include refid="Base_Column_List"/> from draw_session
+    <select id="queryAllDrawSession" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.DrawSession">
+        select
+        <include refid="Base_Column_List"/>
+        from draw_session
         <where>
             and del_flag = 'N'
             <if test="idStr != null and !&quot;&quot;.equals(idStr)">
                 and id in (${idStr})
             </if>
-                    <if test="id != null and !&quot;&quot;.equals(id)">
-                and  id = #{id}
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
             </if>
-                    <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
-                and  del_flag = #{delFlag}
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
             </if>
-                    <if test="userId != null and !&quot;&quot;.equals(userId)">
-                and  user_id = #{userId}
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                and user_id = #{userId}
             </if>
-                    <if test="expireTime != null and !&quot;&quot;.equals(expireTime)">
-                and  expire_time = #{expireTime}
+            <if test="expireTime != null and !&quot;&quot;.equals(expireTime)">
+                and expire_time = #{expireTime}
             </if>
-                    <if test="expired != null and !&quot;&quot;.equals(expired)">
-                and  expired = #{expired}
+            <if test="expired != null and !&quot;&quot;.equals(expired)">
+                and expired = #{expired}
             </if>
-                    <if test="awardIds != null and !&quot;&quot;.equals(awardIds)">
-                and  award_ids = #{awardIds}
+            <if test="awardIds != null and !&quot;&quot;.equals(awardIds)">
+                and award_ids = #{awardIds}
             </if>
-                    <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
-                <trim prefix="and (" suffix=")" prefixOverrides="OR" >
-                                                                                                                                                                                                                                                OR  user_id LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  expire_time LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  expired LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  award_ids LIKE concat('%',#{searchKey},'%')
-                                                                                        </trim>
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR user_id LIKE concat('%',#{searchKey},'%')
+                    OR expire_time LIKE concat('%',#{searchKey},'%')
+                    OR expired LIKE concat('%',#{searchKey},'%')
+                    OR award_ids LIKE concat('%',#{searchKey},'%')
+                </trim>
             </if>
-<if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
-    <foreach item="item" index="index" collection="advancedQuery.split('_;')">
-        <choose>
-            <when test="item.indexOf('like') != -1">
-                <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
-                    <if test="detailIndex == 3">
-                        concat('%',#{itemDetail},'%')
-                    </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
 
-                    <if test="detailIndex &lt; 3">
-                        ${itemDetail}
-                    </if>
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
 
-                </foreach>
-            </when>
-            <otherwise>
-                <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
-                    <if test="detailIndex == 3">
-                        #{itemDetail}
-                    </if>
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
 
-                    <if test="detailIndex &lt; 3">
-                        ${itemDetail}
-                    </if>
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
 
-                </foreach>
-            </otherwise>
-        </choose>
+                            </foreach>
+                        </otherwise>
+                    </choose>
 
 
-    </foreach>
+                </foreach>
 
 
-</if>
+            </if>
         </where>
         order by
 
@@ -267,28 +275,30 @@
         id desc
     </select>
     <select id="queryDrawSession" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
-        select <include refid="Base_Column_List"/> from draw_session
+        select
+        <include refid="Base_Column_List"/>
+        from draw_session
         <where>
             and del_flag = 'N'
-                    <if test="id != null and !&quot;&quot;.equals(id)">
+            <if test="id != null and !&quot;&quot;.equals(id)">
                 and id = #{id}
             </if>
-                     <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                 and del_flag = #{delFlag}
             </if>
-                     <if test="userId != null and !&quot;&quot;.equals(userId)">
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
                 and user_id = #{userId}
             </if>
-                     <if test="expireTime != null and !&quot;&quot;.equals(expireTime)">
+            <if test="expireTime != null and !&quot;&quot;.equals(expireTime)">
                 and expire_time = #{expireTime}
             </if>
-                     <if test="expired != null and !&quot;&quot;.equals(expired)">
+            <if test="expired != null and !&quot;&quot;.equals(expired)">
                 and expired = #{expired}
             </if>
-                     <if test="awardIds != null and !&quot;&quot;.equals(awardIds)">
+            <if test="awardIds != null and !&quot;&quot;.equals(awardIds)">
                 and award_ids = #{awardIds}
             </if>
-         
+
         </where>
         LIMIT 1
     </select>
@@ -304,11 +314,18 @@
         </if>
     </update>
     <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
-        select <include refid="Base_Column_List"/> from draw_session
+        select
+        <include refid="Base_Column_List"/>
+        from draw_session
         <where>
             and del_flag = 'N'
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </where>
+        </where>
         order by id desc
     </select>
+    <update id="setExpire">
+        UPDATE draw_session
+        SET expired = 1
+        WHERE user_id = #{userId}
+    </update>
 </mapper>
 

+ 38 - 17
src/main/java/com/izouma/awesomeadmin/dao/SystemConfigMapper.xml

@@ -5,10 +5,11 @@
                 <id column="id" property="id" jdbcType="INTEGER" />
                                         <result column="del_flag" property="delFlag" jdbcType="CHAR" />
                                 <result column="name" property="name" jdbcType="VARCHAR" />
-                                <result column="value" property="value" jdbcType="VARCHAR" />
+                                <result column="config_key" property="configKey" jdbcType="VARCHAR" />
+                                <result column="config_value" property="configValue" jdbcType="VARCHAR" />
             </resultMap>
     <sql id="Base_Column_List" >
-        id, del_flag, name, value    </sql>
+        id, del_flag, name, config_key, config_value    </sql>
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
         select
         <include refid="Base_Column_List" />
@@ -31,8 +32,11 @@
                 <if test="name!= null" >
                 name,
             </if>
-                <if test="value!= null" >
-                value,
+                <if test="configKey!= null" >
+                config_key,
+            </if>
+                <if test="configValue!= null" >
+                config_value,
             </if>
             </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -45,8 +49,11 @@
                     <if test="name != null" >
                 #{name,jdbcType=VARCHAR},
             </if>
-                    <if test="value != null" >
-                #{value,jdbcType=VARCHAR},
+                    <if test="configKey != null" >
+                #{configKey,jdbcType=VARCHAR},
+            </if>
+                    <if test="configValue != null" >
+                #{configValue,jdbcType=VARCHAR},
             </if>
                 </trim>
     </insert>
@@ -62,8 +69,11 @@
                      <if test="name != null" >
                name= #{name,jdbcType=VARCHAR},
             </if>
-                     <if test="value != null" >
-               value= #{value,jdbcType=VARCHAR},
+                     <if test="configKey != null" >
+               config_key= #{configKey,jdbcType=VARCHAR},
+            </if>
+                     <if test="configValue != null" >
+               config_value= #{configValue,jdbcType=VARCHAR},
             </if>
                  </set>
         where
@@ -91,13 +101,17 @@
                      <if test="record.name != null and !&quot;&quot;.equals(record.name)">
                 and  name = #{record.name}
             </if>
-                     <if test="record.value != null and !&quot;&quot;.equals(record.value)">
-                and  value = #{record.value}
+                     <if test="record.configKey != null and !&quot;&quot;.equals(record.configKey)">
+                and  config_key = #{record.configKey}
+            </if>
+                     <if test="record.configValue != null and !&quot;&quot;.equals(record.configValue)">
+                and  config_value = #{record.configValue}
             </if>
                   <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
              <trim prefix="and (" suffix=")" prefixOverrides="OR" >
                                                                                                                                                                 OR  name LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  value LIKE concat('%',#{record.searchKey},'%')
+                                                                                                    OR  config_key LIKE concat('%',#{record.searchKey},'%')
+                                                                                                    OR  config_value LIKE concat('%',#{record.searchKey},'%')
                                                              </trim>
          </if>
 
@@ -169,13 +183,17 @@
                     <if test="name != null and !&quot;&quot;.equals(name)">
                 and  name = #{name}
             </if>
-                    <if test="value != null and !&quot;&quot;.equals(value)">
-                and  value = #{value}
+                    <if test="configKey != null and !&quot;&quot;.equals(configKey)">
+                and  config_key = #{configKey}
+            </if>
+                    <if test="configValue != null and !&quot;&quot;.equals(configValue)">
+                and  config_value = #{configValue}
             </if>
                     <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
                 <trim prefix="and (" suffix=")" prefixOverrides="OR" >
                                                                                                                                                                                                                                                 OR  name LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  value LIKE concat('%',#{searchKey},'%')
+                                                                                                                                                        OR  config_key LIKE concat('%',#{searchKey},'%')
+                                                                                                                                                        OR  config_value LIKE concat('%',#{searchKey},'%')
                                                                                         </trim>
             </if>
 <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
@@ -243,8 +261,11 @@
                      <if test="name != null and !&quot;&quot;.equals(name)">
                 and name = #{name}
             </if>
-                     <if test="value != null and !&quot;&quot;.equals(value)">
-                and value = #{value}
+                     <if test="configKey != null and !&quot;&quot;.equals(configKey)">
+                and config_key = #{configKey}
+            </if>
+                     <if test="configValue != null and !&quot;&quot;.equals(configValue)">
+                and config_value = #{configValue}
             </if>
          
         </where>
@@ -265,7 +286,7 @@
         select <include refid="Base_Column_List"/> from system_config
         <where>
             and del_flag = 'N'
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </where>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </where>
         order by id desc
     </select>
 </mapper>

+ 116 - 0
src/main/java/com/izouma/awesomeadmin/model/DrawRecord.java

@@ -0,0 +1,116 @@
+package com.izouma.awesomeadmin.model;
+
+import java.util.*;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+
+@JsonAutoDetect
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class DrawRecord{
+    private Integer id;
+    private String delFlag;
+    private Integer userId;
+    private Integer sessionId;
+    private Integer integral;
+    private Boolean win;
+    private Date createTime;
+
+    private String idStr;
+
+    private String searchKey;
+
+    /**
+    * and,test_name,like,value;or,remark,=,123
+    */
+    private String advancedQuery;
+
+    /**
+    * column_name_,desc_;column_name_,asc
+    */
+    private String orderByStr;
+
+    public Integer getId(){
+        return this.id;
+    }
+
+    public void setId(Integer id){
+        this.id = id;
+    }
+    public String getDelFlag(){
+        return this.delFlag;
+    }
+
+    public void setDelFlag(String delFlag){
+        this.delFlag = delFlag;
+    }
+    public Integer getUserId(){
+        return this.userId;
+    }
+
+    public void setUserId(Integer userId){
+        this.userId = userId;
+    }
+    public Integer getSessionId(){
+        return this.sessionId;
+    }
+
+    public void setSessionId(Integer sessionId){
+        this.sessionId = sessionId;
+    }
+    public Integer getIntegral(){
+        return this.integral;
+    }
+
+    public void setIntegral(Integer integral){
+        this.integral = integral;
+    }
+    public Boolean getWin(){
+        return this.win;
+    }
+
+    public void setWin(Boolean win){
+        this.win = win;
+    }
+    public Date getCreateTime(){
+        return this.createTime;
+    }
+
+    public void setCreateTime(Date createTime){
+        this.createTime = createTime;
+    }
+
+    public String getSearchKey() {
+        return searchKey;
+    }
+
+    public void setSearchKey(String searchKey) {
+        this.searchKey = searchKey;
+    }
+
+    public String getAdvancedQuery() {
+        return advancedQuery;
+    }
+
+    public void setAdvancedQuery(String advancedQuery) {
+        this.advancedQuery = advancedQuery;
+    }
+
+    public String getOrderByStr() {
+        return orderByStr;
+    }
+
+    public void setOrderByStr(String orderByStr) {
+        this.orderByStr = orderByStr;
+    }
+
+    public String getIdStr() {
+        return idStr;
+    }
+
+    public void setIdStr(String idStr) {
+        this.idStr = idStr;
+    }
+
+}
+

+ 13 - 5
src/main/java/com/izouma/awesomeadmin/model/SystemConfig.java

@@ -11,7 +11,8 @@ public class SystemConfig{
     private Integer id;
     private String delFlag;
     private String name;
-    private String value;
+    private String configKey;
+    private String configValue;
 
     private String idStr;
 
@@ -48,12 +49,19 @@ public class SystemConfig{
     public void setName(String name){
         this.name = name;
     }
-    public String getValue(){
-        return this.value;
+    public String getConfigKey(){
+        return this.configKey;
     }
 
-    public void setValue(String value){
-        this.value = value;
+    public void setConfigKey(String configKey){
+        this.configKey = configKey;
+    }
+    public String getConfigValue(){
+        return this.configValue;
+    }
+
+    public void setConfigValue(String configValue){
+        this.configValue = configValue;
     }
 
     public String getSearchKey() {

+ 30 - 0
src/main/java/com/izouma/awesomeadmin/service/DrawRecordService.java

@@ -0,0 +1,30 @@
+package com.izouma.awesomeadmin.service;
+
+import java.util.*;
+
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.model.DrawRecord;
+
+
+/**
+ * service接口类
+ */
+public interface DrawRecordService {
+
+    List<DrawRecord> getDrawRecordList(DrawRecord record);
+
+    List<DrawRecord> getDrawRecordByPage(Page page, DrawRecord record);
+
+    DrawRecord getDrawRecordById(String id);
+
+    DrawRecord getDrawRecord(DrawRecord record);
+
+    boolean createDrawRecord(DrawRecord record);
+
+    boolean deleteDrawRecord(DrawRecord record);
+
+    boolean updateDrawRecord(DrawRecord record);
+
+    List<DrawRecord> getTodayDrawRecord(int userId);
+}
+

+ 12 - 0
src/main/java/com/izouma/awesomeadmin/service/DrawService.java

@@ -0,0 +1,12 @@
+package com.izouma.awesomeadmin.service;
+
+import com.izouma.awesomeadmin.model.DrawSession;
+
+import java.util.Map;
+
+public interface DrawService {
+    Map<String, Object> getDrawSession(Boolean refresh);
+
+    Map<String, Object> makeDraw();
+
+}

+ 4 - 3
src/main/java/com/izouma/awesomeadmin/service/DrawSessionService.java

@@ -1,14 +1,15 @@
 package com.izouma.awesomeadmin.service;
 
 import java.util.*;
+
 import com.izouma.awesomeadmin.dto.Page;
 import com.izouma.awesomeadmin.model.DrawSession;
 
 
 /**
-*  service接口类
-*/
-public interface DrawSessionService{
+ * service接口类
+ */
+public interface DrawSessionService {
 
     List<DrawSession> getDrawSessionList(DrawSession record);
 

+ 12 - 3
src/main/java/com/izouma/awesomeadmin/service/SystemConfigService.java

@@ -1,14 +1,15 @@
 package com.izouma.awesomeadmin.service;
 
 import java.util.*;
+
 import com.izouma.awesomeadmin.dto.Page;
 import com.izouma.awesomeadmin.model.SystemConfig;
 
 
 /**
-*  service接口类
-*/
-public interface SystemConfigService{
+ * service接口类
+ */
+public interface SystemConfigService {
 
     List<SystemConfig> getSystemConfigList(SystemConfig record);
 
@@ -23,5 +24,13 @@ public interface SystemConfigService{
     boolean deleteSystemConfig(SystemConfig record);
 
     boolean updateSystemConfig(SystemConfig record);
+
+    String getString(String key, String defaultValue);
+
+    int getInt(String key, int defaultValue);
+
+    boolean getBoolean(String key, boolean defaultValue);
+
+    double getDouble(String key, double defaultValue);
 }
 

+ 150 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/DrawRecordServiceImpl.java

@@ -0,0 +1,150 @@
+package com.izouma.awesomeadmin.service.impl;
+
+import java.util.*;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.izouma.awesomeadmin.constant.AppConstant;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.model.DrawRecord;
+import com.izouma.awesomeadmin.service.DrawRecordService;
+import com.izouma.awesomeadmin.dao.DrawRecordMapper;
+
+/**
+ * service接口实现类
+ */
+@Service
+public class DrawRecordServiceImpl implements DrawRecordService {
+
+    private static Logger logger = Logger.getLogger(DrawRecordServiceImpl.class);
+
+    @Autowired
+    private DrawRecordMapper drawRecordMapper;
+
+    @Override
+    public List<DrawRecord> getDrawRecordList(DrawRecord record) {
+
+        logger.info("getDrawRecordList");
+        try {
+
+            return drawRecordMapper.queryAllDrawRecord(record);
+        } catch (Exception e) {
+            logger.error("getDrawRecordList", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public List<DrawRecord> getDrawRecordByPage(Page page, DrawRecord record) {
+
+        logger.info("getDrawRecordByPage");
+        try {
+
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
+
+            return drawRecordMapper.queryDrawRecordByPage(parameter);
+        } catch (Exception e) {
+            logger.error("getDrawRecordByPage", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public DrawRecord getDrawRecordById(String id) {
+
+        logger.info("getDrawRecordyId");
+        try {
+
+            return drawRecordMapper.selectByPrimaryKey(Integer.valueOf(id));
+        } catch (Exception e) {
+            logger.error("getDrawRecordById", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public DrawRecord getDrawRecord(DrawRecord record) {
+
+        logger.info("getDrawRecord");
+        try {
+
+            return drawRecordMapper.queryDrawRecord(record);
+        } catch (Exception e) {
+            logger.error("getDrawRecord", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public boolean createDrawRecord(DrawRecord record) {
+
+        logger.info("createDrawRecord");
+        try {
+
+            int updates = drawRecordMapper.insertSelective(record);
+
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("createDrawRecord", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean deleteDrawRecord(DrawRecord record) {
+
+        logger.info("deleteDrawRecord");
+        try {
+
+            int updates = drawRecordMapper.delete(record);
+
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("deleteDrawRecord", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean updateDrawRecord(DrawRecord record) {
+
+        logger.info("updateDrawRecord");
+        try {
+
+            int updates = drawRecordMapper.updateByPrimaryKeySelective(record);
+
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("updateDrawRecord", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public List<DrawRecord> getTodayDrawRecord(int userId) {
+        logger.info("getTodayDrawTimes");
+        try {
+            return drawRecordMapper.queryTodayDrawRecord(userId);
+        } catch (Exception e) {
+            logger.error("getTodayDrawTimes", e);
+        }
+        return null;
+    }
+}
+

+ 146 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/DrawServiceImpl.java

@@ -0,0 +1,146 @@
+package com.izouma.awesomeadmin.service.impl;
+
+import com.izouma.awesomeadmin.dao.DrawSessionMapper;
+import com.izouma.awesomeadmin.model.AwardInfo;
+import com.izouma.awesomeadmin.model.DrawRecord;
+import com.izouma.awesomeadmin.model.DrawSession;
+import com.izouma.awesomeadmin.model.UserInfo;
+import com.izouma.awesomeadmin.service.*;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.log4j.Logger;
+import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+@Service
+public class DrawServiceImpl implements DrawService {
+    private static Logger logger = Logger.getLogger(DrawServiceImpl.class);
+
+    @Autowired
+    private DrawSessionService  drawSessionService;
+    @Autowired
+    private DrawSessionMapper   drawSessionMapper;
+    @Autowired
+    private AwardInfoService    awardInfoService;
+    @Autowired
+    private DrawRecordService   drawRecordService;
+    @Autowired
+    private SystemConfigService systemConfigService;
+
+    @Override
+    public Map<String, Object> getDrawSession(Boolean refresh) {
+        logger.info("getSession");
+        try {
+            Map<String, Object> map = new HashMap<>();
+            UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
+            if (refresh == null) {
+                refresh = false;
+            }
+            DrawSession session = new DrawSession();
+            if (!refresh) {
+                session.setUserId(userInfo.getId());
+                session.setExpired(false);
+                session = drawSessionService.getDrawSession(session);
+                if (session != null && session.getExpireTime().before(new Date())) {
+                    session = null;
+                }
+            }
+            if (session == null) {
+                drawSessionMapper.setExpire(userInfo.getId());
+                session = new DrawSession();
+                session.setAwardIds(StringUtils.join(awardInfoService.random(8).stream().map(awardInfo -> awardInfo.getId().toString()).iterator(), ","));
+                session.setUserId(((UserInfo) SecurityUtils.getSubject().getPrincipal()).getId());
+                session.setExpired(false);
+                session.setExpireTime(DateUtils.addDays(new Date(), 1));
+                drawSessionService.createDrawSession(session);
+            }
+            map.put("session", session);
+
+            int maxDrawTimes = systemConfigService.getInt("draw_times", 0);
+            map.put("maxDrawTimes", maxDrawTimes);
+
+            List<DrawRecord> records = drawRecordService.getTodayDrawRecord(userInfo.getId());
+            map.put("drawTimes", records == null ? maxDrawTimes : records.size());
+
+            int drawIntegral = systemConfigService.getInt("draw_integral", 20);
+            map.put("drawIntegral", drawIntegral);
+
+            List<AwardInfo> awards = new ArrayList<>();
+            for (String id : session.getAwardIds().split(",")) {
+                AwardInfo awardInfo = awardInfoService.getAwardInfoById(id);
+                if (awardInfo != null) {
+                    awards.add(awardInfo);
+                }
+            }
+            map.put("awards", awards);
+
+            return map;
+        } catch (Exception e) {
+            logger.error("getSession", e);
+        }
+        return null;
+    }
+
+    @Override
+    public Map<String, Object> makeDraw() {
+        logger.info("makeDraw");
+        try {
+            Map<String, Object> map = new HashMap<>();
+            boolean win = false;
+            String msg = "";
+
+            int maxDrawTimes = systemConfigService.getInt("draw_times", 0);
+            int drawIntegral = systemConfigService.getInt("draw_integral", 20);
+            double winProbability = systemConfigService.getDouble("win_probability", 0.000001);
+
+            UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
+            List<DrawRecord> records = drawRecordService.getTodayDrawRecord(userInfo.getId());
+            if (records == null || records.size() >= maxDrawTimes) {
+                msg = "已达今日抽奖上限";
+            } else {
+                Random random = new Random();
+                win = random.nextInt((int) (1 / winProbability)) == 0;
+                DrawSession session = new DrawSession();
+                session.setUserId(userInfo.getId());
+                session.setExpired(false);
+                session = drawSessionService.getDrawSession(session);
+                List<AwardInfo> awards = new ArrayList<>();
+                for (String id : session.getAwardIds().split(",")) {
+                    AwardInfo awardInfo = awardInfoService.getAwardInfoById(id);
+                    if (awardInfo != null && !awardInfo.getCollected()) {
+                        awards.add(awardInfo);
+                    }
+                }
+                if (awards.size() == 0) {
+                    win = false;
+                }
+
+                DrawRecord drawRecord = new DrawRecord();
+                drawRecord.setUserId(userInfo.getId());
+                drawRecord.setWin(win);
+                drawRecord.setIntegral(drawIntegral);
+                drawRecordService.createDrawRecord(drawRecord);
+
+                if (win) {
+                    int i = random.nextInt(awards.size());
+                    AwardInfo awardInfo = awards.get(i);
+                    awardInfo.setCollected(true);
+                    awardInfo.setCollectUser(userInfo.getId());
+                    awardInfo.setCollectTime(new Date());
+                    awardInfoService.updateAwardInfo(awardInfo);
+                    map.put("winAward", awardInfo);
+                }
+            }
+
+            map.put("win", win);
+            map.put("msg", msg);
+            return map;
+        } catch (Exception e) {
+            logger.error("makeDraw", e);
+        }
+        return null;
+    }
+}

+ 26 - 18
src/main/java/com/izouma/awesomeadmin/service/impl/DrawSessionServiceImpl.java

@@ -1,7 +1,14 @@
 package com.izouma.awesomeadmin.service.impl;
 
 import java.util.*;
+
+import com.izouma.awesomeadmin.dto.Result;
+import com.izouma.awesomeadmin.model.UserInfo;
+import com.izouma.awesomeadmin.service.AwardInfoService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
 import org.apache.log4j.Logger;
+import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.izouma.awesomeadmin.constant.AppConstant;
@@ -11,10 +18,10 @@ import com.izouma.awesomeadmin.service.DrawSessionService;
 import com.izouma.awesomeadmin.dao.DrawSessionMapper;
 
 /**
-*  service接口实现类
-*/
+ * service接口实现类
+ */
 @Service
-public class DrawSessionServiceImpl implements DrawSessionService{
+public class DrawSessionServiceImpl implements DrawSessionService {
 
     private static Logger logger = Logger.getLogger(DrawSessionServiceImpl.class);
 
@@ -27,26 +34,27 @@ public class DrawSessionServiceImpl implements DrawSessionService{
         logger.info("getDrawSessionList");
         try {
 
-        return drawSessionMapper.queryAllDrawSession(record);
+            return drawSessionMapper.queryAllDrawSession(record);
         } catch (Exception e) {
-        logger.error("getDrawSessionList", e);
+            logger.error("getDrawSessionList", e);
         }
 
         return null;
     }
+
     @Override
     public List<DrawSession> getDrawSessionByPage(Page page, DrawSession record) {
 
         logger.info("getDrawSessionByPage");
         try {
 
-        Map<String, Object> parameter = new HashMap<String, Object>();
-        parameter.put("record", record);
-        parameter.put(AppConstant.PAGE, page);
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
 
-        return drawSessionMapper.queryDrawSessionByPage(parameter);
+            return drawSessionMapper.queryDrawSessionByPage(parameter);
         } catch (Exception e) {
-        logger.error("getDrawSessionByPage", e);
+            logger.error("getDrawSessionByPage", e);
         }
 
         return null;
@@ -60,7 +68,7 @@ public class DrawSessionServiceImpl implements DrawSessionService{
 
             return drawSessionMapper.selectByPrimaryKey(Integer.valueOf(id));
         } catch (Exception e) {
-        logger.error("getDrawSessionById", e);
+            logger.error("getDrawSessionById", e);
         }
 
         return null;
@@ -74,7 +82,7 @@ public class DrawSessionServiceImpl implements DrawSessionService{
 
             return drawSessionMapper.queryDrawSession(record);
         } catch (Exception e) {
-        logger.error("getDrawSession", e);
+            logger.error("getDrawSession", e);
         }
 
         return null;
@@ -89,7 +97,7 @@ public class DrawSessionServiceImpl implements DrawSessionService{
             int updates = drawSessionMapper.insertSelective(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
             logger.error("createDrawSession", e);
@@ -104,13 +112,13 @@ public class DrawSessionServiceImpl implements DrawSessionService{
         logger.info("deleteDrawSession");
         try {
 
-             int updates = drawSessionMapper.delete(record);
+            int updates = drawSessionMapper.delete(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
-             logger.error("deleteDrawSession", e);
+            logger.error("deleteDrawSession", e);
         }
 
         return false;
@@ -125,10 +133,10 @@ public class DrawSessionServiceImpl implements DrawSessionService{
             int updates = drawSessionMapper.updateByPrimaryKeySelective(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
-             logger.error("updateDrawSession", e);
+            logger.error("updateDrawSession", e);
         }
 
         return false;

+ 74 - 18
src/main/java/com/izouma/awesomeadmin/service/impl/SystemConfigServiceImpl.java

@@ -1,6 +1,7 @@
 package com.izouma.awesomeadmin.service.impl;
 
 import java.util.*;
+
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -11,10 +12,10 @@ import com.izouma.awesomeadmin.service.SystemConfigService;
 import com.izouma.awesomeadmin.dao.SystemConfigMapper;
 
 /**
-*  service接口实现类
-*/
+ * service接口实现类
+ */
 @Service
-public class SystemConfigServiceImpl implements SystemConfigService{
+public class SystemConfigServiceImpl implements SystemConfigService {
 
     private static Logger logger = Logger.getLogger(SystemConfigServiceImpl.class);
 
@@ -27,26 +28,27 @@ public class SystemConfigServiceImpl implements SystemConfigService{
         logger.info("getSystemConfigList");
         try {
 
-        return systemConfigMapper.queryAllSystemConfig(record);
+            return systemConfigMapper.queryAllSystemConfig(record);
         } catch (Exception e) {
-        logger.error("getSystemConfigList", e);
+            logger.error("getSystemConfigList", e);
         }
 
         return null;
     }
+
     @Override
     public List<SystemConfig> getSystemConfigByPage(Page page, SystemConfig record) {
 
         logger.info("getSystemConfigByPage");
         try {
 
-        Map<String, Object> parameter = new HashMap<String, Object>();
-        parameter.put("record", record);
-        parameter.put(AppConstant.PAGE, page);
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
 
-        return systemConfigMapper.querySystemConfigByPage(parameter);
+            return systemConfigMapper.querySystemConfigByPage(parameter);
         } catch (Exception e) {
-        logger.error("getSystemConfigByPage", e);
+            logger.error("getSystemConfigByPage", e);
         }
 
         return null;
@@ -60,7 +62,7 @@ public class SystemConfigServiceImpl implements SystemConfigService{
 
             return systemConfigMapper.selectByPrimaryKey(Integer.valueOf(id));
         } catch (Exception e) {
-        logger.error("getSystemConfigById", e);
+            logger.error("getSystemConfigById", e);
         }
 
         return null;
@@ -74,7 +76,7 @@ public class SystemConfigServiceImpl implements SystemConfigService{
 
             return systemConfigMapper.querySystemConfig(record);
         } catch (Exception e) {
-        logger.error("getSystemConfig", e);
+            logger.error("getSystemConfig", e);
         }
 
         return null;
@@ -89,7 +91,7 @@ public class SystemConfigServiceImpl implements SystemConfigService{
             int updates = systemConfigMapper.insertSelective(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
             logger.error("createSystemConfig", e);
@@ -104,13 +106,13 @@ public class SystemConfigServiceImpl implements SystemConfigService{
         logger.info("deleteSystemConfig");
         try {
 
-             int updates = systemConfigMapper.delete(record);
+            int updates = systemConfigMapper.delete(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
-             logger.error("deleteSystemConfig", e);
+            logger.error("deleteSystemConfig", e);
         }
 
         return false;
@@ -125,13 +127,67 @@ public class SystemConfigServiceImpl implements SystemConfigService{
             int updates = systemConfigMapper.updateByPrimaryKeySelective(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
-             logger.error("updateSystemConfig", e);
+            logger.error("updateSystemConfig", e);
         }
 
         return false;
     }
+
+    private String getConfig(String key) {
+        SystemConfig systemConfig = new SystemConfig();
+        systemConfig.setConfigKey(key);
+        systemConfig = getSystemConfig(systemConfig);
+        if (systemConfig != null) {
+            return systemConfig.getConfigValue();
+        }
+        return null;
+    }
+
+    @Override
+    public String getString(String key, String defaultValue) {
+        logger.info("getString");
+        try {
+            return getConfig(key);
+        } catch (Exception e) {
+            logger.error("getString", e);
+        }
+        return defaultValue;
+    }
+
+    @Override
+    public int getInt(String key, int defaultValue) {
+        logger.info("getInt");
+        try {
+            return Integer.parseInt(Objects.requireNonNull(getConfig(key)));
+        } catch (Exception e) {
+            logger.error("getInt", e);
+        }
+        return defaultValue;
+    }
+
+    @Override
+    public boolean getBoolean(String key, boolean defaultValue) {
+        logger.info("getBoolean");
+        try {
+            return Boolean.parseBoolean(getConfig(key));
+        } catch (Exception e) {
+            logger.error("getBoolean", e);
+        }
+        return defaultValue;
+    }
+
+    @Override
+    public double getDouble(String key, double defaultValue) {
+        logger.info("getDouble");
+        try {
+            return Double.parseDouble(Objects.requireNonNull(getConfig(key)));
+        } catch (Exception e) {
+            logger.error("getDouble", e);
+        }
+        return defaultValue;
+    }
 }
 

+ 41 - 0
src/main/java/com/izouma/awesomeadmin/web/DrawController.java

@@ -0,0 +1,41 @@
+package com.izouma.awesomeadmin.web;
+
+import com.izouma.awesomeadmin.dto.Result;
+import com.izouma.awesomeadmin.model.DrawSession;
+import com.izouma.awesomeadmin.service.DrawService;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.Map;
+
+@Controller
+@RequestMapping("/draw")
+public class DrawController {
+    @Autowired
+    private DrawService drawService;
+
+    @RequestMapping("/getSession")
+    @ResponseBody
+    @RequiresAuthentication
+    public Result get(Boolean refresh) {
+        Map<String, Object> map = drawService.getDrawSession(refresh);
+        if (map != null) {
+            return new Result(true, map);
+        }
+        return new Result(false, "失败");
+    }
+
+    @RequestMapping("/makeDraw")
+    @ResponseBody
+    @RequiresAuthentication
+    public Result makeDraw() {
+        Map<String, Object> map = drawService.makeDraw();
+        if (map != null) {
+            return new Result(true, map);
+        }
+        return new Result(false, "失败");
+    }
+}

+ 120 - 0
src/main/java/com/izouma/awesomeadmin/web/DrawRecordController.java

@@ -0,0 +1,120 @@
+package com.izouma.awesomeadmin.web;
+
+import java.util.*;
+
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import com.izouma.awesomeadmin.constant.AppConstant;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.dto.Result;
+import com.izouma.awesomeadmin.model.DrawRecord;
+import com.izouma.awesomeadmin.service.DrawRecordService;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Controller
+@RequestMapping("/drawRecord")
+public class DrawRecordController {
+
+    @Autowired
+    private DrawRecordService drawRecordService;
+
+    @RequiresAuthentication
+    @RequestMapping(value = "/all", method = RequestMethod.GET)
+    @ResponseBody
+    public Result all(DrawRecord record) {
+        List<DrawRecord> pp = drawRecordService.getDrawRecordList(record);
+        return new Result(true, pp);
+    }
+
+    @RequestMapping(value = "/getDrawRecord", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getDrawRecord(@RequestParam(required = false, value = "id") String id) {
+        DrawRecord data = drawRecordService.getDrawRecordById(id);
+        return new Result(true, data);
+    }
+
+    @RequestMapping(value = "/getOne", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getOne(DrawRecord record) {
+        DrawRecord data = drawRecordService.getDrawRecord(record);
+        return new Result(true, data);
+    }
+
+    @RequestMapping(value = "/page", method = RequestMethod.GET)
+    @ResponseBody
+    public Result page(Page page, DrawRecord record) {
+        Map<String, Object> result = new HashMap<>();
+
+        List<DrawRecord> pp =drawRecordService.getDrawRecordByPage(page, record);
+
+        result.put(AppConstant.PAGE, page);
+        result.put("pp", pp);
+        return new Result(true, result);
+    }
+
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ResponseBody
+    public Result save(DrawRecord record) {
+        boolean num = drawRecordService.createDrawRecord(record);
+        if (num) {
+        return new Result(true, record.getId());
+        }
+        return new Result(false, "保存异常");
+    }
+
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ResponseBody
+    public Result updateDrawRecord(DrawRecord record) {
+        boolean num = drawRecordService.updateDrawRecord(record);
+        if (num) {
+        return new Result(true, "保存成功");
+        }
+        return new Result(false, "保存异常");
+    }
+
+    @RequestMapping(value = "/del", method = RequestMethod.POST)
+    @ResponseBody
+    public Result deleteDrawRecord(DrawRecord record) {
+
+        boolean num = drawRecordService.deleteDrawRecord(record);
+        if (num) {
+        return new Result(true, "删除成功");
+        }
+        return new Result(false, "删除异常");
+    }
+
+    @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
+    @ResponseBody
+    public void exportExcel(HttpServletRequest request, HttpServletResponse response, DrawRecord record) throws Exception {
+
+        List<DrawRecord> drawRecords = drawRecordService.getDrawRecordList(record);
+
+        String sheetName = "draw_record";
+        String titleName = "抽奖记录数据表";
+        String fileName = "抽奖记录表";
+        int columnNumber = 7;
+        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20 };
+        String[] columnName = {  "" ,   "删除标识" ,   "用户id" ,   "会话id" ,   "消耗积分" ,   "中奖" ,   "创建时间"  };
+        String[][] dataList = new String[drawRecords.size()][7];
+
+        for (int i = 0; i < drawRecords.size(); i++) {
+                        dataList[i][0] = String.valueOf(drawRecords.get(i).getId());
+                        dataList[i][1] = String.valueOf(drawRecords.get(i).getDelFlag());
+                        dataList[i][2] = String.valueOf(drawRecords.get(i).getUserId());
+                        dataList[i][3] = String.valueOf(drawRecords.get(i).getSessionId());
+                        dataList[i][4] = String.valueOf(drawRecords.get(i).getIntegral());
+                        dataList[i][5] = String.valueOf(drawRecords.get(i).getWin());
+                        dataList[i][6] = String.valueOf(drawRecords.get(i).getCreateTime());
+                    }
+
+        ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
+                columnNumber, columnWidth, columnName, dataList, response);
+    }
+}
+

+ 11 - 29
src/main/java/com/izouma/awesomeadmin/web/DrawSessionController.java

@@ -1,27 +1,24 @@
 package com.izouma.awesomeadmin.web;
 
-import java.util.*;
-import java.util.function.Function;
-
-import com.izouma.awesomeadmin.model.AwardInfo;
-import com.izouma.awesomeadmin.model.UserInfo;
-import com.izouma.awesomeadmin.service.AwardInfoService;
-import com.izouma.awesomeadmin.util.ExportExcelUtil;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authz.annotation.RequiresAuthentication;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
 import com.izouma.awesomeadmin.constant.AppConstant;
 import com.izouma.awesomeadmin.dto.Page;
 import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.DrawSession;
 import com.izouma.awesomeadmin.service.DrawSessionService;
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Controller
 @RequestMapping("/drawSession")
@@ -29,8 +26,6 @@ public class DrawSessionController {
 
     @Autowired
     private DrawSessionService drawSessionService;
-    @Autowired
-    private AwardInfoService   awardInfoService;
 
     @RequiresAuthentication
     @RequestMapping(value = "/all", method = RequestMethod.GET)
@@ -123,18 +118,5 @@ public class DrawSessionController {
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
                 columnNumber, columnWidth, columnName, dataList, response);
     }
-
-    @RequestMapping("get")
-    @ResponseBody
-    @RequiresAuthentication
-    public Result get() {
-        DrawSession session = new DrawSession();
-        session.setAwardIds(StringUtils.join(awardInfoService.random(8).stream().map(awardInfo -> awardInfo.getId().toString()).iterator(), ","));
-        session.setUserId(((UserInfo) SecurityUtils.getSubject().getPrincipal()).getId());
-        session.setExpired(false);
-        session.setExpireTime(DateUtils.addDays(new Date(), 1));
-        drawSessionService.createDrawSession(session);
-        return new Result(true, session);
-    }
 }
 

+ 6 - 5
src/main/java/com/izouma/awesomeadmin/web/SystemConfigController.java

@@ -98,16 +98,17 @@ public class SystemConfigController {
         String sheetName = "system_config";
         String titleName = "系统配置数据表";
         String fileName = "系统配置表";
-        int columnNumber = 4;
-        int[] columnWidth = { 20,  20,  20,  20 };
-        String[] columnName = {  "" ,   "删除标识" ,   "名称" ,   "值"  };
-        String[][] dataList = new String[systemConfigs.size()][4];
+        int columnNumber = 5;
+        int[] columnWidth = { 20,  20,  20,  20,  20 };
+        String[] columnName = {  "" ,   "删除标识" ,   "名称" ,   "键" ,   "值"  };
+        String[][] dataList = new String[systemConfigs.size()][5];
 
         for (int i = 0; i < systemConfigs.size(); i++) {
                         dataList[i][0] = String.valueOf(systemConfigs.get(i).getId());
                         dataList[i][1] = String.valueOf(systemConfigs.get(i).getDelFlag());
                         dataList[i][2] = String.valueOf(systemConfigs.get(i).getName());
-                        dataList[i][3] = String.valueOf(systemConfigs.get(i).getValue());
+                        dataList[i][3] = String.valueOf(systemConfigs.get(i).getConfigKey());
+                        dataList[i][4] = String.valueOf(systemConfigs.get(i).getConfigValue());
                     }
 
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,

+ 355 - 373
src/main/vue/src/pages/AwardInfos.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <div class="filters-container">
-        
+
             <el-input placeholder="关键字" size="small" v-model="filter1" clearable class="filter-item"></el-input>
             <el-button @click="searchData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
             </el-button>
@@ -28,184 +28,166 @@
             </el-dropdown>
         </div>
         <el-table
-                :data="tableData"
-                :height="tableHeight"
-                row-key="id"
-                ref="table">
+            :data="tableData"
+            :height="tableHeight"
+            row-key="id"
+            ref="table">
+            <el-table-column
+                v-if="multipleMode"
+                align="center"
+                type="selection"
+                width="50">
+            </el-table-column>
+            <el-table-column
+                type="index"
+                min-width="50"
+                align="center">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('name')"
+                prop="name"
+                label="名称"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('price')"
+                prop="price"
+                label="价格"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('detail')"
+                prop="detail"
+                label="详情"
+                min-width="100">
+            </el-table-column>
+
             <el-table-column
-                    v-if="multipleMode"
-                    align="center"
-                    type="selection"
-                    width="50">
+                v-if="isColumnShow('integral')"
+                prop="integral"
+                label="积分"
+                min-width="100">
             </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('threshold')"
+                prop="threshold"
+                label="门槛"
+                min-width="100">
+            </el-table-column>
+
             <el-table-column
-                    type="index"
-                    min-width="50"
-                    align="center">
+                v-if="isColumnShow('type')"
+                prop="type"
+                label="类型"
+                min-width="100">
             </el-table-column>
-                                                                                    
-                                            <el-table-column
-                                v-if="isColumnShow('name')"
-                                prop="name"
-                                label="名称"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('price')"
-                                prop="price"
-                                label="价格"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('cover')"
-                                prop="cover"
-                                label="封面"
-                                min-width="100">
-                            <template slot-scope="{row}">
-                                <img :src="row.cover" @click="showImg(row.cover)" style="width: 100px;height: 100px;vertical-align: middle;" />
-                            </template>
-
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('pic')"
-                                prop="pic"
-                                label="图片"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('detail')"
-                                prop="detail"
-                                label="详情"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('integral')"
-                                prop="integral"
-                                label="积分"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('threshold')"
-                                prop="threshold"
-                                label="门槛"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('type')"
-                                prop="type"
-                                label="类型"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('userId')"
-                                prop="userId"
-                                label="用户id"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('companyId')"
-                                prop="companyId"
-                                label="公司id"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('source')"
-                                prop="source"
-                                label="来源"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('collected')"
-                                prop="collected"
-                                label="已领取"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('transferred')"
-                                prop="transferred"
-                                label="已转赠"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('collectUser')"
-                                prop="collectUser"
-                                label="获奖人"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('transferUser')"
-                                prop="transferUser"
-                                label="转赠人"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('createdTime')"
-                                prop="createdTime"
-                                label="创建时间"
-                                :formatter="DateTimeFormatter"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('collectTime')"
-                                prop="collectTime"
-                                label="领取时间"
-                                :formatter="DateTimeFormatter"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('transferTime')"
-                                prop="transferTime"
-                                label="转赠时间"
-                                :formatter="DateTimeFormatter"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('shipped')"
-                                prop="shipped"
-                                label="发货"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('shippedTime')"
-                                prop="shippedTime"
-                                label="发货时间"
-                                :formatter="DateTimeFormatter"
-                                min-width="100">
-                        </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('trackingNumber')"
-                                prop="trackingNumber"
-                                label="物流单号"
-                                min-width="100">
-                        </el-table-column>
-                                                            <el-table-column
-                    label="操作"
-                    align="center"
-                    fixed="right"
-                    min-width="150"
+
+            <el-table-column
+                v-if="isColumnShow('userId')"
+                prop="userId"
+                label="用户id"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('companyId')"
+                prop="companyId"
+                label="公司id"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('source')"
+                prop="source"
+                label="来源"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('collected')"
+                prop="collected"
+                label="已领取"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('transferred')"
+                prop="transferred"
+                label="已转赠"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('collectUser')"
+                prop="collectUser"
+                label="获奖人"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('transferUser')"
+                prop="transferUser"
+                label="转赠人"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('createdTime')"
+                prop="createdTime"
+                label="创建时间"
+                :formatter="DateTimeFormatter"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('collectTime')"
+                prop="collectTime"
+                label="领取时间"
+                :formatter="DateTimeFormatter"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('transferTime')"
+                prop="transferTime"
+                label="转赠时间"
+                :formatter="DateTimeFormatter"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('shipped')"
+                prop="shipped"
+                label="发货"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('shippedTime')"
+                prop="shippedTime"
+                label="发货时间"
+                :formatter="DateTimeFormatter"
+                min-width="100">
+            </el-table-column>
+
+            <el-table-column
+                v-if="isColumnShow('trackingNumber')"
+                prop="trackingNumber"
+                label="物流单号"
+                min-width="100">
+            </el-table-column>
+            <el-table-column
+                label="操作"
+                align="center"
+                fixed="right"
+                min-width="150"
             >
                 <template slot-scope="scope">
-                                        <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
                     <el-button @click="deleteRow(scope.row)" type="danger" size="mini" plain>删除</el-button>
                 </template>
             </el-table-column>
@@ -220,14 +202,14 @@
                 </el-button-group>
             </div>
             <el-pagination
-                    background
-                    @size-change="pageSizeChange"
-                    @current-change="currentPageChange"
-                    :current-page="currentPage"
-                    :page-sizes="[10, 20, 30, 40, 50]"
-                    :page-size="pageSize"
-                    layout="total, sizes, prev, pager, next, jumper"
-                    :total="totalNumber">
+                background
+                @size-change="pageSizeChange"
+                @current-change="currentPageChange"
+                :current-page="currentPage"
+                :page-sizes="[10, 20, 30, 40, 50]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="totalNumber">
             </el-pagination>
         </div>
         <el-dialog title="高级查询" :visible.sync="showAdvancedQueryDialog">
@@ -341,112 +323,112 @@
                 filter1: '',
                 filter2: '',
                 tableColumns: [
-                                                                                                                                                                {
-                                label: '名称',
-                                value: 'name',
-                                show: true
-                            },
-                                                                                                {
-                                label: '价格',
-                                value: 'price',
-                                show: true
-                            },
-                                                                                                {
-                                label: '封面',
-                                value: 'cover',
-                                show: true
-                            },
-                                                                                                {
-                                label: '图片',
-                                value: 'pic',
-                                show: true
-                            },
-                                                                                                {
-                                label: '详情',
-                                value: 'detail',
-                                show: true
-                            },
-                                                                                                {
-                                label: '积分',
-                                value: 'integral',
-                                show: true
-                            },
-                                                                                                {
-                                label: '门槛',
-                                value: 'threshold',
-                                show: true
-                            },
-                                                                                                {
-                                label: '类型',
-                                value: 'type',
-                                show: true
-                            },
-                                                                                                {
-                                label: '用户id',
-                                value: 'userId',
-                                show: true
-                            },
-                                                                                                {
-                                label: '公司id',
-                                value: 'companyId',
-                                show: true
-                            },
-                                                                                                {
-                                label: '来源',
-                                value: 'source',
-                                show: true
-                            },
-                                                                                                {
-                                label: '已领取',
-                                value: 'collected',
-                                show: true
-                            },
-                                                                                                {
-                                label: '已转赠',
-                                value: 'transferred',
-                                show: true
-                            },
-                                                                                                {
-                                label: '获奖人',
-                                value: 'collectUser',
-                                show: true
-                            },
-                                                                                                {
-                                label: '转赠人',
-                                value: 'transferUser',
-                                show: true
-                            },
-                                                                                                {
-                                label: '创建时间',
-                                value: 'createdTime',
-                                show: true
-                            },
-                                                                                                {
-                                label: '领取时间',
-                                value: 'collectTime',
-                                show: true
-                            },
-                                                                                                {
-                                label: '转赠时间',
-                                value: 'transferTime',
-                                show: true
-                            },
-                                                                                                {
-                                label: '发货',
-                                value: 'shipped',
-                                show: true
-                            },
-                                                                                                {
-                                label: '发货时间',
-                                value: 'shippedTime',
-                                show: true
-                            },
-                                                                                                {
-                                label: '物流单号',
-                                value: 'trackingNumber',
-                                show: true
-                            },
-                                                            ],
+                    {
+                        label: '名称',
+                        value: 'name',
+                        show: true
+                    },
+                    {
+                        label: '价格',
+                        value: 'price',
+                        show: true
+                    },
+                    {
+                        label: '封面',
+                        value: 'cover',
+                        show: true
+                    },
+                    {
+                        label: '图片',
+                        value: 'pic',
+                        show: true
+                    },
+                    {
+                        label: '详情',
+                        value: 'detail',
+                        show: true
+                    },
+                    {
+                        label: '积分',
+                        value: 'integral',
+                        show: true
+                    },
+                    {
+                        label: '门槛',
+                        value: 'threshold',
+                        show: true
+                    },
+                    {
+                        label: '类型',
+                        value: 'type',
+                        show: true
+                    },
+                    {
+                        label: '用户id',
+                        value: 'userId',
+                        show: true
+                    },
+                    {
+                        label: '公司id',
+                        value: 'companyId',
+                        show: true
+                    },
+                    {
+                        label: '来源',
+                        value: 'source',
+                        show: true
+                    },
+                    {
+                        label: '已领取',
+                        value: 'collected',
+                        show: true
+                    },
+                    {
+                        label: '已转赠',
+                        value: 'transferred',
+                        show: true
+                    },
+                    {
+                        label: '获奖人',
+                        value: 'collectUser',
+                        show: true
+                    },
+                    {
+                        label: '转赠人',
+                        value: 'transferUser',
+                        show: true
+                    },
+                    {
+                        label: '创建时间',
+                        value: 'createdTime',
+                        show: true
+                    },
+                    {
+                        label: '领取时间',
+                        value: 'collectTime',
+                        show: true
+                    },
+                    {
+                        label: '转赠时间',
+                        value: 'transferTime',
+                        show: true
+                    },
+                    {
+                        label: '发货',
+                        value: 'shipped',
+                        show: true
+                    },
+                    {
+                        label: '发货时间',
+                        value: 'shippedTime',
+                        show: true
+                    },
+                    {
+                        label: '物流单号',
+                        value: 'trackingNumber',
+                        show: true
+                    },
+                ],
                 multipleMode: false,
                 showAdvancedQueryDialog: false,
                 advancedQueryFields: [],
@@ -454,91 +436,91 @@
                 tableSortFields: [],
                 searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
                 advancedQueryColumns: [
-                                                                                                                                                                {
-                                label: '名称',
-                                value: 'name'
-                            },
-                                                                                                {
-                                label: '价格',
-                                value: 'price'
-                            },
-                                                                                                {
-                                label: '封面',
-                                value: 'cover'
-                            },
-                                                                                                {
-                                label: '图片',
-                                value: 'pic'
-                            },
-                                                                                                {
-                                label: '详情',
-                                value: 'detail'
-                            },
-                                                                                                {
-                                label: '积分',
-                                value: 'integral'
-                            },
-                                                                                                {
-                                label: '门槛',
-                                value: 'threshold'
-                            },
-                                                                                                {
-                                label: '类型',
-                                value: 'type'
-                            },
-                                                                                                {
-                                label: '用户id',
-                                value: 'user_id'
-                            },
-                                                                                                {
-                                label: '公司id',
-                                value: 'company_id'
-                            },
-                                                                                                {
-                                label: '来源',
-                                value: 'source'
-                            },
-                                                                                                {
-                                label: '已领取',
-                                value: 'collected'
-                            },
-                                                                                                {
-                                label: '已转赠',
-                                value: 'transferred'
-                            },
-                                                                                                {
-                                label: '获奖人',
-                                value: 'collect_user'
-                            },
-                                                                                                {
-                                label: '转赠人',
-                                value: 'transfer_user'
-                            },
-                                                                                                {
-                                label: '创建时间',
-                                value: 'created_time'
-                            },
-                                                                                                {
-                                label: '领取时间',
-                                value: 'collect_time'
-                            },
-                                                                                                {
-                                label: '转赠时间',
-                                value: 'transfer_time'
-                            },
-                                                                                                {
-                                label: '发货',
-                                value: 'shipped'
-                            },
-                                                                                                {
-                                label: '发货时间',
-                                value: 'shipped_time'
-                            },
-                                                                                                {
-                                label: '物流单号',
-                                value: 'tracking_number'
-                            },
-                                                            ],
+                    {
+                        label: '名称',
+                        value: 'name'
+                    },
+                    {
+                        label: '价格',
+                        value: 'price'
+                    },
+                    {
+                        label: '封面',
+                        value: 'cover'
+                    },
+                    {
+                        label: '图片',
+                        value: 'pic'
+                    },
+                    {
+                        label: '详情',
+                        value: 'detail'
+                    },
+                    {
+                        label: '积分',
+                        value: 'integral'
+                    },
+                    {
+                        label: '门槛',
+                        value: 'threshold'
+                    },
+                    {
+                        label: '类型',
+                        value: 'type'
+                    },
+                    {
+                        label: '用户id',
+                        value: 'user_id'
+                    },
+                    {
+                        label: '公司id',
+                        value: 'company_id'
+                    },
+                    {
+                        label: '来源',
+                        value: 'source'
+                    },
+                    {
+                        label: '已领取',
+                        value: 'collected'
+                    },
+                    {
+                        label: '已转赠',
+                        value: 'transferred'
+                    },
+                    {
+                        label: '获奖人',
+                        value: 'collect_user'
+                    },
+                    {
+                        label: '转赠人',
+                        value: 'transfer_user'
+                    },
+                    {
+                        label: '创建时间',
+                        value: 'created_time'
+                    },
+                    {
+                        label: '领取时间',
+                        value: 'collect_time'
+                    },
+                    {
+                        label: '转赠时间',
+                        value: 'transfer_time'
+                    },
+                    {
+                        label: '发货',
+                        value: 'shipped'
+                    },
+                    {
+                        label: '发货时间',
+                        value: 'shipped_time'
+                    },
+                    {
+                        label: '物流单号',
+                        value: 'tracking_number'
+                    },
+                ],
                 advancedQuerySearchKey: '',
                 orderByStr: '',
                 imgSrc: '',
@@ -688,7 +670,7 @@
             },
             exportExcel() {
                 window.location.href = this.$baseUrl + "/awardInfo/exportExcel?searchKey="
-                        + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey+"&orderByStr=" + this.orderByStr;
+                    + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey + "&orderByStr=" + this.orderByStr;
             },
             searchData() {
                 this.currentPage = 1;

+ 170 - 0
src/main/vue/src/pages/DrawRecord.vue

@@ -0,0 +1,170 @@
+<template>
+    <div>
+        <el-form :model="formData" :rules="rules" ref="form" label-width="120px" label-position="right" size="small"
+                 style="max-width: 500px;">
+            <el-form-item prop="userId" label="用户id">
+                <el-input v-model="formData.userId" :disabled="'userId'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="sessionId" label="会话id">
+                <el-input v-model="formData.sessionId" :disabled="'sessionId'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="integral" label="消耗积分">
+                <el-input v-model="formData.integral" :disabled="'integral'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="win" label="中奖">
+                <el-input v-model="formData.win" :disabled="'win'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="createTime" label="创建时间">
+                <template>
+                    <div class="block">
+                        <el-date-picker
+                            v-model="formData.createTime"
+                            type="datetime"
+                            value-format="timestamp"
+                            placeholder="选择日期"
+                            :disabled="'createTime'==subColumn">
+                        </el-date-picker>
+                    </div>
+                </template>
+            </el-form-item>
+            <el-form-item>
+                <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
+                <el-button @click="onDelete" v-if="formData.id" type="danger">删除</el-button>
+                <el-button @click="$router.go(-1)">取消</el-button>
+            </el-form-item>
+        </el-form>
+    </div>
+</template>
+<script>
+    import formValidator from '../formValidator'
+    import { mapState } from 'vuex'
+    import { format } from 'date-fns'
+    import zh from 'date-fns/locale/zh_cn'
+
+    export default {
+        name: 'DrawRecord',
+        created() {
+
+            if (this.$route.query.column) {
+                this.subColumn = this.$route.query.column.split(',')[1];
+                this.subValue = this.$route.query.column.split(',')[0];
+            }
+
+            if (this.$route.query.id) {
+                this.$http.get({
+                    url: '/drawRecord/getOne',
+                    data: {
+                        id: this.$route.query.id
+                    }
+                }).then(res => {
+                    if (res.success) {
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    this.formData = res.data;
+                        if (this.$route.query.column) {
+                            this.formData[this.subColumn] = this.subValue;
+                        }
+                    }
+                })
+            } else {
+                if (this.$route.query.column) {
+                    this.formData[this.subColumn] = this.subValue;
+                }
+            }
+
+                                                                                                                                                                                                                                                                                                                                        },
+        data() {
+            return {
+                saving: false,
+                formData: {
+                },
+                rules: {
+                },
+                subColumn: '',
+                subValue: '',
+            }
+        },
+        computed: {
+            ...mapState(['userInfo']),
+        },
+        methods: {
+            onSave() {
+                this.$refs.form.validate((valid) => {
+                    if (valid) {
+                        this.logicalValidate();
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            logicalValidate() {
+                let logicalData = {
+                };
+
+                if (JSON.stringify(logicalData) == '{}') {
+                    this.submit();
+                } else {
+                    this.$http.get({
+                        url: '/drawRecord/getOne',
+                        data: logicalData
+                    }).then(res => {
+                        if (res.success) {
+                            let logicalFlag = true;
+                            if (res.data) {
+                                if (this.formData.id) {
+                                    if (res.data.id != this.formData.id) {
+                                        logicalFlag = false;
+                                    }
+                                } else {
+                                    logicalFlag = false;
+                                }
+                            }
+
+                            if (logicalFlag) {
+                                this.submit();
+                            } else {
+                                this.$message.warning('逻辑关键字:'+''+'验证失败')
+                            }
+
+                        } else {
+                            this.$message.warning('逻辑关键字:'+''+'验证失败')
+                        }
+                    });
+                }
+            },
+            submit() {
+                let data = {...this.formData};
+
+                                                                                                                                
+                this.$http.post({
+                    url: this.formData.id ? '/drawRecord/update' : '/drawRecord/save',
+                    data: data
+                }).then(res => {
+                    if (res.success) {
+                        this.$message.success('成功');
+                        this.$router.go(-1);
+                    } else {
+                        this.$message.warning('失败')
+                    }
+                });
+            },
+            onDelete() {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
+                    return this.$http.post({
+                        url: '/drawRecord/del',
+                        data: { id: this.formData.id }
+                    })
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                }).catch(action => {
+                    if (action === 'cancel') {
+                        this.$message.info('删除取消');
+                    } else {
+                        this.$message.error('删除失败');
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped>
+</style>

+ 473 - 0
src/main/vue/src/pages/DrawRecords.vue

@@ -0,0 +1,473 @@
+<template>
+    <div>
+        <div class="filters-container">
+        
+            <el-input placeholder="关键字" size="small" v-model="filter1" clearable class="filter-item"></el-input>
+            <el-button @click="searchData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
+            </el-button>
+            <el-button @click="showAdvancedQueryDialog = !showAdvancedQueryDialog" type="primary" size="small"
+                       icon="el-icon-search" class="filter-item">高级查询
+            </el-button>
+            <el-button @click="showTableSortDialog = !showTableSortDialog" type="primary" size="small"
+                       icon="el-icon-sort" class="filter-item">排序
+            </el-button>
+            <el-button @click="$router.push({path:'/drawRecord',query:{column:$route.query.column}})" type="primary"
+                       size="small" icon="el-icon-edit"
+                       class="filter-item">添加
+            </el-button>
+            <el-button @click="exportExcel" type="primary" size="small" icon="el-icon-share" class="filter-item">导出EXCEL
+            </el-button>
+            <el-dropdown trigger="click" size="medium" class="table-column-filter">
+                <span>
+                  筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
+                </span>
+                <el-dropdown-menu slot="dropdown" class="table-column-filter-wrapper">
+                    <el-checkbox v-for="item in tableColumns" :key="item.value" v-model="item.show">{{item.label}}
+                    </el-checkbox>
+                </el-dropdown-menu>
+            </el-dropdown>
+        </div>
+        <el-table
+                :data="tableData"
+                :height="tableHeight"
+                row-key="id"
+                ref="table">
+            <el-table-column
+                    v-if="multipleMode"
+                    align="center"
+                    type="selection"
+                    width="50">
+            </el-table-column>
+            <el-table-column
+                    type="index"
+                    min-width="50"
+                    align="center">
+            </el-table-column>
+                                                                                    
+                                            <el-table-column
+                                v-if="isColumnShow('userId')"
+                                prop="userId"
+                                label="用户id"
+                                min-width="100">
+                        </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('sessionId')"
+                                prop="sessionId"
+                                label="会话id"
+                                min-width="100">
+                        </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('integral')"
+                                prop="integral"
+                                label="消耗积分"
+                                min-width="100">
+                        </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('win')"
+                                prop="win"
+                                label="中奖"
+                                min-width="100">
+                        </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('createTime')"
+                                prop="createTime"
+                                label="创建时间"
+                                :formatter="DateTimeFormatter"
+                                min-width="100">
+                        </el-table-column>
+                                                            <el-table-column
+                    label="操作"
+                    align="center"
+                    fixed="right"
+                    min-width="150"
+            >
+                <template slot-scope="scope">
+                                        <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(scope.row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <div class="multiple-mode-wrapper" v-if="0">
+                <el-button size="small" v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button size="small" @click="operation1">批量操作1</el-button>
+                    <el-button size="small" @click="operation2">批量操作2</el-button>
+                    <el-button size="small" @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div>
+            <el-pagination
+                    background
+                    @size-change="pageSizeChange"
+                    @current-change="currentPageChange"
+                    :current-page="currentPage"
+                    :page-sizes="[10, 20, 30, 40, 50]"
+                    :page-size="pageSize"
+                    layout="total, sizes, prev, pager, next, jumper"
+                    :total="totalNumber">
+            </el-pagination>
+        </div>
+        <el-dialog title="高级查询" :visible.sync="showAdvancedQueryDialog">
+            <el-button @click="addField" type="text" icon="el-icon-plus">添加</el-button>
+            <el-table :data="advancedQueryFields">
+
+                <el-table-column prop="link" label="链接符" align="center">
+                    <template slot-scope="{row}">
+                        <el-select placeholder="链接" size="small" v-model="row.link" class="filter-item">
+                            <el-option label="AND" value="AND">
+                            </el-option>
+                            <el-option label="OR" value="OR">
+                            </el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="name" label="字段" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.name">
+
+                            <el-option v-for="item in advancedQueryColumns" :label="item.label" :value="item.value"
+                                       :key="item.value"></el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="searchMethod" label="搜索方式" width="150" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.searchMethod">
+                            <el-option v-for="item in searchMethods" :label="item" :value="item"
+                                       :key="item"></el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="value" label="参数" align="center">
+                    <template slot-scope="{row}">
+                        <el-input v-model="row.value"></el-input>
+                    </template>
+                </el-table-column>
+                <el-table-column width="60" align="center">
+                    <template slot-scope="{ row, column, $index }">
+                        <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+
+            <span slot="footer" class="dialog-footer">
+
+                <el-button @click="advancedQuery" :loading="$store.state.fetchingData">确定</el-button>
+            </span>
+        </el-dialog>
+
+        <el-dialog title="排序" :visible.sync="showTableSortDialog">
+            <el-button @click="addSortField" type="text" icon="el-icon-plus">添加</el-button>
+            <el-table :data="tableSortFields">
+
+                <el-table-column prop="name" label="字段" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.name">
+
+                            <el-option v-for="item in advancedQueryColumns" :label="item.label" :value="item.value"
+                                       :key="item.value"></el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="order" label="排序" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.order">
+                            <el-option label="降序" value="desc">
+                            </el-option>
+                            <el-option label="升序" value="asc">
+                            </el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column width="60" align="center">
+                    <template slot-scope="{ row, column, $index }">
+                        <el-button @click="removeSortField($index)" size="small" type="text">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+
+            <span slot="footer" class="dialog-footer">
+
+                <el-button @click="tableSortQuery" :loading="$store.state.fetchingData">确定</el-button>
+            </span>
+        </el-dialog>
+
+        <el-dialog title="查看图片" :visible.sync="imageDialogVisible" size="small">
+            <img width="100%" :src="imgSrc" alt="">
+        </el-dialog>
+
+    </div>
+</template>
+<script>
+    import {mapState} from 'vuex'
+    import {format} from 'date-fns'
+    import zh from 'date-fns/locale/zh_cn'
+
+    export default {
+        name: 'DrawRecords',
+        created() {
+            this.getData();
+        },
+        data() {
+            return {
+                totalNumber: 0,
+                totalPage: 10,
+                currentPage: 1,
+                pageSize: 20,
+                tableData: [],
+                filter1: '',
+                filter2: '',
+                tableColumns: [
+                                                                                                                                                                {
+                                label: '用户id',
+                                value: 'userId',
+                                show: true
+                            },
+                                                                                                {
+                                label: '会话id',
+                                value: 'sessionId',
+                                show: true
+                            },
+                                                                                                {
+                                label: '消耗积分',
+                                value: 'integral',
+                                show: true
+                            },
+                                                                                                {
+                                label: '中奖',
+                                value: 'win',
+                                show: true
+                            },
+                                                                                                {
+                                label: '创建时间',
+                                value: 'createTime',
+                                show: true
+                            },
+                                                            ],
+                multipleMode: false,
+                showAdvancedQueryDialog: false,
+                advancedQueryFields: [],
+                showTableSortDialog: false,
+                tableSortFields: [],
+                searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
+                advancedQueryColumns: [
+                                                                                                                                                                {
+                                label: '用户id',
+                                value: 'user_id'
+                            },
+                                                                                                {
+                                label: '会话id',
+                                value: 'session_id'
+                            },
+                                                                                                {
+                                label: '消耗积分',
+                                value: 'integral'
+                            },
+                                                                                                {
+                                label: '中奖',
+                                value: 'win'
+                            },
+                                                                                                {
+                                label: '创建时间',
+                                value: 'create_time'
+                            },
+                                                            ],
+                advancedQuerySearchKey: '',
+                orderByStr: '',
+                imgSrc: '',
+                imageDialogVisible: false,
+            }
+        },
+        computed: {
+            ...mapState(['tableHeight']),
+            selection() {
+                return this.$refs.table.selection.map(i => i.id);
+            }
+        },
+        methods: {
+            pageSizeChange(size) {
+                this.currentPage = 1;
+                this.pageSize = size;
+                this.getData();
+            },
+            currentPageChange(page) {
+                this.currentPage = page;
+                this.getData();
+            },
+            getData() {
+
+                var data = {
+                    currentPage: this.currentPage,
+                    pageNumber: this.pageSize,
+                    searchKey: this.filter1,
+                    advancedQuery: this.advancedQuerySearchKey,
+                    orderByStr: this.orderByStr,
+                }
+
+                if (this.$route.query.column) {
+                    var tempColumn = this.$route.query.column;
+                    data[tempColumn.split(',')[1]] = tempColumn.split(',')[0];
+                }
+
+                this.$http.get({
+                    url: '/drawRecord/page',
+                    data: data
+                }).then(res => {
+                    if (res.success) {
+                        this.totalNumber = res.data.page.totalNumber;
+                        this.tableData = res.data.pp;
+                    }
+                })
+            },
+            isColumnShow(column) {
+                var row = this.tableColumns.find(i => i.value === column);
+                return row ? row.show : false;
+            },
+            toggleMultipleMode(multipleMode) {
+                this.multipleMode = multipleMode;
+                if (!multipleMode) {
+                    this.$refs.table.clearSelection();
+                }
+            },
+            editRow(row) {
+                this.$router.push({
+                    path: '/drawRecord',
+                    query: {
+                        id: row.id,
+                        column: this.$route.query.column,
+                    }
+                })
+            },
+            operation1() {
+                this.$notify({
+                    title: '提示',
+                    message: this.selection
+                });
+            },
+            operation2() {
+                this.$message('操作2');
+            },
+            addField() {
+                this.advancedQueryFields.push({
+                    link: 'AND',
+                    name: '',
+                    searchMethod: '=',
+                    value: '',
+                });
+            },
+            removeField(i) {
+                if (this.advancedQueryFields.length > 0) {
+                    this.advancedQueryFields.splice(i, 1);
+                }
+            },
+            advancedQuery() {
+
+                this.advancedQuerySearchKey = '';
+
+                if (this.advancedQueryFields.length > 0) {
+
+                    var templist = [];
+
+                    this.advancedQueryFields.forEach(item => {
+                        if (item.link && item.name && item.searchMethod && item.value) {
+                            var tempItem = item.link + '_,' + item.name + '_,' + item.searchMethod + '_,' + item.value;
+                            templist.push(tempItem);
+                        }
+                    })
+
+                    if (templist.length > 0) {
+
+                        this.advancedQuerySearchKey = templist.join('_;');
+                    }
+                }
+
+                this.getData();
+                this.showAdvancedQueryDialog = false;
+            },
+            addSortField() {
+                this.tableSortFields.push({
+                    name: '',
+                    order: 'asc',
+                });
+            },
+            removeSortField(i) {
+                if (this.tableSortFields.length > 0) {
+                    this.tableSortFields.splice(i, 1);
+                }
+            },
+            tableSortQuery() {
+
+                this.orderByStr = '';
+
+                if (this.tableSortFields.length > 0) {
+
+                    var templist = [];
+
+                    this.tableSortFields.forEach(item => {
+                        if (item.name && item.order) {
+                            var tempItem = item.name + '_,' + item.order;
+                            templist.push(tempItem);
+                        }
+                    })
+
+                    if (templist.length > 0) {
+
+                        this.orderByStr = templist.join('_;');
+                    }
+                }
+
+                this.getData();
+                this.showTableSortDialog = false;
+            },
+            exportExcel() {
+                window.location.href = this.$baseUrl + "/drawRecord/exportExcel?searchKey="
+                        + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey+"&orderByStr=" + this.orderByStr;
+            },
+            searchData() {
+                this.currentPage = 1;
+                this.getData();
+            },
+            deleteRow(row) {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post({
+                        url: '/drawRecord/del',
+                        data: {id: row.id}
+                    })
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                }).catch(action => {
+                    if (action === 'cancel') {
+                        this.$message.info('删除取消');
+                    } else {
+                        this.$message.error('删除失败');
+                    }
+                })
+            },
+            DateTimeFormatter(row, column, cellValue) {
+                if (cellValue) {
+                    return format(cellValue, 'YYYY/MM/DD HH:mm', {locale: zh})
+                }
+
+            },
+            DateFormatter(row, column, cellValue) {
+                if (cellValue) {
+                    return format(cellValue, 'YYYY/MM/DD', {locale: zh})
+                }
+
+            },
+            showImg(img) {
+                this.imgSrc = img;
+                this.imageDialogVisible = true;
+            },
+
+        }
+    }
+</script>
+<style lang="less" scoped>
+
+</style>

+ 12 - 7
src/main/vue/src/pages/SystemConfig.vue

@@ -5,12 +5,14 @@
             <el-form-item prop="name" label="名称">
                 <el-input v-model="formData.name" :disabled="'name'==subColumn"></el-input>
             </el-form-item>
-            <el-form-item prop="value" label="值">
-                <el-input v-model="formData.value" :disabled="'value'==subColumn"></el-input>
+            <el-form-item prop="configKey" label="键">
+                <el-input v-model="formData.configKey" :disabled="'configKey'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="configValue" label="值">
+                <el-input v-model="formData.configValue" :disabled="'configValue'==subColumn"></el-input>
             </el-form-item>
             <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
-                <el-button @click="onDelete" v-if="formData.id" type="danger">删除</el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
             </el-form-item>
         </el-form>
@@ -39,7 +41,7 @@
                     }
                 }).then(res => {
                     if (res.success) {
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                this.formData = res.data;
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            this.formData = res.data;
                         if (this.$route.query.column) {
                             this.formData[this.subColumn] = this.subValue;
                         }
@@ -51,7 +53,7 @@
                 }
             }
 
-                                                                                                                                                                                                    },
+                                                                                                                                                                                                                                                },
         data() {
             return {
                 saving: false,
@@ -61,7 +63,10 @@
                     name: [
                         {required: true, message: '请输入 名称', trigger: 'blur'},
                     ],
-                    value: [
+                    configKey: [
+                        {required: true, message: '请输入 键', trigger: 'blur'},
+                    ],
+                    configValue: [
                         {required: true, message: '请输入 值', trigger: 'blur'},
                     ],
                 },
@@ -120,7 +125,7 @@
             submit() {
                 let data = {...this.formData};
 
-                                                                                
+                                                                                                
                 this.$http.post({
                     url: this.formData.id ? '/systemConfig/update' : '/systemConfig/save',
                     data: data

+ 20 - 5
src/main/vue/src/pages/SystemConfigs.vue

@@ -52,8 +52,15 @@
                         </el-table-column>
                                                                 
                                             <el-table-column
-                                v-if="isColumnShow('value')"
-                                prop="value"
+                                v-if="isColumnShow('configKey')"
+                                prop="configKey"
+                                label="键"
+                                min-width="100">
+                        </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('configValue')"
+                                prop="configValue"
                                 label="值"
                                 min-width="100">
                         </el-table-column>
@@ -65,7 +72,6 @@
             >
                 <template slot-scope="scope">
                                         <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
-                    <el-button @click="deleteRow(scope.row)" type="danger" size="mini" plain>删除</el-button>
                 </template>
             </el-table-column>
         </el-table>
@@ -204,10 +210,15 @@
                                 label: '名称',
                                 value: 'name',
                                 show: true
+                            },
+                                                                                                {
+                                label: '键',
+                                value: 'configKey',
+                                show: true
                             },
                                                                                                 {
                                 label: '值',
-                                value: 'value',
+                                value: 'configValue',
                                 show: true
                             },
                                                             ],
@@ -221,10 +232,14 @@
                                                                                                                                                                 {
                                 label: '名称',
                                 value: 'name'
+                            },
+                                                                                                {
+                                label: '键',
+                                value: 'config_key'
                             },
                                                                                                 {
                                 label: '值',
-                                value: 'value'
+                                value: 'config_value'
                             },
                                                             ],
                 advancedQuerySearchKey: '',

+ 10 - 0
src/main/vue/src/router/index.js

@@ -204,6 +204,16 @@ const router = new Router({
                     path: '/systemConfigs',
                     name: 'SystemConfigs',
                     component: () => import('../pages/SystemConfigs')
+                },
+                {
+                    path: '/drawRecord',
+                    name: 'DrawRecord',
+                    component: () => import('../pages/DrawRecord')
+                },
+                {
+                    path: '/drawRecords',
+                    name: 'DrawRecords',
+                    component: () => import('../pages/DrawRecords')
                 }
                 /**INSERT_LOCATION**/
             ]