|
@@ -125,6 +125,8 @@ func export() {
|
|
|
defer MgoS.DestoryMongoConn(sess)
|
|
|
count := 0
|
|
|
line := 1
|
|
|
+ winnerLine := 1
|
|
|
+ agencyLine := 1
|
|
|
|
|
|
ch := make(chan bool, 18)
|
|
|
wg := &sync.WaitGroup{}
|
|
@@ -165,14 +167,14 @@ func export() {
|
|
|
}
|
|
|
//2.中标单位
|
|
|
if GF.Env.Winner > 0 {
|
|
|
- line := 1
|
|
|
if tmp["winner_contacts"] != nil {
|
|
|
if contacts, ok := tmp["winner_contacts"].([]interface{}); ok {
|
|
|
log.Info("export", zap.Any("开始导出中标单位", winner))
|
|
|
for _, v := range contacts {
|
|
|
- line++
|
|
|
-
|
|
|
- go writeToExcel(xlsx, "中标单位", winner, line, v, styleOne, wg, ch)
|
|
|
+ winnerLine++
|
|
|
+ ch <- true
|
|
|
+ wg.Add(1)
|
|
|
+ go writeToExcel(xlsx, "中标单位", winner, winnerLine, v, styleOne, wg, ch)
|
|
|
//if data, ok := v.(map[string]interface{}); ok {
|
|
|
// datas := make([]interface{}, 0)
|
|
|
// datas = append(datas, winner, data["contact_person"], data["phone"], data["publishtime"])
|
|
@@ -187,14 +189,14 @@ func export() {
|
|
|
}
|
|
|
//3.代理机关
|
|
|
if GF.Env.Agency > 0 {
|
|
|
- line := 1
|
|
|
if tmp["agency_contacts"] != nil {
|
|
|
if contacts, ok := tmp["agency_contacts"].([]interface{}); ok {
|
|
|
log.Info("export", zap.Any("开始导出代理机关", winner))
|
|
|
for _, v := range contacts {
|
|
|
- line++
|
|
|
-
|
|
|
- go writeToExcel(xlsx, "代理机关", winner, line, v, styleOne, wg, ch)
|
|
|
+ agencyLine++
|
|
|
+ ch <- true
|
|
|
+ wg.Add(1)
|
|
|
+ writeToExcel(xlsx, "代理机关", winner, agencyLine, v, styleOne, wg, ch)
|
|
|
|
|
|
//if data, ok := v.(map[string]interface{}); ok {
|
|
|
// datas := make([]interface{}, 0)
|
|
@@ -222,7 +224,7 @@ func export() {
|
|
|
|
|
|
}
|
|
|
|
|
|
-//writeToExcel 写入Excel
|
|
|
+// writeToExcel 写入Excel
|
|
|
func writeToExcel(xlsx *excelize.File, sheetName string, winner interface{}, line int, data interface{}, style int, wg *sync.WaitGroup, ch chan bool) {
|
|
|
|
|
|
defer func() {
|