cooperation_application_dto.go
5.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
)
type CooperationApplicationDto struct {
// 共创申请ID
CooperationApplicationId int64 `json:"cooperationApplicationId,string"`
// 共创申请人
CooperationApplicationApplicant *User `json:"cooperationApplicationApplicant"`
// 共创申请描述附件
CooperationApplicationAttachment []*domain.Attachment `json:"cooperationApplicationAttachment"`
// 共创申请描述
CooperationApplicationDescription string `json:"cooperationApplicationDescription"`
// 共创申请审核状态,1待审核,2已同意,3已拒绝
CooperationApplicationStatus int32 `json:"cooperationApplicationStatus"`
// 共创申请审核人
CooperationApplicationVerifier *User `json:"cooperationApplicationVerifier"`
// 共创申请审核描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
// 共创申请审核时间
CooperationApplicationVerifyTime int64 `json:"cooperationApplicationVerifyTime"`
// 共创申请时间
CooperationApplyTime int64 `json:"cooperationApplyTime"`
// 共创项目
CooperationProject *CooperationProject `json:"cooperationProject"`
// 数据所属组织机构
Org *Org `json:"org"`
// 是否被取消标志位
IsCanceled bool `json:"isCanceled"`
// 公司
Company *Company `json:"company"`
// 创建时间
//CreatedAt time.Time `json:"createdAt"`
// 删除时间
//DeletedAt time.Time `json:"deletedAt"`
// 更新时间
//UpdatedAt time.Time `json:"updatedAt"`
}
// User 用户第三方服务防腐模型
type User struct {
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `json:"userId"`
// 冗余字段,jsonb格式,不限制存放内容
UserInfo *domain.UserInfo `json:"userInfo,omitempty"`
// 用户所属的部门
Department *Department `json:"department"`
}
type Company struct {
// 公司ID,通过集成REST上下文获取
CompanyId int64 `json:"companyId"`
// 公司logo
CompanyLogo string `json:"companyLogo"`
// 公司名称
CompanyName string `json:"companyName"`
}
// Org 组织机构值对象
type Org struct {
// 组织机构ID
OrgId int64 `json:"orgId"`
// 组织名称
OrgName string `json:"orgName"`
// 公司
//Company *Company `json:"company"`
}
// Department 部门值对象
type Department struct {
// 部门ID,通过REST集成上下文获取
DepartmentId int64 `json:"departmentId"`
// 部门名称
DepartmentName string `json:"departmentName"`
}
// CooperationProject 共创项目实体
type CooperationProject struct {
// 共创项目ID
CooperationProjectId int64 `json:"cooperationProjectId"`
// 共创项目编号
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription"`
// 共创项目名称
CooperationProjectName string `json:"cooperationProjectName"`
// 图片附件
Attachment []*domain.Attachment `json:"attachment"`
}
func (data *CooperationApplicationDto) LoadDto(a *domain.CooperationApplication) {
data.CooperationApplicationId = a.CooperationApplicationId
data.CooperationApplicationApplicant = data.LoadUser(a.CooperationApplicationApplicant)
data.CooperationApplicationAttachment = a.CooperationApplicationAttachment
data.CooperationApplicationDescription = a.CooperationApplicationDescription
data.CooperationApplicationStatus = a.CooperationApplicationStatus
data.CooperationApplicationVerifier = data.LoadUser(a.CooperationApplicationVerifier)
data.CooperationApplicationVerifyDescription = a.CooperationApplicationDescription
data.CooperationApplicationVerifyTime = a.CooperationApplicationVerifyTime.Unix() * 1000
data.CooperationApplyTime = a.CooperationApplyTime.Unix() * 1000
data.CooperationProject = data.LoadCooperationProject(a.CooperationProject)
data.Org = data.LoadOrg(a.Org)
data.IsCanceled = a.IsCanceled
data.Company = data.LoadCompany(a.Company)
}
func (data *CooperationApplicationDto) LoadUser(v *domain.User) *User {
if v == nil {
return &User{}
}
return &User{
UserId: v.UserId,
UserInfo: v.UserInfo,
}
}
func (data *CooperationApplicationDto) LoadCompany(v *domain.Company) *Company {
return &Company{
CompanyId: v.CompanyId,
CompanyName: v.CompanyName,
}
}
func (data *CooperationApplicationDto) LoadOrg(v *domain.Org) *Org {
return &Org{
OrgId: v.OrgId,
OrgName: v.OrgName,
}
}
func (data *CooperationApplicationDto) LoadDepartment(v *domain.Org) *Department {
return &Department{
DepartmentId: v.OrgId,
DepartmentName: v.OrgName,
}
}
func (data *CooperationApplicationDto) LoadCooperationProject(v *domain.CooperationProject) *CooperationProject {
return &CooperationProject{
CooperationProjectId: v.CooperationProjectId,
CooperationProjectNumber: v.CooperationProjectNumber,
CooperationProjectDescription: v.CooperationProjectDescription,
CooperationProjectName: v.CooperationProjectName,
Attachment: v.Attachment,
}
}