Commit ef15bd95 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.5.8' into MVP1.5.8

parents 7881eb54 986c39ed
......@@ -140,4 +140,9 @@ public class SysMenu extends BaseEntity {
@TableField(exist = false)
private List<String> columnIdList;
/**
* 是否开关(0开、1关)
*/
@Schema(description = "是否开关(0开、1关)")
private String isOpen;
}
......@@ -88,4 +88,9 @@ public class SysUserPermission extends BaseEntity {
@Schema(description = "删除状态(0是、1否)")
private String deleteFlag;
/**
* 项目id
*/
@Schema(description = "项目id")
private String domainId;
}
......@@ -53,4 +53,10 @@ public class SysUserDeptVo implements Serializable {
@Schema(description = "登录名")
private String loginName;
/**
* 项目id
*/
@Schema(description = "项目id")
private String domainId;
}
\ No newline at end of file
......@@ -31,8 +31,8 @@ public class SysUserPermissionVo extends RowIndex implements Serializable {
* 登录账号
*/
@NotBlank(message = "登录账号 不能为空")
@Length(max = 10, message = "登录账号 不能超过10 个字符")
@ExcelAttribute(name = "登录账号", isNotEmpty = true, errorInfo = "登录账号 不能为空", maxLength = 10)
@Length(max = 20, message = "登录账号 不能超过20 个字符")
@ExcelAttribute(name = "登录账号", isNotEmpty = true, errorInfo = "登录账号 不能为空", maxLength = 20)
@Schema(description = "登录账号")
@ExcelProperty("登录账号")
private String empLoginName;
......@@ -55,16 +55,17 @@ public class SysUserPermissionVo extends RowIndex implements Serializable {
/**
* 权限类型
*/
@NotBlank(message = "权限类型 不能为空")
@Length(max = 8, message = "权限类型 不能超过8 个字符")
@ExcelAttribute(name = "权限类型", maxLength = 8)
@ExcelAttribute(name = "权限类型", isNotEmpty = true, errorInfo = "权限类型 不能为空", maxLength = 8)
@Schema(description = "权限类型")
@ExcelProperty("权限类型")
private String permissionType;
/**
* 名称
*/
@Length(max = 20, message = "名称 不能超过20 个字符")
@ExcelAttribute(name = "名称", maxLength = 20)
@Length(max = 200, message = "名称 不能超过200 个字符")
@ExcelAttribute(name = "名称", maxLength = 200)
@Schema(description = "名称")
@ExcelProperty("名称")
private String name;
......
......@@ -32,6 +32,16 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
*/
long selectMenuId(@Param("modelId") String modelId);
/**
* 判断是否存在此菜单视图
*
* @param modelId 表单id
* @Author: huyc
* @Date: 2023/8/30 14:20
* @return
*/
long selectViewId(@Param("viewId") String viewId,@Param("modelId") String modelId);
/**
* 判断是否存在此字段
*
......
......@@ -77,6 +77,14 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
*/
IPage<SysUserDeptVo> selectSettleVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名项目编码查询id
* 项目权限
* @param code 编码
* @return
*/
String selectSettleByCode(@Param("code") String code);
/**
* 根据名称或者编码查询数据
* 商机权限
......
......@@ -55,13 +55,23 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if (menuIdCount < 1) {
return R.failed("表单ID填写错误,请确认");
}
//唯一性校验--表单ID唯一
//判断view id是否填写正确并且要属于modeleID
long viewIdCount = baseMapper.selectViewId(menu.getViewId(),menu.getModelId());
if (viewIdCount < 1) {
return R.failed("视图ID不存在或者不属于填写的表单id,请确认");
}
//唯一性校验--视图ID唯一
long modelCount = baseMapper.selectCount(Wrappers.<SysMenu>query().lambda()
.eq(SysMenu::getModelId, menu.getModelId())
.eq(SysMenu::getViewId, menu.getViewId())
.eq(SysMenu::getDeleteStatus, CommonConstants.ONE_STRING));
if (modelCount > 0) {
return R.failed("已存在对应菜单的权限维度");
}
//是否开关为是的话,modelId只能有一个
boolean errorFlag = isOpenCheck(menu);
if (errorFlag) {
return R.failed("只能存在一个开关状态为开的表单ID");
}
//判断菜单是否为一级菜单
if (Common.isNotNull(menu.getMenuName()) && Common.isEmpty(menu.getMenuNameParent())) {
//一级菜单的上级菜单id为0
......@@ -86,6 +96,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
public R<Boolean> updateMenu(SysMenu menu) {
//是否开关为是的话,modelId只能有一个
boolean errorFlag = isOpenCheck(menu);
if (errorFlag) {
return R.failed("只能存在一个开关状态为开的表单ID");
}
//错误信息
StringBuilder errorStr = new StringBuilder();
//权限维度
......@@ -118,4 +133,25 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
}
public boolean isOpenCheck(SysMenu menu) {
if (Common.isNotNull(menu.getIsOpen()) && CommonConstants.ZERO_STRING.equals(menu.getIsOpen())) {
if (Common.isNotNull(menu.getId())) {
long modelCount = baseMapper.selectCount(Wrappers.<SysMenu>query().lambda()
.eq(SysMenu::getModelId, menu.getModelId())
.eq(SysMenu::getDeleteStatus, CommonConstants.ONE_STRING)
.eq(SysMenu::getIsOpen, CommonConstants.ZERO_STRING)
.ne(SysMenu::getId, menu.getId()));
return modelCount > 0;
}else {
long modelCount = baseMapper.selectCount(Wrappers.<SysMenu>query().lambda()
.eq(SysMenu::getModelId, menu.getModelId())
.eq(SysMenu::getDeleteStatus, CommonConstants.ONE_STRING)
.eq(SysMenu::getIsOpen, CommonConstants.ZERO_STRING));
return modelCount > 0;
}
} else {
return false;
}
}
}
......@@ -83,7 +83,8 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo
vo.setResList(resList);
}
List<TreeNode<String>> collect = sysMenuMapper
.selectList(Wrappers.<SysMenu>lambdaQuery()
.selectList(Wrappers.<SysMenu>lambdaQuery().eq(SysMenu::getDeleteStatus,CommonConstants.ONE_STRING)
.eq(SysMenu::getPermissionStatus,CommonConstants.ZERO_STRING)
.orderByAsc(SysMenu::getCreateTime)).stream()
.map(getNodeFunction()).collect(Collectors.toList());
List<Tree<String>> tree = TreeUtil.build(collect, CommonConstants.ZERO_STRING);
......
......@@ -67,7 +67,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
.eq(SysUserPermission::getEmpLoginName, user.getUsername())
.eq(SysUserPermission::getCode,sysUserPermission.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(permission)) {
return R.failed("只有自己有权限的维度才可新增");
return R.failed("操作人仅可对本账号有权限的数据新增账号");
}
}
if (CommonConstants.SIX_STRING.equals(sysUserPermission.getPermissionType())
......@@ -77,7 +77,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
.eq(SysUserPermission::getPermissionType, sysUserPermission.getPermissionType())
.eq(SysUserPermission::getName,sysUserPermission.getName()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
return R.failed("系统中已经存在对应的名称权限维度");
return R.failed("系统中已经存在对应名称的权限类型");
}
} else {
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
......@@ -85,7 +85,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
.eq(SysUserPermission::getPermissionType, sysUserPermission.getPermissionType())
.eq(SysUserPermission::getCode,sysUserPermission.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
return R.failed("系统中已经存在对应的编码的权限维度");
return R.failed("系统中已经存在对应编码的权限类型");
}
}
this.save(sysUserPermission);
......@@ -158,7 +158,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
if (CommonConstants.ONE_STRING.equals(user.getId())) {
iPage = baseMapper.selectContractVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, searchVo.getName(),searchVo.getName(),searchVo.getType());
iPage = baseMapper.selectContractSimpleVO(page, user.getUsername(),searchVo.getName(),searchVo.getType());
}
} else if (CommonConstants.EIGHT_STRING.equals(searchVo.getType()) || CommonConstants.NINE_STRING.equals(searchVo.getType())) {
//部门&&收入归属权限
......@@ -168,7 +168,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
if (CommonConstants.ONE_STRING.equals(user.getId())) {
iPage = baseMapper.selectSettleVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, searchVo.getName(),searchVo.getName(),searchVo.getType());
iPage = baseMapper.selectContractSimpleVO(page, user.getUsername(),searchVo.getName(),searchVo.getType());
}
}
return iPage;
......@@ -259,6 +259,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
YifuUser user = SecurityUtils.getUser();
SysUserPermission permission;
List<SysUserInfo> userInfo;
String domainId;
try {
// 执行数据插入操作 组装
......@@ -291,15 +292,26 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
insert.setPermissionType(typeMap.get(excel.getPermissionType()));
}
//部门权限的时候是否含下级必填
if (CommonConstants.EIGHT_STRING.equals(insert.getPermissionType()) && Common.isEmpty(excel.getIsContains())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "权限类型为部门权限时,是否含下级部门必填", excel));
continue;
}
//登录账号+维度+唯一标识唯一
StringBuilder flag = new StringBuilder();
flag.append(excel.getEmpLoginName());
flag.append("_");
flag.append(insert.getPermissionType());
flag.append("_");
flag.append(excel.getCode());
if (CommonConstants.SIX_STRING.equals(insert.getPermissionType()) ||
CommonConstants.SEVEN_STRING.equals(insert.getPermissionType())) {
flag.append(excel.getName());
} else {
flag.append(excel.getCode());
}
if (null != uniqueMap.get(flag.toString())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "导表中已经存在该登录名对应的权限维度的名称或者编码!", excel));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "导表中已经存在该登录名对应的权限类型的名称或者编码!", excel));
continue;
} else {
uniqueMap.put(flag.toString(), CommonConstants.ONE_STRING);
......@@ -317,7 +329,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
count = baseMapper.selectDictByName(excel.getName(), "line");
}
if (count < 1) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "不存在对应维度的名称信息", excel));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "不存在对应权限类型的名称信息", excel));
continue;
}
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
......@@ -325,14 +337,15 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
.eq(SysUserPermission::getPermissionType, insert.getPermissionType())
.eq(SysUserPermission::getName, excel.getName()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "系统中已经存在该用户对应的名称权限维度", excel));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "系统中已经存在该用户对应的名称的权限类型", excel));
continue;
}
insert.setCode(null);
} else {
//判断对应维度的编码是否存在
Integer count = this.checkExit(insert.getPermissionType(), excel.getCode());
if (count < 1) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "不存在对应维度的编码信息", excel));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "不存在对应权限类型的编码信息", excel));
continue;
}
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
......@@ -340,7 +353,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
.eq(SysUserPermission::getPermissionType, insert.getPermissionType())
.eq(SysUserPermission::getCode, excel.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(permission)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "系统中已经存在该用户对应的编码的权限维度", excel));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "系统中已经存在该用户对应的编码的权限类型", excel));
continue;
}
}
......@@ -354,10 +367,18 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
.eq(SysUserPermission::getPermissionType, insert.getPermissionType())
.eq(SysUserPermission::getCode, excel.getCode()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(permission)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "只有自己有权限的维度才可导入", excel));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "操作人仅可对本账号有权限的数据新增账号", excel));
continue;
}
}
//项目权限的时候赋值项目id
if (CommonConstants.FIVE_STRING.equals(insert.getPermissionType())) {
domainId = baseMapper.selectSettleByCode(insert.getCode());
insert.setDomainId(domainId);
}
if (!CommonConstants.EIGHT_STRING.equals(insert.getPermissionType())) {
insert.setIsContains(null);
}
// 插入数据
insertExcel(insert);
}
......@@ -369,7 +390,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
/**
* 插入excel bad record
*/
private void insertExcel(SysUserPermission insert ) {
private void insertExcel(SysUserPermission insert) {
//转化是否含下级
if (Common.isNotNull(insert.getIsContains())) {
if (CommonConstants.IS_TRUE.equals(insert.getIsContains())) {
......
......@@ -31,6 +31,12 @@ mybatis-plus:
spring:
application:
name: @artifactId@
servlet:
multipart:
#所有上传文件最大大小
max-request-size: 100MB
#单个文件最大大小
max-file-size: 50MB
#swagger 文档 https://springdoc.org/
### OpenAPI3 注解
# OpenAPI 3 注解位置
......
......@@ -27,6 +27,7 @@
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="isOpen" column="IS_OPEN"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -46,6 +47,8 @@
a.BU_ID,
a.LINE_ID,
a.DEPT_ID,
a.IS_OPEN,
a.VIEW_ID,
a.CREATE_TIME
</sql>
<sql id="sysMenu_where">
......@@ -83,6 +86,13 @@
WHERE a.fd_id = #{modelId}
</select>
<select id="selectViewId" resultType="java.lang.Long">
SELECT
count(1)
FROM modeling_app_collection_view a
WHERE a.fd_model_id = #{modelId} and a.fd_id = #{viewId}
</select>
<select id="selectColumnList" resultType="java.lang.String">
SELECT
a.fd_column
......
......@@ -35,6 +35,7 @@
<resultMap id="nameAndCodeMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo">
<result property="name" column="name"/>
<result property="code" column="code"/>
<result property="domainId" column="domainId"/>
</resultMap>
<resultMap id="dictMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo">
......@@ -156,7 +157,7 @@
<select id="selectSettleVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name,a.fd_id domainId
from ekp_24a8e6a7fc143bb8c48a a
where 1=1
<if test="name != null and name.trim() != ''">
......@@ -164,12 +165,19 @@
</if>
</select>
<!--根据项目编码查询id-->
<select id="selectSettleByCode" resultType="java.lang.String">
SELECT
a.fd_id
from ekp_24a8e6a7fc143bb8c48a a where a.fd_3a37fe508071fe = #{code} limit 1
</select>
<select id="selectContractSimpleVO" resultMap="nameAndCodeMap">
SELECT
a.NAME,
a.CODE
from sys_user_permission a
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type}
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type} and a.PERMISSION_STATUS = '0'
<if test="name != null and name.trim() != ''">
AND (a.NAME like concat('%',#{name},'%') or a.CODE like concat('%',#{name},'%'))
</if>
......@@ -187,11 +195,11 @@
<select id="selectQuotationVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b04b9dc64a9f4 code,a.fd_3b04b9daa0c25e name
a.fd_3b04b9dc64a9f4 code,a.fd_3b04b9d8688cfa name
from ekp_fd1449d265845e087bf2 a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b04b9dc64a9f4 like concat('%',#{name},'%') or a.fd_3b04b9daa0c25e like concat('%',#{name},'%'))
AND (a.fd_3b04b9dc64a9f4 like concat('%',#{name},'%') or a.fd_3b04b9d8688cfa like concat('%',#{name},'%'))
</if>
</select>
......
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 to comment