|
@@ -4,6 +4,7 @@ import (
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
"eta/eta_api/models"
|
|
|
+ "eta/eta_api/models/data_manage/excel"
|
|
|
"eta/eta_api/models/ppt_english"
|
|
|
"eta/eta_api/models/system"
|
|
|
"eta/eta_api/services/alarm_msg"
|
|
@@ -170,6 +171,9 @@ func SavePPTReport(pptId, classifyId int, title string, adminInfo *system.Admin)
|
|
|
reportId = int(newReportId)
|
|
|
reportCode = newCode
|
|
|
|
|
|
+ // ppt转报告后,将ppt的表格关系做处理
|
|
|
+ handlerPptToReportTableReferenced(pptId, int(newReportId))
|
|
|
+
|
|
|
// 更新报告中的ppt图片
|
|
|
go saveReportPptImg(pptId, reportId, item.PptxUrl)
|
|
|
|
|
@@ -439,6 +443,10 @@ func SaveEnglishPPTReport(pptId, classifyIdFirst, classifyIdSecond int, title, a
|
|
|
}
|
|
|
reportId = int(newReportId)
|
|
|
reportCode = newCode
|
|
|
+
|
|
|
+ // 英文ppt转英文报告后,将英文报告的表格关系做处理
|
|
|
+ handlerPptToEnReportTableReferenced(pptId, reportId)
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -501,3 +509,134 @@ func UpdatePptEditing(pptId, status, userId int, userName string, isEn bool) (re
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// handlerPptToReportTableReferenced
|
|
|
+// @Description: ppt转报告后,需要同时继承原来ppt中表格的拖动数据逻辑
|
|
|
+// @author: Roc
|
|
|
+// @datetime 2025-01-09 16:51:11
|
|
|
+// @param pptId int
|
|
|
+// @param reportId int
|
|
|
+func handlerPptToReportTableReferenced(pptId, reportId int) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ utils.FileLog.Error("ppt转报告后,报告与动态表格关联处理失败,PPT的ID:%d,新报告ID:%d,Err:%s", pptId, reportId, err.Error())
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ reportInfo, err := models.GetReportByReportId(reportId)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ addList, err := excel.CopyReferencedExcelConfigByReferencedIdAndFromScene(pptId, utils.TableReferencedByPPT, reportInfo.Id, utils.TableReferencedByReport, reportInfo.AdminId, reportInfo.AdminRealName)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(addList) > 0 {
|
|
|
+ // 修改内容
|
|
|
+ reportInfo.Content = HandleReportContentTable(reportInfo.Id, reportInfo.Content)
|
|
|
+ reportInfo.ContentStruct = HandleReportContentStructTable(reportInfo.Id, reportInfo.ContentStruct)
|
|
|
+ err = reportInfo.Update([]string{"Content", "ContentStruct"})
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if reportInfo.HasChapter == 1 {
|
|
|
+ chapterList, tmpErr := models.GetChapterListByReportId(reportInfo.Id)
|
|
|
+ if tmpErr != nil {
|
|
|
+ err = tmpErr
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range chapterList {
|
|
|
+ v.Content = HandleReportContentTable(reportInfo.Id, v.Content)
|
|
|
+ v.ContentStruct = HandleReportContentStructTable(reportInfo.Id, v.ContentStruct)
|
|
|
+ err = v.Update([]string{"Content", "ContentStruct"})
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// HandlerPptToEnPptTableReferenced
|
|
|
+// @Description: ppt转英文ppt后,需要同时继承原来ppt中表格的拖动数据逻辑
|
|
|
+// @author: Roc
|
|
|
+// @datetime 2025-01-09 16:51:03
|
|
|
+// @param pptId int
|
|
|
+// @param enPptId int
|
|
|
+// @param sysUserId int
|
|
|
+// @param sysUserName string
|
|
|
+func HandlerPptToEnPptTableReferenced(pptId, enPptId, sysUserId int, sysUserName string) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ utils.FileLog.Error("ppt转英文PPT后,英文PPT与动态表格关联处理失败,PPT的ID:%d,英文ppt的ID:%d,Err:%s", pptId, enPptId, err.Error())
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ _, err = excel.CopyReferencedExcelConfigByReferencedIdAndFromScene(pptId, utils.TableReferencedByPPT, enPptId, utils.TableReferencedByEnPPT, sysUserId, sysUserName)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// HandlerMergePptTableReferenced
|
|
|
+// @Description: 多ppt合并生成新的ppt,需要同时继承原来所有ppt中表格的拖动数据逻辑
|
|
|
+// @author: Roc
|
|
|
+// @datetime 2025-01-09 16:51:03
|
|
|
+// @param pptId int
|
|
|
+// @param enPptId int
|
|
|
+// @param sysUserId int
|
|
|
+// @param sysUserName string
|
|
|
+func HandlerMergePptTableReferenced(oldPptIdList []int, pptId, sysUserId int, sysUserName string) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ utils.FileLog.Error("ppt转英文PPT后,英文PPT与动态表格关联处理失败,待合并的PPT的ID:%v,英文ppt的ID:%d,Err:%s", oldPptIdList, pptId, err.Error())
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ _, err = excel.CopyReferencedExcelConfigByReferencedIdListAndFromScene(oldPptIdList, utils.TableReferencedByPPT, pptId, utils.TableReferencedByPPT, sysUserId, sysUserName)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// handlerPptToEnReportTableReferenced
|
|
|
+// @Description: 英文ppt转报告后,需要同时继承原来英文ppt中表格的拖动数据逻辑
|
|
|
+// @author: Roc
|
|
|
+// @datetime 2025-01-09 17:04:49
|
|
|
+// @param enPptId int
|
|
|
+// @param enReportId int
|
|
|
+func handlerPptToEnReportTableReferenced(enPptId, enReportId int) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ utils.FileLog.Error("ppt转英文报告后,英文报告与动态表格关联处理失败,PPT的ID:%d,英文报告ID:%d,Err:%s", enPptId, enReportId, err.Error())
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ reportInfo, err := models.GetEnglishReportItemById(enReportId)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ addList, err := excel.CopyReferencedExcelConfigByReferencedIdAndFromScene(enPptId, utils.TableReferencedByEnPPT, enReportId, utils.TableReferencedByEnReport, reportInfo.AdminId, reportInfo.AdminRealName)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(addList) > 0 {
|
|
|
+ // 修改内容
|
|
|
+ reportInfo.Content = HandleReportContentTable(reportInfo.Id, reportInfo.Content)
|
|
|
+ err = reportInfo.Update([]string{"Content"})
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|