Add points task submission and review workflow
This commit is contained in:
@@ -11,12 +11,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="integralNumber" column="integral_number" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="resourceId" column="resource_id" />
|
||||
<result property="bizType" column="biz_type" />
|
||||
<result property="bizId" column="biz_id" />
|
||||
<result property="resourceTitle" column="resource_title" />
|
||||
<result property="integralTime" column="integral_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAppIntegralRecordVo">
|
||||
select a.id, a.source, a.is_add, a.integral_number, a.user_id, a.resource_id, a.integral_time, r.resource_title
|
||||
select a.id, a.source, a.is_add, a.integral_number, a.user_id, a.resource_id,
|
||||
a.biz_type, a.biz_id, a.integral_time, r.resource_title
|
||||
from app_integral_record a
|
||||
left join app_resource r on a.resource_id = r.id
|
||||
</sql>
|
||||
@@ -68,6 +71,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="integralNumber != null">integral_number,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="resourceId != null">resource_id,</if>
|
||||
<if test="bizType != null">biz_type,</if>
|
||||
<if test="bizId != null">biz_id,</if>
|
||||
<if test="integralTime != null">integral_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@@ -76,6 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="integralNumber != null">#{integralNumber},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="resourceId != null">#{resourceId},</if>
|
||||
<if test="bizType != null">#{bizType},</if>
|
||||
<if test="bizId != null">#{bizId},</if>
|
||||
<if test="integralTime != null">#{integralTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
@@ -88,6 +95,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="integralNumber != null">integral_number = #{integralNumber},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="resourceId != null">resource_id = #{resourceId},</if>
|
||||
<if test="bizType != null">biz_type = #{bizType},</if>
|
||||
<if test="bizId != null">biz_id = #{bizId},</if>
|
||||
<if test="integralTime != null">integral_time = #{integralTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<?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.ruoyi.app.mapper.AppPointTaskMapper">
|
||||
<resultMap type="AppPointTask" id="AppPointTaskResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="taskName" column="task_name" />
|
||||
<result property="taskType" column="task_type" />
|
||||
<result property="cycleType" column="cycle_type" />
|
||||
<result property="coverUrl" column="cover_url" />
|
||||
<result property="description" column="description" />
|
||||
<result property="operationGuide" column="operation_guide" />
|
||||
<result property="exampleImages" column="example_images" />
|
||||
<result property="rewardPoints" column="reward_points" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="allowResubmit" column="allow_resubmit" />
|
||||
<result property="status" column="status" />
|
||||
<result property="sortOrder" column="sort_order" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTaskVo">
|
||||
select id, task_name, task_type, cycle_type, cover_url, description, operation_guide,
|
||||
example_images, reward_points, start_time, end_time, allow_resubmit, status,
|
||||
sort_order, create_by, create_time, update_by, update_time
|
||||
from app_point_task
|
||||
</sql>
|
||||
|
||||
<select id="selectAppPointTaskById" resultMap="AppPointTaskResult">
|
||||
<include refid="selectTaskVo" /> where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectAppPointTaskList" parameterType="AppPointTask" resultMap="AppPointTaskResult">
|
||||
<include refid="selectTaskVo" />
|
||||
<where>
|
||||
<if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
|
||||
<if test="taskType != null and taskType != ''">and task_type = #{taskType}</if>
|
||||
<if test="cycleType != null and cycleType != ''">and cycle_type = #{cycleType}</if>
|
||||
<if test="status != null and status != ''">and status = #{status}</if>
|
||||
</where>
|
||||
order by sort_order asc, id desc
|
||||
</select>
|
||||
|
||||
<select id="selectActiveAppPointTaskList" resultMap="AppPointTaskResult">
|
||||
<include refid="selectTaskVo" />
|
||||
where status = '0'
|
||||
and (start_time is null or start_time <= now())
|
||||
and (end_time is null or end_time >= now())
|
||||
order by sort_order asc, id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertAppPointTask" parameterType="AppPointTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into app_point_task
|
||||
(task_name, task_type, cycle_type, cover_url, description, operation_guide, example_images,
|
||||
reward_points, start_time, end_time, allow_resubmit, status, sort_order,
|
||||
create_by, create_time, update_by, update_time)
|
||||
values
|
||||
(#{taskName}, #{taskType}, #{cycleType}, #{coverUrl}, #{description}, #{operationGuide}, #{exampleImages},
|
||||
#{rewardPoints}, #{startTime}, #{endTime}, #{allowResubmit}, #{status}, #{sortOrder},
|
||||
#{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<update id="updateAppPointTask" parameterType="AppPointTask">
|
||||
update app_point_task
|
||||
<set>
|
||||
<if test="taskName != null">task_name = #{taskName},</if>
|
||||
<if test="taskType != null">task_type = #{taskType},</if>
|
||||
<if test="cycleType != null">cycle_type = #{cycleType},</if>
|
||||
<if test="coverUrl != null">cover_url = #{coverUrl},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="operationGuide != null">operation_guide = #{operationGuide},</if>
|
||||
<if test="exampleImages != null">example_images = #{exampleImages},</if>
|
||||
<if test="rewardPoints != null">reward_points = #{rewardPoints},</if>
|
||||
start_time = #{startTime},
|
||||
end_time = #{endTime},
|
||||
<if test="allowResubmit != null">allow_resubmit = #{allowResubmit},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
update_time = #{updateTime}
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAppPointTaskByIds">
|
||||
delete from app_point_task where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="countSubmissionByTaskIds" resultType="int">
|
||||
select count(1) from app_point_task_submission where task_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,201 @@
|
||||
<?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.ruoyi.app.mapper.AppPointTaskSubmissionMapper">
|
||||
<resultMap type="AppPointTaskSubmission" id="SubmissionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="submissionNo" column="submission_no" />
|
||||
<result property="taskId" column="task_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="cycleKey" column="cycle_key" />
|
||||
<result property="rewardPoints" column="reward_points" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="status" column="status" />
|
||||
<result property="attemptCount" column="attempt_count" />
|
||||
<result property="rejectReason" column="reject_reason" />
|
||||
<result property="reviewBy" column="review_by" />
|
||||
<result property="reviewTime" column="review_time" />
|
||||
<result property="rewardRecordId" column="reward_record_id" />
|
||||
<result property="firstSubmitTime" column="first_submit_time" />
|
||||
<result property="lastSubmitTime" column="last_submit_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="taskName" column="task_name" />
|
||||
<result property="taskType" column="task_type" />
|
||||
<result property="cycleType" column="cycle_type" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="nickName" column="nick_name" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="AppPointTaskAttachment" id="AttachmentResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="submissionId" column="submission_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="objectKey" column="object_key" />
|
||||
<result property="originalName" column="original_name" />
|
||||
<result property="fileSize" column="file_size" />
|
||||
<result property="fileType" column="file_type" />
|
||||
<result property="uploadStatus" column="upload_status" />
|
||||
<result property="submitBatch" column="submit_batch" />
|
||||
<result property="isCurrent" column="is_current" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSubmissionVo">
|
||||
select s.id, s.submission_no, s.task_id, s.user_id, s.cycle_key, s.reward_points,
|
||||
s.remark, s.status, s.attempt_count, s.reject_reason, s.review_by, s.review_time,
|
||||
s.reward_record_id, s.first_submit_time, s.last_submit_time,
|
||||
s.create_by, s.create_time, s.update_by, s.update_time,
|
||||
t.task_name, t.task_type, t.cycle_type, u.user_name, u.nick_name
|
||||
from app_point_task_submission s
|
||||
left join app_point_task t on t.id = s.task_id
|
||||
left join sys_user u on u.user_id = s.user_id
|
||||
</sql>
|
||||
|
||||
<select id="selectSubmissionById" resultMap="SubmissionResult">
|
||||
<include refid="selectSubmissionVo" /> where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectSubmissionByIdForUpdate" resultMap="SubmissionResult">
|
||||
select id, submission_no, task_id, user_id, cycle_key, reward_points, remark, status,
|
||||
attempt_count, reject_reason, review_by, review_time, reward_record_id,
|
||||
first_submit_time, last_submit_time, create_by, create_time, update_by, update_time
|
||||
from app_point_task_submission where id = #{id} for update
|
||||
</select>
|
||||
|
||||
<select id="selectByTaskUserCycle" resultMap="SubmissionResult">
|
||||
select id, submission_no, task_id, user_id, cycle_key, reward_points, remark, status,
|
||||
attempt_count, reject_reason, review_by, review_time, reward_record_id,
|
||||
first_submit_time, last_submit_time, create_by, create_time, update_by, update_time
|
||||
from app_point_task_submission
|
||||
where task_id = #{taskId} and user_id = #{userId} and cycle_key = #{cycleKey}
|
||||
</select>
|
||||
|
||||
<select id="selectSubmissionList" parameterType="AppPointTaskSubmission" resultMap="SubmissionResult">
|
||||
<include refid="selectSubmissionVo" />
|
||||
<where>
|
||||
<if test="submissionNo != null and submissionNo != ''">and s.submission_no like concat('%', #{submissionNo}, '%')</if>
|
||||
<if test="taskId != null">and s.task_id = #{taskId}</if>
|
||||
<if test="taskName != null and taskName != ''">and t.task_name like concat('%', #{taskName}, '%')</if>
|
||||
<if test="status != null">and s.status = #{status}</if>
|
||||
<if test="cycleKey != null and cycleKey != ''">and s.cycle_key = #{cycleKey}</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
and (u.user_name like concat('%', #{userName}, '%') or u.nick_name like concat('%', #{userName}, '%'))
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
and date_format(s.last_submit_time, '%Y%m%d') >= date_format(#{params.beginTime}, '%Y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
and date_format(s.last_submit_time, '%Y%m%d') <= date_format(#{params.endTime}, '%Y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
order by s.last_submit_time desc, s.id desc
|
||||
</select>
|
||||
|
||||
<select id="selectMySubmissionList" resultMap="SubmissionResult">
|
||||
<include refid="selectSubmissionVo" />
|
||||
where s.user_id = #{userId}
|
||||
order by s.last_submit_time desc, s.id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertSubmission" parameterType="AppPointTaskSubmission" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into app_point_task_submission
|
||||
(submission_no, task_id, user_id, cycle_key, reward_points, remark, status, attempt_count,
|
||||
reject_reason, review_by, review_time, reward_record_id, first_submit_time, last_submit_time,
|
||||
create_by, create_time, update_by, update_time)
|
||||
values
|
||||
(#{submissionNo}, #{taskId}, #{userId}, #{cycleKey}, #{rewardPoints}, #{remark}, #{status}, #{attemptCount},
|
||||
#{rejectReason}, #{reviewBy}, #{reviewTime}, #{rewardRecordId}, #{firstSubmitTime}, #{lastSubmitTime},
|
||||
#{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<update id="updateSubmission" parameterType="AppPointTaskSubmission">
|
||||
update app_point_task_submission
|
||||
<set>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="attemptCount != null">attempt_count = #{attemptCount},</if>
|
||||
reject_reason = #{rejectReason},
|
||||
review_by = #{reviewBy},
|
||||
review_time = #{reviewTime},
|
||||
<if test="rewardRecordId != null">reward_record_id = #{rewardRecordId},</if>
|
||||
<if test="lastSubmitTime != null">last_submit_time = #{lastSubmitTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
update_time = #{updateTime}
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="insertTempAttachment" parameterType="AppPointTaskAttachment" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into app_point_task_attachment
|
||||
(submission_id, user_id, object_key, original_name, file_size, file_type,
|
||||
upload_status, submit_batch, is_current, create_time)
|
||||
values
|
||||
(null, #{userId}, #{objectKey}, #{originalName}, #{fileSize}, #{fileType},
|
||||
'TEMP', 0, 0, #{createTime})
|
||||
</insert>
|
||||
|
||||
<select id="lockUserForUpload" resultType="long">
|
||||
select user_id from sys_user where user_id = #{userId} for update
|
||||
</select>
|
||||
|
||||
<select id="countTempAttachmentsByUser" resultType="int">
|
||||
select count(1)
|
||||
from app_point_task_attachment
|
||||
where user_id = #{userId} and upload_status = 'TEMP'
|
||||
</select>
|
||||
|
||||
<select id="countAttachmentsByUserSince" resultType="int">
|
||||
select count(1)
|
||||
from app_point_task_attachment
|
||||
where user_id = #{userId} and create_time >= #{since}
|
||||
</select>
|
||||
|
||||
<select id="selectTempAttachments" resultMap="AttachmentResult">
|
||||
select id, submission_id, user_id, object_key, original_name, file_size, file_type,
|
||||
upload_status, submit_batch, is_current, create_time
|
||||
from app_point_task_attachment
|
||||
where user_id = #{userId} and upload_status = 'TEMP' and object_key in
|
||||
<foreach item="key" collection="keys" open="(" separator="," close=")">#{key}</foreach>
|
||||
</select>
|
||||
|
||||
<update id="bindAttachments">
|
||||
update app_point_task_attachment
|
||||
set submission_id = #{submissionId}, upload_status = 'BOUND', submit_batch = #{submitBatch}, is_current = 1
|
||||
where user_id = #{userId} and upload_status = 'TEMP' and object_key in
|
||||
<foreach item="key" collection="keys" open="(" separator="," close=")">#{key}</foreach>
|
||||
</update>
|
||||
|
||||
<update id="markAttachmentsNotCurrent">
|
||||
update app_point_task_attachment set is_current = 0 where submission_id = #{submissionId}
|
||||
</update>
|
||||
|
||||
<select id="selectAttachmentsBySubmissionId" resultMap="AttachmentResult">
|
||||
select id, submission_id, user_id, object_key, original_name, file_size, file_type,
|
||||
upload_status, submit_batch, is_current, create_time
|
||||
from app_point_task_attachment
|
||||
where submission_id = #{submissionId}
|
||||
order by submit_batch desc, id asc
|
||||
</select>
|
||||
|
||||
<select id="selectExpiredTempAttachments" resultMap="AttachmentResult">
|
||||
select id, submission_id, user_id, object_key, original_name, file_size, file_type,
|
||||
upload_status, submit_batch, is_current, create_time
|
||||
from app_point_task_attachment
|
||||
where upload_status = 'TEMP' and create_time < #{beforeTime}
|
||||
order by id asc
|
||||
limit 500
|
||||
</select>
|
||||
|
||||
<delete id="deleteTempAttachmentById">
|
||||
delete from app_point_task_attachment where id = #{id} and upload_status = 'TEMP'
|
||||
</delete>
|
||||
|
||||
<insert id="insertAuditLog" parameterType="AppPointTaskAuditLog">
|
||||
insert into app_point_task_audit_log
|
||||
(submission_id, before_status, after_status, operator_name, remark, create_time)
|
||||
values
|
||||
(#{submissionId}, #{beforeStatus}, #{afterStatus}, #{operatorName}, #{remark}, #{createTime})
|
||||
</insert>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user