|
@@ -636,7 +636,7 @@ func (this *ReportController) IndustryListByDepartment() {
|
|
|
chartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
|
var startSize int
|
|
|
var condition string
|
|
|
- condition = ` AND a.is_report = 1 AND a.publish_status=1 AND m.chart_permission_id =` + strconv.Itoa(chartPermissionId)
|
|
|
+ condition = ` AND a.publish_status=1 AND m.chart_permission_id =` + strconv.Itoa(chartPermissionId)
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize20
|
|
|
}
|
|
@@ -725,17 +725,12 @@ func (this *ReportController) IndustryListByDepartment() {
|
|
|
}
|
|
|
if len(listnNew) > 0 {
|
|
|
for _, v := range listnNew {
|
|
|
- total, err := models.GetIndustrialManagementSubjectCount(v.IndustrialManagementId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取关联标的总数失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+ firstStr := strings.Index(v.IndustrialAndSubjectIds, "—")
|
|
|
Management := new(models.IndustrialManagementIdInt)
|
|
|
- if total == 0 {
|
|
|
+ if firstStr == 0 {
|
|
|
Management.IndustryName = v.IndustryName
|
|
|
} else {
|
|
|
- listSub, err := models.GetIndustrialManagementSubjectList(v.IndustrialManagementId)
|
|
|
+ listSub, err := models.GetIndustrialManagementSubjectList(v.ArticleId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取关联标的列表失败,Err:" + err.Error()
|
|
@@ -748,20 +743,8 @@ func (this *ReportController) IndustryListByDepartment() {
|
|
|
subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
|
Management.IndustryName = subjectNamesNew
|
|
|
}
|
|
|
- //if v.SubjectNames != "" {
|
|
|
- // var subjectNamesNew string
|
|
|
- // slice := strings.Split(v.SubjectNames, ",")
|
|
|
- // for k1, v1 := range slice {
|
|
|
- // if k1 < 4 && k1 < len(slice)-1 {
|
|
|
- // subjectNamesNew += v1 + "/"
|
|
|
- // }
|
|
|
- // }
|
|
|
- // subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
|
- // Management.IndustryName = subjectNamesNew
|
|
|
- //} else {
|
|
|
- // Management.IndustryName = v.IndustryName
|
|
|
- //}
|
|
|
Management.IndustrialManagementId = v.IndustrialManagementId
|
|
|
+ Management.ArticleId = v.ArticleId
|
|
|
resp.ListnNew = append(resp.ListnNew, Management)
|
|
|
}
|
|
|
}
|
|
@@ -999,3 +982,124 @@ func (this *ReportController) ReportList() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 研选最新主题关键词文章列表接口
|
|
|
+// @Description 获取研选最新主题关键词文章列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param ArticleId query int true "文章id"
|
|
|
+// @Success 200 {object} models.ReportArticleWhichIndustrialRepList
|
|
|
+// @router /industry/reportListNew [get]
|
|
|
+func (this *ReportController) ReportListNew() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uid := user.UserId
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ articleId, _ := this.GetInt("ArticleId")
|
|
|
+ var condition string
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
+ var pars []interface{}
|
|
|
+ var total int
|
|
|
+ resp := new(models.ReportArticleWhichIndustrialRepList)
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ userType, _, err := services.GetUserType(user.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if userType == 1 {
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.HaveResearch = true
|
|
|
+ if articleId > 0 {
|
|
|
+ detail, err := models.GetArticleDetailById(articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println(detail.IndustrialAndSubjectIds)
|
|
|
+ fmt.Println(detail.IndustrialManagementId)
|
|
|
+ firstStr := strings.Index(detail.IndustrialAndSubjectIds, "—")
|
|
|
+ fmt.Println(firstStr)
|
|
|
+ if firstStr == 0 {
|
|
|
+ condition += ` AND art.industrial_management_id = '` + strconv.Itoa(detail.IndustrialManagementId) + `'`
|
|
|
+ } else {
|
|
|
+ condition += ` AND art.industrial_and_subject_ids = '` + detail.IndustrialAndSubjectIds + `'`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ total, err = models.GetWhichDepartmentCount(condition)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ page = paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC`
|
|
|
+ list, err := models.IndustrialToArticleWhichDepartment(condition, pars, uid, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k, v := range list {
|
|
|
+ if v.Readnum == 0 {
|
|
|
+ list[k].IsRed = true
|
|
|
+ }
|
|
|
+ list[k].IsResearch = true
|
|
|
+ subjectNames, err := models.GetSubjectNames(v.ArticleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var subjectNamesNew string
|
|
|
+ if len(subjectNames) > 0 {
|
|
|
+ slice := strings.Split(subjectNames, "/")
|
|
|
+ for k3, v3 := range slice {
|
|
|
+ if k3 < 4 {
|
|
|
+ subjectNamesNew += v3 + "/"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ industryName, err := models.GetIndustrialNames(v.ArticleId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败" + strconv.Itoa(v.ArticleId)
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
|
+ list[k].SubjectName = subjectNamesNew
|
|
|
+ list[k].IndustryName = industryName + "-" + subjectNamesNew
|
|
|
+ resp.IndustryName = industryName
|
|
|
+ }
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|