...
|
...
|
@@ -255,11 +255,20 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst |
|
|
}); err4 != nil {
|
|
|
return nil, err4
|
|
|
} else {
|
|
|
// orderGoodIds去重
|
|
|
newOrderGoodIds := utils.RemoveDuplicationInt64(orderGoodIds)
|
|
|
|
|
|
if countDividendsOrder > 0 {
|
|
|
for i, order := range orders {
|
|
|
if len(order.Goods) == len(orderGoodIds) { // 1.全部产品取消分红预算
|
|
|
goods := make([]*domain.OrderGood, 0)
|
|
|
for _, good := range order.Goods {
|
|
|
if good.OrderGoodDividendsStatus == 2 {
|
|
|
goods = append(goods, good)
|
|
|
}
|
|
|
}
|
|
|
if len(goods) == len(newOrderGoodIds) { // 1.已分红的产品数量等于取消的产品数量,订单分红状态变更为未分红
|
|
|
orders[i].DividendStatus = 1
|
|
|
} else if len(order.Goods) > len(orderGoodIds) { // 3.部分产品被取消分红预算
|
|
|
} else if len(goods) > len(newOrderGoodIds) { // 3.已分红的产品数量大于被取消分红的产品数量,订单分红状态变更为部分分红
|
|
|
orders[i].DividendStatus = 3
|
|
|
}
|
|
|
orders[i].DividendStatus = order.DividendStatus
|
...
|
...
|
|