...
|
...
|
@@ -2,8 +2,10 @@ package service |
|
|
|
|
|
import (
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/transaction/pg"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/statistics/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService"
|
|
|
)
|
|
|
|
|
|
// CommonStatisticsService 通用的统计服务
|
...
|
...
|
@@ -11,8 +13,8 @@ type CommonStatisticsService struct { |
|
|
}
|
|
|
|
|
|
// CommonStatisticsService 通用的统计服务
|
|
|
func (svr *CommonStatisticsService) CommonStatisticsService(contractStatisticsQuery *query.CommonStatisticsQuery) (interface{}, error) {
|
|
|
if err := contractStatisticsQuery.ValidateQuery(); err != nil {
|
|
|
func (svr *CommonStatisticsService) CommonStatisticsService(cmd *query.CommonStatisticsQuery) (interface{}, error) {
|
|
|
if err := cmd.ValidateQuery(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
var err error
|
...
|
...
|
@@ -27,58 +29,18 @@ func (svr *CommonStatisticsService) CommonStatisticsService(contractStatisticsQu |
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
//statisticsService, err := factory.CreateCooperationStatisticsService(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//})
|
|
|
//var res interface{}
|
|
|
//switch contractStatisticsQuery.Action {
|
|
|
//case domain_service.SearchContractDividends:
|
|
|
// res, err = statisticsService.SearchContractDividends(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.GetContractDividends:
|
|
|
// res, err = statisticsService.GetContractDividends(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CooperationGoodsStatistics:
|
|
|
// res, err = statisticsService.CooperationGoodsStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CooperationModeStatistics:
|
|
|
// res, err = statisticsService.CooperationModeStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CompanyDividendsStatistics:
|
|
|
// res, err = statisticsService.CompanyDividendsStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CompanyCooperationUsersStatistics:
|
|
|
// res, err = statisticsService.CompanyCooperationUsersStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CompanyPaymentHistoryStatistics:
|
|
|
// res, err = statisticsService.CompanyPaymentHistoryStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CompanyCooperationProjectContracts:
|
|
|
// res, err = statisticsService.CompanyCooperationProjectContracts(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.PaymentHistoryHistogramStatistics:
|
|
|
// res, err = statisticsService.PaymentHistoryHistogramStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CooperationUserModeStatistics:
|
|
|
// res, err = statisticsService.CooperationUserModeStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.DividendsStatistics:
|
|
|
// res, err = statisticsService.DividendsStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.SearchDividendsEstimates:
|
|
|
// res, err = statisticsService.SearchDividendsEstimates(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CooperationCompanyStatistics:
|
|
|
// res, err = statisticsService.CooperationCompanyStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.PersonCooperationContractStatistics:
|
|
|
// res, err = statisticsService.PersonCooperationContractStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.PersonCompanyPaymentHistoryStatistics:
|
|
|
// res, err = statisticsService.PersonCompanyPaymentHistoryStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.PersonCooperationProjectSharedInfo:
|
|
|
// res, err = statisticsService.PersonCooperationProjectSharedInfo(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.PersonCooperationProjectSharedInfoAttachment:
|
|
|
// res, err = statisticsService.PersonCooperationProjectSharedInfoAttachment(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.PersonCooperationCompany:
|
|
|
// res, err = statisticsService.PersonCooperationCompany(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.CreditAccountStatistics:
|
|
|
// res, err = statisticsService.CreditAccountStatistics(contractStatisticsQuery.QueryOptions)
|
|
|
//case domain_service.RelevantCooperationContractNumbers:
|
|
|
// res, err = statisticsService.RelevantCooperationContractNumbers(contractStatisticsQuery.QueryOptions)
|
|
|
//}
|
|
|
statisticsService, _ := domainService.NewPGCommonStatisticsService(transactionContext.(*pg.TransactionContext))
|
|
|
response, err := statisticsService.CommonStatistics(cmd.Action, cmd.QueryOptions)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return struct {
|
|
|
}{}, nil
|
|
|
return response, nil
|
|
|
}
|
|
|
|
|
|
func NewCommonStatisticsService(options map[string]interface{}) *CommonStatisticsService {
|
|
|
newProductSectionService := &CommonStatisticsService{}
|
|
|
return newProductSectionService
|
|
|
} |
...
|
...
|
|