...
|
...
|
@@ -14,6 +14,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
)
|
...
|
...
|
@@ -373,7 +374,10 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
orderGoodIds, _ := utils.SliceAtoi(confirmDividendsIncentivesEstimateCommand.OrderGoodIds)
|
|
|
orderGoodIds, err := utils.SliceAtoi(confirmDividendsIncentivesEstimateCommand.OrderGoodIds)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 用户REST服务初始化
|
|
|
//var userService service.UserService
|
...
|
...
|
@@ -575,13 +579,12 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var dividendsEstimatesSaved []*domain.DividendsEstimate
|
|
|
for _, dividendsEstimate := range dividendsEstimates {
|
|
|
if dividendsEstimateSaved, err := dividendsEstimateRepository.Save(dividendsEstimate); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
dividendsEstimatesSaved = append(dividendsEstimatesSaved, dividendsEstimateSaved)
|
|
|
}
|
|
|
log.Logger.Info("新增的分红预算单", map[string]interface{}{
|
|
|
"dividendsEstimates": dividendsEstimates,
|
|
|
})
|
|
|
dividendsEstimatesSaved, err := dividendsEstimateRepository.SaveMany(dividendsEstimates)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -737,11 +740,16 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentives |
|
|
dividendsEstimatesSaved = append(dividendsEstimatesSaved, dividendsEstimateSaved)
|
|
|
}
|
|
|
}
|
|
|
if confirmMoneyIncentivesEstimateCommand.Action == 1 { // 只预算,不入库
|
|
|
return dividendsEstimatesSaved, nil
|
|
|
} else if confirmMoneyIncentivesEstimateCommand.Action == 2 { // 确定预算
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return dividendsEstimatesSaved, nil
|
|
|
}
|
|
|
return dividendsEstimatesSaved, nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// GetDividendsEstimate 返回分红预算单详情
|
...
|
...
|
|