From 0317376e3477d23a3b6c872e41504110feeda0f3 Mon Sep 17 00:00:00 2001 From: 21819 Date: Sat, 20 Jan 2024 11:44:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E7=BD=91=E7=AB=AF=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=8C=85=E4=B8=8E=E4=B8=BB=E5=88=86=E6=94=AF?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mailbox-common/pom.xml | 22 +- .../java/com/biutag/cache/ConfigCache.java | 8 +- .../java/com/biutag/config/RedisConfig.java | 11 +- .../system/{SystemAuthDept.java => Dept.java} | 5 +- .../system/{SystemAuthMenu.java => Menu.java} | 2 +- .../system/{SystemAuthPerm.java => Perm.java} | 2 +- .../{SystemAuthAdmin.java => PoliceUser.java} | 53 ++- .../system/{SystemAuthPost.java => Post.java} | 2 +- .../system/{SystemAuthRole.java => Role.java} | 2 +- .../java/com/biutag/entity/system/User.java | 316 +++++++++++++ .../java/com/biutag/entity/user/User.java | 2 + .../biutag/mapper/setting/DictDataMapper.java | 13 + .../biutag/mapper/setting/DictTypeMapper.java | 12 + ...temAuthDeptMapper.java => DeptMapper.java} | 4 +- ...temAuthMenuMapper.java => MenuMapper.java} | 4 +- ...temAuthPermMapper.java => PermMapper.java} | 4 +- ...AdminMapper.java => PoliceUserMapper.java} | 9 +- ...temAuthPostMapper.java => PostMapper.java} | 4 +- ...temAuthRoleMapper.java => RoleMapper.java} | 4 +- .../main/java/com/biutag/util/RedisUtils.java | 4 +- mailbox-lan/pom.xml | 36 ++ .../java/com/biutag/lan/AdminInterceptor.java | 216 +++++++++ .../java/com/biutag/lan/AdminThreadLocal.java | 77 +++ .../java/com/biutag/lan/LanApplication.java | 14 +- .../src/main/java/com/biutag/lan/aop/Log.java | 29 ++ .../com/biutag/lan/aop/aspect/LogAspect.java | 171 +++++++ .../biutag/lan/aop/aspect/RequestType.java | 16 + .../com/biutag/lan/cache/CaptchaCache.java | 31 ++ .../com/biutag/lan/config/KaptChaConfig.java | 45 ++ .../biutag/lan/config/MybatisPlusConfig.java | 24 + .../com/biutag/lan/config/WebMvcConfig.java | 56 +++ .../biutag/lan/config/quartz/CronUtils.java | 54 +++ .../biutag/lan/config/quartz/InvokeUtils.java | 152 ++++++ .../biutag/lan/config/quartz/QuartzUtils.java | 104 +++++ .../lan/config/quartz/TaskConstants.java | 20 + .../quartz/exceution/AbstractQuartzJob.java | 81 ++++ .../quartz/exceution/QuartzDisExecution.java | 19 + .../quartz/exceution/QuartzJobExecution.java | 17 + .../biutag/lan/config/stp/StpInException.java | 42 ++ .../biutag/lan/config/stp/StpInterConfig.java | 90 ++++ .../lan/controller/IndexController.java | 41 ++ .../biutag/lan/controller/MailController.java | 28 ++ .../biutag/lan/controller/UserController.java | 53 +++ .../monitor/MonitorCacheController.java | 62 +++ .../monitor/MonitorServerController.java | 33 ++ .../setting/DictDataController.java | 82 ++++ .../setting/DictTypeController.java | 78 ++++ .../setting/SettingLoginController.java | 38 ++ .../setting/SettingNoticeController.java | 48 ++ .../setting/SettingUserController.java | 38 ++ .../lan/controller/system/DeptController.java | 72 +++ .../lan/controller/system/MenuController.java | 80 ++++ .../system/PoliceUserController.java | 107 +++++ .../lan/controller/system/PostController.java | 74 +++ .../lan/controller/system/RoleController.java | 78 ++++ .../system/SystemCacheController.java | 30 ++ .../system/SystemLoginController.java | 50 ++ .../system/SystemLogsController.java | 44 ++ .../java/com/biutag/lan/crontab/MyJob.java | 17 + .../main/java/com/biutag/lan/domain/Mail.java | 76 +++ .../com/biutag/lan/service/IDeptService.java | 66 +++ .../biutag/lan/service/IDictDataService.java | 68 +++ .../biutag/lan/service/IDictTypeService.java | 68 +++ .../com/biutag/lan/service/IIndexService.java | 23 + .../com/biutag/lan/service/IMenuService.java | 64 +++ .../com/biutag/lan/service/IPermService.java | 43 ++ .../lan/service/IPoliceUserService.java | 88 ++++ .../com/biutag/lan/service/IPostService.java | 68 +++ .../com/biutag/lan/service/IRoleService.java | 67 +++ .../lan/service/ISettingLoginService.java | 27 ++ .../lan/service/ISettingNoticeService.java | 40 ++ .../lan/service/ISettingUserService.java | 27 ++ .../lan/service/ISystemCacheService.java | 14 + .../lan/service/ISystemLoginService.java | 37 ++ .../biutag/lan/service/ISystemLogsServer.java | 34 ++ .../com/biutag/lan/service/IUserService.java | 50 ++ .../lan/service/impl/DeptServiceImpl.java | 228 +++++++++ .../lan/service/impl/DictDataServiceImpl.java | 225 +++++++++ .../lan/service/impl/DictTypeServiceImpl.java | 206 ++++++++ .../lan/service/impl/IndexServiceImpl.java | 95 ++++ .../lan/service/impl/MenuServiceImpl.java | 224 +++++++++ .../lan/service/impl/PermServiceImpl.java | 105 +++++ .../service/impl/PoliceUserServiceImpl.java | 442 ++++++++++++++++++ .../lan/service/impl/PostServiceImpl.java | 228 +++++++++ .../lan/service/impl/RoleServiceImpl.java | 221 +++++++++ .../service/impl/SettingLoginServiceImpl.java | 52 +++ .../impl/SettingNoticeServiceImpl.java | 169 +++++++ .../service/impl/SettingUserServiceImpl.java | 42 ++ .../service/impl/SystemCacheServiceImpl.java | 22 + .../service/impl/SystemLoginServiceImpl.java | 193 ++++++++ .../service/impl/SystemLogsServerImpl.java | 120 +++++ .../lan/service/impl/UserServiceImpl.java | 211 +++++++++ .../lan/validate/commons/IdValidate.java | 20 + .../lan/validate/commons/IdsValidate.java | 21 + .../lan/validate/commons/PageValidate.java | 25 + .../crontab/CrontabCreateValidate.java | 53 +++ .../crontab/CrontabUpdateValidate.java | 58 +++ .../setting/DictDataCreateValidate.java | 46 ++ .../setting/DictDataUpdateValidate.java | 50 ++ .../setting/DictTypeCreateValidate.java | 37 ++ .../setting/DictTypeUpdateValidate.java | 42 ++ .../setting/SettingLoginValidate.java | 30 ++ .../validate/setting/SettingUserValidate.java | 18 + .../validate/system/DeptCreateValidate.java | 50 ++ .../validate/system/DeptSearchValidate.java | 21 + .../validate/system/DeptUpdateValidate.java | 54 +++ .../validate/system/MenuCreateValidate.java | 79 ++++ .../validate/system/MenuUpdateValidate.java | 84 ++++ .../system/PoliceUserCreateValidate.java | 66 +++ .../system/PoliceUserLoginsValidate.java | 33 ++ .../system/PoliceUserSearchValidate.java | 30 ++ .../system/PoliceUserUpInfoValidate.java | 31 ++ .../system/PoliceUserUpdateValidate.java | 68 +++ .../validate/system/PostCreateValidate.java | 43 ++ .../validate/system/PostSearchValidate.java | 24 + .../validate/system/PostUpdateValidate.java | 48 ++ .../validate/system/RoleCreateValidate.java | 40 ++ .../validate/system/RoleUpdateValidate.java | 46 ++ .../system/SystemSearchLoginsValidate.java | 27 ++ .../system/SystemSearchOperateValidate.java | 39 ++ .../lan/validate/user/UserSearchValidate.java | 27 ++ .../lan/validate/user/UserUpdateValidate.java | 24 + .../lan/validate/user/UserWalletValidate.java | 30 ++ .../com/biutag/lan/vo/CrontabDetailVo.java | 45 ++ .../com/biutag/lan/vo/CrontabListedVo.java | 51 ++ .../com/biutag/lan/vo/setting/DictDataVo.java | 42 ++ .../com/biutag/lan/vo/setting/DictTypeVo.java | 36 ++ .../biutag/lan/vo/setting/SettingLoginVo.java | 31 ++ .../lan/vo/setting/SettingNoticeDetailVo.java | 39 ++ .../lan/vo/setting/SettingNoticeListedVo.java | 42 ++ .../biutag/lan/vo/setting/SettingUserVo.java | 18 + .../java/com/biutag/lan/vo/system/DeptVo.java | 45 ++ .../java/com/biutag/lan/vo/system/MenuVo.java | 65 +++ .../lan/vo/system/PoliceUserDetailVo.java | 110 +++++ .../lan/vo/system/PoliceUserInformVo.java | 51 ++ .../lan/vo/system/PoliceUserListedVo.java | 118 +++++ .../lan/vo/system/PoliceUserSelvesVo.java | 17 + .../java/com/biutag/lan/vo/system/PostVo.java | 39 ++ .../java/com/biutag/lan/vo/system/RoleVo.java | 42 ++ .../biutag/lan/vo/system/SystemCaptchaVo.java | 17 + .../lan/vo/system/SystemLogLoginVo.java | 36 ++ .../lan/vo/system/SystemLogOperateVo.java | 60 +++ .../biutag/lan/vo/system/SystemLoginVo.java | 21 + .../java/com/biutag/lan/vo/user/UserVo.java | 65 +++ .../src/main/resources/application.yml | 40 +- .../src/main/resources/log4j2-spring.xml | 80 ++++ .../outeradmin/config/MyBatisPlusConfig.java | 19 + .../outeradmin/controller/MailController.java | 65 +++ .../biutag/outeradmin/entity/FormData.java | 14 + .../com/biutag/outeradmin/entity/Mail.java | 72 +++ .../com/biutag/outeradmin/entity/MailID.java | 8 + .../biutag/outeradmin/mapper/MailMapper.java | 9 + .../outeradmin/service/MailService.java | 10 + .../com/biutag/outer/OuterApplication.java | 3 +- .../src/main/resources/application.yml | 34 +- 155 files changed, 9036 insertions(+), 45 deletions(-) rename mailbox-common/src/main/java/com/biutag/entity/system/{SystemAuthDept.java => Dept.java} (91%) rename mailbox-common/src/main/java/com/biutag/entity/system/{SystemAuthMenu.java => Menu.java} (96%) rename mailbox-common/src/main/java/com/biutag/entity/system/{SystemAuthPerm.java => Perm.java} (91%) rename mailbox-common/src/main/java/com/biutag/entity/system/{SystemAuthAdmin.java => PoliceUser.java} (53%) rename mailbox-common/src/main/java/com/biutag/entity/system/{SystemAuthPost.java => Post.java} (95%) rename mailbox-common/src/main/java/com/biutag/entity/system/{SystemAuthRole.java => Role.java} (94%) create mode 100644 mailbox-common/src/main/java/com/biutag/entity/system/User.java create mode 100644 mailbox-common/src/main/java/com/biutag/mapper/setting/DictDataMapper.java create mode 100644 mailbox-common/src/main/java/com/biutag/mapper/setting/DictTypeMapper.java rename mailbox-common/src/main/java/com/biutag/mapper/system/{SystemAuthDeptMapper.java => DeptMapper.java} (56%) rename mailbox-common/src/main/java/com/biutag/mapper/system/{SystemAuthMenuMapper.java => MenuMapper.java} (56%) rename mailbox-common/src/main/java/com/biutag/mapper/system/{SystemAuthPermMapper.java => PermMapper.java} (56%) rename mailbox-common/src/main/java/com/biutag/mapper/system/{SystemAuthAdminMapper.java => PoliceUserMapper.java} (56%) rename mailbox-common/src/main/java/com/biutag/mapper/system/{SystemAuthPostMapper.java => PostMapper.java} (56%) rename mailbox-common/src/main/java/com/biutag/mapper/system/{SystemAuthRoleMapper.java => RoleMapper.java} (56%) create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/AdminInterceptor.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/AdminThreadLocal.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/aop/Log.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/RequestType.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/cache/CaptchaCache.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/KaptChaConfig.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/MybatisPlusConfig.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/quartz/CronUtils.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/quartz/InvokeUtils.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/quartz/QuartzUtils.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/quartz/TaskConstants.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/AbstractQuartzJob.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzDisExecution.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzJobExecution.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInException.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/IndexController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/UserController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorCacheController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorServerController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictDataController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictTypeController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingLoginController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingNoticeController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingUserController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/PostController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/RoleController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemCacheController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLoginController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLogsController.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/crontab/MyJob.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IDictDataService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IDictTypeService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IIndexService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IMenuService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IPermService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IPostService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IRoleService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/ISettingLoginService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/ISettingNoticeService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/ISettingUserService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/ISystemCacheService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLoginService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLogsServer.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/IUserService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictDataServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictTypeServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/IndexServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/PermServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/PostServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/RoleServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingLoginServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingNoticeServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingUserServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemCacheServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLoginServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLogsServerImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/impl/UserServiceImpl.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdsValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/commons/PageValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingLoginValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingUserValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptSearchValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserLoginsValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserSearchValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpInfoValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostSearchValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleCreateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchLoginsValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchOperateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserSearchValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserUpdateValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserWalletValidate.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabDetailVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabListedVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictDataVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictTypeVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingLoginVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeDetailVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeListedVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingUserVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/DeptVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/MenuVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserDetailVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserListedVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserSelvesVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/PostVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/RoleVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemCaptchaVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogLoginVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogOperateVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLoginVo.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/user/UserVo.java create mode 100644 mailbox-lan/src/main/resources/log4j2-spring.xml create mode 100644 mailbox-outer-admin/src/main/java/com/biutag/outeradmin/config/MyBatisPlusConfig.java create mode 100644 mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java create mode 100644 mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java create mode 100644 mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/Mail.java create mode 100644 mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailID.java create mode 100644 mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/MailMapper.java create mode 100644 mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java diff --git a/mailbox-common/pom.xml b/mailbox-common/pom.xml index 3e3cfcf..3b8915f 100644 --- a/mailbox-common/pom.xml +++ b/mailbox-common/pom.xml @@ -36,18 +36,19 @@ org.springframework.boot spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-logging - - + + + + + + org.springframework.boot spring-boot-autoconfigure + @@ -98,10 +99,15 @@ + com.github.yulichang - mybatis-plus-join - 1.2.4 + mybatis-plus-join-boot-starter + 1.4.7.2 diff --git a/mailbox-common/src/main/java/com/biutag/cache/ConfigCache.java b/mailbox-common/src/main/java/com/biutag/cache/ConfigCache.java index 98c8bd2..c12ff08 100644 --- a/mailbox-common/src/main/java/com/biutag/cache/ConfigCache.java +++ b/mailbox-common/src/main/java/com/biutag/cache/ConfigCache.java @@ -44,7 +44,7 @@ public class ConfigCache { } map.put(typeItem, JSON.toJSONString(subMap)); } - RedisUtils.set(cacheKey, JSON.toJSONString(map)); + //RedisUtils.set(cacheKey, JSON.toJSONString(map)); } /** @@ -55,7 +55,7 @@ public class ConfigCache { * @return String */ public static String get(String type, String name) { - Object configs = RedisUtils.get(cacheKey); + Object configs = null;// RedisUtils.get(cacheKey); if (!StringUtils.isNull(configs) && !StringUtils.isEmpty(configs.toString())) { Map configType = MapUtils.jsonToMap(configs.toString()); if (!StringUtils.isEmpty(configType)) { @@ -92,7 +92,7 @@ public class ConfigCache { */ public static Map getConfigCache() { // 获取缓存 - Object config = RedisUtils.get(cacheKey); + Object config = null;// RedisUtils.get(cacheKey); RedisUtils.get(cacheKey); if (!StringUtils.isNull(config) && !StringUtils.isEmpty(config.toString())) { return MapUtils.jsonToMapAsObj(config.toString()); } @@ -103,7 +103,7 @@ public class ConfigCache { * 清除缓存 */ public static void clear() { - RedisUtils.del(cacheKey); + // RedisUtils.del(cacheKey); } } diff --git a/mailbox-common/src/main/java/com/biutag/config/RedisConfig.java b/mailbox-common/src/main/java/com/biutag/config/RedisConfig.java index 2cf3b8e..0d4e822 100644 --- a/mailbox-common/src/main/java/com/biutag/config/RedisConfig.java +++ b/mailbox-common/src/main/java/com/biutag/config/RedisConfig.java @@ -7,13 +7,16 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; -/** +/* +* * Redis配置 - */ -@Configuration +*/ + + +//Configuration public class RedisConfig { - @Bean(name = "redisTemplate") + //@Bean(name = "redisTemplate") public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){ RedisTemplate redisTemplate = new RedisTemplate<>(); StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); diff --git a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthDept.java b/mailbox-common/src/main/java/com/biutag/entity/system/Dept.java similarity index 91% rename from mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthDept.java rename to mailbox-common/src/main/java/com/biutag/entity/system/Dept.java index 5ba8550..97a8376 100644 --- a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthDept.java +++ b/mailbox-common/src/main/java/com/biutag/entity/system/Dept.java @@ -10,7 +10,7 @@ import java.io.Serializable; @Data @ApiModel("系统岗位实体") -public class SystemAuthDept implements Serializable { +public class Dept implements Serializable { private static final long serialVersionUID = 1L; @@ -24,6 +24,9 @@ public class SystemAuthDept implements Serializable { @ApiModelProperty("部门名称") private String name; + + @ApiModelProperty("部门全称") + private String fullName; @ApiModelProperty("负责人名") private String duty; diff --git a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthMenu.java b/mailbox-common/src/main/java/com/biutag/entity/system/Menu.java similarity index 96% rename from mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthMenu.java rename to mailbox-common/src/main/java/com/biutag/entity/system/Menu.java index 3b7ee42..3111957 100644 --- a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthMenu.java +++ b/mailbox-common/src/main/java/com/biutag/entity/system/Menu.java @@ -10,7 +10,7 @@ import java.io.Serializable; @Data @ApiModel("系统菜单实体") -public class SystemAuthMenu implements Serializable { +public class Menu implements Serializable { private static final long serialVersionUID = 1L; diff --git a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthPerm.java b/mailbox-common/src/main/java/com/biutag/entity/system/Perm.java similarity index 91% rename from mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthPerm.java rename to mailbox-common/src/main/java/com/biutag/entity/system/Perm.java index 482d039..b9293f5 100644 --- a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthPerm.java +++ b/mailbox-common/src/main/java/com/biutag/entity/system/Perm.java @@ -10,7 +10,7 @@ import java.io.Serializable; @Data @ApiModel("系统角色菜单实体") -public class SystemAuthPerm implements Serializable { +public class Perm implements Serializable { private static final long serialVersionUID = 1L; diff --git a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthAdmin.java b/mailbox-common/src/main/java/com/biutag/entity/system/PoliceUser.java similarity index 53% rename from mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthAdmin.java rename to mailbox-common/src/main/java/com/biutag/entity/system/PoliceUser.java index 92ed045..6a51176 100644 --- a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthAdmin.java +++ b/mailbox-common/src/main/java/com/biutag/entity/system/PoliceUser.java @@ -10,7 +10,7 @@ import java.io.Serializable; @Data @ApiModel("系统管理员实体") -public class SystemAuthAdmin implements Serializable { +public class PoliceUser implements Serializable { private static final long serialVersionUID = 1L; @@ -18,12 +18,19 @@ public class SystemAuthAdmin implements Serializable { @ApiModelProperty("ID") private Integer id; - @ApiModelProperty("用户账号") + @ApiModelProperty("用户账号") private String nickname; @ApiModelProperty("用户昵称") private String username; - + @ApiModelProperty("警号") + private String empNo; + @ApiModelProperty("身份证") + private String idCode; + @ApiModelProperty("职位名称") + private String displayName; + @ApiModelProperty("姓名") + private String name; @ApiModelProperty("用户密码") private String password; @@ -45,6 +52,44 @@ public class SystemAuthAdmin implements Serializable { @ApiModelProperty("排序编号") private Integer sort; + @ApiModelProperty("岗位主键") + private String districtId; + + @ApiModelProperty("工作") + private String job; + @ApiModelProperty("工作类型") + private String jobType; + @ApiModelProperty("未知") + private String managerId; + @ApiModelProperty("电话") + private String phone; + @ApiModelProperty("传真号") + private String faxNo; + @ApiModelProperty("职位名称") + private String postTitle; + @ApiModelProperty("工作地址") + private String workAddress; + @ApiModelProperty("账号") + private String account; + @ApiModelProperty("手机号") + private String mobile; + @ApiModelProperty("电子邮件") + private String email; + + @ApiModelProperty("性别") + private String gender; + @ApiModelProperty("出生年月") + private String birthday; + + @ApiModelProperty("状态") + private String status; + @ApiModelProperty("入职实际") + private String hiredAt; + @ApiModelProperty("类型 0 原始数据 1 协警 2 文员 3 临时工") + private String type; + + + @ApiModelProperty("多端登录: [0=否, 1=是]") private Integer isMultipoint; @@ -54,6 +99,8 @@ public class SystemAuthAdmin implements Serializable { @ApiModelProperty("是否删除: [0=否, 1=是]") private Integer isDelete; + + @ApiModelProperty("最后登录IP") private String lastLoginIp; diff --git a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthPost.java b/mailbox-common/src/main/java/com/biutag/entity/system/Post.java similarity index 95% rename from mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthPost.java rename to mailbox-common/src/main/java/com/biutag/entity/system/Post.java index 816e279..9754551 100644 --- a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthPost.java +++ b/mailbox-common/src/main/java/com/biutag/entity/system/Post.java @@ -10,7 +10,7 @@ import java.io.Serializable; @Data @ApiModel("系统岗位管理") -public class SystemAuthPost implements Serializable { +public class Post implements Serializable { private static final long serialVersionUID = 1L; diff --git a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthRole.java b/mailbox-common/src/main/java/com/biutag/entity/system/Role.java similarity index 94% rename from mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthRole.java rename to mailbox-common/src/main/java/com/biutag/entity/system/Role.java index f8ca225..9b60378 100644 --- a/mailbox-common/src/main/java/com/biutag/entity/system/SystemAuthRole.java +++ b/mailbox-common/src/main/java/com/biutag/entity/system/Role.java @@ -10,7 +10,7 @@ import java.io.Serializable; @Data @ApiModel("系统角色实体") -public class SystemAuthRole implements Serializable { +public class Role implements Serializable { private static final long serialVersionUID = 1L; diff --git a/mailbox-common/src/main/java/com/biutag/entity/system/User.java b/mailbox-common/src/main/java/com/biutag/entity/system/User.java new file mode 100644 index 0000000..3388c58 --- /dev/null +++ b/mailbox-common/src/main/java/com/biutag/entity/system/User.java @@ -0,0 +1,316 @@ +package com.biutag.entity.system; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +import java.io.Serializable; + + +/** + * 警员表 + * + * @author oumyye + * @email 526948379@qq.com + * @date 2024-01-18 14:20:00 + */ +@TableName( "police_user") +@Data +public class User implements Serializable { + private static final long serialVersionUID = 1L; + @TableId(value="id", type= IdType.AUTO) + @TableField("ID") + private Integer id; + // + @TableField("status") + private Integer status; + + // + @TableField("gender") + private Integer gender; + + // + @TableField("birthday") + private Long birthday; + + // + @TableField("manager_id") + private Long managerId; + + // + @TableField("org_id") + private Long orgId; + + // + + // + @TableField("account_id") + private Long accountId; + + // + @TableField("person_status") + private String personStatus; + + // + @TableField("image_path") + private String imagePath; + + // + @TableField("house_place") + private String housePlace; + + // + @TableField("politics_status") + private String politicsStatus; + + // + @TableField("is_party_team") + private String isPartyTeam; + + // + @TableField("created_at") + private String createdAt; + + // + @TableField("join_date") + private String joinDate; + + // + @TableField("zgcode") + private String zgcode; + + // + @TableField("manage_type") + private String manageType; + + // + @TableField("police_type") + private String policeType; + + // + @TableField("updated_at") + private String updatedAt; + + // + @TableField("birth_issue") + private String birthIssue; + + // + @TableField("avatar_url") + private String avatarUrl; + + // + @TableField("is_admin") + private String isAdmin; + + // + @TableField("work_address") + private String workAddress; + + // + @TableField("servant_date") + private String servantDate; + + // + @TableField("phone") + private String phone; + + // + @TableField("health_status") + private String healthStatus; + + // + @TableField("house_place_detail") + private String housePlaceDetail; + + // + @TableField("name") + private String name; + + // + @TableField("native_place") + private String nativePlace; + + // + @TableField("job") + private String job; + + // + @TableField("name_spell") + private String nameSpell; + + // + @TableField("marital_status") + private String maritalStatus; + + // + @TableField("police_library_mark") + private String policeLibraryMark; + + // + @TableField("display_name") + private String displayName; + + // + @TableField("register_type") + private String registerType; + + // + @TableField("blood_type") + private String bloodType; + + // + @TableField("multi_job_describe") + private String multiJobDescribe; + + // + @TableField("birth_place") + private String birthPlace; + + // + @TableField("speciality") + private String speciality; + + // + @TableField("work_date") + private String workDate; + + // + @TableField("user_image") + private String userImage; + + // + @TableField("person_rank") + private String personRank; + + // + @TableField("relation_depart") + private String relationDepart; + + // + @TableField("post_title") + private String postTitle; + + // + @TableField("police_rank_year") + private String policeRankYear; + + // + @TableField("user_pKId") + private String userPkid; + + // + @TableField("job_station") + private String jobStation; + + // + @TableField("job_type") + private String jobType; + + // + @TableField("person_type") + private String personType; + + // + @TableField("email") + private String email; + + // + @TableField("secret_mark") + private String secretMark; + + // + @TableField("id_code") + private String idCode; + + // + @TableField("work_start_date") + private String workStartDate; + + // + @TableField("is_adm_team") + private String isAdmTeam; + + // + @TableField("mobile") + private String mobile; + + // + @TableField("hired_at") + private String hiredAt; + + // + @TableField("emp_no") + private String empNo; + + // + @TableField("work_time") + private String workTime; + + // + @TableField("real_name") + private String realName; + + // + @TableField("district_id") + private String districtId; + + // + @TableField("fax_no") + private String faxNo; + + // + @TableField("grow_place") + private String growPlace; + + // + @TableField("work_depart") + private String workDepart; + + // + @TableField("accont") + private String accont; + + + @ApiModelProperty("加密盐巴") + private String salt; + + @ApiModelProperty("角色主键") + private String roleIds; + + @ApiModelProperty("部门主键") + private String deptIds; + + @ApiModelProperty("岗位主键") + private String postIds; + + @ApiModelProperty("排序编号") + private Integer sort; + + + + @ApiModelProperty("是否禁用: [0=否, 1=是]") + private Integer isDisable; + + @ApiModelProperty("是否删除: [0=否, 1=是]") + private Integer isDelete; + + @ApiModelProperty("最后登录IP") + private String lastLoginIp; + + @ApiModelProperty("最后登录时间") + private Long lastLoginTime; + + @ApiModelProperty("创建时间") + private Long createTime; + + @ApiModelProperty("更新时间") + private Long updateTime; + + @ApiModelProperty("删除时间") + private Long deleteTime; +} diff --git a/mailbox-common/src/main/java/com/biutag/entity/user/User.java b/mailbox-common/src/main/java/com/biutag/entity/user/User.java index 1528d61..d68b2ad 100644 --- a/mailbox-common/src/main/java/com/biutag/entity/user/User.java +++ b/mailbox-common/src/main/java/com/biutag/entity/user/User.java @@ -2,6 +2,7 @@ package com.biutag.entity.user; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -11,6 +12,7 @@ import java.math.BigDecimal; @Data @ApiModel("用户信息实体") +@TableName("user") public class User implements Serializable { private static final long serialVersionUID = 1L; diff --git a/mailbox-common/src/main/java/com/biutag/mapper/setting/DictDataMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/setting/DictDataMapper.java new file mode 100644 index 0000000..5beed4d --- /dev/null +++ b/mailbox-common/src/main/java/com/biutag/mapper/setting/DictDataMapper.java @@ -0,0 +1,13 @@ +package com.biutag.mapper.setting; + + +import com.biutag.core.basics.IBaseMapper; +import com.biutag.entity.setting.DictData; +import org.apache.ibatis.annotations.Mapper; + +/** + * 字典数据Mapper + */ +@Mapper +public interface DictDataMapper extends IBaseMapper { +} diff --git a/mailbox-common/src/main/java/com/biutag/mapper/setting/DictTypeMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/setting/DictTypeMapper.java new file mode 100644 index 0000000..7f04696 --- /dev/null +++ b/mailbox-common/src/main/java/com/biutag/mapper/setting/DictTypeMapper.java @@ -0,0 +1,12 @@ +package com.biutag.mapper.setting; + +import com.biutag.core.basics.IBaseMapper; +import com.biutag.entity.setting.DictType; +import org.apache.ibatis.annotations.Mapper; + +/** + * 字典类型Mapper + */ +@Mapper +public interface DictTypeMapper extends IBaseMapper { +} diff --git a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthDeptMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/system/DeptMapper.java similarity index 56% rename from mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthDeptMapper.java rename to mailbox-common/src/main/java/com/biutag/mapper/system/DeptMapper.java index bab7d97..021d086 100644 --- a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthDeptMapper.java +++ b/mailbox-common/src/main/java/com/biutag/mapper/system/DeptMapper.java @@ -1,12 +1,12 @@ package com.biutag.mapper.system; import com.biutag.core.basics.IBaseMapper; -import com.biutag.entity.system.SystemAuthDept; +import com.biutag.entity.system.Dept; import org.apache.ibatis.annotations.Mapper; /** * 系统岗位Mapper */ @Mapper -public interface SystemAuthDeptMapper extends IBaseMapper { +public interface DeptMapper extends IBaseMapper { } diff --git a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthMenuMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/system/MenuMapper.java similarity index 56% rename from mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthMenuMapper.java rename to mailbox-common/src/main/java/com/biutag/mapper/system/MenuMapper.java index 2155a0d..ed9bc12 100644 --- a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthMenuMapper.java +++ b/mailbox-common/src/main/java/com/biutag/mapper/system/MenuMapper.java @@ -1,12 +1,12 @@ package com.biutag.mapper.system; import com.biutag.core.basics.IBaseMapper; -import com.biutag.entity.system.SystemAuthMenu; +import com.biutag.entity.system.Menu; import org.apache.ibatis.annotations.Mapper; /** * 系统菜单Mapper */ @Mapper -public interface SystemAuthMenuMapper extends IBaseMapper { +public interface MenuMapper extends IBaseMapper { } diff --git a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthPermMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/system/PermMapper.java similarity index 56% rename from mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthPermMapper.java rename to mailbox-common/src/main/java/com/biutag/mapper/system/PermMapper.java index fed07c5..1218531 100644 --- a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthPermMapper.java +++ b/mailbox-common/src/main/java/com/biutag/mapper/system/PermMapper.java @@ -1,12 +1,12 @@ package com.biutag.mapper.system; import com.biutag.core.basics.IBaseMapper; -import com.biutag.entity.system.SystemAuthPerm; +import com.biutag.entity.system.Perm; import org.apache.ibatis.annotations.Mapper; /** * 角色菜单Mapper */ @Mapper -public interface SystemAuthPermMapper extends IBaseMapper { +public interface PermMapper extends IBaseMapper { } diff --git a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthAdminMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/system/PoliceUserMapper.java similarity index 56% rename from mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthAdminMapper.java rename to mailbox-common/src/main/java/com/biutag/mapper/system/PoliceUserMapper.java index e87cf28..5ded745 100644 --- a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthAdminMapper.java +++ b/mailbox-common/src/main/java/com/biutag/mapper/system/PoliceUserMapper.java @@ -1,7 +1,7 @@ package com.biutag.mapper.system; import com.biutag.core.basics.IBaseMapper; -import com.biutag.entity.system.SystemAuthAdmin; +import com.biutag.entity.system.PoliceUser; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; @@ -11,7 +11,7 @@ import java.util.List; * 系统管理员Mapper */ @Mapper -public interface SystemAuthAdminMapper extends IBaseMapper { +public interface PoliceUserMapper extends IBaseMapper { /** * 获取角色管理员 @@ -20,7 +20,10 @@ public interface SystemAuthAdminMapper extends IBaseMapper { * @param id 文件夹ID * @return List */ - @Select("SELECT id FROM ${prefix}system_auth_admin WHERE is_delete=0 AND FIND_IN_SET(#{id}, role_ids)") + //@Select("SELECT id FROM system_auth_admin WHERE is_delete=0 AND find_in_set(#{id}, role_ids)") + + @Select("SELECT id FROM police_user WHERE is_delete=0 AND #{id} = ANY (STRING_TO_ARRAY(role_ids, ','))") + List selectChildrenById(Integer id); } diff --git a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthPostMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/system/PostMapper.java similarity index 56% rename from mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthPostMapper.java rename to mailbox-common/src/main/java/com/biutag/mapper/system/PostMapper.java index 89ba016..27231cc 100644 --- a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthPostMapper.java +++ b/mailbox-common/src/main/java/com/biutag/mapper/system/PostMapper.java @@ -1,12 +1,12 @@ package com.biutag.mapper.system; import com.biutag.core.basics.IBaseMapper; -import com.biutag.entity.system.SystemAuthPost; +import com.biutag.entity.system.Post; import org.apache.ibatis.annotations.Mapper; /** * 系统岗位Mapper */ @Mapper -public interface SystemAuthPostMapper extends IBaseMapper { +public interface PostMapper extends IBaseMapper { } diff --git a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthRoleMapper.java b/mailbox-common/src/main/java/com/biutag/mapper/system/RoleMapper.java similarity index 56% rename from mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthRoleMapper.java rename to mailbox-common/src/main/java/com/biutag/mapper/system/RoleMapper.java index 17fc9e4..799024c 100644 --- a/mailbox-common/src/main/java/com/biutag/mapper/system/SystemAuthRoleMapper.java +++ b/mailbox-common/src/main/java/com/biutag/mapper/system/RoleMapper.java @@ -1,12 +1,12 @@ package com.biutag.mapper.system; import com.biutag.core.basics.IBaseMapper; -import com.biutag.entity.system.SystemAuthRole; +import com.biutag.entity.system.Role; import org.apache.ibatis.annotations.Mapper; /** * 系统角色Mapper */ @Mapper -public interface SystemAuthRoleMapper extends IBaseMapper { +public interface RoleMapper extends IBaseMapper { } diff --git a/mailbox-common/src/main/java/com/biutag/util/RedisUtils.java b/mailbox-common/src/main/java/com/biutag/util/RedisUtils.java index 83bbed9..f224bb4 100644 --- a/mailbox-common/src/main/java/com/biutag/util/RedisUtils.java +++ b/mailbox-common/src/main/java/com/biutag/util/RedisUtils.java @@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit; /** * Redis工具 */ -@Component +//@Component public class RedisUtils { private static RedisTemplate redisTemplate; @@ -29,7 +29,7 @@ public class RedisUtils { * @author fzr * @param redisTemplate Redis对象 */ - @Resource + //@Resource public void setRedisTemplate(RedisTemplate redisTemplate) { RedisUtils.redisTemplate = redisTemplate; } diff --git a/mailbox-lan/pom.xml b/mailbox-lan/pom.xml index 504d563..472bac4 100644 --- a/mailbox-lan/pom.xml +++ b/mailbox-lan/pom.xml @@ -62,6 +62,42 @@ ${groupId} mailbox-common + + org.springframework.boot + spring-boot-starter-actuator + + + + com.github.penggle + kaptcha + 2.3.2 + + + + + + cn.dev33 + sa-token-spring-boot3-starter + 1.37.0 + + + + + + + + + + + + org.quartz-scheduler + quartz + 2.3.2 + + + org.apache.tomcat.embed + tomcat-embed-core + diff --git a/mailbox-lan/src/main/java/com/biutag/lan/AdminInterceptor.java b/mailbox-lan/src/main/java/com/biutag/lan/AdminInterceptor.java new file mode 100644 index 0000000..e851820 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/AdminInterceptor.java @@ -0,0 +1,216 @@ +package com.biutag.lan; + +import cn.dev33.satoken.stp.StpUtil; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.aop.NotLogin; +import com.biutag.aop.NotPower; +import com.biutag.core.AjaxResult; +import com.biutag.entity.system.PoliceUser; +import com.biutag.enums.ErrorEnum; +import com.biutag.exception.LoginException; +import com.biutag.mapper.system.PoliceUserMapper; +import com.biutag.util.StringUtils; +import com.biutag.util.YmlUtils; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.jetbrains.annotations.NotNull; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; + + + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; + +/** + * 拦截器 + */ +@Component +public class AdminInterceptor implements HandlerInterceptor { + + @Resource + PoliceUserMapper PoliceUserMapper; + + /** + * 前置处理器 + * + * @param request 请求 + * @param response 响应 + * @param handler 处理 + * @return boolean + * @throws Exception 异常 + */ + @Override + public boolean preHandle(@NotNull HttpServletRequest request, + @NotNull HttpServletResponse response, + @NotNull Object handler) throws Exception { + + // 请求方法类型 + String reqUri = request.getRequestURI(); + if (!(handler instanceof HandlerMethod) || !reqUri.startsWith("/api")) { + return HandlerInterceptor.super.preHandle(request, response, handler); + } + + // 登录权限校验 + try { + response.setContentType("application/json;charset=utf-8"); + Method method = this.obtainAop(handler); + this.checkLogin(method, reqUri); + } catch (LoginException e) { + AjaxResult result = AjaxResult.failed(e.getCode(), e.getMsg()); + response.getWriter().print(JSON.toJSONString(result)); + return false; + } + + // 演示环境拦截 + String env = YmlUtils.get("like.production"); + if (StringUtils.isNotNull(env) && env.equals("true")) { + String prefix = "/api/"; + String route = request.getRequestURI().replaceFirst(prefix, ""); + String auths = route.replace("/", ":"); + List ignoreUrl = Arrays.asList("system:login", "system:logout"); + if (request.getMethod().equals("POST") && !ignoreUrl.contains(auths)) { + String message = "演示环境不支持修改数据,请下载源码本地部署体验"; + AjaxResult result = AjaxResult.failed(ErrorEnum.NO_PERMISSION.getCode(), message); + response.getWriter().print(JSON.toJSONString(result)); + return false; + } + } + + // 验证通过继续 + return HandlerInterceptor.super.preHandle(request, response, handler); + } + + /** + * 后置处理器 + * + * @param request 请求 + * @param response 响应 + * @param handler 处理 + * @param ex 异常 + * @throws Exception 异常 + */ + @Override + public void afterCompletion(@NotNull HttpServletRequest request, + @NotNull HttpServletResponse response, + @NotNull Object handler, Exception ex) throws Exception { + AdminThreadLocal.remove(); + HandlerInterceptor.super.afterCompletion(request, response, handler, ex); + } + + /** + * 提取注解 + * + * @param handler 处理器 + * @return Method + * @throws Exception 异常 + */ + private Method obtainAop(@NotNull Object handler) throws Exception { + String[] objArr = handler.toString().split("#"); + String methodStr = objArr[1].split("\\(")[0]; + String classStr = objArr[0]; + Class clazz = Class.forName(classStr); + + Method[] methods = clazz.getDeclaredMethods(); + for (Method method : methods) { + if (method.getName().equals(methodStr)) { + return method; + } + } + + return null; + } + + /** + * 登录验证 + * + * @param method 方法类 + * @author fzr + */ + private void checkLogin(Method method, String reqUri) { + for (int i=0; i<=0; i++) { + // 免登校验 + if (StringUtils.isNotNull(method) && method.isAnnotationPresent(NotLogin.class)) { + break; + } + + // 令牌校验 + String token = StpUtil.getTokenValue(); + if (StringUtils.isNull(token) || StringUtils.isBlank(token)) { + Integer errCode = ErrorEnum.TOKEN_EMPTY.getCode(); + String errMsg = ErrorEnum.TOKEN_EMPTY.getMsg(); + throw new LoginException(errCode, errMsg); + } + + // 登录校验 + Object id = StpUtil.getLoginId(); + if (StringUtils.isNull(id)) { + Integer errCode = ErrorEnum.TOKEN_INVALID.getCode(); + String errMsg = ErrorEnum.TOKEN_INVALID.getMsg(); + throw new LoginException(errCode, errMsg); + } + + // 用户校验 + PoliceUser adminUser = PoliceUserMapper.selectOne( + new QueryWrapper() + .select("id,username,emp_no,role_ids,dept_ids,post_ids,is_disable") + .eq("id", Integer.parseInt(id.toString())) + .eq("is_delete", 0) + .last("limit 1")); + + // 删除校验 + if (StringUtils.isNull(adminUser)) { + Integer errCode = ErrorEnum.TOKEN_INVALID.getCode(); + String errMsg = ErrorEnum.TOKEN_INVALID.getMsg(); + throw new LoginException(errCode, errMsg); + } + + // 禁用校验 + if (adminUser.getIsDisable().equals(1)) { + Integer errCode = ErrorEnum.LOGIN_DISABLE_ERROR.getCode(); + String errMsg = ErrorEnum.LOGIN_DISABLE_ERROR.getMsg(); + throw new LoginException(errCode, errMsg); + } + + // 写入线程 + AdminThreadLocal.put("adminId", id); + AdminThreadLocal.put("username", adminUser.getUsername()); + AdminThreadLocal.put("roleIds", adminUser.getRoleIds()); + AdminThreadLocal.put("deptIds", adminUser.getDeptIds()); + AdminThreadLocal.put("postIds", adminUser.getPostIds()); + + // 权限校验 + if (!adminUser.getId().equals(1)) { + this.checkAuth(method, reqUri); + } + } + } + + /** + * 权限验证 + * + * @param method 方法类 + * @param uri 请求路由 + * @author fzr + */ + private void checkAuth(Method method, String uri) { + for (int i=0; i<=0; i++) { + // 免权限校验 + if (StringUtils.isNotNull(method) && method.isAnnotationPresent(NotPower.class)) { + break; + } + + // 路由转权限 + String prefix = "/api/"; + String route = uri.replaceFirst(prefix, ""); + String auths = route.replace("/", ":"); + + // 校验权限 + StpUtil.checkPermission(auths); + } + } +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/AdminThreadLocal.java b/mailbox-lan/src/main/java/com/biutag/lan/AdminThreadLocal.java new file mode 100644 index 0000000..dcf9a6a --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/AdminThreadLocal.java @@ -0,0 +1,77 @@ +package com.biutag.lan; + + + +import com.biutag.util.ListUtils; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentSkipListMap; + +/** + * 本地线程 + */ +public class AdminThreadLocal { + + /** + * 构造方法 + */ + public AdminThreadLocal() {} + + /** + * 取得本地线程对象 + */ + private static final ThreadLocal> MY_LOCAL = new ThreadLocal<>(); + + /** + * 写入本地线程 + */ + public static void put(String key, Object val) { + Map map = MY_LOCAL.get(); + if (map == null) { + synchronized (MY_LOCAL) { + map = new ConcurrentSkipListMap<>(); + } + } + map.put(key, val); + MY_LOCAL.set(map); + } + + /** + * 获取本地线程 + */ + public static Object get(String key) { + return MY_LOCAL.get().getOrDefault(key, ""); + } + + /** + * 获取管理员ID + */ + public static Integer getAdminId() { + String adminId = AdminThreadLocal.get("adminId").toString(); + if (adminId.equals("")) { + return 0; + } + return Integer.parseInt(adminId); + } + + /** + * 获取角色ID + */ + public static List getRoleIds() { + String roleIds = AdminThreadLocal.get("roleIds").toString(); + if (roleIds.equals("") || roleIds.equals("0")) { + return Collections.emptyList(); + } + return ListUtils.stringToListAsInt(roleIds, ","); + } + + /** + * 删除本地线程 + */ + public static void remove() { + MY_LOCAL.remove(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/LanApplication.java b/mailbox-lan/src/main/java/com/biutag/lan/LanApplication.java index 20c1ccf..ee1bb11 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/LanApplication.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/LanApplication.java @@ -1,8 +1,20 @@ package com.biutag.lan; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; -@SpringBootApplication +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@ComponentScan(basePackages = {"com.biutag.*"}) +@MapperScan(basePackages = {"com.biutag.mapper","com.biutag.lan.mapper"}) +@EnableTransactionManagement +@SpringBootApplication(exclude = {RedisAutoConfiguration.class,RedisRepositoriesAutoConfiguration.class}) public class LanApplication { public static void main(String[] args) { diff --git a/mailbox-lan/src/main/java/com/biutag/lan/aop/Log.java b/mailbox-lan/src/main/java/com/biutag/lan/aop/Log.java new file mode 100644 index 0000000..0498b2d --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/aop/Log.java @@ -0,0 +1,29 @@ +package com.biutag.lan.aop; + +import com.biutag.lan.aop.aspect.RequestType; + +import java.lang.annotation.*; + +/** + * 日志记录类 + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Log { + + /** + * 模块名称 + * + * @return String + */ + String title() default ""; + + /** + * 请求类型 + * + * @return String + */ + RequestType requestType() default RequestType.Default; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java b/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java new file mode 100644 index 0000000..4fbc657 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/LogAspect.java @@ -0,0 +1,171 @@ +package com.biutag.lan.aop.aspect; + +import com.alibaba.fastjson2.JSON; +import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.aop.Log; +import com.biutag.entity.system.SystemLogOperate; +import com.biutag.mapper.system.SystemLogOperateMapper; +import com.biutag.util.IpUtils; +import com.biutag.util.RequestUtils; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest; + + +import java.lang.reflect.Method; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; + +@Aspect +@Component +public class LogAspect { + + @Resource + SystemLogOperateMapper systemLogOperateMapper; + + private static final Logger log = LoggerFactory.getLogger(LogAspect.class); + + /** + * 线程本地变量 + */ + private static final ThreadLocal threadLocal = new ThreadLocal<>(); + + /** + * 单线程化的线程池 + */ + private final ExecutorService executor = Executors.newSingleThreadExecutor(); + + /** + * 声明切面点拦截那些类 + */ + @Pointcut("@annotation(com.biutag.lan.aop.Log)") + private void pointCutMethodController() {} + + /** + * 环绕通知前后增强 + */ + @Around(value = "pointCutMethodController()") + public Object doAroundService(ProceedingJoinPoint joinPoint) throws Throwable { + // 开始时间 + threadLocal.set(System.currentTimeMillis()); + // 执行方法 + Object result = joinPoint.proceed(); + // 保存日志 + recordLog(joinPoint, null); + // 返回结果 + return result; + } + + /** + * 拦截异常操作 + * + * @param joinPoint 切点 + * @param e 异常 + */ + @AfterThrowing(value = "@annotation(controllerLog)", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e) { + recordLog(joinPoint, e); + } + + /** + * 记录日志信息 + * + * @param joinPointObj joinPoint + * @param e Exception 错误异常 + */ + private void recordLog(Object joinPointObj, final Exception e) { + try { + long beginTime = threadLocal.get(); + long endTime = System.currentTimeMillis(); + ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + if (requestAttributes != null) { + // 取得请求对象 + HttpServletRequest request = requestAttributes.getRequest(); + + // 获取当前的用户 + Integer adminId = AdminThreadLocal.getAdminId(); + + // 获取日志注解 + ProceedingJoinPoint joinPoint = (ProceedingJoinPoint) joinPointObj; + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + Log logAnnotation = method.getAnnotation(Log.class); + + // 方法名称 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + + // 获取请求参数 + String queryString = request.getQueryString(); + Object[] args = joinPoint.getArgs(); + String params = ""; + if (args.length > 0) { + if("POST".equals(request.getMethod())){ + if (RequestType.File.equals(logAnnotation.requestType())){ + //文件类型获取文件名称作为参数 + StandardMultipartHttpServletRequest standardMultipartHttpServletRequest = (StandardMultipartHttpServletRequest) args[0]; + //提取文件名 + params = standardMultipartHttpServletRequest + .getMultiFileMap() + .values() + .stream() + .map(m -> m.stream() + .map(MultipartFile::getOriginalFilename) + .collect(Collectors.joining(","))) + .collect(Collectors.joining(",")); + } else { + params = JSON.toJSONString(args); + } + + } else if("GET".equals(request.getMethod())){ + params = queryString; + } + } + + // 错误信息 + String error = ""; + int status = 1; + if (e != null) { + error = e.getMessage(); + status = 2; // 1=成功, 2=失败 + } + + // 数据库日志 + SystemLogOperate model = new SystemLogOperate(); + model.setAdminId(adminId); + model.setTitle(logAnnotation.title()); + model.setIp(IpUtils.getIpAddress()); + model.setType(request.getMethod()); + model.setMethod(className + "." + methodName + "()"); + model.setUrl(RequestUtils.route()); + model.setArgs(params); + model.setError(error); + model.setStatus(status); + model.setStartTime(beginTime / 1000); + model.setEndTime(endTime / 1000); + model.setTaskTime(endTime - beginTime); + model.setCreateTime(System.currentTimeMillis() / 1000); + executor.submit(() -> { + systemLogOperateMapper.insert(model); + }); + } + } catch (Exception ex) { + log.error("异常信息:{}", ex.getMessage()); + } + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/RequestType.java b/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/RequestType.java new file mode 100644 index 0000000..111ea19 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/aop/aspect/RequestType.java @@ -0,0 +1,16 @@ +package com.biutag.lan.aop.aspect; + +/** + * 请求参数类 + */ +public enum RequestType { + /** + * 文件类型 + */ + File, + /** + * 默认数据类型 + */ + Default + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/cache/CaptchaCache.java b/mailbox-lan/src/main/java/com/biutag/lan/cache/CaptchaCache.java new file mode 100644 index 0000000..1c358a5 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/cache/CaptchaCache.java @@ -0,0 +1,31 @@ +package com.biutag.lan.cache; + +import com.biutag.util.*; + +/** + * 验证码缓存器 + */ +public class CaptchaCache { + + public static String get(String uuid) { + String ip = IpUtils.getIpAddress().replaceAll("\\.", ""); + String captchaKey = YmlUtils.get("like.captcha.token") + ip + ":" + uuid; + Object code = null;// RedisUtils.get(captchaKey); + + if (StringUtils.isNull(code) || StringUtils.isEmpty(code.toString())) { + return ""; + } + + //RedisUtils.del(captchaKey); + return code.toString(); + } + + public static void set(String code, String uuid) { + String ip = IpUtils.getIpAddress().replaceAll("\\.", ""); + String verifyKey = YmlUtils.get("like.captcha.token") + ip + ":" + uuid; + long expireTime = Long.parseLong(YmlUtils.get("like.captcha.expire")); + + //RedisUtils.set(verifyKey, code.toLowerCase(), expireTime); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/KaptChaConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/config/KaptChaConfig.java new file mode 100644 index 0000000..e770ccc --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/KaptChaConfig.java @@ -0,0 +1,45 @@ +package com.biutag.lan.config; + +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Properties; + +import static com.google.code.kaptcha.Constants.*; + +/** + * 验证码配置 + */ +@Configuration +public class KaptChaConfig { + + @Bean(name = "captchaProducer") + public DefaultKaptcha getKaptchaBean() { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否边框 + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 字符颜色 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black"); + // 图片宽度 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 图片高度 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 字符大小 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38"); + // 验证键码 + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode"); + // 字符长度 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); + // 字体样式 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 图片样式 + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} + diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/MybatisPlusConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/config/MybatisPlusConfig.java new file mode 100644 index 0000000..bf6dda3 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/MybatisPlusConfig.java @@ -0,0 +1,24 @@ +package com.biutag.lan.config; + +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * MybatisPlus配置 + */ +@Configuration +public class MybatisPlusConfig { + + /** + * 分页插件集成 + */ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); + return interceptor; + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java new file mode 100644 index 0000000..3856397 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/WebMvcConfig.java @@ -0,0 +1,56 @@ +package com.biutag.lan.config; + + +import com.biutag.config.GlobalConfig; +import com.biutag.lan.AdminInterceptor; +import com.biutag.util.YmlUtils; +import jakarta.annotation.Resource; +import org.jetbrains.annotations.NotNull; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + + +/** + * Web配置 + */ +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + + @Resource + AdminInterceptor adminInterceptor; + + /** + * 配置允许跨域 + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedHeaders("*") + .allowedMethods("GET", "POST", "DELETE", "PUT") + .maxAge(3600); + } + + /** + * 登录拦截器 + */ + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(adminInterceptor) + .addPathPatterns("/**"); + } + + /** + * 资源目录映射 + */ + @Override + public void addResourceHandlers(@NotNull ResourceHandlerRegistry registry) { + String directory = YmlUtils.get("like.upload-directory"); + registry.addResourceHandler("/"+ GlobalConfig.publicPrefix +"/**") + .addResourceLocations("file:" + directory); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/CronUtils.java b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/CronUtils.java new file mode 100644 index 0000000..51d1185 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/CronUtils.java @@ -0,0 +1,54 @@ +package com.biutag.lan.config.quartz; + +import org.quartz.CronExpression; + +import java.text.ParseException; +import java.util.Date; + +/** + * 表达式工具 + */ +public class CronUtils { + + /** + * 验证表达式是否有效 + * + * @param cronExpression 表达式 + * @return true=有效,false=无效 + */ + public static boolean isValid(String cronExpression) { + return CronExpression.isValidExpression(cronExpression); + } + + /** + * 验证表达式消息无效给出有效性 + * + * @param cronExpression 表达式 + * @return null=有效, 其它=无效时的错误描述 + */ + public static String invalidMessage(String cronExpression) { + try { + new CronExpression(cronExpression); + return null; + } catch (ParseException pe) { + return pe.getMessage(); + } + } + + /** + * 下一个执行时间点 + * + * @param cronExpression n表达式 + * @return Date下次表达式执行时间 + */ + public static Date nextExecution(String cronExpression) + { + try { + CronExpression cron = new CronExpression(cronExpression); + return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); + } catch (ParseException e) { + throw new IllegalArgumentException(e.getMessage()); + } + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/InvokeUtils.java b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/InvokeUtils.java new file mode 100644 index 0000000..71f4200 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/InvokeUtils.java @@ -0,0 +1,152 @@ +package com.biutag.lan.config.quartz; + +import com.biutag.entity.Crontab; +import com.biutag.util.SpringUtils; +import com.biutag.util.StringUtils; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.LinkedList; +import java.util.List; + +/** + * 执行工具 + */ +public class InvokeUtils { + + /** + * 执行方法 + * + * @param crontab 系统任务 + */ + public static void invokeMethod(Crontab crontab) throws Exception { + String invokeTarget = crontab.getCommand(); + String beanName = getBeanName(invokeTarget); + String methodName = getMethodName(invokeTarget); + List methodParams = getMethodParams(invokeTarget); + + if (!isValidClassName(beanName)) { + Object bean = SpringUtils.getBean(beanName); + invokeMethod(bean, methodName, methodParams); + } else { + Object bean = Class.forName(beanName).newInstance(); + invokeMethod(bean, methodName, methodParams); + } + } + + /** + * 调用任务方法 + * + * @param bean 目标对象 + * @param methodName 方法名称 + * @param methodParams 方法参数 + */ + private static void invokeMethod(Object bean, String methodName, List methodParams) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { + if (StringUtils.isNotNull(methodParams) && methodParams.size() > 0) { + Method method = bean.getClass().getMethod(methodName, getMethodParamsType(methodParams)); + method.invoke(bean, getMethodParamsValue(methodParams)); + } else { + Method method = bean.getClass().getMethod(methodName); + method.invoke(bean); + } + } + + + /** + * 校验是否为为class包名 + * + * @param invokeTarget 名称 + * @return true是 false否 + */ + public static boolean isValidClassName(String invokeTarget) { + return StringUtils.countMatches(invokeTarget, ".") > 1; + } + + /** + * 获取bean名称 + * + * @param invokeTarget 目标字符串 + * @return bean名称 + */ + public static String getBeanName(String invokeTarget) { + String beanName = StringUtils.substringBefore(invokeTarget, "("); + return StringUtils.substringBeforeLast(beanName, "."); + } + + /** + * 获取bean方法 + * + * @param invokeTarget 目标字符串 + * @return method方法 + */ + public static String getMethodName(String invokeTarget) { + String methodName = StringUtils.substringBefore(invokeTarget, "("); + return StringUtils.substringAfterLast(methodName, "."); + } + + /** + * 获取method方法参数相关列表 + * + * @param invokeTarget 目标字符串 + * @return method方法相关参数列表 + */ + public static List getMethodParams(String invokeTarget) { + String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); + if (StringUtils.isEmpty(methodStr)) { + return null; + } + String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)"); + List clazz = new LinkedList<>(); + for (String methodParam : methodParams) { + String str = StringUtils.trimToEmpty(methodParam); + if (StringUtils.startsWithAny(str, "'", "\"")) { + clazz.add(new Object[]{StringUtils.substring(str, 1, str.length() - 1), String.class}); + } else if ("true".equalsIgnoreCase(str) || "false".equalsIgnoreCase(str)) { + clazz.add(new Object[]{Boolean.valueOf(str), Boolean.class}); + } else if (StringUtils.endsWith(str, "L")) { + clazz.add(new Object[]{Long.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Long.class}); + } else if (StringUtils.endsWith(str, "D")) { + clazz.add(new Object[]{Double.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Double.class}); + } else { + clazz.add(new Object[]{Integer.valueOf(str), Integer.class}); + } + } + return clazz; + } + + /** + * 获取参数类型 + * + * @param methodParams 参数相关列表 + * @return 参数类型列表 + */ + public static Class[] getMethodParamsType(List methodParams) { + Class[] clazz = new Class[methodParams.size()]; + int index = 0; + for (Object[] os : methodParams) + { + clazz[index] = (Class) os[1]; + index++; + } + return clazz; + } + + /** + * 获取参数值 + * + * @param methodParams 参数相关列表 + * @return 参数值列表 + */ + public static Object[] getMethodParamsValue(List methodParams) { + Object[] clazz = new Object[methodParams.size()]; + int index = 0; + for (Object[] os : methodParams) { + clazz[index] = os[0]; + index++; + } + return clazz; + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/QuartzUtils.java b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/QuartzUtils.java new file mode 100644 index 0000000..e719665 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/QuartzUtils.java @@ -0,0 +1,104 @@ +package com.biutag.lan.config.quartz; + +import com.biutag.lan.config.quartz.exceution.QuartzDisExecution; +import com.biutag.lan.config.quartz.exceution.QuartzJobExecution; +import com.biutag.entity.Crontab; +import com.biutag.util.StringUtils; +import org.quartz.*; + +/** + * 计划任务工具 + */ +public class QuartzUtils { + + /** + * 得到quartz任务类 + * + * @param crontab 执行计划 + * @return 具体执行任务类 + */ + private static Class getQuartzJobClass(Crontab crontab) { + boolean isConcurrent = crontab.getConcurrent().equals(0); + return isConcurrent ? QuartzJobExecution.class : QuartzDisExecution.class; + } + + /** + * 构建任务对象Key + * + * @param jobId (任务ID) + * @param jobGroup (任务分组) + * @return JobKey + */ + public static JobKey getJobKey(Integer jobId, String jobGroup) { + return JobKey.jobKey(TaskConstants.TASK_CLASS_NAME + jobId, jobGroup); + } + + /** + * 构建触发对象Key + * + * @param jobId (任务ID) + * @param jobGroup (任务分组) + * @return TriggerKey + */ + public static TriggerKey getTriggerKey(Integer jobId, String jobGroup) { + return TriggerKey.triggerKey(TaskConstants.TASK_PROPERTIES + jobId, jobGroup); + } + + /** + * 创建定时任务 + * + * @param scheduler 调度器 + * @param job 任务 + * @throws SchedulerException 调度异常 + */ + public static void createScheduleJob(Scheduler scheduler, Crontab job) throws SchedulerException { + Integer jobId = job.getId(); + String jobGroup = job.getTypes(); + String expression = job.getRules(); + + // 构建任务 + Class jobClass = getQuartzJobClass(job); + JobDetail jobDetail = JobBuilder.newJob(jobClass) + .withIdentity(getJobKey(jobId, jobGroup)) + .build(); + + // 构建时间 + CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(expression); + switch (job.getStrategy()) { + case 1: // 立即执行 + cronScheduleBuilder = cronScheduleBuilder.withMisfireHandlingInstructionIgnoreMisfires(); + break; + case 2: // 执行一次 + cronScheduleBuilder = cronScheduleBuilder.withMisfireHandlingInstructionFireAndProceed(); + break; + case 3: // 放弃执行 + cronScheduleBuilder = cronScheduleBuilder.withMisfireHandlingInstructionDoNothing(); + break; + } + + // 注入参数 + jobDetail.getJobDataMap().put(TaskConstants.TASK_PROPERTIES, job); + + // 构建目标 + CronTrigger trigger = TriggerBuilder.newTrigger() + .withIdentity(getTriggerKey(jobId, jobGroup)) + .withSchedule(cronScheduleBuilder) + .build(); + + // 如果存在则删除 + if (scheduler.checkExists(getJobKey(jobId, jobGroup))) { + scheduler.deleteJob(getJobKey(jobId, jobGroup)); + } + + // 如果过期则调度 + if (StringUtils.isNotNull(CronUtils.nextExecution(job.getRules()))) { + scheduler.scheduleJob(jobDetail, trigger); + } + + // 如果暂停则停止 + if (!job.getStatus().equals(TaskConstants.STATUS_RUN)) { + scheduler.pauseJob(getJobKey(jobId, jobGroup)); + } + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/TaskConstants.java b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/TaskConstants.java new file mode 100644 index 0000000..9fd4c2f --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/TaskConstants.java @@ -0,0 +1,20 @@ +package com.biutag.lan.config.quartz; + +/** + * 计划任务常量 + */ +public class TaskConstants { + + /** 执行任务名 */ + public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; + + /** 执行目标键 */ + public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; + + /** 状态: 运行 */ + public static final Integer STATUS_RUN = 1; + + /** 状态: 失败 */ + public static final Integer STATUS_FAIL = 2; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/AbstractQuartzJob.java b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/AbstractQuartzJob.java new file mode 100644 index 0000000..b0dcbfb --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/AbstractQuartzJob.java @@ -0,0 +1,81 @@ +package com.biutag.lan.config.quartz.exceution; + +import com.biutag.lan.config.quartz.TaskConstants; +import com.biutag.entity.Crontab; +import com.biutag.mapper.CrontabMapper; +import com.biutag.util.SpringUtils; +import com.biutag.util.StringUtils; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; + +public abstract class AbstractQuartzJob implements Job { + + private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class); + + /** + * 线程本地变量 + */ + private static final ThreadLocal threadLocal = new ThreadLocal<>(); + + /** + * 执行 + * + * @param context 上下文 + */ + @Override + public void execute(JobExecutionContext context) { + Crontab crontab = new Crontab(); + BeanUtils.copyProperties(context.getMergedJobDataMap().get(TaskConstants.TASK_PROPERTIES), crontab); + try { + before(); + doExecute(context, crontab); + after(crontab, null); + } catch (Exception e) { + log.error("任务执行异常:", e); + after(crontab, e); + } + } + + /** + * 执行前 + */ + protected void before() { + threadLocal.set(System.currentTimeMillis()); + } + + /** + * 执行后 + * + * @param crontab 系统计划任务 + */ + protected void after(Crontab crontab, Exception e) + { + long startTime = threadLocal.get(); + long endTime = System.currentTimeMillis(); + threadLocal.remove(); + + crontab.setError(""); + crontab.setStartTime(startTime / 1000); + crontab.setEndTime(endTime / 1000); + crontab.setTaskTime(endTime - startTime); + if (StringUtils.isNotNull(e)) { + crontab.setError(e.getMessage()); + crontab.setStatus(TaskConstants.STATUS_FAIL); + } + + SpringUtils.getBean(CrontabMapper.class).updateById(crontab); + } + + /** + * 执行方法 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + * @throws Exception 执行过程中的异常 + */ + protected abstract void doExecute(JobExecutionContext context, Crontab sysJob) throws Exception; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzDisExecution.java b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzDisExecution.java new file mode 100644 index 0000000..4d06198 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzDisExecution.java @@ -0,0 +1,19 @@ +package com.biutag.lan.config.quartz.exceution; + +import com.biutag.lan.config.quartz.InvokeUtils; +import com.biutag.entity.Crontab; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; + +/** + * 禁止并发任务 + */ +@DisallowConcurrentExecution +public class QuartzDisExecution extends AbstractQuartzJob { + + @Override + protected void doExecute(JobExecutionContext context, Crontab crontab) throws Exception { + InvokeUtils.invokeMethod(crontab); + } + +} \ No newline at end of file diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzJobExecution.java b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzJobExecution.java new file mode 100644 index 0000000..2536e6e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/quartz/exceution/QuartzJobExecution.java @@ -0,0 +1,17 @@ +package com.biutag.lan.config.quartz.exceution; + +import com.biutag.lan.config.quartz.InvokeUtils; +import com.biutag.entity.Crontab; +import org.quartz.JobExecutionContext; + +/** + * 允许并发任务 + */ +public class QuartzJobExecution extends AbstractQuartzJob { + + @Override + protected void doExecute(JobExecutionContext context, Crontab crontab) throws Exception { + InvokeUtils.invokeMethod(crontab); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInException.java b/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInException.java new file mode 100644 index 0000000..60d2523 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInException.java @@ -0,0 +1,42 @@ +package com.biutag.lan.config.stp; + +import cn.dev33.satoken.exception.NotLoginException; +import cn.dev33.satoken.exception.NotPermissionException; +import com.biutag.core.AjaxResult; +import com.biutag.enums.ErrorEnum; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +/** + * Sa-Token的异常拦截 + */ +@Slf4j +@ControllerAdvice +public class StpInException { + + /** + * 拦截登录异常 + */ + @ResponseStatus(HttpStatus.OK) + @ExceptionHandler(NotLoginException.class) + @ResponseBody + public AjaxResult handleNotLoginException(NotLoginException e){ + String msg = e.getMessage().startsWith("Token无效") ? "尚未登录,请先登录!" : e.getMessage(); + return AjaxResult.failed(ErrorEnum.TOKEN_INVALID.getCode(), msg); + } + + /** + * 拦截权限异常 + */ + @ResponseStatus(HttpStatus.OK) + @ExceptionHandler(NotPermissionException.class) + @ResponseBody + public AjaxResult handleNotPermissionException(){ + return AjaxResult.failed(ErrorEnum.NO_PERMISSION.getCode(), ErrorEnum.NO_PERMISSION.getMsg()); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java new file mode 100644 index 0000000..1ee8aec --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/config/stp/StpInterConfig.java @@ -0,0 +1,90 @@ +package com.biutag.lan.config.stp; + +import cn.dev33.satoken.stp.StpInterface; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.lan.AdminThreadLocal; +import com.biutag.entity.system.Menu; +import com.biutag.entity.system.Perm; +import com.biutag.mapper.system.MenuMapper; +import com.biutag.mapper.system.PermMapper; +import com.biutag.util.StringUtils; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Component; + + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +/** + * Sa-Token自定义权限验证接口 + */ +@Component +public class StpInterConfig implements StpInterface { + + @Resource + PermMapper PermMapper; + + @Resource + MenuMapper MenuMapper; + + /** + * 返回一个账号所拥有的权限码集合 + * + * @param loginId 登录ID + * @param loginType 登录类型 + * @return List + */ + @Override + public List getPermissionList(Object loginId, String loginType) { + List roleIds = AdminThreadLocal.getRoleIds(); + List perms = new LinkedList<>(); + + if (roleIds.isEmpty()) { + return perms; + } + + List permList = PermMapper.selectList( + new QueryWrapper() + .select("id,role_id,menu_id") + .in("role_id", roleIds)); + + if (permList.isEmpty()) { + return perms; + } + + List menuIds = new LinkedList<>(); + for (Perm Perm : permList) { + menuIds.add(Perm.getMenuId()); + } + + List Menus = MenuMapper.selectList( + new QueryWrapper() + .select("id,perms") + .eq("is_disable", 0) + .in("id", menuIds) + .in("menu_type", Arrays.asList("C", "A")) + .orderByAsc(Arrays.asList("menu_sort", "id"))); + + for (Menu item : Menus) { + if (StringUtils.isNotNull(item.getPerms()) && StringUtils.isNotEmpty(item.getPerms())) { + perms.add(item.getPerms().trim()); + } + } + + return perms; + } + + /** + * 返回一个账号所拥有的角色标识集合 + * + * @param loginId 登录ID + * @param loginType 登录类型 + * @return List + */ + @Override + public List getRoleList(Object loginId, String loginType) { + return null; + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/IndexController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/IndexController.java new file mode 100644 index 0000000..f5e91ff --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/IndexController.java @@ -0,0 +1,41 @@ +package com.biutag.lan.controller; + +import com.biutag.aop.NotLogin; +import com.biutag.lan.service.IIndexService; +import com.biutag.core.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import jakarta.annotation.Resource; +import java.util.Map; + +@Slf4j +@RestController +@RequestMapping("api/index") +@Api(tags = "主页数据管理") +public class IndexController { + + @Resource + IIndexService iIndexService; + + @GetMapping("/console") + @ApiOperation(value="控制台") + public AjaxResult> console() { + Map map = iIndexService.console(); + return AjaxResult.success(map); + } + + @NotLogin + @GetMapping("/config") + @ApiOperation(value="公共配置") + public AjaxResult> config() { + Map map = iIndexService.config(); + + return AjaxResult.success(map); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java new file mode 100644 index 0000000..c66c28e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java @@ -0,0 +1,28 @@ +package com.biutag.lan.controller; + +import com.biutag.core.AjaxResult; +import com.biutag.lan.service.IUserService; +import jakarta.annotation.Resource; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RequiredArgsConstructor +@RequestMapping("mail") +@RestController +public class MailController { + + IUserService iUserService; + @GetMapping + public AjaxResult> list() { + System.out.printf("test"); + Map map = new HashMap<>(); + return AjaxResult.success(map); + + } +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/UserController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/UserController.java new file mode 100644 index 0000000..3a25056 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/UserController.java @@ -0,0 +1,53 @@ +package com.biutag.lan.controller; + +import com.biutag.lan.aop.Log; +import com.biutag.lan.service.IUserService; +import com.biutag.lan.validate.user.UserSearchValidate; +import com.biutag.lan.validate.user.UserUpdateValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.user.UserWalletValidate; +import com.biutag.lan.vo.user.UserVo; +import com.biutag.core.AjaxResult; +import com.biutag.core.PageResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; + +@RestController +@RequestMapping("api/user") +@Api(tags = "用户数据管理") +public class UserController { + + @Resource + IUserService iUserService; + + @GetMapping("/list") + @ApiOperation(value="用户列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @Validated UserSearchValidate searchValidate) { + PageResult list = iUserService.list(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="用户详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + UserVo vo = iUserService.detail(id); + return AjaxResult.success(vo); + } + + @Log(title = "用户编辑") + @PostMapping("/edit") + @ApiOperation(value="用户编辑") + public AjaxResult edit(@Validated @RequestBody UserUpdateValidate updateValidate) { + iUserService.edit(updateValidate); + return AjaxResult.success(); + } + + + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorCacheController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorCacheController.java new file mode 100644 index 0000000..a45f132 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorCacheController.java @@ -0,0 +1,62 @@ +//package com.biutag.lan.controller.monitor; +// +// +//import com.biutag.lan.aop.Log; +//import com.biutag.core.AjaxResult; +//import com.biutag.util.StringUtils; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import org.springframework.data.redis.connection.RedisServerCommands; +//import org.springframework.data.redis.core.RedisCallback; +//import org.springframework.data.redis.core.RedisTemplate; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +// +//import jakarta.annotation.Resource; +//import java.util.*; +// +//@RestController +//@RequestMapping("api/monitor") +//@Api(tags = "监控缓存管理") +//public class MonitorCacheController { +// +// @Resource +// private RedisTemplate redisTemplate; +// +// /** +// * 缓存监控 +// * +// * @author fzr +// * @return AjaxResult +// */ +// @Log(title = "缓存监控") +// @GetMapping("/cache") +// @ApiOperation(value="缓存监控") +// public AjaxResult info() { +// Properties info = (Properties) redisTemplate.execute((RedisCallback) RedisServerCommands::info); +// Properties commandStats = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info("commandstats")); +// Object dbSize = redisTemplate.execute((RedisCallback) RedisServerCommands::dbSize); +// +// if (commandStats == null) { +// return AjaxResult.failed("获取异常"); +// } +// +// Map result = new HashMap<>(3); +// result.put("info", info); +// result.put("dbSize", dbSize); +// +// List> pieList = new ArrayList<>(); +// commandStats.stringPropertyNames().forEach(key -> { +// Map data = new HashMap<>(2); +// String property = commandStats.getProperty(key); +// data.put("name", StringUtils.removeStart(key, "cmdstat_")); +// data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); +// pieList.add(data); +// }); +// +// result.put("commandStats", pieList); +// return AjaxResult.success(result); +// } +// +//} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorServerController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorServerController.java new file mode 100644 index 0000000..28e1bb4 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/monitor/MonitorServerController.java @@ -0,0 +1,33 @@ +package com.biutag.lan.controller.monitor; + +import com.biutag.lan.aop.Log; +import com.biutag.core.AjaxResult; +import com.biutag.core.ServerResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +@RestController +@RequestMapping("api/monitor") +@Api(tags = "监控服务管理") +public class MonitorServerController { + + /** + * 服务器信息 + * + * @author fzr + * @return AjaxResult> + */ + @Log(title = "服务监控") + @GetMapping("/server") + @ApiOperation(value="服务监控") + public AjaxResult> info() { + ServerResult server = new ServerResult(); + return AjaxResult.success(server.copyTo()); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictDataController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictDataController.java new file mode 100644 index 0000000..2b44045 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictDataController.java @@ -0,0 +1,82 @@ +package com.biutag.lan.controller.setting; + +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.biutag.lan.aop.Log; +import com.biutag.aop.NotPower; +import com.biutag.lan.service.IDictDataService; +import com.biutag.lan.validate.commons.IdsValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.setting.DictDataCreateValidate; +import com.biutag.lan.validate.setting.DictDataUpdateValidate; +import com.biutag.lan.vo.setting.DictDataVo; +import com.biutag.core.AjaxResult; +import com.biutag.core.PageResult; +import com.biutag.util.StringUtils; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("api/setting/dict/data") +@Api(tags = "配置字典数据") +public class DictDataController { + + @Resource + IDictDataService iDictDataService; + + @NotPower + @GetMapping("/all") + @ApiOperation(value="字典数据所有") + public AjaxResult> all(@RequestParam Map params) { + Assert.isFalse(StringUtils.isEmpty(params.get("dictType")), "dictType缺失"); + List list = iDictDataService.all(params); + return AjaxResult.success(list); + } + + @GetMapping("/list") + @ApiOperation(value="字典数据列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @RequestParam Map params) { + Assert.isFalse(StringUtils.isEmpty(params.get("dictType")), "dictType缺失"); + PageResult list = iDictDataService.list(pageValidate, params); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="字典数据详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + DictDataVo vo = iDictDataService.detail(id); + return AjaxResult.success(vo); + } + + @Log(title = "字典数据新增") + @PostMapping("/add") + @ApiOperation(value="字典数据新增") + public AjaxResult add(@Validated @RequestBody DictDataCreateValidate createValidate) { + iDictDataService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "字典数据编辑") + @PostMapping("/edit") + @ApiOperation(value="字典数据编辑") + public AjaxResult edit(@Validated @RequestBody DictDataUpdateValidate updateValidate) { + iDictDataService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "字典数据删除") + @PostMapping("/del") + @ApiOperation(value="字典数据删除") + public AjaxResult del(@Validated @RequestBody IdsValidate idsValidate) { + iDictDataService.del(idsValidate.getIds()); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictTypeController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictTypeController.java new file mode 100644 index 0000000..1effdea --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/DictTypeController.java @@ -0,0 +1,78 @@ +package com.biutag.lan.controller.setting; + +import com.biutag.lan.aop.Log; +import com.biutag.aop.NotPower; +import com.biutag.lan.service.IDictTypeService; +import com.biutag.lan.validate.commons.IdsValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.setting.DictTypeCreateValidate; +import com.biutag.lan.validate.setting.DictTypeUpdateValidate; +import com.biutag.lan.vo.setting.DictTypeVo; +import com.biutag.core.AjaxResult; +import com.biutag.core.PageResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("api/setting/dict/type") +@Api(tags = "配置字典类型") +public class DictTypeController { + + @Resource + IDictTypeService iDictTypeService; + + @NotPower + @GetMapping("/all") + @ApiOperation(value="字典类型所有") + public AjaxResult> all() { + List list = iDictTypeService.all(); + return AjaxResult.success(list); + } + + @GetMapping("/list") + @ApiOperation(value="字典类型列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @RequestParam Map params) { + PageResult list = iDictTypeService.list(pageValidate, params); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="字典类型详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + DictTypeVo vo = iDictTypeService.detail(id); + return AjaxResult.success(vo); + } + + @Log(title = "字典类型新增") + @PostMapping("/add") + @ApiOperation(value="字典类型新增") + public AjaxResult add(@Validated @RequestBody DictTypeCreateValidate createValidate) { + iDictTypeService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "字典类型编辑") + @PostMapping("/edit") + @ApiOperation(value="字典类型编辑") + public AjaxResult edit(@Validated @RequestBody DictTypeUpdateValidate updateValidate) { + iDictTypeService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "字典类型删除") + @PostMapping("/del") + @ApiOperation(value="字典类型删除") + public AjaxResult del(@Validated @RequestBody IdsValidate idsValidate) { + iDictTypeService.del(idsValidate.getIds()); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingLoginController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingLoginController.java new file mode 100644 index 0000000..3bd9e6e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingLoginController.java @@ -0,0 +1,38 @@ +package com.biutag.lan.controller.setting; + +import com.biutag.lan.aop.Log; +import com.biutag.lan.service.ISettingLoginService; +import com.biutag.lan.validate.setting.SettingLoginValidate; +import com.biutag.lan.vo.setting.SettingLoginVo; +import com.biutag.core.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; + +@RestController +@RequestMapping("api/setting/login") +@Api(tags = "配置用户登录") +public class SettingLoginController { + + @Resource + ISettingLoginService iSettingLoginService; + + @GetMapping("/detail") + @ApiOperation(value="登录设置详情") + public AjaxResult detail() { + SettingLoginVo vo = iSettingLoginService.detail(); + return AjaxResult.success(vo); + } + + @Log(title = "登录设置编辑") + @PostMapping("/save") + @ApiOperation(value="登录设置编辑") + public AjaxResult save(@Validated @RequestBody SettingLoginValidate loginValidate) { + iSettingLoginService.save(loginValidate); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingNoticeController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingNoticeController.java new file mode 100644 index 0000000..9221e9a --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingNoticeController.java @@ -0,0 +1,48 @@ +package com.biutag.lan.controller.setting; + +import com.biutag.lan.aop.Log; +import com.biutag.lan.service.ISettingNoticeService; +import com.biutag.lan.vo.setting.SettingNoticeDetailVo; +import com.biutag.lan.vo.setting.SettingNoticeListedVo; +import com.biutag.core.AjaxResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("api/setting/notice") +@Api(tags = "配置消息通知") +public class SettingNoticeController { + + @Resource + ISettingNoticeService iSettingNoticeService; + + @GetMapping("/list") + @ApiOperation(value="通知设置列表") + public AjaxResult> list(@RequestParam Integer recipient) { + List list = iSettingNoticeService.list(recipient); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="通知设置详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + SettingNoticeDetailVo vo = iSettingNoticeService.detail(id); + return AjaxResult.success(vo); + } + + @Log(title = "通知设置编辑") + @PostMapping("/save") + @ApiOperation(value="通知设置编辑") + public AjaxResult save(@RequestBody Map params) { + iSettingNoticeService.save(params); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingUserController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingUserController.java new file mode 100644 index 0000000..db98e42 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/setting/SettingUserController.java @@ -0,0 +1,38 @@ +package com.biutag.lan.controller.setting; + +import com.biutag.lan.aop.Log; +import com.biutag.lan.service.ISettingUserService; +import com.biutag.lan.validate.setting.SettingUserValidate; +import com.biutag.lan.vo.setting.SettingUserVo; +import com.biutag.core.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + + +@RestController +@RequestMapping("api/setting/user") +@Api(tags = "配置用户参数") +public class SettingUserController { + + @Resource + ISettingUserService iSettingUserService; + + @GetMapping("/detail") + @ApiOperation(value="用户设置详情") + public AjaxResult detail() { + SettingUserVo vo = iSettingUserService.detail(); + return AjaxResult.success(vo); + } + + @Log(title = "用户设置编辑") + @PostMapping("/save") + @ApiOperation(value="用户设置编辑") + public AjaxResult save(@Validated @RequestBody SettingUserValidate userValidate) { + iSettingUserService.save(userValidate); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java new file mode 100644 index 0000000..0f49310 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java @@ -0,0 +1,72 @@ +package com.biutag.lan.controller.system; + +import com.alibaba.fastjson2.JSONArray; +import com.biutag.aop.NotPower; +import com.biutag.lan.service.IDeptService; +import com.biutag.lan.validate.commons.IdValidate; +import com.biutag.lan.validate.system.DeptCreateValidate; +import com.biutag.lan.validate.system.DeptSearchValidate; +import com.biutag.lan.validate.system.DeptUpdateValidate; +import com.biutag.lan.vo.system.DeptVo; +import com.biutag.core.AjaxResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("api/system/dept") +@Api(tags = "系统部门管理") +public class DeptController { + + @Resource + IDeptService iDeptService; + + @NotPower + @GetMapping("/all") + @ApiOperation(value="部门所有") + public AjaxResult> all() { + List list = iDeptService.all(); + return AjaxResult.success(list); + } + + @GetMapping("/list") + @ApiOperation(value="部门列表") + public AjaxResult list(@Validated DeptSearchValidate searchValidate) { + JSONArray list = iDeptService.list(searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="部门详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + DeptVo vo = iDeptService.detail(id); + return AjaxResult.success(vo); + } + + @PostMapping("/add") + @ApiOperation(value="部门新增") + public AjaxResult add(@Validated @RequestBody DeptCreateValidate createValidate) { + iDeptService.add(createValidate); + return AjaxResult.success(); + } + + @PostMapping("/edit") + @ApiOperation(value="部门编辑") + public AjaxResult edit(@Validated @RequestBody DeptUpdateValidate updateValidate) { + iDeptService.edit(updateValidate); + return AjaxResult.success(); + } + + @PostMapping("/del") + @ApiOperation(value="部门删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iDeptService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java new file mode 100644 index 0000000..5474cb2 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/MenuController.java @@ -0,0 +1,80 @@ +package com.biutag.lan.controller.system; + +import com.alibaba.fastjson2.JSONArray; +import com.biutag.aop.NotLogin; +import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.aop.Log; +import com.biutag.aop.NotPower; +import com.biutag.lan.service.IMenuService; +import com.biutag.lan.validate.commons.IdValidate; +import com.biutag.lan.validate.system.MenuCreateValidate; +import com.biutag.lan.validate.system.MenuUpdateValidate; +import com.biutag.lan.vo.system.MenuVo; +import com.biutag.core.AjaxResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("api/system/menu") +@Api(tags = "系统菜单管理") +public class MenuController { + + @Resource + IMenuService iMenuService; + + @NotPower + @GetMapping("/route") + @ApiOperation(value="获取菜单路由") + public AjaxResult route() { + List roleIds =AdminThreadLocal.getRoleIds(); + JSONArray lists = iMenuService.selectMenuByRoleId(roleIds); + return AjaxResult.success(lists); + } + + @NotPower + @GetMapping("/list") + @ApiOperation(value="获取菜单列表") + public AjaxResult list() { + JSONArray lists = iMenuService.list(); + return AjaxResult.success(lists); + } + + @GetMapping("/detail") + @ApiOperation(value="获取菜单详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + MenuVo vo = iMenuService.detail(id); + return AjaxResult.success(vo); + } + + @Log(title = "菜单新增") + @PostMapping("/add") + @ApiOperation(value="新增菜单") + public AjaxResult add(@Validated @RequestBody MenuCreateValidate createValidate) { + iMenuService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "菜单编辑") + @PostMapping("/edit") + @ApiOperation(value="菜单编辑") + public AjaxResult edit(@Validated @RequestBody MenuUpdateValidate updateValidate) { + iMenuService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "菜单删除") + @PostMapping("/del") + @ApiOperation(value="菜单删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iMenuService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java new file mode 100644 index 0000000..3ab13b3 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java @@ -0,0 +1,107 @@ +package com.biutag.lan.controller.system; + +import com.biutag.aop.NotLogin; +import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.aop.Log; +import com.biutag.lan.service.IPoliceUserService; +import com.biutag.lan.validate.commons.IdValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.PoliceUserCreateValidate; +import com.biutag.lan.validate.system.PoliceUserSearchValidate; +import com.biutag.lan.validate.system.PoliceUserUpInfoValidate; +import com.biutag.lan.validate.system.PoliceUserUpdateValidate; +import com.biutag.lan.vo.system.PoliceUserDetailVo; +import com.biutag.lan.vo.system.PoliceUserListedVo; +import com.biutag.lan.vo.system.PoliceUserSelvesVo; +import com.biutag.aop.NotPower; +import com.biutag.core.AjaxResult; +import com.biutag.core.PageResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + + + +@RestController +@RequestMapping("api/system/admin") +@Api(tags = "系统用户管理") +public class PoliceUserController { + + + @Resource + IPoliceUserService iPoliceUserService; + + @GetMapping("/list") + @ApiOperation(value="管理员列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @Validated PoliceUserSearchValidate searchValidate) { + PageResult list = iPoliceUserService.list(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @NotPower + @GetMapping("/self") + @ApiOperation(value="管理员信息") + public AjaxResult self() { + Integer adminId =AdminThreadLocal.getAdminId(); + PoliceUserSelvesVo vo = iPoliceUserService.self(adminId); + return AjaxResult.success(vo); + } + + @GetMapping("/detail") + @ApiOperation(value="管理员详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + PoliceUserDetailVo vo = iPoliceUserService.detail(id); + return AjaxResult.success(vo); + } + + @Log(title = "管理员新增") + @PostMapping("/add") + @ApiOperation(value="管理员新增") + public AjaxResult add(@Validated @RequestBody PoliceUserCreateValidate createValidate) { + iPoliceUserService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "管理员编辑") + @PostMapping("/edit") + @ApiOperation(value="管理员编辑") + public AjaxResult edit(@Validated @RequestBody PoliceUserUpdateValidate updateValidate) { + Integer adminId = AdminThreadLocal.getAdminId(); + iPoliceUserService.edit(updateValidate, adminId); + return AjaxResult.success(); + } + + @NotPower + @Log(title = "管理员更新") + @PostMapping("/upInfo") + @ApiOperation(value="当前管理员更新") + public AjaxResult upInfo(@Validated @RequestBody PoliceUserUpInfoValidate upInfoValidate) { + Integer adminId = AdminThreadLocal.getAdminId(); + iPoliceUserService.upInfo(upInfoValidate, adminId); + return AjaxResult.success(); + } + + @Log(title = "管理员删除") + @PostMapping("/del") + @ApiOperation(value="管理员删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + Integer adminId = AdminThreadLocal.getAdminId(); + iPoliceUserService.del(idValidate.getId(), adminId); + return AjaxResult.success(); + } + + @Log(title = "管理员状态") + @PostMapping("/disable") + @ApiOperation(value="管理员状态切换") + public AjaxResult disable(@Validated @RequestBody IdValidate idValidate) { + Integer adminId = AdminThreadLocal.getAdminId(); + iPoliceUserService.disable(idValidate.getId(), adminId); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PostController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PostController.java new file mode 100644 index 0000000..1de1f01 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PostController.java @@ -0,0 +1,74 @@ +package com.biutag.lan.controller.system; + +import com.biutag.aop.NotPower; +import com.biutag.lan.service.IPostService; +import com.biutag.lan.validate.commons.IdValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.PostCreateValidate; +import com.biutag.lan.validate.system.PostSearchValidate; +import com.biutag.lan.validate.system.PostUpdateValidate; +import com.biutag.lan.vo.system.PostVo; +import com.biutag.core.AjaxResult; +import com.biutag.core.PageResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("api/system/post") +@Api(tags = "系统岗位管理") +public class PostController { + + @Resource + IPostService iPostService; + + @NotPower + @GetMapping("/all") + @ApiOperation(value="所有岗位") + public AjaxResult> all() { + List list = iPostService.all(); + return AjaxResult.success(list); + } + + @GetMapping("/list") + @ApiOperation(value="岗位列表") + public AjaxResult> list(@Validated PageValidate pageValidate, + @Validated PostSearchValidate searchValidate) { + PageResult list = iPostService.list(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/detail") + @ApiOperation(value="岗位详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + PostVo vo = iPostService.detail(id); + return AjaxResult.success(vo); + } + + @PostMapping("/add") + @ApiOperation(value="岗位新增") + public AjaxResult add(@Validated @RequestBody PostCreateValidate createValidate) { + iPostService.add(createValidate); + return AjaxResult.success(); + } + + @PostMapping("/edit") + @ApiOperation(value="岗位编辑") + public AjaxResult edit(@Validated @RequestBody PostUpdateValidate updateValidate) { + iPostService.edit(updateValidate); + return AjaxResult.success(); + } + + @PostMapping("/del") + @ApiOperation(value="岗位删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iPostService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/RoleController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/RoleController.java new file mode 100644 index 0000000..9f349c5 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/RoleController.java @@ -0,0 +1,78 @@ +package com.biutag.lan.controller.system; + +import com.biutag.lan.aop.Log; +import com.biutag.aop.NotPower; +import com.biutag.lan.service.IRoleService; +import com.biutag.lan.validate.commons.IdValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.RoleCreateValidate; +import com.biutag.lan.validate.system.RoleUpdateValidate; +import com.biutag.lan.vo.system.RoleVo; +import com.biutag.core.AjaxResult; +import com.biutag.core.PageResult; +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("api/system/role") +@Api(tags = "系统角色管理") +public class RoleController { + + @Resource + IRoleService iRoleService; + + @NotPower + @GetMapping("/all") + @ApiOperation(value="所有角色") + public AjaxResult> all() { + List list = iRoleService.all(); + return AjaxResult.success(list); + } + + @Log(title = "角色列表") + @GetMapping("/list") + @ApiOperation(value="角色列表") + public AjaxResult> list(@Validated PageValidate pageValidate) { + PageResult list = iRoleService.list(pageValidate); + return AjaxResult.success(list); + } + + @Log(title = "角色详情") + @GetMapping("/detail") + @ApiOperation(value="角色详情") + public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { + RoleVo vo = iRoleService.detail(id); + return AjaxResult.success(vo); + } + + @Log(title = "角色新增") + @PostMapping("/add") + @ApiOperation(value="角色新增") + public AjaxResult add(@Validated @RequestBody RoleCreateValidate createValidate) { + iRoleService.add(createValidate); + return AjaxResult.success(); + } + + @Log(title = "角色编辑") + @PostMapping("/edit") + @ApiOperation(value="角色编辑") + public AjaxResult edit(@Validated @RequestBody RoleUpdateValidate updateValidate) { + iRoleService.edit(updateValidate); + return AjaxResult.success(); + } + + @Log(title = "角色删除") + @PostMapping("/del") + @ApiOperation(value="角色删除") + public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { + iRoleService.del(idValidate.getId()); + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemCacheController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemCacheController.java new file mode 100644 index 0000000..2746c8a --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemCacheController.java @@ -0,0 +1,30 @@ +package com.biutag.lan.controller.system; + + +import com.biutag.lan.aop.Log; +import com.biutag.lan.service.ISystemCacheService; +import com.biutag.core.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; + +@RestController +@RequestMapping("api/system/cache") +@Api(tags = "系统缓存管理") +public class SystemCacheController { + + @Resource + ISystemCacheService iSystemCacheService; + + @Log(title = "清除系统缓存") + @PostMapping("/clear") + @ApiOperation(value = "清除系统缓存") + public AjaxResult clear() { + iSystemCacheService.clear(); + return AjaxResult.success(); + } + + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLoginController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLoginController.java new file mode 100644 index 0000000..9fa043b --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLoginController.java @@ -0,0 +1,50 @@ +package com.biutag.lan.controller.system; + +import com.biutag.aop.NotLogin; +import com.biutag.aop.NotPower; +import com.biutag.lan.service.ISystemLoginService; +import com.biutag.lan.validate.system.PoliceUserLoginsValidate; +import com.biutag.lan.vo.system.SystemCaptchaVo; +import com.biutag.lan.vo.system.SystemLoginVo; +import com.biutag.core.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import jakarta.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +@RestController +@RequestMapping("api/system") +@Api(tags = "系统登录管理") +public class SystemLoginController { + + @Resource + ISystemLoginService iSystemLoginService; + + @NotLogin + @GetMapping("/captcha") + @ApiOperation(value="取验证码") + public AjaxResult captcha() { + SystemCaptchaVo vo = iSystemLoginService.captcha(); + return AjaxResult.success(vo); + } + + @NotLogin + @PostMapping("/login") + @ApiOperation(value="登录系统") + public AjaxResult login(@Validated() @RequestBody PoliceUserLoginsValidate loginsValidate) { + SystemLoginVo vo = iSystemLoginService.login(loginsValidate); + return AjaxResult.success(vo); + } + + @NotPower + @PostMapping("/logout") + @ApiOperation(value="退出登录") + public AjaxResult logout() { + + return AjaxResult.success(); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLogsController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLogsController.java new file mode 100644 index 0000000..2385dc3 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/SystemLogsController.java @@ -0,0 +1,44 @@ +package com.biutag.lan.controller.system; + +import com.biutag.lan.service.ISystemLogsServer; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.SystemSearchLoginsValidate; +import com.biutag.lan.validate.system.SystemSearchOperateValidate; +import com.biutag.lan.vo.system.SystemLogLoginVo; +import com.biutag.lan.vo.system.SystemLogOperateVo; +import com.biutag.core.AjaxResult; +import com.biutag.core.PageResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import jakarta.annotation.Resource; + +@RestController +@RequestMapping("api/system/log") +@Api(tags = "系统日志管理") +public class SystemLogsController { + + @Resource + ISystemLogsServer iSystemLogsServer; + + @GetMapping("/operate") + @ApiOperation(value="系统操作日志") + public AjaxResult> operate(@Validated PageValidate pageValidate, + @Validated SystemSearchOperateValidate searchValidate) { + PageResult list = iSystemLogsServer.operate(pageValidate, searchValidate); + return AjaxResult.success(list); + } + + @GetMapping("/login") + @ApiOperation(value="系统登录日志") + public AjaxResult> login(@Validated PageValidate pageValidate, + @Validated SystemSearchLoginsValidate searchValidate) { + PageResult list = iSystemLogsServer.login(pageValidate, searchValidate); + return AjaxResult.success(list); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/crontab/MyJob.java b/mailbox-lan/src/main/java/com/biutag/lan/crontab/MyJob.java new file mode 100644 index 0000000..1e02b6f --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/crontab/MyJob.java @@ -0,0 +1,17 @@ +package com.biutag.lan.crontab; + + +import org.springframework.stereotype.Component; + + +/** + * 具体的定时任务 + */ +@Component("myJob") +public class MyJob { + + public void handle(String s) { + // System.out.println("有参数定时任务执行逻辑 : " + s); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java new file mode 100644 index 0000000..612357c --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java @@ -0,0 +1,76 @@ +package com.biutag.lan.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Getter; +import lombok.Setter; + +import java.util.Date; + +@Setter +@Getter +public class Mail { + + @TableId + private String id; + + /** + * 联系人姓名 + */ + private String contactName; + + /** + * 联系人性别 + */ + private String contactSex; + + /** + * 联系人身份证号码 + */ + private String contactIdCard; + + /** + * + */ + private String contactPhone; + + /** + * 案件编号 + */ + private String caseNumber; + + /** + * 内容 + */ + private String content; + + /** + * 附件 + */ + private String attachments; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 评价 + */ + private String evaluate; + + /** + * 是否满意 + */ + private String satisfiedFlag; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java new file mode 100644 index 0000000..4076ece --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java @@ -0,0 +1,66 @@ +package com.biutag.lan.service; + +import com.alibaba.fastjson2.JSONArray; +import com.biutag.lan.validate.system.DeptCreateValidate; +import com.biutag.lan.validate.system.DeptSearchValidate; +import com.biutag.lan.validate.system.DeptUpdateValidate; +import com.biutag.lan.vo.system.DeptVo; + +import java.util.List; + +/** + * 系统部门服务接口类 + */ +public interface IDeptService { + + /** + * 部门所有 + * + * @author fzr + * @return List + */ + List all(); + + /** + * 部门列表 + * + * @author fzr + * @param searchValidate 搜索参数 + * @return JSONArray + */ + JSONArray list(DeptSearchValidate searchValidate); + + /** + * 部门详情 + * + * @author fzr + * @param id 主键 + * @return SysMenu + */ + DeptVo detail(Integer id); + + /** + * 部门新增 + * + * @author fzr + * @param createValidate 参数 + */ + void add(DeptCreateValidate createValidate); + + /** + * 部门编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + void edit(DeptUpdateValidate updateValidate); + + /** + * 部门删除 + * + * @author fzr + * @param id 主键 + */ + void del(Integer id); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IDictDataService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IDictDataService.java new file mode 100644 index 0000000..cbb175a --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IDictDataService.java @@ -0,0 +1,68 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.setting.DictDataCreateValidate; +import com.biutag.lan.validate.setting.DictDataUpdateValidate; +import com.biutag.lan.vo.setting.DictDataVo; +import com.biutag.core.PageResult; + +import java.util.List; +import java.util.Map; + +/** + * 字典数据服务接口类 + */ +public interface IDictDataService { + + /** + * 字典数据所有 + * + * @author fzr + * @return List + */ + List all(Map params); + + /** + * 字典数据列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param params 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, Map params); + + /** + * 字典数据详情 + * + * @author fzr + * @param id 主键 + * @return DictDataVo + */ + DictDataVo detail(Integer id); + + /** + * 字典数据新增 + * + * @author fzr + * @param createValidate 参数 + */ + void add(DictDataCreateValidate createValidate); + + /** + * 字典数据编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + void edit(DictDataUpdateValidate updateValidate); + + /** + * 字典数据删除 + * + * @author fzr + * @param ids 主键 + */ + void del(List ids); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IDictTypeService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IDictTypeService.java new file mode 100644 index 0000000..e0c6d10 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IDictTypeService.java @@ -0,0 +1,68 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.setting.DictTypeCreateValidate; +import com.biutag.lan.validate.setting.DictTypeUpdateValidate; +import com.biutag.lan.vo.setting.DictTypeVo; +import com.biutag.core.PageResult; + +import java.util.List; +import java.util.Map; + +/** + * 字典类型服务接口类 + */ +public interface IDictTypeService { + + /** + * 字典类型所有 + * + * @author fzr + * @return List + */ + List all(); + + /** + * 字典类型列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param params 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, Map params); + + /** + * 字典类型详情 + * + * @author fzr + * @param id 主键 + * @return DictDataVo + */ + DictTypeVo detail(Integer id); + + /** + * 字典类型新增 + * + * @author fzr + * @param createValidate 参数 + */ + void add(DictTypeCreateValidate createValidate); + + /** + * 字典类型编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + void edit(DictTypeUpdateValidate updateValidate); + + /** + * 字典类型删除 + * + * @author fzr + * @param ids 主键 + */ + void del(List ids); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IIndexService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IIndexService.java new file mode 100644 index 0000000..6f31b62 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IIndexService.java @@ -0,0 +1,23 @@ +package com.biutag.lan.service; + +import java.util.Map; + +/** + * 主页服务接口类 + */ +public interface IIndexService { + + /** + * 控制台数据 + * + * @author fzr + * @return Map + */ + Map console(); + + /** + * 公共配置 + */ + Map config(); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IMenuService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IMenuService.java new file mode 100644 index 0000000..bd5b838 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IMenuService.java @@ -0,0 +1,64 @@ +package com.biutag.lan.service; + +import com.alibaba.fastjson2.JSONArray; +import com.biutag.lan.validate.system.MenuCreateValidate; +import com.biutag.lan.validate.system.MenuUpdateValidate; +import com.biutag.lan.vo.system.MenuVo; + +import java.util.List; + +/** + * 系统菜单服务接口类 + */ +public interface IMenuService { + + /** + * 根据角色获取菜单 + * + * @author fzr + * @return JSONArray + */ + JSONArray selectMenuByRoleId(List roleId); + + /** + * 菜单列表 + * + * @author fzr + * @return JSONArray + */ + JSONArray list(); + + /** + * 菜单详情 + * + * @author fzr + * @param id 主键 + * @return SysMenu + */ + MenuVo detail(Integer id); + + /** + * 菜单新增 + * + * @author fzr + * @param createValidate 参数 + */ + void add(MenuCreateValidate createValidate); + + /** + * 菜单编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + void edit(MenuUpdateValidate updateValidate); + + /** + * 菜单删除 + * + * @author fzr + * @param id 主键 + */ + void del(Integer id); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IPermService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IPermService.java new file mode 100644 index 0000000..c53635d --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IPermService.java @@ -0,0 +1,43 @@ +package com.biutag.lan.service; + +import java.util.List; + +/** + * 系统角色菜单服务接口类 + */ +public interface IPermService { + + /** + * 根据角色ID获取菜单ID + * + * @param roleIds 角色ID + * @return List + */ + List selectMenuIdsByRoleId(List roleIds); + + /** + * 批量写入角色菜单 + * + * @author fzr + * @param roleId 角色ID + * @param menuIds 菜单ID组 + */ + void batchSaveByMenuIds(Integer roleId, String menuIds); + + /** + * 根据角色ID批量删除角色菜单 + * + * @author fzr + * @param roleId 角色ID + */ + void batchDeleteByRoleId(Integer roleId); + + /** + * 根据菜单ID批量删除角色菜单 + * + * @author fzr + * @param menuId 菜单ID + */ + void batchDeleteByMenuId(Integer menuId); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java new file mode 100644 index 0000000..01d975f --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java @@ -0,0 +1,88 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.PoliceUserCreateValidate; +import com.biutag.lan.validate.system.PoliceUserSearchValidate; +import com.biutag.lan.validate.system.PoliceUserUpInfoValidate; +import com.biutag.lan.validate.system.PoliceUserUpdateValidate; +import com.biutag.lan.vo.system.PoliceUserDetailVo; +import com.biutag.lan.vo.system.PoliceUserListedVo; +import com.biutag.lan.vo.system.PoliceUserSelvesVo; +import com.biutag.core.PageResult; + +/** + * 系统管理员服务接口类 + */ +public interface IPoliceUserService { + + /** + * 当前管理员 + * + * @author fzr + * @return SystemSelfVo + */ + PoliceUserSelvesVo self(Integer adminId); + + /** + * 管理员详情 + * + * @author fzr + * @param id 主键参数 + * @return PoliceUserDetailVo + */ + PoliceUserDetailVo detail(Integer id); + + /** + * 管理员列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, PoliceUserSearchValidate searchValidate); + + /** + * 管理员新增 + * + * @author fzr + * @param createValidate 参数 + */ + void add(PoliceUserCreateValidate createValidate); + + /** + * 管理员编辑 + * + * @author fzr + * @param updateValidate 参数 + * @param adminId 管理员ID + */ + void edit(PoliceUserUpdateValidate updateValidate, Integer adminId); + + /** + * 当前管理员更新 + * + * @author fzr + * @param upInfoValidate 参数 + * @param adminId 管理员ID + */ + void upInfo(PoliceUserUpInfoValidate upInfoValidate, Integer adminId); + + /** + * 管理员删除 + * + * @author fzr + * @param id 主键参数 + * @param adminId 管理员ID + */ + void del(Integer id, Integer adminId); + + /** + * 管理员状态切换 + * + * @author fzr + * @param id 主键参数 + */ + void disable(Integer id, Integer adminId); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IPostService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IPostService.java new file mode 100644 index 0000000..a055ff7 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IPostService.java @@ -0,0 +1,68 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.PostCreateValidate; +import com.biutag.lan.validate.system.PostSearchValidate; +import com.biutag.lan.validate.system.PostUpdateValidate; +import com.biutag.lan.vo.system.PostVo; +import com.biutag.core.PageResult; + +import java.util.List; + +/** + * 系统岗位服务接口类 + */ +public interface IPostService { + + /** + * 岗位所有 + * + * @author fzr + * @return List + */ + List all(); + + /** + * 岗位列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult list(PageValidate pageValidate, PostSearchValidate searchValidate); + + /** + * 岗位详情 + * + * @author fzr + * @param id 主键 + * @return PostVo + */ + PostVo detail(Integer id); + + /** + * 岗位新增 + * + * @author fzr + * @param createValidate 参数 + */ + void add(PostCreateValidate createValidate); + + /** + * 岗位编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + void edit(PostUpdateValidate updateValidate); + + /** + * 岗位删除 + * + * @author fzr + * @param id 主键 + */ + void del(Integer id); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IRoleService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IRoleService.java new file mode 100644 index 0000000..0da78ae --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IRoleService.java @@ -0,0 +1,67 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.RoleCreateValidate; +import com.biutag.lan.validate.system.RoleUpdateValidate; +import com.biutag.lan.vo.system.RoleVo; +import com.biutag.core.PageResult; +import org.springframework.validation.annotation.Validated; + +import java.util.List; + +/** + * 系统角色服务接口类 + */ +public interface IRoleService { + + /** + * 角色所有 + * + * @author fzr + * @return List + */ + List all(); + + /** + * 角色列表 + * + * @author fzr + * @param pageValidate 参数 + * @return PageResult + */ + PageResult list(@Validated PageValidate pageValidate); + + /** + * 角色详情 + * + * @author fzr + * @param id 主键参数 + * @return SysRole + */ + RoleVo detail(Integer id); + + /** + * 角色新增 + * + * @author fzr + * @param createValidate 参数 + */ + void add(RoleCreateValidate createValidate); + + /** + * 角色更新 + * + * @author fzr + * @param updateValidate 参数 + */ + void edit(RoleUpdateValidate updateValidate); + + /** + * 角色删除 + * + * @author fzr + * @param id 主键参数 + */ + void del(Integer id); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingLoginService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingLoginService.java new file mode 100644 index 0000000..af4ec48 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingLoginService.java @@ -0,0 +1,27 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.setting.SettingLoginValidate; +import com.biutag.lan.vo.setting.SettingLoginVo; + +/** + * 登录设置服务接口类 + */ +public interface ISettingLoginService { + + /** + * 登录设置详情 + * + * @author fzr + * @return SettingLoginVo + */ + SettingLoginVo detail(); + + /** + * 登录设置保存 + * + * @author fzr + * @param loginValidate 参数 + */ + void save(SettingLoginValidate loginValidate); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingNoticeService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingNoticeService.java new file mode 100644 index 0000000..cba09f8 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingNoticeService.java @@ -0,0 +1,40 @@ +package com.biutag.lan.service; + +import com.biutag.lan.vo.setting.SettingNoticeDetailVo; +import com.biutag.lan.vo.setting.SettingNoticeListedVo; + +import java.util.List; +import java.util.Map; + +/** + * 通知设置服务接口类 + */ +public interface ISettingNoticeService { + + /** + * 通知设置列表 + * + * @author fzr + * @param recipient 1=用户, 2=平台 + * @return List + */ + List list(Integer recipient); + + /** + * 通知设置详情 + * + * @author fzr + * @param id 主键 + * @return NoticeDetailVo + */ + SettingNoticeDetailVo detail(Integer id); + + /** + * 通知设置保存 + * + * @author fzr + * @param params 参数 + */ + void save(Map params); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingUserService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingUserService.java new file mode 100644 index 0000000..4d4e4b6 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ISettingUserService.java @@ -0,0 +1,27 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.setting.SettingUserValidate; +import com.biutag.lan.vo.setting.SettingUserVo; + +/** + * 用户设置服务接口类 + */ +public interface ISettingUserService { + + /** + * 用户设置详情 + * + * @author fzr + * @return SettingUserVo + */ + SettingUserVo detail(); + + /** + * 用户设置保存 + * + * @author fzr + * @param userValidate 参数 + */ + void save(SettingUserValidate userValidate); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemCacheService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemCacheService.java new file mode 100644 index 0000000..59e8fe0 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemCacheService.java @@ -0,0 +1,14 @@ +package com.biutag.lan.service; + +/** + * 系统缓存接口类 + */ +public interface ISystemCacheService { + + /** + * 清除系统缓存 + * + */ + void clear(); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLoginService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLoginService.java new file mode 100644 index 0000000..9f88574 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLoginService.java @@ -0,0 +1,37 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.system.PoliceUserLoginsValidate; +import com.biutag.lan.vo.system.SystemCaptchaVo; +import com.biutag.lan.vo.system.SystemLoginVo; + +/** + * 系统登录服务接口类 + */ +public interface ISystemLoginService { + + /** + * 验证码 + * + * @author fzr + * @return SystemCaptchaVo + */ + SystemCaptchaVo captcha(); + + /** + * 登录 + * + * @author fzr + * @param loginsValidate 登录参数 + * @return SystemLoginVo + */ + SystemLoginVo login(PoliceUserLoginsValidate loginsValidate); + + /** + * 退出 + * + * @author fzr + * @param token 令牌 + */ + void logout(String token); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLogsServer.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLogsServer.java new file mode 100644 index 0000000..57d9131 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ISystemLogsServer.java @@ -0,0 +1,34 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.SystemSearchLoginsValidate; +import com.biutag.lan.validate.system.SystemSearchOperateValidate; +import com.biutag.lan.vo.system.SystemLogLoginVo; +import com.biutag.lan.vo.system.SystemLogOperateVo; +import com.biutag.core.PageResult; + +/** + * 系统日志服务类接口类 + */ +public interface ISystemLogsServer { + + /** + * 系统操作日志 + * + * @author fzr + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult operate(PageValidate pageValidate, SystemSearchOperateValidate searchValidate); + + /** + * 系统登录日志 + * + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + PageResult login(PageValidate pageValidate, SystemSearchLoginsValidate searchValidate); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IUserService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IUserService.java new file mode 100644 index 0000000..deb36e3 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IUserService.java @@ -0,0 +1,50 @@ +package com.biutag.lan.service; + +import com.biutag.lan.validate.user.UserSearchValidate; +import com.biutag.lan.validate.user.UserUpdateValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.user.UserWalletValidate; +import com.biutag.lan.vo.user.UserVo; +import com.biutag.core.PageResult; + +/** + * 用户服务接口类 + */ +public interface IUserService { + + /** + * 用户列表 + * + * @author fzr + * @param pageValidate (分页参数) + * @param searchValidate (搜索参数) + * @return PageResult + */ + PageResult list(PageValidate pageValidate, UserSearchValidate searchValidate); + + /** + * 用户详情 + * + * @author fzr + * @param id 主键 + * @return UserVo + */ + UserVo detail(Integer id); + + /** + * 用户编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + void edit(UserUpdateValidate updateValidate); + + /** + * 余额调整 + * + * @author fzr + * @param userWalletValidate 余额 + */ + void adjustWallet(UserWalletValidate userWalletValidate); + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java new file mode 100644 index 0000000..2929dd2 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java @@ -0,0 +1,228 @@ +package com.biutag.lan.service.impl; + +import com.alibaba.fastjson2.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.biutag.lan.service.IDeptService; +import com.biutag.lan.validate.system.DeptCreateValidate; +import com.biutag.lan.validate.system.DeptSearchValidate; +import com.biutag.lan.validate.system.DeptUpdateValidate; +import com.biutag.lan.vo.system.DeptVo; +import com.biutag.entity.system.PoliceUser; +import com.biutag.entity.system.Dept; +import com.biutag.mapper.system.PoliceUserMapper; +import com.biutag.mapper.system.DeptMapper; +import com.biutag.util.ListUtils; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.*; + +/** + * 系统部门服务实现类 + */ +@Service +class DeptServiceImpl implements IDeptService { + + @Resource + DeptMapper DeptMapper; + + @Resource + PoliceUserMapper PoliceUserMapper; + + /** + * 岗位所有 + * + * @author fzr + * @return List + */ + @Override + public List all() { + List DeptList = DeptMapper.selectList(new QueryWrapper() + .gt("pid", 0) + .eq("is_delete", 0) + .orderByDesc((Arrays.asList("sort", "id")))); + + List list = new ArrayList<>(); + for (Dept Dept : DeptList) { + DeptVo vo = new DeptVo(); + BeanUtils.copyProperties(Dept, vo); + + vo.setUpdateTime(TimeUtils.timestampToDate(Dept.getUpdateTime())); + vo.setCreateTime(TimeUtils.timestampToDate(Dept.getCreateTime())); + list.add(vo); + } + + return list; + } + + /** + * 部门列表 + * + * @author fzr + * @param searchValidate 搜索参数 + * @return JSONArray + */ + @Override + public JSONArray list(DeptSearchValidate searchValidate) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_delete", 0); + queryWrapper.orderByDesc(Arrays.asList("sort", "id")); + queryWrapper.select(Dept.class, info -> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")); + + DeptMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "like:name:str", + "=:isStop@is_stop:int" + }); + + List DeptList = DeptMapper.selectList(queryWrapper); + + List list = new LinkedList<>(); + for (Dept Dept : DeptList) { + DeptVo vo = new DeptVo(); + BeanUtils.copyProperties(Dept, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(Dept.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Dept.getUpdateTime())); + list.add(vo); + } + + JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(list)); + return ListUtils.listToTree(jsonArray, "id", "pid", "children"); + } + + /** + * 部门详情 + * + * @author fzr + * @param id 主键 + * @return DeptVo + */ + @Override + public DeptVo detail(Integer id) { + Dept Dept = DeptMapper.selectOne( + new QueryWrapper() + .select(Dept.class, info -> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")) + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(Dept, "部门已不存在!"); + + DeptVo vo = new DeptVo(); + BeanUtils.copyProperties(Dept, vo); + vo.setCreateTime(TimeUtils.timestampToDate(Dept.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Dept.getUpdateTime())); + + return vo; + } + + /** + * 部门新增 + * + * @author fzr + * @param createValidate 参数 + */ + @Override + public void add(DeptCreateValidate createValidate) { + if (createValidate.getPid().equals(0)) { + Dept Dept = DeptMapper.selectOne( + new QueryWrapper() + .select("id,pid,name") + .eq("pid", 0) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.isNull(Dept, "顶级部门只允许有一个"); + } + + Dept model = new Dept(); + model.setPid(createValidate.getPid()); + model.setName(createValidate.getName()); + model.setDuty(createValidate.getDuty()); + model.setMobile(createValidate.getMobile()); + model.setSort(createValidate.getSort()); + model.setIsStop(createValidate.getIsStop()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + DeptMapper.insert(model); + } + + /** + * 部门编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + @Override + public void edit(DeptUpdateValidate updateValidate) { + Dept model = DeptMapper.selectOne( + new QueryWrapper() + .select(Dept.class, info -> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")) + .eq("id", updateValidate.getId()) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(model, "部门不存在"); + Assert.isFalse((model.getPid().equals(0) && updateValidate.getPid()>0), "顶级部门不能修改上级"); + Assert.isFalse(updateValidate.getId().equals(updateValidate.getPid()), "上级部门不能是自己"); + + model.setPid(updateValidate.getPid()); + model.setName(updateValidate.getName()); + model.setDuty(updateValidate.getDuty()); + model.setMobile(updateValidate.getMobile()); + model.setSort(updateValidate.getSort()); + model.setIsStop(updateValidate.getIsStop()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + DeptMapper.updateById(model); + } + + /** + * 部门删除 + * + * @author fzr + * @param id 主键 + */ + @Override + public void del(Integer id) { + Dept model = DeptMapper.selectOne( + new QueryWrapper() + .select("id,pid,name") + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(model, "部门不存在"); + Assert.isFalse((model.getPid() == 0), "顶级部门不能删除"); + + Dept pModel = DeptMapper.selectOne( + new QueryWrapper() + .select("id,pid,name") + .eq("pid", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.isNull(pModel, "请先删除子级部门"); + + PoliceUser PoliceUser = PoliceUserMapper.selectOne(new QueryWrapper() + .select("id,nickname") + .eq("dept_id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.isNull(PoliceUser, "该部门已被管理员使用,请先移除"); + + model.setIsDelete(1); + model.setDeleteTime(System.currentTimeMillis() / 1000); + DeptMapper.updateById(model); + } + +} \ No newline at end of file diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictDataServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictDataServiceImpl.java new file mode 100644 index 0000000..d0f9ee2 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictDataServiceImpl.java @@ -0,0 +1,225 @@ +package com.biutag.lan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.lan.service.IDictDataService; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.setting.DictDataCreateValidate; +import com.biutag.lan.validate.setting.DictDataUpdateValidate; +import com.biutag.lan.vo.setting.DictDataVo; +import com.biutag.core.PageResult; +import com.biutag.entity.setting.DictData; +import com.biutag.entity.setting.DictType; +import com.biutag.mapper.setting.DictDataMapper; +import com.biutag.mapper.setting.DictTypeMapper; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * 字典数据服务实现类 + */ +@Service +public class DictDataServiceImpl implements IDictDataService { + + @Resource + DictDataMapper dictDataMapper; + + @Resource + DictTypeMapper dictTypeMapper; + + /** + * 字典数据所有 + * + * @author fzr + * @return List + */ + @Override + public List all(Map params) { + DictType dictType = dictTypeMapper.selectOne(new QueryWrapper() + .eq("dict_type", params.get("dictType")) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(dictType, "该字典类型不存在!"); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("id,type_id,name,value,remark,sort,status,create_time,update_time"); + queryWrapper.eq("is_delete", 0); + queryWrapper.eq("type_id", dictType.getId()); + queryWrapper.orderByDesc("id"); + + dictDataMapper.setSearch(queryWrapper, params, new String[]{ + "like:name:str", + "like:value:str", + "=:status:int", + }); + + List dictDataList = dictDataMapper.selectList(queryWrapper); + + List list = new LinkedList<>(); + for (DictData dictData : dictDataList) { + DictDataVo vo = new DictDataVo(); + BeanUtils.copyProperties(dictData, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(dictData.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(dictData.getUpdateTime())); + list.add(vo); + } + + return list; + } + + /** + * 字典数据列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param params 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, Map params) { + Integer page = pageValidate.getPageNo(); + Integer limit = pageValidate.getPageSize(); + + DictType dictType = dictTypeMapper.selectOne(new QueryWrapper() + .eq("is_delete", 0) + .eq("dict_type", params.get("dictType")) + .last("limit 1")); + + Assert.notNull(dictType, "该字典类型不存在!"); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("id,type_id,name,value,remark,sort,status,create_time,update_time"); + queryWrapper.eq("type_id", dictType.getId()); + queryWrapper.eq("is_delete", 0); + queryWrapper.orderByDesc("id"); + + dictDataMapper.setSearch(queryWrapper, params, new String[]{ + "like:name:str", + "like:value:str", + "=:status:int", + }); + + IPage iPage = dictDataMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new LinkedList<>(); + for (DictData dictData : iPage.getRecords()) { + DictDataVo vo = new DictDataVo(); + BeanUtils.copyProperties(dictData, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(dictData.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(dictData.getUpdateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 字典数据详情 + * + * @author fzr + * @param id 主键 + * @return DictDataVo + */ + @Override + public DictDataVo detail(Integer id) { + DictData dictData = dictDataMapper.selectOne(new QueryWrapper() + .select("id,type_id,name,value,remark,sort,status,create_time,update_time") + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(dictData, "字典数据不存在!"); + + DictDataVo vo = new DictDataVo(); + BeanUtils.copyProperties(dictData, vo); + vo.setCreateTime(TimeUtils.timestampToDate(dictData.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(dictData.getUpdateTime())); + return vo; + } + + /** + * 字典数据新增 + * + * @author fzr + * @param createValidate 参数 + */ + @Override + public void add(DictDataCreateValidate createValidate) { + Assert.isNull(dictDataMapper.selectOne(new QueryWrapper() + .select("id") + .eq("name", createValidate.getName()) + .eq("is_delete", 0) + .last("limit 1")), "字典数据已存在!"); + + DictData model = new DictData(); + model.setTypeId(createValidate.getTypeId()); + model.setName(createValidate.getName()); + model.setValue(createValidate.getValue()); + model.setRemark(createValidate.getRemark()); + model.setSort(createValidate.getSort()); + model.setStatus(createValidate.getStatus()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + dictDataMapper.insert(model); + } + + /** + * 字典数据编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + @Override + public void edit(DictDataUpdateValidate updateValidate) { + DictData model = dictDataMapper.selectOne(new QueryWrapper() + .eq("id", updateValidate.getId()) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(model, "字典数据不存在!"); + + Assert.isNull(dictDataMapper.selectOne(new QueryWrapper() + .select("id") + .ne("id", updateValidate.getId()) + .eq("name", updateValidate.getName()) + .eq("is_delete", 0) + .last("limit 1")), "字典数据已存在!"); + + model.setName(updateValidate.getName()); + model.setValue(updateValidate.getValue()); + model.setRemark(updateValidate.getRemark()); + model.setSort(updateValidate.getSort()); + model.setStatus(updateValidate.getStatus()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + dictDataMapper.updateById(model); + } + + /** + * 字典数据删除 + * + * @author fzr + * @param ids 主键 + */ + @Override + public void del(List ids) { + for (Integer id : ids) { + DictData model = new DictData(); + model.setId(id); + model.setIsDelete(1); + model.setDeleteTime(System.currentTimeMillis() / 1000); + dictDataMapper.updateById(model); + } + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictTypeServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictTypeServiceImpl.java new file mode 100644 index 0000000..4395086 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DictTypeServiceImpl.java @@ -0,0 +1,206 @@ +package com.biutag.lan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.lan.service.IDictTypeService; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.setting.DictTypeCreateValidate; +import com.biutag.lan.validate.setting.DictTypeUpdateValidate; +import com.biutag.lan.vo.setting.DictTypeVo; +import com.biutag.core.PageResult; +import com.biutag.entity.setting.DictType; +import com.biutag.mapper.setting.DictTypeMapper; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * 字典类型服务实现类 + */ +@Service +public class DictTypeServiceImpl implements IDictTypeService { + + @Resource + DictTypeMapper dictTypeMapper; + + /** + * 字典类型所有 + * + * @author fzr + * @return List + */ + @Override + public List all() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time"); + queryWrapper.eq("is_delete", 0); + queryWrapper.orderByDesc("id"); + + List dictTypeList = dictTypeMapper.selectList(queryWrapper); + + List list = new LinkedList<>(); + for (DictType dictType : dictTypeList) { + DictTypeVo vo = new DictTypeVo(); + BeanUtils.copyProperties(dictType, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(dictType.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(dictType.getUpdateTime())); + list.add(vo); + } + + return list; + } + + /** + * 字典类型列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param params 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, Map params) { + Integer page = pageValidate.getPageNo(); + Integer limit = pageValidate.getPageSize(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time"); + queryWrapper.eq("is_delete", 0); + queryWrapper.orderByDesc("id"); + + dictTypeMapper.setSearch(queryWrapper, params, new String[]{ + "like:dictName@dict_name:str", + "like:dictType@dict_type:str", + "=:dictStatus@dict_status:int", + }); + + IPage iPage = dictTypeMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new LinkedList<>(); + for (DictType dictType : iPage.getRecords()) { + DictTypeVo vo = new DictTypeVo(); + BeanUtils.copyProperties(dictType, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(dictType.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(dictType.getUpdateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 字典类型详情 + * + * @author fzr + * @param id 主键 + * @return DictDataVo + */ + @Override + public DictTypeVo detail(Integer id) { + DictType dictType = dictTypeMapper.selectOne(new QueryWrapper() + .select("id,dict_name,dict_type,dict_remark,dict_status,create_time,update_time") + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(dictType, "字典类型不存在!"); + + DictTypeVo vo = new DictTypeVo(); + BeanUtils.copyProperties(dictType, vo); + vo.setCreateTime(TimeUtils.timestampToDate(dictType.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(dictType.getUpdateTime())); + return vo; + } + + /** + * 字典类型新增 + * + * @author fzr + * @param createValidate 参数 + */ + @Override + public void add(DictTypeCreateValidate createValidate) { + Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper() + .select("id") + .eq("dict_name", createValidate.getDictName()) + .eq("is_delete", 0) + .last("limit 1")), "字典名称已存在!"); + + Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper() + .select("id") + .eq("dict_type", createValidate.getDictType()) + .eq("is_delete", 0) + .last("limit 1")), "字典类型已存在!"); + + DictType model = new DictType(); + model.setDictName(createValidate.getDictName()); + model.setDictType(createValidate.getDictType()); + model.setDictRemark(createValidate.getDictRemark()); + model.setDictStatus(createValidate.getDictStatus()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + dictTypeMapper.insert(model); + } + + /** + * 字典类型编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + @Override + public void edit(DictTypeUpdateValidate updateValidate) { + DictType model = dictTypeMapper.selectOne(new QueryWrapper() + .eq("id", updateValidate.getId()) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(model, "字典类型不存在!"); + + Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper() + .ne("id", updateValidate.getId()) + .eq("dict_name", updateValidate.getDictName()) + .eq("is_delete", 0) + .last("limit 1")), "字典类型已存在!"); + + Assert.isNull(dictTypeMapper.selectOne(new QueryWrapper() + .ne("id", updateValidate.getId()) + .eq("dict_type", updateValidate.getDictType()) + .eq("is_delete", 0) + .last("limit 1")), "字典类型已存在!"); + + model.setDictName(updateValidate.getDictName()); + model.setDictType(updateValidate.getDictType()); + model.setDictRemark(updateValidate.getDictRemark()); + model.setDictStatus(updateValidate.getDictStatus()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + dictTypeMapper.updateById(model); + } + + /** + * 字典类型删除 + * + * @author fzr + * @param ids 主键 + */ + @Override + public void del(List ids) { + for(Integer id : ids) { + DictType model = new DictType(); + model.setId(id); + model.setIsDelete(1); + model.setDeleteTime(System.currentTimeMillis() / 1000); + dictTypeMapper.updateById(model); + } + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/IndexServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/IndexServiceImpl.java new file mode 100644 index 0000000..54c0bdc --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/IndexServiceImpl.java @@ -0,0 +1,95 @@ +package com.biutag.lan.service.impl; + +import com.biutag.lan.service.IIndexService; +import com.biutag.config.GlobalConfig; +import com.biutag.util.*; +import org.springframework.stereotype.Service; + +import java.util.*; + +/** + * 主页服务实现类 + */ +@Service +public class IndexServiceImpl implements IIndexService { + + /** + * 控制台数据 + * + * @author fzr + * @return Map + */ + @Override + public Map console() { + Map console = new LinkedHashMap<>(); + + // 版本信息 + Map version = new LinkedHashMap<>(); + version.put("name", ConfigUtils.get("website", "name", "LikeAdmin-Java")); + version.put("version", GlobalConfig.version); + version.put("website", "www.likeadmin.cn"); + version.put("based", "Vue3.x、ElementUI、MySQL"); + Map channel = new LinkedHashMap<>(); + channel.put("gitee", "https://gitee.com/likeadmin/likeadmin_java"); + channel.put("website", "https://www.likeadmin.cn"); + version.put("channel", channel); + console.put("version", version); + + // 今日数据 + Map today = new LinkedHashMap<>(); + today.put("time", "2022-08-11 15:08:29"); + today.put("todayVisits", 10); // 访问量(人) + today.put("totalVisits", 100); // 总访问量 + today.put("todaySales", 30); // 销售额(元) + today.put("totalSales", 65); // 总销售额 + today.put("todayOrder", 12); // 订单量(笔) + today.put("totalOrder", 255); // 总订单量 + today.put("todayUsers", 120); // 新增用户 + today.put("totalUsers", 360); // 总访用户 + console.put("today", today); + + // 访客图表 + Map visitor = new LinkedHashMap<>(); + visitor.put("date", TimeUtils.daysAgoDate(15)); + visitor.put("list", Arrays.asList(12,13,11,5,8,22,14,9,456,62,78,12,18,22,46)); + console.put("visitor", visitor); + + return console; + } + + /** + * 公共配置 + * + * @author fzr + * @return Map + */ + @Override + public Map config() { + Map website = ConfigUtils.get("website"); + String copyright = ConfigUtils.get("website", "copyright", ""); + + String captchaStatus = YmlUtils.get("like.captcha.status"); + + Map map = new LinkedHashMap<>(); + map.put("loginCaptcha", StringUtils.isNotNull(captchaStatus) && captchaStatus.equals("true")); + map.put("webName", website.getOrDefault("name", "")); + map.put("webLogo", UrlUtils.toAbsoluteUrl(website.getOrDefault("logo", ""))); + map.put("webFavicon", UrlUtils.toAbsoluteUrl(website.getOrDefault("favicon", ""))); + map.put("webBackdrop", UrlUtils.toAbsoluteUrl(website.getOrDefault("backdrop", ""))); + map.put("ossDomain", UrlUtils.domain()); + map.put("copyright", ListUtils.stringToListAsMapStr(copyright)); + map.put("webName", "局长信箱后台管理"); + map.put("webLogo", "http://localhost:8082/api/static/backend_logo.png"); + map.put("webFavicon", "http://localhost:8082/api/static/backend_favicon.ico"); + map.put("webBackdrop", "http://localhost:8082/api/static/backend_backdrop.png"); + map.put("ossDomain", "http://localhost:8080/"); + +// "webName": "LikeAdmin开源后台", +// "webLogo": , +// "webFavicon": , +// "webBackdrop": +// "ossDomain": + return map; + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..44e9f1e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/MenuServiceImpl.java @@ -0,0 +1,224 @@ +package com.biutag.lan.service.impl; + +import com.alibaba.fastjson2.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.biutag.lan.AdminThreadLocal; +import com.biutag.lan.service.IMenuService; +import com.biutag.lan.service.IPermService; +import com.biutag.lan.validate.system.MenuCreateValidate; +import com.biutag.lan.validate.system.MenuUpdateValidate; +import com.biutag.lan.vo.system.MenuVo; +import com.biutag.entity.system.Menu; +import com.biutag.mapper.system.MenuMapper; +import com.biutag.util.ListUtils; +import com.biutag.util.StringUtils; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 系统菜单服务实现类 + */ +@Service +public class MenuServiceImpl implements IMenuService { + + @Resource + MenuMapper MenuMapper; + + @Resource + IPermService iPermService; + + /** + * 根据角色ID获取菜单 + * + * @author fzr + * @param roleIds 角色ID + * @return JSONArray + */ + @Override + public JSONArray selectMenuByRoleId(List roleIds) { + Integer adminId = AdminThreadLocal.getAdminId(); + List menuIds = iPermService.selectMenuIdsByRoleId(roleIds); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("menu_type", Arrays.asList("M", "C")); + queryWrapper.eq("is_disable", 0); + queryWrapper.orderByDesc("menu_sort"); + queryWrapper.orderByAsc("id"); + if (!adminId.equals(1)) { + if (menuIds.size() <= 0) { + menuIds.add(0); + } + queryWrapper.in("id", menuIds); + } + + List Menus = MenuMapper.selectList(queryWrapper); + + List lists = new ArrayList<>(); + for (Menu Menu : Menus) { + MenuVo vo = new MenuVo(); + + BeanUtils.copyProperties(Menu, vo); + if(StringUtils.isEmpty(vo.getSelected())){ + vo.setSelected(""); + } + if(StringUtils.isEmpty(vo.getParams())){ + vo.setParams(""); + } + + vo.setUpdateTime(TimeUtils.timestampToDate(Menu.getUpdateTime())); + vo.setCreateTime(TimeUtils.timestampToDate(Menu.getCreateTime())); + lists.add(vo); + } + + JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(lists)); + return ListUtils.listToTree(jsonArray, "id", "pid", "children"); + } + + /** + * 菜单列表 + * + * @author fzr + * @return JSONArray + */ + @Override + public JSONArray list() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("menu_sort"); + queryWrapper.orderByAsc("id"); + + List Menus = MenuMapper.selectList(queryWrapper); + + List lists = new ArrayList<>(); + for (Menu Menu : Menus) { + MenuVo vo = new MenuVo(); + BeanUtils.copyProperties(Menu, vo); + if(StringUtils.isEmpty(vo.getSelected())){ + vo.setSelected(""); + } + if(StringUtils.isEmpty(vo.getParams())){ + vo.setParams(""); + } + if(StringUtils.isEmpty(vo.getPaths())){ + vo.setPaths(""); + } + if(StringUtils.isEmpty(vo.getMenuIcon())){ + vo.setMenuIcon(""); + } + + vo.setCreateTime(TimeUtils.timestampToDate(Menu.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Menu.getUpdateTime())); + lists.add(vo); + } + + JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(lists)); + return ListUtils.listToTree(jsonArray, "id", "pid", "children"); + } + + /** + * 菜单详情 + * + * @author fzr + * @param id 主键参数 + * @return SysMenu + */ + @Override + public MenuVo detail(Integer id) { + Menu Menu = MenuMapper.selectOne(new QueryWrapper().eq("id", id)); + Assert.notNull(Menu, "菜单已不存在!"); + + MenuVo vo = new MenuVo(); + BeanUtils.copyProperties(Menu, vo); + vo.setCreateTime(TimeUtils.timestampToDate(Menu.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Menu.getUpdateTime())); + + return vo; + } + + /** + * 新增菜单 + * + * @author fzr + * @param createValidate 参数 + */ + @Override + public void add(MenuCreateValidate createValidate) { + Menu model = new Menu(); + model.setPid(createValidate.getPid()); + model.setMenuType(createValidate.getMenuType()); + model.setMenuName(createValidate.getMenuName()); + model.setMenuIcon(createValidate.getMenuIcon()); + model.setMenuSort(createValidate.getMenuSort()); + model.setPerms(createValidate.getPerms()); + model.setPaths(createValidate.getPaths()); + model.setComponent(createValidate.getComponent()); + model.setSelected(createValidate.getSelected()); + model.setParams(createValidate.getParams()); + model.setIsCache(createValidate.getIsCache()); + model.setIsShow(createValidate.getIsShow()); + model.setIsDisable(createValidate.getIsDisable()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + MenuMapper.insert(model); + } + + /** + * 编辑菜单 + * + * @author fzr + * @param updateValidate 菜单 + */ + @Override + public void edit(MenuUpdateValidate updateValidate) { + Menu model = MenuMapper.selectOne(new QueryWrapper().eq("id", updateValidate.getId())); + Assert.notNull(model, "菜单已不存在!"); + + model.setMenuType(updateValidate.getMenuType()); + model.setMenuName(updateValidate.getMenuName()); + model.setMenuIcon(updateValidate.getMenuIcon()); + model.setMenuSort(updateValidate.getMenuSort()); + model.setPaths(updateValidate.getPaths()); + model.setPerms(updateValidate.getPerms()); + model.setComponent(updateValidate.getComponent()); + model.setPid(updateValidate.getPid()); + model.setSelected(updateValidate.getSelected()); + model.setParams(updateValidate.getParams()); + model.setIsCache(updateValidate.getIsCache()); + model.setIsShow(updateValidate.getIsShow()); + model.setIsDisable(updateValidate.getIsDisable()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + MenuMapper.updateById(model); + } + + /** + * 删除菜单 + * + * @author fzr + * @param id 主键参数 + */ + @Override + public void del(Integer id) { + Menu model = MenuMapper.selectOne( + new QueryWrapper() + .select("id,pid,menu_name") + .eq("id", id) + .last("limit 1")); + + Assert.notNull(model, "菜单已不存在!"); + Assert.isNull(MenuMapper.selectOne( + new QueryWrapper() + .eq("pid", id) + .last("limit 1")), + "请先删除子菜单再操作!"); + + MenuMapper.deleteById(id); + iPermService.batchDeleteByMenuId(id); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PermServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PermServiceImpl.java new file mode 100644 index 0000000..8bfbcef --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PermServiceImpl.java @@ -0,0 +1,105 @@ +package com.biutag.lan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.lan.service.IPermService; +import com.biutag.entity.system.Perm; +import com.biutag.entity.system.Role; +import com.biutag.mapper.system.PermMapper; +import com.biutag.mapper.system.RoleMapper; +import com.biutag.util.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import jakarta.annotation.Resource; +import java.util.LinkedList; +import java.util.List; + +/** + * 系统权限服务实现类 + */ +@Service +public class PermServiceImpl implements IPermService { + + @Resource + PermMapper PermMapper; + + @Resource + RoleMapper RoleMapper; + + /** + * 根据角色ID获取菜单ID + * + * @param roleIds 角色ID + * @return List + */ + @Override + public List selectMenuIdsByRoleId(List roleIds) { + List menus = new LinkedList<>(); + + if (roleIds.isEmpty()) { + return menus; + } + + Role Role = RoleMapper.selectOne(new QueryWrapper() + .in("id", roleIds) + .eq("is_disable", 0) + .last("limit 1")); + + if (StringUtils.isNull(Role)) { + return menus; + } + + List Perms = PermMapper.selectList( + new QueryWrapper() + .in("role_id", roleIds)); + + for (Perm Perm : Perms) { + menus.add(Perm.getMenuId()); + } + + return menus; + } + + /** + * 批量写入角色菜单 + * + * @author fzr + * @param roleId 角色ID + * @param menuIds 菜单ID组 + */ + @Override + @Transactional + public void batchSaveByMenuIds(Integer roleId, String menuIds) { + if (menuIds != null && !menuIds.equals("")) { + for (String menuId : menuIds.split(",")) { + Perm model = new Perm(); + model.setRoleId(roleId); + model.setMenuId(Integer.parseInt(menuId)); + PermMapper.insert(model); + } + } + } + + /** + * 批量删除角色菜单(根据角色ID) + * + * @author fzr + * @param roleId 角色ID + */ + @Override + public void batchDeleteByRoleId(Integer roleId) { + PermMapper.delete(new QueryWrapper().eq("role_id", roleId)); + } + + /** + * 批量删除角色菜单(根据菜单ID) + * + * @author fzr + * @param menuId 菜单ID + */ + @Override + public void batchDeleteByMenuId(Integer menuId) { + PermMapper.delete(new QueryWrapper().eq("menu_id", menuId)); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java new file mode 100644 index 0000000..e298e38 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java @@ -0,0 +1,442 @@ +package com.biutag.lan.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.entity.system.*; +import com.biutag.mapper.system.*; +import com.github.yulichang.query.MPJQueryWrapper; +import com.biutag.lan.service.IPoliceUserService; +import com.biutag.lan.service.IPermService; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.PoliceUserCreateValidate; +import com.biutag.lan.validate.system.PoliceUserSearchValidate; +import com.biutag.lan.validate.system.PoliceUserUpInfoValidate; +import com.biutag.lan.validate.system.PoliceUserUpdateValidate; +import com.biutag.lan.vo.system.*; +import com.biutag.core.PageResult; +import com.biutag.exception.OperateException; +import com.biutag.util.*; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.*; + +/** + * 系统管理员服务实现类 + */ +@Service +public class PoliceUserServiceImpl implements IPoliceUserService { + + @Resource + PoliceUserMapper PoliceUserMapper; + + @Resource + MenuMapper MenuMapper; + + @Resource + DeptMapper DeptMapper; + @Resource + PostMapper PostMapper; + @Resource + RoleMapper RoleMapper; + + @Resource + IPermService iPermService; + + /** + * 管理员列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, PoliceUserSearchValidate searchValidate) { + Integer page = pageValidate.getPageNo(); + Integer limit = pageValidate.getPageSize(); + + MPJQueryWrapper mpjQueryWrapper = new MPJQueryWrapper<>(); + mpjQueryWrapper.select("t.id,t.name,t.emp_no,t.username,t.nickname,t.avatar," + + "t.post_ids as post,t.role_ids as role,t.dept_ids as dept,t.is_multipoint,t.mobile,t.id_code,t.job,t.job_type," + + "t.is_disable,t.last_login_ip,t.last_login_time,t.create_time,t.update_time") + .eq("t.is_delete", 0) + .orderByDesc(Arrays.asList("t.id", "t.sort")); + + + PoliceUserMapper.setSearch(mpjQueryWrapper, searchValidate, new String[]{ + "like:empNo@emp_no:str", + "like:name:str", + "like:mobile:str", + "like:idCode@id_code:str" + + }); + + if (StringUtils.isNotNull(searchValidate.getRole())) { + mpjQueryWrapper.in("role_ids", Collections.singletonList(searchValidate.getRole())); + } + + IPage iPage = PoliceUserMapper.selectJoinPage( + new Page<>(page, limit), + PoliceUserListedVo.class, + mpjQueryWrapper); + + for (PoliceUserListedVo vo : iPage.getRecords()) { + if (vo.getId().equals(1)) { + vo.setRole("系统管理员"); + } else { + List role = new LinkedList<>(); + List roleIds = ListUtils.stringToListAsInt(vo.getRole(), ","); + if (!roleIds.isEmpty()) { + List roleList = RoleMapper.selectList(new QueryWrapper() + .select("id,name") + .in("id", roleIds)); + for (Role d : roleList) { + role.add(d.getName()); + } + } + vo.setRole(ListUtils.listToStringByStr(role, ",")); + + + List post = new LinkedList<>(); + List postIds = ListUtils.stringToListAsInt(vo.getPost(), ","); + if (!postIds.isEmpty()) { + List postList = PostMapper.selectList(new QueryWrapper() + .select("id,name") + .in("id", postIds)); + for (Post d : postList) { + post.add(d.getName()); + } + } + vo.setPost(ListUtils.listToStringByStr(post, ",")); + } + + if (StringUtils.isNull(vo.getDept()) || vo.getDept().equals("")) { + vo.setDept(""); + } else { + List dept = new LinkedList<>(); + List deptIds = ListUtils.stringToListAsInt(vo.getDept(), ","); + if (!deptIds.isEmpty()) { + List deptList = DeptMapper.selectList(new QueryWrapper() + .select("id,name") + .in("id", deptIds) + .eq("is_delete", 0)); + for (Dept d : deptList) { + dept.add(d.getName()); + } + } + vo.setDept(ListUtils.listToStringByStr(dept, ",")); + } + + vo.setAvatar(UrlUtils.toAbsoluteUrl(vo.getAvatar())); + vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(vo.getUpdateTime())); + vo.setLastLoginTime(TimeUtils.timestampToDate(vo.getLastLoginTime())); + } + + return PageResult.iPageHandle(iPage); + } + + /** + * 当前管理员 + * + * @author fzr + * @param adminId 管理员ID + * @return PoliceUserSelvesVo + */ + @Override + public PoliceUserSelvesVo self(Integer adminId) { + // 管理员信息 + PoliceUser sysAdmin = PoliceUserMapper.selectOne(new QueryWrapper() + .select(PoliceUser.class, info-> + !info.getColumn().equals("salt") && + !info.getColumn().equals("password") && + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")) + .eq("is_delete", 0) + .eq("id", adminId) + .last("limit 1")); + + PoliceUserInformVo PoliceUserInformVo = new PoliceUserInformVo(); + BeanUtils.copyProperties(sysAdmin, PoliceUserInformVo); + PoliceUserInformVo.setAvatar(UrlUtils.toAbsoluteUrl(sysAdmin.getAvatar())); + PoliceUserInformVo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime())); + PoliceUserInformVo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime())); + PoliceUserInformVo.setLastLoginTime(TimeUtils.timestampToDate(sysAdmin.getLastLoginTime())); + + // 角色权限 + List auths = new LinkedList<>(); + if (adminId > 1) { + List roleIds = ListUtils.stringToListAsInt(sysAdmin.getRoleIds(), ","); + List menuIds = iPermService.selectMenuIdsByRoleId(roleIds); + if (menuIds.size() > 0) { + List Menus = MenuMapper.selectList(new QueryWrapper() + .eq("is_disable", 0) + .in("id", menuIds) + .in("menu_type", Arrays.asList("C", "A")) + .orderByAsc(Arrays.asList("menu_sort", "id"))); + + // 处理权限 + for (Menu item : Menus) { + if (StringUtils.isNotNull(item.getPerms()) && StringUtils.isNotEmpty(item.getPerms())) { + auths.add(item.getPerms().trim()); + } + } + } + // 没有权限 + if (auths.size() <= 0) { + auths.add(""); + } + } else { + // 所有权限 + auths.add("*"); + } + + // 返回数据 + PoliceUserSelvesVo vo = new PoliceUserSelvesVo(); + vo.setUser(PoliceUserInformVo); + vo.setPermissions(auths); + return vo; + } + + /** + * 管理员详细 + * + * @author fzr + * @param id 主键 + * @return PoliceUserDetailVo + */ + @Override + public PoliceUserDetailVo detail(Integer id) { + PoliceUser sysAdmin = PoliceUserMapper.selectOne(new QueryWrapper() + .select(PoliceUser.class, info-> + !info.getColumn().equals("salt") && + !info.getColumn().equals("password") && + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")) + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(sysAdmin, "账号已不存在!"); + + PoliceUserDetailVo vo = new PoliceUserDetailVo(); + BeanUtils.copyProperties(sysAdmin, vo); + vo.setRoleIds(ListUtils.stringToListAsInt(sysAdmin.getRoleIds(), ",")); + vo.setDeptIds(ListUtils.stringToListAsInt(sysAdmin.getDeptIds(), ",")); + vo.setPostIds(ListUtils.stringToListAsInt(sysAdmin.getPostIds(), ",")); + vo.setAvatar(UrlUtils.toAbsoluteUrl(sysAdmin.getAvatar())); + vo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime())); + vo.setLastLoginTime(TimeUtils.timestampToDate(sysAdmin.getLastLoginTime())); + return vo; + } + + /** + * 管理员新增 + * + * @author fzr + * @param createValidate 参数 + */ + @Override + public void add(PoliceUserCreateValidate createValidate) { + String[] field = {"id", "username", "nickname"}; + Assert.isNull(PoliceUserMapper.selectOne(new QueryWrapper() + .select(field) + .eq("is_delete", 0) + .eq("username", createValidate.getUsername()) + .last("limit 1")), "账号已存在换一个吧!"); + + Assert.isNull(PoliceUserMapper.selectOne(new QueryWrapper() + .select(field) + .eq("is_delete", 0) + .eq("nickname", createValidate.getNickname()) + .last("limit 1")), "昵称已存在换一个吧!"); + + String salt = ToolUtils.randomString(5); + String pwd = ToolUtils.makeMd5(createValidate.getPassword().trim() + salt); + + String createAvatar = createValidate.getAvatar(); + String defaultAvatar = "/api/static/backend_avatar.png"; + String avatar = StringUtils.isNotEmpty(createValidate.getAvatar()) ? UrlUtils.toRelativeUrl(createAvatar) : defaultAvatar; + + PoliceUser model = new PoliceUser(); + model.setRoleIds(ListUtils.listToStringByInt(createValidate.getRoleIds(), ",")); + model.setDeptIds(ListUtils.listToStringByInt(createValidate.getDeptIds(), ",")); + model.setPostIds(ListUtils.listToStringByInt(createValidate.getPostIds(), ",")); + model.setEmpNo(createValidate.getUsername()); + model.setName(createValidate.getNickname()); + model.setAvatar(avatar); + model.setPassword(pwd); + model.setSalt(salt); + model.setSort(createValidate.getSort()); + model.setIsMultipoint(createValidate.getIsMultipoint()); + model.setIsDisable(createValidate.getIsDisable()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + PoliceUserMapper.insert(model); + } + + /** + * 管理员更新 + * + * @author fzr + * @param updateValidate 参数 + * @param adminId 管理员ID + */ + @Override + public void edit(PoliceUserUpdateValidate updateValidate, Integer adminId) { + if (!adminId.equals(1) && updateValidate.getId().equals(1)) { + throw new OperateException("您无权限编辑系统管理员!"); + } + + String[] field = {"id", "username", "nickname"}; + Assert.notNull(PoliceUserMapper.selectOne(new QueryWrapper() + .select(field) + .eq("id", updateValidate.getId()) + .eq("is_delete", 0) + .last("limit 1")), "账号不存在了!"); + + Assert.isNull(PoliceUserMapper.selectOne(new QueryWrapper() + .select(field) + .eq("is_delete", 0) + .eq("username", updateValidate.getUsername()) + .ne("id", updateValidate.getId()) + .last("limit 1")), "账号已存在换一个吧!"); + + Assert.isNull(PoliceUserMapper.selectOne(new QueryWrapper() + .select(field) + .eq("is_delete", 0) + .eq("nickname", updateValidate.getNickname()) + .ne("id", updateValidate.getId()) + .last("limit 1")), "昵称已存在换一个吧!"); + + PoliceUser model = new PoliceUser(); + model.setId(updateValidate.getId()); + model.setRoleIds(ListUtils.listToStringByInt(updateValidate.getRoleIds(), ",")); + model.setDeptIds(ListUtils.listToStringByInt(updateValidate.getDeptIds(), ",")); + model.setPostIds(ListUtils.listToStringByInt(updateValidate.getPostIds(), ",")); + model.setName(updateValidate.getNickname()); + model.setAvatar(UrlUtils.toRelativeUrl(updateValidate.getAvatar())); + model.setSort(updateValidate.getSort()); + model.setIsMultipoint(updateValidate.getIsMultipoint()); + model.setIsDisable(updateValidate.getIsDisable()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + + if (!updateValidate.getId().equals(1)) { + model.setName(updateValidate.getUsername()); + } + + if (StringUtils.isNotNull(updateValidate.getPassword()) && StringUtils.isNotEmpty(updateValidate.getPassword())) { + String salt = ToolUtils.randomString(5); + String pwd = ToolUtils.makeMd5( updateValidate.getPassword().trim() + salt); + model.setPassword(pwd); + model.setSalt(salt); + } + + PoliceUserMapper.updateById(model); + if (StringUtils.isNotNull(updateValidate.getPassword()) && StringUtils.isNotEmpty(updateValidate.getPassword())) { + StpUtil.kickout(updateValidate.getId()); + } + } + + /** + * 当前管理员更新 + * + * @author fzr + * @param upInfoValidate 参数 + */ + @Override + public void upInfo(PoliceUserUpInfoValidate upInfoValidate, Integer adminId) { + PoliceUser model = PoliceUserMapper.selectOne(new QueryWrapper() + .select("id,username,nickname,password,salt") + .eq("id", adminId) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(model, "账号不存在了!"); + + String createAvatar = upInfoValidate.getAvatar(); + String defaultAvatar = "/api/static/backend_avatar.png"; + String avatar = StringUtils.isNotEmpty(upInfoValidate.getAvatar()) ? UrlUtils.toRelativeUrl(createAvatar) : defaultAvatar; + + model.setAvatar(avatar); + model.setName(upInfoValidate.getNickname()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + + if (StringUtils.isNotNull(upInfoValidate.getPassword()) && StringUtils.isNotEmpty(upInfoValidate.getPassword())) { + String currPassword = ToolUtils.makeMd5(upInfoValidate.getCurrPassword() + model.getSalt()); + Assert.isFalse(!currPassword.equals(model.getPassword()), "当前密码不正确!"); + String salt = ToolUtils.randomString(5); + String pwd = ToolUtils.makeMd5( upInfoValidate.getPassword().trim() + salt); + model.setPassword(pwd); + model.setSalt(salt); + } + + PoliceUserMapper.updateById(model); + if (StringUtils.isNotNull(upInfoValidate.getPassword()) && StringUtils.isNotEmpty(upInfoValidate.getPassword())) { + StpUtil.kickout(adminId); + } + } + + /** + * 管理员删除 + * + * @author fzr + * @param id 主键 + * @param adminId 管理员ID + */ + @Override + public void del(Integer id, Integer adminId) { + String[] field = {"id", "username", "nickname"}; + Assert.notNull(PoliceUserMapper.selectOne(new QueryWrapper() + .select(field) + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")), "账号已不存在!"); + + Assert.isFalse(id.equals(1), "系统管理员不允许删除!"); + Assert.isFalse(id.equals(adminId) , "不能删除自己!"); + + PoliceUser model = new PoliceUser(); + model.setId(id); + model.setIsDelete(1); + model.setDeleteTime(System.currentTimeMillis() / 1000); + PoliceUserMapper.updateById(model); + + StpUtil.kickout(id); + } + + /** + * 管理员状态切换 + * + * @author fzr + * @param id 主键参数 + * @param adminId 管理员ID + */ + @Override + public void disable(Integer id, Integer adminId) { + PoliceUser PoliceUser = PoliceUserMapper.selectOne(new QueryWrapper() + .select("id,username,nickname,is_disable") + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(PoliceUser, "账号已不存在!"); + Assert.isFalse(id.equals(adminId) , "不能禁用自己!"); + + Integer disable = PoliceUser.getIsDisable() == 1 ? 0 : 1; + PoliceUser.setIsDisable(disable); + PoliceUser.setUpdateTime(TimeUtils.timestamp()); + PoliceUserMapper.updateById(PoliceUser); + + if (disable.equals(1)) { + StpUtil.kickout(id); + } + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PostServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PostServiceImpl.java new file mode 100644 index 0000000..6afa50c --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PostServiceImpl.java @@ -0,0 +1,228 @@ +package com.biutag.lan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.lan.service.IPostService; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.PostCreateValidate; +import com.biutag.lan.validate.system.PostSearchValidate; +import com.biutag.lan.validate.system.PostUpdateValidate; +import com.biutag.lan.vo.system.PostVo; +import com.biutag.core.PageResult; +import com.biutag.entity.system.PoliceUser; +import com.biutag.entity.system.Post; +import com.biutag.mapper.system.PoliceUserMapper; +import com.biutag.mapper.system.PostMapper; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 系统岗位服务实现类 + */ +@Service +public class PostServiceImpl implements IPostService { + + @Resource + PostMapper PostMapper; + + @Resource + PoliceUserMapper PoliceUserMapper; + + /** + * 岗位所有 + * + * @author fzr + * @return List + */ + @Override + public List all() { + List PostList = PostMapper.selectList(new QueryWrapper() + .eq("is_delete", 0) + .orderByDesc((Arrays.asList("sort", "id")))); + + List adminVoArrayList = new ArrayList<>(); + for (Post Post : PostList) { + PostVo vo = new PostVo(); + BeanUtils.copyProperties(Post, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(Post.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Post.getUpdateTime())); + adminVoArrayList.add(vo); + } + + return adminVoArrayList; + } + + /** + * 岗位列表 + * + * @author fzr + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, PostSearchValidate searchValidate) { + Integer page = pageValidate.getPageNo(); + Integer limit = pageValidate.getPageSize(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select(Post.class, info-> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")) + .eq("is_delete", 0) + .orderByDesc(Arrays.asList("sort", "id")); + + PostMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "like:code:str", + "like:name:str", + "=:isStop@is_stop:int" + }); + + IPage iPage = PostMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new ArrayList<>(); + for (Post Post : iPage.getRecords()) { + PostVo vo = new PostVo(); + BeanUtils.copyProperties(Post, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(Post.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Post.getUpdateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 岗位详情 + * + * @author fzr + * @param id 主键 + * @return PostVo + */ + @Override + public PostVo detail(Integer id) { + Post Post = PostMapper.selectOne(new QueryWrapper() + .select(Post.class, info -> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")) + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(Post, "岗位不存在"); + + PostVo vo = new PostVo(); + BeanUtils.copyProperties(Post, vo); + vo.setCreateTime(TimeUtils.timestampToDate(Post.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Post.getUpdateTime())); + + return vo; + } + + /** + * 岗位新增 + * + * @author fzr + * @param createValidate 参数 + */ + @Override + public void add(PostCreateValidate createValidate) { + Assert.isNull(PostMapper.selectOne(new QueryWrapper() + .select("id,code,name") + .nested( + wq->wq.eq("code", createValidate.getCode()) + .or() + .eq("name", createValidate.getName()) + ) + .eq("is_delete", 0) + .last("limit 1")), "该岗位已存在"); + + Post model = new Post(); + model.setCode(createValidate.getCode()); + model.setName(createValidate.getName()); + model.setSort(createValidate.getSort()); + model.setRemarks(createValidate.getRemarks()); + model.setIsStop(createValidate.getIsStop()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + PostMapper.insert(model); + } + + /** + * 岗位编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + @Override + public void edit(PostUpdateValidate updateValidate) { + Post model = PostMapper.selectOne(new QueryWrapper() + .select(Post.class, info -> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")) + .eq("id", updateValidate.getId()) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(model, "岗位不存在"); + + Assert.isNull(PostMapper.selectOne(new QueryWrapper() + .select("id,code,name") + .ne("id", updateValidate.getId()) + .nested( + wq->wq.eq("code", updateValidate.getCode()) + .or() + .eq("name", updateValidate.getName()) + ) + .eq("is_delete", 0) + .last("limit 1")), "该岗位已存在"); + + model.setCode(updateValidate.getCode()); + model.setName(updateValidate.getName()); + model.setSort(updateValidate.getSort()); + model.setRemarks(updateValidate.getRemarks()); + model.setIsStop(updateValidate.getIsStop()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + PostMapper.updateById(model); + } + + /** + * 岗位删除 + * + * @author fzr + * @param id 主键 + */ + @Override + public void del(Integer id) { + Post model = PostMapper.selectOne(new QueryWrapper() + .select("id,code,name") + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(model, "岗位不存在"); + + PoliceUser PoliceUser = PoliceUserMapper.selectOne(new QueryWrapper() + .select("id,emp_no") + .eq("post_ids", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.isNull(PoliceUser, "该岗位已被管理员使用,请先移除"); + + model.setIsDelete(1); + model.setDeleteTime(System.currentTimeMillis() / 1000); + PostMapper.updateById(model); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/RoleServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..561b345 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/RoleServiceImpl.java @@ -0,0 +1,221 @@ +package com.biutag.lan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.lan.service.IPermService; +import com.biutag.lan.service.IRoleService; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.RoleCreateValidate; +import com.biutag.lan.validate.system.RoleUpdateValidate; +import com.biutag.lan.vo.system.RoleVo; +import com.biutag.core.PageResult; +import com.biutag.entity.system.PoliceUser; +import com.biutag.entity.system.Role; +import com.biutag.mapper.system.PoliceUserMapper; +import com.biutag.mapper.system.RoleMapper; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import jakarta.annotation.Resource; +import java.util.*; + +/** + * 系统角色服务实现类 + */ +@Service +public class RoleServiceImpl implements IRoleService { + + @Resource + PoliceUserMapper PoliceUserMapper; + + @Resource + RoleMapper RoleMapper; + + @Resource + IPermService iPermService; + + /** + * 角色所有 + * + * @author fzr + * @return List + */ + @Override + public List all() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.select("id,name,sort,is_disable,create_time,update_time"); + queryWrapper.orderByDesc(Arrays.asList("sort", "id")); + List Roles = RoleMapper.selectList(queryWrapper); + + List list = new ArrayList<>(); + for (Role Role : Roles) { + RoleVo vo = new RoleVo(); + + vo.setId(Role.getId()); + vo.setName(Role.getName()); + vo.setSort(Role.getSort()); + vo.setIsDisable(Role.getIsDisable()); + vo.setCreateTime(TimeUtils.timestampToDate(Role.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Role.getUpdateTime())); + vo.setMember(0); + vo.setRemark(""); + vo.setMenus(Collections.EMPTY_LIST); + list.add(vo); + } + + return list; + } + + /** + * 角色列表 + * + * @author fzr + * @param pageValidate 参数 + * @return PageResult + */ + @Override + public PageResult list(@Validated PageValidate pageValidate) { + Integer page = pageValidate.getPageNo(); + Integer limit = pageValidate.getPageSize(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc(Arrays.asList("sort", "id")); + + IPage iPage = RoleMapper.selectPage(new Page<>(page, limit), queryWrapper); + + List list = new ArrayList<>(); + for (Role Role : iPage.getRecords()) { + RoleVo vo = new RoleVo(); + BeanUtils.copyProperties(Role, vo); + + List ids = PoliceUserMapper.selectChildrenById(Role.getId()); + Integer member = ids.size(); + + vo.setMenus(new ArrayList<>()); + vo.setMember(member); + vo.setCreateTime(TimeUtils.timestampToDate(Role.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Role.getUpdateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 角色详情 + * + * @author fzr + * @param id 主键参数 + * @return SysRole + */ + @Override + public RoleVo detail(Integer id) { + Role Role = RoleMapper.selectOne(new QueryWrapper() + .eq("id", id) + .last("limit 1")); + + Assert.notNull(Role, "角色已不存在!"); + + List roleIds = new LinkedList<>(); + roleIds.add(Role.getId()); + + RoleVo vo = new RoleVo(); + BeanUtils.copyProperties(Role, vo); + vo.setMember(0); + vo.setMenus(iPermService.selectMenuIdsByRoleId(roleIds)); + vo.setCreateTime(TimeUtils.timestampToDate(Role.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(Role.getUpdateTime())); + + return vo; + } + + /** + * 新增角色 + * + * @author fzr + * @param createValidate 参数 + */ + @Override + @Transactional + public void add(RoleCreateValidate createValidate) { + Assert.isNull(RoleMapper.selectOne(new QueryWrapper() + .select("id,name") + .eq("name", createValidate.getName().trim()) + .last("limit 1")), "角色名称已存在!"); + + Role model = new Role(); + model.setName(createValidate.getName().trim()); + model.setRemark(createValidate.getRemark()); + model.setSort(createValidate.getSort()); + model.setIsDisable(createValidate.getIsDisable()); + model.setCreateTime(System.currentTimeMillis() / 1000); + model.setUpdateTime(System.currentTimeMillis() / 1000); + RoleMapper.insert(model); + iPermService.batchSaveByMenuIds(model.getId(), createValidate.getMenuIds()); + } + + /** + * 编辑角色 + * + * @author fzr + * @param updateValidate 参数 + */ + @Override + @Transactional + public void edit(RoleUpdateValidate updateValidate) { + Assert.notNull(RoleMapper.selectOne(new QueryWrapper() + .select("id,name") + .eq("id", updateValidate.getId()) + .last("limit 1")), "角色已不存在!"); + + Assert.isNull(RoleMapper.selectOne(new QueryWrapper() + .select("id,name") + .ne("id", updateValidate.getId()) + .eq("name", updateValidate.getName().trim()) + .last("limit 1")), "角色名称已存在!"); + + Role model = new Role(); + model.setId(updateValidate.getId()); + model.setName(updateValidate.getName().trim()); + model.setRemark(updateValidate.getRemark()); + model.setSort(updateValidate.getSort()); + model.setIsDisable(updateValidate.getIsDisable()); + model.setUpdateTime(System.currentTimeMillis() / 1000); + RoleMapper.updateById(model); + + iPermService.batchDeleteByRoleId(updateValidate.getId()); + iPermService.batchSaveByMenuIds(updateValidate.getId(), updateValidate.getMenuIds()); + } + + /** + * 删除角色 + * + * @author fzr + * @param id 主键参数 + */ + @Override + @Transactional + public void del(Integer id) { + Assert.notNull( + RoleMapper.selectOne(new QueryWrapper() + .select("id", "name") + .eq("id", id) + .last("limit 1")), + "角色已不存在!"); + + Assert.isNull(PoliceUserMapper.selectOne(new QueryWrapper() + .select("id", "role", "nickname") + .eq("role", id) + .eq("is_delete", 0)), + "角色已被管理员使用,请先移除"); + + RoleMapper.deleteById(id); + iPermService.batchDeleteByRoleId(id); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingLoginServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingLoginServiceImpl.java new file mode 100644 index 0000000..603e7d2 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingLoginServiceImpl.java @@ -0,0 +1,52 @@ +package com.biutag.lan.service.impl; + +import com.biutag.lan.service.ISettingLoginService; +import com.biutag.lan.validate.setting.SettingLoginValidate; +import com.biutag.lan.vo.setting.SettingLoginVo; +import com.biutag.util.ListUtils; +import com.biutag.util.ConfigUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 登录设置服务接口类 + */ +@Service +public class SettingLoginServiceImpl implements ISettingLoginService { + + /** + * 登录设置详情 + * + * @author fzr + * @return SettingLoginVo + */ + @Override + public SettingLoginVo detail() { + Map config = ConfigUtils.get("login"); + + SettingLoginVo vo = new SettingLoginVo(); + vo.setLoginWay(ListUtils.stringToListAsInt(config.getOrDefault("loginWay", ""), ",")); + vo.setForceBindMobile(Integer.parseInt(config.getOrDefault("forceBindMobile", "0"))); + vo.setOpenAgreement(Integer.parseInt(config.getOrDefault("openAgreement", "0"))); + vo.setOpenOtherAuth(Integer.parseInt(config.getOrDefault("openOtherAuth", "0"))); + vo.setAutoLoginAuth(ListUtils.stringToListAsInt(config.getOrDefault("autoLoginAuth", ""), ",")); + return vo; + } + + /** + * 登录设置保存 + * + * @author fzr + * @param loginValidate 参数 + */ + @Override + public void save(SettingLoginValidate loginValidate) { + ConfigUtils.set("login", "loginWay", loginValidate.getLoginWay()); + ConfigUtils.set("login", "forceBindMobile", String.valueOf(loginValidate.getForceBindMobile())); + ConfigUtils.set("login", "openAgreement", String.valueOf(loginValidate.getOpenAgreement())); + ConfigUtils.set("login", "openOtherAuth", String.valueOf(loginValidate.getOpenOtherAuth())); + ConfigUtils.set("login", "autoLoginAuth", String.valueOf(loginValidate.getAutoLoginAuth())); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingNoticeServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingNoticeServiceImpl.java new file mode 100644 index 0000000..137c85f --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingNoticeServiceImpl.java @@ -0,0 +1,169 @@ +package com.biutag.lan.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.lan.service.ISettingNoticeService; +import com.biutag.lan.vo.setting.SettingNoticeDetailVo; +import com.biutag.lan.vo.setting.SettingNoticeListedVo; +import com.biutag.entity.notice.NoticeSetting; +import com.biutag.mapper.notice.NoticeSettingMapper; +import com.biutag.util.MapUtils; +import com.biutag.util.StringUtils; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * 通知设置服务实现类 + */ +@Service +public class SettingNoticeServiceImpl implements ISettingNoticeService { + + @Resource + NoticeSettingMapper noticeSettingMapper; + + /** + * 通知设置列表 + * + * @author fzr + * @param recipient 1=用户, 2=平台 + * @return List + */ + @Override + public List list(Integer recipient) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("recipient", recipient); + queryWrapper.eq("is_delete", 0); + queryWrapper.orderByAsc("id"); + + List noticeSettings = noticeSettingMapper.selectList(queryWrapper); + List list = new LinkedList<>(); + for (NoticeSetting n : noticeSettings) { + SettingNoticeListedVo vo = new SettingNoticeListedVo(); + BeanUtils.copyProperties(n, vo); + + Map systemMap = MapUtils.jsonToMap(n.getSystemNotice()); + Map smsMap = MapUtils.jsonToMap(n.getSmsNotice()); + Map oaMap = MapUtils.jsonToMap(n.getOaNotice()); + Map mnpMap = MapUtils.jsonToMap(n.getMnpNotice()); + + vo.setType(n.getType()==1?"业务通知":"验证码"); + vo.setSystemStatus(Integer.parseInt(systemMap.getOrDefault("status", "0"))); + vo.setSmsStatus(Integer.parseInt(smsMap.getOrDefault("status", "0"))); + vo.setOaStatus(Integer.parseInt(oaMap.getOrDefault("status", "0"))); + vo.setMnpStatus(Integer.parseInt(mnpMap.getOrDefault("status", "0"))); + vo.setCreateTime(TimeUtils.timestampToDate(n.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(n.getUpdateTime())); + list.add(vo); + } + + return list; + } + + /** + * 通知设置详情 + * + * @author fzr + * @param id 主键 + * @return NoticeSettingDetailVo + * + */ + @Override + public SettingNoticeDetailVo detail(Integer id) { + NoticeSetting noticeSetting = noticeSettingMapper.selectOne(new QueryWrapper() + .select(NoticeSetting.class, info -> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time") && + !info.getColumn().equals("create_time") && + !info.getColumn().equals("update_time") + ) + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Map systemMap = MapUtils.jsonToMapAsObj(noticeSetting.getSystemNotice()); + Map oaMap = MapUtils.jsonToMapAsObj(noticeSetting.getOaNotice()); + Map mnpMap = MapUtils.jsonToMapAsObj(noticeSetting.getMnpNotice()); + Map smsMap = MapUtils.jsonToMapAsObj(noticeSetting.getSmsNotice()); + + smsMap.put("tips", JSON.parseArray(smsMap.get("tips").toString())); + + SettingNoticeDetailVo vo = new SettingNoticeDetailVo(); + BeanUtils.copyProperties(noticeSetting, vo); + vo.setType(noticeSetting.getType().equals(1)?"业务通知":"验证码"); + vo.setSystemNotice(systemMap); + vo.setOaNotice(oaMap); + vo.setMnpNotice(mnpMap); + vo.setSmsNotice(smsMap); + return vo; + } + + /** + * 通知设置保存 + * + * @author fzr + * @param params 参数 + */ + @Override + public void save(Map params) { + Integer id = Integer.parseInt(params.get("id").toString()); + NoticeSetting noticeSetting = noticeSettingMapper.selectOne(new QueryWrapper() + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Map systemParam = MapUtils.objectToMap(params.get("systemNotice")); + Map systemMap = MapUtils.jsonToMap(noticeSetting.getSystemNotice()); + if (StringUtils.isNotEmpty(systemMap)) { + systemMap.put("title", systemParam.getOrDefault("title", "")); + systemMap.put("content", systemParam.getOrDefault("content", "")); + systemMap.put("tips", systemParam.getOrDefault("tips", "")); + systemMap.put("status", systemParam.getOrDefault("status", "0")); + } + + Map smsParam = MapUtils.objectToMap(params.get("smsNotice")); + Map smsMap = MapUtils.jsonToMap(noticeSetting.getSmsNotice()); + if (StringUtils.isNotEmpty(smsMap)) { + smsMap.put("templateId", smsParam.getOrDefault("templateId", "")); + smsMap.put("content", smsParam.getOrDefault("content", "")); + smsMap.put("tips", smsParam.getOrDefault("tips", "")); + smsMap.put("status", smsParam.getOrDefault("status", "0")); + } + + Map oaParam = MapUtils.objectToMap(params.get("oaNotice")); + Map oaMap = MapUtils.jsonToMap(noticeSetting.getOaNotice()); + if (StringUtils.isNotEmpty(oaMap)) { + oaMap.put("name", oaParam.getOrDefault("name", "")); + oaMap.put("first", oaParam.getOrDefault("first", "")); + oaMap.put("remark", oaParam.getOrDefault("remark", "")); + oaMap.put("templateId", oaParam.getOrDefault("templateId", "")); + oaMap.put("templateSn", oaParam.getOrDefault("templateSn", "")); + oaMap.put("tpl", oaParam.getOrDefault("tpl", "")); + oaMap.put("tips", oaParam.getOrDefault("tips", "")); + oaMap.put("status", oaParam.getOrDefault("status", "0")); + } + + Map mnpParam = MapUtils.objectToMap(params.get("mnpNotice")); + Map mnpMap = MapUtils.jsonToMap(noticeSetting.getMnpNotice()); + if (StringUtils.isNotEmpty(mnpParam)) { + mnpMap.put("templateId", mnpParam.get("templateId")); + mnpMap.put("templateSn", mnpParam.get("templateSn")); + mnpMap.put("tpl", mnpParam.get("tpl")); + mnpMap.put("tips", mnpParam.get("tips")); + mnpMap.put("status", mnpParam.getOrDefault("status", "0")); + } + + noticeSetting.setSystemNotice(JSON.toJSONString(systemMap)); + noticeSetting.setSmsNotice(JSON.toJSONString(smsMap)); + noticeSetting.setOaNotice(JSON.toJSONString(oaMap)); + noticeSetting.setMnpNotice(JSON.toJSONString(mnpMap)); + noticeSetting.setUpdateTime(System.currentTimeMillis() / 1000); + noticeSettingMapper.updateById(noticeSetting); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingUserServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingUserServiceImpl.java new file mode 100644 index 0000000..1d7ff82 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SettingUserServiceImpl.java @@ -0,0 +1,42 @@ +package com.biutag.lan.service.impl; + +import com.biutag.lan.service.ISettingUserService; +import com.biutag.lan.validate.setting.SettingUserValidate; +import com.biutag.lan.vo.setting.SettingUserVo; +import com.biutag.util.ConfigUtils; +import com.biutag.util.UrlUtils; +import org.springframework.stereotype.Service; + +/** + * 用户设置服务实现类 + */ +@Service +public class SettingUserServiceImpl implements ISettingUserService { + + /** + * 用户设置详情 + * + * @author fzr + * @return SettingUserVo + */ + @Override + public SettingUserVo detail() { + String defaultAvatar = ConfigUtils.get("user", "defaultAvatar", ""); + + SettingUserVo vo = new SettingUserVo(); + vo.setDefaultAvatar(UrlUtils.toAbsoluteUrl(defaultAvatar)); + return vo; + } + + /** + * 用户设置保存 + * + * @author fzr + * @param userValidate 参数 + */ + @Override + public void save(SettingUserValidate userValidate) { + ConfigUtils.set("user", "defaultAvatar", UrlUtils.toRelativeUrl(userValidate.getDefaultAvatar())); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemCacheServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemCacheServiceImpl.java new file mode 100644 index 0000000..f87e504 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemCacheServiceImpl.java @@ -0,0 +1,22 @@ +package com.biutag.lan.service.impl; + +import com.biutag.lan.service.ISystemCacheService; +import com.biutag.cache.ConfigCache; +import org.springframework.stereotype.Service; + +/** + * 系统缓存实现类 + */ +@Service +public class SystemCacheServiceImpl implements ISystemCacheService { + + /** + * 清除系统缓存 + */ + @Override + public void clear() { + ConfigCache.clear(); + } + + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLoginServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLoginServiceImpl.java new file mode 100644 index 0000000..26dee88 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLoginServiceImpl.java @@ -0,0 +1,193 @@ +package com.biutag.lan.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.lan.cache.CaptchaCache; +import com.biutag.lan.service.ISystemLoginService; +import com.biutag.lan.validate.system.PoliceUserLoginsValidate; +import com.biutag.lan.vo.system.SystemCaptchaVo; +import com.biutag.lan.vo.system.SystemLoginVo; +import com.biutag.entity.system.PoliceUser; +import com.biutag.entity.system.SystemLogLogin; +import com.biutag.enums.ErrorEnum; +import com.biutag.exception.LoginException; +import com.biutag.exception.OperateException; +import com.biutag.mapper.system.PoliceUserMapper; +import com.biutag.mapper.system.SystemLogLoginMapper; +import com.biutag.util.*; +import com.google.code.kaptcha.Producer; +import jakarta.servlet.http.HttpServletRequest; +import nl.bitwalker.useragentutils.UserAgent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; +import org.springframework.util.FastByteArrayOutputStream; + +import jakarta.annotation.Resource; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.*; + +/** + * 系统登录服务实现类 + */ +@Service +public class SystemLoginServiceImpl implements ISystemLoginService { + + @Resource + Producer captchaProducer; + + @Resource + SystemLogLoginMapper systemLogLoginMapper; + + @Resource + PoliceUserMapper PoliceUserMapper; + + private static final Logger log = LoggerFactory.getLogger(SystemLoginServiceImpl.class); + + /** + * 验证码 + * + * @author fzr + * @return SystemCaptchaVo + */ + @Override + public SystemCaptchaVo captcha() { + // 验证码信息 + String capStr, code; + BufferedImage image; + String uuid = ToolUtils.makeUUID(); + + // 生成验证码 + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try { + ImageIO.write(image, "jpg", os); + } catch (IOException e) { + log.error("verifyCode Error:" + e.getMessage()); + throw new OperateException(e.getMessage()); + } + + // 缓存验证码 + // CaptchaCache.set(code, uuid); + + // 返回验证码 + String base64 = "data:image/jpeg;base64,"+ Base64Util.encode(os.toByteArray()); + SystemCaptchaVo vo = new SystemCaptchaVo(); + vo.setUuid(uuid); + vo.setImg(base64); + return vo; + } + + /** + * 登录 + * + * @author fzr + * @param loginsValidate 登录参数 + * @return SystemLoginVo + */ + @Override + public SystemLoginVo login(PoliceUserLoginsValidate loginsValidate) { + String empNo = loginsValidate.getEmpNo(); + String password = loginsValidate.getPassword(); + + String captchaStatus = YmlUtils.get("like.captcha.status"); + if (StringUtils.isNotNull(captchaStatus) && captchaStatus.equals("true")) { + Assert.notNull(loginsValidate.getCode(), "code参数缺失"); + Assert.notNull(loginsValidate.getUuid(), "uuid参数缺失"); + + String code =CaptchaCache.get(loginsValidate.getUuid()); + if (!loginsValidate.getCode().equals(code)) { + throw new LoginException(ErrorEnum.CAPTCHA_ERROR.getCode(), ErrorEnum.CAPTCHA_ERROR.getMsg()); + } + } + + PoliceUser sysAdmin = PoliceUserMapper.selectOne(new QueryWrapper() + .eq("emp_no", empNo) + .last("limit 1")); + + if (StringUtils.isNull(sysAdmin) || sysAdmin.getIsDelete().equals(1)) { + this.recordLoginLog(0, loginsValidate.getEmpNo(), ErrorEnum.LOGIN_ACCOUNT_ERROR.getMsg()); + throw new LoginException(ErrorEnum.LOGIN_ACCOUNT_ERROR.getCode(), ErrorEnum.LOGIN_ACCOUNT_ERROR.getMsg()); + } + + if (sysAdmin.getIsDisable().equals(1)) { + this.recordLoginLog(sysAdmin.getId(), loginsValidate.getEmpNo(), ErrorEnum.LOGIN_DISABLE_ERROR.getMsg()); + throw new LoginException(ErrorEnum.LOGIN_DISABLE_ERROR.getCode(), ErrorEnum.LOGIN_DISABLE_ERROR.getMsg()); + } + + String newPWd = password + sysAdmin.getSalt(); + String md5Pwd = ToolUtils.makeMd5(newPWd); + if (!md5Pwd.equals(sysAdmin.getPassword())) { + this.recordLoginLog(sysAdmin.getId(), loginsValidate.getEmpNo(), ErrorEnum.LOGIN_ACCOUNT_ERROR.getMsg()); + throw new LoginException(ErrorEnum.LOGIN_ACCOUNT_ERROR.getCode(), ErrorEnum.LOGIN_ACCOUNT_ERROR.getMsg()); + } + + try { + // 禁止多处登录 + if (sysAdmin.getIsMultipoint().equals(0)) { + StpUtil.logout(sysAdmin.getId()); + } + + // 实现账号登录 + StpUtil.login(sysAdmin.getId()); + + // 更新登录信息 + sysAdmin.setLastLoginIp(IpUtils.getIpAddress()); + sysAdmin.setLastLoginTime(System.currentTimeMillis() / 1000); + PoliceUserMapper.updateById(sysAdmin); + + // 记录登录日志 + this.recordLoginLog(sysAdmin.getId(), loginsValidate.getEmpNo(), ""); + + // 响应登录信息 + SystemLoginVo vo = new SystemLoginVo(); + vo.setId(sysAdmin.getId()); + vo.setToken(StpUtil.getTokenValue()); + return vo; + } catch (Exception e) { + Integer adminId = StringUtils.isNotNull(sysAdmin.getId()) ? sysAdmin.getId() : 0; + String error = StringUtils.isEmpty(e.getMessage()) ? "未知错误" : e.getMessage(); + this.recordLoginLog(adminId, loginsValidate.getEmpNo(), error); + throw new OperateException(e.getMessage()); + } + } + + /** + * 退出 + * + * @author fzr + * @param token 令牌 + */ + @Override + public void logout(String token) { + //RedisUtil.del(AdminConfig.backstageTokenKey + token); + } + + /** + * 记录登录日志 + */ + private void recordLoginLog(Integer adminId, String username, String error) { + try { + HttpServletRequest request = Objects.requireNonNull(RequestUtils.handler()); + final UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent")); + + SystemLogLogin model = new SystemLogLogin(); + + model.setAdminId(adminId); + model.setUsername(username); + model.setIp(IpUtils.getIpAddress()); + model.setOs(userAgent.getOperatingSystem().getName()); + model.setBrowser(userAgent.getBrowser().getName()); + model.setStatus(StringUtils.isEmpty(error) ? 1 : 0); + model.setCreateTime(System.currentTimeMillis() / 1000); + systemLogLoginMapper.insert(model); + } catch (Exception e) { + log.error("记录登录日志异常 {}" + e.getMessage()); + } + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLogsServerImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLogsServerImpl.java new file mode 100644 index 0000000..4d55d42 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/SystemLogsServerImpl.java @@ -0,0 +1,120 @@ +package com.biutag.lan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.query.MPJQueryWrapper; +import com.biutag.lan.service.ISystemLogsServer; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.system.SystemSearchLoginsValidate; +import com.biutag.lan.validate.system.SystemSearchOperateValidate; +import com.biutag.lan.vo.system.SystemLogLoginVo; +import com.biutag.lan.vo.system.SystemLogOperateVo; +import com.biutag.config.GlobalConfig; +import com.biutag.core.PageResult; +import com.biutag.entity.system.SystemLogLogin; +import com.biutag.entity.system.SystemLogOperate; +import com.biutag.mapper.system.SystemLogLoginMapper; +import com.biutag.mapper.system.SystemLogOperateMapper; +import com.biutag.util.StringUtils; +import com.biutag.util.TimeUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import jakarta.annotation.Resource; +import java.util.LinkedList; +import java.util.List; + +/** + * 系统日志服务实现类 + */ +@Service +public class SystemLogsServerImpl implements ISystemLogsServer { + + @Resource + SystemLogOperateMapper logOperateMapper; + + @Resource + SystemLogLoginMapper logLoginMapper; + + /** + * 系统操作日志 + * + * @author fzr + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult operate(PageValidate pageValidate, SystemSearchOperateValidate searchValidate) { + Integer pageNo = pageValidate.getPageNo(); + Integer pageSize = pageValidate.getPageSize(); + + MPJQueryWrapper mpjQueryWrapper = new MPJQueryWrapper() + .selectAll(SystemLogOperate.class) + .select("sa.username,sa.nickname") + .leftJoin("police_user sa ON sa.id=t.admin_id".replace("?_", GlobalConfig.tablePrefix)) + .orderByDesc("id"); + + logOperateMapper.setSearch(mpjQueryWrapper, searchValidate, new String[]{ + "like:title:str", + "like:username@sa.username:str", + "like:ip:str", + "=:type:str", + "=:status:int", + "=:url:str", + "datetime:startTime-endTime@t.create_time:str" + }); + + IPage iPage = logOperateMapper.selectJoinPage( + new Page<>(pageNo, pageSize), + SystemLogOperateVo.class, + mpjQueryWrapper); + + for (SystemLogOperateVo vo : iPage.getRecords()) { + vo.setTaskTime(vo.getTaskTime()); + vo.setStartTime(TimeUtils.timestampToDate(vo.getStartTime())); + vo.setEndTime(TimeUtils.timestampToDate(vo.getEndTime())); + vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime())); + vo.setError(StringUtils.isNull(vo.getError()) ? "" : vo.getError()); + } + + return PageResult.iPageHandle(iPage); + } + + /** + * 系统登录日志 + * + * @author fzr + * @param pageValidate 分页参数 + * @param searchValidate 搜索参数 + * @return PageResult + */ + @Override + public PageResult login(PageValidate pageValidate, SystemSearchLoginsValidate searchValidate) { + Integer pageNo = pageValidate.getPageNo(); + Integer pageSize = pageValidate.getPageSize(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("id"); + logLoginMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "like:username:str", + "=:status:int", + "datetime:startTime-endTime@create_time:str" + }); + + IPage iPage = logLoginMapper.selectPage(new Page<>(pageNo, pageSize), queryWrapper); + + List list = new LinkedList<>(); + for (SystemLogLogin item : iPage.getRecords()) { + SystemLogLoginVo vo = new SystemLogLoginVo(); + BeanUtils.copyProperties(item, vo); + + vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/UserServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..3b52543 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/UserServiceImpl.java @@ -0,0 +1,211 @@ +package com.biutag.lan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.lan.service.IUserService; +import com.biutag.lan.validate.user.UserSearchValidate; +import com.biutag.lan.validate.user.UserUpdateValidate; +import com.biutag.lan.validate.commons.PageValidate; +import com.biutag.lan.validate.user.UserWalletValidate; +import com.biutag.lan.vo.user.UserVo; +import com.biutag.core.PageResult; +import com.biutag.entity.user.User; +import com.biutag.enums.ClientEnum; +import com.biutag.enums.LogMoneyEnum; +import com.biutag.exception.OperateException; +import com.biutag.mapper.user.UserMapper; +import com.biutag.util.StringUtils; +import com.biutag.util.TimeUtils; +import com.biutag.util.UrlUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import jakarta.annotation.Resource; +import java.math.BigDecimal; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Pattern; + +/** + * 用户服务实现类 + */ +@Service +public class UserServiceImpl implements IUserService { + + @Resource + UserMapper userMapper; + + + + /** + * 用户列表 + * + * @author fzr + * @param pageValidate (分页参数) + * @param searchValidate (搜索参数) + * @return PageResult + */ + @Override + public PageResult list(PageValidate pageValidate, UserSearchValidate searchValidate) { + Integer pageNo = pageValidate.getPageNo(); + Integer pageSize = pageValidate.getPageSize(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_delete", 0); + queryWrapper.orderByDesc("id"); + queryWrapper.select(User.class, info-> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time") && + !info.getColumn().equals("update_time") && + !info.getColumn().equals("password") && + !info.getColumn().equals("salt") + ); + + if (StringUtils.isNotNull(searchValidate.getKeyword()) && StringUtils.isNotEmpty(searchValidate.getKeyword())) { + String keyword = searchValidate.getKeyword(); + queryWrapper.nested(wq->wq + .like("sn", keyword).or() + .like("nickname", keyword).or() + .like("mobile", keyword)); + } + + userMapper.setSearch(queryWrapper, searchValidate, new String[]{ + "=:channel:int", + "datetime:startTime-endTime@create_time:str" + }); + + IPage iPage = userMapper.selectPage( new Page<>(pageNo, pageSize), queryWrapper); + + List list = new LinkedList<>(); + for (User user : iPage.getRecords()) { + UserVo vo = new UserVo(); + BeanUtils.copyProperties(user, vo); + + vo.setSex(user.getSex()); + vo.setChannel(ClientEnum.getMsgByCode(user.getChannel())); + vo.setAvatar(UrlUtils.toAbsoluteUrl(user.getAvatar())); + vo.setLastLoginTime(TimeUtils.timestampToDate(user.getLastLoginTime())); + vo.setCreateTime(TimeUtils.timestampToDate(user.getCreateTime())); + list.add(vo); + } + + return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list); + } + + /** + * 用户详情 + * + * @author fzr + * @param id 主键 + * @return UserVo + */ + @Override + public UserVo detail(Integer id) { + Assert.notNull( + userMapper.selectOne(new QueryWrapper() + .select("id") + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1") + ), "数据不存在!"); + + + User user = userMapper.selectOne(new QueryWrapper() + .select(User.class, info-> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time") && + !info.getColumn().equals("update_time") && + !info.getColumn().equals("password") && + !info.getColumn().equals("salt") + ) + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + UserVo vo = new UserVo(); + BeanUtils.copyProperties(user, vo); + + vo.setSex(user.getSex()); + vo.setAvatar(UrlUtils.toAbsoluteUrl(user.getAvatar())); + vo.setChannel(ClientEnum.getMsgByCode(user.getChannel())); + vo.setCreateTime(TimeUtils.timestampToDate(user.getCreateTime())); + if (user.getLastLoginTime() <= 0) { + vo.setLastLoginTime("无"); + } else { + vo.setLastLoginTime(TimeUtils.timestampToDate(user.getLastLoginTime())); + } + return vo; + } + + /** + * 用户编辑 + * + * @author fzr + * @param updateValidate 参数 + */ + @Override + public void edit(UserUpdateValidate updateValidate) { + Integer id = updateValidate.getId(); + String field = updateValidate.getField(); + String value = updateValidate.getValue(); + + User user = userMapper.selectOne(new QueryWrapper() + .eq("id", id) + .eq("is_delete", 0) + .last("limit 1")); + + Assert.notNull(user, "用户不存在!"); + + switch (field) { + case "username": + if (!user.getUsername().equals(value)) { + User u = userMapper.selectOne(new QueryWrapper() + .eq("username", value) + .eq("is_delete", 0) + .last("limit 1")); + + if (StringUtils.isNotNull(u) && !u.getId().equals(id)) { + throw new OperateException("当前账号已存在!"); + } + } + Assert.isTrue(value.length() <= 32,"账号不能超过32个字符"); + user.setUsername(value); + break; + case "realName": + Assert.isTrue(value.length() <= 32,"真实姓名不能超过32个字符"); + user.setRealName(value); + break; + case "sex": + user.setSex(Integer.parseInt(value)); + break; + case "mobile": + if (!Pattern.matches("^[1][3-9][0-9]{9}$", value)) { + throw new OperateException("手机号格式不正确!"); + } + user.setMobile(value); + break; + default: + throw new OperateException("不被支持的字段类型!"); + } + + user.setUpdateTime(System.currentTimeMillis() / 1000); + userMapper.updateById(user); + } + + @Override + public void adjustWallet(UserWalletValidate userWalletValidate) { + + } + + /** + * 余额调整 + * + * @author cjh + * @param userWalletValidate 余额 + */ + + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdValidate.java new file mode 100644 index 0000000..fb3e547 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdValidate.java @@ -0,0 +1,20 @@ +package com.biutag.lan.validate.commons; + +import com.biutag.validator.annotation.IDMust; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("ID参数") +public class IdValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "ID", required = true) + private Integer id; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdsValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdsValidate.java new file mode 100644 index 0000000..392a928 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/IdsValidate.java @@ -0,0 +1,21 @@ +package com.biutag.lan.validate.commons; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("IDS参数") +public class IdsValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "ids参数缺失") + @ApiModelProperty(value = "ID数组", required = true) + private List ids; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/PageValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/PageValidate.java new file mode 100644 index 0000000..6e6643e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/commons/PageValidate.java @@ -0,0 +1,25 @@ +package com.biutag.lan.validate.commons; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import jakarta.validation.constraints.DecimalMax; +import jakarta.validation.constraints.DecimalMin; +import java.io.Serializable; + +@Data +@ApiModel("分页参数") +public class PageValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + // 当前分页 + @DecimalMin(value = "1", message = "pageNo参数必须大于0的数字") + public Integer pageNo = 1; + + // 每页条数 + @DecimalMin(value = "1", message = "pageSize参数必须是大于0的数字") + @DecimalMax(value = "60", message = "pageSize参数必须是小于60的数字") + private Integer pageSize = 20; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabCreateValidate.java new file mode 100644 index 0000000..8a74587 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabCreateValidate.java @@ -0,0 +1,53 @@ +package com.biutag.lan.validate.crontab; + +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("计划任务创建参数") +public class CrontabCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "name参数缺失") + @ApiModelProperty(value = "任务名称", required = true) + private String name; + + @NotNull(message = "types参数缺失") + @ApiModelProperty(value = "任务分组", required = true) + private String types; + + @NotNull(message = "command参数缺失") + @ApiModelProperty(value = "执行指令", required = true) + private String command; + + @NotNull(message = "rules参数缺失") + @ApiModelProperty(value = "执行规则", required = true) + private String rules; + + @Length(max = 200, message = "remark参数不能超出200个字符") + @ApiModelProperty(value = "备注") + private String remark; + + @NotNull(message = "status参数缺失") + @IntegerContains(values = {1, 2, 3}, message = "status参数取值异常") + @ApiModelProperty(value = "状态") + private Integer status; + + @NotNull(message = "strategy参数缺失") + @IntegerContains(values = {1, 2, 3}, message = "strategy参数取值异常") + @ApiModelProperty(value = "strategy", required = true) + private Integer strategy; + + @NotNull(message = "concurrent参数缺失") + @IntegerContains(values = {0, 1}, message = "concurrent参数取值异常") + @ApiModelProperty(value = "concurrent", required = true) + private Integer concurrent; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabUpdateValidate.java new file mode 100644 index 0000000..c628a17 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/crontab/CrontabUpdateValidate.java @@ -0,0 +1,58 @@ +package com.biutag.lan.validate.crontab; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("计划任务更新参数") +public class CrontabUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "id", required = true) + private Integer id; + + @NotNull(message = "types参数缺失") + @ApiModelProperty(value = "任务分组", required = true) + private String types; + + @NotNull(message = "name参数缺失") + @ApiModelProperty(value = "任务名称", required = true) + private String name; + + @NotNull(message = "command参数缺失") + @ApiModelProperty(value = "执行指令", required = true) + private String command; + + @NotNull(message = "rules参数缺失") + @ApiModelProperty(value = "执行规则", required = true) + private String rules; + + @Length(max = 200, message = "remark参数不能超出200个字符") + @ApiModelProperty(value = "备注") + private String remark; + + @NotNull(message = "status参数缺失") + @IntegerContains(values = {1, 2, 3}, message = "status参数取值异常") + @ApiModelProperty(value = "状态", required = true) + private Integer status; + + @NotNull(message = "strategy参数缺失") + @IntegerContains(values = {1, 2, 3}, message = "strategy参数取值异常") + @ApiModelProperty(value = "strategy", required = true) + private Integer strategy; + + @NotNull(message = "concurrent参数缺失") + @IntegerContains(values = {0, 1}, message = "concurrent参数取值异常") + @ApiModelProperty(value = "concurrent", required = true) + private Integer concurrent; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataCreateValidate.java new file mode 100644 index 0000000..d878528 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataCreateValidate.java @@ -0,0 +1,46 @@ +package com.biutag.lan.validate.setting; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("字典数据创建参数") +public class DictDataCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "typeId参数必传且需大于0") + @ApiModelProperty(value = "类型ID", required = true) + private Integer typeId; + + @NotNull(message = "name参数缺失") + @ApiModelProperty(value = "键", required = true) + private String name; + + @NotNull(message = "value参数缺失") + @Length(max = 100, message = "键名不能超出100个字符") + @ApiModelProperty(value = "值", required = true) + private String value; + + @Length(max = 200, message = "数值不能超出200个字符") + @ApiModelProperty(value = "备注") + private String remark; + + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序") + private Integer sort; + + @NotNull(message = "status参数缺失") + @IntegerContains(values = {0, 1}, message = "status参数不在合法值内") + @ApiModelProperty(value = "状态", required = true) + private Integer status; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataUpdateValidate.java new file mode 100644 index 0000000..6e548be --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictDataUpdateValidate.java @@ -0,0 +1,50 @@ +package com.biutag.lan.validate.setting; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("字典数据更新参数") +public class DictDataUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "ID", required = true) + private Integer id; + + @IDMust(message = "typeId参数必传且需大于0") + @ApiModelProperty(value = "类型ID", required = true) + private Integer typeId; + + @NotNull(message = "name参数缺失") + @ApiModelProperty(value = "键", required = true) + private String name; + + @NotNull(message = "value参数缺失") + @Length(max = 100, message = "键名不能超出100个字符") + @ApiModelProperty(value = "值", required = true) + private String value; + + @Length(max = 200, message = "数值不能超出200个字符") + @ApiModelProperty(value = "备注") + private String remark; + + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序") + private Integer sort; + + @NotNull(message = "status参数缺失") + @IntegerContains(values = {0, 1}, message = "status参数不在合法值内") + @ApiModelProperty(value = "状态", required = true) + private Integer status; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeCreateValidate.java new file mode 100644 index 0000000..3942582 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeCreateValidate.java @@ -0,0 +1,37 @@ +package com.biutag.lan.validate.setting; + +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("字典类型创建参数") +public class DictTypeCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "dictName参数缺失") + @Length(max = 200, message = "名称不能超出200个字符") + @ApiModelProperty(value = "名称", required = true) + private String dictName; + + @NotNull(message = "dictType参数缺失") + @Length(max = 200, message = "类型不能超出200个字符") + @ApiModelProperty(value = "类型", required = true) + private String dictType; + + @Length(max = 200, message = "备注不能超出200个字符") + @ApiModelProperty(value = "备注") + private String dictRemark; + + @NotNull(message = "dictStatus参数缺失") + @IntegerContains(values = {0, 1}, message = "dictStatus参数不在合法值内") + @ApiModelProperty(value = "状态", required = true) + private Integer dictStatus; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeUpdateValidate.java new file mode 100644 index 0000000..9cb7c68 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/DictTypeUpdateValidate.java @@ -0,0 +1,42 @@ +package com.biutag.lan.validate.setting; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("字典类型更新参数") +public class DictTypeUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "ID", required = true) + private Integer id; + + @NotNull(message = "dictName参数缺失") + @Length(max = 200, message = "名称不能超出200个字符") + @ApiModelProperty(value = "名称", required = true) + private String dictName; + + @NotNull(message = "dictType参数缺失") + @Length(max = 200, message = "类型不能超出200个字符") + @ApiModelProperty(value = "类型", required = true) + private String dictType; + + @Length(max = 200, message = "备注不能超出200个字符") + @ApiModelProperty(value = "备注") + private String dictRemark; + + @NotNull(message = "dictStatus参数缺失") + @IntegerContains(values = {0, 1}, message = "dictStatus参数不在合法值内") + @ApiModelProperty(value = "状态", required = true) + private Integer dictStatus; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingLoginValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingLoginValidate.java new file mode 100644 index 0000000..055ac61 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingLoginValidate.java @@ -0,0 +1,30 @@ +package com.biutag.lan.validate.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("登录信息设置参数") +public class SettingLoginValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "登录方式") + private String loginWay = ""; + + @ApiModelProperty(value = "强制绑定手机") + private Integer forceBindMobile = 0; + + @ApiModelProperty(value = "政策协议") + private Integer openAgreement = 0; + + @ApiModelProperty(value = "第三方登录") + private Integer openOtherAuth = 0; + + @ApiModelProperty(value = "微信开放平台") + private String autoLoginAuth = ""; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingUserValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingUserValidate.java new file mode 100644 index 0000000..f317a27 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/setting/SettingUserValidate.java @@ -0,0 +1,18 @@ +package com.biutag.lan.validate.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("用户设置参数") +public class SettingUserValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "默认头像") + private String defaultAvatar = ""; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptCreateValidate.java new file mode 100644 index 0000000..8941f74 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptCreateValidate.java @@ -0,0 +1,50 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMax; +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import java.io.Serializable; + +@Data +@ApiModel("系统部门创建参数") +public class DeptCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "pid参数缺失") + @DecimalMin(value = "0", message = "上级值不能少于0") + @ApiModelProperty(value = "上级ID", required = true) + private Integer pid; + + @NotNull(message = "name参数缺失") + @Length(min = 1, max = 100, message = "部门名称必须在1~100个字符内") + @ApiModelProperty(value = "部门名称", required = true) + private String name; + + @Length(min = 1, max = 30, message = "负责人名称必须在1~30个字符内") + private String duty = ""; + + @Length(min = 11, max = 11, message = "手机号只能为11位") + @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误") + @ApiModelProperty(value = "手机号码") + private String mobile; + + @NotNull(message = "请选择状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "状态", required = true) + private Integer isStop; + + @NotNull(message = "排序号不能为空") + @DecimalMin(value = "0", message = "排序号值不能少于0") + @DecimalMax(value = "9999", message = "排序号值不能大于9999") + @ApiModelProperty(value = "排序") + private Integer sort; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptSearchValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptSearchValidate.java new file mode 100644 index 0000000..a73a9b2 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptSearchValidate.java @@ -0,0 +1,21 @@ +package com.biutag.lan.validate.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统部门搜索参数") +public class DeptSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "是否停用") + private Integer isStop; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptUpdateValidate.java new file mode 100644 index 0000000..6609ad4 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/DeptUpdateValidate.java @@ -0,0 +1,54 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMax; +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import java.io.Serializable; + +@Data +@ApiModel("系统部门更新参数") +public class DeptUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "id", required = true) + private Integer id; + + @NotNull(message = "pid参数缺失") + @DecimalMin(value = "0", message = "上级值不能少于0") + @ApiModelProperty(value = "上级ID", required = true) + private Integer pid; + + @NotNull(message = "name参数缺失") + @Length(min = 1, max = 100, message = "部门名称必须在1~100个字符内") + @ApiModelProperty(value = "部门名称") + private String name; + + @Length(min = 1, max = 30, message = "负责人名称必须在1~30个字符内") + private String duty = ""; + + @Length(min = 11, max = 11, message = "手机号只能为11位") + @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误") + @ApiModelProperty(value = "手机号码") + private String mobile; + + @NotNull(message = "请选择状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "状态") + private Integer isStop; + + @DecimalMin(value = "0", message = "排序号值不能少于0") + @DecimalMax(value = "9999", message = "排序号值不能大于9999") + @ApiModelProperty(value = "排序") + private Integer sort; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuCreateValidate.java new file mode 100644 index 0000000..46b912e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuCreateValidate.java @@ -0,0 +1,79 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IntegerContains; +import com.biutag.validator.annotation.StringContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("系统菜单创建参数") +public class MenuCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "上级菜单不能为空") + @DecimalMin(value = "0", message = "上级菜单值不能少于0") + @ApiModelProperty(value = "上级ID", required = true) + private Integer pid; + + @NotNull(message = "menuType参数缺失") + @StringContains(values = {"M", "C", "A"}, message = "菜单类型不是合法值(M,C,A)") + @ApiModelProperty(value = "菜单类型", required = true) + private String menuType; + + @NotNull(message = "缺少参数menuName") + @Length(min = 1, max = 30, message = "菜单名称必须在1~30个字符内") + @ApiModelProperty(value = "菜单名称", required = true) + private String menuName; + + @Length(max = 100, message = "图标名称不能超过100个字符") + @ApiModelProperty(value = "菜单图标") + private String menuIcon; + + @NotNull(message = "排序号不能为空") + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "菜单排序") + private Integer menuSort; + + @Length(max = 100, message = "权限字符不能超过100个字符") + @ApiModelProperty(value = "权限字符") + private String perms; + + @Length(max = 200, message = "路由地址不能超过200个字符") + @ApiModelProperty(value = "路由地址") + private String paths; + + @Length(max = 200, message = "前端组件不能超过200个字符") + @ApiModelProperty(value = "前端组件") + private String component; + + @Length(max = 200, message = "选中菜单路径不能超过200个字符") + @ApiModelProperty(value = "选中菜单") + private String selected; + + @Length(max = 200, message = "路由参数不能超过200个字符") + @ApiModelProperty(value = "路由参数") + private String params; + + @NotNull(message = "请选择缓存状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "缓存状态", required = true) + private Integer isCache; + + @NotNull(message = "请选择显示状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "显示状态", required = true) + private Integer isShow; + + @NotNull(message = "请选择菜单状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "菜单状态", required = true) + private Integer isDisable; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuUpdateValidate.java new file mode 100644 index 0000000..1b0325d --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/MenuUpdateValidate.java @@ -0,0 +1,84 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import com.biutag.validator.annotation.StringContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("系统菜单更新参数") +public class MenuUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "id", required = true) + private Integer id; + + @NotNull(message = "上级菜单不能为空") + @DecimalMin(value = "0", message = "上级菜单值不能少于0") + @ApiModelProperty(value = "上级ID", required = true) + private Integer pid; + + @NotNull(message = "menuType参数缺失") + @StringContains(values = {"M", "C", "A"}, message = "菜单类型不是合法值(M,C,A)") + @ApiModelProperty(value = "菜单类型", required = true) + private String menuType; + + @NotNull(message = "缺少参数menuName") + @Length(min = 1, max = 30, message = "菜单名称必须在1~30个字符内") + @ApiModelProperty(value = "菜单名称", required = true) + private String menuName; + + @Length(max = 100, message = "图标名称不能超过100个字符") + @ApiModelProperty(value = "菜单图标") + private String menuIcon; + + @NotNull(message = "排序号不能为空") + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "菜单排序") + private Integer menuSort; + + @Length(max = 100, message = "权限字符不能超过100个字符") + @ApiModelProperty(value = "权限字符") + private String perms; + + @Length(max = 200, message = "路由地址不能超过200个字符") + @ApiModelProperty(value = "路由地址") + private String paths; + + @Length(max = 200, message = "前端组件不能超过200个字符") + @ApiModelProperty(value = "前端组件") + private String component; + + @Length(max = 200, message = "选中菜单路径不能超过200个字符") + @ApiModelProperty(value = "菜单路径") + private String selected; + + @Length(max = 200, message = "路由参数不能超过200个字符") + @ApiModelProperty(value = "路由参数") + private String params; + + @NotNull(message = "请选择缓存状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "缓存状态", required = true) + private Integer isCache; + + @NotNull(message = "请选择显示状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "显示状态", required = true) + private Integer isShow; + + @NotNull(message = "请选择菜单状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "菜单状态", required = true) + private Integer isDisable; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserCreateValidate.java new file mode 100644 index 0000000..535b547 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserCreateValidate.java @@ -0,0 +1,66 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + + +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("系统管理员创建参数") +public class PoliceUserCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotEmpty(message = "账号不能为空") + @Length(min = 2, max = 20, message = "账号必须在2~20个字符内") + @ApiModelProperty(value = "登录账号", required = true) + private String username; + + @NotEmpty(message = "昵称不能为空") + @Length(min = 2, max = 30, message = "昵称必须在2~30个字符内") + @ApiModelProperty(value = "用户昵称", required = true) + private String nickname; + + @NotEmpty(message = "密码不能为空") + @Length(min = 6, max = 32, message = "密码必须在6~32个字符内") + @ApiModelProperty(value = "登录密码", required = true) + private String password; + + @NotNull(message = "请选择是否禁用") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "是否禁用", required = true) + private Integer isDisable; + + @NotNull(message = "请选择是否支持多端登录") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "支持多端", required = true) + private Integer isMultipoint; + + @NotNull(message = "排序号不能为空") + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序", required = true) + private Integer sort = 0; + + @Length(max = 200, message = "头像不能超出200个字符") + @ApiModelProperty(value = "头像") + private String avatar = ""; + + @NotNull(message = "请选择角色") + @ApiModelProperty(value = "角色ID", required = true) + private List roleIds; + + @ApiModelProperty(value = "部门ID") + private List deptIds; + + @ApiModelProperty(value = "岗位ID") + private List postIds; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserLoginsValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserLoginsValidate.java new file mode 100644 index 0000000..eeac4a8 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserLoginsValidate.java @@ -0,0 +1,33 @@ +package com.biutag.lan.validate.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.NotEmpty; +import java.io.Serializable; + +@Data +@ApiModel("系统登录参数") +public class PoliceUserLoginsValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotEmpty(message = "账号不能为空") + @Length(min = 2, max = 20, message = "账号或密码错误") + @ApiModelProperty(value = "登录账号", required = true) + private String empNo; + + @NotEmpty(message = "密码不能为空") + @Length(min = 6, max = 18, message = "账号或密码错误") + @ApiModelProperty(value = "登录密码", required = true) + private String password; + + @ApiModelProperty(value = "验证码") + private String code; + + @ApiModelProperty(value = "标识码") + private String uuid; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserSearchValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserSearchValidate.java new file mode 100644 index 0000000..6ab3f39 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserSearchValidate.java @@ -0,0 +1,30 @@ +package com.biutag.lan.validate.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统管理员搜索参数") +public class PoliceUserSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "警号") + private String empNo; + + @ApiModelProperty(value = "姓名") + private String name; + + @ApiModelProperty(value = "手机号") + private String mobile; + + @ApiModelProperty(value = "身份证") + private String idCode; + + @ApiModelProperty(value = "角色ID") + private Integer role; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpInfoValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpInfoValidate.java new file mode 100644 index 0000000..ca5933e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpInfoValidate.java @@ -0,0 +1,31 @@ +package com.biutag.lan.validate.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.hibernate.validator.constraints.Length; +import lombok.Data; + +import jakarta.validation.constraints.NotEmpty; +import java.io.Serializable; + +@Data +@ApiModel("系统管理员自更新参数") +public class PoliceUserUpInfoValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotEmpty(message = "昵称不能为空") + @Length(min = 2, max = 30, message = "昵称必须在2~30个字符内") + @ApiModelProperty(value = "用户昵称") + private String nickname; + + @Length(max = 32, message = "密码必须在6~32个字符内") + private String password=""; + + @Length(max = 32, message = "当前密码错误") + private String currPassword=""; + + @Length(max = 200, message = "头像不能超出200个字符") + private String avatar = ""; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpdateValidate.java new file mode 100644 index 0000000..05059d0 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpdateValidate.java @@ -0,0 +1,68 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("系统管理员更新参数") +public class PoliceUserUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "ID", required = true) + private Integer id; + + @NotEmpty(message = "账号不能为空") + @Length(min = 2, max = 20, message = "账号必须在2~20个字符内") + @ApiModelProperty(value = "登录账号", required = true) + private String username; + + @NotEmpty(message = "昵称不能为空") + @Length(min = 2, max = 30, message = "昵称必须在2~30个字符内") + @ApiModelProperty(value = "用户昵称", required = true) + private String nickname; + + @ApiModelProperty(value = "登录密码") + private String password; + + @NotNull(message = "请选择是否禁用") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "是否禁用", required = true) + private Integer isDisable; + + @NotNull(message = "请选择是否支持多端登录") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "支持多端", required = true) + private Integer isMultipoint; + + @NotNull(message = "排序号不能为空") + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序", required = true) + private Integer sort = 0; + + @Length(max = 200, message = "头像不能超出200个字符") + @ApiModelProperty(value = "头像") + private String avatar = ""; + + @NotNull(message = "请选择角色") + @ApiModelProperty(value = "角色ID") + private List roleIds; + + @ApiModelProperty(value = "部门ID") + private List deptIds; + + @ApiModelProperty(value = "岗位ID") + private List postIds; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostCreateValidate.java new file mode 100644 index 0000000..498fae1 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostCreateValidate.java @@ -0,0 +1,43 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("系统岗位创建参数") +public class PostCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "code参数缺失") + @Length(min = 1, max = 30, message = "岗位编码必须在1~30个字符内") + @ApiModelProperty(value = "编码", required = true) + private String code; + + @NotNull(message = "name参数缺失") + @Length(min = 1, max = 30, message = "岗位名称必须在1~30个字符内") + @ApiModelProperty(value = "岗位名称", required = true) + private String name; + + @NotNull(message = "请选择状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "是否停用", required = true) + private Integer isStop = 0; + + @Length( max = 250, message = "岗位备注不能大于250个字符内") + @ApiModelProperty(value = "备注信息") + private String remarks = ""; + + @NotNull(message = "排序号不能为空") + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序", required = true) + private Integer sort = 0; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostSearchValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostSearchValidate.java new file mode 100644 index 0000000..448fc5b --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostSearchValidate.java @@ -0,0 +1,24 @@ +package com.biutag.lan.validate.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统岗位搜索参数") +public class PostSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "编码") + private String code; + + @ApiModelProperty(value = "岗位名称") + private String name; + + @ApiModelProperty(value = "是否停用") + private Integer isStop; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostUpdateValidate.java new file mode 100644 index 0000000..61e977c --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/PostUpdateValidate.java @@ -0,0 +1,48 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("系统岗位更新参数") +public class PostUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "id", required = true) + private Integer id; + + @NotNull(message = "code参数缺失") + @Length(min = 1, max = 30, message = "岗位编码必须在1~30个字符内") + @ApiModelProperty(value = "岗位编码", required = true) + private String code; + + @NotNull(message = "name参数缺失") + @Length(min = 1, max = 30, message = "岗位名称必须在1~30个字符内") + @ApiModelProperty(value = "岗位名称", required = true) + private String name; + + @NotNull(message = "请选择状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "是否停用", required = true) + private Integer isStop; + + @Length( max = 250, message = "岗位备注不能大于250个字符内") + @ApiModelProperty(value = "岗位备注") + private String remarks; + + @NotNull(message = "排序号不能为空") + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序", required = true) + private Integer sort; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleCreateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleCreateValidate.java new file mode 100644 index 0000000..8f4f07d --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleCreateValidate.java @@ -0,0 +1,40 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("系统角色创建参数") +public class RoleCreateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "缺少参数name") + @Length(min = 1, max = 30, message = "角色名称必须在1~30个字符内") + @ApiModelProperty(value = "角色名称", required = true) + private String name; + + @Length(max = 200, message = "备注信息不能超过200个字符") + @ApiModelProperty(value = "备注", required = true) + private String remark; + + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序", required = true) + private Integer sort = 0; + + @NotNull(message = "请选择状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "是否禁用", required = true) + private Integer isDisable; + + @ApiModelProperty(value = "菜单权限") + private String menuIds = ""; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleUpdateValidate.java new file mode 100644 index 0000000..dae2931 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/RoleUpdateValidate.java @@ -0,0 +1,46 @@ +package com.biutag.lan.validate.system; + +import com.biutag.validator.annotation.IDMust; +import com.biutag.validator.annotation.IntegerContains; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; + +@Data +@ApiModel("系统角色更新参数") +public class RoleUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @IDMust(message = "id参数必传且需大于0") + @ApiModelProperty(value = "id", required = true) + private Integer id; + + @NotNull(message = "缺少参数name") + @Length(min = 1, max = 30, message = "角色名称必须在1~30个字符内") + @ApiModelProperty(value = "角色名称", required = true) + private String name; + + @Length(max = 200, message = "备注信息不能超过200个字符") + @ApiModelProperty(value = "备注", required = true) + private String remark; + + @DecimalMin(value = "0", message = "排序号值不能少于0") + @ApiModelProperty(value = "排序") + private Integer sort = 0; + + @NotNull(message = "请选择状态") + @IntegerContains(values = {0, 1}) + @ApiModelProperty(value = "是否禁用", required = true) + private Integer isDisable; + + @ApiModelProperty(value = "菜单权限") + private String menuIds = ""; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchLoginsValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchLoginsValidate.java new file mode 100644 index 0000000..d363b33 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchLoginsValidate.java @@ -0,0 +1,27 @@ +package com.biutag.lan.validate.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统登录日志搜索参数") +public class SystemSearchLoginsValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "账号") + private String username; + + @ApiModelProperty(value = "状态") + private Integer status; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchOperateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchOperateValidate.java new file mode 100644 index 0000000..ed0d812 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/SystemSearchOperateValidate.java @@ -0,0 +1,39 @@ +package com.biutag.lan.validate.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统操作日志搜索参数") +public class SystemSearchOperateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "标题") + private String title; + + @ApiModelProperty(value = "账号") + private String username; + + @ApiModelProperty(value = "IP") + private String ip; + + @ApiModelProperty(value = "类型") + private String type; + + @ApiModelProperty(value = "状态") + private String status; + + @ApiModelProperty(value = "路由") + private String url; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserSearchValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserSearchValidate.java new file mode 100644 index 0000000..18f8397 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserSearchValidate.java @@ -0,0 +1,27 @@ +package com.biutag.lan.validate.user; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("用户搜索参数") +public class UserSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "渠道") + private Integer channel; + + @ApiModelProperty(value = "关键词") + private String keyword; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserUpdateValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserUpdateValidate.java new file mode 100644 index 0000000..2c1dbcd --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserUpdateValidate.java @@ -0,0 +1,24 @@ +package com.biutag.lan.validate.user; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("用户更新参数") +public class UserUpdateValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + private Integer id; + + @ApiModelProperty(value = "字段") + private String field; + + @ApiModelProperty(value = "值") + private String value; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserWalletValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserWalletValidate.java new file mode 100644 index 0000000..72a25d9 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/user/UserWalletValidate.java @@ -0,0 +1,30 @@ +package com.biutag.lan.validate.user; + +import com.biutag.validator.annotation.IntegerContains; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class UserWalletValidate implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "缺少用户id参数") + @Min(value = 0, message = "用户id必须为数字") + private Integer userId; + + @NotNull(message = "请输入变动类型") + @IntegerContains(values = {0,1}, message = "变动类型错误") + private Integer action; + + @NotNull(message = "请输入变动金额") + private BigDecimal amount; + + private String remark; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabDetailVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabDetailVo.java new file mode 100644 index 0000000..af72691 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabDetailVo.java @@ -0,0 +1,45 @@ +package com.biutag.lan.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("计划任务详情Vo") +public class CrontabDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "任务ID") + private Integer id; + + @ApiModelProperty(value = "任务分组") + private String types; + + @ApiModelProperty(value = "任务名称") + private String name; + + @ApiModelProperty(value = "执行命令") + private String command; + + @ApiModelProperty(value = "执行规则") + private String rules; + + @ApiModelProperty(value = "备注信息") + private String remark; + + @ApiModelProperty(value = "错误信息") + private String error; + + @ApiModelProperty(value = "执行状态: 1=正在运行, 2=任务停止, 3=发生错误") + private Integer status; + + @ApiModelProperty(value = "执行策略: 1=立即执行, 2=执行一次, 3=放弃执行") + private Integer strategy; + + @ApiModelProperty(value = "并发执行: 0=否, 1=是") + private Integer concurrent; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabListedVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabListedVo.java new file mode 100644 index 0000000..03fda5f --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/CrontabListedVo.java @@ -0,0 +1,51 @@ +package com.biutag.lan.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("计划任务列表Vo") +public class CrontabListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "任务ID") + private Integer id; // 执行ID + + @ApiModelProperty(value = "任务分组") + private String groups; + + @ApiModelProperty(value = "任务名称") + private String name; + + @ApiModelProperty(value = "执行命令") + private String command; + + @ApiModelProperty(value = "执行规则") + private String rules; + + @ApiModelProperty(value = "错误信息") + private String error; + + @ApiModelProperty(value = "执行状态: [1=正在运行, 2=任务停止, 3=发生错误]") + private Integer status; + + @ApiModelProperty(value = "执行策略: [1=立即执行, 2=执行一次, 3=放弃执行]") + private Integer strategy; + + @ApiModelProperty(value = "并发执行: [0=否, 1=是]") + private Integer concurrent; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "执行耗时") + private Long taskTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictDataVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictDataVo.java new file mode 100644 index 0000000..c667936 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictDataVo.java @@ -0,0 +1,42 @@ +package com.biutag.lan.vo.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("字典数据Vo") +public class DictDataVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "类型") + private Integer typeId; + + @ApiModelProperty(value = "键") + private String name; + + @ApiModelProperty(value = "值") + private String value; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "排序") + private Integer sort; + + @ApiModelProperty(value = "是否停用") + private Integer status; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictTypeVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictTypeVo.java new file mode 100644 index 0000000..50b85a9 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/DictTypeVo.java @@ -0,0 +1,36 @@ +package com.biutag.lan.vo.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("字典类型Vo") +public class DictTypeVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "字典名称") + private String dictName; + + @ApiModelProperty(value = "字典类型") + private String dictType; + + @ApiModelProperty(value = "字典备注") + private String dictRemark; + + @ApiModelProperty(value = "字典状态") + private Integer dictStatus; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingLoginVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingLoginVo.java new file mode 100644 index 0000000..085f26f --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingLoginVo.java @@ -0,0 +1,31 @@ +package com.biutag.lan.vo.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("登录设置Vo") +public class SettingLoginVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "登录方式") + private List loginWay; + + @ApiModelProperty(value = "强制绑定手机") + private Integer forceBindMobile; + + @ApiModelProperty(value = "是否开启协议") + private Integer openAgreement; + + @ApiModelProperty(value = "第三方的登录") + private Integer openOtherAuth; + + @ApiModelProperty(value = "自动登录授权") + private List autoLoginAuth; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeDetailVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeDetailVo.java new file mode 100644 index 0000000..97e2d2d --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeDetailVo.java @@ -0,0 +1,39 @@ +package com.biutag.lan.vo.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("通知设置详情Vo") +public class SettingNoticeDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + private Integer id; + + @ApiModelProperty(value = "场景名称") + private String name; + + @ApiModelProperty(value = "通知类型: [1=业务, 2=验证]") + private String type; + + @ApiModelProperty(value = "场景描述") + private String remarks; + + @ApiModelProperty(value = "系统的通知设置") + private Object systemNotice; + + @ApiModelProperty(value = "公众号通知设置") + private Object oaNotice; + + @ApiModelProperty(value = "小程序通知设置") + private Object mnpNotice; + + @ApiModelProperty(value = "短信的通知设置") + private Object smsNotice; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeListedVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeListedVo.java new file mode 100644 index 0000000..1504712 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingNoticeListedVo.java @@ -0,0 +1,42 @@ +package com.biutag.lan.vo.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("通知设置列表Vo") +public class SettingNoticeListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "通知名称") + private String name; + + @ApiModelProperty(value = "通知类型") + private String type; + + @ApiModelProperty(value = "通知状态") + private Integer systemStatus; + + @ApiModelProperty(value = "通知状态") + private Integer smsStatus; + + @ApiModelProperty(value = "公众号状态") + private Integer oaStatus; + + @ApiModelProperty(value = "小程序状态") + private Integer mnpStatus; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingUserVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingUserVo.java new file mode 100644 index 0000000..4e9d161 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/setting/SettingUserVo.java @@ -0,0 +1,18 @@ +package com.biutag.lan.vo.setting; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("用户设置Vo") +public class SettingUserVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "默认头像") + private String defaultAvatar; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/DeptVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/DeptVo.java new file mode 100644 index 0000000..3803499 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/DeptVo.java @@ -0,0 +1,45 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("部门Vo") +public class DeptVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "部门父级") + private Integer pid; + + @ApiModelProperty(value = "部门名称") + private String name; + + @ApiModelProperty(value = "部门全称") + private String fullName; + + @ApiModelProperty(value = "负责人") + private String duty; + + @ApiModelProperty(value = "联系电话") + private String mobile; + + @ApiModelProperty(value = "排序编号") + private Integer sort; + + @ApiModelProperty(value = "是否停用: [0=否, 1=是]") + private Integer isStop; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/MenuVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/MenuVo.java new file mode 100644 index 0000000..015dade --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/MenuVo.java @@ -0,0 +1,65 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统菜单Vo") +public class MenuVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "上级菜单") + private Integer pid; + + @ApiModelProperty(value = "权限类型: [M=目录, C=菜单, A=按钮]") + private String menuType; + + @ApiModelProperty(value = "菜单名称") + private String menuName; + + @ApiModelProperty(value = "菜单图标") + private String menuIcon; + + @ApiModelProperty(value = "菜单排序") + private Integer menuSort; + + @ApiModelProperty(value = "权限标识") + private String perms; + + @ApiModelProperty(value = "路由地址") + private String paths; + + @ApiModelProperty(value = "前端组件") + private String component; + + @ApiModelProperty(value = "选中路径") + private String selected; + + @ApiModelProperty(value = "路由参数") + private String params; + + @ApiModelProperty(value = "是否缓存: [0=否, 1=是]") + private Integer isCache; + + @ApiModelProperty(value = "是否显示: [0=否, 1=是]") + private Integer isShow; + + @ApiModelProperty(value = "是否禁用: [0=否, 1=是]") + private Integer isDisable; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + + + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserDetailVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserDetailVo.java new file mode 100644 index 0000000..855797c --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserDetailVo.java @@ -0,0 +1,110 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +@ApiModel("管理员详情Vo") +public class PoliceUserDetailVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "角色ID") + private List roleIds; + + @ApiModelProperty(value = "部门ID") + private List deptIds; + + @ApiModelProperty(value = "岗位ID") + private List postIds; + + + @ApiModelProperty("用户账号") + private String nickname; + + @ApiModelProperty("用户昵称") + private String username; + @ApiModelProperty("警号") + private String empNo; + @ApiModelProperty("身份证") + private String idCode; + @ApiModelProperty("职位名称") + private String displayName; + @ApiModelProperty("姓名") + private String name; + @ApiModelProperty("用户密码") + private String password; + + @ApiModelProperty("用户头像") + private String avatar; + + @ApiModelProperty("加密盐巴") + private String salt; + + + @ApiModelProperty("排序编号") + private Integer sort; + + @ApiModelProperty("岗位主键") + private String districtId; + + @ApiModelProperty("工作") + private String job; + @ApiModelProperty("工作类型") + private String jobType; + @ApiModelProperty("未知") + private String managerId; + @ApiModelProperty("电话") + private String phone; + @ApiModelProperty("传真号") + private String faxNo; + @ApiModelProperty("职位名称") + private String postTitle; + @ApiModelProperty("工作地址") + private String workAddress; + @ApiModelProperty("账号") + private String account; + @ApiModelProperty("手机号") + private String mobile; + @ApiModelProperty("电子邮件") + private String email; + + @ApiModelProperty("性别") + private String gender; + @ApiModelProperty("出生年月") + private String birthday; + + @ApiModelProperty("状态") + private String status; + @ApiModelProperty("入职实际") + private String hiredAt; + @ApiModelProperty("类型 0 原始数据 1 协警 2 文员 3 临时工") + private String type; + + + @ApiModelProperty(value = "多端登录: [0=否, 1=是]") + private Integer isMultipoint; + + @ApiModelProperty(value = "是否禁用: [0=否, 1=是]") + private Integer isDisable; + + @ApiModelProperty(value = "最后登录IP") + private String lastLoginIp; + + @ApiModelProperty(value = "最后登录时间") + private String lastLoginTime; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java new file mode 100644 index 0000000..97720cd --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java @@ -0,0 +1,51 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("管理员信息Vo") +public class PoliceUserInformVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "部门ID") + private Integer deptId; + + @ApiModelProperty(value = "岗位ID") + private Integer postId; + + @ApiModelProperty(value = "账号") + private String username; + + @ApiModelProperty(value = "昵称") + private String nickname; + + @ApiModelProperty(value = "头像") + private String avatar; + + @ApiModelProperty(value = "多端登录: [0=否, 1=是]") + private Integer isMultipoint; + + @ApiModelProperty(value = "是否禁用: [0=否, 1=是]") + private Integer isDisable; + + @ApiModelProperty(value = "最后登录IP") + private String lastLoginIp; + + @ApiModelProperty(value = "最后登录时间") + private String lastLoginTime; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserListedVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserListedVo.java new file mode 100644 index 0000000..45f28e6 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserListedVo.java @@ -0,0 +1,118 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("管理员列表Vo") +public class PoliceUserListedVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Integer id; + + @ApiModelProperty("用户账号") + private String nickname; + + @ApiModelProperty("用户昵称") + private String username; + @ApiModelProperty("警号") + private String empNo; + @ApiModelProperty("身份证") + private String idCode; + @ApiModelProperty("职位名称") + private String displayName; + @ApiModelProperty("姓名") + private String name; + @ApiModelProperty("用户密码") + private String password; + + @ApiModelProperty("用户头像") + private String avatar; + + @ApiModelProperty("加密盐巴") + private String salt; + + @ApiModelProperty("角色主键") + private String roleIds; + + @ApiModelProperty("部门主键") + private String deptIds; + + @ApiModelProperty("岗位主键") + private String postIds; + + @ApiModelProperty("排序编号") + private Integer sort; + + @ApiModelProperty("岗位主键") + private String districtId; + + @ApiModelProperty("工作") + private String job; + @ApiModelProperty("工作类型") + private String jobType; + @ApiModelProperty("未知") + private String managerId; + @ApiModelProperty("电话") + private String phone; + @ApiModelProperty("传真号") + private String faxNo; + @ApiModelProperty("职位名称") + private String postTitle; + @ApiModelProperty("工作地址") + private String workAddress; + @ApiModelProperty("账号") + private String account; + @ApiModelProperty("手机号") + private String mobile; + @ApiModelProperty("电子邮件") + private String email; + + @ApiModelProperty("性别") + private String gender; + @ApiModelProperty("出生年月") + private String birthday; + + @ApiModelProperty("状态") + private String status; + @ApiModelProperty("入职实际") + private String hiredAt; + @ApiModelProperty("类型 0 原始数据 1 协警 2 文员 3 临时工") + private String type; + + + @ApiModelProperty(value = "部门") + private String dept; + + @ApiModelProperty(value = "角色") + private String role; + + + + @ApiModelProperty(value = "职位") + private String post; + + @ApiModelProperty(value = "多端登录: [0=否, 1=是]") + private Integer isMultipoint; + + @ApiModelProperty(value = "是否禁用: [0=否, 1=是]") + private Integer isDisable; + + @ApiModelProperty(value = "最后登录IP") + private String lastLoginIp; + + @ApiModelProperty(value = "最后登录时间") + private String lastLoginTime; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserSelvesVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserSelvesVo.java new file mode 100644 index 0000000..1f27a91 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserSelvesVo.java @@ -0,0 +1,17 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("当前系统管理员Vo") +public class PoliceUserSelvesVo { + + @ApiModelProperty(value = "用户信息") + private Object user; + + @ApiModelProperty(value = "权限集合: [[*]=>所有权限, ['article:add']=>部分权限]") + private Object permissions; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PostVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PostVo.java new file mode 100644 index 0000000..ee1b13d --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/PostVo.java @@ -0,0 +1,39 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统岗位Vo") +public class PostVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "岗位编号") + private String code; + + @ApiModelProperty(value = "岗位名称") + private String name; + + @ApiModelProperty(value = "岗位备注") + private String remarks; + + @ApiModelProperty(value = "岗位排序") + private Integer sort; + + @ApiModelProperty(value = "是否停用: [0=否, 1=是]") + private Integer isStop; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/RoleVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/RoleVo.java new file mode 100644 index 0000000..8bbc663 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/RoleVo.java @@ -0,0 +1,42 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统角色Vo") +public class RoleVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "角色名称") + private String name; + + @ApiModelProperty(value = "角色备注") + private String remark; + + @ApiModelProperty(value = "关联菜单") + private Object menus; + + @ApiModelProperty(value = "成员数量") + private Integer member; + + @ApiModelProperty(value = "角色排序") + private Integer sort; + + @ApiModelProperty(value = "是否禁用: [0=否, 1=是]") + private Integer isDisable; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + @ApiModelProperty(value = "更新时间") + private String updateTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemCaptchaVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemCaptchaVo.java new file mode 100644 index 0000000..4214d2e --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemCaptchaVo.java @@ -0,0 +1,17 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("验证码") +public class SystemCaptchaVo { + + @ApiModelProperty(value = "标识") + private String uuid; + + @ApiModelProperty(value = "图片") + private String img; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogLoginVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogLoginVo.java new file mode 100644 index 0000000..bb42758 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogLoginVo.java @@ -0,0 +1,36 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("登录日志Vo") +public class SystemLogLoginVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "登录账号") + private String username; + + @ApiModelProperty(value = "来源IP") + private String ip; + + @ApiModelProperty(value = "操作系统") + private String os; + + @ApiModelProperty(value = "浏览器") + private String browser; + + @ApiModelProperty(value = "操作状态: [1=成功, 2=失败]") + private Integer status; + + @ApiModelProperty(value = "创建时间") + private String createTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogOperateVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogOperateVo.java new file mode 100644 index 0000000..1717479 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLogOperateVo.java @@ -0,0 +1,60 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("操作日志Vo") +public class SystemLogOperateVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Integer id; + + @ApiModelProperty(value = "用户账号") + private String username; + + @ApiModelProperty(value = "用户昵称") + private String nickname; + + @ApiModelProperty(value = "请求类型: GET/POST/PUT") + private String type; + + @ApiModelProperty(value = "操作标题") + private String title; + + @ApiModelProperty(value = "请求方式") + private String method; + + @ApiModelProperty(value = "请求IP") + private String ip; + + @ApiModelProperty(value = "请求地址") + private String url; + + @ApiModelProperty(value = "请求参数") + private String args; + + @ApiModelProperty(value = "错误信息") + private String error; + + @ApiModelProperty(value = "执行状态: [1=成功, 2=失败]") + private Integer status; + + @ApiModelProperty(value = "执行耗时") + private String taskTime; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "创建时间") + private String createTime; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLoginVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLoginVo.java new file mode 100644 index 0000000..77e8e81 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/SystemLoginVo.java @@ -0,0 +1,21 @@ +package com.biutag.lan.vo.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("系统登录Vo") +public class SystemLoginVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "管理员ID") + private Integer id; + + @ApiModelProperty(value = "登录令牌") + private String token; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/user/UserVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/user/UserVo.java new file mode 100644 index 0000000..89dc748 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/user/UserVo.java @@ -0,0 +1,65 @@ +package com.biutag.lan.vo.user; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel("用户Vo") +public class UserVo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "用户ID") + private Integer id; + + @ApiModelProperty(value = "用户编码") + private Integer sn; + + @ApiModelProperty(value = "用户头像") + private String avatar; + + @ApiModelProperty(value = "真实姓名") + private String realName; + + @ApiModelProperty(value = "用户昵称") + private String nickname; + + @ApiModelProperty(value = "登录账号") + private String username; + + @ApiModelProperty(value = "手机号码") + private String mobile; + + @ApiModelProperty(value = "用户性别") + private String sex; + + @ApiModelProperty(value = "注册渠道") + private String channel; + + @ApiModelProperty(value = "最后登录IP") + private String lastLoginIp; + + @ApiModelProperty(value = "最后登录时间") + private String lastLoginTime; + + @ApiModelProperty(value = "创建时间") + private String createTime; + + public void setSex(Integer sex) { + switch (sex) { + case 0: + this.sex = "未知"; + break; + case 1: + this.sex = "男"; + break; + case 2: + this.sex = "女"; + break; + } + } + +} diff --git a/mailbox-lan/src/main/resources/application.yml b/mailbox-lan/src/main/resources/application.yml index a48a507..590ad42 100644 --- a/mailbox-lan/src/main/resources/application.yml +++ b/mailbox-lan/src/main/resources/application.yml @@ -1,12 +1,48 @@ server: - port: 8081 + port: 8080 tongweb: license: path: license/license.dat spring: + profiles: + active: dev datasource: driver-class-name: org.postgresql.Driver url: jdbc:postgresql://172.31.217.20:32378/mailbox?currentSchema=mailbox username: mailbox - password: Ip12341234 \ No newline at end of file + password: Ip12341234 + hikari: + connection-timeout: 30000 # 等待连接分配连接的最大时长(毫秒),超出时长还没可用连接则发送SQLException,默认30秒 + minimum-idle: 5 # 最小连接数 + maximum-pool-size: 20 # 最大连接数 + auto-commit: true # 自动提交 + idle-timeout: 600000 # 连接超时的最大时长(毫秒),超时则被释放(retired),默认10分钟 + pool-name: DateSourceHikariCP # 连接池名称 + max-lifetime: 1800000 # 连接的生命时长(毫秒),超时而且没被使用则被释放,默认30分钟(1800000ms) + connection-init-sql: SELECT 1 # 连接时发起SQL测试脚本 + + # Redis配置 +# data: +# redis: +# timeout: 5000 +# host: #192.168.48.231 +# port: 6379 +# password: yuanian +# database: 100 +# repositories: +# enabled: false +# Sa-token配置 +sa-token: + token-name: admin # token的名称 + timeout: 2592000 # token有效期单位s(默认30天,-1代表永不过期) + active-timeout: -1 # token临时有效期(指定时间无操作掉线) + is-concurrent: true # 是否允许同一账号并发登录 + is-share: false # 多人同登账号共用token + token-style: random-64 # token生成的风格 + is-print: false # 打印版本字符画 + is-log: false # 是否输出操作日志 +logging: + level: + root: INFO + com.biutag: debug \ No newline at end of file diff --git a/mailbox-lan/src/main/resources/log4j2-spring.xml b/mailbox-lan/src/main/resources/log4j2-spring.xml new file mode 100644 index 0000000..150461a --- /dev/null +++ b/mailbox-lan/src/main/resources/log4j2-spring.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/config/MyBatisPlusConfig.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/config/MyBatisPlusConfig.java new file mode 100644 index 0000000..d5f2f48 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/config/MyBatisPlusConfig.java @@ -0,0 +1,19 @@ +package com.biutag.outeradmin.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@MapperScan("com.biutag.outeradmin.mapper") +public class MyBatisPlusConfig { + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL)); + return interceptor; + } +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java new file mode 100644 index 0000000..b15c0e4 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java @@ -0,0 +1,65 @@ +package com.biutag.outeradmin.controller; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.biutag.outeradmin.entity.FormData; +import com.biutag.outeradmin.entity.Mail; +import com.biutag.outeradmin.entity.MailID; +import com.biutag.outeradmin.mapper.MailMapper; +import com.biutag.outeradmin.service.MailService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RequiredArgsConstructor +@RequestMapping("/mailbox") +@RestController +public class MailController { + private final MailService mailService; + private final MailMapper mailMapper; + + /** + * 查询所有信件 + * + * @return 信件列表json + */ + @RequestMapping("/list") + public List list() { + List mailList = mailService.list(); + return mailList; +// String result = JSON.toJSONString(mailList); +// return result; + } + + /** + * 查询指定信件 + * + * @param form 前端信件表单数据 + * @return 指定信件json + */ + @RequestMapping("/list-submit") + @ResponseBody + public String siftList(@RequestBody String form) { + FormData formData = JSON.parseObject(form, FormData.class); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.like(formData.getContactName() != null, "contact_name", formData.getContactName()) + .like(formData.getContactPhone() != null, "contact_phone", formData.getContactPhone()) + .like(formData.getContactIdCard() != null, "contact_id_card", formData.getContactIdCard()) + .like(formData.getId() != null, "id", formData.getId()) + .like(formData.getContent() != null, "contact_email", formData.getContent()) +// .like(formData.getEvaluate() != null, "evaluate", formData.getEvaluate()) + .inSql("create_time", "select * from mail where between " + + formData.getDate()[0] + " and " + formData.getDate()[1]); + + return JSON.toJSONString(mailMapper.selectList(queryWrapper)); + } + + @RequestMapping("/detail") + public String detail(@RequestBody String id) { + MailID mailID = JSON.parseObject(id, MailID.class); + //TODO 这里根据ID查询数据库,记得删掉 + System.out.println(mailID.getID()); + return JSON.toJSONString(mailService.getById(mailID.getID())); + } +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java new file mode 100644 index 0000000..7a874d4 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java @@ -0,0 +1,14 @@ +package com.biutag.outeradmin.entity; + +import lombok.Data; + +@Data +public class FormData { + private String[] date; + private String contactName; + private String contactPhone; + private String contactIdCard; + private String id; + private String content; + private String evaluate; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/Mail.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/Mail.java new file mode 100644 index 0000000..a5697e3 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/Mail.java @@ -0,0 +1,72 @@ +package com.biutag.outeradmin.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.util.Date; + +@Data +public class Mail { + @TableId + private String id; + + /** + * 联系人姓名 + */ + private String contactName; + + /** + * 联系人性别 + */ + private String contactSex; + + /** + * 联系人身份证号码 + */ + private String contactIdCard; + + /** + * 联系人手机号码 + */ + private String contactPhone; + + /** + * 案件编号 + */ + private String caseNumber; + + /** + * 内容 + */ + private String content; + + /** + * 附件 + */ + private String attachments; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + +// /** +// * 评价 +// */ +// private String evaluate; + + /** + * 是否满意 + */ + private String satisfaction; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailID.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailID.java new file mode 100644 index 0000000..3b99519 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailID.java @@ -0,0 +1,8 @@ +package com.biutag.outeradmin.entity; + +import lombok.Data; + +@Data +public class MailID { + private String ID; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/MailMapper.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/MailMapper.java new file mode 100644 index 0000000..66b4ba3 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/MailMapper.java @@ -0,0 +1,9 @@ +package com.biutag.outeradmin.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.outeradmin.entity.Mail; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface MailMapper extends BaseMapper { +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java new file mode 100644 index 0000000..1ec9275 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java @@ -0,0 +1,10 @@ +package com.biutag.outeradmin.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.outeradmin.entity.Mail; +import com.biutag.outeradmin.mapper.MailMapper; +import org.springframework.stereotype.Service; + +@Service +public class MailService extends ServiceImpl { +} diff --git a/mailbox-outer/src/main/java/com/biutag/outer/OuterApplication.java b/mailbox-outer/src/main/java/com/biutag/outer/OuterApplication.java index c55ec74..b549e5e 100644 --- a/mailbox-outer/src/main/java/com/biutag/outer/OuterApplication.java +++ b/mailbox-outer/src/main/java/com/biutag/outer/OuterApplication.java @@ -2,8 +2,9 @@ package com.biutag.outer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration; -@SpringBootApplication +@SpringBootApplication(exclude = {RedisRepositoriesAutoConfiguration.class}) public class OuterApplication { public static void main(String[] args) { diff --git a/mailbox-outer/src/main/resources/application.yml b/mailbox-outer/src/main/resources/application.yml index 58353f6..67edfe4 100644 --- a/mailbox-outer/src/main/resources/application.yml +++ b/mailbox-outer/src/main/resources/application.yml @@ -1,12 +1,42 @@ server: - port: 8080 + port: 8081 tongweb: license: path: license/license.dat spring: + profiles: + active: dev + mvc: + static-path-pattern: /api/static/** + throw-exception-if-no-handler-found: true + pathmatch: + matching-strategy: ant_path_matcher datasource: driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://172.31.217.20:32378/mailbox?currentSchema=mailbox-outer + url: jdbc:postgresql://172.31.217.20:32378/mailbox?currentSchema=mailbox username: mailbox password: Ip12341234 + hikari: + connection-timeout: 30000 # 等待连接分配连接的最大时长(毫秒),超出时长还没可用连接则发送SQLException,默认30秒 + minimum-idle: 5 # 最小连接数 + maximum-pool-size: 20 # 最大连接数 + auto-commit: true # 自动提交 + idle-timeout: 600000 # 连接超时的最大时长(毫秒),超时则被释放(retired),默认10分钟 + pool-name: DateSourceHikariCP # 连接池名称 + max-lifetime: 1800000 # 连接的生命时长(毫秒),超时而且没被使用则被释放,默认30分钟(1800000ms) + connection-init-sql: SELECT 1 # 连接时发起SQL测试脚本 + # 限制配置 + servlet: + multipart: + max-file-size: 100MB # 文件上传大小限制 + max-request-size: 100MB # 文件最大请求限制 + enabled: true + # Redis配置 + data: + redis: + timeout: 5000 + host: 192.168.48.231 + port: 6379 + password: yuanian + database: 100 \ No newline at end of file