...
|
...
|
@@ -42,8 +42,10 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests |
|
|
|
|
|
//检查账号是否存在
|
|
|
var (
|
|
|
orderBestshopDao *dao.OrderBestshopDao
|
|
|
orderExist bool
|
|
|
orderBestshopDao *dao.OrderBestshopDao
|
|
|
orderExist bool
|
|
|
partnerRepository domain.PartnerInfoRepository
|
|
|
partnerData *domain.PartnerInfo
|
|
|
)
|
|
|
if orderBestshopDao, err = factory.CreateOrderBestshopDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -54,6 +56,21 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests |
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.TRANSACTION_ERROR, "orderBestshopDao.OrderExist err:"+err.Error())
|
|
|
}
|
|
|
//数据检查
|
|
|
if partnerRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
partnerData, err = partnerRepository.FindOne(domain.PartnerFindOneQuery{UserId: cmd.PartnerId})
|
|
|
if err != nil {
|
|
|
e := fmt.Sprintf("未找到指定的合伙人(id=%d)数据,%s", cmd.PartnerId, err)
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
if partnerData.CompanyId != cmd.CompanyId {
|
|
|
e := fmt.Sprintf("合伙人(partnerId)的公司(companyId=%d)和传递的参数中的companyId 不一致", partnerData.CompanyId)
|
|
|
logs.Warning(e)
|
|
|
}
|
|
|
err = transactionContext.CommitTransaction()
|
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -311,7 +328,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
|
orderData.CompanyId = cmd.CompanyId
|
|
|
err = orderBestshopRepository.Edit(orderData)
|
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "添加order_bestshop失败:"+err.Error())
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "编辑order_bestshop失败:"+err.Error())
|
|
|
}
|
|
|
orderGoods, err = orderGoodBestshopRepository.Find(domain.OrderGoodBestshopFindQuery{
|
|
|
OrderId: orderData.Id,
|
...
|
...
|
|