...
|
...
|
@@ -238,14 +238,39 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
|
} else {
|
|
|
cooperationProjectDao = value
|
|
|
}
|
|
|
// 获取可删除的承接对象类型
|
|
|
undertakerTypesUncheckedAvailable, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
|
|
|
// 可以去除勾选的承接人对象列表
|
|
|
var undertakerTypesUncheckedAvailable []int32
|
|
|
|
|
|
// 判断承接对象是否存在员工
|
|
|
gotUser, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
|
|
"cooperationProjectUndertakerTypes": cooperationProject.CooperationProjectUndertakerTypes,
|
|
|
"user": true,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if !gotUser {
|
|
|
undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 1)
|
|
|
}
|
|
|
|
|
|
// 判断承接对象是否存在共创用户
|
|
|
gotPartner, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
|
|
"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)
|
|
|
}
|
|
|
|
|
|
cooperationProjectDto := &dto.CooperationProjectsDto{}
|
|
|
if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -283,39 +308,10 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje |
|
|
if count, cooperationProjects, err := cooperationProjectRepository.Find(tool_funs.SimpleStructToMap(listCooperationProjectQuery)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
//var cooperationModeRepository domain.CooperationModeRepository
|
|
|
//if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
//}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//} else {
|
|
|
// cooperationProjectRepository = value
|
|
|
//}
|
|
|
//var modeMap = make(map[string]*domain.CooperationMode)
|
|
|
//if _, cooperationProjects, err := cooperationModeRepository.Find(map[string]interface{}{"companyId":listCooperationProjectQuery.CompanyId,"orgId":listCooperationProjectQuery.OrgId}); err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//}else{
|
|
|
// for i:=range cooperationProjects{
|
|
|
// p :=cooperationProjects[i]
|
|
|
// modeMap[p.CooperationModeNumber]=p
|
|
|
// }
|
|
|
//}
|
|
|
//
|
|
|
//var res []*dto.CooperationProjectsDto
|
|
|
//for i := range cooperationProjects {
|
|
|
// p := cooperationProjects[i]
|
|
|
// tp := &dto.CooperationProjectsDto{}
|
|
|
// tp.LoadDto(p, &domain.CooperationMode{})
|
|
|
// res = append(res, tp)
|
|
|
//}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
//"grid": map[string]interface{}{
|
|
|
//"total": count,
|
|
|
//"list": res,
|
|
|
//},
|
|
|
"list": cooperationProjects,
|
|
|
"total": count,
|
|
|
}, nil
|
...
|
...
|
|