Browse Source

no message

zhangchuanxing 4 months ago
parent
commit
e20087432c

+ 63 - 0
controllers/cygx/report_selection.go

@@ -1100,3 +1100,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
+}

+ 2 - 0
models/cygx/report_selection_log.go

@@ -45,6 +45,8 @@ type AddCygxReportSelectionLog struct {
 	OverviewArticleId         int      `description:"综述报告Id"`
 	IsNew                     int      `description:"是否为New标签"`
 	IsShowOverviewArticle     int      `description:"是否展示综述报告 1展示,0隐藏"`
+	ThirdId                   string   `description:"类似产业、标的的三方ID"`
+	ThirdtName                string   `description:"类似产业、标的的三方名称"`
 }
 
 type CygxReportSelectionLogResp 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),
 	)
 }
 

+ 9 - 0
routers/commentsRouter.go

@@ -2491,6 +2491,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",