浏览代码

消息通知增加字段

tudc 4 年之前
父节点
当前提交
c309d47c8d

+ 2 - 2
tianhu-system/src/main/java/com/tianhu/system/controller/OwnNoticeController.java

@@ -81,8 +81,8 @@ public class OwnNoticeController extends BaseController
      * @param userIds       收到信息用户id集合
      */
     @PostMapping("sendNotice")
-    public R sendNotice(String companyId, String tableId, String title, String type, String noticeType, String workType, String messageSend, String userIds, String templateCode)throws Exception {
-        R r = iOwnNoticeService.sendNotice(companyId, tableId, title, type, noticeType, workType, messageSend, userIds, templateCode);
+    public R sendNotice(String companyId, String tableId, String title, String type, String noticeType, String workType, String messageSend, String userIds, String templateCode, String openType, String openUrl)throws Exception {
+        R r = iOwnNoticeService.sendNotice(companyId, tableId, title, type, noticeType, workType, messageSend, userIds, templateCode, openType,  openUrl);
         return r;
     }
 }

+ 0 - 136
tianhu-system/src/main/java/com/tianhu/system/controller/SysNoticeController.java

@@ -1,136 +0,0 @@
-package com.tianhu.system.controller;
-
-import com.tianhu.common.core.constant.SalaryConstants;
-import com.tianhu.common.core.utils.SecurityUtils;
-import com.tianhu.common.core.web.controller.BaseController;
-import com.tianhu.common.core.web.domain.AjaxResult;
-import com.tianhu.common.core.web.page.TableDataInfo;
-import com.tianhu.common.log.annotation.Log;
-import com.tianhu.common.log.enums.BusinessType;
-import com.tianhu.common.security.annotation.PreAuthorize;
-import com.tianhu.common.security.service.TokenService;
-import com.tianhu.system.api.domain.SysUser;
-import com.tianhu.system.api.model.LoginUser;
-import com.tianhu.system.domain.SysNotice;
-import com.tianhu.system.service.ISysNoticeService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 公告 信息操作处理
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/notice")
-public class SysNoticeController extends BaseController
-{
-    @Autowired
-    private ISysNoticeService noticeService;
-    @Autowired
-    private TokenService tokenService;
-
-    /**
-     * 获取通知公告列表
-     */
-    @PreAuthorize(hasPermi = "system:notice:list")
-    @GetMapping("/list")
-    public TableDataInfo list(SysNotice notice)
-    {
-        startPage();
-        //获取公司
-        LoginUser userInfo = tokenService.getLoginUser();
-        SysUser user = userInfo.getSysUser();
-        //公司
-        String companyId = user.getCompanyId();
-        //不是管理员
-        if (!SalaryConstants.OPEX.equals(companyId)) {
-            notice.setCompanyId(companyId);
-        }
-        List<SysNotice> list = noticeService.selectNoticeList(notice);
-        return getDataTable(list);
-    }
-    @GetMapping("/noticeList")
-    public TableDataInfo noticeList(SysNotice notice)
-    {
-        startPage();
-        //获取公司
-        LoginUser userInfo = tokenService.getLoginUser();
-        SysUser user = userInfo.getSysUser();
-        //公司
-        String companyId = user.getCompanyId();
-        //不是管理员
-        if (!SalaryConstants.OPEX.equals(companyId)) {
-            notice.setCompanyId(companyId);
-        }
-        //正常
-        notice.setStatus("0");
-        List<SysNotice> list = noticeService.selectNoticeList(notice);
-        return getDataTable(list);
-    }
-    /**
-     * 根据通知公告编号获取详细信息
-     */
-    @PreAuthorize(hasPermi = "system:notice:query")
-    @GetMapping(value = "/{noticeId}")
-    public AjaxResult getInfo(@PathVariable String noticeId)
-    {
-        return AjaxResult.success(noticeService.selectNoticeById(noticeId));
-    }
-
-    /**
-     * 新增通知公告
-     */
-    @PreAuthorize(hasPermi = "system:notice:add")
-    @Log(title = "通知公告", businessType = BusinessType.UPDATE)
-    @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysNotice notice)
-    {
-        notice.setCreateBy(SecurityUtils.getUsername());
-        //获取公司
-        LoginUser userInfo = tokenService.getLoginUser();
-        SysUser user = userInfo.getSysUser();
-        //公司
-        String company = user.getCompanyId();
-        //公司编号
-        notice.setCompanyId(company);
-        return toAjax(noticeService.insertNotice(notice));
-    }
-
-    /**
-     * 修改通知公告
-     */
-    @PreAuthorize(hasPermi = "system:notice:edit")
-    @Log(title = "通知公告", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysNotice notice)
-    {
-        notice.setUpdateBy(SecurityUtils.getUsername());
-        return toAjax(noticeService.updateNotice(notice));
-    }
-
-    /**
-     * 删除通知公告
-     */
-    @PreAuthorize(hasPermi = "system:notice:remove")
-    @Log(title = "通知公告", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{noticeIds}")
-    public AjaxResult remove(@PathVariable String[] noticeIds)
-    {
-        return toAjax(noticeService.deleteNoticeByIds(noticeIds));
-    }
-
-    /**
-     * 状态修改
-     */
-    @Log(title = "通知公告", businessType = BusinessType.UPDATE)
-    @PutMapping("/changeStatus")
-    public AjaxResult changeStatus(@RequestBody SysNotice notice)
-    {
-        notice.setUpdateBy(SecurityUtils.getUsername());
-        return toAjax(noticeService.updateNotice(notice));
-    }
-}

+ 97 - 164
tianhu-system/src/main/java/com/tianhu/system/domain/SysNotice.java

@@ -1,192 +1,125 @@
 package com.tianhu.system.domain;
 
-import com.tianhu.common.core.annotation.Excel;
-import com.tianhu.common.core.web.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
 
 /**
- * 通知公告对象 sys_notice
+ * <p>
+ * 消息通知表
+ * </p>
  *
- * @author huyi
- * @date 2021-08-25
+ * @author cuixq
+ * @since 2021-09-14
  */
-public class SysNotice extends BaseEntity
-{
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sys_notice")
+public class SysNotice implements Serializable {
+
     private static final long serialVersionUID = 1L;
 
-    /** 公告ID */
+    /**
+     * 消息ID
+     */
+    @TableId("notice_id")
     private String noticeId;
 
-    /** 企业id */
-    @Excel(name = "企业id")
+    /**
+     * 公司id
+     */
+    @TableField("company_id")
     private String companyId;
 
-    /** 关联表主键 */
-    @Excel(name = "关联表主键")
+    /**
+     * 关联表主键
+     */
+    @TableField("table_id")
     private String tableId;
 
-    /** 公告标题 */
-    @Excel(name = "公告标题")
+    /**
+     * 标题
+     */
+    @TableField("notice_title")
     private String noticeTitle;
 
-    /** 公告类型(1通知 2公告) */
-    @Excel(name = "公告类型", readConverterExp = "1=通知,2=公告")
+    /**
+     * 00:待办,01:消息提醒
+     */
+    @TableField("type")
+    private String type;
+
+    /**
+     * 消息提醒类型(00:平台欢迎信, 01:发起人审批结果通知, 02:经办人的平台审批结果通知, 03:融资企业经办人融信失效消息通知, 04:融资企业经办人融信生效消息通知, 05:融信即将失效消息通知, 06:还款消息通知)
+     */
+    @TableField("notice_type")
     private String noticeType;
 
-    /** 00:待办,01:消息提醒 */
-    @Excel(name = "00:待办,01:消息提醒")
-    private String type;
+    /**
+     * 待办类型:(00:融信审批待审批, 01:审批拒绝待编辑, 02:核心企业待确权, 03:待盖章, 04:待签收, 05:待融资, 06:待还款, 07:平台内部待办)
+     */
+    @TableField("work_type")
+    private String workType;
 
-    /** 公告状态(0正常 1关闭) */
-    @Excel(name = "公告状态", readConverterExp = "0=正常,1=关闭")
+    /**
+     * 状态(0待办 1已办 2删除)
+     */
+    @TableField("status")
     private String status;
 
-    /** 是否短信提醒(0:不提醒, 1:提醒) */
-    @Excel(name = "是否短信提醒(0:不提醒, 1:提醒)")
+    /**
+     * 是否短信提醒(0:不提醒, 1:提醒)
+     */
+    @TableField("message_send")
     private String messageSend;
 
-    /** 待办类型:(00:待审批, 01:链属, 02:融信失效) */
-    @Excel(name = "待办类型:(00:待审批, 01:链属, 02:融信失效)")
-    private String workType;
-
-    /** 短信模板ID */
-    @Excel(name = "短信模板ID")
+    /**
+     * 已发短信ID
+     */
+    @TableField("message_id")
     private String messageId;
 
-    /** 短信发送状态(0:未发送 1:已发送) */
-    @Excel(name = "短信发送状态", readConverterExp = "0=:未发送,1=:已发送")
+    /**
+     * 短信模板
+     */
+    @TableField("message_code")
+    private String messageCode;
+
+    /**
+     * 短信发送状态(0:未发送 1:已发送)
+     */
+    @TableField("message_status")
     private String messageStatus;
 
-    /** 短信模板 */
-    @Excel(name = "短信模板")
-    private String messageCode;
+    /**
+     * 打开方式(00:弹窗 01:链接)
+     */
+    @TableField("open_type")
+    private String openType;
+
+    /**
+     * 打开链接
+     */
+    @TableField("open_url")
+    private String openUrl;
+
+    /**
+     * 备注
+     */
+    @TableField("remark")
+    private String remark;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
 
-    public void setNoticeId(String noticeId)
-    {
-        this.noticeId = noticeId;
-    }
-
-    public String getNoticeId()
-    {
-        return noticeId;
-    }
-    public void setCompanyId(String companyId)
-    {
-        this.companyId = companyId;
-    }
-
-    public String getCompanyId()
-    {
-        return companyId;
-    }
-    public void setTableId(String tableId)
-    {
-        this.tableId = tableId;
-    }
-
-    public String getTableId()
-    {
-        return tableId;
-    }
-    public void setNoticeTitle(String noticeTitle)
-    {
-        this.noticeTitle = noticeTitle;
-    }
-
-    public String getNoticeTitle()
-    {
-        return noticeTitle;
-    }
-    public void setNoticeType(String noticeType)
-    {
-        this.noticeType = noticeType;
-    }
-
-    public String getNoticeType()
-    {
-        return noticeType;
-    }
-    public void setType(String type)
-    {
-        this.type = type;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-    public void setStatus(String status)
-    {
-        this.status = status;
-    }
-
-    public String getStatus()
-    {
-        return status;
-    }
-    public void setMessageSend(String messageSend)
-    {
-        this.messageSend = messageSend;
-    }
-
-    public String getMessageSend()
-    {
-        return messageSend;
-    }
-    public void setWorkType(String workType)
-    {
-        this.workType = workType;
-    }
-
-    public String getWorkType()
-    {
-        return workType;
-    }
-    public void setMessageId(String messageId)
-    {
-        this.messageId = messageId;
-    }
-
-    public String getMessageId()
-    {
-        return messageId;
-    }
-    public void setMessageStatus(String messageStatus)
-    {
-        this.messageStatus = messageStatus;
-    }
-
-    public String getMessageStatus()
-    {
-        return messageStatus;
-    }
-    public void setMessageCode(String messageCode)
-    {
-        this.messageCode = messageCode;
-    }
-
-    public String getMessageCode()
-    {
-        return messageCode;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-                .append("noticeId", getNoticeId())
-                .append("companyId", getCompanyId())
-                .append("tableId", getTableId())
-                .append("noticeTitle", getNoticeTitle())
-                .append("noticeType", getNoticeType())
-                .append("type", getType())
-                .append("status", getStatus())
-                .append("messageSend", getMessageSend())
-                .append("workType", getWorkType())
-                .append("messageId", getMessageId())
-                .append("messageStatus", getMessageStatus())
-                .append("messageCode", getMessageCode())
-                .append("remark", getRemark())
-                .toString();
-    }
-}
+}

+ 1 - 1
tianhu-system/src/main/java/com/tianhu/system/service/IOwnNoticeService.java

@@ -35,5 +35,5 @@ public interface IOwnNoticeService
      * @param templateCode  短信模板(aliyun_message_code)
      * @return
      */
-    public R sendNotice(String companyId, String tableId, String title, String type, String noticeType, String workType, String messageSend, String userIds, String templateCode);
+    public R sendNotice(String companyId, String tableId, String title, String type, String noticeType, String workType, String messageSend, String userIds, String templateCode, String openType, String openUrl);
 }

+ 5 - 1
tianhu-system/src/main/java/com/tianhu/system/service/impl/OwnNoticeServiceImpl.java

@@ -81,9 +81,11 @@ public class OwnNoticeServiceImpl implements IOwnNoticeService
      * @param messageSend   是否发送短信 0不发送 1发送
      * @param userIds       收到信息用户id集合
      * @param templateCode  短信模板(aliyun_message_code)
+     * @param openType      打开方式(00:弹窗 01:链接)
+     * @param openUrl       链接
      */
     @Override
-    public R sendNotice(String companyId, String tableId, String title, String type, String noticeType, String workType, String messageSend, String userIds, String templateCode)
+    public R sendNotice(String companyId, String tableId, String title, String type, String noticeType, String workType, String messageSend, String userIds, String templateCode, String openType, String openUrl)
     {
         //新增通知公告
         SysNotice notice = new SysNotice();
@@ -104,6 +106,8 @@ public class OwnNoticeServiceImpl implements IOwnNoticeService
         notice.setWorkType(workType);
         //是否发送短信 0不发送 1发送
         notice.setMessageSend(messageSend);
+        notice.setOpenType(openType);
+        notice.setOpenUrl(openUrl);
         //发送短信手机号
         String phones = "";
         //新增通知公告接收人

+ 1 - 1
tianhu-system/src/main/resources/mapper/system/SysCompanyMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.tianhu.system.mapper.SysCompanyMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.tianhu.system.entity.SysCompany">
+    <resultMap id="BaseResultMap" type="com.tianhu.system.domain.SysCompany">
         <id column="scy_id" property="scyId" />
         <result column="scy_license_file" property="scyLicenseFile" />
         <result column="scy_name" property="scyName" />

+ 21 - 110
tianhu-system/src/main/resources/mapper/system/SysNoticeMapper.xml

@@ -1,114 +1,25 @@
-<?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">
+<?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.tianhu.system.mapper.SysNoticeMapper">
 
-    <resultMap type="SysNotice" id="SysNoticeResult">
-        <result property="noticeId"    column="notice_id"    />
-        <result property="companyId"    column="company_id"    />
-        <result property="tableId"    column="table_id"    />
-        <result property="noticeTitle"    column="notice_title"    />
-        <result property="noticeType"    column="notice_type"    />
-        <result property="type"    column="type"    />
-        <result property="status"    column="status"    />
-        <result property="messageSend"    column="message_send"    />
-        <result property="workType"    column="work_type"    />
-        <result property="messageId"    column="message_id"    />
-        <result property="messageStatus"    column="message_status"    />
-        <result property="messageCode"    column="message_code"    />
-        <result property="remark"    column="remark"    />
-        <result property="createTime"     column="create_time"    />
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.tianhu.system.domain.SysNotice">
+        <id column="notice_id" property="noticeId" />
+        <result column="company_id" property="companyId" />
+        <result column="table_id" property="tableId" />
+        <result column="notice_title" property="noticeTitle" />
+        <result column="type" property="type" />
+        <result column="notice_type" property="noticeType" />
+        <result column="work_type" property="workType" />
+        <result column="status" property="status" />
+        <result column="message_send" property="messageSend" />
+        <result column="message_id" property="messageId" />
+        <result column="message_code" property="messageCode" />
+        <result column="message_status" property="messageStatus" />
+        <result column="open_type" property="openType" />
+        <result column="open_url" property="openUrl" />
+        <result column="remark" property="remark" />
+        <result column="create_time" property="createTime" />
     </resultMap>
 
-    <sql id="selectSysNoticeVo">
-        select notice_id, company_id, table_id, notice_title, notice_type, type, status, message_send, work_type, message_id, message_status, message_code, remark, create_time from sys_notice
-    </sql>
-
-    <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
-        <include refid="selectSysNoticeVo"/>
-        <where>
-            <if test="companyId != null  and companyId != ''"> and company_id = #{companyId}</if>
-            <if test="tableId != null  and tableId != ''"> and table_id = #{tableId}</if>
-            <if test="noticeTitle != null  and noticeTitle != ''"> and notice_title = #{noticeTitle}</if>
-            <if test="noticeType != null  and noticeType != ''"> and notice_type = #{noticeType}</if>
-            <if test="type != null  and type != ''"> and type = #{type}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
-            <if test="messageSend != null  and messageSend != ''"> and message_send = #{messageSend}</if>
-            <if test="workType != null  and workType != ''"> and work_type = #{workType}</if>
-            <if test="messageId != null  and messageId != ''"> and message_id = #{messageId}</if>
-            <if test="messageStatus != null  and messageStatus != ''"> and message_status = #{messageStatus}</if>
-            <if test="messageCode != null  and messageCode != ''"> and message_code = #{messageCode}</if>
-        </where>
-    </select>
-
-    <select id="selectNoticeById" parameterType="String" resultMap="SysNoticeResult">
-        <include refid="selectSysNoticeVo"/>
-        where notice_id = #{noticeId}
-    </select>
-
-    <insert id="insertNotice" parameterType="SysNotice">
-        insert into sys_notice(
-            <if test="noticeId != null">notice_id,</if>
-            <if test="companyId != null">company_id,</if>
-            <if test="tableId != null">table_id,</if>
-            <if test="noticeTitle != null and noticeTitle != ''">notice_title,</if>
-            <if test="noticeType != null and noticeType != ''">notice_type,</if>
-            <if test="type != null">type,</if>
-            <if test="status != null">status,</if>
-            <if test="messageSend != null">message_send,</if>
-            <if test="workType != null">work_type,</if>
-            <if test="messageId != null">message_id,</if>
-            <if test="messageStatus != null">message_status,</if>
-            <if test="messageCode != null">message_code,</if>
-            <if test="remark != null">remark,</if>
-            create_time
-        )values(
-            <if test="noticeId != null">#{noticeId},</if>
-            <if test="companyId != null">#{companyId},</if>
-            <if test="tableId != null">#{tableId},</if>
-            <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
-            <if test="noticeType != null and noticeType != ''">#{noticeType},</if>
-            <if test="type != null">#{type},</if>
-            <if test="status != null">#{status},</if>
-            <if test="messageSend != null">#{messageSend},</if>
-            <if test="workType != null">#{workType},</if>
-            <if test="messageId != null">#{messageId},</if>
-            <if test="messageStatus != null">#{messageStatus},</if>
-            <if test="messageCode != null">#{messageCode},</if>
-            <if test="remark != null">#{remark},</if>
-            sysdate()
-        )
-    </insert>
-
-    <update id="updateNotice" parameterType="SysNotice">
-        update sys_notice
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="companyId != null">company_id = #{companyId},</if>
-            <if test="tableId != null">table_id = #{tableId},</if>
-            <if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle},</if>
-            <if test="noticeType != null and noticeType != ''">notice_type = #{noticeType},</if>
-            <if test="type != null">type = #{type},</if>
-            <if test="status != null">status = #{status},</if>
-            <if test="messageSend != null">message_send = #{messageSend},</if>
-            <if test="workType != null">work_type = #{workType},</if>
-            <if test="messageId != null">message_id = #{messageId},</if>
-            <if test="messageStatus != null">message_status = #{messageStatus},</if>
-            <if test="messageCode != null">message_code = #{messageCode},</if>
-            <if test="remark != null">remark = #{remark},</if>
-        </trim>
-        where notice_id = #{noticeId}
-    </update>
-
-    <delete id="deleteNoticeById" parameterType="String">
-        delete from sys_notice where notice_id = #{noticeId}
-    </delete>
-
-    <delete id="deleteNoticeByIds" parameterType="String">
-        delete from sys_notice where notice_id in
-        <foreach item="noticeId" collection="array" open="(" separator="," close=")">
-            #{noticeId}
-        </foreach>
-    </delete>
-
-</mapper>
+</mapper>