|
@@ -8,6 +8,7 @@ import (
|
|
"hongze/hongze_mobile_admin/models"
|
|
"hongze/hongze_mobile_admin/models"
|
|
"hongze/hongze_mobile_admin/models/roadshow"
|
|
"hongze/hongze_mobile_admin/models/roadshow"
|
|
"hongze/hongze_mobile_admin/models/tables/admin"
|
|
"hongze/hongze_mobile_admin/models/tables/admin"
|
|
|
|
+ "hongze/hongze_mobile_admin/models/tables/english_company"
|
|
"hongze/hongze_mobile_admin/services"
|
|
"hongze/hongze_mobile_admin/services"
|
|
"hongze/hongze_mobile_admin/services/rs"
|
|
"hongze/hongze_mobile_admin/services/rs"
|
|
"hongze/hongze_mobile_admin/utils"
|
|
"hongze/hongze_mobile_admin/utils"
|
|
@@ -16,7 +17,7 @@ import (
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
-//日历
|
|
|
|
|
|
+// 日历
|
|
type CalendarController struct {
|
|
type CalendarController struct {
|
|
controllers.BaseAuth
|
|
controllers.BaseAuth
|
|
}
|
|
}
|
|
@@ -179,6 +180,7 @@ func (this *CalendarController) Add() {
|
|
rsCalendar.ModifyTime = time.Now()
|
|
rsCalendar.ModifyTime = time.Now()
|
|
rsCalendar.ActivityCategory = req.ActivityCategory
|
|
rsCalendar.ActivityCategory = req.ActivityCategory
|
|
rsCalendar.Source = 0
|
|
rsCalendar.Source = 0
|
|
|
|
+ rsCalendar.EnglishCompany = req.EnglishCompany
|
|
rsCalendar.Title = getTitle(req.ActivityType, req.RoadshowType, req.ActivityCategory, req.RoadshowPlatform, req.Province, req.City)
|
|
rsCalendar.Title = getTitle(req.ActivityType, req.RoadshowType, req.ActivityCategory, req.RoadshowPlatform, req.Province, req.City)
|
|
rsCalendarId, err := roadshow.AddRsCalendar(rsCalendar)
|
|
rsCalendarId, err := roadshow.AddRsCalendar(rsCalendar)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -335,6 +337,38 @@ func (this *CalendarController) CalendarList() {
|
|
this.FailWithMessage("获取信息失败!", "获取数据失败,GetCalendarList,Err:"+err.Error())
|
|
this.FailWithMessage("获取信息失败!", "获取数据失败,GetCalendarList,Err:"+err.Error())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 英文客户的国家以及点击量
|
|
|
|
+ englishIds := make([]int, 0)
|
|
|
|
+ for i := range dataList {
|
|
|
|
+ if dataList[i].EnglishCompany == 1 {
|
|
|
|
+ englishIds = append(englishIds, dataList[i].CompanyId)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ englishMap := make(map[int]*english_company.EnglishCompany)
|
|
|
|
+ if len(englishIds) > 0 {
|
|
|
|
+ englishCond := ` AND company_id IN (` + utils.GetOrmInReplace(len(englishIds)) + `)`
|
|
|
|
+ englishPars := make([]interface{}, 0)
|
|
|
|
+ englishPars = append(englishPars, englishIds)
|
|
|
|
+ englishList, e := english_company.GetEnglishCompanyList(englishCond, englishPars, "")
|
|
|
|
+ if e != nil {
|
|
|
|
+ this.FailWithMessage("获取英文客户失败!", "获取英文客户失败, Err:"+err.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for i := range englishList {
|
|
|
|
+ englishMap[englishList[i].CompanyId] = englishList[i]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for i := range dataList {
|
|
|
|
+ if dataList[i].EnglishCompany == 1 {
|
|
|
|
+ en := englishMap[dataList[i].CompanyId]
|
|
|
|
+ if en != nil {
|
|
|
|
+ dataList[i].EnglishCountry = en.Country
|
|
|
|
+ dataList[i].EnglishViewTotal = en.ViewTotal
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
resp.Paging = page
|
|
resp.Paging = page
|
|
resp.List = dataList
|
|
resp.List = dataList
|
|
this.OkDetailed(resp, "获取成功")
|
|
this.OkDetailed(resp, "获取成功")
|
|
@@ -595,31 +629,49 @@ func (this *CalendarController) CalendarDetail() {
|
|
}
|
|
}
|
|
|
|
|
|
companyDetailView := new(roadshow.CompanyDetailView)
|
|
companyDetailView := new(roadshow.CompanyDetailView)
|
|
|
|
+
|
|
if calendarItem != nil && calendarItem.CompanyId > 0 {
|
|
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)
|
|
|
|
- }
|
|
|
|
|
|
+ // 中文客户
|
|
|
|
+ if calendarItem.EnglishCompany == 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报告-累计阅读次数
|
|
|
|
|
|
+ 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报告-累计阅读次数
|
|
|
|
+ }
|
|
|
|
+ // 英文客户
|
|
|
|
+ if calendarItem.EnglishCompany == 1 {
|
|
|
|
+ enItem, e := english_company.GetEnglishCompanyById(calendarItem.CompanyId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ this.FailWithMessage("搜索客户失败!", "获取英文客户详情失败, Err: "+e.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ companyDetailView.CompanyId = enItem.CompanyId
|
|
|
|
+ companyDetailView.CompanyName = enItem.CompanyName
|
|
|
|
+ companyDetailView.Status = "正常"
|
|
|
|
+ companyDetailView.EnglishCompany = 1
|
|
|
|
+ companyDetailView.EnglishCountry = enItem.Country
|
|
|
|
+ companyDetailView.EnglishViewTotal = enItem.ViewTotal
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
resp := new(roadshow.CalendarDetailResp)
|
|
resp := new(roadshow.CalendarDetailResp)
|
|
@@ -1270,6 +1322,8 @@ func (this *CalendarController) Edit() {
|
|
calendarUpdateParams["city"] = req.City
|
|
calendarUpdateParams["city"] = req.City
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ calendarUpdateParams["english_company"] = req.EnglishCompany
|
|
|
|
+
|
|
calendarUpdateParams["modify_time"] = time.Now()
|
|
calendarUpdateParams["modify_time"] = time.Now()
|
|
calendarUpdateParams["title"] = getTitle(req.ActivityType, req.RoadshowType, req.ActivityCategory, req.RoadshowPlatform, req.Province, req.City)
|
|
calendarUpdateParams["title"] = getTitle(req.ActivityType, req.RoadshowType, req.ActivityCategory, req.RoadshowPlatform, req.Province, req.City)
|
|
err = roadshow.UpdateRsCalendar(calendarWhereParams, calendarUpdateParams)
|
|
err = roadshow.UpdateRsCalendar(calendarWhereParams, calendarUpdateParams)
|