作者 唐旭辉

bug 修复

... ... @@ -56,8 +56,8 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE
Title: "调整商品数量",
Item: currentEvent.GoodName,
Action: []string{
fmt.Sprintf("购买数量由%s调整为%s", currentEvent.FormerNumber, currentEvent.NewNumber),
fmt.Sprintf("商品总价由¥%s调整为¥%s", currentEvent.FormerAmount, currentEvent.NewAmount),
fmt.Sprintf(`购买数量由"%s"调整为"%s"`, currentEvent.FormerNumber, currentEvent.NewNumber),
fmt.Sprintf(`商品总价由"¥%s"调整为"¥%s"`, currentEvent.FormerAmount, currentEvent.NewAmount),
},
},
},
... ... @@ -85,8 +85,8 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE
Title: "合伙人分红比例",
Item: currentEvent.GoodName,
Action: []string{
fmt.Sprintf("分红比例由%s调整为%s", currentEvent.FormerPartnerBonusPercent, currentEvent.NewPartnerBonusPercent),
fmt.Sprintf("应收分红由¥%s调整为¥%s", currentEvent.FormerPartnerBonus, currentEvent.NewPartnerBonus),
fmt.Sprintf(`分红比例由"%s"调整为"%s"`, currentEvent.FormerPartnerBonusPercent, currentEvent.NewPartnerBonusPercent),
fmt.Sprintf(`应收分红由"¥%s"调整为"¥%s"`, currentEvent.FormerPartnerBonus, currentEvent.NewPartnerBonus),
},
},
},
... ... @@ -140,7 +140,7 @@ func (subscriber *OrderLogSubscriber) HandleEvent(domainEvent coreDomain.DomainE
Title: "支付分红",
Item: currentEvent.GoodName,
Action: []string{
fmt.Sprintf("支付分红¥%.2f", currentEvent.PartnerBonus),
fmt.Sprintf(`支付分红"¥%.2f"`, currentEvent.PartnerBonus),
},
},
},
... ...
... ... @@ -31,7 +31,11 @@ func (o *OrderGoodWithBestshop) UpdateBonusByPertnerBonusPercent(good *OrderGood
func (o *OrderGoodWithBestshop) PayPartnerBonus(good *OrderGood) error {
o.currentBonusStatus = OrderGoodBonusBestshopHasPay{}
err := good.CurrentBonusStatus.PayPartnerBonus(good)
err := good.Compute()
if err != nil {
return errors.New("核算商品数据失败" + err.Error())
}
err = good.CurrentBonusStatus.PayPartnerBonus(good)
return err
}
... ... @@ -55,14 +59,22 @@ var _ OrderGoodWithBestshopBonusStatus = (*OrderGoodBonusBestshopWaitPay)(nil)
func (waitPay OrderGoodBonusBestshopWaitPay) UpdateOrderGoodNumber(good *OrderGood, number int) error {
good.UseGoodNumber = number
//待支付状态计算
err := good.CurrentBonusStatus.WartPayPartnerBonus(good)
err := good.Compute()
if err != nil {
return errors.New("核算商品数据失败" + err.Error())
}
err = good.CurrentBonusStatus.WartPayPartnerBonus(good)
return err
}
func (waitPay OrderGoodBonusBestshopWaitPay) UpdatePertnerBonusPercent(good *OrderGood, percent float64) error {
good.PartnerBonusPercent = percent
//待支付状态计算
err := good.CurrentBonusStatus.WartPayPartnerBonus(good)
err := good.Compute()
if err != nil {
return errors.New("核算商品数据失败" + err.Error())
}
err = good.CurrentBonusStatus.WartPayPartnerBonus(good)
return err
}
... ...
... ... @@ -82,15 +82,12 @@ func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId i
updateGood = oldOrder.Goods[i]
formerNumber = updateGood.GetCurrentGoodNumber()
formerAmount = updateGood.GetCurrentAmount()
err := new(domain.OrderGoodWithBestshop).UpdateBonusByGoodNumber(&updateGood, goodWithNumber)
err := new(domain.OrderGoodWithBestshop).
UpdateBonusByGoodNumber(&updateGood, goodWithNumber)
if err != nil {
return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
}
updateGood.RemarkReason.ModifyGoodNumber = reason
//计算
if err := updateGood.Compute(); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "核算商品数据失败"+err.Error())
}
newAmount = updateGood.GetCurrentAmount()
goodExist = true
oldOrder.Goods[i] = updateGood
... ... @@ -185,15 +182,12 @@ func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64,
updateGood = oldOrder.Goods[i]
formerPartnerBonusPercent = updateGood.PartnerBonusPercent
formerPartnerBonus = updateGood.GetCurrentPartnerBonus()
err := new(domain.OrderGoodWithBestshop).UpdateBonusByPertnerBonusPercent(&updateGood, partnerPercent)
err := new(domain.OrderGoodWithBestshop).
UpdateBonusByPertnerBonusPercent(&updateGood, partnerPercent)
if err != nil {
return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
}
updateGood.RemarkReason.ModifyPartnerBonusPercent = reason
//计算
if err := updateGood.Compute(); err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "核算商品数据失败"+err.Error())
}
newPartnerBonus = updateGood.GetCurrentPartnerBonus()
goodExist = true
oldOrder.Goods[i] = updateGood
... ... @@ -289,10 +283,6 @@ func (serve *OrderBonusService) PayOrderGoodBonus(orderId int64, goodId int64, a
if err != nil {
return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
}
//计算
if err := updateGood.Compute(); err != nil {
return errors.New("核算商品数据失败" + err.Error())
}
goodExist = true
oldOrder.Goods[i] = updateGood
}
... ...