作者 tangxuhui

数据结构调整

@@ -63,9 +63,10 @@ type CreateCooperationContractCommand struct { @@ -63,9 +63,10 @@ type CreateCooperationContractCommand struct {
63 } `json:"moneyIncentivesRules"` 63 } `json:"moneyIncentivesRules"`
64 // 承接方列表 64 // 承接方列表
65 Undertakers []struct { 65 Undertakers []struct {
66 - UndertakerId string `json:"undertakerId"` //承接人用户id  
67 - RerferrerId string `json:"rerferrerId"` //推荐人用户id  
68 - SalesmanId string `json:"salesmanId"` //关联业务员id 66 + UndertakerId int `json:"undertakerId,string"` //承接人列表id
  67 + UserId int `json:"userId,string"` //用户的id
  68 + RerferrerId int `json:"rerferrerId,string"` //推荐人用户id
  69 + SalesmanId int `json:"salesmanId,string"` //关联业务员id
69 Attachment []domain.Attachment `json:"attachment"` 70 Attachment []domain.Attachment `json:"attachment"`
70 } `json:"undertakers"` 71 } `json:"undertakers"`
71 //关联业务员 72 //关联业务员
@@ -65,9 +65,10 @@ type UpdateCooperationContractCommand struct { @@ -65,9 +65,10 @@ type UpdateCooperationContractCommand struct {
65 } `json:"moneyIncentivesRules"` 65 } `json:"moneyIncentivesRules"`
66 // 承接方列表 66 // 承接方列表
67 Undertakers []struct { 67 Undertakers []struct {
68 - UndertakerId string `json:"undertakerId"` //承接人用户id  
69 - RerferrerId string `json:"rerferrerId"` //推荐人用户id  
70 - SalesmanId string `json:"salesmanId"` //关联业务员id 68 + UndertakerId int `json:"undertakerId,string"` //承接人列表id
  69 + UserId int `json:"userId,string"` //用户id
  70 + RerferrerId int `json:"rerferrerId,string"` //推荐人用户id
  71 + SalesmanId int `json:"salesmanId,string"` //关联业务员id
71 Attachment []domain.Attachment `json:"attachment"` 72 Attachment []domain.Attachment `json:"attachment"`
72 } `json:"undertakers"` 73 } `json:"undertakers"`
73 //关联业务员 74 //关联业务员
@@ -9,9 +9,9 @@ type CooperationContractItem struct { @@ -9,9 +9,9 @@ type CooperationContractItem struct {
9 CooperationContractId int `json:"cooperationContractId,string,"` 9 CooperationContractId int `json:"cooperationContractId,string,"`
10 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号 10 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
11 CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号 11 CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
12 - CooperationContractName string `json:"CooperationContractName"` //合约名称 12 + CooperationContractName string `json:"cooperationContractName"` //合约名称
13 Status int `json:"status"` //合约状态 13 Status int `json:"status"` //合约状态
14 - CreateTtime int `json:"createTtime"` 14 + CreateTime int `json:"createTime"`
15 Department domain.Department `json:"department"` 15 Department domain.Department `json:"department"`
16 IncentivesType string `json:"incentivesType"` //Incentives激励方式 16 IncentivesType string `json:"incentivesType"` //Incentives激励方式
17 CooperationContractSponsor struct { 17 CooperationContractSponsor struct {
@@ -29,7 +29,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon @@ -29,7 +29,7 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon
29 CooperationContractName: param.CooperationContractName, 29 CooperationContractName: param.CooperationContractName,
30 CooperationContractNumber: param.CooperationContractNumber, 30 CooperationContractNumber: param.CooperationContractNumber,
31 Status: param.Status, 31 Status: param.Status,
32 - CreateTtime: int(param.CreatedAt.UnixNano() / 1e6), 32 + CreateTime: int(param.CreatedAt.UnixNano() / 1e6),
33 } 33 }
34 data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId 34 data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId
35 data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName 35 data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
@@ -76,6 +76,7 @@ type Relevant struct { @@ -76,6 +76,7 @@ type Relevant struct {
76 } 76 }
77 77
78 type ContractUndertaker struct { 78 type ContractUndertaker struct {
  79 + UndertakerId int `json:"undertakerId,string"`
79 Attachment []domain.Attachment `json:"attachment"` 80 Attachment []domain.Attachment `json:"attachment"`
80 Department domain.Department `json:"department"` 81 Department domain.Department `json:"department"`
81 HasReferrer bool `json:"hasReferrer"` 82 HasReferrer bool `json:"hasReferrer"`
@@ -162,6 +163,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon @@ -162,6 +163,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
162 UsersId: v.Salesman.UserId, 163 UsersId: v.Salesman.UserId,
163 Phone: v.Salesman.UserInfo.UserPhone, 164 Phone: v.Salesman.UserInfo.UserPhone,
164 }, 165 },
  166 + UndertakerId: v.UndertakerId,
165 UserInfo: domain.UserInfo{ 167 UserInfo: domain.UserInfo{
166 UsersName: v.UserInfo.UserName, 168 UsersName: v.UserInfo.UserName,
167 UsersId: v.UserId, 169 UsersId: v.UserId,
@@ -49,14 +49,15 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -49,14 +49,15 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
49 underTakers := []allied_creation_cooperation.Undertaker{} 49 underTakers := []allied_creation_cooperation.Undertaker{}
50 for _, v := range createCooperationContractCommand.Undertakers { 50 for _, v := range createCooperationContractCommand.Undertakers {
51 u := allied_creation_cooperation.Undertaker{ 51 u := allied_creation_cooperation.Undertaker{
52 - UserId: v.UndertakerId,  
53 - RerferrerId: v.RerferrerId,  
54 - SalesmanId: v.SalesmanId,  
55 - Attachment: v.Attachment, 52 + RelevantId: v.UndertakerId,
  53 + UserId: v.UserId,
  54 + ReferrerId: v.RerferrerId,
  55 + SalesmanId: v.SalesmanId,
  56 + Attachment: v.Attachment,
56 } 57 }
57 underTakers = append(underTakers, u) 58 underTakers = append(underTakers, u)
58 } 59 }
59 - _, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{ 60 + result, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
60 MoneyIncentivesRules: rules2, 61 MoneyIncentivesRules: rules2,
61 DividendsIncentivesRules: rules1, 62 DividendsIncentivesRules: rules1,
62 Undertakers: underTakers, 63 Undertakers: underTakers,
@@ -76,7 +77,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -76,7 +77,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
76 if err != nil { 77 if err != nil {
77 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 78 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
78 } 79 }
79 - return createCooperationContractCommand, err 80 + return dto.ToCooperationContractInfo(&result.CooperationContract), err
80 } 81 }
81 82
82 // 暂停恢复共创合约 83 // 暂停恢复共创合约
@@ -164,14 +165,15 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -164,14 +165,15 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
164 underTakers := []allied_creation_cooperation.Undertaker{} 165 underTakers := []allied_creation_cooperation.Undertaker{}
165 for _, v := range updateCooperationContractCommand.Undertakers { 166 for _, v := range updateCooperationContractCommand.Undertakers {
166 u := allied_creation_cooperation.Undertaker{ 167 u := allied_creation_cooperation.Undertaker{
167 - UserId: v.UndertakerId,  
168 - RerferrerId: v.RerferrerId,  
169 - SalesmanId: v.SalesmanId,  
170 - Attachment: v.Attachment, 168 + RelevantId: v.UndertakerId,
  169 + UserId: v.UserId,
  170 + ReferrerId: v.RerferrerId,
  171 + SalesmanId: v.SalesmanId,
  172 + Attachment: v.Attachment,
171 } 173 }
172 underTakers = append(underTakers, u) 174 underTakers = append(underTakers, u)
173 } 175 }
174 - _, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{ 176 + result, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
175 CooperationContractId: updateCooperationContractCommand.CooperationContract.CooperationContractId, 177 CooperationContractId: updateCooperationContractCommand.CooperationContract.CooperationContractId,
176 MoneyIncentivesRules: rules2, 178 MoneyIncentivesRules: rules2,
177 DividendsIncentivesRules: rules1, 179 DividendsIncentivesRules: rules1,
@@ -193,7 +195,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -193,7 +195,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
193 if err != nil { 195 if err != nil {
194 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 196 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
195 } 197 }
196 - return nil, nil 198 + return dto.ToCooperationContractInfo(&result.CooperationContract), nil
197 } 199 }
198 200
199 func NewCooperationContractService(options map[string]interface{}) *CooperationContractService { 201 func NewCooperationContractService(options map[string]interface{}) *CooperationContractService {
@@ -55,6 +55,7 @@ type CooperationContract struct { @@ -55,6 +55,7 @@ type CooperationContract struct {
55 Undertakers []struct { 55 Undertakers []struct {
56 ContractAttachment []domain.Attachment `json:"contractAttachment"` 56 ContractAttachment []domain.Attachment `json:"contractAttachment"`
57 UserId int `json:"userId,string"` 57 UserId int `json:"userId,string"`
  58 + UndertakerId int `json:"undertakerId,string"`
58 UserInfo struct { 59 UserInfo struct {
59 UserAvatar string `json:"userAvatar"` // 用户头像 60 UserAvatar string `json:"userAvatar"` // 用户头像
60 UserEmail string `json:"userEmail"` // 用户邮箱 61 UserEmail string `json:"userEmail"` // 用户邮箱
@@ -142,10 +143,11 @@ type ( @@ -142,10 +143,11 @@ type (
142 143
143 //合约承接方 144 //合约承接方
144 Undertaker struct { 145 Undertaker struct {
145 - UserId string `json:"userId"` //承接人用户id  
146 - RerferrerId string `json:"rerferrerId"` //推荐人用户id  
147 - SalesmanId string `json:"salesmanId"` //关联业务员id  
148 - Attachment []domain.Attachment `json:"attachment"` 146 + RelevantId int `json:"relevantId,string"`
  147 + UserId int `json:"userId,string"` //承接人用户id
  148 + ReferrerId int `json:"referrerId,string"` //推荐人用户id
  149 + SalesmanId int `json:"salesmanId,string"` //关联业务员id
  150 + Attachment []domain.Attachment `json:"attachment"`
149 } 151 }
150 152
151 ReqCooperationContractAdd struct { 153 ReqCooperationContractAdd struct {