浏览代码

Merge branch 'CRM6.0'

longyu 3 年之前
父节点
当前提交
a43a62f206

+ 308 - 0
controllers/roadshow/calendar.go

@@ -0,0 +1,308 @@
+package roadshow
+
+import (
+	"encoding/json"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hongze_mobile_admin/controllers"
+	"hongze/hongze_mobile_admin/models"
+	"hongze/hongze_mobile_admin/models/roadshow"
+	"hongze/hongze_mobile_admin/models/tables/admin"
+	"hongze/hongze_mobile_admin/services"
+	"hongze/hongze_mobile_admin/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+//日历
+type CalendarController struct {
+	controllers.BaseAuth
+}
+
+// CalendarList
+// @Title 我的日历列表
+// @Description 我的日历列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   Status   query   int  true       "1:待接受,2:包含,已接受,已拒绝,已删除"
+// @Success 200 {object} roadshow.CalendarListResp
+// @router /calendar/list [get]
+func (this *CalendarController) CalendarList() {
+	adminItem := this.AdminWx
+
+	status, _ := this.GetInt("Status")
+
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	var total int
+	page := paging.GetPaging(currentIndex, pageSize, total)
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize10
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+
+	var condition string
+	var pars []interface{}
+
+	condition += ` AND b.researcher_id=?`
+	pars = append(pars, adminItem.AdminId)
+
+	condition += ` AND a.activity_type IN('路演','公开会议') `
+
+	if status == 1 {
+		condition += ` AND b.status=?`
+		pars = append(pars, 1)
+	} else {
+		condition += ` AND b.status IN(2,3,4)`
+	}
+
+	resp := new(roadshow.CalendarListResp)
+	total, err := roadshow.GetCalendarListCount(condition, pars)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		this.FailWithMessage("获取信息失败!", "获取数据总数失败,GetCalendarListCount,Err:"+err.Error())
+		return
+	}
+	page = paging.GetPaging(currentIndex, pageSize, total)
+	dataList, err := roadshow.GetCalendarList(condition, pars, status, startSize, pageSize)
+	if err != nil {
+		this.FailWithMessage("获取信息失败!", "获取数据失败,GetCalendarList,Err:"+err.Error())
+		return
+	}
+	resp.Paging = page
+	resp.List = dataList
+	this.OkDetailed(resp, "获取成功")
+}
+
+// Accept
+// @Description 接受路演活动接口
+// @Param	request	body roadshow.AcceptReq true "type json string"
+// @Success Ret=200 保存成功
+// @router /accept [post]
+func (this *CalendarController) Accept() {
+
+	//adminItem:=this.AdminWx
+	var req roadshow.AcceptReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		this.FailWithMessage("参数解析失败!", "参数解析失败,Err:"+err.Error())
+		return
+	}
+
+	if req.RsCalendarId <= 0 || req.RsCalendarResearcherId <= 0 {
+		this.FailWithMessage("参数错误!", "RsCalendarId 或 RsCalendarResearcherId 小于等于0:")
+		return
+	}
+	rsCalendar, err := roadshow.GetRsCalendarById(req.RsCalendarId)
+	if err != nil {
+		this.FailWithMessage("获取数据失败!", "GetRsCalendarById Err:"+err.Error())
+		return
+	}
+	rsCalendarResearcher, err := roadshow.GetRsCalendarResearcherById(req.RsCalendarResearcherId)
+	if err != nil {
+		this.FailWithMessage("获取数据失败!", "GetRsCalendarResearcherById Err:"+err.Error())
+		return
+	}
+
+	if rsCalendarResearcher.Status == 2 {
+		this.FailWithMessage("已接受,不可重复操作!", "")
+		return
+	} else if rsCalendarResearcher.Status == 3 {
+		this.FailWithMessage("已拒绝,不可进行接受操作!", "")
+		return
+	} else if rsCalendarResearcher.Status == 4 {
+		this.FailWithMessage("已删除,不可进行接受操作!", "")
+		return
+	} else if rsCalendarResearcher.Status == 5 {
+		this.FailWithMessage("已撤回,不可进行接受操作!", "")
+		return
+	}
+	whereParams := make(map[string]interface{})
+	updateParams := make(map[string]interface{})
+
+	whereParams["rs_calendar_researcher_id"] = req.RsCalendarResearcherId
+	whereParams["rs_calendar_id"] = req.RsCalendarId
+
+	updateParams["status"] = 2
+	updateParams["modify_time"] = time.Now()
+	updateParams["approve_time"] = time.Now()
+
+	err = roadshow.UpdateCalendarResearcher(whereParams, updateParams)
+	if err != nil {
+		this.FailWithMessage("获取数据失败!", "UpdateCalendarResearcher Err:"+err.Error())
+		return
+	}
+	//模板消息通知
+	{
+
+		if rsCalendar != nil {
+			sysAdmin, _ := admin.GetAdminById(rsCalendar.SysUserId)
+			first := "【" + this.AdminWx.RealName + "】接受了你的【" + rsCalendar.ActivityType + "】申请"
+			var keyword1 string
+			if rsCalendar.ActivityType == "路演" {
+				keyword1 = rsCalendar.CompanyName + "," + rsCalendar.RoadshowType + rsCalendar.ActivityType
+			} else {
+				keyword1 = rsCalendar.Theme + "," + rsCalendar.RoadshowType + rsCalendar.ActivityType
+			}
+			keyword2 := "已接受"
+			remark := ""
+			if sysAdmin.Mobile != "" {
+				go services.SendWxMsgWithRoadshowDetailResult(first, keyword1, keyword2, remark, sysAdmin.Mobile, "", "")
+			}
+		}
+	}
+	this.OkDetailed(nil, "保存成功")
+}
+
+// @Title 拒绝路演活动接口
+// @Description 拒绝路演活动接口
+// @Param	request	body roadshow.RefuseReq true "type json string"
+// @Success Ret=200 保存成功
+// @router /refuse [post]
+func (this *CalendarController) Refuse() {
+	//adminItem:=this.AdminWx
+
+	var req roadshow.RefuseReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		this.FailWithMessage("参数解析失败!", "参数解析失败,Err:"+err.Error())
+		return
+	}
+
+	if req.RsCalendarId <= 0 || req.RsCalendarResearcherId <= 0 {
+		this.FailWithMessage("参数错误!", "参数错误!RsCalendarId:"+strconv.Itoa(req.RsCalendarId)+";RsCalendarResearcherId:"+strconv.Itoa(req.RsCalendarResearcherId))
+		return
+	}
+	rsCalendar, err := roadshow.GetRsCalendarById(req.RsCalendarId)
+	if err != nil {
+		this.FailWithMessage("获取数据失败!", "GetRsCalendarById,Err:"+err.Error())
+		return
+	}
+	rsCalendarResearcher, err := roadshow.GetRsCalendarResearcherById(req.RsCalendarResearcherId)
+	if err != nil {
+		this.FailWithMessage("获取数据失败!", "GetRsCalendarResearcherById,Err:"+err.Error())
+		return
+	}
+
+	if rsCalendarResearcher.Status == 2 {
+		this.FailWithMessage("已接受,不可进行拒绝操作!", "")
+		return
+	} else if rsCalendarResearcher.Status == 3 {
+		this.FailWithMessage("已拒绝,不可进行重复操作!", "")
+		return
+	} else if rsCalendarResearcher.Status == 4 {
+		this.FailWithMessage("已删除,不可进行拒绝操作!", "")
+		return
+	} else if rsCalendarResearcher.Status == 5 {
+		this.FailWithMessage("已撤回,不可进行拒绝操作!", "")
+		return
+	}
+
+	whereParams := make(map[string]interface{})
+	updateParams := make(map[string]interface{})
+
+	whereParams["rs_calendar_researcher_id"] = req.RsCalendarResearcherId
+	whereParams["rs_calendar_id"] = req.RsCalendarId
+
+	updateParams["status"] = 3
+	updateParams["refuse_reason"] = req.RefuseReason
+	updateParams["refuse_time"] = time.Now()
+	updateParams["modify_time"] = time.Now()
+
+	err = roadshow.UpdateCalendarResearcher(whereParams, updateParams)
+	if err != nil {
+		this.FailWithMessage("保存失败", "保存失败!UpdateCalendarResearcher:"+err.Error())
+		return
+	}
+
+	//模板消息通知
+	{
+
+		if rsCalendar != nil {
+			sysAdmin, _ := admin.GetAdminById(rsCalendar.SysUserId)
+			first := "【" + this.AdminWx.RealName + "】拒绝了你的【" + rsCalendar.ActivityType + "】申请"
+			var keyword1 string
+			if rsCalendar.ActivityType == "路演" {
+				keyword1 = rsCalendar.CompanyName + "," + rsCalendar.RoadshowType + rsCalendar.ActivityType
+			} else {
+				keyword1 = rsCalendar.Theme + "," + rsCalendar.RoadshowType + rsCalendar.ActivityType
+			}
+			keyword2 := "已拒绝"
+			remark := req.RefuseReason
+			if sysAdmin.Mobile != "" {
+				go services.SendWxMsgWithRoadshowDetailResult(first, keyword1, keyword2, remark, sysAdmin.Mobile, "", "")
+			}
+		}
+	}
+	this.OkDetailed(nil, "保存成功")
+}
+
+// @Title 日历详情
+// @Description 日历详情接口
+// @Param   RsCalendarId   query   int  true       "路演活动id"
+// @Param   RsCalendarResearcherId   query   int  true       "活动研究员id"
+// @Success 200 {object} roadshow.CalendarDetailResp
+// @router /calendar/detail [get]
+func (this *CalendarController) CalendarDetail() {
+	//adminItem:=this.AdminWx
+	//roleTypeCode := adminItem.RoleTypeCode
+
+	rsCalendarId, _ := this.GetInt("RsCalendarId")
+	rsCalendarResearcherId, _ := this.GetInt("RsCalendarResearcherId")
+
+	if rsCalendarId <= 0 || rsCalendarResearcherId <= 0 {
+		this.FailWithMessage("参数错误", "rsCalendarId 或 rsCalendarResearcherId")
+		return
+	}
+
+	calendarItem, err := roadshow.GetRsCalendarById(rsCalendarId)
+	if err != nil {
+		this.FailWithMessage("获取数据失败", "获取数据失败!GetRsCalendarById:"+err.Error())
+		return
+	}
+
+	rsCalendarResearcherItem, err := roadshow.GetRsCalendarResearcherById(rsCalendarResearcherId)
+	if err != nil {
+		this.FailWithMessage("获取数据失败", "获取数据失败!GetRsCalendarResearcherById:"+err.Error())
+		return
+	}
+
+	companyDetailView := new(roadshow.CompanyDetailView)
+	if calendarItem != nil && calendarItem.CompanyId > 0 {
+		companyId := calendarItem.CompanyId
+		companyProductItem, err := models.GetCompanyProductByCompanyIdAndProductId(companyId, 1)
+		if err != nil {
+			this.FailWithMessage("获取数据失败", "获取数据失败!GetRsCalendarResearcherById:"+err.Error())
+			return
+		}
+		permissionList, err := models.GetCompanyProductReportPermissionList(companyId, 1)
+		if err != nil {
+			this.FailWithMessage("搜索客户权限失败", "搜索客户权限失败!GetRsCalendarResearcherById:"+err.Error())
+			return
+		}
+		var permissionArr []string
+		for _, v := range permissionList {
+			permissionArr = append(permissionArr, v.PermissionName)
+		}
+
+		readNum := companyProductItem.ViewTotal
+		companyDetailView.CompanyId = companyProductItem.CompanyId
+		companyDetailView.CompanyName = companyProductItem.CompanyName
+		companyDetailView.Status = companyProductItem.Status
+		companyDetailView.IndustryId = companyProductItem.IndustryId
+		companyDetailView.IndustryName = companyProductItem.IndustryName
+		companyDetailView.PermissionName = strings.Join(permissionArr, "/")
+		companyDetailView.ReportReadTotal = readNum //ficc报告-累计阅读次数
+	}
+
+	resp := new(roadshow.CalendarDetailResp)
+	resp.RsCalendarItem = calendarItem
+	resp.RsCalendarResearcherItem = rsCalendarResearcherItem
+	resp.CompanyDetail = companyDetailView
+	this.OkDetailed(resp, "获取成功")
+}

+ 79 - 0
models/company.go

@@ -0,0 +1,79 @@
+package models
+
+import (
+	"github.com/rdlucklib/rdluck_tools/orm"
+	"time"
+)
+
+type CompanyProduct struct {
+	CompanyProductId    int       `orm:"column(company_product_id);pk" description:"客户产品id"`
+	CompanyId           int       `description:"客户id"`
+	ProductId           int       `description:"产品id"`
+	ProductName         string    `description:"产品名称"`
+	CompanyName         string    `description:"客户名称"`
+	Source              string    `description:"来源"`
+	Reasons             string    `description:"新增理由"`
+	Status              string    `description:"客户状态"`
+	IndustryId          int       `description:"行业id"`
+	IndustryName        string    `description:"行业名称"`
+	SellerId            int       `description:"销售id"`
+	SellerName          string    `description:"销售名称"`
+	GroupId             int       `description:"销售分组id"`
+	DepartmentId        int       `description:"销售部门id"`
+	IsSuspend           int       `description:"1:暂停,0:启用"`
+	SuspendTime         time.Time `description:"暂停启用时间"`
+	TryOutTime          time.Time `description:"正式转试用时间"`
+	RenewalReason       string    `description:"正式转试用后的续约情况说明"`
+	LastDescriptionTime time.Time `description:"上次添加说明时间"`
+	RenewalIntention    int       `description:"是否勾选无续约意向,1:确认,0:未确认"`
+	ApproveStatus       string    `description:"审批状态:'审批中','通过','驳回'"`
+	FreezeTime          time.Time `description:"冻结时间"`
+	FreezeReason        time.Time `description:"冻结理由"`
+	Remark              string    `description:"备注信息"`
+	CreateTime          time.Time `description:"创建时间"`
+	ModifyTime          time.Time `description:"修改时间"`
+	StartDate           string    `description:"开始日期"`
+	EndDate             string    `description:"结束日期"`
+	ContractEndDate     time.Time `description:"合同结束日期"`
+	LoseReason          string    `description:"流失原因"`
+	LossTime            time.Time `description:"流失时间"`
+	CompanyType         string    `description:"客户类型"`
+	OpenCode            string    `description:"开放给第三方的编码,不让第三方定位我们的客户信息"`
+	ViewTotal           int       `description:"阅读总数"`
+}
+
+func GetCompanyProductByCompanyIdAndProductId(companyId, productId int) (item *CompanyProduct, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT b.* FROM company AS a
+			INNER JOIN company_product AS b ON a.company_id=b.company_id
+			WHERE a.company_id=? AND b.product_id=? LIMIT 1 `
+	err = o.Raw(sql, companyId, productId).QueryRow(&item)
+	return
+}
+
+//客户授权产品结构体(包含产品名称)
+type CompanyReportPermissionAndName struct {
+	CompanyReportPermissionId int `description:"客户授权产品id"`
+	CompanyId                 int
+	ReportPermissionId        int
+	CreatedTime               time.Time
+	LastUpdatedTime           time.Time
+	ChartPermissionId         int
+	StartDate                 string    `description:"权限开始日期"`
+	EndDate                   string    `description:"权限结束日期"`
+	ProductId                 int       `description:"产品id"`
+	ProductName               string    `description:"产品名称"`
+	CompanyContractId         int       `description:"合同id"`
+	PermissionName            string    `description:"客户授权产品的名称"`
+	ClassifyName              string    `description:"客户授权产品的分类名称"`
+	Status                    string    `description:"'正式','试用','关闭'"`
+	ModifyTime                time.Time `description:"修改时间"`
+}
+
+//根据企业用户id和产品id获取所有正式的权限
+func GetCompanyProductReportPermissionList(companyId, productId int) (items []*CompanyReportPermissionAndName, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT a.*,b.permission_name,b.classify_name FROM company_report_permission a left join chart_permission b on a.chart_permission_id=b.chart_permission_id WHERE a.company_id = ? and a.product_id=? `
+	_, err = o.Raw(sql, companyId, productId).QueryRows(&items)
+	return
+}

+ 3 - 0
models/db_init.go

@@ -3,6 +3,7 @@ package models
 import (
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/rdlucklib/rdluck_tools/orm"
+	"hongze/hongze_mobile_admin/models/roadshow"
 	"hongze/hongze_mobile_admin/models/tables/admin"
 	"hongze/hongze_mobile_admin/models/tables/admin_record"
 	"hongze/hongze_mobile_admin/models/tables/approval_flow"
@@ -82,6 +83,8 @@ func init() {
 		new(wx_user.WxUser),
 		new(seal.Seal), //用印表
 		new(seal.SealOperationRecord),	// 用印操作记录表
+		new(roadshow.RsCalendar),
+		new(roadshow.RsCalendarResearcher),
 	)
 
 }

+ 258 - 0
models/roadshow/calendar.go

@@ -0,0 +1,258 @@
+package roadshow
+
+import (
+	"github.com/rdlucklib/rdluck_tools/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
+)
+
+type AddActivityReq struct {
+	ActivityType     string `description:"活动类型"`
+	RoadshowType     string `description:"路演形式"`
+	RoadshowPlatform string `description:"路演平台"`
+	CompanyId        int    `description:"客户id"`
+	CompanyName      string `description:"客户名称"`
+	Province         string `description:"省"`
+	ProvinceCode     string `description:"省编码"`
+	City             string `description:"市"`
+	CityCode         string `description:"市编码"`
+	Theme            string `description:"会议主题"`
+	CooperationName  string `description:"合作方名称"`
+	ActivityCategory string `description:"活动类别"`
+	ResearcherList   []*CalendarResearcher
+}
+
+type CalendarResearcher struct {
+	ResearcherId   int    `description:"研究员id"`
+	ResearcherName string `description:"研究员名称"`
+	StartDate      string `description:"开始日期"`
+	EndDate        string `description:"结束日期"`
+	StartTime      string `description:"开始时间"`
+	EndTime        string `description:"结束时间"`
+	StartWeek      string `description:"开始日期对应周"`
+	EndWeek        string `description:"结束日期对应周"`
+}
+
+type RsCalendar struct {
+	RsCalendarId     int    `orm:"column(rs_calendar_id);pk"`
+	SysUserId        int    `description:"创建人id"`
+	SysUserRealName  string `description:"创建人名称"`
+	ActivityType     string `description:"活动类型"`
+	RoadshowType     string `description:"路演形式"`
+	RoadshowPlatform string `description:"路演平台"`
+	CompanyId        int    `description:"客户id"`
+	CompanyName      string `description:"客户名称"`
+	Province         string `description:"省"`
+	ProvinceCode     string `description:"省编码"`
+	City             string `description:"市"`
+	CityCode         string `description:"市编码"`
+	Theme            string `description:"会议主题"`
+	CooperationName  string `description:"合作方名称"`
+	CreateTime       time.Time
+	ModifyTime       time.Time
+	ActivityCategory string `description:"活动类别"`
+}
+
+type RsCalendarResearcher struct {
+	RsCalendarResearcherId int    `orm:"column(rs_calendar_researcher_id);pk"`
+	RsCalendarId           int    `description:"日历活动id"`
+	ResearcherId           int    `description:"研究员id"`
+	ResearcherName         string `description:"研究员名称"`
+	StartDate              string `description:"开始日期"`
+	EndDate                string `description:"结束日期"`
+	StartTime              string `description:"开始时间"`
+	EndTime                string `description:"结束时间"`
+	StartWeek              string `description:"开始日期对应周"`
+	EndWeek                string `description:"结束日期对应周"`
+	Status                 int    `description:"状态:1:待接受,2:已接受,3:已拒绝,4:已删除,5:已撤回"`
+	RefuseReason           string `description:"拒绝理由"`
+	RefuseTime             string `description:"拒绝时间"`
+	ApproveTime            string `description:"审批时间"`
+	DeleteReason           string `description:"删除原因"`
+	DeleteTime             string `description:"删除时间"`
+	CreateTime             string
+	ModifyTime             string
+}
+
+func GetRsCalendarById(rsCalendarId int) (item *RsCalendar, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM rs_calendar WHERE rs_calendar_id=? `
+	err = o.Raw(sql, rsCalendarId).QueryRow(&item)
+	return
+}
+
+func GetRsCalendarResearcherById(rsCalendarResearcherId int) (item *RsCalendarResearcher, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM rs_calendar_researcher WHERE rs_calendar_researcher_id=? `
+	err = o.Raw(sql, rsCalendarResearcherId).QueryRow(&item)
+	return
+}
+
+type Researcher struct {
+	AdminId      int    `description:"研究员id"`
+	RealName     string `description:"研究员名称"`
+	GroupId      int    `description:"分组id"`
+	GroupName    string `description:"分组名称"`
+	RoleTypeCode string `description:"角色编码"`
+}
+
+type ResearcherGroup struct {
+	GroupId        int    `description:"分组id"`
+	GroupName      string `description:"分组名称"`
+	ResearcherList []*Researcher
+}
+
+type CalendarListView struct {
+	RsCalendarId           int    `orm:"column(rs_calendar_id);pk"`
+	SysUserId              int    `description:"创建人id"`
+	SysUserRealName        string `description:"创建人名称"`
+	ActivityType           string `description:"活动类型"`
+	RoadshowType           string `description:"路演形式"`
+	RoadshowPlatform       string `description:"路演平台"`
+	CompanyId              int    `description:"客户id"`
+	CompanyName            string `description:"客户名称"`
+	RsCalendarResearcherId int    `description:"活动研究员id"`
+	ResearcherId           int    `description:"研究员id"`
+	ResearcherName         string `description:"研究员名称"`
+	StartDate              string `description:"开始日期"`
+	EndDate                string `description:"结束日期"`
+	StartTime              string `description:"开始时间"`
+	EndTime                string `description:"结束时间"`
+	StartWeek              string `description:"开始日期对应周"`
+	EndWeek                string `description:"结束日期对应周"`
+	CreateTime             time.Time
+	ModifyTime             time.Time
+	Status                 int       `description:"状态:1:待接受,2:已接受,3:已拒绝,4:已删除,5:已撤回"`
+	RefuseReason           string    `description:"拒绝理由"`
+	RefuseTime             time.Time `description:"拒绝时间"`
+	DeleteReason           string    `description:"删除原因"`
+	Province               string    `description:"省"`
+	ProvinceCode           string    `description:"省编码"`
+	City                   string    `description:"市"`
+	CityCode               string    `description:"市编码"`
+	Theme                  string    `description:"会议主题"`
+	CooperationName        string    `description:"合作方名称"`
+	ActivityCategory       string    `description:"活动类别"`
+}
+
+type CalendarListResp struct {
+	Paging *paging.PagingItem
+	List   []*CalendarListView
+}
+
+func GetCalendarListCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM  rs_calendar AS a
+		INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
+		WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+func GetCalendarList(condition string, pars []interface{}, status int, pageLimit ...int) (list []*CalendarListView, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM  rs_calendar AS a
+		INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
+		`
+	if condition != "" {
+		sql += condition
+	}
+	if status==1 {
+		sql += ` ORDER BY a.create_time ASC LIMIT ?,? `
+	}else{
+		sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
+	}
+	_, err = o.Raw(sql, pars, pageLimit).QueryRows(&list)
+	return
+}
+
+type AcceptReq struct {
+	RsCalendarId           int `description:"日历活动id"`
+	RsCalendarResearcherId int `description:"活动研究员id"`
+}
+
+type DeleteReq struct {
+	RsCalendarId           int    `description:"日历活动id"`
+	RsCalendarResearcherId int    `description:"活动研究员id"`
+	DeleteReason           string `description:"删除原因"`
+}
+
+type RefuseReq struct {
+	RsCalendarId           int    `description:"日历活动id"`
+	RsCalendarResearcherId int    `description:"活动研究员id"`
+	RefuseReason           string `description:"拒绝原因"`
+}
+
+// 更新
+func UpdateCalendarResearcher(where, updateParams map[string]interface{}) error {
+	o := orm.NewOrm()
+	ptrStructOrTableName := "rs_calendar_researcher"
+	qs := o.QueryTable(ptrStructOrTableName)
+	for expr, exprV := range where {
+		qs = qs.Filter(expr, exprV)
+	}
+	_, err := qs.Update(updateParams)
+	return err
+}
+
+// 更新
+func UpdateCalendarResearcherFromSH(item *RsCalendarResearcher) error {
+	o := orm.NewOrm()
+	_, err := o.Update(item, "")
+	return err
+}
+
+type AddMattersReq struct {
+	StartDate     string `description:"开始日期"`
+	EndDate       string `description:"结束日期"`
+	StartTime     string `description:"开始时间"`
+	EndTime       string `description:"结束时间"`
+	StartWeek     string `description:"开始日期周"`
+	EndWeek       string `description:"结束日期周"`
+	MatterContent string `description:"事项内容"`
+}
+
+type RsMatters struct {
+	RsMattersId     int       `orm:"column(rs_matters_id);pk"`
+	SysUserId       int       `description:"添加事项人id"`
+	SysUserRealName string    `description:"创建人姓名"`
+	StartDate       string    `description:"开始日期"`
+	EndDate         string    `description:"结束日期"`
+	StartTime       string    `description:"开始时间"`
+	EndTime         string    `description:"结束时间"`
+	StartWeek       string    `description:"开始日期周"`
+	EndWeek         string    `description:"结束日期周"`
+	MatterContent   string    `description:"事项内容"`
+	CreateTime      time.Time `description:"创建时间"`
+	ModifyTime      time.Time `description:"修改时间"`
+}
+
+type UpdateMattersReq struct {
+	RsMattersId   int    `orm:"column(rs_matters_id);pk"`
+	StartDate     string `description:"开始日期"`
+	EndDate       string `description:"结束日期"`
+	StartTime     string `description:"开始时间"`
+	EndTime       string `description:"结束时间"`
+	StartWeek     string `description:"开始日期周"`
+	EndWeek       string `description:"结束日期周"`
+	MatterContent string `description:"事项内容"`
+}
+
+type CompanyDetailView struct {
+	CompanyId       int    `orm:"column(company_id);pk"`
+	CompanyName     string `description:"客户名称"`
+	Status          string `description:"客户状态"`
+	IndustryId      int    `description:"行业id"`
+	IndustryName    string `description:"行业名称"`
+	PermissionName  string `description:"开通品种"`
+	ReportReadTotal int    `description:"累计阅读次数"`
+}
+
+type CalendarDetailResp struct {
+	RsCalendarItem           *RsCalendar
+	RsCalendarResearcherItem *RsCalendarResearcher
+	CompanyDetail            *CompanyDetailView
+}

+ 207 - 0
models/user_view_history.go

@@ -0,0 +1,207 @@
+package models
+
+import (
+	"github.com/rdlucklib/rdluck_tools/orm"
+	"hongze/hongze_mobile_admin/utils"
+	"time"
+)
+
+type UserViewHistory struct {
+	ViewHistoryId        int       `orm:"column(id);pk"`
+	UserId               int       `description:"用户id"`
+	Mobile               string    `description:"手机号"`
+	Email                string    `description:"邮箱"`
+	RealName             string    `description:"用户实际姓名"`
+	CompanyName          string    `description:"公司名称"`
+	ViewTitle            string    `description:"访问标题"`
+	ViewPage             string    `description:"访问页面"`
+	ReportChapterModule  string    `description:"访问核心观点或者图文逻辑"`
+	CreatedTime          string    `description:"创建时间"`
+	LastUpdatedTime      time.Time `description:"访问历史类型,weekly_report 周报,pdf;默认值:weekly_report"`
+	ResearchReportId     int       `description:"研报id"`
+	ResearchReportTypeId int       `description:"报告章节id,为0时表示查看目录或者首页"`
+}
+
+//根据用户id字符串获取用户的浏览数
+type UserViewTotalSlice struct {
+	UserId      int       `description:"用户id"`
+	Total       int       `description:"总阅读数"`
+	CreatedTime time.Time `description:"用户浏览时间"`
+}
+
+func GetCountUserViewHistoryByUserIds(userIds string) (items []*UserViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT count(1) total,user_id,max(created_time) as created_time FROM user_view_history WHERE user_id in (` + userIds + `) group by user_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+	//return items2,err
+}
+
+//根据用户手机号字符串获取用户的浏览数
+type UserViewMobileTotalSlice struct {
+	Mobile      string    `description:"用户手机号"`
+	Total       int       `description:"总阅读数"`
+	CreatedTime time.Time `description:"用户浏览时间"`
+}
+
+func GetCountUserViewHistoryByMobiles(mobiles string) (items []*UserViewMobileTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT count(1) total,mobile,max(created_time) as created_time FROM user_view_history WHERE mobile in (` + mobiles + `) group by mobile`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+//根据用户id字符串获取用户的浏览数
+type UserViewEmailTotalSlice struct {
+	Email       string    `description:"用户邮箱"`
+	Total       int       `description:"总阅读数"`
+	CreatedTime time.Time `description:"用户浏览时间"`
+}
+
+func GetCountUserViewHistoryByEmails(emails string) (items []*UserViewEmailTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT count(1) total,email,max(created_time) as created_time FROM user_view_history WHERE email in (` + emails + `) group by email`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+	//return items2,err
+}
+
+func GetCountCygxArticleHistoryRecordByMobiles(mobiles string) (items []*UserViewMobileTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT count(1) total,mobile,max(create_time) as created_time FROM cygx_article_history_record_newpv WHERE mobile in (` + mobiles + `) AND company_id != 16 group by mobile`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+func GetCountCygxArticleHistoryRecordByEmails(emails string) (items []*UserViewEmailTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT count(1) total,email,max(created_time) as created_time FROM cygx_article_history_record_newpv WHERE email in (` + emails + `) AND company_id != 16 group by email`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// CompanyViewTotalSlice 获取客户的浏览次数
+type CompanyViewTotalSlice struct {
+	CompanyId int `description:"客户id"`
+	ViewTotal int `description:"用户浏览次数"`
+}
+
+// GetCountUserViewHistoryByCompanyIdsMobile 根据手机号获取客户的浏览次数
+func GetCountUserViewHistoryByCompanyIdsMobile(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	a.company_id ,count(1) view_total FROM 	wx_user a
+	JOIN user_view_history b ON a.mobile = b.mobile 
+WHERE 	a.company_id IN ( ` + companyIds + ` )  and b.mobile !="" GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetCountUserViewHistoryByCompanyIdsEmail 根据邮箱获取客户的浏览次数
+func GetCountUserViewHistoryByCompanyIdsEmail(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	a.company_id ,count(1) view_total
+FROM
+	wx_user a
+	JOIN user_view_history b ON a.email = b.email 
+WHERE a.company_id IN ( ` + companyIds + ` ) and b.email !="" and b.mobile=""  GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetCountAdvisoryArticleViewRecordByCompanyIdsMobile 根据手机号获取客户的浏览次数
+func GetCountAdvisoryArticleViewRecordByCompanyIdsMobile(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	a.company_id ,count(1) view_total
+FROM
+	wx_user a
+	JOIN advisory_user_chart_article_record b ON a.mobile = b.mobile 
+WHERE
+	a.company_id IN ( ` + companyIds + ` )  and b.mobile !="" GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetCountAdvisoryArticleViewRecordByCompanyIdsEmail 根据邮箱获取客户的浏览次数
+func GetCountAdvisoryArticleViewRecordByCompanyIdsEmail(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	a.company_id ,count(1) view_total
+FROM
+	wx_user a
+	JOIN advisory_user_chart_article_record b ON a.email = b.email 
+WHERE a.company_id IN ( ` + companyIds + ` ) and b.email !="" and b.mobile="" GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetCountCygxArticleViewRecordByCompanyIdsMobile 根据手机号获取客户的浏览次数
+func GetCountCygxArticleViewRecordByCompanyIdsMobile(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	//dataName := ""
+	//if utils.RunMode == "debug" {
+	//	dataName = "test_v2_hongze_rddp"
+	//} else {
+	//	dataName = "hongze_rddp"
+	//}
+	sql := `SELECT
+	a.company_id ,count(1) view_total
+FROM
+	wx_user a
+	JOIN cygx_article_history_record_newpv b ON a.mobile = b.mobile 
+WHERE
+	a.company_id IN ( ` + companyIds + ` )  and b.mobile !="" GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetCountCygxArticleViewRecordByCompanyIdsEmail 根据邮箱获取客户的浏览次数
+func GetCountCygxArticleViewRecordByCompanyIdsEmail(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	a.company_id ,count(1) view_total
+FROM
+	wx_user a
+	JOIN cygx_article_history_record_newpv b ON a.email = b.email 
+WHERE a.company_id IN ( ` + companyIds + ` ) and b.email !="" and b.mobile="" GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetCountReportViewRecordByCompanyIdsMobile 根据手机号获取客户的浏览次数
+func GetCountReportViewRecordByCompanyIdsMobile(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	dataName := ""
+	if utils.RunMode == "debug" {
+		dataName = "test_v2_hongze_rddp"
+	} else {
+		dataName = "hongze_rddp"
+	}
+	sql := `SELECT
+	a.company_id ,count(1) view_total
+FROM
+	wx_user a
+	JOIN ` + dataName + `.report_view_record b ON a.mobile = b.mobile 
+WHERE
+	a.company_id IN ( ` + companyIds + ` )  and b.mobile !="" GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetCountReportViewRecordByCompanyIdsEmail 根据邮箱获取客户的浏览次数
+func GetCountReportViewRecordByCompanyIdsEmail(companyIds string) (items []*CompanyViewTotalSlice, err error) {
+	o := orm.NewOrm()
+	dataName := ""
+	if utils.RunMode == "debug" {
+		dataName = "test_v2_hongze_rddp"
+	} else {
+		dataName = "hongze_rddp"
+	}
+	sql := `SELECT	a.company_id ,count(1) view_total FROM wx_user a
+	JOIN ` + dataName + `.report_view_record b ON a.email = b.email 
+WHERE a.company_id IN ( ` + companyIds + ` ) and b.email !="" and b.mobile="" GROUP BY company_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 36 - 0
routers/commentsRouter_controllers.go

@@ -7,6 +7,42 @@ import (
 
 func init() {
 
+    beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"] = append(beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"],
+        beego.ControllerComments{
+            Method: "Accept",
+            Router: "/accept",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"] = append(beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"],
+        beego.ControllerComments{
+            Method: "CalendarDetail",
+            Router: "/calendar/detail",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"] = append(beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"],
+        beego.ControllerComments{
+            Method: "CalendarList",
+            Router: "/calendar/list",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"] = append(beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers/roadshow:CalendarController"],
+        beego.ControllerComments{
+            Method: "Refuse",
+            Router: "/refuse",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers:AdminCommon"] = append(beego.GlobalControllerRouter["hongze/hongze_mobile_admin/controllers:AdminCommon"],
         beego.ControllerComments{
             Method: "Login",

+ 6 - 0
routers/router.go

@@ -11,6 +11,7 @@ package routers
 import (
 	"github.com/beego/beego/v2/server/web/filter/cors"
 	"hongze/hongze_mobile_admin/controllers"
+	"hongze/hongze_mobile_admin/controllers/roadshow"
 
 	"github.com/beego/beego/v2/server/web"
 )
@@ -75,6 +76,11 @@ func init() {
 				&controllers.ResourceCommon{},
 			),
 		),
+		web.NSNamespace("/roadshow",
+			web.NSInclude(
+				&roadshow.CalendarController{},
+			),
+		),
 	)
 	web.AddNamespace(ns)
 }

+ 60 - 0
services/company.go

@@ -1,6 +1,8 @@
 package services
 
 import (
+	"fmt"
+	"hongze/hongze_mobile_admin/models"
 	"hongze/hongze_mobile_admin/models/tables/company_operation_record"
 	"hongze/hongze_mobile_admin/utils"
 	"time"
@@ -72,3 +74,61 @@ func AddCompanyOperationRecord(companyId, sellerId, sysUserId, productId, approv
 	_, err = company_operation_record.AddCompanyOperationRecord(record)
 	return
 }
+
+func GetFiccCountUserViewHistoryByCompanyIds(companyIdStr string) (companyViewTotal map[int]int, err error) {
+	//user_view_record mobile
+	companyViewTotal = make(map[int]int)
+	userViewList, err := models.GetCountUserViewHistoryByCompanyIdsMobile(companyIdStr)
+	if err != nil {
+		return
+	}
+	for _, userView := range userViewList {
+		companyViewTotal[userView.CompanyId] = userView.ViewTotal
+	}
+	userViewList, err = models.GetCountUserViewHistoryByCompanyIdsEmail(companyIdStr)
+	if err != nil {
+		return
+	}
+	checkCount(companyViewTotal, userViewList)
+
+	//AdvisoryArticleViewRecord mobile
+	userViewList, err = models.GetCountAdvisoryArticleViewRecordByCompanyIdsMobile(companyIdStr)
+	if err != nil {
+		return
+	}
+	checkCount(companyViewTotal, userViewList)
+
+	//AdvisoryArticleViewRecord email
+	userViewList, err = models.GetCountAdvisoryArticleViewRecordByCompanyIdsEmail(companyIdStr)
+	if err != nil {
+		return
+	}
+	checkCount(companyViewTotal, userViewList)
+
+	//ReportViewRecord mobile
+	userViewList, err = models.GetCountReportViewRecordByCompanyIdsMobile(companyIdStr)
+	if err != nil {
+		return
+	}
+	checkCount(companyViewTotal, userViewList)
+
+	//ReportViewRecord email
+	userViewList, err = models.GetCountReportViewRecordByCompanyIdsEmail(companyIdStr)
+	if err != nil {
+		return
+	}
+	checkCount(companyViewTotal, userViewList)
+	fmt.Println("companyViewTotal5:", companyViewTotal)
+	return
+}
+
+func checkCount(companyViewTotal map[int]int, userViewList []*models.CompanyViewTotalSlice) {
+	for _, userView := range userViewList {
+		if viewTotal, ok := companyViewTotal[userView.CompanyId]; ok {
+			companyViewTotal[userView.CompanyId] = viewTotal + userView.ViewTotal
+		} else { //如果没有数据,那么直接赋值
+			companyViewTotal[userView.CompanyId] = userView.ViewTotal
+		}
+	}
+	return
+}

+ 62 - 0
services/wechat_send_msg.go

@@ -206,3 +206,65 @@ func SendCompanyApplyWxTemplateMsg(mobile, redirectUrl, wxAppPath string, wxMsgM
 	utils.FileLog.Info("send end")
 	return
 }
+
+
+// 路演->销售收到处理结果
+func SendWxMsgWithRoadshowDetailResult(first, keyword1, keyword2, remark,mobile, redirectUrl, wxAppPath string) (err error) {
+	var msg string
+	defer func() {
+		if err != nil {
+			go utils.SendEmail("发送模版消息失败"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers)
+			utils.FileLog.Info("发送模版消息失败,Err:%s,%s", err.Error(), msg)
+		}
+		if msg != "" {
+			utils.FileLog.Info("发送模版消息失败,msg:%s", msg)
+		}
+	}()
+	utils.FileLog.Info("%s", "services SendMsg")
+
+	accessToken, err := WxGetAccessToken()
+	if err != nil {
+		msg = "GetWxAccessToken Err:" + err.Error()
+		return
+	}
+	if accessToken == "" {
+		msg = "accessToken is empty"
+		return
+	}
+	utils.FileLog.Info("mobile:%s", mobile)
+
+	//获取openid列表
+	openIdStr := WxUsersGet()
+	openIdList, err := wx_user.GetOpenIdListByMobile(mobile, openIdStr)
+	if err != nil {
+		msg = "get openIdList err:" + err.Error()
+		return
+	}
+	utils.FileLog.Info("openIdListCount:%s", len(openIdList))
+	//fmt.Println("openIdListCount:", len(openIdList))
+	if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" {
+		utils.FileLog.Info("start send")
+		sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken
+		fmt.Println("send start")
+		utils.FileLog.Info("send start")
+		sendMap := make(map[string]interface{})
+		sendData := make(map[string]interface{})
+
+
+		sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"}
+		sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"}
+		sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"}
+		sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"}
+
+		sendMap["template_id"] = utils.WxMsgTemplateIdWithRoadshowDetailResult
+		sendMap["url"] = redirectUrl
+		sendMap["data"] = sendData
+		//小程序信息
+		if wxAppPath != "" {
+			sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId2, "pagepath": wxAppPath}
+		}
+		sendTemplateMsg(sendUrl, sendMap, openIdList)
+	}
+	utils.FileLog.Info("send end")
+	return
+}

+ 13 - 0
utils/config.go

@@ -29,6 +29,10 @@ var (
 	WxAppId2     string
 	WxAppSecret2 string
 	WxPlatform2  int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1
+
+	WxMsgTemplateIdWithRoadshowPending      string //路演->研究员收到待处理的申请
+	WxMsgTemplateIdWithRoadshowDetailResult string //路演->销售收到处理结果
+	WxMsgTemplateIdWithRoadshowDeleteNotice string //路演->研究员收到活动删除通知
 )
 
 var (
@@ -93,6 +97,10 @@ func init() {
 		STATIC_DIR = "/home/static/imgs/"
 		Endpoint = "oss-cn-shanghai-internal.aliyuncs.com"
 
+		//路演
+		WxMsgTemplateIdWithRoadshowPending = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"      //路演->研究员收到待处理的申请
+		WxMsgTemplateIdWithRoadshowDetailResult = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->销售收到处理结果
+		WxMsgTemplateIdWithRoadshowDeleteNotice = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->研究员收到活动删除通知
 	} else {
 		WxAppId = "wx9b5d7291e581233a"
 		WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
@@ -106,6 +114,11 @@ func init() {
 		//oss配置
 		STATIC_DIR = "static/imgs/"
 		Endpoint = "oss-cn-shanghai.aliyuncs.com"
+
+		//路演
+		WxMsgTemplateIdWithRoadshowPending = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"      //路演->研究员收到待处理的申请
+		WxMsgTemplateIdWithRoadshowDetailResult = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->销售收到处理结果
+		WxMsgTemplateIdWithRoadshowDeleteNotice = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->研究员收到活动删除通知
 	}
 
 	tmpLibreOfficePath, err := web.AppConfig.String("libreOfficePath")

+ 1 - 0
utils/constants.go

@@ -70,6 +70,7 @@ const (
 	ROLE_TYPE_CODE_FICC_RESEARCHR  = "ficc_researcher" //ficc研究员
 	ROLE_TYPE_CODE_RAI_RESEARCHR   = "rai_researcher"  //权益研究员
 	ROLE_TYPE_CODE_COMPLIANCE      = "compliance"      //合规角色
+	ROLE_TYPE_CODE_RESEARCHR       = "researcher"      //ficc研究员(最早定义的)
 
 	ROLE_TYPE_SELLERS = "'ficc_admin','ficc_seller','rai_admin','rai_seller','ficc_group','rai_group','ficc_department','rai_department','compliance'"
 )