|
@@ -130,7 +130,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. |
|
@@ -130,7 +130,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. |
130
|
Phone: companyUserAddCommand.Phone,
|
130
|
Phone: companyUserAddCommand.Phone,
|
131
|
Avatar: companyUserAddCommand.Avator,
|
131
|
Avatar: companyUserAddCommand.Avator,
|
132
|
Email: companyUserAddCommand.Avator,
|
132
|
Email: companyUserAddCommand.Avator,
|
133
|
- Password: "", //TODO 填充密码
|
133
|
+ Password: "123456", //TODO 填充密码
|
134
|
})
|
134
|
})
|
135
|
|
135
|
|
136
|
data := struct {
|
136
|
data := struct {
|
|
@@ -149,10 +149,19 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co |
|
@@ -149,10 +149,19 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co |
149
|
companyUserEnableCommand.Operator.CompanyId,
|
149
|
companyUserEnableCommand.Operator.CompanyId,
|
150
|
companyUserEnableCommand.Operator.OrgId,
|
150
|
companyUserEnableCommand.Operator.OrgId,
|
151
|
companyUserEnableCommand.Operator.UserId)
|
151
|
companyUserEnableCommand.Operator.UserId)
|
|
|
152
|
+
|
|
|
153
|
+ var userIds []int64
|
|
|
154
|
+ for i := range companyUserEnableCommand.UsersIds {
|
|
|
155
|
+ id, _ := strconv.Atoi(companyUserEnableCommand.UsersIds[i])
|
|
|
156
|
+ userIds = append(userIds, int64(id))
|
|
|
157
|
+ }
|
152
|
_, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
158
|
_, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
153
|
- UserIds: companyUserEnableCommand.UsersIds,
|
159
|
+ UserIds: userIds,
|
154
|
EnableStatus: companyUserEnableCommand.EnableStatus,
|
160
|
EnableStatus: companyUserEnableCommand.EnableStatus,
|
155
|
})
|
161
|
})
|
|
|
162
|
+ if err != nil {
|
|
|
163
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
164
|
+ }
|
156
|
return companyUserEnableCommand, err
|
165
|
return companyUserEnableCommand, err
|
157
|
}
|
166
|
}
|
158
|
|
167
|
|
|
@@ -171,7 +180,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co |
|
@@ -171,7 +180,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co |
171
|
})
|
180
|
})
|
172
|
|
181
|
|
173
|
if err != nil {
|
182
|
if err != nil {
|
174
|
- return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
183
|
+ return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
175
|
}
|
184
|
}
|
176
|
//数据转换
|
185
|
//数据转换
|
177
|
cnt := int64(result.Count)
|
186
|
cnt := int64(result.Count)
|
|
@@ -200,10 +209,18 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw |
|
@@ -200,10 +209,18 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw |
200
|
companyUserResetPasswordCommand.Operator.CompanyId,
|
209
|
companyUserResetPasswordCommand.Operator.CompanyId,
|
201
|
companyUserResetPasswordCommand.Operator.OrgId,
|
210
|
companyUserResetPasswordCommand.Operator.OrgId,
|
202
|
companyUserResetPasswordCommand.Operator.UserId)
|
211
|
companyUserResetPasswordCommand.Operator.UserId)
|
|
|
212
|
+ var userIds []int64
|
|
|
213
|
+ for i := range companyUserResetPasswordCommand.UsersIds {
|
|
|
214
|
+ id, _ := strconv.Atoi(companyUserResetPasswordCommand.UsersIds[i])
|
|
|
215
|
+ userIds = append(userIds, int64(id))
|
|
|
216
|
+ }
|
203
|
_, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{
|
217
|
_, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{
|
204
|
- Password: "", //TODO 填充密码
|
|
|
205
|
- UserIds: companyUserResetPasswordCommand.UsersIds,
|
218
|
+ Password: "123456", //TODO 填充密码
|
|
|
219
|
+ UserIds: userIds,
|
206
|
})
|
220
|
})
|
|
|
221
|
+ if err != nil {
|
|
|
222
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
223
|
+ }
|
207
|
return companyUserResetPasswordCommand, err
|
224
|
return companyUserResetPasswordCommand, err
|
208
|
}
|
225
|
}
|
209
|
|
226
|
|
|
@@ -244,6 +261,9 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co |
|
@@ -244,6 +261,9 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co |
244
|
Avatar: companyUserUpdateCommand.Avator,
|
261
|
Avatar: companyUserUpdateCommand.Avator,
|
245
|
Email: companyUserUpdateCommand.Avator,
|
262
|
Email: companyUserUpdateCommand.Avator,
|
246
|
})
|
263
|
})
|
|
|
264
|
+ if err != nil {
|
|
|
265
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
266
|
+ }
|
247
|
return companyUserUpdateCommand, err
|
267
|
return companyUserUpdateCommand, err
|
248
|
}
|
268
|
}
|
249
|
|
269
|
|
|
@@ -265,6 +285,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * |
|
@@ -265,6 +285,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * |
265
|
Phone: cooperationUserAddCommand.Phone,
|
285
|
Phone: cooperationUserAddCommand.Phone,
|
266
|
Password: "123456", //TODO 填充默认密码
|
286
|
Password: "123456", //TODO 填充默认密码
|
267
|
})
|
287
|
})
|
|
|
288
|
+ if err != nil {
|
|
|
289
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
290
|
+ }
|
268
|
data := struct {
|
291
|
data := struct {
|
269
|
UserId string `json:"userId"`
|
292
|
UserId string `json:"userId"`
|
270
|
command.CooperationUserAddCommand
|
293
|
command.CooperationUserAddCommand
|
|
@@ -281,10 +304,18 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom |
|
@@ -281,10 +304,18 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom |
281
|
cooperationUserEnableCommand.Operator.CompanyId,
|
304
|
cooperationUserEnableCommand.Operator.CompanyId,
|
282
|
cooperationUserEnableCommand.Operator.OrgId,
|
305
|
cooperationUserEnableCommand.Operator.OrgId,
|
283
|
cooperationUserEnableCommand.Operator.UserId)
|
306
|
cooperationUserEnableCommand.Operator.UserId)
|
|
|
307
|
+ var userIds []int64
|
|
|
308
|
+ for i := range cooperationUserEnableCommand.UsersIds {
|
|
|
309
|
+ id, _ := strconv.Atoi(cooperationUserEnableCommand.UsersIds[i])
|
|
|
310
|
+ userIds = append(userIds, int64(id))
|
|
|
311
|
+ }
|
284
|
_, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
312
|
_, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
285
|
- UserIds: cooperationUserEnableCommand.UsersIds,
|
313
|
+ UserIds: userIds,
|
286
|
EnableStatus: cooperationUserEnableCommand.EnableStatus,
|
314
|
EnableStatus: cooperationUserEnableCommand.EnableStatus,
|
287
|
})
|
315
|
})
|
|
|
316
|
+ if err != nil {
|
|
|
317
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
318
|
+ }
|
288
|
return cooperationUserEnableCommand, err
|
319
|
return cooperationUserEnableCommand, err
|
289
|
}
|
320
|
}
|
290
|
|
321
|
|
|
@@ -294,12 +325,12 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu |
|
@@ -294,12 +325,12 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu |
294
|
cooperationUserGetQuery.Operator.CompanyId,
|
325
|
cooperationUserGetQuery.Operator.CompanyId,
|
295
|
cooperationUserGetQuery.Operator.OrgId,
|
326
|
cooperationUserGetQuery.Operator.OrgId,
|
296
|
cooperationUserGetQuery.Operator.UserId)
|
327
|
cooperationUserGetQuery.Operator.UserId)
|
297
|
- userId, _ := strconv.Atoi(cooperationUserGetQuery.UsersId)
|
328
|
+ userId, _ := strconv.Atoi(cooperationUserGetQuery.UserId)
|
298
|
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
|
329
|
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
|
299
|
UserId: userId,
|
330
|
UserId: userId,
|
300
|
})
|
331
|
})
|
301
|
if err != nil {
|
332
|
if err != nil {
|
302
|
- return nil, err
|
333
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
303
|
}
|
334
|
}
|
304
|
deadline := result.CooperationInfo.CooperationDeadline.Unix()
|
335
|
deadline := result.CooperationInfo.CooperationDeadline.Unix()
|
305
|
userInfo := dto.CooperationUserInfo{
|
336
|
userInfo := dto.CooperationUserInfo{
|
|
@@ -320,14 +351,15 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu |
|
@@ -320,14 +351,15 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu |
320
|
func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) {
|
351
|
func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) {
|
321
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
|
352
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
|
322
|
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
|
353
|
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
|
323
|
- Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
|
|
|
324
|
- Limit: cooperationUserListQuery.PageSize,
|
|
|
325
|
- CompanyId: cooperationUserListQuery.Operator.CompanyId,
|
|
|
326
|
- OrganizationId: cooperationUserListQuery.Operator.OrgId,
|
|
|
327
|
- DepartmentId: 0,
|
|
|
328
|
- UserName: cooperationUserListQuery.UserName,
|
|
|
329
|
- DepName: "",
|
|
|
330
|
- Phone: "",
|
354
|
+ Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
|
|
|
355
|
+ Limit: cooperationUserListQuery.PageSize,
|
|
|
356
|
+ CompanyId: cooperationUserListQuery.Operator.CompanyId,
|
|
|
357
|
+ OrganizationId: cooperationUserListQuery.Operator.OrgId,
|
|
|
358
|
+ DepartmentId: 0,
|
|
|
359
|
+ UserName: cooperationUserListQuery.UserName,
|
|
|
360
|
+ CooperationCompany: cooperationUserListQuery.CooperationCompany,
|
|
|
361
|
+ DepName: "",
|
|
|
362
|
+ Phone: "",
|
331
|
})
|
363
|
})
|
332
|
var (
|
364
|
var (
|
333
|
listData []dto.CooperationUserItem
|
365
|
listData []dto.CooperationUserItem
|
|
@@ -361,6 +393,9 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe |
|
@@ -361,6 +393,9 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe |
361
|
Password: "", //TODO 填充密码
|
393
|
Password: "", //TODO 填充密码
|
362
|
UserIds: cooperationUserResetPasswordCommand.UsersIds,
|
394
|
UserIds: cooperationUserResetPasswordCommand.UsersIds,
|
363
|
})
|
395
|
})
|
|
|
396
|
+ if err != nil {
|
|
|
397
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
398
|
+ }
|
364
|
return cooperationUserResetPasswordCommand, err
|
399
|
return cooperationUserResetPasswordCommand, err
|
365
|
}
|
400
|
}
|
366
|
|
401
|
|
|
@@ -382,6 +417,9 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom |
|
@@ -382,6 +417,9 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom |
382
|
OrgId: cooperationUserUpdateCommand.Operator.OrgId,
|
417
|
OrgId: cooperationUserUpdateCommand.Operator.OrgId,
|
383
|
Phone: cooperationUserUpdateCommand.Phone,
|
418
|
Phone: cooperationUserUpdateCommand.Phone,
|
384
|
})
|
419
|
})
|
|
|
420
|
+ if err != nil {
|
|
|
421
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
422
|
+ }
|
385
|
return cooperationUserUpdateCommand, err
|
423
|
return cooperationUserUpdateCommand, err
|
386
|
}
|
424
|
}
|
387
|
|
425
|
|
|
@@ -401,7 +439,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan |
|
@@ -401,7 +439,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan |
401
|
ParentId: 0,
|
439
|
ParentId: 0,
|
402
|
})
|
440
|
})
|
403
|
if err != nil {
|
441
|
if err != nil {
|
404
|
- return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
442
|
+ return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
405
|
}
|
443
|
}
|
406
|
var (
|
444
|
var (
|
407
|
dataList []dto.UserOrg
|
445
|
dataList []dto.UserOrg
|
|
@@ -431,7 +469,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa |
|
@@ -431,7 +469,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa |
431
|
RoleName: selectorQuery.RoleName,
|
469
|
RoleName: selectorQuery.RoleName,
|
432
|
})
|
470
|
})
|
433
|
if err != nil {
|
471
|
if err != nil {
|
434
|
- return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
472
|
+ return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
435
|
}
|
473
|
}
|
436
|
var (
|
474
|
var (
|
437
|
dataList []dto.UserRole
|
475
|
dataList []dto.UserRole
|