|
@@ -3,6 +3,7 @@ package report
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
|
"jy/src/jfw/modules/bigmember/src/config"
|
|
|
. "jy/src/jfw/modules/bigmember/src/db"
|
|
|
"jy/src/jfw/modules/bigmember/src/entity"
|
|
@@ -73,7 +74,7 @@ func (r *Report) Index() {
|
|
|
ym := r.GetString("ym")
|
|
|
from := r.GetString("from")
|
|
|
result := M{}
|
|
|
- userId, qk, qv := getQuery(r.Session())
|
|
|
+ userId, qk, qv := getQuery(r.Session(), from)
|
|
|
if qk == "" || qv == nil {
|
|
|
return
|
|
|
}
|
|
@@ -163,7 +164,7 @@ func (r *Report) Detail() {
|
|
|
end, _ := r.GetInt("end")
|
|
|
from := r.GetString("from")
|
|
|
var m M
|
|
|
- userId, qk, qv := getQuery(r.Session())
|
|
|
+ userId, qk, qv := getQuery(r.Session(), from)
|
|
|
if qk == "" || qv == nil {
|
|
|
return
|
|
|
}
|
|
@@ -200,6 +201,9 @@ func (r *Report) Detail() {
|
|
|
// 采购单位类型
|
|
|
m["buyerClass"] = entity.ReportGetBuyerClass(positionId, start, end, from)
|
|
|
m["isNewData"] = isNewData
|
|
|
+ if from == From {
|
|
|
+ m["industry"] = entity.ReportGetIndustry(positionId, start, end, from)
|
|
|
+ }
|
|
|
r.ServeJson(Result{
|
|
|
Data: m,
|
|
|
})
|
|
@@ -264,7 +268,7 @@ func weekResult(qk string, qv interface{}, start, end int64, coll, coll_winner s
|
|
|
"$lte": end,
|
|
|
},
|
|
|
"type": 2,
|
|
|
- }, `{"startdate":1}`, `{"startdate":1,"type":1,"item":1,"bidamount":1,"budget":1,"zhao_matchitem":1,"zhong_matchitem":1,"follow_project":1,"follow_ent":1,"nextweek_bidopen":1,"project_amount":1}`, false, 0, 2)
|
|
|
+ }, `{"startdate":1}`, `{"startdate":1,"type":1,"item":1,"industry":1,bidamount":1,"budget":1,"zhao_matchitem":1,"zhong_matchitem":1,"follow_project":1,"follow_ent":1,"nextweek_bidopen":1,"project_amount":1}`, false, 0, 2)
|
|
|
result := M{}
|
|
|
prevWeek := map[string]interface{}{}
|
|
|
if ok && list != nil {
|
|
@@ -275,6 +279,8 @@ func weekResult(qk string, qv interface{}, start, end int64, coll, coll_winner s
|
|
|
}
|
|
|
//订阅关键词组
|
|
|
result["item"] = v["item"]
|
|
|
+ //行业
|
|
|
+ result["industry"] = v["industry"]
|
|
|
//本周新增招标项目数量
|
|
|
result["zhao_matchitem"] = v["zhao_matchitem"]
|
|
|
//本周新增开标项目数量
|
|
@@ -310,7 +316,7 @@ func monthResult(userId, qk string, qv interface{}, start, end int64, coll, coll
|
|
|
"enddate": map[string]interface{}{
|
|
|
"$lte": end,
|
|
|
},
|
|
|
- }, `{"startdate":1}`, `{"startdate":1,"item":1,"project_matchitem_count":1,"project_matchitem_bidamount":1,"project_count":1,"project_bidamount_count":1,"project_area_count":1,"project_area_bidamount":1,"project_buyerclass_count":1,"project_buyerclass_bidamount":1,"project_buyerclass_average_bidamount":1,"winner_area":1,"buyer":1,"winner":1,"project_bidamount":1,"winner_capital_array":1,"winner_project":1}`, false, -1, -1)
|
|
|
+ }, `{"startdate":1}`, `{"startdate":1,"item":1,"industry":1,project_matchitem_count":1,"project_matchitem_bidamount":1,"project_count":1,"project_bidamount_count":1,"project_area_count":1,"project_area_bidamount":1,"project_buyerclass_count":1,"project_buyerclass_bidamount":1,"project_buyerclass_average_bidamount":1,"winner_area":1,"buyer":1,"winner":1,"project_bidamount":1,"winner_capital_array":1,"winner_project":1}`, false, -1, -1)
|
|
|
if ok && sixDatas != nil {
|
|
|
project_count := &BarCharts{
|
|
|
Keys: map[int64]bool{},
|
|
@@ -327,6 +333,8 @@ func monthResult(userId, qk string, qv interface{}, start, end int64, coll, coll
|
|
|
} else if startdate == start { //本月
|
|
|
//订阅关键词组
|
|
|
result["item"] = v["item"]
|
|
|
+ //行业
|
|
|
+ result["industry"] = v["industry"]
|
|
|
//本月项目规模
|
|
|
result["project_matchitem_count"] = v["project_matchitem_count"]
|
|
|
//本月项目规模
|
|
@@ -526,19 +534,15 @@ func getGrowthRate(v1, v2 float64) float64 {
|
|
|
}
|
|
|
|
|
|
func (r *Report) Tip() {
|
|
|
- _, qk, qv := getQuery(r.Session())
|
|
|
+ _, qk, qv := getQuery(r.Session(), "")
|
|
|
if qk == "" || qv == nil {
|
|
|
return
|
|
|
}
|
|
|
- table := pushspace_member_statistic
|
|
|
- if from == From {
|
|
|
- table = pushspace_member_statistic_yys
|
|
|
- }
|
|
|
- unread := Mgo.Count(table, map[string]interface{}{
|
|
|
+ unread := Mgo.Count(pushspace_member_statistic, map[string]interface{}{
|
|
|
qk: qv,
|
|
|
"unread": 1,
|
|
|
})
|
|
|
- list, ok := Mgo.Find(table, map[string]interface{}{
|
|
|
+ list, ok := Mgo.Find(pushspace_member_statistic, map[string]interface{}{
|
|
|
qk: qv,
|
|
|
"tip": 1,
|
|
|
}, `{"enddate":-1}`, `{"_id":0,"type":1,"startdate":1,"enddate":1,"pushcount":1}`, false, 0, 1)
|
|
@@ -551,7 +555,7 @@ func (r *Report) Tip() {
|
|
|
r.ServeJson(result)
|
|
|
}
|
|
|
func (r *Report) Tipover() {
|
|
|
- _, qk, qv := getQuery(r.Session())
|
|
|
+ _, qk, qv := getQuery(r.Session(), "")
|
|
|
if qk == "" || qv == nil {
|
|
|
return
|
|
|
}
|
|
@@ -569,7 +573,7 @@ func tipover(qk string, qv interface{}, coll string) bool {
|
|
|
}, false, true)
|
|
|
}
|
|
|
func (r *Report) Openpushmsg() error {
|
|
|
- userId, qk, qv := getQuery(r.Session())
|
|
|
+ userId, qk, qv := getQuery(r.Session(), "")
|
|
|
pushcount, _ := r.GetInteger("pushcount")
|
|
|
positionType := qutil.Int64All(r.GetSession("positionType"))
|
|
|
start, _ := r.GetInt("start")
|
|
@@ -598,11 +602,11 @@ func (r *Report) Openpushmsg() error {
|
|
|
}
|
|
|
|
|
|
func (r *Report) Starttime() {
|
|
|
- _, qk, qv := getQuery(r.Session())
|
|
|
+ from := r.GetString("from")
|
|
|
+ _, qk, qv := getQuery(r.Session(), from)
|
|
|
if qk == "" || qv == nil {
|
|
|
return
|
|
|
}
|
|
|
- from := r.GetString("from")
|
|
|
table := pushspace_member_statistic
|
|
|
if from == From {
|
|
|
table = pushspace_member_statistic_yys
|
|
@@ -658,9 +662,12 @@ func isFree(userId string, positionType int64, session *httpsession.Session) boo
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-func getQuery(sess *httpsession.Session) (string, string, interface{}) {
|
|
|
+func getQuery(sess *httpsession.Session, from string) (string, string, interface{}) {
|
|
|
sessMap := sess.GetMultiple()
|
|
|
userId := qutil.ObjToString(sessMap["userId"])
|
|
|
+ if from == From {
|
|
|
+ return userId, "userid", gconv.String(sessMap["positionId"])
|
|
|
+ }
|
|
|
if qutil.IntAll(sessMap["positionType"]) == 1 {
|
|
|
return userId, "ent_userid", qutil.IntAll(sessMap["entUserId"])
|
|
|
} else {
|