Commit 27414e46 authored by huyuchen's avatar huyuchen

菜单权限修改

parent dfe09502
......@@ -219,8 +219,8 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
errorMessage.setData(data);
if (Common.isNotNull(errorMessage)) {
errorMessage.setData(data);
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
......@@ -264,7 +264,6 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
SysUserPermissionVo excel = excelVOList.get(i);
//登录名校验
userInfo = userInfoList.stream().filter(e -> excel.getEmpLoginName().equals(e.getFdLoginName())).collect(Collectors.toList());
if (userInfo.isEmpty()) {
......@@ -277,6 +276,8 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
excel.setEmpDept(sysUserInfo.getFdDeptName());
excel.setEmpName(sysUserInfo.getFdName());
excel.setUserId(sysUserInfo.getFdId());
SysUserPermission insert = new SysUserPermission();
BeanUtil.copyProperties(excel, insert);
//判断表格权限类型是否正确
if (typeMap.isEmpty()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "获取权限类型字典值异常", excel));
......@@ -287,14 +288,14 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "权限类型填写错误,请核实", excel));
continue;
} else {
excel.setPermissionType(typeMap.get(excel.getPermissionType()));
insert.setPermissionType(typeMap.get(excel.getPermissionType()));
}
//登录账号+维度+唯一标识唯一
StringBuilder flag = new StringBuilder();
flag.append(excel.getEmpLoginName());
flag.append("_");
flag.append(excel.getPermissionType());
flag.append(insert.getPermissionType());
flag.append("_");
flag.append(excel.getCode());
if (null != uniqueMap.get(flag.toString())) {
......@@ -306,11 +307,11 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
//BU和条线的时候用名称判断,其他用编码判断
//判断此登录名是否已经存在此权限维度
if (CommonConstants.SIX_STRING.equals(excel.getPermissionType())
|| CommonConstants.SEVEN_STRING.equals(excel.getPermissionType())) {
if (CommonConstants.SIX_STRING.equals(insert.getPermissionType())
|| CommonConstants.SEVEN_STRING.equals(insert.getPermissionType())) {
//判断对应维度的名称是否存在
Integer count;
if (CommonConstants.SIX_STRING.equals(excel.getPermissionType())) {
if (CommonConstants.SIX_STRING.equals(insert.getPermissionType())) {
count = baseMapper.selectDictByName(excel.getName(), "bu");
} else {
count = baseMapper.selectDictByName(excel.getName(), "line");
......@@ -321,7 +322,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
}
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getEmpLoginName, excel.getEmpLoginName())
.eq(SysUserPermission::getPermissionType, excel.getPermissionType())
.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));
......@@ -329,14 +330,14 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
}
} else {
//判断对应维度的编码是否存在
Integer count = this.checkExit(excel.getPermissionType(), excel.getCode());
Integer count = this.checkExit(insert.getPermissionType(), excel.getCode());
if (count < 1) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "不存在对应维度的编码信息", excel));
continue;
}
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getEmpLoginName, excel.getEmpLoginName())
.eq(SysUserPermission::getPermissionType, excel.getPermissionType())
.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));
......@@ -350,7 +351,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getPermissionStatus, CommonConstants.ZERO_STRING)
.eq(SysUserPermission::getEmpLoginName, user.getUsername())
.eq(SysUserPermission::getPermissionType, excel.getPermissionType())
.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));
......@@ -358,7 +359,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
}
}
// 插入数据
insertExcel(excel);
insertExcel(insert);
}
} catch (Exception e) {
log.error("用户权限表导入异常:" + e);
......@@ -368,9 +369,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
/**
* 插入excel bad record
*/
private void insertExcel(SysUserPermissionVo excel) {
SysUserPermission insert = new SysUserPermission();
BeanUtil.copyProperties(excel, insert);
private void insertExcel(SysUserPermission insert ) {
//转化是否含下级
if (Common.isNotNull(insert.getIsContains())) {
if (CommonConstants.IS_TRUE.equals(insert.getIsContains())) {
......
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