|
@@ -9,6 +9,7 @@ import (
|
|
|
"eta/eta_api/models/data_manage/excel/request"
|
|
|
"eta/eta_api/models/system"
|
|
|
"eta/eta_api/services/data/data_manage_permission"
|
|
|
+ excelService "eta/eta_api/services/data/excel"
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
"math"
|
|
@@ -32,6 +33,42 @@ func AddBalanceExcelChart(req request.AddBalanceTableChartReq, sysUser *system.A
|
|
|
err = fmt.Errorf("EXCEL类型错误!")
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ // 操作权限校验, 增加协作人判断
|
|
|
+ {
|
|
|
+ checkExcelInfo := excelInfo
|
|
|
+ checkExcelInfoId := excelInfo.ExcelInfoId
|
|
|
+ if excelInfo.BalanceType == 1 {
|
|
|
+ checkExcelInfoId = excelInfo.RelExcelInfoId
|
|
|
+ } else {
|
|
|
+ if excelInfo.ParentId > 0 {
|
|
|
+ checkExcelInfoId = excelInfo.ParentId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if checkExcelInfoId != excelInfo.ExcelInfoId {
|
|
|
+ checkExcelInfo, err = excelModel.GetExcelInfoById(checkExcelInfoId)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取平衡表格信息失败"
|
|
|
+ err = fmt.Errorf("获取平衡表格信息失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 数据权限
|
|
|
+ haveOperaAuth, e := data_manage_permission.CheckExcelPermissionByExcelInfoId(checkExcelInfo.ExcelInfoId, checkExcelInfo.ExcelClassifyId, checkExcelInfo.IsJoinPermission, sysUser.AdminId)
|
|
|
+ if e != nil {
|
|
|
+ errMsg = "获取ETA表格权限失败"
|
|
|
+ err = fmt.Errorf("获取表格权限信息失败,Err" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ button := excelService.GetBalanceExcelInfoOpButton(sysUser.AdminId, checkExcelInfo.SysUserId, haveOperaAuth, checkExcelInfo.ExcelInfoId)
|
|
|
+ if !button.OpButton {
|
|
|
+ errMsg = "无操作权限"
|
|
|
+ isSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if len(req.ChartEdbInfoList) == 0 {
|
|
|
errMsg = "图表数据不能为空!"
|
|
|
err = fmt.Errorf("图表数据不能为空!%s", err.Error())
|
|
@@ -262,6 +299,40 @@ func EditBalanceExcelChart(req request.AddBalanceTableChartReq, sysUser *system.
|
|
|
err = fmt.Errorf("图表数据不能为空!%s", err.Error())
|
|
|
return
|
|
|
}
|
|
|
+ // 操作权限校验, 增加协作人判断
|
|
|
+ {
|
|
|
+ checkExcelInfo := excelInfo
|
|
|
+ checkExcelInfoId := excelInfo.ExcelInfoId
|
|
|
+ if excelInfo.BalanceType == 1 {
|
|
|
+ checkExcelInfoId = excelInfo.RelExcelInfoId
|
|
|
+ } else {
|
|
|
+ if excelInfo.ParentId > 0 {
|
|
|
+ checkExcelInfoId = excelInfo.ParentId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if checkExcelInfoId != excelInfo.ExcelInfoId {
|
|
|
+ checkExcelInfo, err = excelModel.GetExcelInfoById(checkExcelInfoId)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取平衡表格信息失败"
|
|
|
+ err = fmt.Errorf("获取平衡表格信息失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 数据权限
|
|
|
+ haveOperaAuth, e := data_manage_permission.CheckExcelPermissionByExcelInfoId(checkExcelInfo.ExcelInfoId, checkExcelInfo.ExcelClassifyId, checkExcelInfo.IsJoinPermission, sysUser.AdminId)
|
|
|
+ if e != nil {
|
|
|
+ errMsg = "获取ETA表格权限失败"
|
|
|
+ err = fmt.Errorf("获取表格权限信息失败,Err" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ button := excelService.GetBalanceExcelInfoOpButton(sysUser.AdminId, checkExcelInfo.SysUserId, haveOperaAuth, checkExcelInfo.ExcelInfoId)
|
|
|
+ if !button.OpButton {
|
|
|
+ errMsg = "无操作权限"
|
|
|
+ isSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//查询已有的mapping
|
|
|
mapping, err := excelModel.GetExcelChartEdbMappingByChartInfoId(req.ChartInfoId)
|
|
@@ -1027,7 +1098,7 @@ func CheckBalanceChartCacheAndPermission(chartInfo *data_manage.ChartInfoView, i
|
|
|
}
|
|
|
}
|
|
|
if checkExcelInfoId != excelInfo.ExcelInfoId {
|
|
|
- checkExcelInfo, err = excelModel.GetExcelInfoById(excelInfo.ExcelInfoId)
|
|
|
+ checkExcelInfo, err = excelModel.GetExcelInfoById(checkExcelInfoId)
|
|
|
if err != nil {
|
|
|
errMsg = "获取平衡表格信息失败"
|
|
|
err = errors.New("获取平衡表格信息失败,Err:" + err.Error())
|
|
@@ -1195,25 +1266,6 @@ func AddBalanceStaticExcel(oldExcelInfo *excelModel.ExcelInfo, versionName strin
|
|
|
isSendEmail = true
|
|
|
|
|
|
versionName = utils.TrimLRStr(versionName)
|
|
|
- // todo 操作权限校验
|
|
|
- {
|
|
|
- // 数据权限
|
|
|
- /*haveOperaAuth, tmpErr := data_manage_permission.CheckExcelPermissionByExcelInfoId(oldExcelInfo.ExcelInfoId, oldExcelInfo.ExcelClassifyId, oldExcelInfo.IsJoinPermission, sysUser.AdminId)
|
|
|
- if err != nil {
|
|
|
- errMsg = "获取ETA表格权限失败"
|
|
|
- err = errors.New("获取ETA表格权限失败,Err:" + tmpErr.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- button := GetExcelInfoOpButton(sysUser, oldExcelInfo.SysUserId, oldExcelInfo.Source, haveOperaAuth)
|
|
|
- if !button.CopyButton {
|
|
|
- errMsg = "无操作权限"
|
|
|
- err = errors.New(errMsg)
|
|
|
- isSendEmail = false
|
|
|
- return
|
|
|
- }*/
|
|
|
- }
|
|
|
-
|
|
|
// 检验分类下是否存在该表格名称
|
|
|
{
|
|
|
var condition string
|