|
@@ -175,11 +175,20 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
|
@@ -175,11 +175,20 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro |
175
|
"orgId": createCooperationProjectCommand.OrgId,
|
175
|
"orgId": createCooperationProjectCommand.OrgId,
|
176
|
"cooperationProjectNumber": projectNumber,
|
176
|
"cooperationProjectNumber": projectNumber,
|
177
|
})
|
177
|
})
|
178
|
- // TODO 校验共创项目名称是否唯一
|
|
|
179
|
-
|
|
|
180
|
if !numberAvailable {
|
178
|
if !numberAvailable {
|
181
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创项目异常")
|
179
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "新增共创项目异常")
|
182
|
}
|
180
|
}
|
|
|
181
|
+
|
|
|
182
|
+ // 校验共创项目名称是否唯一
|
|
|
183
|
+ nameAvailable, _ := cooperationProjectDao.CheckProjectNameAvailable(map[string]interface{}{
|
|
|
184
|
+ "companyId": createCooperationProjectCommand.CompanyId,
|
|
|
185
|
+ "orgId": createCooperationProjectCommand.OrgId,
|
|
|
186
|
+ "cooperationProjectName": createCooperationProjectCommand.CooperationProjectName,
|
|
|
187
|
+ })
|
|
|
188
|
+ if !nameAvailable {
|
|
|
189
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, "共创项目名称重复")
|
|
|
190
|
+ }
|
|
|
191
|
+
|
183
|
newCooperationProject := &domain.CooperationProject{
|
192
|
newCooperationProject := &domain.CooperationProject{
|
184
|
CooperationProjectNumber: projectNumber,
|
193
|
CooperationProjectNumber: projectNumber,
|
185
|
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
|
194
|
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
|
|
@@ -489,6 +498,16 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro |
|
@@ -489,6 +498,16 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro |
489
|
operator = data
|
498
|
operator = data
|
490
|
}
|
499
|
}
|
491
|
|
500
|
|
|
|
501
|
+ // 共创项目DAO初始化
|
|
|
502
|
+ var cooperationProjectDao *dao.CooperationProjectDao
|
|
|
503
|
+ if value, err := factory.CreateCooperationProjectDao(map[string]interface{}{
|
|
|
504
|
+ "transactionContext": transactionContext,
|
|
|
505
|
+ }); err != nil {
|
|
|
506
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
507
|
+ } else {
|
|
|
508
|
+ cooperationProjectDao = value
|
|
|
509
|
+ }
|
|
|
510
|
+
|
492
|
// 获取发起人
|
511
|
// 获取发起人
|
493
|
var sponsor *domain.User
|
512
|
var sponsor *domain.User
|
494
|
// sponsorUid类型转换
|
513
|
// sponsorUid类型转换
|
|
@@ -520,6 +539,18 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro |
|
@@ -520,6 +539,18 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro |
520
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationProjectCommand.CooperationProjectId)))
|
539
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationProjectCommand.CooperationProjectId)))
|
521
|
}
|
540
|
}
|
522
|
|
541
|
|
|
|
542
|
+ // 校验共创项目名称是否唯一
|
|
|
543
|
+ if cooperationProject.CooperationProjectName != updateCooperationProjectCommand.CooperationProjectName {
|
|
|
544
|
+ nameAvailable, _ := cooperationProjectDao.CheckProjectNameAvailable(map[string]interface{}{
|
|
|
545
|
+ "companyId": updateCooperationProjectCommand.CompanyId,
|
|
|
546
|
+ "orgId": updateCooperationProjectCommand.OrgId,
|
|
|
547
|
+ "cooperationProjectName": updateCooperationProjectCommand.CooperationProjectName,
|
|
|
548
|
+ })
|
|
|
549
|
+ if !nameAvailable {
|
|
|
550
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, "共创项目名称重复")
|
|
|
551
|
+ }
|
|
|
552
|
+ }
|
|
|
553
|
+
|
523
|
applicantTypes := make(map[int32]interface{})
|
554
|
applicantTypes := make(map[int32]interface{})
|
524
|
|
555
|
|
525
|
// 获取所有申请人
|
556
|
// 获取所有申请人
|