...
|
...
|
@@ -521,7 +521,6 @@ func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimat |
|
|
|
|
|
// ConfirmDividendsIncentivesEstimate 确定业绩激励分红预算
|
|
|
func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncentivesEstimate(confirmDividendsIncentivesEstimateCommand *command.ConfirmDividendsIncentivesEstimateCommand) (interface{}, error) {
|
|
|
start := time.Now() // 获取当前时间
|
|
|
if err := confirmDividendsIncentivesEstimateCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -699,13 +698,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
// 统计预算失败的分红订单
|
|
|
estimateFailedDividendsOrders := make(map[string]string)
|
|
|
|
|
|
initRepo := time.Since(start)
|
|
|
log.Logger.Info("初始化耗时", map[string]interface{}{
|
|
|
"初始化耗时": initRepo.Seconds(),
|
|
|
})
|
|
|
|
|
|
startFindOrderGood := time.Now() // 获取当前时间
|
|
|
|
|
|
// 获取订单产品
|
|
|
if _, orderGoods, err := orderGoodRepository.Find(map[string]interface{}{
|
|
|
"orderGoodIds": orderGoodIds,
|
...
|
...
|
@@ -713,12 +705,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
|
|
|
findOrderGood := time.Since(startFindOrderGood)
|
|
|
log.Logger.Info("查询预算产品耗时", map[string]interface{}{
|
|
|
"初始化耗时": findOrderGood.Seconds(),
|
|
|
})
|
|
|
|
|
|
dividendsEstimates := make([]*domain.DividendsEstimate, 0)
|
|
|
|
|
|
var cooperationContractNumbers []string
|
...
|
...
|
@@ -730,8 +716,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
|
|
|
newCooperationContractNumbers := utils.RemoveDuplicationString(cooperationContractNumbers)
|
|
|
|
|
|
startFindContracts := time.Now()
|
|
|
|
|
|
// 查询共创合约
|
|
|
cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)
|
|
|
if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{
|
...
|
...
|
@@ -749,11 +733,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
}
|
|
|
}
|
|
|
|
|
|
endFindContracts := time.Since(startFindContracts)
|
|
|
log.Logger.Info("查询合约耗时", map[string]interface{}{
|
|
|
"查询合约耗时": endFindContracts.Seconds(),
|
|
|
})
|
|
|
|
|
|
log.Logger.Info("查询共创合约", map[string]interface{}{
|
|
|
"cooperationContractsMap": cooperationContractsMap,
|
|
|
})
|
...
|
...
|
@@ -768,8 +747,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
|
|
|
var countDividendsEstimate int64
|
|
|
|
|
|
startConfirm := time.Now()
|
|
|
|
|
|
for _, orderGood := range orderGoods {
|
|
|
dividendsEstimate := &domain.DividendsEstimate{}
|
|
|
if orderGood.DividendsOrderNumber != "" { // 查询分红订单
|
...
|
...
|
@@ -887,25 +864,13 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
}
|
|
|
}
|
|
|
|
|
|
endConfirm := time.Since(startConfirm)
|
|
|
log.Logger.Info("预算耗时", map[string]interface{}{
|
|
|
"预算耗时": endConfirm.Seconds(),
|
|
|
})
|
|
|
|
|
|
log.Logger.Info("新增的分红预算单", map[string]interface{}{
|
|
|
"dividendsEstimates": dividendsEstimates,
|
|
|
})
|
|
|
|
|
|
startSave := time.Now()
|
|
|
|
|
|
if dividendsEstimatesSaved, err := dividendsEstimateRepository.SaveMany(dividendsEstimates); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
endSave := time.Since(startSave)
|
|
|
log.Logger.Info("保存预算单耗时", map[string]interface{}{
|
|
|
"保存预算单耗时": endSave.Seconds(),
|
|
|
})
|
|
|
|
|
|
// 获取产品ID
|
|
|
orderGoodSavedIds := make([]int64, 0)
|
|
|
for _, dividendsEstimate := range dividendsEstimates {
|
...
|
...
|
|