作者 陈志颖

fix:取消关联的分红预算单

@@ -63,39 +63,49 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -63,39 +63,49 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
63 // 自定义查询 63 // 自定义查询
64 queryOptions := make(map[string]interface{}) 64 queryOptions := make(map[string]interface{})
65 65
66 - //参与分红类型,1承接人,2推荐人,3关联业务员  
67 - if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单  
68 - queryOptions = map[string]interface{}{  
69 - "companyId": dividendsEstimate.Company.CompanyId,  
70 - "orgId": dividendsEstimate.Org.OrgId,  
71 - "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,  
72 - "dividendsParticipateTypes": []int32{2, 3},  
73 - "offsetLimit": false,  
74 - "dividendsStage": dividendsEstimate.DividendsStage,  
75 - "dividendsTypes": []int32{1, 2},  
76 - }  
77 - } else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单  
78 - queryOptions = map[string]interface{}{  
79 - "companyId": dividendsEstimate.Company.CompanyId,  
80 - "orgId": dividendsEstimate.Org.OrgId,  
81 - "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,  
82 - "dividendsParticipateTypes": []int32{1, 3},  
83 - "offsetLimit": false,  
84 - "dividendsStage": dividendsEstimate.DividendsStage,  
85 - "dividendsTypes": []int32{1, 2},  
86 - }  
87 - } else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单  
88 - queryOptions = map[string]interface{}{  
89 - "companyId": dividendsEstimate.Company.CompanyId,  
90 - "orgId": dividendsEstimate.Org.OrgId,  
91 - "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,  
92 - "dividendsParticipateTypes": []int32{1, 2},  
93 - "offsetLimit": false,  
94 - "dividendsStage": dividendsEstimate.DividendsStage,  
95 - "dividendsTypes": []int32{1, 2},  
96 - } 66 + queryOptions = map[string]interface{}{
  67 + "companyId": dividendsEstimate.Company.CompanyId,
  68 + "orgId": dividendsEstimate.Org.OrgId,
  69 + "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
  70 + "dividendsParticipateTypes": []int32{1, 2, 3},
  71 + "offsetLimit": false,
  72 + "dividendsStage": dividendsEstimate.DividendsStage,
  73 + "dividendsTypes": []int32{1, 2},
97 } 74 }
98 75
  76 + //参与分红类型,1承接人,2推荐人,3关联业务员
  77 + //if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单
  78 + // queryOptions = map[string]interface{}{
  79 + // "companyId": dividendsEstimate.Company.CompanyId,
  80 + // "orgId": dividendsEstimate.Org.OrgId,
  81 + // "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
  82 + // "dividendsParticipateTypes": []int32{1, 2, 3},
  83 + // "offsetLimit": false,
  84 + // "dividendsStage": dividendsEstimate.DividendsStage,
  85 + // "dividendsTypes": []int32{1, 2},
  86 + // }
  87 + //} else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单
  88 + // queryOptions = map[string]interface{}{
  89 + // "companyId": dividendsEstimate.Company.CompanyId,
  90 + // "orgId": dividendsEstimate.Org.OrgId,
  91 + // "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
  92 + // "dividendsParticipateTypes": []int32{1, 3},
  93 + // "offsetLimit": false,
  94 + // "dividendsStage": dividendsEstimate.DividendsStage,
  95 + // "dividendsTypes": []int32{1, 2},
  96 + // }
  97 + //} else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单
  98 + // queryOptions = map[string]interface{}{
  99 + // "companyId": dividendsEstimate.Company.CompanyId,
  100 + // "orgId": dividendsEstimate.Org.OrgId,
  101 + // "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
  102 + // "dividendsParticipateTypes": []int32{1, 2},
  103 + // "offsetLimit": false,
  104 + // "dividendsStage": dividendsEstimate.DividendsStage,
  105 + // "dividendsTypes": []int32{1, 2},
  106 + // }
  107 + //}
  108 +
99 // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单 109 // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单
100 if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(queryOptions); err2 != nil { 110 if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(queryOptions); err2 != nil {
101 return nil, err2 111 return nil, err2
@@ -118,39 +128,49 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -118,39 +128,49 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
118 // 自定义查询 128 // 自定义查询
119 queryOptions := make(map[string]interface{}) 129 queryOptions := make(map[string]interface{})
120 130
121 - //参与分红类型,1承接人,2推荐人,3关联业务员  
122 - if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单  
123 - queryOptions = map[string]interface{}{  
124 - "companyId": dividendsEstimate.Company.CompanyId,  
125 - "orgId": dividendsEstimate.Org.OrgId,  
126 - "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,  
127 - "dividendsParticipateTypes": []int32{2, 3},  
128 - "offsetLimit": false,  
129 - "dividendsStage": dividendsEstimate.DividendsStage,  
130 - "dividendsType": int32(3),  
131 - }  
132 - } else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单  
133 - queryOptions = map[string]interface{}{  
134 - "companyId": dividendsEstimate.Company.CompanyId,  
135 - "orgId": dividendsEstimate.Org.OrgId,  
136 - "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,  
137 - "dividendsParticipateTypes": []int32{1, 3},  
138 - "offsetLimit": false,  
139 - "dividendsStage": dividendsEstimate.DividendsStage,  
140 - "dividendsType": int32(3),  
141 - }  
142 - } else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单  
143 - queryOptions = map[string]interface{}{  
144 - "companyId": dividendsEstimate.Company.CompanyId,  
145 - "orgId": dividendsEstimate.Org.OrgId,  
146 - "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,  
147 - "dividendsParticipateTypes": []int32{1, 2},  
148 - "offsetLimit": false,  
149 - "dividendsStage": dividendsEstimate.DividendsStage,  
150 - "dividendsType": int32(3),  
151 - } 131 + queryOptions = map[string]interface{}{
  132 + "companyId": dividendsEstimate.Company.CompanyId,
  133 + "orgId": dividendsEstimate.Org.OrgId,
  134 + "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
  135 + "dividendsParticipateTypes": []int32{1, 2, 3},
  136 + "offsetLimit": false,
  137 + "dividendsStage": dividendsEstimate.DividendsStage,
  138 + "dividendsType": int32(3),
152 } 139 }
153 140
  141 + //参与分红类型,1承接人,2推荐人,3关联业务员
  142 + //if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单
  143 + // queryOptions = map[string]interface{}{
  144 + // "companyId": dividendsEstimate.Company.CompanyId,
  145 + // "orgId": dividendsEstimate.Org.OrgId,
  146 + // "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
  147 + // "dividendsParticipateTypes": []int32{2, 3},
  148 + // "offsetLimit": false,
  149 + // "dividendsStage": dividendsEstimate.DividendsStage,
  150 + // "dividendsType": int32(3),
  151 + // }
  152 + //} else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单
  153 + // queryOptions = map[string]interface{}{
  154 + // "companyId": dividendsEstimate.Company.CompanyId,
  155 + // "orgId": dividendsEstimate.Org.OrgId,
  156 + // "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
  157 + // "dividendsParticipateTypes": []int32{1, 3},
  158 + // "offsetLimit": false,
  159 + // "dividendsStage": dividendsEstimate.DividendsStage,
  160 + // "dividendsType": int32(3),
  161 + // }
  162 + //} else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单
  163 + // queryOptions = map[string]interface{}{
  164 + // "companyId": dividendsEstimate.Company.CompanyId,
  165 + // "orgId": dividendsEstimate.Org.OrgId,
  166 + // "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
  167 + // "dividendsParticipateTypes": []int32{1, 2},
  168 + // "offsetLimit": false,
  169 + // "dividendsStage": dividendsEstimate.DividendsStage,
  170 + // "dividendsType": int32(3),
  171 + // }
  172 + //}
  173 +
154 // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单 174 // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单
155 if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(queryOptions); err2 != nil { 175 if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(queryOptions); err2 != nil {
156 return nil, err2 176 return nil, err2