mirror of
https://github.com/zykzhangyukang/Xinguan.git
synced 2024-09-20 06:46:03 +08:00
重构代码
This commit is contained in:
parent
920769a7e0
commit
2dcde12a3c
|
@ -2,16 +2,41 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="bc0098de-1555-475b-b0df-4f7e5b9cd099" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/enums/RoleStatusEnum.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ConsumerController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ConsumerController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/HealthController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/HealthController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/InStockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/InStockController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/NcovAPIController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/NcovAPIController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/HealthServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/HealthServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/OutStockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/OutStockController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductCategoryController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductCategoryController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/ProductController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/SupplierController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/controller/SupplierController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/InStockServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/InStockServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/OutStockServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/OutStockServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/ProductServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/biz/service/imp/ProductServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/aspect/ControllerEndpointAspect.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/aspect/ControllerEndpointAspect.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/JWTFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/JWTFilter.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/UserRealm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/shiro/UserRealm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/web/GlobalExceptionHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/config/web/GlobalExceptionHandler.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/enums/BaseCodeInterface.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/exception/BaseCodeInterface.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/enums/ErrorCodeEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/exception/ErrorCodeEnum.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/exception/BizException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/exception/BizException.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/exception/ErrorCodeEnum.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/exception/ErrorCodeEnum.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/utils/JWTUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/utils/JWTUtils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/bean/ActiveUser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/bean/ActiveUser.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/bean/ResponseBean.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/common/bean/ResponseBean.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/DepartmentController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/DepartmentController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/FileUploadController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/FileUploadController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LogController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LogController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LoginLogController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/LoginLogController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/MenuController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/MenuController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/RoleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/RoleController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/UserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/controller/UserController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/UserService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/UserService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/DepartmentServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/DepartmentServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LogServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LogServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LoginLogServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/LoginLogServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/MenuServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/MenuServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/RoleServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/RoleServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/UserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/service/impl/UserServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/vo/UserVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/coderman/api/system/vo/UserVO.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -44,6 +69,7 @@
|
|||
<ConfirmationsSetting value="2" id="新增" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -66,7 +92,7 @@
|
|||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.0" />
|
||||
<property name="project.structure.side.proportion" value="0.0" />
|
||||
<property name="settings.editor.selected.configurable" value="MavenSettings" />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
|
@ -2458,7 +2484,8 @@
|
|||
<workItem from="1590679049957" duration="370000" />
|
||||
<workItem from="1590723506721" duration="570000" />
|
||||
<workItem from="1590724085074" duration="3820000" />
|
||||
<workItem from="1590727928932" duration="460000" />
|
||||
<workItem from="1590727928932" duration="6419000" />
|
||||
<workItem from="1590741932410" duration="3987000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
@ -2495,10 +2522,10 @@
|
|||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="498" y="206" key="#com.intellij.ide.util.TreeClassChooserDialog/0.0.1536.834@0.0.1536.834" timestamp="1588079205110" />
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog" timestamp="1590727777212">
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog" timestamp="1590735213148">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog/0.0.1536.834@0.0.1536.834" timestamp="1590727777212" />
|
||||
<state x="361" y="340" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog/0.0.1536.834@0.0.1536.834" timestamp="1590735213148" />
|
||||
<state x="539" y="284" width="457" height="273" key="#com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesDialog.classes" timestamp="1590727325009">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
|
@ -2511,66 +2538,66 @@
|
|||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="524" y="119" key="#xdebugger.evaluate/0.0.1536.834@0.0.1536.834" timestamp="1588300742809" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.bottom" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.bottom" timestamp="1590745829038">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.center" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.center" timestamp="1590745829037">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.center/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.left" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.center/0.0.1536.834@0.0.1536.834" timestamp="1590745829037" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.left" timestamp="1590745829037">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.left/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.right" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.left/0.0.1536.834@0.0.1536.834" timestamp="1590745829037" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.right" timestamp="1590745829038">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.0.right/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.bottom" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.0.right/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.bottom" timestamp="1590745829038">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.center" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.center" timestamp="1590745829038">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.center/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.left" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.center/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.left" timestamp="1590745829038">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.left/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.right" timestamp="1590728054914">
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.left/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.right" timestamp="1590745829038">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="385" key="GridCell.Tab.1.right/0.0.1536.834@0.0.1536.834" timestamp="1590728054914" />
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.bottom" timestamp="1590381858534">
|
||||
<state width="1495" height="310" key="GridCell.Tab.1.right/0.0.1536.834@0.0.1536.834" timestamp="1590745829038" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.bottom" timestamp="1590744261569">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590381858534" />
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.center" timestamp="1590381858534">
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.bottom/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.center" timestamp="1590744261569">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.center/0.0.1536.834@0.0.1536.834" timestamp="1590381858534" />
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.left" timestamp="1590381858534">
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.center/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.left" timestamp="1590744261569">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.left/0.0.1536.834@0.0.1536.834" timestamp="1590381858534" />
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.right" timestamp="1590381858534">
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.left/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.right" timestamp="1590744261569">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="1493" height="624" key="GridCell.Tab.2.right/0.0.1536.834@0.0.1536.834" timestamp="1590381858534" />
|
||||
<state width="1495" height="400" key="GridCell.Tab.2.right/0.0.1536.834@0.0.1536.834" timestamp="1590744261569" />
|
||||
<state width="212" height="477" key="HiddenNamespacesPopup" timestamp="1589459548093">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state width="212" height="477" key="HiddenNamespacesPopup/0.0.1536.834@0.0.1536.834" timestamp="1589459548093" />
|
||||
<state x="346" y="75" key="SettingsEditor" timestamp="1590724559828">
|
||||
<state x="346" y="75" key="SettingsEditor" timestamp="1590731897729">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="346" y="75" key="SettingsEditor/0.0.1536.834@0.0.1536.834" timestamp="1590724559828" />
|
||||
<state x="499" y="176" key="extract.method.dialog" timestamp="1589461001246">
|
||||
<state x="346" y="75" key="SettingsEditor/0.0.1536.834@0.0.1536.834" timestamp="1590731897729" />
|
||||
<state x="499" y="176" key="extract.method.dialog" timestamp="1590745555824">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
<state x="499" y="176" key="extract.method.dialog/0.0.1536.834@0.0.1536.834" timestamp="1589461001246" />
|
||||
<state x="499" y="176" key="extract.method.dialog/0.0.1536.834@0.0.1536.834" timestamp="1590745555824" />
|
||||
<state x="178" y="27" key="new project wizard" timestamp="1589592795583">
|
||||
<screen x="0" y="0" width="1536" height="834" />
|
||||
</state>
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.coderman.api.biz.controller;
|
|||
import com.coderman.api.biz.service.ConsumerService;
|
||||
import com.coderman.api.biz.vo.ConsumerVO;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
|
@ -4,8 +4,8 @@ import com.coderman.api.common.pojo.biz.Health;
|
|||
import com.coderman.api.biz.service.HealthService;
|
||||
import com.coderman.api.biz.vo.HealthVO;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ActiveUser;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ActiveUser;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.coderman.api.biz.vo.InStockDetailVO;
|
|||
import com.coderman.api.biz.vo.InStockVO;
|
||||
import com.coderman.api.biz.vo.SupplierVO;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.coderman.api.biz.controller;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.coderman.api.biz.vo.ConsumerVO;
|
|||
import com.coderman.api.biz.vo.OutStockDetailVO;
|
||||
import com.coderman.api.biz.vo.OutStockVO;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.coderman.api.biz.controller;
|
|||
import com.coderman.api.biz.service.ProductCategoryService;
|
||||
import com.coderman.api.biz.vo.ProductCategoryTreeNodeVO;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import com.coderman.api.biz.vo.ProductCategoryVO;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.coderman.api.biz.service.ProductService;
|
|||
import com.coderman.api.biz.vo.ProductStockVO;
|
||||
import com.coderman.api.biz.vo.ProductVO;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.coderman.api.biz.controller;
|
|||
import com.coderman.api.biz.service.SupplierService;
|
||||
import com.coderman.api.biz.vo.SupplierVO;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.coderman.api.biz.vo.InStockItemVO;
|
|||
import com.coderman.api.biz.vo.InStockVO;
|
||||
import com.coderman.api.biz.vo.SupplierVO;
|
||||
import com.coderman.api.common.pojo.biz.*;
|
||||
import com.coderman.api.system.bean.ActiveUser;
|
||||
import com.coderman.api.common.bean.ActiveUser;
|
||||
import com.coderman.api.common.exception.ErrorCodeEnum;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.coderman.api.biz.mapper.*;
|
|||
import com.coderman.api.biz.service.OutStockService;
|
||||
import com.coderman.api.biz.vo.*;
|
||||
import com.coderman.api.common.pojo.biz.*;
|
||||
import com.coderman.api.system.bean.ActiveUser;
|
||||
import com.coderman.api.common.bean.ActiveUser;
|
||||
import com.coderman.api.common.exception.ErrorCodeEnum;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.coderman.api.common.aspect;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ActiveUser;
|
||||
import com.coderman.api.common.bean.ActiveUser;
|
||||
import com.coderman.api.common.pojo.system.Log;
|
||||
import com.coderman.api.system.service.LogService;
|
||||
import com.coderman.api.common.utils.AddressUtil;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.coderman.api.system.bean;
|
||||
package com.coderman.api.common.bean;
|
||||
|
||||
import com.coderman.api.common.pojo.system.Menu;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
|
@ -1,4 +1,4 @@
|
|||
package com.coderman.api.system.bean;
|
||||
package com.coderman.api.common.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.coderman.api.common.config.shiro;
|
||||
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.common.config.jwt.JWTToken;
|
||||
import com.google.gson.Gson;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.coderman.api.common.config.shiro;
|
||||
|
||||
import com.coderman.api.system.bean.ActiveUser;
|
||||
import com.coderman.api.common.bean.ActiveUser;
|
||||
import com.coderman.api.common.config.jwt.JWTToken;
|
||||
import com.coderman.api.common.pojo.system.Menu;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
||||
import com.coderman.api.common.pojo.system.User;
|
||||
import com.coderman.api.system.service.UserService;
|
||||
import com.coderman.api.common.utils.JWTUtils;
|
||||
import com.coderman.api.system.service.UserService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.*;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
|
@ -102,7 +102,7 @@ public class UserRealm extends AuthorizingRealm {
|
|||
//如果验证通过,获取用户的角色
|
||||
List<Role> roles= userService.findRolesById(userBean.getId());
|
||||
//查询用户的所有菜单(包括了菜单和按钮)
|
||||
List<Menu> menus=userService.findMenuById(roles);
|
||||
List<Menu> menus=userService.findMenuByRoles(roles);
|
||||
|
||||
Set<String> urls=new HashSet<>();
|
||||
Set<String> perms=new HashSet<>();
|
||||
|
@ -125,7 +125,6 @@ public class UserRealm extends AuthorizingRealm {
|
|||
activeUser.setMenus(menus);
|
||||
activeUser.setUrls(urls);
|
||||
activeUser.setPermissions(perms);
|
||||
|
||||
return new SimpleAuthenticationInfo(activeUser, token, getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.coderman.api.common.config.web;
|
||||
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.ShiroException;
|
||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||
|
|
|
@ -3,7 +3,10 @@ package com.coderman.api.common.exception;
|
|||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
*
|
||||
* 业务错误码:返回结果的状态码
|
||||
*
|
||||
* 如果想要代码更具维护性一点,可以定义不同种类的错误码,都实现 BaseCodeInterface
|
||||
* @Author zhangyukang
|
||||
* @Date 2020/3/1 14:51
|
||||
* @Version 1.0
|
||||
|
|
|
@ -16,9 +16,9 @@ import java.util.Date;
|
|||
|
||||
public class JWTUtils {
|
||||
/**
|
||||
* 过期时间2小时
|
||||
* 过期时间6小时
|
||||
*/
|
||||
private static final long EXPIRE_TIME = 3*60*60*1000;
|
||||
private static final long EXPIRE_TIME = 6*60*60*1000;
|
||||
|
||||
/**
|
||||
* 校验token是否正确
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.common.pojo.system.Department;
|
||||
import com.coderman.api.system.service.DepartmentService;
|
||||
import com.coderman.api.system.vo.DeanVO;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.common.utils.CommonFileUtil;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.mapper.ImageAttachmentMapper;
|
||||
import com.coderman.api.common.pojo.system.ImageAttachment;
|
||||
import com.coderman.api.system.vo.ImageAttachmentVO;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.service.LogService;
|
||||
import com.coderman.api.system.vo.LogVO;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.service.LoginLogService;
|
||||
import com.coderman.api.system.vo.LoginLogVO;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.common.pojo.system.Menu;
|
||||
import com.coderman.api.system.service.MenuService;
|
||||
import com.coderman.api.system.vo.MenuNodeVO;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
||||
import com.coderman.api.system.service.MenuService;
|
||||
import com.coderman.api.system.service.RoleService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.coderman.api.system.controller;
|
||||
|
||||
import com.coderman.api.common.annotation.ControllerEndpoint;
|
||||
import com.coderman.api.system.bean.ResponseBean;
|
||||
import com.coderman.api.common.bean.ResponseBean;
|
||||
import com.coderman.api.system.converter.RoleConverter;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
||||
import com.coderman.api.common.pojo.system.User;
|
||||
|
@ -56,7 +56,7 @@ public class UserController {
|
|||
*/
|
||||
@ApiOperation(value = "用户登入", notes = "接收参数用户名和密码,登入成功后,返回JWTToken")
|
||||
@PostMapping("/login")
|
||||
public ResponseBean login(@NotBlank(message = "用户名必填") String username,
|
||||
public ResponseBean login(@NotBlank(message = "账号必填") String username,
|
||||
@NotBlank(message = "密码必填") String password,
|
||||
HttpServletRequest request) {
|
||||
String token=userService.login(username,password);
|
||||
|
@ -192,13 +192,8 @@ public class UserController {
|
|||
@RequiresPermissions({"user:add"})
|
||||
@PostMapping("/add")
|
||||
public ResponseBean add(@RequestBody @Validated UserVO userVO) {
|
||||
User user = userService.findUserByName(userVO.getUsername());
|
||||
if (user == null) {
|
||||
userService.add(userVO);
|
||||
return ResponseBean.success();
|
||||
} else {
|
||||
return ResponseBean.error("用户名已被占用");
|
||||
}
|
||||
userService.add(userVO);
|
||||
return ResponseBean.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.coderman.api.system.enums;
|
||||
|
||||
/**
|
||||
* @Author zhangyukang
|
||||
* @Date 2020/5/29 16:52
|
||||
* @Version 1.0
|
||||
**/
|
||||
|
||||
|
||||
public enum RoleStatusEnum {
|
||||
DISABLE(0),
|
||||
AVAILABLE(1);
|
||||
|
||||
private int statusCode;
|
||||
|
||||
RoleStatusEnum(int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusCode(int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ public interface UserService {
|
|||
* @param roles 用户的角色
|
||||
* @return
|
||||
*/
|
||||
List<Menu> findMenuById(List<Role> roles);
|
||||
List<Menu> findMenuByRoles(List<Role> roles);
|
||||
|
||||
/**
|
||||
* 加载用户菜单
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.system.converter.DepartmentConverter;
|
||||
import com.coderman.api.biz.enums.BizUserTypeEnum;
|
||||
import com.coderman.api.system.mapper.DepartmentMapper;
|
||||
import com.coderman.api.system.mapper.RoleMapper;
|
||||
import com.coderman.api.system.mapper.UserMapper;
|
||||
import com.coderman.api.system.mapper.UserRoleMapper;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.common.pojo.system.Department;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
||||
import com.coderman.api.common.pojo.system.User;
|
||||
import com.coderman.api.common.pojo.system.UserRole;
|
||||
import com.coderman.api.system.converter.DepartmentConverter;
|
||||
import com.coderman.api.system.enums.UserStatusEnum;
|
||||
import com.coderman.api.system.enums.UserTypeEnum;
|
||||
import com.coderman.api.system.mapper.DepartmentMapper;
|
||||
import com.coderman.api.system.mapper.RoleMapper;
|
||||
import com.coderman.api.system.mapper.UserMapper;
|
||||
import com.coderman.api.system.mapper.UserRoleMapper;
|
||||
import com.coderman.api.system.service.DepartmentService;
|
||||
import com.coderman.api.system.vo.DeanVO;
|
||||
import com.coderman.api.system.vo.DepartmentVO;
|
||||
|
@ -22,6 +25,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -72,7 +76,7 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|||
d.setMgrName(user.getUsername());
|
||||
Example o1 = new Example(User.class);
|
||||
o1.createCriteria().andEqualTo("departmentId",department.getId())
|
||||
.andNotEqualTo("type",0);
|
||||
.andNotEqualTo("type", UserTypeEnum.SYSTEM_ADMIN.getTypeCode());
|
||||
d.setTotal(userMapper.selectCountByExample(o1));
|
||||
departmentVOS.add(d);
|
||||
}
|
||||
|
@ -107,7 +111,7 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|||
for (Long userId : userIds) {
|
||||
User user = userMapper.selectByPrimaryKey(userId);
|
||||
//所有可用的
|
||||
if(user!=null&&user.getStatus()==1){
|
||||
if(user!=null&&user.getStatus()== UserStatusEnum.AVAILABLE.getStatusCode()){
|
||||
DeanVO deanVO = new DeanVO();
|
||||
deanVO.setName(user.getUsername());
|
||||
deanVO.setId(user.getId());
|
||||
|
@ -126,6 +130,8 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|||
*/
|
||||
@Override
|
||||
public void add(DepartmentVO departmentVO) {
|
||||
@NotNull(message = "系主任不能为空") Long mgrId = departmentVO.getMgrId();
|
||||
checkMgr(mgrId);
|
||||
Department department = new Department();
|
||||
BeanUtils.copyProperties(departmentVO,department);
|
||||
department.setCreateTime(new Date());
|
||||
|
@ -133,6 +139,27 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|||
departmentMapper.insert(department);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证部门主任
|
||||
* @param mgrId
|
||||
*/
|
||||
private void checkMgr(@NotNull(message = "系主任不能为空") Long mgrId) {
|
||||
User user = userMapper.selectByPrimaryKey(mgrId);
|
||||
if (user==null){
|
||||
throw new ServiceException("不存在该部门主任");
|
||||
}
|
||||
List<DeanVO> deanList = findDeanList();
|
||||
boolean isMgr=false;
|
||||
for (DeanVO deanVO : deanList) {
|
||||
if(deanVO.getId().equals(user.getId())){
|
||||
isMgr=true;
|
||||
}
|
||||
}
|
||||
if(!isMgr){
|
||||
throw new ServiceException("不存在该部门主任");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑院系
|
||||
* @param id
|
||||
|
@ -141,17 +168,25 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|||
@Override
|
||||
public DepartmentVO edit(Long id) {
|
||||
Department department = departmentMapper.selectByPrimaryKey(id);
|
||||
DepartmentVO departmentVO = DepartmentConverter.converterToDepartmentVO(department);
|
||||
return departmentVO;
|
||||
if(department==null){
|
||||
throw new ServiceException("编辑的部门不存在");
|
||||
}
|
||||
return DepartmentConverter.converterToDepartmentVO(department);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新院系
|
||||
* 更新部门
|
||||
* @param id
|
||||
* @param departmentVO
|
||||
*/
|
||||
@Override
|
||||
public void update(Long id, DepartmentVO departmentVO) {
|
||||
Department dbDepartment = departmentMapper.selectByPrimaryKey(id);
|
||||
@NotNull(message = "系主任不能为空") Long mgrId = departmentVO.getMgrId();
|
||||
if(dbDepartment==null){
|
||||
throw new ServiceException("要更新的部门不存在");
|
||||
}
|
||||
checkMgr(mgrId);
|
||||
Department department = new Department();
|
||||
BeanUtils.copyProperties(departmentVO,department);
|
||||
department.setId(id);
|
||||
|
@ -159,8 +194,16 @@ public class DepartmentServiceImpl implements DepartmentService {
|
|||
departmentMapper.updateByPrimaryKeySelective(department);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门信息
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
Department department = departmentMapper.selectByPrimaryKey(id);
|
||||
if(department==null){
|
||||
throw new ServiceException("要删除的部门不存在");
|
||||
}
|
||||
departmentMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.system.mapper.LogMapper;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.common.pojo.system.Log;
|
||||
import com.coderman.api.common.pojo.system.LoginLog;
|
||||
import com.coderman.api.system.mapper.LogMapper;
|
||||
import com.coderman.api.system.service.LogService;
|
||||
import com.coderman.api.system.vo.LogVO;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
|
@ -38,6 +39,7 @@ public class LogServiceImpl implements LogService {
|
|||
logMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageVO<LogVO> findLogList(Integer pageNum, Integer pageSize, LogVO logVO) {
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
|
@ -66,9 +68,17 @@ public class LogServiceImpl implements LogService {
|
|||
return new PageVO<>(info.getTotal(),logVOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param list
|
||||
*/
|
||||
@Override
|
||||
public void batchDelete(List<Long> list) {
|
||||
for (Long id : list) {
|
||||
Log log = logMapper.selectByPrimaryKey(id);
|
||||
if(log==null){
|
||||
throw new ServiceException("id="+id+",操作日志不存在");
|
||||
}
|
||||
delete(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.system.bean.ActiveUser;
|
||||
import com.coderman.api.system.mapper.LoginLogMapper;
|
||||
import com.coderman.api.common.bean.ActiveUser;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.common.pojo.system.LoginLog;
|
||||
import com.coderman.api.system.service.LoginLogService;
|
||||
import com.coderman.api.common.utils.AddressUtil;
|
||||
import com.coderman.api.common.utils.IPUtil;
|
||||
import com.coderman.api.system.mapper.LoginLogMapper;
|
||||
import com.coderman.api.system.service.LoginLogService;
|
||||
import com.coderman.api.system.vo.LoginLogVO;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import com.coderman.api.system.vo.UserVO;
|
||||
|
@ -18,6 +19,7 @@ import org.apache.shiro.SecurityUtils;
|
|||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
@ -80,6 +82,10 @@ public class LoginLogServiceImpl implements LoginLogService {
|
|||
@Override
|
||||
public void batchDelete(List<Long> list) {
|
||||
for (Long id : list) {
|
||||
LoginLog loginLog = loginLogMapper.selectByPrimaryKey(id);
|
||||
if(loginLog==null){
|
||||
throw new ServiceException("id="+id+"登入日志不存在");
|
||||
}
|
||||
delete(id);
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +104,7 @@ public class LoginLogServiceImpl implements LoginLogService {
|
|||
* 插入登入日志
|
||||
* @param request
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void add(HttpServletRequest request) {
|
||||
loginLogMapper.insert(createLoginLog(request));
|
||||
|
@ -128,8 +135,13 @@ public class LoginLogServiceImpl implements LoginLogService {
|
|||
* 删除登入日志
|
||||
* @param id
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
LoginLog loginLog = loginLogMapper.selectByPrimaryKey(id);
|
||||
if(loginLog==null){
|
||||
throw new ServiceException("登入日志不存在");
|
||||
}
|
||||
loginLogMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.system.converter.MenuConverter;
|
||||
import com.coderman.api.system.mapper.MenuMapper;
|
||||
import com.coderman.api.system.mapper.RoleMenuMapper;
|
||||
|
@ -63,6 +64,10 @@ public class MenuServiceImpl implements MenuService {
|
|||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
Menu menu = menuMapper.selectByPrimaryKey(id);
|
||||
if(menu==null){
|
||||
throw new ServiceException("菜单节点不存在");
|
||||
}
|
||||
menuMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.system.converter.RoleConverter;
|
||||
import com.coderman.api.system.mapper.MenuMapper;
|
||||
import com.coderman.api.system.mapper.RoleMapper;
|
||||
import com.coderman.api.system.mapper.RoleMenuMapper;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
import com.coderman.api.common.pojo.system.Role;
|
||||
import com.coderman.api.common.pojo.system.RoleMenu;
|
||||
import com.coderman.api.system.converter.RoleConverter;
|
||||
import com.coderman.api.system.enums.RoleStatusEnum;
|
||||
import com.coderman.api.system.mapper.RoleMapper;
|
||||
import com.coderman.api.system.mapper.RoleMenuMapper;
|
||||
import com.coderman.api.system.service.RoleService;
|
||||
import com.coderman.api.system.vo.PageVO;
|
||||
import com.coderman.api.system.vo.RoleVO;
|
||||
|
@ -18,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -36,9 +38,6 @@ public class RoleServiceImpl implements RoleService {
|
|||
@Autowired
|
||||
private RoleMenuMapper roleMenuMapper;
|
||||
|
||||
@Autowired
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
* @param pageNum
|
||||
|
@ -66,11 +65,18 @@ public class RoleServiceImpl implements RoleService {
|
|||
*/
|
||||
@Override
|
||||
public void add(RoleVO roleVO) {
|
||||
@NotBlank(message = "角色名必填") String roleName = roleVO.getRoleName();
|
||||
Example o = new Example(Role.class);
|
||||
o.createCriteria().andEqualTo("roleName",roleName);
|
||||
int i = roleMapper.selectCountByExample(o);
|
||||
if(i!=0){
|
||||
throw new ServiceException("该角色名已被占用");
|
||||
}
|
||||
Role role = new Role();
|
||||
BeanUtils.copyProperties(roleVO,role);
|
||||
role.setCreateTime(new Date());
|
||||
role.setModifiedTime(new Date());
|
||||
role.setStatus(1);
|
||||
role.setStatus(RoleStatusEnum.AVAILABLE.getStatusCode());//默认启用添加的角色
|
||||
roleMapper.insert(role);
|
||||
}
|
||||
|
||||
|
@ -81,6 +87,10 @@ public class RoleServiceImpl implements RoleService {
|
|||
@Transactional
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
Role role = roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new ServiceException("要删除的角色不存在");
|
||||
}
|
||||
roleMapper.deleteByPrimaryKey(id);
|
||||
//删除对应的[角色-菜单]记录
|
||||
Example o = new Example(RoleMenu.class);
|
||||
|
@ -88,27 +98,64 @@ public class RoleServiceImpl implements RoleService {
|
|||
roleMenuMapper.deleteByExample(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑角色信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public RoleVO edit(Long id) {
|
||||
Role role = roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new ServiceException("编辑的角色不存在");
|
||||
}
|
||||
RoleVO roleVO = new RoleVO();
|
||||
BeanUtils.copyProperties(role,roleVO);
|
||||
return roleVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色信息
|
||||
* @param id
|
||||
* @param roleVO
|
||||
*/
|
||||
@Override
|
||||
public void update(Long id, RoleVO roleVO) {
|
||||
@NotBlank(message = "角色名必填") String roleName = roleVO.getRoleName();
|
||||
Role dbRole = roleMapper.selectByPrimaryKey(id);
|
||||
if(dbRole==null){
|
||||
throw new ServiceException("要更新的角色不存在");
|
||||
}
|
||||
Example o = new Example(Role.class);
|
||||
o.createCriteria().andEqualTo("roleName",roleName);
|
||||
List<Role> roles = roleMapper.selectByExample(o);
|
||||
if(!CollectionUtils.isEmpty(roles)){
|
||||
Role role = roles.get(0);
|
||||
if(!role.getId().equals(id)){
|
||||
throw new ServiceException("该角色名已被占用");
|
||||
}
|
||||
}
|
||||
Role role = new Role();
|
||||
BeanUtils.copyProperties(roleVO,role);
|
||||
role.setModifiedTime(new Date());
|
||||
roleMapper.updateByPrimaryKeySelective(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色状态
|
||||
* @param id
|
||||
* @param status
|
||||
*/
|
||||
@Override
|
||||
public void updateStatus(Long id, Boolean status) {
|
||||
Role role = roleMapper.selectByPrimaryKey(id);
|
||||
if(role==null){
|
||||
throw new ServiceException("角色不存在");
|
||||
}
|
||||
Role t = new Role();
|
||||
t.setId(id);
|
||||
t.setStatus(status?0:1);
|
||||
t.setStatus(status?RoleStatusEnum.DISABLE.getStatusCode():
|
||||
RoleStatusEnum.AVAILABLE.getStatusCode());
|
||||
roleMapper.updateByPrimaryKeySelective(t);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.coderman.api.system.service.impl;
|
||||
|
||||
import com.coderman.api.common.bean.ActiveUser;
|
||||
import com.coderman.api.common.config.jwt.JWTToken;
|
||||
import com.coderman.api.common.exception.ErrorCodeEnum;
|
||||
import com.coderman.api.common.exception.ServiceException;
|
||||
|
@ -7,7 +8,6 @@ import com.coderman.api.common.pojo.system.*;
|
|||
import com.coderman.api.common.utils.JWTUtils;
|
||||
import com.coderman.api.common.utils.MD5Utils;
|
||||
import com.coderman.api.common.utils.MenuTreeBuilder;
|
||||
import com.coderman.api.system.bean.ActiveUser;
|
||||
import com.coderman.api.system.converter.MenuConverter;
|
||||
import com.coderman.api.system.converter.UserConverter;
|
||||
import com.coderman.api.system.enums.UserStatusEnum;
|
||||
|
@ -27,6 +27,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -83,9 +85,13 @@ public class UserServiceImpl implements UserService {
|
|||
*/
|
||||
@Override
|
||||
public List<Role> findRolesById(Long id) {
|
||||
User dbUser = userMapper.selectByPrimaryKey(id);
|
||||
if(dbUser==null){
|
||||
throw new ServiceException("该用户不存在");
|
||||
}
|
||||
List<Role> roles=new ArrayList<>();
|
||||
UserRole t = new UserRole();
|
||||
t.setUserId(id);
|
||||
t.setUserId(dbUser.getId());
|
||||
List<UserRole> userRoleList = userRoleMapper.select(t);
|
||||
List<Long> rids=new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(userRoleList)){
|
||||
|
@ -105,12 +111,12 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 查询用户的权限
|
||||
* 查询权限
|
||||
* @param roles 用户的角色
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Menu> findMenuById(List<Role> roles) {
|
||||
public List<Menu> findMenuByRoles(List<Role> roles) {
|
||||
List<Menu> menus=new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(roles)){
|
||||
Set<Long> menuIds=new HashSet<>();//存放用户的菜单id
|
||||
|
@ -208,6 +214,10 @@ public class UserServiceImpl implements UserService {
|
|||
@Transactional
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
User user = userMapper.selectByPrimaryKey(id);
|
||||
if(user==null){
|
||||
throw new ServiceException("要删除的用户不存在");
|
||||
}
|
||||
userMapper.deleteByPrimaryKey(id);
|
||||
//删除对应[用户-角色]记录
|
||||
Example o = new Example(UserRole.class);
|
||||
|
@ -223,6 +233,9 @@ public class UserServiceImpl implements UserService {
|
|||
@Override
|
||||
public void updateStatus(Long id, Boolean status) {
|
||||
User dbUser = userMapper.selectByPrimaryKey(id);
|
||||
if(dbUser==null){
|
||||
throw new ServiceException("要更新状态的用户不存在");
|
||||
}
|
||||
ActiveUser activeUser= (ActiveUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(dbUser.getId().equals(activeUser.getUser().getId())){
|
||||
throw new ServiceException(ErrorCodeEnum.DoNotAllowToDisableTheCurrentUser);
|
||||
|
@ -239,8 +252,21 @@ public class UserServiceImpl implements UserService {
|
|||
* 添加用户
|
||||
* @param userVO
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void add(UserVO userVO) {
|
||||
@NotBlank(message = "用户名不能为空") String username = userVO.getUsername();
|
||||
@NotNull(message = "部门id不能为空") Long departmentId = userVO.getDepartmentId();
|
||||
Example o = new Example(User.class);
|
||||
o.createCriteria().andEqualTo("username",username);
|
||||
int i = userMapper.selectCountByExample(o);
|
||||
if(i!=0){
|
||||
throw new ServiceException("该用户名已被占用");
|
||||
}
|
||||
Department department = departmentMapper.selectByPrimaryKey(departmentId);
|
||||
if(department==null){
|
||||
throw new ServiceException("该部门不存在");
|
||||
}
|
||||
User user = new User();
|
||||
BeanUtils.copyProperties(userVO,user);
|
||||
String salt=UUID.randomUUID().toString().substring(0,32);
|
||||
|
@ -259,12 +285,31 @@ public class UserServiceImpl implements UserService {
|
|||
* @param id
|
||||
* @param userVO
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void update(Long id,UserEditVO userVO) {
|
||||
User dbUser = userMapper.selectByPrimaryKey(id);
|
||||
@NotBlank(message = "用户名不能为空") String username = userVO.getUsername();
|
||||
@NotNull(message = "部门不能为空") Long departmentId = userVO.getDepartmentId();
|
||||
if(dbUser==null){
|
||||
throw new ServiceException("要删除的用户不存在");
|
||||
}
|
||||
Department department = departmentMapper.selectByPrimaryKey(departmentId);
|
||||
if(department==null){
|
||||
throw new ServiceException("该部门不存在");
|
||||
}
|
||||
Example o = new Example(User.class);
|
||||
o.createCriteria().andEqualTo("username",username);
|
||||
List<User> users = userMapper.selectByExample(o);
|
||||
if(!CollectionUtils.isEmpty(users)){
|
||||
if(!users.get(0).getId().equals(id)){
|
||||
throw new ServiceException("该用户名已被占用");
|
||||
}
|
||||
}
|
||||
User user = new User();
|
||||
BeanUtils.copyProperties(userVO,user);
|
||||
user.setModifiedTime(new Date());
|
||||
user.setId(id);
|
||||
user.setId(dbUser.getId());
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
|
@ -273,9 +318,13 @@ public class UserServiceImpl implements UserService {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public UserEditVO edit(Long id) {
|
||||
User user = userMapper.selectByPrimaryKey(id);
|
||||
if(user==null){
|
||||
throw new ServiceException("要编辑的用户不存在");
|
||||
}
|
||||
UserEditVO userEditVO = new UserEditVO();
|
||||
BeanUtils.copyProperties(user,userEditVO);
|
||||
Department department = departmentMapper.selectByPrimaryKey(user.getDepartmentId());
|
||||
|
@ -290,15 +339,23 @@ public class UserServiceImpl implements UserService {
|
|||
* @param id 用户id
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public List<Long> roles(Long id) {
|
||||
User user = userMapper.selectByPrimaryKey(id);
|
||||
if(user==null){
|
||||
throw new ServiceException("该用户不存在");
|
||||
}
|
||||
Example o = new Example(UserRole.class);
|
||||
o.createCriteria().andEqualTo("userId",id);
|
||||
o.createCriteria().andEqualTo("userId",user.getId());
|
||||
List<UserRole> userRoleList = userRoleMapper.selectByExample(o);
|
||||
List<Long> roleIds=new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(userRoleList)){
|
||||
for (UserRole userRole : userRoleList) {
|
||||
roleIds.add(userRole.getRoleId());
|
||||
Role role = roleMapper.selectByPrimaryKey(userRole.getRoleId());
|
||||
if(role!=null){
|
||||
roleIds.add(role.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return roleIds;
|
||||
|
@ -313,12 +370,25 @@ public class UserServiceImpl implements UserService {
|
|||
@Transactional
|
||||
public void assignRoles(Long id, Long[] rids) {
|
||||
//删除之前用户的所有角色
|
||||
User user = userMapper.selectByPrimaryKey(id);
|
||||
if(user==null){
|
||||
throw new ServiceException("用户不存在");
|
||||
}
|
||||
//删除之前分配的
|
||||
Example o = new Example(UserRole.class);
|
||||
o.createCriteria().andEqualTo("userId",id);
|
||||
o.createCriteria().andEqualTo("userId",user.getId());
|
||||
userRoleMapper.deleteByExample(o);
|
||||
//增加现在分配的
|
||||
if(rids.length>0){
|
||||
for (Long rid : rids) {
|
||||
Role role = roleMapper.selectByPrimaryKey(rid);
|
||||
if(role==null){
|
||||
throw new ServiceException("roleId="+rid+",该角色不存在");
|
||||
}
|
||||
//判断角色状态
|
||||
if(role.getStatus()==0){
|
||||
throw new ServiceException("roleName="+role.getRoleName()+",该角色已禁用");
|
||||
}
|
||||
UserRole userRole = new UserRole();
|
||||
userRole.setUserId(id);
|
||||
userRole.setRoleId(rid);
|
||||
|
|
|
@ -48,6 +48,7 @@ public class UserVO{
|
|||
|
||||
private String departmentName;
|
||||
|
||||
@NotNull(message = "部门id不能为空")
|
||||
private Long departmentId;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue