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
8a9b0f75
Commit
8a9b0f75
authored
Nov 04, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复 Agent应用上架应用广场后,应用收藏计数。
parent
3fb7c06e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
89 deletions
+100
-89
BizAgentApplicationMallRestImpl.java
...pplication/rest/impl/BizAgentApplicationMallRestImpl.java
+100
-89
No files found.
src/main/java/cn/com/poc/agent_application/rest/impl/BizAgentApplicationMallRestImpl.java
View file @
8a9b0f75
...
@@ -44,26 +44,37 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
...
@@ -44,26 +44,37 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
Assert
.
notNull
(
dto
.
getAgentType
());
Assert
.
notNull
(
dto
.
getAgentType
());
Assert
.
notNull
(
dto
.
getIsCopy
());
Assert
.
notNull
(
dto
.
getIsCopy
());
BizAgentApplicationPublishEntity
publishEntity
=
bizAgentApplicationPublishService
.
get
(
dto
.
getAgentPublishId
());
BizAgentApplicationPublishEntity
publishEntity
=
bizAgentApplicationPublishService
.
get
(
dto
.
getAgentPublishId
());
if
(
publishEntity
==
null
)
{
if
(
publishEntity
==
null
)
{
throw
new
BusinessException
(
"应用未发布"
);
throw
new
BusinessException
(
"应用未发布"
);
}
}
dto
.
setIsSale
(
CommonConstant
.
IsDeleted
.
Y
);
dto
.
setIsSale
(
CommonConstant
.
IsDeleted
.
Y
);
// 判断当前应用之前是否上架了
// 判断当前应用之前是否上架了
BizAgentApplicationMallEntity
mallEntity
=
bizAgentApplicationMallService
.
getByAgentPublishId
(
dto
.
getAgentPublishId
());
BizAgentApplicationMallEntity
mallEntity
=
bizAgentApplicationMallService
.
getByAgentPublishId
(
dto
.
getAgentPublishId
());
if
(
mallEntity
!=
null
){
// 查询当前应用的收藏情况
BizMemberAgentApplicationCollectEntity
collectEntity
=
new
BizMemberAgentApplicationCollectEntity
();
collectEntity
.
setAgentId
(
publishEntity
.
getAgentId
());
collectEntity
.
setIsCollect
(
CommonConstant
.
YOrN
.
Y
);
collectEntity
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
N
);
List
<
BizMemberAgentApplicationCollectEntity
>
collectEntities
=
bizMemberAgentApplicationCollectService
.
findByExample
(
collectEntity
,
null
);
if
(
mallEntity
!=
null
)
{
mallEntity
.
setIsSale
(
CommonConstant
.
IsDeleted
.
Y
);
mallEntity
.
setIsSale
(
CommonConstant
.
IsDeleted
.
Y
);
mallEntity
.
setAgentType
(
dto
.
getAgentType
());
mallEntity
.
setAgentType
(
dto
.
getAgentType
());
mallEntity
.
setIsCopy
(
dto
.
getIsCopy
());
mallEntity
.
setIsCopy
(
dto
.
getIsCopy
());
mallEntity
.
setCollectNumber
(
collectEntities
.
size
());
// 如果上架过,则update操作
// 如果上架过,则update操作
bizAgentApplicationMallService
.
update
(
mallEntity
);
bizAgentApplicationMallService
.
update
(
mallEntity
);
}
else
{
}
else
{
// 如果没上架过,则save操作
// 如果没上架过,则save操作
// 把应用存入应用市场表中
// 把应用存入应用市场表中
mallEntity
.
setCollectNumber
(
collectEntities
.
size
());
bizAgentApplicationMallService
.
save
(
BizAgentApplicationMallConvert
.
dtoToEntity
(
dto
));
bizAgentApplicationMallService
.
save
(
BizAgentApplicationMallConvert
.
dtoToEntity
(
dto
));
}
}
}
}
public
BizAgentApplicationMallDto
getById
(
java
.
lang
.
Integer
id
)
throws
Exception
{
public
BizAgentApplicationMallDto
getById
(
java
.
lang
.
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
Assert
.
notNull
(
id
);
return
BizAgentApplicationMallConvert
.
entityToDto
(
bizAgentApplicationMallService
.
get
(
id
));
return
BizAgentApplicationMallConvert
.
entityToDto
(
bizAgentApplicationMallService
.
get
(
id
));
}
}
...
@@ -73,19 +84,19 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
...
@@ -73,19 +84,19 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
return
null
;
return
null
;
}
}
public
List
<
BizAgentApplicationMallDto
>
getList
(
PagingInfo
pagingInfo
)
throws
Exception
{
public
List
<
BizAgentApplicationMallDto
>
getList
(
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAgentApplicationMallDto
>
resultList
=
new
ArrayList
<>();
List
<
BizAgentApplicationMallDto
>
resultList
=
new
ArrayList
<>();
List
<
BizAgentApplicationMallEntity
>
byExample
=
bizAgentApplicationMallService
.
findByExample
(
pagingInfo
);
List
<
BizAgentApplicationMallEntity
>
byExample
=
bizAgentApplicationMallService
.
findByExample
(
pagingInfo
);
for
(
BizAgentApplicationMallEntity
entity
:
byExample
)
{
for
(
BizAgentApplicationMallEntity
entity
:
byExample
)
{
BizAgentApplicationMallDto
mallDto
=
BizAgentApplicationMallConvert
.
entityToDto
(
entity
);
BizAgentApplicationMallDto
mallDto
=
BizAgentApplicationMallConvert
.
entityToDto
(
entity
);
// 如果应用上架了
// 如果应用上架了
if
(
CommonConstant
.
IsDeleted
.
Y
.
equals
(
mallDto
.
getIsSale
()))
{
if
(
CommonConstant
.
IsDeleted
.
Y
.
equals
(
mallDto
.
getIsSale
()))
{
// 设置当前用户是否收藏了
// 设置当前用户是否收藏了
if
(
mallDto
.
getBaseInfo
()
!=
null
)
{
if
(
mallDto
.
getBaseInfo
()
!=
null
)
{
BizMemberAgentApplicationCollectEntity
collect
=
bizMemberAgentApplicationCollectService
.
getByAgentId
(
mallDto
.
getBaseInfo
().
getAgentId
());
BizMemberAgentApplicationCollectEntity
collect
=
bizMemberAgentApplicationCollectService
.
getByAgentId
(
mallDto
.
getBaseInfo
().
getAgentId
());
if
(
collect
!=
null
)
{
if
(
collect
!=
null
)
{
mallDto
.
setIsCollect
(
collect
.
getIsCollect
());
mallDto
.
setIsCollect
(
collect
.
getIsCollect
());
}
else
{
}
else
{
mallDto
.
setIsCollect
(
CommonConstant
.
IsDeleted
.
N
);
mallDto
.
setIsCollect
(
CommonConstant
.
IsDeleted
.
N
);
}
}
}
}
...
@@ -95,13 +106,13 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
...
@@ -95,13 +106,13 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
return
resultList
;
return
resultList
;
}
}
public
BizAgentApplicationMallDto
update
(
BizAgentApplicationMallDto
dto
)
throws
Exception
{
public
BizAgentApplicationMallDto
update
(
BizAgentApplicationMallDto
dto
)
throws
Exception
{
Assert
.
notNull
(
dto
);
Assert
.
notNull
(
dto
);
BizAgentApplicationMallEntity
entity
=
BizAgentApplicationMallConvert
.
dtoToEntity
(
dto
);
BizAgentApplicationMallEntity
entity
=
BizAgentApplicationMallConvert
.
dtoToEntity
(
dto
);
return
BizAgentApplicationMallConvert
.
entityToDto
(
bizAgentApplicationMallService
.
update
(
entity
));
return
BizAgentApplicationMallConvert
.
entityToDto
(
bizAgentApplicationMallService
.
update
(
entity
));
}
}
public
void
deletedById
(
java
.
lang
.
Integer
id
)
throws
Exception
{
public
void
deletedById
(
java
.
lang
.
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
Assert
.
notNull
(
id
);
bizAgentApplicationMallService
.
deletedById
(
id
);
bizAgentApplicationMallService
.
deletedById
(
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