Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
bom_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
28618b14
authored
Jun 10, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Plain Diff
fix conflict
parents
ddf63ad0
fed36481
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
cmd/queue/bom.go
internal/logic/match.go
cmd/queue/bom.go
View file @
28618b14
...
@@ -14,6 +14,7 @@ type RecvPro struct {
...
@@ -14,6 +14,7 @@ type RecvPro struct {
}
}
func
init
()
{
func
init
()
{
<<<<<<<
HEAD
queueExchange
:=
rabbitmq
.
QueueExchange
{
queueExchange
:=
rabbitmq
.
QueueExchange
{
"bom_match"
,
"bom_match"
,
"bom_match"
,
"bom_match"
,
...
...
internal/logic/match.go
View file @
28618b14
...
@@ -220,6 +220,7 @@ func removeZiyingMatchBomItem(ziyingGoodsMapList []GoodsMap, bomItems []model.Bo
...
@@ -220,6 +220,7 @@ func removeZiyingMatchBomItem(ziyingGoodsMapList []GoodsMap, bomItems []model.Bo
func
search
(
index
string
,
bomId
int
,
bomItems
[]
model
.
BomItem
,
deliveryType
,
sort
int
,
client
*
es
.
Client
,
rawSearch
bool
)
(
goodsMapList
[]
GoodsMap
,
err
error
)
{
func
search
(
index
string
,
bomId
int
,
bomItems
[]
model
.
BomItem
,
deliveryType
,
sort
int
,
client
*
es
.
Client
,
rawSearch
bool
)
(
goodsMapList
[]
GoodsMap
,
err
error
)
{
//先去自营查一遍
//先去自营查一遍
search
:=
client
.
MultiSearch
()
.
Index
(
index
)
search
:=
client
.
MultiSearch
()
.
Index
(
index
)
searchFlag
:=
false
//多重搜索,第一次先去精确匹配
//多重搜索,第一次先去精确匹配
for
_
,
bom
:=
range
bomItems
{
for
_
,
bom
:=
range
bomItems
{
//如果是模糊查询,还要去截取字符串
//如果是模糊查询,还要去截取字符串
...
@@ -232,9 +233,14 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor
...
@@ -232,9 +233,14 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor
}
}
//构建一个goods_name对应的bomItems列表
//构建一个goods_name对应的bomItems列表
searchRequest
:=
getSearchParams
(
index
,
bom
.
GoodsName
,
bom
.
BrandName
,
sort
,
bom
.
Number
,
rawSearch
)
searchRequest
:=
getSearchParams
(
index
,
bom
.
GoodsName
,
bom
.
BrandName
,
sort
,
bom
.
Number
,
rawSearch
)
searchFlag
=
true
search
.
Add
(
searchRequest
)
search
.
Add
(
searchRequest
)
}
}
//:todo 这里有bug
//没有搜索条件的话,直接返回空值即可
if
!
searchFlag
{
return
nil
,
err
}
res
,
err
:=
search
.
Do
(
context
.
Background
())
res
,
err
:=
search
.
Do
(
context
.
Background
())
if
err
!=
nil
{
if
err
!=
nil
{
return
return
...
@@ -320,6 +326,11 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es
...
@@ -320,6 +326,11 @@ func getTermQuery(goodsName, brandName string, number int, flag bool) (query *es
field
:=
"auto_goods_name"
field
:=
"auto_goods_name"
query
=
query
.
Must
(
es
.
NewTermQuery
(
field
,
goodsName
))
query
=
query
.
Must
(
es
.
NewTermQuery
(
field
,
goodsName
))
}
}
<<<<<<<
HEAD
=======
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//query = query.Filter(es.NewRangeQuery("stock").Gt(0))
>>>>>>>
ysx
-
修复数据
-
20200609
query
=
query
.
Filter
(
es
.
NewTermQuery
(
"status"
,
1
))
query
=
query
.
Filter
(
es
.
NewTermQuery
(
"status"
,
1
))
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
//src, err := query.Source()
//src, err := query.Source()
...
...
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