用户登录修改

This commit is contained in:
haozq 2024-02-20 18:11:48 +08:00
parent 7c22ecfef1
commit 1b8231b0d3
16 changed files with 562 additions and 92 deletions

View File

@ -23,15 +23,32 @@
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="38edcd87-ada4-4894-a064-a836269e71e4" name="Default Changelist" comment="初始化修改">
<change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__mysql_mysql_connector_java_8_0_30.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/logs/securityControl-system/error.log" afterDir="false" />
<change afterPath="$PROJECT_DIR$/logs/securityControl-system/info.log" afterDir="false" />
<list default="true" id="38edcd87-ada4-4894-a064-a836269e71e4" name="Default Changelist" comment="基础模块修改">
<change afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/logs/securityControl-gateway/error.log" afterDir="false" />
<change afterPath="$PROJECT_DIR$/logs/securityControl-gateway/info.log" afterDir="false" />
<change afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/controller/LoginController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/mapper/LoginMapper.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/LoginService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/service/LoginServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/LoginMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/logs/securityControl-auth/error.log" beforeDir="false" afterPath="$PROJECT_DIR$/logs/securityControl-auth/error.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/logs/securityControl-auth/info.log" beforeDir="false" afterPath="$PROJECT_DIR$/logs/securityControl-auth/info.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/logs/securityControl-system/error.log" beforeDir="false" afterPath="$PROJECT_DIR$/logs/securityControl-system/error.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/logs/securityControl-system/info.log" beforeDir="false" afterPath="$PROJECT_DIR$/logs/securityControl-system/info.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/RemoteUserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/RemoteUserService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/SysUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/domain/SysUser.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/factory/RemoteUserFallbackFactory.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-api/securitycontrol-api-system/src/main/java/com/securitycontrol/system/api/factory/RemoteUserFallbackFactory.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysPasswordService.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysPasswordService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-auth/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-auth/src/main/resources/bootstrap.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/ServiceNameConstants.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/ServiceNameConstants.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/enums/UserStatus.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/enums/UserStatus.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/service/TokenService.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/service/TokenService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-gateway/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-gateway/src/main/resources/bootstrap.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/securitycontrol-system.iml" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/securitycontrol-system.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/VscSystemApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/VscSystemApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/resources/bootstrap.yml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -39,6 +56,14 @@
<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="Class" />
<option value="Interface" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
@ -57,6 +82,7 @@
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="DatabaseDriversLRU" value="mysql" />
<property name="RequestMappingsPanelOrder0" value="0" />
<property name="RequestMappingsPanelOrder1" value="1" />
<property name="RequestMappingsPanelWidth0" value="75" />
@ -66,11 +92,15 @@
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/securitycontrol-commons/securitycontrol-commons-log/src/main" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/resources/mapper" />
<property name="nodejs_package_manager_path" value="npm" />
</component>
<component name="ReactorSettings">
<option name="notificationShown" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="E:\ideaWorkspace\ah_jjzhgd_service\securitycontrol-model\securitycontrol-system\src\main\resources\mapper" />
<recent name="E:\ideaWorkspace\ah_jjzhgd_service\securitycontrol-commons\securitycontrol-commons-log\src\main" />
</key>
</component>
@ -81,6 +111,19 @@
</option>
</component>
<component name="RunManager" selected="Spring Boot.VscSystemApplication">
<configuration name="SecurityUtils" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.securitycontrol.common.security.utils.SecurityUtils" />
<module name="securitycontrol-commons-security" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.securitycontrol.common.security.utils.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="GatewayApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<module name="securitycontrol-gateway" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.securitycontrol.gateway.GatewayApplication" />
@ -102,6 +145,11 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.SecurityUtils" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
@ -113,7 +161,7 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1708406443341</updated>
<workItem from="1708406446066" duration="3002000" />
<workItem from="1708406446066" duration="15397000" />
</task>
<task id="LOCAL-00001" summary="初始化修改">
<created>1708408927745</created>
@ -122,7 +170,21 @@
<option name="project" value="LOCAL" />
<updated>1708408927745</updated>
</task>
<option name="localTasksCounter" value="2" />
<task id="LOCAL-00002" summary="基础模块修改">
<created>1708409760396</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1708409760396</updated>
</task>
<task id="LOCAL-00003" summary="基础模块修改">
<created>1708412455493</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1708412455494</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -142,52 +204,110 @@
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="初始化修改" />
<option name="LAST_COMMIT_MESSAGE" value="初始化修改" />
<MESSAGE value="基础模块修改" />
<option name="LAST_COMMIT_MESSAGE" value="基础模块修改" />
</component>
<component name="WindowStateProjectService">
<state width="1877" height="95" key="GridCell.Tab.0.bottom" timestamp="1708409697427">
<state x="552" y="178" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1708417712806">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697427" />
<state width="1877" height="95" key="GridCell.Tab.0.center" timestamp="1708409697427">
<state x="552" y="178" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1708417712806" />
<state x="765" y="225" key="#com.intellij.ide.util.MemberChooser" timestamp="1708423612153">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697427" />
<state width="1877" height="95" key="GridCell.Tab.0.left" timestamp="1708409697427">
<state x="765" y="225" key="#com.intellij.ide.util.MemberChooser/0.0.1920.1040@0.0.1920.1040" timestamp="1708423612153" />
<state x="472" y="443" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog" timestamp="1708413726823">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697427" />
<state width="1877" height="95" key="GridCell.Tab.0.right" timestamp="1708409697427">
<state x="472" y="443" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1708413726823" />
<state width="454" height="466" key="DebuggerActiveHint" timestamp="1708422708907">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697427" />
<state width="1877" height="95" key="GridCell.Tab.1.bottom" timestamp="1708409697428">
<state width="454" height="466" key="DebuggerActiveHint/0.0.1920.1040@0.0.1920.1040" timestamp="1708422708907" />
<state width="1877" height="354" key="GridCell.Tab.0.bottom" timestamp="1708423510888">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697428" />
<state width="1877" height="95" key="GridCell.Tab.1.center" timestamp="1708409697427">
<state width="1877" height="354" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510888" />
<state width="1877" height="354" key="GridCell.Tab.0.center" timestamp="1708423510888">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697427" />
<state width="1877" height="95" key="GridCell.Tab.1.left" timestamp="1708409697427">
<state width="1877" height="354" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510888" />
<state width="1877" height="354" key="GridCell.Tab.0.left" timestamp="1708423510888">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697427" />
<state width="1877" height="95" key="GridCell.Tab.1.right" timestamp="1708409697428">
<state width="1877" height="354" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510888" />
<state width="1877" height="354" key="GridCell.Tab.0.right" timestamp="1708423510888">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="95" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1708409697428" />
<state x="552" y="253" key="Vcs.Push.Dialog.v2" timestamp="1708408937697">
<state width="1877" height="354" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510888" />
<state width="1877" height="354" key="GridCell.Tab.1.bottom" timestamp="1708423547572">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="552" y="253" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1708408937697" />
<state x="753" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1708408819947">
<state width="1877" height="354" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1708423547572" />
<state width="1877" height="354" key="GridCell.Tab.1.center" timestamp="1708423547572">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="753" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.1920.1040@0.0.1920.1040" timestamp="1708408819947" />
<state x="616" y="240" width="672" height="677" key="run.anything.popup" timestamp="1708408545101">
<state width="1877" height="354" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1708423547572" />
<state width="1877" height="354" key="GridCell.Tab.1.left" timestamp="1708423547572">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="616" y="240" width="672" height="677" key="run.anything.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1708408545101" />
<state width="1877" height="354" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1708423547572" />
<state width="1877" height="354" key="GridCell.Tab.1.right" timestamp="1708423547572">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="354" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1708423547572" />
<state width="1877" height="302" key="GridCell.Tab.2.bottom" timestamp="1708423510619">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="302" key="GridCell.Tab.2.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510619" />
<state width="1877" height="302" key="GridCell.Tab.2.center" timestamp="1708423510618">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="302" key="GridCell.Tab.2.center/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510618" />
<state width="1877" height="302" key="GridCell.Tab.2.left" timestamp="1708423510617">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="302" key="GridCell.Tab.2.left/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510617" />
<state width="1877" height="302" key="GridCell.Tab.2.right" timestamp="1708423510618">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="302" key="GridCell.Tab.2.right/0.0.1920.1040@0.0.1920.1040" timestamp="1708423510618" />
<state x="552" y="253" key="Vcs.Push.Dialog.v2" timestamp="1708412461493">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="552" y="253" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1708412461493" />
<state width="968" height="528" key="XDebugger.FullValuePopup" timestamp="1708421653893">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="968" height="528" key="XDebugger.FullValuePopup/0.0.1920.1040@0.0.1920.1040" timestamp="1708421653893" />
<state x="753" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1708409810755">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="753" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.1920.1040@0.0.1920.1040" timestamp="1708409810755" />
<state x="616" y="240" width="672" height="677" key="run.anything.popup" timestamp="1708423352732">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="616" y="240" width="672" height="677" key="run.anything.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1708423352732" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java</url>
<line>46</line>
<option name="timeStamp" value="7" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java</url>
<line>65</line>
<option name="timeStamp" value="8" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/controller/LoginController.java</url>
<line>75</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

View File

@ -30,7 +30,7 @@ public interface RemoteUserService {
* @param source 请求来源
* @return 结果
*/
@GetMapping("/userManage/info/{username}")
@GetMapping("/userLogin/login/{username}")
Result<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
@ -50,7 +50,7 @@ public interface RemoteUserService {
* @param source 来源
* @return
*/
@PostMapping("/sys/menu/getAllMenuList")
@PostMapping("/userLogin/getAllMenuList")
Result<List<SysMenu>> getAllMenuList(@RequestBody String userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
@ -61,4 +61,12 @@ public interface RemoteUserService {
*/
@PostMapping("/userManage/getUserById/{userId}")
Result<SysUserVo> getUserById(@PathVariable("userId") String userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 修改登录信息
* @param userId
* @param source
*/
@PostMapping("/userLogin/updateUserLogin")
void updateUserLogin(@RequestBody Long userId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

View File

@ -36,7 +36,7 @@ public class SysUser extends BaseEntity {
private String email;
/** 手机号码 */
private String phonenumber;
private String phone;
/** 用户性别 */
private String sex;
@ -82,12 +82,61 @@ public class SysUser extends BaseEntity {
private String unitName;
private String isSup;
/**
* 是否是超级管理员
*/
private String isAdmin;
/**
* 账号类型
*/
private String userType;
/**
* 登录类型
*/
private int loginType;
/**
* 部门
*/
private String deptName;
/**
* 统一权限登录用户id
* */
private String iscUserId;
public String getIsAdmin() {
return isAdmin;
}
public void setIsAdmin(String isAdmin) {
this.isAdmin = isAdmin;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public int getLoginType() {
return loginType;
}
public void setLoginType(int loginType) {
this.loginType = loginType;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getUnitName() {
return unitName;
}
@ -231,14 +280,14 @@ public class SysUser extends BaseEntity {
}
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber()
public String getPhone()
{
return phonenumber;
return phone;
}
public void setPhonenumber(String phonenumber)
public void setPhone(String phone)
{
this.phonenumber = phonenumber;
this.phone = phone;
}
public String getSex()
@ -377,7 +426,7 @@ public class SysUser extends BaseEntity {
.append("userName", getUserName())
.append("nickName", getNickName())
.append("email", getEmail())
.append("phonenumber", getPhonenumber())
.append("phonenumber", getPhone())
.append("sex", getSex())
.append("avatar", getAvatar())
.append("password", getPassword())

View File

@ -46,6 +46,9 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
public Result<SysUserVo> getUserById(String userId, String source) {
return Result.fail("获取用户失败:" + throwable.getMessage());
}
@Override
public void updateUserLogin(Long userId, String source) {
}
};
}

View File

@ -9,6 +9,7 @@ import com.securitycontrol.common.core.utils.JwtUtils;
import com.securitycontrol.common.redis.service.RedisService;
import com.securitycontrol.common.security.service.TokenService;
import com.securitycontrol.common.security.utils.SecurityUtils;
import com.securitycontrol.system.api.domain.SysUser;
import com.securitycontrol.system.api.domain.decision.SysMenu;
import com.securitycontrol.system.api.model.LoginUser;
import io.jsonwebtoken.Claims;
@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@ -30,9 +32,9 @@ import java.util.List;
@RestController
@Slf4j
public class TokenController {
@Autowired
@Resource
private TokenService tokenService;
@Autowired
@Resource
private RedisService redisUtil;
@Autowired
@ -43,10 +45,9 @@ public class TokenController {
@PostMapping("login")
public Result<?> login(LoginBody form) {
List<SysMenu> menu=null;
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),menu);
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),null);
// 获取登录token
return Result.ok(tokenService.createToken(userInfo));
return Result.ok(tokenService.createToken(userInfo),"登录成功");
}

View File

@ -39,9 +39,8 @@ public class SysLoginService
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password))
{
throw new ServiceException("用户/密码必须填写",201);
throw new ServiceException("用户/密码不能为空",201);
}
// 查询用户信息
Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
@ -54,7 +53,6 @@ public class SysLoginService
{
throw new ServiceException(userResult.getMsg());
}
LoginUser userInfo = userResult.getData();
SysUser user = userResult.getData().getSysUser();
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
@ -66,13 +64,11 @@ public class SysLoginService
throw new ServiceException("对不起,您的账号:" + username + " 已锁定",201);
}
passwordService.validate(user, password);
if(list==null){
Result<List<SysMenu>> menu = remoteUserService.getAllMenuList(user.getUserId()+"", SecurityConstants.INNER);
list=menu.getData();
}
Result<List<SysMenu>> menu = remoteUserService.getAllMenuList(user.getUserId()+"", SecurityConstants.INNER);
list=menu.getData();
userInfo.getSysUser().setMenus(list);
recordLogService.recordLogininfor(username, "用户登录", "系统登录");
remoteUserService.updateUserLogin(user.getUserId(),SecurityConstants.INNER);
return userInfo;
}

View File

@ -42,22 +42,16 @@ public class SysPasswordService
public void validate(SysUser user, String password)
{
String username = user.getUserName();
Integer retryCount = redisService.getCacheObject(getCacheKey(username));
if (retryCount == null)
{
if (retryCount == null) {
retryCount = 0;
}
if (!matches(user, password))
{
if (!matches(user, password)) {
retryCount = retryCount + 1;
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new ServiceException("用户不存在/密码错误",201);
}
else
{
} else {
clearLoginRecordCache(username);
}
}
@ -67,8 +61,7 @@ public class SysPasswordService
return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
}
public void clearLoginRecordCache(String loginName)
{
public void clearLoginRecordCache(String loginName) {
if (redisService.hasKey(getCacheKey(loginName)))
{
redisService.deleteObject(getCacheKey(loginName));

View File

@ -9,26 +9,26 @@ public class ServiceNameConstants {
/**
* 认证服务的serviceid
*/
public static final String AUTH_SERVICE = "securitycontrol-auth";
public static final String AUTH_SERVICE = "securityControl-auth";
/**
* 系统模块的serviceid
*/
public static final String SYSTEM_SERVICE = "securitycontrol-system";
public static final String SYSTEM_SERVICE = "securityControl-system";
/**
* 文件服务的serviceid
*/
public static final String FILE_SERVICE = "securitycontrol-file";
public static final String FILE_SERVICE = "securityControl-file";
/**
* 分析决策的serviceid
*/
public static final String DECISION_SERVICE = "securitycontrol-decision";
public static final String DECISION_SERVICE = "securityControl-decision";
/**
* proteam的serviceid
*/
public static final String PROTEAM_SERVICE = "securitycontrol-proteam";
public static final String PROTEAM_SERVICE = "securityControl-proteam";
}

View File

@ -8,7 +8,7 @@ package com.securitycontrol.common.core.enums;
public enum UserStatus
{
//注释
OK("0", "正常"), DISABLE("2", "锁定"), DELETED("1", "删除");
OK("0", "正常"), DISABLE("1", "锁定"), DELETED("2", "停用");
private final String code;
private final String info;

View File

@ -55,20 +55,18 @@ public class TokenService {
loginUser.setUsername(userName);
loginUser.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
refreshToken(loginUser);
// Jwt存储信息
Map<String, Object> claimsMap = new HashMap<String, Object>(50);
claimsMap.put(SecurityConstants.USER_KEY, token);
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
claimsMap.put(SecurityConstants.DETAILS_ISC_USER_ID, loginUser.getSysUser().getIscUserId());
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
// 接口返回信息
Map<String, Object> rspMap = new HashMap<String, Object>(50);
String jwtToken=JwtUtils.createToken(claimsMap);
rspMap.put("access_token", jwtToken);
rspMap.put("us", JSON.toJSONString(loginUser.getSysUser()));
Integer time=60*30;
int time=60*30;
redisService.set("token:"+jwtToken,jwtToken,time);
redisService.set("userId::"+userId,jwtToken,time);
redisService.set("ISCUserId:"+jwtToken,loginUser.getSysUser().getIscUserId(),time);

View File

@ -20,6 +20,27 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2021.0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-commons:2021.0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:2.0.4" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.15.0" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_otel:0.15.0" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_common:0.15.0" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_otel_agent:0.15.0" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.11" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.4" level="project" />
<orderEntry type="module" module-name="securitycontrol-commons-security" />
<orderEntry type="module" module-name="securitycontrol-api-system" />
<orderEntry type="module" module-name="securitycontrol-commons-redis" />
@ -113,26 +134,6 @@
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.6.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.mapstruct:mapstruct:1.3.1.Final" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2021.0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-commons:2021.0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.11" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:2.0.4" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.15" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.15.0" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_otel:0.15.0" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_common:0.15.0" level="project" />
<orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_otel_agent:0.15.0" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel:2021.0.4.0" level="project" />
<orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-transport-simple-http:1.8.5" level="project" />
@ -199,6 +200,7 @@
<orderEntry type="library" name="Maven: net.logstash.logback:logstash-logback-encoder:5.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.3" level="project" />
<orderEntry type="module" module-name="securitycontrol-commons-entity" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.4" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.11.RELEASE" level="project" />

View File

@ -0,0 +1,98 @@
package com.securitycontrol.system.controller;
import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.utils.ServletUtils;
import com.securitycontrol.common.core.utils.StringUtils;
import com.securitycontrol.common.core.utils.ip.IpUtils;
import com.securitycontrol.common.security.annotation.InnerAuth;
import com.securitycontrol.system.api.domain.SysUser;
import com.securitycontrol.system.api.domain.decision.SysMenu;
import com.securitycontrol.system.api.model.LoginUser;
import com.securitycontrol.system.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 系统用户登录
* 业务控制中心
* @author HeiZi
*/
@RestController
@RequestMapping(value = "/userLogin/")
public class LoginController {
@Autowired
private LoginService service;
private static final String ZIOE="0";
private static final int ONE=1;
/**
* 系统用户登录获取用户信息
*/
@InnerAuth
@GetMapping("login/{username}")
public Result<LoginUser> login(@PathVariable("username") String username) {
SysUser sysUser = service.selectUserByUserName(username);
if (StringUtils.isNull(sysUser)) {
return Result.fail("用户名或密码错误");
}
// 角色集合
Set<String> roles = new HashSet<String>();
roles.add(sysUser.getRoleId().toString());
// 权限集合
Set<String> permissions = service.getMenuPermission(sysUser);
LoginUser sysUserVo = new LoginUser();
sysUserVo.setSysUser(sysUser);
sysUserVo.setRoles(roles);
sysUserVo.setPermissions(permissions);
return Result.ok(sysUserVo);
}
/**
* 获取用户当前菜单数据
* @param userId
* @return
*/
@PostMapping("getAllMenuList")
public Result<List<SysMenu>> getAllMenuList(@RequestBody String userId) {
List<SysMenu> list = new ArrayList<SysMenu>();
list = service.getAllMenuList(userId);
return Result.ok(list);
}
/**
* 获取用户当前菜单数据
* @param userId
* @return
*/
@PostMapping("updateUserLogin")
public void updateUserLogin(@RequestBody String userId) {
String ip= IpUtils.getIpAddr(ServletUtils.getRequest());
service.updateUserLogin(userId,ip);
}
}

View File

@ -0,0 +1,46 @@
package com.securitycontrol.system.mapper;
import com.securitycontrol.system.api.domain.SysUser;
import com.securitycontrol.system.api.domain.decision.SysMenu;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Set;
/**
* 数据接口层
* @author HeiZi
*/
@Repository
public interface LoginMapper {
/**
* 查询用户信息
* @param username
* @return
*/
SysUser selectUserByUserName(String username);
/**
* 查询用户权限
* @param sysUser
* @return
*/
Set<String> getMenuPermission(SysUser sysUser);
/**
* 查询菜单集合
* @param userId
* @param pid
* @return
*/
List<SysMenu> getAllMenuList(@Param("userId")String userId,@Param("pid") String pid);
/**
* 更新用户信息
* @param userId
* @param ip
*/
void updateUserLogin(@Param("userId") String userId,@Param("ip") String ip);
}

View File

@ -0,0 +1,37 @@
package com.securitycontrol.system.service;
import com.securitycontrol.system.api.domain.SysUser;
import com.securitycontrol.system.api.domain.decision.SysMenu;
import java.util.List;
import java.util.Set;
/**
* 用户登录 接口处理层
* @author HeiZi
*/
public interface LoginService {
/**
* 用户登录验证
* @param username 用户名
* @return
*/
SysUser selectUserByUserName(String username);
/**
* 获取用户登录权限
* @param sysUser
* @return
*/
Set<String> getMenuPermission(SysUser sysUser);
/**
* 查询全部的菜单列表
* @param userId
* @return
*/
List<SysMenu> getAllMenuList(String userId);
void updateUserLogin(String userId, String ip);
}

View File

@ -0,0 +1,83 @@
package com.securitycontrol.system.service;
import com.securitycontrol.system.api.domain.SysUser;
import com.securitycontrol.system.api.domain.decision.SysMenu;
import com.securitycontrol.system.mapper.LoginMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* 系统 用户
* @author HeiZi
*/
@Service
@Slf4j
public class LoginServiceImpl implements LoginService {
@Autowired
private LoginMapper mapper;
/**
* 查询用户信息
* @param username 用户名
* @return
*/
@Override
public SysUser selectUserByUserName(String username) {
return mapper.selectUserByUserName(username);
}
/**
* 查询用户登录权限
* @param sysUser
* @return
*/
@Override
public Set<String> getMenuPermission(SysUser sysUser) {
return mapper.getMenuPermission(sysUser);
}
/**
* 获取菜单列表的集合
* @param userId
* @return
*/
@Override
public List<SysMenu> getAllMenuList(String userId) {
List<SysMenu> parent=mapper.getAllMenuList(userId,"0");
getChilder(parent,userId);
return parent;
}
@Override
public void updateUserLogin(String userId, String ip) {
try{
mapper.updateUserLogin(userId,ip);
}catch (Exception e){
log.error(e.toString(),e);
}
}
/**
* 子菜单查询
* @param menuList
*/
private void getChilder(List<SysMenu> menuList, String userId) {
for (SysMenu menu : menuList) {
List<SysMenu> list=mapper.getAllMenuList(userId, menu.getMenuId());
if(list!=null &&list.size()>0){
menu.setChilder(list);
menu.setLast(false);
}else{
menu.setChilder(new ArrayList<SysMenu>());
menu.setLast(true);
}
}
}
}

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.securitycontrol.system.mapper.LoginMapper">
<update id="updateUserLogin">
update sys_user set
login_ip=#{ip},login_time=now() where user_id=#{userId}
</update>
<!--查询用户角色-->
<select id="selectUserByUserName" parameterType="String" resultType="com.securitycontrol.system.api.domain.SysUser">
select user_id userId,user_name userName,login_name nickName,
`password`,org_id,dept_name deptName,org_name orgName,is_admin,role_id roleId,
user_type userType,login_type loginType,status,
role_name roleName,phone,su.login_ip loginIp,su.login_name login_time
FROM sys_user su
where su.del_flag=0 AND su.login_name=#{username}
</select>
<!--查询用户已分配的权限-->
<select id="getMenuPermission" parameterType="com.securitycontrol.system.api.domain.SysUser" resultType="String">
select DISTINCT sm.menu_auth
FROM sys_user su
left join sys_role_menu srm on srm .role_id=su.role_id
left join sys_menu sm on sm.menu_id=srm.menu_id and sm.menu_type=1 AND sm.del_flag=0
where su.user_id=#{userId}
</select>
<select id="getAllMenuList" resultType="com.securitycontrol.system.api.domain.decision.SysMenu">
select sm.menu_url url,sm.menu_id menuId,sm.menu_name menuName,sm.menu_logo
FROM sys_user su
left join sys_role_menu srm on srm .role_id=su.role_id
left join sys_menu sm on sm.menu_id=srm.menu_id and sm.del_flag=0 and sm.menu_type=0
where su.user_id=#{userId} and sm.p_id=#{pid}
ORDER BY sm.menu_sort ASC
</select>
</mapper>