...
|
...
|
@@ -121,9 +121,17 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
|
organization = data
|
|
|
}
|
|
|
|
|
|
// 部门REST服务初始化
|
|
|
var departmentService service.DepartmentService
|
|
|
if value, err := factory.CreateDepartmentService(map[string]interface{}{}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
departmentService = value
|
|
|
}
|
|
|
|
|
|
// 获取部门信息
|
|
|
var department *domain.Org
|
|
|
if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.DepartmentId); err != nil {
|
|
|
var department *domain.Department
|
|
|
if data, err := departmentService.DepartmentFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.DepartmentId); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息失败")
|
|
|
} else {
|
|
|
department = data
|
...
|
...
|
@@ -179,7 +187,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
|
CooperationProjectPublishTime: time.Now(),
|
|
|
Attachment: createCooperationProjectCommand.Attachment,
|
|
|
Company: company,
|
|
|
Department: department.ToDepartment(),
|
|
|
Department: department,
|
|
|
Org: organization,
|
|
|
Operator: operator,
|
|
|
OperateTime: time.Now(),
|
...
|
...
|
@@ -377,13 +385,13 @@ func (cooperationProjectService *CooperationProjectService) RemoveCooperationPro |
|
|
if cooperationProject == nil {
|
|
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationProjectCommand.CooperationProjectId, 10)))
|
|
|
}
|
|
|
if cooperationProject, err := cooperationProjectRepository.Remove(cooperationProject); err != nil {
|
|
|
if cooperationProjectRemoved, err := cooperationProjectRepository.Remove(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 cooperationProjectRemoved, nil
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -417,10 +425,8 @@ func (cooperationProjectService *CooperationProjectService) SearchCooperationPro |
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
//"grid": map[string]interface{}{
|
|
|
"total": count,
|
|
|
"list": cooperationProjects,
|
|
|
//},
|
|
|
}, nil
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -507,13 +513,13 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec |
|
|
if err := cooperationProject.Update(tool_funs.SimpleStructToMap(updateCooperationProjectCommand)); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if cooperationProject, err := cooperationProjectRepository.Save(cooperationProject); err != nil {
|
|
|
if cooperationProjectSaved, 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 cooperationProjectSaved, nil
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|