...
|
...
|
@@ -626,17 +626,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
for _, orderGood := range orderGoods {
|
|
|
dividendsEstimate := &domain.DividendsEstimate{}
|
|
|
if orderGood.DividendsOrderNumber != "" { // 查询分红订单
|
|
|
//dividendsOrder, err3 := dividendsOrderRepository.FindOne(map[string]interface{}{
|
|
|
// "dividendsOrderNumber": orderGood.DividendsOrderNumber,
|
|
|
// "companyId": orderGood.CompanyId,
|
|
|
// "orgId": orderGood.OrgId,
|
|
|
//})
|
|
|
//if err3 != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单不存在")
|
|
|
//}
|
|
|
//if dividendsOrder == nil {
|
|
|
// return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("分红订单%s不存在", orderGood.DividendsOrderNumber))
|
|
|
//}
|
|
|
// 分红订单产品预算
|
|
|
if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoods); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -753,6 +742,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
}
|
|
|
|
|
|
// 获取订单产品
|
|
|
if len(orderGoodSavedIds) > 0 {
|
|
|
if countOrderGood, orderGoodsFound, err := orderGoodRepository.Find(map[string]interface{}{
|
|
|
"orderGoodIds": orderGoodSavedIds,
|
|
|
}); err != nil {
|
...
|
...
|
@@ -767,7 +757,9 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 完成第一阶段事务提交
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -788,7 +780,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
failedReasonStr = "无"
|
|
|
}
|
|
|
|
|
|
// 开启薪事务
|
|
|
// 开启第二阶段事务:处理订单和产品状态
|
|
|
newTransactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -893,6 +885,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 完成第二阶段事务提交
|
|
|
if err := newTransactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
|