|
@@ -856,41 +856,40 @@ func (this *ReportSelectionController) GetArticle() {
|
|
|
br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
return
|
|
|
}
|
|
|
- industrialSubjectId, _ := this.GetInt("IndustrialSubjectId")
|
|
|
- if industrialSubjectId < 1 {
|
|
|
- br.Msg = "请输入标的ID"
|
|
|
- return
|
|
|
- }
|
|
|
- detailSubjecj, err := cygx.GetIndustrialSubjectDetailById(industrialSubjectId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
resp := new(cygx.OverviewArticle)
|
|
|
- if detailSubjecj != nil {
|
|
|
- var pars []interface{}
|
|
|
- conditionArticle := ` AND type_name = '综述报告' AND stock LIKE ? `
|
|
|
- subjectName := "%" + detailSubjecj.SubjectName + "%"
|
|
|
- pars = append(pars, subjectName)
|
|
|
- articleList, err := cygx.GetCygxArticleList(conditionArticle, pars, 0, 10)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "GetCygxArticleList,Err:" + err.Error()
|
|
|
+ industrialSubjectId, _ := this.GetInt("IndustrialSubjectId")
|
|
|
+ if industrialSubjectId > 0 {
|
|
|
+ detailSubjecj, err := cygx.GetIndustrialSubjectDetailById(industrialSubjectId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- //一对一精准匹配
|
|
|
- for _, v := range articleList {
|
|
|
- sliceSubjects := strings.Split(v.Stock, "/")
|
|
|
- if len(sliceSubjects) > 0 {
|
|
|
- for _, vSubject := range sliceSubjects {
|
|
|
- sliceKuohao := strings.Split(vSubject, "(") //过滤括号
|
|
|
- sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
|
|
|
- subject := sliceXiahuaxian[0]
|
|
|
- if subject == detailSubjecj.SubjectName {
|
|
|
- resp.ArticleId = v.ArticleId
|
|
|
- resp.Title = v.Title
|
|
|
- continue
|
|
|
+
|
|
|
+ if detailSubjecj != nil {
|
|
|
+ var pars []interface{}
|
|
|
+ conditionArticle := ` AND type_name = '综述报告' AND stock LIKE ? `
|
|
|
+ subjectName := "%" + detailSubjecj.SubjectName + "%"
|
|
|
+ pars = append(pars, subjectName)
|
|
|
+ articleList, err := cygx.GetCygxArticleList(conditionArticle, pars, 0, 10)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "GetCygxArticleList,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //一对一精准匹配
|
|
|
+ for _, v := range articleList {
|
|
|
+ sliceSubjects := strings.Split(v.Stock, "/")
|
|
|
+ if len(sliceSubjects) > 0 {
|
|
|
+ for _, vSubject := range sliceSubjects {
|
|
|
+ sliceKuohao := strings.Split(vSubject, "(") //过滤括号
|
|
|
+ sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
|
|
|
+ subject := sliceXiahuaxian[0]
|
|
|
+ if subject == detailSubjecj.SubjectName {
|
|
|
+ resp.ArticleId = v.ArticleId
|
|
|
+ resp.Title = v.Title
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|