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
1c3fd664
Commit
1c3fd664
authored
Dec 11, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:Agent應用數據看板權限限制
parent
0456929a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
4 deletions
+48
-4
AgentApplicationInfoService.java
...nt_application/aggregate/AgentApplicationInfoService.java
+8
-0
AgentApplicationInfoServiceImpl.java
...ation/aggregate/impl/AgentApplicationInfoServiceImpl.java
+8
-0
AgentDataAnalyzeServiceImpl.java
...oc/expose/aggregate/impl/AgentDataAnalyzeServiceImpl.java
+3
-1
AgentDataAnalyzeRestImpl.java
...cn/com/poc/expose/rest/impl/AgentDataAnalyzeRestImpl.java
+23
-0
exception.properties
...in/resources/framemax-config/i18n/en/exception.properties
+2
-1
exception.properties
...resources/framemax-config/i18n/zh_cn/exception.properties
+2
-1
exception.properties
...resources/framemax-config/i18n/zh_tw/exception.properties
+2
-1
No files found.
src/main/java/cn/com/poc/agent_application/aggregate/AgentApplicationInfoService.java
View file @
1c3fd664
...
...
@@ -119,4 +119,12 @@ public interface AgentApplicationInfoService {
* @param agentId Agent应用id
*/
void
collectOrCancelAgentInPerson
(
String
agentId
)
throws
Exception
;
/**
* 判断用户是否拥有该应用权限
*
* @param agentId 应用id
* @param memberId 用户id
*/
boolean
hasPublishAgentPermission
(
String
agentId
,
Long
memberId
);
}
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationInfoServiceImpl.java
View file @
1c3fd664
...
...
@@ -484,6 +484,14 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
}
public
boolean
hasPublishAgentPermission
(
String
agentId
,
Long
memberId
)
{
BizAgentApplicationPublishEntity
publishEntity
=
bizAgentApplicationPublishService
.
getByAgentId
(
agentId
);
if
(
publishEntity
!=
null
&&
publishEntity
.
getMemberId
().
equals
(
memberId
.
intValue
()))
{
return
true
;
}
return
false
;
}
/**
* 构建应用信息提示词
*
...
...
src/main/java/cn/com/poc/expose/aggregate/impl/AgentDataAnalyzeServiceImpl.java
View file @
1c3fd664
package
cn
.
com
.
poc
.
expose
.
aggregate
.
impl
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationInfoService
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.common.utils.DateUtils
;
import
cn.com.poc.data_analyze.constants.DataAnalyzeTimeDimensionEnum
;
import
cn.com.poc.data_analyze.constants.DataAnalyzeTimeRangeEnum
;
...
...
@@ -12,6 +14,7 @@ import cn.com.poc.data_analyze.query.*;
import
cn.com.poc.data_analyze.service.BizDataAnalyzeDialogueRecordService
;
import
cn.com.poc.data_analyze.service.BizDataAnalyzePointRecordService
;
import
cn.com.poc.expose.aggregate.AgentDataAnalyzeService
;
import
cn.com.yict.framemax.core.i18n.I18nMessageException
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -270,5 +273,4 @@ public class AgentDataAnalyzeServiceImpl implements AgentDataAnalyzeService {
countEntity
.
setChannelDataCount
(
channelDataCountList
);
result
.
add
(
countEntity
);
}
}
src/main/java/cn/com/poc/expose/rest/impl/AgentDataAnalyzeRestImpl.java
View file @
1c3fd664
package
cn
.
com
.
poc
.
expose
.
rest
.
impl
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationInfoService
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.data_analyze.entity.*
;
import
cn.com.poc.expose.aggregate.AgentDataAnalyzeService
;
import
cn.com.poc.expose.dto.agent_data_analyze.*
;
import
cn.com.poc.expose.rest.AgentDataAnalyzeRest
;
import
cn.com.poc.support.security.oauth.entity.UserBaseEntity
;
import
cn.com.yict.framemax.core.i18n.I18nMessageException
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
...
...
@@ -20,8 +24,12 @@ public class AgentDataAnalyzeRestImpl implements AgentDataAnalyzeRest {
@Resource
private
AgentDataAnalyzeService
agentDataAnalyzeService
;
@Resource
private
AgentApplicationInfoService
agentApplicationInfoService
;
@Override
public
List
<
AgentDataAnalyzeGeneralDto
>
getGeneralUsageData
(
String
agentId
,
List
<
String
>
channel
)
{
checkPermission
(
agentId
);
List
<
AgentDataAnalyzeGeneralDto
>
result
=
new
ArrayList
<>();
List
<
AgentDataAnalyzeGeneralEntity
>
generalUsageDataEntity
=
agentDataAnalyzeService
.
getGeneralUsageData
(
agentId
,
channel
);
for
(
AgentDataAnalyzeGeneralEntity
entity
:
generalUsageDataEntity
)
{
...
...
@@ -36,6 +44,7 @@ public class AgentDataAnalyzeRestImpl implements AgentDataAnalyzeRest {
@Override
public
List
<
ChannelUsersCountDto
>
getChannelUsersCount
(
String
agentId
,
List
<
String
>
channel
)
{
checkPermission
(
agentId
);
List
<
ChannelUsersCountDto
>
result
=
new
ArrayList
<>();
List
<
ChannelUsersCountEntity
>
channelUsersCountEntities
=
agentDataAnalyzeService
.
getChannelUserCount
(
agentId
,
channel
);
for
(
ChannelUsersCountEntity
entity
:
channelUsersCountEntities
)
{
...
...
@@ -49,6 +58,7 @@ public class AgentDataAnalyzeRestImpl implements AgentDataAnalyzeRest {
@Override
public
List
<
ChannelUsageCountDto
>
getSendMessageCount
(
String
agentId
,
List
<
String
>
channel
)
{
checkPermission
(
agentId
);
List
<
ChannelUsageCountDto
>
result
=
new
ArrayList
<>();
List
<
ChannelUsageCountEntity
>
sendMessageCountEntities
=
agentDataAnalyzeService
.
getSendMessageCount
(
agentId
,
channel
);
for
(
ChannelUsageCountEntity
entity
:
sendMessageCountEntities
)
{
...
...
@@ -62,6 +72,7 @@ public class AgentDataAnalyzeRestImpl implements AgentDataAnalyzeRest {
@Override
public
List
<
ChannelPointCountDto
>
getPointUsageCount
(
String
agentId
,
List
<
String
>
channel
)
{
checkPermission
(
agentId
);
List
<
ChannelPointCountDto
>
result
=
new
ArrayList
<>();
List
<
ChannelPointCountEntity
>
pointCountEntities
=
agentDataAnalyzeService
.
getPointUsageCount
(
agentId
,
channel
);
for
(
ChannelPointCountEntity
pointCountEntity
:
pointCountEntities
)
{
...
...
@@ -75,6 +86,7 @@ public class AgentDataAnalyzeRestImpl implements AgentDataAnalyzeRest {
@Override
public
List
<
AgentDataAnalyzeTrendDto
>
getAgentDataTrend
(
GetAgentDataTrendRequestDto
dto
)
{
checkPermission
(
dto
.
getAgentId
());
List
<
AgentDataAnalyzeTrendDto
>
result
=
new
ArrayList
<>();
List
<
AgentDataAnalyzeTrendEntity
>
agentDataAnalyzeTrendEntities
=
agentDataAnalyzeService
.
getAgentDataTrend
(
dto
.
getAgentId
(),
dto
.
getChannel
(),
dto
.
getTimeRange
());
for
(
AgentDataAnalyzeTrendEntity
entity
:
agentDataAnalyzeTrendEntities
)
{
...
...
@@ -87,4 +99,15 @@ public class AgentDataAnalyzeRestImpl implements AgentDataAnalyzeRest {
}
return
result
;
}
private
void
checkPermission
(
String
agentId
)
{
UserBaseEntity
userBaseEntity
=
BlContext
.
getCurrentUserNotException
();
if
(
userBaseEntity
==
null
)
{
throw
new
I18nMessageException
(
"exception/user.does.not.exist"
);
}
if
(!
agentApplicationInfoService
.
hasPublishAgentPermission
(
agentId
,
userBaseEntity
.
getUserId
()))
{
throw
new
I18nMessageException
(
"exception/no.permission"
);
}
}
}
src/main/resources/framemax-config/i18n/en/exception.properties
View file @
1c3fd664
...
...
@@ -78,4 +78,5 @@ arg.cannot.null=Arg can not be null
nickName.max.len
=
Overnickname
remark.max.len
=
Remark content too long
file.content.empty
=
The file content cannot be empty
payment.package.configuration.not.exist
=
The equity packet configuration does not exist
\ No newline at end of file
payment.package.configuration.not.exist
=
The equity packet configuration does not exist
no.permission
=
No permission
\ No newline at end of file
src/main/resources/framemax-config/i18n/zh_cn/exception.properties
View file @
1c3fd664
...
...
@@ -78,4 +78,5 @@ arg.cannot.null=\u8BF7\u6C42\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A
nickName.max.len
=
\u6635\u
79F0
\u
8FC7
\u
957F
remark.max.len
=
\u5185\u
5BB9
\u
8FC7
\u
957F
file.content.empty
=
\u6587\u6863\u5185\u
5BB9
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
payment.package.configuration.not.exist
=
\u6743\u
76CA
\u5305\u
914D
\u
7F6E
\u
4E0D
\u
5B58
\u5728
\ No newline at end of file
payment.package.configuration.not.exist
=
\u6743\u
76CA
\u5305\u
914D
\u
7F6E
\u
4E0D
\u
5B58
\u5728
no.permission
=
\u6682\u
65E0
\u6743\u9650
\ No newline at end of file
src/main/resources/framemax-config/i18n/zh_tw/exception.properties
View file @
1c3fd664
...
...
@@ -78,4 +78,5 @@ arg.cannot.null=\u8ACB\u6C42\u53C3\u6578\u4E0D\u80FD\u7232\u7A7A
nickName.max.len
=
\u6635\u
7A31
\u
904E
\u9577
remark.max.len
=
\u5185\u
5BB9
\u
904E
\u9577
file.content.empty
=
\u6587\u
4EF6
\u5185\u
5BB9
\u
4E0D
\u
80FD
\u7232\u
7A7A
payment.package.configuration.not.exist
=
\u
6B0A
\u
76CA
\u5305\u
914D
\u
7F6E
\u
4E0D
\u
5B58
\u5728
\ No newline at end of file
payment.package.configuration.not.exist
=
\u
6B0A
\u
76CA
\u5305\u
914D
\u
7F6E
\u
4E0D
\u
5B58
\u5728
no.permission
=
\u
66AB
\u7121\u
6B0A
\u9650
\ No newline at end of file
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