Просмотр исходного кода

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into export_article_pv

xingzai 6 месяцев назад
Родитель
Сommit
c0f1c39b37

+ 4 - 0
controllers/cygx/apply_record.go

@@ -212,6 +212,10 @@ func (this *ApplyRecordController) ListSysRole() {
 			list[i].HttpUrl = utils.CYGX_WEB_URL + "/recent/" + strconv.Itoa(v.SourceId)
 		case "yanxuanspecial": //研选专栏
 			list[i].HttpUrl = utils.CYGX_WEB_URL + "/column/detail/" + strconv.Itoa(v.SourceId)
+		case utils.CYGX_OBJ_FICC_REPORT: //FICC研报
+			list[i].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.SourceId)
+		case utils.CYGX_OBJ_FICC_REPORT_XCX: //FICC研报
+			list[i].IsGray = true
 		}
 	}
 

+ 1 - 1
controllers/cygx/industrial_management.go

@@ -102,7 +102,7 @@ func (this *IndustrialManagementController) ChartPermissionListIco() {
 	if havestrategy > 0 {
 		condition = ` AND chart_permission_id IN (19,20,21,22,23) `
 	} else {
-		condition = ` AND chart_permission_id IN (19,20,21,22) `
+		condition = ` AND chart_permission_id IN (19,20,21,22) OR ( chart_permission_name = '周期'  AND product_id = 2 )   `
 	}
 	list, err := cygx.GetChartPermissionIco(condition)
 	if err != nil {

+ 9 - 2
controllers/cygx/rai_serve.go

@@ -82,7 +82,14 @@ func (this *RaiServeCoAntroller) SearchTag() {
 	}
 
 	resp := new(cygx.RaiServeTagListResp)
-	list, err := cygx.GetRaiServeSearchTagRespList(keyWord)
+	var chartPermissionId string
+
+	if utils.RunMode == "release" {
+		chartPermissionId = "19, 20, 21, 22 ,62 "
+	} else {
+		chartPermissionId = "19, 20, 21, 22 ,148 "
+	}
+	list, err := cygx.GetRaiServeSearchTagRespList(keyWord, chartPermissionId)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -168,7 +175,7 @@ func (this *RaiServeCoAntroller) SearchTagCalendar() {
 			hasCelue = true
 		}
 	}
-
+	permissionName = append(permissionName, utils.ZHOU_QI_NAME) //所有行业默认添加周期行业
 	var permissionNameSql []string
 	for _, v := range permissionName {
 		permissionNameSql = append(permissionNameSql, "'"+v+"'")

+ 463 - 4
controllers/cygx/report_article.go

@@ -241,6 +241,7 @@ func (this *ReportArticleController) ReportArticleList() {
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
+	//return
 	condition += `	GROUP BY art.article_id  ORDER BY art.publish_date DESC `
 	//fmt.Println(condition)
 	list, err := cygx.GetReportArticleList(condition, pars, startSize, pageSize, isClass)
@@ -370,6 +371,12 @@ func (this *ReportArticleController) ReportArticleList() {
 		list[k].CommentNum = mapCommment[v.ArticleId]
 		list[k].ListIndustrial = mapIndustrialList[v.ArticleId]
 		list[k].ListSubject = mapSubjectList[v.ArticleId]
+
+		if v.ReportId > 0 {
+			list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.ReportId)
+		} else {
+			list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
+		}
 	}
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := new(cygx.GetReportArticleListRep)
@@ -1978,10 +1985,6 @@ func (this *IndustrialSubjectController) ReportMappingAdd() {
 	br.IsAddLog = true
 }
 
-//func init() {
-//	initOrder()
-//}
-
 func initart() {
 	//行业
 	var condition string
@@ -3210,3 +3213,459 @@ func initHistoryRemarList() {
 	}
 
 }
+
+func initcygx_user_feedback() {
+	remarkList, err := cygx.GetCygxUserFeedbackListIni2t()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	var companyids []int
+	var sellerIds []int
+	var adminIds []int
+	//var companyidsMap
+
+	for _, v := range remarkList {
+		item := new(company.CompanyHistoryRemarkResp)
+		item.CompanyId = v.CompanyId
+		if !utils.InArrayByInt(companyids, v.CompanyId) {
+			companyids = append(companyids, v.CompanyId)
+		}
+
+		if !utils.InArrayByInt(sellerIds, v.SellerId) {
+			sellerIds = append(sellerIds, v.SellerId)
+		}
+
+		if !utils.InArrayByInt(adminIds, v.AdminId) {
+			adminIds = append(adminIds, v.AdminId)
+		}
+	}
+
+	sysUserList, err := system.GetAdminList()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	adminMap := make(map[int]*system.Admin, 0)
+	for _, v := range sysUserList {
+		adminMap[v.AdminId] = v
+	}
+
+	listCompany, err := company.GetCompanyProductsByCompanyIdsAndProductIdinit(companyids)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	mapCompamyName := make(map[int]*company.CompanyProduct)
+
+	for _, v := range listCompany {
+		mapCompamyName[v.CompanyId] = v
+	}
+
+	//创建excel
+	dir, err := os.Executable()
+	exPath := filepath.Dir(dir)
+	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	xlsxFile := xlsx.NewFile()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	style := xlsx.NewStyle()
+	alignment := xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+	}
+	style.Alignment = alignment
+	style.ApplyAlignment = true
+
+	redStyle := xlsx.NewStyle()
+	redStyle.Alignment = alignment
+	redStyle.ApplyAlignment = true
+	redStyle.Font.Color = "ff0000"
+	//定义底色需要标黄的 单元格颜色
+	redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
+	redStyle.Fill = redFill
+	//redStyle.Border = *border
+
+	var sheetName string
+	sheetName = "针对kp的交流反馈"
+	sheet, err := xlsxFile.AddSheet(sheetName)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//标头
+	rowTitle := sheet.AddRow()
+	cellA := rowTitle.AddCell()
+	cellA.Value = "服务销售姓名"
+	cellB := rowTitle.AddCell()
+	cellB.Value = " kp姓名"
+	cellC := rowTitle.AddCell()
+	cellC.Value = " 公司名称"
+
+	cellMoney := rowTitle.AddCell()
+	cellMoney.Value = "原销售"
+
+	cellConct := rowTitle.AddCell()
+	cellConct.Value = "交流反馈内容"
+
+	cellTime := rowTitle.AddCell()
+	cellTime.Value = "录入时间"
+
+	var SellerNameArr []string
+	for _, item := range sysUserList {
+		if !utils.InArrayByStr(SellerNameArr, item.RealName) {
+			SellerNameArr = append(SellerNameArr, item.RealName)
+		}
+	}
+	fmt.Println(SellerNameArr)
+	for _, v := range SellerNameArr {
+		fmt.Println(v)
+	}
+	//return
+	for _, v := range adminIds {
+		for _, item := range remarkList {
+
+			if item.AdminId != v {
+				//fmt.Println(v)
+				continue
+			}
+			fmt.Println(v)
+			row := sheet.AddRow()
+			cellAData := row.AddCell()
+			cellAData.Value = adminMap[item.AdminId].RealName
+
+			cellBData := row.AddCell()
+			cellBData.Value = item.RealName
+
+			cellCData := row.AddCell()
+			cellCData.Value = item.CompanyName
+
+			cellCnameData := row.AddCell()
+			cellCnameData.Value = mapCompamyName[item.CompanyId].SellerName
+
+			cellContentData := row.AddCell()
+			cellContentData.Value = item.Content
+
+			cellTimeData := row.AddCell()
+			cellTimeData.Value = item.CreateTime.Format(utils.FormatDateTime)
+		}
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+}
+
+//	func init() {
+//		initcompany_history_remark()
+//	}
+func initcompany_history_remark() {
+	remarkList, err := company.GetCompanyHistoryRemarkListInitExportinit()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	var companyids []int
+	var adminIds []int
+	//var companyidsMap
+
+	for _, v := range remarkList {
+		item := new(company.CompanyHistoryRemarkResp)
+		item.CompanyId = v.CompanyId
+		if !utils.InArrayByInt(companyids, v.CompanyId) {
+			companyids = append(companyids, v.CompanyId)
+		}
+		if !utils.InArrayByInt(adminIds, v.SysAdminId) {
+			adminIds = append(adminIds, v.SysAdminId)
+		}
+		switch v.TableName {
+		case "company_service_record":
+			item.RemarkType = "沟通记录"
+		case "company_product_remark":
+			item.RemarkType = "历史备注"
+		case "company_no_renewed_note":
+			item.RemarkType = "未续约备注"
+		case "company_renewal_reason":
+			item.RemarkType = "未续约说明"
+		case "cygx_user_feedback":
+			item.RemarkType = "交流反馈(" + v.RealName + ")"
+		default:
+			item.RemarkType = "备注"
+		}
+	}
+
+	listCompany, err := company.GetCompanyProductsByCompanyIdsAndProductIdinit(companyids)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	sysUserList, err := system.GetAdminList()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	adminMap := make(map[int]*system.Admin, 0)
+	for _, v := range sysUserList {
+		adminMap[v.AdminId] = v
+	}
+
+	mapCompamyName := make(map[int]*company.CompanyProduct)
+
+	for _, v := range listCompany {
+		mapCompamyName[v.CompanyId] = v
+	}
+
+	//创建excel
+	dir, err := os.Executable()
+	exPath := filepath.Dir(dir)
+	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	xlsxFile := xlsx.NewFile()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	style := xlsx.NewStyle()
+	alignment := xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+	}
+	style.Alignment = alignment
+	style.ApplyAlignment = true
+
+	redStyle := xlsx.NewStyle()
+	redStyle.Alignment = alignment
+	redStyle.ApplyAlignment = true
+	redStyle.Font.Color = "ff0000"
+	//定义底色需要标黄的 单元格颜色
+	redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
+	redStyle.Fill = redFill
+	//redStyle.Border = *border
+
+	var sheetName string
+	sheetName = "针对kp的交流反馈"
+	sheet, err := xlsxFile.AddSheet(sheetName)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//标头
+	rowTitle := sheet.AddRow()
+	cellA := rowTitle.AddCell()
+	cellA.Value = "服务销售姓名"
+
+	cellC := rowTitle.AddCell()
+	cellC.Value = " 公司名称"
+
+	cellMoney := rowTitle.AddCell()
+	cellMoney.Value = "原销售"
+
+	cellConct := rowTitle.AddCell()
+	cellConct.Value = "交流反馈内容"
+
+	cellType := rowTitle.AddCell()
+	cellType.Value = "记录类型"
+
+	cellTime := rowTitle.AddCell()
+	cellTime.Value = "录入时间"
+
+	var SellerNameArr []string
+	for _, item := range remarkList {
+		if !utils.InArrayByStr(SellerNameArr, mapCompamyName[item.CompanyId].ShareSeller) {
+			SellerNameArr = append(SellerNameArr, mapCompamyName[item.CompanyId].ShareSeller)
+		}
+	}
+	fmt.Println(SellerNameArr)
+	for _, v := range SellerNameArr {
+		fmt.Println(v)
+	}
+	//return
+	for _, v := range adminIds {
+		for _, item := range remarkList {
+
+			if item.SysAdminId != v {
+				//fmt.Println(v)
+				continue
+			}
+			fmt.Println(v)
+			row := sheet.AddRow()
+			cellAData := row.AddCell()
+			cellAData.Value = item.SysAdminName
+
+			cellCData := row.AddCell()
+			cellCData.Value = mapCompamyName[item.CompanyId].CompanyName
+
+			cellCnameData := row.AddCell()
+			cellCnameData.Value = mapCompamyName[item.CompanyId].SellerName
+
+			cellContentData := row.AddCell()
+			cellContentData.Value = item.Content
+
+			celltypeData := row.AddCell()
+			switch item.TableName {
+			case "company_service_record":
+				celltypeData.Value = "沟通记录"
+			case "company_product_remark":
+				celltypeData.Value = "历史备注"
+			default:
+				celltypeData.Value = "历史备注"
+			}
+
+			cellTimeData := row.AddCell()
+			cellTimeData.Value = item.CreateTime.Format(utils.FormatDateTime)
+		}
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+}
+
+func initRsListinit() {
+	list, errList := roadshow.GetRsCalendarMeetingUserByRaiinit()
+	if errList != nil {
+		fmt.Println(errList)
+		return
+	}
+
+	var companyids []int
+
+	//var companyidsMap
+	var rsCalendarIds []int
+	for _, v := range list {
+		if !utils.InArrayByInt(companyids, v.CompanyId) {
+			companyids = append(companyids, v.CompanyId)
+		}
+		rsCalendarIds = append(rsCalendarIds, v.RsCalendarId)
+	}
+
+	listCompany, err := company.GetCompanyProductsByCompanyIdsAndProductIdinit(companyids)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	mapCompamyName := make(map[int]*company.CompanyProduct)
+
+	for _, v := range listCompany {
+		mapCompamyName[v.CompanyId] = v
+
+	}
+
+	mapRsCalendarLabel := make(map[int][]string) //1v1 路演标签
+	mapRsCalendarLabel = cygxService.GetRsCalendarLabelByRsCalendarIds(rsCalendarIds)
+
+	//创建excel
+	dir, err := os.Executable()
+	exPath := filepath.Dir(dir)
+	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	xlsxFile := xlsx.NewFile()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	style := xlsx.NewStyle()
+	alignment := xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+	}
+	style.Alignment = alignment
+	style.ApplyAlignment = true
+
+	redStyle := xlsx.NewStyle()
+	redStyle.Alignment = alignment
+	redStyle.ApplyAlignment = true
+	redStyle.Font.Color = "ff0000"
+	//定义底色需要标黄的 单元格颜色
+	redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
+	redStyle.Fill = redFill
+	//redStyle.Border = *border
+
+	var sheetName string
+	sheetName = "活动"
+	sheet, err := xlsxFile.AddSheet(sheetName)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//标头
+	rowTitle := sheet.AddRow()
+	cellA := rowTitle.AddCell()
+	cellA.Value = "公司名称"
+	cellB := rowTitle.AddCell()
+	cellB.Value = "所属服务销售"
+	cellC := rowTitle.AddCell()
+	cellC.Value = "原销售"
+
+	cellD := rowTitle.AddCell()
+	cellD.Value = "姓名"
+	cellE := rowTitle.AddCell()
+	cellE.Value = "手机号"
+
+	cellF := rowTitle.AddCell()
+	cellF.Value = "路演时间"
+	cellG := rowTitle.AddCell()
+	cellG.Value = "研究员"
+	cellH := rowTitle.AddCell()
+	cellH.Value = "路演形式"
+	cellI := rowTitle.AddCell()
+	cellI.Value = "路演主题"
+	cellJ := rowTitle.AddCell()
+	cellJ.Value = "主题标签"
+
+	for _, v := range companyids {
+		for _, item := range list {
+
+			if item.CompanyId != v {
+				//fmt.Println(v)
+				continue
+			}
+			row := sheet.AddRow()
+			cellAData := row.AddCell()
+			cellAData.Value = item.CompanyName
+
+			cellBData := row.AddCell()
+
+			cellCData := row.AddCell()
+
+			if mapCompamyName[item.CompanyId] != nil {
+				cellBData.Value = mapCompamyName[item.CompanyId].ShareSeller
+				cellCData.Value = mapCompamyName[item.CompanyId].SellerName
+			}
+			cellDData := row.AddCell()
+			cellDData.Value = item.RealName
+			cellEData := row.AddCell()
+			cellEData.Value = item.Mobile
+			cellFData := row.AddCell()
+			cellFData.Value = item.StartDate + " " + item.StartTime
+			cellGData := row.AddCell()
+			cellGData.Value = item.ResearcherName
+			cellHData := row.AddCell()
+			cellHData.Value = item.RoadshowType
+			cellIData := row.AddCell()
+			cellIData.Value = item.RoadShowTheme
+			cellJData := row.AddCell()
+			cellJData.Value = strings.Join(mapRsCalendarLabel[item.RsCalendarId], ",")
+
+		}
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+}

+ 18 - 0
controllers/cygx/user.go

@@ -691,6 +691,9 @@ func (this *UserController) TableDetail() {
 				} else {
 					list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
 				}
+				if v.ReportId > 0 {
+					list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.ReportId)
+				}
 			}
 
 			//导出excel
@@ -808,6 +811,9 @@ func (this *UserController) TableDetail() {
 				} else {
 					list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
 				}
+				if v.ReportId > 0 {
+					list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.ReportId)
+				}
 			}
 		}
 	} else if source == 4 {
@@ -2528,6 +2534,9 @@ func (this *UserController) CompanyTableDetail() {
 			} else {
 				list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
 			}
+			if v.ReportId > 0 {
+				list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.ReportId)
+			}
 		}
 		//导出excel
 		if isExport {
@@ -2668,6 +2677,9 @@ func (this *UserController) CompanyTableDetail() {
 				} else {
 					list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
 				}
+				if v.ReportId > 0 {
+					list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.ReportId)
+				}
 			}
 		}
 	} else if source == 4 {
@@ -3830,6 +3842,9 @@ func (this *UserController) CompanyList() {
 			} else {
 				list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
 			}
+			if v.ReportId > 0 {
+				list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.ReportId)
+			}
 		}
 		//导出excel
 		if isExport {
@@ -3979,6 +3994,9 @@ func (this *UserController) CompanyList() {
 				} else {
 					list[k].HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.ArticleId)
 				}
+				if v.ReportId > 0 {
+					list[k].HttpUrl = utils.CYGX_WEB_URL + "/material/ricc/yb/report/" + strconv.Itoa(v.ReportId)
+				}
 			}
 		}
 	} else if source == 4 {

+ 18 - 9
controllers/roadshow/calendar_meeting_user.go

@@ -49,12 +49,18 @@ func (this *CalendarMeetingUserController) Add() {
 	rsCalendarId := req.RsCalendarId
 	userIds := req.UserId
 	tagList := req.TagList
+	roadShowTheme := req.RoadShowTheme
 
 	if rsCalendarId == 0 {
 		br.Msg = "路演信息错误!"
 		return
 	}
 
+	if roadShowTheme == "" {
+		br.Msg = "请输入路演主题名称!"
+		return
+	}
+
 	var itemsGroup []*roadshow.RsCalendarMeetingLabelGroup
 	for _, v := range tagList {
 		itemGroup := new(roadshow.RsCalendarMeetingLabelGroup)
@@ -73,7 +79,7 @@ func (this *CalendarMeetingUserController) Add() {
 		br.ErrMsg = "获取信息失败-AddRsCalendarMeetingLabelGroupMulti!Err:" + err.Error()
 		return
 	}
-
+	var items []*roadshow.RsCalendarMeetingUser
 	if len(userIds) > 0 {
 		var userIdsStr []string
 		for _, v := range userIds {
@@ -85,8 +91,6 @@ func (this *CalendarMeetingUserController) Add() {
 			br.ErrMsg = "获取用户信息失败-GetWxUserListByUserIdsHaveCompany!Err:" + err.Error()
 			return
 		}
-
-		var items []*roadshow.RsCalendarMeetingUser
 		for _, v := range listUser {
 			item := new(roadshow.RsCalendarMeetingUser)
 			item.RsCalendarId = rsCalendarId
@@ -99,16 +103,17 @@ func (this *CalendarMeetingUserController) Add() {
 			item.Position = v.Position
 			item.AdminId = sysUser.AdminId
 			item.AdminName = sysUser.RealName
+			item.RoadShowTheme = req.RoadShowTheme
 			item.CreateTime = time.Now()
 			item.ModifyTime = time.Now()
 			items = append(items, item)
 		}
-		err = roadshow.MultiAddRsCalendarMeetingUser(items)
-		if err != nil {
-			br.Msg = "操作失败!"
-			br.ErrMsg = "操作失败-MultiAddRsCalendarMeetingUserErr:" + err.Error()
-			return
-		}
+	}
+	err = roadshow.MultiAddRsCalendarMeetingUser(items, roadShowTheme, rsCalendarId)
+	if err != nil {
+		br.Msg = "操作失败!"
+		br.ErrMsg = "操作失败-MultiAddRsCalendarMeetingUser!Err:" + err.Error()
+		return
 	}
 	br.Ret = 200
 	br.Success = true
@@ -220,6 +225,10 @@ func (this *CalendarMeetingUserController) List() {
 	}
 	if len(list) == 0 {
 		list = make([]*roadshow.RsCalendarMeetingUserResp, 0)
+	} else {
+		for _, v := range list {
+			resp.RoadShowTheme = v.RoadShowTheme
+		}
 	}
 	if len(lebelDetail) == 0 {
 		lebelDetail = make([]*cygx.RaiServeTagResp, 0)

+ 1 - 1
controllers/roadshow/company.go

@@ -40,7 +40,7 @@ func (this *CalendarController) CompanySearch() {
 		groupId = -1
 	}
 
-	list, err := roadshow.CompanySearchV2(sysUser.AdminId, groupId, KeyWord)
+	list, err := roadshow.CompanySearchV2(sysUser.AdminId, groupId, KeyWord, sysUser.RoleTypeCode)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		br.Msg = "搜索客户失败!"
 		br.ErrMsg = "搜索客户失败!Err:" + err.Error()

+ 7 - 0
models/company/company_history_remark.go

@@ -63,6 +63,13 @@ func GetCompanyHistoryRemarkListInitExport() (items []*CompanyHistoryRemark, err
 	return
 }
 
+func GetCompanyHistoryRemarkListInitExportinit() (items []*CompanyHistoryRemark, err error) {
+	o := orm.NewOrm()
+	sql := "SELECT\n\t* \nFROM\n\tcompany_history_remark \nWHERE\n\tproduct_id = 2 \n\tAND show_time >= '2024-07-01' \n\tAND show_time < '2024-10-01' \n\tAND table_name IN ( 'company_service_record', 'company_history_remark' ) \n\tAND \tsys_admin_id IN ( SELECT admin_id FROM admin WHERE group_id IN ( 68, 72 ) ) \nORDER BY\n\tshow_time DESC "
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 // DelCompanyHistoryRemark 删除客户历史备注
 func DelCompanyHistoryRemark(tableName string, tableId int) (err error) {
 	o := orm.NewOrm()

+ 12 - 0
models/company/company_product.go

@@ -701,3 +701,15 @@ func UpdateSharGroupid(sharGroupid, shareSellerId int) (err error) {
 	_, err = o.Raw(sql, sharGroupid, shareSellerId).Exec()
 	return
 }
+
+// GetCompanyProductsByCompanyIdsAndProductId 根据客户id集合字符串以及品种id获取所有客户产品列表
+func GetCompanyProductsByCompanyIdsAndProductIdinit(companyIds []int) (items []*CompanyProduct, err error) {
+	lenCompanyId := len(companyIds)
+	if lenCompanyId == 0 {
+		return
+	}
+	sql := `SELECT * FROM  company_product  WHERE company_id in (` + utils.GetOrmInReplace(lenCompanyId) + `) AND product_id = 2 `
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, companyIds).QueryRows(&items)
+	return
+}

+ 1 - 0
models/cygx/apply_record.go

@@ -65,6 +65,7 @@ type CygxApplyRecordResp struct {
 	Source                   string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
 	Title                    string `description:"标题"`
 	HttpUrl                  string `description:"跳转地址"`
+	IsGray                   bool   `description:"是否置灰"`
 }
 
 func GetCygxApplyRecord(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxApplyRecordResp, err error) {

+ 1 - 1
models/cygx/cygx_report_mapping.go

@@ -16,7 +16,7 @@ type CygxReportMappingListRep struct {
 // 主题列表
 func CygxReportMappingist(chartPermissionId int) (items []*CygxReportMapping, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
-	sql := `SELECT sub_category_name FROM cygx_report_mapping WHERE  chart_permission_id = ? GROUP BY sub_category_name`
+	sql := `SELECT sub_category_name FROM cygx_report_mapping WHERE  chart_permission_id = ? GROUP BY sub_category_name   ORDER BY sort DESC , id  ASC  `
 	_, err = o.Raw(sql, chartPermissionId).QueryRows(&items)
 	return
 }

+ 3 - 0
models/cygx/cygx_user.go

@@ -301,6 +301,7 @@ type UserInteractionListResp struct {
 
 type UserInteraction struct {
 	ArticleId             int    `description:"文章id"`
+	ReportId              int    `description:"研报文章id"`
 	ActivityId            int    `description:"活动ID"`
 	ArticleType           int    `description:"文章类型 1:查研观向, 2:策略平台"`
 	ArticleIdMd5          string `description:"文章MD5id"`
@@ -371,6 +372,7 @@ type UserInteraction struct {
 	ArticleNum            int    // 已发布的文章数量
 	FansNum               int    // 粉丝数量
 	ResearcherName        string `description:"研究员姓名"`
+	RoadShowTheme         string `description:"路演主题"`
 }
 
 // 查研观向图表
@@ -737,6 +739,7 @@ func GetCygxArticleCollectByUser(uid, startSize, pageSize int, condition string)
 	sql := ` SELECT
 			art.title,
 			art.article_id,
+			art.report_id,
 			art.article_id_md5,
 			art.publish_date,
 			re.chart_permission_name,

+ 2 - 0
models/cygx/cygx_user_company.go

@@ -284,6 +284,7 @@ func GetCygxArticleCollectByCompanyWeekly(startSize, pageSize int, condition str
 	sql := ` SELECT
 			art.title,
 			art.article_id,
+			art.report_id,
 			art.article_id_md5,
 			art.publish_date,
 			re.chart_permission_name,
@@ -961,6 +962,7 @@ func GetCygxArticleCollectByCompanyList(startSize, pageSize int, condition strin
 	sql := ` SELECT
 			art.title,
 			art.article_id,
+			art.report_id,
 			art.article_id_md5,
 			art.publish_date,
 			re.chart_permission_name,

+ 1 - 1
models/cygx/industrial_management.go

@@ -222,7 +222,7 @@ func DeleteIndustrialManagement(industrialManagementId int) (err error) {
 // 获取产业数量
 func GetIndustrialManagementInfo(industrialManagementId int) (item *CygxIndustrialManagement, err error) {
 	sqlCount := ` SELECT *  FROM cygx_industrial_management WHERE industrial_management_id= ? `
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	err = o.Raw(sqlCount, industrialManagementId).QueryRow(&item)
 	return
 }

+ 3 - 3
models/cygx/rai_serve_bill.go

@@ -53,7 +53,7 @@ type RaiServeCoverageRateResp struct {
 }
 
 // 服务类型列表
-func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, err error) {
+func GetRaiServeSearchTagRespList(keywords, chartPermissionId string) (items []*RaiServeTagResp, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := `SELECT
 			1 AS tag_type,
@@ -64,7 +64,7 @@ func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, er
 			cygx_industrial_management AS i 
 		WHERE
 			1 = 1 
-			AND i.chart_permission_id IN ( 19, 20, 21, 22 ) 
+			AND i.chart_permission_id IN (` + chartPermissionId + ` ) 
 			AND  (i.industry_name LIKE '%` + keywords + `%' ) UNION ALL
 		SELECT
 			2 AS tag_type,
@@ -76,7 +76,7 @@ func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, er
 			INNER JOIN cygx_industrial_management AS i ON i.industrial_management_id = s.industrial_management_id 
 		WHERE
 			1 = 1 
-			AND i.chart_permission_id IN ( 19, 20, 21, 22 ) 
+			AND i.chart_permission_id IN (` + chartPermissionId + ` ) 
 			AND ( s.subject_name LIKE  '%` + keywords + `%') 
 		ORDER BY
 			create_time ASC `

+ 3 - 0
models/cygx/report_article.go

@@ -65,6 +65,7 @@ type CygxReportArticle struct {
 	Label               string `description:"标签"`
 	ListIndustrial      []*IndustrialActivityGroupManagementRep
 	ListSubject         []*SubjectActivityGroupManagementRep
+	HttpUrl             string `description:"跳转地址"`
 }
 
 type GetReportArticleListRep struct {
@@ -88,6 +89,7 @@ func GetReportArticleList(condition string, pars []interface{}, startSize, pageS
 		sql = `SELECT
 				art.title,
 				art.article_id,
+				art.report_id,
 				art.category_id,
 				art.publish_date,
 				art.is_class,
@@ -111,6 +113,7 @@ func GetReportArticleList(condition string, pars []interface{}, startSize, pageS
 		sql = `SELECT
 				art.title,
 				art.article_id,
+				art.report_id,
 				art.category_id,
 				art.publish_date,
 				art.is_class,

+ 21 - 0
models/cygx/user_feedback.go

@@ -21,6 +21,7 @@ type CygxUserFeedback struct {
 	CompanyName    string    `comment:"公司名称"`
 	RealName       string    `comment:"用户实际名称"`
 	AdminId        int       `comment:"操作人ID"`
+	SellerId       int       `comment:"操作人ID"`
 	CreateTime     time.Time `comment:"创建时间"`
 }
 
@@ -89,6 +90,26 @@ func GetCygxUserFeedbackListInit() (items []*CygxUserFeedback, err error) {
 	return
 }
 
+func GetCygxUserFeedbackListIni2t() (items []*CygxUserFeedback, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT
+	f.*,
+	p.seller_id 
+FROM
+	cygx_user_feedback AS f
+	INNER JOIN weekly_report.company_product AS p ON p.company_id = f.company_id 
+	AND p.product_id = 2 
+WHERE
+	admin_id IN ( SELECT admin_id FROM weekly_report.admin WHERE group_id IN ( 68, 72 ) ) 
+	AND user_id IN ( SELECT user_id FROM weekly_report.wx_user WHERE is_maker = 1 ) 
+	AND f.create_time > '2024-07-01' 
+	AND f.create_time < '2024-10-01' 
+ORDER BY
+	f.create_time DESC `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 // 获取数量
 func GetCygxUserFeedbackCount(condition string, pars []interface{}) (count int, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")

+ 33 - 6
models/roadshow/company.go

@@ -2,6 +2,7 @@ package roadshow
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"hongze/hz_crm_api/utils"
 )
 
 type CompanySearchView struct {
@@ -25,13 +26,15 @@ func CompanySearch(sellerId int, keyWord string) (list []*CompanySearchView, err
 	return
 }
 
-func CompanySearchV2(sellerId, groupId int, keyWord string) (list []*CompanySearchView, err error) {
+func CompanySearchV2(sellerId, groupId int, keyWord, roleTypeCode string) (list []*CompanySearchView, err error) {
 	list = make([]*CompanySearchView, 0)
 
 	// 中文客户
 	companies := make([]*CompanySearchView, 0)
 	o := orm.NewOrm()
-	sql := `SELECT
+	var sql string
+	if roleTypeCode == utils.ROLE_TYPE_CODE_ADMIN || roleTypeCode == utils.ROLE_TYPE_CODE_RAI_ADMIN { // 权益管理员跟管理员的筛选
+		sql = `SELECT
 				b.company_id,
 				a.company_name,
 				0 AS english_company
@@ -39,13 +42,37 @@ func CompanySearchV2(sellerId, groupId int, keyWord string) (list []*CompanySear
 				company AS a
 			INNER JOIN company_product AS b ON a.company_id = b.company_id 
 			WHERE
-				b.status IN ('正式', '试用', '永续') AND (b.seller_id = ? OR b.share_seller_id = ?  OR b.group_id = ? OR b.share_group_id = ?  ) AND a.company_name LIKE ?
+			     1=1 
+			     AND IF  ( b.product_id = 1 , b.status IN ('正式', '试用', '永续') ,1=1 )  
+			     AND IF  ( b.product_id = 2 , b.status IN ('正式', '试用', '永续', '冻结', '流失') ,1=1 )  
+				 AND a.company_name LIKE ?
 			GROUP BY
 				b.company_id `
-	_, err = o.Raw(sql, sellerId, sellerId, groupId, groupId, keyWord).QueryRows(&companies)
-	if err != nil {
-		return
+		_, err = o.Raw(sql, keyWord).QueryRows(&companies)
+		if err != nil {
+			return
+		}
+	} else {
+		sql = `SELECT
+				b.company_id,
+				a.company_name,
+				0 AS english_company
+			FROM
+				company AS a
+			INNER JOIN company_product AS b ON a.company_id = b.company_id 
+			WHERE
+			     1=1 
+			     AND IF  ( b.product_id = 1 , b.status IN ('正式', '试用', '永续') ,1=1 )  
+			     AND IF  ( b.product_id = 2 , b.status IN ('正式', '试用', '永续', '冻结', '流失') ,1=1 )  
+				 AND (b.seller_id = ? OR b.share_seller_id = ?  OR b.group_id = ? OR b.share_group_id = ?  ) AND a.company_name LIKE ?
+			GROUP BY
+				b.company_id `
+		_, err = o.Raw(sql, sellerId, sellerId, groupId, groupId, keyWord).QueryRows(&companies)
+		if err != nil {
+			return
+		}
 	}
+
 	list = append(list, companies...)
 
 	// 英文客户

+ 7 - 7
models/roadshow/rs_calendar_meeting_label_group.go

@@ -26,9 +26,6 @@ func AddRsCalendarMeetingLabelGroup(item *RsCalendarMeetingLabelGroup) (err erro
 
 // AddRsCalendarMeetingLabelGroupMulti 批量添加
 func AddRsCalendarMeetingLabelGroupMulti(items []*RsCalendarMeetingLabelGroup, rsCalendarId int) (err error) {
-	if len(items) == 0 {
-		return
-	}
 	o, err := orm.NewOrm().Begin()
 	if err != nil {
 		return
@@ -48,11 +45,14 @@ func AddRsCalendarMeetingLabelGroupMulti(items []*RsCalendarMeetingLabelGroup, r
 		return
 	}
 
-	//批量插入
-	_, err = o.InsertMulti(len(items), items)
-	if err != nil {
-		return
+	if len(items) > 0 {
+		_, err = o.InsertMulti(len(items), items)
+		if err != nil {
+			return
+		}
 	}
+	//批量插入
+
 	return
 }
 

+ 74 - 8
models/roadshow/rs_calendar_meeting_user.go

@@ -9,9 +9,10 @@ import (
 )
 
 type AddRsCalendarMeetingUserReq struct {
-	RsCalendarId int   `description:"日程ID"`
-	UserId       []int // 用户ID
-	TagList      []*AddRsCalendarMeetingUserTagReq
+	RsCalendarId  int   `description:"日程ID"`
+	UserId        []int // 用户ID
+	TagList       []*AddRsCalendarMeetingUserTagReq
+	RoadShowTheme string `description:"路演主题"`
 }
 
 type AddRsCalendarMeetingUserTagReq struct {
@@ -31,6 +32,7 @@ type RsCalendarMeetingUser struct {
 	Position                string    `description:"职位"`
 	AdminId                 int       `description:"管理员ID"`
 	AdminName               string    `description:"管理员姓名"`
+	RoadShowTheme           string    `description:"路演主题"`
 	CreateTime              time.Time `description:"创建时间"`
 	ModifyTime              time.Time `description:"修改时间"`
 }
@@ -39,6 +41,7 @@ type RsCalendarMeetingUserResp struct {
 	RsCalendarMeetingUserId int    `description:"参会名单主键ID"`
 	RealName                string `description:"用户实际名称"`
 	Position                string `description:"职位"`
+	RoadShowTheme           string `description:"路演主题"`
 }
 
 type DeleteRsCalendarMeetingUserReq struct {
@@ -46,17 +49,46 @@ type DeleteRsCalendarMeetingUserReq struct {
 }
 
 type RsCalendarMeetingUserListResp struct {
-	List      []*RsCalendarMeetingUserResp
-	ListLebel []*cygx.RaiServeTagResp
+	List          []*RsCalendarMeetingUserResp
+	ListLebel     []*cygx.RaiServeTagResp
+	RoadShowTheme string `description:"路演主题"`
 }
 
 // MultiAddRsCalendarMeetingUser 批量添加RsCalendarMeetingUser
-func MultiAddRsCalendarMeetingUser(items []*RsCalendarMeetingUser) (err error) {
-	if len(items) == 0 {
+func MultiAddRsCalendarMeetingUser(items []*RsCalendarMeetingUser, roadShowTheme string, rsCalendarId int) (err error) {
+	to, err := orm.NewOrm().Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		if err != nil {
+			_ = to.Rollback()
+		} else {
+			_ = to.Commit()
+		}
+	}()
+
+	sql := ` UPDATE rs_calendar_meeting_user SET road_show_theme=? WHERE rs_calendar_id=? `
+	_, err = to.Raw(sql, roadShowTheme, rsCalendarId).Exec()
+	if err != nil {
 		return
 	}
+
+	if len(items) > 0 {
+		_, err = to.InsertMulti(len(items), items)
+		if err != nil {
+			return
+		}
+	}
+
+	return
+}
+
+// 获取第一个提交参会信息内容
+func GetRsCalendarMeetingUserFirst(rsCalendarId int) (item *RsCalendarResearcher, err error) {
 	o := orm.NewOrm()
-	_, err = o.InsertMulti(len(items), items)
+	sql := `SELECT * FROM rs_calendar_meeting_user WHERE rs_calendar_id=? LIMIT 1   `
+	err = o.Raw(sql, rsCalendarId).QueryRow(&item)
 	return
 }
 
@@ -154,6 +186,7 @@ type RsCalendarMeetingUserByRai struct {
 	RoadshowType            string `description:"路演形式"`
 	ResearcherName          string `description:"研究员姓名"`
 	TagType                 int    `description:"标签类型,1产业,2标的,3行业权限"`
+	RoadShowTheme           string `description:"路演主题"`
 }
 
 // 权益联系人列表获取相关信息
@@ -165,6 +198,7 @@ func GetRsCalendarMeetingUserByRai(condition string, startSize, pageSize int) (t
 			r.company_name,
 			r.real_name,
 			r.mobile,
+			r.road_show_theme,
 			b.start_date,
 			b.end_date,
 			b.start_time,
@@ -204,6 +238,7 @@ func GetRsCalendarMeetingUserByRaiWeekly(condition string, startSize, pageSize i
 			r.company_name,
 			r.real_name,
 			r.mobile,
+			r.road_show_theme,
 			b.start_date,
 			b.end_date,
 			b.start_time,
@@ -233,3 +268,34 @@ func GetRsCalendarMeetingUserByRaiWeekly(condition string, startSize, pageSize i
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+// 权益联系人列表获取相关信息
+func GetRsCalendarMeetingUserByRaiinit() (items []*RsCalendarMeetingUserByRai, err error) {
+	o := orm.NewOrm()
+	var sql string
+	sql += `SELECT
+			r.company_id,
+			r.company_name,
+			r.real_name,
+			r.mobile,
+			r.road_show_theme,
+			b.start_date,
+			b.end_date,
+			b.start_time,
+			b.end_time,
+			b.start_week,
+			b.researcher_name,
+			a.roadshow_type,
+			a.rs_calendar_id,
+			g.tag_type
+		FROM
+			rs_calendar_meeting_user AS r
+			INNER JOIN rs_calendar AS a ON a.rs_calendar_id = r.rs_calendar_id
+			INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id = b.rs_calendar_id 
+			LEFT JOIN rs_calendar_meeting_label_group AS g ON g.rs_calendar_id = b.rs_calendar_id 
+		WHERE
+			1 = 1  	AND  start_date >='2024-07-01' AND  start_date <='2024-09-31' GROUP  BY 	r.rs_calendar_meeting_user_id  ORDER BY  b.start_date   DESC ,b.start_time   DESC , a.rs_calendar_id DESC  `
+
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 19 - 0
services/cygx/article.go

@@ -4,6 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/PuerkitoBio/goquery"
+	"hongze/hz_crm_api/models"
 	"hongze/hz_crm_api/models/company"
 	"hongze/hz_crm_api/models/cygx"
 	"hongze/hz_crm_api/services"
@@ -221,6 +222,7 @@ func HandleArticleAndYanxuanRecordList(items []*cygx.CygxArticleAndYanxuanRecord
 		var articleIds []int        // 文章ID
 		var yanxuanSpecialIds []int // 研选专栏ID
 		var sellerCompanyIds []int  // 公司ID
+		var mobiles []string        // 手机号
 		for _, v := range items {
 			if v.Source == utils.CYGX_OBJ_ARTICLE {
 				articleIds = append(articleIds, v.SourceId)
@@ -229,12 +231,25 @@ func HandleArticleAndYanxuanRecordList(items []*cygx.CygxArticleAndYanxuanRecord
 				yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
 			}
 			sellerCompanyIds = append(sellerCompanyIds, v.CompanyId)
+			mobiles = append(mobiles, v.Mobile)
 		}
 
 		sellNameMap := services.GetSellNameMapByCompanyIds(sellerCompanyIds)
 
 		mapIndustrialLabel := GetArticleIndustrialLabelByArticleId(articleIds) // 关联产业
 		mapSubjectLabel := GetArticleSubjectLabelByArticleId(articleIds)       // 关联标的
+
+		//根据手机号获取这些用户的信息
+		listUser, e := models.GetWxUserByOutboundMobiles(mobiles)
+		if e != nil {
+			err = errors.New("GetWxUserOutboundMobiles, Err: " + e.Error())
+			return
+		}
+		mapUserRealname := make(map[string]string)
+		for _, v := range listUser {
+			mapUserRealname[v.Mobile] = v.RealName
+		}
+
 		var condition string
 		var pars []interface{}
 
@@ -292,6 +307,7 @@ func HandleArticleAndYanxuanRecordList(items []*cygx.CygxArticleAndYanxuanRecord
 					item.PublishDate = mapArticle[v.SourceId].PublishDate
 					item.PermissionName = mapArticle[v.SourceId].PermissionName
 					item.ArticleIdMd5 = mapArticle[v.SourceId].ArticleIdMd5
+					item.ReportId = mapArticle[v.SourceId].ReportId
 				}
 			}
 			if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
@@ -307,6 +323,9 @@ func HandleArticleAndYanxuanRecordList(items []*cygx.CygxArticleAndYanxuanRecord
 			item.CreateTime = v.CreateTime
 			item.UserId = v.UserId
 			item.RealName = v.RealName
+			if item.RealName == "" {
+				item.RealName = mapUserRealname[v.Mobile]
+			}
 			item.Mobile = v.Mobile
 			item.CompanyId = v.CompanyId
 			item.CompanyName = v.CompanyName

+ 1 - 0
services/cygx/user_label.go

@@ -359,6 +359,7 @@ func HandleListRsCalendar(list []*roadshow.RsCalendarMeetingUserByRai) (items []
 		item.Mobile = v.Mobile
 		item.CompanyId = v.CompanyId
 		item.CompanyName = v.CompanyName
+		item.RoadShowTheme = v.RoadShowTheme
 		//switch v.TagType {
 		//case 1:
 		//	item.LabelKeyWord = strings.Join(mapGroupindustrialManagementName[v.RsCalendarId], ",")

+ 2 - 0
utils/constants.go

@@ -455,6 +455,8 @@ const (
 	CYGX_OBJ_YANXUANSPECIAL     string = "yanxuanspecial"     // 对象类型:研选专栏
 	CYGX_OBJ_ASKSERIEVIDEO      string = "askserievideo"      // 对象类型:问答系列视频
 	CYGX_OBJ_RS_CALENDAR        string = "rscalendar"         // 对象类型:研究员日历安排
+	CYGX_OBJ_FICC_REPORT        string = "ficcreport"         // 对象类型:FICC研报
+	CYGX_OBJ_FICC_REPORT_XCX    string = "ficcreportxcx"      // 对象类型:FICC研报小程序
 )
 
 const (