Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

tags/24080901
niohe·erbao 1 yıl önce
ebeveyn
işleme
e3131967f5
9 değiştirilmiş dosya ile 70 ekleme ve 23 silme
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  2. +14
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  3. +10
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuSaveDTO.java
  4. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Menu.java
  5. +29
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java
  6. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java
  7. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java
  8. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java
  9. +5
    -0
      pmapi/src/main/resources/application-dev.yml

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java Dosyayı Görüntüle

@@ -28,5 +28,5 @@ public interface UserInfoHelper {
* 判断该用户是否是区管或者超管
* @return
*/
boolean isAdmin(Long userId);
boolean isSuperOrRegionAdmin(Long userId);
}

+ 14
- 8
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java Dosyayı Görüntüle

@@ -1,6 +1,9 @@
package com.ningdatech.pmapi.common.helper.impl;

import cn.hutool.core.collection.CollUtil;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.manage.UserAuthLoginManage;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import lombok.RequiredArgsConstructor;
@@ -38,14 +41,17 @@ public class UserInfoHelperImpl implements UserInfoHelper {
return realName;
}

/**
* 判断此人是否是超管或者区管
* @param userId
* @return
*/
@Override
public boolean isAdmin(Long userId) {
//测试 先返回true
return Boolean.TRUE;
public boolean isSuperOrRegionAdmin(Long userId) {
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
if(CollUtil.isNotEmpty(userFullInfo.getUserRoleList())){
for(Role role : userFullInfo.getUserRoleList()){
if(RoleEnum.SUPER_ADMIN.equals(role.getCode()) ||
RoleEnum.REGION_ADMIN.equals(role.getCode()) ){
return Boolean.TRUE;
}
}
}
return Boolean.FALSE;
}
}

+ 10
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MenuSaveDTO.java Dosyayı Görüntüle

@@ -1,11 +1,14 @@
package com.ningdatech.pmapi.sys.model.dto;

import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
@@ -38,13 +41,14 @@ public class MenuSaveDTO implements Serializable {
* 标题
*/
@ApiModelProperty(value = "标题")
@NotEmpty(message = "请输入菜单标题")
@NotEmpty(message = "标题不能为空")
private String title;

/**
* 页面路径
*/
@ApiModelProperty(value = "页面路径")
@NotBlank(message = "页面路径不能为空")
private String path;

/**
@@ -88,4 +92,9 @@ public class MenuSaveDTO implements Serializable {
*/
@ApiModelProperty(value = "跳转")
private String redirect;

@ApiModelProperty("菜单类型")
@NotNull(message = "菜单类型不能为空")
private MenuTypeEnum menuType;

}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Menu.java Dosyayı Görüntüle

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity;
import com.ningdatech.pmapi.sys.model.enumeration.DataScopeEnum;
import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
@@ -67,6 +68,9 @@ public class Menu extends MenuTreeEntity<Menu, Long> {
@ApiModelProperty("数据权限选项")
private String dataScopeOption;

@ApiModelProperty("菜单类型")
private MenuTypeEnum menuType;

@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateBy;



+ 29
- 12
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/MenuServiceImpl.java Dosyayı Görüntüle

@@ -10,13 +10,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.ningdatech.basic.exception.BaseUncheckedException;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.ValidatorUtil;
import com.ningdatech.pmapi.common.constant.DefValConst;
import com.ningdatech.pmapi.sys.model.entity.Menu;
import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum;
import com.ningdatech.pmapi.sys.mapper.MenuMapper;
import com.ningdatech.pmapi.sys.model.dto.MenuSaveDTO;
import com.ningdatech.pmapi.sys.model.dto.MenuUpdateDTO;
import com.ningdatech.pmapi.sys.mapper.MenuMapper;
import com.ningdatech.pmapi.sys.model.entity.Menu;
import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum;
import com.ningdatech.pmapi.sys.service.IMenuService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -90,6 +91,8 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】:{}重复", data.getPath());
}
}
} else {
checkButtonUnique(data.getPid(), data.getPath(), data.getId());
}
Menu old = getById(data);
if (Objects.isNull(old)) {
@@ -113,16 +116,21 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(MenuSaveDTO data, Long userId) {
if (StrUtil.isBlank(data.getPath())) {
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空");
}
if (StrUtil.isBlank(data.getComponent())) {
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【页面路径】不能为空");
}
if (!ValidatorUtil.isUrl(data.getPath())) {
if (checkPath(null, data.getPath())) {
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】:{}重复", data.getPath());
data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID));
if (data.getMenuType().equals(MenuTypeEnum.MENU)) {
if (StrUtil.isBlank(data.getPath())) {
throw BizException.wrap("【地址栏路径】不能为空");
}
if (StrUtil.isBlank(data.getComponent())) {
throw BizException.wrap("【页面路径】不能为空");
}
if (!ValidatorUtil.isUrl(data.getPath())) {
if (checkPath(null, data.getPath())) {
throw BizException.wrap("【地址栏路径】:{}重复", data.getPath());
}
}
} else {
checkButtonUnique(data.getPid(), data.getPath(), null);
}
data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID));
Menu menu = BeanUtil.toBean(data, Menu.class);
@@ -132,6 +140,15 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
return Boolean.TRUE;
}

private void checkButtonUnique(Long pid, String path, Long menuId) {
LambdaQueryWrapper<Menu> query = Wrappers.lambdaQuery(Menu.class)
.eq(Menu::getPid, pid).eq(Menu::getPath, path)
.ne(menuId != null, Menu::getId, menuId);
if (count(query) > 1) {
throw BizException.wrap("【按钮路径】:{}重复", path);
}
}

public List<Menu> findChildrenByParentId(Long pid) {
if (Objects.isNull(pid)) {
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "pid 不能为空");


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java Dosyayı Görüntüle

@@ -331,6 +331,7 @@ public class UserInfoManage {
UserRoleVO userRoleVO = new UserRoleVO();
userRoleVO.setId(r.getId());
userRoleVO.setName(r.getName());
userRoleVO.setCode(r.getCode());
return userRoleVO;
}).collect(Collectors.toList());
}


+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/UserRoleVO.java Dosyayı Görüntüle

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.user.model.vo;

import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -18,4 +19,7 @@ public class UserRoleVO {

@ApiModelProperty(value = "名称")
private String name;

@ApiModelProperty(value = "角色code")
private String code;
}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java Dosyayı Görüntüle

@@ -17,6 +17,7 @@ import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq;
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO;
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO;
import com.ningdatech.pmapi.todocenter.model.vo.TodoVO;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter;
@@ -61,7 +62,7 @@ public class WorkbenchManage {

//2.项目统计数据
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year)));
if(userInfoHelper.isAdmin(userInfo.getUserId())){
if(userInfoHelper.isSuperOrRegionAdmin(userInfo.getUserId())){
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year)));
}
ProjectListReq projectListReq = new ProjectListReq();


+ 5
- 0
pmapi/src/main/resources/application-dev.yml Dosyayı Görüntüle

@@ -87,6 +87,11 @@ spring:
wall:
config:
multi-statement-allow: true
#设置上传 单个文件的大小
servlet:
multipart:
max-file-size: 100MB
max-request-size: 150MB
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl


Yükleniyor…
İptal
Kaydet