|
@@ -32,13 +32,11 @@ func (weight *weightDataMap) dealWithAddFusionStruct ()(map[string]interface{},m
|
|
dict["fusion_templateid"] = weight.templateid
|
|
dict["fusion_templateid"] = weight.templateid
|
|
//站点,质量分
|
|
//站点,质量分
|
|
dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
|
|
dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ //记录所有href
|
|
|
|
+ dict["fusion_all_hrefs"] = weight.allhrefs
|
|
//采用新增id
|
|
//采用新增id
|
|
delete(dict,"_id")
|
|
delete(dict,"_id")
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ //日志相关处理
|
|
recordDict := make(map[string]interface{},0)
|
|
recordDict := make(map[string]interface{},0)
|
|
recordDict["1"] = map[string]interface{}{
|
|
recordDict["1"] = map[string]interface{}{
|
|
"data":map[string]interface{}{},
|
|
"data":map[string]interface{}{},
|
|
@@ -67,9 +65,17 @@ func (weight *weightDataMap) dealWithMultipleAddFusionStruct ()(map[string]inter
|
|
dict["fusion_templateid"] = weight.templateid
|
|
dict["fusion_templateid"] = weight.templateid
|
|
//站点,质量分
|
|
//站点,质量分
|
|
dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
|
|
dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
|
|
|
|
+ //当前更新时间
|
|
|
|
+ dict["fusion_time"] = qu.IntAll(time.Now().Unix())
|
|
|
|
+ //融合生成时间
|
|
|
|
+ dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
|
|
|
|
+ //记录所有href
|
|
|
|
+ dict["fusion_all_hrefs"] = weight.allhrefs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ //采用新增id
|
|
|
|
+ delete(dict,"_id")
|
|
//日志记录
|
|
//日志记录
|
|
recordDict := make(map[string]interface{},0)
|
|
recordDict := make(map[string]interface{},0)
|
|
//结构体字段逻辑处理
|
|
//结构体字段逻辑处理
|
|
@@ -82,20 +88,6 @@ func (weight *weightDataMap) dealWithMultipleAddFusionStruct ()(map[string]inter
|
|
for k,v:=range otherFieldData {
|
|
for k,v:=range otherFieldData {
|
|
dict[k] = v
|
|
dict[k] = v
|
|
}
|
|
}
|
|
-
|
|
|
|
- //if len(recordDict)>0 {
|
|
|
|
- // log.Println("有更新数据:",len(recordDict))
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- //当前更新时间
|
|
|
|
- dict["fusion_time"] = qu.IntAll(time.Now().Unix())
|
|
|
|
- //融合生成时间
|
|
|
|
- dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //采用新增id
|
|
|
|
- delete(dict,"_id")
|
|
|
|
-
|
|
|
|
newRecordDict := make(map[string]interface{},0)
|
|
newRecordDict := make(map[string]interface{},0)
|
|
newRecordDict["1"] = map[string]interface{}{
|
|
newRecordDict["1"] = map[string]interface{}{
|
|
"data":recordDict,
|
|
"data":recordDict,
|
|
@@ -103,64 +95,9 @@ func (weight *weightDataMap) dealWithMultipleAddFusionStruct ()(map[string]inter
|
|
}
|
|
}
|
|
newRecordDict["number"] = qu.Int64All(1)
|
|
newRecordDict["number"] = qu.Int64All(1)
|
|
|
|
|
|
|
|
+ //融合表记录的字段
|
|
|
|
+ dict["fusion_fields"] = weight.dealWithFusionFields(recordDict)
|
|
|
|
|
|
- //分析recordDict记录在融合表里
|
|
|
|
- /*
|
|
|
|
- {
|
|
|
|
- "item" : {
|
|
|
|
- "id" : "603c7addf021652bdeb21fc6",
|
|
|
|
- "value" : "建材"
|
|
|
|
- }
|
|
|
|
- "bidamount" : {
|
|
|
|
- "id" : "603bc7d036baf5b8f2bb159a",
|
|
|
|
- "value" : 8005829.82
|
|
|
|
- }
|
|
|
|
- "attach_text" : [
|
|
|
|
- {
|
|
|
|
- "id" : "5ff1f441c2c0c99d52d74130",
|
|
|
|
- "value" : {
|
|
|
|
- "0" : {
|
|
|
|
- "file_name" : "技术参数.docx",
|
|
|
|
- "attach_url" : "93736308-4de4-11eb-9409-0242ac120005"
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- //attach_text需要单独处理
|
|
|
|
- fieldCal := make(map[string]interface{},0)
|
|
|
|
- for k,v:=range recordDict{
|
|
|
|
- if k=="attach_text" {
|
|
|
|
- if attachArr,b := v.([]map[string]interface{});b {
|
|
|
|
- for _,v1:=range attachArr {
|
|
|
|
- dict := *qu.ObjToMap(v1)
|
|
|
|
- tmp_id := qu.ObjToString(dict["id"])
|
|
|
|
- if fieldCal[tmp_id]==nil {
|
|
|
|
- fieldCal[tmp_id] = []interface{}{k}
|
|
|
|
- }else {
|
|
|
|
- arr := fieldCal[tmp_id].([]interface{})
|
|
|
|
- arr = append(arr,k)
|
|
|
|
- fieldCal[tmp_id] = arr
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else {
|
|
|
|
- dict := *qu.ObjToMap(v)
|
|
|
|
- tmp_id := qu.ObjToString(dict["id"])
|
|
|
|
- if fieldCal[tmp_id]==nil {
|
|
|
|
- fieldCal[tmp_id] = []interface{}{k}
|
|
|
|
- }else {
|
|
|
|
- arr := fieldCal[tmp_id].([]interface{})
|
|
|
|
- arr = append(arr,k)
|
|
|
|
- fieldCal[tmp_id] = arr
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- dict["fusion_fields"] = fieldCal
|
|
|
|
|
|
|
|
//返回,更新数据,日志记录数据
|
|
//返回,更新数据,日志记录数据
|
|
return dict,newRecordDict
|
|
return dict,newRecordDict
|
|
@@ -181,11 +118,16 @@ func (weight *weightDataMap) dealWithMultipleUpdateFusionStruct (tmpData map[str
|
|
dict["fusion_saveids"] = weight.saveids
|
|
dict["fusion_saveids"] = weight.saveids
|
|
//融合模板
|
|
//融合模板
|
|
dict["fusion_templateid"] = weight.templateid
|
|
dict["fusion_templateid"] = weight.templateid
|
|
|
|
+ //记录所有href
|
|
|
|
+ dict["fusion_all_hrefs"] = weight.allhrefs
|
|
//站点,质量分
|
|
//站点,质量分
|
|
dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
|
|
dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ //融合生成时间-取融合表第一次融合时间
|
|
|
|
+ dict["fusion_time"] = tmpData["fusion_time"]
|
|
|
|
+ //当前更新时间
|
|
|
|
+ dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
|
|
|
|
+ //删除_id
|
|
|
|
+ delete(dict,"_id")
|
|
|
|
|
|
|
|
|
|
//日志记录-还有快照页面 等等
|
|
//日志记录-还有快照页面 等等
|
|
@@ -200,19 +142,6 @@ func (weight *weightDataMap) dealWithMultipleUpdateFusionStruct (tmpData map[str
|
|
for k,v:=range otherFieldData {
|
|
for k,v:=range otherFieldData {
|
|
dict[k] = v
|
|
dict[k] = v
|
|
}
|
|
}
|
|
-
|
|
|
|
- //if len(recordDict)>0 {
|
|
|
|
- // log.Println("有更新数据:",len(recordDict))
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //融合生成时间-取融合表第一次融合时间
|
|
|
|
- dict["fusion_time"] = tmpData["fusion_time"]
|
|
|
|
- //当前更新时间
|
|
|
|
- dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
|
|
|
|
- //删除_id
|
|
|
|
- delete(dict,"_id")
|
|
|
|
-
|
|
|
|
newRecordDict := make(map[string]interface{},0)
|
|
newRecordDict := make(map[string]interface{},0)
|
|
newRecordDict = mgo.FindById(record_coll_name,BsonTOStringId(tmpData["_id"]))
|
|
newRecordDict = mgo.FindById(record_coll_name,BsonTOStringId(tmpData["_id"]))
|
|
number:=qu.Int64All(newRecordDict["number"])
|
|
number:=qu.Int64All(newRecordDict["number"])
|
|
@@ -224,71 +153,19 @@ func (weight *weightDataMap) dealWithMultipleUpdateFusionStruct (tmpData map[str
|
|
}
|
|
}
|
|
newRecordDict["number"] = number
|
|
newRecordDict["number"] = number
|
|
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- "data" : {
|
|
|
|
- "attach_text" : [
|
|
|
|
- {
|
|
|
|
- "id" : "5ff1f441c2c0c99d52d74130",
|
|
|
|
- "value" : {
|
|
|
|
- "0" : {
|
|
|
|
- "file_name" : "技术参数.docx",
|
|
|
|
- "attach_url" : "93736308-4de4-11eb-9409-0242ac120005"
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- "isextFile" : {
|
|
|
|
- "id" : "5ff1f441c2c0c99d52d74130",
|
|
|
|
- "value" : true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- //attach_text需要单独处理
|
|
|
|
- fieldCal := make(map[string]interface{},0)
|
|
|
|
- for k,v:=range recordDict{
|
|
|
|
- if k=="attach_text" {
|
|
|
|
- if attachArr,b := v.([]map[string]interface{});b {
|
|
|
|
- for _,v1:=range attachArr {
|
|
|
|
- dict := *qu.ObjToMap(v1)
|
|
|
|
- tmp_id := qu.ObjToString(dict["id"])
|
|
|
|
- if fieldCal[tmp_id]==nil {
|
|
|
|
- fieldCal[tmp_id] = []interface{}{k}
|
|
|
|
- }else {
|
|
|
|
- arr := fieldCal[tmp_id].([]interface{})
|
|
|
|
- arr = append(arr,k)
|
|
|
|
- fieldCal[tmp_id] = arr
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else {
|
|
|
|
- dict := *qu.ObjToMap(v)
|
|
|
|
- tmp_id := qu.ObjToString(dict["id"])
|
|
|
|
- if fieldCal[tmp_id]==nil {
|
|
|
|
- fieldCal[tmp_id] = []interface{}{k}
|
|
|
|
- }else {
|
|
|
|
- arr := fieldCal[tmp_id].([]interface{})
|
|
|
|
- arr = append(arr,k)
|
|
|
|
- fieldCal[tmp_id] = arr
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- dict["fusion_fields"] = fieldCal
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ //融合表记录的字段
|
|
|
|
+ dict["fusion_fields"] = weight.dealWithFusionFields(recordDict)
|
|
|
|
|
|
//返回,更新数据,日志记录数据
|
|
//返回,更新数据,日志记录数据
|
|
return dict,newRecordDict
|
|
return dict,newRecordDict
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+/*
|
|
|
|
+ 字段处理方法
|
|
|
|
+ **********************
|
|
|
|
+ **********************
|
|
|
|
+*/
|
|
|
|
|
|
//处理其他字段数据
|
|
//处理其他字段数据
|
|
func (weight *weightDataMap)dealWithOtherFieldData(recordDict *map[string]interface{}) map[string]interface{} {
|
|
func (weight *weightDataMap)dealWithOtherFieldData(recordDict *map[string]interface{}) map[string]interface{} {
|
|
@@ -296,9 +173,7 @@ func (weight *weightDataMap)dealWithOtherFieldData(recordDict *map[string]interf
|
|
//模板id 数据
|
|
//模板id 数据
|
|
templateid := weight.templateid
|
|
templateid := weight.templateid
|
|
templateTmp := weight.data[templateid].data
|
|
templateTmp := weight.data[templateid].data
|
|
-
|
|
|
|
modifyData := make(map[string]interface{}, 0) //返回修改的数据
|
|
modifyData := make(map[string]interface{}, 0) //返回修改的数据
|
|
-
|
|
|
|
//找到非空数据
|
|
//找到非空数据
|
|
arr := make([]string,0)
|
|
arr := make([]string,0)
|
|
for key,value:=range templateTmp {
|
|
for key,value:=range templateTmp {
|
|
@@ -340,8 +215,6 @@ func (weight *weightDataMap)dealWithOtherFieldData(recordDict *map[string]interf
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
//log.Println("待替换key:",arr,"修改后:",modifyData)
|
|
//log.Println("待替换key:",arr,"修改后:",modifyData)
|
|
|
|
|
|
//第二步-集合最大化
|
|
//第二步-集合最大化
|
|
@@ -392,40 +265,19 @@ func (weight *weightDataMap)dealWithStructData(recordDict *map[string]interface{
|
|
|
|
|
|
modifyData :=make(map[string]interface{},0)
|
|
modifyData :=make(map[string]interface{},0)
|
|
|
|
|
|
- //附件attach_text
|
|
|
|
- /*
|
|
|
|
- "attach_text" : {
|
|
|
|
- "1" : {
|
|
|
|
- "0" : {
|
|
|
|
- "file_name" : "政采贷融资.doc",
|
|
|
|
- "attach_url" : "d5ca0944-6af1-11eb-a8bb-0242ac120002"
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- "0" : {
|
|
|
|
- "0" : {
|
|
|
|
- "file_name" : "01永嘉县人民医院发光免疫试剂采购及设备租赁项目公开招标文件(电子招标).doc",
|
|
|
|
- "attach_url" : "7827b2d4-6adb-11eb-bd40-0242ac120002"
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
attach_text,isAttach:=make(map[string]interface{},0),false
|
|
attach_text,isAttach:=make(map[string]interface{},0),false
|
|
if tmp_arr,b := templateTmp["attach_text"].(map[string]interface{});b {
|
|
if tmp_arr,b := templateTmp["attach_text"].(map[string]interface{});b {
|
|
//有值符合-
|
|
//有值符合-
|
|
attach_text = tmp_arr
|
|
attach_text = tmp_arr
|
|
- //log.Println("默认初始:",attach_text)
|
|
|
|
}
|
|
}
|
|
//附件判重-并合并新增
|
|
//附件判重-并合并新增
|
|
keyIndex := -1
|
|
keyIndex := -1
|
|
- //找到当前最大keyIndex
|
|
|
|
for k,_:=range attach_text {
|
|
for k,_:=range attach_text {
|
|
key:=qu.IntAll(k)
|
|
key:=qu.IntAll(k)
|
|
if key>keyIndex {
|
|
if key>keyIndex {
|
|
keyIndex = key
|
|
keyIndex = key
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //log.Println("当前keyIndex",keyIndex)
|
|
|
|
for _,value_id :=range weight.saveids {
|
|
for _,value_id :=range weight.saveids {
|
|
if templateid == value_id {
|
|
if templateid == value_id {
|
|
continue
|
|
continue
|
|
@@ -435,13 +287,11 @@ func (weight *weightDataMap)dealWithStructData(recordDict *map[string]interface{
|
|
if len(attachData)>0 { //有值
|
|
if len(attachData)>0 { //有值
|
|
for _,v:=range attachData { //子元素
|
|
for _,v:=range attachData { //子元素
|
|
if attach,isOK := v.(map[string]interface{});isOK {
|
|
if attach,isOK := v.(map[string]interface{});isOK {
|
|
- //log.Println(attach)
|
|
|
|
if !dealWithRepeatAttachData(attach_text,attach) {
|
|
if !dealWithRepeatAttachData(attach_text,attach) {
|
|
//符合条件-不重复直接添加
|
|
//符合条件-不重复直接添加
|
|
keyIndex++
|
|
keyIndex++
|
|
saveKey := fmt.Sprintf("%v",keyIndex)
|
|
saveKey := fmt.Sprintf("%v",keyIndex)
|
|
attach_text[saveKey] = attach //key累加
|
|
attach_text[saveKey] = attach //key累加
|
|
- //log.Println(attach_text)
|
|
|
|
isAttach = true
|
|
isAttach = true
|
|
|
|
|
|
//多条情况-融合
|
|
//多条情况-融合
|
|
@@ -538,6 +388,12 @@ func (weight *weightDataMap)dealWithStructData(recordDict *map[string]interface{
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ 以下方法-记录统计
|
|
|
|
+ ******************************
|
|
|
|
+ ******************************
|
|
|
|
+*/
|
|
func (weight *weightDataMap) dealWithLevelAndScoreRecord () map[string]interface{}{
|
|
func (weight *weightDataMap) dealWithLevelAndScoreRecord () map[string]interface{}{
|
|
dict := make(map[string]interface{},0)
|
|
dict := make(map[string]interface{},0)
|
|
saveids:= weight.saveids
|
|
saveids:= weight.saveids
|
|
@@ -549,3 +405,39 @@ func (weight *weightDataMap) dealWithLevelAndScoreRecord () map[string]interface
|
|
}
|
|
}
|
|
return dict
|
|
return dict
|
|
}
|
|
}
|
|
|
|
+//处理-融合的哪些字段记录
|
|
|
|
+func (weight *weightDataMap)dealWithFusionFields(data map[string]interface{}) map[string]interface{} {
|
|
|
|
+ fieldCal := make(map[string]interface{},0)
|
|
|
|
+ for k,v:=range data{
|
|
|
|
+ if k=="attach_text" {
|
|
|
|
+ if attachArr,b := v.([]map[string]interface{});b {
|
|
|
|
+ for _,v1:=range attachArr {
|
|
|
|
+ dict := *qu.ObjToMap(v1)
|
|
|
|
+ tmp_id := qu.ObjToString(dict["id"])
|
|
|
|
+ if fieldCal[tmp_id]==nil {
|
|
|
|
+ href:=qu.ObjToString(weight.data[tmp_id].data["href"])
|
|
|
|
+ fieldCal[tmp_id] = []interface{}{href,k}
|
|
|
|
+ }else {
|
|
|
|
+ arr := fieldCal[tmp_id].([]interface{})
|
|
|
|
+ arr = append(arr,k)
|
|
|
|
+ fieldCal[tmp_id] = arr
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ dict := *qu.ObjToMap(v)
|
|
|
|
+ tmp_id := qu.ObjToString(dict["id"])
|
|
|
|
+ if fieldCal[tmp_id]==nil {
|
|
|
|
+ href:=qu.ObjToString(weight.data[tmp_id].data["href"])
|
|
|
|
+ fieldCal[tmp_id] = []interface{}{href,k}
|
|
|
|
+ }else {
|
|
|
|
+ arr := fieldCal[tmp_id].([]interface{})
|
|
|
|
+ arr = append(arr,k)
|
|
|
|
+ fieldCal[tmp_id] = arr
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return fieldCal
|
|
|
|
+}
|
|
|
|
+
|