作者 陈志颖

fix:合约说明保存

... ... @@ -27,6 +27,8 @@ type CreateDividendsIncentivesRulesCommand struct {
DividendsIncentivesStageStart time.Time `cname:"业绩分红阶段开始时间" json:"dividendsIncentivesStageStart"`
// 业绩分红阶段结束时间
DividendsIncentivesStageEnd time.Time `cname:"业绩分红阶段结束时间" json:"dividendsIncentivesStageEnd"`
// 说明
Remarks string `cname:"说明" json:"remarks"`
}
// CreateMoneyIncentivesRulesCommand 金额激励规则
... ... @@ -49,6 +51,8 @@ type CreateMoneyIncentivesRulesCommand struct {
ReferrerPercentage float64 `cname:"推荐人抽成" json:"referrerPercentage"`
// 业务员抽成
SalesmanPercentage float64 `cname:"业务员抽成" json:"salesmanPercentage"`
// 说明
Remarks string `cname:"说明" json:"remarks"`
}
// CreateUndertakersCommand 承接人
... ...
... ... @@ -48,7 +48,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
// 获取操作人
var operator *domain.User
if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, createCooperationContractCommand.UserId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取操作人失败")
} else {
operator = data
}
... ... @@ -57,7 +57,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
var sponsor *domain.User
sponsorUid, _ := strconv.ParseInt(createCooperationContractCommand.SponsorUid, 10, 64)
if data, err := userService.OperatorFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, sponsorUid); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取发起人失败")
} else {
sponsor = data
}
... ... @@ -73,7 +73,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
// 获取公司信息
var company *domain.Company
if data, err := companyService.CompanyFrom(createCooperationContractCommand.CompanyId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取公司信息失败")
} else {
company = data
}
... ... @@ -89,7 +89,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
// 获取组织机构信息
var organization *domain.Org
if data, err := organizationService.OrgFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取组织机构失败")
} else {
organization = data
}
... ... @@ -106,7 +106,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
var department *domain.Department
departmentId, err := strconv.ParseInt(createCooperationContractCommand.DepartmentId, 10, 64)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门失败")
}
if data, err := departmentService.DepartmentFrom(createCooperationContractCommand.CompanyId, departmentId); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -253,6 +253,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
UpdatedAt: time.Time{},
DeletedAt: time.Time{},
CreatedAt: time.Now(),
Remarks: dividendsIncentivesRule.Remarks,
})
}
... ... @@ -274,6 +275,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
UpdatedAt: time.Time{},
DeletedAt: time.Time{},
CreatedAt: time.Now(),
Remarks: moneyIncentivesRule.Remarks,
})
}
... ...
... ... @@ -18,7 +18,7 @@ type PayCreditAccountCommand struct {
// 备注
Remarks string `cname:"备注" json:"remarks" valid:"Required"`
// 支付凭证附件
PaymentDocumentAttachment *domain.Attachment `cname:"支付凭证附件" json:"paymentDocumentAttachment" valid:"Required"`
PaymentDocumentAttachments []*domain.Attachment `cname:"支付凭证附件" json:"paymentDocumentAttachment" valid:"Required"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"`
// 组织机构ID
... ...
... ... @@ -185,15 +185,15 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
Status: dividendsEstimates[0].DividendsUser.Status,
Company: dividendsEstimates[0].DividendsUser.Company,
},
AccountDetail: accountDetail, // 结算明细,多笔分红预算单
PaymentDocumentAttachment: nil,
Org: organization,
Company: company,
Operator: operator,
OperateTime: time.Now(),
CreatedAt: time.Now(),
DeletedAt: time.Time{},
UpdatedAt: time.Time{},
AccountDetail: accountDetail, // 结算明细,多笔分红预算单
PaymentDocumentAttachments: nil,
Org: organization,
Company: company,
Operator: operator,
OperateTime: time.Now(),
CreatedAt: time.Now(),
DeletedAt: time.Time{},
UpdatedAt: time.Time{},
}
if creditAccount, err13 := creditAccountRepository.Save(newCreditAccount); err13 != nil {
... ...
... ... @@ -27,7 +27,7 @@ type CreditAccount struct {
// 结算明细
AccountDetail []*AccountDetail `json:"accountDetail"`
// 支付凭证附件
PaymentDocumentAttachment *Attachment `json:"paymentDocumentAttachment"`
PaymentDocumentAttachments []*Attachment `json:"paymentDocumentAttachments"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
... ... @@ -70,8 +70,8 @@ func (creditAccount *CreditAccount) Update(data map[string]interface{}) error {
if paymentStatus, ok := data["paymentStatus"]; ok {
creditAccount.PaymentStatus = paymentStatus.(int32)
}
if paymentDocumentAttachment, ok := data["paymentDocumentAttachment"]; ok {
creditAccount.PaymentDocumentAttachment = paymentDocumentAttachment.(*Attachment)
if paymentDocumentAttachments, ok := data["paymentDocumentAttachments"]; ok {
creditAccount.PaymentDocumentAttachments = paymentDocumentAttachments.([]*Attachment)
}
if remarks, ok := data["remarks"]; ok {
creditAccount.Remarks = remarks.(string)
... ...
... ... @@ -30,7 +30,7 @@ type CreditAccount struct {
// 结算明细
AccountDetail []*domain.AccountDetail `comment:"结算明细"`
// 支付凭证附件
PaymentDocumentAttachment *domain.Attachment `comment:"支付凭证附件"`
PaymentDocumentAttachments []*domain.Attachment `comment:"支付凭证附件"`
// 数据所属组织机构
Org *domain.Org `comment:"数据所属组织机构"`
// 公司
... ...
... ... @@ -7,25 +7,25 @@ import (
func TransformToCreditAccountDomainModelFromPgModels(creditAccountModel *models.CreditAccount) (*domain.CreditAccount, error) {
return &domain.CreditAccount{
CreditAccountId: creditAccountModel.CreditAccountId,
ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,
CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,
PaymentStatus: creditAccountModel.PaymentStatus,
PaymentTime: creditAccountModel.PaymentTime,
SettlementAmount: creditAccountModel.SettlementAmount,
SettlementTime: creditAccountModel.SettlementTime,
CooperationContractNumber: creditAccountModel.CooperationContractNumber,
Participator: creditAccountModel.Participator,
ParticipateType: creditAccountModel.ParticipateType,
AccountDetail: creditAccountModel.AccountDetail,
PaymentDocumentAttachment: creditAccountModel.PaymentDocumentAttachment,
Org: creditAccountModel.Org,
Company: creditAccountModel.Company,
Operator: creditAccountModel.Operator,
OperateTime: creditAccountModel.OperateTime,
CreatedAt: creditAccountModel.CreatedAt,
DeletedAt: creditAccountModel.DeletedAt,
UpdatedAt: creditAccountModel.UpdatedAt,
Remarks: creditAccountModel.Remarks,
CreditAccountId: creditAccountModel.CreditAccountId,
ActuallyPaidAmount: creditAccountModel.ActuallyPaidAmount,
CreditAccountOrderNum: creditAccountModel.CreditAccountOrderNum,
PaymentStatus: creditAccountModel.PaymentStatus,
PaymentTime: creditAccountModel.PaymentTime,
SettlementAmount: creditAccountModel.SettlementAmount,
SettlementTime: creditAccountModel.SettlementTime,
CooperationContractNumber: creditAccountModel.CooperationContractNumber,
Participator: creditAccountModel.Participator,
ParticipateType: creditAccountModel.ParticipateType,
AccountDetail: creditAccountModel.AccountDetail,
PaymentDocumentAttachments: creditAccountModel.PaymentDocumentAttachments,
Org: creditAccountModel.Org,
Company: creditAccountModel.Company,
Operator: creditAccountModel.Operator,
OperateTime: creditAccountModel.OperateTime,
CreatedAt: creditAccountModel.CreatedAt,
DeletedAt: creditAccountModel.DeletedAt,
UpdatedAt: creditAccountModel.UpdatedAt,
Remarks: creditAccountModel.Remarks,
}, nil
}
... ...
... ... @@ -38,7 +38,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
"participator",
"participate_type",
"account_detail",
"payment_document_attachment",
"payment_document_attachments",
"org",
"company",
"operator",
... ... @@ -74,7 +74,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
&creditAccount.Participator,
&creditAccount.ParticipateType,
&creditAccount.AccountDetail,
&creditAccount.PaymentDocumentAttachment,
&creditAccount.PaymentDocumentAttachments,
&creditAccount.Org,
&creditAccount.Company,
&creditAccount.Operator,
... ... @@ -96,7 +96,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
creditAccount.Participator,
creditAccount.ParticipateType,
creditAccount.AccountDetail,
creditAccount.PaymentDocumentAttachment,
creditAccount.PaymentDocumentAttachments,
creditAccount.Org,
creditAccount.Company,
creditAccount.Operator,
... ... @@ -122,7 +122,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
&creditAccount.Participator,
&creditAccount.ParticipateType,
&creditAccount.AccountDetail,
&creditAccount.PaymentDocumentAttachment,
&creditAccount.PaymentDocumentAttachments,
&creditAccount.Org,
&creditAccount.Company,
&creditAccount.Operator,
... ... @@ -144,7 +144,7 @@ func (repository *CreditAccountRepository) Save(creditAccount *domain.CreditAcco
creditAccount.Participator,
creditAccount.ParticipateType,
creditAccount.AccountDetail,
creditAccount.PaymentDocumentAttachment,
creditAccount.PaymentDocumentAttachments,
creditAccount.Org,
creditAccount.Company,
creditAccount.Operator,
... ...