dto.go
4.4 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type CreditAccountItem struct {
CreditAccountId int `json:"creditAccountId,string"` // 账期结算单ID
ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 账期结算实付金额
CreditAccountOrderNum string `json:"creditAccountOrderNum"` // 账期结算单号
PaymentStatus int `json:"paymentStatus"` // 账期结算支付状态,1待支付,2已支付
PaymentTime int64 `json:"paymentTime"` // 共创账期结算支付时间
SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额
SettlementTime int64 `json:"settlementTime"` // 共创账期结算时间
CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号
Participator struct {
UserName string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开
} `json:"participator"` // 参与人
ParticipateType string `json:"participateType"` // 参与类型
PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件
Org struct {
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
} `json:"org"` // 数据所属组织机构
Company domain.CompanyData `json:"-"` // TODO:暂时不需要公司
CreatedAt int64 `json:"createdAt"` // 创建时间
UpdatedAt int64 `json:"updatedAt"` // 更新时间
AccountDetail []struct {
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
DividendsType int `json:"dividendsType"`
DividendsAmount float64 `json:"dividendsAmount"`
} `json:"accountDetail"` //结算明细
Operator struct {
UserId int `json:"userId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
UserName string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserInfo struct {
UserName string `json:"userName"` // 共创人员姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserAccount string `json:"userAccount"` // 用户账号,
} `json:"userInfo"`
} `json:"operator"`
}
func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem {
data := CreditAccountItem{
CreditAccountId: param.CreditAccountId,
ActuallyPaidAmount: param.ActuallyPaidAmount,
CreditAccountOrderNum: param.CreditAccountOrderNum,
PaymentStatus: param.PaymentStatus,
PaymentTime: 0,
SettlementAmount: param.SettlementAmount,
SettlementTime: 0,
CooperationContractNumber: param.CooperationContractNumber,
ParticipateType: param.ParticipateType, // 参与类型
PaymentDocumentAttachment: param.PaymentDocumentAttachment, // 支付凭证附件
Company: param.Company, // 公司
CreatedAt: param.CreatedAt.UnixNano() / 1e6, // 创建时间
UpdatedAt: param.UpdatedAt.UnixNano() / 1e6, // 更新时间
AccountDetail: param.AccountDetail,
}
if !param.PaymentTime.IsZero() {
data.PaymentTime = param.PaymentTime.UnixNano() / 1e6
}
if !param.SettlementTime.IsZero() {
data.SettlementTime = param.PaymentTime.UnixNano() / 1e6
}
data.Org.OrgID = param.Org.OrgID
data.Org.OrgName = param.Org.OrgName
data.Participator.UserName = param.Participator.UserName
data.Participator.UserPhone = param.Participator.UserPhone
data.Participator.UserType = param.Participator.UserType
data.Operator.UserId = param.Operator.UserId
data.Operator.UserBaseId = param.Operator.UserBaseId
data.Operator.UserName = param.Operator.UserName
data.Operator.UserPhone = param.Operator.UserPhone
data.Operator.UserInfo.UserName = param.Operator.UserName
data.Operator.UserInfo.UserPhone = param.Operator.UserPhone
return &data
}