|
@@ -717,7 +717,7 @@ func (service OrderInfoService) UpdateGoodBouns(cmd command.UpdateGoodBouns) err |
|
@@ -717,7 +717,7 @@ func (service OrderInfoService) UpdateGoodBouns(cmd command.UpdateGoodBouns) err |
717
|
}
|
717
|
}
|
718
|
|
718
|
|
719
|
//PageListOrderBouns 获取订单的分红列表
|
719
|
//PageListOrderBouns 获取订单的分红列表
|
720
|
-func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]domain.OrderBase, int, error) {
|
720
|
+func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) {
|
721
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
721
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
722
|
if err != nil {
|
722
|
if err != nil {
|
723
|
return nil, 0, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
723
|
return nil, 0, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
@@ -769,12 +769,21 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
@@ -769,12 +769,21 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
769
|
}
|
769
|
}
|
770
|
orders = append(orders, order)
|
770
|
orders = append(orders, order)
|
771
|
}
|
771
|
}
|
772
|
- var PartnerInfoRepository domain.PartnerInfoRepository
|
772
|
+ var (
|
|
|
773
|
+ PartnerInfoRepository domain.PartnerInfoRepository
|
|
|
774
|
+ orderGoodRepository domain.OrderGoodRepository
|
|
|
775
|
+ )
|
773
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
776
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
774
|
"transactionContext": transactionContext,
|
777
|
"transactionContext": transactionContext,
|
775
|
}); err != nil {
|
778
|
}); err != nil {
|
776
|
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
779
|
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
777
|
}
|
780
|
}
|
|
|
781
|
+ if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
|
|
|
782
|
+ "transactionContext": transactionContext,
|
|
|
783
|
+ }); err != nil {
|
|
|
784
|
+ return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
785
|
+ }
|
|
|
786
|
+ var resp []map[string]interface{}
|
778
|
for i := range orders {
|
787
|
for i := range orders {
|
779
|
partnerData := &domain.PartnerInfo{}
|
788
|
partnerData := &domain.PartnerInfo{}
|
780
|
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
789
|
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
|
@@ -785,12 +794,43 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
@@ -785,12 +794,43 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
785
|
} else {
|
794
|
} else {
|
786
|
orders[i].PartnerInfo = partnerData.Partner
|
795
|
orders[i].PartnerInfo = partnerData.Partner
|
787
|
}
|
796
|
}
|
|
|
797
|
+ var (
|
|
|
798
|
+ goods []domain.OrderGood
|
|
|
799
|
+ hasBonusPercent bool
|
|
|
800
|
+ )
|
|
|
801
|
+ goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id})
|
|
|
802
|
+ for ii := range goods {
|
|
|
803
|
+ if goods[ii].PartnerBonusPercent > 0 {
|
|
|
804
|
+ hasBonusPercent = true
|
|
|
805
|
+ }
|
|
|
806
|
+ }
|
|
|
807
|
+ listItem := map[string]interface{}{
|
|
|
808
|
+ "updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
809
|
+ "id": orders[i].Id,
|
|
|
810
|
+ "shipmentsId": orders[i].DeliveryCode,
|
|
|
811
|
+ "partner": orders[i].PartnerInfo.PartnerName,
|
|
|
812
|
+ "dividendsReceivable": fmt.Sprint(orders[i].GetCurrentPartnerBonus()),
|
|
|
813
|
+ "dividendSpending": fmt.Sprint(orders[i].OrderCompute.PartnerBonusExpense),
|
|
|
814
|
+ "receiveDividends": fmt.Sprint(orders[i].OrderCompute.PartnerBonusHas),
|
|
|
815
|
+ "uncollectedDividends": fmt.Sprint(orders[i].OrderCompute.PartnerBonusNot),
|
|
|
816
|
+ "stateOfPayment": orders[i].BonusStatus,
|
|
|
817
|
+ "orderType": orders[i].OrderType,
|
|
|
818
|
+ "orderTypeName": domain.GetOrderBaseTypeName(orders[i].OrderType),
|
|
|
819
|
+ "orderNumber": orders[i].OrderCode,
|
|
|
820
|
+ }
|
|
|
821
|
+ if !hasBonusPercent {
|
|
|
822
|
+ listItem["receiveDividends"] = "-"
|
|
|
823
|
+ listItem["dividendsReceivable"] = "-"
|
|
|
824
|
+ listItem["dividendSpending"] = "-"
|
|
|
825
|
+ listItem["uncollectedDividends"] = "-"
|
|
|
826
|
+ }
|
|
|
827
|
+ resp = append(resp, listItem)
|
788
|
}
|
828
|
}
|
789
|
err = transactionContext.CommitTransaction()
|
829
|
err = transactionContext.CommitTransaction()
|
790
|
if err != nil {
|
830
|
if err != nil {
|
791
|
- return orders, cnt, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
831
|
+ return resp, cnt, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
792
|
}
|
832
|
}
|
793
|
- return orders, cnt, nil
|
833
|
+ return resp, cnt, nil
|
794
|
}
|
834
|
}
|
795
|
|
835
|
|
796
|
//GetOrderBestshopInfo 获取来源于xiangmi订单的详情以及分红数据
|
836
|
//GetOrderBestshopInfo 获取来源于xiangmi订单的详情以及分红数据
|