|
@@ -2,6 +2,7 @@ package front
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
+ "github.com/shopspring/decimal"
|
|
|
"github.com/tealeg/xlsx"
|
|
|
"mongodb"
|
|
|
"os"
|
|
@@ -52,7 +53,10 @@ func (f *Front) GroupTaskListByGroup() {
|
|
|
tagNum := util.Mgo.Count(sourceinfo, map[string]interface{}{"s_grouptaskid": groupTaskId, "b_istag": true})
|
|
|
progressFloat := float64(tagNum) / float64(giveNum)
|
|
|
value, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", progressFloat), 64)
|
|
|
- progress := fmt.Sprint(value*100) + "%"
|
|
|
+ decimalValue := decimal.NewFromFloat(value)
|
|
|
+ decimalValue = decimalValue.Mul(decimal.NewFromInt(100))
|
|
|
+ value, _ = decimalValue.Float64()
|
|
|
+ progress := fmt.Sprint(value) + "%"
|
|
|
l["s_progress"] = progress
|
|
|
//同步数据库
|
|
|
util.Mgo.UpdateById(util.TASKCOLLNAME, l["_id"], map[string]interface{}{"$set": map[string]interface{}{"s_progress": progress}})
|
|
@@ -113,7 +117,10 @@ func (f *Front) GroupTaskListByAdmin() {
|
|
|
tagNum := util.Mgo.Count(sourceinfo, map[string]interface{}{"s_grouptaskid": groupTaskId, "b_istag": true})
|
|
|
progressFloat := float64(tagNum) / float64(giveNum)
|
|
|
value, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", progressFloat), 64)
|
|
|
- progress := fmt.Sprint(value*100) + "%"
|
|
|
+ decimalValue := decimal.NewFromFloat(value)
|
|
|
+ decimalValue = decimalValue.Mul(decimal.NewFromInt(100))
|
|
|
+ value, _ = decimalValue.Float64()
|
|
|
+ progress := fmt.Sprint(value) + "%"
|
|
|
l["s_progress"] = progress
|
|
|
//同步数据库
|
|
|
util.Mgo.UpdateById(util.TASKCOLLNAME, l["_id"], map[string]interface{}{"$set": map[string]interface{}{"s_progress": progress}})
|
|
@@ -166,7 +173,10 @@ func (f *Front) GroupUserTaskList() {
|
|
|
tagNum := util.Mgo.Count(sourceinfo, map[string]interface{}{"s_usertaskid": mongodb.BsonIdToSId(l["_id"]), "b_istag": true})
|
|
|
progressFloat := float64(tagNum) / float64(giveNum)
|
|
|
value, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", progressFloat), 64)
|
|
|
- progress := fmt.Sprint(value*100) + "%"
|
|
|
+ decimalValue := decimal.NewFromFloat(value)
|
|
|
+ decimalValue = decimalValue.Mul(decimal.NewFromInt(100))
|
|
|
+ value, _ = decimalValue.Float64()
|
|
|
+ progress := fmt.Sprint(value) + "%"
|
|
|
l["s_progress"] = progress
|
|
|
//同步数据库
|
|
|
util.Mgo.UpdateById(util.TASKCOLLNAME, l["_id"], map[string]interface{}{"$set": map[string]interface{}{"s_progress": progress}})
|