用户管理及下拉选查询接口开发

This commit is contained in:
haozq 2025-12-08 18:03:24 +08:00
parent e7d0685275
commit e6c1f40ab4
46 changed files with 1635 additions and 118 deletions

View File

@ -4,12 +4,67 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="30706c6d-35cd-44ba-b6ec-9865ccea7a75" name="Changes" comment="添加app子服务" />
<list default="true" id="30706c6d-35cd-44ba-b6ec-9865ccea7a75" name="Changes" comment="用户管理及下拉选查询接口开发">
<change afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/AllUserVo.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/vo/PublicUserVo.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/login/dao/PublicLoginDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/login/vo/PublicUserVo.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-czl-service/src/main/resources/mappers/login/PublicLoginMapper.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/PathMatchUtil.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/controller/PublicLoginController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/domain/LoginForm.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/domain/PublicUserVo.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/mapper/PublicLoginMapper.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/service/impl/PublicLoginService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/resources/mapper/ldlz/PublicLoginMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/AllUserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/AllUserController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/LoginController.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/LoginController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/PublicLoginController.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/controller/PublicLoginController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/AllUserDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/dao/AllUserDao.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/AllUserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/AllUserService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/LoginService.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/login/service/LoginService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/BnsSecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/BnsSecurityConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/SecurityHeadersFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/config/SecurityHeadersFilter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/controller/OrgController.java" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/java/com/bonus/hnrn/rnbmw/manager/controller/OrgController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/HnRealNameBmw/src/main/resources/mappers/login/AllUserMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/HnRealNameBmw/src/main/resources/mappers/login/AllUserMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/login/controller/PublicLoginController.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/login/controller/PublicLoginController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/login/service/PublicLoginService.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/login/service/PublicLoginService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/manager/dao/UserDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/manager/dao/UserDao.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/manager/utils/AjaxRes.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/manager/utils/AjaxRes.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-czl-service/src/main/resources/mappers/user/newUserMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-czl-service/src/main/resources/mappers/user/newUserMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/AuthFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/AuthFilter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/domain/bo/PerformLogBo.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/domain/bo/PerformLogBo.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/web/core/config/SwaggerConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/web/core/config/SwaggerConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/resources/bootstrap.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-framework/src/main/java/com/bns/framework/config/SecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-framework/src/main/java/com/bns/framework/config/SecurityConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/mapper/SysDeptMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/mapper/SysDeptMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/mapper/SysRoleMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/mapper/SysRoleMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/ISysDeptService.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/ISysDeptService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/ISysRoleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/ISysRoleService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/impl/SysDeptServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/impl/SysDeptServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/impl/SysRoleServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/service/impl/SysRoleServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/resources/mapper/system/SysDeptMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/resources/mapper/system/SysDeptMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/resources/mapper/system/SysRoleMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/resources/mapper/system/SysRoleMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/RnamaApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/RealNameAppApplication.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Interface" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -32,6 +87,12 @@
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Maven.HnRealNameBmw [clean].executor": "Run",
"Maven.HnRealNameBmw [install].executor": "Run",
"Maven.ldlz [clean].executor": "Run",
"Maven.ldlz [install].executor": "Run",
"Maven.realname-app [clean].executor": "Run",
"Maven.realname-app [install].executor": "Run",
"RequestMappingsPanelOrder0": "0",
"RequestMappingsPanelOrder1": "1",
"RequestMappingsPanelWidth0": "75",
@ -42,13 +103,13 @@
"Spring Boot.BonusGatewayApplication.executor": "Debug",
"Spring Boot.CzlScreenApplication.executor": "Debug",
"Spring Boot.CzlServiceApplication.executor": "Debug",
"Spring Boot.HnRealNameBmwApplication.executor": "Run",
"Spring Boot.LdlzApplication.executor": "Run",
"Spring Boot.HnRealNameBmwApplication.executor": "Debug",
"Spring Boot.LdlzApplication.executor": "Debug",
"Spring Boot.RnamaApplication.executor": "Run",
"Spring Boot.RnmwApplication.executor": "Debug",
"git-widget-placeholder": "main",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "F:/workspace/idea/hn_cloud_service/realname-app/src/main/resources",
"last_opened_file_path": "F:/workspace/idea/hn_cloud_service/hn-ldlz/ldlz-admin/src/main/resources/mapper/ldlz/slave",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
@ -67,17 +128,21 @@
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="F:\workspace\idea\hn_cloud_service\hn-ldlz\ldlz-admin\src\main\resources\mapper\ldlz\slave" />
<recent name="F:\workspace\idea\hn_cloud_service\hn-czl-service\src\main\resources\mappers\login" />
<recent name="F:\workspace\idea\hn_cloud_service\realname-app\src\main\resources" />
<recent name="F:\workspace\idea\hn_cloud_service" />
<recent name="F:\workspace\idea\hn_cloud_service\HnRealNameMw\src\main\java\com\bonus\hnrn\rnmw\login" />
<recent name="F:\workspace\idea\hn_cloud_service\hn_czl_screen\src\main\java\com\bonus\hn\bearing\capacity\screen\login" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="F:\workspace\idea\hn_cloud_service\hn-ldlz\ldlz-admin\src\main\resources\mapper\ldlz" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.bns.ldlz.domain" />
<recent name="com.bonus.hnrn.rnbmw.login.vo" />
<recent name="com.bns.ldlz.service" />
<recent name="com.bns.ldlz.controller" />
<recent name="com.bonus.hnrn.rnbmw.login.service" />
<recent name="com.bonus.hnrn.rnbmw.login.controller" />
<recent name="com.bonus.hn.bearing.capacity.backstage.login.service" />
<recent name="com.bonus.hn.bearing.capacity.backstage.login.vo" />
</key>
</component>
<component name="RunDashboard">
@ -90,7 +155,7 @@
</set>
</option>
</component>
<component name="RunManager" selected="Spring Boot.RnamaApplication">
<component name="RunManager" selected="Spring Boot.LdlzApplication">
<configuration name="BonusGatewayApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<module name="bonus-gateway" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.gateway.BonusGatewayApplication" />
@ -130,9 +195,9 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="RnamaApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<configuration name="RealNameAppApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<module name="realname-app" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.hnrn.rnama.RnamaApplication" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bonus.hnrn.rnama.RealNameAppApplication" />
<method v="2">
<option name="Make" enabled="true" />
</method>
@ -165,7 +230,7 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1764900432287</updated>
<workItem from="1764900434133" duration="12211000" />
<workItem from="1764900434133" duration="40334000" />
</task>
<task id="LOCAL-00001" summary="修改新增用户">
<option name="closed" value="true" />
@ -191,7 +256,15 @@
<option name="project" value="LOCAL" />
<updated>1764922474117</updated>
</task>
<option name="localTasksCounter" value="4" />
<task id="LOCAL-00004" summary="添加app子服务">
<option name="closed" value="true" />
<created>1764922497215</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1764922497215</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -212,16 +285,12 @@
<MESSAGE value="修改新增用户" />
<MESSAGE value="自动登录" />
<MESSAGE value="添加app子服务" />
<option name="LAST_COMMIT_MESSAGE" value="添加app子服务" />
<MESSAGE value="用户管理及下拉选查询接口开发" />
<option name="LAST_COMMIT_MESSAGE" value="用户管理及下拉选查询接口开发" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/manager/controller/UserController.java</url>
<line>58</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/manager/service/impl/UserServiceImpl.java</url>
<line>93</line>
@ -232,6 +301,15 @@
<line>126</line>
<option name="timeStamp" value="6" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/hn-ldlz/ldlz-system/src/main/java/com/bns/system/mapper/SysUserPostMapper.java</url>
<line>42</line>
<properties class="com.bns.system.mapper.SysUserPostMapper" method="batchUserPost">
<option name="EMULATED" value="true" />
<option name="WATCH_EXIT" value="false" />
</properties>
<option name="timeStamp" value="17" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>

View File

@ -135,6 +135,12 @@
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<!-- POI OOXML 依赖的 XML 处理包(必须) -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
@ -177,12 +183,7 @@
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<!-- poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<!--mysql-ssh-->
<dependency>
<groupId>com.jcraft</groupId>
@ -362,12 +363,7 @@
<artifactId>xlsx-streamer</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.27</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>

View File

@ -1,24 +1,19 @@
package com.bonus.hnrn.rnbmw.login.controller;
import com.bonus.hnrn.rnbmw.login.service.AllUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "系统用户管理")
@RestController
@RequestMapping("allUser")
public class AllUserController {
@Autowired
private AllUserService allUserService;
}

View File

@ -3,6 +3,7 @@ package com.bonus.hnrn.rnbmw.login.controller;
import com.bonus.hnrn.rnbmw.login.service.LoginService;
import com.bonus.hnrn.rnbmw.login.vo.AjaxResult;
import com.bonus.hnrn.rnbmw.login.vo.LoginFormVo;
import com.bonus.hnrn.rnbmw.login.vo.PublicUserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -30,4 +31,6 @@ public class LoginController {
}

View File

@ -1,26 +1,59 @@
package com.bonus.hnrn.rnbmw.login.controller;
import com.bonus.hnrn.rnbmw.login.service.AllUserService;
import com.bonus.hnrn.rnbmw.login.service.PublicLoginService;
import com.bonus.hnrn.rnbmw.login.vo.AjaxResult;
import com.bonus.hnrn.rnbmw.login.vo.AllUserVo;
import com.bonus.hnrn.rnbmw.login.vo.LoginForm;
import com.bonus.hnrn.rnbmw.manager.dao.UserDao;
import com.bonus.hnrn.rnbmw.manager.entity.OrgBean;
import com.bonus.hnrn.rnbmw.manager.entity.ZNode;
import com.bonus.hnrn.rnbmw.manager.model.SysUser;
import com.bonus.hnrn.rnbmw.manager.service.OrgService;
import com.bonus.hnrn.rnbmw.manager.table.PageTableHandler;
import com.bonus.hnrn.rnbmw.manager.table.PageTableRequest;
import com.bonus.hnrn.rnbmw.manager.table.PageTableResponse;
import com.bonus.hnrn.rnbmw.register.beans.RegisterBean;
import com.bonus.hnrn.rnbmw.register.service.RegisterService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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 javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* 默认公共登录方法
*/
@RestController
@RequestMapping(value = "/publicLogin")
@Slf4j
public class PublicLoginController {
@Autowired
private PublicLoginService loginService;
@Autowired
private AllUserService allUserService;
@Autowired
private OrgService orgService;
@Resource
private UserDao userDao;
@Resource(name = "RegisterService")
private RegisterService registerService;
/**
* 系统登录
* @param token
@ -32,6 +65,125 @@ public class PublicLoginController {
}
@PostMapping("getUserList")
@ApiOperation(value = "用户管理-列表查询")
public PageTableResponse getUserList(PageTableRequest request) {
return new PageTableHandler(new PageTableHandler.CountHandler() {
@Override
public int count(PageTableRequest request) {
return allUserService.getUserListCount(request.getParams());
}
}, new PageTableHandler.ListHandler() {
@Override
public List<AllUserVo> list(PageTableRequest request) {
return allUserService.allUserService(request.getParams(), request.getOffset(), request.getLimit());
}
}).handle(request);
}
@PostMapping("addUserData")
@ApiOperation(value = "用户管理-新增用户")
public AjaxResult addUserData(@RequestBody AllUserVo vo) {
return allUserService.addUserData(vo);
}
@PostMapping("updateUserData")
@ApiOperation(value = "用户管理-修改用户")
public AjaxResult updateUserData(@RequestBody AllUserVo vo) {
return allUserService.updateUserData(vo);
}
@PostMapping("updatePassword")
@ApiOperation(value = "用户管理-修改密码")
public AjaxResult updatePassword(@RequestBody AllUserVo vo) {
return allUserService.updatePassword(vo);
}
@PostMapping("resetPassword")
@ApiOperation(value = "用户管理-重置密码")
public AjaxResult resetPassword(@RequestBody AllUserVo vo) {
return allUserService.resetPassword(vo);
}
@PostMapping("delUserData")
@ApiOperation(value = "用户管理-删除用户")
public AjaxResult delUserData(@RequestBody AllUserVo vo) {
return allUserService.delUserData(vo);
}
@PostMapping("getDeptTree")
@ApiOperation(value = "获取部门树")
public AjaxResult getDeptTree() {
OrgBean bean=new OrgBean();
List<ZNode> list= orgService.getCompanyTree(bean);
return AjaxResult.success(list);
}
/**
* 角色下拉选
* @param
* @return
*/
@PostMapping("getRoleList")
@ApiOperation(value = "获取角色下拉选")
public AjaxResult getRoleList(SysUser user) {
int lv=userDao.getOrgLv(user);
user.setRoleLevel(lv+"");
List<SysUser> roleInfo = userDao.getRoleInfo(user);
return AjaxResult.success(roleInfo);
}
/**
* 角色下拉选
* @param
* @return
*/
@PostMapping("getProList")
@ApiOperation(value = "工程下拉选")
public AjaxResult getProList(SysUser user) {
int lv=userDao.getOrgLv(user);
user.setRoleLevel(lv+"");
List<SysUser> roleInfo = userDao.getRoleInfo(user);
return AjaxResult.success(roleInfo);
}
/**
* 角色下拉选
* @param
* @return
*/
@PostMapping("getSubList")
@ApiOperation(value = "分包商下拉选")
public AjaxResult getSubList(RegisterBean vo) {
List<RegisterBean> sub = new ArrayList<>();
try {
sub = registerService.findSubList(vo);
} catch (Exception e) {
log.error(e.toString(),e);
}
return AjaxResult.success(sub);
}
/**
* 角色下拉选
* @param
* @return
*/
@PostMapping("getTeamList")
@ApiOperation(value = "班组下拉选")
public AjaxResult getTeamList(RegisterBean vo) {
List<RegisterBean> team = new ArrayList<>();
try {
team = registerService.findTeamList(vo);
} catch (Exception e) {
log.error(e.toString(),e);
}
return AjaxResult.success(team);
}

View File

@ -1,7 +1,101 @@
package com.bonus.hnrn.rnbmw.login.dao;
import com.bonus.hnrn.rnbmw.login.vo.AllUserVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface AllUserDao {
/**
* 查询用户数据数量
* @param params
* @return
*/
int getUserListCount(@Param("params") Map<String, Object> params);
/**
* 查询用户数据信息
* @param params
* @param offset
* @param limit
* @return
*/
List<AllUserVo> allUserService(@Param("params")Map<String, Object> params, @Param("offset")Integer offset, @Param("limit")Integer limit);
/**
* 查询数据是否存在
* @param data
* @return
*/
int getUserCount(AllUserVo data);
/**
* 新增用户信息
* @param vo
* @return
*/
int addUserData(AllUserVo vo);
/**
* 修改用户数据
* @param vo
* @return
*/
int updateUserData(AllUserVo vo);
/**
* 删除用户数据
* @param vo
* @return
*/
int delUserData(AllUserVo vo);
/**
* 查询用户数据
* @param vo
* @return
*/
AllUserVo getUserData(AllUserVo vo);
/**
* 修改密码
* @param vo
* @return
*/
int updatePassword(AllUserVo vo);
/**
* 查询实名制用户
* @param vo
* @return
*/
String getSmzUserByName(AllUserVo vo);
/**
* 新增实名制用户
* @param vo
*/
void addSmzUser(AllUserVo vo);
/**
* 添加用户权限
* @param vo
*/
void addUserRole(AllUserVo vo);
/**
* 更新实名制用户
* @param vo
*/
void updateSmzUser(AllUserVo vo);
/**
* 删除实名制用户角色权限
* @param vo
*/
void delUserRole(AllUserVo vo);
}

View File

@ -1,7 +1,227 @@
package com.bonus.hnrn.rnbmw.login.service;
import com.bonus.hnrn.rnbmw.login.dao.AllUserDao;
import com.bonus.hnrn.rnbmw.login.vo.AjaxResult;
import com.bonus.hnrn.rnbmw.login.vo.AllUserVo;
import com.bonus.hnrn.rnbmw.manager.utils.StringHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class AllUserService {
@Autowired
private AllUserDao allUserDao;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
/**
* 查询数据表格集合
* @param params
* @return
*/
public int getUserListCount(Map<String, Object> params) {
try{
return allUserDao.getUserListCount(params);
}catch (Exception e){
log.error(e.toString(),e);
}
return 0;
}
/**
* 查询数据信息
* @param params
* @param offset
* @param limit
* @return
*/
public List<AllUserVo> allUserService(Map<String, Object> params, Integer offset, Integer limit) {
try{
return allUserDao.allUserService(params,offset,limit);
}catch (Exception e){
log.error(e.toString(),e);
}
return new ArrayList<AllUserVo>();
}
/**
* 新增用户管理
* @param vo
* @return
*/
public AjaxResult addUserData(AllUserVo vo) {
try{
AllUserVo data=new AllUserVo();
data.setLoginName(vo.getLoginName());
int isCz=allUserDao.getUserCount(data);
if(isCz>0){
return AjaxResult.error("登录昵称已存在");
}
data=new AllUserVo();
data.setUserPhone(vo.getUserPhone());
isCz=allUserDao.getUserCount(data);
if(isCz>0){
return AjaxResult.error("手机号已被注册");
}
data=new AllUserVo();
data.setIdCard(vo.getIdCard());
isCz=allUserDao.getUserCount(data);
if(isCz>0){
return AjaxResult.error("身份证号码已被注册");
}
if(StringHelper.isEmpty(vo.getPassword())){
vo.setPassword("Hnsbd@admin123");
}
String password= passwordEncoder.encode(vo.getPassword());
vo.setPassword(password);
int num=allUserDao.addUserData(vo);
if(num>0){
addSmzUser(vo);
return AjaxResult.success("添加成功");
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("添加失败");
}
/**
* 添加实名制用户细腻系
* @param vo
*/
private void addSmzUser(AllUserVo vo) {
try{
String id=allUserDao.getSmzUserByName(vo);
if(StringHelper.isEmpty(id)){
//新增用户信息
allUserDao.addSmzUser(vo);
allUserDao.addUserRole(vo);
}else{
vo.setId(id);
allUserDao.updateSmzUser(vo);
allUserDao.delUserRole(vo);
allUserDao.addUserRole(vo);
}
}catch (Exception e){
log.error(e.toString(),e);
}
}
/**
* 查询修改用户数据
* @param vo
* @return
*/
public AjaxResult updateUserData(AllUserVo vo) {
try{
if(StringHelper.isNotEmpty(vo.getUserPhone())){
AllUserVo data=new AllUserVo();
data.setId(vo.getId());
data.setUserPhone(vo.getUserPhone());
int isCz=allUserDao.getUserCount(data);
if(isCz>0){
return AjaxResult.error("手机号已被注册");
}
}
if(StringHelper.isNotEmpty(vo.getIdCard())){
AllUserVo data=new AllUserVo();
data.setId(vo.getId());
data.setIdCard(vo.getIdCard());
int isCz=allUserDao.getUserCount(data);
if(isCz>0){
return AjaxResult.error("身份证号码已被注册");
}
int num=allUserDao.updateUserData(vo);
if(num>0){
addSmzUser(vo);
return AjaxResult.success("修改成功");
}
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("修改失败");
}
/**
* 修改密码
* @param vo
* @return
*/
public AjaxResult updatePassword(AllUserVo vo) {
try{
AllUserVo data=allUserDao.getUserData(vo);
if(data==null){
return AjaxResult.error("用户不存在");
}else{
String newPassword= passwordEncoder.encode(vo.getNewPassword());
if (!passwordEncoder.matches(vo.getPassword(), data.getPassword())) {
return AjaxResult.error("旧密码错误!");
}
vo.setNewPassword(newPassword);
int num=allUserDao.updatePassword(vo);
if(num>0){
return AjaxResult.success("修改成功");
}
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("修改失败");
}
/**
* 删除用户
* @param vo
* @return
*/
public AjaxResult delUserData(AllUserVo vo) {
try{
int num=allUserDao.delUserData(vo);
if(num>0){
return AjaxResult.success("删除成功");
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("删除失败");
}
/**
* 重置密码
* @param vo
* @return
*/
public AjaxResult resetPassword(AllUserVo vo) {
try{
AllUserVo data=allUserDao.getUserData(vo);
if(data==null){
return AjaxResult.error("用户不存在");
}else{
String newPassword= passwordEncoder.encode("Hnsbd@admin123");
vo.setNewPassword(newPassword);
int num=allUserDao.updatePassword(vo);
if(num>0){
return AjaxResult.success("修改成功");
}
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("修改失败");
}
}

View File

@ -3,6 +3,7 @@ package com.bonus.hnrn.rnbmw.login.service;
import com.bonus.hnrn.rnbmw.login.dao.LoginDao;
import com.bonus.hnrn.rnbmw.login.vo.AjaxResult;
import com.bonus.hnrn.rnbmw.login.vo.LoginFormVo;
import com.bonus.hnrn.rnbmw.login.vo.PublicUserVo;
import com.bonus.hnrn.rnbmw.manager.utils.AESCBCUtils;
import com.github.pagehelper.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
@ -59,8 +60,4 @@ public class LoginService {
}
}

View File

@ -0,0 +1,98 @@
package com.bonus.hnrn.rnbmw.login.vo;
import lombok.Data;
@Data
public class AllUserVo {
private String id;
/**
* 用户名称
*/
private String userName;
/**
* 用户名称
*/
private String loginName;
/**
* 密码
*/
private String password;
/**
* 手机号
*/
private String userPhone;
/**
* 数据权限
*/
private String dataType;
/**
* 身份证号码
*/
private String idCard;
/**
* json数据
*/
private String jsonData;
/**
* 创建时间
*/
private String createTime;
/**
* 更新时间
*/
private String updateTime;
/**
* 管理员权限
*/
private String isAdmin;
/**
* 关键字
*/
private String keyWord;
/**
* 新密码
*/
private String newPassword;
/**
* 角色id
*/
private String roleId;
/**
* 组织机构id
*/
private String orgId;
/**
* 工程名称
*/
private String proName;
/**
* 工程id
*/
private String proId;
/**
* 分包商id
*/
private String subId;
/**
* 分包商名称
*/
private String subName;
/**
* 班组id
*/
private String teamId;
/**
* 班组名称
*/
private String teamName;
/**
* 权限类型
*/
private String type;
/**
* 是否自有人员
*/
private String isFree;
}

View File

@ -0,0 +1,47 @@
package com.bonus.hnrn.rnbmw.login.vo;
import lombok.Data;
@Data
public class PublicUserVo {
private String id;
/**
* 用户名称
*/
private String userName;
/**
* 用户名称
*/
private String loginName;
/**
* 密码
*/
private String password;
/**
* 手机号
*/
private String userPhone;
/**
* 身份证号码
*/
private String idCard;
/**
* json数据
*/
private String jsonData;
/**
* 角色id
*/
private String roleId;
/**
* 组织机构id
*/
private String orgId;
private String status;
private String isActive;
}

View File

@ -1,6 +1,5 @@
package com.bonus.hnrn.rnbmw.manager.config;
import com.bonus.hnrn.rnbmw.manager.filter.SecurityFilter;
import com.bonus.hnrn.rnbmw.manager.filter.TokenFilter;
import com.bonus.hnrn.rnbmw.manager.filter.VerifyFilter;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,7 +18,6 @@ import org.springframework.security.web.authentication.AuthenticationFailureHand
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
/**
* spring security配置
@ -58,7 +56,7 @@ public class BnsSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
// 添加安全过滤器在认证前执行 -- 防御 sql 注入攻击 xss 攻击
http.addFilterBefore(new SecurityFilter(), BasicAuthenticationFilter.class);
// http.addFilterBefore(new SecurityFilter(), BasicAuthenticationFilter.class);
// 添加安全过滤器在认证前执行 -- CSP
// http.addFilterBefore(new CspFilter(), BasicAuthenticationFilter.class);
http.csrf().disable();
@ -69,7 +67,7 @@ public class BnsSecurityConfig extends WebSecurityConfigurerAdapter {
http.authorizeRequests()
.antMatchers("/", "/gzRealName/**","/attendance/**","/*.html", "/favicon.ico", "/css/**", "/js/**", "/fonts/**", "/layui/**", "/layui-v2.9.2/**","/layui2.3.6/**", "/layer-v3.1.0/**","/img/**",
"/v2/api-docs/**", "/swagger-resources/**", "/webjars/**", "/pages/**", "/druid/**","/interface/**","/publicLogin/**",
"/statics/**","/download/**","/allSystem/login","/register/**","/companyManager/resetUserPwd","/getCode/**","/OwnContract/updateDownloadState")
"/statics/**","/download/**","/allSystem/login","/allUser/**","/register/**","/companyManager/resetUserPwd","/getCode/**","/OwnContract/updateDownloadState")
.permitAll().
anyRequest().authenticated();
http.formLogin().loginProcessingUrl("/login")

View File

@ -12,8 +12,8 @@ import java.io.IOException;
* 额外的安全头过滤器
* 用于设置更多的安全相关头信息
*/
@Component
@Order(2)
//@Component
//@Order(2)
public class SecurityHeadersFilter implements Filter {
@Override

View File

@ -31,6 +31,8 @@ public class OrgController {
@Autowired
private OrgService service;
@Resource
private UserDao userDao;

View File

@ -3,7 +3,119 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.hnrn.rnbmw.login.dao.AllUserDao">
<insert id="addUserData">
insert into all_system_user(user_name , login_name ,
password , data_type , create_time ,
update_time , is_admin , id_card ,
json_data , user_phone
) values (
#{userName},#{loginName},#{password},#{dataType},now(),now(),#{isAdmin},#{idCard},#{jsonData},#{userPhone}
)
</insert>
<insert id="addSmzUser" keyProperty="id" useGeneratedKeys="true">
insert into sys_user(
username,loginname,phone, id_number,
type, role_id, org_id, pro_id,
sub_id, team_id, post_id, password, sex,
status, create_type,
examine_status, createTime,
updateTime, is_free, is_active)
values (#{userName},#{loginName},#{loginName},#{idCard},#{type},#{roleId},#{orgId},#{proId},#{subId},#{teamId},#{orgId},#{password},
1,1,2,1,now(),now(),#{isFree},1)
</insert>
<insert id="addUserRole">
insert into sys_role_user(roleId, userId) values
(#{roleId}, #{id})
</insert>
<update id="updateUserData">
update all_system_user set user_name=#{userName},data_type=#{dataType},
update_time=now(),is_admin=#{isAdmin},id_card=#{idCard},json_data=#{jsonData}
user_phone=#{userPhone}
</update>
<update id="updatePassword">
update all_system_user set password=#{newPassword}
where id=#{id}
</update>
<update id="updateSmzUser">
update sys_user set username=#{userName},loginname=#{loginName},phone=#{loginName},id_number=#{idCard},type=#{type},
role_id=#{roleId}, org_id=#{orgId}, pro_id=#{proId},sub_id=#{subId},team_id=#{teamId},post_id=#{roleId},
updateTime=now(),is_free=#{isFree}
where id=#{id}
</update>
<delete id="delUserData">
delete from all_system_user where id=#{id}
</delete>
<delete id="delUserRole">
delete from sys_role_user where userId=#{id}
</delete>
<select id="getUserListCount" resultType="java.lang.Integer">
select count(1)
from all_system_user
<where>
<if test="params != null and params.size() > 0">
<if test="params.keyWord != null and params.keyWord !=''">
and (instr(user_name,#{params.keyWord}) &gt; 0 or
instr(login_name,#{params.keyWord}) &gt; 0 or
instr(id_card,#{params.keyWord}) &gt; 0 or
instr(user_phone,#{params.keyWord}) &gt; 0
)
</if>
</if>
</where>
</select>
<select id="allUserService" resultType="com.bonus.hnrn.rnbmw.login.vo.AllUserVo">
select id , user_name userName, login_name loginName,
password password, data_type dataType, create_time createTime,
update_time updateTime, is_admin isAdmin, id_card idCard,
json_data jsonData, user_phone userPhone
from all_system_user
<where>
<if test="params != null and params.size() > 0">
<if test="params.keyWord != null and params.keyWord !=''">
and (instr(user_name,#{params.keyWord}) &gt; 0 or
instr(login_name,#{params.keyWord}) &gt; 0 or
instr(id_card,#{params.keyWord}) &gt; 0 or
instr(user_phone,#{params.keyWord}) &gt; 0
)
</if>
</if>
</where>
ORDER BY id desc
limit #{offset}, #{limit}
</select>
<select id="getUserCount" resultType="java.lang.Integer">
select count(1)
from all_system_user
<where>
<if test="id!=null and id!=''">
and id!=#{id}
</if>
<if test="loginName!=null and loginName!=''">
and login_name=#{loginName}
</if>
<if test="idCard!=null and idCard!=''">
and id_card=#{idCard}
</if>
<if test="userPhone!=null and userPhone!=''">
and user_phone=#{userPhone}
</if>
</where>
</select>
<select id="getUserData" resultType="com.bonus.hnrn.rnbmw.login.vo.AllUserVo">
select id , user_name userName, login_name loginName,
password password, data_type dataType, create_time createTime,
update_time updateTime, is_admin isAdmin, id_card idCard,
json_data jsonData, user_phone userPhone
from all_system_user
where id=#{id}
</select>
<select id="getSmzUserByName" resultType="java.lang.String">
select id
FROM sys_user
WHERE is_active=1 and phone=#{loginName}
</select>
</mapper>

View File

@ -2,6 +2,15 @@ package com.bonus.hn.bearing.capacity.backstage.login.controller;
import com.bonus.hn.bearing.capacity.backstage.login.service.PublicLoginService;
import com.bonus.hn.bearing.capacity.backstage.login.vo.LoginForm;
import com.bonus.hn.bearing.capacity.backstage.login.vo.PublicUserVo;
import com.bonus.hn.bearing.capacity.backstage.manager.annotation.LogAnnotation;
import com.bonus.hn.bearing.capacity.backstage.manager.entity.MapBean;
import com.bonus.hn.bearing.capacity.backstage.manager.entity.ZNode;
import com.bonus.hn.bearing.capacity.backstage.manager.service.UserService;
import com.bonus.hn.bearing.capacity.backstage.manager.utils.AjaxRes;
import com.bonus.hn.bearing.capacity.backstage.manager.utils.GlobalConst;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -9,17 +18,23 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* 默认公共登录方法
*/
@RestController
@Slf4j
@RequestMapping(value = "/publicLogin")
public class PublicLoginController {
@Autowired
private PublicLoginService loginService;
@Autowired
private UserService userService;
/**
* 系统登录
* @param token
@ -31,6 +46,44 @@ public class PublicLoginController {
}
@LogAnnotation
@PostMapping("addUser")
@ApiOperation(value = "新增用户")
public AjaxRes addUser(@RequestBody PublicUserVo vo) {
return loginService.addUser(vo);
}
@PostMapping("getDeptTree")
@ApiOperation(value = "获取部门树")
public AjaxRes getDeptTree() {
try{
List<MapBean> result = userService.getRole();
return AjaxRes.success(result);
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxRes.success(new ArrayList<MapBean>());
}
/**
* 角色下拉选
* @param
* @return
*/
@PostMapping("getRoleList")
@ApiOperation(value = "获取角色下拉选")
public AjaxRes getRoleList() {
AjaxRes ar = new AjaxRes();
try {
List<ZNode> list = userService.getDepartmentTree();
ar.setSucceed(list);
} catch (Exception e) {
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}

View File

@ -0,0 +1,38 @@
package com.bonus.hn.bearing.capacity.backstage.login.dao;
import com.bonus.hn.bearing.capacity.backstage.login.vo.PublicUserVo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PublicLoginDao {
/**
* 依据用户名查询
* @param vo
* @return
*/
PublicUserVo getUserByName(PublicUserVo vo);
/**
* 新增用户
* @param vo
*/
void addUser(PublicUserVo vo);
/**
* 新增用户角色
* @param vo
*/
void addUserRole(PublicUserVo vo);
/**
* 更新用户信息
* @param data
*/
void updateUser(PublicUserVo data);
/**
* 删除用户角色
* @param vo
*/
void delUserRole(PublicUserVo vo);
}

View File

@ -1,7 +1,9 @@
package com.bonus.hn.bearing.capacity.backstage.login.service;
import com.bonus.hn.bearing.capacity.backstage.login.dao.PublicLoginDao;
import com.bonus.hn.bearing.capacity.backstage.login.vo.LoginForm;
import com.bonus.hn.bearing.capacity.backstage.login.vo.PublicUserVo;
import com.bonus.hn.bearing.capacity.backstage.manager.dao.PermissionDao;
import com.bonus.hn.bearing.capacity.backstage.manager.dao.UtilDao;
import com.bonus.hn.bearing.capacity.backstage.manager.entity.LoginUser;
@ -10,6 +12,7 @@ import com.bonus.hn.bearing.capacity.backstage.manager.model.Permission;
import com.bonus.hn.bearing.capacity.backstage.manager.model.SysUser;
import com.bonus.hn.bearing.capacity.backstage.manager.service.TokenService;
import com.bonus.hn.bearing.capacity.backstage.manager.service.UserService;
import com.bonus.hn.bearing.capacity.backstage.manager.utils.AjaxRes;
import com.bonus.hn.bearing.capacity.backstage.manager.utils.ResponseUtil;
import com.bonus.hn.bearing.capacity.backstage.utils.Aes;
import lombok.extern.slf4j.Slf4j;
@ -21,6 +24,7 @@ import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.LockedException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -49,6 +53,12 @@ public class PublicLoginService {
@Autowired
private TokenService tokenService;
@Autowired
private PublicLoginDao dao;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
/**
* 系统登录
* @param us
@ -90,7 +100,6 @@ public class PublicLoginService {
b.setMonth(formattedYearMonth);
b.setUserId(sysUser.getId().toString());
utilDao.insertLoginInfo(b);
//创建token
Token token = tokenService.saveToken(loginUser);
token.setCode("200");
@ -100,4 +109,31 @@ public class PublicLoginService {
log.error(e.toString(),e);
}
}
/**
* 新增用户数据
* @param vo
* @return
*/
public AjaxRes addUser(PublicUserVo vo) {
try{
vo.setPassword(passwordEncoder.encode("Hnsbd@admin123"));
PublicUserVo data=dao.getUserByName(vo);
if(data==null){
//新增用户及角色关联信息
dao.addUser(vo);
dao.addUserRole(vo);
}else{
vo.setId(data.getId());
//修改用户角色信息
dao.updateUser(vo);
dao.delUserRole(vo);
dao.addUserRole(vo);
}
return AjaxRes.success("添加成功");
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxRes.error("添加失败");
}
}

View File

@ -0,0 +1,47 @@
package com.bonus.hn.bearing.capacity.backstage.login.vo;
import lombok.Data;
@Data
public class PublicUserVo {
private String id;
/**
* 用户名称
*/
private String userName;
/**
* 用户名称
*/
private String loginName;
/**
* 密码
*/
private String password;
/**
* 手机号
*/
private String userPhone;
/**
* 身份证号码
*/
private String idCard;
/**
* json数据
*/
private String jsonData;
/**
* 角色id
*/
private String roleId;
/**
* 组织机构id
*/
private String orgId;
private String status;
private String isActive;
}

View File

@ -27,8 +27,7 @@ public interface UserDao {
@Select("select t.ID,t.username,t.login_name as loginName,t.phone, t.nickname,t.type,t.role_id as roleId, t.org_id as orgId, t.password, t.status,t.createTime from sys_user t where t.id = #{id}")
SysUser getById(Long id);
@Select("select t.* ,t.role_id as roleId,t.org_id as orgId,t.org_id as orgId,so.`level`,so.org_name as department,so.parent_id as pId FROM sys_user t LEFT JOIN sys_organization so on so.id = t.org_id where t.phone = #{username} and t.is_active = '1'")
SysUser getUser(String username);
SysUser getUser(@Param("username") String username);
@Update("update sys_user t set t.password = #{password} where t.id = #{id}")
int changePassword(@Param("id") Long id, @Param("password") String password);

View File

@ -20,7 +20,9 @@ public class AjaxRes implements Serializable {
* 返回对象
*/
private Object obj;
public int getRes() {
return res;
}
@ -84,7 +86,35 @@ public class AjaxRes implements Serializable {
this.obj = obj;
this.setRes(GlobalConst.SUCCEED);
}
public static AjaxRes success(String resMsg) {
AjaxRes ajaxRes = new AjaxRes();
ajaxRes.setResMsg(resMsg);
ajaxRes.setRes(GlobalConst.SUCCEED);
return ajaxRes;
}
public static AjaxRes error(String resMsg) {
AjaxRes ajaxRes = new AjaxRes();
ajaxRes.setResMsg(resMsg);
ajaxRes.setRes(GlobalConst.FAIL);
return ajaxRes;
}
public static AjaxRes success(String resMsg,Object data) {
AjaxRes ajaxRes = success(resMsg);
ajaxRes.setObj(data);
return ajaxRes;
}
public static AjaxRes success(Object data) {
AjaxRes ajaxRes = new AjaxRes();
ajaxRes.setResMsg("success");
ajaxRes.setRes(GlobalConst.SUCCEED);
ajaxRes.setObj(data);
return ajaxRes;
}
/**
* 设置成功值
*

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.hn.bearing.capacity.backstage.login.dao.PublicLoginDao">
<insert id="addUser" useGeneratedKeys="true" keyProperty="id">
insert into sys_user(
username,login_name, phone, nickname,role_id,org_id,
password, sex, status, createTime, updateTime,is_active
)values (#{userName},#{loginName},#{loginName},#{userPhone},#{roleId},#{orgId},#{password},1,1,now(),now(),1)
</insert>
<insert id="addUserRole">
insert into sys_role_user(roleId, userId) values(#{roleId},#{id})
</insert>
<update id="updateUser">
update sys_user set username=#{userName},login_name=#{loginName}, nickname=#{userPhone},
role_id=#{roleId},org_id=#{orgId},status=1,password=#{password}
where id=#{id}
</update>
<delete id="delUserRole">
delete from sys_role_user where userId=#{id}
</delete>
<select id="getUserByName" resultType="com.bonus.hn.bearing.capacity.backstage.login.vo.PublicUserVo">
select id ,username userName,login_name loginName,phone userPhone,
nickname,role_id roleId,org_id orgId,status,is_active isActive
from sys_user
where is_active=1 and phone=#{loginName}
</select>
</mapper>

View File

@ -148,6 +148,12 @@
from bm_tower
where pro_id = #{proId} and lon = ''
</select>
<select id="getUser" resultType="com.bonus.hn.bearing.capacity.backstage.manager.model.SysUser">
select t.* ,t.role_id as roleId,t.org_id as orgId,t.org_id as orgId,so.`level`,so.org_name as department,so.parent_id as pId
FROM sys_user t
LEFT JOIN sys_organization so on so.id = t.org_id
where t.phone = #{username} and t.is_active = '1'
</select>
<insert id="saveUserRoles">
insert into sys_role_user(roleId, userId) values

View File

@ -43,18 +43,22 @@ public class AuthFilter implements GlobalFilter, Ordered {
private RedisService redisService;
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpRequest request = exchange.getRequest();
ServerHttpRequest.Builder mutate = request.mutate();
String url = request.getURI().getPath();
if(!url.endsWith("/publicLogin/defaultLogin")){
//public 都是单独走的网关鉴权
if(!PathMatchUtil.isPublicLoginPath(url)){
// 跳过不需要验证的路径
if (StringUtils.matches(url, ignoreWhite.getWhites())) {
return chain.filter(exchange);
}
}
String token = getToken(request);
if (StringUtils.isEmpty(token) || "null".equals(token)) {
return unauthorizedResponse(exchange, "令牌不能为空");

View File

@ -0,0 +1,22 @@
package com.bonus.gateway.filter;
import org.springframework.util.AntPathMatcher;
/**
* 路径匹配工具类
*/
public class PathMatchUtil {
// 初始化 AntPathMatcher单例线程安全
private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
/**
* 判断请求路径是否匹配 /publicLogin/** 规则
* @param requestPath 请求路径 /publicLogin/login/publicLogin/api/user
* @return true=匹配false=不匹配
*/
public static boolean isPublicLoginPath(String requestPath) {
// 匹配规则/publicLogin/**
String pattern = "/publicLogin/**";
return PATH_MATCHER.match(pattern, requestPath);
}
}

View File

@ -34,17 +34,31 @@
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger3-->
<!-- 移除你原来的 Swagger3 依赖,替换为这个 -->
<!-- Springfox 2.8.0 核心依赖(兼容 Spring Boot 2.1.x -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
<exclusions>
<!-- 1. 排除冲突的 spring-plugin与 Spring Boot 2.1.1 自带版本冲突) -->
<exclusion>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<!-- 手动引入 spring-plugin-coreSpringfox 2.8.0 必需,与 Spring Boot 2.1.1 兼容) -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
<!-- Swagger UI 界面依赖必须单独引入2.8.0 没有 starter 整合) -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
<!-- Mysql驱动包 -->

View File

@ -0,0 +1,80 @@
package com.bns.ldlz.controller;
import com.bns.common.constant.Constants;
import com.bns.common.core.controller.BaseController;
import com.bns.common.core.domain.AjaxResult;
import com.bns.common.core.domain.entity.SysDept;
import com.bns.common.core.domain.entity.SysRole;
import com.bns.ldlz.domain.LoginForm;
import com.bns.ldlz.domain.PublicUserVo;
import com.bns.ldlz.service.impl.PublicLoginService;
import com.bns.system.service.ISysDeptService;
import com.bns.system.service.ISysRoleService;
import io.swagger.annotations.ApiOperation;
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 javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 默认公共登录方法
*/
@RestController
@RequestMapping(value = "/publicLogin")
public class PublicLoginController extends BaseController {
@Autowired
private PublicLoginService loginService;
@Autowired
private ISysDeptService deptService;
@Autowired
private ISysRoleService roleService;
/**
* loginForm
* @param
* @param response
*/
@PostMapping("defaultLogin")
public AjaxResult login(@RequestBody LoginForm loginForm, HttpServletResponse response) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginForm,response);
ajax.put(Constants.TOKEN, token);
return ajax;
}
@PostMapping("addUser")
@ApiOperation(value = "新增用户")
public AjaxResult addUser(@RequestBody PublicUserVo vo) {
return loginService.addUser(vo);
}
@PostMapping("getDeptTree")
@ApiOperation(value = "获取部门树")
public AjaxResult getDeptTree(@RequestBody SysDept dept) {
return success(deptService.selectPublicDeptTreeList(dept));
}
/**
* 角色下拉选
* @param vo
* @return
*/
@PostMapping("getRoleList")
@ApiOperation(value = "获取角色下拉选")
public AjaxResult getRoleList(@RequestBody PublicUserVo vo) {
List<SysRole> roles = roleService.selectPublicRoleAll();
return success(roles);
}
}

View File

@ -0,0 +1,11 @@
package com.bns.ldlz.domain;
import lombok.Data;
@Data
public class LoginForm {
private String username;
private String type;
}

View File

@ -0,0 +1,51 @@
package com.bns.ldlz.domain;
import lombok.Data;
@Data
public class PublicUserVo {
private String id;
/**
* 用户名称
*/
private String userName;
/**
* 用户名称
*/
private String loginName;
/**
* 密码
*/
private String password;
/**
* 手机号
*/
private String userPhone;
/**
* 身份证号码
*/
private String idCard;
/**
* json数据
*/
private String jsonData;
/**
* 角色id
*/
private String roleId;
/**
* 组织机构id
*/
private String orgId;
private String status;
private String isActive;
/**
* 是否是管理员
*/
private String isLeader;
}

View File

@ -2,7 +2,6 @@ package com.bns.ldlz.domain.bo;
import com.bns.common.annotation.Excel;
import com.bns.common.core.domain.BaseEntity;
import io.swagger.models.auth.In;
import lombok.Data;
import java.math.BigDecimal;

View File

@ -0,0 +1,44 @@
package com.bns.ldlz.mapper;
import com.bns.ldlz.domain.PublicUserVo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PublicLoginMapper {
/**
* 依据登录信息查询用户
* @param vo
* @return
*/
public String getUserIdByLoginName(PublicUserVo vo) ;
/**
* 新增用户信息
* @param vo
*/
void addUserData(PublicUserVo vo);
/**
* 新增用户岗位信息
* @param vo
*/
void inserUserPost(PublicUserVo vo);
/**
* 新增用户角色信息
* @param vo
*/
void insertUserRole(PublicUserVo vo);
/**
* 更新用户数据
* @param vo
*/
void updateUserData(PublicUserVo vo);
/**
* 删除用户决赛
* @param vo
*/
void delUserRole(PublicUserVo vo);
}

View File

@ -0,0 +1,127 @@
package com.bns.ldlz.service.impl;
import com.bns.common.core.domain.AjaxResult;
import com.bns.common.core.domain.entity.SysUser;
import com.bns.common.core.domain.model.LoginUser;
import com.bns.common.enums.UserStatus;
import com.bns.common.exception.ServiceException;
import com.bns.common.utils.DateUtils;
import com.bns.common.utils.MessageUtils;
import com.bns.common.utils.SecurityUtils;
import com.bns.common.utils.StringUtils;
import com.bns.common.utils.ip.IpUtils;
import com.bns.framework.web.service.SysPermissionService;
import com.bns.framework.web.service.TokenService;
import com.bns.ldlz.domain.LoginForm;
import com.bns.ldlz.domain.PublicUserVo;
import com.bns.ldlz.mapper.PublicLoginMapper;
import com.bns.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.LockedException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* 系统登录
*/
@Service
@Slf4j
public class PublicLoginService {
@Autowired
private PublicLoginMapper mapper;
@Autowired
private ISysUserService userService;
@Autowired
private SysPermissionService permissionService;
@Autowired
private TokenService tokenService;
/**
* 系统登录
* @param us
* @param response
*/
public String login(LoginForm us, HttpServletResponse response) {
String username = us.getUsername();
SysUser user = userService.selectUserByUserName(us.getUsername());
if (StringUtils.isNull(user))
{
log.info("登录用户:{} 不存在.", username);
throw new ServiceException(MessageUtils.message("user.not.exists"));
}
else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
{
log.info("登录用户:{} 已被删除.", username);
throw new ServiceException(MessageUtils.message("user.password.delete"));
}
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
{
log.info("登录用户:{} 已被停用.", username);
throw new ServiceException(MessageUtils.message("user.blocked"));
}
LoginUser userDetails=new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
recordLoginInfo(userDetails.getUserId());
// 生成token
return tokenService.createToken(userDetails);
}
/**
* 记录登录信息
*
* @param userId 用户ID
*/
public void recordLoginInfo(Long userId) {
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setLoginIp(IpUtils.getIpAddr());
sysUser.setLoginDate(DateUtils.getNowDate());
userService.updateUserProfile(sysUser);
}
/**
* 新增用户信息
* @param vo
* @return
*/
public AjaxResult addUser(PublicUserVo vo) {
try{
//默认密码
vo.setPassword(SecurityUtils.encryptPassword("Hnsbd@admin123"));
String id=mapper.getUserIdByLoginName(vo);
if(StringUtils.isNull(id)){
mapper.addUserData(vo);
// mapper.inserUserPost(vo);
mapper.insertUserRole(vo);
}else {
vo.setId(id);
mapper.updateUserData(vo);
mapper.delUserRole(vo);
// mapper.inserUserPost(vo);
mapper.insertUserRole(vo);
}
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("添加失败");
}
}

View File

@ -8,7 +8,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.bns.common.config.LdlzConfig;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
@ -21,15 +20,16 @@ import springfox.documentation.service.SecurityScheme;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2; // 2.8.0 必须加这个注解
/**
* Swagger2的接口配置
*
* Swagger2的接口配置适配 Springfox 2.8.0 + Spring Boot 2.1.1.RELEASE
*
* @author ldlv
*/
@Configuration
public class SwaggerConfig
{
@EnableSwagger2 // 关键Springfox 2.x 必须启用这个注解否则 Swagger 不生效
public class SwaggerConfig {
/** 系统基础配置 */
@Autowired
private LdlzConfig ldlzConfig;
@ -43,60 +43,50 @@ public class SwaggerConfig
private String pathMapping;
/**
* 创建API
* 创建API核心修改替换为 Swagger 2.0 DocumentationType
*/
@Bean
public Docket createRestApi()
{
return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) // 关键2.8.0 不支持 OAS_30改为 SWAGGER_2
.enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
.select()
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.bns.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) // 保留你的扫描逻辑
.paths(PathSelectors.any())
.build()
/* 设置安全模式swagger可以设置访问token */
.securitySchemes(securitySchemes())
.securitySchemes(securitySchemes()) // 保留token配置
.securityContexts(securityContexts())
.pathMapping(pathMapping);
}
/**
* 安全模式这里指定token通过Authorization头请求头传递
* 安全模式修改移除 3.x In.HEADER直接用字符串 "header"
*/
private List<SecurityScheme> securitySchemes()
{
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
private List<SecurityScheme> securitySchemes() {
List<SecurityScheme> apiKeyList = new ArrayList<>();
// 关键Springfox 2.x ApiKey 第三个参数直接传 "header"不是 In.HEADER.toValue()
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
return apiKeyList;
}
/**
* 安全上下文
* 安全上下文无修改2.8.0 兼容
*/
private List<SecurityContext> securityContexts()
{
private List<SecurityContext> securityContexts() {
List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add(
SecurityContext.builder()
.securityReferences(defaultAuth())
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
// 替代 operationSelector匹配所有路径的接口效果与原逻辑一致
.forPaths(PathSelectors.any())
.build());
return securityContexts;
}
/**
* 默认的安全引用
* 默认的安全引用无修改2.8.0 兼容
*/
private List<SecurityReference> defaultAuth()
{
private List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
@ -106,20 +96,14 @@ public class SwaggerConfig
}
/**
* 添加摘要信息
* 摘要信息无修改2.8.0 兼容
*/
private ApiInfo apiInfo()
{
// 用ApiInfoBuilder进行定制
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
// 设置标题
.title("标题领导履职管理系统_接口文档")
// 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息
.contact(new Contact(ldlzConfig.getName(), null, null))
// 版本
.version("版本号:" + ldlzConfig.getVersion())
.build();
}
}
}

View File

@ -95,7 +95,7 @@ pagehelper:
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
enabled: false
# 请求前缀
pathMapping: /dev-api

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bns.ldlz.mapper.PublicLoginMapper">
<insert id="addUserData" useGeneratedKeys="true" keyProperty="id">
insert into sys_user(
dept_id, user_name, nick_name, user_type,
phonenumber, sex, password, status,
del_flag, create_time, update_time, is_leader, leader_order_num
)values (#{orgId},#{loginName},#{userName},'00',#{userPhone},1,#{password},0,0,now(),now(),#{isLeader},1)
</insert>
<insert id="inserUserPost">
insert into sys_user_post(user_id, post_id
)values (#{id},#{orgId})
</insert>
<insert id="insertUserRole">
insert into sys_user_role(user_id, role_id,create_time
)values (#{id},#{roleId},now())
</insert>
<update id="updateUserData">
update sys_user set dept_id=#{orgId},user_name=#{loginName},nick_name=#{userName},
phonenumber=#{userPhone},is_leader=#{isLeader},update_time=now()
where id=#{id}
</update>
<delete id="delUserRole">
delete from sys_user_role where user_id=#{id}
</delete>
<select id="getUserIdByLoginName" resultType="java.lang.String">
select user_id
from sys_user
where user_name=#{userName} and del_flag=0
</select>
</mapper>

View File

@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/token","/login", "/register", "/captchaImage").permitAll()
.antMatchers("/token","/login","/publicLogin/**", "/register", "/captchaImage").permitAll()
// 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers( "/webjars/**", "/druid/**").permitAll()

View File

@ -20,6 +20,9 @@ public interface SysDeptMapper
* @return 部门信息集合
*/
public List<SysDept> selectDeptList(SysDept dept);
public List<SysDept> selectPublicDeptList(SysDept dept);
public List<DeptUserBo> selectDeptUserList(SysDept dept);
public List<DeptUserBo> selectDeptOkUserList(String userIds);
@ -119,4 +122,5 @@ public interface SysDeptMapper
* @return 结果
*/
public int deleteDeptById(Long deptId);
}

View File

@ -18,6 +18,10 @@ public interface SysRoleMapper
*/
public List<SysRole> selectRoleList(SysRole role);
public List<SysRole> selectPublicRoleList(SysRole role);
/**
* 根据用户ID查询角色
*

View File

@ -21,6 +21,10 @@ public interface ISysDeptService
* @return 部门信息集合
*/
public List<SysDept> selectDeptList(SysDept dept);
List<SysDept> selectPublicDeptList(SysDept dept);
public List<SysDept> selectAllDeptList(SysDept dept);
public List<DeptUserBo> selectDeptUserList(SysDept dept);
@ -31,6 +35,8 @@ public interface ISysDeptService
* @return 部门树信息集合
*/
public List<TreeSelect> selectDeptTreeList(SysDept dept);
public List<TreeSelect> selectPublicDeptTreeList(SysDept dept);
public List<TreeSelect4DeptUser> selectDeptUserTreeList(SysUser user);
public List<TreeSelect4DeptUser> selectDeptOkUserTreeList(String userIds);

View File

@ -20,6 +20,8 @@ public interface ISysRoleService
*/
public List<SysRole> selectRoleList(SysRole role);
public List<SysRole> selectPublicRoleList(SysRole role);
/**
* 根据用户ID查询角色列表
*
@ -43,6 +45,9 @@ public interface ISysRoleService
*/
public List<SysRole> selectRoleAll();
public List<SysRole> selectPublicRoleAll();
/**
* 根据用户ID获取角色选择框列表
*

View File

@ -51,6 +51,12 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.selectDeptList(dept);
}
@Override
public List<SysDept> selectPublicDeptList(SysDept dept)
{
return deptMapper.selectPublicDeptList(dept);
}
@Override
public List<SysDept> selectAllDeptList(SysDept dept){
return deptMapper.selectDeptList(dept);
@ -69,6 +75,20 @@ public class SysDeptServiceImpl implements ISysDeptService
return buildDeptTreeSelect(depts);
}
/**
* 查询部门树结构信息
*
* @param dept 部门信息
* @return 部门树信息集合
*/
@Override
public List<TreeSelect> selectPublicDeptTreeList(SysDept dept)
{
List<SysDept> depts = SpringUtils.getAopProxy(this).selectPublicDeptList(dept);
return buildDeptTreeSelect(depts);
}
/**
* 构建前端所需要树结构
*

View File

@ -58,6 +58,13 @@ public class SysRoleServiceImpl implements ISysRoleService
return roleMapper.selectRoleList(role);
}
@Override
public List<SysRole> selectPublicRoleList(SysRole role)
{
return roleMapper.selectPublicRoleList(role);
}
/**
* 根据用户ID查询角色
*
@ -115,6 +122,12 @@ public class SysRoleServiceImpl implements ISysRoleService
return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
}
@Override
public List<SysRole> selectPublicRoleAll()
{
return SpringUtils.getAopProxy(this).selectPublicRoleList(new SysRole());
}
/**
* 根据用户ID获取角色选择框列表
*

View File

@ -62,6 +62,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by d.parent_id, d.order_num
</select>
<select id="selectPublicDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="deptType != null and deptType != ''">
AND dept_type = #{deptType}
</if>
<!-- 数据范围过滤 -->
order by d.parent_id, d.order_num
</select>
<select id="selectDeptUserList" parameterType="SysDept" resultMap="SysDeptUserResult">
select * from (
(
@ -178,8 +201,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="SysDept">
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>

View File

@ -56,6 +56,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope}
order by r.role_sort
</select>
<select id="selectPublicRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleId != null and roleId != 0">
AND r.role_id = #{roleId}
</if>
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<!-- 数据范围过滤 -->
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>

View File

@ -100,18 +100,32 @@
<version>${oshi.version}</version>
</dependency>
<!-- Swagger3依赖 -->
<!-- 移除你原来的 Swagger3 依赖,替换为这个 -->
<!-- Springfox 2.8.0 核心依赖(兼容 Spring Boot 2.1.x -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
<exclusions>
<!-- 1. 排除冲突的 spring-plugin与 Spring Boot 2.1.1 自带版本冲突) -->
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 手动引入 spring-plugin-coreSpringfox 2.8.0 必需,与 Spring Boot 2.1.1 兼容) -->
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
<!-- Swagger UI 界面依赖必须单独引入2.8.0 没有 starter 整合) -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
<!-- io常用工具类 -->
<dependency>

View File

@ -60,14 +60,16 @@
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<!-- redis jar -->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -6,10 +6,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.bonus.hnrn.rnama.*.dao")
public class RnamaApplication {
public class RealNameAppApplication {
public static void main(String[] args) {
SpringApplication.run(RnamaApplication.class, args);
SpringApplication.run(RealNameAppApplication.class, args);
System.err.println("自有人员-APP启动成功");
}