Merge branch 'main' of http://121.37.111.42:3000/ThbTech/gis-bi into main
This commit is contained in:
commit
fcbd1b3905
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||||
import io.gisbi.application.system.domain.Organization;
|
import io.gisbi.application.system.domain.Organization;
|
||||||
import io.gisbi.application.system.service.IOrganizationService;
|
import io.gisbi.application.system.service.IOrganizationService;
|
||||||
|
import io.gisbi.utils.AuthUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.gisbi.config.ResponseResult;
|
import io.gisbi.config.ResponseResult;
|
||||||
@ -37,10 +38,10 @@ public class OrganizationController {
|
|||||||
* orgName 部门名称
|
* orgName 部门名称
|
||||||
* 返回值说明: 企业列表集合
|
* 返回值说明: 企业列表集合
|
||||||
***********************************/
|
***********************************/
|
||||||
@PostMapping("/getOrganization")
|
@PostMapping("/getOrganizations")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Map<String, Object>> getOrganization(String appId, String parentid, String orgName) {
|
public List<Map<String, Object>> getOrganizations(String appId, String orgtype, String parentid, String orgName) {
|
||||||
return organizationService.getOrganization(appId, parentid, orgName);
|
return organizationService.getOrganizations(appId,orgtype, parentid, orgName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
@ -56,8 +57,8 @@ public class OrganizationController {
|
|||||||
if (StrUtil.isBlank(id)) {
|
if (StrUtil.isBlank(id)) {
|
||||||
return ResponseResult.error("查询失败!");
|
return ResponseResult.error("查询失败!");
|
||||||
}
|
}
|
||||||
List<Organization> Organizations = organizationService.getOrganizationById(id, orgName);
|
Organization Organization = organizationService.getOrganizationById(id);
|
||||||
return ResponseResult.successData(Organizations);
|
return ResponseResult.successData(Organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ public class OrganizationController {
|
|||||||
return ResponseResult.error("组织信息不能为空");
|
return ResponseResult.error("组织信息不能为空");
|
||||||
}
|
}
|
||||||
//填写 最近修改者
|
//填写 最近修改者
|
||||||
organization.setLastmodifier("admin");
|
organization.setLastmodifier(AuthUtils.getUser().getUserId().toString());
|
||||||
//填写 最近修改时间
|
//填写 最近修改时间
|
||||||
organization.setLastmodifydate(LocalDateTime.now());
|
organization.setLastmodifydate(LocalDateTime.now());
|
||||||
//根据id 修改系统组织
|
//根据id 修改系统组织
|
||||||
@ -127,7 +128,7 @@ public class OrganizationController {
|
|||||||
UpdateWrapper<Organization> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<Organization> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.eq("id", id)
|
updateWrapper.eq("id", id)
|
||||||
.set("isvaild", isvaild)
|
.set("isvaild", isvaild)
|
||||||
.set("lastmodifier", "admin")
|
.set("lastmodifier", AuthUtils.getUser().getUserId().toString())
|
||||||
.set("lastmodifydate", LocalDateTime.now());
|
.set("lastmodifydate", LocalDateTime.now());
|
||||||
boolean isOk = organizationService.update(updateWrapper);
|
boolean isOk = organizationService.update(updateWrapper);
|
||||||
if (isOk) {
|
if (isOk) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gisbi.application.system.controller;
|
package io.gisbi.application.system.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import io.gisbi.application.system.domain.Role;
|
import io.gisbi.application.system.domain.Role;
|
||||||
import io.gisbi.application.system.service.IRoleService;
|
import io.gisbi.application.system.service.IRoleService;
|
||||||
@ -52,7 +53,7 @@ public class RoleController {
|
|||||||
***********************************/
|
***********************************/
|
||||||
@PostMapping("/getRoleById")
|
@PostMapping("/getRoleById")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseResult getOneById(String id) {
|
public ResponseResult getRoleById(String id) {
|
||||||
Role role = roleService.getById(id);
|
Role role = roleService.getById(id);
|
||||||
return ResponseResult.successData(role);
|
return ResponseResult.successData(role);
|
||||||
}
|
}
|
||||||
@ -80,9 +81,12 @@ public class RoleController {
|
|||||||
* role 角色对象
|
* role 角色对象
|
||||||
* 返回值说明: 是否修改成功
|
* 返回值说明: 是否修改成功
|
||||||
***********************************/
|
***********************************/
|
||||||
@PostMapping("/updateRoleById")
|
@PostMapping("/updateRole")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseResult updateRoleById(@RequestBody Role role) {
|
public ResponseResult updateRole(@RequestBody Role role) {
|
||||||
|
if (StrUtil.isBlank(role.getId())) {
|
||||||
|
return ResponseResult.error("需要提交角色ID!");
|
||||||
|
}
|
||||||
//更新最近修改人
|
//更新最近修改人
|
||||||
role.setLastmodifier(AuthUtils.getUser().getUserId().toString());
|
role.setLastmodifier(AuthUtils.getUser().getUserId().toString());
|
||||||
//更新最近修改时间
|
//更新最近修改时间
|
||||||
|
@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.bouncycastle.asn1.x500.style.RFC4519Style.cn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 用户 前端控制器
|
* 用户 前端控制器
|
||||||
|
@ -20,16 +20,15 @@ public interface IOrganizationService extends IService<Organization> {
|
|||||||
* 参数说明
|
* 参数说明
|
||||||
* 返回值说明: 企业列表集合
|
* 返回值说明: 企业列表集合
|
||||||
***********************************/
|
***********************************/
|
||||||
List<Map<String, Object>> getOrganization(String appId, String parentid, String orgname);
|
List<Map<String, Object>> getOrganizations(String appId, String orgtype, String parentid, String orgname);
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* 用途说明:根据企业ID查询部门信息
|
* 用途说明:根据企业ID查询部门信息
|
||||||
* 参数说明
|
* 参数说明
|
||||||
* id 企业id
|
* id 企业id
|
||||||
* orgName 部门名称
|
|
||||||
* 返回值说明: 系统部门框架对象
|
* 返回值说明: 系统部门框架对象
|
||||||
***********************************/
|
***********************************/
|
||||||
List<Organization> getOrganizationById(String id, String orgName);
|
Organization getOrganizationById(String id);
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* 用途说明:新增系统组织框架
|
* 用途说明:新增系统组织框架
|
||||||
|
@ -46,10 +46,11 @@ public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Org
|
|||||||
* 返回值说明: 企业列表集合
|
* 返回值说明: 企业列表集合
|
||||||
***********************************/
|
***********************************/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getOrganization(String appId, String parentid, String orgname) {
|
public List<Map<String, Object>> getOrganizations(String appId, String orgtype, String parentid, String orgname) {
|
||||||
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(StringUtils.isNotBlank(parentid), Organization::getParentid, parentid);
|
queryWrapper.eq(Organization::getParentid, parentid);
|
||||||
queryWrapper.eq(StringUtils.isNotBlank(appId), Organization::getAppId, appId);
|
queryWrapper.eq(Organization::getAppId, appId);
|
||||||
|
queryWrapper.eq(Organization::getOrgtype, orgtype);
|
||||||
List<Map<String, Object>> listMap = this.listMaps(queryWrapper.orderByAsc(Organization::getOrgcode));
|
List<Map<String, Object>> listMap = this.listMaps(queryWrapper.orderByAsc(Organization::getOrgcode));
|
||||||
|
|
||||||
if (listMap == null) {
|
if (listMap == null) {
|
||||||
@ -109,17 +110,12 @@ public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Org
|
|||||||
* 用途说明:根据企业ID查询部门信息
|
* 用途说明:根据企业ID查询部门信息
|
||||||
* 参数说明
|
* 参数说明
|
||||||
* id 企业id
|
* id 企业id
|
||||||
* orgName 部门名称
|
|
||||||
* 返回值说明: 系统部门框架对象
|
* 返回值说明: 系统部门框架对象
|
||||||
***********************************/
|
***********************************/
|
||||||
@Override
|
@Override
|
||||||
public List<Organization> getOrganizationById(String id, String orgName) {
|
public Organization getOrganizationById(String id) {
|
||||||
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
Organization organization=this.getById(id);
|
||||||
if (StrUtil.isNotBlank(orgName)) {
|
return organization;
|
||||||
queryWrapper.like(Organization::getOrgname, orgName);
|
|
||||||
}
|
|
||||||
queryWrapper.eq(Organization::getParentid, id).orderByDesc(Organization::getOrgcode);
|
|
||||||
return this.list(queryWrapper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
@ -171,6 +167,7 @@ public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Org
|
|||||||
organization.setLastmodifier(AuthUtils.getUser().getUserId().toString());
|
organization.setLastmodifier(AuthUtils.getUser().getUserId().toString());
|
||||||
//填写 当前日期
|
//填写 当前日期
|
||||||
organization.setLastmodifydate(LocalDateTime.now());
|
organization.setLastmodifydate(LocalDateTime.now());
|
||||||
|
|
||||||
return this.save(organization);
|
return this.save(organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,16 +85,14 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|||||||
@Override
|
@Override
|
||||||
public List<Role> listRole(String appId, String rolename) {
|
public List<Role> listRole(String appId, String rolename) {
|
||||||
LambdaQueryWrapper<Role> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Role> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
//根据应用ID查询
|
|
||||||
if (StringUtils.isNotEmpty(appId)) {
|
queryWrapper.eq(Role::getAppId, appId);
|
||||||
queryWrapper.eq(Role::getAppId, appId);
|
|
||||||
}
|
|
||||||
//根据角色名称模糊查询
|
//根据角色名称模糊查询
|
||||||
if (StringUtils.isNotEmpty(rolename)) {
|
if (StringUtils.isNotEmpty(rolename)) {
|
||||||
queryWrapper.like(Role::getRolename, rolename);
|
queryWrapper.like(Role::getRolename, rolename);
|
||||||
}
|
}
|
||||||
//根据角色类别 正序排序
|
//根据角色类别 正序排序
|
||||||
queryWrapper.orderByAsc(Role::getType);
|
queryWrapper.orderByAsc(Role::getType, Role::getRolecode);
|
||||||
List<Role> roles = roleMapper.selectList(queryWrapper);
|
List<Role> roles = roleMapper.selectList(queryWrapper);
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
@ -107,18 +105,12 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|||||||
***********************************/
|
***********************************/
|
||||||
@Override
|
@Override
|
||||||
public void deleteById(String id) {
|
public void deleteById(String id) {
|
||||||
String[] ids = id.split(",");
|
//根据id删除 角色
|
||||||
for (String roleId : ids) {
|
boolean isOk = this.removeById(id);
|
||||||
//根据id删除 角色
|
//删除角色菜单关联
|
||||||
boolean isOk = this.removeById(roleId);
|
roleMapper.deleteRoleMenus(id);
|
||||||
if (!isOk) {
|
//删除角色用户关联
|
||||||
continue;
|
roleMapper.deleteRoleUser(id);
|
||||||
}
|
|
||||||
//删除角色菜单关联
|
|
||||||
roleMapper.deleteRoleMenus(roleId);
|
|
||||||
//删除角色用户关联
|
|
||||||
roleMapper.deleteRoleUser(roleId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package io.gisbi.application.system.service.impl;
|
package io.gisbi.application.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.Hutool;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
@ -64,7 +66,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
//返回信息
|
//返回信息
|
||||||
Map<String, String> result = new HashMap<>();
|
Map<String, String> result = new HashMap<>();
|
||||||
//普通用户
|
//普通用户
|
||||||
user.setUsertype(DEFAULT_IS_VALID);
|
|
||||||
// BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
// BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
// //设置缺省密码
|
// //设置缺省密码
|
||||||
// String cryptPassword = passwordEncoder.encode("123456");
|
// String cryptPassword = passwordEncoder.encode("123456");
|
||||||
@ -76,7 +77,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
//账号有效 状态 1-有效 0-停用
|
//账号有效 状态 1-有效 0-停用
|
||||||
user.setStatus(DEFAULT_IS_VALID);
|
user.setStatus(DEFAULT_IS_VALID);
|
||||||
//判断注册的登录账号是否存在
|
//判断注册的登录账号是否存在
|
||||||
if (isExistAccount(user.getUsername())) {
|
if (!isExistAccount(user.getAppId(), StrUtil.trim(user.getUsername()))) {
|
||||||
//新增用户
|
//新增用户
|
||||||
boolean ok = this.save(user);
|
boolean ok = this.save(user);
|
||||||
//新增用户分配权限
|
//新增用户分配权限
|
||||||
@ -329,11 +330,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
* 用途说明:角色添加用户
|
* 用途说明:角色添加用户
|
||||||
* 参数说明
|
* 参数说明
|
||||||
* roleid 角色id
|
* roleid 角色id
|
||||||
* userids 用户id组
|
* userid 用户id
|
||||||
* 返回值说明: 是否新增成功
|
* 返回值说明: 是否新增成功
|
||||||
***********************************/
|
***********************************/
|
||||||
@Override
|
@Override
|
||||||
public boolean addUserRoles(String roleid, String userid) {
|
public boolean addUserRole(String roleid, String userid) {
|
||||||
boolean isOk = true;
|
boolean isOk = true;
|
||||||
if (StringUtils.isEmpty(roleid) || StringUtils.isEmpty(userid)) {
|
if (StringUtils.isEmpty(roleid) || StringUtils.isEmpty(userid)) {
|
||||||
return false;
|
return false;
|
||||||
@ -358,13 +359,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|||||||
* account 登录名称
|
* account 登录名称
|
||||||
* 返回值说明: 重复返回 false 否则返回 true
|
* 返回值说明: 重复返回 false 否则返回 true
|
||||||
************************************/
|
************************************/
|
||||||
private boolean isExistAccount(String username) {
|
private boolean isExistAccount(String appid,String username) {
|
||||||
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
||||||
if (this.list(queryWrapper.eq("username", username)).size() > 0) {
|
if (this.list(queryWrapper.eq("app_id", appid).eq("username", username)).size() > 0) {
|
||||||
//判断 查询登录账号 结果集是否为null 重复返回 false 否则返回 tree
|
//判断 查询登录账号 结果集是否为null 重复返回 false 否则返回 tree
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user