123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- package roadshow
- import (
- "time"
- "github.com/beego/beego/v2/client/orm"
- )
- type RsReportRecord struct {
- RsReportRecordId int `orm:"column(rs_report_record_id);pk"`
- CompanyId int `description:"客户id"`
- CompanyName string `description:"客户名称"`
- CreditCode string `description:"社会统一信用码"`
- CompanyStatus string `description:"客户状态:'试用','永续','冻结','流失','正式','潜在'"`
- ResearcherId int `description:"研究员id"`
- ResearcherName string `description:"研究员名称"`
- ResearcherGroupId int `description:"研究员分组id"`
- ResearcherGroupName string `description:"研究员分组名称"`
- SellerId int `description:"所属销售id"`
- SellerName string `description:"所属销售名称"`
- SellerGroupId int `description:"销售分组id"`
- SellerGroupName string `description:"销售分组名称"`
- RsCalendarId int `description:"路演活动id"`
- RsCalendarResearcherId int `description:"路演研究员id"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期对应周"`
- EndWeek string `description:"结束日期对应周"`
- CreateTime time.Time `description:"记录创建时间"`
- RsCalendarResearcherStatus int `description:"路演活动状态"`
- ModifyTime time.Time `description:"记录修改时间"`
- ActivityType string `description:"活动类型"`
- RoadshowType string `description:"路演形式"`
- }
- func AddRsReportRecord(item *RsReportRecord) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type RsCalendarResearcherView struct {
- RsCalendarId int `description:"活动"`
- 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:"合作方名称"`
- Title string `description:"展示在日历的标题"`
- Source int8 `description:"来源,0:自系统,1:上海方的"`
- CreateTime time.Time
- ModifyTime time.Time
- ActivityCategory 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:"结束日期对应周"`
- Status int `description:"状态:1:待接受,2:已接受,3:已拒绝,4:已删除,5:已撤回,6:已结束"`
- RefuseReason string `description:"拒绝理由"`
- RefuseTime time.Time `description:"拒绝时间"`
- DeleteReason string `description:"删除理由"`
- DeleteTime time.Time `description:"删除时间"`
- ApproveTime time.Time `description:"接受时间"`
- IsSynced int `description:"是否与上海同步 0:未同步 1:已同步"`
- ResearcherSort int `description:"研究员新增排序"`
- }
- func GetRsCalendarDetail(endDate string) (list []*RsCalendarResearcherView, err error) {
- sql := ` SELECT * FROM rs_calendar AS a
- INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
- WHERE a.source=0 AND b.end_date>=? `
- o := orm.NewOrm()
- _, err = o.Raw(sql, endDate).QueryRows(&list)
- return
- }
- type CompanySearchView struct {
- CompanyId int `orm:"column(company_id);pk"`
- CompanyName string `description:"客户名称"`
- CreditCode string `description:"社会统一信用码"`
- CompanyCode string `description:"客户编码"`
- Status string `description:"客户状态"`
- }
- func RsCompanyList() (list []*CompanySearchView, err error) {
- o := orm.NewOrm()
- sql := ` SELECT b.company_id,b.company_name,a.credit_code,b.status FROM company AS a
- INNER JOIN company_product AS b ON a.company_id=b.company_id
- WHERE b.status IN('正式','试用') AND b.product_id=1 `
- sql += ` GROUP BY b.company_id `
- _, err = o.Raw(sql).QueryRows(&list)
- return
- }
- func GetExistRsReportRecord(endDate string) (list []*RsReportRecord, err error) {
- sql := ` SELECT * FROM rs_report_record
- WHERE end_date>=? `
- o := orm.NewOrm()
- _, err = o.Raw(sql, endDate).QueryRows(&list)
- return
- }
- // 更新活动信息
- func UpdateRsReportRecord(where, updateParams map[string]interface{}) error {
- o := orm.NewOrm()
- ptrStructOrTableName := "rs_report_record"
- qs := o.QueryTable(ptrStructOrTableName)
- for expr, exprV := range where {
- qs = qs.Filter(expr, exprV)
- }
- _, err := qs.Update(updateParams)
- return err
- }
|