|
@@ -823,6 +823,7 @@ func (f *Front) GroupExportData() {
|
|
|
sheet := file.Sheets[0]
|
|
|
fields := map[string]interface{}{
|
|
|
"id": 1,
|
|
|
+ "v_baseinfo.package": 1,
|
|
|
"v_baseinfo.s_winner": 1,
|
|
|
"v_baseinfo.buyer": 1,
|
|
|
"v_baseinfo.projectcode": 1,
|
|
@@ -837,20 +838,55 @@ func (f *Front) GroupExportData() {
|
|
|
}
|
|
|
list, _ := util.Mgo.Find(sourceinfo, q, nil, fields, false, -1, -1)
|
|
|
for _, l := range *list {
|
|
|
- row := sheet.AddRow()
|
|
|
baseinfo := l["v_baseinfo"].(map[string]interface{})
|
|
|
- row.AddCell().SetValue(util.SE.EncodeString(qu.ObjToString(l["id"])))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["s_winner"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["buyer"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["projectcode"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["projectname"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["title"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["bidamount"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["area"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["city"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(l["tagname"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(l["tagname2"]))
|
|
|
- row.AddCell().SetValue(qu.ObjToString(baseinfo["is_effective"]))
|
|
|
+ if baseinfo["package"] != nil {
|
|
|
+ pkg := baseinfo["package"].(map[string]interface{})
|
|
|
+ for _, p := range pkg {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ p1 := p.(map[string]interface{})
|
|
|
+ winner := []string{}
|
|
|
+ bidamount := float64(0)
|
|
|
+ if p1["winner_all"] != nil {
|
|
|
+ if all := p1["winner_all"].([]interface{}); all != nil {
|
|
|
+ if len(all) > 0 {
|
|
|
+ for _, a := range all {
|
|
|
+ a1 := a.(map[string]interface{})
|
|
|
+ if qu.ObjToString(a1["winner"]) != "" {
|
|
|
+ winner = append(winner, qu.ObjToString(a1["winner"]))
|
|
|
+ }
|
|
|
+ bidamount = qu.Float64All(a1["bidamount"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.AddCell().SetValue(util.SE.EncodeString(qu.ObjToString(l["id"])))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(winner))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["buyer"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["projectcode"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["projectname"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["title"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(bidamount))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["area"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["city"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(l["tagname"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(l["tagname2"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["is_effective"]))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ row := sheet.AddRow()
|
|
|
+ row.AddCell().SetValue(util.SE.EncodeString(qu.ObjToString(l["id"])))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["s_winner"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["buyer"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["projectcode"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["projectname"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["title"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["bidamount"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["area"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["city"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(l["tagname"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(l["tagname2"]))
|
|
|
+ row.AddCell().SetValue(qu.ObjToString(baseinfo["is_effective"]))
|
|
|
+ }
|
|
|
}
|
|
|
fname := fmt.Sprintf(modelpath, time.Now().Unix())
|
|
|
qu.Debug("File Name:", fname)
|