作者 唐旭辉

更新

... ... @@ -249,12 +249,28 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) (
SalesmanBonusPercent: cmd.SalesmanBonusPercent,
CompanyId: cmd.CompanyId,
}
var categoryRepository domain.PartnerCategoryRepository
if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
var cmdPartnerCategoryOk bool
for _, v := range partnerData.PartnerCategoryInfos {
if v.Id == cmd.PartnerCategory {
newOrder.PartnerCategory = v
_, categorys, err := categoryRepository.Find(domain.PartnerCategoryFindQuery{
Ids: []int64{v.Id},
})
if err != nil {
e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
}
if len(categorys) > 0 {
newOrder.PartnerCategory = categorys[0]
cmdPartnerCategoryOk = true
}
break
}
}
if !cmdPartnerCategoryOk {
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "合伙人类型选择错误")
... ...