作者 陈志颖

合并分支 'dev' 到 'test'

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



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