Commit 1a1d7b62 by mushishixian

fix

parent f8931d40
......@@ -14,16 +14,16 @@ type RecvPro struct {
}
func init() {
queueExchange := rabbitmq.QueueExchange{
"bom_match",
"bom_match",
"bom",
"direct",
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
}
str := `{"bom_id":491,"delivery_type":1,"sort":1}`
rabbitmq.Send(queueExchange, str)
//queueExchange := rabbitmq.QueueExchange{
// "bom_match",
// "bom_match",
// "bom",
// "direct",
// "amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
//}
//
//str := `{"bom_id":523,"delivery_type":1,"sort":1}`
//rabbitmq.Send(queueExchange, str)
}
func (t *RecvPro) Consumer(dataByte []byte) (err error) {
......
......@@ -105,7 +105,6 @@ func searchAttr(attrOrigin, brandName, encap string, search *es.MultiSearchServi
source.Sort("brand_sort", true)
source = source.From(0).Size(1)
searchRequest := es.NewSearchRequest().Source(source)
//fmt.Println(searchRequest.Body())
return search.Add(searchRequest)
}
......@@ -147,18 +146,20 @@ func changeKeyword(attr string) (result string) {
//将属性值转成ES的标准值(例如 : 阻值(欧姆)€3000)
func TransformESParam(attr string) (result string) {
attr = changeKeyword(attr)
unitMapping := mapping.UnitValueMapping
//needCheckUnits := getNeedCheckUnit()
//获取该属性对应的单位
for unit, _ := range unitMapping {
index := strings.Index(attr, unit)
if index > 0 {
attr = string([]rune(attr)[:index+len(unit)-1])
}
//得到截取后的参数,去得到需要用于es查询的参数
attrValue := getAttrValueByAttr(attr)
return attrValue
}
return
//for _, unit := range needCheckUnits {
// //todo : bug
// index := strings.Index(attr, unit)
// if index > 0 {
// attr = string([]rune(attr)[:index+len(unit)-1])
// }
// //得到截取后的参数,去得到需要用于es查询的参数
//attrValue := getAttrValueByAttr(attr)
// return attrValue
//}
attrValue := getAttrValueByAttr(attr)
return attrValue
}
//根据参数单位或者参数值获取对应的重要属性,组成最后查询的字符串
......@@ -257,3 +258,11 @@ func getQuery(attrs []string) (query *es.BoolQuery) {
return query
}
func getNeedCheckUnit() (unitSlice []string) {
unitMapping := mapping.UnitValueMapping
for unit, _ := range unitMapping {
unitSlice = append(unitSlice, unit)
}
return
}
......@@ -51,6 +51,9 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) {
if err != nil {
return err
}
if bomMatching.GoodsName == "" {
continue
}
bomMatchingList = append(bomMatchingList, bomMatching)
}
}
......
......@@ -33,7 +33,7 @@ func MatchGoods(message model.BomMessage) (err error) {
bomItems := bom.BomItems
var perGoDealNumber int
if configs.ApiSetting.Mode == "debug" {
perGoDealNumber = 40
perGoDealNumber = 200
} else {
perGoDealNumber = 40
}
......@@ -83,7 +83,6 @@ func SearchGoods(bomId int, bomItems []model.BomItem, deliveryType, sort int, wg
defer client.Stop()
//匹配之前,去遍历bom_item,把没有型号名称但是有参数的bom_item进行型号补充
bomItems, err = MatchGoodsNameByAttrs(bomItems)
//第一次先去精确匹配
goodsMapList, err := getUpdateGoodsData(bomId, bomItems, deliveryType, sort, client, true)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment