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
40840791
Commit
40840791
authored
Oct 16, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 获取用户对话列表
parent
75153ee9
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
209 additions
and
2 deletions
+209
-2
MemberDialoguesQuery.sql
.../com/poc/agent_application/query/MemberDialoguesQuery.sql
+12
-0
MemberDialoguesQueryCondition.java
...gent_application/query/MemberDialoguesQueryCondition.java
+23
-0
MemberDialoguesQueryItem.java
...poc/agent_application/query/MemberDialoguesQueryItem.java
+86
-0
BizAgentApplicationDialoguesRecordService.java
...on/service/BizAgentApplicationDialoguesRecordService.java
+9
-1
BizAgentApplicationDialoguesRecordServiceImpl.java
...e/impl/BizAgentApplicationDialoguesRecordServiceImpl.java
+9
-0
UserDialoguesDto.java
src/main/java/cn/com/poc/expose/dto/UserDialoguesDto.java
+33
-0
AgentApplicationRest.java
...ain/java/cn/com/poc/expose/rest/AgentApplicationRest.java
+6
-1
AgentApplicationRestImpl.java
...cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
+31
-0
No files found.
src/main/java/cn/com/poc/agent_application/query/MemberDialoguesQuery.sql
0 → 100644
View file @
40840791
select
distinct
agent_id
,
dialogs_id
,
member_id
,
content
,
`timestamp`
from
biz_agent_application_dialogues_record
where
is_deleted
=
'N'
<<
and
member_id
=
:
memberId
>>
group
by
dialogs_id
order
by
`timestamp`
desc
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/query/MemberDialoguesQueryCondition.java
0 → 100644
View file @
40840791
package
cn
.
com
.
poc
.
agent_application
.
query
;
import
java.io.Serializable
;
/**
* Query Condition class for MemberDialoguesQuery
*/
public
class
MemberDialoguesQueryCondition
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
java
.
lang
.
Long
memberId
;
public
java
.
lang
.
Long
getMemberId
(){
return
this
.
memberId
;
}
public
void
setMemberId
(
java
.
lang
.
Long
memberId
){
this
.
memberId
=
memberId
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/query/MemberDialoguesQueryItem.java
0 → 100644
View file @
40840791
package
cn
.
com
.
poc
.
agent_application
.
query
;
import
java.io.Serializable
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
cn.com.yict.framemax.data.model.BaseItemClass
;
/**
* Query Item class for MemberDialoguesQuery
*/
@Entity
public
class
MemberDialoguesQueryItem
extends
BaseItemClass
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** agent_id
*agent_id
*/
private
java
.
lang
.
String
agentId
;
@Column
(
name
=
"agent_id"
)
public
java
.
lang
.
String
getAgentId
(){
return
this
.
agentId
;
}
public
void
setAgentId
(
java
.
lang
.
String
agentId
){
this
.
agentId
=
agentId
;
}
/** dialogs_id
*dialogs_id
*/
private
java
.
lang
.
String
dialogsId
;
@Column
(
name
=
"dialogs_id"
)
public
java
.
lang
.
String
getDialogsId
(){
return
this
.
dialogsId
;
}
public
void
setDialogsId
(
java
.
lang
.
String
dialogsId
){
this
.
dialogsId
=
dialogsId
;
}
/** member_id
*member_id
*/
private
java
.
lang
.
Long
memberId
;
@Column
(
name
=
"member_id"
)
public
java
.
lang
.
Long
getMemberId
(){
return
this
.
memberId
;
}
public
void
setMemberId
(
java
.
lang
.
Long
memberId
){
this
.
memberId
=
memberId
;
}
/** content
*content
*/
private
java
.
lang
.
String
content
;
@Column
(
name
=
"content"
)
public
java
.
lang
.
String
getContent
(){
return
this
.
content
;
}
public
void
setContent
(
java
.
lang
.
String
content
){
this
.
content
=
content
;
}
/** timestamp
*timestamp
*/
private
java
.
lang
.
Long
timestamp
;
@Column
(
name
=
"timestamp"
)
public
java
.
lang
.
Long
getTimestamp
(){
return
this
.
timestamp
;
}
public
void
setTimestamp
(
java
.
lang
.
Long
timestamp
){
this
.
timestamp
=
timestamp
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationDialoguesRecordService.java
View file @
40840791
package
cn
.
com
.
poc
.
agent_application
.
service
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryItem
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationDialoguesRecordEntity
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizAgentApplicationDialoguesRecordService
extends
BaseService
{
...
...
@@ -21,4 +21,12 @@ public interface BizAgentApplicationDialoguesRecordService extends BaseService {
List
<
BizAgentApplicationDialoguesRecordEntity
>
getRecord
(
String
agentId
,
Integer
turn
);
/**
* 获取用户的对话【组】
*
* @param memberId 用户id
* @return
*/
List
<
MemberDialoguesQueryItem
>
memberDialoguesQuery
(
Long
memberId
,
PagingInfo
pagingInfo
);
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationDialoguesRecordServiceImpl.java
View file @
40840791
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryCondition
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryItem
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.agent_application.service.BizAgentApplicationDialoguesRecordService
;
import
cn.com.poc.agent_application.model.BizAgentApplicationDialoguesRecordModel
;
...
...
@@ -116,4 +118,11 @@ public class BizAgentApplicationDialoguesRecordServiceImpl extends BaseServiceIm
public
List
<
BizAgentApplicationDialoguesRecordEntity
>
getRecord
(
String
agentId
,
Integer
turn
)
{
return
null
;
}
@Override
public
List
<
MemberDialoguesQueryItem
>
memberDialoguesQuery
(
Long
memberId
,
PagingInfo
pagingInfo
)
{
MemberDialoguesQueryCondition
condition
=
new
MemberDialoguesQueryCondition
();
condition
.
setMemberId
(
memberId
);
return
this
.
sqlDao
.
query
(
condition
,
MemberDialoguesQueryItem
.
class
,
pagingInfo
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/expose/dto/UserDialoguesDto.java
0 → 100644
View file @
40840791
package
cn
.
com
.
poc
.
expose
.
dto
;
import
java.io.Serializable
;
public
class
UserDialoguesDto
implements
Serializable
{
/**
* 会话ID
*/
private
java
.
lang
.
String
dialogsId
;
/**
* 内容
*/
private
String
content
;
public
String
getDialogsId
()
{
return
dialogsId
;
}
public
void
setDialogsId
(
String
dialogsId
)
{
this
.
dialogsId
=
dialogsId
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
}
src/main/java/cn/com/poc/expose/rest/AgentApplicationRest.java
View file @
40840791
package
cn
.
com
.
poc
.
expose
.
rest
;
import
cn.com.poc.agent_application.dto.AgentApplicationCreateContinueQuesDto
;
import
cn.com.poc.agent_application.dto.AgentApplicationInfoDto
;
import
cn.com.poc.agent_application.dto.AgentApplicationInfoSearchDto
;
import
cn.com.poc.agent_application.dto.BizAgentApplicationPublishDto
;
import
cn.com.poc.expose.dto.AgentApplicationDto
;
import
cn.com.poc.expose.dto.UserDialoguesDto
;
import
cn.com.yict.framemax.core.rest.BaseRest
;
import
cn.com.yict.framemax.web.permission.Access
;
import
cn.com.yict.framemax.web.permission.Permission
;
...
...
@@ -43,4 +43,9 @@ public interface AgentApplicationRest extends BaseRest {
*/
List
<
String
>
createContinueQuestions
(
@RequestBody
AgentApplicationCreateContinueQuesDto
dto
)
throws
Exception
;
/**
* 获取用户已创建的对话记录
*/
List
<
UserDialoguesDto
>
getUserDialogues
()
throws
Exception
;
}
src/main/java/cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
View file @
40840791
...
...
@@ -6,20 +6,28 @@ import cn.com.poc.agent_application.dto.AgentApplicationCreateContinueQuesDto;
import
cn.com.poc.agent_application.dto.AgentApplicationInfoSearchDto
;
import
cn.com.poc.agent_application.dto.BizAgentApplicationPublishDto
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity
;
import
cn.com.poc.agent_application.query.MemberDialoguesQueryItem
;
import
cn.com.poc.agent_application.service.BizAgentApplicationDialoguesRecordService
;
import
cn.com.poc.agent_application.service.BizAgentApplicationPublishService
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.common.utils.UUIDTool
;
import
cn.com.poc.expose.aggregate.AgentApplicationService
;
import
cn.com.poc.expose.dto.AgentApplicationDto
;
import
cn.com.poc.expose.dto.UserDialoguesDto
;
import
cn.com.poc.expose.rest.AgentApplicationRest
;
import
cn.com.poc.support.security.oauth.entity.UserBaseEntity
;
import
cn.com.yict.framemax.core.exception.BusinessException
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
public
class
AgentApplicationRestImpl
implements
AgentApplicationRest
{
...
...
@@ -31,6 +39,9 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Resource
private
BizAgentApplicationPublishService
bizAgentApplicationPublishService
;
@Resource
private
BizAgentApplicationDialoguesRecordService
bizAgentApplicationDialoguesRecordService
;
@Override
public
String
createDialogues
(
String
agentId
)
throws
Exception
{
return
"DIA_"
+
UUIDTool
.
getUUID
();
...
...
@@ -73,4 +84,24 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
cn
.
com
.
poc
.
common
.
utils
.
Assert
.
notNull
(
dto
.
getInput
(),
"input不能为空"
);
return
agentApplicationService
.
createContinueQuestions
(
dto
.
getInput
());
}
@Override
public
List
<
UserDialoguesDto
>
getUserDialogues
()
throws
Exception
{
UserBaseEntity
userBaseEntity
=
BlContext
.
getCurrentUserNotException
();
if
(
userBaseEntity
==
null
)
{
throw
new
BusinessException
(
"用户未登录"
);
}
Long
userId
=
userBaseEntity
.
getUserId
();
List
<
UserDialoguesDto
>
result
=
new
ArrayList
<>();
List
<
MemberDialoguesQueryItem
>
memberDialoguesQueryItems
=
bizAgentApplicationDialoguesRecordService
.
memberDialoguesQuery
(
userId
,
null
);
if
(
CollectionUtils
.
isNotEmpty
(
memberDialoguesQueryItems
))
{
result
=
memberDialoguesQueryItems
.
stream
().
map
(
item
->
{
UserDialoguesDto
userDialoguesDto
=
new
UserDialoguesDto
();
userDialoguesDto
.
setDialogsId
(
item
.
getDialogsId
());
userDialoguesDto
.
setContent
(
item
.
getContent
());
return
userDialoguesDto
;
}).
collect
(
Collectors
.
toList
());
}
return
result
;
}
}
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