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 @@ + + + + + + + + \ 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