|
@@ -41,7 +41,7 @@ type PPTContentElements struct {
|
|
|
}
|
|
|
|
|
|
// SavePPTReport 保存PPT报告
|
|
|
-func SavePPTReport(pptId, classifyIdSecond int, title string, adminInfo *system.Admin) (reportId int, reportCode, errMsg string, err error) {
|
|
|
+func SavePPTReport(pptId, classifyId int, title string, adminInfo *system.Admin) (reportId int, reportCode, errMsg string, err error) {
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
utils.FileLog.Info("%s", err.Error())
|
|
@@ -68,7 +68,7 @@ func SavePPTReport(pptId, classifyIdSecond int, title string, adminInfo *system.
|
|
|
}
|
|
|
|
|
|
// 2023-02-21 PPT可多次转为报告, 不做关联
|
|
|
- if classifyIdSecond == 0 {
|
|
|
+ if classifyId == 0 {
|
|
|
errMsg = "请选择报告类型"
|
|
|
err = errors.New("请选择报告类型")
|
|
|
return
|
|
@@ -90,17 +90,48 @@ func SavePPTReport(pptId, classifyIdSecond int, title string, adminInfo *system.
|
|
|
classifyMap[v.Id] = v
|
|
|
}
|
|
|
classifyIdFirst := 0
|
|
|
+ classifyIdSecond := 0
|
|
|
+ classifyIdThird := 0
|
|
|
classifyNameFirst := ""
|
|
|
classifyNameSecond := ""
|
|
|
- secondClassify := classifyMap[classifyIdSecond]
|
|
|
- if secondClassify != nil {
|
|
|
- classifyNameSecond = secondClassify.ClassifyName
|
|
|
- firstClassify := classifyMap[secondClassify.ParentId]
|
|
|
- if firstClassify != nil {
|
|
|
- classifyIdFirst = firstClassify.Id
|
|
|
- classifyNameFirst = firstClassify.ClassifyName
|
|
|
- }
|
|
|
+ classifyNameThird := ""
|
|
|
+
|
|
|
+ // 最小单元分类,第二级别的分类 ,最大的分类
|
|
|
+ var baseClassify, twoClassify, threeClassify *models.Classify
|
|
|
+
|
|
|
+ var hasTwo, hasThird bool
|
|
|
+ baseClassify, ok := classifyMap[classifyId]
|
|
|
+ if !ok {
|
|
|
+ errMsg = "分类异常"
|
|
|
+ err = errors.New("获取分类失败 ")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ twoClassify, hasTwo = classifyMap[baseClassify.ParentId]
|
|
|
+ if ok {
|
|
|
+ threeClassify, hasThird = classifyMap[twoClassify.ParentId]
|
|
|
+ }
|
|
|
+
|
|
|
+ if hasThird { // 如果确实是有三级分类
|
|
|
+ classifyIdFirst = threeClassify.Id
|
|
|
+ classifyNameFirst = threeClassify.ClassifyName
|
|
|
+
|
|
|
+ classifyIdSecond = twoClassify.Id
|
|
|
+ classifyNameSecond = twoClassify.ClassifyName
|
|
|
+
|
|
|
+ classifyIdThird = baseClassify.Id
|
|
|
+ classifyNameThird = baseClassify.ClassifyName
|
|
|
+ } else if hasTwo {
|
|
|
+ classifyIdFirst = twoClassify.Id
|
|
|
+ classifyNameFirst = twoClassify.ClassifyName
|
|
|
+
|
|
|
+ classifyIdSecond = baseClassify.Id
|
|
|
+ classifyNameSecond = baseClassify.ClassifyName
|
|
|
+
|
|
|
+ } else {
|
|
|
+ classifyIdFirst = baseClassify.Id
|
|
|
+ classifyNameFirst = baseClassify.ClassifyName
|
|
|
}
|
|
|
+
|
|
|
// 新增报告
|
|
|
nowTime := time.Now().Local()
|
|
|
reportReq := &models.AddReq{
|
|
@@ -109,6 +140,8 @@ func SavePPTReport(pptId, classifyIdSecond int, title string, adminInfo *system.
|
|
|
ClassifyNameFirst: classifyNameFirst,
|
|
|
ClassifyIdSecond: classifyIdSecond,
|
|
|
ClassifyNameSecond: classifyNameSecond,
|
|
|
+ ClassifyIdThird: classifyIdThird,
|
|
|
+ ClassifyNameThird: classifyNameThird,
|
|
|
Title: title,
|
|
|
Abstract: "",
|
|
|
Author: "FICC团队",
|
|
@@ -117,7 +150,16 @@ func SavePPTReport(pptId, classifyIdSecond int, title string, adminInfo *system.
|
|
|
Content: htm,
|
|
|
CreateTime: nowTime.Format(utils.FormatDateTime),
|
|
|
ReportVersion: 2,
|
|
|
+ CollaborateType: 1, // 协作方式,1:个人,2:多人协作。默认:1
|
|
|
+ ReportLayout: 1, // 报告布局,1:常规布局,2:智能布局。默认:1
|
|
|
+ IsPublicPublish: 2, // 是否公开发布,1:是,2:否
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果PPT是公开的,则报告也公开发布
|
|
|
+ if item.IsShare == 1 {
|
|
|
+ reportReq.IsPublicPublish = 1
|
|
|
}
|
|
|
+
|
|
|
newReportId, newCode, _, e := CreateNewReport(*reportReq, adminInfo)
|
|
|
if e != nil {
|
|
|
errMsg = "转换失败"
|