dto.go
9.1 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package dto
import (
"strconv"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type CooperationProjectInfo struct {
Company struct {
CompanyId int `json:"companyId,string,"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"` //项目归属企业
Org struct {
OrgId int `json:"orgId,string"`
OrgName string `json:"orgName"`
} `json:"org"` //项目创建时的组织
CooperationMode struct {
CooperationModeId int `json:"cooperationModeId,string"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
} `json:"cooperationMode"` //项目模式
CooperationProjectDescription string `json:"cooperationProjectDescription"`
Images []domain.Attachment `json:"images"` //图片附件
CooperationProjectId int `json:"cooperationProjectId,string,"`
CooperationProjectName string `json:"cooperationProjectName"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
CooperationProjectPublishTime time.Time `json:"cooperationProjectPublishTime"`
CreatedAt time.Time `json:"createdAt"`
CooperationProjectSponsor struct {
UserId int `json:"userId,string"`
UsersName string `json:"userName"`
UsersCode string `json:"userCode"`
UserInfo struct {
UsersName string `json:"userName"`
UsersCode string `json:"userCode"`
Phone string `json:"phone"`
UsersId int `json:"userId,string"`
} `json:"userInfo"`
} `json:"cooperationProjectSponsor"` //项目发起人
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开
Department struct {
DepartmentNumber string `json:"departmentNumber"`
DepartmentId int `json:"departmentId,string,"`
DepartmentName string `json:"departmentName"`
} `json:"department"` //项目发起部门
Status int `json:"status"` // 共创项目状态,1招标中,2结束
// 可以去除勾选的共创项目承接对象列表
UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
// 承接人
Applicants []struct {
UserId int64 `json:"userId,string"`
UserBaseId int64 `json:"userBaseId,string"` // 用户基本id
Org struct {
OrgId int64 `json:"orgId,string"` // 组织机构ID
OrgName string `json:"orgName"` // 组织名称
} `json:"org"` // 用户所属组织机构
Department struct {
DepartmentId int64 `json:"departmentId,string"` // 部门ID,
DepartmentName string `json:"departmentName"` // 部门名称
DepartmentNumber string `json:"departmentNumber"` // 部门编码
} `json:"department"` // 用户所属的部门
UserInfo struct {
UserAvatar string `json:"userAvatar"` // 用户头像
UserEmail string `json:"userEmail"` // 用户邮箱
UserName string `json:"userName"` // 共创人员姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserAccount string `json:"userAccount"` // 用户账号,
UserCode string `json:"userCode"` // 用户编码
} `json:"userInfo,omitempty"`
} `json:"applicants"`
}
func ToCooperationProjectInfo(param *allied_creation_cooperation.CooperationProject) *CooperationProjectInfo {
data := CooperationProjectInfo{
Company: param.Company,
Org: param.Org,
CooperationMode: param.CooperationMode,
CooperationProjectDescription: param.CooperationProjectDescription,
CooperationProjectId: param.CooperationProjectId,
CooperationProjectName: param.CooperationProjectName,
CooperationProjectNumber: param.CooperationProjectNumber,
CooperationProjectPublishTime: param.CooperationProjectPublishTime,
CreatedAt: param.CreatedAt,
CooperationProjectUndertakerType: param.CooperationProjectUndertakerType,
Department: param.Department,
Status: param.Status,
Images: param.Attachment,
UndertakerTypesUncheckedAvailable: param.UndertakerTypesUncheckedAvailable,
Applicants: param.Applicants,
}
data.CooperationProjectSponsor.UsersCode = param.CooperationProjectSponsor.UserInfo.UsersCode
data.CooperationProjectSponsor.UsersName = param.CooperationProjectSponsor.UserInfo.UsersName
data.CooperationProjectSponsor.UserId = param.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.Phone = param.CooperationProjectSponsor.UserInfo.UserPhone
data.CooperationProjectSponsor.UserInfo.UsersId = param.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.UsersName = param.CooperationProjectSponsor.UserInfo.UsersName
data.CooperationProjectSponsor.UserInfo.UsersCode = param.CooperationProjectSponsor.UserInfo.UsersCode
return &data
}
type CooperationApplicationItem struct {
CooperationApplicationApplicant struct {
Company domain.CompanyData `json:"company"`
Department domain.Department `json:"department"`
Org domain.Org `json:"org"`
UserBaseID int `json:"userBaseId,string"`
UserID int `json:"userId,string"`
UserName string `json:"userName"`
UserCode string `json:"userCode"`
UserInfo domain.UserInfo `json:"userInfo"`
UserType int `json:"userType"`
} `json:"cooperationApplicationApplicant"` //申请人
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述
CooperationApplicationID int `json:"cooperationApplicationId,string"` //申请id
CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //状态
CooperationApplyTime int `json:"cooperationApplyTime"` //申请时间
CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件
CooperationApplicationVerifyTime int `json:"cooperationApplicationVerifyTime"`
}
func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem {
applicationID, _ := strconv.Atoi(param.CooperationApplicationID)
data := CooperationApplicationItem{
CooperationApplicationDescription: param.CooperationApplicationDescription,
CooperationApplicationID: applicationID,
CooperationApplicationStatus: param.CooperationApplicationStatus,
CooperationApplyTime: param.CooperationApplyTime,
CooperationApplicationAttachment: param.CooperationApplicationAttachment,
CooperationApplicationVerifyTime: param.CooperationApplicationVerifyTime,
}
data.CooperationApplicationApplicant.Company.CompanyID = param.Company.CompanyID
data.CooperationApplicationApplicant.Company.CompanyName = param.Company.CompanyName
data.CooperationApplicationApplicant.Department.DepartmentId = int(param.CooperationApplicationApplicant.Department.DepartmentId)
data.CooperationApplicationApplicant.Department.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName
//data.CooperationApplicationApplicant.Department.DepartmentNumber = param.CooperationApplicationApplicant.Department.DepartmentNumber
data.CooperationApplicationApplicant.Org.OrgID = param.Org.OrgID
data.CooperationApplicationApplicant.Org.OrgName = param.Org.OrgName
data.CooperationApplicationApplicant.UserID = param.CooperationApplicationApplicant.UserID
data.CooperationApplicationApplicant.UserName = param.CooperationApplicationApplicant.UserInfo.UserName
data.CooperationApplicationApplicant.UserCode = param.CooperationApplicationApplicant.UserInfo.UserCode
//data.CooperationApplicationApplicant.UserType = param.CooperationApplicationApplicant.
data.CooperationApplicationApplicant.UserInfo.Phone = param.CooperationApplicationApplicant.UserInfo.UserPhone
data.CooperationApplicationApplicant.UserInfo.UsersName = param.CooperationApplicationApplicant.UserInfo.UserName
data.CooperationApplicationApplicant.UserInfo.UsersId = param.CooperationApplicationApplicant.UserID
return &data
//return nil
}
type CooperationProjectSearchItem struct {
allied_creation_cooperation.DataCooperationProjectSearchItem
AuthFlag bool `json:"authFlag"` //当前用户是否可以编辑
}
func ToCooperationProjectSearchItem(items []allied_creation_cooperation.DataCooperationProjectSearchItem, operatorOrgId int) []CooperationProjectSearchItem {
listData := []CooperationProjectSearchItem{}
operatorOrgIdStr := strconv.Itoa(operatorOrgId)
for i := range items {
listItem := CooperationProjectSearchItem{
DataCooperationProjectSearchItem: items[i],
AuthFlag: operatorOrgIdStr == items[i].Org.OrgID,
}
listData = append(listData, listItem)
}
return listData
}