消息配置
This commit is contained in:
parent
f65750f963
commit
29e330e467
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.snow.framework.util.ShiroUtils;
|
import com.snow.framework.util.ShiroUtils;
|
||||||
import com.snow.system.domain.SysUser;
|
import com.snow.system.domain.SysUser;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
|
@ -53,6 +54,8 @@ public class SysNewsTriggersController extends BaseController
|
||||||
public TableDataInfo list(SysNewsTriggers sysNewsTriggers)
|
public TableDataInfo list(SysNewsTriggers sysNewsTriggers)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
|
SysUser sysUser = ShiroUtils.getSysUser();
|
||||||
|
sysNewsTriggers.setUserId(String.valueOf(sysUser.getUserId()));
|
||||||
List<SysNewsTriggers> list = sysNewsTriggersService.selectSysNewsTriggersList(sysNewsTriggers);
|
List<SysNewsTriggers> list = sysNewsTriggersService.selectSysNewsTriggersList(sysNewsTriggers);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +71,7 @@ public class SysNewsTriggersController extends BaseController
|
||||||
{
|
{
|
||||||
SysUser sysUser = ShiroUtils.getSysUser();
|
SysUser sysUser = ShiroUtils.getSysUser();
|
||||||
sysNewsTriggers.setUserId(String.valueOf(sysUser.getUserId()));
|
sysNewsTriggers.setUserId(String.valueOf(sysUser.getUserId()));
|
||||||
|
|
||||||
List<SysNewsTriggers> list = sysNewsTriggersService.selectSysNewsTriggersList(sysNewsTriggers);
|
List<SysNewsTriggers> list = sysNewsTriggersService.selectSysNewsTriggersList(sysNewsTriggers);
|
||||||
ExcelUtil<SysNewsTriggers> util = new ExcelUtil<SysNewsTriggers>(SysNewsTriggers.class);
|
ExcelUtil<SysNewsTriggers> util = new ExcelUtil<SysNewsTriggers>(SysNewsTriggers.class);
|
||||||
return util.exportExcel(list, "triggers");
|
return util.exportExcel(list, "triggers");
|
||||||
|
@ -93,6 +97,13 @@ public class SysNewsTriggersController extends BaseController
|
||||||
{
|
{
|
||||||
SysUser sysUser = ShiroUtils.getSysUser();
|
SysUser sysUser = ShiroUtils.getSysUser();
|
||||||
sysNewsTriggers.setUserId(String.valueOf(sysUser.getUserId()));
|
sysNewsTriggers.setUserId(String.valueOf(sysUser.getUserId()));
|
||||||
|
sysNewsTriggers.setNewsOnOff(null);
|
||||||
|
List<SysNewsTriggers> sysNewsTriggersList = sysNewsTriggersService.selectSysNewsTriggersList(sysNewsTriggers);
|
||||||
|
if(CollectionUtils.isNotEmpty(sysNewsTriggersList)){
|
||||||
|
return AjaxResult.error("该配置已存在,请勿重复添加");
|
||||||
|
}
|
||||||
|
sysNewsTriggers.setNewsOnOff(sysNewsTriggers.getNewsOnOff());
|
||||||
|
sysNewsTriggers.setCreateBy(String.valueOf(sysUser.getUserId()));
|
||||||
return toAjax(sysNewsTriggersService.insertSysNewsTriggers(sysNewsTriggers));
|
return toAjax(sysNewsTriggersService.insertSysNewsTriggers(sysNewsTriggers));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,17 +118,6 @@ public class SysNewsTriggersController extends BaseController
|
||||||
return prefix + "/edit";
|
return prefix + "/edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改保存消息通知配置
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("system:triggers:edit")
|
|
||||||
@Log(title = "消息通知配置", businessType = BusinessType.UPDATE)
|
|
||||||
@PostMapping("/edit")
|
|
||||||
@ResponseBody
|
|
||||||
public AjaxResult editSave(SysNewsTriggers sysNewsTriggers)
|
|
||||||
{
|
|
||||||
return toAjax(sysNewsTriggersService.updateSysNewsTriggers(sysNewsTriggers));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除消息通知配置
|
* 删除消息通知配置
|
||||||
|
@ -130,4 +130,19 @@ public class SysNewsTriggersController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(sysNewsTriggersService.deleteSysNewsTriggersByIds(ids));
|
return toAjax(sysNewsTriggersService.deleteSysNewsTriggersByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启关闭通知
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:triggers:changeStatus")
|
||||||
|
@Log(title = "开启关闭通知", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/changeStatus")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult changeStatus(SysNewsTriggers sysNewsTriggers)
|
||||||
|
{
|
||||||
|
SysUser sysUser = ShiroUtils.getSysUser();
|
||||||
|
sysNewsTriggers.setUpdateBy(String.valueOf(sysUser.getUserId()));
|
||||||
|
return toAjax(sysNewsTriggersService.updateSysNewsTriggers(sysNewsTriggers));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://rm-bp1j1554xv1qs04295o.mysql.rds.aliyuncs.com:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/snow?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: cloud_root
|
username: root
|
||||||
password: Jin!152377
|
password: root
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
|
@ -6,16 +6,25 @@
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-triggers-add">
|
<form class="form-horizontal m" id="form-triggers-add">
|
||||||
|
<input name="newsNodeId" type="hidden" id="newsNodeId">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label is-required">归属节点:</label>
|
<label class="col-sm-3 control-label is-required">归属节点:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input name="newsNodeId" onclick="selectNodeTree()" id="treeName" type="text" placeholder="请选择归属节点" class="form-control" required>
|
<input name="treeName" onclick="selectNodeTree()" id="treeName" type="text" placeholder="请选择归属节点" class="form-control" required>
|
||||||
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">消息类型:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('sys_news_type')}">
|
||||||
|
<input type="radio" th:id="${dict.dictCode}" name="newsType" th:value="${dict.dictValue}" th:checked="${dict.default}">
|
||||||
|
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">消息开关:</label>
|
<label class="col-sm-3 control-label">消息开关:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
@ -55,6 +64,7 @@
|
||||||
function doSubmit(index, layero){
|
function doSubmit(index, layero){
|
||||||
var body = layer.getChildFrame('body', index);
|
var body = layer.getChildFrame('body', index);
|
||||||
$("#treeId").val(body.find('#treeId').val());
|
$("#treeId").val(body.find('#treeId').val());
|
||||||
|
$("#newsNodeId").val(body.find('#treeId').val());
|
||||||
$("#treeName").val(body.find('#treeName').val());
|
$("#treeName").val(body.find('#treeName').val());
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,17 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 search-collapse">
|
<div class="col-sm-12 search-collapse">
|
||||||
<form id="user-form">
|
<form id="user-form">
|
||||||
<input type="hidden" id="deptId" name="deptId">
|
<input type="hidden" id="newsNodeId" name="newsNodeId">
|
||||||
<input type="hidden" id="parentId" name="parentId">
|
<input type="hidden" id="parentId" name="parentId">
|
||||||
<div class="select-list">
|
<div class="select-list">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label>节点key:</label>
|
<label>节点key:</label>
|
||||||
<input type="text" name="newsNodeId"/>
|
<input type="text" name="newsNodeKey"/>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
消息类型:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
消息类型:<select name="newsType" th:with="type=${@dict.getType('sys_news_type')}">
|
||||||
<option value="">所有</option>
|
<option value="">所有</option>
|
||||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -56,19 +56,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group-sm" id="toolbar" role="group">
|
<div class="btn-group-sm" id="toolbar" role="group">
|
||||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:user:add">
|
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:triggers:add">
|
||||||
<i class="fa fa-plus"></i> 新增
|
<i class="fa fa-plus"></i> 新增
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:user:edit">
|
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:triggers:remove">
|
||||||
<i class="fa fa-edit"></i> 修改
|
|
||||||
</a>
|
|
||||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:user:remove">
|
|
||||||
<i class="fa fa-remove"></i> 删除
|
<i class="fa fa-remove"></i> 删除
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:user:import">
|
<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:triggers:import">
|
||||||
<i class="fa fa-upload"></i> 导入
|
<i class="fa fa-upload"></i> 导入
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export">
|
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:triggers:export">
|
||||||
<i class="fa fa-download"></i> 导出
|
<i class="fa fa-download"></i> 导出
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,6 +83,7 @@
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var editFlag = [[${@permission.hasPermi('system:triggers:edit')}]];
|
var editFlag = [[${@permission.hasPermi('system:triggers:edit')}]];
|
||||||
var removeFlag = [[${@permission.hasPermi('system:triggers:remove')}]];
|
var removeFlag = [[${@permission.hasPermi('system:triggers:remove')}]];
|
||||||
|
var sysNewsType = [[${@dict.getType('sys_news_type')}]];
|
||||||
var prefix = ctx + "system/triggers";
|
var prefix = ctx + "system/triggers";
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
@ -114,17 +112,24 @@
|
||||||
title: 'null',
|
title: 'null',
|
||||||
visible: false
|
visible: false
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'newsNodeId',
|
field: 'sysNewsNode.newsNodeName',
|
||||||
title: '流程消息节点key'
|
align: 'center',
|
||||||
|
title: '消息节点'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'sysNewsNode.newsNodeKey',
|
||||||
|
align: 'center',
|
||||||
|
title: '节点key'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'newsType',
|
field: 'newsType',
|
||||||
title: '消息类型'
|
title: '消息类型',
|
||||||
},
|
align: 'center',
|
||||||
{
|
formatter: function(value, row, index) {
|
||||||
field: 'newsOnOff',
|
return $.table.selectDictLabel(sysNewsType, value);
|
||||||
title: '消息开关'
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visible: editFlag == 'hidden' ? false : true,
|
visible: editFlag == 'hidden' ? false : true,
|
||||||
|
@ -134,16 +139,11 @@
|
||||||
return statusTools(row);
|
return statusTools(row);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
field: 'userId',
|
|
||||||
title: '用户id'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
|
||||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||||
return actions.join('');
|
return actions.join('');
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,8 @@
|
||||||
$.tree.init(options);
|
$.tree.init(options);
|
||||||
|
|
||||||
function zOnClick(event, treeId, treeNode) {
|
function zOnClick(event, treeId, treeNode) {
|
||||||
$("#deptId").val(treeNode.id);
|
//$.tree.notAllowParents();
|
||||||
|
$("#newsNodeId").val(treeNode.id);
|
||||||
$("#parentId").val(treeNode.pId);
|
$("#parentId").val(treeNode.pId);
|
||||||
$.table.search();
|
$.table.search();
|
||||||
}
|
}
|
||||||
|
@ -190,58 +191,32 @@
|
||||||
|
|
||||||
function newsNode() {
|
function newsNode() {
|
||||||
var url = ctx + "system/node";
|
var url = ctx + "system/node";
|
||||||
$.modal.openTab("部门管理", url);
|
$.modal.openTab("消息节点管理", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 用户管理-重置密码 */
|
|
||||||
function resetPwd(userId) {
|
|
||||||
var url = prefix + '/resetPwd/' + userId;
|
|
||||||
$.modal.open("重置密码", url, '800', '300');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 用户管理-分配角色 */
|
|
||||||
function authRole(userId) {
|
|
||||||
var url = prefix + '/authRole/' + userId;
|
|
||||||
$.modal.openTab("用户分配角色", url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 用户状态显示 */
|
/* 用户状态显示 */
|
||||||
function statusTools(row) {
|
function statusTools(row) {
|
||||||
if (row.status == 1) {
|
if (row.newsOnOff == 1) {
|
||||||
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
|
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
|
||||||
} else {
|
} else {
|
||||||
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
|
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 用户管理-停用 */
|
/* 用户管理-停用 */
|
||||||
function disable(userId) {
|
function disable(userId) {
|
||||||
$.modal.confirm("确认要停用用户吗?", function() {
|
$.modal.confirm("确认要关闭消息通知吗?", function() {
|
||||||
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 1 });
|
$.operate.post(prefix + "/changeStatus", { "id": userId, "newsOnOff": 1 });
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 用户管理启用 */
|
/* 用户管理启用 */
|
||||||
function enable(userId) {
|
function enable(userId) {
|
||||||
$.modal.confirm("确认要启用用户吗?", function() {
|
$.modal.confirm("确认要启用消息通知吗?", function() {
|
||||||
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 0 });
|
$.operate.post(prefix + "/changeStatus", { "id": userId, "newsOnOff": 0 });
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<!-- 导入区域 -->
|
|
||||||
<script id="importTpl" type="text/template">
|
|
||||||
<form enctype="multipart/form-data" class="mt20 mb10">
|
|
||||||
<div class="col-xs-offset-1">
|
|
||||||
<input type="file" id="file" name="file"/>
|
|
||||||
<div class="mt10 pt5">
|
|
||||||
<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
|
|
||||||
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
|
|
||||||
</div>
|
|
||||||
<font color="red" class="pull-left mt10">
|
|
||||||
提示:仅允许导入“xls”或“xlsx”格式文件!
|
|
||||||
</font>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</script>
|
|
||||||
</html>
|
</html>
|
|
@ -125,4 +125,15 @@ public class Constants
|
||||||
* 钉钉回调失败返回
|
* 钉钉回调失败返回
|
||||||
*/
|
*/
|
||||||
public static final String CALL_BACK_FAIL_RETURN="fail";
|
public static final String CALL_BACK_FAIL_RETURN="fail";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dingding消息类型
|
||||||
|
*/
|
||||||
|
public static final Integer NEWS_DINGDING_TYPE=1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件消息类型
|
||||||
|
*/
|
||||||
|
public static final Integer NEWS_EMAIL_TYPE=2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.snow.framework.web.service;
|
||||||
|
|
||||||
|
import com.snow.common.constant.Constants;
|
||||||
|
import com.snow.framework.util.ShiroUtils;
|
||||||
|
import com.snow.system.domain.SysNewsNode;
|
||||||
|
import com.snow.system.domain.SysNewsTriggers;
|
||||||
|
import com.snow.system.domain.SysUser;
|
||||||
|
import com.snow.system.service.impl.SysNewsNodeServiceImpl;
|
||||||
|
import com.snow.system.service.impl.SysNewsTriggersServiceImpl;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author qimingjin
|
||||||
|
* @Title:
|
||||||
|
* @Description:
|
||||||
|
* @date 2021/3/3 17:03
|
||||||
|
*/
|
||||||
|
@Service("newsTrigger")
|
||||||
|
public class NewsTriggerService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysNewsNodeServiceImpl sysNewsNodeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysNewsTriggersServiceImpl sysNewsTriggersService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Email消息通知开关
|
||||||
|
* @param nodeKey
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean getEmailOnOff(String nodeKey)
|
||||||
|
{
|
||||||
|
return getNewsOnOff(nodeKey,Constants.NEWS_EMAIL_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取钉钉开关
|
||||||
|
* @param nodeKey
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean getDingTalkOnOff(String nodeKey)
|
||||||
|
{
|
||||||
|
return getNewsOnOff(nodeKey,Constants.NEWS_DINGDING_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean getNewsOnOff(String nodeKey,Integer newsType){
|
||||||
|
SysNewsNode sysNewsNode = sysNewsNodeService.selectSysNewsNodeByKey(nodeKey);
|
||||||
|
if(null == sysNewsNode){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SysNewsTriggers sysNewsTriggers=new SysNewsTriggers();
|
||||||
|
sysNewsTriggers.setNewsNodeId(sysNewsNode.getId());
|
||||||
|
sysNewsTriggers.setNewsType(newsType);
|
||||||
|
SysUser sysUser = ShiroUtils.getSysUser();
|
||||||
|
sysNewsTriggers.setUserId(String.valueOf(sysUser.getUserId()));
|
||||||
|
List<SysNewsTriggers> sysNewsTriggersList = sysNewsTriggersService.selectSysNewsTriggersList(sysNewsTriggers);
|
||||||
|
if(CollectionUtils.isNotEmpty(sysNewsTriggersList)){
|
||||||
|
Integer newsOnOff = sysNewsTriggersList.get(0).getNewsOnOff();
|
||||||
|
return newsOnOff==1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import com.snow.common.annotation.Excel;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.snow.common.core.domain.BaseEntity;
|
import com.snow.common.core.domain.BaseEntity;
|
||||||
import com.snow.common.core.domain.TreeEntity;
|
import com.snow.common.core.domain.TreeEntity;
|
||||||
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
* @author qimingjin
|
* @author qimingjin
|
||||||
* @date 2021-03-02
|
* @date 2021-03-02
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class SysNewsNode extends TreeEntity
|
public class SysNewsNode extends TreeEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -32,57 +34,4 @@ public class SysNewsNode extends TreeEntity
|
||||||
@Excel(name = "是否删除", readConverterExp = "0=--否,1--是")
|
@Excel(name = "是否删除", readConverterExp = "0=--否,1--是")
|
||||||
private Long isDelete;
|
private Long isDelete;
|
||||||
|
|
||||||
public void setId(Integer id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setNewsNodeName(String newsNodeName)
|
|
||||||
{
|
|
||||||
this.newsNodeName = newsNodeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNewsNodeName()
|
|
||||||
{
|
|
||||||
return newsNodeName;
|
|
||||||
}
|
|
||||||
public void setNewsNodeKey(String newsNodeKey)
|
|
||||||
{
|
|
||||||
this.newsNodeKey = newsNodeKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNewsNodeKey()
|
|
||||||
{
|
|
||||||
return newsNodeKey;
|
|
||||||
}
|
|
||||||
public void setIsDelete(Long isDelete)
|
|
||||||
{
|
|
||||||
this.isDelete = isDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getIsDelete()
|
|
||||||
{
|
|
||||||
return isDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("newsNodeName", getNewsNodeName())
|
|
||||||
.append("newsNodeKey", getNewsNodeKey())
|
|
||||||
.append("parentId", getParentId())
|
|
||||||
.append("ancestors", getAncestors())
|
|
||||||
.append("orderNum", getOrderNum())
|
|
||||||
.append("isDelete", getIsDelete())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.snow.system.domain;
|
||||||
import com.snow.common.annotation.Excel;
|
import com.snow.common.annotation.Excel;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.snow.common.core.domain.BaseEntity;
|
import com.snow.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
* @author qimingjin
|
* @author qimingjin
|
||||||
* @date 2021-03-02
|
* @date 2021-03-02
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class SysNewsTriggers extends BaseEntity
|
public class SysNewsTriggers extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -21,15 +23,15 @@ public class SysNewsTriggers extends BaseEntity
|
||||||
|
|
||||||
/** 流程消息节点key */
|
/** 流程消息节点key */
|
||||||
@Excel(name = "流程消息节点key")
|
@Excel(name = "流程消息节点key")
|
||||||
private Long newsNodeId;
|
private Integer newsNodeId;
|
||||||
|
|
||||||
/** 消息类型(1-钉钉,2-邮件,3-短信,4-站内消息) */
|
/** 消息类型(1-钉钉,2-邮件,3-短信,4-站内消息) */
|
||||||
@Excel(name = "消息类型", readConverterExp = "1=-钉钉,2-邮件,3-短信,4-站内消息")
|
@Excel(name = "消息类型", readConverterExp = "1=-钉钉,2-邮件,3-短信,4-站内消息")
|
||||||
private Long newsType;
|
private Integer newsType;
|
||||||
|
|
||||||
/** 消息开关(0--关,1--开) */
|
/** 消息开关(0--关,1--开) */
|
||||||
@Excel(name = "消息开关", readConverterExp = "0=--关,1--开")
|
@Excel(name = "消息开关", readConverterExp = "0=--关,1--开")
|
||||||
private Long newsOnOff;
|
private Integer newsOnOff;
|
||||||
|
|
||||||
/** 用户id */
|
/** 用户id */
|
||||||
@Excel(name = "用户id")
|
@Excel(name = "用户id")
|
||||||
|
@ -39,74 +41,8 @@ public class SysNewsTriggers extends BaseEntity
|
||||||
@Excel(name = "是否删除", readConverterExp = "0=--否,1--是")
|
@Excel(name = "是否删除", readConverterExp = "0=--否,1--是")
|
||||||
private Long isDelete;
|
private Long isDelete;
|
||||||
|
|
||||||
public void setId(Integer id)
|
/**
|
||||||
{
|
* 节点信息
|
||||||
this.id = id;
|
*/
|
||||||
}
|
private SysNewsNode sysNewsNode;
|
||||||
|
|
||||||
public Integer getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setNewsNodeId(Long newsNodeId)
|
|
||||||
{
|
|
||||||
this.newsNodeId = newsNodeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getNewsNodeId()
|
|
||||||
{
|
|
||||||
return newsNodeId;
|
|
||||||
}
|
|
||||||
public void setNewsType(Long newsType)
|
|
||||||
{
|
|
||||||
this.newsType = newsType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getNewsType()
|
|
||||||
{
|
|
||||||
return newsType;
|
|
||||||
}
|
|
||||||
public void setNewsOnOff(Long newsOnOff)
|
|
||||||
{
|
|
||||||
this.newsOnOff = newsOnOff;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getNewsOnOff()
|
|
||||||
{
|
|
||||||
return newsOnOff;
|
|
||||||
}
|
|
||||||
public void setUserId(String userId)
|
|
||||||
{
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserId()
|
|
||||||
{
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
public void setIsDelete(Long isDelete)
|
|
||||||
{
|
|
||||||
this.isDelete = isDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getIsDelete()
|
|
||||||
{
|
|
||||||
return isDelete;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("newsNodeId", getNewsNodeId())
|
|
||||||
.append("newsType", getNewsType())
|
|
||||||
.append("newsOnOff", getNewsOnOff())
|
|
||||||
.append("userId", getUserId())
|
|
||||||
.append("isDelete", getIsDelete())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,13 @@ public interface SysNewsNodeMapper
|
||||||
*/
|
*/
|
||||||
public SysNewsNode selectSysNewsNodeById(Integer id);
|
public SysNewsNode selectSysNewsNodeById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询消息配置节点
|
||||||
|
* @param newsNodeKey 配置节点key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SysNewsNode selectSysNewsNodeByKey(String newsNodeKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询消息配置节点列表
|
* 查询消息配置节点列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,6 +20,13 @@ public interface ISysNewsNodeService
|
||||||
*/
|
*/
|
||||||
public SysNewsNode selectSysNewsNodeById(Integer id);
|
public SysNewsNode selectSysNewsNodeById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询消息配置节点
|
||||||
|
* @param newsNodeKey 配置节点key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SysNewsNode selectSysNewsNodeByKey(String newsNodeKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询消息配置节点列表
|
* 查询消息配置节点列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -35,6 +35,11 @@ public class SysNewsNodeServiceImpl implements ISysNewsNodeService
|
||||||
return sysNewsNodeMapper.selectSysNewsNodeById(id);
|
return sysNewsNodeMapper.selectSysNewsNodeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysNewsNode selectSysNewsNodeByKey(String newsNodeKey) {
|
||||||
|
return sysNewsNodeMapper.selectSysNewsNodeByKey(newsNodeKey);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询消息配置节点列表
|
* 查询消息配置节点列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.snow.system.service.impl;
|
package com.snow.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.snow.common.utils.DateUtils;
|
import com.snow.common.utils.DateUtils;
|
||||||
|
import com.snow.common.utils.StringUtils;
|
||||||
|
import com.snow.system.domain.SysNewsNode;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.snow.system.mapper.SysNewsTriggersMapper;
|
import com.snow.system.mapper.SysNewsTriggersMapper;
|
||||||
|
@ -21,6 +24,9 @@ public class SysNewsTriggersServiceImpl implements ISysNewsTriggersService
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNewsTriggersMapper sysNewsTriggersMapper;
|
private SysNewsTriggersMapper sysNewsTriggersMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysNewsNodeServiceImpl sysNewsNodeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询消息通知配置
|
* 查询消息通知配置
|
||||||
*
|
*
|
||||||
|
@ -42,7 +48,16 @@ public class SysNewsTriggersServiceImpl implements ISysNewsTriggersService
|
||||||
@Override
|
@Override
|
||||||
public List<SysNewsTriggers> selectSysNewsTriggersList(SysNewsTriggers sysNewsTriggers)
|
public List<SysNewsTriggers> selectSysNewsTriggersList(SysNewsTriggers sysNewsTriggers)
|
||||||
{
|
{
|
||||||
return sysNewsTriggersMapper.selectSysNewsTriggersList(sysNewsTriggers);
|
List<SysNewsTriggers> sysNewsTriggersList=new ArrayList<>();
|
||||||
|
if(StringUtils.isNotNull(sysNewsTriggers.getNewsNodeId())){
|
||||||
|
SysNewsNode sysNewsNode = sysNewsNodeService.selectSysNewsNodeById(sysNewsTriggers.getNewsNodeId().intValue());
|
||||||
|
sysNewsTriggersList = sysNewsTriggersMapper.selectSysNewsTriggersList(sysNewsTriggers);
|
||||||
|
sysNewsTriggersList.parallelStream().forEach(t->{
|
||||||
|
t.setSysNewsNode(sysNewsNode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return sysNewsTriggersList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,6 +43,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where t.id = #{id}
|
where t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysNewsNodeByKey" parameterType="String" resultMap="SysNewsNodeResult">
|
||||||
|
<include refid="selectSysNewsNodeVo"/>
|
||||||
|
where news_node_key = #{newsNodeKey} and is_delete=0
|
||||||
|
</select>
|
||||||
<insert id="insertSysNewsNode" parameterType="SysNewsNode" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertSysNewsNode" parameterType="SysNewsNode" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into sys_news_node
|
insert into sys_news_node
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
Loading…
Reference in New Issue