package services import ( "encoding/json" "eta/eta_mini_api/models" "eta/eta_mini_api/utils" "fmt" resp2 "eta/eta_mini_api/models/response" ) // GetReportPdfClassify 获取pdf研报的最小分类 func GetReportPdfClassify(report *models.ReportPdfView) int { var res int if report.ClassifyIdFirst != 0 { res = report.ClassifyIdFirst } if report.ClassifyIdSecond != 0 { res = report.ClassifyIdSecond } if report.ClassifyIdThird != 0 { res = report.ClassifyIdThird } return res } func GetReportList(chartPermissionId, level, rangeType, classifyId, currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportList], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/report/list?" url += fmt.Sprintf("RangeType=%d&ChartPermissionId=%d&Level=%d&PageSize=%d&CurrentIndex=%d&ClassifyId=%d", rangeType, chartPermissionId, level, pageSize, currentIndex, classifyId) fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func GetNoAuthReportList(reportType, chartPermissionId, level, rangeType, classifyId, currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportPushListResp], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/noAuth/report/list?" url += fmt.Sprintf("ReportType=%d&RangeType=%d&ChartPermissionId=%d&Level=%d&PageSize=%d&CurrentIndex=%d&ClassifyId=%d", reportType, rangeType, chartPermissionId, level, pageSize, currentIndex, classifyId) fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func GetNoAuthReportDetail(reportId int) (resp *resp2.ReportResp[resp2.ReportDetailResp], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/noAuth/report/detail?" url += fmt.Sprintf("ReportId=%d", reportId) fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func GetReportDetail(reportId, userId int) (resp *resp2.ReportResp[resp2.ReportDetailResp], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/report/detail?" url += fmt.Sprintf("ReportId=%d&UserId=%d", reportId, userId) fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func GetReportDetailNoUser(reportId int) (resp *resp2.ReportResp[resp2.ReportDetailResp], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/report/detail/noUser?" url += fmt.Sprintf("ReportId=%d", reportId) fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func GetReportDailyList() (resp *resp2.ReportResp[resp2.ReportList], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/report/daily/list" fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func GetReportRecentList(currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportList], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/report/recent/list?" url += fmt.Sprintf("PageSize=%d&CurrentIndex=%d", pageSize, currentIndex) fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func SearchReport(keyWord string, currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportSearchResp], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/report/search?" url += fmt.Sprintf("KeyWord=%s&PageSize=%d&CurrentIndex=%d", keyWord, pageSize, currentIndex) fmt.Println(url) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } func SearchReportPush(keyWord string, startSize, pageSize int) (items []*models.ReportPushStatus, total int, err error) { if keyWord == "" { return } var pars []interface{} condition := `AND title LIKE ?` pars = append(pars, utils.GetLikeKeywordPars(pars, keyWord, 1)) total, err = models.GetReportPushStatusCountByCondition(condition, pars) if err != nil { return } items, err = models.GetReportPushStatusByCondition(condition, pars, startSize, pageSize) if err != nil { return } return }