|
@@ -1,6 +1,6 @@
|
|
|
-// Package document_manange
|
|
|
+// Package document_manage
|
|
|
// @Author gmy 2024/9/19 14:09:00
|
|
|
-package document_manange
|
|
|
+package document_manage
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
@@ -17,17 +17,9 @@ type DocumentManageController struct {
|
|
|
controllers.BaseAuthController
|
|
|
}
|
|
|
|
|
|
-// HandleResponseWithValidation
|
|
|
+// ValidateUser
|
|
|
// 处理响应和校验
|
|
|
-func HandleResponseWithValidation(this *DocumentManageController, br *models.BaseResponse) bool {
|
|
|
- defer func() {
|
|
|
- if br.ErrMsg == "" {
|
|
|
- br.IsSendEmail = false
|
|
|
- }
|
|
|
- this.Data["json"] = br
|
|
|
- this.ServeJSON()
|
|
|
- }()
|
|
|
-
|
|
|
+func ValidateUser(this *DocumentManageController, br *models.BaseResponse) bool {
|
|
|
// 验证用户是否已登录
|
|
|
sysUser := this.SysUser
|
|
|
if sysUser == nil {
|
|
@@ -48,9 +40,18 @@ func HandleResponseWithValidation(this *DocumentManageController, br *models.Bas
|
|
|
func (this *DocumentManageController) DocumentClassifyList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
sysUser := this.SysUser
|
|
|
classifyList, err := document_manage_service.DocumentClassifyList(sysUser.AdminId)
|
|
|
if err != nil {
|
|
@@ -74,7 +75,15 @@ func (this *DocumentManageController) DocumentClassifyList() {
|
|
|
func (this *DocumentManageController) DocumentCollectClassify() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -110,7 +119,15 @@ func (this *DocumentManageController) DocumentCollectClassify() {
|
|
|
func (this *DocumentManageController) DocumentVarietyList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -136,9 +153,18 @@ func (this *DocumentManageController) DocumentVarietyList() {
|
|
|
func (this *DocumentManageController) DocumentReportList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
// 文档类型 1-文档管理库 2-战研中心-pci
|
|
|
documentType, err := this.GetInt("DocumentType")
|
|
|
if err != nil {
|
|
@@ -153,10 +179,16 @@ func (this *DocumentManageController) DocumentReportList() {
|
|
|
}
|
|
|
|
|
|
chartPermissionIdString := this.GetString("ChartPermissionIdList")
|
|
|
- chartPermissionIdList := strings.Split(chartPermissionIdString, ",")
|
|
|
+ var chartPermissionIdList []string
|
|
|
+ if strings.TrimSpace(chartPermissionIdString) != "" {
|
|
|
+ chartPermissionIdList = strings.Split(chartPermissionIdString, ",")
|
|
|
+ }
|
|
|
|
|
|
classifyIdString := this.GetString("ClassifyIdList")
|
|
|
- classifyIdList := strings.Split(classifyIdString, ",")
|
|
|
+ var classifyIdList []string
|
|
|
+ if strings.TrimSpace(classifyIdString) != "" {
|
|
|
+ classifyIdList = strings.Split(classifyIdString, ",")
|
|
|
+ }
|
|
|
|
|
|
keyword := this.GetString("Keyword")
|
|
|
orderField := this.GetString("OrderField")
|
|
@@ -192,18 +224,35 @@ func (this *DocumentManageController) DocumentReportList() {
|
|
|
func (this *DocumentManageController) RuiSiReportList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
classifyIdFirstString := this.GetString("classifyIdFirstList")
|
|
|
- classifyIdFirstList := strings.Split(classifyIdFirstString, ",")
|
|
|
+ var classifyIdFirstList []string
|
|
|
+ if strings.TrimSpace(classifyIdFirstString) != "" {
|
|
|
+ classifyIdFirstList = strings.Split(classifyIdFirstString, ",")
|
|
|
+ }
|
|
|
|
|
|
classifyIdSecondString := this.GetString("classifyIdSecondList")
|
|
|
- classifyIdSecondList := strings.Split(classifyIdSecondString, ",")
|
|
|
+ var classifyIdSecondList []string
|
|
|
+ if strings.TrimSpace(classifyIdSecondString) != "" {
|
|
|
+ classifyIdSecondList = strings.Split(classifyIdSecondString, ",")
|
|
|
+ }
|
|
|
|
|
|
classifyIdThirdString := this.GetString("classifyIdThirdList")
|
|
|
- classifyIdThirdList := strings.Split(classifyIdThirdString, ",")
|
|
|
+ var classifyIdThirdList []string
|
|
|
+ if strings.TrimSpace(classifyIdThirdString) != "" {
|
|
|
+ classifyIdThirdList = strings.Split(classifyIdThirdString, ",")
|
|
|
+ }
|
|
|
|
|
|
keyword := this.GetString("Keyword")
|
|
|
orderField := this.GetString("OrderField")
|
|
@@ -239,11 +288,19 @@ func (this *DocumentManageController) RuiSiReportList() {
|
|
|
func (this *DocumentManageController) DocumentRuiSiDetail() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
// 获取指标数据列表
|
|
|
- this.GetString("DocumentRuiSiDetail")
|
|
|
|
|
|
reportId, err := this.GetInt("ReportId")
|
|
|
if err != nil {
|
|
@@ -272,7 +329,15 @@ func (this *DocumentManageController) DocumentRuiSiDetail() {
|
|
|
func (this *DocumentManageController) DocumentSave() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -306,11 +371,19 @@ func (this *DocumentManageController) DocumentSave() {
|
|
|
func (this *DocumentManageController) DocumentDetail() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
// 获取指标数据列表
|
|
|
- this.GetString("ChartPermissionId")
|
|
|
|
|
|
outsideReportId, err := this.GetInt("OutsideReportId")
|
|
|
if err != nil {
|
|
@@ -339,7 +412,15 @@ func (this *DocumentManageController) DocumentDetail() {
|
|
|
func (this *DocumentManageController) DocumentUpdate() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -369,7 +450,15 @@ func (this *DocumentManageController) DocumentUpdate() {
|
|
|
func (this *DocumentManageController) DocumentDelete() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
|
|
|
- if !HandleResponseWithValidation(this, br) {
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ if !ValidateUser(this, br) {
|
|
|
return
|
|
|
}
|
|
|
|