Browse Source

Merge branch 'feature/eta1.8.5_excel_balance' into debug

xyxie 10 tháng trước cách đây
mục cha
commit
2f5c63a085

+ 9 - 1
controllers/data_manage/excel/balance_table.go

@@ -878,6 +878,13 @@ func (c *ExcelInfoController) AddStaticExcel() {
 		br.IsSendEmail = false
 		return
 	}
+
+	// 获取原ETA表格信息
+	oldExcelInfo, err := excel.GetExcelInfoById(req.ExcelInfoId)
+	if err != nil {
+		br.Msg = "获取ETA表格失败"
+		return
+	}
 	// 查询出每个子表的内容,并将内容转为静态版本
 	//查询动态表所有的子表,并复制为静态表
 	condition := " AND parent_id = ? AND balance_type = 0 "
@@ -898,7 +905,8 @@ func (c *ExcelInfoController) AddStaticExcel() {
 		}
 		childExcelList[k].Content = content
 	}
-	excelInfo, err, errMsg, isSendEmail := data.AddBalanceStaticExcel(req.ExcelInfoId, req.VersionName, sysUser, 0, req.ExcelInfoId, 1, childExcelList)
+
+	excelInfo, err, errMsg, isSendEmail := data.AddBalanceStaticExcel(oldExcelInfo, req.VersionName, sysUser, 0, req.ExcelInfoId, 1, childExcelList)
 	if err != nil {
 		br.Msg = "复制失败"
 		if errMsg != `` {

+ 1 - 0
models/data_manage/excel/excel_info.go

@@ -252,6 +252,7 @@ func GetExcelInfoListByCondition(condition string, pars []interface{}) (items []
 	if condition != "" {
 		sql += condition
 	}
+	sql += ` ORDER BY excel_info_id asc `
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }

+ 3 - 11
services/data/chart_info_excel_balance.go

@@ -1200,18 +1200,10 @@ func getBalanceDataListStartDateAndValue(dataList []*data_manage.EdbDataList) (s
 }
 
 // AddBalanceStaticExcel 另存为和存为静态表以及子表的复制都调用该接口
-func AddBalanceStaticExcel(oldExcelInfoId int, versionName string, sysUser *system.Admin, parentId, relExcelInfoId, balanceType int, childExcelList []*excelModel.ExcelInfo) (excelInfo *excelModel.ExcelInfo, err error, errMsg string, isSendEmail bool) {
+func AddBalanceStaticExcel(oldExcelInfo *excelModel.ExcelInfo, versionName string, sysUser *system.Admin, parentId, relExcelInfoId, balanceType int, childExcelList []*excelModel.ExcelInfo) (excelInfo *excelModel.ExcelInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	versionName = utils.TrimLRStr(versionName)
-
-	// 获取原ETA表格信息
-	oldExcelInfo, err := excelModel.GetExcelInfoById(oldExcelInfoId)
-	if err != nil {
-		errMsg = "获取ETA表格失败"
-		return
-	}
-
 	// todo 操作权限校验
 	{
 		// 数据权限
@@ -1236,7 +1228,7 @@ func AddBalanceStaticExcel(oldExcelInfoId int, versionName string, sysUser *syst
 		var condition string
 		var pars []interface{}
 		condition += " AND rel_excel_info_id=? "
-		pars = append(pars, oldExcelInfoId)
+		pars = append(pars, oldExcelInfo.ExcelInfoId)
 
 		condition += " AND version_name=? "
 		pars = append(pars, versionName)
@@ -1311,7 +1303,7 @@ func AddBalanceStaticExcel(oldExcelInfoId int, versionName string, sysUser *syst
 	}
 	if parentId == 0 && len(childExcelList) > 0 {
 		for _, childExcelInfo := range childExcelList {
-			_, err, errMsg, isSendEmail = AddBalanceStaticExcel(childExcelInfo.ExcelInfoId, versionName, sysUser, excelInfo.ExcelInfoId, relExcelInfoId, balanceType, []*excelModel.ExcelInfo{})
+			_, err, errMsg, isSendEmail = AddBalanceStaticExcel(childExcelInfo, versionName, sysUser, excelInfo.ExcelInfoId, relExcelInfoId, balanceType, []*excelModel.ExcelInfo{})
 			if err != nil {
 				return
 			}

+ 1 - 0
services/data/excel/balance_table.go

@@ -489,6 +489,7 @@ func TransferBalanceExcelContentToStatic(excelDetail *excelModel.ExcelInfo, lang
 
 		for _, v := range cellRelationConfList {
 			if v.Type == request.EdbDT || v.Type == request.InsertDataDT || v.Type == request.PopInsertDataDT || v.Type == request.InsertEdbCalculateDataDT || v.Type == request.DateCalculateDataDT {
+			} else {
 				cellRelationConfNewList = append(cellRelationConfNewList, v)
 			}
 		}