作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !63
@@ -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,46 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -653,6 +673,46 @@ 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 + log.Logger.Info("查询共创合约", map[string]interface{}{
  693 + "cooperationContractsMap": cooperationContractsMap,
  694 + })
  695 +
  696 + // 查询共创项目
  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 + })
  715 +
656 // 统计成功预算的分红订单 716 // 统计成功预算的分红订单
657 estimateSuccessfullyDividendsOrders := make(map[string]string) 717 estimateSuccessfullyDividendsOrders := make(map[string]string)
658 718
@@ -684,7 +744,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -684,7 +744,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
684 orderGoodsToConfirm := make([]*domain.OrderGood, 0) 744 orderGoodsToConfirm := make([]*domain.OrderGood, 0)
685 orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood) 745 orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
686 // 分红订单产品预算 746 // 分红订单产品预算
687 - if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId); err != nil { 747 + 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()) 748 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
689 } else { 749 } else {
690 for _, dividendsEstimateDetail := range dividendsEstimateDetails { 750 for _, dividendsEstimateDetail := range dividendsEstimateDetails {
@@ -740,7 +800,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -740,7 +800,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
740 orderGoodsToConfirm := make([]*domain.OrderGood, 0) 800 orderGoodsToConfirm := make([]*domain.OrderGood, 0)
741 orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood) 801 orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
742 // 分红退货单产品预算 802 // 分红退货单产品预算
743 - if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId); err != nil { 803 + 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()) 804 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
745 } else { 805 } else {
746 for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails { 806 for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
@@ -907,6 +907,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -907,6 +907,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
907 DividendsReturnedOrderNumber: "", 907 DividendsReturnedOrderNumber: "",
908 CooperationContractNumber: orderGood.CooperationContractNumber, 908 CooperationContractNumber: orderGood.CooperationContractNumber,
909 OrderGoodExpense: orderGood.OrderGoodExpense, 909 OrderGoodExpense: orderGood.OrderGoodExpense,
  910 + OrderGoodDividendsStatus: int32(1),
910 OrgId: importDividendsOrderCommand.OrgId, 911 OrgId: importDividendsOrderCommand.OrgId,
911 CompanyId: importDividendsOrderCommand.CompanyId, 912 CompanyId: importDividendsOrderCommand.CompanyId,
912 CreatedAt: time.Now(), 913 CreatedAt: time.Now(),
@@ -43,5 +43,5 @@ func (DividendsEstimateDetail *DividendsEstimateDetail) GenerateSpecificDividend @@ -43,5 +43,5 @@ func (DividendsEstimateDetail *DividendsEstimateDetail) GenerateSpecificDividend
43 43
44 type ConfirmDividendsIncentivesEstimateService interface { 44 type ConfirmDividendsIncentivesEstimateService interface {
45 coreDomain.DomainEventPublisher 45 coreDomain.DomainEventPublisher
46 - Confirm(orderGoods []*domain.OrderGood, companyId int64, orgId int64) ([]*DividendsEstimateDetail, error) 46 + Confirm(orderGoods []*domain.OrderGood, companyId int64, orgId int64, cooperationContractsMap map[string]*domain.CooperationContract, cooperationProjectsMap map[string]*domain.CooperationProject) ([]*DividendsEstimateDetail, error)
47 } 47 }
@@ -20,7 +20,6 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -20,7 +20,6 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
20 var dividendsOrderRepository domain.DividendsOrderRepository // 分红订单仓储 20 var dividendsOrderRepository domain.DividendsOrderRepository // 分红订单仓储
21 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository // 分红退货单仓储 21 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository // 分红退货单仓储
22 var orderGoodRepository domain.OrderGoodRepository // 订单产品仓储 22 var orderGoodRepository domain.OrderGoodRepository // 订单产品仓储
23 - //var cooperationContactRepository domain.CooperationContractRepository // 合约仓储  
24 23
25 // 分红预算单仓储初始化 24 // 分红预算单仓储初始化
26 if repo, err := repository.NewDividendsEstimateRepository(domainService.transactionContext); err != nil { 25 if repo, err := repository.NewDividendsEstimateRepository(domainService.transactionContext); err != nil {
@@ -50,16 +49,10 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -50,16 +49,10 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
50 orderGoodRepository = repo 49 orderGoodRepository = repo
51 } 50 }
52 51
53 - // 共创合约仓储初始化  
54 - //if repo, err := repository.NewCooperationContractRepository(domainService.transactionContext); err != nil {  
55 - // return nil, err  
56 - //} else {  
57 - // cooperationContactRepository = repo  
58 - //}  
59 -  
60 // 获取分红预算单 52 // 获取分红预算单
61 if count, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{ 53 if count, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
62 "dividendsEstimateIds": dividendsEstimateIds, 54 "dividendsEstimateIds": dividendsEstimateIds,
  55 + "offsetLimit": false,
63 }); err != nil { 56 }); err != nil {
64 return nil, err 57 return nil, err
65 } else { 58 } else {
@@ -154,6 +147,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -154,6 +147,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
154 "companyId": dividendsEstimates[0].Company.CompanyId, 147 "companyId": dividendsEstimates[0].Company.CompanyId,
155 "orgId": dividendsEstimates[0].Org.OrgId, 148 "orgId": dividendsEstimates[0].Org.OrgId,
156 "dividendsOrderNumbers": orderNums, 149 "dividendsOrderNumbers": orderNums,
  150 + "offsetLimit": false,
157 }); err4 != nil { 151 }); err4 != nil {
158 return nil, err4 152 return nil, err4
159 } else { 153 } else {
@@ -193,6 +187,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -193,6 +187,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
193 "orderGoodIds": orderGoodIds, 187 "orderGoodIds": orderGoodIds,
194 "companyId": dividendsEstimates[0].Company.CompanyId, 188 "companyId": dividendsEstimates[0].Company.CompanyId,
195 "orgId": dividendsEstimates[0].Org.OrgId, 189 "orgId": dividendsEstimates[0].Org.OrgId,
  190 + "offsetLimit": false,
196 }); err != nil { 191 }); err != nil {
197 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 192 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
198 } else { 193 } else {
@@ -216,6 +211,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -216,6 +211,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
216 "companyId": dividendsEstimates[0].Company.CompanyId, 211 "companyId": dividendsEstimates[0].Company.CompanyId,
217 "orgId": dividendsEstimates[0].Org.OrgId, 212 "orgId": dividendsEstimates[0].Org.OrgId,
218 "dividendsReturnedOrderNumbers": returnedOrderNums, 213 "dividendsReturnedOrderNumbers": returnedOrderNums,
  214 + "offsetLimit": false,
219 }); err5 != nil { 215 }); err5 != nil {
220 return nil, err5 216 return nil, err5
221 } else { 217 } else {
@@ -256,6 +252,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -256,6 +252,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
256 "orderGoodIds": orderGoodIds, 252 "orderGoodIds": orderGoodIds,
257 "companyId": dividendsEstimates[0].Company.CompanyId, 253 "companyId": dividendsEstimates[0].Company.CompanyId,
258 "orgId": dividendsEstimates[0].Org.OrgId, 254 "orgId": dividendsEstimates[0].Org.OrgId,
  255 + "offsetLimit": false,
259 }); err != nil { 256 }); err != nil {
260 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 257 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
261 } else { 258 } else {
@@ -8,7 +8,6 @@ import ( @@ -8,7 +8,6 @@ import (
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/repository" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/repository"
11 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"  
12 ) 11 )
13 12
14 type ConfirmDividendsIncentivesEstimateService struct { 13 type ConfirmDividendsIncentivesEstimateService struct {
@@ -17,26 +16,10 @@ type ConfirmDividendsIncentivesEstimateService struct { @@ -17,26 +16,10 @@ type ConfirmDividendsIncentivesEstimateService struct {
17 } 16 }
18 17
19 // Confirm 确认业绩分红预算 18 // Confirm 确认业绩分红预算
20 -func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoods []*domain.OrderGood, companyId int64, orgId int64) ([]*service.DividendsEstimateDetail, error) {  
21 - var cooperationContractRepository domain.CooperationContractRepository // 共创合约仓储  
22 - var cooperationProjectRepository domain.CooperationProjectRepository // 共创项目仓储 19 +func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoods []*domain.OrderGood, companyId int64, orgId int64, cooperationContractsMap map[string]*domain.CooperationContract, cooperationProjectsMap map[string]*domain.CooperationProject) ([]*service.DividendsEstimateDetail, error) {
23 var dividendsOrderRepository domain.DividendsOrderRepository // 分红订单仓储 20 var dividendsOrderRepository domain.DividendsOrderRepository // 分红订单仓储
24 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository // 分红退货单仓储 21 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository // 分红退货单仓储
25 22
26 - // 共创合约仓储初始化  
27 - if repo, err := repository.NewCooperationContractRepository(domainService.transactionContext); err != nil {  
28 - return nil, err  
29 - } else {  
30 - cooperationContractRepository = repo  
31 - }  
32 -  
33 - // 共创项目仓储初始化  
34 - if repo, err := repository.NewCooperationProjectRepository(domainService.transactionContext); err != nil {  
35 - return nil, err  
36 - } else {  
37 - cooperationProjectRepository = repo  
38 - }  
39 -  
40 // 分红订单仓储初始化 23 // 分红订单仓储初始化
41 if repo, err := repository.NewDividendsOrderRepository(domainService.transactionContext); err != nil { 24 if repo, err := repository.NewDividendsOrderRepository(domainService.transactionContext); err != nil {
42 return nil, err 25 return nil, err
@@ -51,29 +34,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -51,29 +34,9 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
51 dividendsReturnedOrderRepository = repo 34 dividendsReturnedOrderRepository = repo
52 } 35 }
53 36
54 - // 查询共创合约  
55 - cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)  
56 - if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{  
57 - "companyId": companyId,  
58 - "orgId": orgId,  
59 - "offsetLimit": false,  
60 - }); err != nil {  
61 - return nil, err  
62 - } else {  
63 - if count > 0 {  
64 - for _, cooperationContractFound := range cooperationContractsFound {  
65 - cooperationContractsMap[cooperationContractFound.CooperationContractNumber] = cooperationContractFound  
66 - }  
67 - }  
68 - }  
69 -  
70 // 确认业绩分红预算 37 // 确认业绩分红预算
71 var dividendsEstimateDetails []*service.DividendsEstimateDetail 38 var dividendsEstimateDetails []*service.DividendsEstimateDetail
72 for _, orderGood := range orderGoods { 39 for _, orderGood := range orderGoods {
73 - log.Logger.Info("业绩分红预算产品", map[string]interface{}{  
74 - "orderGood": orderGood,  
75 - })  
76 -  
77 if orderGood.CooperationContractNumber == "" { 40 if orderGood.CooperationContractNumber == "" {
78 var orderNumber string 41 var orderNumber string
79 if orderGood.DividendsOrderNumber != "" { 42 if orderGood.DividendsOrderNumber != "" {
@@ -93,9 +56,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -93,9 +56,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
93 continue 56 continue
94 } 57 }
95 58
96 - var cooperationContract *domain.CooperationContract  
97 -  
98 // 获取合约 59 // 获取合约
  60 + var cooperationContract *domain.CooperationContract
99 if _, ok := cooperationContractsMap[orderGood.CooperationContractNumber]; !ok { 61 if _, ok := cooperationContractsMap[orderGood.CooperationContractNumber]; !ok {
100 var orderNumber string 62 var orderNumber string
101 if orderGood.DividendsOrderNumber != "" { 63 if orderGood.DividendsOrderNumber != "" {
@@ -115,52 +77,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -115,52 +77,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
115 continue 77 continue
116 } else { 78 } else {
117 cooperationContract = cooperationContractsMap[orderGood.CooperationContractNumber] 79 cooperationContract = cooperationContractsMap[orderGood.CooperationContractNumber]
118 - }  
119 -  
120 - //cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{  
121 - // "cooperationContractNumber": orderGood.CooperationContractNumber,  
122 - // "companyId": orderGood.CompanyId,  
123 - // "orgId": orderGood.OrgId,  
124 - //})  
125 - //if err != nil {  
126 - // var orderNumber string  
127 - // if orderGood.DividendsOrderNumber != "" {  
128 - // orderNumber = orderGood.DividendsOrderNumber  
129 - // } else {  
130 - // orderNumber = orderGood.DividendsReturnedOrderNumber  
131 - // }  
132 - // dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{  
133 - // DividendsUser: nil,  
134 - // DividendsParticipateType: 0,  
135 - // DividendsStage: 0,  
136 - // DividendsAmount: 0,  
137 - // OrderOrReturnedOrderNumber: orderNumber,  
138 - // IsSuccessfully: false,  
139 - // Reason: "共创合约错误",  
140 - // })  
141 - // continue  
142 - //}  
143 - if cooperationContract == nil {  
144 - var orderNumber string  
145 - if orderGood.DividendsOrderNumber != "" {  
146 - orderNumber = orderGood.DividendsOrderNumber  
147 - } else {  
148 - orderNumber = orderGood.DividendsReturnedOrderNumber  
149 - }  
150 - dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{  
151 - DividendsUser: nil,  
152 - DividendsParticipateType: 0,  
153 - DividendsStage: 0,  
154 - DividendsAmount: 0,  
155 - OrderOrReturnedOrderNumber: orderNumber,  
156 - IsSuccessfully: false,  
157 - Reason: "共创合约" + orderGood.CooperationContractNumber + "不存在",  
158 - })  
159 - continue  
160 - } else {  
161 - log.Logger.Info("产品相关的合约", map[string]interface{}{  
162 - "cooperationContract": cooperationContract,  
163 - })  
164 if cooperationContract.Status == 2 { 80 if cooperationContract.Status == 2 {
165 var orderNumber string 81 var orderNumber string
166 if orderGood.DividendsOrderNumber != "" { 82 if orderGood.DividendsOrderNumber != "" {
@@ -181,32 +97,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -181,32 +97,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
181 } 97 }
182 } 98 }
183 99
184 - // 获取共创项目  
185 - if cooperationContract.CooperationProjectNumber != "" {  
186 - cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{  
187 - "cooperationProjectNumber": cooperationContract.CooperationProjectNumber,  
188 - "companyId": cooperationContract.Company.CompanyId,  
189 - "orgId": cooperationContract.Org.OrgId,  
190 - })  
191 - if err != nil {  
192 - var orderNumber string  
193 - if orderGood.DividendsOrderNumber != "" {  
194 - orderNumber = orderGood.DividendsOrderNumber  
195 - } else {  
196 - orderNumber = orderGood.DividendsReturnedOrderNumber  
197 - }  
198 - dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{  
199 - DividendsUser: nil,  
200 - DividendsParticipateType: 0,  
201 - DividendsStage: 0,  
202 - DividendsAmount: 0,  
203 - OrderOrReturnedOrderNumber: orderNumber,  
204 - IsSuccessfully: false,  
205 - Reason: "共创项目" + cooperationContract.CooperationProjectNumber + "查询错误",  
206 - })  
207 - continue  
208 - }  
209 - if cooperationProject == nil { 100 + // 判断共创项目是否存在
  101 + if _, ok := cooperationProjectsMap[cooperationContract.CooperationProjectNumber]; !ok {
210 var orderNumber string 102 var orderNumber string
211 if orderGood.DividendsOrderNumber != "" { 103 if orderGood.DividendsOrderNumber != "" {
212 orderNumber = orderGood.DividendsOrderNumber 104 orderNumber = orderGood.DividendsOrderNumber
@@ -224,7 +116,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -224,7 +116,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
224 }) 116 })
225 continue 117 continue
226 } 118 }
227 - }  
228 119
229 if orderGood.DividendsOrderNumber != "" { // 获取分红订单 120 if orderGood.DividendsOrderNumber != "" { // 获取分红订单
230 // 获取分红订单 121 // 获取分红订单
@@ -408,6 +299,18 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -408,6 +299,18 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
408 } 299 }
409 } 300 }
410 // 计算分红 301 // 计算分红
  302 + if len(cooperationContract.Undertakers) <= 0 {
  303 + dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
  304 + DividendsUser: nil,
  305 + DividendsParticipateType: 0,
  306 + DividendsStage: 0,
  307 + DividendsAmount: 0,
  308 + OrderOrReturnedOrderNumber: orderGood.DividendsReturnedOrderNumber,
  309 + IsSuccessfully: false,
  310 + Reason: "合约承接人不存在",
  311 + })
  312 + continue
  313 + } else {
411 for _, undertaker := range cooperationContract.Undertakers { 314 for _, undertaker := range cooperationContract.Undertakers {
412 // 添加承接人分红退货预算信息详情 315 // 添加承接人分红退货预算信息详情
413 if dividendsIncentivesRuleMatched.DividendsIncentivesPercentage > 0 { 316 if dividendsIncentivesRuleMatched.DividendsIncentivesPercentage > 0 {
@@ -497,6 +400,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -497,6 +400,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
497 } 400 }
498 } 401 }
499 } 402 }
  403 + }
  404 +
500 return dividendsEstimateDetails, nil 405 return dividendsEstimateDetails, nil
501 } 406 }
502 407