新增客户端部门人员选择插件
This commit is contained in:
parent
7d22720e36
commit
00dc0293f0
@ -103,4 +103,14 @@ public interface IApiConsts {
|
||||
* 修改密码
|
||||
*/
|
||||
String UPDATE_USER_PASSWORD = "%s/resource/user/updateuserpassword";
|
||||
|
||||
/**
|
||||
* 部门人员列表(ZTree格式)
|
||||
*/
|
||||
String LIST_ZTREE_DEPARTMENT_WITH_USER = "%s/resource/department/listztreedepartmentwithuser";
|
||||
|
||||
/**
|
||||
* 部门人员列表
|
||||
*/
|
||||
String LIST_DEPARTMENT_USER_BY_USER_DEPARTMENT_ID = "%s/resource/user/listdepartmentuserbyuserdepartmentid";
|
||||
}
|
||||
|
@ -11,10 +11,7 @@ import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -52,4 +49,18 @@ public class DepartmentController extends AbstractController {
|
||||
return departmentService.listDepartments(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "部门人员列表", notes = "部门人员列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "上级部门ID", paramType = "form")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listztreedepartmentwithuser")
|
||||
public JSONArray listZTreeDepartmentWithUser(@RequestParam(required = false) String id) {
|
||||
String departmentParentId = "0";
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
departmentParentId = id;
|
||||
}
|
||||
return departmentService.listZTreeDepartmentWithUser(departmentParentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -156,9 +157,21 @@ public class UserController extends AbstractController {
|
||||
@PutMapping("updateuserpassword")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult updateUserPassword(@RequestBody Map<String, Object> params) throws ParamsException, SearchException, UpdateException {
|
||||
// params.put("oldPassword", appChangePasswordVO.getOldPassword());
|
||||
// params.put("newPassword", appChangePasswordVO.getNewPassword());
|
||||
return userService.updateUserPassword(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过用户和部门ID列表获取部门用户列表", notes = "通过用户和部门ID列表获取部门用户列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "selectedUsers", value = "用户和部门ID列表", paramType = "body")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("listdepartmentuserbyuserdepartmentid")
|
||||
public JSONArray listDepartmentUserByUserDepartmentId(@RequestBody JSONObject params) {
|
||||
JSONArray selectedUsers = params.getJSONArray("selectedUsers");
|
||||
if (selectedUsers == null || selectedUsers.isEmpty()) {
|
||||
throw new ParamsException("参数列表不能为空");
|
||||
}
|
||||
return userService.listDepartmentUserByUserDepartmentId(params);
|
||||
}
|
||||
|
||||
}
|
@ -38,4 +38,14 @@ public interface IDepartmentService {
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONArray listDepartmentsAllByParentId(String parentId) throws AccessTokenException, SearchException;
|
||||
|
||||
/**
|
||||
* 部门人员列表
|
||||
*
|
||||
* @param departmentParentId
|
||||
* @return
|
||||
* @throws AccessTokenException
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONArray listZTreeDepartmentWithUser(String departmentParentId) throws AccessTokenException, SearchException;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.IApiConsts;
|
||||
import com.cm.common.plugin.oauth.service.department.IDepartmentService;
|
||||
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
||||
import com.cm.common.plugin.utils.RestTemplateUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -56,4 +57,14 @@ public class DepartmentServiceImpl extends AbstractService implements IDepartmen
|
||||
}
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray listZTreeDepartmentWithUser(String departmentParentId) throws AccessTokenException, SearchException {
|
||||
Map<String, Object> params = new HashMap<>(1);
|
||||
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||
params.put("id", departmentParentId);
|
||||
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_ZTREE_DEPARTMENT_WITH_USER, apiPathProperties.getUserCenter()), params);
|
||||
searchResourceResult(result, "获取部门人员列表失败");
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
}
|
||||
|
@ -157,4 +157,14 @@ public interface IUserService {
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResult updateUserPassword(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||
|
||||
/**
|
||||
* 通过用户和部门ID列表获取部门用户列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws AccessTokenException
|
||||
* @throws SearchException
|
||||
*/
|
||||
JSONArray listDepartmentUserByUserDepartmentId(JSONObject params) throws AccessTokenException, SearchException;
|
||||
}
|
||||
|
@ -137,4 +137,14 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray listDepartmentUserByUserDepartmentId(JSONObject jsonObject) throws AccessTokenException, SearchException {
|
||||
Map<String, Object> params = new HashMap<>(1);
|
||||
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||
params.put("jsonObjectParams", jsonObject.toJSONString());
|
||||
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_DEPARTMENT_USER_BY_USER_DEPARTMENT_ID, apiPathProperties.getUserCenter()), params);
|
||||
searchResourceResult(result, "获取部门人员列表失败");
|
||||
return JSONArray.parseArray(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,7 +65,7 @@
|
||||
});
|
||||
$('.selector-body-wrapper').css({
|
||||
marginTop: '5px',
|
||||
height: height +'px',
|
||||
height: (height - 10) +'px',
|
||||
border: '1px dotted silver'
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user