...
|
...
|
@@ -18,27 +18,6 @@ import ( |
|
|
type CooperationApplicationService struct {
|
|
|
}
|
|
|
|
|
|
// ApprovalCooperationApplication 审核共创申请
|
|
|
func (cooperationApplicationService *CooperationApplicationService) ApprovalCooperationApplication(approvalCooperationApplicationCommand *command.ApprovalCooperationApplicationCommand) (interface{}, error) {
|
|
|
if err := approvalCooperationApplicationCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// ApplyForCooperation 申请共创
|
|
|
func (cooperationApplicationService *CooperationApplicationService) ApplyForCooperation(applyForCooperationCommand *command.ApplyForCooperationCommand) (interface{}, error) {
|
|
|
if err := applyForCooperationCommand.ValidateCommand(); err != nil {
|
...
|
...
|
@@ -68,8 +47,6 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop |
|
|
}
|
|
|
if cooperationProject == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", applyForCooperationCommand.CooperationProjectNumber))
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
|
|
|
// 用户REST服务初始化
|
...
|
...
|
@@ -156,9 +133,73 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop |
|
|
}
|
|
|
}
|
|
|
|
|
|
// BatchApprovalCooperationApplication 一键审核共创申请
|
|
|
func (cooperationApplicationService *CooperationApplicationService) BatchApprovalCooperationApplication(batchApprovalCooperationApplicatonCommand *command.BatchApprovalCooperationApplicationCommand) (interface{}, error) {
|
|
|
if err := batchApprovalCooperationApplicatonCommand.ValidateCommand(); err != nil {
|
|
|
// ApprovalCooperationApplication 审核共创申请
|
|
|
func (cooperationApplicationService *CooperationApplicationService) ApprovalCooperationApplication(approvalCooperationApplicationCommand *command.ApprovalCooperationApplicationCommand) (interface{}, error) {
|
|
|
if err := approvalCooperationApplicationCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
var cooperationApplicationRepository domain.CooperationApplicationRepository
|
|
|
if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
cooperationApplicationRepository = value
|
|
|
}
|
|
|
cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": approvalCooperationApplicationCommand.CooperationApplicationId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if cooperationApplication == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(approvalCooperationApplicationCommand.CooperationApplicationId, 10)))
|
|
|
}
|
|
|
if err := cooperationApplication.Update(tool_funs.SimpleStructToMap(approvalCooperationApplicationCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if cooperationApplicationSaved, err := cooperationApplicationRepository.Save(cooperationApplication); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return cooperationApplicationSaved, nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// BatchApprovalCooperationApplication 批量审核共创申请
|
|
|
func (cooperationApplicationService *CooperationApplicationService) BatchApprovalCooperationApplication(batchApprovalCooperationApplicationCommand *command.BatchApprovalCooperationApplicationCommand) (interface{}, error) {
|
|
|
if err := batchApprovalCooperationApplicationCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// OneClickApprovalCooperationApplication 一键审核共创申请
|
|
|
func (cooperationApplicationService *CooperationApplicationService) OneClickApprovalCooperationApplication(oneClickApprovalCooperationApplicationCommand *command.OneClickApprovalCooperationApplicationCommand) (interface{}, error) {
|
|
|
if err := oneClickApprovalCooperationApplicationCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
...
|
...
|
|