Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-dj-taskcenter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0b4d1e7f
authored
May 22, 2026
by
叶立庆
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加字段校验
1 parent
74c131c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
3 deletions
rpc-dj-taskcenter-api/src/main/java/cn/com/glsx/dj/taskcenter/dto/taskcenter/request/CreateTaskRequest.java
rpc-dj-taskcenter/src/main/java/cn/com/glsx/dj/taskcenter/service/taskcenter/TaskCenterService.java
rpc-dj-taskcenter-api/src/main/java/cn/com/glsx/dj/taskcenter/dto/taskcenter/request/CreateTaskRequest.java
View file @
0b4d1e7
...
...
@@ -20,6 +20,7 @@ import java.util.List;
@Data
public
class
CreateTaskRequest
implements
Serializable
{
@ApiModelProperty
(
notes
=
"序列化版本号"
,
hidden
=
true
)
private
static
final
long
serialVersionUID
=
1L
;
/** 任务信息。 */
...
...
rpc-dj-taskcenter/src/main/java/cn/com/glsx/dj/taskcenter/service/taskcenter/TaskCenterService.java
View file @
0b4d1e7
...
...
@@ -150,11 +150,9 @@ public class TaskCenterService {
if
(
StringUtils
.
isBlank
(
taskDTO
.
getBizType
()))
{
throw
new
RpcServiceException
(
DefaultErrorEnum
.
PARAMETER_NULL
,
"bizType不能为空"
);
}
if
(
StringUtils
.
isBlank
(
taskDTO
.
getTitle
()))
{
throw
new
RpcServiceException
(
DefaultErrorEnum
.
PARAMETER_NULL
,
"title不能为空"
);
}
TaskBizCategory
bizCategory
=
getBizCategoryOrThrow
(
taskDTO
.
getBizType
());
validateTaskInfo
(
taskDTO
,
request
.
getAssignees
(),
true
);
validateBizDisplayInfo
(
taskDTO
.
getBizDisplayInfo
());
String
taskStatus
=
StringUtils
.
defaultIfBlank
(
taskDTO
.
getStatus
(),
TaskCenterConstants
.
TASK_STATUS_UNFINISHED
);
...
...
@@ -295,6 +293,7 @@ public class TaskCenterService {
Task
task
=
getTaskByIdOrBizKey
(
updateDTO
.
getTaskId
(),
updateDTO
.
getBizType
(),
updateDTO
.
getBizInstanceId
());
validateTaskExists
(
task
);
validateTaskInfo
(
updateDTO
,
request
.
getAssignees
(),
false
);
validateBizDisplayInfo
(
updateDTO
.
getBizDisplayInfo
());
Date
now
=
new
Date
();
...
...
@@ -578,6 +577,34 @@ public class TaskCenterService {
}
}
private
void
validateTaskInfo
(
TaskDTO
taskDTO
,
List
<
TaskAssigneeInputDTO
>
assignees
,
boolean
isCreate
)
{
if
(
isCreate
)
{
if
(
StringUtils
.
isBlank
(
taskDTO
.
getTitle
()))
{
throw
new
RpcServiceException
(
DefaultErrorEnum
.
PARAMETER_NULL
,
"任务标题不能为空"
);
}
}
if
(
StringUtils
.
isNotBlank
(
taskDTO
.
getTitle
())
&&
taskDTO
.
getTitle
().
length
()
>
100
)
{
throw
new
RpcServiceException
(
DefaultErrorEnum
.
PARAMETER_NULL
,
"任务标题长度不能超过100"
);
}
if
(
StringUtils
.
isNotBlank
(
taskDTO
.
getDescription
())
&&
taskDTO
.
getDescription
().
length
()
>
4096
)
{
throw
new
RpcServiceException
(
DefaultErrorEnum
.
PARAMETER_NULL
,
"任务描述长度不能超过4096"
);
}
if
(
CollectionUtils
.
isNotEmpty
(
assignees
))
{
if
(
assignees
.
size
()
>
100
)
{
throw
new
RpcServiceException
(
DefaultErrorEnum
.
PARAMETER_NULL
,
"执行人不能超过100个"
);
}
for
(
int
i
=
0
;
i
<
assignees
.
size
();
i
++)
{
TaskAssigneeInputDTO
assignee
=
assignees
.
get
(
i
);
if
(
StringUtils
.
isBlank
(
assignee
.
getAssigneeId
()))
{
throw
new
RpcServiceException
(
DefaultErrorEnum
.
PARAMETER_NULL
,
String
.
format
(
"第%d个执行人ID不能为空"
,
i
+
1
));
}
}
}
}
private
Task
getTaskByIdOrBizKey
(
Long
taskId
,
String
bizType
,
String
bizInstanceId
)
{
if
(
taskId
!=
null
)
{
return
taskMapper
.
selectByPrimaryKey
(
taskId
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment