...
|
...
|
@@ -101,18 +101,31 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop |
|
|
|
|
|
var newCooperationApplication *domain.CooperationApplication
|
|
|
|
|
|
if applyForCooperationCommand.CompanyId == 0 && applyForCooperationCommand.OrgId == 0 && applyForCooperationCommand.UserId == 0 { // 游客操作
|
|
|
// TODO 获取申请人信息
|
|
|
if applyForCooperationCommand.CompanyId == 0 && applyForCooperationCommand.OrgId == 0 && applyForCooperationCommand.UserId == 0 && applyForCooperationCommand.UserBaseId != 0 { // 游客操作
|
|
|
// 获取申请人信息
|
|
|
var applicant *domain.User
|
|
|
if data, err := userService.VisitorFrom(applyForCooperationCommand.CompanyId, applyForCooperationCommand.OrgId, applyForCooperationCommand.UserBaseId); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取申请人失败")
|
|
|
} else {
|
|
|
applicant = data
|
|
|
}
|
|
|
|
|
|
// TODO 校验:同一个用户,不能多次申请同一个项目
|
|
|
// 校验:同一个用户,不能多次申请同一个项目
|
|
|
applicationExist, _ := cooperationApplicationDao.CheckApplicationExist(map[string]interface{}{
|
|
|
"visitorUserBaseId": applicant.UserBaseId,
|
|
|
"cooperationApplicationId": cooperationProject.CooperationProjectId,
|
|
|
})
|
|
|
if applicationExist {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "抱歉,您已经申请过该项目")
|
|
|
}
|
|
|
|
|
|
// TODO 校验:判断用户类型是否属于承接对象
|
|
|
//if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType) {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
|
|
|
//}
|
|
|
// 校验:判断用户类型是否属于承接对象
|
|
|
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType) {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
|
|
|
}
|
|
|
|
|
|
newCooperationApplication = &domain.CooperationApplication{
|
|
|
CooperationApplicationApplicant: nil, // TODO 获取游客(申请人)信息
|
|
|
CooperationApplicationApplicant: applicant,
|
|
|
CooperationApplicationAttachment: applyForCooperationCommand.CooperationApplicationAttachment,
|
|
|
CooperationApplicationDescription: applyForCooperationCommand.CooperationApplicationDescription,
|
|
|
CooperationApplicationStatus: 1,
|
...
|
...
|
@@ -157,6 +170,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop |
|
|
applicationExist, _ := cooperationApplicationDao.CheckApplicationExist(map[string]interface{}{
|
|
|
"companyId": applyForCooperationCommand.CompanyId,
|
|
|
"orgId": applyForCooperationCommand.OrgId,
|
|
|
"applicantId": applicant.UserId,
|
|
|
"cooperationApplicationId": cooperationProject.CooperationProjectId,
|
|
|
})
|
|
|
if applicationExist {
|
...
|
...
|
|