接口调整

This commit is contained in:
pengjie 2023-04-10 18:07:22 +08:00
parent 866673f97f
commit 86dd75d7d4
16 changed files with 70 additions and 73 deletions

View File

@ -4,6 +4,7 @@ import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.basicdata.dto.MenuTreeDto;
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
import com.zhgd.xmgl.modules.basicdata.entity.SystemRoleMenu;
import com.zhgd.xmgl.modules.basicdata.service.IBaseMenuService;
import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.Api;
@ -198,7 +199,7 @@ public class BaseMenuController {
@ApiOperation(value = "获取角色的菜单权限", notes = "获取角色的菜单权限" , httpMethod="POST")
@ApiImplicitParam(name = "roleId", value = "系统角色表ID", paramType = "query", required = true, dataType = "Long")
@PostMapping(value = "/queryByRole")
public Result<Set<Long>> queryByRole(@RequestBody Map<String,Object> map) {
public Result<List<SystemRoleMenu>> queryByRole(@RequestBody Map<String,Object> map) {
return Result.success(baseMenuService.roleMenu(MapUtils.getString(map,"roleId")));
}

View File

@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@ -63,10 +60,10 @@ public class EntSystemDeptController {
* @return
*/
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="POST")
@PostMapping(value = "/tree")
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="GET")
@GetMapping(value = "/tree")
public Result<List<SystemDept>> queryTreeList() {
List<SystemDept> tree = systemDeptService.tree(0);
List<SystemDept> tree = systemDeptService.tree(0L);
return Result.success(tree);
}

View File

@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@ -63,10 +60,10 @@ public class GovSystemDeptController {
* @return
*/
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="POST")
@PostMapping(value = "/tree")
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="GET")
@GetMapping(value = "/tree")
public Result<List<SystemDept>> queryTreeList() {
List<SystemDept> tree = systemDeptService.tree(0);
List<SystemDept> tree = systemDeptService.tree(0L);
return Result.success(tree);
}

View File

@ -14,10 +14,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@ -63,10 +60,10 @@ public class SystemDeptController {
* @return
*/
@OperLog(operModul = "部门配置", operType = "层级查询", operDesc = "层级查询政府内部部门信息")
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="POST")
@PostMapping(value = "/tree")
@ApiOperation(value = " 层级查询政府内部部门信息", notes = "层级查询政府内部部门信息", httpMethod="GET")
@GetMapping(value = "/tree")
public Result<List<SystemDept>> queryTreeList() {
List<SystemDept> tree = systemDeptService.tree(0);
List<SystemDept> tree = systemDeptService.tree(0L);
return Result.success(tree);
}

View File

@ -14,5 +14,5 @@ public class SystemUserDto extends SystemUser {
@ApiModelProperty(value = "用户角色")
private String roleId;
private String roleName;
}

View File

@ -27,7 +27,7 @@ public class SystemDept implements Serializable {
/**
* 部门id
*/
@TableId(type = IdType.AUTO)
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "部门id(主键ID)")
private Long deptId;
/**
@ -35,7 +35,7 @@ public class SystemDept implements Serializable {
*/
@Excel(name = "父部门id", width = 15)
@ApiModelProperty(value = "父部门id")
private Integer parentId;
private Long parentId;
/**
* 祖级列表
*/

View File

@ -35,22 +35,15 @@ public class SystemRoleMenu implements Serializable {
@ApiModelProperty(value = "角色id")
private Long roleId;
/**
* 菜单id
* 对应权限id
*/
@Excel(name = "菜单id", width = 15)
@ApiModelProperty(value = "菜单id")
private Long menuId;
@Excel(name = "对应权限id", width = 15)
@ApiModelProperty(value = "对应权限id")
private Long authorityId;
/**
* 权限id
* 菜单类型,0:模块 1:菜单;2:按钮
*/
@Excel(name = "权限id", width = 15)
@ApiModelProperty(value = "权限id")
private Long actionId;
/**
* 模块id
*/
@Excel(name = "模块id", width = 15)
@ApiModelProperty(value = "模块id")
private Long moduleId;
@Excel(name = "菜单类型,0:模块 1:菜单;2:按钮", width = 15)
@ApiModelProperty(value = "菜单类型,0:模块 1:菜单;2:按钮")
private Integer type;
}

View File

@ -53,7 +53,6 @@ public class SystemUser implements Serializable {
*/
@Excel(name = "创建时间", width = 15)
@ApiModelProperty(value = "创建时间")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
/**
* 人员姓名
@ -92,11 +91,11 @@ public class SystemUser implements Serializable {
@ApiModelProperty(value = "项目子账号绑定的人员ID")
private Integer workerId;
/**
* 组织岗位Id
* 组织岗位
*/
@Excel(name = "组织岗位Id", width = 15)
@ApiModelProperty(value = "组织岗位Id")
private Integer jobId;
@Excel(name = "组织岗位", width = 15)
@ApiModelProperty(value = "组织岗位")
private String jobName;
/**
* 外部第三方账号
*/
@ -122,6 +121,14 @@ public class SystemUser implements Serializable {
@ApiModelProperty(value = "邮箱")
private String email;
@Excel(name = "性别(0女;1男)", width = 15)
@ApiModelProperty(value = "性别(0女;1男)")
private Integer sex;
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
@TableField(exist = false)
@ApiModelProperty(value = "token")
private String token;

View File

@ -28,4 +28,6 @@ public interface BaseMenuMapper extends BaseMapper<BaseMenu> {
List<EntityMap> selectHeadquartersMenuList(Map<String, Object> param);
List<EntityMap> selectComapnyUserMenuList(Map<String, Object> param);
List<BaseMenu> getMenuIdByFilter(Long roleId, Long moduleId);
}

View File

@ -54,4 +54,9 @@
WHERE b.user_id=#{userId} and a.status=1 and m.style_type=#{styleType}
order by a.parent_id,a.priority
</select>
<select id="getMenuIdByFilter" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseMenu">
SELECT m.* FROM system_role_menu r LEFT JOIN base_menu m ON r.authority_id = m.menu_id AND r.type = 1
WHERE m.module_id = #{moduleId} AND r.role_id = #{roleId}
</select>
</mapper>

View File

@ -13,9 +13,10 @@
</select>
<select id="getPageList" resultType="com.zhgd.xmgl.modules.basicdata.dto.SystemUserDto">
SELECT <include refid="userInfo"></include>, d.dept_name, ur.role_id FROM system_user u
SELECT <include refid="userInfo"></include>, d.dept_name, r.role_name FROM system_user u
LEFT JOIN system_dept d ON u.department = d.dept_id
LEFT JOIN user_role ur ON u.user_id = ur.user_id
LEFT JOIN system_user_role ur ON u.user_id = ur.user_id
LEFT JOIN system_role r ON ur.role_id = r.role_id
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -6,6 +6,7 @@ import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.basicdata.dto.MenuTreeDto;
import com.zhgd.xmgl.modules.basicdata.entity.BaseMenu;
import com.zhgd.xmgl.modules.basicdata.entity.BaseModule;
import com.zhgd.xmgl.modules.basicdata.entity.SystemRoleMenu;
import java.util.List;
import java.util.Map;
@ -49,7 +50,7 @@ public interface IBaseMenuService extends IService<BaseMenu> {
List<MenuTreeDto> myTreeMenu(Long moduleId);
Set<Long> roleMenu(String roleId);
List<SystemRoleMenu> roleMenu(String roleId);
Set<String> queryRouter();
}

View File

@ -13,7 +13,7 @@ import java.util.List;
*/
public interface ISystemDeptService extends IService<SystemDept> {
List<SystemDept> tree(Integer deptId);
List<SystemDept> tree(Long deptId);
boolean saveInfo(SystemDept systemDept);

View File

@ -99,13 +99,10 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
// 查询相对应的菜单
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getModuleId, moduleId));
} else {
List<Long> roleIds = systemUserRoleService.list(Wrappers.<SystemUserRole>lambdaQuery()
.eq(SystemUserRole::getUserId, user.getUserId())).stream().map(r -> r.getRoleId()).collect(Collectors.toList());
if (roleIds.size() > 0) {
List<Long> menuIds = systemRoleMenuService.list(Wrappers.<SystemRoleMenu>lambdaQuery()
.in(SystemRoleMenu::getRoleId, roleIds).eq(SystemRoleMenu::getModuleId, moduleId)
).stream().map(r -> r.getMenuId()).collect(Collectors.toList());
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getMenuId, menuIds));
Long roleId = systemUserRoleService.getOne(Wrappers.<SystemUserRole>lambdaQuery()
.eq(SystemUserRole::getUserId, user.getUserId())).getRoleId();
if (roleId != null) {
baseMenus = baseMenuMapper.getMenuIdByFilter(roleId, moduleId);
}
}
if (baseMenus.size() == 0) {
@ -117,18 +114,10 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
}
@Override
public Set<Long> roleMenu(String roleId) {
Set<Long> ids = new HashSet<>();
public List<SystemRoleMenu> roleMenu(String roleId) {
// 查询角色下的菜单
List<SystemRoleMenu> systemRoleMenus = systemRoleMenuService.list(Wrappers.<SystemRoleMenu>lambdaQuery()
.eq(SystemRoleMenu::getRoleId, roleId));
for (SystemRoleMenu systemRoleMenu : systemRoleMenus) {
ids.add(systemRoleMenu.getModuleId());
ids.add(systemRoleMenu.getMenuId());
ids.add(systemRoleMenu.getActionId());
}
ids.remove(null);
return ids;
return systemRoleMenuService.list(Wrappers.<SystemRoleMenu>lambdaQuery()
.eq(SystemRoleMenu::getRoleId, roleId));
}
@Override

View File

@ -61,7 +61,9 @@ public class GovernmentServiceImpl extends ServiceImpl<GovernmentMapper, Governm
}
for (Government government : pageList.getRecords()) {
if (government.getExpireTime() != null) {
government.setDiffDay((int) DateUtil.between(new Date(), government.getExpireTime(), DateUnit.DAY));
Integer between = (int) DateUtil.between(new Date(), government.getExpireTime(), DateUnit.DAY, false);
government.setDiffDay(between > 0 ? between : 0);
government.setState(between > 0 ? government.getState() : 0);
}
government.setInstallProject(projectList.stream().filter(p -> p.getGovernmentSn().equals(government.getGovernmentSn())).count());
}
@ -131,6 +133,11 @@ public class GovernmentServiceImpl extends ServiceImpl<GovernmentMapper, Governm
if (accountType == 2) {
govSn = sn;
}
return this.getOne(Wrappers.<Government>lambdaQuery().eq(Government::getGovernmentSn, govSn));
Government government = this.getOne(Wrappers.<Government>lambdaQuery().eq(Government::getGovernmentSn, govSn));
if (government.getExpireTime().before(new Date())) {
government.setState(0);
this.updateById(government);
}
return government;
}
}

View File

@ -24,12 +24,12 @@ import java.util.stream.Collectors;
public class SystemDeptServiceImpl extends ServiceImpl<SystemDeptMapper, SystemDept> implements ISystemDeptService {
@Override
public List<SystemDept> tree(Integer deptId) {
public List<SystemDept> tree(Long deptId) {
SecurityUser user = SecurityUtil.getUser();
List<SystemDept> list = this.list(Wrappers.<SystemDept>lambdaQuery().eq(SystemDept::getSn, user.getSn()));
List<SystemDept> treeList = new ArrayList<>();
if (deptId == 0) {
treeList = list.stream().filter(d -> d.getParentId().equals(0)).collect(Collectors.toList());
if (deptId.equals(0L)) {
treeList = list.stream().filter(d -> d.getParentId().equals(0L)).collect(Collectors.toList());
getTreeList(treeList, list);
} else {
treeList = list.stream().filter(d -> d.getDeptId().equals(deptId)).collect(Collectors.toList());
@ -62,7 +62,7 @@ public class SystemDeptServiceImpl extends ServiceImpl<SystemDeptMapper, SystemD
private List<SystemDept> getTreeList(List<SystemDept> treeList, List<SystemDept> list) {
for (SystemDept systemDept : treeList) {
List<SystemDept> children = this.list(Wrappers.<SystemDept>lambdaQuery().eq(SystemDept::getParentId, systemDept.getDeptId()));
List<SystemDept> children = list.stream().filter(d -> d.getParentId().equals(systemDept.getDeptId())).collect(Collectors.toList());
getTreeList(children, list);
systemDept.setChildren(children);
}