作者 陈志颖

合并分支 'dev' 到 'test'

fix:批量取消分红预算单,更新订单状态错误



查看合并请求 !69
@@ -359,7 +359,6 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec @@ -359,7 +359,6 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
359 undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3) 359 undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3)
360 } 360 }
361 361
362 - // TODO 优化  
363 // 判断项目关联的合约承接人类型 362 // 判断项目关联的合约承接人类型
364 undertakers := make([]*domain.Undertaker, 0) 363 undertakers := make([]*domain.Undertaker, 0)
365 if countContracts, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{ 364 if countContracts, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{
@@ -153,18 +153,19 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -153,18 +153,19 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
153 } else { 153 } else {
154 // orderGoodIds去重 154 // orderGoodIds去重
155 newOrderGoodIds := utils.RemoveDuplicationInt64(orderGoodIds) 155 newOrderGoodIds := utils.RemoveDuplicationInt64(orderGoodIds)
156 -  
157 if countDividendsOrder > 0 { 156 if countDividendsOrder > 0 {
158 for i, order := range orders { 157 for i, order := range orders {
159 - goods := make([]*domain.OrderGood, 0) 158 + var goodIds []int64
160 for _, good := range order.Goods { 159 for _, good := range order.Goods {
161 if good.OrderGoodDividendsStatus == 2 { 160 if good.OrderGoodDividendsStatus == 2 {
162 - goods = append(goods, good) 161 + goodIds = append(goodIds, good.OrderGoodId)
163 } 162 }
164 } 163 }
165 - if len(goods) == len(newOrderGoodIds) { // 1.已分红的产品数量等于取消的产品数量,订单分红状态变更为未分红 164 + // goodIds去重
  165 + newGoodIds := utils.RemoveDuplicationInt64(goodIds)
  166 + if len(newGoodIds) == len(newOrderGoodIds) { // 1.已分红的产品数量等于取消的产品数量,订单分红状态变更为未分红
166 orders[i].DividendStatus = 1 167 orders[i].DividendStatus = 1
167 - } else if len(goods) > len(newOrderGoodIds) { // 3.已分红的产品数量大于被取消分红的产品数量,订单分红状态变更为部分分红 168 + } else if len(newGoodIds) > len(newOrderGoodIds) { // 3.已分红的产品数量大于被取消分红的产品数量,订单分红状态变更为部分分红
168 orders[i].DividendStatus = 3 169 orders[i].DividendStatus = 3
169 } 170 }
170 orders[i].DividendStatus = order.DividendStatus 171 orders[i].DividendStatus = order.DividendStatus