作者 陈志颖

fix:承接人类型校验

@@ -122,8 +122,9 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop @@ -122,8 +122,9 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
122 } 122 }
123 123
124 // 校验:判断用户类型是否属于承接对象 124 // 校验:判断用户类型是否属于承接对象
125 - if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 4) { // 非公开类型校验  
126 - if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, applicant.UserType) { 125 + if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, 3) { // 非公开类型校验
  126 + userType := applicant.UserType ^ 1024
  127 + if !utils.IsContain(cooperationProject.CooperationProjectUndertakerTypes, userType) {
127 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象") 128 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
128 } 129 }
129 } 130 }
@@ -160,10 +160,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -160,10 +160,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
160 160
161 // 校验承接人是否属于承接对象,1员工,2共创用户,4公开 161 // 校验承接人是否属于承接对象,1员工,2共创用户,4公开
162 if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 3) { 162 if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 3) {
163 - var userType int32  
164 - if undertakerDomain.UserType > 1024 {  
165 - userType = undertakerDomain.UserType - 1024  
166 - } 163 + userType := undertakerDomain.UserType ^ 1024
167 if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, userType) { 164 if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, userType) {
168 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象") 165 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
169 } 166 }
@@ -1027,10 +1024,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -1027,10 +1024,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
1027 1024
1028 // 校验:判断用户类型是否属于承接对象 1025 // 校验:判断用户类型是否属于承接对象
1029 if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 3) { // 非公开类型校验 1026 if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 3) { // 非公开类型校验
1030 - var userType int32  
1031 - if undertakerDomain.UserType > 1024 {  
1032 - userType = undertakerDomain.UserType - 1024  
1033 - } 1027 + userType := undertakerDomain.UserType ^ 1024
1034 if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, userType) { 1028 if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, userType) {
1035 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象") 1029 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象")
1036 } 1030 }
@@ -170,6 +170,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro @@ -170,6 +170,7 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
170 if err2 != nil { 170 if err2 != nil {
171 return nil, application.ThrowError(application.TRANSACTION_ERROR, err2.Error()) 171 return nil, application.ThrowError(application.TRANSACTION_ERROR, err2.Error())
172 } 172 }
  173 +
173 // 校验共创项目编号是否唯一 174 // 校验共创项目编号是否唯一
174 numberAvailable, _ := cooperationProjectDao.CheckProjectNumberAvailable(map[string]interface{}{ 175 numberAvailable, _ := cooperationProjectDao.CheckProjectNumberAvailable(map[string]interface{}{
175 "companyId": createCooperationProjectCommand.CompanyId, 176 "companyId": createCooperationProjectCommand.CompanyId,