|
@@ -17,6 +17,7 @@ import (
|
|
|
"os"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+ "sync"
|
|
|
"time"
|
|
|
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
@@ -795,7 +796,12 @@ func (this *ReportController) SaveReportContent() {
|
|
|
br.IsSendEmail = false
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ if reportInfo.ReportLayout == 3 && req.FreeLayoutConfig == "" {
|
|
|
+ br.Msg = "自由布局配置为空"
|
|
|
+ br.ErrMsg = "自由布局配置为空"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
// 标记更新中
|
|
|
{
|
|
|
markStatus, err := services.UpdateReportEditMark(req.ReportId, 0, sysUser.AdminId, 1, sysUser.RealName, this.Lang)
|
|
@@ -838,6 +844,7 @@ func (this *ReportController) SaveReportContent() {
|
|
|
go alarm_msg.SendAlarmMsg("解析 ContentSub 失败,Err:"+err.Error(), 3)
|
|
|
//utils.SendEmail(utils.APPNAME+"失败提醒", "解析 ContentSub 失败,Err:"+err.Error(), utils.EmailSendToUsers)
|
|
|
}
|
|
|
+
|
|
|
reportInfo.Content = html.EscapeString(content)
|
|
|
reportInfo.ContentSub = html.EscapeString(contentSub)
|
|
|
reportInfo.ContentStruct = html.EscapeString(req.ContentStruct)
|
|
@@ -848,15 +855,56 @@ func (this *ReportController) SaveReportContent() {
|
|
|
reportInfo.EndResourceId = req.EndResourceId
|
|
|
reportInfo.ModifyTime = time.Now()
|
|
|
reportInfo.ContentModifyTime = time.Now()
|
|
|
- updateCols := []string{"Content", "ContentSub", "ContentStruct", "HeadImg", "EndImg", "CanvasColor", "HeadResourceId", "EndResourceId", "ModifyTime", "ContentModifyTime"}
|
|
|
- err = reportInfo.UpdateReport(updateCols)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "保存失败"
|
|
|
- br.ErrMsg = "保存失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ if reportInfo.ReportLayout == 3 {
|
|
|
+ reportInfo.FreeLayoutConfig = req.FreeLayoutConfig
|
|
|
+ //自由布局更新每页的数据
|
|
|
+ ormList := report.ToOrmViewList(req.FreeLayoutContentPages, false, reportInfo.Id, 0)
|
|
|
+ var wg sync.WaitGroup
|
|
|
+ wg.Add(len(ormList))
|
|
|
+ for _, v := range ormList {
|
|
|
+ go func(v *report.ReportFreeLayout) {
|
|
|
+ defer wg.Done()
|
|
|
+ content = v.Content
|
|
|
+ if content != "" {
|
|
|
+ e = utils.ContentXssCheck(content)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "存在非法标签"
|
|
|
+ br.ErrMsg = "存在非法标签, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ contentClean, e = services.FilterReportContentBr(content)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "内容去除前后空格失败"
|
|
|
+ br.ErrMsg = "内容去除前后空格失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ content = contentClean
|
|
|
+ v.ContentStruct = services.HandleReportContentStruct(req.ContentStruct, "del", nil)
|
|
|
+ v.Content = html.EscapeString(content)
|
|
|
+ v.ContentStruct = html.EscapeString(v.ContentStruct)
|
|
|
+ }
|
|
|
+ }(v)
|
|
|
+ wg.Wait()
|
|
|
+ err = models.InsertOrUpdateReportFreeLayoutContentPage(reportInfo, ormList)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存失败"
|
|
|
+ br.ErrMsg = "保存失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ updateCols := []string{"Content", "ContentSub", "ContentStruct", "HeadImg", "EndImg", "CanvasColor", "HeadResourceId", "EndResourceId", "ModifyTime", "ContentModifyTime"}
|
|
|
+ err = reportInfo.UpdateReport(updateCols)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存失败"
|
|
|
+ br.ErrMsg = "保存失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
go models.AddReportSaveLog(reportId, this.SysUser.AdminId, reportInfo.Content, reportInfo.ContentSub, reportInfo.ContentStruct, reportInfo.CanvasColor, this.SysUser.AdminName, reportInfo.HeadResourceId, reportInfo.EndResourceId)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
resp := new(models.SaveReportContentResp)
|
|
@@ -1022,17 +1070,21 @@ func (this *ReportController) BaseDetail() {
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
- /*var req models.ReportDetailReq
|
|
|
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "参数解析异常!"
|
|
|
- br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if req.ReportId <= 0 {
|
|
|
- br.Msg = "参数错误"
|
|
|
- return
|
|
|
- }*/
|
|
|
+ /*
|
|
|
+ var req models.ReportDetailReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.ReportId <= 0 {
|
|
|
+ br.Msg = "参数错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ */
|
|
|
reportId, err := this.GetInt("ReportId")
|
|
|
if err != nil {
|
|
|
br.Msg = "获取参数失败!"
|
|
@@ -1177,11 +1229,12 @@ func (this *ReportController) EditLayoutImg() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- //if req.Content == "" {
|
|
|
- // br.Msg = "报告内容不能为空"
|
|
|
- // return
|
|
|
- //}
|
|
|
- //更新标记key
|
|
|
+ // if req.Content == "" {
|
|
|
+ // br.Msg = "报告内容不能为空"
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // 更新标记key
|
|
|
markStatus, err := services.UpdateReportEditMark(int(req.ReportId), 0, sysUser.AdminId, 1, sysUser.RealName, this.Lang)
|
|
|
if err != nil {
|
|
|
br.Msg = err.Error()
|
|
@@ -1189,7 +1242,7 @@ func (this *ReportController) EditLayoutImg() {
|
|
|
}
|
|
|
if markStatus.Status == 1 {
|
|
|
br.Msg = markStatus.Msg
|
|
|
- //br.Ret = 202 //202 服务器已接受请求,但尚未处理。
|
|
|
+ // br.Ret = 202 //202 服务器已接受请求,但尚未处理。
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -1816,10 +1869,10 @@ func (this *ReportCommonController) ShareTransform() {
|
|
|
// @author: Roc
|
|
|
// @datetime 2024-06-21 09:19:05
|
|
|
func init() {
|
|
|
- //fixApproveRecord()
|
|
|
- //fixChapterPermission()
|
|
|
- //fixReportEs()
|
|
|
- //fixSmartReport()
|
|
|
+ // fixApproveRecord()
|
|
|
+ // fixChapterPermission()
|
|
|
+ // fixReportEs()
|
|
|
+ // fixSmartReport()
|
|
|
}
|
|
|
|
|
|
// 修复研报审批数据
|
|
@@ -1835,7 +1888,7 @@ func fixApproveRecord() {
|
|
|
return
|
|
|
}
|
|
|
for _, recordItem := range list {
|
|
|
- //fmt.Println(recordItem)
|
|
|
+ // fmt.Println(recordItem)
|
|
|
recordItem.NodeState = recordItem.State
|
|
|
recordItem.NodeApproveUserId = recordItem.ApproveUserId
|
|
|
recordItem.NodeApproveUserName = recordItem.ApproveUserName
|
|
@@ -1885,7 +1938,7 @@ func fixChapterPermission() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //notIdList := []int{9675, 9675, 9740, 9749, 9768, 9773, 9791, 9792, 9793, 9850, 9851, 9852, 9852, 9852, 9853, 9854, 9856, 9857, 9857, 9858, 9859, 9860, 9861, 9862, 9862, 9863, 9866}
|
|
|
+ // notIdList := []int{9675, 9675, 9740, 9749, 9768, 9773, 9791, 9792, 9793, 9850, 9851, 9852, 9852, 9852, 9853, 9854, 9856, 9857, 9857, 9858, 9859, 9860, 9861, 9862, 9862, 9863, 9866}
|
|
|
notIdList := []int{}
|
|
|
allReportChapterList, err := models.GetAllReportChapter()
|
|
|
if err != nil {
|
|
@@ -2008,7 +2061,7 @@ func fixSmartReport() {
|
|
|
for _, v := range list {
|
|
|
fmt.Println(v)
|
|
|
addList = append(addList, &models.Report{
|
|
|
- //Id: 0,
|
|
|
+ // Id: 0,
|
|
|
AddType: 1,
|
|
|
ClassifyIdFirst: v.ClassifyIdFirst,
|
|
|
ClassifyNameFirst: v.ClassifyNameFirst,
|
|
@@ -2024,7 +2077,7 @@ func fixSmartReport() {
|
|
|
PublishTime: v.PublishTime,
|
|
|
Stage: v.Stage,
|
|
|
MsgIsSend: v.MsgIsSend,
|
|
|
- //ThsMsgIsSend: v.Tha,
|
|
|
+ // ThsMsgIsSend: v.Tha,
|
|
|
Content: v.Content,
|
|
|
VideoUrl: v.VideoUrl,
|
|
|
VideoName: v.VideoName,
|
|
@@ -2120,7 +2173,7 @@ func fixSmartReport() {
|
|
|
func initPdf() {
|
|
|
inFile := "anNNgk3Bbi4LRULwcJgNOPrREYh5.pdf"
|
|
|
f2, err := services.GeneralWaterMarkPdf(inFile, "颜鹏 - 18170239278")
|
|
|
- //f2, err := services.GeneralWaterMarkPdf(inFile, "上周美国馏分油库存累库95万桶,馏分油表需环比下降(-25.6万桶/日)。本期馏分油产量继续抬升,在供增需减的环比变动下库存持续累库。馏分油供应的增加我们认为可能和进口的油种有关,今年以来美国进口的中重质原油占比不断走高,尤其是5")
|
|
|
+ // f2, err := services.GeneralWaterMarkPdf(inFile, "上周美国馏分油库存累库95万桶,馏分油表需环比下降(-25.6万桶/日)。本期馏分油产量继续抬升,在供增需减的环比变动下库存持续累库。馏分油供应的增加我们认为可能和进口的油种有关,今年以来美国进口的中重质原油占比不断走高,尤其是5")
|
|
|
if err != nil {
|
|
|
fmt.Println("生成失败,ERR:", err)
|
|
|
return
|