|
@@ -23,6 +23,7 @@ type ReportController struct {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
func (this *ReportController) List() {
|
|
@@ -37,6 +38,7 @@ func (this *ReportController) List() {
|
|
|
chartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
|
level, _ := this.GetInt("Level")
|
|
|
rangeType, _ := this.GetInt("RangeType")
|
|
|
+ classifyId, _ := this.GetInt("ClassifyId")
|
|
|
|
|
|
if chartPermissionId <= 0 {
|
|
|
br.Msg = "品种参数错误"
|
|
@@ -76,14 +78,26 @@ func (this *ReportController) List() {
|
|
|
br.ErrMsg = "获取数据失败,品种id:" + strconv.Itoa(chartPermissionId)
|
|
|
return
|
|
|
}
|
|
|
- tmptotal, err := models.GetReportCountByClassifyIds(classifyIds, condition)
|
|
|
+
|
|
|
+ var selectedClassifyId []int
|
|
|
+ if classifyId > 0 {
|
|
|
+ for _, v := range classifyIds {
|
|
|
+ if v == classifyId {
|
|
|
+ selectedClassifyId = append(selectedClassifyId, v)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedClassifyId = classifyIds
|
|
|
+ }
|
|
|
+ tmptotal, err := models.GetReportCountByClassifyIds(selectedClassifyId, condition)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
total = tmptotal
|
|
|
- tmpReportList, err := models.GetReportListByClassifyIds(classifyIds, condition, startSize, pageSize)
|
|
|
+ tmpReportList, err := models.GetReportListByClassifyIds(selectedClassifyId, condition, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取报告列表失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -112,14 +126,26 @@ func (this *ReportController) List() {
|
|
|
br.Msg = "该品种下没有绑定分类"
|
|
|
return
|
|
|
}
|
|
|
- tmptotal, err := models.GetReportCountByClassifyIds(classifyIds, condition)
|
|
|
+
|
|
|
+ var selectedClassifyId []int
|
|
|
+ if classifyId > 0 {
|
|
|
+ for _, v := range classifyIds {
|
|
|
+ if v == classifyId {
|
|
|
+ selectedClassifyId = append(selectedClassifyId, v)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ selectedClassifyId = classifyIds
|
|
|
+ }
|
|
|
+ tmptotal, err := models.GetReportCountByClassifyIds(selectedClassifyId, condition)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
total = tmptotal
|
|
|
- tmpReportList, err := models.GetReportListByClassifyIds(classifyIds, condition, startSize, pageSize)
|
|
|
+ tmpReportList, err := models.GetReportListByClassifyIds(selectedClassifyId, condition, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取报告列表失败"
|
|
|
br.ErrMsg = "获取报告列表失败,Err:" + err.Error()
|
|
@@ -214,7 +240,7 @@ func (this *ReportController) Detail() {
|
|
|
br.ErrMsg = "获取研报权限失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- chartPermissionList, err := models.GetChartPermissionIdsByIds(reportChartPermissionIds)
|
|
|
+ chartPermissionList, err := models.GetChartPermissionListByIds(reportChartPermissionIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取研报权限失败"
|
|
|
br.ErrMsg = "获取研报权限失败,Err:" + err.Error()
|
|
@@ -281,9 +307,8 @@ func (this *ReportController) Detail() {
|
|
|
br.Msg = "用户权限不足"
|
|
|
return
|
|
|
}
|
|
|
- reportClassifyIdStr := strconv.Itoa(report.ClassifyIdSecond)
|
|
|
for _, v := range classifyIds {
|
|
|
- if v == reportClassifyIdStr {
|
|
|
+ if v == report.ClassifyIdSecond {
|
|
|
IsHas = true
|
|
|
}
|
|
|
}
|
|
@@ -362,8 +387,6 @@ func (this *ReportController) DetailNoUser() {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
func (this *ReportController) Today() {
|
|
@@ -373,18 +396,6 @@ func (this *ReportController) Today() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
|
|
|
- pageSize, _ := this.GetInt("PageSize")
|
|
|
- currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
-
|
|
|
- var startSize int
|
|
|
- if pageSize <= 0 {
|
|
|
- pageSize = utils.PageSize30
|
|
|
- }
|
|
|
- if currentIndex <= 0 {
|
|
|
- currentIndex = 1
|
|
|
- }
|
|
|
- startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
-
|
|
|
total, err := models.GetReportDailyListCount()
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败"
|
|
@@ -392,7 +403,7 @@ func (this *ReportController) Today() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- list, err := models.GetReportDailyList(startSize, pageSize)
|
|
|
+ list, err := models.GetReportDailyList(0, total)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
@@ -417,7 +428,7 @@ func (this *ReportController) Today() {
|
|
|
chartPermissionIds = append(chartPermissionIds, strconv.Itoa(v.ChartPermissionId))
|
|
|
}
|
|
|
|
|
|
- chartPermissionList2, err := models.GetParentChartPermissionListByIds(chartPermissionIds)
|
|
|
+ chartPermissionList2, err := models.GetChartPermissionListByIds(chartPermissionIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取研报二级品种权限失败"
|
|
|
br.ErrMsg = "获取研报二级品种权限失败,Err:" + err.Error()
|
|
@@ -448,10 +459,7 @@ func (this *ReportController) Today() {
|
|
|
v.PermissionNames = utils.Unique(permissionNames)
|
|
|
}
|
|
|
|
|
|
- page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
-
|
|
|
resp := new(response.ReportListResp)
|
|
|
- resp.Paging = page
|
|
|
resp.List = list
|
|
|
|
|
|
br.Ret = 200
|
|
@@ -517,7 +525,7 @@ func (this *ReportController) RecentList() {
|
|
|
chartPermissionIds = append(chartPermissionIds, strconv.Itoa(v.ChartPermissionId))
|
|
|
}
|
|
|
|
|
|
- chartPermissionList2, err := models.GetParentChartPermissionListByIds(chartPermissionIds)
|
|
|
+ chartPermissionList2, err := models.GetChartPermissionListByIds(chartPermissionIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取研报二级品种权限失败"
|
|
|
br.ErrMsg = "获取研报二级品种权限失败,Err:" + err.Error()
|