...
|
...
|
@@ -11,6 +11,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
)
|
...
|
...
|
@@ -529,42 +530,43 @@ func (cooperationProjectService *CooperationProjectService) BatchEndCooperationP |
|
|
}()
|
|
|
|
|
|
// 共创项目仓储初始化
|
|
|
//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 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
|
|
|
}
|
|
|
|
|
|
// 转换共创项目ID列表类型
|
|
|
//cooperationProjectIds, err := utils.SliceAtoi(batchEndCooperationProjectCommand.CooperationProjectIds)
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//}
|
|
|
|
|
|
//cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectId": batchEndCooperationProjectCommand.CooperationProjectId})
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//}
|
|
|
//if cooperationProject == nil {
|
|
|
// return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(batchEndCooperationProjectCommand.CooperationProjectId)))
|
|
|
//}
|
|
|
|
|
|
//if err := cooperationProject.Update(tool_funs.SimpleStructToMap(batchEndCooperationProjectCommand)); err != nil {
|
|
|
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
//}
|
|
|
//
|
|
|
//if cooperationProject, err := cooperationProjectRepository.Save(cooperationProject); 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 cooperationProject, nil
|
|
|
//}
|
|
|
return nil, nil
|
|
|
cooperationProjectIds, err := utils.SliceAtoi(batchEndCooperationProjectCommand.CooperationProjectIds)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if count, cooperationProjects, err := cooperationProjectRepository.Find(map[string]interface{}{
|
|
|
"cooperationProjectIds": cooperationProjectIds,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if count > 0 {
|
|
|
for i, _ := range cooperationProjects {
|
|
|
cooperationProjects[i].Status = 2
|
|
|
}
|
|
|
cooperationProjectsEnded, err := cooperationProjectRepository.UpdateMany(cooperationProjects)
|
|
|
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 map[string]interface{}{
|
|
|
"cooperationProjects": cooperationProjectsEnded,
|
|
|
}, nil
|
|
|
} else {
|
|
|
return map[string]interface{}{}, nil
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func NewCooperationProjectService(options map[string]interface{}) *CooperationProjectService {
|
...
|
...
|
|