作者 陈志颖

fix:合约说明保存

@@ -27,6 +27,8 @@ type CreateDividendsIncentivesRulesCommand struct { @@ -27,6 +27,8 @@ type CreateDividendsIncentivesRulesCommand struct {
27 DividendsIncentivesStageStart time.Time `cname:"业绩分红阶段开始时间" json:"dividendsIncentivesStageStart"` 27 DividendsIncentivesStageStart time.Time `cname:"业绩分红阶段开始时间" json:"dividendsIncentivesStageStart"`
28 // 业绩分红阶段结束时间 28 // 业绩分红阶段结束时间
29 DividendsIncentivesStageEnd time.Time `cname:"业绩分红阶段结束时间" json:"dividendsIncentivesStageEnd"` 29 DividendsIncentivesStageEnd time.Time `cname:"业绩分红阶段结束时间" json:"dividendsIncentivesStageEnd"`
  30 + // 说明
  31 + Remarks string `cname:"说明" json:"remarks"`
30 } 32 }
31 33
32 // CreateMoneyIncentivesRulesCommand 金额激励规则 34 // CreateMoneyIncentivesRulesCommand 金额激励规则
@@ -49,6 +51,8 @@ type CreateMoneyIncentivesRulesCommand struct { @@ -49,6 +51,8 @@ type CreateMoneyIncentivesRulesCommand struct {
49 ReferrerPercentage float64 `cname:"推荐人抽成" json:"referrerPercentage"` 51 ReferrerPercentage float64 `cname:"推荐人抽成" json:"referrerPercentage"`
50 // 业务员抽成 52 // 业务员抽成
51 SalesmanPercentage float64 `cname:"业务员抽成" json:"salesmanPercentage"` 53 SalesmanPercentage float64 `cname:"业务员抽成" json:"salesmanPercentage"`
  54 + // 说明
  55 + Remarks string `cname:"说明" json:"remarks"`
52 } 56 }
53 57
54 // CreateUndertakersCommand 承接人 58 // CreateUndertakersCommand 承接人
@@ -48,7 +48,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -48,7 +48,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
48 // 获取操作人 48 // 获取操作人
49 var operator *domain.User 49 var operator *domain.User
50 if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, createCooperationContractCommand.UserId); err != nil { 50 if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, createCooperationContractCommand.UserId); err != nil {
51 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 51 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败")
52 } else { 52 } else {
53 operator = data 53 operator = data
54 } 54 }
@@ -57,7 +57,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -57,7 +57,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
57 var sponsor *domain.User 57 var sponsor *domain.User
58 sponsorUid, _ := strconv.ParseInt(createCooperationContractCommand.SponsorUid, 10, 64) 58 sponsorUid, _ := strconv.ParseInt(createCooperationContractCommand.SponsorUid, 10, 64)
59 if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, sponsorUid); err != nil { 59 if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, sponsorUid); err != nil {
60 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 60 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发起人失败")
61 } else { 61 } else {
62 sponsor = data 62 sponsor = data
63 } 63 }
@@ -73,7 +73,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -73,7 +73,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
73 // 获取公司信息 73 // 获取公司信息
74 var company *domain.Company 74 var company *domain.Company
75 if data, err := companyService.CompanyFrom(createCooperationContractCommand.CompanyId); err != nil { 75 if data, err := companyService.CompanyFrom(createCooperationContractCommand.CompanyId); err != nil {
76 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 76 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取公司信息失败")
77 } else { 77 } else {
78 company = data 78 company = data
79 } 79 }
@@ -89,7 +89,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -89,7 +89,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
89 // 获取组织机构信息 89 // 获取组织机构信息
90 var organization *domain.Org 90 var organization *domain.Org
91 if data, err := organizationService.OrgFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId); err != nil { 91 if data, err := organizationService.OrgFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId); err != nil {
92 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 92 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取组织机构失败")
93 } else { 93 } else {
94 organization = data 94 organization = data
95 } 95 }
@@ -106,7 +106,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -106,7 +106,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
106 var department *domain.Department 106 var department *domain.Department
107 departmentId, err := strconv.ParseInt(createCooperationContractCommand.DepartmentId, 10, 64) 107 departmentId, err := strconv.ParseInt(createCooperationContractCommand.DepartmentId, 10, 64)
108 if err != nil { 108 if err != nil {
109 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 109 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门失败")
110 } 110 }
111 if data, err := departmentService.DepartmentFrom(createCooperationContractCommand.CompanyId, departmentId); err != nil { 111 if data, err := departmentService.DepartmentFrom(createCooperationContractCommand.CompanyId, departmentId); err != nil {
112 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 112 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -253,6 +253,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -253,6 +253,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
253 UpdatedAt: time.Time{}, 253 UpdatedAt: time.Time{},
254 DeletedAt: time.Time{}, 254 DeletedAt: time.Time{},
255 CreatedAt: time.Now(), 255 CreatedAt: time.Now(),
  256 + Remarks: dividendsIncentivesRule.Remarks,
256 }) 257 })
257 } 258 }
258 259
@@ -274,6 +275,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -274,6 +275,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
274 UpdatedAt: time.Time{}, 275 UpdatedAt: time.Time{},
275 DeletedAt: time.Time{}, 276 DeletedAt: time.Time{},
276 CreatedAt: time.Now(), 277 CreatedAt: time.Now(),
  278 + Remarks: moneyIncentivesRule.Remarks,
277 }) 279 })
278 } 280 }
279 281
@@ -18,7 +18,7 @@ type PayCreditAccountCommand struct { @@ -18,7 +18,7 @@ type PayCreditAccountCommand struct {
18 // 备注 18 // 备注
19 Remarks string `cname:"备注" json:"remarks" valid:"Required"` 19 Remarks string `cname:"备注" json:"remarks" valid:"Required"`
20 // 支付凭证附件 20 // 支付凭证附件
21 - PaymentDocumentAttachment *domain.Attachment `cname:"支付凭证附件" json:"paymentDocumentAttachment" valid:"Required"` 21 + PaymentDocumentAttachments []*domain.Attachment `cname:"支付凭证附件" json:"paymentDocumentAttachment" valid:"Required"`
22 // 公司ID,通过集成REST上下文获取 22 // 公司ID,通过集成REST上下文获取
23 CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` 23 CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"`
24 // 组织机构ID 24 // 组织机构ID
@@ -185,15 +185,15 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred @@ -185,15 +185,15 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
185 Status: dividendsEstimates[0].DividendsUser.Status, 185 Status: dividendsEstimates[0].DividendsUser.Status,
186 Company: dividendsEstimates[0].DividendsUser.Company, 186 Company: dividendsEstimates[0].DividendsUser.Company,
187 }, 187 },
188 - AccountDetail: accountDetail, // 结算明细,多笔分红预算单  
189 - PaymentDocumentAttachment: nil,  
190 - Org: organization,  
191 - Company: company,  
192 - Operator: operator,  
193 - OperateTime: time.Now(),  
194 - CreatedAt: time.Now(),  
195 - DeletedAt: time.Time{},  
196 - UpdatedAt: time.Time{}, 188 + AccountDetail: accountDetail, // 结算明细,多笔分红预算单
  189 + PaymentDocumentAttachments: nil,
  190 + Org: organization,
  191 + Company: company,
  192 + Operator: operator,
  193 + OperateTime: time.Now(),
  194 + CreatedAt: time.Now(),
  195 + DeletedAt: time.Time{},
  196 + UpdatedAt: time.Time{},
197 } 197 }
198 198
199 if creditAccount, err13 := creditAccountRepository.Save(newCreditAccount); err13 != nil { 199 if creditAccount, err13 := creditAccountRepository.Save(newCreditAccount); err13 != nil {
@@ -27,7 +27,7 @@ type CreditAccount struct { @@ -27,7 +27,7 @@ type CreditAccount struct {
27 // 结算明细 27 // 结算明细
28 AccountDetail []*AccountDetail `json:"accountDetail"` 28 AccountDetail []*AccountDetail `json:"accountDetail"`
29 // 支付凭证附件 29 // 支付凭证附件
30 - PaymentDocumentAttachment *Attachment `json:"paymentDocumentAttachment"` 30 + PaymentDocumentAttachments []*Attachment `json:"paymentDocumentAttachments"`
31 // 数据所属组织机构 31 // 数据所属组织机构
32 Org *Org `json:"org"` 32 Org *Org `json:"org"`
33 // 公司 33 // 公司
@@ -70,8 +70,8 @@ func (creditAccount *CreditAccount) Update(data map[string]interface{}) error { @@ -70,8 +70,8 @@ func (creditAccount *CreditAccount) Update(data map[string]interface{}) error {
70 if paymentStatus, ok := data["paymentStatus"]; ok { 70 if paymentStatus, ok := data["paymentStatus"]; ok {
71 creditAccount.PaymentStatus = paymentStatus.(int32) 71 creditAccount.PaymentStatus = paymentStatus.(int32)
72 } 72 }
73 - if paymentDocumentAttachment, ok := data["paymentDocumentAttachment"]; ok {  
74 - creditAccount.PaymentDocumentAttachment = paymentDocumentAttachment.(*Attachment) 73 + if paymentDocumentAttachments, ok := data["paymentDocumentAttachments"]; ok {
  74 + creditAccount.PaymentDocumentAttachments = paymentDocumentAttachments.([]*Attachment)
75 } 75 }
76 if remarks, ok := data["remarks"]; ok { 76 if remarks, ok := data["remarks"]; ok {
77 creditAccount.Remarks = remarks.(string) 77 creditAccount.Remarks = remarks.(string)
@@ -30,7 +30,7 @@ type CreditAccount struct { @@ -30,7 +30,7 @@ type CreditAccount struct {
30 // 结算明细 30 // 结算明细
31 AccountDetail []*domain.AccountDetail `comment:"结算明细"` 31 AccountDetail []*domain.AccountDetail `comment:"结算明细"`
32 // 支付凭证附件 32 // 支付凭证附件
33 - PaymentDocumentAttachment *domain.Attachment `comment:"支付凭证附件"` 33 + PaymentDocumentAttachments []*domain.Attachment `comment:"支付凭证附件"`
34 // 数据所属组织机构 34 // 数据所属组织机构
35 Org *domain.Org `comment:"数据所属组织机构"` 35 Org *domain.Org `comment:"数据所属组织机构"`
36 // 公司 36 // 公司
@@ -7,25 +7,25 @@ import ( @@ -7,25 +7,25 @@ import (
7 7
8 func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) { 8 func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) {
9 return &domain.CreditAccount{ 9 return &domain.CreditAccount{
10 - CreditAccountId: creditAccountModel.CreditAccountId,  
11 - ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,  
12 - CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,  
13 - PaymentStatus: creditAccountModel.PaymentStatus,  
14 - PaymentTime: creditAccountModel.PaymentTime,  
15 - SettlementAmount: creditAccountModel.SettlementAmount,  
16 - SettlementTime: creditAccountModel.SettlementTime,  
17 - CooperationContractNumber: creditAccountModel.CooperationContractNumber,  
18 - Participator: creditAccountModel.Participator,  
19 - ParticipateType: creditAccountModel.ParticipateType,  
20 - AccountDetail: creditAccountModel.AccountDetail,  
21 - PaymentDocumentAttachment: creditAccountModel.PaymentDocumentAttachment,  
22 - Org: creditAccountModel.Org,  
23 - Company: creditAccountModel.Company,  
24 - Operator: creditAccountModel.Operator,  
25 - OperateTime: creditAccountModel.OperateTime,  
26 - CreatedAt: creditAccountModel.CreatedAt,  
27 - DeletedAt: creditAccountModel.DeletedAt,  
28 - UpdatedAt: creditAccountModel.UpdatedAt,  
29 - Remarks: creditAccountModel.Remarks, 10 + CreditAccountId: creditAccountModel.CreditAccountId,
  11 + ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,
  12 + CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,
  13 + PaymentStatus: creditAccountModel.PaymentStatus,
  14 + PaymentTime: creditAccountModel.PaymentTime,
  15 + SettlementAmount: creditAccountModel.SettlementAmount,
  16 + SettlementTime: creditAccountModel.SettlementTime,
  17 + CooperationContractNumber: creditAccountModel.CooperationContractNumber,
  18 + Participator: creditAccountModel.Participator,
  19 + ParticipateType: creditAccountModel.ParticipateType,
  20 + AccountDetail: creditAccountModel.AccountDetail,
  21 + PaymentDocumentAttachments: creditAccountModel.PaymentDocumentAttachments,
  22 + Org: creditAccountModel.Org,
  23 + Company: creditAccountModel.Company,
  24 + Operator: creditAccountModel.Operator,
  25 + OperateTime: creditAccountModel.OperateTime,
  26 + CreatedAt: creditAccountModel.CreatedAt,
  27 + DeletedAt: creditAccountModel.DeletedAt,
  28 + UpdatedAt: creditAccountModel.UpdatedAt,
  29 + Remarks: creditAccountModel.Remarks,
30 }, nil 30 }, nil
31 } 31 }
@@ -38,7 +38,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -38,7 +38,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
38 "participator", 38 "participator",
39 "participate_type", 39 "participate_type",
40 "account_detail", 40 "account_detail",
41 - "payment_document_attachment", 41 + "payment_document_attachments",
42 "org", 42 "org",
43 "company", 43 "company",
44 "operator", 44 "operator",
@@ -74,7 +74,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -74,7 +74,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
74 &creditAccount.Participator, 74 &creditAccount.Participator,
75 &creditAccount.ParticipateType, 75 &creditAccount.ParticipateType,
76 &creditAccount.AccountDetail, 76 &creditAccount.AccountDetail,
77 - &creditAccount.PaymentDocumentAttachment, 77 + &creditAccount.PaymentDocumentAttachments,
78 &creditAccount.Org, 78 &creditAccount.Org,
79 &creditAccount.Company, 79 &creditAccount.Company,
80 &creditAccount.Operator, 80 &creditAccount.Operator,
@@ -96,7 +96,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -96,7 +96,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
96 creditAccount.Participator, 96 creditAccount.Participator,
97 creditAccount.ParticipateType, 97 creditAccount.ParticipateType,
98 creditAccount.AccountDetail, 98 creditAccount.AccountDetail,
99 - creditAccount.PaymentDocumentAttachment, 99 + creditAccount.PaymentDocumentAttachments,
100 creditAccount.Org, 100 creditAccount.Org,
101 creditAccount.Company, 101 creditAccount.Company,
102 creditAccount.Operator, 102 creditAccount.Operator,
@@ -122,7 +122,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -122,7 +122,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
122 &creditAccount.Participator, 122 &creditAccount.Participator,
123 &creditAccount.ParticipateType, 123 &creditAccount.ParticipateType,
124 &creditAccount.AccountDetail, 124 &creditAccount.AccountDetail,
125 - &creditAccount.PaymentDocumentAttachment, 125 + &creditAccount.PaymentDocumentAttachments,
126 &creditAccount.Org, 126 &creditAccount.Org,
127 &creditAccount.Company, 127 &creditAccount.Company,
128 &creditAccount.Operator, 128 &creditAccount.Operator,
@@ -144,7 +144,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco @@ -144,7 +144,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
144 creditAccount.Participator, 144 creditAccount.Participator,
145 creditAccount.ParticipateType, 145 creditAccount.ParticipateType,
146 creditAccount.AccountDetail, 146 creditAccount.AccountDetail,
147 - creditAccount.PaymentDocumentAttachment, 147 + creditAccount.PaymentDocumentAttachments,
148 creditAccount.Org, 148 creditAccount.Org,
149 creditAccount.Company, 149 creditAccount.Company,
150 creditAccount.Operator, 150 creditAccount.Operator,