|
@@ -651,14 +651,14 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -651,14 +651,14 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
651
|
}
|
651
|
}
|
652
|
|
652
|
|
653
|
// 共创项目仓储初始化
|
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
|
- }
|
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
|
|
662
|
|
663
|
// 初始化确认业绩激励分红预算领域服务
|
663
|
// 初始化确认业绩激励分红预算领域服务
|
664
|
var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService
|
664
|
var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService
|
|
@@ -673,45 +673,25 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -673,45 +673,25 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
673
|
})
|
673
|
})
|
674
|
}
|
674
|
}
|
675
|
|
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
|
- log.Logger.Info("查询共创合约", map[string]interface{}{
|
|
|
693
|
- "cooperationContractsMap": cooperationContractsMap,
|
|
|
694
|
- })
|
|
|
695
|
-
|
|
|
696
|
// 查询共创项目
|
676
|
// 查询共创项目
|
697
|
- cooperationProjectsMap := make(map[string]*domain.CooperationProject, 0)
|
|
|
698
|
- if count, cooperationProjectsFound, err := cooperationProjectRepository.Find(map[string]interface{}{
|
|
|
699
|
- "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
|
|
700
|
- "orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
|
|
|
701
|
- "offsetLimit": false,
|
|
|
702
|
- }); err != nil {
|
|
|
703
|
- return nil, err
|
|
|
704
|
- } else {
|
|
|
705
|
- if count > 0 {
|
|
|
706
|
- for _, cooperationProjectFound := range cooperationProjectsFound {
|
|
|
707
|
- cooperationProjectsMap[cooperationProjectFound.CooperationProjectNumber] = cooperationProjectFound
|
|
|
708
|
- }
|
|
|
709
|
- }
|
|
|
710
|
- }
|
|
|
711
|
-
|
|
|
712
|
- log.Logger.Info("查询共创项目", map[string]interface{}{
|
|
|
713
|
- "cooperationProjectsMap": cooperationProjectsMap,
|
|
|
714
|
- })
|
677
|
+ //cooperationProjectsMap := make(map[string]*domain.CooperationProject, 0)
|
|
|
678
|
+ //if count, cooperationProjectsFound, err := cooperationProjectRepository.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 _, cooperationProjectFound := range cooperationProjectsFound {
|
|
|
687
|
+ // cooperationProjectsMap[cooperationProjectFound.CooperationProjectNumber] = cooperationProjectFound
|
|
|
688
|
+ // }
|
|
|
689
|
+ // }
|
|
|
690
|
+ //}
|
|
|
691
|
+ //
|
|
|
692
|
+ //log.Logger.Info("查询共创项目", map[string]interface{}{
|
|
|
693
|
+ // "cooperationProjectsMap": cooperationProjectsMap,
|
|
|
694
|
+ //})
|
715
|
|
695
|
|
716
|
// 统计成功预算的分红订单
|
696
|
// 统计成功预算的分红订单
|
717
|
estimateSuccessfullyDividendsOrders := make(map[string]string)
|
697
|
estimateSuccessfullyDividendsOrders := make(map[string]string)
|
|
@@ -728,6 +708,34 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -728,6 +708,34 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
728
|
} else {
|
708
|
} else {
|
729
|
dividendsEstimates := make([]*domain.DividendsEstimate, 0)
|
709
|
dividendsEstimates := make([]*domain.DividendsEstimate, 0)
|
730
|
|
710
|
|
|
|
711
|
+ var cooperationContractNumbers []string
|
|
|
712
|
+
|
|
|
713
|
+ // 获取订单产品合约编号
|
|
|
714
|
+ for _, orderGood := range orderGoods {
|
|
|
715
|
+ cooperationContractNumbers = append(cooperationContractNumbers, orderGood.CooperationContractNumber)
|
|
|
716
|
+ }
|
|
|
717
|
+
|
|
|
718
|
+ // 查询共创合约
|
|
|
719
|
+ cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)
|
|
|
720
|
+ if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{
|
|
|
721
|
+ "cooperationContractNumbers": cooperationContractNumbers,
|
|
|
722
|
+ "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
|
|
723
|
+ "orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
|
|
|
724
|
+ "offsetLimit": false,
|
|
|
725
|
+ }); err != nil {
|
|
|
726
|
+ return nil, err
|
|
|
727
|
+ } else {
|
|
|
728
|
+ if count > 0 {
|
|
|
729
|
+ for _, cooperationContractFound := range cooperationContractsFound {
|
|
|
730
|
+ cooperationContractsMap[cooperationContractFound.CooperationContractNumber] = cooperationContractFound
|
|
|
731
|
+ }
|
|
|
732
|
+ }
|
|
|
733
|
+ }
|
|
|
734
|
+
|
|
|
735
|
+ log.Logger.Info("查询共创合约", map[string]interface{}{
|
|
|
736
|
+ "cooperationContractsMap": cooperationContractsMap,
|
|
|
737
|
+ })
|
|
|
738
|
+
|
731
|
// 统计当前企业分红预算单数
|
739
|
// 统计当前企业分红预算单数
|
732
|
count, err := dividendsEstimateDao.CountDividendsEstimate(map[string]interface{}{
|
740
|
count, err := dividendsEstimateDao.CountDividendsEstimate(map[string]interface{}{
|
733
|
"companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
741
|
"companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
|
@@ -744,7 +752,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -744,7 +752,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
744
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
752
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
745
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
753
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
746
|
// 分红订单产品预算
|
754
|
// 分红订单产品预算
|
747
|
- if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, cooperationProjectsMap); err != nil {
|
755
|
+ if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, nil); err != nil {
|
748
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
756
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
749
|
} else {
|
757
|
} else {
|
750
|
for _, dividendsEstimateDetail := range dividendsEstimateDetails {
|
758
|
for _, dividendsEstimateDetail := range dividendsEstimateDetails {
|
|
@@ -800,7 +808,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
@@ -800,7 +808,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
800
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
808
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
801
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
809
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
802
|
// 分红退货单产品预算
|
810
|
// 分红退货单产品预算
|
803
|
- if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, cooperationProjectsMap); err != nil {
|
811
|
+ if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, nil); err != nil {
|
804
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
812
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
805
|
} else {
|
813
|
} else {
|
806
|
for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
|
814
|
for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
|