|
@@ -18,6 +18,18 @@ import (
|
|
|
"util"
|
|
|
)
|
|
|
|
|
|
+// ProjectIsExists 获取所有项目名称
|
|
|
+func (f *Front) ProjectIsExists() {
|
|
|
+ defer qu.Catch()
|
|
|
+ name := f.GetString("s_name")
|
|
|
+ exists := false
|
|
|
+ project, _ := util.Mgo.FindOne(util.PROJECTCOLLNAME, map[string]interface{}{"s_name": name})
|
|
|
+ if project != nil && len(*project) > 0 {
|
|
|
+ exists = true
|
|
|
+ }
|
|
|
+ f.ServeJson(map[string]interface{}{"exists": exists})
|
|
|
+}
|
|
|
+
|
|
|
// ProjectList 项目列表
|
|
|
func (f *Front) ProjectList() {
|
|
|
defer qu.Catch()
|
|
@@ -70,6 +82,10 @@ func (f *Front) ProjectSave() {
|
|
|
stype := f.GetString("s_type") //新建项目类型:数据库导入、excel导入
|
|
|
s_sourceinfoTmp := f.GetString("s_sourceinfo") //数据表
|
|
|
s_sourceinfo := "f_sourceinfo_" + s_sourceinfoTmp
|
|
|
+ if !util.Mgo.CreateIndex(s_sourceinfo, util.SourceInfoIndexArr) { //创建数据源表同时生成字段索引
|
|
|
+ f.ServeJson(map[string]interface{}{"success": false, "msg": "数据源表创建失败"})
|
|
|
+ return
|
|
|
+ }
|
|
|
if stype != "edit" && s_sourceinfo == "" {
|
|
|
f.ServeJson(map[string]interface{}{"success": false, "msg": "缺少数据存储表名"})
|
|
|
return
|
|
@@ -79,7 +95,6 @@ func (f *Front) ProjectSave() {
|
|
|
"s_name": s_name,
|
|
|
}
|
|
|
set := map[string]interface{}{}
|
|
|
- qu.Debug(stype)
|
|
|
//导入数据
|
|
|
if stype == "excel" { //excel导入
|
|
|
s_entname = f.GetString("s_entname") //公司名称
|
|
@@ -369,7 +384,6 @@ func (f *Front) ProjectGroupTaskSave() {
|
|
|
projectname := qu.ObjToString((*project)["s_name"]) //项目名称
|
|
|
sourceinfo := qu.ObjToString((*project)["s_sourceinfo"]) //源数据表
|
|
|
group := f.GetString("s_group")
|
|
|
- qu.Debug(group)
|
|
|
stype := f.GetString("s_type")
|
|
|
qu.Debug("项目id:", projectid, " 项目名称:", projectname)
|
|
|
if err := json.Unmarshal([]byte(group), &groupArr); err != nil {
|
|
@@ -909,7 +923,9 @@ func ImportDataByColl(s_sourceinfo, historyid string, success *bool, msg *string
|
|
|
}
|
|
|
rname := qu.ObjToString(tmp["rulename"])
|
|
|
lock.Lock()
|
|
|
- rulenameMap[rname] = true
|
|
|
+ for _, r := range strings.Split(rname, ",") {
|
|
|
+ rulenameMap[r] = true
|
|
|
+ }
|
|
|
//rulename = append(rulename, qu.ObjToString(tmp["rulename"])) //规则名称
|
|
|
idInfoMap[id] = needField
|
|
|
lock.Unlock()
|
|
@@ -969,9 +985,9 @@ func GetDataById(idsInfo map[string]map[string]interface{}, importType, s_source
|
|
|
bidData, _ := util.MgoB.FindById(tmpBidColl, id, nil)
|
|
|
if bidData != nil && len(*bidData) > 0 { //bidding表数据存在
|
|
|
//2.查extract
|
|
|
- extData, _ := util.MgoE.FindById(util.ExtColl1, id, nil)
|
|
|
+ extData, _ := util.MgoE.FindById(util.ExtColl1, id, map[string]interface{}{"attach_text": 0})
|
|
|
if extData == nil || len(*extData) == 0 {
|
|
|
- extData, _ = util.MgoE.FindById(util.ExtColl2, id, nil)
|
|
|
+ extData, _ = util.MgoE.FindById(util.ExtColl2, id, map[string]interface{}{"attach_text": 0})
|
|
|
}
|
|
|
//抽取表字段合并到bidding
|
|
|
if extData != nil && len(*extData) > 0 {
|
|
@@ -1044,36 +1060,40 @@ func GetDataById(idsInfo map[string]map[string]interface{}, importType, s_source
|
|
|
//esQ := `{"query":{"bool":{"must":[{"term":{"ids":"` + id + `"}}]}}}`
|
|
|
//info := util.Es.Get("projectset", "projectset", esQ)
|
|
|
projectId := qu.ObjToString((*bidData)["projectId"])
|
|
|
- project, _ := util.MgoE.FindById(util.ProjectColl, projectId, map[string]interface{}{"ids": 1})
|
|
|
- if project != nil && len(*project) > 0 {
|
|
|
- ids := qu.ObjArrToStringArr((*project)["ids"].([]interface{}))
|
|
|
- if len(ids) > 0 {
|
|
|
- var infolist []map[string]interface{}
|
|
|
- for _, v := range ids {
|
|
|
- if v == id { // 当前公告
|
|
|
- continue
|
|
|
- }
|
|
|
- if v < util.BIDDINGSTARTID {
|
|
|
- tmpBidColl = util.BidColl2 //bidding_back
|
|
|
- }
|
|
|
- bid, b := util.MgoB.FindById(tmpBidColl, v, nil)
|
|
|
- if b && len(*bid) > 0 {
|
|
|
- tmp := make(map[string]interface{})
|
|
|
- tmp["id"] = v
|
|
|
- tmp["title"] = (*bid)["title"]
|
|
|
- tmp["href"] = (*bid)["href"]
|
|
|
- tmp["toptype"] = (*bid)["toptype"]
|
|
|
- tmp["subtype"] = (*bid)["subtype"]
|
|
|
- tmp["publishtime"] = (*bid)["publishtime"]
|
|
|
- tmp["detail"] = (*bid)["detail"]
|
|
|
- tmp["filetext"] = util.GetFileText(*bid)
|
|
|
- infolist = append(infolist, tmp)
|
|
|
+ if projectId != "" && len(projectId) == 24 { //舍弃项目id为空和合并错误的
|
|
|
+ project, _ := util.MgoE.FindById(util.ProjectColl, projectId, map[string]interface{}{"ids": 1})
|
|
|
+ if project != nil && len(*project) > 0 {
|
|
|
+ ids := qu.ObjArrToStringArr((*project)["ids"].([]interface{}))
|
|
|
+ if len(ids) > 0 {
|
|
|
+ var infolist []map[string]interface{}
|
|
|
+ for _, v := range ids {
|
|
|
+ if v == id { // 当前公告
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if v < util.BIDDINGSTARTID {
|
|
|
+ tmpBidColl = util.BidColl2 //bidding_back
|
|
|
+ }
|
|
|
+ bid, b := util.MgoB.FindById(tmpBidColl, v, nil)
|
|
|
+ if b && len(*bid) > 0 {
|
|
|
+ tmp := make(map[string]interface{})
|
|
|
+ tmp["id"] = v
|
|
|
+ tmp["title"] = (*bid)["title"]
|
|
|
+ tmp["href"] = (*bid)["href"]
|
|
|
+ tmp["toptype"] = (*bid)["toptype"]
|
|
|
+ tmp["subtype"] = (*bid)["subtype"]
|
|
|
+ tmp["publishtime"] = (*bid)["publishtime"]
|
|
|
+ tmp["detail"] = (*bid)["detail"]
|
|
|
+ tmp["filetext"] = util.GetFileText(*bid)
|
|
|
+ infolist = append(infolist, tmp)
|
|
|
+ }
|
|
|
}
|
|
|
+ (*bidData)["info"] = infolist
|
|
|
}
|
|
|
- (*bidData)["info"] = infolist
|
|
|
+ } else {
|
|
|
+ qu.Debug("Projectset Find Error", projectId)
|
|
|
}
|
|
|
} else {
|
|
|
- qu.Debug("Projectset Find Error", projectId, ", tmp--", tmp)
|
|
|
+ qu.Debug("ProjectId Is Null", id)
|
|
|
}
|
|
|
baseInfoMap["id"] = id
|
|
|
_id := (*bidData)["_id"]
|