...
|
...
|
@@ -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"
|
|
|
)
|
...
|
...
|
@@ -123,6 +124,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC |
|
|
var undertakerDomain *domain.Undertaker
|
|
|
undertakerUid, _ := strconv.ParseInt(undertaker.UserId, 10, 64)
|
|
|
if data, err := userService.UndertakerFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, undertakerUid); err != nil {
|
|
|
log.Logger.Error(err.Error())
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
undertakerDomain = data
|
...
|
...
|
@@ -131,19 +133,25 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC |
|
|
// 获取推荐人
|
|
|
var referrerDomain *domain.Referrer
|
|
|
referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64)
|
|
|
if data, err := userService.ReferrerFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, referrerUid); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
referrerDomain = data
|
|
|
if referrerUid > 0 {
|
|
|
if data, err := userService.ReferrerFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, referrerUid); err != nil {
|
|
|
log.Logger.Error(err.Error())
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
referrerDomain = data
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取业务员
|
|
|
var salesmanDomain *domain.Salesman
|
|
|
salesmanUid, _ := strconv.ParseInt(undertaker.SalesmanId, 10, 64)
|
|
|
if data, err := userService.SalesmanFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, salesmanUid); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
salesmanDomain = data
|
|
|
if salesmanUid > 0 {
|
|
|
if data, err := userService.SalesmanFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, salesmanUid); err != nil {
|
|
|
log.Logger.Error(err.Error())
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
salesmanDomain = data
|
|
|
}
|
|
|
}
|
|
|
|
|
|
undertakers = append(undertakers, &domain.Undertaker{
|
...
|
...
|
@@ -171,6 +179,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC |
|
|
var relevantDomain *domain.Relevant
|
|
|
relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64)
|
|
|
if data, err := userService.RelevantFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, relevantUid); err != nil {
|
|
|
log.Logger.Error(err.Error())
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
relevantDomain = data
|
...
|
...
|
@@ -751,19 +760,23 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC |
|
|
// 获取推荐人
|
|
|
var referrerDomain *domain.Referrer
|
|
|
referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64)
|
|
|
if data, err := userService.ReferrerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, referrerUid); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
referrerDomain = data
|
|
|
if referrerUid > 0 {
|
|
|
if data, err := userService.ReferrerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, referrerUid); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
referrerDomain = data
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取业务员
|
|
|
var salesmanDomain *domain.Salesman
|
|
|
salesmanUid, _ := strconv.ParseInt(undertaker.SalesmanId, 10, 64)
|
|
|
if data, err := userService.SalesmanFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, salesmanUid); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
salesmanDomain = data
|
|
|
if salesmanUid > 0 {
|
|
|
if data, err := userService.SalesmanFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, salesmanUid); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
salesmanDomain = data
|
|
|
}
|
|
|
}
|
|
|
|
|
|
undertakers = append(undertakers, &domain.Undertaker{
|
...
|
...
|
|