|
@@ -4,6 +4,7 @@ import (
|
|
|
"errors"
|
|
|
"gorm.io/gorm"
|
|
|
"hongze/hongze_yb/global"
|
|
|
+ "hongze/hongze_yb/models/tables/chart_permission"
|
|
|
"hongze/hongze_yb/models/tables/research_report"
|
|
|
"hongze/hongze_yb/models/tables/teleconference"
|
|
|
"hongze/hongze_yb/models/tables/teleconference_video"
|
|
@@ -13,11 +14,13 @@ import (
|
|
|
"hongze/hongze_yb/models/tables/yb_activity_remind"
|
|
|
"hongze/hongze_yb/models/tables/yb_activity_type"
|
|
|
"hongze/hongze_yb/models/tables/yb_activity_voice"
|
|
|
+ "hongze/hongze_yb/models/tables/yb_speaker"
|
|
|
"hongze/hongze_yb/services/company"
|
|
|
"hongze/hongze_yb/services/user"
|
|
|
"hongze/hongze_yb/utils"
|
|
|
"log"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -208,10 +211,11 @@ func SyncTeleconferenceOldData() (countTotal, countSuccess int, err error) {
|
|
|
countTotal = len(teleconferenceList)
|
|
|
|
|
|
// 取出电话会IDs和报告Ids
|
|
|
- var teleconferenceIds, reportIds []int
|
|
|
+ var teleconferenceIds, reportIds, chartPermissionIds []int
|
|
|
for i := 0; i < len(teleconferenceList); i++ {
|
|
|
teleconferenceIds = append(teleconferenceIds, int(teleconferenceList[i].TeleconferenceID))
|
|
|
reportIds = append(reportIds, int(teleconferenceList[i].ReferResearchReportID))
|
|
|
+ chartPermissionIds = append(chartPermissionIds, teleconferenceList[i].ReportPermissionID)
|
|
|
}
|
|
|
|
|
|
// 报告名称map
|
|
@@ -238,12 +242,32 @@ func SyncTeleconferenceOldData() (countTotal, countSuccess int, err error) {
|
|
|
typeIdNameMap[activityType.ActivityTypeID] = activityType.ActivityTypeName
|
|
|
}
|
|
|
|
|
|
+ // 主讲人map
|
|
|
+ speakerList, err := yb_speaker.GetSpeakerList()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var speakerNamePicMap = make(map[string]string, 0)
|
|
|
+ for i := 0; i < len(speakerList); i++ {
|
|
|
+ speakerNamePicMap[speakerList[i].SpeakerName] = speakerList[i].SpeakerHeadPic
|
|
|
+ }
|
|
|
+
|
|
|
// 音频列表
|
|
|
voicesList, err := teleconference_video.GetListByTeleconferenceIds(teleconferenceIds)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 图片权限map
|
|
|
+ chartPermissionList, err := chart_permission.GetListByIds(chartPermissionIds)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var chartPermissionIdNameMap = make(map[int]string, 0)
|
|
|
+ for i := 0; i < len(chartPermissionList); i++ {
|
|
|
+ chartPermissionIdNameMap[int(chartPermissionList[i].ChartPermissionID)] = chartPermissionList[i].PermissionName
|
|
|
+ }
|
|
|
+
|
|
|
// 开启事务
|
|
|
tx := global.DEFAULT_MYSQL.Begin()
|
|
|
defer func() {
|
|
@@ -256,6 +280,7 @@ func SyncTeleconferenceOldData() (countTotal, countSuccess int, err error) {
|
|
|
|
|
|
// 遍历数据
|
|
|
for _, item := range teleconferenceList {
|
|
|
+
|
|
|
// 匹配报告名称和link
|
|
|
reportId := int(item.ReferResearchReportID)
|
|
|
linkUrl := `https://details.hzinsights.com/ficcReportDetail?research_report_id=`
|
|
@@ -276,7 +301,22 @@ func SyncTeleconferenceOldData() (countTotal, countSuccess int, err error) {
|
|
|
firstActivityTypeName = typeIdNameMap[firstActivityTypeId]
|
|
|
}
|
|
|
|
|
|
- // TODO:匹配主讲人头像-规则暂定
|
|
|
+ // 匹配主讲人头像
|
|
|
+ speakerName := item.Speaker
|
|
|
+ if speakerName == "" {
|
|
|
+ continue
|
|
|
+ } else if speakerName == "全体FICC研究员" || speakerName == "弘则FICC研究员" {
|
|
|
+ speakerName = "FICC研究员"
|
|
|
+ }
|
|
|
+ speakerPic := "https://hzstatic.hzinsights.com/static/images/202112/20211210/wn6c3oYKTfT4NbTZgRGflRuIBZaa.png"
|
|
|
+ for i := 0; i < len(speakerList); i++ {
|
|
|
+ if strings.Contains(speakerName, speakerList[i].SpeakerName) {
|
|
|
+ speakerName = speakerList[i].SpeakerName // 存在多个人的情况,则以新表数据为准
|
|
|
+ speakerPic = speakerNamePicMap[speakerList[i].SpeakerName]
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
backgroundPic := ""
|
|
|
if firstActivityTypeId == 1 {
|
|
|
// 电话会议
|
|
@@ -295,8 +335,8 @@ func SyncTeleconferenceOldData() (countTotal, countSuccess int, err error) {
|
|
|
ActivityName: item.TeleconferenceTitle,
|
|
|
StartTime: item.StartTime,
|
|
|
EndTime: item.EndTime,
|
|
|
- Speaker: item.Speaker,
|
|
|
- SpeakerHeadPic: "",
|
|
|
+ Speaker: speakerName,
|
|
|
+ SpeakerHeadPic: speakerPic,
|
|
|
SpeakerBackgroundPic: backgroundPic,
|
|
|
SingaporeTel: item.SingaporeTelephone,
|
|
|
ParticipationCode: item.Password,
|
|
@@ -343,7 +383,7 @@ func SyncTeleconferenceOldData() (countTotal, countSuccess int, err error) {
|
|
|
activityPermission := &yb_activity_permission.YbActivityPermission{
|
|
|
ActivityID: uint32(activityId),
|
|
|
PermissionID: uint32(item.ReportPermissionID),
|
|
|
- PermissionName: "",
|
|
|
+ PermissionName: chartPermissionIdNameMap[item.ReportPermissionID],
|
|
|
CreateTime: nowTime,
|
|
|
}
|
|
|
activityPermissionCreate := tx.Debug().Create(activityPermission)
|