x1ongzhu 7 лет назад
Родитель
Сommit
4c354775f0

+ 3 - 0
src/main/java/com/izouma/awesomeadmin/constant/AppConstant.java

@@ -534,4 +534,7 @@ public interface AppConstant {
         String JOIN_ROOMS_NORMAL    = "joinRoomsNormal"; // 用户每日加入高级房间次数
         String JOIN_ROOMS_ADVANCED  = "joinRoomsAdvanced"; // 用户每日加入高级房间次数
     }
+
+
+
 }

+ 38 - 0
src/main/java/com/izouma/awesomeadmin/dao/CheckinRecordMapper.java

@@ -0,0 +1,38 @@
+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.CheckinRecord;
+
+
+/**
+ * Dao接口
+ */
+@Repository("com.zoumaframe.dao.CheckinRecordMapper")
+public interface CheckinRecordMapper {
+    /*generatedStart*/
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(CheckinRecord record);
+
+    CheckinRecord selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(CheckinRecord record);
+
+    List<CheckinRecord> queryAllCheckinRecord(CheckinRecord record);
+
+    List<CheckinRecord> queryCheckinRecordByPage(Map<String, Object> parameter);
+
+    int delete(CheckinRecord record);
+
+    CheckinRecord queryCheckinRecord(CheckinRecord record);
+
+    List<CheckinRecord> query(CheckinRecord record);
+    /*generatedEnd*/
+
+    List<CheckinRecord> queryWeekRecord(@Param("userId") Integer userId);
+}
+

+ 344 - 0
src/main/java/com/izouma/awesomeadmin/dao/CheckinRecordMapper.xml

@@ -0,0 +1,344 @@
+<?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.CheckinRecordMapper">
+    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.CheckinRecord">
+        <!--generatedStart-->
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
+        <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+        <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
+        <result column="user_id" property="userId" jdbcType="INTEGER"/>
+        <!--generatedEnd-->
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        <!--generatedStart-->
+        id, del_flag, update_time, update_user, create_time, create_user, user_id        <!--generatedEnd-->
+    </sql>
+
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM checkin_record
+        WHERE id = #{id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        DELETE
+        FROM checkin_record
+        WHERE id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.CheckinRecord" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO checkin_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <!--generatedStart-->
+            <if test="id!= null">
+                id,
+            </if>
+            <if test="delFlag!= null">
+                del_flag,
+            </if>
+            <if test="updateTime!= null">
+                update_time,
+            </if>
+            <if test="updateUser!= null">
+                update_user,
+            </if>
+            <if test="createTime!= null">
+                create_time,
+            </if>
+            <if test="createUser!= null">
+                create_user,
+            </if>
+            <if test="userId!= null">
+                user_id,
+            </if>
+            <!--generatedEnd-->
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <!--generatedStart-->
+            <if test="id != null">
+                #{id,jdbcType=INTEGER},
+            </if>
+            <if test="delFlag != null">
+                #{delFlag,jdbcType=CHAR},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateUser != null">
+                #{updateUser,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="createUser != null">
+                #{createUser,jdbcType=VARCHAR},
+            </if>
+            <if test="userId != null">
+                #{userId,jdbcType=INTEGER},
+            </if>
+            <!--generatedEnd-->
+        </trim>
+    </insert>
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.CheckinRecord">
+        UPDATE checkin_record
+        <set>
+            <!--generatedStart-->
+            <if test="id != null">
+                id= #{id,jdbcType=INTEGER},
+            </if>
+            <if test="delFlag != null">
+                del_flag= #{delFlag,jdbcType=CHAR},
+            </if>
+            <if test="updateTime != null">
+                update_time= #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateUser != null">
+                update_user= #{updateUser,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null">
+                create_time= #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="createUser != null">
+                create_user= #{createUser,jdbcType=VARCHAR},
+            </if>
+            <if test="userId != null">
+                user_id= #{userId,jdbcType=INTEGER},
+            </if>
+            <!--generatedEnd-->
+        </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="queryCheckinRecordByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
+        SELECT <include refid="Base_Column_List"/> FROM checkin_record
+        <where>
+            AND del_flag = 'N'
+            <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
+                AND id IN (${record.idStr})
+            </if>
+            <!--generatedStart-->
+            <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.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
+                AND update_time = #{record.updateTime}
+            </if>
+            <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
+                AND update_user = #{record.updateUser}
+            </if>
+            <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
+                AND create_time = #{record.createTime}
+            </if>
+            <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
+                AND create_user = #{record.createUser}
+            </if>
+            <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
+                AND user_id = #{record.userId}
+            </if>
+            <!--generatedEnd-->
+            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    <!--generatedStart-->
+                    OR user_id LIKE concat('%',#{record.searchKey},'%')
+                    <!--generatedEnd-->
+                </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="queryAllCheckinRecord" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
+        SELECT <include refid="Base_Column_List"/> FROM checkin_record
+        <where>
+            AND del_flag = 'N'
+            <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+                AND id IN (${idStr})
+            </if>
+            <!--generatedStart-->
+            <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="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                AND update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                AND update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                AND create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                AND create_user = #{createUser}
+            </if>
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                AND user_id = #{userId}
+            </if>
+            <!--generatedEnd-->
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    <!--generatedStart-->
+                    OR user_id LIKE concat('%',#{searchKey},'%')
+                    <!--generatedEnd-->
+                </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="queryCheckinRecord" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
+        SELECT <include refid="Base_Column_List"/> FROM checkin_record
+        <where>
+            AND del_flag = 'N'
+            <!--generatedStart-->
+            <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="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                AND update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                AND update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                AND create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                AND create_user = #{createUser}
+            </if>
+            <if test="userId != null and !&quot;&quot;.equals(userId)">
+                AND user_id = #{userId}
+            </if>
+            <!--generatedEnd-->
+        </where>
+        LIMIT 1
+    </select>
+
+    <update id="delete">
+        UPDATE checkin_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.CheckinRecord">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM checkin_record
+        <where>
+            AND del_flag = 'N'
+            <!--generatedStart-->
+            <!--generatedEnd-->
+        </where>
+        ORDER BY id DESC
+    </select>
+
+    <select id="queryWeekRecord" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
+        SELECT <include refid="Base_Column_List"/>, (weekday(create_time) + 1) AS week_day
+        FROM checkin_record
+        WHERE del_flag = 'N'
+          AND user_id = 1
+          AND yearweek(create_time, 1) = yearweek(now(), 1)
+        GROUP BY week_day
+    </select>
+</mapper>
+

+ 136 - 0
src/main/java/com/izouma/awesomeadmin/model/CheckinRecord.java

@@ -0,0 +1,136 @@
+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 CheckinRecord {
+    /*generatedStart*/
+    private Integer id;
+    private String  delFlag;
+    private Date    updateTime;
+    private String  updateUser;
+    private Date    createTime;
+    private String  createUser;
+    private Integer userId;
+
+    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;
+    /*generatedEnd*/
+
+    private Integer weekDay;
+
+    /*generatedStart*/
+    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 Date getUpdateTime() {
+        return this.updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getUpdateUser() {
+        return this.updateUser;
+    }
+
+    public void setUpdateUser(String updateUser) {
+        this.updateUser = updateUser;
+    }
+
+    public Date getCreateTime() {
+        return this.createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getCreateUser() {
+        return this.createUser;
+    }
+
+    public void setCreateUser(String createUser) {
+        this.createUser = createUser;
+    }
+
+    public Integer getUserId() {
+        return this.userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    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;
+    }
+    /*generatedEnd*/
+
+    public Integer getWeekDay() {
+        return weekDay;
+    }
+
+    public void setWeekDay(Integer weekDay) {
+        this.weekDay = weekDay;
+    }
+}
+

+ 33 - 0
src/main/java/com/izouma/awesomeadmin/service/CheckinRecordService.java

@@ -0,0 +1,33 @@
+package com.izouma.awesomeadmin.service;
+
+import java.util.*;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.dto.Result;
+import com.izouma.awesomeadmin.model.CheckinRecord;
+
+
+/**
+*  service接口类
+*/
+public interface CheckinRecordService{
+    /*generatedStart*/
+    List<CheckinRecord> getCheckinRecordList(CheckinRecord record);
+
+    List<CheckinRecord> getCheckinRecordByPage(Page page, CheckinRecord record);
+
+    CheckinRecord getCheckinRecordById(String id);
+
+    CheckinRecord getCheckinRecord(CheckinRecord record);
+
+    boolean createCheckinRecord(CheckinRecord record);
+
+    boolean deleteCheckinRecord(CheckinRecord record);
+
+    boolean updateCheckinRecord(CheckinRecord record);
+    /*generatedEnd*/
+
+    Map<String,Object> weekRecord(Integer userId);
+
+    Result checkin(Integer userId);
+}
+

+ 161 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/CheckinRecordServiceImpl.java

@@ -0,0 +1,161 @@
+package com.izouma.awesomeadmin.service.impl;
+
+import java.util.*;
+
+import com.izouma.awesomeadmin.dto.Result;
+import org.apache.commons.lang3.time.DateFormatUtils;
+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.CheckinRecord;
+import com.izouma.awesomeadmin.service.CheckinRecordService;
+import com.izouma.awesomeadmin.dao.CheckinRecordMapper;
+
+/**
+ * service接口实现类
+ */
+@Service
+public class CheckinRecordServiceImpl implements CheckinRecordService {
+    /*generatedStart*/
+    private static Logger logger = Logger.getLogger(CheckinRecordServiceImpl.class);
+
+    @Autowired
+    private CheckinRecordMapper checkinRecordMapper;
+    /*generatedEnd*/
+
+    /*generatedStart*/
+    @Override
+    public List<CheckinRecord> getCheckinRecordList(CheckinRecord record) {
+        logger.info("getCheckinRecordList");
+        try {
+            return checkinRecordMapper.queryAllCheckinRecord(record);
+        } catch (Exception e) {
+            logger.error("getCheckinRecordList", e);
+        }
+        return null;
+    }
+
+    @Override
+    public List<CheckinRecord> getCheckinRecordByPage(Page page, CheckinRecord record) {
+        logger.info("getCheckinRecordByPage");
+        try {
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
+
+            return checkinRecordMapper.queryCheckinRecordByPage(parameter);
+        } catch (Exception e) {
+            logger.error("getCheckinRecordByPage", e);
+        }
+        return null;
+    }
+
+    @Override
+    public CheckinRecord getCheckinRecordById(String id) {
+        logger.info("getCheckinRecordyId");
+        try {
+            return checkinRecordMapper.selectByPrimaryKey(Integer.valueOf(id));
+        } catch (Exception e) {
+            logger.error("getCheckinRecordById", e);
+        }
+        return null;
+    }
+
+    @Override
+    public CheckinRecord getCheckinRecord(CheckinRecord record) {
+        logger.info("getCheckinRecord");
+        try {
+            return checkinRecordMapper.queryCheckinRecord(record);
+        } catch (Exception e) {
+            logger.error("getCheckinRecord", e);
+        }
+        return null;
+    }
+
+    @Override
+    public boolean createCheckinRecord(CheckinRecord record) {
+        logger.info("createCheckinRecord");
+        try {
+            int updates = checkinRecordMapper.insertSelective(record);
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("createCheckinRecord", e);
+        }
+        return false;
+    }
+
+    @Override
+    public boolean deleteCheckinRecord(CheckinRecord record) {
+        logger.info("deleteCheckinRecord");
+        try {
+            int updates = checkinRecordMapper.delete(record);
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("deleteCheckinRecord", e);
+        }
+        return false;
+    }
+
+    @Override
+    public boolean updateCheckinRecord(CheckinRecord record) {
+        logger.info("updateCheckinRecord");
+        try {
+            int updates = checkinRecordMapper.updateByPrimaryKeySelective(record);
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("updateCheckinRecord", e);
+        }
+        return false;
+    }
+    /*generatedEnd*/
+
+    @Override
+    public Map<String, Object> weekRecord(Integer userId) {
+        logger.info("weekRecord");
+        try {
+            List<CheckinRecord> weekRecord = checkinRecordMapper.queryWeekRecord(userId);
+            Map<String, Object> map = new HashMap<>();
+            for (CheckinRecord record : weekRecord) {
+                map.put(record.getWeekDay().toString(), record);
+            }
+            return map;
+        } catch (Exception e) {
+            logger.error(e);
+        }
+        return null;
+    }
+
+    @Override
+    public Result checkin(Integer userId) {
+        logger.info("checkin");
+        try {
+            CheckinRecord checkinRecord = new CheckinRecord();
+            checkinRecord.setCreateTime(new Date());
+            checkinRecord.setUserId(userId);
+            checkinRecord = getCheckinRecord(checkinRecord);
+            if (checkinRecord != null) {
+                return new Result(false, "今日已签到,请勿重复签到");
+            }
+            checkinRecord = new CheckinRecord();
+            checkinRecord.setUserId(userId);
+            if (createCheckinRecord(checkinRecord)) {
+                Map<String, Object> map = new HashMap<>();
+                //todo: 赠送金币道具
+                return new Result(true, "签到成功");
+            }
+        } catch (Exception e) {
+            logger.error(e);
+        }
+        return new Result(false, "签到失败,请稍后再试");
+    }
+
+}
+

+ 17 - 3
src/main/java/com/izouma/awesomeadmin/service/impl/HouseInfoServiceImpl.java

@@ -3,6 +3,7 @@ package com.izouma.awesomeadmin.service.impl;
 import java.math.BigDecimal;
 import java.util.*;
 
+import com.izouma.awesomeadmin.beans.UserPlayTimes;
 import com.izouma.awesomeadmin.dao.CompetitionSeasonMapper;
 import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.*;
@@ -509,6 +510,11 @@ public class HouseInfoServiceImpl implements HouseInfoService {
                 return new Result(false, "加入失败,游戏已开始!");
             }
 
+            Competition competition = competitionService.getCompetitionById(record.getCompetitionId().toString());
+            if (competition == null) {
+                return new Result(false, "加入失败,比赛不存在!");
+            }
+
             //检查是否重复加入
             PlayerInfo playerInfo = playerInfoService.getPlayerInfo(record);
             if (playerInfo != null) {
@@ -516,13 +522,21 @@ public class HouseInfoServiceImpl implements HouseInfoService {
             }
 
             //todo: 检查剩余次数
-
-            //todo: 使用道具
+            UserPlayTimes userPlayTimes = playerInfoService.getUserPlayTimes(userInfo.getId());
+            int restTimes = 0;
+            if (AppConstant.CompetitionType.NORMAL == competition.getType()) {
+                restTimes = userPlayTimes.getTotalNormal() - userPlayTimes.getUsedNormal();
+            } else if (AppConstant.CompetitionType.ADVANCE == competition.getType()) {
+                restTimes = userPlayTimes.getTotalAdvanced() - userPlayTimes.getUsedAdvanced();
+            }
+            if (restTimes<=0){
+                //todo: 使用道具
+                return new Result(false, "加入失败,今日次数已用完");
+            }
 
             double entryCoin = 0;
             double moneyCoin = userInfo.getMoneyCoin();
 
-
             record.setGameId(houseInfo.getGameId());
             record.setHouseId(houseInfo.getId());
             record.setJoinTime(new Date());

+ 34 - 37
src/main/java/com/izouma/awesomeadmin/util/DateTimeTool.java

@@ -9,18 +9,16 @@ import java.util.Date;
 import java.util.GregorianCalendar;
 
 /**
- * 
- * <p>日期时间工具类。</p> 
- * 
- * @version 1.0
+ * <p>日期时间工具类。</p>
+ *
  * @author 索晨成 <br />
  * 更新履历 <br />
- *  日期 : 姓名: 更新内容<br />
+ * 日期 : 姓名: 更新内容<br />
+ * @version 1.0
  */
 public class DateTimeTool {
 
     /**
-     * 
      * <p>时间间隔转换。</p>
      *
      * @param createtime
@@ -296,7 +294,7 @@ public class DateTimeTool {
     /**
      * 将日期按照传入的格式进行格式化
      *
-     * @param date 日期
+     * @param date   日期
      * @param format 格式化
      * @return 转换后日期
      */
@@ -317,8 +315,8 @@ public class DateTimeTool {
      * 将日期按照传入的格式进行格式化
      *
      * @param dateTime 日期
-     * @param format1 传入参数的时间类型
-     * @param format2 格式化时间类型
+     * @param format1  传入参数的时间类型
+     * @param format2  格式化时间类型
      * @return 转换后日期
      */
     public static Date dateTimeStrToDateTime(String dateTime, String format1, String format2) {
@@ -343,7 +341,7 @@ public class DateTimeTool {
      * 将字符串转换为时间类型
      *
      * @param dateTimeStr 日期和时间字符串
-     * @param format 日期和时间格式
+     * @param format      日期和时间格式
      * @return 转换后的日期和时间
      * @author tang_wenwei
      */
@@ -364,7 +362,7 @@ public class DateTimeTool {
     /**
      * 将时间格式转换为字符串 yyyy-MM-dd
      *
-     * @param dateDate  日期
+     * @param dateDate 日期
      * @return 转换后日期
      */
     public static String dateTimeToStr(Date dateDate) {
@@ -379,7 +377,7 @@ public class DateTimeTool {
     /**
      * 将时间格式转换为字符串MM-dd
      *
-     * @param dateDate  日期
+     * @param dateDate 日期
      * @return 转换后日期
      */
     public static String dateTimeToStrOfMMDD(Date dateDate) {
@@ -399,8 +397,8 @@ public class DateTimeTool {
     /**
      * 将时间格式转换为字符串 yyyy-MM-dd
      *
-     * @param dateDate  日期
-     * @param format 格式化类型
+     * @param dateDate 日期
+     * @param format   格式化类型
      * @return 转换后日期
      */
     public static String dateTimeToStr(Date dateDate, String format) {
@@ -413,11 +411,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>将日期和时间相加返回字符型。</p>
      *
      * @param dateDate 日期
-     * @param time 时间
+     * @param time     时间
      * @return 转换后时间
      */
     public static String dateAddTimeToStr(Date dateDate, String time) {
@@ -430,11 +427,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>将日期和时间相加返回日期型。</p>
      *
      * @param dateDate 日期
-     * @param time 时间
+     * @param time     时间
      * @return 转换后时间
      */
     public static Date dateAddTimeToDateTimeHHMMSS(Date dateDate, String time) {
@@ -459,11 +455,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>将日期和时间相加返回日期型。</p>
      *
      * @param dateDate 日期
-     * @param time 时间
+     * @param time     时间
      * @return 转换后时间
      */
     public static Date dateAddTimeToDateTime(Date dateDate, String time) {
@@ -485,11 +480,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>时间加上固定秒钟数。</p>
      *
      * @param dateTime 时间
-     * @param seconds 秒钟
+     * @param seconds  秒钟
      * @return 相加后的结果
      */
     public static Date dateTimeAddSeconds(Date dateTime, int seconds) {
@@ -506,11 +500,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>时间减去固定秒钟数。</p>
      *
      * @param dateTime 时间
-     * @param seconds 秒钟
+     * @param seconds  秒钟
      * @return 相减后的结果
      */
     public static Date dateTimeSubtractSeconds(Date dateTime, int seconds) {
@@ -524,11 +517,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>时间减去固定分钟数。</p>
      *
      * @param dateTime 时间
-     * @param minutes 分钟
+     * @param minutes  分钟
      * @return 相减后的结果
      */
     public static Date dateTimeSubtractMinutes(Date dateTime, int minutes) {
@@ -542,11 +534,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>时间加上固定分钟数。</p>
      *
      * @param dateTime 时间
-     * @param minutes 分钟
+     * @param minutes  分钟
      * @return 相加后的结果
      */
     public static Date dateTimeAddMinutes(Date dateTime, int minutes) {
@@ -570,7 +561,7 @@ public class DateTimeTool {
      * <p>时间加上固定分钟数(计算制作时间和准备时间)。</p>
      *
      * @param dateTime 时间
-     * @param minutes 分钟
+     * @param minutes  分钟
      * @return 相加后的结果
      */
     public static Date dateTimeAddMinutes(Date dateTime, BigDecimal minutes) {
@@ -587,11 +578,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>时间减去固定小时数。</p>
      *
      * @param dateTime 时间
-     * @param hours 小时
+     * @param hours    小时
      * @return 相减后的结果
      */
     public static Date dateTimeSubtractHours(Date dateTime, int hours) {
@@ -603,11 +593,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>时间加上固定小时数。</p>
      *
      * @param dateTime 时间
-     * @param hours 小时
+     * @param hours    小时
      * @return 相加后的结果
      */
     public static Date dateTimeAddHours(Date dateTime, int hours) {
@@ -623,11 +612,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>将时间往后推N天。</p>
      *
      * @param dateTime 时间
-     * @param dayNum 往后推的天数
+     * @param dayNum   往后推的天数
      * @return 计算结果
      */
     public static Date dateTimeAddDay(Date dateTime, int dayNum) {
@@ -650,11 +638,10 @@ public class DateTimeTool {
 
 
     /**
-     * 
      * <p>将时间往后推N月。</p>
      *
      * @param dateTime 时间
-     * @param dayNum 往后推的月数
+     * @param dayNum   往后推的月数
      * @return 计算结果
      */
     public static Date dateTimeAddMonth(Date dateTime, int monthNum) {
@@ -707,4 +694,14 @@ public class DateTimeTool {
         return age;
     }
 
+    public static int getDayOfWeek(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int week = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+        if (week < 0) {
+            week += 7;
+        }
+        return week;
+    }
+
 }

+ 136 - 0
src/main/java/com/izouma/awesomeadmin/web/CheckinRecordController.java

@@ -0,0 +1,136 @@
+package com.izouma.awesomeadmin.web;
+
+import java.util.*;
+
+import com.izouma.awesomeadmin.model.UserInfo;
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.commons.lang.StringUtils;
+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.CheckinRecord;
+import com.izouma.awesomeadmin.service.CheckinRecordService;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Controller
+@RequestMapping("/checkinRecord")
+public class CheckinRecordController {
+    /*generatedStart*/
+    @Autowired
+    private CheckinRecordService checkinRecordService;
+    /*generatedEnd*/
+
+    /*generatedStart*/
+    @RequiresAuthentication
+    @RequestMapping(value = "/all", method = RequestMethod.GET)
+    @ResponseBody
+    public Result all(CheckinRecord record) {
+        List<CheckinRecord> pp = checkinRecordService.getCheckinRecordList(record);
+        return new Result(true, pp);
+    }
+
+    @RequestMapping(value = "/getCheckinRecord", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getCheckinRecord(@RequestParam(required = false, value = "id") String id) {
+        CheckinRecord data = checkinRecordService.getCheckinRecordById(id);
+        return new Result(true, data);
+    }
+
+    @RequestMapping(value = "/getOne", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getOne(CheckinRecord record) {
+        CheckinRecord data = checkinRecordService.getCheckinRecord(record);
+        return new Result(true, data);
+    }
+
+    @RequestMapping(value = "/page", method = RequestMethod.GET)
+    @ResponseBody
+    public Result page(Page page, CheckinRecord record) {
+        Map<String, Object> result = new HashMap<>();
+
+        List<CheckinRecord> pp = checkinRecordService.getCheckinRecordByPage(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(CheckinRecord record) {
+        boolean num = checkinRecordService.createCheckinRecord(record);
+        if (num) {
+            return new Result(true, record.getId());
+        }
+        return new Result(false, "保存异常");
+    }
+
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ResponseBody
+    public Result updateCheckinRecord(CheckinRecord record) {
+        boolean num = checkinRecordService.updateCheckinRecord(record);
+        if (num) {
+            return new Result(true, "保存成功");
+        }
+        return new Result(false, "保存异常");
+    }
+
+    @RequestMapping(value = "/del", method = RequestMethod.POST)
+    @ResponseBody
+    public Result deleteCheckinRecord(CheckinRecord record) {
+
+        boolean num = checkinRecordService.deleteCheckinRecord(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, CheckinRecord record) throws Exception {
+
+        List<CheckinRecord> checkinRecords = checkinRecordService.getCheckinRecordList(record);
+
+        String sheetName = "checkin_record";
+        String titleName = "签到记录数据表";
+        String fileName = "签到记录表";
+        int columnNumber = 7;
+        int[] columnWidth = {20, 20, 20, 20, 20, 20, 20};
+        String[] columnName = {"", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "用户"};
+        String[][] dataList = new String[checkinRecords.size()][7];
+
+        for (int i = 0; i < checkinRecords.size(); i++) {
+            dataList[i][0] = String.valueOf(checkinRecords.get(i).getId());
+            dataList[i][1] = String.valueOf(checkinRecords.get(i).getDelFlag());
+            dataList[i][2] = String.valueOf(checkinRecords.get(i).getUpdateTime());
+            dataList[i][3] = String.valueOf(checkinRecords.get(i).getUpdateUser());
+            dataList[i][4] = String.valueOf(checkinRecords.get(i).getCreateTime());
+            dataList[i][5] = String.valueOf(checkinRecords.get(i).getCreateUser());
+            dataList[i][6] = String.valueOf(checkinRecords.get(i).getUserId());
+        }
+
+        ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
+                columnNumber, columnWidth, columnName, dataList, response);
+    }
+    /*generatedEnd*/
+
+    @RequestMapping("weekRecord")
+    @ResponseBody
+    public Result weekRecord() {
+        UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
+        Map<String, Object> map = checkinRecordService.weekRecord(userInfo.getId());
+        if (map != null) {
+            return new Result(true, map);
+        }
+        return new Result(false, "失败");
+    }
+}
+

+ 148 - 0
src/main/vue/src/pages/CheckinRecord.vue

@@ -0,0 +1,148 @@
+<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="用户">
+                <el-input v-model="formData.userId" :disabled="'userId'==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>
+    </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: 'CheckinRecord',
+        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: '/checkinRecord/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: '/checkinRecord/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 ? '/checkinRecord/update' : '/checkinRecord/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: '/checkinRecord/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>

+ 408 - 0
src/main/vue/src/pages/CheckinRecords.vue

@@ -0,0 +1,408 @@
+<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:'/checkinRecord',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="用户"
+                                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: 'CheckinRecords',
+        created() {
+            this.getData();
+        },
+        data() {
+            return {
+                totalNumber: 0,
+                totalPage: 10,
+                currentPage: 1,
+                pageSize: 20,
+                tableData: [],
+                filter1: '',
+                filter2: '',
+                tableColumns: [
+                                                                                                                                                                                                                                                                                                                                                {
+                                label: '用户',
+                                value: 'userId',
+                                show: true
+                            },
+                                                            ],
+                multipleMode: false,
+                showAdvancedQueryDialog: false,
+                advancedQueryFields: [],
+                showTableSortDialog: false,
+                tableSortFields: [],
+                searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
+                advancedQueryColumns: [
+                                                                                                                                                                                                                                                                                                                                                {
+                                label: '用户',
+                                value: 'user_id'
+                            },
+                                                            ],
+                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: '/checkinRecord/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: '/checkinRecord',
+                    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 + "/checkinRecord/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: '/checkinRecord/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>

+ 10 - 4
src/main/vue/src/pages/HouseInfo.vue

@@ -196,12 +196,10 @@
                 }
             });
 
-
             this.$http.get({
                 url: '/gameInfo/all'
             }).then(res => {
                 if (res.success) {
-
                     if (res.data.length > 0) {
                         res.data.forEach(item => {
                             this.gameIdOptions.push({label: item.gameName, value: item.id});
@@ -210,12 +208,10 @@
                 }
             });
 
-
             this.$http.get({
                 url: '/competitionSeason/all'
             }).then(res => {
                 if (res.success) {
-
                     if (res.data.length > 0) {
                         res.data.forEach(item => {
                             this.seasonIdOptions.push({label: item.shortName, value: item.id});
@@ -223,6 +219,15 @@
                     }
                 }
             });
+
+            this.$http.get({
+                url: 'competition/all',
+                data: {}
+            }).then(res => {
+                if (res.success) {
+                    this.competitions = res.data;
+                }
+            });
         },
         data() {
             return {
@@ -277,6 +282,7 @@
                 seasonIdOptions: [],
                 subColumn: '',
                 subValue: '',
+                competitions: []
             }
         },
         methods: {

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

@@ -401,6 +401,16 @@ const router = new Router({
                     path: '/participatingInfos',
                     name: 'ParticipatingInfos',
                     component: () => import('../pages/ParticipatingInfos')
+                },
+                {
+                    path: '/checkinRecord',
+                    name: 'CheckinRecord',
+                    component: () => import('../pages/CheckinRecord')
+                },
+                {
+                    path: '/checkinRecords',
+                    name: 'CheckinRecords',
+                    component: () => import('../pages/CheckinRecords')
                 }
                 /**INSERT_LOCATION**/
         ]

+ 9 - 0
src/test/java/GetDayFromDate.java

@@ -0,0 +1,9 @@
+import com.izouma.awesomeadmin.util.DateTimeTool;
+
+import java.util.Date;
+
+public class GetDayFromDate {
+    public static void main(String[] args) {
+        System.out.println(DateTimeTool.getDayOfWeek(new Date()));
+    }
+}