@@ -28,5 +28,5 @@ public interface UserInfoHelper { | |||||
* 判断该用户是否是区管或者超管 | * 判断该用户是否是区管或者超管 | ||||
* @return | * @return | ||||
*/ | */ | ||||
boolean isAdmin(Long userId); | |||||
boolean isSuperOrRegionAdmin(Long userId); | |||||
} | } |
@@ -1,6 +1,9 @@ | |||||
package com.ningdatech.pmapi.common.helper.impl; | package com.ningdatech.pmapi.common.helper.impl; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | 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.manage.UserAuthLoginManage; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -38,14 +41,17 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||||
return realName; | return realName; | ||||
} | } | ||||
/** | |||||
* 判断此人是否是超管或者区管 | |||||
* @param userId | |||||
* @return | |||||
*/ | |||||
@Override | @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; | |||||
} | } | ||||
} | } |
@@ -1,11 +1,14 @@ | |||||
package com.ningdatech.pmapi.sys.model.dto; | package com.ningdatech.pmapi.sys.model.dto; | ||||
import com.ningdatech.pmapi.sys.model.enumeration.MenuTypeEnum; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.*; | import lombok.*; | ||||
import lombok.experimental.Accessors; | import lombok.experimental.Accessors; | ||||
import javax.validation.constraints.NotBlank; | |||||
import javax.validation.constraints.NotEmpty; | import javax.validation.constraints.NotEmpty; | ||||
import javax.validation.constraints.NotNull; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
/** | /** | ||||
@@ -38,13 +41,14 @@ public class MenuSaveDTO implements Serializable { | |||||
* 标题 | * 标题 | ||||
*/ | */ | ||||
@ApiModelProperty(value = "标题") | @ApiModelProperty(value = "标题") | ||||
@NotEmpty(message = "请输入菜单标题") | |||||
@NotEmpty(message = "标题不能为空") | |||||
private String title; | private String title; | ||||
/** | /** | ||||
* 页面路径 | * 页面路径 | ||||
*/ | */ | ||||
@ApiModelProperty(value = "页面路径") | @ApiModelProperty(value = "页面路径") | ||||
@NotBlank(message = "页面路径不能为空") | |||||
private String path; | private String path; | ||||
/** | /** | ||||
@@ -88,4 +92,9 @@ public class MenuSaveDTO implements Serializable { | |||||
*/ | */ | ||||
@ApiModelProperty(value = "跳转") | @ApiModelProperty(value = "跳转") | ||||
private String redirect; | private String redirect; | ||||
@ApiModelProperty("菜单类型") | |||||
@NotNull(message = "菜单类型不能为空") | |||||
private MenuTypeEnum menuType; | |||||
} | } |
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; | import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity; | ||||
import com.ningdatech.pmapi.sys.model.enumeration.DataScopeEnum; | 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.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.*; | import lombok.*; | ||||
@@ -67,6 +68,9 @@ public class Menu extends MenuTreeEntity<Menu, Long> { | |||||
@ApiModelProperty("数据权限选项") | @ApiModelProperty("数据权限选项") | ||||
private String dataScopeOption; | private String dataScopeOption; | ||||
@ApiModelProperty("菜单类型") | |||||
private MenuTypeEnum menuType; | |||||
@TableField(fill = FieldFill.INSERT_UPDATE) | @TableField(fill = FieldFill.INSERT_UPDATE) | ||||
private Long updateBy; | private Long updateBy; | ||||
@@ -10,13 +10,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.exception.BaseUncheckedException; | import com.ningdatech.basic.exception.BaseUncheckedException; | ||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.util.ValidatorUtil; | import com.ningdatech.basic.util.ValidatorUtil; | ||||
import com.ningdatech.pmapi.common.constant.DefValConst; | 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.MenuSaveDTO; | ||||
import com.ningdatech.pmapi.sys.model.dto.MenuUpdateDTO; | 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 com.ningdatech.pmapi.sys.service.IMenuService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | 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()); | throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】:{}重复", data.getPath()); | ||||
} | } | ||||
} | } | ||||
} else { | |||||
checkButtonUnique(data.getPid(), data.getPath(), data.getId()); | |||||
} | } | ||||
Menu old = getById(data); | Menu old = getById(data); | ||||
if (Objects.isNull(old)) { | if (Objects.isNull(old)) { | ||||
@@ -113,16 +116,21 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM | |||||
@Override | @Override | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public boolean save(MenuSaveDTO data, Long userId) { | 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)); | data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID)); | ||||
Menu menu = BeanUtil.toBean(data, Menu.class); | Menu menu = BeanUtil.toBean(data, Menu.class); | ||||
@@ -132,6 +140,15 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM | |||||
return Boolean.TRUE; | 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) { | public List<Menu> findChildrenByParentId(Long pid) { | ||||
if (Objects.isNull(pid)) { | if (Objects.isNull(pid)) { | ||||
throw new BaseUncheckedException(HttpStatus.HTTP_OK, "pid 不能为空"); | throw new BaseUncheckedException(HttpStatus.HTTP_OK, "pid 不能为空"); | ||||
@@ -331,6 +331,7 @@ public class UserInfoManage { | |||||
UserRoleVO userRoleVO = new UserRoleVO(); | UserRoleVO userRoleVO = new UserRoleVO(); | ||||
userRoleVO.setId(r.getId()); | userRoleVO.setId(r.getId()); | ||||
userRoleVO.setName(r.getName()); | userRoleVO.setName(r.getName()); | ||||
userRoleVO.setCode(r.getCode()); | |||||
return userRoleVO; | return userRoleVO; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
} | } | ||||
@@ -1,5 +1,6 @@ | |||||
package com.ningdatech.pmapi.user.model.vo; | package com.ningdatech.pmapi.user.model.vo; | ||||
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -18,4 +19,7 @@ public class UserRoleVO { | |||||
@ApiModelProperty(value = "名称") | @ApiModelProperty(value = "名称") | ||||
private String name; | private String name; | ||||
@ApiModelProperty(value = "角色code") | |||||
private String code; | |||||
} | } |
@@ -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.ResToBeProcessedVO; | ||||
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; | import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; | ||||
import com.ningdatech.pmapi.todocenter.model.vo.TodoVO; | 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.security.auth.model.UserInfoDetails; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; | import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; | ||||
@@ -61,7 +62,7 @@ public class WorkbenchManage { | |||||
//2.项目统计数据 | //2.项目统计数据 | ||||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year))); | res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year))); | ||||
if(userInfoHelper.isAdmin(userInfo.getUserId())){ | |||||
if(userInfoHelper.isSuperOrRegionAdmin(userInfo.getUserId())){ | |||||
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year))); | res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year))); | ||||
} | } | ||||
ProjectListReq projectListReq = new ProjectListReq(); | ProjectListReq projectListReq = new ProjectListReq(); | ||||
@@ -87,6 +87,11 @@ spring: | |||||
wall: | wall: | ||||
config: | config: | ||||
multi-statement-allow: true | multi-statement-allow: true | ||||
#设置上传 单个文件的大小 | |||||
servlet: | |||||
multipart: | |||||
max-file-size: 100MB | |||||
max-request-size: 150MB | |||||
mybatis-plus: | mybatis-plus: | ||||
configuration: | configuration: | ||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | ||||