作者 陈志颖

fix:承接人类型校验

... ... @@ -122,8 +122,9 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
}
// 校验:判断用户类型是否属于承接对象
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 4) { // 非公开类型校验
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType) {
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 3) { // 非公开类型校验
userType := applicant.UserType ^ 1024
if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, userType) {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
}
}
... ...
... ... @@ -160,10 +160,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
// 校验承接人是否属于承接对象,1员工,2共创用户,4公开
if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 3) {
var userType int32
if undertakerDomain.UserType > 1024 {
userType = undertakerDomain.UserType - 1024
}
userType := undertakerDomain.UserType ^ 1024
if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, userType) {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
}
... ... @@ -1027,10 +1024,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
// 校验:判断用户类型是否属于承接对象
if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 3) { // 非公开类型校验
var userType int32
if undertakerDomain.UserType > 1024 {
userType = undertakerDomain.UserType - 1024
}
userType := undertakerDomain.UserType ^ 1024
if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, userType) {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
}
... ...
... ... @@ -170,6 +170,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
if err2 != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err2.Error())
}
// 校验共创项目编号是否唯一
numberAvailable, _ := cooperationProjectDao.CheckProjectNumberAvailable(map[string]interface{}{
"companyId": createCooperationProjectCommand.CompanyId,
... ...