Commit 7bfcd65c by 李小龙

组织角色

parent 88b6ee64
Showing with 372 additions and 225 deletions
......@@ -53,7 +53,7 @@ public class SwaggerSaasConfig {
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.groupName("03-平台端");
.groupName("03-平台端-人员管理");
ApiSelectorBuilder builder = docket.select();
//api过滤
builder = builder.apis(
......
......@@ -29,7 +29,7 @@ public class PlatLoginController {
@ApiOperation("退出登录")
@PostMapping("logout")
public ApiResponseEntity<?> logout() {
public ApiResponseEntity<Void> logout() {
platUserService.logout();
return ApiResponseUtils.success();
}
......
package com.makeit.controller.plat;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.global.annotation.Action;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.vo.platform.auth.PlatOrgQueryDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 租户端角色 前端控制器
* </p>
*
* @author eugene young
* @since 2022-05-10
*/
@Api(tags = "平台端-组织")
@RestController
@RequestMapping("/plat/org")
public class PlatOrgController {
@Autowired
private PlatOrgService platOrgService;
@Autowired
private PlatUserService platUserService;
@Action(module = "平台端-组织", name = "分页列表", code = "plat:org:page")
@ApiOperation("树形列表")
@PostMapping("page")
public ApiResponseEntity<PageVO<PlatOrg>> page(@RequestBody PageReqDTO<PlatOrgQueryDTO> pageReqDTO){
return ApiResponseUtils.success(platOrgService.page(pageReqDTO));
}
@Action(module = "平台端-组织", name = "不分页列表", code = "plat:org:list")
@ApiOperation("树形列表")
@PostMapping("list")
public ApiResponseEntity<List<PlatOrg>> list(@RequestBody PlatOrgQueryDTO platOrgQueryDTO){
return ApiResponseUtils.success(platOrgService.subOrgList(platOrgQueryDTO));
}
@Action(module = "平台端-组织", name = "树形列表", code = "plat:org:tree")
@ApiOperation("树形列表")
@PostMapping("tree")
public ApiResponseEntity<List<PlatOrg>> tree(@RequestBody PlatOrgQueryDTO tntDept){
return ApiResponseUtils.success(platOrgService.tree(tntDept));
}
@ApiOperation("树形列表(AuthIgnore)")
@PostMapping("treeAuthIgnore")
public ApiResponseEntity<List<PlatOrg>> treeAuthIgnore(@RequestBody PlatOrgQueryDTO tntDept){
return ApiResponseUtils.success(platOrgService.tree(tntDept));
}
@Action(module = "平台端-组织", name = "新增", code = "plat:org:add")
@ApiOperation("新增")
@PostMapping("add")
public ApiResponseEntity<String> add(@Validated @RequestBody PlatOrg tntDept){
return ApiResponseUtils.success(platOrgService.add(tntDept));
}
@Action(module = "平台端-组织", name = "编辑", code = "plat:org:edit")
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<Void> edit(@Validated @RequestBody PlatOrg tntDept){
platOrgService.edit(tntDept);
return ApiResponseUtils.success();
}
@Action(module = "平台端-组织", name = "详情", code = "plat:org:view")
@ApiOperation("详情")
@PostMapping("view")
public ApiResponseEntity<PlatOrg> view(@RequestBody BaseIdDTO baseIdDTO){
return ApiResponseUtils.success(platOrgService.view(baseIdDTO.getId()));
}
@Action(module = "平台端-组织", name = "删除", code = "plat:org:del")
@ApiOperation("删除")
@PostMapping("del")
public ApiResponseEntity<PlatOrg> del(@RequestBody BaseIdDTO baseIdDTO){
platOrgService.del(baseIdDTO.getId());
return ApiResponseUtils.success();
}
@ApiOperation("左上方组织树")
@PostMapping("deptTree")
public ApiResponseEntity<List<PlatOrg>> tree(){
return ApiResponseUtils.success(platUserService.getDeptTreeList());
}
@ApiOperation("当前账号的权限级别树")
@PostMapping("belongToScopeTree")
public ApiResponseEntity<List<PlatOrg>> belongToScopeTree(@RequestBody BaseIdDTO baseIdDTO){
return ApiResponseUtils.success(platOrgService.belongToOrgTree());
}
@ApiOperation("启用|禁用")
@PostMapping("enable")
public ApiResponseEntity<Void> enable(@RequestBody PlatOrg param){
platOrgService.enable(param);
return ApiResponseUtils.success();
}
}
......@@ -11,6 +11,8 @@ import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.auth.PlatRoleDeptDTOVO;
import com.makeit.dto.platform.auth.PlatRoleMenuDTO;
import com.makeit.dto.platform.auth.PlatUserRoleDTO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.auth.PlatRoleMenu;
import com.makeit.entity.platform.auth.PlatRoleOrg;
import com.makeit.global.annotation.Action;
......@@ -76,15 +78,14 @@ public class PlatRoleController {
@Action(module = "平台端-角色", name = "新增", code = "tnt:role:add")
@ApiOperation("新增")
@PostMapping("add")
public ApiResponseEntity<?> add(@Validated @RequestBody PlatRoleDTOVO dto) {
platRoleService.add(dto);
return ApiResponseUtils.success();
public ApiResponseEntity<String> add(@Validated @RequestBody PlatRoleDTOVO dto) {
return ApiResponseUtils.success(platRoleService.add(dto));
}
@Action(module = "平台端-角色", name = "编辑", code = "tnt:role:edit")
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatRoleDTOVO dto) {
public ApiResponseEntity<Void> edit(@Validated @RequestBody PlatRoleDTOVO dto) {
platRoleService.edit(dto);
return ApiResponseUtils.success();
}
......@@ -99,7 +100,7 @@ public class PlatRoleController {
@Action(module = "平台端-角色", name = "删除", code = "tnt:role:del")
@ApiOperation("删除")
@PostMapping("del")
public ApiResponseEntity<?> del(@RequestBody BaseIdDTO dto) {
public ApiResponseEntity<Void> del(@RequestBody BaseIdDTO dto) {
platRoleService.del(dto.getId());
return ApiResponseUtils.success();
}
......@@ -107,7 +108,7 @@ public class PlatRoleController {
@Action(module = "平台端-角色", name = "改变状态", code = "tnt:role:changeStatus")
@ApiOperation("改变状态")
@PostMapping("changeStatus")
public ApiResponseEntity<?> changeStatus(@RequestBody StatusDTO dto) {
public ApiResponseEntity<Void> changeStatus(@RequestBody StatusDTO dto) {
platRoleService.changeStatus(dto);
return ApiResponseUtils.success();
}
......@@ -115,7 +116,7 @@ public class PlatRoleController {
@Action(module = "平台端-角色", name = "分配用户", code = "tnt:role:assignUserList")
@ApiOperation("分配用户")
@PostMapping("assignUserList")
public ApiResponseEntity<?> assignUserList(@RequestBody List<PlatUserRoleDTO> userRoleDTOList) {//参数要不要是一个对象里 有一个数组
public ApiResponseEntity<Void> assignUserList(@RequestBody List<PlatUserRoleDTO> userRoleDTOList) {//参数要不要是一个对象里 有一个数组
platRoleService.assignUserList(userRoleDTOList);
return ApiResponseUtils.success();
}
......@@ -123,7 +124,7 @@ public class PlatRoleController {
@Action(module = "平台端-角色", name = "删除分配用户", code = "tnt:role:removeAssignUserList")
@ApiOperation("删除分配用户")
@PostMapping("removeAssignUserList")
public ApiResponseEntity<?> removeAssignUserList(@RequestBody List<PlatUserRoleDTO> userRoleDTOList) {
public ApiResponseEntity<Void> removeAssignUserList(@RequestBody List<PlatUserRoleDTO> userRoleDTOList) {
platRoleService.removeAssignUserList(userRoleDTOList);
return ApiResponseUtils.success();
}
......@@ -131,7 +132,7 @@ public class PlatRoleController {
@Action(module = "平台端-角色", name = "分配菜单", code = "tnt:role:assignMenuList")
@ApiOperation("分配菜单")
@PostMapping("assignMenuList")
public ApiResponseEntity<?> assignMenuList(@RequestBody PlatRoleMenuDTO roleMenuDTO) {
public ApiResponseEntity<Void> assignMenuList(@RequestBody PlatRoleMenuDTO roleMenuDTO) {
platRoleService.assignMenuList(roleMenuDTO);
return ApiResponseUtils.success();
}
......@@ -143,38 +144,22 @@ public class PlatRoleController {
return ApiResponseUtils.success(platRoleService.getAssignMenuList(baseIdDTO.getId()));
}
// @Action(module = "平台端-角色", name = "分配微信菜单", code = "tnt:role:assignWechatMenuList")
// @ApiOperation("分配微信菜单")
// @PostMapping("assignWechatMenuList")
// public ApiResponseEntity<?> assignWechatMenuList(@RequestBody PlatRoleMenuDTO roleMenuDTO) {
// platRoleService.assignWechatMenuList(roleMenuDTO);
// return ApiResponseUtils.success();
// }
//
// @Action(module = "平台端-角色", name = "获取分配微信菜单", code = "tnt:role:getWechatMenuListByRoleId")
// @ApiOperation("获取分配微信菜单")
// @PostMapping("getWechatMenuListByRoleId")
// public ApiResponseEntity<List<PlatRoleWechatMenu>> getWechatMenuListByRoleId(@RequestBody BaseIdDTO baseIdDTO) {
// return ApiResponseUtils.success(platRoleService.getWechatMenuListByRoleId(baseIdDTO.getId()));
// }
//@Action(module = "平台端-角色", name = "管理范围可选值", code = "tnt:role:getCandidateDeptList")
@ApiOperation("管理范围可选值")
@PostMapping("getCandidateOrgList")
public ApiResponseEntity<?> getCandidateDeptList(@RequestBody BaseOrgDTO deptDTO) {
public ApiResponseEntity<List<PlatOrg>> getCandidateDeptList(@RequestBody BaseOrgDTO deptDTO) {
return ApiResponseUtils.success(platUserService.getHotelList(deptDTO.getOrgId()));
}
@ApiOperation("管理范围可选值2")
@PostMapping("getCandidateDeptList2")
public ApiResponseEntity<?> getCandidateDeptList2(@RequestBody BaseOrgDTO deptDTO) {
public ApiResponseEntity<List<PlatOrg>> getCandidateDeptList2(@RequestBody BaseOrgDTO deptDTO) {
return ApiResponseUtils.success(platUserService.getCandidateDeptList());
}
@Action(module = "平台端-角色", name = "分配管理权限", code = "tnt:role:assignDeptList")
@ApiOperation("分配管理权限")
@PostMapping("assignDeptList")
public ApiResponseEntity<?> assignDeptList(@RequestBody PlatRoleDeptDTOVO roleDeptDTO) {
public ApiResponseEntity<Void> assignDeptList(@RequestBody PlatRoleDeptDTOVO roleDeptDTO) {
platRoleService.assignDeptList(roleDeptDTO);
return ApiResponseUtils.success();
}
......@@ -189,7 +174,7 @@ public class PlatRoleController {
@Action(module = "平台端-角色", name = "复制角色及关联", code = "tnt:role:copyRole")
@ApiOperation("复制角色及关联")
@PostMapping("copyRole")
public ApiResponseEntity<?> copyRole(@RequestBody BaseIdDTO baseIdDTO) {
public ApiResponseEntity<Void> copyRole(@RequestBody BaseIdDTO baseIdDTO) {
platRoleService.copyRole(baseIdDTO.getId());
return ApiResponseUtils.success();
}
......@@ -200,20 +185,12 @@ public class PlatRoleController {
return ApiResponseUtils.success(platRoleService.getList(dto));
}
// @ApiOperation(value = "导出模板", notes = "")
// @PostMapping("/exportTemplate")
// public void exportTemplate(HttpServletResponse response) {
// platRoleService.exportTemplate(response);
// }
//
// @ApiOperation(value = "人员角色关联-导入", notes = "tnt.userLabel.importExcel")
// @PostMapping("/importExcel")
// @Action(name = "人员角色关联-导入", code = "tnt:role:copyRole.userRole.importExcel")
// public ApiResponseEntity<ExcelImportVo> importExcel(@RequestParam(value = "deptId", required = true) String deptId,
// @RequestParam(value = "hotelId", required = true) String hotelId,
// @RequestParam(value = "excelFile", required = true) MultipartFile excelFile) throws Exception {
// return ApiResponseUtils.success(platRoleService.importExcel(deptId, hotelId, excelFile));
// }
@ApiOperation("人员管理-角色")
@PostMapping("belongTo")
public ApiResponseEntity<List<PlatRole>> belongTo(@Validated @RequestBody BaseIdDTO baseIdDTO) {
List<PlatRole> list = platRoleService.belongTo(baseIdDTO);
return ApiResponseUtils.success(list);
}
}
......@@ -10,6 +10,7 @@ import com.makeit.common.response.ApiResponseUtils;
import com.makeit.global.annotation.Action;
import com.makeit.module.admin.dto.plat.PlatUserDTOVO;
import com.makeit.module.admin.dto.plat.PlatUserQueryDTO;
import com.makeit.module.admin.vo.plat.PlatUserLoginVO;
import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.vo.platform.auth.PlatPersonDTOVO;
import io.swagger.annotations.Api;
......@@ -75,15 +76,14 @@ public class PlatUserController {
@Action(module = "平台端-人员", name = "新增", code = "plat:user:add")
@ApiOperation("新增")
@PostMapping("add")
public ApiResponseEntity<?> add(@Validated @RequestBody PlatPersonDTOVO dto) {
platUserService.addPerson(dto);
return ApiResponseUtils.success();
public ApiResponseEntity<String> add(@Validated @RequestBody PlatPersonDTOVO dto) {
return ApiResponseUtils.success(platUserService.addPerson(dto));
}
@Action(module = "平台端-人员", name = "编辑", code = "plat:user:edit")
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<?> edit(@Validated @RequestBody PlatPersonDTOVO dto) {
public ApiResponseEntity<Void> edit(@Validated @RequestBody PlatPersonDTOVO dto) {
platUserService.editPerson(dto);
return ApiResponseUtils.success();
}
......@@ -91,7 +91,7 @@ public class PlatUserController {
@Action(module = "平台端-人员", name = "改变密码", code = "plat:user:changePassword")
@ApiOperation("改变密码")
@PostMapping("changePassword")
public ApiResponseEntity<?> changePassword(@RequestBody PlatUserDTOVO dto) {
public ApiResponseEntity<Void> changePassword(@RequestBody PlatUserDTOVO dto) {
platUserService.changePassword(dto);
return ApiResponseUtils.success();
}
......@@ -106,7 +106,7 @@ public class PlatUserController {
@Action(module = "平台端-人员", name = "删除", code = "plat:user:del")
@ApiOperation("删除")
@PostMapping("del")
public ApiResponseEntity<?> del(@RequestBody BaseIdDTO dto) {
public ApiResponseEntity<Void> del(@RequestBody BaseIdDTO dto) {
platUserService.del(dto.getId());
return ApiResponseUtils.success();
}
......@@ -114,41 +114,34 @@ public class PlatUserController {
@Action(module = "平台端-人员", name = "改变状态", code = "plat:user:changeStatus")
@ApiOperation("改变状态")
@PostMapping("changeStatus")
public ApiResponseEntity<?> changeStatus(@RequestBody StatusDTO dto) {
public ApiResponseEntity<Void> changeStatus(@RequestBody StatusDTO dto) {
platUserService.changeStatus(dto);
return ApiResponseUtils.success();
}
// @ApiOperation("获取当前登录用户角色菜单")
// @PostMapping("getRoleMenu")
// public ApiResponseEntity<PlatUserLoginVO> getRoleAndMenuList() {
// return ApiResponseUtils.success(platUserService.getRoleAndMenuList());
// }
//
// @ApiOperation("获取当前登录用户角色菜单2")
// @PostMapping("getRoleMenu2")
// public ApiResponseEntity<PlatUserLoginVO> getRoleAndMenuList2() {
// return ApiResponseUtils.success(platUserService.getRoleAndMenuList2());
// }
// //@Action(module = "平台端-人员", name = "获取当前登录用户企业微信菜单", code = "tnt:user:getWechatMenuList")
// @ApiOperation("获取当前登录用户企业微信菜单")
// @PostMapping("getWechatMenuList")
// public ApiResponseEntity<PlatUserLoginVO> getWechatMenuList() {
// return ApiResponseUtils.success(platUserService.getWechatMenuList());
// }
// @ApiOperation("获取当前登录用户信息")
// @PostMapping("getUserVO")
// public ApiResponseEntity<PlatUserLoginVO> getUserInfo() {
// return ApiResponseUtils.success(platUserService.getUserVO());
// }
//
// @ApiOperation("获取当前登录用户详细信息")
// @PostMapping("getUserDetail")
// public ApiResponseEntity<PlatPersonDTOVO> getUserDetail() {
// return ApiResponseUtils.success(platUserService.getUserDetail());
// }
@ApiOperation("获取当前登录用户角色菜单")
@PostMapping("getRoleMenu")
public ApiResponseEntity<PlatUserLoginVO> getRoleAndMenuList() {
return ApiResponseUtils.success(platUserService.getRoleAndMenuList());
}
@ApiOperation("获取当前登录用户角色菜单2")
@PostMapping("getRoleMenu2")
public ApiResponseEntity<PlatUserLoginVO> getRoleAndMenuList2() {
return ApiResponseUtils.success(platUserService.getRoleAndMenuList2());
}
@ApiOperation("获取当前登录用户信息")
@PostMapping("getUserVO")
public ApiResponseEntity<PlatUserLoginVO> getUserInfo() {
return ApiResponseUtils.success(platUserService.getUserVO());
}
@ApiOperation("获取当前登录用户详细信息")
@PostMapping("getUserDetail")
public ApiResponseEntity<PlatPersonDTOVO> getUserDetail() {
return ApiResponseUtils.success(platUserService.getUserDetail());
}
}
......@@ -18,4 +18,7 @@ public class BaseOrgDTO extends BaseTenantDTO implements Serializable {
@ApiModelProperty(value = "部门树冗余 id")
private String path;
@ApiModelProperty(value = "父级id")
private String parentId;
}
package com.makeit.module.admin.dto.plat;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.makeit.common.dto.BaseOrgDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel("租户端角色 列表 新增 编辑 详情")
......@@ -23,33 +20,9 @@ public class PlatRoleDTOVO extends BaseOrgDTO implements Serializable {
@ApiModelProperty(value = "名称")
private String name;
@NotBlank(message = "编码不能为空")
@Size(max = 64, message = "编码最长为64字符")
@Pattern(regexp = "[a-zA-Z0-9]{0,64}", message = "编码只能为大小写英文字符和数字")
@ApiModelProperty(value = "编码")
private String code;
// @NotBlank(message = "状态不能为空")
// @Pattern(regexp = "0|1", message = "状态可选值为 0禁用 1启用")
// @ApiModelProperty(value = "状态 0禁用 1启用")
// private String status;
@Size(max = 512, message = "备注最长512字符")
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "是否管理员角色 0否 1是")
private String isAdmin;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createdAt;
@ApiModelProperty(value = "关键词 查询用")
private String keyword;
@TableField(exist = false)
@ApiModelProperty(value = "部门名称")
......
......@@ -18,10 +18,7 @@ public class PlatUserQueryDTO extends BaseOrgDTO {
private String account;
@ApiModelProperty(value = "姓名")
private String name;
// @ApiModelProperty(value = "姓名")
// private String username;
private String username;
@ApiModelProperty(value = "手机号")
private String mobile;
......@@ -63,9 +60,6 @@ public class PlatUserQueryDTO extends BaseOrgDTO {
private List<String> roleIdList;
@ApiModelProperty(value = "部门id集合")
private List<String> deptIdList;
@ApiModelProperty("分管部门树id")
private String chargeDeptId;
private List<String> orgIdList;
}
......@@ -21,12 +21,6 @@ public class PlatTenantVO extends BaseIdDTO implements Serializable {
@ApiModelProperty(value = "状态 0停用 1启用")
private String status;
// @ApiModelProperty(value = "开始时间")
// private LocalDateTime startTime;
//
// @ApiModelProperty(value = "结束时间")
// private LocalDateTime endTime;
@ApiModelProperty(value = "开始时间")
private LocalDate startTime;
......@@ -47,13 +41,13 @@ public class PlatTenantVO extends BaseIdDTO implements Serializable {
*/
@ApiModelProperty(value = "创建时间",required = false)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime createdAt;
private LocalDateTime createDate;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间",required = false)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatedAt;
private LocalDateTime updateDate;
}
......@@ -30,7 +30,7 @@ public class PlatUserLoginVO implements Serializable {
private String isTenant;
@ApiModelProperty(value = "部门树id")
private String deptId;
private String orgId;
@ApiModelProperty("token")
private String token;
......
......@@ -14,7 +14,7 @@ public class PlatUserVO implements Serializable {
private String isTenant;
private String deptId;
private String orgId;
public PlatUserVO() {
}
......
......@@ -30,7 +30,7 @@ public class WechatUserInfo implements Serializable {
private String tenantId;
private String isFactory;
private String deptId;
private String orgId;
private String account;
......
......@@ -58,10 +58,7 @@ public class PlatPersonDTOVO extends BaseIdDTO {
@NotBlank(message = "部门不能为空")
@ApiModelProperty(value = "部门树id")
private String deptId;
@ApiModelProperty(value = "分管部门id")
private String chargeDeptId;
private String orgId;
@NotBlank(message = "性别不能为空")
@Pattern(regexp = "1|2", message = "性别可选值为 1男 2女")
......@@ -100,7 +97,7 @@ public class PlatPersonDTOVO extends BaseIdDTO {
*/
@ApiModelProperty(value = "创建时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createdAt;
private LocalDateTime createDate;
/**
* 更新时间
......@@ -109,15 +106,9 @@ public class PlatPersonDTOVO extends BaseIdDTO {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatedAt;
@ApiModelProperty(value = "部门名称")
private String deptName;
@ApiModelProperty(value = "分管部门名称")
private String chargeDeptName;
@ApiModelProperty(value = "头像")
private String avatar;
......
......@@ -21,6 +21,6 @@ public class PlatRoleDeptDTOVO extends BaseTenantDTO {
// private String hotelId;
@ApiModelProperty(value = "部门树id集合")
private List<String> deptIdList;
private List<String> orgIdList;
}
......@@ -7,6 +7,6 @@ import lombok.experimental.FieldNameConstants;
@Data
public class PlatUserCountVO {
//private String id;
private String deptId;
private String orgId;
private Integer count;
}
......@@ -6,6 +6,7 @@ import com.makeit.common.entity.BaseBusEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -17,14 +18,14 @@ import java.util.List;
public class PlatOrg extends BaseBusEntity {
/**
* 租户id
* 父级id
*/
private String tenantId;
private String parentId;
/**
* 父级id
* 全路径id
*/
private String parentId;
private String path;
/**
* 组织名称
......@@ -53,7 +54,7 @@ public class PlatOrg extends BaseBusEntity {
@ApiModelProperty(value = "子集")
@TableField(exist = false)
private List<PlatOrg> children;
private List<PlatOrg> children = new ArrayList<>();
@TableField(exist = false)
private PlatOrg parent;
......
......@@ -18,16 +18,16 @@ import java.util.function.Function;
public class DeptUtil {
private static PlatUserService tntUserService;
private static PlatUserService platUserService;
private static PlatOrgService tntDeptService;
private static PlatOrgService platOrgService;
public static PlatOrg getById(String deptId) {
return tntDeptService.getById(deptId);
return platOrgService.getById(deptId);
}
public static List<PlatOrg> getHotelList() {
List<PlatOrg> deptList = tntDeptService.list(new QueryWrapper<PlatOrg>().lambda()
List<PlatOrg> deptList = platOrgService.list(new QueryWrapper<PlatOrg>().lambda()
//.eq(PlatOrg::getTag, DeptEnum.DeptTagEnum.HOTEL.getValue())
//.eq(TntDept::getStatus, CommonEnum.YES.getValue())
);
......@@ -147,7 +147,7 @@ public class DeptUtil {
//不涉及角色
public static List<String> findSelfAndAllChildrenIdList(String deptId) {
List<String> idList = StreamUtil.map(tntDeptService.findSelfAndAllChildren(deptId), PlatOrg::getId);
List<String> idList = StreamUtil.map(platOrgService.findSelfAndAllChildren(deptId), PlatOrg::getId);
idList.add(-1 + "");
return idList;
}
......@@ -178,7 +178,7 @@ public class DeptUtil {
// }
public static <T> void join(List<T> list, Function<T, String> getNid, BiConsumer<T, PlatOrg> consumer) {
JoinUtil.join(list, tntDeptService, null, getNid, PlatOrg::getId, consumer);
JoinUtil.join(list, platOrgService, null, getNid, PlatOrg::getId, consumer);
}
public static String getDeptName(List<String> applyDeptIds, Map<String, String> deptMap) {
......
......@@ -2,12 +2,15 @@ package com.makeit.service.platform.auth;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.vo.platform.auth.PlatOrgQueryDTO;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author lixl
......@@ -60,7 +63,7 @@ public interface PlatOrgService extends IService<PlatOrg> {
Comparator<PlatOrg> getComparator();
void add(PlatOrg dto);
String add(PlatOrg dto);
void edit(PlatOrg dto);
......@@ -80,4 +83,27 @@ public interface PlatOrgService extends IService<PlatOrg> {
List<PlatOrg> getSelfAndAllParent(String deptId);
List<PlatOrg> getDeptSelfAndChildren(String deptId);
/**
* 获取所属组织
* 当前账号所属角色的权限级别,可查看某一级或者某一级及其下级
* @return
*/
List<PlatOrg> belongToOrgTree();
/**
* 启用|禁用
* @param param
*/
void enable(PlatOrg param);
/**
* 获取用户权限范围
*/
Set<String> getOrgIdListByUserId(String userId);
PageVO<PlatOrg> page(PageReqDTO<PlatOrgQueryDTO> pageReqDTO);
List<PlatOrg> subOrgList(PlatOrgQueryDTO platOrgQueryDTO);
}
......@@ -4,6 +4,9 @@ package com.makeit.service.platform.auth;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.entity.platform.auth.PlatRoleOrg;
import java.util.Collection;
import java.util.List;
/**
* @author lixl
* @description 针对表【plat_role_org(租户端角色部门关联表)】的数据库操作Service
......@@ -11,4 +14,11 @@ import com.makeit.entity.platform.auth.PlatRoleOrg;
*/
public interface PlatRoleOrgService extends IService<PlatRoleOrg> {
/**
* 根据角色获取所属组织
* @param roleIds
* @return
*/
List<PlatRoleOrg> getByRoleIds(Collection<String> roleIds);
}
......@@ -2,6 +2,7 @@ package com.makeit.service.platform.auth;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.dto.StatusDTO;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
......@@ -25,7 +26,7 @@ public interface PlatRoleService extends IService<PlatRole> {
PageVO<PlatRoleDTOVO> page(PageReqDTO<PlatRoleDTOVO> page);
void add(PlatRoleDTOVO dto);
String add(PlatRoleDTOVO dto);
void edit(PlatRoleDTOVO dto);
......@@ -35,27 +36,14 @@ public interface PlatRoleService extends IService<PlatRole> {
void changeStatus(StatusDTO dto);
void assignUserList(List<PlatUserRoleDTO> userRoleDTOList);
void removeAssignUserList(List<PlatUserRoleDTO> userRoleDTOList);
// void exportTemplate(HttpServletResponse response);
//
// ExcelImportVo importExcel(String deptId, String hotelId, MultipartFile excelFile) throws Exception;
void assignMenuList(PlatRoleMenuDTO roleMenuDTO);
List<PlatRoleMenu> getAssignMenuList(String id);
// void assignWechatMenuList(PlatRoleMenuDTO roleMenuDTO);
// List<PlatRoleWechatMenu> getWechatMenuListByRoleId(String roleId);
void assignDeptList(PlatRoleDeptDTOVO tntRoleDeptDTO);
List<PlatRoleOrg> getDeptListByRoleId(String roleId);
......@@ -70,4 +58,11 @@ public interface PlatRoleService extends IService<PlatRole> {
* @return
*/
List<PlatRoleDTOVO> getList(PlatRoleDTOVO dto);
/**
* 当前用户的所属组织下的角色
* @param baseIdDTO
* @return
*/
List<PlatRole> belongTo(BaseIdDTO baseIdDTO);
}
......@@ -4,6 +4,8 @@ package com.makeit.service.platform.auth;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.entity.platform.auth.PlatUserRole;
import java.util.List;
/**
* @author lixl
* @description 针对表【plat_user_role(租户端用户角色关联表)】的数据库操作Service
......@@ -11,4 +13,10 @@ import com.makeit.entity.platform.auth.PlatUserRole;
*/
public interface PlatUserRoleService extends IService<PlatUserRole> {
/**
* 根据userId 获取
* @param userId
* @return
*/
List<PlatUserRole> getByUserId(String userId);
}
......@@ -80,7 +80,7 @@ public interface PlatUserService extends IService<PlatUser> {
List<PlatPersonDTOVO> auditUserList(PlatUserQueryDTO dto);
void addPerson(PlatPersonDTOVO dto);
String addPerson(PlatPersonDTOVO dto);
void editPerson(PlatPersonDTOVO dto);
......
package com.makeit.service.platform.auth.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.entity.platform.auth.PlatRoleOrg;
import com.makeit.mapper.platform.auth.PlatRoleOrgMapper;
import com.makeit.service.platform.auth.PlatRoleOrgService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* @author lixl
* @description 针对表【plat_role_org(租户端角色部门关联表)】的数据库操作Service实现
......@@ -15,4 +21,19 @@ import org.springframework.stereotype.Service;
public class PlatRoleOrgServiceImpl extends ServiceImpl<PlatRoleOrgMapper, PlatRoleOrg>
implements PlatRoleOrgService{
/**
* 根据角色获取所属组织
*
* @param roleIds
* @return
*/
@Override
public List<PlatRoleOrg> getByRoleIds(Collection<String> roleIds) {
if(CollectionUtils.isEmpty(roleIds)){
return new ArrayList<>();
}
LambdaQueryWrapper<PlatRoleOrg> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(PlatRoleOrg::getRoleId,roleIds);
return list(queryWrapper);
}
}
package com.makeit.service.platform.auth.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.entity.platform.auth.PlatUserRole;
import com.makeit.mapper.platform.auth.PlatUserRoleMapper;
import com.makeit.service.platform.auth.PlatRoleOrgService;
import com.makeit.service.platform.auth.PlatUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author lixl
* @description 针对表【plat_user_role(租户端用户角色关联表)】的数据库操作Service实现
......@@ -15,4 +20,21 @@ import org.springframework.stereotype.Service;
public class PlatUserRoleServiceImpl extends ServiceImpl<PlatUserRoleMapper, PlatUserRole>
implements PlatUserRoleService{
@Autowired
private PlatRoleOrgService platRoleOrgService;
/**
* 根据userId 获取
*
* @param userId
* @return
*/
@Override
public List<PlatUserRole> getByUserId(String userId) {
LambdaQueryWrapper<PlatUserRole> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatUserRole::getUserId,userId);
return list(queryWrapper);
}
}
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.entity.BaseEntity;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatUser;
import com.makeit.entity.saas.PlatTenant;
import com.makeit.entity.saas.PlatTenantMenu;
......@@ -22,6 +23,7 @@ import com.makeit.module.admin.dto.plat.PlatTenantMenuDTO;
import com.makeit.module.admin.dto.plat.PlatTenantStatusDTO;
import com.makeit.module.admin.vo.plat.PlatTenantVO;
import com.makeit.module.system.service.SysConfigService;
import com.makeit.service.platform.auth.PlatOrgService;
import com.makeit.service.platform.auth.PlatUserService;
import com.makeit.service.saas.PlatTenantMenuService;
import com.makeit.service.saas.PlatTenantService;
......@@ -70,6 +72,9 @@ implements PlatTenantService {
@Autowired
private PlatTenantMenuService platTenantMenuService;
@Autowired
private PlatOrgService platOrgService;
private LambdaQueryWrapper<PlatTenant> listLambdaQueryWrapper(PlatTenantVO dto, boolean userAccountLike) {
List<String> tenantUserIdList = new ArrayList<>(10);
......@@ -195,6 +200,10 @@ implements PlatTenantService {
//更新用户的tenantId
platUserService.updatePlatUserTenantId(tntTenant.getId(),dto.getPlatUserId());
//组织表增加一条数据
PlatOrg platOrg = convertToPlatOrg(tntTenant);
platOrgService.add(platOrg);
return tntTenant.getId();
}
......@@ -213,10 +222,23 @@ implements PlatTenantService {
}
platUserService.updatePlatUserTenantId(tntTenant.getId(),dto.getPlatUserId());
PlatOrg platOrg = convertToPlatOrg(platTenant);
//更新组织表
platOrgService.edit(platOrg);
saasOperationLogService.add("平台端-租户账号-编辑", dto.getId());
}
public PlatOrg convertToPlatOrg(PlatTenant platTenant){
PlatOrg platOrg = new PlatOrg();
platOrg.setTenantId(platTenant.getId());
platOrg.setName(platTenant.getName());
platOrg.setStatus(platTenant.getStatus());
platOrg.setId(platTenant.getId());
return platOrg;
}
@Override
public PlatTenantDTOVO view(String id) {
PlatTenantDTOVO userVO = BeanDtoVoUtils.convert(getById(id), PlatTenantDTOVO.class);
......
......@@ -15,7 +15,7 @@ public class PlatOrgQueryDTO extends BaseOrgDTO {
@ApiModelProperty(value = "状态 0禁用 1启用")
private String status;
@ApiModelProperty(value = "是否从酒店开始 0否 1是")
private String fromHotel;
@ApiModelProperty(value = "字典类型 1-居家 2-机构")
private String type;
}
......@@ -46,7 +46,7 @@ public class PlatPersonDTOVO extends BaseIdDTO {
private String status;
@ApiModelProperty(value = "部门树id")
private String deptId;
private String orgId;
@Size(max = 512, message = "备注最长512字符")
@ApiModelProperty(value = "备注")
......@@ -67,7 +67,7 @@ public class PlatPersonDTOVO extends BaseIdDTO {
private LocalDateTime updateDate;
@ApiModelProperty(value = "部门名称")
private String deptName;
private String orgName;
@ApiModelProperty(value = "头像")
......
......@@ -7,6 +7,6 @@ import lombok.experimental.FieldNameConstants;
@Data
public class PlatUserCountVO {
//private String id;
private String deptId;
private String orgId;
private Integer count;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment