123
This commit is contained in:
parent
eefba25d17
commit
9c28709556
|
@ -0,0 +1,77 @@
|
|||
package com.ruoyi.bst.remind.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 定时提醒对象 bst_remind
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
@Data
|
||||
public class Remind extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "提醒模式", readConverterExp = "如=:每天、每月、每年、下一次提醒")
|
||||
@ApiModelProperty("提醒模式")
|
||||
private String reminderPattern;
|
||||
|
||||
@Excel(name = "提醒时机", readConverterExp = "每=天x时,每月x日,每年x月x日,下次x年x月x日")
|
||||
@ApiModelProperty("提醒时机")
|
||||
private String reminderVal;
|
||||
|
||||
@Excel(name = "项目类型(如:服务器、域名等)")
|
||||
@ApiModelProperty("项目类型(如:服务器、域名等)")
|
||||
private String projectType;
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty("备注")
|
||||
private String notes;
|
||||
|
||||
@Excel(name = "是否失效")
|
||||
@ApiModelProperty("是否失效")
|
||||
private Integer isInvalid;
|
||||
|
||||
@Excel(name = "提醒次数")
|
||||
@ApiModelProperty("提醒次数")
|
||||
private Long reminderNumber;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "最后提醒时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("最后提醒时间")
|
||||
private Date lastReminderTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "下一次提醒日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("下一次提醒日期")
|
||||
private Date nextRemindTime;
|
||||
|
||||
@Excel(name = "创建者")
|
||||
@ApiModelProperty("创建者")
|
||||
private Long createId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date creataDate;
|
||||
|
||||
@Excel(name = "更新者")
|
||||
@ApiModelProperty("更新者")
|
||||
private Long updateId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "跟新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("跟新时间")
|
||||
private Date updateDate;
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.ruoyi.bst.remind.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RemindQuery extends RemindVO{
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.ruoyi.bst.remind.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RemindVO extends Remind{
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.ruoyi.bst.remind.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.bst.remind.domain.Remind;
|
||||
import com.ruoyi.bst.remind.domain.RemindVO;
|
||||
import com.ruoyi.bst.remind.domain.RemindQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 定时提醒Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
public interface RemindMapper
|
||||
{
|
||||
/**
|
||||
* 查询定时提醒
|
||||
*
|
||||
* @param id 定时提醒主键
|
||||
* @return 定时提醒
|
||||
*/
|
||||
RemindVO selectRemindById(Long id);
|
||||
|
||||
/**
|
||||
* 查询定时提醒列表
|
||||
*
|
||||
* @param query 定时提醒
|
||||
* @return 定时提醒集合
|
||||
*/
|
||||
List<RemindVO> selectRemindList(@Param("query")RemindQuery query);
|
||||
|
||||
/**
|
||||
* 新增定时提醒
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 结果
|
||||
*/
|
||||
int insertRemind(Remind remind);
|
||||
|
||||
/**
|
||||
* 批量新增定时提醒
|
||||
*/
|
||||
int batchInsert(@Param("list") List<? extends Remind> list);
|
||||
|
||||
/**
|
||||
* 批量修改定时提醒
|
||||
*/
|
||||
int batchUpdate(@Param("list") List<? extends Remind> list);
|
||||
|
||||
/**
|
||||
* 修改定时提醒
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRemind(@Param("data") Remind remind);
|
||||
|
||||
/**
|
||||
* 删除定时提醒
|
||||
*
|
||||
* @param id 定时提醒主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteRemindById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除定时提醒
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRemindByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取全部定时提醒任务
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
List<RemindVO> selectAll();
|
||||
}
|
|
@ -0,0 +1,336 @@
|
|||
<?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.bst.remind.mapper.RemindMapper">
|
||||
|
||||
<resultMap type="RemindVO" id="RemindResult" autoMapping="true">
|
||||
<result property="id" column="id" />
|
||||
<result property="reminderPattern" column="reminder_pattern" />
|
||||
<result property="reminderVal" column="reminder_val" />
|
||||
<result property="projectType" column="project_type" />
|
||||
<result property="notes" column="notes" />
|
||||
<result property="isInvalid" column="is_invalid" />
|
||||
<result property="reminderNumber" column="reminder_number" />
|
||||
<result property="lastReminderTime" column="last_reminder_time" />
|
||||
<result property="nextRemindTime" column="next_remind_time" />
|
||||
<result property="createId" column="create_id" />
|
||||
<result property="creataDate" column="creata_date" />
|
||||
<result property="updateId" column="update_id" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRemindVo">
|
||||
select
|
||||
id,
|
||||
reminder_pattern,
|
||||
reminder_val,
|
||||
project_type,
|
||||
notes,
|
||||
is_invalid,
|
||||
reminder_number,
|
||||
last_reminder_time,
|
||||
next_remind_time,
|
||||
create_id,
|
||||
creata_date,
|
||||
update_id,
|
||||
update_date
|
||||
from bst_remind
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.reminderPattern != null and query.reminderPattern != ''"> and reminder_pattern = #{query.reminderPattern}</if>
|
||||
<if test="query.reminderVal != null and query.reminderVal != ''"> and reminder_val = #{query.reminderVal}</if>
|
||||
<if test="query.projectType != null and query.projectType != ''"> and project_type = #{query.projectType}</if>
|
||||
<if test="query.notes != null and query.notes != ''"> and notes = #{query.notes}</if>
|
||||
<if test="query.isInvalid != null "> and is_invalid = #{query.isInvalid}</if>
|
||||
<if test="query.reminderNumber != null "> and reminder_number = #{query.reminderNumber}</if>
|
||||
<if test="query.lastReminderTime != null "> and last_reminder_time = #{query.lastReminderTime}</if>
|
||||
<if test="query.nextRemindTime != null "> and next_remind_time = #{query.nextRemindTime}</if>
|
||||
<if test="query.createId != null "> and create_id = #{query.createId}</if>
|
||||
<if test="query.creataDate != null "> and creata_date = #{query.creataDate}</if>
|
||||
<if test="query.updateId != null "> and update_id = #{query.updateId}</if>
|
||||
<if test="query.updateDate != null "> and update_date = #{query.updateDate}</if>
|
||||
${query.params.dataScope}
|
||||
</sql>
|
||||
|
||||
<select id="selectEveryDay" parameterType="RemindQuery" resultMap="RemindResult">
|
||||
<include refid="selectRemindVo"/>
|
||||
where next_remind_time = 1
|
||||
</select>
|
||||
|
||||
<select id="selectNotEveryDay" parameterType="RemindQuery" resultMap="RemindResult">
|
||||
<include refid="selectRemindVo"/>
|
||||
where next_remind_time != 1
|
||||
</select>
|
||||
|
||||
<select id="selectRemindList" parameterType="RemindQuery" resultMap="RemindResult">
|
||||
<include refid="selectRemindVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRemindById" parameterType="Long" resultMap="RemindResult">
|
||||
<include refid="selectRemindVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRemind" parameterType="Remind">
|
||||
insert into bst_remind
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="reminderPattern != null and reminderPattern != ''">reminder_pattern,</if>
|
||||
<if test="reminderVal != null and reminderVal != ''">reminder_val,</if>
|
||||
<if test="projectType != null and projectType != ''">project_type,</if>
|
||||
<if test="notes != null and notes != ''">notes,</if>
|
||||
<if test="isInvalid != null">is_invalid,</if>
|
||||
<if test="reminderNumber != null">reminder_number,</if>
|
||||
<if test="lastReminderTime != null">last_reminder_time,</if>
|
||||
<if test="nextRemindTime != null">next_remind_time,</if>
|
||||
<if test="createId != null">create_id,</if>
|
||||
<if test="creataDate != null">creata_date,</if>
|
||||
<if test="updateId != null">update_id,</if>
|
||||
<if test="updateDate != null">update_date,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="reminderPattern != null and reminderPattern != ''">#{reminderPattern},</if>
|
||||
<if test="reminderVal != null and reminderVal != ''">#{reminderVal},</if>
|
||||
<if test="projectType != null and projectType != ''">#{projectType},</if>
|
||||
<if test="notes != null and notes != ''">#{notes},</if>
|
||||
<if test="isInvalid != null">#{isInvalid},</if>
|
||||
<if test="reminderNumber != null">#{reminderNumber},</if>
|
||||
<if test="lastReminderTime != null">#{lastReminderTime},</if>
|
||||
<if test="nextRemindTime != null">#{nextRemindTime},</if>
|
||||
<if test="createId != null">#{createId},</if>
|
||||
<if test="creataDate != null">#{creataDate},</if>
|
||||
<if test="updateId != null">#{updateId},</if>
|
||||
<if test="updateDate != null">#{updateDate},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" parameterType="Remind">
|
||||
insert into bst_remind
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
id,
|
||||
reminder_pattern,
|
||||
reminder_val,
|
||||
project_type,
|
||||
notes,
|
||||
is_invalid,
|
||||
reminder_number,
|
||||
last_reminder_time,
|
||||
next_remind_time,
|
||||
create_id,
|
||||
creata_date,
|
||||
update_id,
|
||||
update_date,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="i.id != null ">#{i.id},</if>
|
||||
<if test="i.id == null ">default,</if>
|
||||
<if test="i.reminderPattern != null and i.reminderPattern != ''">#{i.reminderPattern},</if>
|
||||
<if test="i.reminderPattern == null or i.reminderPattern == ''">default,</if>
|
||||
<if test="i.reminderVal != null and i.reminderVal != ''">#{i.reminderVal},</if>
|
||||
<if test="i.reminderVal == null or i.reminderVal == ''">default,</if>
|
||||
<if test="i.projectType != null and i.projectType != ''">#{i.projectType},</if>
|
||||
<if test="i.projectType == null or i.projectType == ''">default,</if>
|
||||
<if test="i.notes != null and i.notes != ''">#{i.notes},</if>
|
||||
<if test="i.notes == null or i.notes == ''">default,</if>
|
||||
<if test="i.isInvalid != null ">#{i.isInvalid},</if>
|
||||
<if test="i.isInvalid == null ">default,</if>
|
||||
<if test="i.reminderNumber != null ">#{i.reminderNumber},</if>
|
||||
<if test="i.reminderNumber == null ">default,</if>
|
||||
<if test="i.lastReminderTime != null ">#{i.lastReminderTime},</if>
|
||||
<if test="i.lastReminderTime == null ">default,</if>
|
||||
<if test="i.nextRemindTime != null ">#{i.nextRemindTime},</if>
|
||||
<if test="i.nextRemindTime == null ">default,</if>
|
||||
<if test="i.createId != null ">#{i.createId},</if>
|
||||
<if test="i.createId == null ">default,</if>
|
||||
<if test="i.creataDate != null ">#{i.creataDate},</if>
|
||||
<if test="i.creataDate == null ">default,</if>
|
||||
<if test="i.updateId != null ">#{i.updateId},</if>
|
||||
<if test="i.updateId == null ">default,</if>
|
||||
<if test="i.updateDate != null ">#{i.updateDate},</if>
|
||||
<if test="i.updateDate == null ">default,</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate">
|
||||
update bst_remind
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<foreach open="id = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.id != null ">
|
||||
WHEN #{item.id} THEN #{item.id}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `id`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="reminder_pattern = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.reminderPattern != null and item.reminderPattern != ''">
|
||||
WHEN #{item.id} THEN #{item.reminderPattern}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `reminder_pattern`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="reminder_val = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.reminderVal != null and item.reminderVal != ''">
|
||||
WHEN #{item.id} THEN #{item.reminderVal}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `reminder_val`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="project_type = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.projectType != null and item.projectType != ''">
|
||||
WHEN #{item.id} THEN #{item.projectType}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `project_type`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="notes = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.notes != null and item.notes != ''">
|
||||
WHEN #{item.id} THEN #{item.notes}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `notes`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="is_invalid = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.isInvalid != null ">
|
||||
WHEN #{item.id} THEN #{item.isInvalid}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `is_invalid`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="reminder_number = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.reminderNumber != null ">
|
||||
WHEN #{item.id} THEN #{item.reminderNumber}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `reminder_number`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="last_reminder_time = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.lastReminderTime != null ">
|
||||
WHEN #{item.id} THEN #{item.lastReminderTime}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `last_reminder_time`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="next_remind_time = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.nextRemindTime != null ">
|
||||
WHEN #{item.id} THEN #{item.nextRemindTime}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `next_remind_time`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="create_id = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.createId != null ">
|
||||
WHEN #{item.id} THEN #{item.createId}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `create_id`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="creata_date = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.creataDate != null ">
|
||||
WHEN #{item.id} THEN #{item.creataDate}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `creata_date`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="update_id = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.updateId != null ">
|
||||
WHEN #{item.id} THEN #{item.updateId}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `update_id`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="update_date = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.updateDate != null ">
|
||||
WHEN #{item.id} THEN #{item.updateDate}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `update_date`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateRemind" parameterType="Remind">
|
||||
update bst_remind
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<include refid="updateColumns"/>
|
||||
</trim>
|
||||
where id = #{data.id}
|
||||
</update>
|
||||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.reminderPattern != null and data.reminderPattern != ''">reminder_pattern = #{data.reminderPattern},</if>
|
||||
<if test="data.reminderVal != null and data.reminderVal != ''">reminder_val = #{data.reminderVal},</if>
|
||||
<if test="data.projectType != null and data.projectType != ''">project_type = #{data.projectType},</if>
|
||||
<if test="data.notes != null and data.notes != ''">notes = #{data.notes},</if>
|
||||
<if test="data.isInvalid != null">is_invalid = #{data.isInvalid},</if>
|
||||
<if test="data.reminderNumber != null">reminder_number = #{data.reminderNumber},</if>
|
||||
<if test="data.lastReminderTime != null">last_reminder_time = #{data.lastReminderTime},</if>
|
||||
<if test="data.nextRemindTime != null">next_remind_time = #{data.nextRemindTime},</if>
|
||||
<if test="data.createId != null">create_id = #{data.createId},</if>
|
||||
<if test="data.creataDate != null">creata_date = #{data.creataDate},</if>
|
||||
<if test="data.updateId != null">update_id = #{data.updateId},</if>
|
||||
<if test="data.updateDate != null">update_date = #{data.updateDate},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteRemindById" parameterType="Long">
|
||||
delete from bst_remind where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRemindByIds" parameterType="String">
|
||||
delete from bst_remind where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,80 @@
|
|||
package com.ruoyi.bst.remind.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.bst.remind.domain.Remind;
|
||||
import com.ruoyi.bst.remind.domain.RemindVO;
|
||||
import com.ruoyi.bst.remind.domain.RemindQuery;
|
||||
|
||||
/**
|
||||
* 定时提醒Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
public interface RemindService
|
||||
{
|
||||
/**
|
||||
* 查询定时提醒
|
||||
*
|
||||
* @param id 定时提醒主键
|
||||
* @return 定时提醒
|
||||
*/
|
||||
public RemindVO selectRemindById(Long id);
|
||||
|
||||
/**
|
||||
* 查询定时提醒列表
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 定时提醒集合
|
||||
*/
|
||||
public List<RemindVO> selectRemindList(RemindQuery remind);
|
||||
|
||||
/**
|
||||
* 新增定时提醒
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRemind(Remind remind);
|
||||
|
||||
/**
|
||||
* 修改定时提醒
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRemind(Remind remind);
|
||||
|
||||
/**
|
||||
* 批量删除定时提醒
|
||||
*
|
||||
* @param ids 需要删除的定时提醒主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRemindByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除定时提醒信息
|
||||
*
|
||||
* @param id 定时提醒主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRemindById(Long id);
|
||||
|
||||
/**
|
||||
* 获取每天的任务
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RemindVO> selectEveryDay();
|
||||
|
||||
|
||||
/**
|
||||
* 获取非每天的任务
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RemindVO> selectNotEveryDay();
|
||||
|
||||
int batchInsert(List<RemindVO> list);
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.ruoyi.bst.remind.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.bst.remind.mapper.RemindMapper;
|
||||
import com.ruoyi.bst.remind.domain.Remind;
|
||||
import com.ruoyi.bst.remind.domain.RemindVO;
|
||||
import com.ruoyi.bst.remind.domain.RemindQuery;
|
||||
import com.ruoyi.bst.remind.service.RemindService;
|
||||
|
||||
/**
|
||||
* 定时提醒Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
@Service
|
||||
public class RemindServiceImpl implements RemindService
|
||||
{
|
||||
@Autowired
|
||||
private RemindMapper remindMapper;
|
||||
|
||||
/**
|
||||
* 查询定时提醒
|
||||
*
|
||||
* @param id 定时提醒主键
|
||||
* @return 定时提醒
|
||||
*/
|
||||
@Override
|
||||
public RemindVO selectRemindById(Long id)
|
||||
{
|
||||
return remindMapper.selectRemindById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询定时提醒列表
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 定时提醒
|
||||
*/
|
||||
@Override
|
||||
public List<RemindVO> selectRemindList(RemindQuery remind)
|
||||
{
|
||||
return remindMapper.selectRemindList(remind);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增定时提醒
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRemind(Remind remind)
|
||||
{
|
||||
return remindMapper.insertRemind(remind);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改定时提醒
|
||||
*
|
||||
* @param remind 定时提醒
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRemind(Remind remind)
|
||||
{
|
||||
return remindMapper.updateRemind(remind);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除定时提醒
|
||||
*
|
||||
* @param ids 需要删除的定时提醒主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRemindByIds(Long[] ids)
|
||||
{
|
||||
return remindMapper.deleteRemindByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时提醒信息
|
||||
*
|
||||
* @param id 定时提醒主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRemindById(Long id)
|
||||
{
|
||||
return remindMapper.deleteRemindById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RemindVO> selectEveryDay() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RemindVO> selectNotEveryDay() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<RemindVO> list) {
|
||||
return remindMapper.batchInsert(list);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.ruoyi.common.constants;
|
||||
|
||||
/**
|
||||
* 到期提醒模块常量
|
||||
*/
|
||||
public class RemindConstants {
|
||||
|
||||
// 每天
|
||||
public static final String EVERYDAY = "1";
|
||||
|
||||
// 每月
|
||||
public static final String MONTHLY = "2";
|
||||
|
||||
// 每年
|
||||
public static final String EVERYYEAR = "3";
|
||||
|
||||
// 下一次
|
||||
public static final String NEXTREMINDER = "4";
|
||||
|
||||
// 服务器
|
||||
public static final String SERVER = "1";
|
||||
|
||||
// 域名
|
||||
public static final String DOMAINNAME = "2";
|
||||
|
||||
}
|
62
ruoyi-web/src/main/java/com/ruoyi/task/RemindTask.java
Normal file
62
ruoyi-web/src/main/java/com/ruoyi/task/RemindTask.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package com.ruoyi.task;
|
||||
|
||||
import com.ruoyi.bst.message.domain.Message;
|
||||
import com.ruoyi.bst.message.service.MessageService;
|
||||
import com.ruoyi.bst.remind.domain.RemindVO;
|
||||
import com.ruoyi.bst.remind.service.RemindService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import sun.util.resources.LocaleData;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RemindTask {
|
||||
|
||||
@Autowired
|
||||
private RemindService remindService;
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
/**
|
||||
* 处理每天到期提醒功能
|
||||
* 到规定时间后,往消息表插入消息
|
||||
*/
|
||||
public void handleEveryDayExpirationReminder() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (RemindVO remindVO : ) {
|
||||
LocalDateTime lastTime = remindVO.getLastReminderTime().toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime();
|
||||
if (!now.isBefore(lastTime)) {
|
||||
Message message = new Message();
|
||||
messageService.insertMessage(message);
|
||||
LocalDateTime tomorrow = now.plusDays(1);
|
||||
remindVO.setLastReminderTime();
|
||||
remindService.updateRemind()
|
||||
}
|
||||
}
|
||||
List<RemindVO> list = remindService.selectEveryDay();
|
||||
remindService.batchInsert(list);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理非每天到期提醒功能
|
||||
* 到规定时间后,往消息表插入消息
|
||||
*/
|
||||
public void handleNotEveryDayExpirationReminder() {
|
||||
for (RemindVO remindVO : remindService.selectNotEveryDay()) {
|
||||
// if (remindVO.getReminderPattern().equals()) {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
107
ruoyi-web/src/main/java/com/ruoyi/web/bst/RemindController.java
Normal file
107
ruoyi-web/src/main/java/com/ruoyi/web/bst/RemindController.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
package com.ruoyi.web.bst;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.bst.remind.domain.Remind;
|
||||
import com.ruoyi.bst.remind.domain.RemindVO;
|
||||
import com.ruoyi.bst.remind.domain.RemindQuery;
|
||||
import com.ruoyi.bst.remind.service.RemindService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 定时提醒Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bst/remind")
|
||||
public class RemindController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private RemindService remindService;
|
||||
|
||||
/**
|
||||
* 查询定时提醒列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:remind:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RemindQuery query)
|
||||
{
|
||||
startPage();
|
||||
startOrderBy();
|
||||
List<RemindVO> list = remindService.selectRemindList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出定时提醒列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:remind:export')")
|
||||
@Log(title = "定时提醒", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RemindQuery query)
|
||||
{
|
||||
List<RemindVO> list = remindService.selectRemindList(query);
|
||||
ExcelUtil<RemindVO> util = new ExcelUtil<RemindVO>(RemindVO.class);
|
||||
util.exportExcel(response, list, "定时提醒数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取定时提醒详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:remind:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(remindService.selectRemindById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增定时提醒
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:remind:add')")
|
||||
@Log(title = "定时提醒", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Remind remind)
|
||||
{
|
||||
return toAjax(remindService.insertRemind(remind));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改定时提醒
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:remind:edit')")
|
||||
@Log(title = "定时提醒", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Remind remind)
|
||||
{
|
||||
return toAjax(remindService.updateRemind(remind));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时提醒
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:remind:remove')")
|
||||
@Log(title = "定时提醒", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(remindService.deleteRemindByIds(ids));
|
||||
}
|
||||
}
|
|
@ -6,9 +6,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/project-manager?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://47.120.68.19:3306/project-manager?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: 123456
|
||||
password: d0dbe100b71c1d09
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
Loading…
Reference in New Issue
Block a user