浏览代码

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

zhangchuanxing 5 月之前
父节点
当前提交
8e45dad565

+ 59 - 0
controllers/cygx/industrial_subject.go

@@ -628,3 +628,62 @@ func (this *IndustrialSubjectController) CountDetail() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 通过行业获取关联标的列表
+// @Description 通过行业获取关联标的列表接口
+// @Param   KeyWord   query   string  false       "搜索关键词"
+// @Param   ChartPermissionId   query   int  true       "分类ID"
+// @Success Ret=200  {object} cygx.CygxIndustrialSubjectList
+// @router /industrialAndSubject/search [get]
+func (this *IndustrialSubjectController) IndustrialAndSubjectSearch() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var condition string
+	keyWord := this.GetString("KeyWord")
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+	if keyWord != "" {
+		condition = ` AND s.subject_name LIKE '%` + keyWord + `%'  `
+	}
+	if chartPermissionId > 0 {
+		condition += ` AND m.chart_permission_id = ` + strconv.Itoa(chartPermissionId)
+	}
+	listSubject, err := cygx.GetIndustrialSubjectListNameByChartId(condition)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	condition = ` AND industry_name LIKE '%` + keyWord + `%'  AND  chart_permission_id = ` + strconv.Itoa(chartPermissionId)
+	listIndustrial, err := cygx.GetIndustrialManagement(condition)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	listResp := make([]*cygx.CygxIndustrialSubjectListRep, 0)
+	for _, v := range listIndustrial {
+		item := new(cygx.CygxIndustrialSubjectListRep)
+		item.IndustryName = v.IndustryName
+		item.IndustrialManagementId = v.IndustrialManagementId
+		listResp = append(listResp, item)
+	}
+	for _, v := range listSubject {
+		listResp = append(listResp, v)
+	}
+	resp := new(cygx.CygxIndustrialSubjectList)
+	resp.List = listResp
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 20 - 4
controllers/cygx/report_selection.go

@@ -123,6 +123,7 @@ func (this *ReportSelectionController) PreserveAndPublish() {
 		item.IndustrialSubjectId = v.IndustrialSubjectId
 		item.SubjectName = v.IndustrialSubjectName
 		item.IndustrialManagementId = v.IndustrialManagementId
+		item.IndustrialManagementNames = v.IndustrialManagementName
 		item.OverviewArticleId = v.OverviewArticleId
 		item.IsNew = v.IsNew
 		item.IsShowOverviewArticle = v.IsShowOverviewArticle
@@ -411,6 +412,12 @@ func (this *ReportSelectionController) Detail() {
 			if periods != "" {
 				listSon[kIndustrial].IsNew = 0
 			}
+
+			if vIndustrial.SubjectName == "" {
+				listSon[kIndustrial].ShowName = vIndustrial.IndustrialManagementNames
+			} else {
+				listSon[kIndustrial].ShowName = vIndustrial.SubjectName
+			}
 		}
 		list[k].List = listSon
 		list[k].BodyChartSummary = mapChartLog[v.ChartPermissionName]
@@ -1009,9 +1016,13 @@ func (this *ReportSelectionController) History() {
 		br.ErrMsg = "GetCygxReportSelectionSubjectHistoryList,Err:" + err.Error()
 		return
 	}
-	mapSubjectHistory := make(map[string]int)
+	mapSubjectHistory := make(map[string]int) // 标的点击数量
+	industrialHistory := make(map[string]int) // 产业点击数量
 	for _, v := range listSelectionSubjectHistory {
 		mapSubjectHistory[v.IndustrialSubjectId]++
+		if v.IndustrialSubjectId == "0" && v.IndustrialManagementId > 0 {
+			industrialHistory[strconv.Itoa(v.IndustrialManagementId)]++
+		}
 	}
 
 	//排序方式修改
@@ -1021,10 +1032,15 @@ func (this *ReportSelectionController) History() {
 		for _, v2 := range listSelectionLog {
 			if v.ChartPermissionName == v2.PermissionName {
 				item := new(cygx.HistoryReportSelectionLogResp)
-				item.SubjectName = v2.SubjectName
-				item.IndustrialSubjectId = v2.IndustrialSubjectId
+				if (v2.IndustrialSubjectId == "" || v2.IndustrialSubjectId == "0") && v2.IndustrialManagementId != "" {
+					item.SubjectName = v2.IndustrialManagementNames
+					item.Count = mapSubjectHistory[v2.IndustrialSubjectId]
+				} else {
+					item.SubjectName = v2.SubjectName
+					item.IndustrialSubjectId = v2.IndustrialSubjectId
+					item.Count = mapSubjectHistory[v2.IndustrialSubjectId]
+				}
 				item.IsNew = v2.IsNew
-				item.Count = mapSubjectHistory[v2.IndustrialSubjectId]
 				resp.Count += item.Count
 				v.List = append(v.List, item)
 			}

+ 42 - 38
models/cygx/report_selection_log.go

@@ -6,18 +6,19 @@ import (
 )
 
 type CygxReportSelectionLog struct {
-	ArticleSunId           int       `orm:"column(article_sun_id);pk"description:"子级报告id"`
-	ArticleId              int       `description:"父级报告Id"`
-	ChartPermissionId      int       `description:"行业ID"`
-	CreateTime             time.Time `description:"创建时间"`
-	Body                   string    `description:"内容"`
-	IndustrialSubjectId    string    `description:"标的ID"`
-	SubjectName            string    `description:"标的名称"`
-	IndustrialManagementId string    `description:"产业资源包Id  多个用 , 隔开"`
-	CompanyLabel           string    `description:"公司标签多个用{|}隔开"`
-	OverviewArticleId      int       `description:"关联的综述报告ID"`
-	IsNew                  int       `description:"是否为New标签"`
-	IsShowOverviewArticle  int       `description:"是否展示综述报告 1展示,0隐藏"`
+	ArticleSunId              int       `orm:"column(article_sun_id);pk"description:"子级报告id"`
+	ArticleId                 int       `description:"父级报告Id"`
+	ChartPermissionId         int       `description:"行业ID"`
+	CreateTime                time.Time `description:"创建时间"`
+	Body                      string    `description:"内容"`
+	IndustrialSubjectId       string    `description:"标的ID"`
+	SubjectName               string    `description:"标的名称"`
+	IndustrialManagementId    string    `description:"产业资源包Id  多个用 , 隔开"`
+	IndustrialManagementNames string    `description:"产业资源包名称  多个用 , 隔开"`
+	CompanyLabel              string    `description:"公司标签多个用{|}隔开"`
+	OverviewArticleId         int       `description:"关联的综述报告ID"`
+	IsNew                     int       `description:"是否为New标签"`
+	IsShowOverviewArticle     int       `description:"是否展示综述报告 1展示,0隐藏"`
 }
 
 type CygxReportSelectionLogRep struct {
@@ -46,20 +47,22 @@ type AddCygxReportSelectionLog struct {
 }
 
 type CygxReportSelectionLogResp struct {
-	ChartPermissionId        int      `description:"行业ID"`
-	IndustrialSubjectId      string   `description:"标的ID"`
-	SubjectName              string   `description:"标的名称"`
-	IndustrialSubjectName    string   `description:"标的ID"`
-	Body                     string   `description:"内容"`
-	IndustrialManagementId   string   `description:"产业资源包Id  多个用 , 隔开"`
-	IndustrialManagementName string   `description:"产业资源包Id  多个用 , 隔开"`
-	CompanyLabel             []string `description:"公司标签"`
-	Label                    string   `description:"公司标签"`
-	OverviewArticleId        int      `description:"综述报告Id"`
-	OverviewArticleTitle     string   `description:"综述报告标题"`
-	IsNew                    int      `description:"是否为New标签"`
-	IsShowOverviewArticle    int      `description:"是否展示综述报告 1展示,0隐藏"`
-	ChartPermissionSort      int      `description:"品种排序"`
+	ChartPermissionId         int      `description:"行业ID"`
+	IndustrialSubjectId       string   `description:"标的ID"`
+	SubjectName               string   `description:"标的名称"`
+	ShowName                  string   `description:"产业与标的展示名称"`
+	IndustrialSubjectName     string   `description:"标的ID"`
+	Body                      string   `description:"内容"`
+	IndustrialManagementId    string   `description:"产业资源包Id  多个用 , 隔开"`
+	IndustrialManagementName  string   `description:"产业资源包Id  多个用 , 隔开"`
+	IndustrialManagementNames string   `description:"产业资源包Id  多个用 , 隔开"`
+	CompanyLabel              []string `description:"公司标签"`
+	Label                     string   `description:"公司标签"`
+	OverviewArticleId         int      `description:"综述报告Id"`
+	OverviewArticleTitle      string   `description:"综述报告标题"`
+	IsNew                     int      `description:"是否为New标签"`
+	IsShowOverviewArticle     int      `description:"是否展示综述报告 1展示,0隐藏"`
+	ChartPermissionSort       int      `description:"品种排序"`
 }
 
 type CygxReportSelectionChart struct {
@@ -92,18 +95,19 @@ func GetCygxReportSelectionSjdpList(articleId int, typeStr string) (items []*Cyg
 }
 
 type CygxReportSelectionLoglist struct {
-	ArticleSunId           int       `description:"子级报告id"`
-	ArticleId              int       `description:"父级报告Id"`
-	ChartPermissionId      int       `description:"行业ID"`
-	PermissionName         string    `description:"行业ID"`
-	CreateTime             time.Time `description:"创建时间"`
-	Body                   string    `description:"内容"`
-	IndustrialSubjectId    string    `description:"标的ID"`
-	IndustrialManagementId string    `description:"产业资源包Id  多个用 , 隔开"`
-	SubjectName            string    `description:"标的名称"`
-	IcoLink                string    `orm:"column(image_url)"description:"图标链接"`
-	OverviewArticleId      int       `description:"关联的综述报告ID"`
-	IsNew                  int       `description:"是否为New标签"`
+	ArticleSunId              int       `description:"子级报告id"`
+	ArticleId                 int       `description:"父级报告Id"`
+	ChartPermissionId         int       `description:"行业ID"`
+	PermissionName            string    `description:"行业ID"`
+	CreateTime                time.Time `description:"创建时间"`
+	Body                      string    `description:"内容"`
+	IndustrialSubjectId       string    `description:"标的ID"`
+	IndustrialManagementId    string    `description:"产业资源包Id  多个用 , 隔开"`
+	IndustrialManagementNames string    `description:"产业资源包名称  多个用 , 隔开"`
+	SubjectName               string    `description:"标的名称"`
+	IcoLink                   string    `orm:"column(image_url)"description:"图标链接"`
+	OverviewArticleId         int       `description:"关联的综述报告ID"`
+	IsNew                     int       `description:"是否为New标签"`
 }
 
 // 列表

+ 11 - 10
models/cygx/report_selection_subject_history.go

@@ -6,16 +6,17 @@ import (
 )
 
 type CygxReportSelectionSubjectHistory struct {
-	Id                  int       `orm:"column(id);pk"`
-	ArticleId           int       `description:"文章ID"`
-	UserId              int       `description:"用户ID"`
-	CreateTime          time.Time `description:"创建时间"`
-	ModifyTime          time.Time `description:"修改时间"`
-	Mobile              string    `description:"手机号"`
-	Email               string    `description:"邮箱"`
-	CompanyId           int       `description:"公司id"`
-	CompanyName         string    `description:"公司名称"`
-	IndustrialSubjectId string    `description:"标的ID"`
+	Id                     int       `orm:"column(id);pk"`
+	ArticleId              int       `description:"文章ID"`
+	UserId                 int       `description:"用户ID"`
+	CreateTime             time.Time `description:"创建时间"`
+	ModifyTime             time.Time `description:"修改时间"`
+	Mobile                 string    `description:"手机号"`
+	Email                  string    `description:"邮箱"`
+	CompanyId              int       `description:"公司id"`
+	CompanyName            string    `description:"公司名称"`
+	IndustrialSubjectId    string    `description:"标的ID"`
+	IndustrialManagementId int       `description:"产业ID"`
 }
 
 // 列表

+ 9 - 0
routers/commentsRouter.go

@@ -1771,6 +1771,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:IndustrialSubjectController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:IndustrialSubjectController"],
+        beego.ControllerComments{
+            Method: "IndustrialAndSubjectSearch",
+            Router: `/industrialAndSubject/search`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:IndustrialSubjectController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:IndustrialSubjectController"],
         beego.ControllerComments{
             Method: "IndustrialSubjectAdd",

+ 2 - 2
services/roadshow/calendar.go

@@ -405,7 +405,7 @@ func CalendarToSH(rsCalendar roadshow.RsCalendar, researcher roadshow.RsCalendar
 	endTime := eTime.Format("2006-01-02 15:04")
 
 	// 创建上海路演日程
-	err, errMsg = creatSHCalendar(userInfo.Mobile, researcherInfo.Mobile, rsCalendar.Title, startTime, endTime, 1, researcher.RsCalendarResearcherId)
+	err, errMsg = creatSHCalendar(userInfo.Mobile, researcherInfo.Mobile, rsCalendar.CompanyName+rsCalendar.Title, startTime, endTime, 1, researcher.RsCalendarResearcherId)
 	if err != nil {
 		utils.FileLog.Info("CreatSHCalendar err: " + err.Error())
 		fmt.Println(err)
@@ -576,7 +576,7 @@ func UpdateSHCalendarByMatter(req roadshow.UpdateMattersReq) (err error) {
 	endTime := eTime.Format("2006-01-02 15:04")
 	//发送更新请求
 
-	_, err = updateSHCalendar(fmt.Sprintf("%v", relationItem.ThirdCalendarId), relationItem.ResearcherMobile, req.MatterContent, startTime, endTime)
+	_, err = updateSHCalendar(fmt.Sprintf("%v", relationItem.ThirdCalendarId), relationItem.ResearcherMobile, relationItem.CustomerName+req.MatterContent, startTime, endTime)
 	if err == nil {
 		updateParams := make(map[string]interface{})
 		whereParams := make(map[string]interface{})