...
|
...
|
@@ -12,6 +12,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
)
|
...
|
...
|
@@ -244,6 +245,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
// 共创项目仓储初始化
|
|
|
var cooperationProjectRepository domain.CooperationProjectRepository
|
|
|
if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -252,6 +255,18 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
|
} else {
|
|
|
cooperationProjectRepository = value
|
|
|
}
|
|
|
|
|
|
// 共创申请仓储初始化
|
|
|
var cooperationApplicationRepository domain.CooperationApplicationRepository
|
|
|
if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
cooperationApplicationRepository = value
|
|
|
}
|
|
|
|
|
|
// 获取共创项目
|
|
|
cooperationProject, err := cooperationProjectRepository.FindOne(tool_funs.SimpleStructToMap(getCooperationProjectQuery))
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -276,6 +291,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
|
gotUser, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
|
|
"user": true,
|
|
|
"companyId": getCooperationProjectQuery.CompanyId,
|
|
|
"orgId": getCooperationProjectQuery.OrgId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -288,6 +305,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
|
gotPartner, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
|
|
"partner": true,
|
|
|
"companyId": getCooperationProjectQuery.CompanyId,
|
|
|
"orgId": getCooperationProjectQuery.OrgId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -301,10 +320,32 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
|
undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3)
|
|
|
}
|
|
|
|
|
|
// TODO 返回所有员工类型的申请通过人
|
|
|
// 返回所有员工类型的申请通过人
|
|
|
applicants := make([]*domain.User, 0)
|
|
|
// 获取当前项目的所有申请
|
|
|
if countApplication, cooperationApplications, err := cooperationApplicationRepository.Find(map[string]interface{}{
|
|
|
"cooperationProjectNumberExact": cooperationProject.CooperationProjectNumber,
|
|
|
"companyId": cooperationProject.Company.CompanyId,
|
|
|
"orgId": cooperationProject.Org.OrgId,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
if countApplication > 0 {
|
|
|
for _, cooperationApplication := range cooperationApplications {
|
|
|
log.Logger.Info("申请人", map[string]interface{}{
|
|
|
"applicant": cooperationApplication.CooperationApplicationApplicant,
|
|
|
})
|
|
|
userType := cooperationApplication.CooperationApplicationApplicant.UserType & 1
|
|
|
fmt.Printf("用户类型值: %d\n", userType)
|
|
|
if userType == 1 && cooperationApplication.CooperationApplicationStatus == 2 { // 申请人中的员工类型,审核中通过的
|
|
|
applicants = append(applicants, cooperationApplication.CooperationApplicationApplicant)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
cooperationProjectDto := &dto.CooperationProjectsDto{}
|
|
|
if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil {
|
|
|
if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable, applicants); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
...
|
...
|
|