Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-api
Commits
5a3353da
Commit
5a3353da
authored
Oct 18, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:关闭对话[批量]
parent
fa9af058
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
61 deletions
+98
-61
BizAgentApplicationDialoguesRecordService.java
...on/service/BizAgentApplicationDialoguesRecordService.java
+5
-0
BizAgentApplicationDialoguesRecordServiceImpl.java
...e/impl/BizAgentApplicationDialoguesRecordServiceImpl.java
+83
-61
AgentApplicationRest.java
...ain/java/cn/com/poc/expose/rest/AgentApplicationRest.java
+5
-0
AgentApplicationRestImpl.java
...cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
+5
-0
No files found.
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationDialoguesRecordService.java
View file @
5a3353da
...
@@ -29,4 +29,9 @@ public interface BizAgentApplicationDialoguesRecordService extends BaseService {
...
@@ -29,4 +29,9 @@ public interface BizAgentApplicationDialoguesRecordService extends BaseService {
*/
*/
List
<
MemberDialoguesQueryItem
>
memberDialoguesQuery
(
Long
memberId
,
PagingInfo
pagingInfo
);
List
<
MemberDialoguesQueryItem
>
memberDialoguesQuery
(
Long
memberId
,
PagingInfo
pagingInfo
);
/**
* 批量删除会话记录
*/
boolean
batchDeleteByDialogueId
(
List
<
String
>
dialogueIds
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationDialoguesRecordServiceImpl.java
View file @
5a3353da
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryCondition
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryCondition
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryItem
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryItem
;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.agent_application.service.BizAgentApplicationDialoguesRecordService
;
import
cn.com.poc.agent_application.service.BizAgentApplicationDialoguesRecordService
;
import
cn.com.poc.agent_application.model.BizAgentApplicationDialoguesRecordModel
;
import
cn.com.poc.agent_application.model.BizAgentApplicationDialoguesRecordModel
;
...
@@ -12,107 +13,109 @@ import cn.com.yict.framemax.data.model.PagingInfo;
...
@@ -12,107 +13,109 @@ import cn.com.yict.framemax.data.model.PagingInfo;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
@Service
@Service
public
class
BizAgentApplicationDialoguesRecordServiceImpl
extends
BaseServiceImpl
public
class
BizAgentApplicationDialoguesRecordServiceImpl
extends
BaseServiceImpl
implements
BizAgentApplicationDialoguesRecordService
{
implements
BizAgentApplicationDialoguesRecordService
{
@Resource
@Resource
private
BizAgentApplicationDialoguesRecordRepository
repository
;
private
BizAgentApplicationDialoguesRecordRepository
repository
;
public
BizAgentApplicationDialoguesRecordEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
{
public
BizAgentApplicationDialoguesRecordEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
Assert
.
notNull
(
id
);
BizAgentApplicationDialoguesRecordModel
model
=
this
.
repository
.
get
(
id
);
BizAgentApplicationDialoguesRecordModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
){
if
(
model
==
null
)
{
return
null
;
return
null
;
}
}
if
(
"Y"
.
equals
(
model
.
getIsDeleted
())){
if
(
"Y"
.
equals
(
model
.
getIsDeleted
()))
{
return
null
;
return
null
;
}
}
return
BizAgentApplicationDialoguesRecordConvert
.
modelToEntity
(
model
);
return
BizAgentApplicationDialoguesRecordConvert
.
modelToEntity
(
model
);
}
}
public
List
<
BizAgentApplicationDialoguesRecordEntity
>
findByExample
(
BizAgentApplicationDialoguesRecordEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
public
List
<
BizAgentApplicationDialoguesRecordEntity
>
findByExample
(
BizAgentApplicationDialoguesRecordEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAgentApplicationDialoguesRecordEntity
>
result
=
new
ArrayList
<
BizAgentApplicationDialoguesRecordEntity
>();
List
<
BizAgentApplicationDialoguesRecordEntity
>
result
=
new
ArrayList
<
BizAgentApplicationDialoguesRecordEntity
>();
BizAgentApplicationDialoguesRecordModel
model
=
new
BizAgentApplicationDialoguesRecordModel
();
BizAgentApplicationDialoguesRecordModel
model
=
new
BizAgentApplicationDialoguesRecordModel
();
if
(
example
!=
null
){
if
(
example
!=
null
)
{
model
=
BizAgentApplicationDialoguesRecordConvert
.
entityToModel
(
example
);
model
=
BizAgentApplicationDialoguesRecordConvert
.
entityToModel
(
example
);
}
}
model
.
setIsDeleted
(
"N"
);
model
.
setIsDeleted
(
"N"
);
List
<
BizAgentApplicationDialoguesRecordModel
>
models
=
this
.
repository
.
findByExample
(
model
,
"timestamp asc"
,
pagingInfo
);
List
<
BizAgentApplicationDialoguesRecordModel
>
models
=
this
.
repository
.
findByExample
(
model
,
"timestamp asc"
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizAgentApplicationDialoguesRecordConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
result
=
models
.
stream
().
map
(
BizAgentApplicationDialoguesRecordConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
}
return
result
;
return
result
;
}
}
public
BizAgentApplicationDialoguesRecordEntity
save
(
BizAgentApplicationDialoguesRecordEntity
entity
)
throws
Exception
{
public
BizAgentApplicationDialoguesRecordEntity
save
(
BizAgentApplicationDialoguesRecordEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
entity
.
setId
(
null
);
entity
.
setIsDeleted
(
"N"
);
entity
.
setIsDeleted
(
"N"
);
BizAgentApplicationDialoguesRecordModel
model
=
BizAgentApplicationDialoguesRecordConvert
.
entityToModel
(
entity
);
BizAgentApplicationDialoguesRecordModel
model
=
BizAgentApplicationDialoguesRecordConvert
.
entityToModel
(
entity
);
BizAgentApplicationDialoguesRecordModel
saveModel
=
this
.
repository
.
save
(
model
);
BizAgentApplicationDialoguesRecordModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationDialoguesRecordConvert
.
modelToEntity
(
saveModel
);
return
BizAgentApplicationDialoguesRecordConvert
.
modelToEntity
(
saveModel
);
}
}
public
BizAgentApplicationDialoguesRecordEntity
update
(
BizAgentApplicationDialoguesRecordEntity
entity
)
throws
Exception
{
public
BizAgentApplicationDialoguesRecordEntity
update
(
BizAgentApplicationDialoguesRecordEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizAgentApplicationDialoguesRecordModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
BizAgentApplicationDialoguesRecordModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getRole
()
!=
null
)
{
if
(
entity
.
getRole
()
!=
null
)
{
model
.
setRole
(
entity
.
getRole
());
model
.
setRole
(
entity
.
getRole
());
}
}
if
(
entity
.
getAgentId
()
!=
null
)
{
if
(
entity
.
getAgentId
()
!=
null
)
{
model
.
setAgentId
(
entity
.
getAgentId
());
model
.
setAgentId
(
entity
.
getAgentId
());
}
}
if
(
entity
.
getMemberId
()
!=
null
)
{
if
(
entity
.
getMemberId
()
!=
null
)
{
model
.
setMemberId
(
entity
.
getMemberId
());
model
.
setMemberId
(
entity
.
getMemberId
());
}
}
if
(
entity
.
getContent
()
!=
null
)
{
if
(
entity
.
getContent
()
!=
null
)
{
model
.
setContent
(
entity
.
getContent
());
model
.
setContent
(
entity
.
getContent
());
}
}
if
(
entity
.
getTimestamp
()
!=
null
)
{
if
(
entity
.
getTimestamp
()
!=
null
)
{
model
.
setTimestamp
(
entity
.
getTimestamp
());
model
.
setTimestamp
(
entity
.
getTimestamp
());
}
}
if
(
entity
.
getIsDeleted
()
!=
null
)
{
if
(
entity
.
getIsDeleted
()
!=
null
)
{
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
}
}
if
(
entity
.
getCreator
()
!=
null
)
{
if
(
entity
.
getCreator
()
!=
null
)
{
model
.
setCreator
(
entity
.
getCreator
());
model
.
setCreator
(
entity
.
getCreator
());
}
}
if
(
entity
.
getCreatedTime
()
!=
null
)
{
if
(
entity
.
getCreatedTime
()
!=
null
)
{
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
}
}
if
(
entity
.
getModifier
()
!=
null
)
{
if
(
entity
.
getModifier
()
!=
null
)
{
model
.
setModifier
(
entity
.
getModifier
());
model
.
setModifier
(
entity
.
getModifier
());
}
}
if
(
entity
.
getModifiedTime
()
!=
null
)
{
if
(
entity
.
getModifiedTime
()
!=
null
)
{
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
}
}
if
(
entity
.
getSysVersion
()
!=
null
)
{
if
(
entity
.
getSysVersion
()
!=
null
)
{
model
.
setSysVersion
(
entity
.
getSysVersion
());
model
.
setSysVersion
(
entity
.
getSysVersion
());
}
}
BizAgentApplicationDialoguesRecordModel
saveModel
=
this
.
repository
.
save
(
model
);
BizAgentApplicationDialoguesRecordModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationDialoguesRecordConvert
.
modelToEntity
(
saveModel
);
return
BizAgentApplicationDialoguesRecordConvert
.
modelToEntity
(
saveModel
);
}
}
public
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
{
public
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
Assert
.
notNull
(
id
);
BizAgentApplicationDialoguesRecordModel
model
=
this
.
repository
.
get
(
id
);
BizAgentApplicationDialoguesRecordModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
){
if
(
model
!=
null
)
{
if
(
"N"
.
equals
(
model
.
getIsDeleted
())){
if
(
"N"
.
equals
(
model
.
getIsDeleted
()))
{
model
.
setIsDeleted
(
"Y"
);
model
.
setIsDeleted
(
"Y"
);
this
.
repository
.
save
(
model
);
this
.
repository
.
save
(
model
);
}
}
}
}
}
}
@Override
@Override
public
List
<
BizAgentApplicationDialoguesRecordEntity
>
getRecord
(
String
agentId
,
Integer
turn
)
{
public
List
<
BizAgentApplicationDialoguesRecordEntity
>
getRecord
(
String
agentId
,
Integer
turn
)
{
...
@@ -123,6 +126,25 @@ public class BizAgentApplicationDialoguesRecordServiceImpl extends BaseServiceIm
...
@@ -123,6 +126,25 @@ public class BizAgentApplicationDialoguesRecordServiceImpl extends BaseServiceIm
public
List
<
MemberDialoguesQueryItem
>
memberDialoguesQuery
(
Long
memberId
,
PagingInfo
pagingInfo
)
{
public
List
<
MemberDialoguesQueryItem
>
memberDialoguesQuery
(
Long
memberId
,
PagingInfo
pagingInfo
)
{
MemberDialoguesQueryCondition
condition
=
new
MemberDialoguesQueryCondition
();
MemberDialoguesQueryCondition
condition
=
new
MemberDialoguesQueryCondition
();
condition
.
setMemberId
(
memberId
);
condition
.
setMemberId
(
memberId
);
return
this
.
sqlDao
.
query
(
condition
,
MemberDialoguesQueryItem
.
class
,
pagingInfo
);
return
this
.
sqlDao
.
query
(
condition
,
MemberDialoguesQueryItem
.
class
,
pagingInfo
);
}
@Override
public
boolean
batchDeleteByDialogueId
(
List
<
String
>
dialogueIds
)
{
Assert
.
notEmpty
(
dialogueIds
);
List
<
BizAgentApplicationDialoguesRecordModel
>
delModels
=
new
ArrayList
<>();
for
(
String
dialogueId
:
dialogueIds
)
{
BizAgentApplicationDialoguesRecordModel
model
=
new
BizAgentApplicationDialoguesRecordModel
();
model
.
setDialogsId
(
dialogueId
);
model
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
N
);
List
<
BizAgentApplicationDialoguesRecordModel
>
models
=
this
.
repository
.
findByExample
(
model
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
model
=
models
.
get
(
0
);
model
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
Y
);
delModels
.
add
(
model
);
}
}
this
.
repository
.
saveAll
(
delModels
);
return
true
;
}
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/expose/rest/AgentApplicationRest.java
View file @
5a3353da
...
@@ -58,6 +58,11 @@ public interface AgentApplicationRest extends BaseRest {
...
@@ -58,6 +58,11 @@ public interface AgentApplicationRest extends BaseRest {
*/
*/
void
closeDialogues
(
@RequestParam
String
dialogueId
)
throws
Exception
;
void
closeDialogues
(
@RequestParam
String
dialogueId
)
throws
Exception
;
/**
* 关闭对话[批量]
*/
void
batchCloseDialogues
(
@RequestBody
List
<
String
>
dialogueIds
);
/**
/**
* 获取对话上下文
* 获取对话上下文
*/
*/
...
...
src/main/java/cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
View file @
5a3353da
...
@@ -138,6 +138,11 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
...
@@ -138,6 +138,11 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
}
}
}
}
@Override
public
void
batchCloseDialogues
(
List
<
String
>
dialogueIds
)
{
bizAgentApplicationDialoguesRecordService
.
batchDeleteByDialogueId
(
dialogueIds
);
}
@Override
@Override
public
List
<
DialoguesContextDto
>
getDialogueContext
(
String
dialogueId
)
throws
Exception
{
public
List
<
DialoguesContextDto
>
getDialogueContext
(
String
dialogueId
)
throws
Exception
{
Assert
.
notBlank
(
dialogueId
,
"对话ID不能为空"
);
Assert
.
notBlank
(
dialogueId
,
"对话ID不能为空"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment