|
@@ -153,6 +153,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop |
|
@@ -153,6 +153,7 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop |
153
|
defer func() {
|
153
|
defer func() {
|
154
|
_ = transactionContext.RollbackTransaction()
|
154
|
_ = transactionContext.RollbackTransaction()
|
155
|
}()
|
155
|
}()
|
|
|
156
|
+
|
156
|
// 共创申请仓储初始化
|
157
|
// 共创申请仓储初始化
|
157
|
var cooperationApplicationRepository domain.CooperationApplicationRepository
|
158
|
var cooperationApplicationRepository domain.CooperationApplicationRepository
|
158
|
if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
159
|
if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
|
@@ -162,10 +163,29 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop |
|
@@ -162,10 +163,29 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop |
162
|
} else {
|
163
|
} else {
|
163
|
cooperationApplicationRepository = value
|
164
|
cooperationApplicationRepository = value
|
164
|
}
|
165
|
}
|
|
|
166
|
+
|
|
|
167
|
+ // 用户REST服务初始化
|
|
|
168
|
+ var userService service.UserService
|
|
|
169
|
+ if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
|
|
|
170
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
171
|
+ } else {
|
|
|
172
|
+ userService = value
|
|
|
173
|
+ }
|
|
|
174
|
+
|
|
|
175
|
+ // 获取审核人
|
|
|
176
|
+ var verifier *domain.User
|
|
|
177
|
+ if data, err := userService.UserFrom(approvalCooperationApplicationCommand.CompanyId, approvalCooperationApplicationCommand.OrgId, approvalCooperationApplicationCommand.UserId); err != nil {
|
|
|
178
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取申请人失败")
|
|
|
179
|
+ } else {
|
|
|
180
|
+ verifier = data
|
|
|
181
|
+ }
|
|
|
182
|
+
|
|
|
183
|
+ // 共创申请ID转换
|
165
|
cooperationApplicationId, err := strconv.ParseInt(approvalCooperationApplicationCommand.CooperationApplicationId, 10, 64)
|
184
|
cooperationApplicationId, err := strconv.ParseInt(approvalCooperationApplicationCommand.CooperationApplicationId, 10, 64)
|
166
|
if err != nil {
|
185
|
if err != nil {
|
167
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请ID类型错误")
|
186
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请ID类型错误")
|
168
|
}
|
187
|
}
|
|
|
188
|
+
|
169
|
// 获取共创申请
|
189
|
// 获取共创申请
|
170
|
cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": approvalCooperationApplicationCommand.CooperationApplicationId})
|
190
|
cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": approvalCooperationApplicationCommand.CooperationApplicationId})
|
171
|
if err != nil {
|
191
|
if err != nil {
|
|
@@ -174,11 +194,15 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop |
|
@@ -174,11 +194,15 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop |
174
|
if cooperationApplication == nil {
|
194
|
if cooperationApplication == nil {
|
175
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10)))
|
195
|
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10)))
|
176
|
}
|
196
|
}
|
|
|
197
|
+
|
177
|
if approvalCooperationApplicationCommand.Action == 1 {
|
198
|
if approvalCooperationApplicationCommand.Action == 1 {
|
178
|
cooperationApplication.CooperationApplicationStatus = 2
|
199
|
cooperationApplication.CooperationApplicationStatus = 2
|
179
|
} else if approvalCooperationApplicationCommand.Action == 2 {
|
200
|
} else if approvalCooperationApplicationCommand.Action == 2 {
|
180
|
cooperationApplication.CooperationApplicationStatus = 3
|
201
|
cooperationApplication.CooperationApplicationStatus = 3
|
181
|
}
|
202
|
}
|
|
|
203
|
+
|
|
|
204
|
+ cooperationApplication.CooperationApplicationVerifier = verifier
|
|
|
205
|
+
|
182
|
if err := cooperationApplication.Update(tool_funs.SimpleStructToMap(approvalCooperationApplicationCommand)); err != nil {
|
206
|
if err := cooperationApplication.Update(tool_funs.SimpleStructToMap(approvalCooperationApplicationCommand)); err != nil {
|
183
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
207
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
184
|
}
|
208
|
}
|
|
@@ -207,6 +231,7 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova |
|
@@ -207,6 +231,7 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova |
207
|
defer func() {
|
231
|
defer func() {
|
208
|
_ = transactionContext.RollbackTransaction()
|
232
|
_ = transactionContext.RollbackTransaction()
|
209
|
}()
|
233
|
}()
|
|
|
234
|
+
|
210
|
// 共创申请仓储初始化
|
235
|
// 共创申请仓储初始化
|
211
|
var cooperationApplicationRepository domain.CooperationApplicationRepository
|
236
|
var cooperationApplicationRepository domain.CooperationApplicationRepository
|
212
|
if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
237
|
if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
|
|
@@ -216,10 +241,30 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova |
|
@@ -216,10 +241,30 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova |
216
|
} else {
|
241
|
} else {
|
217
|
cooperationApplicationRepository = value
|
242
|
cooperationApplicationRepository = value
|
218
|
}
|
243
|
}
|
|
|
244
|
+
|
|
|
245
|
+ // 共创申请ID类型转换
|
219
|
cooperationApplicationIds, err := utils.SliceAtoi(batchApprovalCooperationApplicationCommand.CooperationApplicationIds)
|
246
|
cooperationApplicationIds, err := utils.SliceAtoi(batchApprovalCooperationApplicationCommand.CooperationApplicationIds)
|
220
|
if err != nil {
|
247
|
if err != nil {
|
221
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请ID列表类型错误")
|
248
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请ID列表类型错误")
|
222
|
}
|
249
|
}
|
|
|
250
|
+
|
|
|
251
|
+ // 用户REST服务初始化
|
|
|
252
|
+ var userService service.UserService
|
|
|
253
|
+ if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
|
|
|
254
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
255
|
+ } else {
|
|
|
256
|
+ userService = value
|
|
|
257
|
+ }
|
|
|
258
|
+
|
|
|
259
|
+ // 获取审核人
|
|
|
260
|
+ var verifier *domain.User
|
|
|
261
|
+ if data, err := userService.UserFrom(batchApprovalCooperationApplicationCommand.CompanyId, batchApprovalCooperationApplicationCommand.OrgId, batchApprovalCooperationApplicationCommand.UserId); err != nil {
|
|
|
262
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取申请人失败")
|
|
|
263
|
+ } else {
|
|
|
264
|
+ verifier = data
|
|
|
265
|
+ }
|
|
|
266
|
+
|
|
|
267
|
+ // 获取共创申请
|
223
|
if count, cooperationApplications, err := cooperationApplicationRepository.Find(map[string]interface{}{
|
268
|
if count, cooperationApplications, err := cooperationApplicationRepository.Find(map[string]interface{}{
|
224
|
"cooperationApplicationIds": cooperationApplicationIds,
|
269
|
"cooperationApplicationIds": cooperationApplicationIds,
|
225
|
}); err != nil {
|
270
|
}); err != nil {
|
|
@@ -227,12 +272,13 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova |
|
@@ -227,12 +272,13 @@ func (cooperationApplicationService *CooperationApplicationService) BatchApprova |
227
|
} else {
|
272
|
} else {
|
228
|
if count > 0 {
|
273
|
if count > 0 {
|
229
|
for i, _ := range cooperationApplications {
|
274
|
for i, _ := range cooperationApplications {
|
230
|
- cooperationApplications[i].CooperationApplicationDescription = batchApprovalCooperationApplicationCommand.CooperationApplicationVerifyDescription
|
275
|
+ cooperationApplications[i].CooperationApplicationVerifyDescription = batchApprovalCooperationApplicationCommand.CooperationApplicationVerifyDescription
|
231
|
if batchApprovalCooperationApplicationCommand.Action == 1 { // 同意
|
276
|
if batchApprovalCooperationApplicationCommand.Action == 1 { // 同意
|
232
|
cooperationApplications[i].CooperationApplicationStatus = 2
|
277
|
cooperationApplications[i].CooperationApplicationStatus = 2
|
233
|
} else if batchApprovalCooperationApplicationCommand.Action == 2 { // 拒绝
|
278
|
} else if batchApprovalCooperationApplicationCommand.Action == 2 { // 拒绝
|
234
|
cooperationApplications[i].CooperationApplicationStatus = 3
|
279
|
cooperationApplications[i].CooperationApplicationStatus = 3
|
235
|
}
|
280
|
}
|
|
|
281
|
+ cooperationApplications[i].CooperationApplicationVerifier = verifier
|
236
|
}
|
282
|
}
|
237
|
cooperationApplicationsApproved, err := cooperationApplicationRepository.UpdateMany(cooperationApplications)
|
283
|
cooperationApplicationsApproved, err := cooperationApplicationRepository.UpdateMany(cooperationApplications)
|
238
|
if err != nil {
|
284
|
if err != nil {
|