Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into crm/crm_16.1

zhangchuanxing 3 months ago
parent
commit
d25d0e5ce9

+ 78 - 2
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
@@ -670,6 +674,8 @@ func (this *ReportSelectionController) ListPeriods() {
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
+
+	condition += `	GROUP BY  periods `
 	list, err := cygx.GetReportSelectionListPeriods(condition, pars, startSize, pageSize)
 	if err != nil {
 		br.Msg = "获取失败"
@@ -1026,7 +1032,11 @@ func (this *ReportSelectionController) History() {
 	}
 	mapSubjectHistory := make(map[string]int)    // 标的点击数量
 	mapIndustrialHistory := make(map[string]int) // 产业点击数量
+	mapThirdIdHistory := make(map[int]int)       // 三方产业点击数量
 	for _, v := range listSelectionSubjectHistory {
+		if v.ThirdId > 0 {
+			mapThirdIdHistory[v.ThirdId]++
+		}
 		mapSubjectHistory[v.IndustrialSubjectId]++
 		if v.IndustrialSubjectId == "0" && v.IndustrialManagementId > 0 {
 			mapIndustrialHistory[strconv.Itoa(v.IndustrialManagementId)]++
@@ -1040,7 +1050,10 @@ func (this *ReportSelectionController) History() {
 		for _, v2 := range listSelectionLog {
 			if v.ChartPermissionName == v2.PermissionName {
 				item := new(cygx.HistoryReportSelectionLogResp)
-				if (v2.IndustrialSubjectId == "" || v2.IndustrialSubjectId == "0") && v2.IndustrialManagementId != "" {
+				if v2.ThirdId > 0 {
+					item.SubjectName = v2.ThirdName
+					item.Count = mapThirdIdHistory[v2.ThirdId]
+				} else if (v2.IndustrialSubjectId == "" || v2.IndustrialSubjectId == "0") && v2.IndustrialManagementId != "" {
 					item.SubjectName = v2.IndustrialManagementNames
 					item.Count = mapIndustrialHistory[v2.IndustrialManagementId]
 				} else {
@@ -1100,3 +1113,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
+}

+ 1 - 1
models/cygx/report_selection.go

@@ -310,7 +310,7 @@ func GetReportSelectionListPeriods(condition string, pars []interface{}, startSi
 	if condition != "" {
 		sql += condition
 	}
-	sql += ` ORDER BY  rs.periods  DESC    LIMIT ?,?`
+	sql += `  ORDER BY  rs.periods  DESC    LIMIT ?,?`
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }

+ 8 - 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 {
@@ -106,6 +112,8 @@ type CygxReportSelectionLoglist struct {
 	IndustrialManagementId    string    `description:"产业资源包Id  多个用 , 隔开"`
 	IndustrialManagementNames string    `description:"产业资源包名称  多个用 , 隔开"`
 	SubjectName               string    `description:"标的名称"`
+	ThirdId                   int       `description:"类似产业、标的的三方ID"`
+	ThirdName                 string    `description:"类似产业、标的的三方名称"`
 	IcoLink                   string    `orm:"column(image_url)"description:"图标链接"`
 	OverviewArticleId         int       `description:"关联的综述报告ID"`
 	IsNew                     int       `description:"是否为New标签"`

+ 1 - 0
models/cygx/report_selection_subject_history.go

@@ -17,6 +17,7 @@ type CygxReportSelectionSubjectHistory struct {
 	CompanyName            string    `description:"公司名称"`
 	IndustrialSubjectId    string    `description:"标的ID"`
 	IndustrialManagementId int       `description:"产业ID"`
+	ThirdId                int       `description:"类似产业、标的的三方ID"`
 }
 
 // 列表

+ 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",