|
@@ -121,9 +121,17 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
@@ -121,9 +121,17 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
121
|
organization = data
|
121
|
organization = data
|
|
122
|
}
|
122
|
}
|
|
123
|
|
123
|
|
|
|
|
124
|
+ // 部门REST服务初始化
|
|
|
|
125
|
+ var departmentService service.DepartmentService
|
|
|
|
126
|
+ if value, err := factory.CreateDepartmentService(map[string]interface{}{}); err != nil {
|
|
|
|
127
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
128
|
+ } else {
|
|
|
|
129
|
+ departmentService = value
|
|
|
|
130
|
+ }
|
|
|
|
131
|
+
|
|
124
|
// 获取部门信息
|
132
|
// 获取部门信息
|
|
125
|
- var department *domain.Org
|
|
|
|
126
|
- if data, err := organizationService.OrgFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.DepartmentId); err != nil {
|
133
|
+ var department *domain.Department
|
|
|
|
134
|
+ if data, err := departmentService.DepartmentFrom(createCooperationProjectCommand.CompanyId, createCooperationProjectCommand.DepartmentId); err != nil {
|
|
127
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息失败")
|
135
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息失败")
|
|
128
|
} else {
|
136
|
} else {
|
|
129
|
department = data
|
137
|
department = data
|
|
@@ -179,7 +187,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
@@ -179,7 +187,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
179
|
CooperationProjectPublishTime: time.Now(),
|
187
|
CooperationProjectPublishTime: time.Now(),
|
|
180
|
Attachment: createCooperationProjectCommand.Attachment,
|
188
|
Attachment: createCooperationProjectCommand.Attachment,
|
|
181
|
Company: company,
|
189
|
Company: company,
|
|
182
|
- Department: department.ToDepartment(),
|
190
|
+ Department: department,
|
|
183
|
Org: organization,
|
191
|
Org: organization,
|
|
184
|
Operator: operator,
|
192
|
Operator: operator,
|
|
185
|
OperateTime: time.Now(),
|
193
|
OperateTime: time.Now(),
|
|
@@ -377,13 +385,13 @@ func (cooperationProjectService *CooperationProjectService) RemoveCooperationPro |
|
@@ -377,13 +385,13 @@ func (cooperationProjectService *CooperationProjectService) RemoveCooperationPro |
|
377
|
if cooperationProject == nil {
|
385
|
if cooperationProject == nil {
|
|
378
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationProjectCommand.CooperationProjectId, 10)))
|
386
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeCooperationProjectCommand.CooperationProjectId, 10)))
|
|
379
|
}
|
387
|
}
|
|
380
|
- if cooperationProject, err := cooperationProjectRepository.Remove(cooperationProject); err != nil {
|
388
|
+ if cooperationProjectRemoved, err := cooperationProjectRepository.Remove(cooperationProject); err != nil {
|
|
381
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
389
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
382
|
} else {
|
390
|
} else {
|
|
383
|
if err := transactionContext.CommitTransaction(); err != nil {
|
391
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
384
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
392
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
385
|
}
|
393
|
}
|
|
386
|
- return cooperationProject, nil
|
394
|
+ return cooperationProjectRemoved, nil
|
|
387
|
}
|
395
|
}
|
|
388
|
}
|
396
|
}
|
|
389
|
|
397
|
|
|
@@ -417,10 +425,8 @@ func (cooperationProjectService *CooperationProjectService) SearchCooperationPro |
|
@@ -417,10 +425,8 @@ func (cooperationProjectService *CooperationProjectService) SearchCooperationPro |
|
417
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
425
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
418
|
}
|
426
|
}
|
|
419
|
return map[string]interface{}{
|
427
|
return map[string]interface{}{
|
|
420
|
- //"grid": map[string]interface{}{
|
|
|
|
421
|
"total": count,
|
428
|
"total": count,
|
|
422
|
"list": cooperationProjects,
|
429
|
"list": cooperationProjects,
|
|
423
|
- //},
|
|
|
|
424
|
}, nil
|
430
|
}, nil
|
|
425
|
}
|
431
|
}
|
|
426
|
}
|
432
|
}
|
|
@@ -507,13 +513,13 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec |
|
@@ -507,13 +513,13 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec |
|
507
|
if err := cooperationProject.Update(tool_funs.SimpleStructToMap(updateCooperationProjectCommand)); err != nil {
|
513
|
if err := cooperationProject.Update(tool_funs.SimpleStructToMap(updateCooperationProjectCommand)); err != nil {
|
|
508
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
514
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
509
|
}
|
515
|
}
|
|
510
|
- if cooperationProject, err := cooperationProjectRepository.Save(cooperationProject); err != nil {
|
516
|
+ if cooperationProjectSaved, err := cooperationProjectRepository.Save(cooperationProject); err != nil {
|
|
511
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
517
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
512
|
} else {
|
518
|
} else {
|
|
513
|
if err := transactionContext.CommitTransaction(); err != nil {
|
519
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
514
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
520
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
515
|
}
|
521
|
}
|
|
516
|
- return cooperationProject, nil
|
522
|
+ return cooperationProjectSaved, nil
|
|
517
|
}
|
523
|
}
|
|
518
|
}
|
524
|
}
|
|
519
|
|
525
|
|