作者 陈志颖

合并分支 'dev' 到 'test'

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



查看合并请求 !29
... ... @@ -407,6 +407,28 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
transactionContext.RollbackTransaction()
}()
// 获取合伙人类型
var PartnerCategoryRepository domain.PartnerCategoryRepository
if PartnerCategoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
var partnerCategories []domain.PartnerCategory
_, partnerCategories, err = PartnerCategoryRepository.Find(domain.PartnerCategoryFindQuery{
Ids: []int64{},
})
if err != nil {
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("检索合伙人类型数据失败"))
}
partnerCategoryMap := map[int64]interface{}{}
if len(partnerCategories) > 0 {
for _, partnerCategory := range partnerCategories {
partnerCategoryMap[partnerCategory.Id] = partnerCategory.Name
}
}
// 获取合伙人数据
var PartnerInfoRepository domain.PartnerInfoRepository
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -514,6 +536,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
var cmdPartnerCategoryOk bool
for _, v := range partnerData.PartnerCategoryInfos {
if v.Id == cmd.PartnerCategory {
v.Name = partnerCategoryMap[v.Id].(string)
oldOrderData.PartnerCategory = v
cmdPartnerCategoryOk = true
}
... ... @@ -534,7 +557,6 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
if err != nil {
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中合计的数值失败:%s", err))
}
err = orderBaseRepository.Save(oldOrderData)
if err != nil {
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单数据失败:%s", err))
... ...