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
1e54f5b1
Commit
1e54f5b1
authored
Aug 24, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
dcb78f84
960658b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
+38
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+38
-4
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
1e54f5b1
...
...
@@ -13,7 +13,6 @@ import com.wwdz.ch.db.bean.EsPageInfo;
import
com.wwdz.ch.db.bean.ItemOfEs
;
import
com.wwdz.ch.db.dao.*
;
import
com.wwdz.ch.db.domain.*
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.db.dto.request.EsSearchRequestDto
;
import
com.wwdz.ch.db.es.ItemEsDao
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
...
...
@@ -71,9 +70,44 @@ public class ItemServiceImpl implements ItemService {
@Override
public
Result
nameList
(
ItemRequestDto
dto
)
{
try
{
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setName
(
dto
.
getName
());
List
<
String
>
names
=
itemDao
.
findNames
(
coinRequestDto
);
List
<
String
>
names
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
dto
.
getName
()))
{
EsSearchRequestDto
esSearchRequestDto
=
new
EsSearchRequestDto
();
esSearchRequestDto
.
setPage
(
1
);
esSearchRequestDto
.
setSize
(
1000
);
esSearchRequestDto
.
setContent
(
dto
.
getName
());
EsPageInfo
esPageInfo
=
itemEsDao
.
findList
(
esSearchRequestDto
);
if
(
Objects
.
nonNull
(
esPageInfo
)
&&
CollectionUtils
.
isNotEmpty
(
esPageInfo
.
getDataList
()))
{
Set
<
String
>
set
=
new
HashSet
<>();
esPageInfo
.
getDataList
().
forEach
(
s
->
{
ItemOfEs
es
=
(
ItemOfEs
)
s
;
String
name
=
es
.
getName
();
// 处理特殊字符
name
=
name
.
replaceAll
(
"\\s*|\r|\n|\t"
,
""
);
name
=
name
.
replaceAll
(
"/P"
,
""
);
if
(
name
.
contains
(
","
))
{
int
index
=
name
.
indexOf
(
","
);
name
=
name
.
substring
(
0
,
index
);
}
// 超过15个字的截取前15个字符
if
(
name
.
length
()
>
15
)
{
name
=
name
.
substring
(
0
,
15
);
}
set
.
add
(
name
);
});
// 取16个名称
if
(
set
.
size
()
<=
16
)
{
names
=
new
ArrayList
<>(
set
);
}
else
{
int
i
=
1
;
Iterator
<
String
>
iterator
=
set
.
iterator
();
while
(
i
<=
16
)
{
names
.
add
(
iterator
.
next
());
i
++;
}
}
}
}
return
Result
.
success
(
names
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询藏品名称联想失败"
,
e
);
...
...
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