Commit 3a62958e by 李小龙

fixbug: 子女端租户|平台端小程序组织|cutLeaves

parent 272d8750
......@@ -83,4 +83,6 @@ public class PlatMenuDTOVO extends BaseIdDTO {
* 跳转参数
*/
private String pageQuery;
private boolean show = false;
}
......@@ -29,28 +29,28 @@ public class PlatOrgChildrenController {
@Autowired
private PlatOrgService platOrgService;
@Action(module = "平台端-组织", name = "分页列表", code = "plat:org:page")
@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")
@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:add")
@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")
@Action(module = "子女端小程序-组织", name = "编辑", code = "plat:org:edit")
@ApiOperation("编辑")
@PostMapping("edit")
public ApiResponseEntity<Void> edit(@Validated @RequestBody PlatOrg tntDept){
......
package com.makeit.module.controller.children.tenant;
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.saas.PlatTenant;
import com.makeit.module.admin.dto.plat.PlatTenantDTOVO;
import com.makeit.module.admin.vo.plat.PlatTenantVO;
import com.makeit.service.saas.PlatTenantService;
import com.makeit.service.saas.SaasOperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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("/children/tenant")
public class PlatTenantChildrenController {
@Autowired
private PlatTenantService platTenantService;
@Autowired
private SaasOperationLogService saasOperationLogService;
@ApiOperation("分页列表")
@PostMapping("page")
public ApiResponseEntity<PageVO<PlatTenantVO>> page(@RequestBody PageReqDTO<PlatTenantVO> page){
return ApiResponseUtils.success(platTenantService.page(page));
}
@ApiOperation("列表")
@PostMapping("list")
public ApiResponseEntity<List<PlatTenant>> list(@RequestBody PlatTenantVO dto){
return ApiResponseUtils.success(platTenantService.list(dto));
}
@ApiOperation("分页列表(AuthIgnore)")
@PostMapping("pageAuthIgnore")
public ApiResponseEntity<PageVO<PlatTenantVO>> pageAuthIgnore(@RequestBody PageReqDTO<PlatTenantVO> page){
return ApiResponseUtils.success(platTenantService.page(page));
}
@ApiOperation("列表(AuthIgnore)")
@PostMapping("listAuthIgnore")
public ApiResponseEntity<List<PlatTenant>> listAuthIgnore(@RequestBody PlatTenantVO dto){
return ApiResponseUtils.success(platTenantService.list(dto));
}
@ApiOperation("列表 根据账号精确查询")
@PostMapping("listByUserIdAndAccount")
public ApiResponseEntity<List<PlatTenant>> listByUserIdAndAccount(@RequestBody PlatTenantVO dto){
return ApiResponseUtils.success(platTenantService.listByUserIdAndAccount(dto));
}
@ApiOperation("详情")
@PostMapping("view")
public ApiResponseEntity<PlatTenantDTOVO> view(@RequestBody BaseIdDTO dto){
saasOperationLogService.add("saas端-租户管理-详情", dto.getId());
return ApiResponseUtils.success(platTenantService.view(dto.getId()));
}
@ApiOperation("详情(AuthIgnore)")
@PostMapping("viewIgnore")
public ApiResponseEntity<PlatTenantDTOVO> viewIgnore(@RequestBody BaseIdDTO dto){
return ApiResponseUtils.success(platTenantService.view(dto.getId()));
}
}
package com.makeit.module.controller.wechat.org;
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.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;
@Api(tags = "平台端小程序-组织")
@RestController
@RequestMapping("/wechat/plat/org")
public class PlatOrgWechatController {
@Autowired
private PlatOrgService platOrgService;
@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: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()));
}
@ApiOperation("当前账号的权限级别树")
@PostMapping("belongToScopeTree")
public ApiResponseEntity<List<PlatOrg>> belongToScopeTree(@RequestBody PlatOrg param){
return ApiResponseUtils.success(platOrgService.belongToOrgTree(param));
}
}
......@@ -244,7 +244,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_USER_PASSWORD_NOT_BLANK);
}
setPassword(user);
user.setAccount(dto.getMobile());
save(user);
dto.setId(user.getId());
return user.getId();
......@@ -785,8 +784,6 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
user.setStatus(CommonEnum.YES.getValue());
user.setAccount(dto.getMobile());
fillOrgPath(dto, user);
save(user);
......@@ -1012,6 +1009,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
public void updatePlatUserTenantId(String tenantId, String platUserId) {
LambdaUpdateWrapper<PlatUser> updateWrapper = Wrappers.lambdaUpdate(PlatUser.class)
.set(PlatUser::getTenantId, tenantId)
.set(PlatUser::getOrgId,tenantId)
.eq(BaseEntity::getId, platUserId);
this.update(updateWrapper);
}
......
......@@ -2,6 +2,7 @@ package com.makeit.service.saas.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.entity.saas.PlatMenu;
import com.makeit.entity.saas.PlatTenantMenu;
import com.makeit.enums.CodeMessageEnum;
......@@ -18,6 +19,7 @@ import com.makeit.service.saas.PlatTenantMenuService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.StreamUtil;
import io.swagger.annotations.Api;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -39,13 +41,13 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @author lixl
* @description 针对表【tnt_auth_menu(租户端资源管理)】的数据库操作Service实现
* @createDate 2023-08-29 14:29:10
*/
* @author lixl
* @description 针对表【tnt_auth_menu(租户端资源管理)】的数据库操作Service实现
* @createDate 2023-08-29 14:29:10
*/
@Service
public class PlatMenuServiceImpl extends ServiceImpl<PlatMenuMapper, PlatMenu>
implements PlatMenuService {
implements PlatMenuService {
@Autowired
private PlatTenantMenuService platTenantMenuService;
......@@ -96,23 +98,74 @@ implements PlatMenuService {
return topList;
}
private List<PlatMenuDTOVO> tree(List<PlatMenuDTOVO> orgList, Set<String> filterSet) {
if (CollectionUtils.isEmpty(orgList)) {
return new ArrayList<>();
}
Map<String, List<PlatMenuDTOVO>> parentMap = orgList.stream()
.collect(Collectors.groupingBy(PlatMenuDTOVO::getParentId));
orgList.forEach(vo -> {
vo.setChildren(parentMap.get(vo.getId()));
});
List<PlatMenuDTOVO> collect = orgList.stream().filter(vo ->
StringUtils.equals(vo.getParentId(), TreeConst.TOP_LEVEL)).collect(Collectors.toList());
for (PlatMenuDTOVO platMenuDTOVO : collect) {
cutLeaves(platMenuDTOVO, filterSet);
}
return collect.stream().filter(vo -> vo.isShow()).collect(Collectors.toList());
}
/**
* 去掉filterSet后的子节点
* @param parent
* @param filterSet
* @return
*/
public boolean cutLeaves(PlatMenuDTOVO parent, Set<String> filterSet) {
List<PlatMenuDTOVO> children = parent.getChildren();
boolean childShow = false;
if (CollectionUtils.isNotEmpty(children)) {
for (PlatMenuDTOVO platMenuDTOVO : children) {
boolean test = cutLeaves(platMenuDTOVO, filterSet);
if (!test) {
platMenuDTOVO.setChildren(null);
} else {
platMenuDTOVO.setShow(true);
childShow = true;
}
if (filterSet.contains(platMenuDTOVO.getId())) {
platMenuDTOVO.setShow(true);
childShow = true;
}
}
children.removeIf(vo->!vo.isShow());
}
if(!childShow){
parent.setChildren(null);
}
if (filterSet.contains(parent.getId())) {
childShow = true;
}
parent.setShow(childShow);
return parent.isShow();
}
@Override
public List<PlatMenuDTOVO> tree(PlatMenuQueryDTO dto) {
List<PlatMenuDTOVO> tntMenuList = list(dto);
return tree(tntMenuList);
dto.setName(null);
dto.setStatus(null);
List<PlatMenuDTOVO> tntMenuListAll = list(dto);
Set<String> menuIdSet = tntMenuList.stream().map(BaseIdDTO::getId).collect(Collectors.toSet());
return tree(tntMenuListAll, menuIdSet);
}
// private void checkName(TntMenuDTOVO dto) {
// TntMenu old = getOne(new QueryWrapper<TntMenu>().lambda()
// .in(TntMenu::getCategory, SysEnum.MenuTypeEnum.CATALOGUE.getValue(), SysEnum.MenuTypeEnum.MENU.getValue())
// .eq(TntMenu::getName, dto.getName()));
// if (old != null && !old.getId().equals(dto.getId())) {
// throw new BusinessException(CodeMessageEnum.SYSTEM_ERROR_NAME_DUPLICATE);
// }
// }
/**
* 校验资源名称是否重复
*
* @param dto
*/
private void checkCode(PlatMenuDTOVO dto) {
......
......@@ -8,7 +8,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
......@@ -34,7 +33,7 @@ public class PlatAlarmRecordVO extends BaseTenantDTO {
private String alarmType;
@ApiModelProperty(value = "告警时间")
private Date alarmDate;
private LocalDateTime alarmDate;
@ApiModelProperty(value = "状态 0 待处理 1 已处理")
private String status;
......@@ -49,7 +48,7 @@ public class PlatAlarmRecordVO extends BaseTenantDTO {
private String dealUser;
@ApiModelProperty(value = "处理时间")
private Date dealDate;
private LocalDateTime dealDate;
@ApiModelProperty(value = "所属组织id")
private String orgId;
......
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