作者 陈志颖

fix:编辑订单合伙类型名消失问题

@@ -407,6 +407,28 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) @@ -407,6 +407,28 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
407 transactionContext.RollbackTransaction() 407 transactionContext.RollbackTransaction()
408 }() 408 }()
409 409
  410 + // 获取合伙人类型
  411 + var PartnerCategoryRepository domain.PartnerCategoryRepository
  412 + if PartnerCategoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
  413 + "transactionContext": transactionContext,
  414 + }); err != nil {
  415 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  416 + }
  417 + var partnerCategories []domain.PartnerCategory
  418 + _, partnerCategories, err = PartnerCategoryRepository.Find(domain.PartnerCategoryFindQuery{
  419 + Ids: []int64{},
  420 + })
  421 + if err != nil {
  422 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("检索合伙人类型数据失败"))
  423 + }
  424 + partnerCategoryMap := map[int64]interface{}{}
  425 + if len(partnerCategories) > 0 {
  426 + for _, partnerCategory := range partnerCategories {
  427 + partnerCategoryMap[partnerCategory.Id] = partnerCategory.Name
  428 + }
  429 + }
  430 +
  431 + // 获取合伙人数据
410 var PartnerInfoRepository domain.PartnerInfoRepository 432 var PartnerInfoRepository domain.PartnerInfoRepository
411 if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ 433 if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
412 "transactionContext": transactionContext, 434 "transactionContext": transactionContext,
@@ -514,6 +536,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) @@ -514,6 +536,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
514 var cmdPartnerCategoryOk bool 536 var cmdPartnerCategoryOk bool
515 for _, v := range partnerData.PartnerCategoryInfos { 537 for _, v := range partnerData.PartnerCategoryInfos {
516 if v.Id == cmd.PartnerCategory { 538 if v.Id == cmd.PartnerCategory {
  539 + v.Name = partnerCategoryMap[v.Id].(string)
517 oldOrderData.PartnerCategory = v 540 oldOrderData.PartnerCategory = v
518 cmdPartnerCategoryOk = true 541 cmdPartnerCategoryOk = true
519 } 542 }
@@ -534,7 +557,6 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) @@ -534,7 +557,6 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
534 if err != nil { 557 if err != nil {
535 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中合计的数值失败:%s", err)) 558 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中合计的数值失败:%s", err))
536 } 559 }
537 -  
538 err = orderBaseRepository.Save(oldOrderData) 560 err = orderBaseRepository.Save(oldOrderData)
539 if err != nil { 561 if err != nil {
540 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单数据失败:%s", err)) 562 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单数据失败:%s", err))