cooperation_application_controller.go
9.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
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
package controllers
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationApplication/service"
)
type CooperationApplicationController struct {
BaseController
}
func (controller *CooperationApplicationController) ApplyForCooperation() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
applyForCooperationCommand := &command.ApplyForCooperationCommand{}
_ = controller.Unmarshal(applyForCooperationCommand)
header := controller.GetRequestHeader(controller.Ctx)
applyForCooperationCommand.CompanyId = header.CompanyId
applyForCooperationCommand.OrgId = header.OrgId
applyForCooperationCommand.UserId = header.UserId
applyForCooperationCommand.UserBaseId = header.UserBaseId
cooperationProjectId, _ := controller.GetInt64(":cooperationProjectId")
applyForCooperationCommand.CooperationProjectId = cooperationProjectId
data, err := cooperationApplicationService.ApplyForCooperation(applyForCooperationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) ApprovalCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
approvalCooperationApplicationCommand := &command.ApprovalCooperationApplicationCommand{}
_ = controller.Unmarshal(approvalCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
approvalCooperationApplicationCommand.CompanyId = header.CompanyId
approvalCooperationApplicationCommand.OrgId = header.OrgId
approvalCooperationApplicationCommand.UserId = header.UserId
approvalCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.ApprovalCooperationApplication(approvalCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) CancelCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
cancelCooperationApplicationCommand := &command.CancelCooperationApplicationCommand{}
_ = controller.Unmarshal(cancelCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
cancelCooperationApplicationCommand.CompanyId = header.CompanyId
cancelCooperationApplicationCommand.OrgId = header.OrgId
cancelCooperationApplicationCommand.UserId = header.UserId
cancelCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.CancelCooperationApplication(cancelCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) BatchApprovalCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
batchApprovalCooperationApplicationCommand := &command.BatchApprovalCooperationApplicationCommand{}
_ = controller.Unmarshal(batchApprovalCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
batchApprovalCooperationApplicationCommand.CompanyId = header.CompanyId
batchApprovalCooperationApplicationCommand.OrgId = header.OrgId
batchApprovalCooperationApplicationCommand.UserId = header.UserId
batchApprovalCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.BatchApprovalCooperationApplication(batchApprovalCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) OneClickApprovalCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
oneClickApprovalCooperationApplicationCommand := &command.OneClickApprovalCooperationApplicationCommand{}
_ = controller.Unmarshal(oneClickApprovalCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
oneClickApprovalCooperationApplicationCommand.CompanyId = header.CompanyId
oneClickApprovalCooperationApplicationCommand.OrgId = header.OrgId
oneClickApprovalCooperationApplicationCommand.UserId = header.UserId
oneClickApprovalCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.OneClickApprovalCooperationApplication(oneClickApprovalCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) CreateCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
createCooperationApplicationCommand := &command.CreateCooperationApplicationCommand{}
_ = controller.Unmarshal(createCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
createCooperationApplicationCommand.CompanyId = header.CompanyId
createCooperationApplicationCommand.OrgId = header.OrgId
createCooperationApplicationCommand.UserId = header.UserId
createCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.CreateCooperationApplication(createCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) UpdateCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
updateCooperationApplicationCommand := &command.UpdateCooperationApplicationCommand{}
_ = controller.Unmarshal(updateCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
updateCooperationApplicationCommand.CompanyId = header.CompanyId
updateCooperationApplicationCommand.OrgId = header.OrgId
updateCooperationApplicationCommand.UserId = header.UserId
updateCooperationApplicationCommand.UserBaseId = header.UserBaseId
cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
updateCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
data, err := cooperationApplicationService.UpdateCooperationApplication(updateCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) GetCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
getCooperationApplicationQuery := &query.GetCooperationApplicationQuery{}
header := controller.GetRequestHeader(controller.Ctx)
getCooperationApplicationQuery.CompanyId = header.CompanyId
getCooperationApplicationQuery.OrgId = header.OrgId
getCooperationApplicationQuery.UserId = header.UserId
getCooperationApplicationQuery.UserBaseId = header.UserBaseId
cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
getCooperationApplicationQuery.CooperationApplicationId = cooperationApplicationId
data, err := cooperationApplicationService.GetCooperationApplication(getCooperationApplicationQuery)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) RemoveCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
removeCooperationApplicationCommand := &command.RemoveCooperationApplicationCommand{}
_ = controller.Unmarshal(removeCooperationApplicationCommand)
header := controller.GetRequestHeader(controller.Ctx)
removeCooperationApplicationCommand.CompanyId = header.CompanyId
removeCooperationApplicationCommand.OrgId = header.OrgId
removeCooperationApplicationCommand.UserId = header.UserId
removeCooperationApplicationCommand.UserBaseId = header.UserBaseId
cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
removeCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
data, err := cooperationApplicationService.RemoveCooperationApplication(removeCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) SearchCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
searchCooperationApplicationQuery := &query.SearchCooperationApplicationQuery{}
header := controller.GetRequestHeader(controller.Ctx)
searchCooperationApplicationQuery.CompanyId = header.CompanyId
searchCooperationApplicationQuery.OrgId = header.OrgId
searchCooperationApplicationQuery.UserId = header.UserId
searchCooperationApplicationQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt64("pageSize")
searchCooperationApplicationQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt64("pageNumber")
searchCooperationApplicationQuery.PageNumber = pageNumber
data, err := cooperationApplicationService.SearchCooperationApplication(searchCooperationApplicationQuery)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) ListCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
listCooperationApplicationQuery := &query.ListCooperationApplicationQuery{}
header := controller.GetRequestHeader(controller.Ctx)
listCooperationApplicationQuery.CompanyId = header.CompanyId
listCooperationApplicationQuery.OrgId = header.OrgId
listCooperationApplicationQuery.UserId = header.UserId
listCooperationApplicationQuery.UserBaseId = header.UserBaseId
pageSize, _ := controller.GetInt64("pageSize")
listCooperationApplicationQuery.PageSize = pageSize
pageNumber, _ := controller.GetInt64("pageNumber")
listCooperationApplicationQuery.PageNumber = pageNumber
data, err := cooperationApplicationService.ListCooperationApplication(listCooperationApplicationQuery)
controller.Response(data, err)
}