credit_account.go
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package domain
import "time"
// 账期结算单实体
type CreditAccount struct {
// 账期结算单ID
CreditAccountId int64 `json:"creditAccountId,string"`
// 账期结算实付金额
ActuallyPaidAmount float64 `json:"actuallyPaidAmount"`
// 账期结算单号
CreditAccountOrderNum string `json:"creditAccountOrderNum"`
// 账期结算支付状态,1待支付,2已支付
PaymentStatus int32 `json:"paymentStatus"`
// 共创账期结算支付时间
PaymentTime time.Time `json:"paymentTime"`
// 账期结算金额
SettlementAmount float64 `json:"settlementAmount"`
// 共创账期结算时间
SettlementTime time.Time `json:"settlementTime"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 参与人uid,包括承接人、推荐人、关联业务员
Participator []int64 `json:"participator"`
// 支付凭证附件
PaymentDocumentAttachment *Attachment `json:"paymentDocumentAttachment"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 操作人
Operator *User `json:"operator"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
}
type CreditAccountRepository interface {
Save(creditAccount *CreditAccount) (*CreditAccount, error)
Remove(creditAccount *CreditAccount) (*CreditAccount, error)
FindOne(queryOptions map[string]interface{}) (*CreditAccount, error)
Find(queryOptions map[string]interface{}) (int64, []*CreditAccount, error)
}
func (creditAccount *CreditAccount) Identify() interface{} {
if creditAccount.CreditAccountId == 0 {
return nil
}
return creditAccount.CreditAccountId
}
func (creditAccount *CreditAccount) Update(data map[string]interface{}) error {
if actuallyPaidAmount, ok := data["actuallyPaidAmount"]; ok {
creditAccount.ActuallyPaidAmount = actuallyPaidAmount.(float64)
}
if creditAccountOrderNum, ok := data["creditAccountOrderNum"]; ok {
creditAccount.CreditAccountOrderNum = creditAccountOrderNum.(string)
}
if paymentStatus, ok := data["paymentStatus"]; ok {
creditAccount.PaymentStatus = paymentStatus.(int32)
}
return nil
}