...
|
...
|
@@ -159,11 +159,15 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC |
|
|
}
|
|
|
|
|
|
// 校验承接人是否属于承接对象,1员工,2共创用户,4公开
|
|
|
typeExist := false
|
|
|
if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 3) {
|
|
|
for _, userType := range createCooperationContractCommand.CooperationContractUndertakerTypes {
|
|
|
if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
|
|
|
if utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {
|
|
|
typeExist = true
|
|
|
}
|
|
|
}
|
|
|
if !typeExist {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1027,11 +1031,15 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
|
}
|
|
|
|
|
|
// 校验:判断用户类型是否属于承接对象
|
|
|
typeExist := false
|
|
|
if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 3) { // 非公开类型校验
|
|
|
for _, userType := range cooperationContract.CooperationContractUndertakerTypes {
|
|
|
if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
|
|
|
if utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, undertakerDomain.UserType&userType) {
|
|
|
typeExist = true
|
|
|
}
|
|
|
}
|
|
|
if !typeExist {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象")
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|