作者 陈志颖

fix:多产品分红预算错误

... ... @@ -615,7 +615,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
dividendsEstimates := make([]*domain.DividendsEstimate, 0)
// 统计当前分红预算单数
// 统计当前企业分红预算单数
count, err := dividendsEstimateDao.CountDividendsEstimate(map[string]interface{}{
"companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
})
... ... @@ -626,8 +626,11 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
for _, orderGood := range orderGoods {
dividendsEstimate := &domain.DividendsEstimate{}
if orderGood.DividendsOrderNumber != "" { // 查询分红订单
// 临时方案
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
// 分红订单产品预算
if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoods); err != nil {
if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
for _, dividendsEstimateDetail := range dividendsEstimateDetails {
... ... @@ -677,8 +680,10 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
}
}
} else if orderGood.DividendsReturnedOrderNumber != "" { // 查询分红退货单
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
// 分红退货单产品预算
if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoods); err != nil {
if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
... ...
... ... @@ -70,7 +70,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "共创合约错误",
})
continue
//return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if cooperationContract == nil {
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
... ... @@ -83,7 +82,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "共创合约" + orderGood.CooperationContractNumber + "不存在",
})
continue
//return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("共创合约%s不存在", orderGood.CooperationContractNumber))
}
// 获取共创项目
... ... @@ -117,7 +115,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "共创项目" + orderGood.CooperationContractNumber + "已结束或不存在",
})
continue
//return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("共创项目%s不存在", cooperationContract.CooperationProjectNumber))
}
// 校验合约关联的项目是否已结束
... ... @@ -153,7 +150,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "分红订单" + orderGood.DividendsOrderNumber + "查询错误",
})
continue
//return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在")
}
if dividendsOrder == nil {
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
... ... @@ -166,7 +162,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "分红订单" + orderGood.DividendsOrderNumber + "不存在",
})
continue
//return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("分红订单%s不存在", orderGood.DividendsOrderNumber))
}
// 匹配分红规则
... ... @@ -189,7 +184,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "未匹配到分红规则",
})
continue
//return nil, application.ThrowError(application.RES_NO_FIND_ERROR, "未匹配到分红规则")
}
// 计算分红
... ... @@ -285,7 +279,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "退货单" + orderGood.DividendsReturnedOrderNumber + "不存在",
})
continue
//return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红退货单不存在")
}
if dividendsReturnedOrder == nil {
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
... ... @@ -298,7 +291,6 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
Reason: "退货单" + orderGood.DividendsReturnedOrderNumber + "不存在",
})
continue
//return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsReturnedOrderNumber))
}
// 匹配分红规则
var dividendsIncentivesRuleMatched *domain.DividendsIncentivesRule
... ...