|
@@ -12,6 +12,7 @@ import ( |
|
@@ -12,6 +12,7 @@ import ( |
12
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
|
12
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
|
13
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
|
13
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
|
14
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
14
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
|
|
15
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
|
15
|
"strconv"
|
16
|
"strconv"
|
16
|
"time"
|
17
|
"time"
|
17
|
)
|
18
|
)
|
|
@@ -244,6 +245,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
@@ -244,6 +245,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
244
|
defer func() {
|
245
|
defer func() {
|
245
|
_ = transactionContext.RollbackTransaction()
|
246
|
_ = transactionContext.RollbackTransaction()
|
246
|
}()
|
247
|
}()
|
|
|
248
|
+
|
|
|
249
|
+ // 共创项目仓储初始化
|
247
|
var cooperationProjectRepository domain.CooperationProjectRepository
|
250
|
var cooperationProjectRepository domain.CooperationProjectRepository
|
248
|
if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
|
251
|
if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
|
249
|
"transactionContext": transactionContext,
|
252
|
"transactionContext": transactionContext,
|
|
@@ -252,6 +255,18 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
@@ -252,6 +255,18 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
252
|
} else {
|
255
|
} else {
|
253
|
cooperationProjectRepository = value
|
256
|
cooperationProjectRepository = value
|
254
|
}
|
257
|
}
|
|
|
258
|
+
|
|
|
259
|
+ // 共创申请仓储初始化
|
|
|
260
|
+ var cooperationApplicationRepository domain.CooperationApplicationRepository
|
|
|
261
|
+ if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
|
|
262
|
+ "transactionContext": transactionContext,
|
|
|
263
|
+ }); err != nil {
|
|
|
264
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
265
|
+ } else {
|
|
|
266
|
+ cooperationApplicationRepository = value
|
|
|
267
|
+ }
|
|
|
268
|
+
|
|
|
269
|
+ // 获取共创项目
|
255
|
cooperationProject, err := cooperationProjectRepository.FindOne(tool_funs.SimpleStructToMap(getCooperationProjectQuery))
|
270
|
cooperationProject, err := cooperationProjectRepository.FindOne(tool_funs.SimpleStructToMap(getCooperationProjectQuery))
|
256
|
if err != nil {
|
271
|
if err != nil {
|
257
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
272
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -276,6 +291,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
@@ -276,6 +291,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
276
|
gotUser, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
291
|
gotUser, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
277
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
292
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
278
|
"user": true,
|
293
|
"user": true,
|
|
|
294
|
+ "companyId": getCooperationProjectQuery.CompanyId,
|
|
|
295
|
+ "orgId": getCooperationProjectQuery.OrgId,
|
279
|
})
|
296
|
})
|
280
|
if err != nil {
|
297
|
if err != nil {
|
281
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
298
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
@@ -288,6 +305,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
@@ -288,6 +305,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
288
|
gotPartner, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
305
|
gotPartner, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
289
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
306
|
"cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
|
290
|
"partner": true,
|
307
|
"partner": true,
|
|
|
308
|
+ "companyId": getCooperationProjectQuery.CompanyId,
|
|
|
309
|
+ "orgId": getCooperationProjectQuery.OrgId,
|
291
|
})
|
310
|
})
|
292
|
if err != nil {
|
311
|
if err != nil {
|
293
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
312
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
@@ -301,10 +320,32 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
|
@@ -301,10 +320,32 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec |
301
|
undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3)
|
320
|
undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3)
|
302
|
}
|
321
|
}
|
303
|
|
322
|
|
304
|
- // TODO 返回所有员工类型的申请通过人
|
323
|
+ // 返回所有员工类型的申请通过人
|
|
|
324
|
+ applicants := make([]*domain.User, 0)
|
|
|
325
|
+ // 获取当前项目的所有申请
|
|
|
326
|
+ if countApplication, cooperationApplications, err := cooperationApplicationRepository.Find(map[string]interface{}{
|
|
|
327
|
+ "cooperationProjectNumberExact": cooperationProject.CooperationProjectNumber,
|
|
|
328
|
+ "companyId": cooperationProject.Company.CompanyId,
|
|
|
329
|
+ "orgId": cooperationProject.Org.OrgId,
|
|
|
330
|
+ }); err != nil {
|
|
|
331
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
332
|
+ } else {
|
|
|
333
|
+ if countApplication > 0 {
|
|
|
334
|
+ for _, cooperationApplication := range cooperationApplications {
|
|
|
335
|
+ log.Logger.Info("申请人", map[string]interface{}{
|
|
|
336
|
+ "applicant": cooperationApplication.CooperationApplicationApplicant,
|
|
|
337
|
+ })
|
|
|
338
|
+ userType := cooperationApplication.CooperationApplicationApplicant.UserType & 1
|
|
|
339
|
+ fmt.Printf("用户类型值: %d\n", userType)
|
|
|
340
|
+ if userType == 1 && cooperationApplication.CooperationApplicationStatus == 2 { // 申请人中的员工类型,审核中通过的
|
|
|
341
|
+ applicants = append(applicants, cooperationApplication.CooperationApplicationApplicant)
|
|
|
342
|
+ }
|
|
|
343
|
+ }
|
|
|
344
|
+ }
|
|
|
345
|
+ }
|
305
|
|
346
|
|
306
|
cooperationProjectDto := &dto.CooperationProjectsDto{}
|
347
|
cooperationProjectDto := &dto.CooperationProjectsDto{}
|
307
|
- if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil {
|
348
|
+ if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable, applicants); err != nil {
|
308
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
349
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
309
|
}
|
350
|
}
|
310
|
if err := transactionContext.CommitTransaction(); err != nil {
|
351
|
if err := transactionContext.CommitTransaction(); err != nil {
|