|
@@ -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}})
|
|
@@ -74,8 +78,8 @@ func (f *Front) GroupTaskListByAdmin() {
|
|
|
status := f.GetString("s_status")
|
|
|
searchStr := f.GetString("search[value]")
|
|
|
search := strings.TrimSpace(searchStr)
|
|
|
- starttime, _ := f.GetInt("starttime")
|
|
|
- endtime, _ := f.GetInt("endtime")
|
|
|
+ starttime, _ := f.GetInt("i_starttime")
|
|
|
+ completetime, _ := f.GetInt("i_completetime")
|
|
|
query := map[string]interface{}{
|
|
|
"s_stype": "group", //检索用户组任务
|
|
|
}
|
|
@@ -84,9 +88,9 @@ func (f *Front) GroupTaskListByAdmin() {
|
|
|
"$gte": starttime,
|
|
|
}
|
|
|
}
|
|
|
- if endtime > 0 {
|
|
|
+ if completetime > 0 {
|
|
|
query["i_completetime"] = map[string]interface{}{
|
|
|
- "$lte": endtime,
|
|
|
+ "$lte": completetime,
|
|
|
}
|
|
|
}
|
|
|
if status != "-1" { //任务状态
|
|
@@ -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}})
|
|
@@ -294,6 +304,7 @@ func (f *Front) GroupTaskExport() {
|
|
|
"i_completetime": 1,
|
|
|
}
|
|
|
list, _ := util.Mgo.Find(util.TASKCOLLNAME, query, nil, fields, false, -1, -1)
|
|
|
+ qu.Debug(len(*list))
|
|
|
for _, l := range *list {
|
|
|
row := sheet.AddRow()
|
|
|
entname := qu.ObjToString(l["s_entname"])
|