|
@@ -3,6 +3,7 @@ package controllers
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"eta/eta_api/models"
|
|
|
+ "eta/eta_api/models/company"
|
|
|
"eta/eta_api/services"
|
|
|
"eta/eta_api/services/alarm_msg"
|
|
|
"eta/eta_api/utils"
|
|
@@ -289,7 +290,14 @@ func (this *ReportController) PublishReport() {
|
|
|
} else {
|
|
|
publishTime = time.Now()
|
|
|
}
|
|
|
-
|
|
|
+ // 获取审批流设置
|
|
|
+ confKey := "approval_flow"
|
|
|
+ confTmp, e := company.GetConfigDetailByCode(confKey)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取审批流配置失败"
|
|
|
+ br.ErrMsg = "获取审批流配置失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
var tmpErr error
|
|
|
if report.HasChapter == 1 && (report.ChapterType == utils.REPORT_TYPE_DAY || report.ChapterType == utils.REPORT_TYPE_WEEK) {
|
|
|
// 发布晨周报
|
|
@@ -304,11 +312,20 @@ func (this *ReportController) PublishReport() {
|
|
|
br.ErrMsg = "报告内容为空,不需要生成,report_id:" + strconv.Itoa(report.Id)
|
|
|
return
|
|
|
}
|
|
|
- if tmpErr = models.PublishReportById(report.Id, publishTime); tmpErr != nil {
|
|
|
- br.Msg = "报告发布失败"
|
|
|
- br.ErrMsg = "报告发布失败, Err:" + tmpErr.Error() + ", report_id:" + strconv.Itoa(report.Id)
|
|
|
- return
|
|
|
+ if confTmp.ConfigValue == "1" || confTmp.ConfigValue == "3"{
|
|
|
+ if tmpErr = models.SubmitReportById(report.Id, publishTime); tmpErr != nil {
|
|
|
+ br.Msg = "提交审核失败"
|
|
|
+ br.ErrMsg = "提交审核失败, Err:" + tmpErr.Error() + ", report_id:" + strconv.Itoa(report.Id)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if tmpErr = models.PublishReportById(report.Id, publishTime); tmpErr != nil {
|
|
|
+ br.Msg = "报告发布失败"
|
|
|
+ br.ErrMsg = "报告发布失败, Err:" + tmpErr.Error() + ", report_id:" + strconv.Itoa(report.Id)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
go func() {
|
|
|
// 生成音频
|
|
|
if report.VideoUrl == "" {
|
|
@@ -319,7 +336,11 @@ func (this *ReportController) PublishReport() {
|
|
|
// _ = services.ZhaoGangSend(report)
|
|
|
//}
|
|
|
// 更新报告Es
|
|
|
- _ = services.UpdateReportEs(report.Id, 2)
|
|
|
+ if report.HasChapter != 1 && (confTmp.ConfigValue == "1" || confTmp.ConfigValue == "3"){
|
|
|
+ _ = services.UpdateReportEs(report.Id, 3)
|
|
|
+ } else {
|
|
|
+ _ = services.UpdateReportEs(report.Id, 2)
|
|
|
+ }
|
|
|
}()
|
|
|
}
|
|
|
}
|