正在显示
3 个修改的文件
包含
18 行增加
和
5 行删除
@@ -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 |
@@ -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 | } |
@@ -885,6 +885,7 @@ func (repository *CooperationContractRepository) UpdateOne(cooperationContract * | @@ -885,6 +885,7 @@ func (repository *CooperationContractRepository) UpdateOne(cooperationContract * | ||
885 | CreatedAt: cooperationContract.CreatedAt, | 885 | CreatedAt: cooperationContract.CreatedAt, |
886 | DeletedAt: cooperationContract.DeletedAt, | 886 | DeletedAt: cooperationContract.DeletedAt, |
887 | UpdatedAt: time.Now(), | 887 | UpdatedAt: time.Now(), |
888 | + CooperationProjectId: cooperationContract.CooperationProjectId, | ||
888 | } | 889 | } |
889 | if _, err := tx.Model(cooperationContractModel).WherePK().Update(); err != nil { | 890 | if _, err := tx.Model(cooperationContractModel).WherePK().Update(); err != nil { |
890 | return nil, err | 891 | return nil, err |
@@ -915,6 +916,7 @@ func (repository *CooperationContractRepository) UpdateMany(cooperationContracts | @@ -915,6 +916,7 @@ func (repository *CooperationContractRepository) UpdateMany(cooperationContracts | ||
915 | CreatedAt: cooperationContract.CreatedAt, | 916 | CreatedAt: cooperationContract.CreatedAt, |
916 | DeletedAt: cooperationContract.DeletedAt, | 917 | DeletedAt: cooperationContract.DeletedAt, |
917 | UpdatedAt: time.Now(), | 918 | UpdatedAt: time.Now(), |
919 | + CooperationProjectId: cooperationContract.CooperationProjectId, | ||
918 | }) | 920 | }) |
919 | } | 921 | } |
920 | if _, err := tx.Model(&cooperationContractModels).WherePK().Update(); err != nil { | 922 | if _, err := tx.Model(&cooperationContractModels).WherePK().Update(); err != nil { |
-
请 注册 或 登录 后发表评论