作者 唐旭辉

更新

@@ -249,12 +249,28 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( @@ -249,12 +249,28 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
249 SalesmanBonusPercent: cmd.SalesmanBonusPercent, 249 SalesmanBonusPercent: cmd.SalesmanBonusPercent,
250 CompanyId: cmd.CompanyId, 250 CompanyId: cmd.CompanyId,
251 } 251 }
  252 + var categoryRepository domain.PartnerCategoryRepository
  253 + if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
  254 + "transactionContext": transactionContext,
  255 + }); err != nil {
  256 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  257 + }
252 var cmdPartnerCategoryOk bool 258 var cmdPartnerCategoryOk bool
253 for _, v := range partnerData.PartnerCategoryInfos { 259 for _, v := range partnerData.PartnerCategoryInfos {
254 if v.Id == cmd.PartnerCategory { 260 if v.Id == cmd.PartnerCategory {
255 - newOrder.PartnerCategory = v 261 + _, categorys, err := categoryRepository.Find(domain.PartnerCategoryFindQuery{
  262 + Ids: []int64{v.Id},
  263 + })
  264 + if err != nil {
  265 + e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
  266 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  267 + }
  268 + if len(categorys) > 0 {
  269 + newOrder.PartnerCategory = categorys[0]
256 cmdPartnerCategoryOk = true 270 cmdPartnerCategoryOk = true
257 } 271 }
  272 + break
  273 + }
258 } 274 }
259 if !cmdPartnerCategoryOk { 275 if !cmdPartnerCategoryOk {
260 return nil, lib.ThrowError(lib.BUSINESS_ERROR, "合伙人类型选择错误") 276 return nil, lib.ThrowError(lib.BUSINESS_ERROR, "合伙人类型选择错误")