|
@@ -1,37 +1,34 @@
|
|
package front
|
|
package front
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "dataCheck/util"
|
|
|
|
+ "fmt"
|
|
"github.com/shopspring/decimal"
|
|
"github.com/shopspring/decimal"
|
|
|
|
+ qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
|
|
|
|
+ "jygit.jydev.jianyu360.cn/data_processing/common_utils/mongodb"
|
|
|
|
+ "jygit.jydev.jianyu360.cn/data_processing/common_utils/redis"
|
|
"math"
|
|
"math"
|
|
- "strconv"
|
|
|
|
-
|
|
|
|
- //"container/list"
|
|
|
|
- "fmt"
|
|
|
|
- qu "qfw/util"
|
|
|
|
- "qfw/util/redis"
|
|
|
|
- "sync/atomic"
|
|
|
|
-
|
|
|
|
- mgo "mongodb"
|
|
|
|
"sort"
|
|
"sort"
|
|
|
|
+ "strconv"
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
|
|
+ "sync/atomic"
|
|
"time"
|
|
"time"
|
|
- "util"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
-//查找未被标注的数据id
|
|
|
|
|
|
+// 查找未被标注的数据id
|
|
func GetNoCheckedId(id, coll string) (string, bool) {
|
|
func GetNoCheckedId(id, coll string) (string, bool) {
|
|
defer qu.Catch()
|
|
defer qu.Catch()
|
|
q := map[string]interface{}{
|
|
q := map[string]interface{}{
|
|
"_id": map[string]interface{}{
|
|
"_id": map[string]interface{}{
|
|
- "$gt": mgo.StringTOBsonId(id),
|
|
|
|
|
|
+ "$gt": mongodb.StringTOBsonId(id),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
sess := util.MgoM.GetMgoConn()
|
|
sess := util.MgoM.GetMgoConn()
|
|
defer util.MgoM.DestoryMongoConn(sess)
|
|
defer util.MgoM.DestoryMongoConn(sess)
|
|
it := sess.DB(util.MgoM.DbName).C(coll).Find(q).Sort("_id").Select(map[string]interface{}{"_id": 1}).Iter()
|
|
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); {
|
|
for tmp := make(map[string]interface{}); it.Next(&tmp); {
|
|
- id = mgo.BsonIdToSId(tmp["_id"])
|
|
|
|
|
|
+ id = mongodb.BsonIdToSId(tmp["_id"])
|
|
exists, err := redis.Exists("extcheck", coll+"_"+id)
|
|
exists, err := redis.Exists("extcheck", coll+"_"+id)
|
|
if err == nil && !exists {
|
|
if err == nil && !exists {
|
|
return id, exists
|
|
return id, exists
|
|
@@ -41,7 +38,7 @@ func GetNoCheckedId(id, coll string) (string, bool) {
|
|
return id, true
|
|
return id, true
|
|
}
|
|
}
|
|
|
|
|
|
-//查询列表数据
|
|
|
|
|
|
+// 查询列表数据
|
|
func getListInfo(coll string, query map[string]interface{}, currentpage int) []map[string]interface{} {
|
|
func getListInfo(coll string, query map[string]interface{}, currentpage int) []map[string]interface{} {
|
|
start := (currentpage - 1) * 50
|
|
start := (currentpage - 1) * 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)
|
|
infoList, _ := util.MgoM.Find(coll, query, `{"_id":1}`, `{"_id":1,"title":1,"detail":1,"site":1,"href":1,"ck_data":1}`, false, start, 50)
|
|
@@ -56,7 +53,7 @@ func getListInfo(coll string, query map[string]interface{}, currentpage int) []m
|
|
if !strings.HasPrefix(href, "http") {
|
|
if !strings.HasPrefix(href, "http") {
|
|
v["href"] = "http://" + href
|
|
v["href"] = "http://" + href
|
|
}
|
|
}
|
|
- v["_id"] = mgo.BsonIdToSId(v["_id"])
|
|
|
|
|
|
+ v["_id"] = mongodb.BsonIdToSId(v["_id"])
|
|
(*infoList)[k] = v
|
|
(*infoList)[k] = v
|
|
v["num"] = k + 1 + start
|
|
v["num"] = k + 1 + start
|
|
}
|
|
}
|
|
@@ -74,7 +71,7 @@ func getDetail(id, coll string) map[string]interface{} {
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
info["detail"] = qu.ObjToString(info["title"]) + "</br>" + qu.ObjToString(info["detail"])
|
|
info["detail"] = qu.ObjToString(info["title"]) + "</br>" + qu.ObjToString(info["detail"])
|
|
- info["_id"] = mgo.BsonIdToSId(info["_id"])
|
|
|
|
|
|
+ info["_id"] = mongodb.BsonIdToSId(info["_id"])
|
|
//ck_pclisext, _ := info["ck_pclisext"].(bool)
|
|
//ck_pclisext, _ := info["ck_pclisext"].(bool)
|
|
ck_pclistag, _ := info["ck_pclistag"].(bool)
|
|
ck_pclistag, _ := info["ck_pclistag"].(bool)
|
|
//ck_wodrisext, _ := info["ck_wodrisext"].(bool)
|
|
//ck_wodrisext, _ := info["ck_wodrisext"].(bool)
|
|
@@ -127,7 +124,7 @@ func getDetail(id, coll string) map[string]interface{} {
|
|
return rep
|
|
return rep
|
|
}
|
|
}
|
|
|
|
|
|
-//获取公告关联信息
|
|
|
|
|
|
+// 获取公告关联信息
|
|
func setOtherInfo(info map[string]interface{}) (result, moreArr []map[string]interface{}) {
|
|
func setOtherInfo(info map[string]interface{}) (result, moreArr []map[string]interface{}) {
|
|
if otherInfo, ok := info["info"].([]interface{}); ok && len(otherInfo) > 0 {
|
|
if otherInfo, ok := info["info"].([]interface{}); ok && len(otherInfo) > 0 {
|
|
//中标,成交、合同、招标(不含变更)
|
|
//中标,成交、合同、招标(不含变更)
|
|
@@ -227,7 +224,7 @@ func DealData(tmpLen int, publishtime float64, tmp []map[string]interface{}, mor
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//拼装中标候选人
|
|
|
|
|
|
+// 拼装中标候选人
|
|
func setWorderMap(info map[string]interface{}) ([]interface{}, []map[string]interface{}) {
|
|
func setWorderMap(info map[string]interface{}) ([]interface{}, []map[string]interface{}) {
|
|
//基本参数--中标候选人
|
|
//基本参数--中标候选人
|
|
winnerorder, _ := util.Config.Biaozhu["winnerorder"].([]interface{})
|
|
winnerorder, _ := util.Config.Biaozhu["winnerorder"].([]interface{})
|
|
@@ -265,7 +262,7 @@ func setWorderMap(info map[string]interface{}) ([]interface{}, []map[string]inte
|
|
return worders, isNewAndStatus
|
|
return worders, isNewAndStatus
|
|
}
|
|
}
|
|
|
|
|
|
-//拼装标的物
|
|
|
|
|
|
+// 拼装标的物
|
|
func setPurchasingMap(info map[string]interface{}) ([]interface{}, []map[string]interface{}) {
|
|
func setPurchasingMap(info map[string]interface{}) ([]interface{}, []map[string]interface{}) {
|
|
purchasinglist, _ := util.Config.Biaozhu["purchasinglist"].([]interface{})
|
|
purchasinglist, _ := util.Config.Biaozhu["purchasinglist"].([]interface{})
|
|
purchasinglists := []interface{}{}
|
|
purchasinglists := []interface{}{}
|
|
@@ -309,7 +306,7 @@ func setPurchasingMap(info map[string]interface{}) ([]interface{}, []map[string]
|
|
return purchasinglists, isNewAndStatus
|
|
return purchasinglists, isNewAndStatus
|
|
}
|
|
}
|
|
|
|
|
|
-//拼装子包信息
|
|
|
|
|
|
+// 拼装子包信息
|
|
func setPaceMap(info map[string]interface{}) ([]map[string]interface{}, []string, []bool) {
|
|
func setPaceMap(info map[string]interface{}) ([]map[string]interface{}, []string, []bool) {
|
|
var confpack []interface{}
|
|
var confpack []interface{}
|
|
confpack, _ = util.Config.Biaozhu["package"].([]interface{})
|
|
confpack, _ = util.Config.Biaozhu["package"].([]interface{})
|
|
@@ -404,7 +401,7 @@ func setPaceMap(info map[string]interface{}) ([]map[string]interface{}, []string
|
|
return packages, sortpackskey, isNewPkgArr
|
|
return packages, sortpackskey, isNewPkgArr
|
|
}
|
|
}
|
|
|
|
|
|
-//拼装抽取common值
|
|
|
|
|
|
+// 拼装抽取common值
|
|
func setExtComMap(info map[string]interface{}) ([]interface{}, []interface{}, []interface{}) {
|
|
func setExtComMap(info map[string]interface{}) ([]interface{}, []interface{}, []interface{}) {
|
|
//基本参数
|
|
//基本参数
|
|
common, _ := util.Config.Biaozhu["common"].([]interface{})
|
|
common, _ := util.Config.Biaozhu["common"].([]interface{})
|
|
@@ -488,7 +485,7 @@ func setExtComMap(info map[string]interface{}) ([]interface{}, []interface{}, []
|
|
return common, timeplace, other
|
|
return common, timeplace, other
|
|
}
|
|
}
|
|
|
|
|
|
-//标注基本字段
|
|
|
|
|
|
+// 标注基本字段
|
|
func BzJBZD(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
func BzJBZD(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
info, _ := content[0].(map[string]interface{})
|
|
info, _ := content[0].(map[string]interface{})
|
|
if uInputs, ok := info["uInput"].([]interface{}); ok {
|
|
if uInputs, ok := info["uInput"].([]interface{}); ok {
|
|
@@ -532,7 +529,7 @@ func BzJBZD(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//标注时间地点
|
|
|
|
|
|
+// 标注时间地点
|
|
func BzSJDD(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
func BzSJDD(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
info, _ := content[0].(map[string]interface{})
|
|
info, _ := content[0].(map[string]interface{})
|
|
if uInputs, ok := info["uInput"].([]interface{}); ok {
|
|
if uInputs, ok := info["uInput"].([]interface{}); ok {
|
|
@@ -567,7 +564,7 @@ func BzSJDD(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
// qu.Debug("unset---", unset)
|
|
// qu.Debug("unset---", unset)
|
|
}
|
|
}
|
|
|
|
|
|
-//标注标的信息
|
|
|
|
|
|
+// 标注标的信息
|
|
func BzBDXX(content []interface{}, set, unset, errset map[string]interface{}, isext, istag bool, status int) {
|
|
func BzBDXX(content []interface{}, set, unset, errset map[string]interface{}, isext, istag bool, status int) {
|
|
//qu.Debug("是否抽取:", status, isext, len(content), errset)
|
|
//qu.Debug("是否抽取:", status, isext, len(content), errset)
|
|
if status == -1 {
|
|
if status == -1 {
|
|
@@ -632,7 +629,7 @@ func BzBDXX(content []interface{}, set, unset, errset map[string]interface{}, is
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//标注多包信息
|
|
|
|
|
|
+// 标注多包信息
|
|
func BzDBXX(content []interface{}, set, unset, errset map[string]interface{}, isext bool, status int) {
|
|
func BzDBXX(content []interface{}, set, unset, errset map[string]interface{}, isext bool, status int) {
|
|
//qu.Debug("是否抽取:", status, isext, len(content), errset)
|
|
//qu.Debug("是否抽取:", status, isext, len(content), errset)
|
|
if status == -1 {
|
|
if status == -1 {
|
|
@@ -751,7 +748,7 @@ func BzDBXX(content []interface{}, set, unset, errset map[string]interface{}, is
|
|
// qu.Debug("errset---", errset)
|
|
// qu.Debug("errset---", errset)
|
|
}
|
|
}
|
|
|
|
|
|
-//标注中标候选人信息
|
|
|
|
|
|
+// 标注中标候选人信息
|
|
func BzZBHXRXX(content []interface{}, set, unset, errset map[string]interface{}, isext bool, status int) {
|
|
func BzZBHXRXX(content []interface{}, set, unset, errset map[string]interface{}, isext bool, status int) {
|
|
if status == -1 {
|
|
if status == -1 {
|
|
return
|
|
return
|
|
@@ -811,7 +808,7 @@ func BzZBHXRXX(content []interface{}, set, unset, errset map[string]interface{},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//标注其余信息
|
|
|
|
|
|
+// 标注其余信息
|
|
func BzQYXX(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
func BzQYXX(content []interface{}, set, unset, errset map[string]interface{}) {
|
|
info, _ := content[0].(map[string]interface{})
|
|
info, _ := content[0].(map[string]interface{})
|
|
if uInputs, ok := info["uInput"].([]interface{}); ok {
|
|
if uInputs, ok := info["uInput"].([]interface{}); ok {
|
|
@@ -874,7 +871,7 @@ func mapIntAdd(k, val string, tmp map[string]map[string]int) map[string]map[stri
|
|
return tmp
|
|
return tmp
|
|
}
|
|
}
|
|
|
|
|
|
-//通过id查询数据
|
|
|
|
|
|
+// 通过id查询数据
|
|
func GetDataById(coll string, ids []string, stype string, tmp map[string]map[string]interface{}) (bool, string, int64) {
|
|
func GetDataById(coll string, ids []string, stype string, tmp map[string]map[string]interface{}) (bool, string, int64) {
|
|
defer qu.Catch()
|
|
defer qu.Catch()
|
|
success := true
|
|
success := true
|
|
@@ -987,7 +984,7 @@ func GetDataById(coll string, ids []string, stype string, tmp map[string]map[str
|
|
return success, msg, n
|
|
return success, msg, n
|
|
}
|
|
}
|
|
|
|
|
|
-//通过id查询数据
|
|
|
|
|
|
+// 通过id查询数据
|
|
func GetDataById1(coll string, ids []string, stype string, tmp map[string]map[string]interface{}) (bool, string, int64) {
|
|
func GetDataById1(coll string, ids []string, stype string, tmp map[string]map[string]interface{}) (bool, string, int64) {
|
|
defer qu.Catch()
|
|
defer qu.Catch()
|
|
success := true
|
|
success := true
|
|
@@ -1152,7 +1149,7 @@ func GetDataById1(coll string, ids []string, stype string, tmp map[string]map[st
|
|
return success, msg, n
|
|
return success, msg, n
|
|
}
|
|
}
|
|
|
|
|
|
-//更新数据
|
|
|
|
|
|
+// 更新数据
|
|
func UpdateMarkColl(bidData, markData *map[string]interface{}) {
|
|
func UpdateMarkColl(bidData, markData *map[string]interface{}) {
|
|
defer qu.Catch()
|
|
defer qu.Catch()
|
|
ck_data := qu.IntAll((*markData)["ck_data"])
|
|
ck_data := qu.IntAll((*markData)["ck_data"])
|
|
@@ -1174,11 +1171,11 @@ func UpdateMarkColl(bidData, markData *map[string]interface{}) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//获取当前数据下一条的id
|
|
|
|
|
|
+// 获取当前数据下一条的id
|
|
func GetNextDataId(id, coll string, query map[string]interface{}) string {
|
|
func GetNextDataId(id, coll string, query map[string]interface{}) string {
|
|
nextIdQuery := map[string]interface{}{
|
|
nextIdQuery := map[string]interface{}{
|
|
"_id": map[string]interface{}{
|
|
"_id": map[string]interface{}{
|
|
- "$gt": mgo.StringTOBsonId(id),
|
|
|
|
|
|
+ "$gt": mongodb.StringTOBsonId(id),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
for k, v := range query {
|
|
for k, v := range query {
|
|
@@ -1187,12 +1184,12 @@ func GetNextDataId(id, coll string, query map[string]interface{}) string {
|
|
|
|
|
|
one, _ := util.MgoM.Find(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 {
|
|
if one != nil && len(*one) == 1 {
|
|
- return mgo.BsonIdToSId((*one)[0]["_id"])
|
|
|
|
|
|
+ return mongodb.BsonIdToSId((*one)[0]["_id"])
|
|
}
|
|
}
|
|
return id
|
|
return id
|
|
}
|
|
}
|
|
|
|
|
|
-//获取已标注和数据总数的信息
|
|
|
|
|
|
+// 获取已标注和数据总数的信息
|
|
func GetCheckedAndAllDataInfo(query map[string]interface{}, coll string) (int, int) {
|
|
func GetCheckedAndAllDataInfo(query map[string]interface{}, coll string) (int, int) {
|
|
allCount := util.MgoM.Count(coll, query)
|
|
allCount := util.MgoM.Count(coll, query)
|
|
ckDataQuery := map[string]interface{}{
|
|
ckDataQuery := map[string]interface{}{
|
|
@@ -1207,7 +1204,7 @@ func GetCheckedAndAllDataInfo(query map[string]interface{}, coll string) (int, i
|
|
return checkedCount, allCount
|
|
return checkedCount, allCount
|
|
}
|
|
}
|
|
|
|
|
|
-//查询表中已标数据的标注人
|
|
|
|
|
|
+// 查询表中已标数据的标注人
|
|
func GetLabeler(coll string) (labeler []string) {
|
|
func GetLabeler(coll string) (labeler []string) {
|
|
defer qu.Catch()
|
|
defer qu.Catch()
|
|
sess := util.MgoM.GetMgoConn()
|
|
sess := util.MgoM.GetMgoConn()
|