|
@@ -640,6 +640,26 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -640,6 +640,26 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
640
|
dividendsReturnedOrderRepository = value
|
640
|
dividendsReturnedOrderRepository = value
|
|
641
|
}
|
641
|
}
|
|
642
|
|
642
|
|
|
|
|
643
|
+ // 共创合约仓储初始化
|
|
|
|
644
|
+ var cooperationContractRepository domain.CooperationContractRepository
|
|
|
|
645
|
+ if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
|
|
|
|
646
|
+ "transactionContext": transactionContext,
|
|
|
|
647
|
+ }); err != nil {
|
|
|
|
648
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
649
|
+ } else {
|
|
|
|
650
|
+ cooperationContractRepository = value
|
|
|
|
651
|
+ }
|
|
|
|
652
|
+
|
|
|
|
653
|
+ // 共创项目仓储初始化
|
|
|
|
654
|
+ var cooperationProjectRepository domain.CooperationProjectRepository
|
|
|
|
655
|
+ if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
|
|
|
|
656
|
+ "transactionContext": transactionContext,
|
|
|
|
657
|
+ }); err != nil {
|
|
|
|
658
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
659
|
+ } else {
|
|
|
|
660
|
+ cooperationProjectRepository = value
|
|
|
|
661
|
+ }
|
|
|
|
662
|
+
|
|
643
|
// 初始化确认业绩激励分红预算领域服务
|
663
|
// 初始化确认业绩激励分红预算领域服务
|
|
644
|
var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService
|
664
|
var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService
|
|
645
|
if value, err := factory.CreateConfirmDividendsIncentivesEstimateService(map[string]interface{}{
|
665
|
if value, err := factory.CreateConfirmDividendsIncentivesEstimateService(map[string]interface{}{
|
|
@@ -653,6 +673,38 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -653,6 +673,38 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
653
|
})
|
673
|
})
|
|
654
|
}
|
674
|
}
|
|
655
|
|
675
|
|
|
|
|
676
|
+ // 查询共创合约
|
|
|
|
677
|
+ cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)
|
|
|
|
678
|
+ if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{
|
|
|
|
679
|
+ "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
|
|
|
680
|
+ "orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
|
|
|
|
681
|
+ "offsetLimit": false,
|
|
|
|
682
|
+ }); err != nil {
|
|
|
|
683
|
+ return nil, err
|
|
|
|
684
|
+ } else {
|
|
|
|
685
|
+ if count > 0 {
|
|
|
|
686
|
+ for _, cooperationContractFound := range cooperationContractsFound {
|
|
|
|
687
|
+ cooperationContractsMap[cooperationContractFound.CooperationContractNumber] = cooperationContractFound
|
|
|
|
688
|
+ }
|
|
|
|
689
|
+ }
|
|
|
|
690
|
+ }
|
|
|
|
691
|
+
|
|
|
|
692
|
+ // 查询共创项目
|
|
|
|
693
|
+ cooperationProjectsMap := make(map[string]*domain.CooperationProject, 0)
|
|
|
|
694
|
+ if count, cooperationProjectsFound, err := cooperationProjectRepository.Find(map[string]interface{}{
|
|
|
|
695
|
+ "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
|
|
|
696
|
+ "orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
|
|
|
|
697
|
+ "offsetLimit": false,
|
|
|
|
698
|
+ }); err != nil {
|
|
|
|
699
|
+ return nil, err
|
|
|
|
700
|
+ } else {
|
|
|
|
701
|
+ if count > 0 {
|
|
|
|
702
|
+ for _, cooperationProjectFound := range cooperationProjectsFound {
|
|
|
|
703
|
+ cooperationProjectsMap[cooperationProjectFound.CooperationProjectNumber] = cooperationProjectFound
|
|
|
|
704
|
+ }
|
|
|
|
705
|
+ }
|
|
|
|
706
|
+ }
|
|
|
|
707
|
+
|
|
656
|
// 统计成功预算的分红订单
|
708
|
// 统计成功预算的分红订单
|
|
657
|
estimateSuccessfullyDividendsOrders := make(map[string]string)
|
709
|
estimateSuccessfullyDividendsOrders := make(map[string]string)
|
|
658
|
|
710
|
|
|
@@ -684,7 +736,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -684,7 +736,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
684
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
736
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
|
685
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
737
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
|
686
|
// 分红订单产品预算
|
738
|
// 分红订单产品预算
|
|
687
|
- if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId); err != nil {
|
739
|
+ if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, cooperationProjectsMap); err != nil {
|
|
688
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
740
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
689
|
} else {
|
741
|
} else {
|
|
690
|
for _, dividendsEstimateDetail := range dividendsEstimateDetails {
|
742
|
for _, dividendsEstimateDetail := range dividendsEstimateDetails {
|
|
@@ -740,7 +792,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -740,7 +792,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
740
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
792
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
|
741
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
793
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
|
742
|
// 分红退货单产品预算
|
794
|
// 分红退货单产品预算
|
|
743
|
- if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId); err != nil {
|
795
|
+ if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, cooperationProjectsMap); err != nil {
|
|
744
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
796
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
745
|
} else {
|
797
|
} else {
|
|
746
|
for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
|
798
|
for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
|