...
|
...
|
@@ -365,14 +365,39 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont |
|
|
} else {
|
|
|
cooperationContractDao = value
|
|
|
}
|
|
|
// 获取可删除的承接对象类型
|
|
|
undertakerTypesUncheckedAvailable, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
"cooperationContractNumber": cooperationContract.CooperationContractNumber,
|
|
|
"cooperationContractUndertakerTypes": cooperationContract.CooperationContractUndertakerTypes,
|
|
|
|
|
|
// 可以去除勾选的承接人对象列表
|
|
|
var undertakerTypesUncheckedAvailable []int32
|
|
|
|
|
|
// 判断承接对象是否存在员工
|
|
|
gotUser, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
"cooperationContractNumber": cooperationContract.CooperationContractNumber,
|
|
|
"user": true,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if !gotUser {
|
|
|
undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 1)
|
|
|
}
|
|
|
|
|
|
// 判断承接对象是否存在共创用户
|
|
|
gotPartner, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
"cooperationContractNumber": cooperationContract.CooperationContractNumber,
|
|
|
"partner": true,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if !gotPartner {
|
|
|
undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 2)
|
|
|
}
|
|
|
|
|
|
// 判断承接人是否存在公开用户
|
|
|
if !gotUser && !gotPartner {
|
|
|
undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3)
|
|
|
}
|
|
|
|
|
|
cooperationContractDto := &dto.CooperationContractDto{}
|
|
|
if err := cooperationContractDto.LoadDto(cooperationContract, undertakerTypesUncheckedAvailable); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
|