作者 唐旭辉

更新注释

... ... @@ -16,7 +16,7 @@ import (
//从其他系统接收订单数据
const (
BEST_SHOP_UNIONID string = "gh_18eb644002fb" //海鲜干货小程序原始id
BEST_SHOP_UNIONID string = "gh_18eb644002fb" //香米小程序原始id
)
type SyncOrderService struct {
... ... @@ -79,6 +79,7 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests
//
logs.Warning("订单数据已存在:order_code=%s", cmd.OrderCode)
} else {
//复制数据到order_base表
err = s.CreateOrderFromBestshop(cmd)
}
return err
... ... @@ -225,6 +226,8 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
}
for _, v := range companyData.Applets {
//BEST_SHOP_UNIONID string = "gh_18eb644002fb" //香米小程序原始id
//接收香米小程序的订单数据
if len(v.Id) > 0 {
canCopyOrder = true
}
... ... @@ -237,7 +240,7 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
orderbase domain.OrderBase
ordergoods []domain.OrderGood
)
//TODO 添加orderBase
//添加orderBase
orderBestshop.CopyToOrderBase(&orderbase)
orderbase.CompanyId = companyData.Id
for i := range orderBestshop.Goods {
... ... @@ -245,13 +248,15 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
orderBestshop.Goods[i].CopyToOrderGood(&good)
good.CompanyId = partnerData.CompanyId
good.Compute()
//初始接收的订单按照待支付状态处理
good.CurrentBonusStatus.WartPayPartnerBonus(&good)
ordergoods = append(ordergoods, good)
}
orderbase.Goods = ordergoods
orderbase.PartnerId = partnerData.Partner.Id
orderbase.CompanyId = partnerData.CompanyId
orderbase.PartnerCategory = domain.PartnerCategory{Id: 1, Name: "事业合伙人"} // 默认设定为事业合伙人订单
// 默认设定为事业合伙人订单
orderbase.PartnerCategory = domain.PartnerCategory{Id: 1, Name: "事业合伙人"}
orderbase.Compute()
err = orderBaseRepository.Save(&orderbase)
if err != nil {
... ...
... ... @@ -311,6 +311,7 @@ func (good *OrderGood) Compute() error {
planamount := price.Mul(decimal.NewFromInt(int64(planGoodNumber)))
var partnerBonusPercent float64
if good.PartnerBonusPercent < 0 {
//判断合伙人分成比例是否设置,若未设置则按照 0 来计算分成
partnerBonusPercent = 0
} else {
partnerBonusPercent = good.PartnerBonusPercent
... ...