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
68777b48
Commit
68777b48
authored
Nov 27, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:Agent应用-配置应用音频自动播放
parent
87555dfb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
8 deletions
+89
-8
pom.xml
pom.xml
+6
-1
BizAgentApplicationPublishService.java
...pplication/service/BizAgentApplicationPublishService.java
+1
-1
BizAgentApplicationPublishServiceImpl.java
...n/service/impl/BizAgentApplicationPublishServiceImpl.java
+1
-3
AgentApplicationService.java
.../cn/com/poc/expose/aggregate/AgentApplicationService.java
+18
-0
AgentApplicationServiceImpl.java
...oc/expose/aggregate/impl/AgentApplicationServiceImpl.java
+33
-0
AgentApplicationRest.java
...ain/java/cn/com/poc/expose/rest/AgentApplicationRest.java
+14
-0
AgentApplicationRestImpl.java
...cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
+16
-1
AgentApplicationConsumerServiceImpl.java
...age/service/impl/AgentApplicationConsumerServiceImpl.java
+0
-2
No files found.
pom.xml
View file @
68777b48
...
...
@@ -151,7 +151,12 @@
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-core
</artifactId>
<version>
3.7.7
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-test
</artifactId>
...
...
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationPublishService.java
View file @
68777b48
...
...
@@ -12,7 +12,7 @@ public interface BizAgentApplicationPublishService extends BaseService {
BizAgentApplicationPublishEntity
get
(
java
.
lang
.
Integer
id
)
throws
Exception
;
BizAgentApplicationPublishEntity
getByAgentId
(
String
agentId
)
throws
Exception
;
BizAgentApplicationPublishEntity
getByAgentId
(
String
agentId
);
List
<
BizAgentApplicationPublishEntity
>
findByExample
(
BizAgentApplicationPublishEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
...
...
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationPublishServiceImpl.java
View file @
68777b48
...
...
@@ -14,8 +14,6 @@ import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity;
import
cn.com.poc.agent_application.convert.BizAgentApplicationPublishConvert
;
import
cn.com.poc.agent_application.repository.BizAgentApplicationPublishRepository
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
cn.hutool.core.bean.BeanUtil
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -52,7 +50,7 @@ public class BizAgentApplicationPublishServiceImpl extends BaseServiceImpl
}
@Override
public
BizAgentApplicationPublishEntity
getByAgentId
(
String
agentId
)
throws
Exception
{
public
BizAgentApplicationPublishEntity
getByAgentId
(
String
agentId
)
{
Assert
.
notNull
(
agentId
);
BizAgentApplicationPublishModel
model
=
new
BizAgentApplicationPublishModel
();
model
.
setAgentId
(
agentId
);
...
...
src/main/java/cn/com/poc/expose/aggregate/AgentApplicationService.java
View file @
68777b48
...
...
@@ -2,6 +2,7 @@ package cn.com.poc.expose.aggregate;
import
cn.com.poc.agent_application.query.MemberCollectQueryItem
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
...
...
@@ -46,4 +47,21 @@ public interface AgentApplicationService {
*/
List
<
MemberCollectQueryItem
>
getCollectedApplications
(
Long
memberId
,
PagingInfo
pagingInfo
);
/**
* 获取用户在当前应用的自动播放配置
*
* @param memberId 用户ID
* @param agentId 应用ID
*/
String
autoPlayByAgentId
(
Long
memberId
,
String
agentId
);
/**
* 设置用户在当前应用的自动播放配置
*
* @param memberId 用户ID
* @param agentId 应用ID
* @param autoPlay 自动播放配置 Y/N
*/
String
enableAutoPlay
(
Long
memberId
,
String
agentId
,
String
autoPlay
);
}
src/main/java/cn/com/poc/expose/aggregate/impl/AgentApplicationServiceImpl.java
View file @
68777b48
...
...
@@ -6,6 +6,7 @@ import cn.com.poc.agent_application.constant.AgentApplicationGCConfigConstants;
import
cn.com.poc.agent_application.entity.BizAgentApplicationDialoguesRecordEntity
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationGcConfigEntity
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity
;
import
cn.com.poc.agent_application.entity.VoiceConfig
;
import
cn.com.poc.agent_application.query.MemberCollectQueryCondition
;
import
cn.com.poc.agent_application.query.MemberCollectQueryItem
;
import
cn.com.poc.agent_application.service.BizAgentApplicationDialoguesRecordService
;
...
...
@@ -62,6 +63,11 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
*/
final
private
String
MEMBER_RECOMMEND_QUESTIONS_LAST
=
AGENT_APPLICATION_RECOMMEND_QUESTIONS
+
"MEMBER_LAST:"
;
/**
* 应用自动播放Key
*/
final
private
String
AGENT_APPLICATION_AUTO_PLAY
=
"AGENT_APPLICATION_AUTO_PLAY:"
;
@Resource
private
BizMemberAgentApplicationCollectService
bizMemberAgentApplicationCollectService
;
...
...
@@ -266,6 +272,33 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
return
memberCollectQueryItems
;
}
@Override
public
String
autoPlayByAgentId
(
Long
memberId
,
String
agentId
)
{
String
result
=
CommonConstant
.
YOrN
.
N
;
String
redisKey
=
AGENT_APPLICATION_RECOMMEND_QUESTIONS
+
memberId
+
":"
+
agentId
;
if
(
redisService
.
hasKey
(
redisKey
))
{
result
=
(
String
)
redisService
.
get
(
redisKey
);
}
else
{
BizAgentApplicationPublishEntity
publishEntity
=
bizAgentApplicationPublishService
.
getByAgentId
(
agentId
);
if
(
publishEntity
==
null
)
{
throw
new
I18nMessageException
(
"exception/application.does.not.exist"
);
}
VoiceConfig
voiceConfig
=
publishEntity
.
getVoiceConfig
();
if
(
voiceConfig
!=
null
)
{
String
isAutoPlay
=
voiceConfig
.
getDefaultOpen
();
result
=
isAutoPlay
;
}
redisService
.
set
(
redisKey
,
result
,
30
*
60
*
60
*
24
);
}
return
result
;
}
@Override
public
String
enableAutoPlay
(
Long
memberId
,
String
agentId
,
String
autoPlay
)
{
String
redisKey
=
AGENT_APPLICATION_RECOMMEND_QUESTIONS
+
memberId
+
":"
+
agentId
;
redisService
.
set
(
redisKey
,
autoPlay
,
30
*
60
*
60
*
24
);
return
autoPlay
;
}
private
void
createCNQuestion
()
{
Message
message
=
new
Message
();
...
...
src/main/java/cn/com/poc/expose/rest/AgentApplicationRest.java
View file @
68777b48
...
...
@@ -86,4 +86,18 @@ public interface AgentApplicationRest extends BaseRest {
*/
List
<
DialoguesContextDto
>
getDialogueContext
(
@RequestParam
String
dialogueId
)
throws
Exception
;
/**
* 获取用户在当前应用的自动播放配置
*
* @param agentId 应用ID
*/
String
autoPlayByAgentId
(
@RequestParam
String
agentId
);
/**
* 设置用户在当前应用的自动播放配置
*
* @param agentId 应用ID
* @param autoPlay 自动播放配置 Y/N
*/
String
enableAutoPlay
(
@RequestParam
String
agentId
,
@RequestParam
String
autoPlay
);
}
src/main/java/cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
View file @
68777b48
package
cn
.
com
.
poc
.
expose
.
rest
.
impl
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationInfoService
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationMallService
;
import
cn.com.poc.agent_application.convert.AgentApplicationInfoConvert
;
import
cn.com.poc.agent_application.convert.BizAgentApplicationPublishConvert
;
import
cn.com.poc.agent_application.dto.AgentApplicationCreateContinueQuesDto
;
...
...
@@ -232,4 +231,20 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
}
return
null
;
}
@Override
public
String
autoPlayByAgentId
(
String
agentId
)
{
Assert
.
notBlank
(
agentId
);
UserBaseEntity
currentUser
=
BlContext
.
getCurrentUser
();
return
agentApplicationService
.
autoPlayByAgentId
(
currentUser
.
getUserId
(),
agentId
);
}
@Override
public
String
enableAutoPlay
(
String
agentId
,
String
autoPlay
)
{
Assert
.
notBlank
(
agentId
);
Assert
.
notBlank
(
autoPlay
);
Assert
.
isTrue
(
CommonConstant
.
YOrN
.
N
.
equals
(
autoPlay
)
||
CommonConstant
.
YOrN
.
Y
.
equals
(
autoPlay
));
UserBaseEntity
currentUser
=
BlContext
.
getCurrentUser
();
return
agentApplicationService
.
enableAutoPlay
(
currentUser
.
getUserId
(),
agentId
,
autoPlay
);
}
}
src/main/java/cn/com/poc/message/service/impl/AgentApplicationConsumerServiceImpl.java
View file @
68777b48
...
...
@@ -2,12 +2,10 @@ package cn.com.poc.message.service.impl;
import
cn.com.poc.agent_application.aggregate.AgentApplicationMallService
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity
;
import
cn.com.poc.agent_application.service.BizAgentApplicationDialoguesRecordService
;
import
cn.com.poc.agent_application.service.BizAgentApplicationPublishService
;
import
cn.com.poc.message.entity.AgentApplicationClickEventMessage
;
import
cn.com.poc.message.service.AgentApplicationConsumerService
;
import
cn.com.poc.message.topic.AgentApplicationTopic
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.yict.framemax.tumbleweed.client.annotation.Consumer
;
import
org.springframework.stereotype.Service
;
...
...
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