...
|
...
|
@@ -236,7 +236,9 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova |
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return cooperationApplicationsApproved, nil
|
|
|
return map[string]interface{}{
|
|
|
"cooperationApplications": cooperationApplicationsApproved,
|
|
|
}, nil
|
|
|
} else {
|
|
|
return map[string]interface{}{}, nil
|
|
|
}
|
...
|
...
|
@@ -258,10 +260,41 @@ func (cooperationApplicationService *CooperationApplicationService) OneClickAppr |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// 共创申请仓储初始化
|
|
|
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
|
|
|
}
|
|
|
// 查询共创申请
|
|
|
oneClickApprovalCooperationApplicationCommand.CooperationApplicationStatus = 1 // 待审核
|
|
|
if count, cooperationApplications, err := cooperationApplicationRepository.Find(tool_funs.SimpleStructToMap(oneClickApprovalCooperationApplicationCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if count > 0 {
|
|
|
for i, _ := range cooperationApplications {
|
|
|
if oneClickApprovalCooperationApplicationCommand.Action == 1 {
|
|
|
cooperationApplications[i].CooperationApplicationStatus = 2
|
|
|
} else if oneClickApprovalCooperationApplicationCommand.Action == 2 {
|
|
|
cooperationApplications[i].CooperationApplicationStatus = 3
|
|
|
}
|
|
|
cooperationApplications[i].CooperationApplicationDescription = oneClickApprovalCooperationApplicationCommand.CooperationApplicationVerifyDescription
|
|
|
}
|
|
|
cooperationApplicationsApproved, err := cooperationApplicationRepository.UpdateMany(cooperationApplications)
|
|
|
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())
|
|
|
}
|
|
|
return cooperationApplicationsApproved, nil
|
|
|
} else {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未找到待审核的共创申请")
|
|
|
}
|
|
|
}
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// CreateCooperationApplication 创建共创申请服务
|
...
|
...
|
@@ -434,6 +467,7 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
// 共创申请仓储初始化
|
|
|
var cooperationApplicationRepository domain.CooperationApplicationRepository
|
|
|
if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
|