|
@@ -0,0 +1,253 @@
|
|
|
+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:"结束日期对应周"`
|
|
|
+ CreateTime time.Time
|
|
|
+ ModifyTime time.Time
|
|
|
+ Status int `description:"状态:1:待接受,2:已接受,3:已拒绝,4:已删除,5:已撤回"`
|
|
|
+ RefuseReason string `description:"拒绝理由"`
|
|
|
+ RefuseTime time.Time `description:"拒绝时间"`
|
|
|
+}
|
|
|
+
|
|
|
+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{}, 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
|
|
|
+ }
|
|
|
+ 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
|
|
|
+}
|