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
cbc9d777
Commit
cbc9d777
authored
Sep 05, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:Agent应用配置保存 参数验证和转换
parent
c507bd6d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
AgentApplicationInfoRestImpl.java
...t_application/rest/impl/AgentApplicationInfoRestImpl.java
+12
-0
BizAgentApplicationInfoService.java
...t_application/service/BizAgentApplicationInfoService.java
+2
-0
BizAgentApplicationInfoServiceImpl.java
...tion/service/impl/BizAgentApplicationInfoServiceImpl.java
+14
-0
No files found.
src/main/java/cn/com/poc/agent_application/rest/impl/AgentApplicationInfoRestImpl.java
View file @
cbc9d777
...
@@ -45,6 +45,9 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -45,6 +45,9 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
public
AgentApplicationInfoDto
saveOrUpdate
(
AgentApplicationInfoDto
dto
)
throws
Exception
{
public
AgentApplicationInfoDto
saveOrUpdate
(
AgentApplicationInfoDto
dto
)
throws
Exception
{
Assert
.
notNull
(
dto
);
Assert
.
notNull
(
dto
);
Assert
.
notNull
(
dto
.
getBaseInfo
());
Assert
.
notNull
(
dto
.
getBaseInfo
());
Assert
.
notNull
(
dto
.
getCommConfig
());
Assert
.
notNull
(
dto
.
getCommModelConfig
());
Assert
.
notNull
(
dto
.
getKnowledgeConfig
());
UserBaseEntity
userBaseEntity
=
BlContext
.
getCurrentUserNotException
();
UserBaseEntity
userBaseEntity
=
BlContext
.
getCurrentUserNotException
();
Long
userId
=
userBaseEntity
.
getUserId
();
Long
userId
=
userBaseEntity
.
getUserId
();
dto
.
getBaseInfo
().
setMemberId
(
userId
.
intValue
());
dto
.
getBaseInfo
().
setMemberId
(
userId
.
intValue
());
...
@@ -58,6 +61,9 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -58,6 +61,9 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
Assert
.
notNull
(
dto
);
Assert
.
notNull
(
dto
);
Assert
.
notNull
(
dto
.
getBaseInfo
());
Assert
.
notNull
(
dto
.
getBaseInfo
());
Assert
.
notNull
(
dto
.
getBaseInfo
().
getAgentId
(),
"id不能为空"
);
Assert
.
notNull
(
dto
.
getBaseInfo
().
getAgentId
(),
"id不能为空"
);
Assert
.
notNull
(
dto
.
getCommConfig
());
Assert
.
notNull
(
dto
.
getCommModelConfig
());
Assert
.
notNull
(
dto
.
getKnowledgeConfig
());
BizAgentApplicationInfoEntity
entity
=
AgentApplicationInfoConvert
.
dtoToEntity
(
dto
);
BizAgentApplicationInfoEntity
entity
=
AgentApplicationInfoConvert
.
dtoToEntity
(
dto
);
return
AgentApplicationInfoConvert
.
entityToDto
(
bizAgentApplicationInfoService
.
update
(
entity
));
return
AgentApplicationInfoConvert
.
entityToDto
(
bizAgentApplicationInfoService
.
update
(
entity
));
}
}
...
@@ -83,6 +89,12 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -83,6 +89,12 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
Assert
.
notNull
(
dto
);
Assert
.
notNull
(
dto
);
Assert
.
notNull
(
dto
.
getBaseInfo
());
Assert
.
notNull
(
dto
.
getBaseInfo
());
Assert
.
notNull
(
dto
.
getBaseInfo
().
getAgentId
(),
"id不能为空"
);
Assert
.
notNull
(
dto
.
getBaseInfo
().
getAgentId
(),
"id不能为空"
);
Assert
.
notNull
(
dto
.
getCommConfig
());
Assert
.
notNull
(
dto
.
getCommModelConfig
());
Assert
.
notNull
(
dto
.
getKnowledgeConfig
());
UserBaseEntity
userBaseEntity
=
BlContext
.
getCurrentUserNotException
();
Long
userId
=
userBaseEntity
.
getUserId
();
dto
.
getBaseInfo
().
setMemberId
(
userId
.
intValue
());
dto
.
getBaseInfo
().
setAgentPublishStatus
(
AgentApplicationConstants
.
AGENT_PUBLISH_STATUS
.
PUBLISH
);
dto
.
getBaseInfo
().
setAgentPublishStatus
(
AgentApplicationConstants
.
AGENT_PUBLISH_STATUS
.
PUBLISH
);
if
(
null
==
bizAgentApplicationInfoService
.
update
(
AgentApplicationInfoConvert
.
dtoToEntity
(
dto
)))
{
if
(
null
==
bizAgentApplicationInfoService
.
update
(
AgentApplicationInfoConvert
.
dtoToEntity
(
dto
)))
{
throw
new
BusinessException
(
"发布失败"
);
throw
new
BusinessException
(
"发布失败"
);
...
...
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationInfoService.java
View file @
cbc9d777
...
@@ -16,6 +16,8 @@ public interface BizAgentApplicationInfoService extends BaseService {
...
@@ -16,6 +16,8 @@ public interface BizAgentApplicationInfoService extends BaseService {
BizAgentApplicationInfoEntity
update
(
BizAgentApplicationInfoEntity
entity
)
throws
Exception
;
BizAgentApplicationInfoEntity
update
(
BizAgentApplicationInfoEntity
entity
)
throws
Exception
;
BizAgentApplicationInfoEntity
saveOrUpdate
(
BizAgentApplicationInfoEntity
entity
)
throws
Exception
;
void
deletedByAgentId
(
String
agentId
);
void
deletedByAgentId
(
String
agentId
);
boolean
publish
(
String
agentId
)
throws
Exception
;
boolean
publish
(
String
agentId
)
throws
Exception
;
...
...
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationInfoServiceImpl.java
View file @
cbc9d777
...
@@ -12,8 +12,10 @@ import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
...
@@ -12,8 +12,10 @@ import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
import
cn.com.poc.agent_application.convert.AgentApplicationInfoConvert
;
import
cn.com.poc.agent_application.convert.AgentApplicationInfoConvert
;
import
cn.com.poc.agent_application.repository.BizAgentApplicationInfoRepository
;
import
cn.com.poc.agent_application.repository.BizAgentApplicationInfoRepository
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
cn.hutool.core.bean.BeanUtil
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -102,6 +104,18 @@ public class BizAgentApplicationInfoServiceImpl extends BaseServiceImpl
...
@@ -102,6 +104,18 @@ public class BizAgentApplicationInfoServiceImpl extends BaseServiceImpl
return
AgentApplicationInfoConvert
.
modelToEntity
(
saveModel
);
return
AgentApplicationInfoConvert
.
modelToEntity
(
saveModel
);
}
}
@Override
public
BizAgentApplicationInfoEntity
saveOrUpdate
(
BizAgentApplicationInfoEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
BizAgentApplicationInfoModel
model
=
new
BizAgentApplicationInfoModel
();
BeanUtils
.
copyProperties
(
entity
,
model
);
if
(
StringUtils
.
isBlank
(
entity
.
getAgentId
()))
{
model
.
setAgentId
(
UUIDTool
.
getUUID
());
}
BizAgentApplicationInfoModel
saveModel
=
this
.
repository
.
save
(
model
);
return
AgentApplicationInfoConvert
.
modelToEntity
(
saveModel
);
}
@Override
@Override
public
boolean
publish
(
String
agentId
)
throws
Exception
{
public
boolean
publish
(
String
agentId
)
throws
Exception
{
Assert
.
notNull
(
agentId
);
Assert
.
notNull
(
agentId
);
...
...
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