From 960449c57f97edb45a2e7e1f7c3d6b1f9c97d1cf Mon Sep 17 00:00:00 2001 From: Administrator Date: Tue, 12 Oct 2021 17:03:50 +0800 Subject: [PATCH] start... --- src/main/java/com/subsidy/MeishuApplication.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/Code.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/ResponseData.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/ResponseVO.java | 21 +++++++++++++++++++++ src/main/java/com/subsidy/common/configure/AliyunSmsProperties.java | 19 +++++++++++++++++++ src/main/java/com/subsidy/common/configure/MybatisPlusConfig.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/configure/RemoteProperties.java | 36 ++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/configure/RestTemplateConfig.java | 31 +++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/configure/SwaggerConfig.java | 31 +++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/configure/VODConfig.java | 25 +++++++++++++++++++++++++ src/main/java/com/subsidy/common/configure/WebConfig.java | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/configure/WebLogAspect.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/configure/WechatConfig.java | 24 ++++++++++++++++++++++++ src/main/java/com/subsidy/common/constant/AttendanceConstant.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/constant/Code.java | 33 +++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/constant/WxConstant.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/exception/GlobalExceptionHandler.java | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/exception/HttpException.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/handler/MetaHandler.java | 26 ++++++++++++++++++++++++++ src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/common/interceptor/LoginRequired.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/controller/AdministerController.java | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/CategoryController.java | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/ClassDictController.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/ClassMemberMappingController.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/controller/CourseContentController.java | 43 +++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/CourseDictController.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/DepartmentDictController.java | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/ExerciseDictController.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/FileDictController.java | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/MemberController.java | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/controller/PermissionsDictController.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/controller/RoleAdministerMappingController.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/controller/RoleDictController.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/controller/RolePermissionMappingController.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/controller/VodDictController.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/mapper/AdministerMapper.java | 28 ++++++++++++++++++++++++++++ src/main/java/com/subsidy/mapper/CategoryMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/ClassDictMapper.java | 23 +++++++++++++++++++++++ src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/CourseContentMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/CourseDictMapper.java | 23 +++++++++++++++++++++++ src/main/java/com/subsidy/mapper/DepartmentDictMapper.java | 24 ++++++++++++++++++++++++ src/main/java/com/subsidy/mapper/ExerciseDictMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/FileDictMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/MemberMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/PermissionsDictMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/RoleDictMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/RolePermissionMappingMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/VodDictMapper.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/model/AdministerDO.java | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/CategoryDO.java | 34 ++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/ClassDictDO.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/ClassMemberMappingDO.java | 36 ++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/CourseContentDO.java | 38 ++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/CourseDictDO.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/DepartmentDictDO.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/ExerciseDictDO.java | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/FileDictDO.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/MemberDO.java | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/PermissionsDictDO.java | 41 +++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/RoleAdministerMappingDO.java | 33 +++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/RoleDictDO.java | 34 ++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/RolePermissionMappingDO.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/VodDictDO.java | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/AdministerService.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/CategoryService.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/ClassDictService.java | 27 +++++++++++++++++++++++++++ src/main/java/com/subsidy/service/ClassMemberMappingService.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/CourseContentService.java | 25 +++++++++++++++++++++++++ src/main/java/com/subsidy/service/CourseDictService.java | 25 +++++++++++++++++++++++++ src/main/java/com/subsidy/service/DepartmentDictService.java | 26 ++++++++++++++++++++++++++ src/main/java/com/subsidy/service/ExerciseDictService.java | 27 +++++++++++++++++++++++++++ src/main/java/com/subsidy/service/FileDictService.java | 26 ++++++++++++++++++++++++++ src/main/java/com/subsidy/service/MemberService.java | 26 ++++++++++++++++++++++++++ src/main/java/com/subsidy/service/PermissionsDictService.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/RoleAdministerMappingService.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/RoleDictService.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/RolePermissionMappingService.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/VodDictService.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java | 42 ++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/PermissionsDictServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/service/impl/RoleAdministerMappingServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/service/impl/RoleDictServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/service/impl/RolePermissionMappingServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/BaseModel.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/CodeGenerator.java | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/ConstantUtils.java | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/DateFormatUtil.java | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/EncryptUtil.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/HttpUtil.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/JwtUtil.java | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/LatexUtils.java | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/Localstorage.java | 21 +++++++++++++++++++++ src/main/java/com/subsidy/util/MathUtil.java | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/RandomUtil.java | 19 +++++++++++++++++++ src/main/java/com/subsidy/util/SMSUtils.java | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/SecretUtils.java | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/Signature.java | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/TestMain.java | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/excel/ExcelColumn.java | 13 +++++++++++++ src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java | 21 +++++++++++++++++++++ src/main/java/com/subsidy/util/excel/ExcelUtil.java | 345 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/tree/Node.java | 42 ++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/tree/NumberTree.java | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/tree/SerialNumber.java | 28 ++++++++++++++++++++++++++++ src/main/resources/mapper/AdministerMapper.xml | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/CategoryMapper.xml | 22 ++++++++++++++++++++++ src/main/resources/mapper/ClassDictMapper.xml | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/ClassMemberMappingMapper.xml | 23 +++++++++++++++++++++++ src/main/resources/mapper/CourseContentMapper.xml | 24 ++++++++++++++++++++++++ src/main/resources/mapper/CourseDictMapper.xml | 38 ++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/DepartmentDictMapper.xml | 36 ++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/ExerciseDictMapper.xml | 28 ++++++++++++++++++++++++++++ src/main/resources/mapper/FileDictMapper.xml | 25 +++++++++++++++++++++++++ src/main/resources/mapper/MemberMapper.xml | 27 +++++++++++++++++++++++++++ src/main/resources/mapper/PermissionsDictMapper.xml | 24 ++++++++++++++++++++++++ src/main/resources/mapper/RoleAdministerMappingMapper.xml | 23 +++++++++++++++++++++++ src/main/resources/mapper/RoleDictMapper.xml | 22 ++++++++++++++++++++++ src/main/resources/mapper/RolePermissionMappingMapper.xml | 23 +++++++++++++++++++++++ src/main/resources/mapper/VodDictMapper.xml | 42 ++++++++++++++++++++++++++++++++++++++++++ 132 files changed, 6184 insertions(+) create mode 100644 src/main/java/com/subsidy/MeishuApplication.java create mode 100644 src/main/java/com/subsidy/common/Code.java create mode 100644 src/main/java/com/subsidy/common/ResponseData.java create mode 100644 src/main/java/com/subsidy/common/ResponseVO.java create mode 100644 src/main/java/com/subsidy/common/configure/AliyunSmsProperties.java create mode 100644 src/main/java/com/subsidy/common/configure/MybatisPlusConfig.java create mode 100644 src/main/java/com/subsidy/common/configure/RemoteProperties.java create mode 100644 src/main/java/com/subsidy/common/configure/RestTemplateConfig.java create mode 100644 src/main/java/com/subsidy/common/configure/SwaggerConfig.java create mode 100644 src/main/java/com/subsidy/common/configure/VODConfig.java create mode 100644 src/main/java/com/subsidy/common/configure/WebConfig.java create mode 100644 src/main/java/com/subsidy/common/configure/WebLogAspect.java create mode 100644 src/main/java/com/subsidy/common/configure/WechatConfig.java create mode 100644 src/main/java/com/subsidy/common/constant/AttendanceConstant.java create mode 100644 src/main/java/com/subsidy/common/constant/Code.java create mode 100644 src/main/java/com/subsidy/common/constant/WxConstant.java create mode 100644 src/main/java/com/subsidy/common/exception/GlobalExceptionHandler.java create mode 100644 src/main/java/com/subsidy/common/exception/HttpException.java create mode 100644 src/main/java/com/subsidy/common/handler/MetaHandler.java create mode 100644 src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java create mode 100644 src/main/java/com/subsidy/common/interceptor/LoginRequired.java create mode 100644 src/main/java/com/subsidy/controller/AdministerController.java create mode 100644 src/main/java/com/subsidy/controller/CategoryController.java create mode 100644 src/main/java/com/subsidy/controller/ClassDictController.java create mode 100644 src/main/java/com/subsidy/controller/ClassMemberMappingController.java create mode 100644 src/main/java/com/subsidy/controller/CourseContentController.java create mode 100644 src/main/java/com/subsidy/controller/CourseDictController.java create mode 100644 src/main/java/com/subsidy/controller/DepartmentDictController.java create mode 100644 src/main/java/com/subsidy/controller/ExerciseDictController.java create mode 100644 src/main/java/com/subsidy/controller/FileDictController.java create mode 100644 src/main/java/com/subsidy/controller/MemberController.java create mode 100644 src/main/java/com/subsidy/controller/PermissionsDictController.java create mode 100644 src/main/java/com/subsidy/controller/RoleAdministerMappingController.java create mode 100644 src/main/java/com/subsidy/controller/RoleDictController.java create mode 100644 src/main/java/com/subsidy/controller/RolePermissionMappingController.java create mode 100644 src/main/java/com/subsidy/controller/VodDictController.java create mode 100644 src/main/java/com/subsidy/mapper/AdministerMapper.java create mode 100644 src/main/java/com/subsidy/mapper/CategoryMapper.java create mode 100644 src/main/java/com/subsidy/mapper/ClassDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java create mode 100644 src/main/java/com/subsidy/mapper/CourseContentMapper.java create mode 100644 src/main/java/com/subsidy/mapper/CourseDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/DepartmentDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/ExerciseDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/FileDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/MemberMapper.java create mode 100644 src/main/java/com/subsidy/mapper/PermissionsDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java create mode 100644 src/main/java/com/subsidy/mapper/RoleDictMapper.java create mode 100644 src/main/java/com/subsidy/mapper/RolePermissionMappingMapper.java create mode 100644 src/main/java/com/subsidy/mapper/VodDictMapper.java create mode 100644 src/main/java/com/subsidy/model/AdministerDO.java create mode 100644 src/main/java/com/subsidy/model/CategoryDO.java create mode 100644 src/main/java/com/subsidy/model/ClassDictDO.java create mode 100644 src/main/java/com/subsidy/model/ClassMemberMappingDO.java create mode 100644 src/main/java/com/subsidy/model/CourseContentDO.java create mode 100644 src/main/java/com/subsidy/model/CourseDictDO.java create mode 100644 src/main/java/com/subsidy/model/DepartmentDictDO.java create mode 100644 src/main/java/com/subsidy/model/ExerciseDictDO.java create mode 100644 src/main/java/com/subsidy/model/FileDictDO.java create mode 100644 src/main/java/com/subsidy/model/MemberDO.java create mode 100644 src/main/java/com/subsidy/model/PermissionsDictDO.java create mode 100644 src/main/java/com/subsidy/model/RoleAdministerMappingDO.java create mode 100644 src/main/java/com/subsidy/model/RoleDictDO.java create mode 100644 src/main/java/com/subsidy/model/RolePermissionMappingDO.java create mode 100644 src/main/java/com/subsidy/model/VodDictDO.java create mode 100644 src/main/java/com/subsidy/service/AdministerService.java create mode 100644 src/main/java/com/subsidy/service/CategoryService.java create mode 100644 src/main/java/com/subsidy/service/ClassDictService.java create mode 100644 src/main/java/com/subsidy/service/ClassMemberMappingService.java create mode 100644 src/main/java/com/subsidy/service/CourseContentService.java create mode 100644 src/main/java/com/subsidy/service/CourseDictService.java create mode 100644 src/main/java/com/subsidy/service/DepartmentDictService.java create mode 100644 src/main/java/com/subsidy/service/ExerciseDictService.java create mode 100644 src/main/java/com/subsidy/service/FileDictService.java create mode 100644 src/main/java/com/subsidy/service/MemberService.java create mode 100644 src/main/java/com/subsidy/service/PermissionsDictService.java create mode 100644 src/main/java/com/subsidy/service/RoleAdministerMappingService.java create mode 100644 src/main/java/com/subsidy/service/RoleDictService.java create mode 100644 src/main/java/com/subsidy/service/RolePermissionMappingService.java create mode 100644 src/main/java/com/subsidy/service/VodDictService.java create mode 100644 src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/MemberServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/PermissionsDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/RoleAdministerMappingServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/RoleDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/RolePermissionMappingServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/util/BaseModel.java create mode 100644 src/main/java/com/subsidy/util/CodeGenerator.java create mode 100644 src/main/java/com/subsidy/util/ConstantUtils.java create mode 100644 src/main/java/com/subsidy/util/DateFormatUtil.java create mode 100644 src/main/java/com/subsidy/util/EncryptUtil.java create mode 100644 src/main/java/com/subsidy/util/HttpUtil.java create mode 100644 src/main/java/com/subsidy/util/JwtUtil.java create mode 100644 src/main/java/com/subsidy/util/LatexUtils.java create mode 100644 src/main/java/com/subsidy/util/Localstorage.java create mode 100644 src/main/java/com/subsidy/util/MathUtil.java create mode 100644 src/main/java/com/subsidy/util/RandomUtil.java create mode 100644 src/main/java/com/subsidy/util/SMSUtils.java create mode 100644 src/main/java/com/subsidy/util/SecretUtils.java create mode 100644 src/main/java/com/subsidy/util/Signature.java create mode 100644 src/main/java/com/subsidy/util/TestMain.java create mode 100644 src/main/java/com/subsidy/util/excel/ExcelColumn.java create mode 100644 src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java create mode 100644 src/main/java/com/subsidy/util/excel/ExcelUtil.java create mode 100644 src/main/java/com/subsidy/util/tree/Node.java create mode 100644 src/main/java/com/subsidy/util/tree/NumberTree.java create mode 100644 src/main/java/com/subsidy/util/tree/SerialNumber.java create mode 100644 src/main/resources/mapper/AdministerMapper.xml create mode 100644 src/main/resources/mapper/CategoryMapper.xml create mode 100644 src/main/resources/mapper/ClassDictMapper.xml create mode 100644 src/main/resources/mapper/ClassMemberMappingMapper.xml create mode 100644 src/main/resources/mapper/CourseContentMapper.xml create mode 100644 src/main/resources/mapper/CourseDictMapper.xml create mode 100644 src/main/resources/mapper/DepartmentDictMapper.xml create mode 100644 src/main/resources/mapper/ExerciseDictMapper.xml create mode 100644 src/main/resources/mapper/FileDictMapper.xml create mode 100644 src/main/resources/mapper/MemberMapper.xml create mode 100644 src/main/resources/mapper/PermissionsDictMapper.xml create mode 100644 src/main/resources/mapper/RoleAdministerMappingMapper.xml create mode 100644 src/main/resources/mapper/RoleDictMapper.xml create mode 100644 src/main/resources/mapper/RolePermissionMappingMapper.xml create mode 100644 src/main/resources/mapper/VodDictMapper.xml diff --git a/src/main/java/com/subsidy/MeishuApplication.java b/src/main/java/com/subsidy/MeishuApplication.java new file mode 100644 index 0000000..768f41b --- /dev/null +++ b/src/main/java/com/subsidy/MeishuApplication.java @@ -0,0 +1,39 @@ +package com.subsidy; + +import com.alibaba.druid.support.http.StatViewServlet; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@SpringBootApplication +@MapperScan(basePackages = {"com.meishu.mapper"}) +@EnableScheduling +@EnableAsync +public class MeishuApplication { + + public static void main(String[] args) { + SpringApplication.run(MeishuApplication.class, args); + } + + @Bean + public ServletRegistrationBean druidStatViewServlet() { + //先配置管理后台的servLet,访问的入口为/druid/ + ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean( + new StatViewServlet(), "/druid/*"); + // IP白名单 (没有配置或者为空,则允许所有访问) + servletRegistrationBean.addInitParameter("allow", "127.0.0.1"); + // IP黑名单 (存在共同时,deny优先于allow) + servletRegistrationBean.addInitParameter("deny", ""); + servletRegistrationBean.addInitParameter("loginUsername", "admin"); + servletRegistrationBean.addInitParameter("loginPassword", "yhkl1234"); + servletRegistrationBean.addInitParameter("resetEnable", "false"); + return servletRegistrationBean; + } + +} diff --git a/src/main/java/com/subsidy/common/Code.java b/src/main/java/com/subsidy/common/Code.java new file mode 100644 index 0000000..91afe9e --- /dev/null +++ b/src/main/java/com/subsidy/common/Code.java @@ -0,0 +1,45 @@ +package com.subsidy.common; + +public enum Code { + + USERNAMENOTFOUND(10001, "用户不存在"), + BADCREDENTIALS(10002,"账户或者密码错误"), + ACCOUNTEXPIRED(10003,"账户过期"), + LOCKEDEXCEPTION(10004, "账户已锁定"), + DISABLEDEXCEPTION(10005,"账户已禁用"), + ACCESSDENIED(10006,"无权限访问"), + AUTHENTICATION(10007,"身份验证异常"), + NOHANDLERFOUND(10008,"找不到相应的视图处理器"), + PARAM_INVALID(10009, "参数不合法"), + TOKEN_EXCEPTION(10010, "Token不合法"), + TOKEN_EXPIRED(10011, "Token已过期"), + OSS_ERROR(10012, "OSS文件上传异常"), + Network_ERROR(90000, "网络请求失败"), + SERVER_INTERNAL_ERROR(99999, "服务器内部错误"), + ; + + private Integer code; + + private String message; + + Code(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/src/main/java/com/subsidy/common/ResponseData.java b/src/main/java/com/subsidy/common/ResponseData.java new file mode 100644 index 0000000..fd45218 --- /dev/null +++ b/src/main/java/com/subsidy/common/ResponseData.java @@ -0,0 +1,54 @@ +package com.subsidy.common; + +import com.subsidy.common.configure.RemoteProperties; +import lombok.Data; +import org.springframework.boot.context.properties.EnableConfigurationProperties; + +/** + * 返回数据 + * + * @author DengMin + * @date 2019/08/27 13:57 + **/ +@Data +@EnableConfigurationProperties(RemoteProperties.class) +public class ResponseData { + + public static ResponseVO generateCreatedResponse(int code) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(RemoteProperties.getMessage(code)) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, String message) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(message) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, T data) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(RemoteProperties.getMessage(code)) + .data(data) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, String message, T data) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(message) + .data(data) + .build(); + } + + public static ResponseVO generateCreatedResponse(int code, String message, String path) { + return (ResponseVO) ResponseVO.builder() + .code(code) + .message(message) + .path(path) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/common/ResponseVO.java b/src/main/java/com/subsidy/common/ResponseVO.java new file mode 100644 index 0000000..afaa676 --- /dev/null +++ b/src/main/java/com/subsidy/common/ResponseVO.java @@ -0,0 +1,21 @@ +package com.subsidy.common; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ResponseVO { + + private Integer code; + + private String message; + + private T data; + + private String path; +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/common/configure/AliyunSmsProperties.java b/src/main/java/com/subsidy/common/configure/AliyunSmsProperties.java new file mode 100644 index 0000000..bb827e2 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/AliyunSmsProperties.java @@ -0,0 +1,19 @@ +package com.subsidy.common.configure; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Data +@Component +@ConfigurationProperties(prefix = "sms") +public class AliyunSmsProperties { + + private String product; + + private String domain; + + private String accessKeyId; + + private String accessKeySecret; +} diff --git a/src/main/java/com/subsidy/common/configure/MybatisPlusConfig.java b/src/main/java/com/subsidy/common/configure/MybatisPlusConfig.java new file mode 100644 index 0000000..c02a5b2 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/MybatisPlusConfig.java @@ -0,0 +1,54 @@ +package com.subsidy.common.configure; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.config.GlobalConfig; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.subsidy.common.handler.MetaHandler; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author: tuyp + * @create: 2020-08-12 12:01 + */ +@Configuration +@ConditionalOnClass(value = {PaginationInterceptor.class}) +public class MybatisPlusConfig { + + /** + * 分页 + * @return + */ + @Bean + public PaginationInterceptor paginationInterceptor(){ + PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); + paginationInterceptor.setDialectType(DbType.MYSQL.getDb()); + return paginationInterceptor; + } +// +// /** +// * 打印 sql +// */ +// @Bean +// public PerformanceInterceptor performanceInterceptor() { +// PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor(); +// //格式化sql语句 +// Properties properties = new Properties(); +// properties.setProperty("format", "false"); +// performanceInterceptor.setProperties(properties); +// return performanceInterceptor; +// } + + /** + * 自动填充功能 + * @return + */ + @Bean + public GlobalConfig globalConfig() { + GlobalConfig globalConfig = new GlobalConfig(); + globalConfig.setMetaObjectHandler(new MetaHandler()); + return globalConfig; + } + +} diff --git a/src/main/java/com/subsidy/common/configure/RemoteProperties.java b/src/main/java/com/subsidy/common/configure/RemoteProperties.java new file mode 100644 index 0000000..23a42de --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/RemoteProperties.java @@ -0,0 +1,36 @@ +package com.subsidy.common.configure; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +/** + *

+ * 读取状态码 + *

+ * + * @author DengMin + * @date Created in 2020/08/24 + */ +@Component +@ConfigurationProperties(prefix = "meishu") +@PropertySource(value = "classpath:code.properties", encoding = "UTF-8") +public class RemoteProperties { + + private static Map codeMessage = new HashMap<>(); + + public static String getMessage(Integer code) { + return codeMessage.get(code); + } + + public Map getCodeMessage() { + return codeMessage; + } + + public void setCodeMessage(Map codeMessage) { + RemoteProperties.codeMessage = codeMessage; + } +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/common/configure/RestTemplateConfig.java b/src/main/java/com/subsidy/common/configure/RestTemplateConfig.java new file mode 100644 index 0000000..c4f692f --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/RestTemplateConfig.java @@ -0,0 +1,31 @@ +package com.subsidy.common.configure; + +import org.springframework.context.annotation.Bean; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; + +@Component +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate() { + RestTemplate restTemplate = new RestTemplate(); + restTemplate.getMessageConverters().add(new WxMappingJackson2HttpMessageConverter()); + return restTemplate; + } + + public class WxMappingJackson2HttpMessageConverter extends MappingJackson2HttpMessageConverter { + public WxMappingJackson2HttpMessageConverter(){ + List mediaTypes = new ArrayList<>(); + mediaTypes.add(MediaType.TEXT_PLAIN); + mediaTypes.add(MediaType.TEXT_HTML); + setSupportedMediaTypes(mediaTypes); + } + } + +} diff --git a/src/main/java/com/subsidy/common/configure/SwaggerConfig.java b/src/main/java/com/subsidy/common/configure/SwaggerConfig.java new file mode 100644 index 0000000..68dc808 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/SwaggerConfig.java @@ -0,0 +1,31 @@ +package com.subsidy.common.configure; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .pathMapping("/") + .select() + .apis(RequestHandlerSelectors.basePackage("com.meishu")) + .paths(PathSelectors.any()) + .build().apiInfo(new ApiInfoBuilder() + .title("市西cms") + .description("接口文档规范") + .version("1.0") +// .contact(new Contact("啊啊啊啊","www.youkehulian.com","tcp@meishu.com")) +// .license("The Apache License") +// .licenseUrl("http://www.baidu.com") + .build()); + } +} diff --git a/src/main/java/com/subsidy/common/configure/VODConfig.java b/src/main/java/com/subsidy/common/configure/VODConfig.java new file mode 100644 index 0000000..699cad7 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/VODConfig.java @@ -0,0 +1,25 @@ +package com.subsidy.common.configure; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @author: tuyp + * @create: 2020-06-01 16:46 + */ +@Component +@Data +@ConfigurationProperties(prefix = "vod") +public class VODConfig { + + private String appId; + + private String secretId; + + private String secretKey; + + private String api; + + private String region; +} diff --git a/src/main/java/com/subsidy/common/configure/WebConfig.java b/src/main/java/com/subsidy/common/configure/WebConfig.java new file mode 100644 index 0000000..ecb8f03 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/WebConfig.java @@ -0,0 +1,61 @@ +package com.subsidy.common.configure; + +import com.subsidy.common.interceptor.AuthenticationInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +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; + +/** + * @author DengMin + * @date 2020/07/06 + **/ +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Autowired + private AuthenticationInterceptor authenticationInterceptor; + + /** + * 跨域支持 + * + * @param registry + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") +// .allowCredentials(true) + .allowedOrigins("*") + .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS") + .maxAge(3600); + } + + /** + * Swagger + * @param registry + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/**").addResourceLocations("classpath:/static/"); + registry.addResourceHandler("swagger-ui.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + } + + /** + * 鉴权 + * @param registry + */ + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(authenticationInterceptor) + .excludePathPatterns("/static/*") + .addPathPatterns("/**"); + } + + + +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/common/configure/WebLogAspect.java b/src/main/java/com/subsidy/common/configure/WebLogAspect.java new file mode 100644 index 0000000..1732de8 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/WebLogAspect.java @@ -0,0 +1,56 @@ +package com.subsidy.common.configure; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; + +@Aspect +@Component +public class WebLogAspect { + + private final Logger logger = LoggerFactory.getLogger(WebLogAspect.class); + + @Pointcut("execution(public * com.subsidy.controller.*.*(..))")//切入点描述 这个是controller包的切入点 + public void controllerLog(){}//签名,可以理解成这个切入点的一个名称 + + @Pointcut("execution(public * com.subsidy.controller.*.*(..))") + public void serviceImplLog(){} + + @Before("controllerLog()") //在切入点的方法run之前要干的 + public void logBeforeController(JoinPoint joinPoint) { + + + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + //这个RequestContextHolder是Springmvc提供来获得请求的东西 + HttpServletRequest request = ((ServletRequestAttributes)requestAttributes).getRequest(); + + // 记录下请求内容 + logger.info("####requestUrl : " + request.getRequestURL().toString()); + logger.info("####requestParam : " + Arrays.toString(joinPoint.getArgs())); + + } + +// @Around("serviceImplLog()") +// public Object afterController(ProceedingJoinPoint proceedingJoinPoint) { +// +// Object result = null; +// +// try{ +// result = proceedingJoinPoint.proceed(); +// logger.info("====reulst"+result); +// }catch (Throwable e){ +// MyException myException =(MyException)e; +// throw myException; +// } +// return result; +// } + +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/common/configure/WechatConfig.java b/src/main/java/com/subsidy/common/configure/WechatConfig.java new file mode 100644 index 0000000..46e2034 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/WechatConfig.java @@ -0,0 +1,24 @@ +package com.subsidy.common.configure; + + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties(prefix = "wechat") +public class WechatConfig { + + private String appId; + + private String appSecret; + + private String msgUrl; + + private String templateId; + + private String agentId; + + +} diff --git a/src/main/java/com/subsidy/common/constant/AttendanceConstant.java b/src/main/java/com/subsidy/common/constant/AttendanceConstant.java new file mode 100644 index 0000000..1305fc9 --- /dev/null +++ b/src/main/java/com/subsidy/common/constant/AttendanceConstant.java @@ -0,0 +1,29 @@ +package com.subsidy.common.constant; + +public class AttendanceConstant { + + /** + * 创建预约api + */ + public static final String CREATE_TOPIC_URL = "https://open.api.roomis.com.cn/api/my/booking/spaces/{spaceId}/events"; + + /** + * 考勤api + */ + public static final String GET_ATTENDANCE_URL = "https://open.api.roomis.com.cn/api/attendance/{id}"; + + /** + * 创建人ID + */ + public static Long organizerId = 200000222L; + + /** + * 开始时间 + */ + public static String startTime = "07:00:00"; + + /** + * 结束时间 + */ + public static String endTime = "21:00:00"; +} diff --git a/src/main/java/com/subsidy/common/constant/Code.java b/src/main/java/com/subsidy/common/constant/Code.java new file mode 100644 index 0000000..d4a02f9 --- /dev/null +++ b/src/main/java/com/subsidy/common/constant/Code.java @@ -0,0 +1,33 @@ +package com.subsidy.common.constant; + +import lombok.Getter; + +@Getter +public enum Code { + + USERNAMENOTFOUND(1001, "用户不存在"), + BADCREDENTIALS(1002,"账户或者密码错误"), + ACCOUNTEXPIRED(1003,"账户过期"), + LOCKEDEXCEPTION(1004, "账户已锁定"), + DISABLEDEXCEPTION(1005,"账户已禁用"), + ACCESSDENIED(1006,"无权限访问"), + AUTHENTICATION(1007,"身份验证异常"), + NOHANDLERFOUND(1008,"找不到相应的视图处理器"), + PARAM_INVALID(1009, "参数不合法"), + TOKEN_EXCEPTION(1010, "无效的令牌"), + TOKEN_EXPIRED(1011, "令牌已过期"), + TOKEN_VERIFICATION_FAILED(1013, "令牌验证失败"), + OSS_ERROR(1012, "OSS文件上传异常"), + Network_ERROR(9000, "网络请求失败"), + SERVER_INTERNAL_ERROR(99999, "服务器内部错误"), + ; + + private Integer code; + + private String message; + + Code(Integer code, String message) { + this.code = code; + this.message = message; + } +} diff --git a/src/main/java/com/subsidy/common/constant/WxConstant.java b/src/main/java/com/subsidy/common/constant/WxConstant.java new file mode 100644 index 0000000..41ed23a --- /dev/null +++ b/src/main/java/com/subsidy/common/constant/WxConstant.java @@ -0,0 +1,35 @@ +package com.subsidy.common.constant; + +public class WxConstant { + + /** + * app id + */ + public static final String APPID = "wx75ec06e9ce50ef73"; + + /** + * 秘钥 + */ + public static final String SECRENT = "c039d32804278503474dfcf7cb3944b9"; + + /** + * 获取访问用户身份 + */ + public static final String GETUSERINFO = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token={access_token}&code={code}"; + + /** + * 读取成员 + */ + public static final String GET = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token={access_token}&userid={userid}"; + + /** + * 获取access_token + */ + public static final String GET_SUITE_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={appid}&secret={secret}"; + + + /** + * 扫码登陆回调地址 + */ + public static final String QR_REDIRECT_URL = "http://massadmin.youkehulian.com"; +} diff --git a/src/main/java/com/subsidy/common/exception/GlobalExceptionHandler.java b/src/main/java/com/subsidy/common/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..5f8117b --- /dev/null +++ b/src/main/java/com/subsidy/common/exception/GlobalExceptionHandler.java @@ -0,0 +1,118 @@ +package com.subsidy.common.exception; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.configure.RemoteProperties; +import com.subsidy.common.constant.Code; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.validation.BindException; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.NoHandlerFoundException; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; + +/** + * 异常处理 + * @author DengMin + * @date 2020/07/14 + **/ +@Slf4j +@RestControllerAdvice +public class GlobalExceptionHandler { + + /** + * 自定义异常 + * @param e + * @return + */ + @ExceptionHandler(value = HttpException.class) + public ResponseVO handlerException(HttpServletRequest request, HttpException e) { + String message = RemoteProperties.getMessage(e.getCode()); + if(StringUtils.isBlank(message)) { + message = e.getMessage(); + } + String url = request.getRequestURI(); + return ResponseData.generateCreatedResponse(e.getCode(), message, url); + } + + /** + * 404 + * @param request + * @return + */ + @ExceptionHandler(value = NoHandlerFoundException.class) + public ResponseVO NoHandlerFoundException(HttpServletRequest request) { + String url = request.getRequestURI(); + return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url); + } + + /** + * 请求方式错误 + * @param request + * @return + */ + @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class) + public ResponseVO HttpRequestMethodNotSupportedException(HttpServletRequest request) { + String url = request.getRequestURI(); + return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url); + } + + /** + * 参数不合法 + * @param e + * @return + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseVO validateException(MethodArgumentNotValidException e){ + final List errList = new ArrayList<>(); + e.getBindingResult().getAllErrors().stream().forEach(x -> { + errList.add(x.getDefaultMessage()); + }); + return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString()); + } + + /** + * JSON 序列化异常 + * @param e + * @return + */ + @ExceptionHandler(HttpMessageNotReadableException.class) + public ResponseVO exceptionHandler(HttpMessageNotReadableException e) { + log.error(e.getMessage()); + return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage()+":{"+e.getMessage()+"}"); + } + + /** + * 校验异常 + * @param e + * @return + */ + @ExceptionHandler(BindException.class) + public ResponseVO BindException(BindException e){ + final List errList = new ArrayList<>(); + e.getBindingResult().getAllErrors().stream().forEach(x -> { + errList.add(x.getDefaultMessage()); + }); + return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString()); + } + + /** + * 服务器内部错误 + * @return + */ + @ExceptionHandler(value = Exception.class) + public ResponseVO serverInternalError(Exception e, HttpServletRequest request) { + String url = request.getRequestURI(); + log.error("path:"+url); + log.error("---- error message: ---"+e.toString()); + return ResponseData.generateCreatedResponse(Code.SERVER_INTERNAL_ERROR.getCode(), Code.SERVER_INTERNAL_ERROR.getMessage(), url); + } +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/common/exception/HttpException.java b/src/main/java/com/subsidy/common/exception/HttpException.java new file mode 100644 index 0000000..291188b --- /dev/null +++ b/src/main/java/com/subsidy/common/exception/HttpException.java @@ -0,0 +1,45 @@ +package com.subsidy.common.exception; + + +import com.subsidy.common.configure.RemoteProperties; + +/** + * 异常处理 + * @author DengMin + * @date 2020/08/12 + **/ +public class HttpException extends RuntimeException{ + + private Integer code; + + private String message; + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + @Override + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public HttpException(Integer code) { + super(RemoteProperties.getMessage(code)); + String message = RemoteProperties.getMessage(code); + this.message = message; + this.code = code; + } + + public HttpException(Integer code, String message) { + this.message = message; + this.code = code; + } +} diff --git a/src/main/java/com/subsidy/common/handler/MetaHandler.java b/src/main/java/com/subsidy/common/handler/MetaHandler.java new file mode 100644 index 0000000..9e83fcd --- /dev/null +++ b/src/main/java/com/subsidy/common/handler/MetaHandler.java @@ -0,0 +1,26 @@ +package com.subsidy.common.handler; + +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +/** + * 填充配置 + * @author DengMin + * @date 2020/07/21 + **/ +@Component +public class MetaHandler implements MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + this.setFieldValByName("createDate", LocalDateTime.now(), metaObject); + } + + @Override + public void updateFill(MetaObject metaObject) { + this.setFieldValByName("updateDate", LocalDateTime.now(), metaObject); + } +} diff --git a/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java new file mode 100644 index 0000000..a3b12c9 --- /dev/null +++ b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java @@ -0,0 +1,79 @@ +package com.subsidy.common.interceptor; + +import com.auth0.jwt.interfaces.Claim; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.subsidy.common.exception.HttpException; +import com.subsidy.util.JwtUtil; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.lang.reflect.Method; +import java.util.Map; + +/** + *

+ * 鉴权拦截器 + *

+ * + * @author DengMin + * @since 2021/4/14 + */ +@Component +public class AuthenticationInterceptor implements HandlerInterceptor { + + + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { + // 不需要进行拦截 + if (!(handler instanceof HandlerMethod)) { + return true; + } + + HandlerMethod handlerMethod = (HandlerMethod) handler; + Method method = handlerMethod.getMethod(); + LoginRequired methodAnnotation = method.getAnnotation(LoginRequired.class); + if (methodAnnotation != null) { + String authorization = request.getHeader("Authorization"); + if (!StringUtils.isBlank(authorization)) { + String token = authorization; + if (authorization.startsWith("Bearer")) { + token = authorization.replace("Bearer ", ""); + } + /*Token不存在*/ + if (token == null || JwtUtil.isExpired(token) || !JwtUtil.verifyToken(token)) { + throw new HttpException(1010); + } + + Map claimMap = JwtUtil.getClaims(token); + if (claimMap != null) { + String[] role = methodAnnotation.value(); + String type = claimMap.get("type").asString(); + if (role.length > 0) { + if ("administer".equals(type)) { + //AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong()); + //if (administerDO != null) { + // Localstorage.setUser(administerDO); + // return true; + //} + } else { + throw new HttpException(1010); + } + } else { + //AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong()); + //if (administerDO != null) { + // Localstorage.setUser(administerDO); + // return true; + //} + } + } +// return true; + } + throw new HttpException(1010); + } + return true; + } +} diff --git a/src/main/java/com/subsidy/common/interceptor/LoginRequired.java b/src/main/java/com/subsidy/common/interceptor/LoginRequired.java new file mode 100644 index 0000000..19e2615 --- /dev/null +++ b/src/main/java/com/subsidy/common/interceptor/LoginRequired.java @@ -0,0 +1,20 @@ +package com.subsidy.common.interceptor; + +import java.lang.annotation.*; + +/** + *

+ * 自定义验证登陆注解 + *

+ * + * @author DengMin + * @since 2020/12/18 + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface LoginRequired { + + String[] value(); +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java new file mode 100644 index 0000000..3ac0588 --- /dev/null +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -0,0 +1,80 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.administer.OperatorsDTO; +import com.subsidy.model.AdministerDO; +import com.subsidy.service.AdministerService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 管理平台用户 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "管理平台用户") +@RequestMapping("/administer") +public class AdministerController { + + @Autowired + private AdministerService administerService; + + @PostMapping("/login") + @ApiOperation("登录接口 telephone password") + public ResponseVO login(@RequestBody AdministerDO administerDO){ + return ResponseData.generateCreatedResponse(0,administerService.login(administerDO)); + } + + @PostMapping("/getPermissions") + @ApiOperation("权限查询") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getPermissions() { + return ResponseData.generateCreatedResponse(0, administerService.getPermissions()); + } + + @PostMapping("/administers") + @ApiOperation("运营者/企业查询 {pageNum pageSize accountType 0:运营者管理 1:企业管理}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ + return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO)); + } + + @PostMapping("addAdminister") + @ApiOperation("添加运营者/企业 {telephone:账号 userName:成员名称/企业名称 shortName 简称 banner:标语 field:领域 accountType:账号类型}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addOperator(@RequestBody AdministerDO administerDO){ + return ResponseData.generateCreatedResponse(0,administerService.addOperator(administerDO)); + } + + @PostMapping("deleteAdminister") + @ApiOperation("删除运营者/企业 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteAdminister(AdministerDO administerDO){ + return ResponseData.generateCreatedResponse(0,administerService.deleteAdminister(administerDO)); + } + + @PostMapping("updateAdminister") + @ApiOperation("修改运营者,企业 id userName:成员名称/企业名称 shortName 简称 banner:标语 field:领域") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateAdminister(AdministerDO administerDO){ + return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(administerDO)); + } + + + + +} diff --git a/src/main/java/com/subsidy/controller/CategoryController.java b/src/main/java/com/subsidy/controller/CategoryController.java new file mode 100644 index 0000000..374dca7 --- /dev/null +++ b/src/main/java/com/subsidy/controller/CategoryController.java @@ -0,0 +1,71 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.category.GetCategoriesDTO; +import com.subsidy.model.CategoryDO; +import com.subsidy.service.CategoryService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 类目名称 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "类目") +@RequestMapping("/category") +public class CategoryController { + + @Autowired + private CategoryService categoryService; + + @PostMapping("getCategories") + @ApiOperation("查询类目 name 类目名称 pageSize pageNum") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getCategories(@RequestBody GetCategoriesDTO getCategoriesDTO){ + return ResponseData.generateCreatedResponse(0,categoryService.getCategories(getCategoriesDTO)); + } + + @PostMapping("getAll") + @ApiOperation("查询所有类目") + public ResponseVO getAll(){ + return ResponseData.generateCreatedResponse(0,categoryService.getAll()); + } + + @PostMapping("addCategory") + @ApiOperation("新增类目 name") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addCategory(@RequestBody CategoryDO categoryDO){ + return ResponseData.generateCreatedResponse(0,categoryService.addCategory(categoryDO)); + } + + @PostMapping("deleteCategory") + @ApiOperation("删除类目 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteCategory(@RequestBody CategoryDO categoryDO){ + return ResponseData.generateCreatedResponse(0,categoryService.deleteCategory(categoryDO)); + } + + @PostMapping("updateCategory") + @ApiOperation("修改类目 id name") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateCategory(@RequestBody CategoryDO categoryDO){ + return ResponseData.generateCreatedResponse(0,categoryService.updateCategory(categoryDO)); + } + + +} diff --git a/src/main/java/com/subsidy/controller/ClassDictController.java b/src/main/java/com/subsidy/controller/ClassDictController.java new file mode 100644 index 0000000..fd0b3ec --- /dev/null +++ b/src/main/java/com/subsidy/controller/ClassDictController.java @@ -0,0 +1,63 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.model.ClassDictDO; +import com.subsidy.service.ClassDictService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 班级id 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@RestController +@Api(tags = "班级") +@RequestMapping("/classDict") +public class ClassDictController { + + @Autowired + private ClassDictService classDictService; + + @PostMapping("getAllClasses") + @ApiOperation("获取某企业下的所有课程 companyId") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){ + return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO)); + } + + @PostMapping("deleteClasses") + @ApiOperation("删除课程 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteClasses(@RequestBody ClassDictDO classDictDO){ + return ResponseData.generateCreatedResponse(0,classDictService.deleteClasses(classDictDO)); + } + + @PostMapping("addClass") + @ApiOperation("添加课程 companyId courseId className startDate endDate") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addClass(@RequestBody ClassDictDO classDictDO){ + return ResponseData.generateCreatedResponse(0,classDictService.addClass(classDictDO)); + } + + @PostMapping("updateClass") + @ApiOperation("添加课程 id companyId courseId className startDate endDate") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateClass(@RequestBody ClassDictDO classDictDO){ + return ResponseData.generateCreatedResponse(0,classDictService.updateClass(classDictDO)); + } + +} diff --git a/src/main/java/com/subsidy/controller/ClassMemberMappingController.java b/src/main/java/com/subsidy/controller/ClassMemberMappingController.java new file mode 100644 index 0000000..ec9096f --- /dev/null +++ b/src/main/java/com/subsidy/controller/ClassMemberMappingController.java @@ -0,0 +1,22 @@ +package com.subsidy.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 班级成员映射表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@RestController +@Api(tags = "班级成员映射表") +@RequestMapping("/class-member-mapping-do") +public class ClassMemberMappingController { + +} diff --git a/src/main/java/com/subsidy/controller/CourseContentController.java b/src/main/java/com/subsidy/controller/CourseContentController.java new file mode 100644 index 0000000..9d75906 --- /dev/null +++ b/src/main/java/com/subsidy/controller/CourseContentController.java @@ -0,0 +1,43 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.model.CourseContentDO; +import com.subsidy.model.VodDictDO; +import com.subsidy.service.CourseContentService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 课程目录表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "课程目录表") +@RequestMapping("/courseContent") +public class CourseContentController { + + @Autowired + private CourseContentService courseContentService; + + @PostMapping("getContents") + @ApiOperation("获取课程目录 {courseId}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getContents(@RequestBody CourseContentDO courseContentDO){ + return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO)); + } + +} diff --git a/src/main/java/com/subsidy/controller/CourseDictController.java b/src/main/java/com/subsidy/controller/CourseDictController.java new file mode 100644 index 0000000..cbd229a --- /dev/null +++ b/src/main/java/com/subsidy/controller/CourseDictController.java @@ -0,0 +1,68 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.course.QueryCoursesDTO; +import com.subsidy.model.CourseDictDO; +import com.subsidy.service.CourseDictService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "课程表") +@RequestMapping("/courseDict") +public class CourseDictController { + + @Autowired + private CourseDictService courseDictService; + + @PostMapping("addCourse") + @ApiOperation("添加课程 courseName categoryId courseType courseSource") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){ + return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO)); + } + + @PostMapping("deleteCourse") + @ApiOperation("删除课程 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){ + return ResponseData.generateCreatedResponse(0,courseDictService.deleteCourse(courseDictDO)); + } + + @PostMapping("queryCourses") + @ApiOperation("查询课程 courseName categoryId courseType courseSource") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){ + return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO)); + } + + + @PostMapping("updateCourses") + @ApiOperation("编辑课程 id courseName categoryId courseType courseSource") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){ + return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO)); + } + + + + +} diff --git a/src/main/java/com/subsidy/controller/DepartmentDictController.java b/src/main/java/com/subsidy/controller/DepartmentDictController.java new file mode 100644 index 0000000..bbd4199 --- /dev/null +++ b/src/main/java/com/subsidy/controller/DepartmentDictController.java @@ -0,0 +1,65 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.model.DepartmentDictDO; +import com.subsidy.service.DepartmentDictService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 部门字典表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "部门字典表") +@RequestMapping("/departmentDict") +public class DepartmentDictController { + + @Autowired + private DepartmentDictService departmentDictService; + + @PostMapping("getDepartments") + @ApiOperation("获取所有部门 companyId 企业id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){ + return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO)); + } + + @PostMapping("addDepartment") + @ApiOperation("添加部门 companyId departmentName leaderName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){ + return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO)); + } + + @PostMapping("deleteDepartment") + @ApiOperation("删除部门 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteDepartment(@RequestBody DepartmentDictDO departmentDictDO){ + return ResponseData.generateCreatedResponse(0,departmentDictService.deleteDepartment(departmentDictDO)); + } + + @PostMapping("updateDepartment") + @ApiOperation("编辑部门 id companyId departmentName leaderName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){ + return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO)); + } + + + +} diff --git a/src/main/java/com/subsidy/controller/ExerciseDictController.java b/src/main/java/com/subsidy/controller/ExerciseDictController.java new file mode 100644 index 0000000..91341e7 --- /dev/null +++ b/src/main/java/com/subsidy/controller/ExerciseDictController.java @@ -0,0 +1,63 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.exercise.GetAllExercisesDTO; +import com.subsidy.model.ExerciseDictDO; +import com.subsidy.service.ExerciseDictService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 习题库 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@RestController +@Api(tags = "习题库") +@RequestMapping("/exerciseDict") +public class ExerciseDictController { + + @Autowired + private ExerciseDictService exerciseDictService; + + @PostMapping("getAllExercises") + @ApiOperation("查询所有题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 pageSize pageNum}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getAllExercises(@RequestBody GetAllExercisesDTO getAllExercisesDTO){ + return ResponseData.generateCreatedResponse(0,exerciseDictService.getAllExercises(getAllExercisesDTO)); + } + + @PostMapping("addExercise") + @ApiOperation("添加题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案 }") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addExercise(@RequestBody ExerciseDictDO exerciseDictDO){ + return ResponseData.generateCreatedResponse(0,exerciseDictService.addExercise(exerciseDictDO)); + } + + @PostMapping("deleteExercise") + @ApiOperation("删除题目 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteExercise(@RequestBody ExerciseDictDO exerciseDictDO){ + return ResponseData.generateCreatedResponse(0,exerciseDictService.deleteExercise(exerciseDictDO)); + } + + @PostMapping("updateExercise") + @ApiOperation("修改题目 id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateExercise(@RequestBody ExerciseDictDO exerciseDictDO){ + return ResponseData.generateCreatedResponse(0,exerciseDictService.updateExercise(exerciseDictDO)); + } +} diff --git a/src/main/java/com/subsidy/controller/FileDictController.java b/src/main/java/com/subsidy/controller/FileDictController.java new file mode 100644 index 0000000..aafca9f --- /dev/null +++ b/src/main/java/com/subsidy/controller/FileDictController.java @@ -0,0 +1,64 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.model.FileDictDO; +import com.subsidy.model.VodDictDO; +import com.subsidy.service.FileDictService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 课件表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "课件表") +@RequestMapping("/fileDict") +public class FileDictController { + + @Autowired + private FileDictService fileDictService; + + @PostMapping("getContendFiles") + @ApiOperation("获取目录下的视频 {contentId vodName}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getContendFiles(@RequestBody FileDictDO fileDictDO){ + return ResponseData.generateCreatedResponse(0,fileDictService.getContendFiles(fileDictDO)); + } + + @PostMapping("deleteFile") + @ApiOperation("删除视频 id ") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteFile(@RequestBody FileDictDO fileDictDO){ + return ResponseData.generateCreatedResponse(0,fileDictService.deleteFile(fileDictDO)); + } + + @PostMapping("addFile") + @ApiOperation("新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addFile(@RequestBody FileDictDO fileDictDO){ + return ResponseData.generateCreatedResponse(0,fileDictService.addFile(fileDictDO)); + } + + @PostMapping("updateFile") + @ApiOperation("新增视频 id contentId vodName vodLength vodType vodSize vodUrl vodCode") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateFile(@RequestBody FileDictDO fileDictDO){ + return ResponseData.generateCreatedResponse(0,fileDictService.updateFile(fileDictDO)); + } + +} diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java new file mode 100644 index 0000000..8d47d47 --- /dev/null +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -0,0 +1,65 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.model.MemberDO; +import com.subsidy.service.MemberService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 学生表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "学生表") +@RequestMapping("/member") +public class MemberController { + + @Autowired + private MemberService memberService; + + @PostMapping("getAll") + @ApiOperation("查询某部门成员 pageNum pageSize userName status") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){ + return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO)); + } + + @PostMapping("deleteMember") + @ApiOperation("删除成员 id ") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteMember(@RequestBody MemberDO memberDO){ + return ResponseData.generateCreatedResponse(0,memberService.deleteMember(memberDO)); + } + + @PostMapping("addMember") + @ApiOperation("新增成员 departmentId userName accountName telephone gender image idCard") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addMember(@RequestBody MemberDO memberDO){ + return ResponseData.generateCreatedResponse(0,memberService.addMember(memberDO)); + } + + @PostMapping("updateMember") + @ApiOperation("编辑成员 {id departmentId userName accountName telephone gender image idCard}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateMember(@RequestBody MemberDO memberDO){ + return ResponseData.generateCreatedResponse(0,memberService.updateMember(memberDO)); + } + + +} diff --git a/src/main/java/com/subsidy/controller/PermissionsDictController.java b/src/main/java/com/subsidy/controller/PermissionsDictController.java new file mode 100644 index 0000000..c257813 --- /dev/null +++ b/src/main/java/com/subsidy/controller/PermissionsDictController.java @@ -0,0 +1,22 @@ +package com.subsidy.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 权限表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "权限表") +@RequestMapping("/permissions-dict-do") +public class PermissionsDictController { + +} diff --git a/src/main/java/com/subsidy/controller/RoleAdministerMappingController.java b/src/main/java/com/subsidy/controller/RoleAdministerMappingController.java new file mode 100644 index 0000000..bfc1119 --- /dev/null +++ b/src/main/java/com/subsidy/controller/RoleAdministerMappingController.java @@ -0,0 +1,22 @@ +package com.subsidy.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "") +@RequestMapping("/role-administer-mapping-do") +public class RoleAdministerMappingController { + +} diff --git a/src/main/java/com/subsidy/controller/RoleDictController.java b/src/main/java/com/subsidy/controller/RoleDictController.java new file mode 100644 index 0000000..76b225c --- /dev/null +++ b/src/main/java/com/subsidy/controller/RoleDictController.java @@ -0,0 +1,22 @@ +package com.subsidy.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 角色表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "角色表") +@RequestMapping("/role-dict-do") +public class RoleDictController { + +} diff --git a/src/main/java/com/subsidy/controller/RolePermissionMappingController.java b/src/main/java/com/subsidy/controller/RolePermissionMappingController.java new file mode 100644 index 0000000..a17f192 --- /dev/null +++ b/src/main/java/com/subsidy/controller/RolePermissionMappingController.java @@ -0,0 +1,22 @@ +package com.subsidy.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 系统用户角色表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "系统用户角色表") +@RequestMapping("/role-permission-mapping-do") +public class RolePermissionMappingController { + +} diff --git a/src/main/java/com/subsidy/controller/VodDictController.java b/src/main/java/com/subsidy/controller/VodDictController.java new file mode 100644 index 0000000..7041430 --- /dev/null +++ b/src/main/java/com/subsidy/controller/VodDictController.java @@ -0,0 +1,70 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.model.VodDictDO; +import com.subsidy.service.VodDictService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 视频表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@RestController +@Api(tags = "视频表") +@RequestMapping("/vodDict") +public class VodDictController { + + @Autowired + private VodDictService vodDictService; + + @PostMapping("/signature") + @ApiOperation("获取签名") + public ResponseVO signature()throws Exception{ + return ResponseData.generateCreatedResponse(0,vodDictService.signature()); + } + + @PostMapping("getContendVods") + @ApiOperation("获取目录下的视频 {contentId vodName}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getContendVods(@RequestBody VodDictDO vodDictDO){ + return ResponseData.generateCreatedResponse(0,vodDictService.getContendVods(vodDictDO)); + } + + @PostMapping("deleteVod") + @ApiOperation("删除视频 id ") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteVod(@RequestBody VodDictDO vodDictDO){ + return ResponseData.generateCreatedResponse(0,vodDictService.deleteVod(vodDictDO)); + } + + @PostMapping("addVod") + @ApiOperation("新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addVod(@RequestBody VodDictDO vodDictDO){ + return ResponseData.generateCreatedResponse(0,vodDictService.addVod(vodDictDO)); + } + + @PostMapping("updateVod") + @ApiOperation("新增视频 id contentId vodName vodLength vodType vodSize vodUrl vodCode") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateVod(@RequestBody VodDictDO vodDictDO){ + return ResponseData.generateCreatedResponse(0,vodDictService.updateVod(vodDictDO)); + } + + +} diff --git a/src/main/java/com/subsidy/mapper/AdministerMapper.java b/src/main/java/com/subsidy/mapper/AdministerMapper.java new file mode 100644 index 0000000..97c91cb --- /dev/null +++ b/src/main/java/com/subsidy/mapper/AdministerMapper.java @@ -0,0 +1,28 @@ +package com.subsidy.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.administer.OperatorsDTO; +import com.subsidy.model.AdministerDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.administer.OperatorsVO; +import com.subsidy.vo.administer.PermissionsVO; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 管理平台用户 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Repository +public interface AdministerMapper extends BaseMapper { + + List getPermissions(Long id); + + IPage operators(IPage page,String accountType); + +} diff --git a/src/main/java/com/subsidy/mapper/CategoryMapper.java b/src/main/java/com/subsidy/mapper/CategoryMapper.java new file mode 100644 index 0000000..8835bd5 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/CategoryMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.CategoryDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 类目名称 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface CategoryMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/ClassDictMapper.java b/src/main/java/com/subsidy/mapper/ClassDictMapper.java new file mode 100644 index 0000000..3f23005 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/ClassDictMapper.java @@ -0,0 +1,23 @@ +package com.subsidy.mapper; + +import com.subsidy.model.ClassDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.classdict.GetAllClassesVO; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 班级id Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ + @Repository +public interface ClassDictMapper extends BaseMapper { + + List getAllClasses(ClassDictDO classDictDO); + +} diff --git a/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java b/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java new file mode 100644 index 0000000..fa258cb --- /dev/null +++ b/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.ClassMemberMappingDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 班级成员映射表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ + @Repository +public interface ClassMemberMappingMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/CourseContentMapper.java b/src/main/java/com/subsidy/mapper/CourseContentMapper.java new file mode 100644 index 0000000..66db80e --- /dev/null +++ b/src/main/java/com/subsidy/mapper/CourseContentMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.CourseContentDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 课程目录表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface CourseContentMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/CourseDictMapper.java b/src/main/java/com/subsidy/mapper/CourseDictMapper.java new file mode 100644 index 0000000..e83ae3f --- /dev/null +++ b/src/main/java/com/subsidy/mapper/CourseDictMapper.java @@ -0,0 +1,23 @@ +package com.subsidy.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.model.CourseDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Repository +public interface CourseDictMapper extends BaseMapper { + + IPage queryCourses(IPage page,String courseName,Long categoryId,String courseType,String courseSource); + +} diff --git a/src/main/java/com/subsidy/mapper/DepartmentDictMapper.java b/src/main/java/com/subsidy/mapper/DepartmentDictMapper.java new file mode 100644 index 0000000..7824003 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/DepartmentDictMapper.java @@ -0,0 +1,24 @@ +package com.subsidy.mapper; + +import com.subsidy.dto.department.GetDepartmentsVO; +import com.subsidy.model.DepartmentDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 部门字典表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Repository +public interface DepartmentDictMapper extends BaseMapper { + + List getDepartments(DepartmentDictDO departmentDictDO); + + +} diff --git a/src/main/java/com/subsidy/mapper/ExerciseDictMapper.java b/src/main/java/com/subsidy/mapper/ExerciseDictMapper.java new file mode 100644 index 0000000..8fa63fa --- /dev/null +++ b/src/main/java/com/subsidy/mapper/ExerciseDictMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.ExerciseDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 习题库 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ + @Repository +public interface ExerciseDictMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/FileDictMapper.java b/src/main/java/com/subsidy/mapper/FileDictMapper.java new file mode 100644 index 0000000..4ee1912 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/FileDictMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.FileDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 课件表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface FileDictMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/MemberMapper.java b/src/main/java/com/subsidy/mapper/MemberMapper.java new file mode 100644 index 0000000..eedc04c --- /dev/null +++ b/src/main/java/com/subsidy/mapper/MemberMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.MemberDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 学生表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface MemberMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/PermissionsDictMapper.java b/src/main/java/com/subsidy/mapper/PermissionsDictMapper.java new file mode 100644 index 0000000..2febf3c --- /dev/null +++ b/src/main/java/com/subsidy/mapper/PermissionsDictMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.PermissionsDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 权限表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface PermissionsDictMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java b/src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java new file mode 100644 index 0000000..f1c3259 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.RoleAdministerMappingDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface RoleAdministerMappingMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/RoleDictMapper.java b/src/main/java/com/subsidy/mapper/RoleDictMapper.java new file mode 100644 index 0000000..931c13e --- /dev/null +++ b/src/main/java/com/subsidy/mapper/RoleDictMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.RoleDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 角色表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface RoleDictMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/RolePermissionMappingMapper.java b/src/main/java/com/subsidy/mapper/RolePermissionMappingMapper.java new file mode 100644 index 0000000..c39ed50 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/RolePermissionMappingMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.RolePermissionMappingDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 系统用户角色表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ + @Repository +public interface RolePermissionMappingMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/VodDictMapper.java b/src/main/java/com/subsidy/mapper/VodDictMapper.java new file mode 100644 index 0000000..fdd5e00 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/VodDictMapper.java @@ -0,0 +1,22 @@ +package com.subsidy.mapper; + +import com.subsidy.model.VodDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.vod.GetContendVodsVO; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 视频表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Repository +public interface VodDictMapper extends BaseMapper { + + List getContendVods(VodDictDO vodDictDO); +} diff --git a/src/main/java/com/subsidy/model/AdministerDO.java b/src/main/java/com/subsidy/model/AdministerDO.java new file mode 100644 index 0000000..6cf32d7 --- /dev/null +++ b/src/main/java/com/subsidy/model/AdministerDO.java @@ -0,0 +1,77 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 管理平台用户 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("administer") +public class AdministerDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 手机号/企业账号 + */ + private String telephone; + + /** + * 密码 + */ + private String password; + + /** + * 成员名称/企业名称 + */ + private String userName; + + /** + * 简称 + */ + private String shortName; + + /** + * 头像 + */ + private String img; + + /** + * 标语 + */ + private String banner; + + /** + * 1:启用 0:禁用 + */ + private String status; + + /** + * 领域 + */ + private String field; + + /** + * 账户类型 + */ + private String accountType; + + +} diff --git a/src/main/java/com/subsidy/model/CategoryDO.java b/src/main/java/com/subsidy/model/CategoryDO.java new file mode 100644 index 0000000..c8bec80 --- /dev/null +++ b/src/main/java/com/subsidy/model/CategoryDO.java @@ -0,0 +1,34 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 类目名称 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("category") +public class CategoryDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 类目名称 + */ + private String name; + + +} diff --git a/src/main/java/com/subsidy/model/ClassDictDO.java b/src/main/java/com/subsidy/model/ClassDictDO.java new file mode 100644 index 0000000..573e509 --- /dev/null +++ b/src/main/java/com/subsidy/model/ClassDictDO.java @@ -0,0 +1,49 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 班级id + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("class_dict") +public class ClassDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业id + */ + private Long companyId; + + /** + * 班级名称 + */ + private String className; + + /** + * 课程id + */ + private Long courseId; + + private LocalDateTime startDate; + + private LocalDateTime endDate; + + +} diff --git a/src/main/java/com/subsidy/model/ClassMemberMappingDO.java b/src/main/java/com/subsidy/model/ClassMemberMappingDO.java new file mode 100644 index 0000000..db0dec8 --- /dev/null +++ b/src/main/java/com/subsidy/model/ClassMemberMappingDO.java @@ -0,0 +1,36 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 班级成员映射表 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("class_member_mapping") +public class ClassMemberMappingDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 成员id + */ + private Long memberId; + + /** + * 班级id + */ + private Long classId; + + +} diff --git a/src/main/java/com/subsidy/model/CourseContentDO.java b/src/main/java/com/subsidy/model/CourseContentDO.java new file mode 100644 index 0000000..e07f57b --- /dev/null +++ b/src/main/java/com/subsidy/model/CourseContentDO.java @@ -0,0 +1,38 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 课程目录表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("course_content") +public class CourseContentDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + private Long id; + + private Long courseId; + + /** + * 目录 + */ + private String content; + + /** + * 排序 + */ + private Integer orderNo; + + +} diff --git a/src/main/java/com/subsidy/model/CourseDictDO.java b/src/main/java/com/subsidy/model/CourseDictDO.java new file mode 100644 index 0000000..de5fe9f --- /dev/null +++ b/src/main/java/com/subsidy/model/CourseDictDO.java @@ -0,0 +1,49 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("course_dict") +public class CourseDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 课程名称 + */ + private String courseName; + + /** + * 类目id + */ + private Long categoryId; + + /** + * 课程类型 + */ + private String courseType; + + /** + * 课程来源 + */ + private String courseSource; + + +} diff --git a/src/main/java/com/subsidy/model/DepartmentDictDO.java b/src/main/java/com/subsidy/model/DepartmentDictDO.java new file mode 100644 index 0000000..2f34ede --- /dev/null +++ b/src/main/java/com/subsidy/model/DepartmentDictDO.java @@ -0,0 +1,57 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 部门字典表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("departmentDict") +public class DepartmentDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业id + */ + private Long companyId; + + /** + * 部门名称 + */ + private String departmentName; + + /** + * 部门负责人id + */ + private String leaderName; + + /** + * 父节点id + */ + private Long parentId; + + /** + * 为写程序方便,数据库里为null + */ + private String children; + + +} diff --git a/src/main/java/com/subsidy/model/ExerciseDictDO.java b/src/main/java/com/subsidy/model/ExerciseDictDO.java new file mode 100644 index 0000000..05347d8 --- /dev/null +++ b/src/main/java/com/subsidy/model/ExerciseDictDO.java @@ -0,0 +1,69 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 习题库 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("exercise_dict") +public class ExerciseDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 题目类型:单选/多选/是非 + */ + private String exerciseType; + + /** + * 课程id + */ + private Long courseId; + + /** + * 难度:容易/适中/困难 + */ + private String difficulty; + + /** + * 题目 + */ + private String title; + + /** + * 选项 + */ + private String items; + + /** + * 正确答案 + */ + private String rightAnswer; + + /** + * 解析 + */ + private String detail; + + /** + * 排序 + */ + private Integer orderNo; + + +} diff --git a/src/main/java/com/subsidy/model/FileDictDO.java b/src/main/java/com/subsidy/model/FileDictDO.java new file mode 100644 index 0000000..1b75394 --- /dev/null +++ b/src/main/java/com/subsidy/model/FileDictDO.java @@ -0,0 +1,49 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 课件表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("file_dict") +public class FileDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 目录id + */ + private Long contentId; + + /** + * 文件名称 + */ + private String fileName; + + /** + * 文件大小 + */ + private String fileSize; + + /** + * 排序 + */ + private Integer orderNo; + + +} diff --git a/src/main/java/com/subsidy/model/MemberDO.java b/src/main/java/com/subsidy/model/MemberDO.java new file mode 100644 index 0000000..6212c79 --- /dev/null +++ b/src/main/java/com/subsidy/model/MemberDO.java @@ -0,0 +1,74 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 学生表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("member") +public class MemberDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 部门id + */ + private Long departmentId; + + /** + * 账号 + */ + private String accountName; + + /** + * 姓名 + */ + private String userName; + + /** + * 手机号 + */ + private String telephone; + + /** + * 密码 + */ + private String password; + + /** + * 性别 + */ + private String gender; + + /** + * 头像 + */ + private String image; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 状态 + */ + private String status; + + +} diff --git a/src/main/java/com/subsidy/model/PermissionsDictDO.java b/src/main/java/com/subsidy/model/PermissionsDictDO.java new file mode 100644 index 0000000..7bcbbd3 --- /dev/null +++ b/src/main/java/com/subsidy/model/PermissionsDictDO.java @@ -0,0 +1,41 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 权限表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("permissions_dict") +public class PermissionsDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 父级ID + */ + private Long parentId; + + /** + * 名称 + */ + private String name; + + private String children; + + +} diff --git a/src/main/java/com/subsidy/model/RoleAdministerMappingDO.java b/src/main/java/com/subsidy/model/RoleAdministerMappingDO.java new file mode 100644 index 0000000..34e957b --- /dev/null +++ b/src/main/java/com/subsidy/model/RoleAdministerMappingDO.java @@ -0,0 +1,33 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("role_administer_mapping") +public class RoleAdministerMappingDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long administerId; + + private Long roleId; + + +} diff --git a/src/main/java/com/subsidy/model/RoleDictDO.java b/src/main/java/com/subsidy/model/RoleDictDO.java new file mode 100644 index 0000000..6246c5d --- /dev/null +++ b/src/main/java/com/subsidy/model/RoleDictDO.java @@ -0,0 +1,34 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 角色表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("role_dict") +public class RoleDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 角色 + */ + private String role; + + +} diff --git a/src/main/java/com/subsidy/model/RolePermissionMappingDO.java b/src/main/java/com/subsidy/model/RolePermissionMappingDO.java new file mode 100644 index 0000000..24d494a --- /dev/null +++ b/src/main/java/com/subsidy/model/RolePermissionMappingDO.java @@ -0,0 +1,39 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 系统用户角色表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("role_permission_mapping") +public class RolePermissionMappingDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 权限ID + */ + private Long roleId; + + /** + * 角色ID + */ + private Long permissionId; + + +} diff --git a/src/main/java/com/subsidy/model/VodDictDO.java b/src/main/java/com/subsidy/model/VodDictDO.java new file mode 100644 index 0000000..d684161 --- /dev/null +++ b/src/main/java/com/subsidy/model/VodDictDO.java @@ -0,0 +1,64 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 视频表 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("vod_dict") +public class VodDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 目录id + */ + private Long contentId; + + /** + * 视频名称 + */ + private String vodName; + + /** + * 视频时长 + */ + private Integer vodLength; + + /** + * 视频格式 + */ + private String vodType; + + /** + * 视频大小 + */ + private String vodSize; + + /** + * 视频地址 + */ + private String vodUrl; + + /** + * 视频编码 + */ + private String vodCode; + + +} diff --git a/src/main/java/com/subsidy/service/AdministerService.java b/src/main/java/com/subsidy/service/AdministerService.java new file mode 100644 index 0000000..938d30f --- /dev/null +++ b/src/main/java/com/subsidy/service/AdministerService.java @@ -0,0 +1,35 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.administer.OperatorsDTO; +import com.subsidy.model.AdministerDO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.administer.AdministerPermissionVO; +import com.subsidy.vo.administer.LoginVO; +import com.subsidy.vo.administer.OperatorsVO; + +import java.util.List; + +/** + *

+ * 管理平台用户 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface AdministerService extends IService { + + LoginVO login(AdministerDO administerDO); + + AdministerPermissionVO getPermissions(); + + IPage operators(OperatorsDTO operatorsDTO); + + String addOperator(AdministerDO administerDO); + + String deleteAdminister(AdministerDO administerDO); + + String updateAdminister(AdministerDO administerDO); + +} diff --git a/src/main/java/com/subsidy/service/CategoryService.java b/src/main/java/com/subsidy/service/CategoryService.java new file mode 100644 index 0000000..034a526 --- /dev/null +++ b/src/main/java/com/subsidy/service/CategoryService.java @@ -0,0 +1,29 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.category.GetCategoriesDTO; +import com.subsidy.model.CategoryDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 类目名称 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface CategoryService extends IService { + + IPage getCategories(GetCategoriesDTO getCategoriesDTO); + + List getAll(); + + String addCategory(CategoryDO categoryDO); + + String deleteCategory(CategoryDO categoryDO); + + String updateCategory(CategoryDO categoryDO); +} diff --git a/src/main/java/com/subsidy/service/ClassDictService.java b/src/main/java/com/subsidy/service/ClassDictService.java new file mode 100644 index 0000000..b701ab6 --- /dev/null +++ b/src/main/java/com/subsidy/service/ClassDictService.java @@ -0,0 +1,27 @@ +package com.subsidy.service; + +import com.subsidy.model.ClassDictDO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.classdict.GetAllClassesVO; + +import java.util.List; + +/** + *

+ * 班级id 服务类 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +public interface ClassDictService extends IService { + + List getAllClasses(ClassDictDO classDictDO); + + String deleteClasses(ClassDictDO classDictDO); + + String addClass(ClassDictDO classDictDO); + + String updateClass(ClassDictDO classDictDO); + +} diff --git a/src/main/java/com/subsidy/service/ClassMemberMappingService.java b/src/main/java/com/subsidy/service/ClassMemberMappingService.java new file mode 100644 index 0000000..e5e7430 --- /dev/null +++ b/src/main/java/com/subsidy/service/ClassMemberMappingService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.ClassMemberMappingDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 班级成员映射表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +public interface ClassMemberMappingService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/CourseContentService.java b/src/main/java/com/subsidy/service/CourseContentService.java new file mode 100644 index 0000000..2ccc299 --- /dev/null +++ b/src/main/java/com/subsidy/service/CourseContentService.java @@ -0,0 +1,25 @@ +package com.subsidy.service; + +import com.subsidy.controller.CourseDictController; +import com.subsidy.model.CourseContentDO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.model.CourseDictDO; +import com.subsidy.model.VodDictDO; +import com.subsidy.vo.vod.GetContendVodsVO; + +import java.util.List; + +/** + *

+ * 课程目录表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface CourseContentService extends IService { + + List getContents(CourseContentDO courseContentDO); + + +} diff --git a/src/main/java/com/subsidy/service/CourseDictService.java b/src/main/java/com/subsidy/service/CourseDictService.java new file mode 100644 index 0000000..ddb7f61 --- /dev/null +++ b/src/main/java/com/subsidy/service/CourseDictService.java @@ -0,0 +1,25 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.course.QueryCoursesDTO; +import com.subsidy.model.CourseDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface CourseDictService extends IService { + + String addCourse(CourseDictDO courseDictDO); + + String deleteCourse(CourseDictDO courseDictDO); + + IPage queryCourses(QueryCoursesDTO queryCoursesDTO); + + String updateCourses(CourseDictDO courseDictDO); +} diff --git a/src/main/java/com/subsidy/service/DepartmentDictService.java b/src/main/java/com/subsidy/service/DepartmentDictService.java new file mode 100644 index 0000000..be78168 --- /dev/null +++ b/src/main/java/com/subsidy/service/DepartmentDictService.java @@ -0,0 +1,26 @@ +package com.subsidy.service; + +import com.subsidy.dto.department.GetDepartmentsVO; +import com.subsidy.model.DepartmentDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 部门字典表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface DepartmentDictService extends IService { + + List getDepartments(DepartmentDictDO departmentDictDO); + + String addDepartment(DepartmentDictDO departmentDictDO); + + String deleteDepartment(DepartmentDictDO departmentDictDO); + + String updateDepartment(DepartmentDictDO departmentDictDO); +} diff --git a/src/main/java/com/subsidy/service/ExerciseDictService.java b/src/main/java/com/subsidy/service/ExerciseDictService.java new file mode 100644 index 0000000..f0346d5 --- /dev/null +++ b/src/main/java/com/subsidy/service/ExerciseDictService.java @@ -0,0 +1,27 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.exercise.GetAllExercisesDTO; +import com.subsidy.model.ExerciseDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 习题库 服务类 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +public interface ExerciseDictService extends IService { + + IPage getAllExercises(GetAllExercisesDTO getAllExercisesDTO); + + String addExercise(ExerciseDictDO exerciseDictDO); + + String deleteExercise(ExerciseDictDO exerciseDictDO); + + String updateExercise(ExerciseDictDO exerciseDictDO); +} diff --git a/src/main/java/com/subsidy/service/FileDictService.java b/src/main/java/com/subsidy/service/FileDictService.java new file mode 100644 index 0000000..29a8f71 --- /dev/null +++ b/src/main/java/com/subsidy/service/FileDictService.java @@ -0,0 +1,26 @@ +package com.subsidy.service; + +import com.subsidy.model.FileDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 课件表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface FileDictService extends IService { + + List getContendFiles(FileDictDO fileDictDO); + + String deleteFile(FileDictDO fileDictDO); + + String addFile(FileDictDO fileDictDO); + + String updateFile(FileDictDO fileDictDO); + +} diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java new file mode 100644 index 0000000..d6982f5 --- /dev/null +++ b/src/main/java/com/subsidy/service/MemberService.java @@ -0,0 +1,26 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.model.MemberDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 学生表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface MemberService extends IService { + + IPage getAll(GetAllDTO getAllDTO); + + String deleteMember(MemberDO memberDO); + + String addMember(MemberDO memberDO); + + String updateMember(MemberDO memberDO); + +} diff --git a/src/main/java/com/subsidy/service/PermissionsDictService.java b/src/main/java/com/subsidy/service/PermissionsDictService.java new file mode 100644 index 0000000..5599332 --- /dev/null +++ b/src/main/java/com/subsidy/service/PermissionsDictService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.PermissionsDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 权限表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface PermissionsDictService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/RoleAdministerMappingService.java b/src/main/java/com/subsidy/service/RoleAdministerMappingService.java new file mode 100644 index 0000000..22089da --- /dev/null +++ b/src/main/java/com/subsidy/service/RoleAdministerMappingService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.RoleAdministerMappingDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface RoleAdministerMappingService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/RoleDictService.java b/src/main/java/com/subsidy/service/RoleDictService.java new file mode 100644 index 0000000..757a2d8 --- /dev/null +++ b/src/main/java/com/subsidy/service/RoleDictService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.RoleDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 角色表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface RoleDictService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/RolePermissionMappingService.java b/src/main/java/com/subsidy/service/RolePermissionMappingService.java new file mode 100644 index 0000000..dfedd54 --- /dev/null +++ b/src/main/java/com/subsidy/service/RolePermissionMappingService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.RolePermissionMappingDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 系统用户角色表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface RolePermissionMappingService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/VodDictService.java b/src/main/java/com/subsidy/service/VodDictService.java new file mode 100644 index 0000000..ac16676 --- /dev/null +++ b/src/main/java/com/subsidy/service/VodDictService.java @@ -0,0 +1,29 @@ +package com.subsidy.service; + +import com.subsidy.model.VodDictDO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.vod.GetContendVodsVO; +import com.subsidy.vo.vod.SignatureVO; + +import java.util.List; + +/** + *

+ * 视频表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +public interface VodDictService extends IService { + + SignatureVO signature()throws Exception; + + List getContendVods(VodDictDO vodDictDO); + + String deleteVod(VodDictDO vodDictDO); + + String addVod(VodDictDO vodDictDO); + + String updateVod(VodDictDO vodDictDO); +} diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java new file mode 100644 index 0000000..4f6ee3a --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -0,0 +1,126 @@ +package com.subsidy.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.subsidy.common.exception.HttpException; +import com.subsidy.dto.administer.OperatorsDTO; +import com.subsidy.model.AdministerDO; +import com.subsidy.mapper.AdministerMapper; +import com.subsidy.model.RoleAdministerMappingDO; +import com.subsidy.service.AdministerService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import com.subsidy.util.JwtUtil; +import com.subsidy.util.Localstorage; +import com.subsidy.vo.administer.AdministerPermissionVO; +import com.subsidy.vo.administer.LoginVO; +import com.subsidy.vo.administer.OperatorsVO; +import com.subsidy.vo.administer.PermissionsVO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 管理平台用户 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class AdministerServiceImpl extends ServiceImpl implements AdministerService { + + + public LoginVO login(AdministerDO administerDO) { + + LoginVO loginVO = new LoginVO(); + + AdministerDO administerDO1 = this.baseMapper.selectOne(new QueryWrapper() + .lambda() + .eq(AdministerDO::getTelephone, administerDO.getTelephone())); + + if (null != administerDO1) { + if (administerDO.getPassword().equals(administerDO1.getPassword())) { + String token = JwtUtil.generateToken(administerDO.getId(), ConstantUtils.ADMINISTER_TERMINATE); + loginVO.setToken(token); + return loginVO; + }else { + throw new HttpException(10004); + } + } else { + throw new HttpException(10011); + } + } + + public AdministerPermissionVO getPermissions() { + + AdministerPermissionVO administerPermissionVO = new AdministerPermissionVO(); + AdministerDO administerDO = (AdministerDO) Localstorage.getUser(); + if (administerDO == null) { + throw new HttpException(10012); + } + BeanUtils.copyProperties(administerDO, administerPermissionVO); + + List list = this.baseMapper.getPermissions(administerDO.getId()); + List treeList = new ArrayList(); + if (list != null) { + list.forEach(permission -> { + if (permission.getParentId() == null) { + treeList.add(permission); + } + + list.forEach(p -> { + if (null != p.getParentId() && p.getParentId().equals(permission.getId())) { + if (permission.getChildren() == null) { + permission.setChildren(new ArrayList<>()); + } + permission.getChildren().add(p); + } + }); + }); + } + administerPermissionVO.setPermissions(treeList); + return administerPermissionVO; + } + + public IPage operators(OperatorsDTO operatorsDTO){ + Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); + return this.baseMapper.operators(pager,operatorsDTO.getAccountType()); + } + + public String addOperator(AdministerDO administerDO){ + + Integer count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AdministerDO::getAccountType,administerDO.getAccountType()) + .eq(AdministerDO::getTelephone,administerDO.getTelephone())); + + if (count>0){ + throw new HttpException(10014); + } + + administerDO.setPassword("admin123"); + administerDO.setStatus("1"); + this.baseMapper.insert(administerDO); + + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteAdminister(AdministerDO administerDO){ + this.baseMapper.deleteById(administerDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateAdminister(AdministerDO administerDO){ + this.baseMapper.updateById(administerDO); + return ConstantUtils.SET_SUCCESS; + } + + +} diff --git a/src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java new file mode 100644 index 0000000..97604dd --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java @@ -0,0 +1,74 @@ +package com.subsidy.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.subsidy.common.exception.HttpException; +import com.subsidy.dto.category.GetCategoriesDTO; +import com.subsidy.model.CategoryDO; +import com.subsidy.mapper.CategoryMapper; +import com.subsidy.service.CategoryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 类目名称 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class CategoryServiceImpl extends ServiceImpl implements CategoryService { + + public IPage getCategories(GetCategoriesDTO getCategoriesDTO){ + Page pager = new Page(getCategoriesDTO.getPageNum(), getCategoriesDTO.getPageSize()); + return this.baseMapper.selectPage(pager,new QueryWrapper() + .lambda() + .like(CategoryDO::getName,getCategoriesDTO.getName())); + } + + public List getAll(){ + return this.baseMapper.selectList(null); + } + + + public String addCategory(CategoryDO categoryDO){ + + Integer count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CategoryDO::getName,categoryDO.getName())); + + if (count > 0 ){ + throw new HttpException(90001); + } + this.baseMapper.insert(categoryDO); + + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteCategory(CategoryDO categoryDO){ + this.baseMapper.deleteById(categoryDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateCategory(CategoryDO categoryDO){ + + int count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CategoryDO::getName,categoryDO.getName())); + + if (count>2){ + throw new HttpException(90001); + } + + this.baseMapper.updateById(categoryDO); + return ConstantUtils.SET_SUCCESS; + } + + +} diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java new file mode 100644 index 0000000..c07ef76 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java @@ -0,0 +1,56 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.mapper.ClassMemberMappingMapper; +import com.subsidy.model.ClassDictDO; +import com.subsidy.mapper.ClassDictMapper; +import com.subsidy.model.ClassMemberMappingDO; +import com.subsidy.service.ClassDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import com.subsidy.vo.classdict.GetAllClassesVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + *

+ * 班级id 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@Service +public class ClassDictServiceImpl extends ServiceImpl implements ClassDictService { + + @Autowired + private ClassMemberMappingMapper classMemberMappingMapper; + + public List getAllClasses(ClassDictDO classDictDO){ + return this.baseMapper.getAllClasses(classDictDO); + } + + @Transactional + public String deleteClasses(ClassDictDO classDictDO){ + this.baseMapper.deleteById(classDictDO.getId()); + + classMemberMappingMapper.delete(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId,classDictDO.getId())); + return ConstantUtils.DELETE_SUCCESS; + } + + public String addClass(ClassDictDO classDictDO){ + this.baseMapper.insert(classDictDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String updateClass(ClassDictDO classDictDO){ + this.baseMapper.updateById(classDictDO); + return ConstantUtils.SET_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java new file mode 100644 index 0000000..e0947c6 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java @@ -0,0 +1,20 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.ClassMemberMappingDO; +import com.subsidy.mapper.ClassMemberMappingMapper; +import com.subsidy.service.ClassMemberMappingService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 班级成员映射表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@Service +public class ClassMemberMappingServiceImpl extends ServiceImpl implements ClassMemberMappingService { + +} diff --git a/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java new file mode 100644 index 0000000..8008bc9 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java @@ -0,0 +1,42 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.controller.CourseContentController; +import com.subsidy.mapper.VodDictMapper; +import com.subsidy.model.CourseContentDO; +import com.subsidy.mapper.CourseContentMapper; +import com.subsidy.model.CourseDictDO; +import com.subsidy.model.VodDictDO; +import com.subsidy.service.CourseContentService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import com.subsidy.vo.vod.GetContendVodsVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 课程目录表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class CourseContentServiceImpl extends ServiceImpl implements CourseContentService { + + @Autowired + private VodDictMapper vodDictMapper; + + public List getContents(CourseContentDO courseContentDO) { + return this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(CourseContentDO::getCourseId, courseContentDO.getCourseId()) + .orderByAsc(CourseContentDO::getOrderNo) + .orderByAsc(CourseContentDO::getCreateDate)); + } + + +} diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java new file mode 100644 index 0000000..073d3f7 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java @@ -0,0 +1,63 @@ +package com.subsidy.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.subsidy.common.exception.HttpException; +import com.subsidy.dto.course.QueryCoursesDTO; +import com.subsidy.model.CourseDictDO; +import com.subsidy.mapper.CourseDictMapper; +import com.subsidy.service.CourseDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class CourseDictServiceImpl extends ServiceImpl implements CourseDictService { + + public String addCourse(CourseDictDO courseDictDO){ + + int count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CourseDictDO::getCourseName,courseDictDO.getCourseName())); + + if (count >0){ + throw new HttpException(20001); + } + + this.baseMapper.insert(courseDictDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteCourse(CourseDictDO courseDictDO){ + this.baseMapper.deleteById(courseDictDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public IPage queryCourses(QueryCoursesDTO queryCoursesDTO){ + Page pager = new Page(queryCoursesDTO.getPageNum(), queryCoursesDTO.getPageSize()); + return this.baseMapper.queryCourses(pager,queryCoursesDTO.getCourseName(),queryCoursesDTO.getCategoryId(),queryCoursesDTO.getCourseType(),queryCoursesDTO.getCourseSource()); + } + + public String updateCourses(CourseDictDO courseDictDO){ + int count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CourseDictDO::getCourseName,courseDictDO.getCourseName())); + + if (count >1){ + throw new HttpException(20001); + } + + this.baseMapper.updateById(courseDictDO); + return ConstantUtils.DELETE_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java new file mode 100644 index 0000000..efc172a --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java @@ -0,0 +1,68 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.common.exception.HttpException; +import com.subsidy.dto.department.GetDepartmentsVO; +import com.subsidy.model.DepartmentDictDO; +import com.subsidy.mapper.DepartmentDictMapper; +import com.subsidy.service.DepartmentDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 部门字典表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class DepartmentDictServiceImpl extends ServiceImpl implements DepartmentDictService { + + + public List getDepartments(DepartmentDictDO departmentDictDO) { + return this.baseMapper.getDepartments(departmentDictDO); + } + + public String addDepartment(DepartmentDictDO departmentDictDO) { + + Integer counter = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId()) + .eq(DepartmentDictDO::getDepartmentName, departmentDictDO.getDepartmentName())); + + if (counter > 0) { + throw new HttpException(30001); + } + + this.baseMapper.insert(departmentDictDO); + + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteDepartment(DepartmentDictDO departmentDictDO) { + this.baseMapper.deleteById(departmentDictDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateDepartment(DepartmentDictDO departmentDictDO) { + + Integer counter = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId()) + .eq(DepartmentDictDO::getDepartmentName, departmentDictDO.getDepartmentName()) + .ne(DepartmentDictDO::getId, departmentDictDO.getId())); + + if (counter > 0) { + throw new HttpException(30001); + } + + this.baseMapper.updateById(departmentDictDO); + return ConstantUtils.SET_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java new file mode 100644 index 0000000..6473d47 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java @@ -0,0 +1,68 @@ +package com.subsidy.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.subsidy.dto.exercise.GetAllExercisesDTO; +import com.subsidy.model.ExerciseDictDO; +import com.subsidy.mapper.ExerciseDictMapper; +import com.subsidy.service.ExerciseDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.apache.tomcat.util.bcel.Const; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 习题库 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-12 + */ +@Service +public class ExerciseDictServiceImpl extends ServiceImpl implements ExerciseDictService { + + public IPage getAllExercises(GetAllExercisesDTO getAllExercisesDTO) { + + Page pager = new Page(getAllExercisesDTO.getPageNum(), getAllExercisesDTO.getPageSize()); + + return this.baseMapper.selectPage(pager, new QueryWrapper() + .lambda() + .eq(ExerciseDictDO::getCourseId, getAllExercisesDTO.getCourseId()) + .like(ExerciseDictDO::getDifficulty, getAllExercisesDTO.getDifficulty()) + .like(ExerciseDictDO::getExerciseType, getAllExercisesDTO.getExerciseType()) + .like(ExerciseDictDO::getTitle, getAllExercisesDTO.getExerciseType()) + .orderByAsc(ExerciseDictDO::getOrderNo)); + } + + public String addExercise(ExerciseDictDO exerciseDictDO){ + + List exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(ExerciseDictDO::getCourseId,exerciseDictDO.getCourseId()) + .orderByDesc(ExerciseDictDO::getOrderNo)); + + int orderNo = 1; + + if (exerciseDictDOS.size() >0){ + orderNo = exerciseDictDOS.get(0).getOrderNo()+1; + } + exerciseDictDO.setOrderNo(orderNo); + this.baseMapper.insert(exerciseDictDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteExercise(ExerciseDictDO exerciseDictDO){ + this.baseMapper.deleteById(exerciseDictDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateExercise(ExerciseDictDO exerciseDictDO){ + this.baseMapper.updateById(exerciseDictDO); + return ConstantUtils.SET_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java new file mode 100644 index 0000000..7619ebf --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java @@ -0,0 +1,48 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.model.FileDictDO; +import com.subsidy.mapper.FileDictMapper; +import com.subsidy.model.VodDictDO; +import com.subsidy.service.FileDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import com.subsidy.vo.vod.GetContendVodsVO; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 课件表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class FileDictServiceImpl extends ServiceImpl implements FileDictService { + + public List getContendFiles(FileDictDO fileDictDO) { + return this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(FileDictDO::getContentId,fileDictDO.getContentId()) + .like(FileDictDO::getFileName,fileDictDO.getFileName())); + } + + public String deleteFile(FileDictDO fileDictDO) { + this.baseMapper.deleteById(fileDictDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String addFile(FileDictDO fileDictDO) { + this.baseMapper.insert(fileDictDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String updateFile(FileDictDO fileDictDO) { + this.baseMapper.updateById(fileDictDO); + return ConstantUtils.SET_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java new file mode 100644 index 0000000..2ec38f9 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -0,0 +1,90 @@ +package com.subsidy.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.subsidy.common.exception.HttpException; +import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.model.MemberDO; +import com.subsidy.mapper.MemberMapper; +import com.subsidy.service.MemberService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.springframework.stereotype.Service; + +/** + *

+ * 学生表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class MemberServiceImpl extends ServiceImpl implements MemberService { + + public IPage getAll(GetAllDTO getAllDTO) { + Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); + return this.baseMapper.selectPage(pager, new QueryWrapper() + .lambda() + .like(MemberDO::getUserName, getAllDTO.getUserName()) + .like(MemberDO::getStatus, getAllDTO.getStatus())); + } + + public String deleteMember(MemberDO memberDO) { + this.baseMapper.deleteById(memberDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String addMember(MemberDO memberDO) { + + Integer count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(MemberDO::getTelephone, memberDO.getTelephone()) + .eq(MemberDO::getDepartmentId, memberDO.getDepartmentId())); + + if (count > 0) { + throw new HttpException(20002); + } + + Integer count1 = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(MemberDO::getIdCard, memberDO.getIdCard()) + .eq(MemberDO::getDepartmentId, memberDO.getDepartmentId())); + + if (count1 > 0) { + throw new HttpException(20002); + } + + memberDO.setPassword("123456"); + memberDO.setStatus("启用"); + this.baseMapper.insert(memberDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String updateMember(MemberDO memberDO) { + + Integer count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(MemberDO::getTelephone, memberDO.getTelephone()) + .eq(MemberDO::getDepartmentId, memberDO.getDepartmentId()) + .ne(MemberDO::getId, memberDO.getId())); + + if (count > 0) { + throw new HttpException(20002); + } + + Integer count1 = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(MemberDO::getIdCard, memberDO.getIdCard()) + .eq(MemberDO::getDepartmentId, memberDO.getDepartmentId()) + .ne(MemberDO::getId, memberDO.getId())); + + if (count1 > 0) { + throw new HttpException(20002); + } + this.baseMapper.updateById(memberDO); + return ConstantUtils.SET_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/PermissionsDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/PermissionsDictServiceImpl.java new file mode 100644 index 0000000..42f5f20 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/PermissionsDictServiceImpl.java @@ -0,0 +1,20 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.PermissionsDictDO; +import com.subsidy.mapper.PermissionsDictMapper; +import com.subsidy.service.PermissionsDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 权限表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class PermissionsDictServiceImpl extends ServiceImpl implements PermissionsDictService { + +} diff --git a/src/main/java/com/subsidy/service/impl/RoleAdministerMappingServiceImpl.java b/src/main/java/com/subsidy/service/impl/RoleAdministerMappingServiceImpl.java new file mode 100644 index 0000000..8c3ba95 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/RoleAdministerMappingServiceImpl.java @@ -0,0 +1,20 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.RoleAdministerMappingDO; +import com.subsidy.mapper.RoleAdministerMappingMapper; +import com.subsidy.service.RoleAdministerMappingService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class RoleAdministerMappingServiceImpl extends ServiceImpl implements RoleAdministerMappingService { + +} diff --git a/src/main/java/com/subsidy/service/impl/RoleDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/RoleDictServiceImpl.java new file mode 100644 index 0000000..772bff8 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/RoleDictServiceImpl.java @@ -0,0 +1,20 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.RoleDictDO; +import com.subsidy.mapper.RoleDictMapper; +import com.subsidy.service.RoleDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 角色表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class RoleDictServiceImpl extends ServiceImpl implements RoleDictService { + +} diff --git a/src/main/java/com/subsidy/service/impl/RolePermissionMappingServiceImpl.java b/src/main/java/com/subsidy/service/impl/RolePermissionMappingServiceImpl.java new file mode 100644 index 0000000..6c33b85 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/RolePermissionMappingServiceImpl.java @@ -0,0 +1,20 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.RolePermissionMappingDO; +import com.subsidy.mapper.RolePermissionMappingMapper; +import com.subsidy.service.RolePermissionMappingService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 系统用户角色表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class RolePermissionMappingServiceImpl extends ServiceImpl implements RolePermissionMappingService { + +} diff --git a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java new file mode 100644 index 0000000..df13404 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java @@ -0,0 +1,76 @@ +package com.subsidy.service.impl; + +import com.subsidy.common.configure.VODConfig; +import com.subsidy.model.VodDictDO; +import com.subsidy.mapper.VodDictMapper; +import com.subsidy.service.VodDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import com.subsidy.util.Signature; +import com.subsidy.vo.vod.GetContendVodsVO; +import com.subsidy.vo.vod.SignatureVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Random; + +/** + *

+ * 视频表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-11 + */ +@Service +public class VodDictServiceImpl extends ServiceImpl implements VodDictService { + + @Autowired + private VODConfig vodConfig; + + + public SignatureVO signature() throws Exception { +// + SignatureVO signatureVO = new SignatureVO(); + + Signature signature = new Signature(); + signature.setSecretId(vodConfig.getSecretId()); + signature.setSecretKey(vodConfig.getSecretKey()); + signature.setCurrentTime(System.currentTimeMillis()); + signature.setRandom(new Random().nextInt(Integer.MAX_VALUE)); + signature.setSignValidDuration(3600 * 24 * 2); + + String sign = ""; + try { + sign = signature.getUploadSignature(); + signatureVO.setSign(sign); + } catch (Exception ex) { + ex.printStackTrace(); +// throw new MyException(ResultEnum.UNKNOWN_ERROR); + } + return signatureVO; + } + + public List getContendVods(VodDictDO vodDictDO) { + return this.baseMapper.getContendVods(vodDictDO); + } + + public String deleteVod(VodDictDO vodDictDO) { + this.baseMapper.deleteById(vodDictDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String addVod(VodDictDO vodDictDO) { + this.baseMapper.insert(vodDictDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String updateVod(VodDictDO vodDictDO) { + this.baseMapper.updateById(vodDictDO); + return ConstantUtils.SET_SUCCESS; + } + + + +} diff --git a/src/main/java/com/subsidy/util/BaseModel.java b/src/main/java/com/subsidy/util/BaseModel.java new file mode 100644 index 0000000..7504dd0 --- /dev/null +++ b/src/main/java/com/subsidy/util/BaseModel.java @@ -0,0 +1,35 @@ +package com.subsidy.util; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public abstract class BaseModel { + + /** + * 创建时间 + */ + @JsonIgnore + @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT) + private LocalDateTime createDate; + + /** + * 更新时间 + */ + @JsonIgnore + @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "update_date", fill = FieldFill.UPDATE) + private LocalDateTime updateDate; + + /** + * 删除时间 + */ + @JsonIgnore + @TableLogic + private LocalDateTime deleteDate; +} diff --git a/src/main/java/com/subsidy/util/CodeGenerator.java b/src/main/java/com/subsidy/util/CodeGenerator.java new file mode 100644 index 0000000..ae1381a --- /dev/null +++ b/src/main/java/com/subsidy/util/CodeGenerator.java @@ -0,0 +1,124 @@ +package com.subsidy.util; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException; +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.InjectionConfig; +import com.baomidou.mybatisplus.generator.config.*; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; + +import java.util.ArrayList; +import java.util.List; +import java.util.ResourceBundle; +import java.util.Scanner; + +/** + * Mybatis-Plus CodeGenerator + * + * @author DengMin + * @date 2020/07/02 + **/ +public class CodeGenerator { + + public static String scanner(String tip) { + StringBuilder help = new StringBuilder(); + help.append("1.生成全部表 2.输入需要生成表名"); + System.out.println(help.toString()); + Scanner scanner = new Scanner(System.in); + Integer ipt = Integer.valueOf(scanner.next()); + if(ipt == 1) { + return ""; + } else if(ipt == 2) { + StringBuilder help1 = new StringBuilder(); + help1.append("请输入" + tip + ":"); + System.out.println(help1.toString()); + Scanner scanner1 = new Scanner(System.in); + if (scanner1.hasNext()) { + String name = scanner1.next(); + if (StringUtils.isNotEmpty(name)) { + return name; + } + } + throw new MybatisPlusException("请输入正确的" + tip + "!"); + } + return scanner(tip); + } + + public static void main(String[] args) { + final ResourceBundle rb = ResourceBundle.getBundle("mybatis-plus"); + // 代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 全局配置 + GlobalConfig gc = new GlobalConfig(); + gc.setOutputDir(System.getProperty("user.dir") + rb.getString("outputDir")); + gc.setOpen(false); + gc.setBaseResultMap(true); + gc.setBaseColumnList(true); + gc.setAuthor(rb.getString("author")); + gc.setMapperName("%sMapper"); + gc.setEntityName("%sDO"); + gc.setServiceName("%sService"); + gc.setServiceImplName("%sServiceImpl"); + gc.setControllerName("%sController"); + mpg.setGlobalConfig(gc); + + // 数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setDbType(DbType.MYSQL); + dsc.setUrl(rb.getString("url")); + dsc.setDriverName(rb.getString("driverName")); + dsc.setUsername(rb.getString("userName")); + dsc.setPassword(rb.getString("password")); + mpg.setDataSource(dsc); + + // 包配置 + PackageConfig pc = new PackageConfig(); + pc.setParent(rb.getString("setParent")); + pc.setController("controller"); + pc.setService("service"); + pc.setServiceImpl("service.impl"); + pc.setEntity("model"); + pc.setMapper("mapper"); + mpg.setPackageInfo(pc); + + // 自定义配置 + InjectionConfig cfg = new InjectionConfig() { + @Override + public void initMap() { + // to do nothing + } + }; + List focList = new ArrayList<>(); + focList.add(new FileOutConfig("/templates/mapper.xml.ftl") { + @Override + public String outputFile(TableInfo tableInfo) { + // 自定义输入文件名称 + return System.getProperty("user.dir")+ rb.getString("mapperPath") + tableInfo.getMapperName() + StringPool.DOT_XML; + } + }); + cfg.setFileOutConfigList(focList); + mpg.setCfg(cfg); + mpg.setTemplate(new TemplateConfig().setXml(null)); + + // 策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setNaming(NamingStrategy.underline_to_camel); + strategy.setColumnNaming(NamingStrategy.underline_to_camel); + strategy.setSuperEntityClass(BaseModel.class); + strategy.setEntityLombokModel(true); + strategy.setRestControllerStyle(true); + String [] tables = scanner("表名,多个英文逗号分割").split(","); + if(StringUtils.isNotBlank(tables[0])) { + strategy.setInclude(tables); + } + strategy.setControllerMappingHyphenStyle(true); + mpg.setStrategy(strategy); + mpg.setTemplateEngine(new FreemarkerTemplateEngine()); + mpg.execute(); + } +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/util/ConstantUtils.java b/src/main/java/com/subsidy/util/ConstantUtils.java new file mode 100644 index 0000000..72603a6 --- /dev/null +++ b/src/main/java/com/subsidy/util/ConstantUtils.java @@ -0,0 +1,89 @@ +package com.subsidy.util; + + +/** + * 枚举类 + */ +public class ConstantUtils { + + public static final String DELETE_SUCCESS = "删除成功"; + + public static final String UPLOAD_FAIL = "上传失败"; + + public static final String ADD_SUCCESS = "新增成功"; + + public static final String COMMIT_SUCCESS = "提交成功"; + + public static final String SUCCESS_SEND_OUT = "发送成功"; + + public static final String FAIL_SEND_OUT = "发送失败"; + + public static final String SAVE_SUCCESS = "保存成功"; + + public static final String SHARE_SUCCESS = "共享成功"; + + public static final String SUBMIT_SUCCESS = "提交成功"; + + public static final String SUCCESS_UPDATE = "更新成功"; + + public static final String FAIL_UPDATE = "更新失败"; + + public static final String SET_SUCCESS = "设置成功"; + + public static final String SUCCESS_VERIFY = "验证成功"; + + public static final String FAIL_VERIFY = "验证失败"; + + public static final String COMPANY_NAME = "TeachAI"; + + public static final String ALREADY_DONE = "已完成"; + + public static final String ALREADY_RECOMMEND = "已推荐"; + + public static final String VERIFY_NAME = "有课互联"; + + public static final String NOTICE_NAME = "有课进度通知"; + + public static final String PUBLISH_SUCCESS = "发布成功"; + + public static final String LOGIN_OUT ="登出成功"; + + public static final String COMPRESS_SUCCESS = "压缩成功"; + + public static final String SCHOOL = "上海市市西中学"; + + public static final String CHECK_STATUS = "审核通过"; + + /** + * 短信模板---验证模板 + */ + public static final String TEMPLATE_CODE = "SMS_190945394"; + + /** + * 短信 地域ID + */ + public static final String REGION_ID = "cn-hangzhou"; + + /** + * 短信 RAM账号AccessKey ID + */ + public static final String ACCESS_KEY_ID = "LTAIOrpFKrDqsQ2c"; + + /** + * 短信 RAM账号AccessKey Secret + */ + public static final String SECRET = "1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G"; + + /** + * 腾讯云点播视频转码模板 + */ + public static final Long TEMPLATE_VOD = 100030L; + + /** + * 手机端token + */ + public static final String MOBILE_TERMINATE = "mobile"; + + public static final String ADMINISTER_TERMINATE = "administer"; + +} diff --git a/src/main/java/com/subsidy/util/DateFormatUtil.java b/src/main/java/com/subsidy/util/DateFormatUtil.java new file mode 100644 index 0000000..4ae1409 --- /dev/null +++ b/src/main/java/com/subsidy/util/DateFormatUtil.java @@ -0,0 +1,79 @@ +package com.subsidy.util; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 处理时间工具 + * + * @author DengMin + * @date 2019/08/27 13:56 + **/ +public class DateFormatUtil { + + public final static String YEAR = "yyyy"; + public final static String FMT_sdf14_L = "yyyy-MM-dd HH:mm:ss"; + public final static String FMT_sdf_yMd = "yyyy-MM-dd"; + public final static String FMT_sdf_yM = "yyyy-M"; + public final static String FMT_sdf_yMM = "yyyy-MM"; + public final static String FMT_sdf_Hm = "H:mm"; + public final static String FMT_sdf_HHmm = "HH:mm"; + public final static String cron = "s m H d M ? yyyy"; + + /** + * Date转String,自定义格式 + * @param date + * @param pattern + * @return + */ + public static String format(Date date, String pattern) { + try { + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + return sdf.format(date); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * String转Date,自定义格式 + * @param date + * @param pattern + * @return + */ + public static Date parse(String date, String pattern) { + try { + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + return sdf.parse(date); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 比较两个时间 + * .after 大于 + * .before 小于 + * @param d1 + * @param d2 + * @return + */ + public static boolean compare(Date d1, Date d2 ) { + if(d1.after(d2)) { + return false; + } + return true; + } + + /** + * Data转Cron + * @param date + * @return + */ + public static String getCron(Date date) { + SimpleDateFormat sdf = new SimpleDateFormat("s m H d M ? yyyy"); + return sdf.format(date); + } +} diff --git a/src/main/java/com/subsidy/util/EncryptUtil.java b/src/main/java/com/subsidy/util/EncryptUtil.java new file mode 100644 index 0000000..7055849 --- /dev/null +++ b/src/main/java/com/subsidy/util/EncryptUtil.java @@ -0,0 +1,35 @@ +package com.subsidy.util; + +import com.amdelamar.jhash.Hash; +import com.amdelamar.jhash.algorithms.Type; +import com.amdelamar.jhash.exception.InvalidHashException; + +public class EncryptUtil { + + /** + * 设置密文密码 + * + * @param password 原始密码 + * @return 加密密码 + */ + public static String encrypt(String password) { + char[] chars = password.toCharArray(); + return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).create(); + } + + /** + * 验证加密密码 + * + * @param encryptedPassword 密文密码 + * @param plainPassword 明文密码 + * @return 验证是否成功 + */ + public static boolean verify(String encryptedPassword, String plainPassword) { + char[] chars = plainPassword.toCharArray(); + try { + return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).verify(encryptedPassword); + } catch (InvalidHashException e) { + return false; + } + } +} diff --git a/src/main/java/com/subsidy/util/HttpUtil.java b/src/main/java/com/subsidy/util/HttpUtil.java new file mode 100644 index 0000000..669745a --- /dev/null +++ b/src/main/java/com/subsidy/util/HttpUtil.java @@ -0,0 +1,63 @@ +package com.subsidy.util; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import org.springframework.http.*; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +/** + * http请求 + */ +public class HttpUtil { + + /** + * GET 请求 + * @param params + * @param url + * @return + */ + public static JSONObject get(Map params, String url) { + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity responseEntity = restTemplate.getForEntity(url, String.class, params); + String body = responseEntity.getBody(); + JSONObject object = JSON.parseObject(body); + return object; + } + + /** + * POST 请求 + * @param params + * @param url + * @return + */ + public static JSONObject post(Map params, String url) { + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity responseEntity = restTemplate.postForEntity(url, params, String.class); + String body = responseEntity.getBody(); + JSONObject object = JSON.parseObject(body); + return object; + } + + /** + * POST 请求 带Token + * + * @param param + * @param token + * @param url + * @return + */ + public static JSONObject sendPost(Map param, String token, String url, Object obj) { + RestTemplate restTemplate = new RestTemplate(); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + headers.add("Accept", MediaType.ALL_VALUE); + headers.add("Authorization", "Bearer " + token); + HttpEntity formEntity = new HttpEntity(param.toString(), headers); + ResponseEntity responseEntity = restTemplate.exchange(url, HttpMethod.POST, formEntity, String.class, obj); + String body = responseEntity.getBody(); + JSONObject object = JSON.parseObject(body); + return object; + } +} diff --git a/src/main/java/com/subsidy/util/JwtUtil.java b/src/main/java/com/subsidy/util/JwtUtil.java new file mode 100644 index 0000000..972185b --- /dev/null +++ b/src/main/java/com/subsidy/util/JwtUtil.java @@ -0,0 +1,96 @@ +package com.subsidy.util; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTVerifier; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.interfaces.Claim; + +import java.util.Date; +import java.util.Map; + +/** + *

+ * Token工具 + *

+ * + * @author DengMin + * @since 2021/4/14 + */ +public class JwtUtil { + + private static Long EXPIRE_TIME = 24 * 60 * 60 * 1000L; + + private static String SECRET = "PBKDF2SHA256:64000:18:24:N:GFHZ6Y0PTEUDYCJI3K6SOOXWYEKPOZED:WBWFJMX5DF252E0HR3BF3P/D"; + + /** + * 生成Token + * @param id + * @return + */ + public static String generateToken(Long id, String type) { + Date expireDate = new Date(System.currentTimeMillis() + EXPIRE_TIME); + return JWT.create() + .withClaim("id", id) + .withClaim("type", type) + .withAudience() + .withExpiresAt(expireDate) + .withIssuedAt(new Date()) + .sign(Algorithm.HMAC256(SECRET)); + } + + /** + * 检验token是否正确 + * @param token + * @return + */ + public static boolean verifyToken(String token) { + try { + Algorithm algorithm = Algorithm.HMAC256(SECRET); + JWTVerifier verifier = JWT.require(algorithm).build(); + verifier.verify(token); + return true; + } catch (Exception e) { + return false; + } + } + + /** + * 获取用户自定义Claim集合 + * @param token + * @return + */ + public static Map getClaims(String token) { + Algorithm algorithm = Algorithm.HMAC256(SECRET); + JWTVerifier verifier = JWT.require(algorithm).build(); + Map claims = verifier.verify(token).getClaims(); + return claims; + } + + /** + * 获取过期时间 + * @param token + * @return + */ + public static Date getExpiresAt(String token) { + Algorithm algorithm = Algorithm.HMAC256(SECRET); + return JWT + .require(algorithm) + .build() + .verify(token) + .getExpiresAt(); + } + + /** + * 验证token是否失效 + * @param token + * @return true: 过期, false: 没过期 + */ + public static boolean isExpired(String token) { + try { + final Date expiration = getExpiresAt(token); + return expiration.before(new Date()); + } catch (Exception e) { + return true; + } + } +} diff --git a/src/main/java/com/subsidy/util/LatexUtils.java b/src/main/java/com/subsidy/util/LatexUtils.java new file mode 100644 index 0000000..ac6fddb --- /dev/null +++ b/src/main/java/com/subsidy/util/LatexUtils.java @@ -0,0 +1,124 @@ +package com.subsidy.util; + +import org.scilab.forge.jlatexmath.TeXConstants; +import org.scilab.forge.jlatexmath.TeXFormula; +import org.scilab.forge.jlatexmath.TeXIcon; + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; + +/** + * @author: tuyp + * @create: 2020-08-08 21:19 + */ +public class LatexUtils { + + /** + * @Description: 将base64编码字符串转换为图片 + * @Author: + * @CreateTime: + * @param imgStr + * base64编码字符串 + * @param path + * 图片路径-具体到文件 + * @return + */ + public static boolean generateImage(String imgStr, String path) { + if (imgStr == null) { + return false; + } +// BASE64Decoder decoder = new BASE64Decoder(); + try { +// byte[] b = decoder.decodeBuffer(imgStr); +// for (int i = 0; i < b.length; i++) { +// if (b[i] < 0) { +// b[i] += 256; +// } +// } +// OutputStream out = new FileOutputStream(path); +// out.write(b); +// out.flush(); +// out.close(); + return true; + } catch (Exception e) { + // TODO: handle exception + return false; + } + } + + /** + * @Description: 根据图片地址转换为base64编码字符串 + * @Author: + * @CreateTime: + * @return + */ +// public static String getImageStr(String imgFile) { +// InputStream inputStream = null; +// byte[] data = null; +// try { +// inputStream = new FileInputStream(imgFile); +// data = new byte[inputStream.available()]; +// inputStream.read(data); +// inputStream.close(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// // 加密 +// BASE64Encoder encoder = new BASE64Encoder(); +// return encoder.encode(data); +// } + + // latex 转 imgbase64 + public static String latex2Png(String latex) { + try { + TeXFormula formula = new TeXFormula(latex); + // render the formla to an icon of the same size as the formula. + TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20); + // insert a border + icon.setInsets(new Insets(1, 1, 1, 1)); + // now create an actual image of the rendered equation + BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_BYTE_GRAY); + Graphics2D g2 = image.createGraphics(); + g2.setColor(Color.white); + g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight()); + JLabel jl = new JLabel(); + jl.setForeground(new Color(0, 0, 0)); + icon.paintIcon(jl, g2, 0, 0); + // at this point the image is created, you could also save it with ImageIO + // saveImage(image, "png", "F:\\b.png"); +// ImageIO.write(image, "png", new File("F:\\c.png")); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + try { + ImageIO.write(image, "png", outputStream); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + byte[] buffer = outputStream.toByteArray(); +// BASE64Encoder encoder = new BASE64Encoder(); + return ("data:image/png;base64,"); + } catch (Exception e) { + // e.printStackTrace(); + // ExceptionUtil.log(log, e); + System.err.println("公式解析有误:\n" + latex); + // e.printStackTrace(); + return null; + } + } + + public static void main(String[] args) { + String str = latex2Png("\\(\\sqrt[3]{2+x}\\)"); + System.out.println(str); + + + + +// String omml =Latex_Word.latexToWord(str); +// System.out.println(omml); + } + +} diff --git a/src/main/java/com/subsidy/util/Localstorage.java b/src/main/java/com/subsidy/util/Localstorage.java new file mode 100644 index 0000000..4cc65bd --- /dev/null +++ b/src/main/java/com/subsidy/util/Localstorage.java @@ -0,0 +1,21 @@ +package com.subsidy.util; + +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class Localstorage { + + private static final ThreadLocal local = ThreadLocal.withInitial(() -> null); + + public static void setUser(Object admin) { + Localstorage.local.set(admin); + } + + public static Object getUser() { + return Localstorage.local.get(); + } + + public static void remove() { + Localstorage.local.remove(); + } +} diff --git a/src/main/java/com/subsidy/util/MathUtil.java b/src/main/java/com/subsidy/util/MathUtil.java new file mode 100644 index 0000000..854ca16 --- /dev/null +++ b/src/main/java/com/subsidy/util/MathUtil.java @@ -0,0 +1,129 @@ +package com.subsidy.util; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Random; + +public class MathUtil { + + public static String getRandomCode(int randomLength) { + StringBuilder str = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < randomLength; i++) { + str.append(random.nextInt(10)); + } + return str.toString(); + } + + public static String getRandomString(int length) { + StringBuilder val = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < length; ++i) { + String charOrNum = random.nextInt(3) % 3 == 0 ? "num" : "char"; + if ("char".equalsIgnoreCase(charOrNum)) { + int temp = random.nextInt(2) % 2 == 0 ? 65 : 97; + val.append((char) (random.nextInt(26) + temp)); + } else { + val.append(random.nextInt(10)); + } + } + return val.toString(); + } + + //习题/视频 ==> 秒钟向上取整 + public static String ceilSecond(int length) { + return String.valueOf((int) Math.ceil((double) length / 60)); + } + + //视频秒数处理 + public static String vodLength(int i) { + if (i > 60) { + if (i % 60 >= 10) { + return i / 60 + ":" + i % 60; + } else { + return i / 60 + ":0" + i % 60; + } + } else { + if (i % 60 >= 10) { + return "00:" + i; + } else { + return "00:0" + i; + } + } + } + + //文件大小处理 + public static String fileUnit(int i) { + if (i / 1024 > 1024) { + return String.format("%.2f", (double) i / 1024 / 1024) + "M"; + } else { + return String.format("%.2f", (double) i / 1024) + "K"; + } + } + + //单个题目秒数处理 + public static String exerciseLength(int i) { + if (i >= 60 * 60) { + return i / 60 / 60 + "时" + (i - 60 * 60) / 60 + "分" + i % 60 + "秒"; + } else if (i >= 60) { + return i / 60 + "分" + i % 60 + "秒"; + } else { + return i % 60 + "秒"; + } + } + + // 除法取整 + public static String getAvgIndex(BigDecimal counts, BigDecimal total) { + if (BigDecimal.ZERO.equals(total)) { + return "0"; + } else { + return counts.divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString(); + } + } + + //百分比 取整 返回字符串 + public static String getPercentAvgIndex(BigDecimal counts, BigDecimal total) { + if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) { + return "0%"; + } else { + return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString() + "%"; + } + } + + //百分比 不带%输出 + public static String getPercentAvgIndexWithPercent(BigDecimal counts, BigDecimal total) { + if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) { + return "0"; + } else { + return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString(); + } + } + + + //习题序号生成规则 sid 从数据取出某科目某知识点的最大的序号 + public static String getExeCode(String sid) { + Integer integer = Integer.valueOf(sid.substring(9)); + return sid.substring(0, 9) + (++integer); + } + + // 整型a 整型b a/b 向上取整 + public static Integer intDivCeil(long a, int b) { + return (int) Math.ceil((double) a / b); + } + + // 整型a 整型b a/b 向下取整 + public static Integer intDivFloorPercent(long a, int b) { + return (int) Math.floor((double) a * 100 / b); + } + + public static Integer getRandomNum(Integer i){ + Random random = new Random(); + return random.nextInt(i); + } + +// public static void main(String[] args) { +// for (int i= 1;i<100;i++){ +// System.out.println(getRandomNum(2)); +// } +// } +} diff --git a/src/main/java/com/subsidy/util/RandomUtil.java b/src/main/java/com/subsidy/util/RandomUtil.java new file mode 100644 index 0000000..da3a872 --- /dev/null +++ b/src/main/java/com/subsidy/util/RandomUtil.java @@ -0,0 +1,19 @@ +package com.subsidy.util; + +import java.util.Random; + +public class RandomUtil { + + public static int getCode() { + return (int)((Math.random() * 9 + 1) * 100000); + } + + public static String getRandomCode(int randomLength) { + StringBuilder str = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < randomLength; i++) { + str.append(random.nextInt(10)); + } + return str.toString(); + } +} diff --git a/src/main/java/com/subsidy/util/SMSUtils.java b/src/main/java/com/subsidy/util/SMSUtils.java new file mode 100644 index 0000000..8d625d6 --- /dev/null +++ b/src/main/java/com/subsidy/util/SMSUtils.java @@ -0,0 +1,137 @@ +package com.subsidy.util; + +import com.aliyuncs.CommonRequest; +import com.aliyuncs.CommonResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; +import com.aliyuncs.http.MethodType; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; +import com.subsidy.common.configure.AliyunSmsProperties; +import com.subsidy.common.exception.HttpException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 短信发送工具类 + */ + +@Component +public class SMSUtils { + + @Autowired + private AliyunSmsProperties aliyunSmsProperties; + + public SendSmsResponse send(String phone, String code) { + try { + System.setProperty("sun.net.client.defaultConnectTimeout", "10000"); + System.setProperty("sun.net.client.defaultReadTimeout", "10000"); + + //初始化acsClient,暂不支持region化 + IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", aliyunSmsProperties.getAccessKeyId(), aliyunSmsProperties.getAccessKeySecret()); + DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", aliyunSmsProperties.getProduct(), aliyunSmsProperties.getDomain()); + IAcsClient acsClient = new DefaultAcsClient(profile); + + //组装请求对象-具体描述见控制台-文档部分内容 + SendSmsRequest request = new SendSmsRequest(); + //必填:待发送手机号 + request.setPhoneNumbers(phone); + //必填:短信签名-可在短信控制台中找到 + request.setSignName("有课互联"); + //必填:短信模板-可在短信控制台中找到 + request.setTemplateCode("SMS_190945394"); + //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 + request.setTemplateParam("{\"code\":\""+ code +"\"}"); + + //hint 此处可能会抛出异常,注意catch + SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request); + if(sendSmsResponse != null && sendSmsResponse.getCode().equals("OK")) { + return sendSmsResponse; + } + + throw new Exception(sendSmsResponse.getMessage()); + } catch (Exception e) { + throw new HttpException(70011); + } + } + + + /** + * 发送验证码短信 + * @param templateId 短信模板id + * @param telephone 手机号 + * @return + */ + public static String sendVerifySMS(String templateId,String telephone,String param){ + DefaultProfile profile = DefaultProfile.getProfile(ConstantUtils.REGION_ID, ConstantUtils.ACCESS_KEY_ID, ConstantUtils.SECRET); + IAcsClient client = new DefaultAcsClient(profile); + + CommonRequest request = new CommonRequest(); + request.setSysMethod(MethodType.POST); + request.setSysDomain("dysmsapi.aliyuncs.com"); + request.setSysVersion("2017-05-25"); + request.setSysAction("SendSms"); + request.putQueryParameter("RegionId",ConstantUtils.REGION_ID); + request.putQueryParameter("PhoneNumbers",telephone); + request.putQueryParameter("SignName",ConstantUtils.VERIFY_NAME); + request.putQueryParameter("TemplateCode",templateId); +// if (StringUtils.isEmpty(param)){ +// request.putQueryParameter("TemplateParam","{ \"code\":\""+verifyCode +"\"}"); +// } + request.putQueryParameter("TemplateParam",param); + CommonResponse response = null; + try { + response = client.getCommonResponse(request); + return ConstantUtils.SUCCESS_SEND_OUT; + } catch(Exception e) { + e.printStackTrace(); + return ConstantUtils.FAIL_SEND_OUT; + } + } + + /** + * 发送通知短信 + * @param templateId 短信模板id + * @param telephone 手机号 + * @return + */ + public static String sendNoticeSMS(String templateId,String telephone,String param){ + DefaultProfile profile = DefaultProfile.getProfile(ConstantUtils.REGION_ID, ConstantUtils.ACCESS_KEY_ID, ConstantUtils.SECRET); + IAcsClient client = new DefaultAcsClient(profile); + + CommonRequest request = new CommonRequest(); + request.setSysMethod(MethodType.POST); + request.setSysDomain("dysmsapi.aliyuncs.com"); + request.setSysVersion("2017-05-25"); + request.setSysAction("SendSms"); + request.putQueryParameter("RegionId",ConstantUtils.REGION_ID); + request.putQueryParameter("PhoneNumbers",telephone); + request.putQueryParameter("SignName",ConstantUtils.NOTICE_NAME); + request.putQueryParameter("TemplateCode",templateId); +// if (StringUtils.isEmpty(param)){ +// request.putQueryParameter("TemplateParam","{ \"code\":\""+verifyCode +"\"}"); +// } + request.putQueryParameter("TemplateParam",param); + CommonResponse response = null; + try + + { + response = client.getCommonResponse(request); + return ConstantUtils.SUCCESS_SEND_OUT; + } catch( + Exception e) + + { + e.printStackTrace(); + return ConstantUtils.FAIL_SEND_OUT; + } + } + + public static void main(String[] args) { + String param = "{ \"company\":\""+"基金会"+ "\",\"time\":\""+"2020-01-02" +"\",\"address\":\""+"上海市" +"\"}"; + sendNoticeSMS("SMS_215336604","15201936167",param); + } + +} diff --git a/src/main/java/com/subsidy/util/SecretUtils.java b/src/main/java/com/subsidy/util/SecretUtils.java new file mode 100644 index 0000000..f0c15c9 --- /dev/null +++ b/src/main/java/com/subsidy/util/SecretUtils.java @@ -0,0 +1,116 @@ +package com.subsidy.util; + +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.util.UUID; + +public class SecretUtils { + + /** + * 对用户登录密码进行MD5加密 + * + * @param str + * @return + */ + + public static String getMD5String(String str) { + try { + // 生成一个MD5加密计算摘要 + MessageDigest md = MessageDigest.getInstance("MD5"); + // 计算md5函数 + md.update(str.getBytes()); + // digest()最后确定返回md5 hash值,返回值为8位字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符 + // BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值 + //一个byte是八位二进制,也就是2位十六进制字符(2的8次方等于16的2次方) + return new BigInteger(1, md.digest()).toString(16); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 对字符串进行SHA加密 + * + * @param + */ + public static String getSHAString(String str) { + try { + MessageDigest sha = MessageDigest.getInstance("SHA-1"); + + byte[] byteArray = str.getBytes(StandardCharsets.UTF_8); + byte[] md5Bytes = sha.digest(byteArray); + StringBuffer hexValue = new StringBuffer(); + for (int i = 0; i < md5Bytes.length; i++) { + int val = ((int) md5Bytes[i]) & 0xff; + if (val < 16) { + hexValue.append("0"); + } + hexValue.append(Integer.toHexString(val)); + } + + return hexValue.toString(); + } catch (Exception e) { + return null; + } + + } + + + private static byte[] md5(String s) + { + MessageDigest algorithm; + try + { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes("UTF-8")); + byte[] messageDigest = algorithm.digest(); + return messageDigest; + } + catch (Exception e) + { + + } + return null; + } + + private static final String toHex(byte hash[]) + { + if (hash == null) + { + return null; + } + StringBuffer buf = new StringBuffer(hash.length * 2); + int i; + + for (i = 0; i < hash.length; i++) + { + if ((hash[i] & 0xff) < 0x10) + { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String hash(String s) + { + try + { + return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8"); + } + catch (Exception e) + { + return s; + } + } + + public static void main(String[] args) { + String uuid = UUID.randomUUID().toString(); + System.out.println(uuid); + System.out.println(hash(uuid+"ixihs")); + } +} \ No newline at end of file diff --git a/src/main/java/com/subsidy/util/Signature.java b/src/main/java/com/subsidy/util/Signature.java new file mode 100644 index 0000000..87f4c62 --- /dev/null +++ b/src/main/java/com/subsidy/util/Signature.java @@ -0,0 +1,79 @@ +package com.subsidy.util; + +import sun.misc.BASE64Encoder; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; + +/** + * @author: tuyp + * @create: 2020-07-29 12:42 + */ +public class Signature { + private String secretId; + private String secretKey; + private long currentTime; + private int random; + private int signValidDuration; + + private static final String HMAC_ALGORITHM = "HmacSHA1"; + private static final String CONTENT_CHARSET = "UTF-8"; + + public static byte[] byteMerger(byte[] byte1, byte[] byte2) { + byte[] byte3 = new byte[byte1.length + byte2.length]; + System.arraycopy(byte1, 0, byte3, 0, byte1.length); + System.arraycopy(byte2, 0, byte3, byte1.length, byte2.length); + return byte3; + } + + public String getUploadSignature() throws Exception { + String strSign = ""; + String contextStr = ""; + + long endTime = (currentTime + signValidDuration); + contextStr += "secretId=" + java.net.URLEncoder.encode(secretId, "utf8"); + contextStr += "¤tTimeStamp=" + currentTime; + contextStr += "&expireTime=" + endTime; + contextStr += "&random=" + random; + + try { + Mac mac = Mac.getInstance(HMAC_ALGORITHM); + SecretKeySpec secretKey = new SecretKeySpec(this.secretKey.getBytes(CONTENT_CHARSET), mac.getAlgorithm()); + mac.init(secretKey); + + byte[] hash = mac.doFinal(contextStr.getBytes(CONTENT_CHARSET)); + byte[] sigBuf = byteMerger(hash, contextStr.getBytes(StandardCharsets.UTF_8)); + strSign = base64Encode(sigBuf); + strSign = strSign.replace(" ", "").replace("\n", "").replace("\r", ""); + } catch (Exception e) { + throw e; + } + return strSign; + } + + private String base64Encode(byte[] buffer) { + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encode(buffer); + } + + public void setSecretId(String secretId) { + this.secretId = secretId; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public void setCurrentTime(long currentTime) { + this.currentTime = currentTime; + } + + public void setRandom(int random) { + this.random = random; + } + + public void setSignValidDuration(int signValidDuration) { + this.signValidDuration = signValidDuration; + } +} diff --git a/src/main/java/com/subsidy/util/TestMain.java b/src/main/java/com/subsidy/util/TestMain.java new file mode 100644 index 0000000..547881b --- /dev/null +++ b/src/main/java/com/subsidy/util/TestMain.java @@ -0,0 +1,61 @@ +package com.subsidy.util; + +import java.security.MessageDigest; +import java.util.Random; + +public class TestMain { + + public static void main(String[] args) { + String password = "123456"; + String saltCode = getRandomCharAndNumr(5); + String encryptString = encrypt("91ebn" + password); + System.out.println(encryptString); + } + + public static String encrypt(String string) { + + String encryptedString = string; + char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + try { + byte[] btInput = string.getBytes(); + MessageDigest mdInst = MessageDigest.getInstance("MD5"); + mdInst.update(btInput); + byte[] md = mdInst.digest(); + int j = md.length; + char[] str = new char[j * 2]; + int k = 0; + for (int i = 0; i < j; i++) { + byte byte0 = md[i]; + str[k++] = hexDigits[byte0 >>> 4 & 0xf]; + str[k++] = hexDigits[byte0 & 0xf]; + } + encryptedString = new String(str); + return encryptedString; + } catch (Exception e) { + e.printStackTrace(); + return encryptedString; + } + } + + /** + * 获取随机字母数字组合 + * + * @param length + * 字符串长度 + * @return + */ + public static String getRandomCharAndNumr(Integer length) { + String str = ""; + Random random = new Random(); + for (int i = 0; i < length; i++) { + boolean b = random.nextBoolean(); + if (b) { // 字符串 + // int choice = random.nextBoolean() ? 65 : 97; 取得65大写字母还是97小写字母 + str += (char) (97 + random.nextInt(26));// 取得大写字母 + } else { // 数字 + str += String.valueOf(random.nextInt(10)); + } + } + return str; + } +} diff --git a/src/main/java/com/subsidy/util/excel/ExcelColumn.java b/src/main/java/com/subsidy/util/excel/ExcelColumn.java new file mode 100644 index 0000000..ca1690d --- /dev/null +++ b/src/main/java/com/subsidy/util/excel/ExcelColumn.java @@ -0,0 +1,13 @@ +package com.subsidy.util.excel; + +import java.lang.annotation.*; + +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ExcelColumn { + + String value() default ""; + + int col() default 1; +} diff --git a/src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java b/src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java new file mode 100644 index 0000000..873ab06 --- /dev/null +++ b/src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java @@ -0,0 +1,21 @@ +package com.subsidy.util.excel; + +import java.lang.annotation.*; + +/** + *

+ * excel 字段 + *

+ * + * @author DengMin + * @date Created in 2020/08/28 + */ +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ExcelColumnUtil { + + String value() default ""; + + int col() default 0; +} diff --git a/src/main/java/com/subsidy/util/excel/ExcelUtil.java b/src/main/java/com/subsidy/util/excel/ExcelUtil.java new file mode 100644 index 0000000..f68b2a4 --- /dev/null +++ b/src/main/java/com/subsidy/util/excel/ExcelUtil.java @@ -0,0 +1,345 @@ +package com.subsidy.util.excel; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.CharUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * Excel工具 + * + * @author DengMin + * @date 2019/08/27 13:57 + **/ +@Slf4j +public class ExcelUtil { + + private final static String EXCEL2003 = "xls"; + + private final static String EXCEL2007 = "xlsx"; + + /** + * 导入excel文件 + * @param path + * @param cls + * @param file + * @param + * @return + */ + public static List readExcel(String path, Class cls, MultipartFile file) { + String fileName = file.getOriginalFilename(); + if(!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) { + log.info("上传文件格式不正确"); +// throw new HTTPException(10022); + } + + List dataList = new ArrayList<>(); + Workbook workbook = null; + try { + InputStream is = file.getInputStream(); + if (fileName.endsWith(EXCEL2007)) { + // FileInputStream is = new FileInputStream(new File(path)); + workbook = new XSSFWorkbook(is); + } + + if(fileName.endsWith(EXCEL2003)) { + // FileInputStream is = new FileInputStream(new File(path)); + workbook = new HSSFWorkbook(is); + } + + if (workbook != null) { + Map> classMap = new HashMap<>(); + List fields = Stream.of(cls.getDeclaredFields()).collect(Collectors.toList()); + fields.forEach(field -> { + ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class); + if (annotation != null) { + String value = annotation.value(); + if(StringUtils.isBlank(value)) { + return; + } + + if(!classMap.containsKey(value)) { + classMap.put(value, new ArrayList<>()); + } + + field.setAccessible(true); + classMap.get(value).add(field); + } + }); + //索引-->columns + Map> reflectionMap = new HashMap<>(); + //默认读取第一个sheet + Sheet sheet = workbook.getSheetAt(0); + + boolean firstRow = true; + for (int i = 0; i <= sheet.getLastRowNum(); i++) { + Row row = sheet.getRow(i); + //提取标题 + if (firstRow) { + for (int j = 0; j <= row.getLastCellNum(); j++) { + Cell cell = row.getCell(j); + String cellValue = getCellValue(cell); + if (classMap.containsKey(cellValue)) { + reflectionMap.put(j, classMap.get(cellValue)); + } + } + + firstRow = false; + } else { + //忽略空白行 + if (row == null) { + continue; + } + + try { + T t = cls.newInstance(); + //判断是否为空白行 + boolean allBlank = true; + for (int j = 0; j <= row.getLastCellNum(); j++) { + if (reflectionMap.containsKey(j)) { + Cell cell = row.getCell(j); + String cellValue = getCellValue(cell); + if (StringUtils.isNotBlank(cellValue)) { + allBlank = false; + } + List fieldList = reflectionMap.get(j); + fieldList.forEach(x -> { + try { + handleField(t, cellValue, x); + } catch (Exception e) { + e.printStackTrace(); + log.error(String.format("reflect field:%s value:%s exception!", x.getName(), cellValue), e); + } + }); + } + } + + if(!allBlank) { + dataList.add(t); + } + } catch (Exception e) { + e.printStackTrace(); + log.error(String.format("parse row:%s exception!", i), e); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + log.error(String.format("parse excel exception!"), e); + } finally { + if (workbook != null) { + try { + workbook.close(); + } catch (Exception e) { + e.printStackTrace(); + log.error(String.format("parse excel exception!"), e); + } + } + } + return dataList; + } + + /** + * 导出excel文件 + * @param list + * @param cls + * @param + */ + public static void writeExcel(List list, Class cls) { + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletResponse response = servletRequestAttributes.getResponse(); + Field[] fields = cls.getDeclaredFields(); + List fieldList = Arrays.stream(fields).filter(field -> { + ExcelColumn annotation = field.getAnnotation(ExcelColumn.class); + if(annotation != null) { + field.setAccessible(true); + return true; + } + return false; + }).sorted(Comparator.comparing(field -> { + int col = 0; + ExcelColumn annotation = field.getAnnotation(ExcelColumn.class); + if(annotation != null) { + col = annotation.col(); + } + return col; + })).collect(Collectors.toList()); + + Workbook wb = new XSSFWorkbook(); + Sheet sheet = wb.createSheet(); + AtomicInteger ai = new AtomicInteger(); + { + Row row = sheet.createRow(ai.getAndIncrement()); + AtomicInteger at = new AtomicInteger(); + fieldList.forEach(field -> { + ExcelColumn annotation = field.getAnnotation(ExcelColumn.class); + String columnName = ""; + if (annotation != null) { + columnName = annotation.value(); + } + Cell cell = row.createCell(at.getAndIncrement()); + CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + Font font = wb.createFont(); + font.setBoldweight(Font.BOLDWEIGHT_BOLD); + cellStyle.setFont(font); + cell.setCellStyle(cellStyle); + cell.setCellValue(columnName); + }); + + if (list != null) { + list.forEach(data -> { + Row r = sheet.createRow(ai.getAndIncrement()); + AtomicInteger a = new AtomicInteger(); + fieldList.forEach(field -> { + try { + Class type = field.getType(); + Object value = field.get(data); + Cell cell = r.createCell(a.getAndIncrement()); + if (value != null) { + cell.setCellValue(value.toString()); + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + }); + }); + for (int i = 0; i < list.size(); i++) { + sheet.autoSizeColumn(i); + } + } + String fileName = String.valueOf(new Date().getTime()); + buildExcelDocument(fileName + "." + EXCEL2007, wb, response); + } + } + + + private static void setStyle(CellStyle cellStyle) { + // 水平居中 + cellStyle.setAlignment(CellStyle.ALIGN_CENTER); + // 垂直居中 + cellStyle.setVerticalAlignment(CellStyle.ALIGN_CENTER); + // 边框 + cellStyle.setBorderTop(CellStyle.BORDER_THIN); + // 边框 + cellStyle.setBorderLeft(CellStyle.BORDER_THIN); + // 边框 + cellStyle.setBorderRight(CellStyle.BORDER_THIN); + // 边框 + cellStyle.setBorderBottom(CellStyle.BORDER_THIN); + } + + private static void handleField(T t, String value, Field field) throws Exception { + Class type = field.getType(); + if (type == null || type == void.class || StringUtils.isBlank(value)) { + return; + } + if (type == Object.class) { + field.set(t, value); + //数字类型 + } else if (type.getSuperclass() == null || type.getSuperclass() == Number.class) { + if (type == int.class || type == Integer.class) { + field.set(t, NumberUtils.toInt(value)); + } else if (type == long.class || type == Long.class) { + field.set(t, NumberUtils.toLong(value)); + } else if (type == byte.class || type == Byte.class) { + field.set(t, NumberUtils.toByte(value)); + } else if (type == short.class || type == Short.class) { + field.set(t, NumberUtils.toShort(value)); + } else if (type == double.class || type == Double.class) { + field.set(t, NumberUtils.toDouble(value)); + } else if (type == float.class || type == Float.class) { + field.set(t, NumberUtils.toFloat(value)); + } else if (type == char.class || type == Character.class) { + field.set(t, CharUtils.toChar(value)); + } else if (type == boolean.class) { + field.set(t, BooleanUtils.toBoolean(value)); + } else if (type == BigDecimal.class) { + field.set(t, new BigDecimal(value)); + } + } else if (type == Boolean.class) { + field.set(t, BooleanUtils.toBoolean(value)); + } else if (type == Date.class) { + // + field.set(t, value); + } else if (type == String.class) { + field.set(t, value); + } else { + Constructor constructor = type.getConstructor(String.class); + field.set(t, constructor.newInstance(value)); + } + } + + private static String getCellValue(Cell cell) { + if (cell == null) { + return ""; + } + + if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + if (DateUtil.isCellDateFormatted(cell)) { + return HSSFDateUtil.getJavaDate(cell.getNumericCellValue()).toString(); + } else { + return new BigDecimal(cell.getNumericCellValue()).toString(); + } + } else if (cell.getCellType() == Cell.CELL_TYPE_STRING) { + return StringUtils.trimToEmpty(cell.getStringCellValue()); + } else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) { + return StringUtils.trimToEmpty(cell.getCellFormula()); + } else if (cell.getCellType() == Cell.CELL_TYPE_BLANK) { + return ""; + } else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) { + return String.valueOf(cell.getBooleanCellValue()); + } else if (cell.getCellType() == Cell.CELL_TYPE_ERROR) { + return "ERROR"; + } else { + return cell.toString().trim(); + } + } + + private static void buildExcelDocument(String fileName, Workbook wb, HttpServletResponse response){ + try { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "utf-8")); + response.flushBuffer(); + wb.write(response.getOutputStream()); + } catch (IOException e) { + log.error(String.format("downLoad excel exception"), e); + } + } + + private static void buildExcelFile(String path, Workbook wb){ + File file = new File(path); + if (file.exists()) { + file.delete(); + } + + try { + wb.write(new FileOutputStream(file)); + } catch (Exception e) { + log.error(String.format("downLoad excel exception"), e); + } + } +} diff --git a/src/main/java/com/subsidy/util/tree/Node.java b/src/main/java/com/subsidy/util/tree/Node.java new file mode 100644 index 0000000..bf53d6e --- /dev/null +++ b/src/main/java/com/subsidy/util/tree/Node.java @@ -0,0 +1,42 @@ +package com.subsidy.util.tree; + +import lombok.Data; + +@Data +public class Node implements Comparable { + + //主键 + private String id; + + //同级节点第几个元素 + private String number; + + //1.1 + private String text; + + //父节点 + private String parentId; + + private int level; + + public Node(String id, String number, String parentId, int level) { + this.id = id; + this.number = number; + this.parentId = parentId; + this.level = level; + } + + @Override + public int compareTo(Node o) { + if (this.level != o.level) { + return o.level - this.level; + } else { + if(this.number==null){ + return -1; + } + return this.number.compareTo(o.number); + } + } + + +} diff --git a/src/main/java/com/subsidy/util/tree/NumberTree.java b/src/main/java/com/subsidy/util/tree/NumberTree.java new file mode 100644 index 0000000..d051a9f --- /dev/null +++ b/src/main/java/com/subsidy/util/tree/NumberTree.java @@ -0,0 +1,212 @@ +package com.subsidy.util.tree; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class NumberTree { + + private String id; + + private List nodeList; + + private String separator; + + private int idSeq; + + private SerialNumber number; + + public NumberTree(String separator, SerialNumber number) { + init(); + this.separator = separator; + this.number = number; + + } + + public void init() { + idSeq = 1; + this.separator = "."; + if (this.nodeList == null) { + nodeList = new ArrayList(); + } + } + + + /** + *

功能描述:根据父节点获取所有子节点。

+ */ + public List getChildNodes(Node pNode) { + String pId = pNode.getId(); + return getChildNodes(pId); + } + + /** + *

功能描述:根据父节点获取所有子节点。

+ */ + public List getChildNodes(String pId) { + List childNodes = new ArrayList(); + for (Node n : nodeList) { + if (pId.equals(n.getParentId())) { + childNodes.add(n); + } + } + + return childNodes; + } + + /** + *

功能描述:获取本级值最大的节点。

+ */ + public Node getMaxNodeForThisLevel(Node pNode) { + List childList = getChildNodes(pNode); + Node root = getRoot(nodeList); + if (childList.size() <= 0) { + return null; + } + Node maxNode = root; + for (Node node : childList) { + if (maxNode.getNumber().compareTo(node.getNumber()) < 0) { + maxNode = node; + } + } + return maxNode; + } + + /** + *

功能描述:生成下一个子节点。

+ */ + public Node generateNextChildNode(Node node) { + Node newNode = null; + Node maxNode = getMaxNodeForThisLevel(node); + String nextNumber = number.firstNumber(); + int level = node.getLevel(); + if (maxNode != null && !"0".equals(maxNode.getId())) {//本级存在子节点,且非根节点 + nextNumber = number.produceNext(maxNode.getNumber()); + level = maxNode.getLevel(); + } + newNode = new Node(String.valueOf(++idSeq), nextNumber, node.getId(), level); + + generateNodeText(newNode, nextNumber); + + return newNode; + } + + + /** + * + *

功能描述:获取父节点。

+ */ + public Node getParentNode(Node node) { + for (Node n : nodeList) { + if (node.getParentId() == n.getId()) { + return n; + } + } + return node; + } + + /** + *

功能描述:生成节点路径。

+ */ + public void generateNodeText(Node node, String text) { + + if (node == null || "0".equals(node.getId())) { + return; + } + + Node pNode = getParentNode(node); + + if (!"0".equals(pNode.getId())) { + text = pNode.getText() + separator + text; + } + + node.setText(text); + } + + /** + *

功能描述:遍历所有树节点。

+ */ + public void traverseNodeList(Node node) { + if(node==null){ + node = getRoot(nodeList); + } + List childNodes = getChildNodes(node); + System.out.println(node.getText()); + if (childNodes.size() > 0) { + for (Node n : childNodes) { + traverseNodeList(n); + } + } + } + public static void main(String[] args) { + SerialNumber number = new SerialNumber(); + NumberTree treeNode = new NumberTree(".", number); + + addSomeNodes(treeNode); + treeNode.traverseNodeList(null); + } + + /** + *

功能描述:获取根节点。

+ */ + public Node getRoot(List nodeList) { + Node root = null; + if (nodeList.size() <= 0 || (root = getNodeById(nodeList, "0")) == null) { + root = createRoot(); + nodeList.add(root); + } + return root; + } + + private Node getNodeById(List nodeList, String id) { + Node node = null; + if(id!=null){ + for (Node n : nodeList) { + if (id.equals(n.getId())) { + node = n; + break; + } + } + } + return node; + } + + private Node createRoot() { + Node root = new Node("0", number.rootNumber(), "-1", 0); + root.setText("0"); + return root; + } + + /** + *

功能描述:测试添加节点。

+ */ + private static Node addSomeNodes(NumberTree tree) { + Node root = tree.getRoot(tree.nodeList); + Node node1 = getNextNode(tree, root);//1 + Node node2 = getNextNode(tree, root);//2 + Node node3 = getNextNode(tree, root);//3 + Node node11 = getNextNode(tree, node1);//1.1 + Node node12 = getNextNode(tree, node1);//1.2 + Node node21 = getNextNode(tree, node2);//2.1 + Node node211 = getNextNode(tree, node21);//2.1.1 + Node node212 = getNextNode(tree, node21);//2.1.2 + Node node22 = getNextNode(tree, node2);//2.2 + Node node221 = getNextNode(tree, node22);//2.2.1 + Node node31 = getNextNode(tree, node3); + Node node32 = getNextNode(tree, node3); + Node node311 = getNextNode(tree, node31); + Node node3111 = getNextNode(tree, node311); + return root; + } + + public static Node getNextNode(NumberTree tree, Node pNode) { + Node node = tree.generateNextChildNode(pNode); + if (node != null) { + tree.nodeList.add(node); + } + return node; + } + +} diff --git a/src/main/java/com/subsidy/util/tree/SerialNumber.java b/src/main/java/com/subsidy/util/tree/SerialNumber.java new file mode 100644 index 0000000..02a5e31 --- /dev/null +++ b/src/main/java/com/subsidy/util/tree/SerialNumber.java @@ -0,0 +1,28 @@ +package com.subsidy.util.tree; + +public class SerialNumber{ + + public String produceNext(String crrnt) { + + String next = "0"; + if (crrnt != null) { + try { + int crrntNum = Integer.parseInt(crrnt); + next = String.valueOf(crrntNum + 1); + } catch (Exception e) { + System.err.println("非数字类型的字符串!"); + } + } + return next; + } + + public String rootNumber() { + return "0"; + } + + public String firstNumber() { + return "1"; + } + + +} diff --git a/src/main/resources/mapper/AdministerMapper.xml b/src/main/resources/mapper/AdministerMapper.xml new file mode 100644 index 0000000..c4bdce7 --- /dev/null +++ b/src/main/resources/mapper/AdministerMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, telephone, password, user_name, short_name, img, banner, status, field + + + + + + + diff --git a/src/main/resources/mapper/CategoryMapper.xml b/src/main/resources/mapper/CategoryMapper.xml new file mode 100644 index 0000000..d896583 --- /dev/null +++ b/src/main/resources/mapper/CategoryMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, name + + + diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml new file mode 100644 index 0000000..0084dcd --- /dev/null +++ b/src/main/resources/mapper/ClassDictMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, class_name, course_id, start_date, end_date + + + + + diff --git a/src/main/resources/mapper/ClassMemberMappingMapper.xml b/src/main/resources/mapper/ClassMemberMappingMapper.xml new file mode 100644 index 0000000..e26d2d7 --- /dev/null +++ b/src/main/resources/mapper/ClassMemberMappingMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, member_id, class_id + + + diff --git a/src/main/resources/mapper/CourseContentMapper.xml b/src/main/resources/mapper/CourseContentMapper.xml new file mode 100644 index 0000000..dca213d --- /dev/null +++ b/src/main/resources/mapper/CourseContentMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, course_id, content, order_no + + + diff --git a/src/main/resources/mapper/CourseDictMapper.xml b/src/main/resources/mapper/CourseDictMapper.xml new file mode 100644 index 0000000..e7c0df9 --- /dev/null +++ b/src/main/resources/mapper/CourseDictMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, course_name, category_id, course_type, course_source + + + + + diff --git a/src/main/resources/mapper/DepartmentDictMapper.xml b/src/main/resources/mapper/DepartmentDictMapper.xml new file mode 100644 index 0000000..046c41b --- /dev/null +++ b/src/main/resources/mapper/DepartmentDictMapper.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, department_name, department_leader_id, parent_id, children + + + + + diff --git a/src/main/resources/mapper/ExerciseDictMapper.xml b/src/main/resources/mapper/ExerciseDictMapper.xml new file mode 100644 index 0000000..7c0cd4f --- /dev/null +++ b/src/main/resources/mapper/ExerciseDictMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, exercise_type, course_id, difficulty, title, items, right_answer, detail + + + diff --git a/src/main/resources/mapper/FileDictMapper.xml b/src/main/resources/mapper/FileDictMapper.xml new file mode 100644 index 0000000..8ef3647 --- /dev/null +++ b/src/main/resources/mapper/FileDictMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, content_id, file_name, file_size, order_no + + + diff --git a/src/main/resources/mapper/MemberMapper.xml b/src/main/resources/mapper/MemberMapper.xml new file mode 100644 index 0000000..e0d3576 --- /dev/null +++ b/src/main/resources/mapper/MemberMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, user_name, telephone, password, gender, image, id_card + + + diff --git a/src/main/resources/mapper/PermissionsDictMapper.xml b/src/main/resources/mapper/PermissionsDictMapper.xml new file mode 100644 index 0000000..9968c9a --- /dev/null +++ b/src/main/resources/mapper/PermissionsDictMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, parent_id, name, children + + + diff --git a/src/main/resources/mapper/RoleAdministerMappingMapper.xml b/src/main/resources/mapper/RoleAdministerMappingMapper.xml new file mode 100644 index 0000000..be38418 --- /dev/null +++ b/src/main/resources/mapper/RoleAdministerMappingMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, administer_id, role_id + + + diff --git a/src/main/resources/mapper/RoleDictMapper.xml b/src/main/resources/mapper/RoleDictMapper.xml new file mode 100644 index 0000000..4339e33 --- /dev/null +++ b/src/main/resources/mapper/RoleDictMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, role + + + diff --git a/src/main/resources/mapper/RolePermissionMappingMapper.xml b/src/main/resources/mapper/RolePermissionMappingMapper.xml new file mode 100644 index 0000000..65fa02d --- /dev/null +++ b/src/main/resources/mapper/RolePermissionMappingMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, role_id, permission_id + + + diff --git a/src/main/resources/mapper/VodDictMapper.xml b/src/main/resources/mapper/VodDictMapper.xml new file mode 100644 index 0000000..af8d323 --- /dev/null +++ b/src/main/resources/mapper/VodDictMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, content_id, vod_name, vod_length, vod_type, vod_size, vod_url, vod_code + + + + + -- libgit2 0.25.0