Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
90bff1e4
Commit
90bff1e4
authored
Aug 18, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 藏品被删除后的展示问题
parent
d4225270
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
147 additions
and
7 deletions
+147
-7
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
+4
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
...ao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
+12
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/CategoryRequestDto.java
...ava/com/wwdz/ch/wx/entity/request/CategoryRequestDto.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/CategoryResponseVo.java
...ain/java/com/wwdz/ch/wx/entity/vo/CategoryResponseVo.java
+15
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
...rc/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
+74
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+10
-7
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
+24
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/CategoryService.java
...src/main/java/com/wwdz/ch/wx/service/CategoryService.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
...rc/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
+6
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
View file @
90bff1e4
...
@@ -7,10 +7,14 @@ public interface CategoryDao {
...
@@ -7,10 +7,14 @@ public interface CategoryDao {
List
<
Category
>
queryByLevel
(
Integer
level
,
Integer
offset
,
Integer
limit
);
List
<
Category
>
queryByLevel
(
Integer
level
,
Integer
offset
,
Integer
limit
);
List
<
Category
>
listByLevel
(
Integer
level
);
List
<
Category
>
queryByPid
(
Integer
pid
);
List
<
Category
>
queryByPid
(
Integer
pid
);
Category
findById
(
Integer
id
);
Category
findById
(
Integer
id
);
Category
findByName
(
String
name
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
int
updateById
(
Category
category
);
int
updateById
(
Category
category
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
View file @
90bff1e4
...
@@ -36,6 +36,12 @@ public class CategoryDaoImpl implements CategoryDao {
...
@@ -36,6 +36,12 @@ public class CategoryDaoImpl implements CategoryDao {
return
categoryMapper
.
selectByExample
(
example
);
return
categoryMapper
.
selectByExample
(
example
);
}
}
public
List
<
Category
>
listByLevel
(
Integer
level
)
{
CategoryExample
example
=
new
CategoryExample
();
example
.
or
().
andLevelEqualTo
(
level
).
andIsDeletedEqualTo
(
false
);
return
categoryMapper
.
selectByExample
(
example
);
}
public
List
<
Category
>
queryByPid
(
Integer
pid
)
{
public
List
<
Category
>
queryByPid
(
Integer
pid
)
{
CategoryExample
example
=
new
CategoryExample
();
CategoryExample
example
=
new
CategoryExample
();
example
.
or
().
andPidEqualTo
(
pid
).
andIsDeletedEqualTo
(
false
);
example
.
or
().
andPidEqualTo
(
pid
).
andIsDeletedEqualTo
(
false
);
...
@@ -46,6 +52,12 @@ public class CategoryDaoImpl implements CategoryDao {
...
@@ -46,6 +52,12 @@ public class CategoryDaoImpl implements CategoryDao {
return
categoryMapper
.
selectByPrimaryKey
(
id
);
return
categoryMapper
.
selectByPrimaryKey
(
id
);
}
}
public
Category
findByName
(
String
name
)
{
CategoryExample
example
=
new
CategoryExample
();
example
.
or
().
andNameEqualTo
(
name
).
andIsDeletedEqualTo
(
false
);
return
categoryMapper
.
selectOneByExample
(
example
);
}
public
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
public
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
)
{
String
order
)
{
CategoryExample
example
=
new
CategoryExample
();
CategoryExample
example
=
new
CategoryExample
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/CategoryRequestDto.java
View file @
90bff1e4
...
@@ -9,4 +9,5 @@ public class CategoryRequestDto implements Entity {
...
@@ -9,4 +9,5 @@ public class CategoryRequestDto implements Entity {
private
Integer
level
;
private
Integer
level
;
private
Integer
page
;
private
Integer
page
;
private
Integer
size
;
private
Integer
size
;
private
String
name
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/CategoryResponseVo.java
0 → 100644
View file @
90bff1e4
package
com.wwdz.ch.wx.entity.vo
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
CategoryResponseVo
implements
Entity
{
private
Integer
cid
;
private
Integer
pid
;
private
String
categoryName
;
private
List
<
CategoryResponseVo
>
child
;
private
Integer
isChosen
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
View file @
90bff1e4
package
com.wwdz.ch.wx.impl
;
package
com.wwdz.ch.wx.impl
;
import
com.google.common.collect.Lists
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.CategoryDao
;
import
com.wwdz.ch.db.dao.CategoryDao
;
import
com.wwdz.ch.db.domain.Category
;
import
com.wwdz.ch.wx.entity.request.CategoryRequestDto
;
import
com.wwdz.ch.wx.entity.request.CategoryRequestDto
;
import
com.wwdz.ch.wx.entity.vo.CategoryResponseVo
;
import
com.wwdz.ch.wx.service.CategoryService
;
import
com.wwdz.ch.wx.service.CategoryService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
CategoryServiceImpl
implements
CategoryService
{
public
class
CategoryServiceImpl
implements
CategoryService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CategoryServiceImpl
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CategoryServiceImpl
.
class
);
...
@@ -36,4 +44,70 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -36,4 +44,70 @@ public class CategoryServiceImpl implements CategoryService {
return
Result
.
failed
(
"查询子类目失败"
);
return
Result
.
failed
(
"查询子类目失败"
);
}
}
}
}
@Override
public
Result
find
(
CategoryRequestDto
dto
)
{
if
(
StringUtils
.
isBlank
(
dto
.
getName
()))
{
return
Result
.
success
(
new
ArrayList
<>());
}
try
{
Category
category
=
categoryDao
.
findByName
(
dto
.
getName
());
if
(
Objects
.
isNull
(
category
))
{
return
Result
.
success
(
new
ArrayList
<>());
}
List
<
Category
>
categoryList
=
new
ArrayList
<>();
categoryList
.
add
(
category
);
int
i
=
category
.
getLevel
()
-
1
;
while
(
i
>
0
)
{
categoryList
.
addAll
(
categoryDao
.
listByLevel
(
i
));
i
--;
}
List
<
CategoryResponseVo
>
responseVoList
=
categoryList
.
stream
()
.
map
(
this
::
toCategotyResongseVo
).
collect
(
Collectors
.
toList
());
for
(
CategoryResponseVo
vo
:
responseVoList
)
{
if
(
vo
.
getCid
().
equals
(
category
.
getId
()))
{
vo
.
setIsChosen
(
1
);
}
}
return
Result
.
success
(
convertVoList
(
responseVoList
));
}
catch
(
Exception
e
)
{
return
null
;
}
}
public
List
<
CategoryResponseVo
>
convertVoList
(
List
<
CategoryResponseVo
>
voList
)
{
Map
<
Integer
,
CategoryResponseVo
>
menuMap
=
new
HashMap
<>();
CategoryResponseVo
root
=
new
CategoryResponseVo
();
root
.
setChild
(
Lists
.
newArrayList
());
root
.
setCid
(
0
);
menuMap
.
put
(
0
,
root
);
if
(
CollectionUtils
.
isNotEmpty
(
voList
))
{
for
(
CategoryResponseVo
vo
:
voList
)
{
menuMap
.
put
(
vo
.
getCid
(),
vo
);
}
for
(
CategoryResponseVo
vo
:
voList
)
{
if
(
Objects
.
isNull
(
vo
))
{
continue
;
}
CategoryResponseVo
parentVo
=
menuMap
.
get
(
vo
.
getPid
());
if
(
Objects
.
isNull
(
parentVo
))
{
continue
;
}
if
(
CollectionUtils
.
isEmpty
(
parentVo
.
getChild
()))
{
parentVo
.
setChild
(
Lists
.
newArrayList
());
}
parentVo
.
getChild
().
add
(
vo
);
}
}
return
root
.
getChild
();
}
private
CategoryResponseVo
toCategotyResongseVo
(
Category
category
)
{
CategoryResponseVo
vo
=
new
CategoryResponseVo
();
vo
.
setCid
(
category
.
getId
());
vo
.
setPid
(
category
.
getPid
());
vo
.
setCategoryName
(
category
.
getName
());
vo
.
setIsChosen
(
0
);
return
vo
;
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
90bff1e4
...
@@ -100,7 +100,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -100,7 +100,7 @@ public class FavoritesServiceImpl implements FavoritesService {
coinRequestDto
.
setIds
(
favoritesItemsRelations
.
stream
()
coinRequestDto
.
setIds
(
favoritesItemsRelations
.
stream
()
.
map
(
FavoritesItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
()));
.
map
(
FavoritesItemsRelation:
:
getItemId
).
collect
(
Collectors
.
toList
()));
List
<
Item
>
items
=
itemDao
.
findListWithImages
(
coinRequestDto
);
List
<
Item
>
items
=
itemDao
.
findListWithImages
(
coinRequestDto
);
items
=
items
.
stream
().
filter
(
s
->
StringUtils
.
isNotBlank
(
s
.
getImages
())).
collect
(
Collectors
.
toList
());
items
=
items
.
stream
().
filter
(
s
->
!
s
.
getIsDeleted
()).
filter
(
s
->
StringUtils
.
isNotBlank
(
s
.
getImages
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
items
))
{
if
(
CollectionUtils
.
isNotEmpty
(
items
))
{
List
<
String
>
images
=
new
ArrayList
<>();
List
<
String
>
images
=
new
ArrayList
<>();
if
(
items
.
size
()
<=
4
)
{
if
(
items
.
size
()
<=
4
)
{
...
@@ -275,10 +275,17 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -275,10 +275,17 @@ public class FavoritesServiceImpl implements FavoritesService {
}
}
List
<
AgentTranceResponseVo
>
list
=
new
ArrayList
<>();
List
<
AgentTranceResponseVo
>
list
=
new
ArrayList
<>();
for
(
FavoritesItemsRelation
relation
:
relationPage
.
getList
())
{
for
(
FavoritesItemsRelation
relation
:
relationPage
.
getList
())
{
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setViewType
(
2
);
ItemResponseVo
vo
=
new
ItemResponseVo
();
ItemResponseVo
vo
=
new
ItemResponseVo
();
Item
item
=
itemDao
.
findById
(
relation
.
getItemId
());
Item
item
=
itemDao
.
findById
(
relation
.
getItemId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
vo
.
setId
(
relation
.
getItemId
());
vo
.
setIsDeleted
(
1
);
vo
.
setIsDeleted
(
1
);
agentTranceResponseVo
.
setDetail
(
vo
);
list
.
add
(
agentTranceResponseVo
);
continue
;
continue
;
}
}
vo
.
setIsDeleted
(
0
);
vo
.
setIsDeleted
(
0
);
...
@@ -330,10 +337,6 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -330,10 +337,6 @@ public class FavoritesServiceImpl implements FavoritesService {
}
}
}
}
vo
.
setHomePageImage
(
homePageMap
);
vo
.
setHomePageImage
(
homePageMap
);
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setViewType
(
2
);
agentTranceResponseVo
.
setDetail
(
vo
);
agentTranceResponseVo
.
setDetail
(
vo
);
list
.
add
(
agentTranceResponseVo
);
list
.
add
(
agentTranceResponseVo
);
}
}
...
@@ -408,10 +411,10 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -408,10 +411,10 @@ public class FavoritesServiceImpl implements FavoritesService {
try
{
try
{
Favorites
favorites
=
favoritesDao
.
info
(
dto
.
getFavoritesId
());
Favorites
favorites
=
favoritesDao
.
info
(
dto
.
getFavoritesId
());
if
(
Objects
.
isNull
(
favorites
))
{
if
(
Objects
.
isNull
(
favorites
))
{
Result
.
failed
(
"数据异常,收藏册不存在"
);
return
Result
.
failed
(
"数据异常,收藏册不存在"
);
}
}
if
(
favoritesItemsRelationDao
.
isCollected
(
favorites
.
getUserId
(),
dto
.
getId
()))
{
if
(
favoritesItemsRelationDao
.
isCollected
(
favorites
.
getUserId
(),
dto
.
getId
()))
{
Result
.
failed
(
"您已经收藏过该藏品"
);
return
Result
.
failed
(
"您已经收藏过该藏品"
);
}
}
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
FavoritesItemsRelation
favoritesItemsRelation
=
new
FavoritesItemsRelation
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
View file @
90bff1e4
...
@@ -73,6 +73,18 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -73,6 +73,18 @@ public class FootPrintServiceImpl implements FootPrintService {
Item
item
=
itemDao
.
findById
(
footprint
.
getItemId
());
Item
item
=
itemDao
.
findById
(
footprint
.
getItemId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
itemResponseVo
.
setIsDeleted
(
1
);
itemResponseVo
.
setIsDeleted
(
1
);
if
(
footprint
.
getAddTime
().
compareTo
(
today
)
>=
0
)
{
todayList
.
add
(
itemResponseVo
);
}
if
(
footprint
.
getAddTime
().
compareTo
(
yesterday
)
>=
0
&&
footprint
.
getAddTime
().
compareTo
(
today
)
<=
0
)
{
yesterdayList
.
add
(
itemResponseVo
);
}
if
(
footprint
.
getAddTime
().
compareTo
(
week
)
>=
0
&&
footprint
.
getAddTime
().
compareTo
(
yesterday
)
<=
0
)
{
weekList
.
add
(
itemResponseVo
);
}
if
(
footprint
.
getAddTime
().
compareTo
(
month
)
>=
0
&&
footprint
.
getAddTime
().
compareTo
(
week
)
<=
0
)
{
monthList
.
add
(
itemResponseVo
);
}
continue
;
continue
;
}
}
itemResponseVo
.
setIsDeleted
(
0
);
itemResponseVo
.
setIsDeleted
(
0
);
...
@@ -207,6 +219,18 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -207,6 +219,18 @@ public class FootPrintServiceImpl implements FootPrintService {
Item
item
=
itemDao
.
findById
(
footprint
.
getItemId
());
Item
item
=
itemDao
.
findById
(
footprint
.
getItemId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
itemResponseVo
.
setIsDeleted
(
1
);
itemResponseVo
.
setIsDeleted
(
1
);
if
(
footprint
.
getAddTime
().
compareTo
(
today
)
>=
0
)
{
todayList
.
add
(
itemResponseVo
);
}
if
(
footprint
.
getAddTime
().
compareTo
(
yesterday
)
>=
0
&&
footprint
.
getAddTime
().
compareTo
(
today
)
<=
0
)
{
yesterdayList
.
add
(
itemResponseVo
);
}
if
(
footprint
.
getAddTime
().
compareTo
(
week
)
>=
0
&&
footprint
.
getAddTime
().
compareTo
(
yesterday
)
<=
0
)
{
weekList
.
add
(
itemResponseVo
);
}
if
(
footprint
.
getAddTime
().
compareTo
(
month
)
>=
0
&&
footprint
.
getAddTime
().
compareTo
(
week
)
<=
0
)
{
monthList
.
add
(
itemResponseVo
);
}
continue
;
continue
;
}
}
itemResponseVo
.
setIsDeleted
(
0
);
itemResponseVo
.
setIsDeleted
(
0
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/CategoryService.java
View file @
90bff1e4
...
@@ -6,4 +6,5 @@ import com.wwdz.ch.wx.entity.request.CategoryRequestDto;
...
@@ -6,4 +6,5 @@ import com.wwdz.ch.wx.entity.request.CategoryRequestDto;
public
interface
CategoryService
{
public
interface
CategoryService
{
Result
top
(
CategoryRequestDto
dto
);
Result
top
(
CategoryRequestDto
dto
);
Result
child
(
CategoryRequestDto
dto
);
Result
child
(
CategoryRequestDto
dto
);
Result
find
(
CategoryRequestDto
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
View file @
90bff1e4
...
@@ -62,4 +62,10 @@ public class WxCategoryController {
...
@@ -62,4 +62,10 @@ public class WxCategoryController {
dto
.
setId
(
Integer
.
parseInt
(
id
));
dto
.
setId
(
Integer
.
parseInt
(
id
));
return
categoryService
.
child
(
dto
);
return
categoryService
.
child
(
dto
);
}
}
@ApiOperation
(
value
=
"名称查询"
)
@PostMapping
(
value
=
"/find"
)
public
Result
find
(
@RequestBody
CategoryRequestDto
dto
)
{
return
categoryService
.
find
(
dto
);
}
}
}
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