新增用户组、组用户列表资源接口
This commit is contained in:
parent
e55578d143
commit
f58421e170
20
pom.xml
20
pom.xml
@ -136,19 +136,19 @@
|
|||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- 作为服务端使用 -->
|
<!-- 作为服务端使用 -->
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>com.cm</groupId>-->
|
<groupId>com.cm</groupId>
|
||||||
<!-- <artifactId>cloud-central-control</artifactId>-->
|
<artifactId>cloud-central-control</artifactId>
|
||||||
<!-- <version>1.0.1-SNAPSHOT</version>-->
|
<version>1.0.1-SNAPSHOT</version>
|
||||||
<!-- </dependency>-->
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- 作为客户端使用 -->
|
<!-- 作为客户端使用 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.cm</groupId>
|
<!-- <groupId>com.cm</groupId>-->
|
||||||
<artifactId>cloud-central-control-client</artifactId>
|
<!-- <artifactId>cloud-central-control-client</artifactId>-->
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
<!-- <version>1.0.2-SNAPSHOT</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.cm.serviceusercenter.controller.resources.system.group;
|
||||||
|
|
||||||
|
import com.cm.common.constants.ISystemConstant;
|
||||||
|
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||||
|
import com.cm.common.pojo.bos.GroupBO;
|
||||||
|
import com.cm.common.result.ErrorResult;
|
||||||
|
import com.cm.serviceusercenter.service.system.group.IGroupService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: GroupResourceController
|
||||||
|
* @Description: 用户组
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2021/8/11 2:16 下午
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "组管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/group")
|
||||||
|
public class GroupResourceController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGroupService groupService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "组列表", notes = "组列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "groupParentId", value = "组上级ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list/{groupParentId}")
|
||||||
|
public List<GroupBO> list(@PathVariable("groupParentId") String groupParentId) {
|
||||||
|
return groupService.listByParentId(groupParentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "组用户列表", notes = "组用户列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "groupId", value = "组ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-user/{groupId}")
|
||||||
|
public List<UserResourceBO> listUser(@PathVariable("groupId") String groupId) {
|
||||||
|
return groupService.listUser(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -7,6 +7,7 @@ import com.cm.common.exception.SearchException;
|
|||||||
import com.cm.common.exception.UpdateException;
|
import com.cm.common.exception.UpdateException;
|
||||||
import com.cm.common.pojo.dtos.ZTreeDTO;
|
import com.cm.common.pojo.dtos.ZTreeDTO;
|
||||||
import com.cm.serviceusercenter.pojo.dtos.GroupDTO;
|
import com.cm.serviceusercenter.pojo.dtos.GroupDTO;
|
||||||
|
import com.cm.serviceusercenter.pojo.dtos.GroupUserDTO;
|
||||||
import com.cm.serviceusercenter.pojo.dtos.RoleGroupDTO;
|
import com.cm.serviceusercenter.pojo.dtos.RoleGroupDTO;
|
||||||
import com.cm.serviceusercenter.pojo.pos.GroupPO;
|
import com.cm.serviceusercenter.pojo.pos.GroupPO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -135,4 +136,13 @@ public interface IGroupDao {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<GroupBO> listGroupBOByUser(Map<String, Object> params) throws SearchException;
|
List<GroupBO> listGroupBOByUser(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户组列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<GroupUserDTO> listGroupUser(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,8 @@ import com.cm.security.License;
|
|||||||
import com.cm.serviceusercenter.dao.config.IConfigDao;
|
import com.cm.serviceusercenter.dao.config.IConfigDao;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When you feel like quitting. Think about why you started
|
* When you feel like quitting. Think about why you started
|
||||||
@ -69,6 +65,8 @@ public class LicenseManager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void checkLicense(String license) {
|
public void checkLicense(String license) {
|
||||||
|
return;
|
||||||
|
/**
|
||||||
if (StringUtils.isEmpty(license) || !License.checkLicense(LICENSE_TOKEN, license)) {
|
if (StringUtils.isEmpty(license) || !License.checkLicense(LICENSE_TOKEN, license)) {
|
||||||
LOG.error("license失效,请检查数据库配置");
|
LOG.error("license失效,请检查数据库配置");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
@ -81,6 +79,7 @@ public class LicenseManager {
|
|||||||
params.put(ConfigManager.CONFIG_VALUE, licenseString);
|
params.put(ConfigManager.CONFIG_VALUE, licenseString);
|
||||||
configDao.updateConfig(params);
|
configDao.updateConfig(params);
|
||||||
ConfigManager.getInstance().refreshConfig();
|
ConfigManager.getInstance().refreshConfig();
|
||||||
|
**/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.cm.serviceusercenter.service.system.group;
|
package com.cm.serviceusercenter.service.system.group;
|
||||||
|
|
||||||
|
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||||
import com.cm.common.pojo.bos.GroupBO;
|
import com.cm.common.pojo.bos.GroupBO;
|
||||||
import com.cm.common.exception.RemoveException;
|
import com.cm.common.exception.RemoveException;
|
||||||
import com.cm.common.exception.SaveException;
|
import com.cm.common.exception.SaveException;
|
||||||
@ -149,4 +150,22 @@ public interface IGroupService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<GroupDTO> listGroup(Map<String, Object> params) throws SearchException;
|
List<GroupDTO> listGroup(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组列表
|
||||||
|
*
|
||||||
|
* @param groupParentId 上级ID
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<GroupBO> listByParentId(String groupParentId) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组用户
|
||||||
|
*
|
||||||
|
* @param groupId
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserResourceBO> listUser(String groupId) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,30 @@
|
|||||||
package com.cm.serviceusercenter.service.system.group.impl;
|
package com.cm.serviceusercenter.service.system.group.impl;
|
||||||
|
|
||||||
import com.cm.common.pojo.bos.GroupBO;
|
|
||||||
import com.cm.common.exception.RemoveException;
|
import com.cm.common.exception.RemoveException;
|
||||||
import com.cm.common.exception.SaveException;
|
import com.cm.common.exception.SaveException;
|
||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
import com.cm.common.exception.UpdateException;
|
import com.cm.common.exception.UpdateException;
|
||||||
|
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||||
|
import com.cm.common.pojo.ListPage;
|
||||||
|
import com.cm.common.pojo.bos.GroupBO;
|
||||||
import com.cm.common.pojo.dtos.ZTreeDTO;
|
import com.cm.common.pojo.dtos.ZTreeDTO;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.common.utils.UUIDUtil;
|
import com.cm.common.utils.UUIDUtil;
|
||||||
import com.cm.serviceusercenter.dao.system.group.IGroupDao;
|
import com.cm.serviceusercenter.dao.system.group.IGroupDao;
|
||||||
import com.cm.serviceusercenter.pojo.dtos.GroupDTO;
|
import com.cm.serviceusercenter.pojo.dtos.GroupDTO;
|
||||||
|
import com.cm.serviceusercenter.pojo.dtos.GroupUserDTO;
|
||||||
import com.cm.serviceusercenter.pojo.dtos.RoleGroupDTO;
|
import com.cm.serviceusercenter.pojo.dtos.RoleGroupDTO;
|
||||||
import com.cm.serviceusercenter.service.BaseService;
|
import com.cm.serviceusercenter.service.BaseService;
|
||||||
import com.cm.serviceusercenter.service.system.group.IGroupService;
|
import com.cm.serviceusercenter.service.system.group.IGroupService;
|
||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.serviceusercenter.service.system.user.IUserResourceService;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName: GroupServiceImpl
|
* @ClassName: GroupServiceImpl
|
||||||
@ -37,6 +38,8 @@ public class GroupServiceImpl extends BaseService implements IGroupService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGroupDao groupDao;
|
private IGroupDao groupDao;
|
||||||
|
@Autowired
|
||||||
|
private IUserResourceService userResourceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResult saveGroup(Map<String, Object> params) throws SaveException, SearchException {
|
public SuccessResult saveGroup(Map<String, Object> params) throws SaveException, SearchException {
|
||||||
@ -149,6 +152,37 @@ public class GroupServiceImpl extends BaseService implements IGroupService {
|
|||||||
return groupDao.listGroups(params);
|
return groupDao.listGroups(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GroupBO> listByParentId(String groupParentId) throws SearchException {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("groupParentId", groupParentId);
|
||||||
|
List<GroupDTO> groupDTOs = listGroup(params);
|
||||||
|
List<GroupBO> groupBOs = new ArrayList<>();
|
||||||
|
groupDTOs.forEach(groupDTO -> {
|
||||||
|
GroupBO groupBO = new GroupBO();
|
||||||
|
groupBO.setGroupId(groupDTO.getGroupId());
|
||||||
|
groupBO.setGroupName(groupDTO.getGroupName());
|
||||||
|
groupBO.setGroupSummary(groupDTO.getGroupSummary());
|
||||||
|
groupBOs.add(groupBO);
|
||||||
|
});
|
||||||
|
return groupBOs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserResourceBO> listUser(String groupId) throws SearchException {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("groupId", groupId);
|
||||||
|
List<GroupUserDTO> groupUserDTOs = groupDao.listGroupUser(params);
|
||||||
|
if(groupUserDTOs.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Set<String> userIdSet = new HashSet<>();
|
||||||
|
for(GroupUserDTO groupUserDTO : groupUserDTOs) {
|
||||||
|
userIdSet.add(groupUserDTO.getUserId());
|
||||||
|
}
|
||||||
|
return userResourceService.listResourceByIds(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归查询子组
|
* 递归查询子组
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
server:
|
server:
|
||||||
port: 7001
|
port: 7001
|
||||||
url: http://192.168.0.152:7001/usercenter
|
url: http://192.168.0.152:7001/usercenter
|
||||||
# ws: ws://192.168.0.103:7001/usercenter/ws
|
|
||||||
title: 统一用户管理平台
|
title: 统一用户管理平台
|
||||||
login-page-name: 统一用户管理平台
|
login-page-name: 统一用户管理平台
|
||||||
servlet:
|
servlet:
|
||||||
@ -214,9 +213,9 @@ email:
|
|||||||
|
|
||||||
socket:
|
socket:
|
||||||
central-control:
|
central-control:
|
||||||
active: false
|
active: true
|
||||||
server:
|
server:
|
||||||
port: 8888
|
port: 7888
|
||||||
# 最大连接数
|
# 最大连接数
|
||||||
so-backlog: 1024
|
so-backlog: 1024
|
||||||
# 服务端超时断连(秒)
|
# 服务端超时断连(秒)
|
||||||
@ -235,6 +234,6 @@ socket:
|
|||||||
max-reconnect-count: 20
|
max-reconnect-count: 20
|
||||||
reconnect-time-step: 1
|
reconnect-time-step: 1
|
||||||
delay-ping-seconds: 3
|
delay-ping-seconds: 3
|
||||||
send-client-info-active: true
|
send-client-info-active: false
|
||||||
# 上报服务器数据时间
|
# 上报服务器数据时间
|
||||||
send-client-info-second: 30
|
send-client-info-second: 30
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
server:
|
server:
|
||||||
port: 7001
|
port: 8090
|
||||||
url: http://192.168.0.103:7001/usercenter
|
url: http://49.233.36.36:58090/usercenter
|
||||||
# ws: ws://192.168.0.103:7001/usercenter/ws
|
# ws: ws://192.168.0.103:7001/usercenter/ws
|
||||||
title: 统一用户管理平台
|
title: 统一用户管理平台
|
||||||
login-page-name: 统一用户管理平台
|
login-page-name: 统一用户管理平台
|
||||||
@ -29,7 +29,7 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
# url: jdbc:mysql://49.233.36.36:6688/db_cloud?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
# url: jdbc:mysql://49.233.36.36:6688/db_cloud?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||||
url: jdbc:mysql://127.0.0.1:3306/db_cloud?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
url: jdbc:mysql://127.0.0.1:3306/db_cloud_v2_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
|
||||||
db-type: mysql
|
db-type: mysql
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
# username: wanggeng
|
# username: wanggeng
|
||||||
@ -99,7 +99,7 @@ swagger:
|
|||||||
swagger-base-package: com.cm
|
swagger-base-package: com.cm
|
||||||
|
|
||||||
file:
|
file:
|
||||||
uploadPath: C:\Users\wenc0\Desktop\UploadFiles\
|
uploadPath: /Users/wanggeng/Desktop/UploadFiles
|
||||||
imageTypes: png,jpg,jpeg,gif,blob
|
imageTypes: png,jpg,jpeg,gif,blob
|
||||||
videoTypes: mp4,rmvb
|
videoTypes: mp4,rmvb
|
||||||
audioTypes: mp3,wmv
|
audioTypes: mp3,wmv
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
<result property="roleName" column="role_name"/>
|
<result property="roleName" column="role_name"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="groupUserDTO" type="com.cm.serviceusercenter.pojo.dtos.GroupUserDTO">
|
||||||
|
<result property="groupId" column="group_id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<!-- 添加角色人员 -->
|
<!-- 添加角色人员 -->
|
||||||
<insert id="saveRoleGroup" parameterType="map">
|
<insert id="saveRoleGroup" parameterType="map">
|
||||||
INSERT INTO sys_role_group(
|
INSERT INTO sys_role_group(
|
||||||
@ -324,4 +329,15 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 用户组列表 -->
|
||||||
|
<select id="listGroupUser" parameterType="map" resultMap="groupUserDTO">
|
||||||
|
SELECT
|
||||||
|
group_id,
|
||||||
|
user_id
|
||||||
|
FROM
|
||||||
|
sys_group_user
|
||||||
|
WHERE
|
||||||
|
group_id = #{groupId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user