...
|
...
|
@@ -717,7 +717,7 @@ func (service OrderInfoService) UpdateGoodBouns(cmd command.UpdateGoodBouns) err |
|
|
}
|
|
|
|
|
|
//PageListOrderBouns 获取订单的分红列表
|
|
|
func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]domain.OrderBase, int, error) {
|
|
|
func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, 0, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -769,12 +769,21 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
|
}
|
|
|
orders = append(orders, order)
|
|
|
}
|
|
|
var PartnerInfoRepository domain.PartnerInfoRepository
|
|
|
var (
|
|
|
PartnerInfoRepository domain.PartnerInfoRepository
|
|
|
orderGoodRepository domain.OrderGoodRepository
|
|
|
)
|
|
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
var resp []map[string]interface{}
|
|
|
for i := range orders {
|
|
|
partnerData := &domain.PartnerInfo{}
|
|
|
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
...
|
...
|
@@ -785,12 +794,43 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
|
} else {
|
|
|
orders[i].PartnerInfo = partnerData.Partner
|
|
|
}
|
|
|
var (
|
|
|
goods []domain.OrderGood
|
|
|
hasBonusPercent bool
|
|
|
)
|
|
|
goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id})
|
|
|
for ii := range goods {
|
|
|
if goods[ii].PartnerBonusPercent > 0 {
|
|
|
hasBonusPercent = true
|
|
|
}
|
|
|
}
|
|
|
listItem := map[string]interface{}{
|
|
|
"updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
"id": orders[i].Id,
|
|
|
"shipmentsId": orders[i].DeliveryCode,
|
|
|
"partner": orders[i].PartnerInfo.PartnerName,
|
|
|
"dividendsReceivable": fmt.Sprint(orders[i].GetCurrentPartnerBonus()),
|
|
|
"dividendSpending": fmt.Sprint(orders[i].OrderCompute.PartnerBonusExpense),
|
|
|
"receiveDividends": fmt.Sprint(orders[i].OrderCompute.PartnerBonusHas),
|
|
|
"uncollectedDividends": fmt.Sprint(orders[i].OrderCompute.PartnerBonusNot),
|
|
|
"stateOfPayment": orders[i].BonusStatus,
|
|
|
"orderType": orders[i].OrderType,
|
|
|
"orderTypeName": domain.GetOrderBaseTypeName(orders[i].OrderType),
|
|
|
"orderNumber": orders[i].OrderCode,
|
|
|
}
|
|
|
if !hasBonusPercent {
|
|
|
listItem["receiveDividends"] = "-"
|
|
|
listItem["dividendsReceivable"] = "-"
|
|
|
listItem["dividendSpending"] = "-"
|
|
|
listItem["uncollectedDividends"] = "-"
|
|
|
}
|
|
|
resp = append(resp, listItem)
|
|
|
}
|
|
|
err = transactionContext.CommitTransaction()
|
|
|
if err != nil {
|
|
|
return orders, cnt, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
return resp, cnt, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
return orders, cnt, nil
|
|
|
return resp, cnt, nil
|
|
|
}
|
|
|
|
|
|
//GetOrderBestshopInfo 获取来源于xiangmi订单的详情以及分红数据
|
...
|
...
|
|