Przeglądaj źródła

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

zhangchuanxing 3 miesięcy temu
rodzic
commit
0399df653f

+ 68 - 1
controllers/cygx/report_selection.go

@@ -127,6 +127,8 @@ func (this *ReportSelectionController) PreserveAndPublish() {
 		if v.IndustrialManagementNames != "" {
 			item.IndustrialManagementNames = v.IndustrialManagementNames
 		}
+		item.ThirdId = v.ThirdId
+		item.ThirdName = v.ThirdName
 		item.OverviewArticleId = v.OverviewArticleId
 		item.IsNew = v.IsNew
 		item.IsShowOverviewArticle = v.IsShowOverviewArticle
@@ -422,7 +424,9 @@ func (this *ReportSelectionController) Detail() {
 				listSon[kIndustrial].IsNew = 0
 			}
 
-			if vIndustrial.SubjectName == "" {
+			if vIndustrial.ThirdName != "" {
+				listSon[kIndustrial].ShowName = vIndustrial.ThirdName
+			} else if vIndustrial.SubjectName == "" {
 				listSon[kIndustrial].ShowName = vIndustrial.IndustrialManagementNames
 			} else {
 				listSon[kIndustrial].ShowName = vIndustrial.SubjectName
@@ -1100,3 +1104,66 @@ func (this *ReportSelectionController) RarryList() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title   添加三方名称
+// @Description   添加三方名称接口
+// @Param	request	body cygx.AddReportSelectionThirdNameReq true "type json string"
+// @Success Ret=200 {object} cygx.AddReportSelectionThirdNameResp
+// @router /reportSelection/add/third_name [post]
+func (this *ReportSelectionController) AddThirdName() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	AdminUser := this.SysUser
+	if AdminUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	var req cygx.AddReportSelectionThirdNameReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	thirdName := req.ThirdName
+	chartPermissionId := req.ChartPermissionId
+	if thirdName == "" {
+		br.Msg = "名称不能为空"
+		return
+	}
+
+	// 品种信息
+	chartPermission, err := models.GetChartPermissionById(chartPermissionId)
+	if err != nil {
+		br.Msg = "品种信息有误"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+
+	item := new(cygx.CygxReportSelectionThirdName)
+	item.ThirdName = thirdName
+	item.ChartPermissionId = chartPermissionId
+	item.ChartPermissionName = chartPermission.ChartPermissionName
+	item.CreateTime = time.Now()
+
+	newId, err := cygx.AddCygxReportSelectionThirdName(item)
+	if err != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "操作失败,Err:" + err.Error()
+		return
+	}
+	resp := new(cygx.AddReportSelectionThirdNameResp)
+	resp.ThirdName = thirdName
+	resp.ThirdId = fmt.Sprint(newId)
+	br.Ret = 200
+	br.Data = resp
+	br.Success = true
+	br.Msg = "操作成功"
+	br.IsAddLog = true
+}

+ 6 - 0
models/cygx/report_selection_log.go

@@ -19,6 +19,8 @@ type CygxReportSelectionLog struct {
 	OverviewArticleId         int       `description:"关联的综述报告ID"`
 	IsNew                     int       `description:"是否为New标签"`
 	IsShowOverviewArticle     int       `description:"是否展示综述报告 1展示,0隐藏"`
+	ThirdId                   string    `description:"类似产业、标的的三方ID"`
+	ThirdName                 string    `description:"类似产业、标的的三方名称"`
 }
 
 type CygxReportSelectionLogRep struct {
@@ -45,6 +47,8 @@ type AddCygxReportSelectionLog struct {
 	OverviewArticleId         int      `description:"综述报告Id"`
 	IsNew                     int      `description:"是否为New标签"`
 	IsShowOverviewArticle     int      `description:"是否展示综述报告 1展示,0隐藏"`
+	ThirdId                   string   `description:"类似产业、标的的三方ID"`
+	ThirdName                 string   `description:"类似产业、标的的三方名称"`
 }
 
 type CygxReportSelectionLogResp struct {
@@ -64,6 +68,8 @@ type CygxReportSelectionLogResp struct {
 	IsNew                     int      `description:"是否为New标签"`
 	IsShowOverviewArticle     int      `description:"是否展示综述报告 1展示,0隐藏"`
 	ChartPermissionSort       int      `description:"品种排序"`
+	ThirdId                   string   `description:"类似产业、标的的三方ID"`
+	ThirdName                 string   `description:"类似产业、标的的三方名称"`
 }
 
 type CygxReportSelectionChart struct {

+ 33 - 0
models/cygx/report_selection_third_name.go

@@ -0,0 +1,33 @@
+package cygx
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+//重点公司三方名称 类似产业、标的的三方名称
+
+type CygxReportSelectionThirdName struct {
+	ThirdId             int       `orm:"column(third_id);pk"description:"类似产业、标的的三方ID"`
+	ThirdName           string    `description:"类似产业、标的的三方名称"`
+	ChartPermissionId   int       `description:"行业ID"`
+	ChartPermissionName string    `description:"行业名称"`
+	CreateTime          time.Time `description:"创建时间"`
+}
+
+type AddReportSelectionThirdNameReq struct {
+	ThirdName         string `description:"类似产业、标的的三方名称"`
+	ChartPermissionId int    `description:"行业ID"`
+}
+
+type AddReportSelectionThirdNameResp struct {
+	ThirdName string `description:"类似产业、标的的三方名称"`
+	ThirdId   string `description:"类似产业、标的的三方ID"`
+}
+
+// 添加
+func AddCygxReportSelectionThirdName(item *CygxReportSelectionThirdName) (lastId int64, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	lastId, err = o.Insert(item)
+	return
+}

+ 1 - 0
models/db.go

@@ -487,6 +487,7 @@ func initCygx() {
 		new(cygx.CygxOrder),
 		new(cygx.CygxOrderAction),
 		new(cygx.CygxUserFeedback),
+		new(cygx.CygxReportSelectionThirdName),
 		new(cygx.CygxGushouTimeLine),
 	)
 }

+ 9 - 0
routers/commentsRouter.go

@@ -2554,6 +2554,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ReportSelectionController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ReportSelectionController"],
+        beego.ControllerComments{
+            Method: "AddThirdName",
+            Router: `/reportSelection/add/third_name`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ReportSelectionController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ReportSelectionController"],
         beego.ControllerComments{
             Method: "ArticleHistoryExport",