Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
向汉
/
uc-engine
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
38088726
...
38088726521fa4be3a8877b97bcc450439e833cb
authored
2022-08-09 13:28:49 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.删除任务缓存
1 parent
8292c0b7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
30 deletions
member-service-impl/src/main/java/com/topdraw/business/process/rest/TaskOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/TaskOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/TaskOperationController.java
View file @
3808872
...
...
@@ -65,22 +65,22 @@ public class TaskOperationController {
/**
* 修改任务
*
* @param
task
消息
* @param
content
消息
*/
@PostMapping
(
value
=
"/updateTask"
)
@ApiOperation
(
"修改任务"
)
@AnonymousAccess
public
void
updateTask
(
@RequestBody
@Validated
Task
task
)
{
log
.
info
(
"taskOperation ==>> updateTask ==>> param ==>> {}"
,
task
);
Long
id
=
task
.
getId
();
public
void
updateTask
(
@RequestBody
@Validated
Task
content
)
{
log
.
info
(
"taskOperation ==>> updateTask ==>> param ==>> {}"
,
content
);
Long
id
=
content
.
getId
();
TaskDTO
taskDTO
=
this
.
taskOperationService
.
findById
(
id
);
if
(
Objects
.
nonNull
(
taskDTO
.
getId
()))
{
task
.
setCode
(
taskDTO
.
getCode
());
Task
task
_
=
new
Task
();
BeanUtils
.
copyProperties
(
taskDTO
,
task
_
);
task
_
.
copy
(
task
);
content
.
setCode
(
taskDTO
.
getCode
());
Task
task
=
new
Task
();
BeanUtils
.
copyProperties
(
taskDTO
,
task
);
task
.
copy
(
content
);
// 修改任务
this
.
taskOperationService
.
updateTask
(
task
_
);
this
.
taskOperationService
.
updateTask
(
task
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/TaskOperationServiceImpl.java
View file @
3808872
...
...
@@ -47,6 +47,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Service
;
...
...
@@ -99,7 +100,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
private
static
final
Integer
POINTS_MIN
=
1
;
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
cacheTaskByEvent
,
key
=
"#task.event"
)
//
@CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEvent, key = "#task.event")
public
TaskDTO
createTask
(
Task
task
)
{
Long
taskTemplateId
=
task
.
getTaskTemplateId
();
TaskTemplateDTO
taskTemplateDTO
=
this
.
taskTemplateService
.
findById
(
taskTemplateId
);
...
...
@@ -107,29 +108,14 @@ public class TaskOperationServiceImpl implements TaskOperationService {
task
.
setTaskTemplateCode
(
taskTemplateDTO
.
getCode
());
Task
task_
=
TaskBuilder
.
build
(
task
);
TaskDTO
taskDTO
=
this
.
taskService
.
create
(
task_
);
if
(
Objects
.
nonNull
(
taskDTO
.
getId
()))
{
task_
.
setId
(
taskDTO
.
getId
());
this
.
createTaskAttr
(
task_
);
}
((
TaskOperationServiceImpl
)
AopContext
.
currentProxy
()).
asyncCreateTask
(
task_
);
return
taskDTO
;
}
/**
*
* @param task 任务
*/
private
void
createTaskAttr
(
Task
task
)
{
TaskAttr
taskAttr
=
new
TaskAttr
();
// taskAttr.setAttrStr(task.getAttr());
taskAttr
.
setTaskId
(
task
.
getId
());
this
.
taskAttrService
.
create
(
taskAttr
);
}
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
cacheTaskByEvent
,
key
=
"#task.event"
)
// @CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEventAndMemberLevelAndVip
, key = "#task.event")
public
TaskDTO
updateTask
(
Task
task
)
{
Long
taskTemplateId
=
task
.
getTaskTemplateId
();
TaskTemplateDTO
taskTemplateDTO
=
this
.
taskTemplateService
.
findById
(
taskTemplateId
);
...
...
@@ -149,18 +135,17 @@ public class TaskOperationServiceImpl implements TaskOperationService {
* @param task 任务
*/
private
void
updateTaskAttr
(
Task
task
)
{
/* List<String> attr = task.getAttr();
TaskAttrDTO
taskAttrDTO
=
this
.
taskAttrService
.
findByTaskId
(
task
.
getId
());
if
(
Objects
.
nonNull
(
taskAttrDTO
.
getId
()))
{
TaskAttr
taskAttr
=
new
TaskAttr
();
BeanUtils
.
copyProperties
(
taskAttrDTO
,
taskAttr
);
taskAttr.setAttrStr();
taskAttr
.
setAttrStr
(
task
.
getAttr
()
);
this
.
taskAttrService
.
update
(
taskAttr
);
}
*/
}
}
@Override
@CacheEvict
(
cacheNames
=
RedisKeyConstants
.
cacheTaskByEvent
,
key
=
"#task.event"
)
//
@CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEvent, key = "#task.event")
public
Integer
deleteTask
(
Task
task
)
{
Long
id
=
task
.
getId
();
TaskDTO
taskDTO
=
this
.
findById
(
id
);
...
...
Please
register
or
sign in
to post a comment