作者 yangfu

支付凭证重复修改

@@ -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{} {
@@ -82,12 +84,21 @@ func NewContractParticipant(u *User, primaryKey string, attachments []*Attachmen @@ -82,12 +84,21 @@ func NewContractParticipant(u *User, primaryKey string, attachments []*Attachmen
82 Participant: u.SimpleCopy(), 84 Participant: u.SimpleCopy(),
83 primaryKey: primaryKey, 85 primaryKey: primaryKey,
84 PaymentDocuments: make([]*Attachment, 0), 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
@@ -320,7 +320,7 @@ func (ptr *CooperationStatisticsService) PersonCooperationProjectSharedInfo(quer @@ -320,7 +320,7 @@ func (ptr *CooperationStatisticsService) PersonCooperationProjectSharedInfo(quer
320 if len(v.PaymentDocument) == 0 && len(mapCreditAccount[key].PaymentDocumentAttachments) > 0 { 320 if len(v.PaymentDocument) == 0 && len(mapCreditAccount[key].PaymentDocumentAttachments) > 0 {
321 v.PaymentDocument = "查看" 321 v.PaymentDocument = "查看"
322 } 322 }
323 - v.PaymentDocuments = append(v.PaymentDocuments, creditAccounts[i].PaymentDocumentAttachments...) 323 + v.AppendAttachments(creditAccounts[i].PaymentDocumentAttachments)
324 } 324 }
325 } 325 }
326 } 326 }