dto.go
8.9 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
package dto
import (
"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"
)
//CooperationProjectItem 返回共创项目列表项
type CooperationProjectItem struct {
CooperationMode domain.CooperationMode `json:"cooperationMode"` //项目模式
CooperationProjectID int `json:"cooperationProjectId,string,"` //id
CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //承接对象
Department domain.Department `json:"department"` //项目发起部门
Status int `json:"status"` //项目状态
CooperationProjectPublishTime int `json:"cooperationProjectPublishTime"`
CooperationProjectSponsor struct {
UsersId int `json:"usersId"`
UserInfo domain.UserInfo `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.UserPhone
data.CooperationProjectSponsor.UserInfo.UsersName = projecetParam.CooperationProjectSponsor.UserInfo.UsersName
return &data
}
//CooperationProjectInfo 返回共创项目详情
type CooperationProjectInfo struct {
CooperationMode domain.CooperationMode `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 domain.Department `json:"department"` //项目发起部门
Status int `json:"status"` //项目状态
CooperationProjectSponsor struct {
UsersId int `json:"userId,string"`
UserInfo domain.UserInfo `json:"userInfo"`
} `json:"cooperationProjectSponsor"` //共创发起人
Attachment []domain.Attachment `json:"attachment"` //图片附件
Images []string `json:"images"`
}
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,
}
for i := range projecetParam.Attachment {
attachment := projecetParam.Attachment[i]
data.Images = append(data.Images, attachment.Url)
}
data.CooperationProjectSponsor.UsersId = projecetParam.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.UsersId = projecetParam.CooperationProjectSponsor.UsersId
data.CooperationProjectSponsor.UserInfo.Phone = projecetParam.CooperationProjectSponsor.UserInfo.UserPhone
data.CooperationProjectSponsor.UserInfo.UsersName = projecetParam.CooperationProjectSponsor.UserInfo.UsersName
return &data
}
type CooperationApplication struct {
Company domain.CompanyData `json:"company"`
CooperationApplicationApplicant struct {
UserId int `json:"userId"`
UserInfo domain.UserInfo `json:"userInfo"`
Department domain.Department `json:"department"` //申请人部门
} `json:"cooperationApplicationApplicant"` //申请人
CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件信息
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //申请描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"` //审核描述
CooperationApplicationId int `json:"cooperationApplicationId"` //申请id
CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //审核状态
CooperationApplicationVerifyTime int `json:"cooperationApplicationVerifyTime"` //审核的时间
CooperationProjectId int `json:"cooperationProjectId"` //项目id
CooperationProjectName string `json:"cooperationProjectName"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
}
func ToCooperationApplication(applicationParam *allied_creation_cooperation.CooperationApplication) *CooperationApplication {
//data := CooperationApplication{
// CooperationApplicationAttachment: applicationParam.CooperationApplicationAttachment, //附件信息
// CooperationApplicationDescription: applicationParam.CooperationApplicationDescription,
// CooperationApplicationId: applicationParam.CooperationApplicationID,
// CooperationApplicationStatus: applicationParam.CooperationApplicationStatus, //共创申请审核状态,1待审核,2已同意,3已拒绝
// CooperationApplicationVerifyTime: int(applicationParam.CooperationApplicationVerifyTime.Unix()), //审核的时间
// CooperationProjectId: applicationParam.CooperationProject.CooperationProjectID,
// CooperationProjectName: applicationParam.CooperationProject.CooperationProjectName,
// CooperationProjectNumber: applicationParam.CooperationProject.CooperationProjectNumber,
// CooperationApplicationVerifyDescription: applicationParam.CooperationApplicationVerifyDescription,
//}
//data.CooperationApplicationApplicant.UserId = applicationParam.CooperationApplicationApplicant.UserID
//data.CooperationApplicationApplicant.UserInfo.Phone = applicationParam.CooperationApplicationApplicant.UserInfo.UserPhone
//data.CooperationApplicationApplicant.UserInfo.UsersName = applicationParam.CooperationApplicationApplicant.UserInfo.UserName
//data.CooperationApplicationApplicant.UserInfo.UsersId = applicationParam.CooperationApplicationApplicant.UserID
//data.CooperationApplicationApplicant.Department.DepartmentId = applicationParam.CooperationApplicationApplicant.Department.DepartmentID
//data.CooperationApplicationApplicant.Department.DepartmentName = applicationParam.CooperationApplicationApplicant.Department.DepartmentName
//data.CooperationApplicationApplicant.Department.DepartmentNumber = applicationParam.CooperationApplicationApplicant.Department.DepartmentNumber
//data.Company.CompanyID = applicationParam.Company.CompanyID
//data.Company.CompanyName = applicationParam.Company.CompanyName
//return &data
return nil
}