cooperation_person_statistics_dto.go
3.0 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package domain
import (
"strings"
"time"
)
// CooperationPersonStatisticsDto 共创人员信息统计
type CooperationPersonStatisticsDto struct {
// 共创时间
CooperationTime time.Time `json:"cooperationTime"`
// 合伙类型,即共创模式
CooperationTypes []*CooperationMode `json:"cooperationTypes"`
// 分红明细
DividendsDetails *DividendsDetails `json:"dividendsDetails"`
// 订单明细
OrderDetails *OrderDetails `json:"orderDetails"`
// 共创人员姓名
UserName string `json:"userName"`
}
// 1.共创项目浏览详情
// 共创项目详情
type CooperationProjectSharedInfoDto struct {
// 共创项目数据
Project interface{} `json:"project"`
// 企业信息
Org *Org `json:"org"`
// 企业关注状态
OrgStarred bool `json:"orgStarred"`
// 合同参与人
ContractParticipant []*ContractParticipant `json:"contractParticipant"`
}
// 项目参与人
type ContractParticipant struct {
//
User *User `json:"-"`
// 参与人
Participant interface{} `json:"participant"`
// 合约数据 (合约名称、合约状态、合约附件)
Contract interface{} `json:"contract"`
// 订单金额
OrderAmount float64 `json:"orderAmount"`
// 分红金额 ()
DividendsAmount float64 `json:"dividendsAmount"`
// 合同内容
ContractContent string `json:"contractContent"`
// 支付凭证
PaymentDocument string `json:"paymentDocument"`
// 支付凭证
PaymentDocuments []*Attachment `json:"paymentDocuments"`
// 敏感标识
SensitiveFlag bool `json:"sensitiveFlag"`
// 共创合约编号
primaryKey string `json:"key"`
}
func (u *User) SimpleCopy() map[string]interface{} {
return map[string]interface{}{
"userId": u.UserId,
//"userBaseId":u.UserBaseId,
"userInfo": u.UserInfo,
}
}
func (ut *Undertaker) ToUser() *User {
return &User{UserId: ut.UserId, UserBaseId: ut.UserBaseId, UserInfo: ut.UserInfo}
}
func (ut *Referrer) ToUser() *User {
return &User{UserId: ut.UserId, UserBaseId: ut.UserBaseId, UserInfo: ut.UserInfo}
}
func (ut *Salesman) ToUser() *User {
return &User{UserId: ut.UserId, UserBaseId: ut.UserBaseId, UserInfo: ut.UserInfo}
}
func NewContractParticipant(u *User, primaryKey string, attachments []*Attachment) *ContractParticipant {
p := &ContractParticipant{
User: u,
Participant: u.SimpleCopy(),
primaryKey: primaryKey,
PaymentDocuments: make([]*Attachment, 0),
}
if len(attachments) > 0 {
p.ContractContent = attachments[0].Name
}
return p
}
func (cp *ContractParticipant) Complete(userBaseId int64, sensitive bool) *ContractParticipant {
cp.SensitiveFlag = false
if sensitive {
if cp.User.UserBaseId != userBaseId {
cp.DividendsAmount = 0
cp.SensitiveFlag = true
name := []rune(cp.User.UserInfo.UserName)
for i := range name {
if i == 0 {
continue
}
name[i] = rune('*')
}
cp.User.UserInfo.UserName = string(name)
cp.Participant = cp.User.SimpleCopy()
}
return cp
}
return cp
}
func (cp *ContractParticipant) CooperationContractNumber() string {
sp := strings.Split(cp.primaryKey, "-")
if len(sp) == 0 {
return ""
}
return sp[0]
}