...
|
...
|
@@ -249,11 +249,27 @@ 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
|
|
|
cmdPartnerCategoryOk = true
|
|
|
_, 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 {
|
...
|
...
|
|