|
@@ -2,7 +2,6 @@ package service |
|
@@ -2,7 +2,6 @@ package service |
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
4
|
"fmt"
|
4
|
"fmt"
|
5
|
- "time"
|
|
|
6
|
|
5
|
|
7
|
"github.com/astaxie/beego/logs"
|
6
|
"github.com/astaxie/beego/logs"
|
8
|
|
7
|
|
|
@@ -536,108 +535,108 @@ func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, |
|
@@ -536,108 +535,108 @@ func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, |
536
|
}
|
535
|
}
|
537
|
|
536
|
|
538
|
//Delivery 发货
|
537
|
//Delivery 发货
|
539
|
-func (service OrderInfoService) Delivery(cmd command.OrderDeliveryCommand) error {
|
|
|
540
|
- var (
|
|
|
541
|
- transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
542
|
- err error
|
|
|
543
|
- )
|
|
|
544
|
- if err = transactionContext.StartTransaction(); err != nil {
|
|
|
545
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
546
|
- }
|
|
|
547
|
- defer func() {
|
|
|
548
|
- transactionContext.RollbackTransaction()
|
|
|
549
|
- }()
|
|
|
550
|
- var (
|
|
|
551
|
- orderBaseRepository domain.OrderBaseRepository
|
|
|
552
|
- orderGoodRepository domain.OrderGoodRepository
|
|
|
553
|
- oldOrderData *domain.OrderBase
|
|
|
554
|
- oldOrderGoods []domain.OrderGood
|
|
|
555
|
- orderBaseDao *dao.OrderBaseDao
|
|
|
556
|
- )
|
538
|
+// func (service OrderInfoService) Delivery(cmd command.OrderDeliveryCommand) error {
|
|
|
539
|
+// var (
|
|
|
540
|
+// transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
541
|
+// err error
|
|
|
542
|
+// )
|
|
|
543
|
+// if err = transactionContext.StartTransaction(); err != nil {
|
|
|
544
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
545
|
+// }
|
|
|
546
|
+// defer func() {
|
|
|
547
|
+// transactionContext.RollbackTransaction()
|
|
|
548
|
+// }()
|
|
|
549
|
+// var (
|
|
|
550
|
+// orderBaseRepository domain.OrderBaseRepository
|
|
|
551
|
+// orderGoodRepository domain.OrderGoodRepository
|
|
|
552
|
+// oldOrderData *domain.OrderBase
|
|
|
553
|
+// oldOrderGoods []domain.OrderGood
|
|
|
554
|
+// orderBaseDao *dao.OrderBaseDao
|
|
|
555
|
+// )
|
557
|
|
556
|
|
558
|
- if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
|
|
|
559
|
- "transactionContext": transactionContext,
|
|
|
560
|
- }); err != nil {
|
|
|
561
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
562
|
- }
|
|
|
563
|
- if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
|
|
|
564
|
- "transactionContext": transactionContext,
|
|
|
565
|
- }); err != nil {
|
|
|
566
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
567
|
- }
|
|
|
568
|
- //获取旧的订单
|
|
|
569
|
- oldOrderData, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{
|
|
|
570
|
- CompanyId: cmd.CompanyId,
|
|
|
571
|
- OrderId: cmd.OrderId,
|
|
|
572
|
- })
|
|
|
573
|
- if err != nil {
|
|
|
574
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单:%s", err))
|
|
|
575
|
- }
|
|
|
576
|
- if oldOrderData.OrderType != domain.OrderIntention {
|
|
|
577
|
- return lib.ThrowError(lib.BUSINESS_ERROR, "订单类型已发生变更")
|
|
|
578
|
- }
|
|
|
579
|
- if orderBaseDao, err = factory.CreateOrderBaseDao(map[string]interface{}{
|
|
|
580
|
- "transactionContext": transactionContext,
|
|
|
581
|
- }); err != nil {
|
|
|
582
|
- return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
583
|
- }
|
|
|
584
|
- //检查delivery_code是否重复
|
|
|
585
|
- if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId, cmd.OrderId); err != nil {
|
|
|
586
|
- return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
587
|
- } else if ok {
|
|
|
588
|
- return lib.ThrowError(lib.BUSINESS_ERROR, "发货号已存在")
|
|
|
589
|
- }
|
|
|
590
|
- //获取旧的订单中的商品
|
|
|
591
|
- oldOrderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
|
|
|
592
|
- OrderId: cmd.OrderId,
|
|
|
593
|
- CompanyId: cmd.CompanyId,
|
|
|
594
|
- })
|
|
|
595
|
- if err != nil {
|
|
|
596
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单中的商品列表失败:%s", err))
|
|
|
597
|
- }
|
|
|
598
|
- for _, newGood := range cmd.Goods {
|
|
|
599
|
- for i := range oldOrderGoods {
|
|
|
600
|
- if newGood.Id != oldOrderGoods[i].Id {
|
|
|
601
|
- continue
|
|
|
602
|
- }
|
|
|
603
|
- oldOrderGoods[i].GoodName = newGood.GoodName
|
|
|
604
|
- oldOrderGoods[i].PlanGoodNumber = newGood.PlanGoodNumber
|
|
|
605
|
- oldOrderGoods[i].Price = newGood.Price
|
|
|
606
|
- oldOrderGoods[i].PartnerBonusPercent = newGood.PartnerBonusPercent
|
|
|
607
|
- oldOrderGoods[i].Remark = newGood.Remark
|
|
|
608
|
- err = oldOrderGoods[i].Compute()
|
|
|
609
|
- if err != nil {
|
|
|
610
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的数值失败:%s", err))
|
|
|
611
|
- }
|
|
|
612
|
- err = oldOrderGoods[i].CurrentBonusStatus.WartPayPartnerBonus(&oldOrderGoods[i])
|
|
|
613
|
- if err != nil {
|
|
|
614
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的分红数值失败:%s", err))
|
|
|
615
|
- }
|
|
|
616
|
- }
|
|
|
617
|
- }
|
|
|
618
|
- oldOrderData.DeliveryCode = cmd.DeliveryCode
|
|
|
619
|
- oldOrderData.DeliveryTime = time.Now()
|
|
|
620
|
- oldOrderData.Goods = oldOrderGoods
|
|
|
621
|
- //变更订单类型
|
|
|
622
|
- oldOrderData.OrderType = domain.OrderReal
|
|
|
623
|
- err = oldOrderData.Compute()
|
|
|
624
|
- if err != nil {
|
|
|
625
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中合计的数值失败:%s", err))
|
|
|
626
|
- }
|
|
|
627
|
- err = orderBaseRepository.Save(oldOrderData)
|
|
|
628
|
- if err != nil {
|
|
|
629
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单数据失败:%s", err))
|
|
|
630
|
- }
|
|
|
631
|
- err = orderGoodRepository.Save(oldOrderGoods)
|
|
|
632
|
- if err != nil {
|
|
|
633
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单中的商品数据失败:%s", err))
|
|
|
634
|
- }
|
|
|
635
|
- err = transactionContext.CommitTransaction()
|
|
|
636
|
- if err != nil {
|
|
|
637
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
638
|
- }
|
|
|
639
|
- return nil
|
|
|
640
|
-}
|
557
|
+// if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
|
|
|
558
|
+// "transactionContext": transactionContext,
|
|
|
559
|
+// }); err != nil {
|
|
|
560
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
561
|
+// }
|
|
|
562
|
+// if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
|
|
|
563
|
+// "transactionContext": transactionContext,
|
|
|
564
|
+// }); err != nil {
|
|
|
565
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
566
|
+// }
|
|
|
567
|
+// //获取旧的订单
|
|
|
568
|
+// oldOrderData, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{
|
|
|
569
|
+// CompanyId: cmd.CompanyId,
|
|
|
570
|
+// OrderId: cmd.OrderId,
|
|
|
571
|
+// })
|
|
|
572
|
+// if err != nil {
|
|
|
573
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单:%s", err))
|
|
|
574
|
+// }
|
|
|
575
|
+// if oldOrderData.OrderType != domain.OrderIntention {
|
|
|
576
|
+// return lib.ThrowError(lib.BUSINESS_ERROR, "订单类型已发生变更")
|
|
|
577
|
+// }
|
|
|
578
|
+// if orderBaseDao, err = factory.CreateOrderBaseDao(map[string]interface{}{
|
|
|
579
|
+// "transactionContext": transactionContext,
|
|
|
580
|
+// }); err != nil {
|
|
|
581
|
+// return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
582
|
+// }
|
|
|
583
|
+// //检查delivery_code是否重复
|
|
|
584
|
+// if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId, cmd.OrderId); err != nil {
|
|
|
585
|
+// return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
586
|
+// } else if ok {
|
|
|
587
|
+// return lib.ThrowError(lib.BUSINESS_ERROR, "发货号已存在")
|
|
|
588
|
+// }
|
|
|
589
|
+// //获取旧的订单中的商品
|
|
|
590
|
+// oldOrderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
|
|
|
591
|
+// OrderId: cmd.OrderId,
|
|
|
592
|
+// CompanyId: cmd.CompanyId,
|
|
|
593
|
+// })
|
|
|
594
|
+// if err != nil {
|
|
|
595
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单中的商品列表失败:%s", err))
|
|
|
596
|
+// }
|
|
|
597
|
+// for _, newGood := range cmd.Goods {
|
|
|
598
|
+// for i := range oldOrderGoods {
|
|
|
599
|
+// if newGood.Id != oldOrderGoods[i].Id {
|
|
|
600
|
+// continue
|
|
|
601
|
+// }
|
|
|
602
|
+// oldOrderGoods[i].GoodName = newGood.GoodName
|
|
|
603
|
+// oldOrderGoods[i].PlanGoodNumber = newGood.PlanGoodNumber
|
|
|
604
|
+// oldOrderGoods[i].Price = newGood.Price
|
|
|
605
|
+// oldOrderGoods[i].PartnerBonusPercent = newGood.PartnerBonusPercent
|
|
|
606
|
+// oldOrderGoods[i].Remark = newGood.Remark
|
|
|
607
|
+// err = oldOrderGoods[i].Compute()
|
|
|
608
|
+// if err != nil {
|
|
|
609
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的数值失败:%s", err))
|
|
|
610
|
+// }
|
|
|
611
|
+// err = oldOrderGoods[i].CurrentBonusStatus.WartPayPartnerBonus(&oldOrderGoods[i])
|
|
|
612
|
+// if err != nil {
|
|
|
613
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的分红数值失败:%s", err))
|
|
|
614
|
+// }
|
|
|
615
|
+// }
|
|
|
616
|
+// }
|
|
|
617
|
+// oldOrderData.DeliveryCode = cmd.DeliveryCode
|
|
|
618
|
+// oldOrderData.DeliveryTime = time.Now()
|
|
|
619
|
+// oldOrderData.Goods = oldOrderGoods
|
|
|
620
|
+// //变更订单类型
|
|
|
621
|
+// oldOrderData.OrderType = domain.OrderReal
|
|
|
622
|
+// err = oldOrderData.Compute()
|
|
|
623
|
+// if err != nil {
|
|
|
624
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中合计的数值失败:%s", err))
|
|
|
625
|
+// }
|
|
|
626
|
+// err = orderBaseRepository.Save(oldOrderData)
|
|
|
627
|
+// if err != nil {
|
|
|
628
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单数据失败:%s", err))
|
|
|
629
|
+// }
|
|
|
630
|
+// err = orderGoodRepository.Save(oldOrderGoods)
|
|
|
631
|
+// if err != nil {
|
|
|
632
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单中的商品数据失败:%s", err))
|
|
|
633
|
+// }
|
|
|
634
|
+// err = transactionContext.CommitTransaction()
|
|
|
635
|
+// if err != nil {
|
|
|
636
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
637
|
+// }
|
|
|
638
|
+// return nil
|
|
|
639
|
+// }
|
641
|
|
640
|
|
642
|
//DisableOrEnable 开启关闭订单
|
641
|
//DisableOrEnable 开启关闭订单
|
643
|
func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) error {
|
642
|
func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) error {
|
|
@@ -684,100 +683,100 @@ func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) |
|
@@ -684,100 +683,100 @@ func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) |
684
|
}
|
683
|
}
|
685
|
|
684
|
|
686
|
//UpdateGoodBouns 分红时,更新货品的分红相关的数值
|
685
|
//UpdateGoodBouns 分红时,更新货品的分红相关的数值
|
687
|
-func (service OrderInfoService) UpdateGoodBouns(cmd command.UpdateGoodBouns) error {
|
|
|
688
|
- var (
|
|
|
689
|
- transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
690
|
- err error
|
|
|
691
|
- )
|
|
|
692
|
- if err = transactionContext.StartTransaction(); err != nil {
|
|
|
693
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
694
|
- }
|
|
|
695
|
- defer func() {
|
|
|
696
|
- transactionContext.RollbackTransaction()
|
|
|
697
|
- }()
|
|
|
698
|
- var (
|
|
|
699
|
- orderBaseRepository domain.OrderBaseRepository
|
|
|
700
|
- orderGoodRepository domain.OrderGoodRepository
|
|
|
701
|
- oldOrderData *domain.OrderBase
|
|
|
702
|
- oldOrderGoods []domain.OrderGood
|
|
|
703
|
- )
|
|
|
704
|
- if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
|
|
|
705
|
- "transactionContext": transactionContext,
|
|
|
706
|
- }); err != nil {
|
|
|
707
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
708
|
- }
|
|
|
709
|
- if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
|
|
|
710
|
- "transactionContext": transactionContext,
|
|
|
711
|
- }); err != nil {
|
|
|
712
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
713
|
- }
|
|
|
714
|
- //获取旧的订单
|
|
|
715
|
- oldOrderData, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{
|
|
|
716
|
- OrderId: cmd.Id,
|
|
|
717
|
- CompanyId: cmd.CompanyId,
|
|
|
718
|
- })
|
|
|
719
|
- if err != nil {
|
|
|
720
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单:%s", err))
|
|
|
721
|
- }
|
|
|
722
|
- if oldOrderData.OrderType != domain.OrderReal {
|
|
|
723
|
- return lib.ThrowError(lib.BUSINESS_ERROR, fmt.Sprintf("指定的订单的订单类型发生变更"))
|
|
|
724
|
- }
|
|
|
725
|
- //获取旧的订单中的商品
|
|
|
726
|
- oldOrderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
|
|
|
727
|
- OrderId: cmd.Id,
|
|
|
728
|
- })
|
|
|
729
|
- if err != nil {
|
|
|
730
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单中的商品列表失败:%s", err))
|
|
|
731
|
- }
|
|
|
732
|
- for _, newGood := range cmd.GoodBouns {
|
|
|
733
|
- for i := range oldOrderGoods {
|
|
|
734
|
- if newGood.GoodId != oldOrderGoods[i].Id {
|
|
|
735
|
- continue
|
|
|
736
|
- }
|
|
|
737
|
- oldOrderGoods[i].UseGoodNumber = newGood.UseGoodNumber
|
|
|
738
|
- oldOrderGoods[i].Remark = newGood.Remark
|
|
|
739
|
- oldOrderGoods[i].BonusStatus = newGood.BounsStatus
|
|
|
740
|
- err = oldOrderGoods[i].Compute()
|
|
|
741
|
- if err != nil {
|
|
|
742
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的数值失败:%s", err))
|
|
|
743
|
- }
|
|
|
744
|
- switch newGood.BounsStatus {
|
|
|
745
|
- case domain.OrderGoodWaitPay:
|
|
|
746
|
- err = oldOrderGoods[i].CurrentBonusStatus.WartPayPartnerBonus(&oldOrderGoods[i])
|
|
|
747
|
- if err != nil {
|
|
|
748
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的分红数值失败:%s", err))
|
|
|
749
|
- }
|
|
|
750
|
- case domain.OrderGoodHasPay:
|
|
|
751
|
- err = oldOrderGoods[i].CurrentBonusStatus.PayPartnerBonus(&oldOrderGoods[i])
|
|
|
752
|
- if err != nil {
|
|
|
753
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的分红数值失败:%s", err))
|
|
|
754
|
- }
|
|
|
755
|
- default:
|
|
|
756
|
- return lib.ThrowError(lib.ARG_ERROR, fmt.Sprintf("货品的支付状态错误"))
|
|
|
757
|
- }
|
|
|
758
|
- }
|
|
|
759
|
- }
|
|
|
760
|
- oldOrderData.Goods = oldOrderGoods
|
686
|
+// func (service OrderInfoService) UpdateGoodBouns(cmd command.UpdateGoodBouns) error {
|
|
|
687
|
+// var (
|
|
|
688
|
+// transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
689
|
+// err error
|
|
|
690
|
+// )
|
|
|
691
|
+// if err = transactionContext.StartTransaction(); err != nil {
|
|
|
692
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
693
|
+// }
|
|
|
694
|
+// defer func() {
|
|
|
695
|
+// transactionContext.RollbackTransaction()
|
|
|
696
|
+// }()
|
|
|
697
|
+// var (
|
|
|
698
|
+// orderBaseRepository domain.OrderBaseRepository
|
|
|
699
|
+// orderGoodRepository domain.OrderGoodRepository
|
|
|
700
|
+// oldOrderData *domain.OrderBase
|
|
|
701
|
+// oldOrderGoods []domain.OrderGood
|
|
|
702
|
+// )
|
|
|
703
|
+// if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
|
|
|
704
|
+// "transactionContext": transactionContext,
|
|
|
705
|
+// }); err != nil {
|
|
|
706
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
707
|
+// }
|
|
|
708
|
+// if orderGoodRepository, err = factory.CreateOrderGoodRepository(map[string]interface{}{
|
|
|
709
|
+// "transactionContext": transactionContext,
|
|
|
710
|
+// }); err != nil {
|
|
|
711
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
712
|
+// }
|
|
|
713
|
+// //获取旧的订单
|
|
|
714
|
+// oldOrderData, err = orderBaseRepository.FindOne(domain.OrderBaseFindOneQuery{
|
|
|
715
|
+// OrderId: cmd.Id,
|
|
|
716
|
+// CompanyId: cmd.CompanyId,
|
|
|
717
|
+// })
|
|
|
718
|
+// if err != nil {
|
|
|
719
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单:%s", err))
|
|
|
720
|
+// }
|
|
|
721
|
+// if oldOrderData.OrderType != domain.OrderReal {
|
|
|
722
|
+// return lib.ThrowError(lib.BUSINESS_ERROR, fmt.Sprintf("指定的订单的订单类型发生变更"))
|
|
|
723
|
+// }
|
|
|
724
|
+// //获取旧的订单中的商品
|
|
|
725
|
+// oldOrderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
|
|
|
726
|
+// OrderId: cmd.Id,
|
|
|
727
|
+// })
|
|
|
728
|
+// if err != nil {
|
|
|
729
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("未找到指定的订单中的商品列表失败:%s", err))
|
|
|
730
|
+// }
|
|
|
731
|
+// for _, newGood := range cmd.GoodBouns {
|
|
|
732
|
+// for i := range oldOrderGoods {
|
|
|
733
|
+// if newGood.GoodId != oldOrderGoods[i].Id {
|
|
|
734
|
+// continue
|
|
|
735
|
+// }
|
|
|
736
|
+// oldOrderGoods[i].UseGoodNumber = newGood.UseGoodNumber
|
|
|
737
|
+// oldOrderGoods[i].Remark = newGood.Remark
|
|
|
738
|
+// oldOrderGoods[i].BonusStatus = newGood.BounsStatus
|
|
|
739
|
+// err = oldOrderGoods[i].Compute()
|
|
|
740
|
+// if err != nil {
|
|
|
741
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的数值失败:%s", err))
|
|
|
742
|
+// }
|
|
|
743
|
+// switch newGood.BounsStatus {
|
|
|
744
|
+// case domain.OrderGoodWaitPay:
|
|
|
745
|
+// err = oldOrderGoods[i].CurrentBonusStatus.WartPayPartnerBonus(&oldOrderGoods[i])
|
|
|
746
|
+// if err != nil {
|
|
|
747
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的分红数值失败:%s", err))
|
|
|
748
|
+// }
|
|
|
749
|
+// case domain.OrderGoodHasPay:
|
|
|
750
|
+// err = oldOrderGoods[i].CurrentBonusStatus.PayPartnerBonus(&oldOrderGoods[i])
|
|
|
751
|
+// if err != nil {
|
|
|
752
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中商品的分红数值失败:%s", err))
|
|
|
753
|
+// }
|
|
|
754
|
+// default:
|
|
|
755
|
+// return lib.ThrowError(lib.ARG_ERROR, fmt.Sprintf("货品的支付状态错误"))
|
|
|
756
|
+// }
|
|
|
757
|
+// }
|
|
|
758
|
+// }
|
|
|
759
|
+// oldOrderData.Goods = oldOrderGoods
|
761
|
|
760
|
|
762
|
- err = oldOrderData.Compute()
|
|
|
763
|
- if err != nil {
|
|
|
764
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中合计的数值失败:%s", err))
|
|
|
765
|
- }
|
|
|
766
|
- err = orderBaseRepository.Save(oldOrderData)
|
|
|
767
|
- if err != nil {
|
|
|
768
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单数据失败:%s", err))
|
|
|
769
|
- }
|
|
|
770
|
- err = orderGoodRepository.Save(oldOrderGoods)
|
|
|
771
|
- if err != nil {
|
|
|
772
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单中的商品数据失败:%s", err))
|
|
|
773
|
- }
|
|
|
774
|
- err = transactionContext.CommitTransaction()
|
|
|
775
|
- if err != nil {
|
|
|
776
|
- return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
777
|
- }
|
|
|
778
|
- return nil
|
761
|
+// err = oldOrderData.Compute()
|
|
|
762
|
+// if err != nil {
|
|
|
763
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("核算订单中合计的数值失败:%s", err))
|
|
|
764
|
+// }
|
|
|
765
|
+// err = orderBaseRepository.Save(oldOrderData)
|
|
|
766
|
+// if err != nil {
|
|
|
767
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单数据失败:%s", err))
|
|
|
768
|
+// }
|
|
|
769
|
+// err = orderGoodRepository.Save(oldOrderGoods)
|
|
|
770
|
+// if err != nil {
|
|
|
771
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, fmt.Sprintf("保存订单中的商品数据失败:%s", err))
|
|
|
772
|
+// }
|
|
|
773
|
+// err = transactionContext.CommitTransaction()
|
|
|
774
|
+// if err != nil {
|
|
|
775
|
+// return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
776
|
+// }
|
|
|
777
|
+// return nil
|
779
|
|
778
|
|
780
|
-}
|
779
|
+// }
|
781
|
|
780
|
|
782
|
//PageListOrderBouns 获取订单的分红列表
|
781
|
//PageListOrderBouns 获取订单的分红列表
|
783
|
func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) {
|
782
|
func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) {
|