dto.go
5.5 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
package dto
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
//CooperationProjectItem 返回共创项目列表项
type CooperationProjectItem struct {
CooperationMode struct {
CooperationModeId int `json:"cooperationModeId,string"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
} `json:"cooperationMode"` //项目模式
CooperationProjectID int `json:"cooperationProjectId,string,"` //id
CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //承接对象
Department struct {
DepartmentNumber string `json:"departmentNumber"`
DepartmentId int `json:"departmentId,string,"`
DepartmentName string `json:"departmentName"`
} `json:"department"` //项目发起部门
Status int `json:"status"` //项目状态
CooperationProjectPublishTime int `json:"cooperationProjectPublishTime"`
CooperationProjectSponsor struct {
UsersId int `json:"usersId"`
UserInfo struct {
UsersName string `json:"usersName"`
Phone string `json:"phone"`
UsersId int `json:"userId,string"`
} `json:"UserInfo"`
} `json:"cooperationProjectSponsor"` //共创发起人
}
func ToCooperationProjectItem(projecetParam *allied_creation_cooperation.CooperationProject) *CooperationProjectItem {
data := CooperationProjectItem{
CooperationMode: projecetParam.CooperationMode,
CooperationProjectID: projecetParam.CooperationProjectId,
CooperationProjectName: projecetParam.CooperationProjectName,
CooperationProjectNumber: projecetParam.CooperationProjectNumber,
CooperationProjectUndertakerType: projecetParam.CooperationProjectUndertakerType,
Department: projecetParam.Department,
Status: projecetParam.Status,
CooperationProjectPublishTime: int(projecetParam.CooperationProjectPublishTime.Unix()),
}
data.CooperationProjectSponsor.UsersId = projecetParam.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.UsersId = projecetParam.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.Phone = projecetParam.CooperationProjectSponsor.UserInfo.Phone
data.CooperationProjectSponsor.UserInfo.UsersName = projecetParam.CooperationProjectSponsor.UserInfo.UsersName
return &data
}
//CooperationProjectInfo 返回共创项目详情
type CooperationProjectInfo struct {
CooperationMode struct {
CooperationModeId int `json:"cooperationModeId,string"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
} `json:"cooperationMode"` //共创模式
CooperationProjectID int `json:"cooperationProjectId,string,"` //id
CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationProjectPublishTime int `json:"cooperationProjectPublishTime"` //共创项目发布时间
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //承接对象
CooperationProjectDescription string `json:"cooperationProjectDescription"` //共创描述
Department struct {
DepartmentNumber string `json:"departmentNumber"`
DepartmentId int `json:"departmentId,string,"`
DepartmentName string `json:"departmentName"`
} `json:"department"` //项目发起部门
Status int `json:"status"` //项目状态
CooperationProjectSponsor struct {
UsersId int `json:"usersId"`
UserInfo struct {
UsersName string `json:"usersName"`
Phone string `json:"phone"`
UsersId int `json:"userId,string"`
} `json:"UserInfo"`
} `json:"cooperationProjectSponsor"` //共创发起人
Attachment []allied_creation_cooperation.ProjectAttachment `json:"attachment"` //图片附件
}
func ToCooperationProjectInfo(projecetParam *allied_creation_cooperation.CooperationProject) *CooperationProjectInfo {
data := CooperationProjectInfo{
CooperationMode: projecetParam.CooperationMode,
CooperationProjectID: projecetParam.CooperationProjectId,
CooperationProjectName: projecetParam.CooperationProjectName,
CooperationProjectNumber: projecetParam.CooperationProjectNumber,
CooperationProjectUndertakerType: projecetParam.CooperationProjectUndertakerType,
Department: projecetParam.Department,
Status: projecetParam.Status,
CooperationProjectPublishTime: int(projecetParam.CooperationProjectPublishTime.Unix()),
Attachment: projecetParam.Attachment,
CooperationProjectDescription: projecetParam.CooperationProjectDescription,
}
data.CooperationProjectSponsor.UsersId = projecetParam.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.UsersId = projecetParam.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.Phone = projecetParam.CooperationProjectSponsor.UserInfo.Phone
data.CooperationProjectSponsor.UserInfo.UsersName = projecetParam.CooperationProjectSponsor.UserInfo.UsersName
return &data
}