|
@@ -3,6 +3,7 @@ package front
|
|
|
import (
|
|
|
"fmt"
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
+ "math"
|
|
|
mgo "mongodb"
|
|
|
qu "qfw/util"
|
|
|
"sort"
|
|
@@ -25,10 +26,11 @@ func (f *Front) RemarkList() {
|
|
|
query := map[string]interface{}{"s_usertaskid": tid}
|
|
|
if search != "" {
|
|
|
query["$or"] = []interface{}{
|
|
|
- bson.M{"s_name": bson.M{"$regex": search}},
|
|
|
+ bson.M{"v_baseinfo.title": bson.M{"$regex": search}},
|
|
|
}
|
|
|
}
|
|
|
- info, _ := util.Mgo.Find(sourceinfo, query, `{"_id": 1}`, nil, false, start, limit)
|
|
|
+ field := map[string]interface{}{"title": 1, "v_baseinfo": 1, "b_istag": 1}
|
|
|
+ info, _ := util.Mgo.Find(sourceinfo, query, `{"_id": 1}`, field, false, start, limit)
|
|
|
count := util.Mgo.Count(sourceinfo, query)
|
|
|
qu.Debug(query, sourceinfo, count)
|
|
|
f.ServeJson(map[string]interface{}{
|
|
@@ -45,7 +47,10 @@ func (f *Front) RemarkList() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (f *Front) RemarkDetail(id, coll string) {
|
|
|
+func (f *Front) RemarkDetail() {
|
|
|
+ id := f.GetString("gid")
|
|
|
+ coll := f.GetString("s_sourceinfo")
|
|
|
+ qu.Debug("------------", id, coll)
|
|
|
rep := getDetail(id, coll) //获取本条公告的信息
|
|
|
f.T["otherInfo"] = rep["otherInfo"] //展示关联公告信息
|
|
|
f.T["moreInfo"] = rep["moreInfo"] //更多关联公告信息
|
|
@@ -58,22 +63,19 @@ func (f *Front) RemarkDetail(id, coll string) {
|
|
|
f.T["timeplace"] = rep["timeplace"]
|
|
|
f.T["purchasinglist"] = rep["purchasinglist"]
|
|
|
f.T["other"] = rep["other"]
|
|
|
-
|
|
|
f.T["PurchasinglistField"] = util.PurchasinglistField
|
|
|
f.T["WinnerorderField"] = util.WinnerorderField
|
|
|
f.T["PackageField"] = util.PackageField
|
|
|
f.T["topsubtype"] = util.TopSubStypeArr2
|
|
|
- f.T[preKey+"purchasinglist"] = rep[preKey+"purchasinglist"]
|
|
|
- f.T[preKey+"package"] = rep[preKey+"package"]
|
|
|
- f.T[preKey+"winnerorder"] = rep[preKey+"winnerorder"]
|
|
|
+ f.T["ck_purchasinglist"] = rep["ck_purchasinglist"]
|
|
|
+ f.T["ck_package"] = rep["ck_package"]
|
|
|
+ f.T["ck_winnerorder"] = rep["ck_winnerorder"]
|
|
|
f.T["worder_new"] = rep["worder_new"]
|
|
|
f.T["pcl_new"] = rep["pcl_new"]
|
|
|
f.T["pkg_new"] = rep["pkg_new"]
|
|
|
- f.T["nextid"] = GetNextDataId(id, coll, query) //下一条id
|
|
|
- checkedNum, allNum := GetCheckedAndAllDataInfo(query, coll) //已标和总数信息
|
|
|
- f.T["checkednum"] = checkedNum
|
|
|
- f.T["allnum"] = allNum
|
|
|
- f.T["fields"] = util.Config.Fields
|
|
|
+ f.T["nextid"] = GetNextDataId(id, coll) //下一条id
|
|
|
+ f.T["fields"] = map[string]bool{"projectname": true}
|
|
|
+ _ = f.Render("project/remark_detail.html", &f.T)
|
|
|
}
|
|
|
|
|
|
func getDetail(id, coll string) map[string]interface{} {
|
|
@@ -94,35 +96,34 @@ func getDetail(id, coll string) map[string]interface{} {
|
|
|
rep["common"] = common
|
|
|
rep["timeplace"] = timeplace
|
|
|
rep["other"] = other
|
|
|
- packs, packskey, pkg_new := setPaceMap(baseInfo, bzInfo) //拼装子包信息
|
|
|
+ packs, packskey, pkg_new := setPaceMap(baseInfo) //拼装子包信息
|
|
|
rep["packs"] = packs
|
|
|
rep["packskey"] = packskey
|
|
|
rep["pkg_new"] = pkg_new
|
|
|
-
|
|
|
- purchasinglist, isNewStatus := setPurchasingMap(baseInfo, bzInfo) //标的物
|
|
|
+ purchasinglist, isNewStatus := setPurchasingMap(baseInfo) //标的物
|
|
|
rep["purchasinglist"] = purchasinglist
|
|
|
rep["pcl_new"] = isNewStatus
|
|
|
- worder, worder_new := setWorderMap(info) //中标候选人
|
|
|
+ worder, worder_new := setWorderMap(baseInfo) //中标候选人
|
|
|
rep["worder"] = worder
|
|
|
rep["worder_new"] = worder_new
|
|
|
- otherInfo, moreInfo := setOtherInfo(info) //处理公告关联信息
|
|
|
+ otherInfo, moreInfo := setOtherInfo(baseInfo) //处理公告关联信息
|
|
|
rep["otherInfo"] = otherInfo
|
|
|
rep["moreInfo"] = moreInfo
|
|
|
//
|
|
|
- if info[preKey+"purchasinglist"] != nil {
|
|
|
- rep[preKey+"purchasinglist"] = "1"
|
|
|
+ if bzInfo["purchasinglist"] != nil {
|
|
|
+ rep["ck_purchasinglist"] = "1"
|
|
|
} else {
|
|
|
- rep[preKey+"purchasinglist"] = "-1"
|
|
|
+ rep["ck_purchasinglist"] = "-1"
|
|
|
}
|
|
|
- if info[preKey+"package"] != nil {
|
|
|
- rep[preKey+"package"] = "1"
|
|
|
+ if bzInfo["package"] != nil {
|
|
|
+ rep["ck_package"] = "1"
|
|
|
} else {
|
|
|
- rep[preKey+"package"] = "-1"
|
|
|
+ rep["ck_package"] = "-1"
|
|
|
}
|
|
|
- if info[preKey+"winnerorder"] != nil {
|
|
|
- rep[preKey+"winnerorder"] = "1"
|
|
|
+ if bzInfo["winnerorder"] != nil {
|
|
|
+ rep["ck_winnerorder"] = "1"
|
|
|
} else {
|
|
|
- rep[preKey+"winnerorder"] = "-1"
|
|
|
+ rep["ck_winnerorder"] = "-1"
|
|
|
}
|
|
|
return rep
|
|
|
}
|
|
@@ -212,10 +213,10 @@ func setExtComMap(info, bzInfo map[string]interface{}) ([]interface{}, []interfa
|
|
|
}
|
|
|
|
|
|
//拼装子包信息
|
|
|
-func setPaceMap(info, bzInfo map[string]interface{}) ([]map[string]interface{}, []string, []bool) {
|
|
|
+func setPaceMap(info map[string]interface{}) ([]map[string]interface{}, []string, []bool) {
|
|
|
var confpack []interface{}
|
|
|
confpack, _ = util.BiaoZhu["package"].([]interface{})
|
|
|
- bzpack := bzInfo["package"].(map[string]interface{})
|
|
|
+ //bzpack := bzInfo["package"].(map[string]interface{})
|
|
|
packs := map[string]map[string]interface{}{}
|
|
|
var sortpackskey []string
|
|
|
isNewPkg := map[string]bool{} //记录子包是否是新增的
|
|
@@ -225,8 +226,7 @@ func setPaceMap(info, bzInfo map[string]interface{}) ([]map[string]interface{},
|
|
|
//isNew, _ := tmppack["ck_isnew"].(bool)
|
|
|
isNew := false
|
|
|
status := "-1"
|
|
|
- bzp := bzpack[k].(map[string]interface{})
|
|
|
- if bzp["tag"] != nil {
|
|
|
+ if tmppack["package_son"] != nil {
|
|
|
status = "1"
|
|
|
}
|
|
|
isNewPkg[k] = isNew
|
|
@@ -309,7 +309,7 @@ func setPaceMap(info, bzInfo map[string]interface{}) ([]map[string]interface{},
|
|
|
}
|
|
|
|
|
|
//拼装标的物
|
|
|
-func setPurchasingMap(info, bzinfo map[string]interface{}) ([]interface{}, []map[string]interface{}) {
|
|
|
+func setPurchasingMap(info map[string]interface{}) ([]interface{}, []map[string]interface{}) {
|
|
|
purchasinglist, _ := util.BiaoZhu["purchasinglist"].([]interface{})
|
|
|
var purchasinglists []interface{}
|
|
|
//isNewPcl := []bool{} //记录子包是否是新增的
|
|
@@ -320,7 +320,7 @@ func setPurchasingMap(info, bzinfo map[string]interface{}) ([]interface{}, []map
|
|
|
//isNew, _ := pcl["ck_isnew"].(bool)
|
|
|
isNew := false
|
|
|
status := "-1"
|
|
|
- if pcl["ck_purchasinglist"] != nil {
|
|
|
+ if pcl["purchasinglist_son"] != nil {
|
|
|
status = "1"
|
|
|
}
|
|
|
//isNewPcl = append(isNewPcl, isNew)
|
|
@@ -351,3 +351,156 @@ func setPurchasingMap(info, bzinfo map[string]interface{}) ([]interface{}, []map
|
|
|
}
|
|
|
return purchasinglists, isNewAndStatus
|
|
|
}
|
|
|
+
|
|
|
+//拼装中标候选人
|
|
|
+func setWorderMap(info map[string]interface{}) ([]interface{}, []map[string]interface{}) {
|
|
|
+ //基本参数--中标候选人
|
|
|
+ winnerorder, _ := util.BiaoZhu["winnerorder"].([]interface{})
|
|
|
+ worders := []interface{}{}
|
|
|
+ isNewAndStatus := []map[string]interface{}{}
|
|
|
+ if tmpwds, ok := info["winnerorder"].([]interface{}); ok {
|
|
|
+ for _, v := range tmpwds {
|
|
|
+ if wd, ok := v.(map[string]interface{}); ok {
|
|
|
+ //isNew, _ := wd["ck_isnew"].(bool)
|
|
|
+ isNew := false
|
|
|
+ status := "-1"
|
|
|
+ if wd["winnerorder_son"] != nil {
|
|
|
+ status = "1"
|
|
|
+ }
|
|
|
+ isNewAndStatus = append(isNewAndStatus, map[string]interface{}{"isnew": isNew, "status": status})
|
|
|
+ wds := []interface{}{}
|
|
|
+ for _, cp := range winnerorder {
|
|
|
+ cp, _ := cp.(map[string]interface{})
|
|
|
+ value := wd[qu.ObjToString(cp["key"])]
|
|
|
+ if value == nil {
|
|
|
+ value = ""
|
|
|
+ }
|
|
|
+ tp := map[string]interface{}{
|
|
|
+ "key": cp["key"],
|
|
|
+ "descript": cp["descript"],
|
|
|
+ "value": value,
|
|
|
+ "status": status,
|
|
|
+ }
|
|
|
+ wds = append(wds, tp)
|
|
|
+ }
|
|
|
+ worders = append(worders, wds)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return worders, isNewAndStatus
|
|
|
+}
|
|
|
+
|
|
|
+//获取公告关联信息
|
|
|
+func setOtherInfo(info map[string]interface{}) (result, moreArr []map[string]interface{}) {
|
|
|
+ if otherInfo, ok := info["info"].([]interface{}); ok && len(otherInfo) > 0 {
|
|
|
+ //中标,成交、合同、招标(不含变更)
|
|
|
+ /*
|
|
|
+ [
|
|
|
+ {},
|
|
|
+ {},
|
|
|
+ ]
|
|
|
+ */
|
|
|
+ zbArr := []map[string]interface{}{}
|
|
|
+ cjArr := []map[string]interface{}{}
|
|
|
+ htArr := []map[string]interface{}{}
|
|
|
+ zbbArr := []map[string]interface{}{}
|
|
|
+ for _, tmp := range otherInfo {
|
|
|
+ tmpInfo := tmp.(map[string]interface{})
|
|
|
+ tmpInfo["detail"] = qu.ObjToString(tmpInfo["title"]) + "</br>" + qu.ObjToString(tmpInfo["title"])
|
|
|
+ toptype := tmpInfo["toptype"]
|
|
|
+ subtype := tmpInfo["subtype"]
|
|
|
+ ptime := ""
|
|
|
+ tmpPtime := qu.Int64All(tmpInfo["publishtime"])
|
|
|
+ if tmpPtime > 0 {
|
|
|
+ ptime = qu.FormatDateByInt64(&tmpPtime, qu.Date_Full_Layout)
|
|
|
+ }
|
|
|
+ tmpInfo["publishtime_str"] = ptime
|
|
|
+ if subtype == "中标" {
|
|
|
+ zbArr = append(zbArr, tmpInfo)
|
|
|
+ } else if subtype == "成交" {
|
|
|
+ cjArr = append(cjArr, tmpInfo)
|
|
|
+ } else if subtype == "合同" {
|
|
|
+ htArr = append(htArr, tmpInfo)
|
|
|
+ } else if toptype == "招标" && subtype != "变更" {
|
|
|
+ zbbArr = append(zbbArr, tmpInfo)
|
|
|
+ } else { //标注页不展示的信息,更多中展示
|
|
|
+ moreArr = append(moreArr, map[string]interface{}{
|
|
|
+ "publishtime": tmpInfo["publishtime_str"],
|
|
|
+ "subtype": subtype,
|
|
|
+ "title": tmpInfo["title"],
|
|
|
+ "href": util.GetJyHref(qu.ObjToString(tmpInfo["id"])),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ publishtime := qu.Float64All(info["publishtime"])
|
|
|
+ //中标信息
|
|
|
+ if zbLen := len(zbArr); zbLen > 0 {
|
|
|
+ rzb := DealData(zbLen, publishtime, zbArr, &moreArr)
|
|
|
+ result = append(result, rzb)
|
|
|
+ }
|
|
|
+ //成交
|
|
|
+ if cjLen := len(cjArr); cjLen > 0 {
|
|
|
+ rcj := DealData(cjLen, publishtime, cjArr, &moreArr)
|
|
|
+ result = append(result, rcj)
|
|
|
+ }
|
|
|
+ //合同
|
|
|
+ if htLen := len(htArr); htLen > 0 {
|
|
|
+ rht := DealData(htLen, publishtime, htArr, &moreArr)
|
|
|
+ result = append(result, rht)
|
|
|
+ }
|
|
|
+ result = append(result, zbbArr...)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func DealData(tmpLen int, publishtime float64, tmp []map[string]interface{}, moreArr *[]map[string]interface{}) (resultTmp map[string]interface{}) {
|
|
|
+ if tmpLen == 1 || publishtime <= 0 { //相同类型只有一条或者原公告发布时间异常取第一条公告
|
|
|
+ resultTmp = tmp[0]
|
|
|
+ for _, t := range tmp[1:] { //将过滤掉的数据加入到更多中
|
|
|
+ *moreArr = append(*moreArr, map[string]interface{}{
|
|
|
+ "publishtime": t["publishtime_str"],
|
|
|
+ "subtype": t["subtype"],
|
|
|
+ "title": t["title"],
|
|
|
+ "href": util.GetJyHref(qu.ObjToString(t["id"])),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ diff := float64(0) //记录差值
|
|
|
+ index := 0
|
|
|
+ for i, zb := range tmp {
|
|
|
+ pTmp := qu.Float64All(zb["publishtime"])
|
|
|
+ diffTmp := math.Abs(publishtime - pTmp) //绝对值
|
|
|
+ if i == 0 {
|
|
|
+ diff = diffTmp
|
|
|
+ } else if diffTmp < diff { //记录较小差值的数据索引位置
|
|
|
+ diff = diffTmp
|
|
|
+ index = i
|
|
|
+ } else { //将过滤掉的数据加入到更多中
|
|
|
+ *moreArr = append(*moreArr, map[string]interface{}{
|
|
|
+ "publishtime": zb["publishtime_str"],
|
|
|
+ "subtype": zb["subtype"],
|
|
|
+ "title": zb["title"],
|
|
|
+ "href": util.GetJyHref(qu.ObjToString(zb["id"])),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resultTmp = tmp[index]
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//获取当前数据下一条的id
|
|
|
+func GetNextDataId(id, coll string) string {
|
|
|
+ nextIdQuery := map[string]interface{}{
|
|
|
+ "_id": map[string]interface{}{
|
|
|
+ "$gt": mgo.StringTOBsonId(id),
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
+ one, _ := util.Mgo.Find(coll, nextIdQuery, `{"_id":1}`, `{"_id":1}`, true, 0, 1)
|
|
|
+ if one != nil && len(*one) == 1 {
|
|
|
+ return mgo.BsonIdToSId((*one)[0]["_id"])
|
|
|
+ }
|
|
|
+ return id
|
|
|
+}
|