Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
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
曲欣亮
shop
Commits
b11a0192
Commit
b11a0192
authored
Oct 14, 2018
by
zhangyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
0dc47a17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
218 additions
and
32 deletions
+218
-32
GoodsController.java
src/main/java/com/egolm/shop/controller/GoodsController.java
+17
-19
GoodsService.java
src/main/java/com/egolm/shop/service/GoodsService.java
+1
-1
GoodsServiceImpl.java
...in/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
+199
-12
SolrGoodsServiceImpl.java
...ava/com/egolm/shop/service/impl/SolrGoodsServiceImpl.java
+1
-0
No files found.
src/main/java/com/egolm/shop/controller/GoodsController.java
View file @
b11a0192
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.GsonUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
import
com.egolm.common.jdbc.Page
;
...
@@ -147,29 +148,26 @@ public class GoodsController {
...
@@ -147,29 +148,26 @@ public class GoodsController {
return
Rjx
.
jsonOk
().
set
(
"list"
,
listMap
).
set
(
"page"
,
page
).
toJson
();
return
Rjx
.
jsonOk
().
set
(
"list"
,
listMap
).
set
(
"page"
,
page
).
toJson
();
}
}
@ApiOperation
(
"统一搜索(
未完成,要弄搜索引擎
)"
)
@ApiOperation
(
"统一搜索(
支持品牌,分类,关键字,仓库等
)"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"orgNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"区域编号"
,
defaultValue
=
"SHBS"
),
@ApiImplicitParam
(
paramType
=
"query"
,
dataType
=
"String"
,
required
=
true
,
value
=
"JSON参数"
,
defaultValue
=
"{\"topCategoryNO\":\"01\",\"upCategoryNO\":\"\",\"categoryID\":[\"\"],\"brandID\":[\"\"],\"agentID\":\"\",\"warehouseNO\":\"\",\"scopeTypeID\":\"1\",\"districtID\":\"\",\"keyword\":\"*\",\"index\":1,\"userNO\":\"00034\",\"shopNO\":\"167728271\"}"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"shopNO"
,
dataType
=
"String"
,
required
=
false
,
value
=
"店铺编号"
,
defaultValue
=
"00029997"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"queryStr"
,
dataType
=
"String"
,
required
=
false
,
value
=
"搜索内容()"
,
defaultValue
=
"%"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"index"
,
dataType
=
"String"
,
required
=
false
,
value
=
"第几页"
,
defaultValue
=
"1"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"limit"
,
dataType
=
"String"
,
required
=
false
,
value
=
"每页数量"
,
defaultValue
=
"20"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"语言"
,
defaultValue
=
"936"
),
})
})
@RequestMapping
(
value
=
"/searchGoods"
,
method
=
RequestMethod
.
GE
T
)
@RequestMapping
(
value
=
"/searchGoods"
,
method
=
RequestMethod
.
POS
T
)
public
String
searchGoods
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
String
searchGoods
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Map
<
String
,
Object
>>
listMap
;
String
reqJson
=
ServletUtil
.
readReqJson
(
request
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
System
.
out
.
println
(
"searchGoods-------"
+
reqJson
);
params
.
put
(
"orgNO"
,
request
.
getParameter
(
"orgNO"
));
Map
<
String
,
Object
>
argsMap
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"shopNO"
,
request
.
getParameter
(
"shopNO"
)==
null
?
""
:
request
.
getParameter
(
"shopNO"
));
try
{
params
.
put
(
"queryStr"
,
request
.
getParameter
(
"queryStr"
)==
null
?
"%"
:
request
.
getParameter
(
"queryStr"
));
argsMap
=
GsonUtil
.
toMap
(
reqJson
);
Page
page
=
new
Page
();
if
(!
argsMap
.
containsKey
(
"index"
)
||
!
argsMap
.
containsKey
(
"limit"
)
||
!
argsMap
.
containsKey
(
"userNO"
)
||
!
argsMap
.
containsKey
(
"shopNO"
)
||
!
argsMap
.
containsKey
(
"orgNO"
))
{
page
.
setIndex
(
Long
.
valueOf
(
request
.
getParameter
(
"index"
)==
null
?
"1"
:
request
.
getParameter
(
"index"
)));
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"参数缺失"
).
set
(
"errorMsg"
,
"index,limit,userNO,shopNO,orgNO为必填项"
).
toJson
();
page
.
setLimit
(
Long
.
valueOf
(
request
.
getParameter
(
"limit"
)==
null
?
"10"
:
request
.
getParameter
(
"limit"
)));
}
page
.
setLimitKey
(
"GoodsID desc"
);
}
catch
(
Exception
e
)
{
listMap
=
goodsService
.
GetCategoryGoods
(
params
,
page
);
e
.
printStackTrace
();
return
Rjx
.
jsonOk
().
set
(
"list"
,
listMap
).
set
(
"page"
,
page
).
toJson
();
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"查询参数格式错误"
).
toJson
();
}
return
goodsService
.
searchGoods
(
argsMap
);
}
}
...
...
src/main/java/com/egolm/shop/service/GoodsService.java
View file @
b11a0192
...
@@ -14,7 +14,7 @@ public interface GoodsService {
...
@@ -14,7 +14,7 @@ public interface GoodsService {
public
List
<
Map
<
String
,
Object
>>
GetCategoryGoods
(
Map
<
String
,
Object
>
map
,
Page
page
);
public
List
<
Map
<
String
,
Object
>>
GetCategoryGoods
(
Map
<
String
,
Object
>
map
,
Page
page
);
List
<
Map
<
String
,
Object
>>
searchGoods
(
Map
<
String
,
Object
>
map
,
Page
page
);
String
searchGoods
(
Map
<
String
,
Object
>
map
);
List
<
Map
<
String
,
Object
>>
hotSearchKey
(
Map
<
String
,
Object
>
map
,
Page
page
);
List
<
Map
<
String
,
Object
>>
hotSearchKey
(
Map
<
String
,
Object
>
map
,
Page
page
);
...
...
src/main/java/com/egolm/shop/service/impl/GoodsServiceImpl.java
View file @
b11a0192
This diff is collapsed.
Click to expand it.
src/main/java/com/egolm/shop/service/impl/SolrGoodsServiceImpl.java
View file @
b11a0192
...
@@ -67,6 +67,7 @@ public class SolrGoodsServiceImpl implements SolrGoodsService {
...
@@ -67,6 +67,7 @@ public class SolrGoodsServiceImpl implements SolrGoodsService {
String
[]
limitKeys
=
page
.
getLimitKey
();
String
[]
limitKeys
=
page
.
getLimitKey
();
if
(
limitKeys
!=
null
)
{
if
(
limitKeys
!=
null
)
{
for
(
String
key
:
limitKeys
)
{
for
(
String
key
:
limitKeys
)
{
System
.
out
.
println
(
"key---"
+
key
);
String
[]
kv
=
key
.
split
(
" "
,
2
);
String
[]
kv
=
key
.
split
(
" "
,
2
);
ORDER
sc
=
kv
[
1
]
==
null
||
kv
[
1
].
trim
().
length
()
==
0
||
kv
[
1
].
equalsIgnoreCase
(
"asc"
)
?
ORDER
.
asc
:
ORDER
.
desc
;
ORDER
sc
=
kv
[
1
]
==
null
||
kv
[
1
].
trim
().
length
()
==
0
||
kv
[
1
].
equalsIgnoreCase
(
"asc"
)
?
ORDER
.
asc
:
ORDER
.
desc
;
solrQuery
.
addSort
(
kv
[
0
],
sc
);
solrQuery
.
addSort
(
kv
[
0
],
sc
);
...
...
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