|
@@ -8,9 +8,11 @@ import (
|
|
|
"math"
|
|
|
mgo "mongodb"
|
|
|
qu "qfw/util"
|
|
|
+ "regexp"
|
|
|
"sort"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+ "sync"
|
|
|
"time"
|
|
|
"util"
|
|
|
)
|
|
@@ -109,6 +111,7 @@ func (f *Front) RemarkDetail() {
|
|
|
func getDetail(id, coll string) map[string]interface{} {
|
|
|
rep := map[string]interface{}{}
|
|
|
infoTmp, _ := util.Mgo.FindById(coll, id, ``)
|
|
|
+ rep["s_excp_info"] = (*infoTmp)["s_excp_info"]
|
|
|
baseInfo := (*infoTmp)["v_baseinfo"].(map[string]interface{}) //字段值
|
|
|
var bzInfo map[string]interface{} //标注信息
|
|
|
if (*infoTmp)["v_taginfo"] != nil {
|
|
@@ -554,16 +557,21 @@ func GetNextDataId(id, coll, tid string) string {
|
|
|
}
|
|
|
|
|
|
// GetNextDataId1 质检下一条
|
|
|
-func GetNextDataId1(id, coll, tid string) string {
|
|
|
+func GetNextDataId1(id, coll, tid, tag string) string {
|
|
|
nextIdQuery := map[string]interface{}{
|
|
|
"_id": map[string]interface{}{
|
|
|
"$gt": mgo.StringTOBsonId(id),
|
|
|
},
|
|
|
+ "b_check": nil,
|
|
|
}
|
|
|
if tid != "" {
|
|
|
// 数据有任务 查询带上标注标记
|
|
|
nextIdQuery["i_ckdata"] = 2
|
|
|
- nextIdQuery["s_usertaskid"] = tid
|
|
|
+ if tag == "group" {
|
|
|
+ nextIdQuery["s_grouptaskid"] = tid
|
|
|
+ } else {
|
|
|
+ nextIdQuery["s_usertaskid"] = tid
|
|
|
+ }
|
|
|
} else {
|
|
|
nextIdQuery["i_ckdata"] = 2
|
|
|
}
|
|
@@ -636,6 +644,7 @@ func (f *Front) CheckList() {
|
|
|
func (f *Front) CheckData() {
|
|
|
qu.Catch()
|
|
|
pid := f.GetString("pid")
|
|
|
+ gid := f.GetString("gid")
|
|
|
tid := f.GetString("tid")
|
|
|
stype := f.GetString("stype")
|
|
|
sourceinfo := f.GetString("s_sourceinfo")
|
|
@@ -652,7 +661,9 @@ func (f *Front) CheckData() {
|
|
|
query["b_istag"] = true
|
|
|
if stype == "group" {
|
|
|
query["s_grouptaskid"] = tid
|
|
|
+ f.SetSession("check", "group")
|
|
|
} else {
|
|
|
+ f.SetSession("check", "user")
|
|
|
query["s_usertaskid"] = tid
|
|
|
}
|
|
|
} else {
|
|
@@ -674,18 +685,24 @@ func (f *Front) CheckData() {
|
|
|
}
|
|
|
}
|
|
|
status := f.GetString("s_status")
|
|
|
+ s_excp := f.GetString("s_excp")
|
|
|
if status == "1" {
|
|
|
query["b_check"] = true
|
|
|
} else if status == "-1" {
|
|
|
query["b_check"] = false
|
|
|
}
|
|
|
+ if s_excp == "1" {
|
|
|
+ query["s_excp"] = nil
|
|
|
+ } else if s_excp == "-1" {
|
|
|
+ query["s_excp"] = map[string]interface{}{"$exists": true}
|
|
|
+ }
|
|
|
if search != "" {
|
|
|
query["$or"] = []interface{}{
|
|
|
map[string]interface{}{"v_baseinfo.title": map[string]interface{}{"$regex": search}},
|
|
|
map[string]interface{}{"s_login": map[string]interface{}{"$regex": search}},
|
|
|
}
|
|
|
}
|
|
|
- fields := map[string]interface{}{"v_baseinfo.title": 1, "b_check": 1, "i_ckdata": 1, "s_login": 1, "b_istag": 1}
|
|
|
+ fields := map[string]interface{}{"v_baseinfo.title": 1, "b_check": 1, "i_ckdata": 1, "s_login": 1, "b_istag": 1, "s_excp": 1, "s_excp_info": 1}
|
|
|
info, _ := util.Mgo.Find(sourceinfo, query, `{"_id": 1}`, fields, false, start, limit)
|
|
|
count := util.Mgo.Count(sourceinfo, query)
|
|
|
qu.Debug(query, sourceinfo, count)
|
|
@@ -746,6 +763,7 @@ func (f *Front) CheckData() {
|
|
|
}
|
|
|
f.T["pid"] = pid
|
|
|
f.T["tid"] = tid
|
|
|
+ f.T["gid"] = gid
|
|
|
f.T["sourceinfo"] = sourceinfo
|
|
|
f.T["stype"] = stype
|
|
|
f.T["datatype"] = datatype
|
|
@@ -772,6 +790,7 @@ func (f *Front) CheckDetail() {
|
|
|
rep := getDetail(did, coll) //获取本条公告的信息
|
|
|
f.T["otherInfo"] = rep["otherInfo"] //展示关联公告信息
|
|
|
f.T["moreInfo"] = rep["moreInfo"] //更多关联公告信息
|
|
|
+ f.T["s_excp_info"] = rep["s_excp_info"]
|
|
|
f.T["pid"] = pid
|
|
|
f.T["tid"] = tid
|
|
|
f.T["did"] = did
|
|
@@ -795,7 +814,7 @@ func (f *Front) CheckDetail() {
|
|
|
f.T["worder_new"] = rep["worder_new"]
|
|
|
f.T["pcl_new"] = rep["pcl_new"]
|
|
|
f.T["pkg_new"] = rep["pkg_new"]
|
|
|
- f.T["nextid"] = GetNextDataId1(did, coll, tid) //下一条id
|
|
|
+ f.T["nextid"] = GetNextDataId1(did, coll, tid, qu.ObjToString(f.GetSession("check"))) //下一条id
|
|
|
_ = f.Render("project/check_detail.html", &f.T)
|
|
|
}
|
|
|
|
|
@@ -923,10 +942,20 @@ func (f *Front) CheckSave() {
|
|
|
setResult["v_checkinfo"] = checkSet
|
|
|
for field, val := range baseSet { //更新基本字段
|
|
|
setResult["v_baseinfo."+field] = val
|
|
|
+ baseInfo[field] = val
|
|
|
}
|
|
|
baseUnsetResult := map[string]interface{}{} //删除字段集
|
|
|
for field, _ := range baseUnset { //删除基本字段
|
|
|
baseUnsetResult["v_baseinfo."+field] = ""
|
|
|
+ delete(baseInfo, field)
|
|
|
+ }
|
|
|
+ ex, exp := DataException(baseInfo)
|
|
|
+ if ex != "" {
|
|
|
+ setResult["s_excp"] = ex
|
|
|
+ setResult["s_excp_info"] = exp
|
|
|
+ } else {
|
|
|
+ baseUnsetResult["s_excp"] = ""
|
|
|
+ baseUnsetResult["s_excp_info"] = ""
|
|
|
}
|
|
|
set := map[string]interface{}{
|
|
|
"$set": setResult,
|
|
@@ -1120,3 +1149,122 @@ func CountPr(c1, c2 int) string {
|
|
|
d := decimal.NewFromInt32(int32(c1)).Div(decimal.NewFromInt32(int32(c2))).Mul(decimal.NewFromInt32(100))
|
|
|
return d.String() + "%"
|
|
|
}
|
|
|
+
|
|
|
+func (f *Front) CheckExcpResult() {
|
|
|
+ pid := f.GetString("pid")
|
|
|
+ tid := f.GetString("tid")
|
|
|
+ sourceinfo := f.GetString("s_sourceinfo")
|
|
|
+ stype := f.GetString("stype")
|
|
|
+ query := make(map[string]interface{})
|
|
|
+ var dataSource []map[string]interface{}
|
|
|
+ if tid != "" {
|
|
|
+ if stype == "group" {
|
|
|
+ query["s_grouptaskid"] = tid
|
|
|
+ } else {
|
|
|
+ query["s_usertaskid"] = tid
|
|
|
+ }
|
|
|
+ query["s_excp"] = map[string]interface{}{"$exists": true}
|
|
|
+
|
|
|
+ } else {
|
|
|
+ query["s_excp"] = map[string]interface{}{"$exists": true}
|
|
|
+ excpNum := util.Mgo.Count(sourceinfo, query)
|
|
|
+ tagNum := util.Mgo.Count(sourceinfo, map[string]interface{}{"i_ckdata": 2})
|
|
|
+ dataSource = append(dataSource, map[string]interface{}{"name": "达标数据", "num1": excpNum, "num2": tagNum, "num3": CountPr(excpNum, tagNum)})
|
|
|
+ }
|
|
|
+ f.T["tableData"] = dataSource
|
|
|
+ f.T["pid"] = pid
|
|
|
+ f.T["tid"] = tid
|
|
|
+ f.T["sourceinfo"] = sourceinfo
|
|
|
+ _ = f.Render("project/check_excp_result.html", &f.T)
|
|
|
+}
|
|
|
+
|
|
|
+func (f *Front) CheckExcpData() {
|
|
|
+ sourceinfo := f.GetString("s_sourceinfo")
|
|
|
+ // 达标,待分发数据
|
|
|
+ query := map[string]interface{}{
|
|
|
+ "b_istagging": false,
|
|
|
+ //"b_isgivegroup": false,
|
|
|
+ }
|
|
|
+ pool := make(chan bool, 3)
|
|
|
+ wg := &sync.WaitGroup{}
|
|
|
+ sess := util.Mgo.GetMgoConn()
|
|
|
+ defer util.Mgo.DestoryMongoConn(sess)
|
|
|
+ count := 0
|
|
|
+ it := sess.DB(util.Mgo.DbName).C(sourceinfo).Find(query).Select(nil).Iter()
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
|
+ if tmp["s_excp"] != nil {
|
|
|
+ f.ServeJson(map[string]interface{}{"success": true})
|
|
|
+ break
|
|
|
+ }
|
|
|
+ pool <- true
|
|
|
+ wg.Add(1)
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
+ defer func() {
|
|
|
+ <-pool
|
|
|
+ wg.Done()
|
|
|
+ info := tmp["v_baseinfo"].(map[string]interface{})
|
|
|
+ ex, exp := DataException(info)
|
|
|
+ if ex != "" {
|
|
|
+ util.Mgo.UpdateById(sourceinfo, tmp["_id"], map[string]interface{}{"$set": map[string]interface{}{"s_excp": ex, "s_excp_info": exp}})
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ }(tmp)
|
|
|
+ }
|
|
|
+ f.ServeJson(map[string]interface{}{"success": true})
|
|
|
+}
|
|
|
+
|
|
|
+var regReplAllSymbol = regexp.MustCompile("[(\\(<《【\\[{{〔)\\)>》】\\]}}〕,,;;::'\"“”。.\\??/+=\\-_——*&……\\^%$¥@#!!`~·]")
|
|
|
+
|
|
|
+func DataException(tmp map[string]interface{}) (string, string) {
|
|
|
+ var tag []string
|
|
|
+ var exp string
|
|
|
+ if tmp["buyer"] != nil && tmp["buyer"] == tmp["s_winner"] {
|
|
|
+ tag = append(tag, "1")
|
|
|
+ exp += "采购单位与中标单位相等,"
|
|
|
+ }
|
|
|
+ if tmp["agency"] != nil && tmp["buyer"] == tmp["agency"] {
|
|
|
+ tag = append(tag, "2")
|
|
|
+ exp += "采购单位与代理机构相等,"
|
|
|
+ }
|
|
|
+ if tmp["s_winner"] != nil && tmp["s_winner"] == tmp["agency"] {
|
|
|
+ tag = append(tag, "3")
|
|
|
+ exp += "中标单位与代理机构相等,"
|
|
|
+ }
|
|
|
+ if tmp["bidamount"] != nil && tmp["budget"] != nil {
|
|
|
+ if qu.Float64All(tmp["bidamount"]) > qu.Float64All(tmp["budget"]) {
|
|
|
+ tag = append(tag, "4")
|
|
|
+ exp += "中标金额大于预算,"
|
|
|
+ }
|
|
|
+ if qu.Float64All(tmp["bidamount"]) < (qu.Float64All(tmp["budget"]) / 2) {
|
|
|
+ tag = append(tag, "5")
|
|
|
+ exp += "中标金额小于预算的一半,"
|
|
|
+ }
|
|
|
+ if tmp["budget"] == 0 && qu.Float64All(tmp["bidamount"]) != 0 {
|
|
|
+ tag = append(tag, "6")
|
|
|
+ exp += "预算为0,中标金额不为0,"
|
|
|
+ }
|
|
|
+ if qu.Float64All(tmp["budget"]) != 0 && tmp["bidamount"] == 0 {
|
|
|
+ tag = append(tag, "7")
|
|
|
+ exp += "预算不为0,中标金额为0,"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if b := qu.ObjToString(tmp["buyer"]); b != "" {
|
|
|
+ if regReplAllSymbol.MatchString(b) {
|
|
|
+ tag = append(tag, "8")
|
|
|
+ exp += "采购单位含有特殊符号,"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if a := qu.ObjToString(tmp["agency"]); a != "" {
|
|
|
+ if regReplAllSymbol.MatchString(a) {
|
|
|
+ tag = append(tag, "9")
|
|
|
+ exp += "中标单位含有特殊符号,"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if a := qu.ObjToString(tmp["s_winner"]); a != "" {
|
|
|
+ if regReplAllSymbol.MatchString(a) {
|
|
|
+ tag = append(tag, "10")
|
|
|
+ exp += "代理机构含有特殊符号,"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return strings.Join(tag, ","), exp
|
|
|
+}
|