cooperation_application_controller.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
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
data, err := cooperationApplicationService.ApplyForCooperation(applyForCooperationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) AgreeCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
agreeCooperationApplicationCommand := &command.AgreeCooperationApplicationCommand{}
_ = controller.Unmarshal(agreeCooperationApplicationCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
agreeCooperationApplicationCommand.CompanyId = header.CompanyId
agreeCooperationApplicationCommand.OrgId = header.OrgId
agreeCooperationApplicationCommand.UserId = header.UserId
agreeCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.AgreeCooperationApplication(agreeCooperationApplicationCommand)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) RejectCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
rejectCooperationApplicationCommand := &command.RejectCooperationApplicationCommand{}
_ = controller.Unmarshal(rejectCooperationApplicationCommand)
// 解析头部信息
header := controller.GetRequestHeader(controller.Ctx)
rejectCooperationApplicationCommand.CompanyId = header.CompanyId
rejectCooperationApplicationCommand.OrgId = header.OrgId
rejectCooperationApplicationCommand.UserId = header.UserId
rejectCooperationApplicationCommand.UserBaseId = header.UserBaseId
data, err := cooperationApplicationService.RejectCooperationApplication(rejectCooperationApplicationCommand)
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) 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.GetString(":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)
}