ly 3 лет назад
Родитель
Сommit
1e6d5b41fb

+ 9 - 1
master/src/main/java/com/ruoyi/common/thread/Trainning/PlanStudyMailThread.java

@@ -1,6 +1,8 @@
 package com.ruoyi.common.thread.Trainning;
 
 import com.ruoyi.common.sendEmail.IMailService;
+import com.ruoyi.project.system.domain.SysMessage;
+import com.ruoyi.project.system.service.ISysMessageService;
 import com.ruoyi.project.training.spec.domain.TStApprove;
 import com.ruoyi.project.training.spec.domain.TStPlan;
 
@@ -13,19 +15,25 @@ public class PlanStudyMailThread implements Runnable{
     private String usernameEN;
     private TStPlan tStPlan;
     private int sendType;
+    private SysMessage message;
+    private ISysMessageService sysMessageService;
 
-    public PlanStudyMailThread(IMailService mailService, String email, String username, String usernameEN, TStPlan tStPlan, int sendType) {
+    public PlanStudyMailThread(IMailService mailService, String email, String username
+            , String usernameEN, TStPlan tStPlan, ISysMessageService sysMessageService, SysMessage message, int sendType) {
         this.mailService = mailService;
         this.email = email;
         this.username = username;
         this.usernameEN = usernameEN;
         this.tStPlan = tStPlan;
         this.sendType = sendType;
+        this.sysMessageService = sysMessageService;
+        this.message = message;
     }
 
     @Override
     public void run() {
         sendMail();
+        sysMessageService.insertSysMessage(message);
     }
 
     /*

+ 111 - 0
master/src/main/java/com/ruoyi/project/system/controller/SysMessageController.java

@@ -0,0 +1,111 @@
+package com.ruoyi.project.system.controller;
+
+import java.util.List;
+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.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.project.system.domain.SysMessage;
+import com.ruoyi.project.system.service.ISysMessageService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.page.TableDataInfo;
+
+/**
+ * 系统消息Controller
+ *
+ * @author ruoyi
+ * @date 2022-05-26
+ */
+@RestController
+@RequestMapping("/system/message")
+public class SysMessageController extends BaseController
+{
+    @Autowired
+    private ISysMessageService sysMessageService;
+
+
+    /**
+     * 查询系统消息列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(SysMessage sysMessage)
+    {
+        sysMessage.setUserId(getUserId());
+        startPage();
+        List<SysMessage> list = sysMessageService.selectSysMessageList(sysMessage);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询系统消息列表
+     */
+    @GetMapping("/unlist")
+    public List<SysMessage> unlist(SysMessage sysMessage)
+    {
+        sysMessage.setIsRead(0l);
+        sysMessage.setUserId(getUserId());
+        List<SysMessage> list = sysMessageService.selectSysMessageList(sysMessage);
+        return list;
+    }
+
+    /**
+     * 导出系统消息列表
+     */
+    @Log(title = "系统消息", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(SysMessage sysMessage)
+    {
+        List<SysMessage> list = sysMessageService.selectSysMessageList(sysMessage);
+        ExcelUtil<SysMessage> util = new ExcelUtil<SysMessage>(SysMessage.class);
+        return util.exportExcel(list, "message");
+    }
+
+    /**
+     * 获取系统消息详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(sysMessageService.selectSysMessageById(id));
+    }
+
+    /**
+     * 新增系统消息
+     */
+    @Log(title = "系统消息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysMessage sysMessage)
+    {
+        return toAjax(sysMessageService.insertSysMessage(sysMessage));
+    }
+
+    /**
+     * 修改系统消息
+     */
+    @Log(title = "系统消息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysMessage sysMessage)
+    {
+        return toAjax(sysMessageService.updateSysMessage(sysMessage));
+    }
+
+    /**
+     * 删除系统消息
+     */
+    @Log(title = "系统消息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(sysMessageService.deleteSysMessageByIds(ids));
+    }
+}

+ 134 - 0
master/src/main/java/com/ruoyi/project/system/domain/SysMessage.java

@@ -0,0 +1,134 @@
+package com.ruoyi.project.system.domain;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 系统消息对象 sys_message
+ *
+ * @author ruoyi
+ * @date 2022-05-26
+ */
+public class SysMessage extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long id;
+
+    /** 标题 */
+    @Excel(name = "标题")
+    private String msgTitle;
+
+    /** 类型 */
+    @Excel(name = "类型")
+    private String msgType;
+
+    /** 公告内容 */
+    @Excel(name = "公告内容")
+    private String msgContent;
+
+    /** 状态(0正常 1关闭) */
+    @Excel(name = "状态", readConverterExp = "0=正常,1=关闭")
+    private String status;
+
+    /** 接收者 */
+    @Excel(name = "接收者")
+    private Long userId;
+
+    /** 是否已读 */
+    @Excel(name = "是否已读")
+    private Long isRead;
+
+    /** 删除标识 */
+    private Long delFlag;
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+    public void setMsgTitle(String msgTitle)
+    {
+        this.msgTitle = msgTitle;
+    }
+
+    public Long getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Long delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public String getMsgTitle()
+    {
+        return msgTitle;
+    }
+    public void setMsgType(String msgType)
+    {
+        this.msgType = msgType;
+    }
+
+    public String getMsgType()
+    {
+        return msgType;
+    }
+    public void setMsgContent(String msgContent)
+    {
+        this.msgContent = msgContent;
+    }
+
+    public String getMsgContent()
+    {
+        return msgContent;
+    }
+    public void setStatus(String status)
+    {
+        this.status = status;
+    }
+
+    public String getStatus()
+    {
+        return status;
+    }
+    public void setUserId(Long userId)
+    {
+        this.userId = userId;
+    }
+
+    public Long getUserId()
+    {
+        return userId;
+    }
+    public void setIsRead(Long isRead)
+    {
+        this.isRead = isRead;
+    }
+
+    public Long getIsRead()
+    {
+        return isRead;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("msgTitle", getMsgTitle())
+            .append("msgType", getMsgType())
+            .append("msgContent", getMsgContent())
+            .append("status", getStatus())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("userId", getUserId())
+            .append("isRead", getIsRead())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 62 - 0
master/src/main/java/com/ruoyi/project/system/mapper/SysMessageMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.project.system.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
+import com.ruoyi.project.system.domain.SysMessage;
+
+/**
+ * 系统消息Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-26
+ */
+public interface SysMessageMapper
+{
+    /**
+     * 查询系统消息
+     *
+     * @param id 系统消息ID
+     * @return 系统消息
+     */
+    public SysMessage selectSysMessageById(Long id);
+
+    /**
+     * 查询系统消息列表
+     *
+     * @param sysMessage 系统消息
+     * @return 系统消息集合
+     */
+    public List<SysMessage> selectSysMessageList(SysMessage sysMessage);
+
+    /**
+     * 新增系统消息
+     *
+     * @param sysMessage 系统消息
+     * @return 结果
+     */
+    public int insertSysMessage(SysMessage sysMessage);
+
+    /**
+     * 修改系统消息
+     *
+     * @param sysMessage 系统消息
+     * @return 结果
+     */
+    public int updateSysMessage(SysMessage sysMessage);
+
+    /**
+     * 删除系统消息
+     *
+     * @param id 系统消息ID
+     * @return 结果
+     */
+    public int deleteSysMessageById(Long id);
+
+    /**
+     * 批量删除系统消息
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteSysMessageByIds(Long[] ids);
+}

+ 61 - 0
master/src/main/java/com/ruoyi/project/system/service/ISysMessageService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.project.system.service;
+
+import java.util.List;
+import com.ruoyi.project.system.domain.SysMessage;
+
+/**
+ * 系统消息Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-26
+ */
+public interface ISysMessageService
+{
+    /**
+     * 查询系统消息
+     *
+     * @param id 系统消息ID
+     * @return 系统消息
+     */
+    public SysMessage selectSysMessageById(Long id);
+
+    /**
+     * 查询系统消息列表
+     *
+     * @param sysMessage 系统消息
+     * @return 系统消息集合
+     */
+    public List<SysMessage> selectSysMessageList(SysMessage sysMessage);
+
+    /**
+     * 新增系统消息
+     *
+     * @param sysMessage 系统消息
+     * @return 结果
+     */
+    public int insertSysMessage(SysMessage sysMessage);
+
+    /**
+     * 修改系统消息
+     *
+     * @param sysMessage 系统消息
+     * @return 结果
+     */
+    public int updateSysMessage(SysMessage sysMessage);
+
+    /**
+     * 批量删除系统消息
+     *
+     * @param ids 需要删除的系统消息ID
+     * @return 结果
+     */
+    public int deleteSysMessageByIds(Long[] ids);
+
+    /**
+     * 删除系统消息信息
+     *
+     * @param id 系统消息ID
+     * @return 结果
+     */
+    public int deleteSysMessageById(Long id);
+}

+ 95 - 0
master/src/main/java/com/ruoyi/project/system/service/impl/SysMessageServiceImpl.java

@@ -0,0 +1,95 @@
+package com.ruoyi.project.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.project.system.mapper.SysMessageMapper;
+import com.ruoyi.project.system.domain.SysMessage;
+import com.ruoyi.project.system.service.ISysMessageService;
+
+/**
+ * 系统消息Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-26
+ */
+@Service
+public class SysMessageServiceImpl implements ISysMessageService
+{
+    @Autowired
+    private SysMessageMapper sysMessageMapper;
+
+    /**
+     * 查询系统消息
+     *
+     * @param id 系统消息ID
+     * @return 系统消息
+     */
+    @Override
+    public SysMessage selectSysMessageById(Long id)
+    {
+        return sysMessageMapper.selectSysMessageById(id);
+    }
+
+    /**
+     * 查询系统消息列表
+     *
+     * @param sysMessage 系统消息
+     * @return 系统消息
+     */
+    @Override
+    public List<SysMessage> selectSysMessageList(SysMessage sysMessage)
+    {
+        return sysMessageMapper.selectSysMessageList(sysMessage);
+    }
+
+    /**
+     * 新增系统消息
+     *
+     * @param sysMessage 系统消息
+     * @return 结果
+     */
+    @Override
+    public int insertSysMessage(SysMessage sysMessage)
+    {
+        sysMessage.setCreateTime(DateUtils.getNowDate());
+        return sysMessageMapper.insertSysMessage(sysMessage);
+    }
+
+    /**
+     * 修改系统消息
+     *
+     * @param sysMessage 系统消息
+     * @return 结果
+     */
+    @Override
+    public int updateSysMessage(SysMessage sysMessage)
+    {
+        return sysMessageMapper.updateSysMessage(sysMessage);
+    }
+
+    /**
+     * 批量删除系统消息
+     *
+     * @param ids 需要删除的系统消息ID
+     * @return 结果
+     */
+    @Override
+    public int deleteSysMessageByIds(Long[] ids)
+    {
+        return sysMessageMapper.deleteSysMessageByIds(ids);
+    }
+
+    /**
+     * 删除系统消息信息
+     *
+     * @param id 系统消息ID
+     * @return 结果
+     */
+    @Override
+    public int deleteSysMessageById(Long id)
+    {
+        return sysMessageMapper.deleteSysMessageById(id);
+    }
+}

+ 18 - 3
master/src/main/java/com/ruoyi/project/training/spec/controller/TStPlanController.java

@@ -11,7 +11,9 @@ import com.github.stuxuhai.jpinyin.PinyinHelper;
 import com.ruoyi.common.sendEmail.IMailService;
 import com.ruoyi.common.thread.Trainning.PlanApproveMailThread;
 import com.ruoyi.common.thread.Trainning.PlanStudyMailThread;
+import com.ruoyi.project.system.domain.SysMessage;
 import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysMessageService;
 import com.ruoyi.project.system.service.ISysUserService;
 import com.ruoyi.project.training.spec.domain.TStFeedback;
 import com.ruoyi.project.training.spec.domain.TStSuccessor;
@@ -68,6 +70,9 @@ public class TStPlanController extends BaseController
     private ITStYearplanService tStYearplanService;
     @Autowired
     private IMailService mailService;
+
+    @Autowired
+    private ISysMessageService sysMessageService;
     /**
      * 查询月度反馈培养计划列表
      */
@@ -285,6 +290,7 @@ public class TStPlanController extends BaseController
         //发送邮件
         try {
             TStPlan mailStPlan = tStPlanService.selectTStPlanById(tStPlan.getId());
+            SysMessage message = new SysMessage();
             if (tStPlan.getStudyState().equals("2")){//待导师确认
                 List<TStSuccessor> successorList = stSuccessorMapper.selectMentorListByStaffId(mailStPlan.getStaffId());
                 if (successorList.size() > 0) {
@@ -295,7 +301,10 @@ public class TStPlanController extends BaseController
                     String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
                     logger.info("email:" + email);
                     logger.info("username:" + username);
-                    PlanStudyMailThread sendEmailThead = new PlanStudyMailThread(mailService,email, username,usernameEN, mailStPlan, 2);
+                    message.setUserId(mt.getUserId());
+                    message.setMsgTitle("您有一条系统消息");
+                    message.setMsgContent("您有一条培训待导师确认");
+                    PlanStudyMailThread sendEmailThead = new PlanStudyMailThread(mailService,email, username,usernameEN, mailStPlan,sysMessageService,message, 2);
                     Thread t = new Thread(sendEmailThead);
                     t.start();
                 }
@@ -306,7 +315,10 @@ public class TStPlanController extends BaseController
                     String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
                     logger.info("email:" + email);
                     logger.info("username:" + username);
-                    PlanStudyMailThread sendEmailThead = new PlanStudyMailThread(mailService,email, username,usernameEN, mailStPlan, 3);
+                    message.setUserId(xs.getUserId());
+                    message.setMsgTitle("您有一条系统消息");
+                    message.setMsgContent("您有一条培训被导师拒绝");
+                    PlanStudyMailThread sendEmailThead = new PlanStudyMailThread(mailService,email, username,usernameEN, mailStPlan,sysMessageService,message, 3);
                     Thread t = new Thread(sendEmailThead);
                     t.start();
             }else if (tStPlan.getStudyState().equals("1")) { //完成
@@ -316,7 +328,10 @@ public class TStPlanController extends BaseController
                     String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
                     logger.info("email:" + email);
                     logger.info("username:" + username);
-                    PlanStudyMailThread sendEmailThead = new PlanStudyMailThread(mailService,email, username,usernameEN, mailStPlan, 1);
+                    message.setUserId(xs.getUserId());
+                    message.setMsgTitle("您有一条系统消息");
+                    message.setMsgContent("您有一条培训已完成");
+                    PlanStudyMailThread sendEmailThead = new PlanStudyMailThread(mailService,email, username,usernameEN, mailStPlan,sysMessageService,message, 1);
                     Thread t = new Thread(sendEmailThead);
                     t.start();
                 }

+ 101 - 0
master/src/main/resources/mybatis/system/SysMessageMapper.xml

@@ -0,0 +1,101 @@
+<?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.project.system.mapper.SysMessageMapper">
+
+    <resultMap type="SysMessage" id="SysMessageResult">
+        <result property="id"    column="id"    />
+        <result property="msgTitle"    column="msg_title"    />
+        <result property="msgType"    column="msg_type"    />
+        <result property="msgContent"    column="msg_content"    />
+        <result property="status"    column="status"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="userId"    column="user_id"    />
+        <result property="isRead"    column="is_read"    />
+        <result property="remark"    column="remark"    />
+        <result property="delFlag"    column="del_flag"    />
+    </resultMap>
+
+    <sql id="selectSysMessageVo">
+        select d.id, d.msg_title, d.msg_type, d.msg_content, d.status, d.create_by, d.create_time, d.user_id, d.is_read, d.remark  from sys_message d
+    </sql>
+
+    <select id="selectSysMessageList" parameterType="SysMessage" resultMap="SysMessageResult">
+        <include refid="selectSysMessageVo"/>
+        <where>
+            <if test="msgTitle != null  and msgTitle != ''"> and msg_title = #{msgTitle}</if>
+            <if test="msgType != null  and msgType != ''"> and msg_type = #{msgType}</if>
+            <if test="msgContent != null  and msgContent != ''"> and msg_content = #{msgContent}</if>
+            <if test="status != null  and status != ''"> and status = #{status}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="isRead != null "> and is_read = #{isRead}</if>
+            and d.del_flag = 0
+        </where>
+    </select>
+
+    <select id="selectSysMessageById" parameterType="Long" resultMap="SysMessageResult">
+        <include refid="selectSysMessageVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertSysMessage" parameterType="SysMessage">
+        <selectKey keyProperty="id" resultType="long" order="BEFORE">
+            SELECT seq_sys_message.NEXTVAL as id FROM DUAL
+        </selectKey>
+        insert into sys_message
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="msgTitle != null and msgTitle != ''">msg_title,</if>
+            <if test="msgType != null and msgType != ''">msg_type,</if>
+            <if test="msgContent != null">msg_content,</if>
+            <if test="status != null">status,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="isRead != null">is_read,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="msgTitle != null and msgTitle != ''">#{msgTitle},</if>
+            <if test="msgType != null and msgType != ''">#{msgType},</if>
+            <if test="msgContent != null">#{msgContent},</if>
+            <if test="status != null">#{status},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="isRead != null">#{isRead},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysMessage" parameterType="SysMessage">
+        update sys_message
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="msgTitle != null and msgTitle != ''">msg_title = #{msgTitle},</if>
+            <if test="msgType != null and msgType != ''">msg_type = #{msgType},</if>
+            <if test="msgContent != null">msg_content = #{msgContent},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="isRead != null">is_read = #{isRead},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteSysMessageById" parameterType="Long">
+        update sys_message set del_flag = 2 where id = #{id}
+    </update>
+
+    <update id="deleteSysMessageByIds" parameterType="String">
+        update sys_message set del_flag = 2 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+</mapper>

+ 62 - 0
ui/src/api/system/message.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询系统消息列表
+export function listMessage(query) {
+  return request({
+    url: '/system/message/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询系统消息列表
+export function listUnMessage(query) {
+  return request({
+    url: '/system/message/unlist',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询系统消息详细
+export function getMessage(id) {
+  return request({
+    url: '/system/message/' + id,
+    method: 'get'
+  })
+}
+
+// 新增系统消息
+export function addMessage(data) {
+  return request({
+    url: '/system/message',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改系统消息
+export function updateMessage(data) {
+  return request({
+    url: '/system/message',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除系统消息
+export function delMessage(id) {
+  return request({
+    url: '/system/message/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出系统消息
+export function exportMessage(query) {
+  return request({
+    url: '/system/message/export',
+    method: 'get',
+    params: query
+  })
+}

+ 26 - 1
ui/src/layout/components/Navbar.vue

@@ -35,6 +35,15 @@
               </div>
             </el-popover>
         </div>
+        <div class="right-menu-item" style="cursor:pointer" @click="toMessage" >
+
+            <div slot="reference">
+              <el-badge :is-dot="messageFlag">
+                <i class="el-icon-message"  style=" font-size:20px;"></i>
+              </el-badge>
+            </div>
+
+        </div>
 <!--        <el-tooltip content="源码地址" effect="dark" placement="bottom">-->
 <!--          <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
 <!--        </el-tooltip>-->
@@ -84,6 +93,7 @@ import RuoYiGit from '@/components/RuoYi/Git'
 import RuoYiDoc from '@/components/RuoYi/Doc'
 import LangSelect from '@/components/LangSelect'
 import {listUnNotice} from "@/api/system/notice";
+import {listUnMessage} from "@/api/system/message";
 export default {
   components: {
     Breadcrumb,
@@ -99,6 +109,7 @@ export default {
       return {
         gridData: [],
         dotFlag: false,
+        messageFlag: false
       };
     },
   computed: {
@@ -121,10 +132,12 @@ export default {
   },
   mounted() {
     this.getNotice()
+    this.getMessage()
     //定时器
     const timer = setInterval(() => {
       this.getNotice()
-    }, 100000)
+      this.getMessage()
+    }, 10000)
   },
   methods: {
     getNotice(){
@@ -137,6 +150,18 @@ export default {
         }
       });
     },
+    getMessage(){
+      listUnMessage().then(response => {
+        if (response.length > 0) {
+          this.messageFlag = true
+        }else {
+          this.messageFlag = false
+        }
+      });
+    },
+    toMessage(){
+      this.$router.push("/system/message");
+    },
     toggleSideBar() {
       this.$store.dispatch('app/toggleSideBar')
     },

+ 14 - 0
ui/src/router/index.js

@@ -93,6 +93,20 @@ export const constantRoutes = [
       }
     ]
   },
+  {
+    path: '/system',
+    component: Layout,
+    hidden: true,
+    redirect: 'noredirect',
+    children: [
+      {
+        path: 'message',
+        component: (resolve) => require(['@/views/system/message/index'], resolve),
+        name: 'Profile',
+        meta: { title: '系统消息', icon: '' }
+      }
+    ]
+  },
   {
     path: '/dict',
     component: Layout,

+ 371 - 0
ui/src/views/system/message/index.vue

@@ -0,0 +1,371 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="标题" prop="msgTitle">
+        <el-input
+          v-model="queryParams.msgTitle"
+          placeholder="请输入标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+<!--    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['system:message:add']"
+        >全部已读</el-button>
+      </el-col>
+
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>-->
+
+    <el-table v-loading="loading" :data="messageList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+<!--      <el-table-column type="selection" width="55" align="center" />-->
+      <el-table-column label="标题" align="center" prop="msgTitle" :show-overflow-tooltip="true"/>
+      <el-table-column label="内容" align="center" prop="msgContent" :show-overflow-tooltip="true"/>
+      <el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
+      <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/>
+<!--      <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-button-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-edit"-->
+<!--            @click="handleUpdate(scope.row)"-->
+<!--            v-hasPermi="['system:message:edit']"-->
+<!--          >修改</el-button>-->
+<!--          <el-button-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-delete"-->
+<!--            @click="handleDelete(scope.row)"-->
+<!--            v-hasPermi="['system:message:remove']"-->
+<!--          >删除</el-button>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改系统消息对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="标题" prop="msgTitle">
+          <el-input v-model="form.msgTitle" placeholder="请输入标题" />
+        </el-form-item>
+        <el-form-item label="类型" prop="msgType">
+          <el-select v-model="form.msgType" placeholder="请选择类型">
+            <el-option label="请选择字典生成" value="" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="公告内容">
+          <editor v-model="form.msgContent" :min-height="192"/>
+        </el-form-item>
+        <el-form-item label="状态">
+          <el-radio-group v-model="form.status">
+            <el-radio label="1">请选择字典生成</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="接收者" prop="userId">
+          <el-input v-model="form.userId" placeholder="请输入接收者" />
+        </el-form-item>
+        <el-form-item label="是否已读" prop="isRead">
+          <el-input v-model="form.isRead" placeholder="请输入是否已读" />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" />
+        </el-form-item>
+          <el-form-item label="归属部门" prop="deptId">
+              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
+          </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+      <!-- 用户导入对话框 -->
+      <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+          <el-upload
+                  ref="upload"
+                  :limit="1"
+                  accept=".xlsx, .xls"
+                  :headers="upload.headers"
+                  :action="upload.url + '?updateSupport=' + upload.updateSupport"
+                  :disabled="upload.isUploading"
+                  :on-progress="handleFileUploadProgress"
+                  :on-success="handleFileSuccess"
+                  :auto-upload="false"
+                  drag
+          >
+              <i class="el-icon-upload"></i>
+              <div class="el-upload__text">
+                  将文件拖到此处,或
+                  <em>点击上传</em>
+              </div>
+              <div class="el-upload__tip" slot="tip">
+                  <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
+                  <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+              </div>
+              <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+          </el-upload>
+          <div slot="footer" class="dialog-footer">
+              <el-button type="primary" @click="submitFileForm">确 定</el-button>
+              <el-button @click="upload.open = false">取 消</el-button>
+          </div>
+      </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listMessage, getMessage, delMessage, addMessage, updateMessage, exportMessage, importTemplate} from "@/api/system/message";
+import { treeselect } from "@/api/system/dept";
+import { getToken } from "@/utils/auth";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import Editor from '@/components/Editor';
+
+export default {
+  name: "Message",
+  components: { Treeselect },
+  // components: { Editor },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 系统消息表格数据
+      messageList: [],
+      // 弹出层标题
+      title: "",
+      // 部门树选项
+      deptOptions: undefined,
+      clientHeight:300,
+      // 是否显示弹出层
+      open: false,
+        // 用户导入参数
+        upload: {
+            // 是否显示弹出层(用户导入)
+            open: false,
+            // 弹出层标题(用户导入)
+            title: "",
+            // 是否禁用上传
+            isUploading: false,
+            // 是否更新已经存在的用户数据
+            updateSupport: 0,
+            // 设置上传的请求头部
+            headers: { Authorization: "Bearer " + getToken() },
+            // 上传的地址
+            url: process.env.VUE_APP_BASE_API + "/system/message/importData"
+        },
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 20,
+        msgTitle: null,
+        msgType: null,
+        msgContent: null,
+        status: null,
+        userId: null,
+        isRead: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        msgTitle: [
+          { required: true, message: "标题不能为空", trigger: "blur" }
+        ],
+        msgType: [
+          { required: true, message: "类型不能为空", trigger: "change" }
+        ],
+      }
+    };
+  },
+  watch: {
+        // 根据名称筛选部门树
+        deptName(val) {
+            this.$refs.tree.filter(val);
+        }
+   },
+  created() {
+      //设置表格高度对应屏幕高度
+      this.$nextTick(() => {
+          this.clientHeight = document.body.clientHeight -250
+      })
+    this.getList();
+    this.getTreeselect();
+  },
+  methods: {
+    /** 查询系统消息列表 */
+    getList() {
+      this.loading = true;
+      listMessage(this.queryParams).then(response => {
+        this.messageList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+     /** 查询部门下拉树结构 */
+     getTreeselect() {
+          treeselect().then(response => {
+              this.deptOptions = response.data;
+          });
+     },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        msgTitle: null,
+        msgType: null,
+        msgContent: null,
+        status: "0",
+        createBy: null,
+        createTime: null,
+        userId: null,
+        isRead: null,
+        remark: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加系统消息";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getMessage(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改系统消息";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateMessage(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addMessage(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delMessage(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有系统消息数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportMessage(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        })
+    },
+      /** 导入按钮操作 */
+      handleImport() {
+          this.upload.title = "用户导入";
+          this.upload.open = true;
+      },
+      /** 下载模板操作 */
+      importTemplate() {
+          importTemplate().then(response => {
+              this.download(response.msg);
+          });
+      },
+      // 文件上传中处理
+      handleFileUploadProgress(event, file, fileList) {
+          this.upload.isUploading = true;
+      },
+      // 文件上传成功处理
+      handleFileSuccess(response, file, fileList) {
+          this.upload.open = false;
+          this.upload.isUploading = false;
+          this.$refs.upload.clearFiles();
+          this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+          this.getList();
+      },
+      // 提交上传文件
+      submitFileForm() {
+          this.$refs.upload.submit();
+      }
+  }
+};
+</script>