Browse Source

Merge branch 'cygx/cygx_need_959' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

zhangchuanxing 5 months ago
parent
commit
8a1b31d70e
1 changed files with 31 additions and 32 deletions
  1. 31 32
      controllers/cygx/report_selection.go

+ 31 - 32
controllers/cygx/report_selection.go

@@ -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
+						}
 					}
 				}
 			}