| | |
| | | |
| | | import ( |
| | | "encoding/json" |
| | | "io/ioutil" |
| | | "time" |
| | | |
| | | "kingdee-dbapi/cache" |
| | |
| | | } |
| | | |
| | | // 给bom添加组件 |
| | | for _, bom := range bomList { |
| | | bom.Component = bomChildMap[bom.FInterID] |
| | | for idx, bom := range bomList { |
| | | bomList[idx].Component = bomChildMap[bom.FInterID] |
| | | } |
| | | |
| | | // 每次发 1000 条 |
| | | // 每次发 200 条 |
| | | successCnt := 0 |
| | | for i := 0; i < len(bomList); i += 1000 { |
| | | end := i + 1000 |
| | | for i := 0; i < len(bomList); i += 200 { |
| | | end := i + 200 |
| | | if end > len(bomList) { |
| | | end = len(bomList) |
| | | } |
| | | |
| | | b, _ := json.Marshal(bomList[i:end]) |
| | | |
| | | ioutil.WriteFile("bomList.tmp", b, 0644) |
| | | |
| | | ok := nsqclient.Produce(config.Options.BomTopic, b) |
| | | if !ok { |