|
@@ -633,10 +633,11 @@ func (this *ReportController) IndustryListByDepartment() {
|
|
uid := user.UserId
|
|
uid := user.UserId
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
- chartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
|
|
|
|
+ //chartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
var startSize int
|
|
var startSize int
|
|
var condition string
|
|
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)
|
|
|
|
+ condition = ` AND a.publish_status=1 `
|
|
if pageSize <= 0 {
|
|
if pageSize <= 0 {
|
|
pageSize = utils.PageSize20
|
|
pageSize = utils.PageSize20
|
|
}
|
|
}
|
|
@@ -701,19 +702,53 @@ func (this *ReportController) IndustryListByDepartment() {
|
|
subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
artList[k2].SubjectName = subjectNamesNew
|
|
artList[k2].SubjectName = subjectNamesNew
|
|
artList[k2].DepartmentId = v.DepartmentId
|
|
artList[k2].DepartmentId = v.DepartmentId
|
|
- artList[k2].IndustryName = industryName + "-" + subjectNamesNew
|
|
|
|
|
|
+ if subjectNamesNew == "" {
|
|
|
|
+ artList[k2].IndustryName = industryName
|
|
|
|
+ } else {
|
|
|
|
+ artList[k2].IndustryName = industryName + "-" + subjectNamesNew
|
|
|
|
+ }
|
|
|
|
+ if artList[k2].IsReport == "1" {
|
|
|
|
+ artList[k2].IndustryName = "【观点】" + artList[k2].IndustryName
|
|
|
|
+ } else {
|
|
|
|
+ artList[k2].IndustryName = "【纪要】" + artList[k2].IndustryName
|
|
|
|
+ }
|
|
}
|
|
}
|
|
list[k].List = artList
|
|
list[k].List = artList
|
|
if v.FollowNum > 0 {
|
|
if v.FollowNum > 0 {
|
|
list[k].IsMyFollow = true
|
|
list[k].IsMyFollow = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- resp.ListnNew, err = models.GetIndustrialSubjectByDepartmentNew()
|
|
|
|
|
|
+ listnNew, err := models.GetIndustrialSubjectByDepartmentNew()
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取信息失败"
|
|
br.Msg = "获取信息失败"
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if len(listnNew) > 0 {
|
|
|
|
+ for _, v := range listnNew {
|
|
|
|
+ firstStr := strings.Index(v.IndustrialAndSubjectIds, "—")
|
|
|
|
+ Management := new(models.IndustrialManagementIdInt)
|
|
|
|
+ if firstStr == 0 {
|
|
|
|
+ Management.IndustryName = v.IndustryName
|
|
|
|
+ } else {
|
|
|
|
+ listSub, err := models.GetIndustrialManagementSubjectList(v.ArticleId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取关联标的列表失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var subjectNamesNew string
|
|
|
|
+ for _, v1 := range listSub {
|
|
|
|
+ subjectNamesNew += v1.SubjectName + "/"
|
|
|
|
+ }
|
|
|
|
+ subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
|
|
+ Management.IndustryName = subjectNamesNew
|
|
|
|
+ }
|
|
|
|
+ Management.IndustrialManagementId = v.IndustrialManagementId
|
|
|
|
+ Management.ArticleId = v.ArticleId
|
|
|
|
+ resp.ListnNew = append(resp.ListnNew, Management)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
resp.List = list
|
|
resp.List = list
|
|
resp.Paging = page
|
|
resp.Paging = page
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
@@ -903,7 +938,7 @@ func (this *ReportController) ReportList() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
page = paging.GetPaging(currentIndex, pageSize, total)
|
|
page = paging.GetPaging(currentIndex, pageSize, total)
|
|
- condition += ` AND art.is_report =1 GROUP BY art.article_id ORDER BY art.publish_date DESC`
|
|
|
|
|
|
+ condition += ` GROUP BY art.article_id ORDER BY art.publish_date DESC`
|
|
list, err := models.IndustrialToArticleWhichDepartment(condition, pars, uid, startSize, pageSize)
|
|
list, err := models.IndustrialToArticleWhichDepartment(condition, pars, uid, startSize, pageSize)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
@@ -938,7 +973,133 @@ func (this *ReportController) ReportList() {
|
|
}
|
|
}
|
|
subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
subjectNamesNew = strings.TrimRight(subjectNamesNew, "/")
|
|
list[k].SubjectName = subjectNamesNew
|
|
list[k].SubjectName = subjectNamesNew
|
|
- list[k].IndustryName = industryName + "-" + subjectNamesNew
|
|
|
|
|
|
+ if subjectNamesNew != "" {
|
|
|
|
+ list[k].IndustryName = industryName + "-" + subjectNamesNew
|
|
|
|
+ } else {
|
|
|
|
+ list[k].IndustryName = industryName
|
|
|
|
+ }
|
|
|
|
+ resp.IndustryName = industryName
|
|
|
|
+ }
|
|
|
|
+ resp.List = list
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ firstStr := strings.Index(detail.IndustrialAndSubjectIds, "—")
|
|
|
|
+ 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
|
|
|
|
+ if subjectNamesNew != "" {
|
|
|
|
+ list[k].IndustryName = industryName + "-" + subjectNamesNew
|
|
|
|
+ } else {
|
|
|
|
+ list[k].IndustryName = industryName
|
|
|
|
+ }
|
|
resp.IndustryName = industryName
|
|
resp.IndustryName = industryName
|
|
}
|
|
}
|
|
resp.List = list
|
|
resp.List = list
|