...
|
...
|
@@ -640,6 +640,26 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
dividendsReturnedOrderRepository = value
|
|
|
}
|
|
|
|
|
|
// 共创合约仓储初始化
|
|
|
var cooperationContractRepository domain.CooperationContractRepository
|
|
|
if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
cooperationContractRepository = value
|
|
|
}
|
|
|
|
|
|
// 共创项目仓储初始化
|
|
|
var cooperationProjectRepository domain.CooperationProjectRepository
|
|
|
if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
cooperationProjectRepository = value
|
|
|
}
|
|
|
|
|
|
// 初始化确认业绩激励分红预算领域服务
|
|
|
var confirmDividendsIncentivesEstimateService service.ConfirmDividendsIncentivesEstimateService
|
|
|
if value, err := factory.CreateConfirmDividendsIncentivesEstimateService(map[string]interface{}{
|
...
|
...
|
@@ -653,6 +673,38 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
})
|
|
|
}
|
|
|
|
|
|
// 查询共创合约
|
|
|
cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)
|
|
|
if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{
|
|
|
"companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
|
|
"orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
|
|
|
"offsetLimit": false,
|
|
|
}); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
if count > 0 {
|
|
|
for _, cooperationContractFound := range cooperationContractsFound {
|
|
|
cooperationContractsMap[cooperationContractFound.CooperationContractNumber] = cooperationContractFound
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 查询共创项目
|
|
|
cooperationProjectsMap := make(map[string]*domain.CooperationProject, 0)
|
|
|
if count, cooperationProjectsFound, err := cooperationProjectRepository.Find(map[string]interface{}{
|
|
|
"companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
|
|
|
"orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
|
|
|
"offsetLimit": false,
|
|
|
}); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
if count > 0 {
|
|
|
for _, cooperationProjectFound := range cooperationProjectsFound {
|
|
|
cooperationProjectsMap[cooperationProjectFound.CooperationProjectNumber] = cooperationProjectFound
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 统计成功预算的分红订单
|
|
|
estimateSuccessfullyDividendsOrders := make(map[string]string)
|
|
|
|
...
|
...
|
@@ -684,7 +736,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
|
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
|
|
// 分红订单产品预算
|
|
|
if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId); err != nil {
|
|
|
if dividendsEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, cooperationProjectsMap); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
for _, dividendsEstimateDetail := range dividendsEstimateDetails {
|
...
|
...
|
@@ -740,7 +792,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent |
|
|
orderGoodsToConfirm := make([]*domain.OrderGood, 0)
|
|
|
orderGoodsToConfirm = append(orderGoodsToConfirm, orderGood)
|
|
|
// 分红退货单产品预算
|
|
|
if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId); err != nil {
|
|
|
if dividendsReturnedEstimateDetails, err := confirmDividendsIncentivesEstimateService.Confirm(orderGoodsToConfirm, confirmDividendsIncentivesEstimateCommand.CompanyId, confirmDividendsIncentivesEstimateCommand.OrgId, cooperationContractsMap, cooperationProjectsMap); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
for _, dividendsReturnedEstimateDetail := range dividendsReturnedEstimateDetails {
|
...
|
...
|
|