|
@@ -7,11 +7,10 @@ import (
|
|
|
"fmt"
|
|
|
"io/ioutil"
|
|
|
qu "qfw/util"
|
|
|
+ "qfw/util/redis"
|
|
|
"sync/atomic"
|
|
|
|
|
|
- //"qfw/util/mongodb"
|
|
|
mgo "mongodb"
|
|
|
- //"qfw/util/redis"
|
|
|
"sort"
|
|
|
"strings"
|
|
|
"sync"
|
|
@@ -26,28 +25,24 @@ import (
|
|
|
|
|
|
type Front struct {
|
|
|
*xweb.Action
|
|
|
- //index xweb.Mapper `xweb:"/"`
|
|
|
- // pack xweb.Mapper `xweb:"/package"`
|
|
|
- listInfo xweb.Mapper `xweb:"/list"`
|
|
|
- elist xweb.Mapper `xweb:"/elist"`
|
|
|
- detail xweb.Mapper `xweb:"/detail/(.*).html"`
|
|
|
- biaozhu xweb.Mapper `xweb:"/biaozhu"`
|
|
|
- tj xweb.Mapper `xweb:"/tj"`
|
|
|
- importByExcel xweb.Mapper `xweb:"/importbyexcel"`
|
|
|
- importByEs xweb.Mapper `xweb:"/importbyes"`
|
|
|
- getEsCount xweb.Mapper `xweb:"/getescount"`
|
|
|
- finishCheck xweb.Mapper `xweb:"/finishcheck"`
|
|
|
- syncMarked xweb.Mapper `xweb:"/syncmarked"`
|
|
|
+ // elist xweb.Mapper `xweb:"/elist"`
|
|
|
+ login xweb.Mapper `xweb:"/"`
|
|
|
+ saveUser xweb.Mapper `xweb:"/center/saveuser"`
|
|
|
+ listInfo xweb.Mapper `xweb:"/center/list"`
|
|
|
+ checkId xweb.Mapper `xweb:"/center/checkid"`
|
|
|
+ detail xweb.Mapper `xweb:"/center/detail/(.*).html"`
|
|
|
+ biaozhu xweb.Mapper `xweb:"/center/biaozhu"`
|
|
|
+ importByExcel xweb.Mapper `xweb:"/center/importbyexcel"`
|
|
|
+ importByEs xweb.Mapper `xweb:"/center/importbyes"`
|
|
|
+ getEsCount xweb.Mapper `xweb:"/center/getescount"`
|
|
|
+ finishCheck xweb.Mapper `xweb:"/center/finishcheck"`
|
|
|
+ errCheck xweb.Mapper `xweb:"/center/errcheck"`
|
|
|
+ syncMarked xweb.Mapper `xweb:"/center/syncmarked"`
|
|
|
}
|
|
|
|
|
|
-//var IdList *list.List //所有数据
|
|
|
-//var IdPackList *list.List //含有分包的数据
|
|
|
var preKey = "ck_"
|
|
|
var preErr = "err_"
|
|
|
var SE = qu.SimpleEncrypt{Key: "topJYBX2019"}
|
|
|
-var Max, Min string
|
|
|
-var HasNo bool //预算和中标金额是否存在标记
|
|
|
-var QueryFind map[string]interface{} //查询
|
|
|
|
|
|
/*
|
|
|
status
|
|
@@ -57,92 +52,77 @@ var QueryFind map[string]interface{} //查询
|
|
|
3:修改
|
|
|
4:删除
|
|
|
*/
|
|
|
-/**
|
|
|
-//查询初始化的数据
|
|
|
-func (i *Front) Index() error {
|
|
|
- _id := ""
|
|
|
- ran := 0
|
|
|
- for {
|
|
|
- index, invalid := 0, 0
|
|
|
- if IdList.Len() == 0 {
|
|
|
- return i.Render("finish.html")
|
|
|
- }
|
|
|
- ran = util.Getrand(IdList.Len())
|
|
|
- for e := IdList.Front(); e != nil; e = e.Next() { //遍历IdList,获取id
|
|
|
- if index == ran {
|
|
|
- _id = qu.ObjToString(e.Value)
|
|
|
- invalid = redis.GetInt("extcheck", "extcheck_"+_id)
|
|
|
- break
|
|
|
- }
|
|
|
- index++
|
|
|
- }
|
|
|
- if invalid == 0 {
|
|
|
- break
|
|
|
- }
|
|
|
- if IdList.Len() < 500 { //|| IdPackList.Len() < 100
|
|
|
- qu.Debug("抽查数据剩余不足", IdList.Len())
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- redis.Put("extcheck", "extcheck_"+_id, 1, 10*60)
|
|
|
- qu.Debug("_id", _id, "---", IdList.Len())
|
|
|
- rep := getDetail(_id)
|
|
|
- //i.T["ispackage"] = ispackage
|
|
|
- //i.T["type"] = rep["type"]
|
|
|
- i.T["info"] = rep["info"]
|
|
|
- i.T["common"] = rep["common"]
|
|
|
- i.T["worder"] = rep["worder"]
|
|
|
- i.T["packs"] = rep["packs"]
|
|
|
- i.T["packskey"] = rep["packskey"]
|
|
|
- i.T["ck_pclisext"] = rep["ck_pclisext"]
|
|
|
- i.T["ck_wodrisext"] = rep["ck_wodrisext"]
|
|
|
- i.T["ck_pkgisext"] = rep["ck_pkgisext"]
|
|
|
- i.T["timeplace"] = rep["timeplace"]
|
|
|
- i.T["purchasinglist"] = rep["purchasinglist"]
|
|
|
- i.T["other"] = rep["other"]
|
|
|
- //qu.Debug(util.PurchasinglistField, util.WinnerorderField, util.PackageField)
|
|
|
- i.T["PurchasinglistField"] = util.PurchasinglistField
|
|
|
- i.T["WinnerorderField"] = util.WinnerorderField
|
|
|
- i.T["PackageField"] = util.PackageField
|
|
|
- i.T[preKey+"purchasinglist"] = rep[preKey+"purchasinglist"]
|
|
|
- i.T[preKey+"package"] = rep[preKey+"package"]
|
|
|
- i.T[preKey+"winnerorder"] = rep[preKey+"winnerorder"]
|
|
|
- i.T["worder_new"] = rep["worder_new"]
|
|
|
- i.T["pcl_new"] = rep["pcl_new"]
|
|
|
- i.T["pkg_new"] = rep["pkg_new"]
|
|
|
|
|
|
- return i.Render("detail.html", &i.T)
|
|
|
-}
|
|
|
-*/
|
|
|
//列表
|
|
|
func (i *Front) ListInfo() error {
|
|
|
+ //loginuser := i.GetSession("loginuser").(string)
|
|
|
spidercode := i.GetString("spidercode")
|
|
|
coll := i.GetString("coll")
|
|
|
field := i.GetString("field")
|
|
|
stype := i.GetString("type")
|
|
|
- Min = i.GetString("minval")
|
|
|
- Max = i.GetString("maxval")
|
|
|
- HasNo, _ = i.GetBool("hasno")
|
|
|
+ min := i.GetString("minval") //min max不用int类型接收,以免有默认值0
|
|
|
+ max := i.GetString("maxval")
|
|
|
+ hasno, _ := i.GetBool("hasno")
|
|
|
pagenum, _ := i.GetInteger("pagenum")
|
|
|
if pagenum == 0 {
|
|
|
pagenum = 1
|
|
|
}
|
|
|
- if coll != "" { //指定表
|
|
|
- util.Coll = coll
|
|
|
+ qu.Debug("coll:", coll, "stype:", stype, "field:", field, "hasno:", hasno, "max:", max, "min:", min, "pagenum:", pagenum)
|
|
|
+ query := map[string]interface{}{}
|
|
|
+ if spidercode != "" { //爬虫代码
|
|
|
+ query["spidercode"] = spidercode
|
|
|
}
|
|
|
- if stype == "" {
|
|
|
- stype = "-1"
|
|
|
+ if stype != "-1" && stype != "" { //类型
|
|
|
+ if stype == util.SPECIALTYPE {
|
|
|
+ query["subtype"] = map[string]interface{}{
|
|
|
+ "$exists": false,
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ subtype := strings.Split(stype, "-")[1]
|
|
|
+ query["subtype"] = subtype
|
|
|
+ }
|
|
|
}
|
|
|
- if field == "" {
|
|
|
- field = "-1"
|
|
|
+ if field != "-1" && field != "" { //字段
|
|
|
+ query[preKey+field] = map[string]interface{}{
|
|
|
+ "$exists": false, //field未曾标记
|
|
|
+ }
|
|
|
+ if field == "budget" || field == "bidamount" || field == "biddiscount" { //金额区间
|
|
|
+ numMap := map[string]interface{}{}
|
|
|
+ if min != "" {
|
|
|
+ minint := qu.IntAll(min)
|
|
|
+ numMap["$gte"] = minint
|
|
|
+ }
|
|
|
+ if max != "" {
|
|
|
+ maxint := qu.IntAll(max)
|
|
|
+ numMap["$lte"] = maxint
|
|
|
+ }
|
|
|
+ queryArr := []interface{}{}
|
|
|
+ if hasno { //包含field不存在的数据
|
|
|
+ queryArr = append(queryArr, map[string]interface{}{
|
|
|
+ field: map[string]interface{}{
|
|
|
+ "$exists": false,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if len(numMap) > 0 { //给定了区间,查询此区间或者budget、bidamount不存在的数据
|
|
|
+ queryArr = append(queryArr, map[string]interface{}{
|
|
|
+ field: numMap,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if len(queryArr) > 0 {
|
|
|
+ query["$or"] = queryArr
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ hasno = false
|
|
|
+ }
|
|
|
}
|
|
|
- listData := getListInfo(spidercode, stype, field, pagenum)
|
|
|
- //if len(listData) > 0 { //每次查询更新内存中标注数据
|
|
|
- // IdList = list.New()
|
|
|
- // for _, v := range listData {
|
|
|
- // IdList.PushBack(mgo.BsonIdToSId(v["_id"]))
|
|
|
- // }
|
|
|
- //}
|
|
|
+ qu.Debug("query:", coll, query)
|
|
|
+ if coll == "" {
|
|
|
+ coll = util.Config.Fromtable
|
|
|
+ }
|
|
|
+ i.SetSession("coll", coll) //session中存入查询表
|
|
|
+ i.SetSession("query", query) //session中存入查询条件
|
|
|
+ listData := getListInfo(coll, query, pagenum)
|
|
|
i.T["list"] = listData
|
|
|
i.T["type"] = stype
|
|
|
i.T["field"] = field
|
|
@@ -150,30 +130,37 @@ func (i *Front) ListInfo() error {
|
|
|
i.T["coll"] = coll
|
|
|
i.T["topsubtype"] = util.TopSubStypeArr
|
|
|
i.T["allfield"] = util.AllFieldArr
|
|
|
- i.T["fromtable"] = util.Coll
|
|
|
+ i.T["fromtable"] = util.Config.Fromtable
|
|
|
i.T["dbname"] = util.Config.Dbname
|
|
|
- i.T["max"] = Max
|
|
|
- i.T["min"] = Min
|
|
|
- i.T["hasno"] = HasNo
|
|
|
- checkedNum, allNum := GetCheckedAndAllDataInfo() //已标和总数信息
|
|
|
+ i.T["max"] = max
|
|
|
+ i.T["min"] = min
|
|
|
+ i.T["hasno"] = hasno
|
|
|
+ checkedNum, allNum := GetCheckedAndAllDataInfo(query, coll) //已标和总数信息
|
|
|
i.T["checkednum"] = checkedNum
|
|
|
i.T["allnum"] = allNum
|
|
|
i.T["pagenum"] = pagenum
|
|
|
return i.Render("list.html", &i.T)
|
|
|
}
|
|
|
|
|
|
-//标错列表
|
|
|
-func (i *Front) Elist() error {
|
|
|
- attrname := i.GetString("attrname")
|
|
|
- common := util.Config.Biaozhu["common"]
|
|
|
- elist, _ := util.MgoM.Find(util.Config.Totablel, `{"ck_`+attrname+`":"0"}`, `{"_id":1}`, `{"_id":1}`, false, -1, -1)
|
|
|
- for _, v := range *elist {
|
|
|
- v["_id"] = mgo.BsonIdToSId(v["_id"])
|
|
|
+//判断id是否正在被标记
|
|
|
+func (i *Front) CheckId() {
|
|
|
+ defer qu.Catch()
|
|
|
+ msg := ""
|
|
|
+ id := i.GetString("id")
|
|
|
+ coll := i.GetSession("coll").(string)
|
|
|
+ if coll != "" {
|
|
|
+ exists, err := redis.Exists("extcheck", coll+"_"+id)
|
|
|
+ if err == nil {
|
|
|
+ if exists {
|
|
|
+ id, exists = GetNoCheckedId(id, coll)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ msg = "校验数据出错!"
|
|
|
+ }
|
|
|
+ i.ServeJson(map[string]interface{}{"msg": msg, "id": id, "exists": exists})
|
|
|
+ return
|
|
|
}
|
|
|
- i.T["elist"] = *elist
|
|
|
- i.T["attrname"] = attrname
|
|
|
- i.T["common"] = common
|
|
|
- return i.Render("elist.html", &i.T)
|
|
|
+ i.ServeJson(map[string]interface{}{"msg": "数据校验表出错!"})
|
|
|
}
|
|
|
|
|
|
//标注
|
|
@@ -246,8 +233,10 @@ func (i *Front) Biaozhu() error {
|
|
|
// qu.Debug("errset---", errset)
|
|
|
// qu.Debug("set---", set)
|
|
|
// qu.Debug("unset---", unset)
|
|
|
+ loginuser := i.GetSession("loginuser").(string)
|
|
|
unerrset := map[string]interface{}{} //记录errdata错误信息表删除
|
|
|
- data, _ := util.MgoM.FindById(util.Coll, _id, nil)
|
|
|
+ coll := i.GetSession("coll").(string)
|
|
|
+ data, _ := util.MgoM.FindById(coll, _id, nil)
|
|
|
//标注误操作处理
|
|
|
if len(set) > 0 { //set中为本次标注保存的数据(ck_bidopentime:1;ck_buyer:2;buyer:"XXX")
|
|
|
for s, sv := range set {
|
|
@@ -345,6 +334,7 @@ func (i *Front) Biaozhu() error {
|
|
|
}
|
|
|
//qu.Debug("errset---", errset)
|
|
|
errset["updatetime"] = time.Now().Unix()
|
|
|
+ errset["modifyuser"] = loginuser
|
|
|
errUpdata["$set"] = errset
|
|
|
}
|
|
|
if len(unerrset) > 0 {
|
|
@@ -360,13 +350,14 @@ func (i *Front) Biaozhu() error {
|
|
|
if len(set) > 0 {
|
|
|
set["ck_data"] = stype
|
|
|
set["updatetime"] = time.Now().Unix()
|
|
|
+ set["modifyuser"] = loginuser
|
|
|
update["$set"] = set
|
|
|
}
|
|
|
if len(unset) > 0 {
|
|
|
update["$unset"] = unset
|
|
|
}
|
|
|
if len(update) > 0 {
|
|
|
- b = util.MgoM.Update(util.Coll, `{"_id":"`+_id+`"}`, update, false, false)
|
|
|
+ b = util.MgoM.Update(coll, `{"_id":"`+_id+`"}`, update, false, false)
|
|
|
if b {
|
|
|
//for e := IdList.Front(); e != nil; e = e.Next() { //遍历IdList,删除元素
|
|
|
// if _id == qu.ObjToString(e.Value) {
|
|
@@ -374,8 +365,8 @@ func (i *Front) Biaozhu() error {
|
|
|
// break
|
|
|
// }
|
|
|
//}
|
|
|
- if util.Coll != util.Config.Fromtable && isSaveMarked { //util.coll此时的标注表 util.Config.Fromtable默认标注表
|
|
|
- data, _ := util.MgoM.FindById(util.Coll, _id, nil)
|
|
|
+ if coll != util.Config.Fromtable && isSaveMarked { //util.coll此时的标注表 util.Config.Fromtable默认标注表
|
|
|
+ data, _ := util.MgoM.FindById(coll, _id, nil)
|
|
|
if data != nil && len(*data) > 0 {
|
|
|
update := map[string]interface{}{"$set": *data}
|
|
|
if len(unset) > 0 {
|
|
@@ -395,8 +386,25 @@ func (i *Front) Biaozhu() error {
|
|
|
|
|
|
//查询信息
|
|
|
func (i *Front) Detail(id string) error {
|
|
|
- rep := getDetail(id)
|
|
|
- //i.T["type"] = rep["type"]
|
|
|
+ coll, _ := i.GetSession("coll").(string)
|
|
|
+ //if coll != "" {
|
|
|
+ // exists, _ := redis.Exists("extcheck", coll+"_"+id)
|
|
|
+ // if exists {
|
|
|
+ // tmpId, exists := GetNoCheckedId(id, coll)
|
|
|
+ // if exists { //标注完成
|
|
|
+ // return i.Render("finish.html", &i.T)
|
|
|
+ // } else {
|
|
|
+ // id = tmpId
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //} else {
|
|
|
+ // i.T["err"] = "数据查询表为空!"
|
|
|
+ // return i.Render("err.html", &i.T)
|
|
|
+ //}
|
|
|
+ query, _ := i.GetSession("query").(map[string]interface{})
|
|
|
+ qu.Debug(coll, query)
|
|
|
+ rep := getDetail(id, coll)
|
|
|
+ i.T["jyhref"] = util.JYHREFPRE + qu.CommonEncodeArticle("content", id) + ".html"
|
|
|
i.T["info"] = rep["info"]
|
|
|
i.T["common"] = rep["common"]
|
|
|
i.T["worder"] = rep["worder"]
|
|
@@ -411,16 +419,19 @@ func (i *Front) Detail(id string) error {
|
|
|
i.T["PurchasinglistField"] = util.PurchasinglistField
|
|
|
i.T["WinnerorderField"] = util.WinnerorderField
|
|
|
i.T["PackageField"] = util.PackageField
|
|
|
+ i.T["topsubtype"] = util.TopSubStypeArr2
|
|
|
i.T[preKey+"purchasinglist"] = rep[preKey+"purchasinglist"]
|
|
|
i.T[preKey+"package"] = rep[preKey+"package"]
|
|
|
i.T[preKey+"winnerorder"] = rep[preKey+"winnerorder"]
|
|
|
i.T["worder_new"] = rep["worder_new"]
|
|
|
i.T["pcl_new"] = rep["pcl_new"]
|
|
|
i.T["pkg_new"] = rep["pkg_new"]
|
|
|
- i.T["nextid"] = GetNextDataId(id) //下一条id
|
|
|
- checkedNum, allNum := GetCheckedAndAllDataInfo() //已标和总数信息
|
|
|
+ i.T["nextid"] = GetNextDataId(id, coll, query) //下一条id
|
|
|
+ checkedNum, allNum := GetCheckedAndAllDataInfo(query, coll) //已标和总数信息
|
|
|
i.T["checkednum"] = checkedNum
|
|
|
i.T["allnum"] = allNum
|
|
|
+ //存入Redis
|
|
|
+ redis.Put("extcheck", coll+"_"+id, "", util.Config.RedisTimeout*60) //正在标注的数据存入redis避免多人同时标注(加上coll左前缀避免不同表相同id数据不能同时标注)
|
|
|
return i.Render("detail.html", &i.T)
|
|
|
}
|
|
|
|
|
@@ -602,6 +613,28 @@ func (i *Front) ImportByEs() {
|
|
|
i.ServeJson(map[string]interface{}{"msg": msg})
|
|
|
}
|
|
|
|
|
|
+//查找未被标注的数据id
|
|
|
+func GetNoCheckedId(id, coll string) (string, bool) {
|
|
|
+ defer qu.Catch()
|
|
|
+ q := map[string]interface{}{
|
|
|
+ "_id": map[string]interface{}{
|
|
|
+ "$gt": mgo.StringTOBsonId(id),
|
|
|
+ },
|
|
|
+ }
|
|
|
+ sess := util.MgoM.GetMgoConn()
|
|
|
+ defer util.MgoM.DestoryMongoConn(sess)
|
|
|
+ it := sess.DB(util.MgoM.DbName).C(coll).Find(q).Sort("_id").Select(map[string]interface{}{"_id": 1}).Iter()
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); {
|
|
|
+ id = mgo.BsonIdToSId(tmp["_id"])
|
|
|
+ exists, err := redis.Exists("extcheck", coll+"_"+id)
|
|
|
+ if err == nil && !exists {
|
|
|
+ return id, exists
|
|
|
+ }
|
|
|
+ tmp = map[string]interface{}{}
|
|
|
+ }
|
|
|
+ return id, true
|
|
|
+}
|
|
|
+
|
|
|
//同步数据
|
|
|
func (i *Front) SyncMarked() {
|
|
|
syncColl := i.GetString("coll")
|
|
@@ -659,62 +692,15 @@ func (i *Front) FinishCheck() {
|
|
|
i.Render("finish.html")
|
|
|
}
|
|
|
|
|
|
+//错误页面
|
|
|
+func (i *Front) ErrCheck() {
|
|
|
+ i.Render("err.html")
|
|
|
+}
|
|
|
+
|
|
|
//查询列表数据
|
|
|
-func getListInfo(spidercode, stype, field string, currentpage int) []map[string]interface{} {
|
|
|
- QueryFind = map[string]interface{}{}
|
|
|
- if spidercode != "" {
|
|
|
- QueryFind["spidercode"] = spidercode
|
|
|
- }
|
|
|
- if stype != "-1" && stype != "" {
|
|
|
- if stype == util.SPECIALTYPE {
|
|
|
- QueryFind["subtype"] = map[string]interface{}{
|
|
|
- "$exists": false,
|
|
|
- }
|
|
|
- } else {
|
|
|
- subtype := strings.Split(stype, "-")[1]
|
|
|
- QueryFind["subtype"] = subtype
|
|
|
- }
|
|
|
- }
|
|
|
- if field != "-1" && field != "" {
|
|
|
- //query[field] = map[string]interface{}{
|
|
|
- // "$exists": true, //字段存在
|
|
|
- //}
|
|
|
- QueryFind[preKey+field] = map[string]interface{}{
|
|
|
- "$exists": false, //field未曾标记
|
|
|
- }
|
|
|
- if field == "budget" || field == "bidamount" { //金额区间
|
|
|
- numMap := map[string]interface{}{}
|
|
|
- if Min != "" {
|
|
|
- minint := qu.IntAll(Min)
|
|
|
- numMap["$gte"] = minint
|
|
|
- }
|
|
|
- if Max != "" {
|
|
|
- maxint := qu.IntAll(Max)
|
|
|
- numMap["$lte"] = maxint
|
|
|
- }
|
|
|
- queryArr := []interface{}{}
|
|
|
- if HasNo { //包含field不存在的数据
|
|
|
- queryArr = append(queryArr, map[string]interface{}{
|
|
|
- field: map[string]interface{}{
|
|
|
- "$exists": false,
|
|
|
- },
|
|
|
- })
|
|
|
- }
|
|
|
- if len(numMap) > 0 { //给定了区间,查询此区间或者budget、bidamount不存在的数据
|
|
|
- queryArr = append(queryArr, map[string]interface{}{
|
|
|
- field: numMap,
|
|
|
- })
|
|
|
- }
|
|
|
- if len(queryArr) > 0 {
|
|
|
- QueryFind["$or"] = queryArr
|
|
|
- }
|
|
|
- } else {
|
|
|
- HasNo = false //当字段不是budget、bidamount时,HasNo改为false,仅作用于页面展示
|
|
|
- }
|
|
|
- }
|
|
|
- qu.Debug("query:", util.Coll, QueryFind)
|
|
|
+func getListInfo(coll string, query map[string]interface{}, currentpage int) []map[string]interface{} {
|
|
|
start := (currentpage - 1) * 50
|
|
|
- infoList, _ := util.MgoM.Find(util.Coll, QueryFind, `{"_id":1}`, `{"_id":1,"title":1,"detail":1,"site":1,"href":1,"ck_data":1}`, false, start, 50)
|
|
|
+ infoList, _ := util.MgoM.Find(coll, query, `{"_id":1}`, `{"_id":1,"title":1,"detail":1,"site":1,"href":1,"ck_data":1}`, false, start, 50)
|
|
|
for k, v := range *infoList {
|
|
|
ck_data := qu.IntAll(v["ck_data"])
|
|
|
if ck_data > 0 {
|
|
@@ -733,9 +719,9 @@ func getListInfo(spidercode, stype, field string, currentpage int) []map[string]
|
|
|
return *infoList
|
|
|
}
|
|
|
|
|
|
-func getDetail(id string) map[string]interface{} {
|
|
|
+func getDetail(id, coll string) map[string]interface{} {
|
|
|
rep := map[string]interface{}{}
|
|
|
- infoTmp, _ := util.MgoM.FindById(util.Coll, id, ``)
|
|
|
+ infoTmp, _ := util.MgoM.FindById(coll, id, ``)
|
|
|
info := *infoTmp
|
|
|
// if qu.ObjToString(info["check"]) == "ok" && flag != "y" {
|
|
|
// bz_info, _ := util.MgoM.FindById(util.Config.Totablel, id, ``)
|
|
@@ -918,7 +904,15 @@ func setExtComMap(info map[string]interface{}) ([]interface{}, []interface{}, []
|
|
|
if info[fmt.Sprint(cp["key"])] == nil {
|
|
|
cp["value"] = ""
|
|
|
} else {
|
|
|
- cp["value"] = info[fmt.Sprint(cp["key"])]
|
|
|
+ if cp["key"] == "subtype" {
|
|
|
+ if info["toptype"] != nil && info["subtype"] != nil {
|
|
|
+ cp["value"] = qu.ObjToString(info["toptype"]) + "-" + qu.ObjToString(info[fmt.Sprint(cp["key"])])
|
|
|
+ } else {
|
|
|
+ cp["value"] = ""
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ cp["value"] = info[fmt.Sprint(cp["key"])]
|
|
|
+ }
|
|
|
}
|
|
|
if info[preKey+fmt.Sprint(cp["key"])] == nil {
|
|
|
cp["status"] = "-1"
|
|
@@ -997,13 +991,20 @@ func BzJBZD(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
|
continue
|
|
|
}
|
|
|
if status == 2 || status == 3 { //新增、修改
|
|
|
- input := tmpMap["input"] //值
|
|
|
- if key == "attach_discern" || key == "attach_ext" { //附件识别、抽取select
|
|
|
+ input := tmpMap["input"] //值
|
|
|
+ if key == "subtype" || key == "attach_discern" || key == "attach_ext" || key == "isrepeat" { //附件识别、抽取select
|
|
|
input = tmpMap["select"]
|
|
|
- } else if key == "budget" || key == "bidamount" {
|
|
|
+ } else if key == "budget" || key == "bidamount" || key == "biddiscount" {
|
|
|
input = qu.Float64All(input)
|
|
|
}
|
|
|
- set[key] = input
|
|
|
+ if key == "subtype" {
|
|
|
+ if topsubtype := strings.Split(qu.ObjToString(input), "-"); len(topsubtype) == 2 {
|
|
|
+ set["toptype"] = topsubtype[0]
|
|
|
+ set[key] = topsubtype[1]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ set[key] = input
|
|
|
+ }
|
|
|
errset[key] = status
|
|
|
} else if status == 4 { //删除
|
|
|
unset[key] = ""
|
|
@@ -1299,7 +1300,7 @@ func GetDataById(coll string, ids []string, stype string, tmp map[string]map[str
|
|
|
msg := ""
|
|
|
wg := &sync.WaitGroup{}
|
|
|
lock := &sync.Mutex{}
|
|
|
- ch := make(chan bool, 5)
|
|
|
+ ch := make(chan bool, 10)
|
|
|
n := int64(0)
|
|
|
for i, id := range ids {
|
|
|
wg.Add(1)
|
|
@@ -1428,16 +1429,16 @@ func UpdateMarkColl(bidData, markData *map[string]interface{}) {
|
|
|
}
|
|
|
|
|
|
//获取当前数据下一条的id
|
|
|
-func GetNextDataId(id string) string {
|
|
|
+func GetNextDataId(id, coll string, query map[string]interface{}) string {
|
|
|
nextIdQuery := map[string]interface{}{
|
|
|
"_id": map[string]interface{}{
|
|
|
"$gt": mgo.StringTOBsonId(id),
|
|
|
},
|
|
|
}
|
|
|
- for k, v := range QueryFind {
|
|
|
+ for k, v := range query {
|
|
|
nextIdQuery[k] = v
|
|
|
}
|
|
|
- one, _ := util.MgoM.Find(util.Coll, nextIdQuery, `{"_id":1}`, `{"_id":1}`, true, 0, 1)
|
|
|
+ one, _ := util.MgoM.Find(coll, nextIdQuery, `{"_id":1}`, `{"_id":1}`, true, 0, 1)
|
|
|
if one != nil && len(*one) == 1 {
|
|
|
return mgo.BsonIdToSId((*one)[0]["_id"])
|
|
|
}
|
|
@@ -1445,17 +1446,17 @@ func GetNextDataId(id string) string {
|
|
|
}
|
|
|
|
|
|
//获取已标注和数据总数的信息
|
|
|
-func GetCheckedAndAllDataInfo() (int, int) {
|
|
|
- allCount := util.MgoM.Count(util.Coll, QueryFind)
|
|
|
+func GetCheckedAndAllDataInfo(query map[string]interface{}, coll string) (int, int) {
|
|
|
+ allCount := util.MgoM.Count(coll, query)
|
|
|
ckDataQuery := map[string]interface{}{
|
|
|
"ck_data": map[string]interface{}{
|
|
|
"$gt": 0,
|
|
|
},
|
|
|
}
|
|
|
- for k, v := range QueryFind {
|
|
|
+ for k, v := range query {
|
|
|
ckDataQuery[k] = v
|
|
|
}
|
|
|
- checkedCount := util.MgoM.Count(util.Coll, ckDataQuery)
|
|
|
+ checkedCount := util.MgoM.Count(coll, ckDataQuery)
|
|
|
return checkedCount, allCount
|
|
|
}
|
|
|
|
|
@@ -1517,3 +1518,17 @@ func (i *Front) Tj() error {
|
|
|
i.T["total"] = len(*list)
|
|
|
return i.Render("tj.html", &i.T)
|
|
|
}
|
|
|
+
|
|
|
+//标错列表
|
|
|
+func (i *Front) Elist() error {
|
|
|
+ attrname := i.GetString("attrname")
|
|
|
+ common := util.Config.Biaozhu["common"]
|
|
|
+ elist, _ := util.MgoM.Find(util.Config.Totablel, `{"ck_`+attrname+`":"0"}`, `{"_id":1}`, `{"_id":1}`, false, -1, -1)
|
|
|
+ for _, v := range *elist {
|
|
|
+ v["_id"] = mgo.BsonIdToSId(v["_id"])
|
|
|
+ }
|
|
|
+ i.T["elist"] = *elist
|
|
|
+ i.T["attrname"] = attrname
|
|
|
+ i.T["common"] = common
|
|
|
+ return i.Render("elist.html", &i.T)
|
|
|
+}
|