diff --git a/service-core/pom.xml b/service-core/pom.xml new file mode 100644 index 00000000..441917ca --- /dev/null +++ b/service-core/pom.xml @@ -0,0 +1,33 @@ + + + + wg-basic + ink.wgink + 1.0-SNAPSHOT + + 4.0.0 + + service-core + 用户、组织机构、角色、菜单、职位、组、权限全部 + + + + ink.wgink + service-group + 1.0-SNAPSHOT + + + ink.wgink + service-position + 1.0-SNAPSHOT + + + ink.wgink + service-role + 1.0-SNAPSHOT + + + + \ No newline at end of file diff --git a/service-core/src/main/java/ink/wgink/service/core/controller/api/manage/CoreManageController.java b/service-core/src/main/java/ink/wgink/service/core/controller/api/manage/CoreManageController.java new file mode 100644 index 00000000..881102e7 --- /dev/null +++ b/service-core/src/main/java/ink/wgink/service/core/controller/api/manage/CoreManageController.java @@ -0,0 +1,66 @@ +package ink.wgink.service.core.controller.api.manage; + +import ink.wgink.common.base.DefaultBaseController; +import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.dtos.department.DepartmentDTO; +import ink.wgink.pojo.dtos.user.UserDTO; +import ink.wgink.pojo.result.ErrorResult; +import ink.wgink.pojo.result.SuccessResultList; +import ink.wgink.service.core.service.manage.ICoreManageService; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName: CoreManageController + * @Description: 核心管理 + * @Author: wanggeng + * @Date: 2022/8/10 16:27 + * @Version: 1.0 + */ +@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "核心业务") +@RestController +@RequestMapping(ISystemConstant.API_PREFIX + "/core/manage") +public class CoreManageController extends DefaultBaseController { + + @Autowired + private ICoreManageService coreManageService; + + @ApiOperation(value = "组织部门导航列表", notes = "通过组织部门ID获取与查询有关的所有组织部门列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "departmentId", value = "组织部门上级ID", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("list-department-nav-path/department-id/{departmentId}") + public List listDepartmentNavPathByDepartmentId(@PathVariable("departmentId") String departmentId) { + return coreManageService.listDepartmentNavPathByDepartmentId(departmentId); + } + + @ApiOperation(value = "组织部门用户列表", notes = "组织部门用户列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "path"), + @ApiImplicitParam(name = "roleId", value = "部门ID", paramType = "query"), + @ApiImplicitParam(name = "positionId", value = "部门ID", paramType = "query"), + @ApiImplicitParam(name = "groupId", value = "部门ID", paramType = "query"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query"), + @ApiImplicitParam(name = "userType", value = "用户类型", paramType = "query"), + @ApiImplicitParam(name = "userStatus", value = "用户状态", paramType = "query"), + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listpage-user/department-id/{departmentId}") + public SuccessResultList> listPageUserByDepartmentId(@PathVariable("departmentId") String departmentId, ListPage page) { + Map requestParams = requestParams(); + page.setParams(requestParams); + return coreManageService.listPageUserByDepartmentId(departmentId, page); + } + +} diff --git a/service-core/src/main/java/ink/wgink/service/core/controller/route/manage/CoreManageRouteController.java b/service-core/src/main/java/ink/wgink/service/core/controller/route/manage/CoreManageRouteController.java new file mode 100644 index 00000000..a13d0d33 --- /dev/null +++ b/service-core/src/main/java/ink/wgink/service/core/controller/route/manage/CoreManageRouteController.java @@ -0,0 +1,56 @@ +package ink.wgink.service.core.controller.route.manage; + +import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.interfaces.user.IUserExpandBaseService; +import ink.wgink.interfaces.user.IUserExpandOptionButton; +import ink.wgink.service.user.util.UserUtil; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * @ClassName: CoreManageRouteController + * @Description: 核心管理 + * @Author: wanggeng + * @Date: 2022/8/10 16:29 + * @Version: 1.0 + */ +@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "核心管理路由") +@Controller +@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/core/manage") +public class CoreManageRouteController { + + @Autowired(required = false) + private IUserExpandBaseService userExpandBaseService; + @Autowired(required = false) + private IUserExpandOptionButton userExpandOptionButton; + + @GetMapping("list-department-tree") + public ModelAndView listDepartmentTree() { + ModelAndView modelAndView = new ModelAndView("core/manage/list-department-tree"); + return modelAndView; + } + + @GetMapping("list-department-user") + public ModelAndView listDepartmentUser() { + ModelAndView modelAndView = new ModelAndView("core/manage/list-department-user"); + UserUtil.setUserListPageExpand(userExpandBaseService, userExpandOptionButton, modelAndView); + return modelAndView; + } + + @GetMapping("save-department-user") + public ModelAndView saveDepartmentUser() { + ModelAndView modelAndView = new ModelAndView("core/manage/save-department-user"); + return modelAndView; + } + + @GetMapping("update-department-user") + public ModelAndView updateDepartmentUser() { + ModelAndView modelAndView = new ModelAndView("core/manage/update-department-user"); + return modelAndView; + } + +} diff --git a/service-core/src/main/java/ink/wgink/service/core/dao/manage/ICoreManageDao.java b/service-core/src/main/java/ink/wgink/service/core/dao/manage/ICoreManageDao.java new file mode 100644 index 00000000..35ab01a3 --- /dev/null +++ b/service-core/src/main/java/ink/wgink/service/core/dao/manage/ICoreManageDao.java @@ -0,0 +1,27 @@ +package ink.wgink.service.core.dao.manage; + +import ink.wgink.pojo.dtos.user.UserDTO; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName: ICoreManageDao + * @Description: 核心管理 + * @Author: wanggeng + * @Date: 2022/8/11 14:51 + * @Version: 1.0 + */ +@Repository +public interface ICoreManageDao { + + /** + * 用户列表 + * + * @param params + * @return + */ + List listUser(Map params); + +} diff --git a/service-core/src/main/java/ink/wgink/service/core/service/manage/ICoreManageService.java b/service-core/src/main/java/ink/wgink/service/core/service/manage/ICoreManageService.java new file mode 100644 index 00000000..7db20a99 --- /dev/null +++ b/service-core/src/main/java/ink/wgink/service/core/service/manage/ICoreManageService.java @@ -0,0 +1,43 @@ +package ink.wgink.service.core.service.manage; + +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.dtos.department.DepartmentDTO; +import ink.wgink.pojo.dtos.user.UserDTO; +import ink.wgink.pojo.result.SuccessResultList; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName: ICoreManageService + * @Description: 核心管理 + * @Author: wanggeng + * @Date: 2022/8/10 16:28 + * @Version: 1.0 + */ +public interface ICoreManageService { + + /** + * 组织部门导航列表 + * + * @param departmentId + * @return + */ + List listDepartmentNavPathByDepartmentId(String departmentId); + + /** + * 用户列表 + * + * @return + */ + List listUser(Map params); + + /** + * 组织部门用户列表 + * + * @param departmentId + * @param page + * @return + */ + SuccessResultList> listPageUserByDepartmentId(String departmentId, ListPage page); +} diff --git a/service-core/src/main/java/ink/wgink/service/core/service/manage/impl/CoreManageServiceImpl.java b/service-core/src/main/java/ink/wgink/service/core/service/manage/impl/CoreManageServiceImpl.java new file mode 100644 index 00000000..f684fe8f --- /dev/null +++ b/service-core/src/main/java/ink/wgink/service/core/service/manage/impl/CoreManageServiceImpl.java @@ -0,0 +1,82 @@ +package ink.wgink.service.core.service.manage.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import ink.wgink.common.base.DefaultBaseService; +import ink.wgink.exceptions.SearchException; +import ink.wgink.interfaces.consts.ISystemConstant; +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.dtos.department.DepartmentDTO; +import ink.wgink.pojo.dtos.user.UserDTO; +import ink.wgink.pojo.pos.DepartmentPO; +import ink.wgink.pojo.result.SuccessResultList; +import ink.wgink.service.core.dao.manage.ICoreManageDao; +import ink.wgink.service.core.service.manage.ICoreManageService; +import ink.wgink.service.department.service.IDepartmentService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @ClassName: CoreManageServiceImpl + * @Description: 核心管理业务 + * @Author: wanggeng + * @Date: 2022/8/10 16:28 + * @Version: 1.0 + */ +@Service +public class CoreManageServiceImpl extends DefaultBaseService implements ICoreManageService { + + @Autowired + private IDepartmentService departmentService; + @Autowired + private ICoreManageDao coreManageDao; + + @Override + public List listDepartmentNavPathByDepartmentId(String departmentId) { + DepartmentPO departmentPO = departmentService.getPO(departmentId); + if (departmentPO == null) { + throw new SearchException("部门不存在"); + } + List navList = new ArrayList<>(); + setDepartmentNav(navList, departmentPO); + return navList; + } + + @Override + public List listUser(Map params) { + params = params == null ? getHashMap(0) : params; + return coreManageDao.listUser(params); + } + + @Override + public SuccessResultList> listPageUserByDepartmentId(String departmentId, ListPage page) { + page.getParams().put("departmentId", departmentId); + PageHelper.startPage(page.getPage(), page.getRows()); + List userDTOs = listUser(page.getParams()); + PageInfo pageInfo = new PageInfo<>(userDTOs); + return new SuccessResultList<>(userDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); + } + + /** + * 设置部门导航 + * + * @param navList + * @param departmentPO + */ + private void setDepartmentNav(List navList, DepartmentPO departmentPO) { + DepartmentDTO departmentDTO = new DepartmentDTO(); + BeanUtils.copyProperties(departmentPO, departmentDTO); + navList.add(0, departmentDTO); + if (StringUtils.equals(ISystemConstant.TREE_ROOT_ID, departmentPO.getDepartmentParentId())) { + return; + } + DepartmentPO departmentParentPO = departmentService.getPO(departmentPO.getDepartmentParentId()); + setDepartmentNav(navList, departmentParentPO); + } +} diff --git a/service-core/src/main/resources/mybatis/mapper/core-manage-mapper.xml b/service-core/src/main/resources/mybatis/mapper/core-manage-mapper.xml new file mode 100644 index 00000000..446a3414 --- /dev/null +++ b/service-core/src/main/resources/mybatis/mapper/core-manage-mapper.xml @@ -0,0 +1,188 @@ + + + + + + + SELECT + user_id, + user_password, + user_username, + user_name, + user_phone, + user_email, + user_ukey, + user_ukey_electronic_secret_key, + user_type, + user_state, + user_expired_date, + user_avatar, + user_longitude, + user_latitude, + last_login_address, + LEFT(last_login_time, 19) last_login_time, + login_type, + gmt_password_modified, + remarks, + LEFT(gmt_create, 19) gmt_create + FROM + sys_user t1 + WHERE + t1.is_delete = 0 + AND + t1.user_username != 'admin' + + AND ( + t1.user_username LIKE CONCAT('%', #{keywords}, '%') + OR + t1.user_name LIKE CONCAT('%', #{keywords}, '%') + OR + t1.user_phone LIKE CONCAT('%', #{keywords}, '%') + OR + t1.user_email LIKE CONCAT('%', #{keywords}, '%') + ) + + + AND + t1.user_type = #{userType} + + + AND + t1.user_state = #{userState} + + + AND + t1.user_type != #{excludeUserType} + + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_department_user st1 + WHERE + st1.department_id = #{departmentId} + ) + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_department_user st1 + WHERE + st1.department_id IN + + #{departmentIds[${index}]} + + ) + + + AND + t1.user_id NOT IN ( + SELECT + user_id + FROM + sys_department_user st1 + WHERE + st1.department_id = #{excludeDepartmentId} + ) + + + AND + t1.user_id NOT IN ( + SELECT + user_id + FROM + sys_department_user st1 + WHERE + st1.department_id IN + + #{excludeDepartmentIds[${index}]} + + ) + + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_role_user st2 + WHERE + st2.role_id = #{roleId} + ) + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_role_user st2 + WHERE + st2.role_id IN + + #{roleIds[${index}]} + + ) + + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_position_user st3 + WHERE + st3.position_id = #{positionId} + ) + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_position_user st3 + WHERE + st3.position_id IN + + #{positionIds[${index}]} + + ) + + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_group_user st4 + WHERE + st4.group_id = #{groupId} + ) + + + AND + t1.user_id IN ( + SELECT + user_id + FROM + sys_group_user st4 + WHERE + st4.group_id IN + + #{groupIds[${index}]} + + ) + + + + \ No newline at end of file diff --git a/service-core/src/main/resources/templates/core/manage/list-department-tree.html b/service-core/src/main/resources/templates/core/manage/list-department-tree.html new file mode 100644 index 00000000..84f7ab18 --- /dev/null +++ b/service-core/src/main/resources/templates/core/manage/list-department-tree.html @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/service-core/src/main/resources/templates/core/manage/list-department-user.html b/service-core/src/main/resources/templates/core/manage/list-department-user.html new file mode 100644 index 00000000..22d39d0f --- /dev/null +++ b/service-core/src/main/resources/templates/core/manage/list-department-user.html @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 选择类型 + 系统用户 + 普通用户 + 公共用户 + + + + + 选择状态 + 正常 + 锁定 + 未审核 + 审核不通过 + + + + + + + + + + + + + + + + + 本级搜索 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/service-core/src/main/resources/templates/core/manage/save-department-user.html b/service-core/src/main/resources/templates/core/manage/save-department-user.html new file mode 100644 index 00000000..be4460cc --- /dev/null +++ b/service-core/src/main/resources/templates/core/manage/save-department-user.html @@ -0,0 +1,347 @@ + + + + + + + + + + + + + + + + + + 上级列表/ + 新增内容 + + + + + + + + 用户名 * + + + + + + 密码 * + + + + + + 昵称 * + + + + + + 类型 * + + + + + + + + 类型说明 + 系统用户:具有后台登录权限且参与后台、APP业务的用户 + 普通用户:具有APP登录权限且参与APP业务的用户 + 公共用户:来自小程序、公众号等公共平台自动创建且参与此类业务的的用户 + + + 状态 * + + + + + + + 手机 + + + + + + 邮箱 + + + + + + 过期时间 + + + + + + 备注 + + + + + + + + 组织部门 * + + + + + + + 角色 + + + + + + + 职位 + + + + + + + 组 + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/service-core/src/main/resources/templates/core/manage/update-department-user.html b/service-core/src/main/resources/templates/core/manage/update-department-user.html new file mode 100644 index 00000000..cc72cd1f --- /dev/null +++ b/service-core/src/main/resources/templates/core/manage/update-department-user.html @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + 上级列表/ + 编辑内容 + + + + + + + + 用户名 * + + + + + + 新密码 + + + + + + 昵称 * + + + + + + 类型 * + + + + + + + + 类型说明 + 系统用户:具有后台登录权限且参与后台、APP业务的用户 + 普通用户:具有APP登录权限且参与APP业务的用户 + 公共用户:来自小程序、公众号等公共平台自动创建且参与此类业务的的用户 + + + 状态 * + + + + + + + 手机 + + + + + + 邮箱 + + + + + + 过期时间 + + + + + + 备注 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file
+ 类型说明 + 系统用户:具有后台登录权限且参与后台、APP业务的用户 + 普通用户:具有APP登录权限且参与APP业务的用户 + 公共用户:来自小程序、公众号等公共平台自动创建且参与此类业务的的用户 +