|
@@ -61,6 +61,7 @@ type ReportDTO struct {
|
|
|
OrgId int `json:"orgId"`
|
|
|
Title string `json:"title"`
|
|
|
Author string `json:"author"`
|
|
|
+ AuthorInfo []Anthor `json:"authorInfo"`
|
|
|
Source string `json:"source"`
|
|
|
Abstract string `json:"abstract"`
|
|
|
PublishedTime string `json:"publishedTime"`
|
|
@@ -83,19 +84,46 @@ type PermissionDTO struct {
|
|
|
ParentID int
|
|
|
}
|
|
|
|
|
|
+type Anthor struct {
|
|
|
+ Id int `json:"id"`
|
|
|
+ Name string `json:"name"`
|
|
|
+ HeadImgUrl string `json:"headImgUrl"`
|
|
|
+}
|
|
|
+
|
|
|
func GetGetReportById(reportId int) (ReportDTO ReportDTO, err error) {
|
|
|
report, err := reportDao.GetReportById(reportId)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- //orgId := report.OrgID
|
|
|
- //names, _ := reportDao.GetAuthorByOrgId(orgId, string(report.Source))
|
|
|
- //if names != nil && len(names) > 1 {
|
|
|
- // names = stringUtils.UniqueItems(names)
|
|
|
- // report.Author = strings.Join(names, ",")
|
|
|
- //}
|
|
|
- //report.PublishedTime = report.PublishedTime
|
|
|
+
|
|
|
ReportDTO = convertReportDTO(report, true)
|
|
|
+
|
|
|
+ authorStr := ReportDTO.Author
|
|
|
+ authorNames := strings.Split(authorStr, ",")
|
|
|
+ authorNames = stringUtils.RemoveEmptyStrings(authorNames)
|
|
|
+ var authorList []Anthor
|
|
|
+ if len(authorNames) > 0 {
|
|
|
+ for _, name := range authorNames {
|
|
|
+ var author analystService.FinancialAnalystDTO
|
|
|
+ author, err = analystService.GetAnalystByName(name)
|
|
|
+ var item Anthor
|
|
|
+ if err != nil {
|
|
|
+ item = Anthor{
|
|
|
+ Id: 0,
|
|
|
+ Name: name,
|
|
|
+ HeadImgUrl: "",
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item = Anthor{
|
|
|
+ Id: author.Id,
|
|
|
+ Name: author.Name,
|
|
|
+ HeadImgUrl: author.HeadImgUrl,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ authorList = append(authorList, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ReportDTO.AuthorInfo = authorList
|
|
|
return
|
|
|
}
|
|
|
|