Kaynağa Gözat

周报月报查询修改

WH01243 1 yıl önce
ebeveyn
işleme
9c3f43a1a5

+ 16 - 8
src/jfw/modules/bigmember/src/entity/report.go

@@ -79,6 +79,10 @@ func GetReportProjectInfo(param *ReportProjectInfoParam, positionId int64) (data
 				tmpArr = append(tmpArr, "find_in_set(?,subscopeclass)")
 				values = append(values, fmt.Sprintf("%s_%s", topIndustry, subList[i]))
 			}
+			if param.From == From {
+				tmpArr = append(tmpArr, "find_in_set(?,subscopeclass)")
+				values = append(values, topIndustry)
+			}
 		}
 		qstr = append(qstr, fmt.Sprintf("(%s)", strings.Join(tmpArr, " or ")))
 	}
@@ -110,7 +114,7 @@ func GetReportProjectInfo(param *ReportProjectInfoParam, positionId int64) (data
 	if param.From == From {
 		table = TableMemberReportProjectYys
 	}
-	CountQuery := fmt.Sprintf("select count(1) from %s where position_id=? and start_time>=? and end_time<=? %s ", table, q)
+	CountQuery := fmt.Sprintf("select count(1) from %s where position_id=? and start_time=? and end_time=? %s ", table, q)
 	total = db.Base.CountBySql(CountQuery, values...)
 	if total == 0 {
 		return data, 0
@@ -119,7 +123,7 @@ func GetReportProjectInfo(param *ReportProjectInfoParam, positionId int64) (data
 	if param.Sort == 1 {
 		orderby = " (if(bidamount >0,bidamount,budget)) desc,id desc"
 	}
-	query := fmt.Sprintf("select * from %s where position_id=? and start_time>=? and end_time<=? %s  order by  %s   limit %d,%d", table, q, orderby, (param.PageNum-1)*param.PageSize, param.PageSize)
+	query := fmt.Sprintf("select * from %s where position_id=? and start_time=? and end_time=? %s  order by  %s   limit %d,%d", table, q, orderby, (param.PageNum-1)*param.PageSize, param.PageSize)
 	rs := db.Base.SelectBySql(query, values...)
 	if rs != nil && len(*rs) > 0 {
 		data = *rs
@@ -149,7 +153,7 @@ func ReportProjectInfoFormat(data []map[string]interface{}) []map[string]interfa
 		tmp["name"] = common.ObjToString(data[i]["name"])
 		tmp["area"] = data[i]["area"]
 		tmp["bidStatus"] = data[i]["bidstatus"]
-		tmp["buyerClass"] = data[i]["buyerclass"]
+		tmp["buyerClass"] = ""
 		tmp["subscopeclass"] = data[i]["subscopeclass"]
 		tmp["bidAmount"] = data[i]["bidamount"]
 		tmp["budget"] = data[i]["budget"]
@@ -196,7 +200,7 @@ func ReportGetBuyerClass(positionId, start, end int64, from string) []string {
 	if from == From {
 		table = TableMemberReportProjectYys
 	}
-	q := "select distinct(buyerclass) from " + table + " where position_id =? and start_time >=? and end_time<=?  order by buyerclass "
+	q := "select distinct(buyerclass) from " + table + " where position_id =? and start_time =? and end_time=?  order by buyerclass "
 	rs := db.Base.SelectBySql(q, positionId, start, end)
 	if rs != nil && len(*rs) > 0 {
 		for i := 0; i < len(*rs); i++ {
@@ -207,8 +211,8 @@ func ReportGetBuyerClass(positionId, start, end int64, from string) []string {
 }
 
 // ReportGetIndustry 周报月报获取当前行业
-func ReportGetIndustry(positionId, start, end int64, from string) []string {
-	subscopeclass := []string{}
+func ReportGetIndustry(positionId, start, end int64, from string) map[string]interface{} {
+	subscopeclassArr := map[string]interface{}{}
 	table := TableMemberReportProject
 	if from == From {
 		table = TableMemberReportProjectYys
@@ -217,10 +221,14 @@ func ReportGetIndustry(positionId, start, end int64, from string) []string {
 	rs := db.Base.SelectBySql(q, positionId, start, end)
 	if rs != nil && len(*rs) > 0 {
 		for i := 0; i < len(*rs); i++ {
-			subscopeclass = append(subscopeclass, common.ObjToString((*rs)[i]["subscopeclass"]))
+			subscopeclass := common.ObjToString((*rs)[i]["subscopeclass"])
+			if subscopeclass != "" {
+				subscopeclassArr[subscopeclass] = []interface{}{}
+			}
+
 		}
 	}
-	return subscopeclass
+	return subscopeclassArr
 }
 
 // GetMainPositionId 根据用户id获取主账号的职位id

+ 5 - 3
src/jfw/modules/bigmember/src/service/report/report.go

@@ -243,9 +243,11 @@ func (r *Report) ProjectInfo() {
 	param.PageSize = qutil.If(param.PageSize < 1 || param.PageSize > 100, 50, param.PageSize).(int)
 	// 取positionId
 	positionId := qutil.Int64All(r.GetSession("positionId"))
-	mainPositionId := entity.GetMainPositionId(qutil.ObjToString(r.GetSession("mgoUserId")))
-	if mainPositionId != int64(0) {
-		positionId = mainPositionId
+	if param.From != From {
+		mainPositionId := entity.GetMainPositionId(qutil.ObjToString(r.GetSession("mgoUserId")))
+		if mainPositionId != int64(0) {
+			positionId = mainPositionId
+		}
 	}
 	m := map[string]interface{}{}
 	list, total := entity.GetReportProjectInfo(&param, positionId)