Commit 8ce9c84e by mushishixian

优化

parent 914a481b
The file could not be displayed because it is too large.
...@@ -15,6 +15,9 @@ func GetBomItems(bomId int) (bomItems []model.BomItem) { ...@@ -15,6 +15,9 @@ func GetBomItems(bomId int) (bomItems []model.BomItem) {
//更新没有匹配的到bom详情 //更新没有匹配的到bom详情
func UpdateNoMatchBomItem(bomItems []model.BomItem) (err error) { func UpdateNoMatchBomItem(bomItems []model.BomItem) (err error) {
if len(bomItems) == 0 {
return nil
}
var updateIdList []int var updateIdList []int
var bomIdStr string var bomIdStr string
for _, bomItem := range bomItems { for _, bomItem := range bomItems {
......
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"bom_server/configs" "bom_server/configs"
"bom_server/internal/model" "bom_server/internal/model"
"encoding/json" "encoding/json"
"fmt"
"github.com/imroc/req" "github.com/imroc/req"
"reflect" "reflect"
"strconv" "strconv"
...@@ -109,9 +108,7 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) { ...@@ -109,9 +108,7 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) {
} }
} }
} }
start := time.Now()
err = BatchSaveMatchings(bomId, bomMatchingList) err = BatchSaveMatchings(bomId, bomMatchingList)
fmt.Println(time.Now().Sub(start))
if err != nil { if err != nil {
return return
} }
......
...@@ -30,7 +30,7 @@ func MatchGoods(bomId int) (err error) { ...@@ -30,7 +30,7 @@ func MatchGoods(bomId int) (err error) {
return errors.New("没有商品的bom单") return errors.New("没有商品的bom单")
} }
bomItems := bom.BomItems bomItems := bom.BomItems
perGoDealNumber := 200 perGoDealNumber := 50
//开启协程处理搜索.每50个开启一个协程 //开启协程处理搜索.每50个开启一个协程
var wg sync.WaitGroup var wg sync.WaitGroup
//判断是否有余数 //判断是否有余数
...@@ -139,7 +139,6 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, client *es.Client, ...@@ -139,7 +139,6 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, client *es.Client,
} }
res, err := search.Do(context.Background()) res, err := search.Do(context.Background())
if err != nil { if err != nil {
fmt.Println(err)
return return
} }
if len(res.Responses) == 0 { if len(res.Responses) == 0 {
......
...@@ -9,6 +9,10 @@ func hello(name string) string { ...@@ -9,6 +9,10 @@ func hello(name string) string {
return "Hello " + name + "!" return "Hello " + name + "!"
} }
func export(bomId int) {
}
func main() { func main() {
service := rpc.NewHTTPService() service := rpc.NewHTTPService()
service.AddFunction("hello", hello, rpc.Options{}) service.AddFunction("hello", hello, rpc.Options{})
......
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