优化代码

This commit is contained in:
jinqiming 2021-10-15 14:55:17 +08:00
parent 9e80e482ec
commit 1ea4d5d197
11 changed files with 185 additions and 57 deletions

View File

@ -317,4 +317,13 @@ public class SysUserController extends BaseController
SysUser sysUser = userService.selectUserById(id);
return AjaxResult.success(sysUser);
}
/**
* 多选用户
* @return
*/
@GetMapping("/selectMultiUser")
public String selectMultiUser() {
return prefix + "/selectMultiUser";
}
}

View File

@ -151,7 +151,7 @@ is:
notice: true
#是否开启同步钉钉
sync:
dingtalk: true
dingtalk: false
flowable:
#关闭定时任务JOB

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('分配角色选择用户')" />
<th:block th:include="include :: header('选择用户')" />
</head>
<body class="gray-bg">

View File

@ -31,24 +31,33 @@
<label class="col-sm-3 control-label">执行人:</label>
<div class="col-sm-8">
<div class="input-group">
<input class="form-control" type="hidden" name="acceptUser" id="transitionPerson" required>
<input class="form-control" type="hidden" name="taskDistributeId" id="taskDistributeId" required>
<input class="form-control" type="text" name="transitionPersonName" onclick="selectUserInfo()" id="transitionPersonName" readonly="true">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">期望完成时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="expectedTime" class="form-control" placeholder="yyyy-MM-dd mm:hh:ss" type="text" required>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">任务来源:</label>
<div class="col-sm-8">
<input name="taskSource" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<!-- <div class="form-group">
<label class="col-sm-3 control-label">任务跳转URL</label>
<div class="col-sm-8">
<input name="taskUrl" class="form-control" type="text">
</div>
</div>
</div>-->
</form>
</div>
<th:block th:include="include :: footer" />
@ -65,7 +74,7 @@
}
function selectUserInfo() {
var url = "/system/resign/selectUser";
var url = "/system/user/selectMultiUser";
$.modal.open("选择用户",url,"","",doSubmit);
}
@ -73,7 +82,7 @@
var body = layer.getChildFrame('body', index);
var iframeWin = layero.find('iframe')[0];
iframeWin.contentWindow.submitHandler(index, layero);
$("#transitionPerson").val(body.find('#id').val());
$("#taskDistributeId").val(body.find('#id').val());
$("#transitionPersonName").val(body.find('#userName').val());
layer.close(index);
}

View File

@ -14,10 +14,6 @@
<label>任务名称:</label>
<input type="text" name="taskName"/>
</li>
<li>
<label>任务内容:</label>
<input type="text" name="taskContent"/>
</li>
<li>
<label>任务状态:</label>
<select name="taskStatus" th:with="type=${@dict.getType('ding_task_status')}">
@ -36,22 +32,6 @@
<label>任务来源:</label>
<input type="text" name="taskSource"/>
</li>
<li>
<label>任务外部id</label>
<input type="text" name="taskOutsideId"/>
</li>
<li>
<label>任务跳转URL</label>
<input type="text" name="taskUrl"/>
</li>
<li>
<label>乐观锁:</label>
<input type="text" name="revision"/>
</li>
<li>
<label>删除标识:</label>
<input type="text" name="isDelete"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@ -102,7 +82,7 @@
{
field: 'taskNo',
title: '任务编号',
visible: false
visible: true
},
{
field: 'taskName',
@ -110,7 +90,10 @@
},
{
field: 'taskContent',
title: '任务内容'
title: '任务内容',
formatter: function(value, row, index) {
return row.taskContent.substring(0,20)+"...";
}
},
{
field: 'taskStatus',
@ -130,22 +113,6 @@
field: 'taskSource',
title: '任务来源'
},
{
field: 'taskOutsideId',
title: '任务外部id'
},
{
field: 'taskUrl',
title: '任务跳转URL'
},
{
field: 'revision',
title: '乐观锁'
},
{
field: 'isDelete',
title: '删除标识'
},
{
title: '操作',
align: 'center',

View File

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('多选用户')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-11 search-collapse">
<form id="role-form">
<div class="select-list">
<ul>
<li>
用户名称:<input type="text" name="userName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<form class="form-horizontal m" id="form-resign-add">
<div class="col-sm-12 select-table table-striped">
<input id="id" name="id" type="hidden" />
<input id="userName" name="userName" type="hidden" />
<input id="dingUserId" name="dingUserId" type="hidden" />
<input id="email" name="email" type="hidden" />
<table id="bootstrap-table"></table>
</div>
</form>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
$(function() {
var options = {
url: "/system/user/list",
queryParams: queryParams,
sortName: "createTime",
sortOrder: "desc",
modalName: "用户",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
clickToSelect: true,
singleSelect:false,
rememberSelected: true,
columns: [{
field: 'state',
checkbox: true
},
{
field: 'userId',
title: '用户ID',
visible: false
},
{
field: 'userName',
title: '用户名称'
},
{
field: 'email',
title: '邮箱'
},
{
field: 'dingUserId',
title: '钉钉ID',
visible: false
}]
};
$.table.init(options);
});
function queryParams(params) {
var search = $.table.queryParams(params);
return search;
}
/* 添加用户-选择用户-提交 */
function submitHandler() {
var rows = $.table.selectFirstColumns();
var id=$.table.selectNColumns(1);
var userName=$.table.selectNColumns(2);
var email=$.table.selectNColumns(3);
var dingUserId=$.table.selectNColumns(4);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$("#id").val(id);
$("#userName").val(userName);
$("#email").val(email);
$("#dingUserId").val(dingUserId);
}
</script>
</body>
</html>

View File

@ -13,7 +13,12 @@ public enum DingFlowTaskType {
PAUSED("PAUSED", "暂停"),
CANCELED("CANCELED", "取消"),
COMPLETED("COMPLETED", "完成"),
TERMINATED("TERMINATED", "终止");
TERMINATED("TERMINATED", "终止"),
//20211015
PROCESSING("","处理中")
;
private final String code;
private final String info;
@ -35,18 +40,18 @@ public enum DingFlowTaskType {
}
public static DingFlowTaskType getType(String info) {
for (DingFlowTaskType dingFLowOperationType:DingFlowTaskType.values()){
if(dingFLowOperationType.getInfo().equals(info)){
return dingFLowOperationType;
for (DingFlowTaskType dingFlowTaskType:DingFlowTaskType.values()){
if(dingFlowTaskType.getInfo().equals(info)){
return dingFlowTaskType;
}
}
return null;
}
public static DingFlowTaskType getCode(String code) {
for (DingFlowTaskType dingFLowOperationType:DingFlowTaskType.values()){
if(dingFLowOperationType.getCode().equals(code)){
return dingFLowOperationType;
for (DingFlowTaskType dingFlowTaskType:DingFlowTaskType.values()){
if(dingFlowTaskType.getCode().equals(code)){
return dingFlowTaskType;
}
}
return null;

View File

@ -30,6 +30,12 @@ public class SysOaTask extends BaseEntity
@Excel(name = "任务内容")
private String taskContent;
@Excel(name = "紧急程度")
private Integer priority;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date expectedTime;
/** 任务状态(详见数据字典) */
@Excel(name = "任务状态", readConverterExp = "详=见数据字典")
private String taskStatus;

View File

@ -80,7 +80,7 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService
String newSequenceNo = sequenceService.getNewSequenceNo(SequenceConstants.OA_TASK_SEQUENCE);
sysOaTask.setTaskNo(newSequenceNo);
List<String> taskDistributeIdList= sysOaTask.getTaskDistributeId();
if(CollUtil.isNotEmpty(taskDistributeIdList)){
if(CollUtil.isEmpty(taskDistributeIdList)){
//待完成
sysOaTask.setTaskStatus(DingFlowTaskType.NEW.getCode());
}else {

View File

@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="taskContent" column="task_content" />
<result property="taskStatus" column="task_status" />
<result property="taskType" column="task_type" />
<result property="expectedTime" column="expected_time" />
<result property="priority" column="priority" />
<result property="taskSource" column="task_source" />
<result property="taskOutsideId" column="task_outside_id" />
<result property="taskUrl" column="task_url" />
@ -22,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSysOaTaskVo">
select task_no, task_name, task_content, task_status, task_type, task_source, task_outside_id, task_url, revision, create_by, is_delete, create_time, update_by, update_time from sys_oa_task
select task_no, task_name, expected_time,priority,task_content, task_status, task_type, task_source, task_outside_id, task_url, revision, create_by, is_delete, create_time, update_by, update_time from sys_oa_task
</sql>
<select id="selectSysOaTaskList" parameterType="SysOaTask" resultMap="SysOaTaskResult">
@ -34,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskType != null and taskType != ''"> and task_type = #{taskType}</if>
<if test="taskSource != null and taskSource != ''"> and task_source = #{taskSource}</if>
<if test="taskOutsideId != null and taskOutsideId != ''"> and task_outside_id = #{taskOutsideId}</if>
<if test="taskUrl != null and taskUrl != ''"> and task_url = #{taskUrl}</if>
<if test="priority != null "> and priority = #{priority}</if>
<if test="revision != null "> and revision = #{revision}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
</where>
@ -53,6 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskContent != null">task_content,</if>
<if test="taskStatus != null">task_status,</if>
<if test="taskType != null">task_type,</if>
<if test="priority != null">priority,</if>
<if test="expectedTime != null">expected_time,</if>
<if test="taskSource != null">task_source,</if>
<if test="taskOutsideId != null">task_outside_id,</if>
<if test="taskUrl != null">task_url,</if>
@ -69,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskContent != null">#{taskContent},</if>
<if test="taskStatus != null">#{taskStatus},</if>
<if test="taskType != null">#{taskType},</if>
<if test="priority != null">#{priority},</if>
<if test="expectedTime != null">#{expectedTime},</if>
<if test="taskSource != null">#{taskSource},</if>
<if test="taskOutsideId != null">#{taskOutsideId},</if>
<if test="taskUrl != null">#{taskUrl},</if>
@ -88,6 +94,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskContent != null">task_content = #{taskContent},</if>
<if test="taskStatus != null">task_status = #{taskStatus},</if>
<if test="taskType != null">task_type = #{taskType},</if>
<if test="priority != null">priority=#{priority},</if>
<if test="expectedTime != null">expected_time=#{expectedTime},</if>
<if test="taskSource != null">task_source = #{taskSource},</if>
<if test="taskOutsideId != null">task_outside_id = #{taskOutsideId},</if>
<if test="taskUrl != null">task_url = #{taskUrl},</if>

View File

@ -32,6 +32,25 @@ INSERT INTO `sys_menu`(`menu_name`, `parent_id`, `order_num`, `url`, `target`, `
#2021-07-29
CREATE TABLE `sys_oa_task` (
`task_no` varchar(64) NOT NULL COMMENT '任务编号',
`task_name` varchar(128) NOT NULL COMMENT '任务名称',
`task_content` text COMMENT '任务内容',
`priority` int(11) NOT NULL DEFAULT '20' COMMENT '紧急程度(详见数据字典)',
`expected_time` datetime DEFAULT NULL COMMENT '预期完成时间',
`task_status` varchar(32) DEFAULT NULL COMMENT '任务状态(详见数据字典)',
`task_type` varchar(32) DEFAULT NULL COMMENT '任务类型(详见数据字典)',
`task_source` varchar(128) DEFAULT NULL COMMENT '任务来源',
`task_outside_id` varchar(64) DEFAULT NULL COMMENT '任务外部id',
`task_url` varchar(128) DEFAULT NULL COMMENT '任务跳转URL',
`revision` int(11) NOT NULL DEFAULT '1' COMMENT '乐观锁',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
`is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`task_no`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='系统任务表';
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('系统任务', '2145', '1', '/system/task', 'C', '0', 'system:task:view', '#', 'admin', now(), 'ry', now(), '系统任务菜单');
@ -55,5 +74,8 @@ values('系统任务删除', @parentId, '4', '#', 'F', '0', 'system:task:remov
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('系统任务导出', @parentId, '5', '#', 'F', '0', 'system:task:export', '#', 'admin', now(), 'ry', now(), '');
INSERT INTO `snow-dev`.`sys_dict_type`(`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('任务类型', 'sys_task_type', '0', 'admin', NOW(), '', NULL, '任务类型');
INSERT INTO `sys_dict_data`( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '系统任务', '1', 'sys_task_type', NULL, 'primary', 'Y', '0', 'admin', NOW(), '', NULL, '待办任务');
INSERT INTO `sys_dict_type`(`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('任务类型', 'sys_task_type', '0', 'admin', NOW(), '', NULL, '任务类型');
INSERT INTO `sys_dict_data`( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '系统任务', '1', 'sys_task_type', NULL, 'primary', 'Y', '0', 'admin', NOW(), '', NULL, '待办任务');
--20211015
INSERT INTO `sys_sequence`(`name`, `current_value`, `increment`, `described`) VALUES ('OA_RW', 1, 1, '系统任务单号');