作者 tangxuhui

数据结构调整

... ... @@ -63,9 +63,10 @@ type CreateCooperationContractCommand struct {
} `json:"moneyIncentivesRules"`
// 承接方列表
Undertakers []struct {
UndertakerId string `json:"undertakerId"` //承接人用户id
RerferrerId string `json:"rerferrerId"` //推荐人用户id
SalesmanId string `json:"salesmanId"` //关联业务员id
UndertakerId int `json:"undertakerId,string"` //承接人列表id
UserId int `json:"userId,string"` //用户的id
RerferrerId int `json:"rerferrerId,string"` //推荐人用户id
SalesmanId int `json:"salesmanId,string"` //关联业务员id
Attachment []domain.Attachment `json:"attachment"`
} `json:"undertakers"`
//关联业务员
... ...
... ... @@ -65,9 +65,10 @@ type UpdateCooperationContractCommand struct {
} `json:"moneyIncentivesRules"`
// 承接方列表
Undertakers []struct {
UndertakerId string `json:"undertakerId"` //承接人用户id
RerferrerId string `json:"rerferrerId"` //推荐人用户id
SalesmanId string `json:"salesmanId"` //关联业务员id
UndertakerId int `json:"undertakerId,string"` //承接人列表id
UserId int `json:"userId,string"` //用户id
RerferrerId int `json:"rerferrerId,string"` //推荐人用户id
SalesmanId int `json:"salesmanId,string"` //关联业务员id
Attachment []domain.Attachment `json:"attachment"`
} `json:"undertakers"`
//关联业务员
... ...
... ... @@ -9,9 +9,9 @@ type CooperationContractItem struct {
CooperationContractId int `json:"cooperationContractId,string,"`
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationContractName string `json:"CooperationContractName"` //合约名称
CooperationContractName string `json:"cooperationContractName"` //合约名称
Status int `json:"status"` //合约状态
CreateTtime int `json:"createTtime"`
CreateTime int `json:"createTime"`
Department domain.Department `json:"department"`
IncentivesType string `json:"incentivesType"` //Incentives激励方式
CooperationContractSponsor struct {
... ... @@ -29,7 +29,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon
CooperationContractName: param.CooperationContractName,
CooperationContractNumber: param.CooperationContractNumber,
Status: param.Status,
CreateTtime: int(param.CreatedAt.UnixNano() / 1e6),
CreateTime: int(param.CreatedAt.UnixNano() / 1e6),
}
data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId
data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
... ... @@ -76,6 +76,7 @@ type Relevant struct {
}
type ContractUndertaker struct {
UndertakerId int `json:"undertakerId,string"`
Attachment []domain.Attachment `json:"attachment"`
Department domain.Department `json:"department"`
HasReferrer bool `json:"hasReferrer"`
... ... @@ -162,6 +163,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
UsersId: v.Salesman.UserId,
Phone: v.Salesman.UserInfo.UserPhone,
},
UndertakerId: v.UndertakerId,
UserInfo: domain.UserInfo{
UsersName: v.UserInfo.UserName,
UsersId: v.UserId,
... ...
... ... @@ -49,14 +49,15 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
underTakers := []allied_creation_cooperation.Undertaker{}
for _, v := range createCooperationContractCommand.Undertakers {
u := allied_creation_cooperation.Undertaker{
UserId: v.UndertakerId,
RerferrerId: v.RerferrerId,
RelevantId: v.UndertakerId,
UserId: v.UserId,
ReferrerId: v.RerferrerId,
SalesmanId: v.SalesmanId,
Attachment: v.Attachment,
}
underTakers = append(underTakers, u)
}
_, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
result, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
MoneyIncentivesRules: rules2,
DividendsIncentivesRules: rules1,
Undertakers: underTakers,
... ... @@ -76,7 +77,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return createCooperationContractCommand, err
return dto.ToCooperationContractInfo(&result.CooperationContract), err
}
// 暂停恢复共创合约
... ... @@ -164,14 +165,15 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
underTakers := []allied_creation_cooperation.Undertaker{}
for _, v := range updateCooperationContractCommand.Undertakers {
u := allied_creation_cooperation.Undertaker{
UserId: v.UndertakerId,
RerferrerId: v.RerferrerId,
RelevantId: v.UndertakerId,
UserId: v.UserId,
ReferrerId: v.RerferrerId,
SalesmanId: v.SalesmanId,
Attachment: v.Attachment,
}
underTakers = append(underTakers, u)
}
_, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
result, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
CooperationContractId: updateCooperationContractCommand.CooperationContract.CooperationContractId,
MoneyIncentivesRules: rules2,
DividendsIncentivesRules: rules1,
... ... @@ -193,7 +195,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
return dto.ToCooperationContractInfo(&result.CooperationContract), nil
}
func NewCooperationContractService(options map[string]interface{}) *CooperationContractService {
... ...
... ... @@ -55,6 +55,7 @@ type CooperationContract struct {
Undertakers []struct {
ContractAttachment []domain.Attachment `json:"contractAttachment"`
UserId int `json:"userId,string"`
UndertakerId int `json:"undertakerId,string"`
UserInfo struct {
UserAvatar string `json:"userAvatar"` // 用户头像
UserEmail string `json:"userEmail"` // 用户邮箱
... ... @@ -142,9 +143,10 @@ type (
//合约承接方
Undertaker struct {
UserId string `json:"userId"` //承接人用户id
RerferrerId string `json:"rerferrerId"` //推荐人用户id
SalesmanId string `json:"salesmanId"` //关联业务员id
RelevantId int `json:"relevantId,string"`
UserId int `json:"userId,string"` //承接人用户id
ReferrerId int `json:"referrerId,string"` //推荐人用户id
SalesmanId int `json:"salesmanId,string"` //关联业务员id
Attachment []domain.Attachment `json:"attachment"`
}
... ...