作者 yangfu

支付凭证重复修改

... ... @@ -55,6 +55,8 @@ type ContractParticipant struct {
SensitiveFlag bool `json:"sensitiveFlag"`
// 共创合约编号
primaryKey string `json:"key"`
// 支付凭证去重
duplicatePaymentDocuments map[string]struct{}
}
func (u *User) SimpleCopy() map[string]interface{} {
... ... @@ -78,16 +80,25 @@ func (ut *Salesman) ToUser() *User {
func NewContractParticipant(u *User, primaryKey string, attachments []*Attachment) *ContractParticipant {
p := &ContractParticipant{
User: u,
Participant: u.SimpleCopy(),
primaryKey: primaryKey,
PaymentDocuments: make([]*Attachment, 0),
User: u,
Participant: u.SimpleCopy(),
primaryKey: primaryKey,
PaymentDocuments: make([]*Attachment, 0),
duplicatePaymentDocuments: make(map[string]struct{}),
}
if len(attachments) > 0 {
p.ContractContent = attachments[0].Name
}
return p
}
func (cp *ContractParticipant) AppendAttachments(attachments []*Attachment) {
for i := range attachments {
if _, ok := cp.duplicatePaymentDocuments[attachments[i].Url]; !ok {
cp.duplicatePaymentDocuments[attachments[i].Url] = struct{}{}
cp.PaymentDocuments = append(cp.PaymentDocuments, attachments[i])
}
}
}
func (cp *ContractParticipant) Complete(userBaseId int64, sensitive bool) *ContractParticipant {
cp.SensitiveFlag = false
... ...
... ... @@ -320,7 +320,7 @@ func (ptr *CooperationStatisticsService) PersonCooperationProjectSharedInfo(quer
if len(v.PaymentDocument) == 0 && len(mapCreditAccount[key].PaymentDocumentAttachments) > 0 {
v.PaymentDocument = "查看"
}
v.PaymentDocuments = append(v.PaymentDocuments, creditAccounts[i].PaymentDocumentAttachments...)
v.AppendAttachments(creditAccounts[i].PaymentDocumentAttachments)
}
}
}
... ...