浏览代码

更新人变更

xyxie 10 月之前
父节点
当前提交
2d4dfc2d8e

+ 11 - 0
controllers/data_manage/excel/excel_info.go

@@ -874,6 +874,17 @@ func (c *ExcelInfoController) Edit() {
 		return
 	}
 
+	if excelInfo.Source == utils.BALANCE_TABLE && req.IsAuto == false {
+		// 更新人变更
+		parentExcelInfoId := excelInfo.ParentId
+		if excelInfo.BalanceType == 1 {
+			parentExcelInfoId = excelInfo.RelExcelInfoId
+		}
+		err = excel3.ModifyExcelInfoUpdateUserId(parentExcelInfoId, sysUser.AdminId, sysUser.RealName)
+		br.Msg = "保存失败"
+		br.ErrMsg = "保存失败,Err:" + err.Error()
+		return
+	}
 	// 更新excel下载地址(默认的EXCEL需要更新,自定义表格不需要更新)
 	if excelInfo.Source == 1 {
 		go excel2.UpdateExcelInfoFileUrl(excelInfo)

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

@@ -698,3 +698,10 @@ type ExcelInfoDetailButton struct {
 	RefreshEdbButton bool `description:"是否可刷新指标"`
 	OpWorkerButton   bool `description:"是否修改协作人"`
 }
+
+func ModifyExcelInfoUpdateUserId(excelInfoId, userId int, userName string) (err error) {
+	o := orm.NewOrmUsingDB("data")
+	sql := `UPDATE excel_info SET sys_user_id=?,sys_user_real_name=? WHERE excel_info_id =? `
+	_, err = o.Raw(sql, userId, userName, excelInfoId).Exec()
+	return
+}

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

@@ -35,6 +35,7 @@ type EditExcelInfoReq struct {
 	ExcelClassifyId int         `description:"分类id"`
 	Content         string      `description:"Excel表格内容"`
 	TableData       interface{} `description:"自定义表格的数据内容"`
+	IsAuto          bool        `description:"是否自动保存,1:是,2:否,默认:1"`
 }
 
 // SetExcelInfoImageReq 设置excel表格图片请求