|
@@ -4,10 +4,13 @@ import (
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
"hongze/hongze_yb/global"
|
|
"hongze/hongze_yb/global"
|
|
|
|
+ "hongze/hongze_yb/models/response"
|
|
"hongze/hongze_yb/models/response/pc"
|
|
"hongze/hongze_yb/models/response/pc"
|
|
|
|
+ "hongze/hongze_yb/models/tables/chart_permission"
|
|
"hongze/hongze_yb/models/tables/chart_permission_search_key_word_mapping"
|
|
"hongze/hongze_yb/models/tables/chart_permission_search_key_word_mapping"
|
|
"hongze/hongze_yb/models/tables/rddp/classify"
|
|
"hongze/hongze_yb/models/tables/rddp/classify"
|
|
"hongze/hongze_yb/models/tables/rddp/customer_comment"
|
|
"hongze/hongze_yb/models/tables/rddp/customer_comment"
|
|
|
|
+ "hongze/hongze_yb/models/tables/rddp/report"
|
|
"hongze/hongze_yb/services/company"
|
|
"hongze/hongze_yb/services/company"
|
|
"hongze/hongze_yb/services/user"
|
|
"hongze/hongze_yb/services/user"
|
|
"hongze/hongze_yb/utils"
|
|
"hongze/hongze_yb/utils"
|
|
@@ -72,3 +75,56 @@ func GetClassifyDetail(user user.UserInfo, classifyIdSecond int) (detail *pc.Cla
|
|
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// GetLatestReportList 首页最新资讯
|
|
|
|
+func GetLatestReportList(user user.UserInfo, chartPermissionId int) (ret []*response.ReportCollectListItem, err error) {
|
|
|
|
+ var errMsg string
|
|
|
|
+ defer func() {
|
|
|
|
+ if err != nil {
|
|
|
|
+ global.LOG.Critical(fmt.Sprintf("GetCollectReportList: userId=%d, err:%s, errMsg:%s", user.UserID, err.Error(), errMsg))
|
|
|
|
+ }
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ // 查询权限的基本信息
|
|
|
|
+ permissionInfo, err := chart_permission.GetByChartPermissionId(chartPermissionId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ errMsg = err.Error()
|
|
|
|
+ err = errors.New("查询权限出错")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if permissionInfo.ChartPermissionID == 0 {
|
|
|
|
+ err = errors.New("权限不存在")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ // 除了晨报和周报以外的其他报告
|
|
|
|
+ classifyNames, err := chart_permission_search_key_word_mapping.GetKeyWordsByChartPermissionId(chartPermissionId, "rddp")
|
|
|
|
+ if err != nil {
|
|
|
|
+ errMsg = err.Error()
|
|
|
|
+ err = errors.New("查询权限对应的分类出错")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var classifySecondIds []int
|
|
|
|
+ if len(classifyNames) > 0 {
|
|
|
|
+ classifySecondIds, err = classify.GetSecondIdsByClassifyNames(classifyNames)
|
|
|
|
+ if err != nil {
|
|
|
|
+ errMsg = err.Error()
|
|
|
|
+ err = errors.New("查询分类出错")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var reportList []*response.ReportCollectListItem
|
|
|
|
+ if len(classifySecondIds) > 0 {
|
|
|
|
+ reportList, err = report.GetLatestReportByPermission(classifySecondIds)
|
|
|
|
+ if err != nil {
|
|
|
|
+ errMsg = err.Error()
|
|
|
|
+ err = errors.New("查询报告信息出错")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = reportList
|
|
|
|
+ return
|
|
|
|
+}
|