正在显示
1 个修改的文件
包含
124 行增加
和
68 行删除
| @@ -67,8 +67,25 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -67,8 +67,25 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | + // 查询共创项目 | ||
| 71 | + cooperationProjectsMap := make(map[string]*domain.CooperationProject, 0) | ||
| 72 | + if count, cooperationProjectsFound, err := cooperationProjectRepository.Find(map[string]interface{}{ | ||
| 73 | + "companyId": companyId, | ||
| 74 | + "orgId": orgId, | ||
| 75 | + "offsetLimit": false, | ||
| 76 | + }); err != nil { | ||
| 77 | + return nil, err | ||
| 78 | + } else { | ||
| 79 | + if count > 0 { | ||
| 80 | + for _, cooperationProjectFound := range cooperationProjectsFound { | ||
| 81 | + cooperationProjectsMap[cooperationProjectFound.CooperationProjectNumber] = cooperationProjectFound | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 70 | // 确认业绩分红预算 | 86 | // 确认业绩分红预算 |
| 71 | var dividendsEstimateDetails []*service.DividendsEstimateDetail | 87 | var dividendsEstimateDetails []*service.DividendsEstimateDetail |
| 88 | + go func() { | ||
| 72 | for _, orderGood := range orderGoods { | 89 | for _, orderGood := range orderGoods { |
| 73 | log.Logger.Info("业绩分红预算产品", map[string]interface{}{ | 90 | log.Logger.Info("业绩分红预算产品", map[string]interface{}{ |
| 74 | "orderGood": orderGood, | 91 | "orderGood": orderGood, |
| @@ -93,9 +110,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -93,9 +110,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
| 93 | continue | 110 | continue |
| 94 | } | 111 | } |
| 95 | 112 | ||
| 96 | - var cooperationContract *domain.CooperationContract | ||
| 97 | - | ||
| 98 | // 获取合约 | 113 | // 获取合约 |
| 114 | + var cooperationContract *domain.CooperationContract | ||
| 99 | if _, ok := cooperationContractsMap[orderGood.CooperationContractNumber]; !ok { | 115 | if _, ok := cooperationContractsMap[orderGood.CooperationContractNumber]; !ok { |
| 100 | var orderNumber string | 116 | var orderNumber string |
| 101 | if orderGood.DividendsOrderNumber != "" { | 117 | if orderGood.DividendsOrderNumber != "" { |
| @@ -115,6 +131,24 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -115,6 +131,24 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
| 115 | continue | 131 | continue |
| 116 | } else { | 132 | } else { |
| 117 | cooperationContract = cooperationContractsMap[orderGood.CooperationContractNumber] | 133 | cooperationContract = cooperationContractsMap[orderGood.CooperationContractNumber] |
| 134 | + if cooperationContract.Status == 2 { | ||
| 135 | + var orderNumber string | ||
| 136 | + if orderGood.DividendsOrderNumber != "" { | ||
| 137 | + orderNumber = orderGood.DividendsOrderNumber | ||
| 138 | + } else { | ||
| 139 | + orderNumber = orderGood.DividendsReturnedOrderNumber | ||
| 140 | + } | ||
| 141 | + dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ | ||
| 142 | + DividendsUser: nil, | ||
| 143 | + DividendsParticipateType: 0, | ||
| 144 | + DividendsStage: 0, | ||
| 145 | + DividendsAmount: 0, | ||
| 146 | + OrderOrReturnedOrderNumber: orderNumber, | ||
| 147 | + IsSuccessfully: false, | ||
| 148 | + Reason: "共创合约" + orderGood.CooperationContractNumber + "已暂停", | ||
| 149 | + }) | ||
| 150 | + continue | ||
| 151 | + } | ||
| 118 | } | 152 | } |
| 119 | 153 | ||
| 120 | //cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{ | 154 | //cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{ |
| @@ -140,73 +174,94 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -140,73 +174,94 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
| 140 | // }) | 174 | // }) |
| 141 | // continue | 175 | // continue |
| 142 | //} | 176 | //} |
| 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 { | ||
| 165 | - var orderNumber string | ||
| 166 | - if orderGood.DividendsOrderNumber != "" { | ||
| 167 | - orderNumber = orderGood.DividendsOrderNumber | ||
| 168 | - } else { | ||
| 169 | - orderNumber = orderGood.DividendsReturnedOrderNumber | ||
| 170 | - } | ||
| 171 | - dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ | ||
| 172 | - DividendsUser: nil, | ||
| 173 | - DividendsParticipateType: 0, | ||
| 174 | - DividendsStage: 0, | ||
| 175 | - DividendsAmount: 0, | ||
| 176 | - OrderOrReturnedOrderNumber: orderNumber, | ||
| 177 | - IsSuccessfully: false, | ||
| 178 | - Reason: "共创合约" + orderGood.CooperationContractNumber + "已暂停", | ||
| 179 | - }) | ||
| 180 | - continue | ||
| 181 | - } | ||
| 182 | - } | 177 | + //if cooperationContract == nil { |
| 178 | + // var orderNumber string | ||
| 179 | + // if orderGood.DividendsOrderNumber != "" { | ||
| 180 | + // orderNumber = orderGood.DividendsOrderNumber | ||
| 181 | + // } else { | ||
| 182 | + // orderNumber = orderGood.DividendsReturnedOrderNumber | ||
| 183 | + // } | ||
| 184 | + // dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ | ||
| 185 | + // DividendsUser: nil, | ||
| 186 | + // DividendsParticipateType: 0, | ||
| 187 | + // DividendsStage: 0, | ||
| 188 | + // DividendsAmount: 0, | ||
| 189 | + // OrderOrReturnedOrderNumber: orderNumber, | ||
| 190 | + // IsSuccessfully: false, | ||
| 191 | + // Reason: "共创合约" + orderGood.CooperationContractNumber + "不存在", | ||
| 192 | + // }) | ||
| 193 | + // continue | ||
| 194 | + //} else { | ||
| 195 | + // log.Logger.Info("产品相关的合约", map[string]interface{}{ | ||
| 196 | + // "cooperationContract": cooperationContract, | ||
| 197 | + // }) | ||
| 198 | + // if cooperationContract.Status == 2 { | ||
| 199 | + // var orderNumber string | ||
| 200 | + // if orderGood.DividendsOrderNumber != "" { | ||
| 201 | + // orderNumber = orderGood.DividendsOrderNumber | ||
| 202 | + // } else { | ||
| 203 | + // orderNumber = orderGood.DividendsReturnedOrderNumber | ||
| 204 | + // } | ||
| 205 | + // dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ | ||
| 206 | + // DividendsUser: nil, | ||
| 207 | + // DividendsParticipateType: 0, | ||
| 208 | + // DividendsStage: 0, | ||
| 209 | + // DividendsAmount: 0, | ||
| 210 | + // OrderOrReturnedOrderNumber: orderNumber, | ||
| 211 | + // IsSuccessfully: false, | ||
| 212 | + // Reason: "共创合约" + orderGood.CooperationContractNumber + "已暂停", | ||
| 213 | + // }) | ||
| 214 | + // continue | ||
| 215 | + // } | ||
| 216 | + //} | ||
| 183 | 217 | ||
| 184 | // 获取共创项目 | 218 | // 获取共创项目 |
| 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 { | 219 | + //if cooperationContract.CooperationProjectNumber != "" { |
| 220 | + // cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{ | ||
| 221 | + // "cooperationProjectNumber": cooperationContract.CooperationProjectNumber, | ||
| 222 | + // "companyId": cooperationContract.Company.CompanyId, | ||
| 223 | + // "orgId": cooperationContract.Org.OrgId, | ||
| 224 | + // }) | ||
| 225 | + // if err != nil { | ||
| 226 | + // var orderNumber string | ||
| 227 | + // if orderGood.DividendsOrderNumber != "" { | ||
| 228 | + // orderNumber = orderGood.DividendsOrderNumber | ||
| 229 | + // } else { | ||
| 230 | + // orderNumber = orderGood.DividendsReturnedOrderNumber | ||
| 231 | + // } | ||
| 232 | + // dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ | ||
| 233 | + // DividendsUser: nil, | ||
| 234 | + // DividendsParticipateType: 0, | ||
| 235 | + // DividendsStage: 0, | ||
| 236 | + // DividendsAmount: 0, | ||
| 237 | + // OrderOrReturnedOrderNumber: orderNumber, | ||
| 238 | + // IsSuccessfully: false, | ||
| 239 | + // Reason: "共创项目" + cooperationContract.CooperationProjectNumber + "查询错误", | ||
| 240 | + // }) | ||
| 241 | + // continue | ||
| 242 | + // } | ||
| 243 | + // if cooperationProject == nil { | ||
| 244 | + // var orderNumber string | ||
| 245 | + // if orderGood.DividendsOrderNumber != "" { | ||
| 246 | + // orderNumber = orderGood.DividendsOrderNumber | ||
| 247 | + // } else { | ||
| 248 | + // orderNumber = orderGood.DividendsReturnedOrderNumber | ||
| 249 | + // } | ||
| 250 | + // dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{ | ||
| 251 | + // DividendsUser: nil, | ||
| 252 | + // DividendsParticipateType: 0, | ||
| 253 | + // DividendsStage: 0, | ||
| 254 | + // DividendsAmount: 0, | ||
| 255 | + // OrderOrReturnedOrderNumber: orderNumber, | ||
| 256 | + // IsSuccessfully: false, | ||
| 257 | + // Reason: "共创项目" + cooperationContract.CooperationProjectNumber + "已结束或不存在", | ||
| 258 | + // }) | ||
| 259 | + // continue | ||
| 260 | + // } | ||
| 261 | + //} | ||
| 262 | + | ||
| 263 | + // 判断共创项目是否存在 | ||
| 264 | + if _, ok := cooperationProjectsMap[cooperationContract.CooperationProjectNumber]; !ok { | ||
| 210 | var orderNumber string | 265 | var orderNumber string |
| 211 | if orderGood.DividendsOrderNumber != "" { | 266 | if orderGood.DividendsOrderNumber != "" { |
| 212 | orderNumber = orderGood.DividendsOrderNumber | 267 | orderNumber = orderGood.DividendsOrderNumber |
| @@ -224,7 +279,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -224,7 +279,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
| 224 | }) | 279 | }) |
| 225 | continue | 280 | continue |
| 226 | } | 281 | } |
| 227 | - } | ||
| 228 | 282 | ||
| 229 | if orderGood.DividendsOrderNumber != "" { // 获取分红订单 | 283 | if orderGood.DividendsOrderNumber != "" { // 获取分红订单 |
| 230 | // 获取分红订单 | 284 | // 获取分红订单 |
| @@ -497,6 +551,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | @@ -497,6 +551,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo | ||
| 497 | } | 551 | } |
| 498 | } | 552 | } |
| 499 | } | 553 | } |
| 554 | + }() | ||
| 555 | + | ||
| 500 | return dividendsEstimateDetails, nil | 556 | return dividendsEstimateDetails, nil |
| 501 | } | 557 | } |
| 502 | 558 |
-
请 注册 或 登录 后发表评论