Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-webapp-plug
Overview
Overview
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
base_platform_enterprise
gic-webapp-plug
Commits
29f2c09b
Commit
29f2c09b
authored
Sep 19, 2019
by
xub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spu搜索
parent
7321f3e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
GoodsController.java
...va/com/gic/plug/web/controller/goods/GoodsController.java
+13
-9
No files found.
src/main/java/com/gic/plug/web/controller/goods/GoodsController.java
View file @
29f2c09b
...
...
@@ -7,9 +7,11 @@ import com.gic.commons.webapi.reponse.RestResponse;
import
com.gic.goods.api.dto.GoodsSkuDTO
;
import
com.gic.goods.api.service.GoodsApiService
;
import
com.gic.plug.web.vo.goods.GoodsVO
;
import
com.gic.search.business.api.constant.enums.OperateEnum
;
import
com.gic.search.business.api.dto.DynamicSearchDTO
;
import
com.gic.search.business.api.dto.ESResponseQueryBatchDTO
;
import
com.gic.search.business.api.service.EsBusinessOperaApiService
;
import
com.gic.search.business.api.utils.QueryConditionAssemblyUtil
;
import
com.gic.widget.screening.api.service.EsScreeningSearchService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.curator.shaded.com.google.common.collect.Lists
;
...
...
@@ -47,8 +49,8 @@ public class GoodsController {
*/
@GetMapping
(
"list-goods"
)
public
RestResponse
ListGoods
(
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"1"
)
Integer
currentPage
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
pageSize
,
Long
goodsDomainId
,
String
search
)
{
ServiceResponse
<
ESResponseQueryBatchDTO
>
serviceResponse
=
searchES
(
currentPage
,
pageSize
,
goodsDomainId
,
search
);
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
pageSize
,
Long
goodsDomainId
,
String
search
,
String
channelCode
)
{
ServiceResponse
<
ESResponseQueryBatchDTO
>
serviceResponse
=
searchES
(
currentPage
,
pageSize
,
goodsDomainId
,
search
,
channelCode
);
if
(
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
success
(
serviceResponse
.
getResult
());
}
...
...
@@ -62,8 +64,8 @@ public class GoodsController {
*/
@GetMapping
(
"list-sku"
)
public
RestResponse
ListSku
(
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"1"
)
Integer
currentPage
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
pageSize
,
Long
goodsDomainId
,
String
search
)
{
ServiceResponse
<
ESResponseQueryBatchDTO
>
serviceResponse
=
searchES
(
currentPage
,
pageSize
,
goodsDomainId
,
search
);
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
pageSize
,
Long
goodsDomainId
,
String
search
,
String
channelCode
)
{
ServiceResponse
<
ESResponseQueryBatchDTO
>
serviceResponse
=
searchES
(
currentPage
,
pageSize
,
goodsDomainId
,
search
,
channelCode
);
if
(!
serviceResponse
.
isSuccess
())
{
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
...
...
@@ -102,7 +104,7 @@ public class GoodsController {
}
private
ServiceResponse
<
ESResponseQueryBatchDTO
>
searchES
(
Integer
currentPage
,
Integer
pageSize
,
Long
goodsDomainId
,
String
search
)
{
private
ServiceResponse
<
ESResponseQueryBatchDTO
>
searchES
(
Integer
currentPage
,
Integer
pageSize
,
Long
goodsDomainId
,
String
search
,
String
channelCode
)
{
DynamicSearchDTO
searchDTO
=
new
DynamicSearchDTO
();
String
esName
=
esScreeningSearchService
.
getCurrentEsName
(
"goods-test-123456"
,
"goods-search"
);
searchDTO
.
setIndexName
(
esName
);
...
...
@@ -111,10 +113,12 @@ public class GoodsController {
searchDTO
.
setType
(
"mapper_type"
);
searchDTO
.
setBegin
(
currentPage
);
searchDTO
.
setRecordNumber
(
pageSize
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"goodsCode"
,
search
);
jsonObject
.
put
(
"goodsDomainId"
,
goodsDomainId
);
searchDTO
.
setSearchJson
(
jsonObject
);
JSONObject
goodsCodeJson
=
QueryConditionAssemblyUtil
.
createSimpleQueryNode
(
"goodsCode"
,
OperateEnum
.
OPERATE_LIKE
,
search
);
JSONObject
goodsNameJson
=
QueryConditionAssemblyUtil
.
createSimpleQueryNode
(
"goodsName"
,
OperateEnum
.
OPERATE_LIKE
,
search
);
JSONObject
goodsDomainIdJson
=
QueryConditionAssemblyUtil
.
createSimpleQueryNode
(
"channelCodeDomainId"
,
OperateEnum
.
OPERATE_EQ
,
channelCode
+
"-"
+
goodsDomainId
);
JSONObject
nameAndCodeJson
=
QueryConditionAssemblyUtil
.
addQueryNodeForSiblin
(
goodsCodeJson
,
goodsNameJson
,
OperateEnum
.
OPERATE_OR
);
JSONObject
json
=
QueryConditionAssemblyUtil
.
addQueryNodeForSiblin
(
nameAndCodeJson
,
goodsDomainIdJson
,
OperateEnum
.
OPERATE_AND
);
searchDTO
.
setSearchJson
(
json
);
ServiceResponse
<
ESResponseQueryBatchDTO
>
serviceResponse
=
esBusinessOperaApiService
.
queryDataBatch
(
searchDTO
,
false
,
null
);
return
serviceResponse
;
}
...
...
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