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
7b4b313c
Commit
7b4b313c
authored
Aug 22, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 首页名称联想去重
parent
329eb876
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
129 additions
and
90 deletions
+129
-90
ch-dao/src/main/java/com/wwdz/ch/db/dao/KeywordDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/KeywordDao.java
+9
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/KeywordDaoImpl.java
ch-dao/src/main/java/com/wwdz/ch/db/impl/KeywordDaoImpl.java
+23
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
.../main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
+3
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+10
-26
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
+6
-14
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+6
-35
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/KeywordServiceImpl.java
...src/main/java/com/wwdz/ch/wx/impl/KeywordServiceImpl.java
+38
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
...api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
+0
-7
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/KeywordService.java
.../src/main/java/com/wwdz/ch/wx/service/KeywordService.java
+7
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+0
-6
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxKeywordController.java
...src/main/java/com/wwdz/ch/wx/web/WxKeywordController.java
+27
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/KeywordDao.java
0 → 100644
View file @
7b4b313c
package
com.wwdz.ch.db.dao
;
import
com.wwdz.ch.db.domain.Keyword
;
import
java.util.List
;
public
interface
KeywordDao
{
List
<
Keyword
>
findList
();
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/KeywordDaoImpl.java
0 → 100644
View file @
7b4b313c
package
com.wwdz.ch.db.impl
;
import
com.wwdz.ch.db.dao.KeywordDao
;
import
com.wwdz.ch.db.domain.Keyword
;
import
com.wwdz.ch.db.domain.KeywordExample
;
import
com.wwdz.ch.db.mapper.KeywordMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
class
KeywordDaoImpl
implements
KeywordDao
{
@Autowired
private
KeywordMapper
keywordMapper
;
@Override
public
List
<
Keyword
>
findList
()
{
KeywordExample
example
=
new
KeywordExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
return
keywordMapper
.
selectByExample
(
example
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
View file @
7b4b313c
...
...
@@ -31,7 +31,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
.
addPathPatterns
(
"/**"
)
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/wx/user/loginByWx"
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
,
"/wx/item/page"
,
"/wx/item/info"
,
"/wx/item/findNames"
,
"/wx/item/recommend"
,
"/wx/favorites/info"
,
"/wx/favorites/itemList"
);
,
"/wx/item/page"
,
"/wx/item/info"
,
"/wx/item/findNames"
,
"/wx/favorites/info"
,
"/wx/favorites/itemList"
,
"/wx/keyword/recommend"
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
7b4b313c
...
...
@@ -447,13 +447,6 @@ public class FavoritesServiceImpl implements FavoritesService {
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"width"
,
"0"
);
homePageMap
.
put
(
"height"
,
"0"
);
if
(
StringUtils
.
isNotBlank
(
item
.
getTopImage
()))
{
if
(
item
.
getTopImage
().
contains
(
"_"
))
{
homePageMap
=
getImageMap
(
item
.
getTopImage
());
homePageMap
.
put
(
"url"
,
item
.
getTopImage
());
homePageMap
.
put
(
"type"
,
2
);
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
item
.
getImages
()))
{
String
[]
image
=
item
.
getImages
().
split
(
";"
);
homePageMap
.
put
(
"url"
,
image
[
0
]);
...
...
@@ -463,7 +456,6 @@ public class FavoritesServiceImpl implements FavoritesService {
homePageMap
.
put
(
"type"
,
2
);
}
}
}
if
(
StringUtils
.
isNotBlank
(
item
.
getVideos
()))
{
String
[]
vedioImage
=
item
.
getVideos
().
split
(
";"
);
if
(
vedioImage
[
0
].
contains
(
","
))
{
...
...
@@ -543,24 +535,16 @@ public class FavoritesServiceImpl implements FavoritesService {
if
(
CollectionUtils
.
isNotEmpty
(
favoritesItemsDtos
))
{
if
(
favoritesItemsDtos
.
size
()
<=
4
)
{
for
(
FavoritesItemsDto
favoritesItemsDto
:
favoritesItemsDtos
)
{
if
(
StringUtils
.
isNotBlank
(
favoritesItemsDto
.
getTopImage
()))
{
images
.
add
(
favoritesItemsDto
.
getTopImage
());
}
else
{
String
[]
image
=
favoritesItemsDto
.
getImages
().
split
(
";"
);
images
.
add
(
image
[
0
]);
}
}
}
else
{
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
if
(
StringUtils
.
isNotBlank
(
favoritesItemsDtos
.
get
(
i
).
getTopImage
()))
{
images
.
add
(
favoritesItemsDtos
.
get
(
i
).
getTopImage
());
}
else
{
String
[]
image
=
favoritesItemsDtos
.
get
(
i
).
getImages
().
split
(
";"
);
images
.
add
(
image
[
0
]);
}
}
}
}
return
images
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
View file @
7b4b313c
...
...
@@ -289,13 +289,6 @@ public class FootPrintServiceImpl implements FootPrintService {
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"width"
,
"0"
);
homePageMap
.
put
(
"height"
,
"0"
);
if
(
StringUtils
.
isNotBlank
(
item
.
getTopImage
()))
{
if
(
item
.
getTopImage
().
contains
(
"_"
))
{
homePageMap
=
getImageMap
(
item
.
getTopImage
());
homePageMap
.
put
(
"url"
,
item
.
getTopImage
());
homePageMap
.
put
(
"type"
,
2
);
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
item
.
getImages
()))
{
String
[]
image
=
item
.
getImages
().
split
(
";"
);
homePageMap
.
put
(
"url"
,
image
[
0
]);
...
...
@@ -305,7 +298,6 @@ public class FootPrintServiceImpl implements FootPrintService {
homePageMap
.
put
(
"type"
,
2
);
}
}
}
if
(
StringUtils
.
isNotBlank
(
item
.
getVideos
()))
{
String
[]
vedioImage
=
item
.
getVideos
().
split
(
";"
);
if
(
vedioImage
[
0
].
contains
(
","
))
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
7b4b313c
...
...
@@ -81,27 +81,6 @@ public class ItemServiceImpl implements ItemService {
}
}
@Override
public
Result
recommend
()
{
try
{
List
<
Map
<
String
,
Object
>>
list
=
favoritesItemsRelationDao
.
findItemIdByCount
();
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
Result
.
success
();
}
Random
random
=
new
Random
();
int
index
=
random
.
nextInt
(
20
);
Long
itemId
=
(
Long
)
list
.
get
(
index
).
get
(
"item_id"
);
Item
item
=
itemDao
.
findDetails
(
itemId
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
item
.
getName
());
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"搜索推荐失败"
,
e
);
return
Result
.
failed
(
"搜索推荐失败"
);
}
}
@Override
public
Result
page
(
ItemRequestDto
dto
)
{
try
{
...
...
@@ -559,13 +538,6 @@ public class ItemServiceImpl implements ItemService {
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"width"
,
"0"
);
homePageMap
.
put
(
"height"
,
"0"
);
if
(
StringUtils
.
isNotBlank
(
es
.
getTopImage
()))
{
if
(
es
.
getTopImage
().
contains
(
"_"
))
{
homePageMap
=
getImageMap
(
es
.
getTopImage
());
homePageMap
.
put
(
"url"
,
es
.
getTopImage
());
homePageMap
.
put
(
"type"
,
2
);
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
es
.
getImages
()))
{
String
[]
image
=
es
.
getImages
().
split
(
";"
);
homePageMap
.
put
(
"url"
,
image
[
0
]);
...
...
@@ -575,7 +547,6 @@ public class ItemServiceImpl implements ItemService {
homePageMap
.
put
(
"type"
,
2
);
}
}
}
if
(
StringUtils
.
isNotBlank
(
es
.
getVideos
()))
{
String
[]
vedioImage
=
es
.
getVideos
().
split
(
";"
);
if
(
vedioImage
[
0
].
contains
(
","
))
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/KeywordServiceImpl.java
0 → 100644
View file @
7b4b313c
package
com.wwdz.ch.wx.impl
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.KeywordDao
;
import
com.wwdz.ch.db.domain.Keyword
;
import
com.wwdz.ch.wx.service.KeywordService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
KeywordServiceImpl
implements
KeywordService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
KeywordServiceImpl
.
class
);
@Autowired
private
KeywordDao
keywordDao
;
@Override
public
Result
recommend
()
{
try
{
List
<
String
>
result
=
new
ArrayList
<>();
List
<
Keyword
>
list
=
keywordDao
.
findList
();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
result
=
list
.
stream
().
map
(
Keyword:
:
getKeyword
).
collect
(
Collectors
.
toList
());
}
logger
.
info
(
"【请求结束】搜索词推荐成功"
);
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询搜索词推荐失败"
,
e
);
return
Result
.
failed
(
"查询搜素词推荐失败"
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
View file @
7b4b313c
...
...
@@ -15,13 +15,6 @@ public interface ItemService {
*/
Result
nameList
(
ItemRequestDto
dto
);
/**
* 搜索用藏品名称推荐
*
* @return
*/
Result
recommend
();
/**
* 藏品分页
*
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/KeywordService.java
0 → 100644
View file @
7b4b313c
package
com.wwdz.ch.wx.service
;
import
com.wwdz.ch.core.type.Result
;
public
interface
KeywordService
{
Result
recommend
();
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
7b4b313c
...
...
@@ -45,12 +45,6 @@ public class WxItemController {
return
itemService
.
nameList
(
dto
);
}
@ApiOperation
(
value
=
"推荐词汇"
)
@PostMapping
(
"/recommend"
)
public
Result
recommend
()
{
return
itemService
.
recommend
();
}
@ApiOperation
(
value
=
"分页查询"
)
@PostMapping
(
"/page"
)
public
Result
page
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxKeywordController.java
0 → 100644
View file @
7b4b313c
package
com.wwdz.ch.wx.web
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.service.KeywordService
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/wx/keyword"
)
public
class
WxKeywordController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxKeywordController
.
class
);
@Autowired
private
KeywordService
keywordService
;
@ApiOperation
(
value
=
"搜索词推荐"
)
@PostMapping
(
"/recommend"
)
public
Result
recommend
()
{
logger
.
info
(
"【请求开始】搜索词推荐"
);
return
keywordService
.
recommend
();
}
}
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