xuzhiheng 11 місяців тому
батько
коміт
4f3a8391ce
1 змінених файлів з 11 додано та 1 видалено
  1. 11 1
      exportData/main.go

+ 11 - 1
exportData/main.go

@@ -5,6 +5,7 @@ import (
 	"log"
 	"mongodb"
 	"qfw/util"
+	"strconv"
 	"strings"
 
 	"github.com/shopspring/decimal"
@@ -84,7 +85,7 @@ func main() {
 
 	sess := Mgo.GetMgoConn()
 	defer Mgo.DestoryMongoConn(sess)
-
+	contentMap := map[string]bool{}
 	file := xlsx.NewFile()
 	sheet, err := file.AddSheet("sheet1")
 	if err != nil {
@@ -407,6 +408,15 @@ func main() {
 					log.Println("remark ", remark)
 					if isOk {
 						row := sheet.AddRow()
+						expurasingtime := strconv.Itoa(util.IntAll(p1["expurasingtime"]))
+						buyer_purchase := util.ObjToString(p1["buyer"])
+						totalprice := strconv.FormatFloat(util.Float64All(p1["totalprice"]), 'f', -1, 64)
+						content := projectname_purchase + buyer_purchase + expurasingtime + totalprice
+						if contentMap[content] {
+							continue
+						} else {
+							contentMap[content] = true
+						}
 						for _, v := range FiedlsPurchase {
 							if v == "projectname_purchase" || v == "projectscope_purchase" || v == "item" || v == "buyer_purchase" ||
 								v == "totalprice" || v == "expurasingtime" || v == "cgyxxqhref" || v == "remark" {