作者 唐旭辉

更新

@@ -44,6 +44,8 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests @@ -44,6 +44,8 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests
44 var ( 44 var (
45 orderBestshopDao *dao.OrderBestshopDao 45 orderBestshopDao *dao.OrderBestshopDao
46 orderExist bool 46 orderExist bool
  47 + partnerRepository domain.PartnerInfoRepository
  48 + partnerData *domain.PartnerInfo
47 ) 49 )
48 if orderBestshopDao, err = factory.CreateOrderBestshopDao(map[string]interface{}{ 50 if orderBestshopDao, err = factory.CreateOrderBestshopDao(map[string]interface{}{
49 "transactionContext": transactionContext, 51 "transactionContext": transactionContext,
@@ -54,6 +56,21 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests @@ -54,6 +56,21 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests
54 if err != nil { 56 if err != nil {
55 return lib.ThrowError(lib.TRANSACTION_ERROR, "orderBestshopDao.OrderExist err:"+err.Error()) 57 return lib.ThrowError(lib.TRANSACTION_ERROR, "orderBestshopDao.OrderExist err:"+err.Error())
56 } 58 }
  59 + //数据检查
  60 + if partnerRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
  61 + "transactionContext": transactionContext,
  62 + }); err != nil {
  63 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  64 + }
  65 + partnerData, err = partnerRepository.FindOne(domain.PartnerFindOneQuery{UserId: cmd.PartnerId})
  66 + if err != nil {
  67 + e := fmt.Sprintf("未找到指定的合伙人(id=%d)数据,%s", cmd.PartnerId, err)
  68 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  69 + }
  70 + if partnerData.CompanyId != cmd.CompanyId {
  71 + e := fmt.Sprintf("合伙人(partnerId)的公司(companyId=%d)和传递的参数中的companyId 不一致", partnerData.CompanyId)
  72 + logs.Warning(e)
  73 + }
57 err = transactionContext.CommitTransaction() 74 err = transactionContext.CommitTransaction()
58 if err != nil { 75 if err != nil {
59 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 76 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
@@ -311,7 +328,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes @@ -311,7 +328,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes
311 orderData.CompanyId = cmd.CompanyId 328 orderData.CompanyId = cmd.CompanyId
312 err = orderBestshopRepository.Edit(orderData) 329 err = orderBestshopRepository.Edit(orderData)
313 if err != nil { 330 if err != nil {
314 - return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "添加order_bestshop失败:"+err.Error()) 331 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "编辑order_bestshop失败:"+err.Error())
315 } 332 }
316 orderGoods, err = orderGoodBestshopRepository.Find(domain.OrderGoodBestshopFindQuery{ 333 orderGoods, err = orderGoodBestshopRepository.Find(domain.OrderGoodBestshopFindQuery{
317 OrderId: orderData.Id, 334 OrderId: orderData.Id,