|
@@ -69,6 +69,7 @@ type ReportDTO struct {
|
|
PermissionNames interface{} `json:"permissionNames,omitempty"`
|
|
PermissionNames interface{} `json:"permissionNames,omitempty"`
|
|
Highlight []string `json:"highlight,omitempty"`
|
|
Highlight []string `json:"highlight,omitempty"`
|
|
Detail json.RawMessage `json:"detail,omitempty"`
|
|
Detail json.RawMessage `json:"detail,omitempty"`
|
|
|
|
+ PdfUrl string `json:"pdfUrl,omitempty"`
|
|
CoverSrc int `json:"-"`
|
|
CoverSrc int `json:"-"`
|
|
CoverUrl string `json:"coverUrl"`
|
|
CoverUrl string `json:"coverUrl"`
|
|
}
|
|
}
|
|
@@ -178,7 +179,7 @@ func GetReportPageByAnalyst(pageInfo page.PageInfo, analyst string) (list []Repo
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-func GetReportPageByOrgIds(pageInfo page.PageInfo, orgIds []int) (list []ReportDTO, err error) {
|
|
|
|
|
|
+func GetReportPageByOrgIds(pageInfo page.PageInfo, orgIds map[string][]int) (list []ReportDTO, err error) {
|
|
offset := page.StartIndex(pageInfo.Current, pageInfo.PageSize)
|
|
offset := page.StartIndex(pageInfo.Current, pageInfo.PageSize)
|
|
reports, err := reportDao.GetReportPageByOrgIds(pageInfo.LatestId, pageInfo.PageSize, offset, orgIds)
|
|
reports, err := reportDao.GetReportPageByOrgIds(pageInfo.LatestId, pageInfo.PageSize, offset, orgIds)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -394,8 +395,8 @@ func syncES(reports []reportDao.Report) (err error) {
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-func InitHTReportList(list []ht.HTReport) (err error) {
|
|
|
|
- logger.Info("同步研报数量%d", len(list))
|
|
|
|
|
|
+func InitHTReportList(list []ht.HTReport) (noRecord bool, err error) {
|
|
|
|
+
|
|
var reports []reportDao.Report
|
|
var reports []reportDao.Report
|
|
//获取系统中ht品种名
|
|
//获取系统中ht品种名
|
|
permissions, err := reportDao.GetGLAuthorNames()
|
|
permissions, err := reportDao.GetGLAuthorNames()
|
|
@@ -435,17 +436,23 @@ func InitHTReportList(list []ht.HTReport) (err error) {
|
|
coverSrc = ids[randomIndex]
|
|
coverSrc = ids[randomIndex]
|
|
}
|
|
}
|
|
destRp.CoverSrc = coverSrc
|
|
destRp.CoverSrc = coverSrc
|
|
|
|
+ destRp.PlateName = htRp.PermissionName
|
|
reports = append(reports, destRp)
|
|
reports = append(reports, destRp)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- err = reportDao.BatchInsertReport(&reports)
|
|
|
|
- if err != nil {
|
|
|
|
- logger.Error("同步HT研报失败:%v", err)
|
|
|
|
- return
|
|
|
|
|
|
+ if len(reports) == 0 {
|
|
|
|
+ return true, nil
|
|
|
|
+ } else {
|
|
|
|
+ logger.Info("同步研报数量%d", len(reports))
|
|
|
|
+ err = reportDao.BatchInsertReport(&reports)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logger.Error("同步HT研报失败:%v", err)
|
|
|
|
+ return false, err
|
|
|
|
+ }
|
|
|
|
+ return false, syncES(reports)
|
|
}
|
|
}
|
|
- return syncES(reports)
|
|
|
|
}
|
|
}
|
|
func SyncHTReportList(list []ht.HTReport) (err error) {
|
|
func SyncHTReportList(list []ht.HTReport) (err error) {
|
|
//logger.Info("同步研报数量%d", len(list))
|
|
//logger.Info("同步研报数量%d", len(list))
|
|
@@ -505,8 +512,7 @@ func GetListByCondition[T any](column string, ids []T) (dtoList []ReportDTO, err
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func GetTotalPageCountByPermissionIds(permissionIds []int) (total int64, latestId int64, ids []int) {
|
|
|
|
- //TODO 一期品种筛选reportIds
|
|
|
|
|
|
+func GetTotalPageCountByPermissionIds(permissionIds []int) (total int64, latestId int64, ids map[string][]int) {
|
|
htIds, err := GetHTReportIdsByPermissionIds(permissionIds)
|
|
htIds, err := GetHTReportIdsByPermissionIds(permissionIds)
|
|
if err != nil {
|
|
if err != nil {
|
|
logger.Error("品种筛选ht报告id失败:%v", err)
|
|
logger.Error("品种筛选ht报告id失败:%v", err)
|
|
@@ -518,7 +524,18 @@ func GetTotalPageCountByPermissionIds(permissionIds []int) (total int64, latestI
|
|
etaIds = []int{}
|
|
etaIds = []int{}
|
|
}
|
|
}
|
|
total = int64(len(etaIds) + len(htIds))
|
|
total = int64(len(etaIds) + len(htIds))
|
|
- ids = append(etaIds, htIds...)
|
|
|
|
|
|
+ ids = make(map[string][]int, 2)
|
|
|
|
+ if len(etaIds) == 0 {
|
|
|
|
+ ids["ETA"] = []int{}
|
|
|
|
+ } else {
|
|
|
|
+ ids["ETA"] = etaIds
|
|
|
|
+ }
|
|
|
|
+ if len(htIds) == 0 {
|
|
|
|
+ ids["HT"] = []int{}
|
|
|
|
+ } else {
|
|
|
|
+ ids["HT"] = htIds
|
|
|
|
+ }
|
|
|
|
+ //ids = append(etaIds, htIds...)
|
|
latestId = reportDao.GetMaxIdByPermissionIds(ids)
|
|
latestId = reportDao.GetMaxIdByPermissionIds(ids)
|
|
return
|
|
return
|
|
}
|
|
}
|