优化
This commit is contained in:
parent
12c748828f
commit
f2ec79bd7a
@ -172,8 +172,26 @@ public class GovSystemRoleController {
|
||||
@PostMapping(value = "/editMenu")
|
||||
public Result<SystemRole> menu(@RequestBody List<SystemRoleMenu> systemRoleMenus) {
|
||||
Result<SystemRole> result = new Result<SystemRole>();
|
||||
if (systemRoleMenus.size() == 0) {
|
||||
result.error("请选择菜单权限");
|
||||
return result;
|
||||
}
|
||||
SystemRole systemRole = systemRoleService.getById(systemRoleMenus.get(0).getRoleId());
|
||||
systemRoleMenuService.remove(Wrappers.<SystemRoleMenu>lambdaQuery()
|
||||
.eq(SystemRoleMenu::getRoleId, systemRoleMenus.get(0).getRoleId()));
|
||||
Long moduleId;
|
||||
if (systemRole.getRoleType() == 2) {
|
||||
moduleId = 1670639811581595650L;
|
||||
} else if (systemRole.getRoleType() == 3) {
|
||||
moduleId = 1681837103227502594L;
|
||||
} else {
|
||||
moduleId = 1670603312504918018L;
|
||||
}
|
||||
SystemRoleMenu systemRoleMenu = new SystemRoleMenu();
|
||||
systemRoleMenu.setRoleId(systemRoleMenus.get(0).getRoleId());
|
||||
systemRoleMenu.setType(0);
|
||||
systemRoleMenu.setAuthorityId(moduleId);
|
||||
systemRoleMenus.add(systemRoleMenu);
|
||||
systemRoleMenuService.saveBatch(systemRoleMenus);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -192,6 +192,7 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
|
||||
@Override
|
||||
public List<MenuTreeDto> getMenusForHz(Map<String, Object> map) {
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
String roleId = MapUtils.getString(map, "roleId");
|
||||
SystemRole systemRole = systemRoleService.getById(roleId);
|
||||
Integer accountType = systemRole.getRoleType();
|
||||
@ -218,13 +219,14 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
} else {
|
||||
moduleId = 1670603312504918018L;
|
||||
}
|
||||
List<BaseModule> baseModules = baseModuleService.list(Wrappers.<BaseModule>lambdaQuery().eq(BaseModule::getModuleId, moduleId));
|
||||
List<MenuTreeDto> menuList = TreeUtil.formatModule(baseModules);
|
||||
// List<BaseModule> baseModules = baseModuleService.list(Wrappers.<BaseModule>lambdaQuery().eq(BaseModule::getModuleId, moduleId));
|
||||
// List<MenuTreeDto> menuList = TreeUtil.formatModule(baseModules);
|
||||
List<MenuTreeDto> menuList = new ArrayList<>();
|
||||
Set<BaseMenu> baseMenus = new HashSet<>();
|
||||
List<BaseMenu> baseMenuList = new ArrayList<>();
|
||||
if (accountType != 3) {
|
||||
if (accountType != 3 || (user.getAccountType() == 2 && systemRole.getSysDefault() == 1)) {
|
||||
// 查询相对应的菜单
|
||||
List<BaseMenu> res = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getModuleId, moduleId)
|
||||
List<BaseMenu> res = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().eq(BaseMenu::getModuleId, moduleId)
|
||||
.eq(BaseMenu::getStatus, 1).orderByAsc(BaseMenu::getPriority));
|
||||
baseMenus.addAll(res);
|
||||
} else {
|
||||
@ -251,7 +253,7 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
List<BaseAction> baseAction = baseActionMapper.selectList(Wrappers.<BaseAction>lambdaQuery().in(BaseAction::getMenuId,
|
||||
baseMenus.stream().map(m -> m.getMenuId()).collect(Collectors.toList())).eq(BaseAction::getStatus, 1));
|
||||
menuList.addAll(TreeUtil.formatAction(baseAction));
|
||||
return TreeUtil.build(menuList, 0, moduleId, 1);
|
||||
return TreeUtil.build(menuList, 1, moduleId, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -7,12 +7,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.util.PageUtil;
|
||||
import com.zhgd.mybatis.Aes;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.EnterpriseMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.EnterpriseVo;
|
||||
import com.zhgd.xmgl.modules.basicdata.vo.SystemUserVo;
|
||||
import com.zhgd.xmgl.security.SecurityUtil;
|
||||
import com.zhgd.xmgl.util.CommonUtil;
|
||||
import com.zhgd.xmgl.util.ParamEnum;
|
||||
@ -98,9 +98,8 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
|
||||
enterpriseVo.setCreateTime(new Date());
|
||||
boolean flag = this.save(enterpriseVo);
|
||||
if (flag) {
|
||||
SystemUser systemUser = new SystemUser();
|
||||
SystemUserVo systemUser = new SystemUserVo();
|
||||
systemUser.setAccount(enterpriseVo.getAccount());
|
||||
systemUser.setPassword(Aes.encrypt(enterpriseVo.getPassword()));
|
||||
systemUser.setShowPassword(enterpriseVo.getPassword());
|
||||
systemUser.setRealName(enterpriseVo.getRealName());
|
||||
systemUser.setIsManager(true);
|
||||
@ -109,16 +108,17 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterpr
|
||||
systemUser.setSn(enterpriseVo.getEnterpriseSn());
|
||||
systemUser.setAccountType(3);
|
||||
systemUser.setEmail(enterpriseVo.getEmail());
|
||||
systemUser.setCreateTime(new Date());
|
||||
systemUserService.save(systemUser);
|
||||
for (ParamEnum.EngineeringMain type : ParamEnum.EngineeringMain.values()) {
|
||||
if (type.getValue().equals(enterpriseVo.getEnterpriseMains().get(0).getMainType())) {
|
||||
SystemRole role = systemRoleService.getOne(Wrappers.<SystemRole>lambdaQuery().eq(SystemRole::getRoleCode, type.name()));
|
||||
SystemRole role = systemRoleService.getOne(Wrappers.<SystemRole>lambdaQuery().eq(SystemRole::getRoleCode, type.name())
|
||||
.eq(SystemRole::getSysDefault, 1));
|
||||
if (role != null) {
|
||||
SystemUserRole systemUserRole = new SystemUserRole();
|
||||
systemUserRole.setUserId(systemUser.getUserId());
|
||||
systemUserRole.setRoleId(role.getRoleId());
|
||||
systemUserRoleService.save(systemUserRole);
|
||||
systemUser.setRoleId(role.getRoleId());
|
||||
systemUserService.saveInfo(systemUser);
|
||||
// SystemUserRole systemUserRole = new SystemUserRole();
|
||||
// systemUserRole.setUserId(userId);
|
||||
// systemUserRole.setRoleId(role.getRoleId());
|
||||
// systemUserRoleService.save(systemUserRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,9 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleMapper, SystemR
|
||||
queryWrapper.eq("create_by", user.getUserId());
|
||||
}
|
||||
}
|
||||
queryWrapper.lambda().eq(SystemRole::getSysDefault, 0);
|
||||
if (user.getAccountType() != 2) {
|
||||
queryWrapper.lambda().eq(SystemRole::getSysDefault, 0);
|
||||
}
|
||||
queryWrapper.orderByAsc("priority");
|
||||
Page<SystemRole> page = PageUtil.getPage(map);
|
||||
return baseMapper.selectPage(page, queryWrapper);
|
||||
|
||||
@ -100,14 +100,13 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
if (systemUser1 != null) {
|
||||
throw new CustomException("该用户账号已被使用!");
|
||||
}
|
||||
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
SystemUser systemUser = new SystemUser();
|
||||
BeanUtils.copyProperties(systemUserVo, systemUser);
|
||||
systemUser.setCreateTime(new Date());
|
||||
systemUser.setSn(StringUtils.isBlank(systemUserVo.getSn()) ? governmentService.list().get(0).getGovernmentSn() : systemUserVo.getSn());
|
||||
systemUser.setPassword(systemUser.getShowPassword());
|
||||
systemUser.setIsManager(false);
|
||||
systemUser.setIsManager(systemUserVo.getIsManager() == null ? false : systemUserVo.getIsManager());
|
||||
systemUser.setAccountType(systemUserVo.getAccountType() == null ? user.getAccountType() : systemUserVo.getAccountType());
|
||||
systemUser.setCreateBy(user.getUserId());
|
||||
//同步用户
|
||||
@ -129,11 +128,12 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
JSONObject object = JSONObject.parseObject(result);
|
||||
if (object.getInteger("code") == 200) {
|
||||
systemUser.setAccount(object.getJSONObject("data").getString("uid"));
|
||||
systemUser.setUserId(object.getJSONObject("data").getString("id"));
|
||||
this.save(systemUser);
|
||||
//新增用户角色
|
||||
SystemUserRole systemUserRole = new SystemUserRole();
|
||||
systemUserRole.setRoleId(systemUserVo.getRoleId());
|
||||
systemUserRole.setUserId(systemUser.getUserId());
|
||||
systemUserRole.setUserId(object.getJSONObject("data").getString("id"));
|
||||
return systemUserRoleMapper.insert(systemUserRole);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,9 +29,9 @@ spring.file-storage.minio[0].platform=minio-1
|
||||
spring.file-storage.minio[0].enable-storage=true
|
||||
spring.file-storage.minio[0].access-key=minioadmin
|
||||
spring.file-storage.minio[0].secret-key=minioadmin
|
||||
spring.file-storage.minio[0].end-point=http://182.90.224.147:9000
|
||||
spring.file-storage.minio[0].bucket-name=wisdomisitezw
|
||||
spring.file-storage.minio[0].domain=http://182.90.224.147:9000/wisdomisitezw/
|
||||
spring.file-storage.minio[0].end-point=http://jxjzw.zhgdyun.com:9001
|
||||
spring.file-storage.minio[0].bucket-name=wisdomsitezw-hzxmgl
|
||||
spring.file-storage.minio[0].domain=http://jxjzw.zhgdyun.com:9001/wisdomsitezw-hzxmgl/
|
||||
spring.file-storage.minio[0].base-path=
|
||||
#spring.file-storage.default-platform=local
|
||||
#spring.file-storage.thumbnail-suffix=.jpg
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user