|
@@ -55,6 +55,8 @@ type ContractParticipant struct { |
|
@@ -55,6 +55,8 @@ type ContractParticipant struct { |
55
|
SensitiveFlag bool `json:"sensitiveFlag"`
|
55
|
SensitiveFlag bool `json:"sensitiveFlag"`
|
56
|
// 共创合约编号
|
56
|
// 共创合约编号
|
57
|
primaryKey string `json:"key"`
|
57
|
primaryKey string `json:"key"`
|
|
|
58
|
+ // 支付凭证去重
|
|
|
59
|
+ duplicatePaymentDocuments map[string]struct{}
|
58
|
}
|
60
|
}
|
59
|
|
61
|
|
60
|
func (u *User) SimpleCopy() map[string]interface{} {
|
62
|
func (u *User) SimpleCopy() map[string]interface{} {
|
|
@@ -78,16 +80,25 @@ func (ut *Salesman) ToUser() *User { |
|
@@ -78,16 +80,25 @@ func (ut *Salesman) ToUser() *User { |
78
|
|
80
|
|
79
|
func NewContractParticipant(u *User, primaryKey string, attachments []*Attachment) *ContractParticipant {
|
81
|
func NewContractParticipant(u *User, primaryKey string, attachments []*Attachment) *ContractParticipant {
|
80
|
p := &ContractParticipant{
|
82
|
p := &ContractParticipant{
|
81
|
- User: u,
|
|
|
82
|
- Participant: u.SimpleCopy(),
|
|
|
83
|
- primaryKey: primaryKey,
|
|
|
84
|
- PaymentDocuments: make([]*Attachment, 0),
|
83
|
+ User: u,
|
|
|
84
|
+ Participant: u.SimpleCopy(),
|
|
|
85
|
+ primaryKey: primaryKey,
|
|
|
86
|
+ PaymentDocuments: make([]*Attachment, 0),
|
|
|
87
|
+ duplicatePaymentDocuments: make(map[string]struct{}),
|
85
|
}
|
88
|
}
|
86
|
if len(attachments) > 0 {
|
89
|
if len(attachments) > 0 {
|
87
|
p.ContractContent = attachments[0].Name
|
90
|
p.ContractContent = attachments[0].Name
|
88
|
}
|
91
|
}
|
89
|
return p
|
92
|
return p
|
90
|
}
|
93
|
}
|
|
|
94
|
+func (cp *ContractParticipant) AppendAttachments(attachments []*Attachment) {
|
|
|
95
|
+ for i := range attachments {
|
|
|
96
|
+ if _, ok := cp.duplicatePaymentDocuments[attachments[i].Url]; !ok {
|
|
|
97
|
+ cp.duplicatePaymentDocuments[attachments[i].Url] = struct{}{}
|
|
|
98
|
+ cp.PaymentDocuments = append(cp.PaymentDocuments, attachments[i])
|
|
|
99
|
+ }
|
|
|
100
|
+ }
|
|
|
101
|
+}
|
91
|
|
102
|
|
92
|
func (cp *ContractParticipant) Complete(userBaseId int64, sensitive bool) *ContractParticipant {
|
103
|
func (cp *ContractParticipant) Complete(userBaseId int64, sensitive bool) *ContractParticipant {
|
93
|
cp.SensitiveFlag = false
|
104
|
cp.SensitiveFlag = false
|