作者 陈志颖

fix:新增公司增加栏目设置数据

@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "encoding/json" 4 "encoding/json"
5 "errors" 5 "errors"
6 "fmt" 6 "fmt"
  7 + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/constant"
7 "time" 8 "time"
8 9
9 "github.com/astaxie/beego/logs" 10 "github.com/astaxie/beego/logs"
@@ -196,6 +197,12 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error { @@ -196,6 +197,12 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error {
196 }); err != nil { 197 }); err != nil {
197 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 198 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
198 } 199 }
  200 + var columnSettingRepository domain.ColumnSettingRepository
  201 + if columnSettingRepository, err = factory.CreateColumnSettingRepository(map[string]interface{}{
  202 + "transactionContext": transactionContext,
  203 + }); err != nil {
  204 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  205 + }
199 oldCompany, err = companyRespository.FindOne(domain.CompanyFindOneOptions{ 206 oldCompany, err = companyRespository.FindOne(domain.CompanyFindOneOptions{
200 Id: data.Company.Id, 207 Id: data.Company.Id,
201 }) 208 })
@@ -277,6 +284,21 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error { @@ -277,6 +284,21 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error {
277 if err != nil { 284 if err != nil {
278 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 285 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
279 } 286 }
  287 + // 初始化栏目设置
  288 + newColumnSetting := &domain.ColumnSetting{
  289 + Description: "订单管理栏目设置",
  290 + UserName: data.User.Name,
  291 + CompanyId: int(data.User.CompanyId),
  292 + Uid: data.User.Id,
  293 + Key: constant.ORDER_BASE, // 订单栏目模块名称
  294 + Value: domain.DefaultColumns, // 栏目值数组,创建用户时使用默认栏目设置
  295 + InvalidValue: domain.DefaultInvalidColumns, // 初始化无效栏目数组
  296 + CreatedAt: time.Now(),
  297 + UpdatedAt: time.Now(),
  298 + }
  299 + if _, err = columnSettingRepository.Save(newColumnSetting); err != nil {
  300 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  301 + }
280 err = transactionContext.CommitTransaction() 302 err = transactionContext.CommitTransaction()
281 return nil 303 return nil
282 } 304 }