|
|
@@ -3,7 +3,9 @@ package com.inspur.customer.web.controller.org;
|
|
|
import com.alibaba.cola.dto.PageResponse;
|
|
|
import com.alibaba.cola.dto.Response;
|
|
|
import com.alibaba.cola.dto.SingleResponse;
|
|
|
+import com.inspur.customer.client.keycloak.KeycloakService;
|
|
|
import com.inspur.customer.client.org.SmsbDepartmentService;
|
|
|
+import com.inspur.customer.client.org.SmsbDepartmentUserService;
|
|
|
import com.inspur.customer.object.org.*;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.keycloak.representations.idm.UserRepresentation;
|
|
|
@@ -22,6 +24,10 @@ public class SmsbDepartmentController {
|
|
|
|
|
|
@DubboReference
|
|
|
private SmsbDepartmentService departmentService;
|
|
|
+ @DubboReference
|
|
|
+ private SmsbDepartmentUserService userService;
|
|
|
+ @DubboReference
|
|
|
+ private KeycloakService service;
|
|
|
|
|
|
@PostMapping("/admin/department")
|
|
|
public Response addDepartment(@RequestHeader String userId, @Valid @RequestBody SmsbDepartmentAdd smsbDepartmentAdd){
|
|
|
@@ -74,4 +80,17 @@ public class SmsbDepartmentController {
|
|
|
return departmentService.regrouping(smsbRegrouping);
|
|
|
}
|
|
|
|
|
|
+ @DeleteMapping("/admin/users/{uId}")
|
|
|
+ public Response enableSwitch(@RequestHeader String userId,
|
|
|
+ @PathVariable("uId") String uId,
|
|
|
+ @Valid @RequestBody OperationAuthority authority){
|
|
|
+ Response checkResponse = departmentService.checkOperationAuthority(userId, authority.getTenant());
|
|
|
+ if(!checkResponse.isSuccess()){return checkResponse;}
|
|
|
+ if(userService.removeUser(uId)){
|
|
|
+ return service.removeUser(uId);
|
|
|
+ }else{
|
|
|
+ return Response.buildFailure("500","注销用户失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|