|
@@ -3363,3 +3363,112 @@ func (c *ExcelInfoController) GetExcelRuleDetail() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
}
|
|
|
+
|
|
|
+// GetExcelReferenceDetail
|
|
|
+// @Title 表格引用配置详情
|
|
|
+// @Description 表格引用配置详情
|
|
|
+// @Param ExcelInfoRuleMappingId query int true "id"
|
|
|
+// @Success Ret=200 获取成功
|
|
|
+// @router /excel_info/reference/detail [get]
|
|
|
+//func (c *ExcelInfoController) GetExcelReferenceDetail() {
|
|
|
+// br := new(models.BaseResponse).Init()
|
|
|
+// defer func() {
|
|
|
+// c.Data["json"] = br
|
|
|
+// c.ServeJSON()
|
|
|
+// }()
|
|
|
+// sysUser := c.SysUser
|
|
|
+// if sysUser == nil {
|
|
|
+// br.Msg = "请登录"
|
|
|
+// br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+// br.Ret = 408
|
|
|
+// return
|
|
|
+// }
|
|
|
+// excelReferenceCode := c.GetString("ExcelReferenceCode")
|
|
|
+//
|
|
|
+// item, err := excel3.GetReferencedExcelConfigByUniqueCode(excelReferenceCode)
|
|
|
+// if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+// br.Msg = "获取规则"
|
|
|
+// br.ErrMsg = "管理规则添加失败,Err:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// br.Data = item
|
|
|
+// br.Msg = "获取成功"
|
|
|
+// br.Ret = 200
|
|
|
+// br.Success = true
|
|
|
+//}
|
|
|
+
|
|
|
+// GetExcelReferenceDetail
|
|
|
+// @Title 表格引用配置保存
|
|
|
+// @Description 表格引用配置保存
|
|
|
+// @Param ExcelInfoRuleMappingId query int true "id"
|
|
|
+// @Success Ret=200 获取成功
|
|
|
+// @router /excel_info/reference/save [post]
|
|
|
+func (c *ExcelInfoController) SaveExcelReference() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := c.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req []excel3.ExcelReferencesReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ addList := make([]*excel3.ReferencedExcelConfig, 0)
|
|
|
+ for _, v := range req {
|
|
|
+ exist, e := excel3.GetReferencedExcelConfig(v.ReferencedId, v.FromScene, v.Uuid)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "查找引用失败"
|
|
|
+ br.ErrMsg = "查找引用失败,Err:" + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if exist.ReferencedExcelConfigId == 0 {
|
|
|
+ item := excel3.ReferencedExcelConfig{
|
|
|
+ UniqueCode: v.UniqueCode,
|
|
|
+ ReferencedId: v.ReferencedId,
|
|
|
+ FromScene: v.FromScene,
|
|
|
+ Uuid: v.Uuid,
|
|
|
+ WidthList: v.WidthList,
|
|
|
+ HeightList: v.HeightList,
|
|
|
+ OpUserId: sysUser.AdminId,
|
|
|
+ OpUserName: sysUser.RealName,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ }
|
|
|
+ addList = append(addList, &item)
|
|
|
+ } else {
|
|
|
+ exist.WidthList = v.WidthList
|
|
|
+ exist.HeightList = v.HeightList
|
|
|
+ exist.OpUserId = sysUser.AdminId
|
|
|
+ exist.OpUserName = sysUser.RealName
|
|
|
+ exist.ModifyTime = time.Now()
|
|
|
+ err = excel3.UpdateReferencedExcelConfig(&exist)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "更新引用失败"
|
|
|
+ br.ErrMsg = "更新引用失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ err = excel3.AddReferencedExcelConfig(addList)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "添加引用失败"
|
|
|
+ br.ErrMsg = "添加引用失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Msg = "添加成功"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+}
|