|
@@ -11,6 +11,7 @@ import (
|
|
|
"eta/eta_api/services/ppt2img"
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
+ "html"
|
|
|
"sort"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -40,6 +41,7 @@ type PPTContentElements struct {
|
|
|
SheetId string `json:"sheetId"`
|
|
|
SheetHeight string `json:"sheetHeight"`
|
|
|
Src string `json:"src"`
|
|
|
+ Uid string `json:"uid"`
|
|
|
}
|
|
|
|
|
|
// SavePPTReport 保存PPT报告
|
|
@@ -162,17 +164,17 @@ func SavePPTReport(pptId, classifyId int, title string, adminInfo *system.Admin)
|
|
|
reportReq.IsPublicPublish = 1
|
|
|
}
|
|
|
|
|
|
- newReportId, newCode, _, e := CreateNewReport(*reportReq, adminInfo)
|
|
|
+ newReportInfo, _, e := CreateNewReport(*reportReq, adminInfo)
|
|
|
if e != nil {
|
|
|
errMsg = "转换失败"
|
|
|
err = errors.New("新增报告失败, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- reportId = int(newReportId)
|
|
|
- reportCode = newCode
|
|
|
+ reportId = newReportInfo.Id
|
|
|
+ reportCode = newReportInfo.ReportCode
|
|
|
|
|
|
// ppt转报告后,将ppt的表格关系做处理
|
|
|
- handlerPptToReportTableReferenced(pptId, int(newReportId))
|
|
|
+ handlerPptToReportTableReferenced(pptId, newReportInfo.Id)
|
|
|
|
|
|
// 更新报告中的ppt图片
|
|
|
go saveReportPptImg(pptId, reportId, item.PptxUrl)
|
|
@@ -246,10 +248,10 @@ func pptContent2Html(content string, isEnglish bool) (htm string, err error) {
|
|
|
if len(chartIdInfo) == 2 {
|
|
|
v.ChartId = chartIdInfo[1]
|
|
|
}
|
|
|
- htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s&fromPage=en&isETAForumChart=true" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId)
|
|
|
+ htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s&fromPage=en&isETAForumChart=true&uid=%s" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId, v.Uid)
|
|
|
break
|
|
|
}
|
|
|
- htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s&fromPage=en" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId)
|
|
|
+ htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s&fromPage=en&uid=%s" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId, v.Uid)
|
|
|
break
|
|
|
}
|
|
|
if strings.HasPrefix(v.ChartId, "isETAForumChart_") {
|
|
@@ -257,12 +259,12 @@ func pptContent2Html(content string, isEnglish bool) (htm string, err error) {
|
|
|
if len(chartIdInfo) == 2 {
|
|
|
v.ChartId = chartIdInfo[1]
|
|
|
}
|
|
|
- htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s&isETAForumChart=true" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId)
|
|
|
+ htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s&isETAForumChart=true&uid=%s" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId, v.Uid)
|
|
|
break
|
|
|
}
|
|
|
- htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId)
|
|
|
+ htmlContent += fmt.Sprintf(`<iframe src="%s/chartshow?code=%s&uid=%s" width="100%%" height="350" style="border-width:0px; min-height:350px;"></iframe>`, chartRoot, v.ChartId, v.Uid)
|
|
|
case ElementsTypeSheet:
|
|
|
- htmlContent += fmt.Sprintf(`<iframe src="%s/sheetshow?code=%s" class="iframe%s" width="100%%" height="%s" style="border-width:0px;"></iframe>`, chartRoot, v.SheetId, v.SheetId, v.SheetHeight)
|
|
|
+ htmlContent += fmt.Sprintf(`<iframe src="%s/sheetshow?code=%s&uid=%s" class="iframe%s" width="100%%" height="%s" style="border-width:0px;"></iframe>`, chartRoot, v.SheetId, v.Uid, v.SheetId, v.SheetHeight)
|
|
|
}
|
|
|
htmlContent += htmlSuffix
|
|
|
}
|
|
@@ -528,15 +530,17 @@ func handlerPptToReportTableReferenced(pptId, reportId int) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- addList, err := excel.CopyReferencedExcelConfigByReferencedIdAndFromScene(pptId, utils.TableReferencedByPPT, reportInfo.Id, utils.TableReferencedByReport, reportInfo.AdminId, reportInfo.AdminRealName)
|
|
|
+ newFromScene := utils.TableReferencedByReport
|
|
|
+ addList, err := excel.CopyReferencedExcelConfigByReferencedIdAndFromScene(pptId, utils.TableReferencedByPPT, reportInfo.Id, newFromScene, 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)
|
|
|
+ content := HandleReportContentTableAndScene(reportInfo.Id, newFromScene, html.UnescapeString(reportInfo.Content))
|
|
|
+ reportInfo.Content = html.EscapeString(content)
|
|
|
+ reportInfo.ContentStruct = HandleReportContentStructTableAndScene(reportInfo.Id, newFromScene, reportInfo.ContentStruct)
|
|
|
err = reportInfo.Update([]string{"Content", "ContentStruct"})
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -549,8 +553,9 @@ func handlerPptToReportTableReferenced(pptId, reportId int) {
|
|
|
return
|
|
|
}
|
|
|
for _, v := range chapterList {
|
|
|
- v.Content = HandleReportContentTable(reportInfo.Id, v.Content)
|
|
|
- v.ContentStruct = HandleReportContentStructTable(reportInfo.Id, v.ContentStruct)
|
|
|
+ chapterContent := HandleReportContentTableAndScene(reportInfo.Id, newFromScene, html.UnescapeString(v.Content))
|
|
|
+ v.Content = html.EscapeString(chapterContent)
|
|
|
+ v.ContentStruct = HandleReportContentStructTableAndScene(reportInfo.Id, newFromScene, v.ContentStruct)
|
|
|
err = v.Update([]string{"Content", "ContentStruct"})
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -625,14 +630,16 @@ func handlerPptToEnReportTableReferenced(enPptId, enReportId int) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- addList, err := excel.CopyReferencedExcelConfigByReferencedIdAndFromScene(enPptId, utils.TableReferencedByEnPPT, enReportId, utils.TableReferencedByEnReport, reportInfo.AdminId, reportInfo.AdminRealName)
|
|
|
+ newFromScene := utils.TableReferencedByEnReport
|
|
|
+ addList, err := excel.CopyReferencedExcelConfigByReferencedIdAndFromScene(enPptId, utils.TableReferencedByEnPPT, enReportId, newFromScene, reportInfo.AdminId, reportInfo.AdminRealName)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if len(addList) > 0 {
|
|
|
// 修改内容
|
|
|
- reportInfo.Content = HandleReportContentTable(reportInfo.Id, reportInfo.Content)
|
|
|
+ content := HandleReportContentTableAndScene(reportInfo.Id, newFromScene, html.UnescapeString(reportInfo.Content))
|
|
|
+ reportInfo.Content = html.EscapeString(content)
|
|
|
err = reportInfo.Update([]string{"Content"})
|
|
|
if err != nil {
|
|
|
return
|