|
@@ -365,14 +365,39 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont |
|
@@ -365,14 +365,39 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont |
365
|
} else {
|
365
|
} else {
|
366
|
cooperationContractDao = value
|
366
|
cooperationContractDao = value
|
367
|
}
|
367
|
}
|
368
|
- // 获取可删除的承接对象类型
|
|
|
369
|
- undertakerTypesUncheckedAvailable, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
370
|
- "cooperationContractNumber": cooperationContract.CooperationContractNumber,
|
|
|
371
|
- "cooperationContractUndertakerTypes": cooperationContract.CooperationContractUndertakerTypes,
|
368
|
+
|
|
|
369
|
+ // 可以去除勾选的承接人对象列表
|
|
|
370
|
+ var undertakerTypesUncheckedAvailable []int32
|
|
|
371
|
+
|
|
|
372
|
+ // 判断承接对象是否存在员工
|
|
|
373
|
+ gotUser, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
374
|
+ "cooperationContractNumber": cooperationContract.CooperationContractNumber,
|
|
|
375
|
+ "user": true,
|
|
|
376
|
+ })
|
|
|
377
|
+ if err != nil {
|
|
|
378
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
379
|
+ }
|
|
|
380
|
+ if !gotUser {
|
|
|
381
|
+ undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 1)
|
|
|
382
|
+ }
|
|
|
383
|
+
|
|
|
384
|
+ // 判断承接对象是否存在共创用户
|
|
|
385
|
+ gotPartner, err := cooperationContractDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
|
|
|
386
|
+ "cooperationContractNumber": cooperationContract.CooperationContractNumber,
|
|
|
387
|
+ "partner": true,
|
372
|
})
|
388
|
})
|
373
|
if err != nil {
|
389
|
if err != nil {
|
374
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
390
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
375
|
}
|
391
|
}
|
|
|
392
|
+ if !gotPartner {
|
|
|
393
|
+ undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 2)
|
|
|
394
|
+ }
|
|
|
395
|
+
|
|
|
396
|
+ // 判断承接人是否存在公开用户
|
|
|
397
|
+ if !gotUser && !gotPartner {
|
|
|
398
|
+ undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3)
|
|
|
399
|
+ }
|
|
|
400
|
+
|
376
|
cooperationContractDto := &dto.CooperationContractDto{}
|
401
|
cooperationContractDto := &dto.CooperationContractDto{}
|
377
|
if err := cooperationContractDto.LoadDto(cooperationContract, undertakerTypesUncheckedAvailable); err != nil {
|
402
|
if err := cooperationContractDto.LoadDto(cooperationContract, undertakerTypesUncheckedAvailable); err != nil {
|
378
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
403
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|