Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_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
b47b2d33
authored
Jul 16, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改配置名称
parent
525c9513
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
10 deletions
conf/search.ini
controller/get_data_controller.go
controller/quote_controller.go
requests/quote_request.go
service/query/quote_query.go
conf/search.ini
View file @
b47b2d33
[
supplier_all
]
[
SUPPLIER_ALL
]
1
=
future
1
=
future
2
=
powerandsignal
2
=
powerandsignal
3
=
rochester
3
=
rochester
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
21
=
rs
21
=
rs
1676
=
buerklin
1676
=
buerklin
[
search_supplier_merge
]
[
SEARCH_SUPPLIER_MERGE
]
17
=
zhuanmai
17
=
zhuanmai
1
=
future
1
=
future
3
=
rochester
3
=
rochester
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
20
=
powell
20
=
powell
21
=
rs
21
=
rs
#相似物料供应商
#相似物料供应商
[
alike_supplier
]
[
ALIKE_SUPPLIER
]
1
=
ti
1
=
ti
[common]
[common]
...
...
controller/get_data_controller.go
View file @
b47b2d33
...
@@ -27,8 +27,8 @@ func GetDataIndex(c *gin.Context) {
...
@@ -27,8 +27,8 @@ func GetDataIndex(c *gin.Context) {
r
.
Stock
=
r
.
KNums
r
.
Stock
=
r
.
KNums
}
}
//获取所有合并供应商列表
//获取所有合并供应商列表
supplierList
:=
config
.
GetSectionValues
(
"
search_supplier_merge
"
)
supplierList
:=
config
.
GetSectionValues
(
"
SEARCH_SUPPLIER_MERGE
"
)
supplierName
:=
config
.
Get
(
"
supplier_all
."
+
r
.
SupplierId
)
.
String
()
supplierName
:=
config
.
Get
(
"
SUPPLIER_ALL
."
+
r
.
SupplierId
)
.
String
()
if
supplierName
==
""
&&
r
.
IsSort
!=
2
{
if
supplierName
==
""
&&
r
.
IsSort
!=
2
{
c
.
JSON
(
200
,
common
.
ErrorResponse
(
1
,
"供应商id有误"
))
c
.
JSON
(
200
,
common
.
ErrorResponse
(
1
,
"供应商id有误"
))
return
return
...
@@ -82,7 +82,7 @@ func getDataQueryStr(r requests.GetDataIndexRequest, supplierList []string) stri
...
@@ -82,7 +82,7 @@ func getDataQueryStr(r requests.GetDataIndexRequest, supplierList []string) stri
//类似物料搜索的组装查询条件
//类似物料搜索的组装查询条件
alikeQuery
,
_
:=
getDataService
.
GetQuery
(
r
.
Keyword
,
"alike"
,
""
,
r
.
GoodsNameEq
,
r
.
Stock
)
alikeQuery
,
_
:=
getDataService
.
GetQuery
(
r
.
Keyword
,
"alike"
,
""
,
r
.
GoodsNameEq
,
r
.
Stock
)
//类似物料供应商列表
//类似物料供应商列表
alikeSuppliers
:=
config
.
GetSectionValues
(
"
alike_supplier
"
)
alikeSuppliers
:=
config
.
GetSectionValues
(
"
ALIKE_SUPPLIER
"
)
//构建msearch搜索json
//构建msearch搜索json
var
queryStr
string
var
queryStr
string
for
_
,
supplierName
:=
range
supplierList
{
for
_
,
supplierName
:=
range
supplierList
{
...
...
controller/quote_controller.go
View file @
b47b2d33
...
@@ -41,7 +41,7 @@ func QuoteIndex(c *gin.Context) {
...
@@ -41,7 +41,7 @@ func QuoteIndex(c *gin.Context) {
return
return
}
}
//获取供应商名称
//获取供应商名称
supplierNameMap
:=
config
.
Cfg
.
Section
(
"
supplier_all
"
)
.
KeysHash
()
supplierNameMap
:=
config
.
Cfg
.
Section
(
"
SUPPLIER_ALL
"
)
.
KeysHash
()
supplierName
,
exist
:=
supplierNameMap
[
r
.
SupplierId
]
supplierName
,
exist
:=
supplierNameMap
[
r
.
SupplierId
]
if
!
exist
{
if
!
exist
{
c
.
JSON
(
200
,
common
.
ErrorResponse
(
1
,
"供应商有误"
))
c
.
JSON
(
200
,
common
.
ErrorResponse
(
1
,
"供应商有误"
))
...
...
requests/quote_request.go
View file @
b47b2d33
...
@@ -28,7 +28,7 @@ func CheckQuoteRequest(r QuoteIndexRequest) (errCode int, errMsg string) {
...
@@ -28,7 +28,7 @@ func CheckQuoteRequest(r QuoteIndexRequest) (errCode int, errMsg string) {
return
1
,
"缺少参数"
return
1
,
"缺少参数"
}
}
//判断供应商
//判断供应商
if
config
.
Get
(
"
supplier_all
."
+
r
.
SupplierId
)
.
String
()
==
""
{
if
config
.
Get
(
"
SUPPLIER_ALL
."
+
r
.
SupplierId
)
.
String
()
==
""
{
return
1
,
"供应商id有误"
return
1
,
"供应商id有误"
}
}
return
return
...
...
service/query/quote_query.go
View file @
b47b2d33
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
)
)
func
GetSupplierIndex
(
supplierId
string
)
(
supplierIndex
string
)
{
func
GetSupplierIndex
(
supplierId
string
)
(
supplierIndex
string
)
{
supplierIndexMap
:=
config
.
Cfg
.
Section
(
"
supplier_all
"
)
.
KeysHash
()
supplierIndexMap
:=
config
.
Cfg
.
Section
(
"
SUPPLIER_ALL
"
)
.
KeysHash
()
if
index
,
exist
:=
supplierIndexMap
[
supplierId
];
exist
{
if
index
,
exist
:=
supplierIndexMap
[
supplierId
];
exist
{
return
index
return
index
}
}
...
@@ -214,7 +214,7 @@ func GetGoodsBySupplierIdQuery(r requests.GetGoodsBySupplierRequest) (string, er
...
@@ -214,7 +214,7 @@ func GetGoodsBySupplierIdQuery(r requests.GetGoodsBySupplierRequest) (string, er
//判断是否存在类似物料搜索
//判断是否存在类似物料搜索
supplierIndexName
:=
GetSupplierIndex
(
r
.
SupplierId
)
supplierIndexName
:=
GetSupplierIndex
(
r
.
SupplierId
)
//获取相似物料供应商列表
//获取相似物料供应商列表
alikeSuppliers
:=
config
.
Cfg
.
Section
(
"
alike_supplier
"
)
.
KeyStrings
()
alikeSuppliers
:=
config
.
Cfg
.
Section
(
"
ALIKE_SUPPLIER
"
)
.
KeyStrings
()
if
php2go
.
InArray
(
supplierIndexName
,
alikeSuppliers
)
&&
keyword
!=
""
{
if
php2go
.
InArray
(
supplierIndexName
,
alikeSuppliers
)
&&
keyword
!=
""
{
query
.
Should
(
elastic
.
NewTermQuery
(
"goods_name_alike"
,
keyword
))
query
.
Should
(
elastic
.
NewTermQuery
(
"goods_name_alike"
,
keyword
))
}
}
...
...
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