|
@@ -182,8 +182,12 @@ func (this *ReportController) ListReport() {
|
|
|
pvMap := make(map[int]int)
|
|
|
uvMap := make(map[int]int)
|
|
|
reportIdArr := make([]int, 0)
|
|
|
- syncReportIdArr := make([]string, 0) // 同步过来的报告IDs
|
|
|
- oldAndNewReportIdMap := make(map[int]int) // 旧报告和新报告的id对应关系
|
|
|
+ syncReportIdArr := make([]string, 0) // 同步过来的报告IDs
|
|
|
+ oldAndNewReportIdMap := make(map[int]int) // 旧报告和新报告的id对应关系
|
|
|
+ classifyIdList := make([]int, 0) // 关联的指标分类id
|
|
|
+ classifyIdMap := make(map[int]bool) // 分类id map
|
|
|
+ classifyMap := make(map[int]*models.Classify) // 分类map
|
|
|
+
|
|
|
for i := 0; i < listLen; i++ {
|
|
|
reportIdArr = append(reportIdArr, list[i].Id)
|
|
|
if list[i].OldReportId > 0 && list[i].ReportLayout == 1 {
|
|
@@ -192,6 +196,22 @@ func (this *ReportController) ListReport() {
|
|
|
}
|
|
|
pvMap[list[i].Id] = list[i].Pv
|
|
|
uvMap[list[i].Id] = list[i].Uv
|
|
|
+
|
|
|
+ if list[i].ClassifyIdFirst > 0 {
|
|
|
+ if _, ok := classifyIdMap[list[i].ClassifyIdFirst]; !ok {
|
|
|
+ classifyIdList = append(classifyIdList, list[i].ClassifyIdFirst)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if list[i].ClassifyIdSecond > 0 {
|
|
|
+ if _, ok := classifyIdMap[list[i].ClassifyIdSecond]; !ok {
|
|
|
+ classifyIdList = append(classifyIdList, list[i].ClassifyIdSecond)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if list[i].ClassifyIdThird > 0 {
|
|
|
+ if _, ok := classifyIdMap[list[i].ClassifyIdThird]; !ok {
|
|
|
+ classifyIdList = append(classifyIdList, list[i].ClassifyIdThird)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 当下报告的pv,uv
|
|
@@ -210,6 +230,18 @@ func (this *ReportController) ListReport() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if len(classifyIdList) > 0 {
|
|
|
+ classifyList, e := models.GetClassifyListByIdList(classifyIdList)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取报告分类失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range classifyList {
|
|
|
+ classifyMap[v.Id] = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//reportIds := strings.Join(reportIdArr, ",")
|
|
|
//syncReportIds := strings.Join(syncReportIdArr, ",")
|
|
|
|
|
@@ -256,6 +288,26 @@ func (this *ReportController) ListReport() {
|
|
|
list[i].ChapterVideoList = chapterList
|
|
|
list[i].Pv = pvMap[list[i].Id]
|
|
|
list[i].Uv = uvMap[list[i].Id]
|
|
|
+
|
|
|
+ if list[i].ClassifyIdThird > 0 {
|
|
|
+ if classify, ok := classifyMap[list[i].ClassifyIdThird]; ok {
|
|
|
+ if classify.Enabled == 1 {
|
|
|
+ list[i].ClassifyEnabled = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if list[i].ClassifyIdSecond > 0 {
|
|
|
+ if classify, ok := classifyMap[list[i].ClassifyIdSecond]; ok {
|
|
|
+ if classify.Enabled == 1 {
|
|
|
+ list[i].ClassifyEnabled = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if list[i].ClassifyIdFirst > 0 {
|
|
|
+ if classify, ok := classifyMap[list[i].ClassifyIdFirst]; ok {
|
|
|
+ if classify.Enabled == 1 {
|
|
|
+ list[i].ClassifyEnabled = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 多人协作的协作报告,需要判断是否可编辑
|
|
@@ -980,6 +1032,24 @@ func (this *ReportController) AuthorizedListReport() {
|
|
|
condition += orCondition
|
|
|
}
|
|
|
|
|
|
+ // 获取所有启用的分类
|
|
|
+ classifyList, err := models.GetAllEnabledClassify()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ classifyIdNum := len(classifyList)
|
|
|
+ if classifyIdNum > 0 {
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
+ for _, v := range classifyList {
|
|
|
+ classifyIdList = append(classifyIdList, v.Id)
|
|
|
+ }
|
|
|
+
|
|
|
+ condition += ` AND a.classify_id_first in (` + utils.GetOrmInReplace(classifyIdNum) + `) AND a.classify_id_second in (` + utils.GetOrmInReplace(classifyIdNum) + `) AND a.classify_id_third in (` + utils.GetOrmInReplace(classifyIdNum) + `) `
|
|
|
+ pars = append(pars, classifyIdList, classifyIdList, classifyIdList)
|
|
|
+ }
|
|
|
+
|
|
|
total, err = models.GetReportListCountByAuthorized(condition, pars)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|