├── doc ├── images │ ├── sentinel01.png │ ├── swagger01.png │ ├── apm-agent01.png │ ├── apm-agent02.png │ ├── apm-agent03.png │ ├── apm-agent04.png │ ├── spring-metrice01.png │ ├── spring-metrice02.png │ ├── spring-metrice03.png │ ├── spring-metrice04.png │ ├── springboot-admin01.png │ └── springboot-admin02.png ├── config │ ├── pisces-gateway-sentinel-flow-rule.json │ └── pisces-amqp-dev.yaml ├── front │ ├── cros.md │ └── readme.md └── readme.md ├── pisces-auth └── src │ ├── main │ ├── resources │ │ ├── jwt.jks │ │ ├── bootstrap.yml │ │ └── mapper │ │ │ ├── UserMapper.xml │ │ │ └── RoleMapper.xml │ └── java │ │ └── com │ │ └── besscroft │ │ └── pisces │ │ └── auth │ │ ├── mapper │ │ ├── UserMapper.java │ │ └── RoleMapper.java │ │ ├── service │ │ ├── UserService.java │ │ └── impl │ │ │ └── UserServiceImpl.java │ │ ├── domain │ │ └── Oauth2Token.java │ │ ├── PiscesAuthApplication.java │ │ ├── exception │ │ └── Oauth2ExceptionHandler.java │ │ ├── component │ │ └── JwtTokenEnhancer.java │ │ ├── controller │ │ └── PublicKeyController.java │ │ └── config │ │ └── SpringDocConfig.java │ └── test │ └── java │ └── com │ └── besscroft │ └── pisces │ └── auth │ ├── PiscesAuthApplicationTests.java │ └── service │ └── UserServiceTest.java ├── pisces-framework ├── pisces-cache │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── spring.factories │ │ │ └── java │ │ │ └── com │ │ │ └── besscroft │ │ │ └── pisces │ │ │ └── framework │ │ │ └── cache │ │ │ ├── component │ │ │ └── PiscesKeyGenerator.java │ │ │ └── config │ │ │ └── CacheAutoConfiguration.java │ └── pom.xml ├── pisces-common │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── besscroft │ │ │ └── pisces │ │ │ └── framework │ │ │ └── common │ │ │ ├── dto │ │ │ ├── WhiteDictDto.java │ │ │ └── UserDto.java │ │ │ ├── exception │ │ │ ├── ErrorCode.java │ │ │ └── PiscesException.java │ │ │ ├── enums │ │ │ └── DictGroupEnum.java │ │ │ ├── constant │ │ │ ├── SystemDictConstants.java │ │ │ ├── MessageConstant.java │ │ │ ├── AMQPConstant.java │ │ │ ├── AuthConstants.java │ │ │ └── HttpStatus.java │ │ │ ├── entity │ │ │ ├── Log.java │ │ │ ├── ResourceCategory.java │ │ │ ├── Dict.java │ │ │ ├── Depart.java │ │ │ ├── White.java │ │ │ ├── Role.java │ │ │ └── Resource.java │ │ │ └── util │ │ │ └── SecurityUtils.java │ │ └── resources │ │ └── banner.txt ├── pom.xml └── pisces-mybatis │ ├── pom.xml │ └── src │ └── main │ └── java │ └── com │ └── besscroft │ └── pisces │ └── framework │ └── mybatis │ └── handler │ └── CustomMetaObjectHandler.java ├── pisces-amqp └── src │ ├── test │ └── java │ │ └── com │ │ └── besscroft │ │ └── pisces │ │ └── amqp │ │ └── PiscesAmqpApplicationTests.java │ └── main │ ├── java │ └── com │ │ └── besscroft │ │ └── pisces │ │ └── amqp │ │ ├── PiscesAmqpApplication.java │ │ ├── service │ │ └── PushService.java │ │ ├── config │ │ ├── TgConfiguration.java │ │ ├── BarkConfiguration.java │ │ ├── ServerChanConfiguration.java │ │ └── RabbitQueueConfiguration.java │ │ └── listener │ │ └── MessageReceiverListener.java │ └── resources │ └── bootstrap.yml ├── pisces-api ├── pisces-file │ └── src │ │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── besscroft │ │ │ └── pisces │ │ │ └── file │ │ │ ├── PiscesFileApplicationTests.java │ │ │ └── service │ │ │ └── StorageServiceTest.java │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── besscroft │ │ │ └── pisces │ │ │ └── file │ │ │ ├── config │ │ │ ├── OSSAutoConfiguration.java │ │ │ ├── OSSProperties.java │ │ │ ├── SpringDocConfig.java │ │ │ ├── MinioOSSConfiguration.java │ │ │ └── AliyunOSSConfiguration.java │ │ │ ├── PiscesFileApplication.java │ │ │ ├── service │ │ │ └── StorageService.java │ │ │ └── controller │ │ │ ├── MinioController.java │ │ │ └── AliyunOSSController.java │ │ └── resources │ │ └── bootstrap.yml └── pom.xml ├── pisces-admin ├── admin-boot │ └── src │ │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── besscroft │ │ │ └── pisces │ │ │ └── admin │ │ │ └── PiscesAdminApplicationTests.java │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── besscroft │ │ │ └── pisces │ │ │ └── admin │ │ │ ├── mapper │ │ │ ├── LogMapper.java │ │ │ ├── WhiteMapper.java │ │ │ ├── ResourceCategoryMapper.java │ │ │ ├── DictMapper.java │ │ │ ├── DepartMapper.java │ │ │ ├── ResourceMapper.java │ │ │ ├── MenuMapper.java │ │ │ └── RoleMapper.java │ │ │ ├── service │ │ │ ├── LogService.java │ │ │ ├── impl │ │ │ │ ├── LogServiceImpl.java │ │ │ │ └── DictServiceImpl.java │ │ │ ├── DictService.java │ │ │ ├── WhiteService.java │ │ │ ├── ResourceCategoryService.java │ │ │ ├── DepartService.java │ │ │ ├── ResourceService.java │ │ │ ├── MenuService.java │ │ │ └── RoleService.java │ │ │ ├── domain │ │ │ ├── dto │ │ │ │ ├── DepartDictDto.java │ │ │ │ ├── ResourceCategoryDictDto.java │ │ │ │ ├── RoleResourceRelationDto.java │ │ │ │ ├── RoleDictDto.java │ │ │ │ ├── MenuDictDto.java │ │ │ │ ├── DepartTreeDto.java │ │ │ │ ├── ResourceDto.java │ │ │ │ ├── DepartDto.java │ │ │ │ └── MenuDto.java │ │ │ ├── param │ │ │ │ ├── menu │ │ │ │ │ ├── MenuPageListParam.java │ │ │ │ │ ├── ChangeMenuStatusParam.java │ │ │ │ │ └── AddMenuParam.java │ │ │ │ ├── role │ │ │ │ │ ├── RolePageListParam.java │ │ │ │ │ ├── ChangeRoleStatusParam.java │ │ │ │ │ ├── UpdateMenuByRoleParam.java │ │ │ │ │ ├── UpdateResourceByRoleParam.java │ │ │ │ │ ├── AddRoleParam.java │ │ │ │ │ └── UpdateRoleByRoleParam.java │ │ │ │ ├── dict │ │ │ │ │ ├── DictPageListParam.java │ │ │ │ │ ├── AddDictParam.java │ │ │ │ │ └── UpdateDictParam.java │ │ │ │ ├── white │ │ │ │ │ ├── WhitePageListParam.java │ │ │ │ │ ├── AddWhiteParam.java │ │ │ │ │ └── UpdateWhiteParam.java │ │ │ │ ├── depart │ │ │ │ │ ├── DepartPageListParam.java │ │ │ │ │ ├── AddDepartParam.java │ │ │ │ │ └── UpdateDepartParam.java │ │ │ │ ├── resource │ │ │ │ │ ├── ResourcePageListParam.java │ │ │ │ │ ├── AddResourceParam.java │ │ │ │ │ └── UpdateResourceParam.java │ │ │ │ ├── resourceCategory │ │ │ │ │ ├── ResourceCategoryPageListParam.java │ │ │ │ │ ├── AddResourceCategoryParam.java │ │ │ │ │ └── UpdateResourceCategoryParam.java │ │ │ │ ├── LoginParam.java │ │ │ │ ├── user │ │ │ │ │ ├── UpdatePasswordParam.java │ │ │ │ │ ├── UserPageListParam.java │ │ │ │ │ ├── ChangeUserStatusParam.java │ │ │ │ │ ├── UpdateDepartByUserParam.java │ │ │ │ │ ├── UpdateRoleByUserParam.java │ │ │ │ │ ├── UpdateUserParam.java │ │ │ │ │ └── AddUserParam.java │ │ │ │ └── PageParam.java │ │ │ └── vo │ │ │ │ ├── RouterVo.java │ │ │ │ └── MetaVo.java │ │ │ ├── event │ │ │ └── ClearCacheEvent.java │ │ │ ├── component │ │ │ ├── RoleResourceRulesHolder.java │ │ │ └── PasswordEncoderConfiguration.java │ │ │ ├── converter │ │ │ ├── DictConverterMapper.java │ │ │ ├── UserConverterMapper.java │ │ │ ├── RoleConverterMapper.java │ │ │ ├── WhiteConverterMapper.java │ │ │ ├── ResourceConverterMapper.java │ │ │ ├── MenuConverterMapper.java │ │ │ ├── ResourceCategoryConverterMapper.java │ │ │ └── DepartConverterMapper.java │ │ │ ├── PiscesAdminApplication.java │ │ │ ├── sender │ │ │ ├── MessageSender.java │ │ │ └── impl │ │ │ │ └── MessageSenderImpl.java │ │ │ ├── listener │ │ │ └── TransactionalMessageListener.java │ │ │ └── config │ │ │ └── SpringDocConfig.java │ │ └── resources │ │ ├── mapper │ │ ├── LogMapper.xml │ │ ├── WhiteMapper.xml │ │ ├── ResourceCategoryMapper.xml │ │ ├── DepartMapper.xml │ │ └── DictMapper.xml │ │ └── bootstrap.yml ├── admin-api │ ├── src │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── besscroft │ │ │ │ └── pisces │ │ │ │ └── common │ │ │ │ └── admin │ │ │ │ └── api │ │ │ │ └── AdminApiApplicationTests.java │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── besscroft │ │ │ └── pisces │ │ │ └── admin │ │ │ └── api │ │ │ ├── fallback │ │ │ └── AuthFeignFallbackClient.java │ │ │ └── AuthFeignClient.java │ └── pom.xml └── pom.xml ├── pisces-gateway └── src │ ├── test │ └── java │ │ └── com │ │ └── besscroft │ │ └── pisces │ │ └── gateway │ │ └── PiscesGatewayApplicationTests.java │ └── main │ ├── java │ └── com │ │ └── besscroft │ │ └── pisces │ │ └── gateway │ │ ├── retry │ │ ├── AuthRetry.java │ │ ├── WhiteRetry.java │ │ └── impl │ │ │ ├── AuthRetryImpl.java │ │ │ └── WhiteRetryImpl.java │ │ ├── config │ │ ├── SentinelGatewayConfiguration.java │ │ └── GlobalCorsConfiguration.java │ │ ├── PiscesGatewayApplication.java │ │ ├── filter │ │ └── AuthGlobalFilter.java │ │ └── handler │ │ └── SentinelExceptionHandler.java │ └── resources │ └── bootstrap.yml ├── .gitignore ├── .github ├── docker │ ├── jar │ │ ├── pisces-amqp │ │ │ └── Dockerfile │ │ ├── pisces-auth │ │ │ └── Dockerfile │ │ ├── pisces-file │ │ │ └── Dockerfile │ │ ├── pisces-gateway │ │ │ └── Dockerfile │ │ └── pisces-admin │ │ │ └── Dockerfile │ └── agent │ │ ├── pisces-amqp │ │ └── Dockerfile │ │ ├── pisces-file │ │ └── Dockerfile │ │ ├── pisces-gateway │ │ └── Dockerfile │ │ ├── pisces-auth │ │ └── Dockerfile │ │ └── pisces-admin │ │ └── Dockerfile └── workflows │ └── release-tag.yml ├── LICENSE └── fork-and-push.md /doc/images/sentinel01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/sentinel01.png -------------------------------------------------------------------------------- /doc/images/swagger01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/swagger01.png -------------------------------------------------------------------------------- /doc/images/apm-agent01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/apm-agent01.png -------------------------------------------------------------------------------- /doc/images/apm-agent02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/apm-agent02.png -------------------------------------------------------------------------------- /doc/images/apm-agent03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/apm-agent03.png -------------------------------------------------------------------------------- /doc/images/apm-agent04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/apm-agent04.png -------------------------------------------------------------------------------- /doc/images/spring-metrice01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/spring-metrice01.png -------------------------------------------------------------------------------- /doc/images/spring-metrice02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/spring-metrice02.png -------------------------------------------------------------------------------- /doc/images/spring-metrice03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/spring-metrice03.png -------------------------------------------------------------------------------- /doc/images/spring-metrice04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/spring-metrice04.png -------------------------------------------------------------------------------- /doc/images/springboot-admin01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/springboot-admin01.png -------------------------------------------------------------------------------- /doc/images/springboot-admin02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/doc/images/springboot-admin02.png -------------------------------------------------------------------------------- /pisces-auth/src/main/resources/jwt.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/besscroft/pisces-cloud/HEAD/pisces-auth/src/main/resources/jwt.jks -------------------------------------------------------------------------------- /pisces-framework/pisces-cache/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.besscroft.pisces.framework.cache.config.RedisTemplateConfiguration -------------------------------------------------------------------------------- /doc/config/pisces-gateway-sentinel-flow-rule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "/pisces-admin/user/list", 4 | "limitApp": "default", 5 | "grade": 1, 6 | "count": 10, 7 | "strategy": 0, 8 | "controlBehavior": 0, 9 | "clusterMode": false 10 | } 11 | ] -------------------------------------------------------------------------------- /pisces-amqp/src/test/java/com/besscroft/pisces/amqp/PiscesAmqpApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class PiscesAmqpApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pisces-auth/src/test/java/com/besscroft/pisces/auth/PiscesAuthApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class PiscesAuthApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/test/java/com/besscroft/pisces/file/PiscesFileApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class PiscesFileApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/test/java/com/besscroft/pisces/admin/PiscesAdminApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class PiscesAdminApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pisces-gateway/src/test/java/com/besscroft/pisces/gateway/PiscesGatewayApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class PiscesGatewayApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pisces-admin/admin-api/src/test/java/com/besscroft/pisces/common/admin/api/AdminApiApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.common.admin.api; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class AdminApiApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/retry/AuthRetry.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.retry; 2 | 3 | /** 4 | * @Description 异步远程调用——处理载入权限缓存——重试方法 5 | * @Author Bess Croft 6 | * @Date 2022/9/16 21:25 7 | */ 8 | public interface AuthRetry { 9 | 10 | /** 11 | * 权限关系列表重试方法 12 | * @return 是否成功 13 | */ 14 | boolean retryAuthTask(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/retry/WhiteRetry.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.retry; 2 | 3 | /** 4 | * @Description 异步远程调用——处理载入白名单缓存——重试方法 5 | * @Author Bess Croft 6 | * @Date 2022/9/16 21:45 7 | */ 8 | public interface WhiteRetry { 9 | 10 | /** 11 | * 白名单列表重试方法 12 | * @return 是否成功 13 | */ 14 | boolean retryWhiteTask(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/LogMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.Log; 5 | 6 | /** 7 | * @Description 日志 Mapper 接口 8 | * @Author Bess Croft 9 | * @Date 2022/2/5 12:37 10 | */ 11 | public interface LogMapper extends BaseMapper { 12 | } 13 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/LogService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.framework.common.entity.Log; 5 | 6 | /** 7 | * @Description 日志服务接口 8 | * @Author Bess Croft 9 | * @Date 2022/2/5 12:39 10 | */ 11 | public interface LogService extends IService { 12 | } 13 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/DepartDictDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Description 部门字典封装对象 7 | * @Author Bess Croft 8 | * @Date 2022/4/30 17:40 9 | */ 10 | @Data 11 | public class DepartDictDto { 12 | 13 | /** 部门 id */ 14 | private Long departId; 15 | 16 | /** 部门名称 */ 17 | private String departName; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/dto/WhiteDictDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Description 白名单字典 封装对象 7 | * @Author Bess Croft 8 | * @Date 2022/5/14 22:01 9 | */ 10 | @Data 11 | public class WhiteDictDto { 12 | 13 | /** 白名单规则名称 */ 14 | private String title; 15 | 16 | /** 白名单规则地址 */ 17 | private String path; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/ResourceCategoryDictDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Description 7 | * @Author Bess Croft 8 | * @Date 2022/4/30 15:42 9 | */ 10 | @Data 11 | public class ResourceCategoryDictDto { 12 | 13 | /** 资源类别 id */ 14 | private Long resourceCategoryId; 15 | 16 | /** 资源类别名称 */ 17 | private String categoryName; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/RoleResourceRelationDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Description 角色资源关系对象 7 | * @Author Bess Croft 8 | * @Date 2022/3/4 21:31 9 | */ 10 | @Data 11 | public class RoleResourceRelationDto { 12 | 13 | private Long id; 14 | 15 | /** 角色ID */ 16 | private Long roleId; 17 | 18 | /** 资源ID */ 19 | private Long resourceId; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/RoleDictDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Description 角色字典 封装对象 7 | * @Author Bess Croft 8 | * @Date 2022/4/10 18:39 9 | */ 10 | @Data 11 | public class RoleDictDto { 12 | 13 | /** 角色 id */ 14 | private Long roleId; 15 | 16 | /** 角色名称 */ 17 | private String roleName; 18 | 19 | /** 角色编码 */ 20 | private String roleCode; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/MenuDictDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @Description 菜单字典 封装对象 9 | * @Author Bess Croft 10 | * @Date 2022/5/4 18:43 11 | */ 12 | @Data 13 | public class MenuDictDto { 14 | 15 | /** 菜单 id */ 16 | private Long value; 17 | 18 | /** 菜单标题 */ 19 | private String label; 20 | 21 | List children; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/DepartTreeDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @Description 部门树封装对象 9 | * @Author Bess Croft 10 | * @Date 2022/10/14 18:01 11 | */ 12 | @Data 13 | public class DepartTreeDto { 14 | 15 | /** 部门 id */ 16 | private Long departId; 17 | 18 | /** 部门名称 */ 19 | private String departName; 20 | 21 | private List children; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/menu/MenuPageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.menu; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Description 菜单列表 请求参数 8 | * @Author Bess Croft 9 | * @Date 2022/3/24 14:41 10 | */ 11 | @Data 12 | @Schema(title = "菜单列表请求参数") 13 | public class MenuPageListParam { 14 | 15 | /** 查询参数 */ 16 | @Schema(title = "查询参数", type = "String") 17 | private String queryKey; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/resources/mapper/LogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | id 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | /\ /\ 2 | |`\\_,--="=--,_//`| 3 | \ ." :'. .': ". / 4 | ==) _ : ' : _ (== 5 | |>/O\ _ /O\<| 6 | | \-"~` _ `~"-/ | 7 | >|`===. \_/ .===`|< 8 | .-"-. \===' | '===/ .-"-. 9 | .---{'. '`}---\, .-'-. ,/---{.'. '}---. 10 | ) `"---"` `~-===-~` `"---"` ( 11 | ( Pisces-Cloud ) 12 | ) SPRING IS IN THE AIR! ( 13 | '---------------------------------------' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | /logs 7 | **/**/logs 8 | 9 | ### STS ### 10 | .apt_generated 11 | .classpath 12 | .factorypath 13 | .project 14 | .settings 15 | .springBeans 16 | .sts4-cache 17 | 18 | ### IntelliJ IDEA ### 19 | .idea 20 | *.iws 21 | *.iml 22 | *.ipr 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.User; 5 | 6 | /** 7 | * @Description 用户 mapper 接口 8 | * @Author Bess Croft 9 | * @Date 2022/2/4 13:16 10 | */ 11 | public interface UserMapper extends BaseMapper { 12 | 13 | /** 14 | * 根据用户名查询用户信息 15 | * @param username 用户名 16 | * @return 17 | */ 18 | User findByUsername(String username); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /.github/docker/jar/pisces-amqp/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM eclipse-temurin:17.0.4.1_1-jre-jammy 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置时区 6 | RUN set -eux; \ 7 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 8 | echo $TZ > /etc/timezone 9 | # 拷贝jar包,并重命名 10 | COPY ./pisces-amqp/target/pisces-amqp.jar /pisces-amqp.jar 11 | # 指定docker容器启动时运行jar包 12 | ENTRYPOINT exec java ${JAVA_OPTS} -jar /pisces-amqp.jar ${SPRING_CONFIG} 13 | # 指定维护者的名字 14 | MAINTAINER besscroft 15 | -------------------------------------------------------------------------------- /.github/docker/jar/pisces-auth/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM eclipse-temurin:17.0.4.1_1-jre-jammy 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置时区 6 | RUN set -eux; \ 7 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 8 | echo $TZ > /etc/timezone 9 | # 拷贝jar包,并重命名 10 | COPY ./pisces-auth/target/pisces-auth.jar /pisces-auth.jar 11 | # 指定docker容器启动时运行jar包 12 | ENTRYPOINT exec java ${JAVA_OPTS} -jar /pisces-auth.jar ${SPRING_CONFIG} 13 | # 指定维护者的名字 14 | MAINTAINER besscroft 15 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/java/com/besscroft/pisces/amqp/PiscesAmqpApplication.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @Slf4j 8 | @SpringBootApplication 9 | public class PiscesAmqpApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(PiscesAmqpApplication.class, args); 13 | log.info("(♥◠‿◠)ノ゙ Pisces Cloud 消息中心启动成功 ლ(´ڡ`ლ)゙ \n"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/event/ClearCacheEvent.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.event; 2 | 3 | import lombok.Getter; 4 | import org.springframework.context.ApplicationEvent; 5 | 6 | /** 7 | * @Description 定义缓存删除 Event 8 | * @Author Bess Croft 9 | * @Date 2022/5/21 22:40 10 | */ 11 | public class ClearCacheEvent extends ApplicationEvent { 12 | 13 | @Getter 14 | private String cacheKey; 15 | 16 | public ClearCacheEvent(String cacheKey) { 17 | super(cacheKey); 18 | this.cacheKey = cacheKey; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.github/docker/jar/pisces-file/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM eclipse-temurin:17.0.4.1_1-jre-jammy 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置时区 6 | RUN set -eux; \ 7 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 8 | echo $TZ > /etc/timezone 9 | # 拷贝jar包,并重命名 10 | COPY ./pisces-api/pisces-file/target/pisces-file.jar /pisces-file.jar 11 | # 指定docker容器启动时运行jar包 12 | ENTRYPOINT exec java ${JAVA_OPTS} -jar /pisces-file.jar ${SPRING_CONFIG} 13 | # 指定维护者的名字 14 | MAINTAINER besscroft 15 | -------------------------------------------------------------------------------- /.github/docker/jar/pisces-gateway/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM eclipse-temurin:17.0.4.1_1-jre-jammy 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置时区 6 | RUN set -eux; \ 7 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 8 | echo $TZ > /etc/timezone 9 | # 拷贝jar包,并重命名 10 | COPY ./pisces-gateway/target/pisces-gateway.jar /pisces-gateway.jar 11 | # 指定docker容器启动时运行jar包 12 | ENTRYPOINT exec java ${JAVA_OPTS} -jar /pisces-gateway.jar ${SPRING_CONFIG} 13 | # 指定维护者的名字 14 | MAINTAINER besscroft 15 | -------------------------------------------------------------------------------- /.github/docker/jar/pisces-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM eclipse-temurin:17.0.4.1_1-jre-jammy 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置时区 6 | RUN set -eux; \ 7 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 8 | echo $TZ > /etc/timezone 9 | # 拷贝jar包,并重命名 10 | COPY ./pisces-admin/admin-boot/target/pisces-admin.jar /pisces-admin.jar 11 | # 指定docker容器启动时运行jar包 12 | ENTRYPOINT exec java ${JAVA_OPTS} -jar /pisces-admin.jar ${SPRING_CONFIG} 13 | # 指定维护者的名字 14 | MAINTAINER besscroft 15 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/exception/ErrorCode.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.exception; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Description 异常错误码对象 7 | * @Author Bess Croft 8 | * @Date 2022/3/24 10:47 9 | */ 10 | @Data 11 | public class ErrorCode { 12 | 13 | /** 错误码 */ 14 | private final Integer code; 15 | 16 | /** 错误提示 */ 17 | private final String message; 18 | 19 | public ErrorCode(Integer code, String message) { 20 | this.code = code; 21 | this.message = message; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/enums/DictGroupEnum.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.enums; 2 | 3 | /** 4 | * @Description 字典分组枚举 5 | * @Author Bess Croft 6 | * @Date 2022/8/5 14:25 7 | */ 8 | public enum DictGroupEnum { 9 | 10 | RESOURCE("资源", "RESOURCE"); 11 | 12 | private final String code; 13 | private final String value; 14 | 15 | DictGroupEnum(String code, String value) { 16 | this.code = code; 17 | this.value = value; 18 | } 19 | 20 | public String getValue() { 21 | return value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/ResourceDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * @Description 资源树封装对象 9 | * @Author Bess Croft 10 | * @Date 2022/4/3 11:21 11 | */ 12 | @Data 13 | public class ResourceDto { 14 | 15 | private Long id; 16 | 17 | /** 资源名称 */ 18 | private String name; 19 | 20 | /** 资源路径 */ 21 | private String url; 22 | 23 | /** 资源描述 */ 24 | private String description; 25 | 26 | /** 子资源 **/ 27 | private List children; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.framework.common.dto.UserDto; 5 | import com.besscroft.pisces.framework.common.entity.User; 6 | 7 | /** 8 | * @Description 用户服务 9 | * @Author Bess Croft 10 | * @Date 2022/2/4 13:15 11 | */ 12 | public interface UserService extends IService { 13 | 14 | /** 15 | * 根据用户名查询用户信息 16 | * @param username 用户名 17 | * @return 用户信息 18 | */ 19 | UserDto loadUserByUsername(String username); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/impl/LogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.besscroft.pisces.framework.common.entity.Log; 5 | import com.besscroft.pisces.admin.mapper.LogMapper; 6 | import com.besscroft.pisces.admin.service.LogService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @Description 日志服务实现类 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 12:39 13 | */ 14 | @Service 15 | public class LogServiceImpl extends ServiceImpl implements LogService { 16 | } 17 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/domain/Oauth2Token.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.domain; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | /** 8 | * @Description 认证令牌 9 | * @Author Bess Croft 10 | * @Date 2022/2/4 16:08 11 | */ 12 | @Data 13 | @Builder 14 | @EqualsAndHashCode(callSuper = false) 15 | public class Oauth2Token { 16 | 17 | /** 访问令牌 */ 18 | private String token; 19 | 20 | /** 刷新令牌 */ 21 | private String refreshToken; 22 | 23 | /** 访问令牌头前缀 */ 24 | private String tokenHead; 25 | 26 | /** 有效时间(秒) */ 27 | private int expiresIn; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/config/OSSAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.config; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | /** 8 | * @Description 对象存储自动配置 9 | * @Author Bess Croft 10 | * @Date 2022/8/5 13:18 11 | */ 12 | @Configuration(proxyBeanMethods = false) 13 | @EnableConfigurationProperties(OSSProperties.class) 14 | @Import({AliyunOSSConfiguration.class, MinioOSSConfiguration.class}) 15 | public class OSSAutoConfiguration { 16 | } 17 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.Role; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 角色 mapper 接口 11 | * @Author Bess Croft 12 | * @Date 2022/2/4 15:48 13 | */ 14 | public interface RoleMapper extends BaseMapper { 15 | 16 | /** 17 | * 根据用户id查询角色 18 | * @param userId 用户id 19 | * @return 角色 20 | */ 21 | List findAllByUserId(@Param("userId") Long userId); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/java/com/besscroft/pisces/amqp/service/PushService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp.service; 2 | 3 | /** 4 | * @Description 推送服务 5 | * @Author Bess Croft 6 | * @Date 2022/9/4 12:38 7 | */ 8 | public interface PushService { 9 | 10 | /** 11 | * 推送消息到 bark 12 | * @param sendKey 发送密钥 13 | * @param message 消息内容 14 | * @return 推送结果 15 | */ 16 | String pushBark(String sendKey, String message); 17 | 18 | /** 19 | * 推送消息到 server 酱 20 | * @param sendKey 发送密钥 21 | * @param message 消息内容 22 | * @return 推送结果 23 | */ 24 | String pushServerChanSimple(String sendKey, String message); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/role/RolePageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.role; 2 | 3 | import com.besscroft.pisces.admin.domain.param.PageParam; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * @Description 角色分页列表 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/20 19:21 12 | */ 13 | @Data 14 | @Schema(title = "角色分页列表请求参数") 15 | @EqualsAndHashCode(callSuper = true) 16 | public class RolePageListParam extends PageParam { 17 | 18 | /** 查询参数 */ 19 | @Schema(title = "查询参数", type = "String") 20 | private String queryKey; 21 | 22 | } -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/constant/SystemDictConstants.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.constant; 2 | 3 | /** 4 | * @Description 系统字典常量 5 | * @Author Bess Croft 6 | * @Date 2022/4/10 18:49 7 | */ 8 | public interface SystemDictConstants { 9 | 10 | /** 角色字典 */ 11 | String ROLE = "system:dict:role"; 12 | 13 | /** 资源类别字典 */ 14 | String RESOURCE_CATEGORY = "system:dict:resource:category"; 15 | 16 | /** 部门字典 */ 17 | String DEPART = "system:dict:depart"; 18 | 19 | /** 菜单字典 */ 20 | String MENU = "system:dict:menu"; 21 | 22 | /** 白名单字典 */ 23 | String WHITE = "system:dict:white"; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/dict/DictPageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.dict; 2 | 3 | import com.besscroft.pisces.admin.domain.param.PageParam; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * @Description 字典分页接口 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/8/24 16:47 12 | */ 13 | @Data 14 | @Schema(title = "字典分页接口请求参数") 15 | @EqualsAndHashCode(callSuper = true) 16 | public class DictPageListParam extends PageParam { 17 | 18 | /** 查询参数 */ 19 | @Schema(title = "查询参数", type = "String") 20 | private String queryKey; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/WhiteMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.White; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 白名单 Mapper 接口 11 | * @Author Bess Croft 12 | * @Date 2022/5/14 18:20 13 | */ 14 | public interface WhiteMapper extends BaseMapper { 15 | 16 | /** 17 | * 根据关键字查询白名单信息 18 | * @param queryKey 关键字 19 | * @return 白名单信息 20 | */ 21 | List selectAllByQueryKey(@Param("queryKey") String queryKey); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/white/WhitePageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.white; 2 | 3 | import com.besscroft.pisces.admin.domain.param.PageParam; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * @Description 白名单分页接口 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/5/14 18:28 12 | */ 13 | @Data 14 | @Schema(title = "白名单分页接口请求参数") 15 | @EqualsAndHashCode(callSuper = true) 16 | public class WhitePageListParam extends PageParam { 17 | 18 | /** 查询参数 */ 19 | @Schema(title = "查询参数", type = "String") 20 | private String queryKey; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/constant/MessageConstant.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.constant; 2 | 3 | /** 4 | * @Description 消息常量 5 | * @Author Bess Croft 6 | * @Date 2022/2/2 21:40 7 | */ 8 | public interface MessageConstant { 9 | 10 | String LOGIN_SUCCESS = "登录成功!"; 11 | 12 | String USERNAME_PASSWORD_ERROR = "用户名或密码错误!"; 13 | 14 | String CREDENTIALS_EXPIRED = "该账户的登录凭证已过期,请重新登录!"; 15 | 16 | String ACCOUNT_DISABLED = "该账户已被禁用,请联系管理员!"; 17 | 18 | String ACCOUNT_LOCKED = "该账号已被锁定,请联系管理员!"; 19 | 20 | String ACCOUNT_EXPIRED = "该账号已过期,请联系管理员!"; 21 | 22 | String PERMISSION_DENIED = "没有访问权限,请联系管理员!"; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/depart/DepartPageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.depart; 2 | 3 | import com.besscroft.pisces.admin.domain.param.PageParam; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * @Description 部门/组织 分页列表 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/24 17:17 12 | */ 13 | @Data 14 | @Schema(title = "部门/组织分页列表请求参数") 15 | @EqualsAndHashCode(callSuper = true) 16 | public class DepartPageListParam extends PageParam { 17 | 18 | /** 查询参数 */ 19 | @Schema(title = "查询参数", type = "String") 20 | private String queryKey; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/resource/ResourcePageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.resource; 2 | 3 | import com.besscroft.pisces.admin.domain.param.PageParam; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * @Description 资源分页列表 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/24 17:17 12 | */ 13 | @Data 14 | @Schema(title = "资源分页列表请求参数") 15 | @EqualsAndHashCode(callSuper = true) 16 | public class ResourcePageListParam extends PageParam { 17 | 18 | /** 查询参数 */ 19 | @Schema(title = "查询参数", type = "String") 20 | private String queryKey; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /.github/workflows/release-tag.yml: -------------------------------------------------------------------------------- 1 | name: Create Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | build: 10 | name: Create Release 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - name: Get Version 15 | id: get_version 16 | run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} 17 | - name: Create Release 18 | id: create_release 19 | uses: actions/create-release@v1 20 | env: 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 22 | with: 23 | tag_name: ${{ github.ref }} 24 | release_name: ${{ github.ref }} 25 | draft: false 26 | prerelease: false -------------------------------------------------------------------------------- /doc/front/cros.md: -------------------------------------------------------------------------------- 1 | --- 2 | icon: creative 3 | category: Pisces 4 | --- 5 | 6 | # 跨域问题 7 | 8 | 跨源资源共享 (CORS)(或通俗地译为跨域资源共享)是一种基于 HTTP 头的机制,该机制通过允许服务器标示除了它自己以外的其它 origin(域,协议和端口),使得浏览器允许这些 origin 访问加载自己的资源。跨源资源共享还通过一种机制来检查服务器是否会允许要发送的真实请求,该机制通过浏览器发起一个到服务器托管的跨源资源的"预检"请求。在预检中,浏览器发送的头中标示有HTTP方法和真实请求中会用到的头。 9 | 10 | > 文中对跨域的解释,来源于 [MDN](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CORS) 11 | 12 | 大家应该知道,每一次浏览器发送请求时,会先以 `OPTIONS` 请求方式发送一个“预检请求”(这里需要说明的时,并不是所有请求都会发送 options 哦!),通过这个预检请求,从而获知服务器端对跨域请求支持的 `HTTP` 方法。在确认服务器允许跨域请求时,浏览器会再次发送真实请求。 13 | 14 | 不过,经验丰富的小伙伴们应该知道,我们在开发时,往往会采用 `proxy` 的方式解决跨域请求问题(详见 [文档](https://www.webpackjs.com/configuration/dev-server/#devserver-proxy))。不过,这种方式在生产环境中,是使用不了的。生产环境中,我们一般是使用 `nginx` 来进行处理的。 15 | 16 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/dto/UserDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 登录用户信息 11 | * @Author Bess Croft 12 | * @Date 2022/2/4 12:22 13 | */ 14 | @Data 15 | @EqualsAndHashCode(callSuper = false) 16 | @NoArgsConstructor 17 | public class UserDto { 18 | 19 | private Long id; 20 | 21 | private String username; 22 | 23 | private String password; 24 | 25 | private Integer status; 26 | 27 | private String clientId; 28 | 29 | private List roles; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/resourceCategory/ResourceCategoryPageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.resourceCategory; 2 | 3 | import com.besscroft.pisces.admin.domain.param.PageParam; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * @Description 资源类别分页列表 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/24 17:17 12 | */ 13 | @Data 14 | @Schema(title = "资源类别分页列表请求参数") 15 | @EqualsAndHashCode(callSuper = true) 16 | public class ResourceCategoryPageListParam extends PageParam { 17 | 18 | /** 查询参数 */ 19 | @Schema(title = "查询参数", type = "String") 20 | private String queryKey; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/white/AddWhiteParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.white; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Description 新增白名单 请求参数 8 | * @Author Bess Croft 9 | * @Date 2022/5/14 21:01 10 | */ 11 | @Data 12 | @Schema(title = "客户端登录请求参数") 13 | public class AddWhiteParam { 14 | 15 | /** 白名单规则名称 */ 16 | @Schema(title = "白名单规则名称", type = "String") 17 | private String title; 18 | 19 | /** 白名单规则地址 */ 20 | @Schema(title = "白名单规则地址", type = "String") 21 | private String path; 22 | 23 | /** 备注 */ 24 | @Schema(title = "备注", type = "String") 25 | private String remark; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/component/RoleResourceRulesHolder.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.component; 2 | 3 | import com.besscroft.pisces.admin.service.ResourceService; 4 | import lombok.RequiredArgsConstructor; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.annotation.PostConstruct; 8 | 9 | /** 10 | * @Description 角色资源规则初始化 处理 11 | * @Author Bess Croft 12 | * @Date 2022/3/4 21:41 13 | */ 14 | @Component 15 | @RequiredArgsConstructor 16 | public class RoleResourceRulesHolder { 17 | 18 | private final ResourceService resourceService; 19 | 20 | @PostConstruct 21 | public void initRoleResourceMap() { 22 | resourceService.initRoleResourceMap(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/ResourceCategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.ResourceCategory; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 资源类别 Mapper 接口 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 12:36 13 | */ 14 | public interface ResourceCategoryMapper extends BaseMapper { 15 | 16 | /** 17 | * 根据关键词查询资源类别信息 18 | * @param queryKey 关键词 19 | * @return 资源类别 20 | */ 21 | List selectAllByQueryKey(@Param("queryKey") String queryKey); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/config/SentinelGatewayConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.config; 2 | 3 | import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler; 4 | import com.besscroft.pisces.gateway.handler.SentinelExceptionHandler; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * @Description Sentinel Gateway 适配模块配置 10 | * @Author Bess Croft 11 | * @Date 2022/5/28 12:16 12 | */ 13 | @Configuration 14 | public class SentinelGatewayConfiguration { 15 | 16 | @Bean 17 | public BlockRequestHandler blockRequestHandler() { 18 | return new SentinelExceptionHandler(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /pisces-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.besscroft.pisces 7 | pisces-cloud 8 | ${revision} 9 | ../pom.xml 10 | 11 | 12 | pisces-api 13 | Pisces Cloud API 模块 14 | 15 | 16 | pisces-file 17 | 18 | pom 19 | 20 | 21 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/component/PasswordEncoderConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.component; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.security.crypto.factory.PasswordEncoderFactories; 6 | import org.springframework.security.crypto.password.PasswordEncoder; 7 | 8 | /** 9 | * @Description 密码处理器 10 | * @Author Bess Croft 11 | * @Date 2022/3/20 15:04 12 | */ 13 | @Configuration 14 | public class PasswordEncoderConfiguration { 15 | 16 | @Bean 17 | public PasswordEncoder passwordEncoder() { 18 | // 默认为 bcrypt 19 | return PasswordEncoderFactories.createDelegatingPasswordEncoder(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/LoginParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | import javax.validation.constraints.NotNull; 6 | 7 | /** 8 | * @Description 客户端登录请求参数 9 | * @Author Bess Croft 10 | * @Date 2022/2/4 16:15 11 | */ 12 | @Data 13 | @Schema(title = "客户端登录请求参数") 14 | public class LoginParam { 15 | 16 | /** 登录用户名 */ 17 | @NotNull(message = "登录用户名不能为空") 18 | @Schema(title = "登录用户名", type = "String", required = true) 19 | private String username; 20 | 21 | /** 登录密码 */ 22 | @NotNull(message = "登录密码不能为空") 23 | @Schema(title = "登录密码", type = "String", required = true) 24 | private String password; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/user/UpdatePasswordParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.user; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @Description 密码更新接口 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/11/5 20:29 12 | */ 13 | @Data 14 | public class UpdatePasswordParam { 15 | 16 | /** 旧密码 */ 17 | @NotBlank(message = "旧密码不能为空!") 18 | @Schema(title = "旧密码", type = "String", required = true) 19 | private String oldPassword; 20 | 21 | /** 新密码 */ 22 | @NotBlank(message = "新密码不能为空!") 23 | @Schema(title = "新密码", type = "String", required = true) 24 | private String newPassword; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/resourceCategory/AddResourceCategoryParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.resourceCategory; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | /** 7 | * @Description 新增资源类别请求参数 8 | * @Author Bess Croft 9 | * @Date 2022/5/8 14:49 10 | */ 11 | @Data 12 | @Schema(title = "新增资源类别请求参数") 13 | public class AddResourceCategoryParam { 14 | 15 | /** 资源类别名称 */ 16 | @Schema(title = "资源类别名称", type = "String") 17 | private String categoryName; 18 | 19 | /** 资源描述 */ 20 | @Schema(title = "资源描述", type = "String") 21 | private String description; 22 | 23 | /** 排序 */ 24 | @Schema(title = "排序", type = "Integer") 25 | private Integer sort; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/user/UserPageListParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.user; 2 | 3 | import com.besscroft.pisces.admin.domain.param.PageParam; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * @Description 用户分页列表 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/13 16:35 12 | */ 13 | @Data 14 | @Schema(title = "用户分页列表请求参数") 15 | @EqualsAndHashCode(callSuper = true) 16 | public class UserPageListParam extends PageParam { 17 | 18 | /** 查询参数 */ 19 | @Schema(title = "查询参数", type = "String") 20 | private String queryKey; 21 | 22 | /** 部门id */ 23 | @Schema(title = "部门id", type = "Long") 24 | private Long departId; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/PiscesAuthApplication.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | 9 | @Slf4j 10 | @EnableDiscoveryClient 11 | @SpringBootApplication(scanBasePackages = "com.besscroft.pisces") 12 | @MapperScan("com.besscroft.pisces.auth.mapper") 13 | public class PiscesAuthApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(PiscesAuthApplication.class, args); 17 | log.info("(♥◠‿◠)ノ゙ Pisces 认证中心启动成功 ლ(´ڡ`ლ)゙ \n"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/DictConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.param.dict.AddDictParam; 4 | import com.besscroft.pisces.admin.domain.param.dict.UpdateDictParam; 5 | import com.besscroft.pisces.framework.common.entity.Dict; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.factory.Mappers; 8 | 9 | /** 10 | * @Description 字典对象转换器 11 | * @Author Bess Croft 12 | * @Date 2022/8/28 13:31 13 | */ 14 | @Mapper(componentModel = "spring") 15 | public interface DictConverterMapper { 16 | 17 | DictConverterMapper INSTANCE = Mappers.getMapper(DictConverterMapper.class); 18 | 19 | Dict AddParamToDict(AddDictParam param); 20 | 21 | Dict UpdateParamToDict(UpdateDictParam param); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/UserConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.param.user.AddUserParam; 4 | import com.besscroft.pisces.admin.domain.param.user.UpdateUserParam; 5 | import com.besscroft.pisces.framework.common.entity.User; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.factory.Mappers; 8 | 9 | /** 10 | * @Description 用户对象转换器 11 | * @Author Bess Croft 12 | * @Date 2022/8/28 15:09 13 | */ 14 | @Mapper(componentModel = "spring") 15 | public interface UserConverterMapper { 16 | 17 | UserConverterMapper INSTANCE = Mappers.getMapper(UserConverterMapper.class); 18 | 19 | User AddParamToUser(AddUserParam param); 20 | 21 | User UpdateParamToUser(UpdateUserParam param); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.besscroft.pisces 7 | pisces-cloud 8 | ${revision} 9 | ../pom.xml 10 | 11 | 12 | pisces-admin 13 | Pisces Cloud 系统模块 14 | 15 | 16 | admin-api 17 | admin-boot 18 | 19 | pom 20 | 21 | 22 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/RoleConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.param.role.AddRoleParam; 4 | import com.besscroft.pisces.admin.domain.param.role.UpdateRoleByRoleParam; 5 | import com.besscroft.pisces.framework.common.entity.Role; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.factory.Mappers; 8 | 9 | /** 10 | * @Description 角色对象转换器 11 | * @Author Bess Croft 12 | * @Date 2022/8/28 15:09 13 | */ 14 | @Mapper(componentModel = "spring") 15 | public interface RoleConverterMapper { 16 | 17 | RoleConverterMapper INSTANCE = Mappers.getMapper(RoleConverterMapper.class); 18 | 19 | Role AddParamToRole(AddRoleParam param); 20 | 21 | Role UpdateParamToRole(UpdateRoleByRoleParam param); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/menu/ChangeMenuStatusParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.menu; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 菜单可用状态更改 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/24 15:16 12 | */ 13 | @Data 14 | @Schema(title = "菜单可用状态更改请求参数") 15 | public class ChangeMenuStatusParam { 16 | 17 | /** 菜单 id */ 18 | @Schema(title = "菜单 id", type = "Long", required = true) 19 | @NotNull(message = "菜单 id 不能为空") 20 | private Long menuId; 21 | 22 | /** 菜单可用状态 */ 23 | @Schema(title = "菜单可用状态", type = "Boolean", required = true) 24 | @NotNull(message = "菜单可用状态不能为空") 25 | private Boolean isHide; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/role/ChangeRoleStatusParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.role; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 角色可用状态更改 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/20 20:19 12 | */ 13 | @Data 14 | @Schema(title = "角色可用状态更改请求参数") 15 | public class ChangeRoleStatusParam { 16 | 17 | /** 角色 id */ 18 | @NotNull(message = "角色 id 不能为空") 19 | @Schema(title = "角色 id", type = "Long", required = true) 20 | private Long roleId; 21 | 22 | /** 角色可用状态 */ 23 | @NotNull(message = "角色可用状态不能为空") 24 | @Schema(title = "角色可用状态", type = "Boolean", required = true) 25 | private Boolean status; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/user/ChangeUserStatusParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.user; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 用户可用状态更改 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/3/20 11:34 12 | */ 13 | @Data 14 | @Schema(title = "用户可用状态更改请求参数") 15 | public class ChangeUserStatusParam { 16 | 17 | /** 用户 id */ 18 | @Schema(title = "用户 id", type = "Long", required = true) 19 | @NotNull(message = "用户 id 不能为空") 20 | private Long userId; 21 | 22 | /** 用户可用状态 */ 23 | @NotNull(message = "用户可用状态不能为空") 24 | @Schema(title = "用户可用状态", type = "Boolean", required = true) 25 | private Boolean status; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/user/UpdateDepartByUserParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.user; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 更新用户部门 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/10/15 12:38 12 | */ 13 | @Data 14 | @Schema(title = "更新用户部门请求参数") 15 | public class UpdateDepartByUserParam { 16 | 17 | /** 用户 id */ 18 | @NotNull(message = "用户 id 不允许为空!") 19 | @Schema(title = "用户 id", type = "Long", required = true) 20 | private Long userId; 21 | 22 | /** 部门 id */ 23 | @NotNull(message = "部门 id 不允许为空!") 24 | @Schema(title = "部门 id", type = "Long", required = true) 25 | private Long departId; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/entity/Log.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import io.swagger.v3.oas.annotations.media.Schema; 7 | import lombok.*; 8 | 9 | /** 10 | * @Description 日志实体 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 12:12 13 | */ 14 | @Data 15 | @Builder 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @EqualsAndHashCode(callSuper = true) 19 | @TableName(value = "pisces_sys_log") 20 | @Schema(title = "日志实体") 21 | public class Log extends BaseEntity { 22 | 23 | @TableId(type = IdType.AUTO) 24 | @Schema(title = "日志 id", type = "Long") 25 | private Long id; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/java/com/besscroft/pisces/amqp/config/TgConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | /** 7 | * @Description tg 配置 8 | * @Author Bess Croft 9 | * @Date 2022/9/4 12:29 10 | */ 11 | @Configuration 12 | public class TgConfiguration { 13 | 14 | /** token */ 15 | private static String token; 16 | 17 | /** chatId */ 18 | private static String chatId; 19 | 20 | @Value("${pisces.amqp.channel.tg.token}") 21 | public void setToken(String token) { 22 | TgConfiguration.token = token; 23 | } 24 | 25 | @Value("${pisces.amqp.channel.tg.chat-id}") 26 | public void setChatId(String chatId) { 27 | TgConfiguration.chatId = chatId; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/constant/AMQPConstant.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.constant; 2 | 3 | /** 4 | * @Description 消息枚举 5 | * @Author Bess Croft 6 | * @Date 2022/9/4 11:30 7 | */ 8 | public interface AMQPConstant { 9 | 10 | /** 消息 */ 11 | String MESSAGE_QUEUE = "pieces-queue-message"; 12 | 13 | /** 短信 */ 14 | String SMS_QUEUE = "pisces-queue-sms"; 15 | 16 | /** 邮件 */ 17 | String EMAIL_QUEUE = "pisces-queue-email"; 18 | 19 | /** server 酱 */ 20 | String SERVER_CHAN_QUEUE = "pisces-queue-server-chan"; 21 | 22 | /** Bark */ 23 | String BARK_QUEUE = "pisces-queue-bark"; 24 | 25 | /** Telegram */ 26 | String TG_QUEUE = "pisces-queue-tg"; 27 | 28 | /** 企业微信 */ 29 | String WORK_WEIXIN_QUEUE = "pisces-queue-work-weixin"; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /pisces-admin/admin-api/src/main/java/com/besscroft/pisces/admin/api/fallback/AuthFeignFallbackClient.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.api.fallback; 2 | 3 | import com.besscroft.pisces.admin.api.AuthFeignClient; 4 | import com.besscroft.pisces.framework.common.result.AjaxResult; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * @Description 认证中心请求服务熔断器 12 | * @Author Bess Croft 13 | * @Time 2021/11/21 12:20 14 | */ 15 | @Slf4j 16 | @Component 17 | public class AuthFeignFallbackClient implements AuthFeignClient { 18 | 19 | @Override 20 | public AjaxResult getAccessToken(Map parameters) { 21 | log.error("feign 远程调用认证用户服务异常:url:{/oauth/token}, data{}", parameters); 22 | return AjaxResult.error(5001, "服务暂时不可用"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/exception/Oauth2ExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.exception; 2 | 3 | import com.besscroft.pisces.framework.common.result.AjaxResult; 4 | import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | /** 10 | * @Description Oauth2 全局异常处理 11 | * @Author Bess Croft 12 | * @Date 2022/2/4 16:30 13 | */ 14 | @ControllerAdvice 15 | public class Oauth2ExceptionHandler { 16 | 17 | @ResponseBody 18 | @ExceptionHandler(value = OAuth2Exception.class) 19 | public AjaxResult handleOauth2(OAuth2Exception e) { 20 | return AjaxResult.error(e.getMessage()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/DictMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.Dict; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 字典 Mapper 接口 11 | * @Author Bess Croft 12 | * @Date 2022/8/5 14:20 13 | */ 14 | public interface DictMapper extends BaseMapper { 15 | 16 | /** 17 | * 根据字典分组查询字典列表 18 | * @param groupName 字典分组名称 19 | * @return 字典列表 20 | */ 21 | List selectAllByGroup(@Param("groupName") String groupName); 22 | 23 | /** 24 | * 根据查询参数查询所有数据 25 | * @param queryKey 查询参数 26 | * @return 字典列表 27 | */ 28 | List selectAllByQueryKey(@Param("queryKey") String queryKey); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/java/com/besscroft/pisces/amqp/config/BarkConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | /** 7 | * @Description Bark 配置 8 | * @Author Bess Croft 9 | * @Date 2022/9/4 12:28 10 | */ 11 | @Configuration 12 | public class BarkConfiguration { 13 | 14 | /** sendKey */ 15 | public static String sendKey; 16 | 17 | /** 推送地址 */ 18 | public static String pushUrl; 19 | 20 | @Value("${pisces.amqp.channel.bark.send-key}") 21 | public void setSendKey(String sendKey) { 22 | BarkConfiguration.sendKey = sendKey; 23 | } 24 | 25 | @Value("${pisces.amqp.channel.bark.push-url}") 26 | public void setPushUrl(String pushUrl) { 27 | BarkConfiguration.pushUrl = pushUrl; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/DepartMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.Depart; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 部门 Mapper 接口 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 12:36 13 | */ 14 | public interface DepartMapper extends BaseMapper { 15 | 16 | /** 17 | * 根据关键词查询部门信息 18 | * @param queryKey 关键词 19 | * @return 部门信息 20 | */ 21 | List selectAllByQueryKey(@Param("queryKey") String queryKey); 22 | 23 | /** 24 | * 查询是否为根节点 25 | * @param departId 部门id 26 | * @return 是->0 || null;不是->其它数字 27 | */ 28 | Integer selectParentExistById(@Param("departId") Long departId); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/ResourceMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.Resource; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 资源 Mapper 接口 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 12:35 13 | */ 14 | public interface ResourceMapper extends BaseMapper { 15 | 16 | /** 17 | * 根据关键词查询资源信息 18 | * @param queryKey 关键词 19 | * @return 资源信息 20 | */ 21 | List selectAllByQueryKey(@Param("queryKey") String queryKey); 22 | 23 | /** 24 | * 根据角色 id 查询所有资源 25 | * @param roleId 角色 id 26 | * @return 角色的资源集合 27 | */ 28 | List findAllByRoleId(@Param("roleId") Long roleId); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /pisces-framework/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | pisces-cloud 7 | com.besscroft.pisces 8 | ${revision} 9 | ../pom.xml 10 | 11 | 4.0.0 12 | 13 | pisces-framework 14 | Pisces Cloud 公共模块 15 | 16 | 17 | pisces-common 18 | pisces-cache 19 | pisces-mybatis 20 | 21 | pom 22 | 23 | 24 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/java/com/besscroft/pisces/amqp/config/ServerChanConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | /** 7 | * @Description Server 酱配置 8 | * @Author Bess Croft 9 | * @Date 2022/9/4 12:25 10 | */ 11 | @Configuration 12 | public class ServerChanConfiguration { 13 | 14 | /** sendKey */ 15 | public static String sendKey; 16 | 17 | /** 推送地址 */ 18 | public static String pushUrl; 19 | 20 | @Value("${pisces.amqp.channel.server-chan.send-key}") 21 | public void setSendKey(String sendKey) { 22 | ServerChanConfiguration.sendKey = sendKey; 23 | } 24 | 25 | @Value("${pisces.amqp.channel.server-chan.push-url}") 26 | public void setPushUrl(String pushUrl) { 27 | ServerChanConfiguration.pushUrl = pushUrl; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/WhiteConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.param.white.AddWhiteParam; 4 | import com.besscroft.pisces.admin.domain.param.white.UpdateWhiteParam; 5 | import com.besscroft.pisces.framework.common.entity.White; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.Mapping; 8 | import org.mapstruct.factory.Mappers; 9 | 10 | /** 11 | * @Description 白名单对象转换器 12 | * @Author Bess Croft 13 | * @Date 2022/8/28 15:09 14 | */ 15 | @Mapper(componentModel = "spring") 16 | public interface WhiteConverterMapper { 17 | 18 | WhiteConverterMapper INSTANCE = Mappers.getMapper(WhiteConverterMapper.class); 19 | 20 | White AddParamToWhite(AddWhiteParam param); 21 | 22 | @Mapping(source = "param.whiteId", target = "id") 23 | White UpdateParamToWhile(UpdateWhiteParam param); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/role/UpdateMenuByRoleParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.role; 2 | 3 | import io.swagger.v3.oas.annotations.media.ArraySchema; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import java.util.Set; 9 | 10 | /** 11 | * @Description 更新角色菜单接口请求参数 12 | * @Author Bess Croft 13 | * @Date 2022/4/3 10:36 14 | */ 15 | @Data 16 | @Schema(title = "更新角色菜单接口请求参数") 17 | public class UpdateMenuByRoleParam { 18 | 19 | /** 角色 id */ 20 | @NotNull(message = "角色 id 不能为空") 21 | @Schema(title = "角色 id", type = "Long", required = true) 22 | private Long roleId; 23 | 24 | /** 菜单 id 列表 */ 25 | @ArraySchema(arraySchema = @Schema( 26 | title = "菜单 id 列表", 27 | type = "Long" 28 | )) 29 | private Set menuIds; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/user/UpdateRoleByUserParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.user; 2 | 3 | import io.swagger.v3.oas.annotations.media.ArraySchema; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import java.util.Set; 9 | 10 | /** 11 | * @Description 更新用户角色 请求参数 12 | * @Author Bess Croft 13 | * @Date 2022/4/10 20:54 14 | */ 15 | @Data 16 | @Schema(title = "更新用户角色请求参数") 17 | public class UpdateRoleByUserParam { 18 | 19 | /** 用户 id */ 20 | @NotNull(message = "用户 id 不允许为空!") 21 | @Schema(title = "用户 id", type = "Long", required = true) 22 | private Long userId; 23 | 24 | /** 角色 id 列表 */ 25 | @ArraySchema(arraySchema = @Schema( 26 | title = "角色 id 列表", 27 | type = "Long" 28 | )) 29 | private Set roleIds; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/PageParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.Min; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @Description 分页列表接口 请求参数 11 | * @Author Bess Croft 12 | * @Date 2022/3/13 16:33 13 | */ 14 | @Data 15 | @Schema(title = "分页请求参数") 16 | public class PageParam { 17 | 18 | /** 页码 */ 19 | @Min(value = 1, message = "pageNum must be >= 1") 20 | @NotNull(message = "pageNum must not null") 21 | @Schema(title = "页码", type = "Integer") 22 | private Integer pageNum; 23 | 24 | /** 页大小 */ 25 | @Min(value = 1, message = "pageSize must be >= 1") 26 | @NotNull(message = "pageSize must not null") 27 | @Schema(title = "页大小", type = "Integer") 28 | private Integer pageSize; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/role/UpdateResourceByRoleParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.role; 2 | 3 | import io.swagger.v3.oas.annotations.media.ArraySchema; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import java.util.Set; 9 | 10 | /** 11 | * @Description 更新角色资源接口请求参数 12 | * @Author Bess Croft 13 | * @Date 2022/4/3 15:04 14 | */ 15 | @Data 16 | @Schema(title = "更新角色资源接口请求参数") 17 | public class UpdateResourceByRoleParam { 18 | 19 | /** 角色 id */ 20 | @NotNull(message = "角色 id 不能为空") 21 | @Schema(title = "角色 id", type = "Long", required = true) 22 | private Long roleId; 23 | 24 | /** 资源 id 列表 */ 25 | @ArraySchema(arraySchema = @Schema( 26 | title = "资源 id 列表", 27 | type = "Long" 28 | )) 29 | private Set resourceIds; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/PiscesFileApplication.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.context.annotation.ComponentScan; 9 | 10 | @Slf4j 11 | @EnableDiscoveryClient 12 | @EnableConfigurationProperties 13 | @ComponentScan("com.besscroft.pisces") 14 | @SpringBootApplication(scanBasePackages = "com.besscroft.pisces") 15 | public class PiscesFileApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(PiscesFileApplication.class, args); 19 | log.info("(♥◠‿◠)ノ゙ Pisces 分布式文件中心启动成功 ლ(´ڡ`ლ)゙ \n"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/depart/AddDepartParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.depart; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 新增部门 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/4/30 16:43 12 | */ 13 | @Data 14 | @Schema(title = "新增部门请求参数") 15 | public class AddDepartParam { 16 | 17 | /** 上级 id */ 18 | @NotNull(message = "没有上级部门 id") 19 | @Schema(title = "上级 id", type = "Long", required = true) 20 | private Long parentId; 21 | 22 | /** 部门名称 */ 23 | @Schema(title = "部门名称", type = "String") 24 | private String name; 25 | 26 | /** 部门描述 */ 27 | @Schema(title = "部门描述", type = "String") 28 | private String description; 29 | 30 | /** 排序 */ 31 | @Schema(title = "排序", type = "String") 32 | private Integer sort; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pisces-admin/admin-api/src/main/java/com/besscroft/pisces/admin/api/AuthFeignClient.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.api; 2 | 3 | import com.besscroft.pisces.admin.api.fallback.AuthFeignFallbackClient; 4 | import com.besscroft.pisces.framework.common.result.AjaxResult; 5 | import org.springframework.cloud.openfeign.FeignClient; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | * @Description 认证中心请求服务 13 | * @Author Bess Croft 14 | * @Time 2021/11/21 12:18 15 | */ 16 | @FeignClient(value = "pisces-auth", fallback = AuthFeignFallbackClient.class) 17 | public interface AuthFeignClient { 18 | 19 | /** 20 | * 获取Oauth2Token 21 | * @param parameters 请求参数 22 | * @return Oauth2Token 23 | */ 24 | @PostMapping(value = "/oauth/token") 25 | AjaxResult getAccessToken(@RequestParam Map parameters); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/ResourceConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.param.resource.AddResourceParam; 4 | import com.besscroft.pisces.admin.domain.param.resource.UpdateResourceParam; 5 | import com.besscroft.pisces.framework.common.entity.Resource; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.Mapping; 8 | import org.mapstruct.factory.Mappers; 9 | 10 | /** 11 | * @Description 资源对象转换器 12 | * @Author Bess Croft 13 | * @Date 2022/4/30 14:33 14 | */ 15 | @Mapper(componentModel = "spring") 16 | public interface ResourceConverterMapper { 17 | 18 | ResourceConverterMapper INSTANCE = Mappers.getMapper(ResourceConverterMapper.class); 19 | 20 | Resource AddParamToResource(AddResourceParam param); 21 | 22 | @Mapping(source = "param.resourceId", target = "id") 23 | Resource UpdateParamToResource(UpdateResourceParam param); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/white/UpdateWhiteParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.white; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 更新白名单请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/5/14 21:02 12 | */ 13 | @Data 14 | @Schema(title = "客户端登录请求参数") 15 | public class UpdateWhiteParam { 16 | 17 | /** 白名单 id */ 18 | @Schema(title = "白名单 id", type = "String", required = true) 19 | @NotNull(message = "白名单 id 不能为空") 20 | private Long whiteId; 21 | 22 | /** 白名单规则名称 */ 23 | @Schema(title = "白名单规则名称", type = "String") 24 | private String title; 25 | 26 | /** 白名单规则地址 */ 27 | @Schema(title = "白名单规则地址", type = "String") 28 | private String path; 29 | 30 | /** 备注 */ 31 | @Schema(title = "备注", type = "String") 32 | private String remark; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pisces-framework/pisces-mybatis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | pisces-framework 6 | com.besscroft.pisces 7 | ${revision} 8 | ../pom.xml 9 | 10 | 4.0.0 11 | 12 | pisces-mybatis 13 | mybatis 强化包 14 | jar 15 | 16 | 17 | 18 | com.besscroft.pisces 19 | pisces-common 20 | ${revision} 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 20990 3 | 4 | spring: 5 | application: 6 | name: '@artifactId@' 7 | profiles: 8 | active: '@spring.active@' 9 | cloud: 10 | nacos: 11 | discovery: 12 | server-addr: ${NACOS_HOST:http://localhost}:${NACOS_PORT:8848} 13 | namespace: ${NACOS_SPACE:daa4bab0-c137-42a8-86dd-406bb603dee1} 14 | group: ${NACOS_GROUP:DEFAULT_GROUP} 15 | username: ${NACOS_USER:nacos} 16 | password: ${NACOS_PASSWORD:nacos} 17 | watch-delay: 1000 18 | # 配置中心 19 | config: 20 | # 配置文件 prefix 21 | prefix: ${spring.application.name} 22 | server-addr: ${spring.cloud.nacos.discovery.server-addr} 23 | namespace: ${spring.cloud.nacos.discovery.namespace} 24 | group: ${spring.cloud.nacos.discovery.group} 25 | file-extension: yaml 26 | username: ${spring.cloud.nacos.discovery.username} 27 | password: ${spring.cloud.nacos.discovery.password} 28 | -------------------------------------------------------------------------------- /pisces-auth/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 22333 3 | 4 | spring: 5 | application: 6 | name: '@artifactId@' 7 | profiles: 8 | active: '@spring.active@' 9 | cloud: 10 | nacos: 11 | discovery: 12 | server-addr: ${NACOS_HOST:http://localhost}:${NACOS_PORT:8848} 13 | namespace: ${NACOS_SPACE:daa4bab0-c137-42a8-86dd-406bb603dee1} 14 | group: ${NACOS_GROUP:DEFAULT_GROUP} 15 | username: ${NACOS_USER:nacos} 16 | password: ${NACOS_PASSWORD:nacos} 17 | watch-delay: 1000 18 | # 配置中心 19 | config: 20 | # 配置文件 prefix 21 | prefix: ${spring.application.name} 22 | server-addr: ${spring.cloud.nacos.discovery.server-addr} 23 | namespace: ${spring.cloud.nacos.discovery.namespace} 24 | group: ${spring.cloud.nacos.discovery.group} 25 | file-extension: yaml 26 | username: ${spring.cloud.nacos.discovery.username} 27 | password: ${spring.cloud.nacos.discovery.password} 28 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8000 3 | 4 | spring: 5 | application: 6 | name: '@artifactId@' 7 | profiles: 8 | active: '@spring.active@' 9 | cloud: 10 | nacos: 11 | discovery: 12 | server-addr: ${NACOS_HOST:http://localhost}:${NACOS_PORT:8848} 13 | namespace: ${NACOS_SPACE:daa4bab0-c137-42a8-86dd-406bb603dee1} 14 | group: ${NACOS_GROUP:DEFAULT_GROUP} 15 | username: ${NACOS_USER:nacos} 16 | password: ${NACOS_PASSWORD:nacos} 17 | watch-delay: 1000 18 | # 配置中心 19 | config: 20 | # 配置文件 prefix 21 | prefix: ${spring.application.name} 22 | server-addr: ${spring.cloud.nacos.discovery.server-addr} 23 | namespace: ${spring.cloud.nacos.discovery.namespace} 24 | group: ${spring.cloud.nacos.discovery.group} 25 | file-extension: yaml 26 | username: ${spring.cloud.nacos.discovery.username} 27 | password: ${spring.cloud.nacos.discovery.password} 28 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 20890 3 | 4 | spring: 5 | application: 6 | name: '@artifactId@' 7 | profiles: 8 | active: '@spring.active@' 9 | cloud: 10 | nacos: 11 | discovery: 12 | server-addr: ${NACOS_HOST:http://localhost}:${NACOS_PORT:8848} 13 | namespace: ${NACOS_SPACE:daa4bab0-c137-42a8-86dd-406bb603dee1} 14 | group: ${NACOS_GROUP:DEFAULT_GROUP} 15 | username: ${NACOS_USER:nacos} 16 | password: ${NACOS_PASSWORD:nacos} 17 | watch-delay: 1000 18 | # 配置中心 19 | config: 20 | # 配置文件 prefix 21 | prefix: ${spring.application.name} 22 | server-addr: ${spring.cloud.nacos.discovery.server-addr} 23 | namespace: ${spring.cloud.nacos.discovery.namespace} 24 | group: ${spring.cloud.nacos.discovery.group} 25 | file-extension: yaml 26 | username: ${spring.cloud.nacos.discovery.username} 27 | password: ${spring.cloud.nacos.discovery.password} 28 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/PiscesAdminApplication.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.cloud.openfeign.EnableFeignClients; 9 | import org.springframework.scheduling.annotation.EnableAsync; 10 | 11 | @Slf4j 12 | @EnableAsync 13 | @EnableFeignClients 14 | @EnableDiscoveryClient 15 | @SpringBootApplication(scanBasePackages = "com.besscroft.pisces") 16 | @MapperScan("com.besscroft.pisces.admin.mapper") 17 | public class PiscesAdminApplication { 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(PiscesAdminApplication.class, args); 21 | log.info("(♥◠‿◠)ノ゙ Pisces Cloud 业务系统启动成功 ლ(´ڡ`ლ)゙ \n"); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/vo/RouterVo.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @Description 前端动态路由封装 10 | * @Author Bess Croft 11 | * @Date 2022/2/5 13:16 12 | */ 13 | @Data 14 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 15 | public class RouterVo { 16 | 17 | /** 18 | * 路由名字 19 | */ 20 | private String name; 21 | 22 | /** 23 | * 路由地址 24 | */ 25 | private String path; 26 | 27 | /** 28 | * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 29 | */ 30 | private String redirect; 31 | 32 | /** 33 | * 组件地址 34 | */ 35 | private String component; 36 | 37 | /** 38 | * 其他元素 39 | */ 40 | private MetaVo meta; 41 | 42 | /** 43 | * 子路由 44 | */ 45 | @JsonInclude(JsonInclude.Include.NON_NULL) 46 | private List children; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/role/AddRoleParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.role; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotEmpty; 7 | 8 | /** 9 | * @Description 新增角色请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/4/3 21:23 12 | */ 13 | @Data 14 | @Schema(title = "新增角色请求参数") 15 | public class AddRoleParam { 16 | 17 | /** 角色名称 */ 18 | @NotEmpty(message = "角色名称不能为空!") 19 | @Schema(title = "角色名称", type = "String", required = true) 20 | private String roleName; 21 | 22 | /** 角色编码 */ 23 | @NotEmpty(message = "角色编码不能为空!") 24 | @Schema(title = "角色编码", type = "String", required = true) 25 | private String roleCode; 26 | 27 | /** 描述 */ 28 | @Schema(title = "描述", type = "String") 29 | private String description; 30 | 31 | /** 排序 */ 32 | @Schema(title = "排序", type = "Integer") 33 | private Integer sort; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/dict/AddDictParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.dict; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @Description 新增字典接口——请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/8/28 12:59 12 | */ 13 | @Data 14 | @Schema(title = "新增字典接口请求参数") 15 | public class AddDictParam { 16 | 17 | /** 字典分组 */ 18 | @Schema(title = "字典分组", type = "String") 19 | @NotBlank(message = "字典分组不能为空") 20 | private String groupName; 21 | 22 | /** 字典 key */ 23 | @Schema(title = "字典 key", type = "String") 24 | @NotBlank(message = "字典 key不能为空") 25 | private String key; 26 | 27 | /** 字典值 */ 28 | @Schema(title = "字典值", type = "String") 29 | @NotBlank(message = "字典值不能为空") 30 | private String value; 31 | 32 | /** 备注 */ 33 | @Schema(title = "备注", type = "String") 34 | private String remark; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /.github/docker/agent/pisces-amqp/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM apache/skywalking-java-agent:8.13.0-java17 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置 agent 配置信息 6 | ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES="-Dskywalking.collector.backend_service=127.0.0.1:11800" \ 7 | SW_AGENT_NAME="-Dskywalking.agent.service_name=Pisces-Cloud::pisces-amqp" 8 | # 设置时区 9 | RUN set -eux; \ 10 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 11 | echo $TZ > /etc/timezone; \ 12 | cp /skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-sentinel-1.x-plugin-8.13.0.jar 13 | # 拷贝jar包,并重命名 14 | COPY ./pisces-amqp/target/pisces-amqp.jar /pisces-amqp.jar 15 | # 指定docker容器启动时运行jar包 16 | ENTRYPOINT exec java ${JAVA_OPTS} -javaagent:/skywalking/agent/skywalking-agent.jar ${SW_AGENT_COLLECTOR_BACKEND_SERVICES} ${SW_AGENT_NAME} -jar /pisces-amqp.jar ${SPRING_CONFIG} 17 | # 指定维护者的名字 18 | MAINTAINER besscroft 19 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/MenuConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.dto.MenuDto; 4 | import com.besscroft.pisces.admin.domain.param.menu.AddMenuParam; 5 | import com.besscroft.pisces.admin.domain.param.menu.UpdateMenuByMenuParam; 6 | import com.besscroft.pisces.framework.common.entity.Menu; 7 | import org.mapstruct.Mapper; 8 | import org.mapstruct.factory.Mappers; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @Description 菜单对象转换器 14 | * @Author Bess Croft 15 | * @Date 2022/2/5 13:19 16 | */ 17 | @Mapper(componentModel = "spring") 18 | public interface MenuConverterMapper { 19 | 20 | MenuConverterMapper INSTANCE = Mappers.getMapper(MenuConverterMapper.class); 21 | 22 | Menu AddParamToMenu(AddMenuParam param); 23 | 24 | Menu UpdateParamToMenu(UpdateMenuByMenuParam param); 25 | 26 | MenuDto MenuToMenuDto(Menu menu); 27 | 28 | List MenuToMenuDtoList(List menuList); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/resourceCategory/UpdateResourceCategoryParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.resourceCategory; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 更新资源类别 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/5/8 14:50 12 | */ 13 | @Data 14 | @Schema(title = "客户端登录请求参数") 15 | public class UpdateResourceCategoryParam { 16 | 17 | 18 | /** 资源类别 id */ 19 | @NotNull(message = "资源类别 id 不能为空") 20 | @Schema(title = "资源类别 id", type = "Long", required = true) 21 | private Long resourceCategoryId; 22 | 23 | /** 资源类别名称 */ 24 | @Schema(title = "资源类别名称", type = "String") 25 | private String categoryName; 26 | 27 | /** 资源描述 */ 28 | @Schema(title = "资源描述", type = "String") 29 | private String description; 30 | 31 | /** 排序 */ 32 | @Schema(title = "排序", type = "Integer") 33 | private Integer sort; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /pisces-framework/pisces-cache/src/main/java/com/besscroft/pisces/framework/cache/component/PiscesKeyGenerator.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.cache.component; 2 | 3 | import org.springframework.cache.interceptor.KeyGenerator; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.lang.reflect.Method; 8 | 9 | /** 10 | * @Description 自定义 key 生成策略 11 | * @Author Bess Croft 12 | * @Date 2022/5/21 22:06 13 | */ 14 | @Configuration 15 | @Component("piscesKeyGenerator") 16 | public class PiscesKeyGenerator implements KeyGenerator { 17 | 18 | /** 19 | * 这里的策略为 "::pisces",表示系统默认生成的 key,不带业务性质 20 | * 比如正常业务 key 可能为:"system:user::1" 21 | * 而此策略生成的 key 为:"system:user::pisces" 22 | * @param target 目标对象 23 | * @param method 目标方法 24 | * @param params 方法参数 25 | * @return 26 | */ 27 | @Override 28 | public Object generate(Object target, Method method, Object... params) { 29 | return "pisces"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 20100 3 | 4 | spring: 5 | main: 6 | allow-bean-definition-overriding: true 7 | application: 8 | name: pisces-admin 9 | profiles: 10 | active: '@spring.active@' 11 | cloud: 12 | nacos: 13 | discovery: 14 | server-addr: ${NACOS_HOST:http://localhost}:${NACOS_PORT:8848} 15 | namespace: ${NACOS_SPACE:daa4bab0-c137-42a8-86dd-406bb603dee1} 16 | group: ${NACOS_GROUP:DEFAULT_GROUP} 17 | username: ${NACOS_USER:nacos} 18 | password: ${NACOS_PASSWORD:nacos} 19 | watch-delay: 1000 20 | # 配置中心 21 | config: 22 | # 配置文件 prefix 23 | prefix: ${spring.application.name} 24 | server-addr: ${spring.cloud.nacos.discovery.server-addr} 25 | namespace: ${spring.cloud.nacos.discovery.namespace} 26 | group: ${spring.cloud.nacos.discovery.group} 27 | file-extension: yaml 28 | username: ${spring.cloud.nacos.discovery.username} 29 | password: ${spring.cloud.nacos.discovery.password} 30 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/DepartDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.time.LocalDateTime; 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 部门树封装对象 11 | * @Author Bess Croft 12 | * @Date 2022/4/30 16:59 13 | */ 14 | @Data 15 | @Builder 16 | public class DepartDto { 17 | 18 | private Long id; 19 | 20 | /** 上级ID */ 21 | private Long parentId; 22 | 23 | /** 部门名称 */ 24 | private String name; 25 | 26 | /** 部门描述 */ 27 | private String description; 28 | 29 | /** 排序 */ 30 | private Integer sort; 31 | 32 | /** 创建者 */ 33 | private String creator; 34 | 35 | /** 更新者 */ 36 | private String updater; 37 | 38 | /** 创建时间 */ 39 | private LocalDateTime createTime; 40 | 41 | /** 更新时间 */ 42 | private LocalDateTime updateTime; 43 | 44 | /** 逻辑删除:0->删除状态;1->可用状态 */ 45 | private Integer del; 46 | 47 | /** 子部门 */ 48 | private List children; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/ResourceCategoryConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.param.resourceCategory.AddResourceCategoryParam; 4 | import com.besscroft.pisces.admin.domain.param.resourceCategory.UpdateResourceCategoryParam; 5 | import com.besscroft.pisces.framework.common.entity.ResourceCategory; 6 | import org.mapstruct.Mapper; 7 | import org.mapstruct.Mapping; 8 | import org.mapstruct.factory.Mappers; 9 | 10 | /** 11 | * @Description 资源类别对象转换器 12 | * @Author Bess Croft 13 | * @Date 2022/8/28 15:08 14 | */ 15 | @Mapper(componentModel = "spring") 16 | public interface ResourceCategoryConverterMapper { 17 | 18 | ResourceCategoryConverterMapper INSTANCE = Mappers.getMapper(ResourceCategoryConverterMapper.class); 19 | 20 | ResourceCategory AddParamToResourceCategory(AddResourceCategoryParam param); 21 | 22 | @Mapping(source = "param.resourceCategoryId", target = "id") 23 | ResourceCategory UpdateParamToResourceCategory(UpdateResourceCategoryParam param); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/test/java/com/besscroft/pisces/file/service/StorageServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.service; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.junit.jupiter.api.DisplayName; 5 | import org.junit.jupiter.api.Test; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | * @Description 存储服务测试类 13 | * @Author Bess Croft 14 | * @Date 2022/8/8 14:26 15 | */ 16 | @Slf4j 17 | @SpringBootTest 18 | public class StorageServiceTest { 19 | 20 | @Autowired 21 | private Map storageService; 22 | 23 | @Test 24 | @DisplayName("存放对象进存储桶方法测试") 25 | void putObject() { 26 | 27 | } 28 | 29 | @Test 30 | @DisplayName("从存储桶中获取对象方法测试") 31 | void getObject() { 32 | 33 | } 34 | 35 | @Test 36 | @DisplayName("获取对象的地址方法测试") 37 | void getObjectUrl() { 38 | 39 | } 40 | 41 | @Test 42 | @DisplayName("从存储桶中删除对象方法测试") 43 | void removeObject() { 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/PiscesGatewayApplication.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.client.loadbalancer.LoadBalanced; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.retry.annotation.EnableRetry; 10 | import org.springframework.web.reactive.function.client.WebClient; 11 | 12 | @Slf4j 13 | @EnableRetry 14 | @EnableDiscoveryClient 15 | @SpringBootApplication 16 | public class PiscesGatewayApplication { 17 | 18 | public static void main(String[] args) { 19 | SpringApplication.run(PiscesGatewayApplication.class, args); 20 | log.info("(♥◠‿◠)ノ゙ Pisces 网关启动成功 ლ(´ڡ`ლ)゙ \n"); 21 | } 22 | 23 | @Bean 24 | @LoadBalanced 25 | public WebClient.Builder webBuilder(){ 26 | return WebClient.builder(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/dict/UpdateDictParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.dict; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @Description 更新字典接口——请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/8/28 12:59 12 | */ 13 | @Data 14 | @Schema(title = "更新字典接口请求参数") 15 | public class UpdateDictParam { 16 | 17 | @Schema(title = "字典 id", type = "Long") 18 | private Long id; 19 | 20 | /** 字典分组 */ 21 | @Schema(title = "字典分组", type = "String") 22 | @NotBlank(message = "字典分组不能为空") 23 | private String groupName; 24 | 25 | /** 字典 key */ 26 | @Schema(title = "字典 key", type = "String") 27 | @NotBlank(message = "字典 key不能为空") 28 | private String key; 29 | 30 | /** 字典值 */ 31 | @Schema(title = "字典值", type = "String") 32 | @NotBlank(message = "字典值不能为空") 33 | private String value; 34 | 35 | /** 备注 */ 36 | @Schema(title = "备注", type = "String") 37 | private String remark; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/sender/MessageSender.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.sender; 2 | 3 | /** 4 | * @Description 消息发送服务 5 | * @Author Bess Croft 6 | * @Date 2022/9/4 11:26 7 | */ 8 | public interface MessageSender { 9 | 10 | /** 11 | * 发送消息 12 | * @param message 消息内容 13 | */ 14 | void send(String message); 15 | 16 | /** 17 | * 发送短信 18 | * @param message 短信内容 19 | */ 20 | void sendSMS(String message); 21 | 22 | /** 23 | * 发送邮件 24 | * @param email 邮件 25 | */ 26 | void sendEmail(String email); 27 | 28 | /** 29 | * 发送消息到 Server 酱 30 | * @param message 消息内容/ 31 | */ 32 | void sendServerChan(String message); 33 | 34 | /** 35 | * 发送消息到 Bark 36 | * @param message 消息内容 37 | */ 38 | void sendBark(String message); 39 | 40 | /** 41 | * 发送消息到 tg 42 | * @param message 消息内容 43 | */ 44 | void sendTG(String message); 45 | 46 | /** 47 | * 发送消息到企业微信 48 | * @param message 消息内容 49 | */ 50 | void sendWorkWeixin(String message); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 besscroft 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/depart/UpdateDepartParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.depart; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 更新部门 请求参数 10 | * @Author Bess Croft 11 | * @Date 2022/4/30 16:43 12 | */ 13 | @Data 14 | @Schema(title = "更新部门请求参数") 15 | public class UpdateDepartParam { 16 | 17 | /** 部门 id */ 18 | @NotNull(message = "部门 id 不能为空") 19 | @Schema(title = "部门 id", type = "Long", required = true) 20 | private Long departId; 21 | 22 | /** 上级 id */ 23 | @NotNull(message = "没有上级部门 id") 24 | @Schema(title = "上级 id", type = "Long", required = true) 25 | private Long parentId; 26 | 27 | /** 部门名称 */ 28 | @Schema(title = "部门名称", type = "String") 29 | private String name; 30 | 31 | /** 部门描述 */ 32 | @Schema(title = "部门描述", type = "String") 33 | private String description; 34 | 35 | /** 排序 */ 36 | @Schema(title = "排序", type = "Integer") 37 | private Integer sort; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/listener/TransactionalMessageListener.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.listener; 2 | 3 | import com.besscroft.pisces.admin.event.ClearCacheEvent; 4 | import lombok.RequiredArgsConstructor; 5 | import org.springframework.data.redis.core.RedisTemplate; 6 | import org.springframework.lang.NonNull; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.transaction.event.TransactionPhase; 9 | import org.springframework.transaction.event.TransactionalEventListener; 10 | 11 | /** 12 | * @Description 事务事件监听 13 | * @Author Bess Croft 14 | * @Date 2022/5/21 22:40 15 | */ 16 | @Component 17 | @RequiredArgsConstructor 18 | public class TransactionalMessageListener { 19 | 20 | private final RedisTemplate redisTemplate; 21 | 22 | /** 23 | * 事务 COMMIT 之后,执行删除缓存操作 24 | * @param clearCacheEvent 缓存删除事件 25 | */ 26 | @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) 27 | public void clearCache(@NonNull ClearCacheEvent clearCacheEvent) { 28 | redisTemplate.delete(clearCacheEvent.getCacheKey()); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /.github/docker/agent/pisces-file/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM apache/skywalking-java-agent:8.13.0-java17 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置 agent 配置信息 6 | ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES="-Dskywalking.collector.backend_service=127.0.0.1:11800" \ 7 | SW_AGENT_NAME="-Dskywalking.agent.service_name=Pisces-Cloud::pisces-file" 8 | # 设置时区 9 | RUN set -eux; \ 10 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 11 | echo $TZ > /etc/timezone; \ 12 | cp /skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-sentinel-1.x-plugin-8.13.0.jar; \ 13 | cp /skywalking/agent/optional-plugins/apm-fastjson-1.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-fastjson-1.x-plugin-8.13.0.jar 14 | # 拷贝jar包,并重命名 15 | COPY ./pisces-api/pisces-file/target/pisces-file.jar /pisces-file.jar 16 | # 指定docker容器启动时运行jar包 17 | ENTRYPOINT exec java ${JAVA_OPTS} -javaagent:/skywalking/agent/skywalking-agent.jar ${SW_AGENT_COLLECTOR_BACKEND_SERVICES} ${SW_AGENT_NAME} -jar /pisces-file.jar ${SPRING_CONFIG} 18 | # 指定维护者的名字 19 | MAINTAINER besscroft 20 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/DictService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.framework.common.entity.Dict; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @Description 字典服务接口 10 | * @Author Bess Croft 11 | * @Date 2022/8/5 14:21 12 | */ 13 | public interface DictService extends IService { 14 | 15 | /** 16 | * 根据字典分组获取所有字典 17 | * @param groupName 字典分组名称 18 | * @return 字典 19 | */ 20 | List queryAllByGroup(String groupName); 21 | 22 | /** 23 | * 字典分页 24 | * @param pageNum 页码 25 | * @param pageSize 页大小 26 | * @param queryKey 查询参数 27 | * @return 字典分页信息 28 | */ 29 | List pageList(Integer pageNum, Integer pageSize, String queryKey); 30 | 31 | /** 32 | * 新增字典 33 | * @param dict 字典实体 34 | */ 35 | void addDict(Dict dict); 36 | 37 | /** 38 | * 更新字典 39 | * @param dict 字典实体 40 | */ 41 | void updateDict(Dict dict); 42 | 43 | /** 44 | * 字典逻辑删除 45 | * @param dictId 字典 id 46 | */ 47 | void deleteDict(Long dictId); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /.github/docker/agent/pisces-gateway/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM apache/skywalking-java-agent:8.13.0-java17 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置 agent 配置信息 6 | ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES="-Dskywalking.collector.backend_service=127.0.0.1:11800" \ 7 | SW_AGENT_NAME="-Dskywalking.agent.service_name=Pisces-Cloud::pisces-gateway" 8 | # 设置时区 9 | RUN set -eux; \ 10 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 11 | echo $TZ > /etc/timezone; \ 12 | cp /skywalking/agent/optional-plugins/apm-spring-cloud-gateway-3.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-spring-cloud-gateway-3.x-plugin-8.13.0.jar; \ 13 | cp /skywalking/agent/optional-plugins/apm-spring-webflux-5.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-spring-webflux-5.x-plugin-8.13.0.jar 14 | # 拷贝jar包,并重命名 15 | COPY ./pisces-gateway/target/pisces-gateway.jar /pisces-gateway.jar 16 | # 指定docker容器启动时运行jar包 17 | ENTRYPOINT exec java ${JAVA_OPTS} -javaagent:/skywalking/agent/skywalking-agent.jar ${SW_AGENT_COLLECTOR_BACKEND_SERVICES} ${SW_AGENT_NAME} -jar /pisces-gateway.jar ${SPRING_CONFIG} 18 | # 指定维护者的名字 19 | MAINTAINER besscroft 20 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/config/GlobalCorsConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.reactive.CorsWebFilter; 7 | import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; 8 | import org.springframework.web.util.pattern.PathPatternParser; 9 | 10 | /** 11 | * @Description 跨域配置 12 | * @Author Bess Croft 13 | * @Date 2022/2/4 18:11 14 | */ 15 | @Configuration 16 | public class GlobalCorsConfiguration { 17 | 18 | @Bean 19 | public CorsWebFilter corsFilter() { 20 | CorsConfiguration config = new CorsConfiguration(); 21 | config.addAllowedMethod("*"); 22 | config.addAllowedOrigin("*"); 23 | config.addAllowedHeader("*"); 24 | config.setAllowCredentials(true); 25 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser()); 26 | source.registerCorsConfiguration("/*", config); 27 | 28 | return new CorsWebFilter(source); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/role/UpdateRoleByRoleParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.role; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @Description 更新角色请求参数 11 | * @Author Bess Croft 12 | * @Date 2022/4/3 21:23 13 | */ 14 | @Data 15 | @Schema(title = "更新角色请求参数") 16 | public class UpdateRoleByRoleParam { 17 | 18 | /** 角色 id */ 19 | @NotNull(message = "角色id不能为空!") 20 | @Schema(title = "角色 id", type = "Long", required = true) 21 | private Long id; 22 | 23 | /** 角色名称 */ 24 | @NotEmpty(message = "角色名称不能为空!") 25 | @Schema(title = "角色名称", type = "String", required = true) 26 | private String roleName; 27 | 28 | /** 角色编码 */ 29 | @NotEmpty(message = "角色编码不能为空!") 30 | @Schema(title = "角色编码", type = "String", required = true) 31 | private String roleCode; 32 | 33 | /** 描述 */ 34 | @Schema(title = "描述", type = "String") 35 | private String description; 36 | 37 | /** 排序 */ 38 | @Schema(title = "排序", type = "Integer") 39 | private Integer sort; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/resource/AddResourceParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.resource; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @Description 新增资源 请求参数 11 | * @Author Bess Croft 12 | * @Date 2022/4/30 14:23 13 | */ 14 | @Data 15 | @Schema(title = "新增资源请求参数") 16 | public class AddResourceParam { 17 | 18 | /** 资源名称 */ 19 | @Schema(title = "资源名称", type = "String") 20 | private String name; 21 | 22 | /** 资源路径 */ 23 | @Schema(title = "资源路径", type = "String") 24 | private String url; 25 | 26 | /** 资源描述 */ 27 | @Schema(title = "资源描述", type = "String") 28 | private String description; 29 | 30 | /** 路由分配 key */ 31 | @Schema(title = "路由分配 key", type = "String") 32 | @NotBlank(message = "路由分配 key 不能为空") 33 | private String routeKey; 34 | 35 | /** 资源类别 id */ 36 | @NotNull(message = "资源类别 id") 37 | @Schema(title = "登录用户名", type = "Long") 38 | private Long categoryId; 39 | 40 | /** 排序 */ 41 | @Schema(title = "排序", type = "Integer") 42 | private Integer sort; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/WhiteService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.framework.common.dto.WhiteDictDto; 5 | import com.besscroft.pisces.framework.common.entity.White; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 白名单服务接口 11 | * @Author Bess Croft 12 | * @Date 2022/5/14 18:21 13 | */ 14 | public interface WhiteService extends IService { 15 | 16 | /** 17 | * 获取白名单列表(分页) 18 | * @param pageNum 页码 19 | * @param pageSize 页大小 20 | * @param queryKey 查询参数 21 | * @return 白名单分页列表 22 | */ 23 | List getWhiteListPage(Integer pageNum, Integer pageSize, String queryKey); 24 | 25 | /** 26 | * 新增白名单 27 | * @param white 白名单实体 28 | */ 29 | void addWhite(White white); 30 | 31 | /** 32 | * 更新白名单 33 | * @param white 白名单实体 34 | */ 35 | void updateWhite(White white); 36 | 37 | /** 38 | * 白名单逻辑删除 39 | * @param whiteId 白名单 id 40 | */ 41 | void deleteWhite(Long whiteId); 42 | 43 | /** 44 | * 获取白名单字典 45 | * @return 白名单字典 46 | */ 47 | List getWhiteDict(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.framework.common.entity.Menu; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 菜单 Mapper 接口 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 12:36 13 | */ 14 | public interface MenuMapper extends BaseMapper { 15 | 16 | /** 17 | * 根据用户 id 查询所有菜单 18 | * @param userId 用户 id 19 | * @return 用户的菜单集合 20 | */ 21 | List getAllByUserId(@Param("userId") Long userId); 22 | 23 | /** 24 | * 根据关键词查询菜单信息 25 | * @param queryKey 关键词 26 | * @return 菜单信息 27 | */ 28 | List selectAllByQueryKey(@Param("queryKey") String queryKey); 29 | 30 | /** 31 | * 修改菜单可用状态 32 | * @param menuId 菜单id 33 | * @param isHide 可用状态 34 | * @return 生效行数 35 | */ 36 | int updateStatusById(@Param("menuId") Long menuId, 37 | @Param("isHide") Integer isHide); 38 | 39 | /** 40 | * 根据角色id查询所有菜单 41 | * @param roleId 角色id 42 | * @return 菜单集合 43 | */ 44 | List findAllByRoleId(@Param("roleId") Long roleId); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /.github/docker/agent/pisces-auth/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM apache/skywalking-java-agent:8.13.0-java17 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置 agent 配置信息 6 | ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES="-Dskywalking.collector.backend_service=127.0.0.1:11800" \ 7 | SW_AGENT_NAME="-Dskywalking.agent.service_name=Pisces-Cloud::pisces-auth" 8 | # 设置时区 9 | RUN set -eux; \ 10 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 11 | echo $TZ > /etc/timezone; \ 12 | cp /skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-sentinel-1.x-plugin-8.13.0.jar; \ 13 | cp /skywalking/agent/optional-plugins/apm-mybatis-3.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-mybatis-3.x-plugin-8.13.0.jar; \ 14 | cp /skywalking/agent/optional-plugins/apm-fastjson-1.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-fastjson-1.x-plugin-8.13.0.jar 15 | # 拷贝jar包,并重命名 16 | COPY ./pisces-auth/target/pisces-auth.jar /pisces-auth.jar 17 | # 指定docker容器启动时运行jar包 18 | ENTRYPOINT exec java ${JAVA_OPTS} -javaagent:/skywalking/agent/skywalking-agent.jar ${SW_AGENT_COLLECTOR_BACKEND_SERVICES} ${SW_AGENT_NAME} -jar /pisces-auth.jar ${SPRING_CONFIG} 19 | # 指定维护者的名字 20 | MAINTAINER besscroft 21 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/constant/AuthConstants.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.constant; 2 | 3 | /** 4 | * @Description security 常量 5 | * @Author Bess Croft 6 | * @Date 2022/2/3 21:06 7 | */ 8 | public interface AuthConstants { 9 | 10 | /** 认证信息 Http 请求头 */ 11 | String JWT_TOKEN_HEADER = "Authorization"; 12 | 13 | /** 用户信息 Http 请求头 */ 14 | String USER_TOKEN_HEADER = "user"; 15 | 16 | /** JWT令牌前缀 */ 17 | String JWT_TOKEN_PREFIX = "Bearer "; 18 | 19 | /** JWT存储权限前缀 */ 20 | String AUTHORITY_PREFIX = "ROLE_"; 21 | 22 | /** JWT存储权限属性 */ 23 | String JWT_AUTHORITIES_KEY = "authorities"; 24 | 25 | /** Redis 缓存权限规则 key */ 26 | String PERMISSION_RULES_KEY = "auth:roleResourceMap"; 27 | 28 | /** 默认密码编码方式 */ 29 | String BCRYPT = "{bcrypt}"; 30 | 31 | /** 系统 client_id */ 32 | String SYSTEM_CLIENT_ID = "pisces:system:token"; 33 | 34 | /** 启用账号 */ 35 | Integer STATUS = 1; 36 | 37 | /** 客户端 id */ 38 | String CLIENT_ID = "client_id"; 39 | 40 | /** 系统机密 */ 41 | String SYSTEM_CLIENT_SECRET = "123456"; 42 | 43 | /** OAuth2 密码模式 */ 44 | String OAUTH2_PASSWORD = "password"; 45 | 46 | /** 用户信息 */ 47 | String SYSTEM_USER = "pisces:system:user"; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /.github/docker/agent/pisces-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | # 该镜像需要依赖的基础镜像 2 | FROM apache/skywalking-java-agent:8.13.0-java17 3 | # 设置环境变量 4 | ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m -Dfile.encoding=utf-8" SPRING_CONFIG="--spring.profiles.active=prod" 5 | # 设置 agent 配置信息 6 | ENV SW_AGENT_COLLECTOR_BACKEND_SERVICES="-Dskywalking.collector.backend_service=127.0.0.1:11800" \ 7 | SW_AGENT_NAME="-Dskywalking.agent.service_name=Pisces-Cloud::pisces-admin" 8 | # 设置时区 9 | RUN set -eux; \ 10 | ln -snf /usr/share/zoneinfo/$TZ /etc/localtime; \ 11 | echo $TZ > /etc/timezone; \ 12 | cp /skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-sentinel-1.x-plugin-8.13.0.jar; \ 13 | cp /skywalking/agent/optional-plugins/apm-mybatis-3.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-mybatis-3.x-plugin-8.13.0.jar; \ 14 | cp /skywalking/agent/optional-plugins/apm-fastjson-1.x-plugin-8.13.0.jar /skywalking/agent/plugins/apm-fastjson-1.x-plugin-8.13.0.jar 15 | # 拷贝jar包,并重命名 16 | COPY ./pisces-admin/admin-boot/target/pisces-admin.jar /pisces-admin.jar 17 | # 指定docker容器启动时运行jar包 18 | ENTRYPOINT exec java ${JAVA_OPTS} -javaagent:/skywalking/agent/skywalking-agent.jar ${SW_AGENT_COLLECTOR_BACKEND_SERVICES} ${SW_AGENT_NAME} -jar /pisces-admin.jar ${SPRING_CONFIG} 19 | # 指定维护者的名字 20 | MAINTAINER besscroft 21 | -------------------------------------------------------------------------------- /doc/readme.md: -------------------------------------------------------------------------------- 1 | --- 2 | icon: creative 3 | category: Pisces 4 | --- 5 | 6 | # 项目介绍 7 | 8 | [![](https://img.shields.io/badge/%E5%BC%80%E5%8F%91%E8%BF%9B%E5%BA%A6-%E5%BC%80%E5%8F%91%E4%B8%AD-brightgreen?style=flat-square)]() [![](https://img.shields.io/github/license/besscroft/pisces-cloud?style=flat-square)](https://github.com/besscroft/pisces-cloud/blob/master/LICENSE) ![GitHub repo size](https://img.shields.io/github/repo-size/besscroft/pisces-cloud?style=flat-square&color=328657) 9 | 10 | 一站式微服务解决方案,基于 Spring Cloud 2021.0.1 & Alibaba 2021.0.1.0 + Spring Security OAuth2 + PostgreSQL + Mybatis-Plus 构建。项目的进度可以查看下方的看板了解! 11 | 12 | [pisces-cloud 看板](https://github.com/users/besscroft/projects/1) 13 | 14 | ## 预览 15 | 16 | [Pisces Cloud](https://pisces.besscroft.com/) 17 | 18 | ## 项目结构 19 | 20 | ``` 21 | ├── .github # GitHub Actions 22 | │ ├── workflows # 代码检查作业 23 | ├── doc # 文档 24 | │ ├── config # 项目需要的 nacos 配置 25 | │ └── sql # 项目需要的 SQL 脚本 26 | ├── pisces-admin # 系统支撑服务 27 | │ ├── admin-api # 接口 28 | │ └── admin-boot # 服务 29 | ├── pisces-amqp # 消息中心服务 30 | ├── pisces-api # 通用接口支撑服务 31 | │ └── pisces-file # 分布式文件中心服务 32 | ├── pisces-auth # 认证服务 33 | ├── pisces-framework # 核心模块 34 | │ ├── pisces-cache # 公共缓存模块 35 | │ └── pisces-common # 公共核心模块 36 | └──pisces-gateway # 网关服务 37 | ``` 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/config/OSSProperties.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | /** 7 | * @Description 对象存储 8 | * @Author Bess Croft 9 | * @Date 2022/8/5 11:58 10 | */ 11 | @Data 12 | @ConfigurationProperties(prefix = "oss") 13 | public class OSSProperties { 14 | 15 | private Aliyun aliyun; 16 | private Minio minio; 17 | 18 | /** 19 | * 阿里云 OSS 20 | */ 21 | @Data 22 | public static class Aliyun { 23 | private boolean active; 24 | private String endpoint; 25 | private String cdnEndpoint; 26 | private String accessKeyId; 27 | private String accessKeySecret; 28 | private String bucketName; 29 | private String prefix; 30 | private String cdnPrefix; 31 | } 32 | 33 | /** 34 | * Minio OSS 35 | */ 36 | @Data 37 | public static class Minio { 38 | private boolean active; 39 | private String endpoint; 40 | private String cdnEndpoint; 41 | private String accessKey; 42 | private String secretKey; 43 | private String bucketName; 44 | private String prefix; 45 | private String cdnPrefix; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pisces-auth/src/test/java/com/besscroft/pisces/auth/service/UserServiceTest.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.service; 2 | 3 | import com.besscroft.pisces.framework.common.dto.UserDto; 4 | import com.fasterxml.jackson.core.JsonProcessingException; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import org.junit.jupiter.api.Test; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.boot.test.context.SpringBootTest; 11 | 12 | import static org.junit.jupiter.api.Assertions.assertNotNull; 13 | 14 | /** 15 | * @Description 用户服务测试类 16 | * @Author Bess Croft 17 | * @Date 2022/2/13 11:59 18 | */ 19 | @SpringBootTest 20 | public class UserServiceTest { 21 | 22 | private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceTest.class); 23 | 24 | @Autowired 25 | private UserService userService; 26 | 27 | @Autowired 28 | private ObjectMapper objectMapper; 29 | 30 | @Test 31 | void loadUserByUsername() throws JsonProcessingException { 32 | String username = "admin"; 33 | UserDto userDto = userService.loadUserByUsername(username); 34 | assertNotNull(userDto, "根据用户名查询用户信息失败!"); 35 | LOGGER.info("用户信息:{}", objectMapper.writeValueAsString(userDto)); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/vo/MetaVo.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @Description 路由 meta 信息 7 | * @Author Bess Croft 8 | * @Date 2022/2/5 13:16 9 | */ 10 | @Data 11 | public class MetaVo { 12 | 13 | /** 14 | * 设置该路由在侧边栏和面包屑中展示的名字 15 | */ 16 | private String title; 17 | 18 | /** 19 | * 设置该路由的图标,对应路径src/assets/icons/svg 20 | */ 21 | private String icon; 22 | 23 | /** 是否外链 */ 24 | private String isLink; 25 | 26 | /** 是否隐藏 */ 27 | private Boolean isHide; 28 | 29 | /** 是否全屏 */ 30 | private Boolean isFull; 31 | 32 | /** 是否固定在 tabs nav */ 33 | private Boolean isAffix; 34 | 35 | /** 是否缓存 */ 36 | private Boolean isKeepAlive; 37 | 38 | public MetaVo() { 39 | } 40 | 41 | public MetaVo(String title, String icon) { 42 | this.title = title; 43 | this.icon = icon; 44 | } 45 | 46 | public MetaVo(String title, String icon, String isLink, Boolean isHide, Boolean isFull, Boolean isAffix, Boolean isKeepAlive) { 47 | this.title = title; 48 | this.icon = icon; 49 | this.isLink = isLink; 50 | this.isHide = isHide; 51 | this.isFull = isFull; 52 | this.isAffix = isAffix; 53 | this.isKeepAlive = isKeepAlive; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/entity/ResourceCategory.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import lombok.*; 9 | 10 | /** 11 | * @Description 资源类别实体 12 | * @Author Bess Croft 13 | * @Date 2022/2/5 12:12 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @EqualsAndHashCode(callSuper = true) 20 | @TableName(value = "pisces_auth_resource_category") 21 | @Schema(title = "资源类别实体") 22 | public class ResourceCategory extends BaseEntity { 23 | 24 | @TableId(type = IdType.AUTO) 25 | @Schema(title = "资源类别 id", type = "Long") 26 | private Long id; 27 | 28 | /** 资源类别名称 */ 29 | @TableField(value = "category_name") 30 | @Schema(title = "资源类别名称", type = "String") 31 | private String categoryName; 32 | 33 | /** 资源描述 */ 34 | @TableField(value = "description") 35 | @Schema(title = "资源描述", type = "String") 36 | private String description; 37 | 38 | /** 排序 */ 39 | @TableField(value = "sort") 40 | @Schema(title = "排序", type = "Integer") 41 | private Integer sort; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/component/JwtTokenEnhancer.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.component; 2 | 3 | import com.besscroft.pisces.auth.domain.SecurityUser; 4 | import org.springframework.lang.NonNull; 5 | import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; 6 | import org.springframework.security.oauth2.common.OAuth2AccessToken; 7 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 8 | import org.springframework.security.oauth2.provider.token.TokenEnhancer; 9 | import org.springframework.stereotype.Component; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | /** 15 | * @Description JWT 内容增强处理 16 | * @Author Bess Croft 17 | * @Date 2022/2/4 12:19 18 | */ 19 | @Component 20 | public class JwtTokenEnhancer implements TokenEnhancer { 21 | 22 | @Override 23 | public OAuth2AccessToken enhance(@NonNull OAuth2AccessToken oAuth2AccessToken, @NonNull OAuth2Authentication oAuth2Authentication) { 24 | SecurityUser user = (SecurityUser) oAuth2Authentication.getPrincipal(); 25 | Map info = new HashMap<>(); 26 | info.put("id", user.getId()); 27 | info.put("account", user.getUsername()); 28 | info.put("client_id",user.getClientId()); 29 | ((DefaultOAuth2AccessToken) oAuth2AccessToken).setAdditionalInformation(info); 30 | return oAuth2AccessToken; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/controller/PublicKeyController.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.controller; 2 | 3 | import io.swagger.v3.oas.annotations.Operation; 4 | import io.swagger.v3.oas.annotations.tags.Tag; 5 | import lombok.RequiredArgsConstructor; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import com.nimbusds.jose.jwk.JWKSet; 11 | import com.nimbusds.jose.jwk.RSAKey; 12 | import java.security.KeyPair; 13 | import java.security.interfaces.RSAPublicKey; 14 | import java.util.Map; 15 | 16 | /** 17 | * @Description 公钥获取接口 18 | * @Author Bess Croft 19 | * @Date 2022/2/4 16:32 20 | */ 21 | @RestController 22 | @RequiredArgsConstructor 23 | @RequestMapping("/publicKey") 24 | @Tag(name = "公钥获取接口") 25 | public class PublicKeyController { 26 | 27 | private final KeyPair keyPair; 28 | 29 | /** 30 | * https://spring.io/guides/tutorials/spring-boot-oauth2/#_social_login_authserver 31 | * @return 公钥 32 | */ 33 | @GetMapping("/get") 34 | @Operation(summary = "公钥获取接口") 35 | public Map loadPublicKey() { 36 | RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); 37 | RSAKey key = new RSAKey.Builder(publicKey).build(); 38 | return new JWKSet(key).toJSONObject(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /pisces-framework/pisces-cache/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | pisces-framework 6 | com.besscroft.pisces 7 | ${revision} 8 | ../pom.xml 9 | 10 | 4.0.0 11 | 12 | pisces-cache 13 | jar 14 | pisces-cache 15 | 16 | 17 | 18 | 19 | org.springframework.boot 20 | spring-boot-starter-json 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-data-redis 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-cache 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/resource/UpdateResourceParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.resource; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | import javax.validation.constraints.NotNull; 8 | 9 | /** 10 | * @Description 更新资源 请求参数 11 | * @Author Bess Croft 12 | * @Date 2022/4/30 14:45 13 | */ 14 | @Data 15 | @Schema(title = "更新资源请求参数") 16 | public class UpdateResourceParam { 17 | 18 | /** 资源 id */ 19 | @NotNull(message = "资源 id 不能为空") 20 | @Schema(title = "资源 id", type = "String", required = true) 21 | private Long resourceId; 22 | 23 | /** 资源名称 */ 24 | @Schema(title = "资源名称", type = "String") 25 | private String name; 26 | 27 | /** 资源路径 */ 28 | @Schema(title = "资源路径", type = "String") 29 | private String url; 30 | 31 | /** 资源描述 */ 32 | @Schema(title = "资源描述", type = "String") 33 | private String description; 34 | 35 | /** 路由分配 key */ 36 | @Schema(title = "路由分配 key", type = "String") 37 | @NotBlank(message = "路由分配 key 不能为空") 38 | private String routeKey; 39 | 40 | /** 资源类别 id */ 41 | @NotNull(message = "资源类别 id 不能为空") 42 | @Schema(title = "资源类别 id", type = "Long", required = true) 43 | private Long categoryId; 44 | 45 | /** 排序 */ 46 | @Schema(title = "排序", type = "Integer") 47 | private Integer sort; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/entity/Dict.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import lombok.*; 9 | 10 | /** 11 | * @Description 字典实体 12 | * @Author Bess Croft 13 | * @Date 2022/8/5 14:16 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @EqualsAndHashCode(callSuper = true) 20 | @TableName(value = "pisces_sys_dict") 21 | @Schema(title = "字典实体") 22 | public class Dict extends BaseEntity { 23 | 24 | @TableId(type = IdType.AUTO) 25 | @Schema(title = "字典 id", type = "Long") 26 | private Long id; 27 | 28 | /** 字典分组 */ 29 | @TableField(value = "group_name") 30 | @Schema(title = "字典分组", type = "String") 31 | private String groupName; 32 | 33 | /** 字典 key */ 34 | @TableField(value = "key") 35 | @Schema(title = "字典 key", type = "String") 36 | private String key; 37 | 38 | /** 字典值 */ 39 | @TableField(value = "value") 40 | @Schema(title = "字典值", type = "String") 41 | private String value; 42 | 43 | /** 备注 */ 44 | @TableField(value = "remark") 45 | @Schema(title = "备注", type = "String") 46 | private String remark; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pisces-admin/admin-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.besscroft.pisces 7 | pisces-admin 8 | ${revision} 9 | ../pom.xml 10 | 11 | 12 | com.besscroft.pisces.admin.api 13 | admin-api 14 | jar 15 | Pisces Cloud 管理系统业务处理 api 模块 16 | 17 | 18 | 19 | 20 | com.besscroft.pisces 21 | pisces-common 22 | ${revision} 23 | 24 | 25 | 26 | org.springframework.cloud 27 | spring-cloud-starter-openfeign 28 | 29 | 30 | io.github.openfeign 31 | feign-okhttp 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/ResourceCategoryService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.admin.domain.dto.ResourceCategoryDictDto; 5 | import com.besscroft.pisces.framework.common.entity.ResourceCategory; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 资源类别服务接口 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 12:38 13 | */ 14 | public interface ResourceCategoryService extends IService { 15 | 16 | /** 17 | * 获取资源类别列表(分页) 18 | * @param pageNum 页码 19 | * @param pageSize 页大小 20 | * @param queryKey 查询参数 21 | * @return 资源类别列表分页对象 22 | */ 23 | List getResourceCategoryListPage(Integer pageNum, Integer pageSize, String queryKey); 24 | 25 | /** 26 | * 资源类别逻辑删除 27 | * @param resourceCategoryId 资源类别 id 28 | */ 29 | void deleteResourceCategory(Long resourceCategoryId); 30 | 31 | /** 32 | * 获取资源类别字典 33 | * @return 资源类别字典 34 | */ 35 | List getResourceCategoryDict(); 36 | 37 | /** 38 | * 新增资源类别 39 | * @param resourceCategory 资源类别实体 40 | */ 41 | void addResourceCategory(ResourceCategory resourceCategory); 42 | 43 | /** 44 | * 更新资源类别 45 | * @param resourceCategory 资源类别实体 46 | */ 47 | void updateResourceCategory(ResourceCategory resourceCategory); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/entity/Depart.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import lombok.*; 9 | 10 | /** 11 | * @Description 部门实体 12 | * @Author Bess Croft 13 | * @Date 2022/2/5 12:06 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @EqualsAndHashCode(callSuper = true) 20 | @TableName(value = "pisces_auth_depart") 21 | @Schema(title = "部门实体") 22 | public class Depart extends BaseEntity { 23 | 24 | @TableId(type = IdType.AUTO) 25 | @Schema(title = "部门 id", type = "Long") 26 | private Long id; 27 | 28 | /** 上级 id */ 29 | @TableField(value = "parent_id") 30 | @Schema(title = "上级 id", type = "Long") 31 | private Long parentId; 32 | 33 | /** 部门名称 */ 34 | @TableField(value = "name") 35 | @Schema(title = "部门名称", type = "String") 36 | private String name; 37 | 38 | /** 部门描述 */ 39 | @TableField(value = "description") 40 | @Schema(title = "部门描述", type = "String") 41 | private String description; 42 | 43 | /** 排序 */ 44 | @TableField(value = "sort") 45 | @Schema(title = "排序", type = "Integer") 46 | private Integer sort; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/entity/White.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import lombok.*; 9 | 10 | /** 11 | * @Description 白名单实体 12 | * @Author Bess Croft 13 | * @Date 2022/5/14 18:17 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @EqualsAndHashCode(callSuper = true) 20 | @TableName(value = "pisces_sys_white") 21 | @Schema(title = "白名单实体") 22 | public class White extends BaseEntity { 23 | 24 | @TableId(type = IdType.AUTO) 25 | @Schema(title = "白名单 id", type = "Long") 26 | private Long id; 27 | 28 | /** 白名单规则名称 */ 29 | @TableField(value = "title") 30 | @Schema(title = "白名单规则名称", type = "String") 31 | private String title; 32 | 33 | /** 白名单规则地址 */ 34 | @TableField(value = "path") 35 | @Schema(title = "白名单规则地址", type = "String") 36 | private String path; 37 | 38 | /** 备注 */ 39 | @TableField(value = "remark") 40 | @Schema(title = "备注", type = "String") 41 | private String remark; 42 | 43 | /** 白名单规则启用状态:0->禁用;1->启用 */ 44 | @TableField(value = "status") 45 | @Schema(title = "白名单规则启用状态:0->禁用;1->启用", type = "Integer") 46 | private Integer status; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/DepartService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.admin.domain.dto.DepartDictDto; 5 | import com.besscroft.pisces.admin.domain.dto.DepartDto; 6 | import com.besscroft.pisces.admin.domain.dto.DepartTreeDto; 7 | import com.besscroft.pisces.framework.common.entity.Depart; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @Description 部门/组织服务接口 13 | * @Author Bess Croft 14 | * @Date 2022/2/5 12:39 15 | */ 16 | public interface DepartService extends IService { 17 | 18 | /** 19 | * 获取部门/组织列表(分页) 20 | * @param pageNum 页码 21 | * @param pageSize 页大小 22 | * @param queryKey 查询参数 23 | * @return 部门/组织列表分页对象 24 | */ 25 | List getDepartListPage(Integer pageNum, Integer pageSize, String queryKey); 26 | 27 | /** 28 | * 部门逻辑删除 29 | * @param departId 部门/组织 id 30 | */ 31 | void deleteDepart(Long departId); 32 | 33 | /** 34 | * 新增部门 35 | * @param depart 部门实体 36 | */ 37 | void addDepart(Depart depart); 38 | 39 | /** 40 | * 更新部门 41 | * @param depart 部门 42 | */ 43 | void updateDepart(Depart depart); 44 | 45 | /** 46 | * 获取部门字典 47 | * @return 部门字典 48 | */ 49 | List getDepartDict(); 50 | 51 | /** 52 | * 获取部门树 53 | * @return 部门树 54 | */ 55 | List getUserDepartList(); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/config/SpringDocConfig.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.config; 2 | 3 | import io.swagger.v3.oas.models.ExternalDocumentation; 4 | import io.swagger.v3.oas.models.OpenAPI; 5 | import io.swagger.v3.oas.models.info.Contact; 6 | import io.swagger.v3.oas.models.info.Info; 7 | import io.swagger.v3.oas.models.info.License; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * @Description SpringDoc 配置 13 | * @Author Bess Croft 14 | * @Date 2022/6/3 20:23 15 | */ 16 | @Configuration 17 | public class SpringDocConfig { 18 | 19 | @Bean 20 | public OpenAPI customOpenApi() { 21 | return new OpenAPI() 22 | .info(new Info().title("Pisces Auth") 23 | .description("一站式微服务解决方案,基于 Spring Cloud 2021.0.1 & Alibaba 2021.0.1.0 + Spring Security OAuth2 + PostgreSQL + Mybatis-Plus 构建。") 24 | .version("v2.0.0") 25 | .contact(new Contact() 26 | .name("Bess Croft") 27 | .email("besscroft@foxmail.com")) 28 | .license(new License().name("MIT license").url("https://github.com/besscroft/pisces-cloud/blob/main/LICENSE"))) 29 | .externalDocs(new ExternalDocumentation() 30 | .description("Pisces Cloud 文档") 31 | .url("https://docs.besscroft.com/pisces/readme.html")); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/resources/mapper/WhiteMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | id, title, path, remark, creator, updater, create_time, update_time, status, del 22 | 23 | 24 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/config/SpringDocConfig.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.config; 2 | 3 | import io.swagger.v3.oas.models.ExternalDocumentation; 4 | import io.swagger.v3.oas.models.OpenAPI; 5 | import io.swagger.v3.oas.models.info.Contact; 6 | import io.swagger.v3.oas.models.info.Info; 7 | import io.swagger.v3.oas.models.info.License; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * @Description SpringDoc 配置 13 | * @Author Bess Croft 14 | * @Date 2022/6/3 20:21 15 | */ 16 | @Configuration 17 | public class SpringDocConfig { 18 | 19 | @Bean 20 | public OpenAPI customOpenApi() { 21 | return new OpenAPI() 22 | .info(new Info().title("Pisces Admin") 23 | .description("一站式微服务解决方案,基于 Spring Cloud 2021.0.1 & Alibaba 2021.0.1.0 + Spring Security OAuth2 + PostgreSQL + Mybatis-Plus 构建。") 24 | .version("v2.0.0") 25 | .contact(new Contact() 26 | .name("Bess Croft") 27 | .email("besscroft@foxmail.com")) 28 | .license(new License().name("MIT license").url("https://github.com/besscroft/pisces-cloud/blob/main/LICENSE"))) 29 | .externalDocs(new ExternalDocumentation() 30 | .description("Pisces Cloud 文档") 31 | .url("https://docs.besscroft.com/pisces/readme.html")); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/config/SpringDocConfig.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.config; 2 | 3 | import io.swagger.v3.oas.models.ExternalDocumentation; 4 | import io.swagger.v3.oas.models.OpenAPI; 5 | import io.swagger.v3.oas.models.info.Contact; 6 | import io.swagger.v3.oas.models.info.Info; 7 | import io.swagger.v3.oas.models.info.License; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * @Description SpringDoc 配置 13 | * @Author Bess Croft 14 | * @Date 2022/7/19 20:38 15 | */ 16 | @Configuration 17 | public class SpringDocConfig { 18 | 19 | @Bean 20 | public OpenAPI customOpenApi() { 21 | return new OpenAPI() 22 | .info(new Info().title("Pisces File") 23 | .description("一站式微服务解决方案,基于 Spring Cloud 2021.0.1 & Alibaba 2021.0.1.0 + Spring Security OAuth2 + PostgreSQL + Mybatis-Plus 构建。") 24 | .version("v2.0.0") 25 | .contact(new Contact() 26 | .name("Bess Croft") 27 | .email("besscroft@foxmail.com")) 28 | .license(new License().name("MIT license").url("https://github.com/besscroft/pisces-cloud/blob/main/LICENSE"))) 29 | .externalDocs(new ExternalDocumentation() 30 | .description("Pisces Cloud 文档") 31 | .url("https://docs.besscroft.com/pisces/readme.html")); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/resources/mapper/ResourceCategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | id, category_name, description, sort, creator, updater, create_time, update_time, del 21 | 22 | 23 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/ResourceService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.admin.domain.dto.ResourceDto; 5 | import com.besscroft.pisces.framework.common.entity.Resource; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | import java.util.Set; 10 | 11 | /** 12 | * @Description 资源服务接口 13 | * @Author Bess Croft 14 | * @Date 2022/2/5 12:38 15 | */ 16 | public interface ResourceService extends IService { 17 | 18 | /** 19 | * 初始化资源角色规则 20 | * @return 资源角色规则 21 | */ 22 | Map> initRoleResourceMap(); 23 | 24 | /** 25 | * 获取资源列表(分页) 26 | * @param pageNum 页码 27 | * @param pageSize 页大小 28 | * @param queryKey 查询参数 29 | * @return 资源列表分页对象 30 | */ 31 | List getResourceListPage(Integer pageNum, Integer pageSize, String queryKey); 32 | 33 | /** 34 | * 获取所有资源树 35 | * @return 资源树 36 | */ 37 | List getAll(); 38 | 39 | /** 40 | * 根据角色 id 获取资源 id 列表 41 | * @param roleId 角色 id 42 | * @return 资源 id 列表 43 | */ 44 | Set getIdsByRoleId(Long roleId); 45 | 46 | /** 47 | * 资源逻辑删除 48 | * @param resourceId 资源 id 49 | */ 50 | void deleteResource(Long resourceId); 51 | 52 | /** 53 | * 新增资源 54 | * @param resource 资源实体 55 | */ 56 | void addResource(Resource resource); 57 | 58 | /** 59 | * 更新资源 60 | * @param resource 资源实体 61 | */ 62 | void updateResource(Resource resource); 63 | 64 | } 65 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/converter/DepartConverterMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.converter; 2 | 3 | import com.besscroft.pisces.admin.domain.dto.DepartDto; 4 | import com.besscroft.pisces.admin.domain.dto.DepartTreeDto; 5 | import com.besscroft.pisces.admin.domain.param.depart.AddDepartParam; 6 | import com.besscroft.pisces.admin.domain.param.depart.UpdateDepartParam; 7 | import com.besscroft.pisces.framework.common.entity.Depart; 8 | import org.mapstruct.Mapper; 9 | import org.mapstruct.Mapping; 10 | import org.mapstruct.Mappings; 11 | import org.mapstruct.factory.Mappers; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * @Description 部门对象转换器 17 | * @Author Bess Croft 18 | * @Date 2022/4/30 17:02 19 | */ 20 | @Mapper(componentModel = "spring") 21 | public interface DepartConverterMapper { 22 | 23 | DepartConverterMapper INSTANCE = Mappers.getMapper(DepartConverterMapper.class); 24 | 25 | Depart AddParamToDepart(AddDepartParam param); 26 | 27 | @Mappings({ 28 | @Mapping(source = "param.departId", target = "id"), 29 | }) 30 | Depart UpdateParamToDepart(UpdateDepartParam param); 31 | 32 | DepartDto DepartToDepartDto(Depart depart); 33 | 34 | List DepartToDepartDtoList(List departList); 35 | 36 | @Mappings({ 37 | @Mapping(source = "departDto.id", target = "departId"), 38 | @Mapping(source = "departDto.name", target = "departName") 39 | }) 40 | DepartTreeDto DepartDtoToDepartTreeDto(DepartDto departDto); 41 | 42 | List DepartDtoToDepartTreeDtoList(List departDtoList); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/user/UpdateUserParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.user; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import io.swagger.v3.oas.annotations.media.Schema; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * @Description 更新用户请求参数 12 | * @Author Bess Croft 13 | * @Date 2022/3/20 16:22 14 | */ 15 | @Data 16 | @Schema(title = "更新用户请求参数") 17 | public class UpdateUserParam { 18 | 19 | /** 用户 id */ 20 | @NotNull(message = "用户 id 不能为空") 21 | @Schema(title = "用户 id", type = "Long", required = true) 22 | private Long id; 23 | 24 | /** 头像(地址) */ 25 | @Schema(title = "头像(地址)", type = "String") 26 | private String avatar; 27 | 28 | /** 邮箱 */ 29 | @Schema(title = "邮箱", type = "String") 30 | private String email; 31 | 32 | /** 昵称 */ 33 | @Schema(title = "昵称", type = "String") 34 | private String name; 35 | 36 | /** 真实姓名 */ 37 | @Schema(title = "真实姓名", type = "String") 38 | private String realName; 39 | 40 | /** 手机 */ 41 | @Schema(title = "手机", type = "String") 42 | private String telephone; 43 | 44 | /** 生日 */ 45 | @Schema(title = "生日", type = "Date") 46 | @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") 47 | private LocalDateTime birthday; 48 | 49 | /** 性别 */ 50 | @Schema(title = "性别", type = "Integer") 51 | private Integer sex; 52 | 53 | /** 备注 */ 54 | @Schema(title = "备注", type = "String") 55 | private String remark; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/entity/Role.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import lombok.*; 9 | 10 | /** 11 | * @Description 角色实体 12 | * @Author Bess Croft 13 | * @Date 2022/2/5 12:06 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @EqualsAndHashCode(callSuper = true) 20 | @TableName(value = "pisces_auth_role") 21 | @Schema(title = "角色实体") 22 | public class Role extends BaseEntity { 23 | 24 | @TableId(type = IdType.AUTO) 25 | @Schema(title = "角色 id", type = "Long") 26 | private Long id; 27 | 28 | /** 角色名称 */ 29 | @TableField(value = "role_name") 30 | @Schema(title = "角色名称", type = "String") 31 | private String roleName; 32 | 33 | /** 角色编码 */ 34 | @TableField(value = "role_code") 35 | @Schema(title = "角色编码", type = "String") 36 | private String roleCode; 37 | 38 | /** 描述 */ 39 | @TableField(value = "description") 40 | @Schema(title = "描述", type = "String") 41 | private String description; 42 | 43 | /** 排序 */ 44 | @TableField(value = "sort") 45 | @Schema(title = "排序", type = "Integer") 46 | private Integer sort; 47 | 48 | /** 角色启用状态:0->禁用;1->启用 */ 49 | @TableField(value = "status") 50 | @Schema(title = "角色启用状态:0->禁用;1->启用", type = "Integer") 51 | private Integer status; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/user/AddUserParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.user; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotEmpty; 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | * @Description 新增用户请求参数 11 | * @Author Bess Croft 12 | * @Date 2022/3/20 14:17 13 | */ 14 | @Data 15 | @Schema(title = "新增用户请求参数") 16 | public class AddUserParam { 17 | 18 | /** 用户名 */ 19 | @NotEmpty(message = "用户名不能为空") 20 | @Schema(title = "用户名", type = "String", required = true) 21 | private String username; 22 | 23 | /** 密码 */ 24 | @NotEmpty(message = "密码不能为空") 25 | @Schema(title = "密码", type = "String", required = true) 26 | private String password; 27 | 28 | /** 头像(地址) */ 29 | @Schema(title = "头像(地址)", type = "String") 30 | private String avatar; 31 | 32 | /** 邮箱 */ 33 | @Schema(title = "邮箱", type = "String") 34 | private String email; 35 | 36 | /** 昵称 */ 37 | @Schema(title = "昵称", type = "String") 38 | private String name; 39 | 40 | /** 真实姓名 */ 41 | @Schema(title = "真实姓名", type = "String") 42 | private String realName; 43 | 44 | /** 手机 */ 45 | @Schema(title = "手机", type = "String") 46 | private String telephone; 47 | 48 | /** 生日 */ 49 | @Schema(title = "生日", type = "Date") 50 | private LocalDateTime birthday; 51 | 52 | /** 性别 */ 53 | @Schema(title = "性别", type = "Integer") 54 | private Integer sex; 55 | 56 | /** 备注 */ 57 | @Schema(title = "备注", type = "String") 58 | private String remark; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /fork-and-push.md: -------------------------------------------------------------------------------- 1 | ## 如何给开源(本)项目贡献代码 2 | 3 | > 此方法也适用于你在其它仓库贡献代码!!! 4 | 5 | 一般我们会接触到如下两种: 6 | 7 | - 代码仓库管理者给你添加该仓库的写入权限,这样的话可以直接`push`。 8 | - 对于不能直接`push`的仓库,采用经典的`fork & new pr`来提交代码。 9 | 10 | ### fork & pull request 11 | 12 | 本仓库采用了最常见的开发模型,稳定的代码会提交到`main`分支,其它特性全部在`dev`分支进行开发,功能完善/稳定后,会合并到`main`分支。 13 | 14 | > 注意,并不是所有仓库的都叫`dev`,你可以尝试追踪 git 树以了解此库具有相同特性的分支。 15 | 16 | 假如现在需要在其分支`dev`上提交代码(修复 bug、优化性能、新增功能),那么我建议你这样做: 17 | 18 | * 克隆代码到本地 19 | 20 | ``` 21 | git clone https://github.com/besscroft/pisces-cloud.git 22 | ``` 23 | 24 | * 切换到远程分支`dev`(远程库默认名字为`origin`) 25 | 26 | ``` 27 | git checkout origin/dev 28 | ``` 29 | 30 | * 基于远程分支`dev`新建本地分支`dev`(注意远程分支和本地分支的区别,名字一样,但是一个是远程,一个是本地) 31 | 32 | ```bash 33 | git checkout -b dev 34 | 35 | # 或者 36 | git branch dev 37 | git checkout dev 38 | ``` 39 | 40 | * 在该分支提交你的更改,然后提交 41 | 42 | ```bash 43 | git commit -m ":bug:fix bug" 44 | ``` 45 | 46 | * 由于你此时没有直接 push 到 origin 的权限,所有需要先对该仓库进行`fork`,然后在本地添加一个新的推送地址 47 | 48 | ```bash 49 | git remote add upstream git@github.com:/pisces-cloud.git 50 | ``` 51 | 52 | * 推送本地分支到自己的`pisces-cloud fork`库(需要先做合并,因为此时远程分支管`dev`可能合并了其他代码) 53 | 54 | ```bash 55 | git fetch origin 56 | git merge origin/dev 57 | 58 | git push upstream dev 59 | ``` 60 | 61 | * 这样你的`pisces-cloud fork`库的`dev`分支包含了你的最新更改,点击上面的`new pull request`就可以推送请求了。注意推送的来源和目的地,如果不对需要点击`Edit`进行修改,另外可以点击下面的标签`file changed`查看具体的变动,确认无误后填写 pull request 的标题和具体内容,点击`create pull request`绿色按钮推送就可以了 62 | 63 | 如果评审人员给出了反馈需要继续修正代码,可以从第六步重新开始,这样所有的提交都会显示到同一个`pull request`中,如果想发起一个全新的`pull request`,可以拉出一个新的分支,然后重复第六步开始的工作。 64 | 65 | > 注:提交到本项目的代码,必须有如下要求: 66 | > 67 | > This commit was created on GitHub.com and signed with GitHub’s **verified signature**. -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/exception/PiscesException.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.exception; 2 | 3 | import com.besscroft.pisces.framework.common.constant.HttpStatus; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | /** 8 | * @Description 自定义全局异常 9 | * @Author Bess Croft 10 | * @Date 2022/3/24 10:31 11 | */ 12 | @Data 13 | @EqualsAndHashCode(callSuper = true) 14 | public class PiscesException extends RuntimeException { 15 | 16 | private static final Long serialVersionUID = 1L; 17 | 18 | /** 错误码 */ 19 | private Integer code; 20 | 21 | /** 错误提示 */ 22 | private String message; 23 | 24 | /** 25 | * 空构造方法,避免反序列化问题 26 | */ 27 | public PiscesException() { 28 | } 29 | 30 | public PiscesException(ErrorCode errorCode) { 31 | this.code = errorCode.getCode(); 32 | this.message = errorCode.getMessage(); 33 | } 34 | 35 | public PiscesException(String message) { 36 | this.code = HttpStatus.ERROR; 37 | this.message = message; 38 | } 39 | 40 | public PiscesException(Integer code, String message) { 41 | this.code = code; 42 | this.message = message; 43 | } 44 | 45 | public Integer getCode() { 46 | return code; 47 | } 48 | 49 | public PiscesException setCode(Integer code) { 50 | this.code = code; 51 | return this; 52 | } 53 | 54 | @Override 55 | public String getMessage() { 56 | return message; 57 | } 58 | 59 | public PiscesException setMessage(String message) { 60 | this.message = message; 61 | return this; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /doc/config/pisces-amqp-dev.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | # rabbitmq 配置 3 | rabbitmq: 4 | host: localhost 5 | port: 5672 6 | username: keqing 7 | password: keqing@520 8 | # 虚拟host 9 | virtual-host: pisces-dev 10 | cloud: 11 | # Sentinel 配置项,对应 SentinelProperties 配置属性类 12 | sentinel: 13 | enabled: true # 是否开启。默认为 true 开启 14 | eager: true # 是否饥饿加载。默认为 false 关闭 15 | transport: 16 | dashboard: 127.0.0.1:7070 # Sentinel 控制台地址 17 | port: 8719 18 | filter: 19 | enabled: true 20 | main: 21 | allow-bean-definition-overriding: true 22 | 23 | # Actuator 配置 24 | management: 25 | endpoints: 26 | web: 27 | exposure: 28 | # 监控项配置 29 | include: info, health 30 | endpoint: 31 | health: 32 | # 开启显示全部细节 33 | show-details: always 34 | shutdown: 35 | # 启用接口关闭 SpringBoot 36 | enabled: false 37 | # Micrometer 配置 38 | metrics: 39 | tags: 40 | application: ${spring.application.name} 41 | 42 | # 日志文件地址(提供给程序读取的地址,输出地址请在 log4j2.xml 配置) 43 | logging: 44 | file: 45 | name: logs/${spring.application.name}/info.log 46 | 47 | # 第三方通道配置 48 | pisces: 49 | amqp: 50 | channel: 51 | # server 酱 52 | server-chan: 53 | # (随便输入的,替换成自己的即可) 54 | send-key: SCT8YK9T52KUShcrzXUvru563dA09Imz 55 | # 推送地址 56 | push-url: https://sctapi.ftqq.com 57 | # bark 58 | bark: 59 | # (随便输入的,替换成自己的即可) 60 | send-key: b77TFWhHJS76xsQbGRbk8q 61 | # 推送地址,如果自建了服务器可以改成自己的 62 | push-url: https://api.day.app 63 | # telegram 64 | tg: 65 | # (随便输入的,替换成自己的即可) 66 | token: 'bot:2333333' 67 | # (随便输入的,替换成自己的即可) 68 | chat-id: 22333 69 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/dto/MenuDto.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.time.LocalDateTime; 7 | import java.util.List; 8 | 9 | /** 10 | * @Description 菜单树封装对象 11 | * @Author Bess Croft 12 | * @Date 2022/2/5 13:20 13 | */ 14 | @Data 15 | @Builder 16 | public class MenuDto { 17 | 18 | private Long id; 19 | 20 | /** 父级ID */ 21 | private Long parentId; 22 | 23 | /** 菜单名称 */ 24 | private String title; 25 | 26 | /** 前端名称 */ 27 | private String name; 28 | 29 | /** 父菜单名称 */ 30 | private String parentTitle; 31 | 32 | /** 菜单级数 */ 33 | private Integer level; 34 | 35 | /** 组件路径 */ 36 | private String component; 37 | 38 | /** 重定向地址 */ 39 | private String redirect; 40 | 41 | /** 路由地址 */ 42 | private String path; 43 | 44 | /** 菜单图标名称 */ 45 | private String icon; 46 | 47 | /** 外链(如果有填地址) */ 48 | private String isLink; 49 | 50 | /** 菜单显示状态:0->禁用;1->启用 */ 51 | private Integer isHide; 52 | 53 | /** 是否全屏:0->否;1->是 */ 54 | private Integer isFull; 55 | 56 | /** 是否固定在 tabs nav:0->否;1->是 */ 57 | private Integer isAffix; 58 | 59 | /** 是否缓存:0->否;1->是 */ 60 | private Integer isKeepAlive; 61 | 62 | /** 排序 */ 63 | private Integer sort; 64 | 65 | /** 创建者 */ 66 | private String creator; 67 | 68 | /** 更新者 */ 69 | private String updater; 70 | 71 | /** 创建时间 */ 72 | private LocalDateTime createTime; 73 | 74 | /** 更新时间 */ 75 | private LocalDateTime updateTime; 76 | 77 | /** 逻辑删除:0->删除状态;1->可用状态 */ 78 | private Integer del; 79 | 80 | /** 子菜单 **/ 81 | private List children; 82 | 83 | } 84 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/entity/Resource.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import lombok.*; 9 | 10 | /** 11 | * @Description 资源实体 12 | * @Author Bess Croft 13 | * @Date 2022/2/5 12:11 14 | */ 15 | @Data 16 | @Builder 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @EqualsAndHashCode(callSuper = true) 20 | @TableName(value = "pisces_auth_resource") 21 | @Schema(title = "资源实体") 22 | public class Resource extends BaseEntity { 23 | 24 | @TableId(type = IdType.AUTO) 25 | @Schema(title = "资源 id", type = "Long") 26 | private Long id; 27 | 28 | /** 资源名称 */ 29 | @TableField(value = "name") 30 | @Schema(title = "资源名称", type = "String") 31 | private String name; 32 | 33 | /** 资源路径 */ 34 | @TableField(value = "url") 35 | @Schema(title = "资源路径", type = "String") 36 | private String url; 37 | 38 | /** 资源描述 */ 39 | @TableField(value = "description") 40 | @Schema(title = "资源描述", type = "String") 41 | private String description; 42 | 43 | /** 资源类别 id */ 44 | @TableField(value = "category_id") 45 | @Schema(title = "资源类别 id", type = "Long") 46 | private Long categoryId; 47 | 48 | /** 排序 */ 49 | @TableField(value = "sort") 50 | @Schema(title = "排序", type = "Integer") 51 | private Integer sort; 52 | 53 | /** 路由分配 key */ 54 | @TableField(value = "route_key") 55 | @Schema(title = "路由分配 key", type = "String") 56 | private String routeKey; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/service/StorageService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.service; 2 | 3 | import java.io.InputStream; 4 | 5 | /** 6 | * @Description 存储服务接口 7 | * @Author Bess Croft 8 | * @Date 2022/8/1 21:48 9 | */ 10 | public interface StorageService { 11 | 12 | /** 13 | * 存放对象进存储桶 14 | * @param bucketName 存储桶名称 15 | * @param objectName 自定义对象名称 16 | * @param inputStream 对象的输入流 17 | * @param contentType Http MimeType 18 | * @return 文件链接 19 | */ 20 | String putObject(String bucketName, String objectName, InputStream inputStream, String contentType); 21 | 22 | /** 23 | * 存放对象进存储桶 24 | * @param bucketName 存储桶名称 25 | * @param objectName 自定义对象名称 26 | * @param inputStream 对象的输入流 27 | * @param contentType Http MimeType 28 | * @return CDN 文件链接 29 | */ 30 | String putObjectCdn(String bucketName, String objectName, InputStream inputStream, String contentType); 31 | 32 | /** 33 | * 从存储桶中获取对象 34 | * @param bucketName 存储桶名称 35 | * @param objectName 自定义对象名称 36 | * @return 对象的输入流 37 | */ 38 | InputStream getObject(String bucketName, String objectName); 39 | 40 | /** 41 | * 获取对象的地址 42 | * @param bucketName 存储桶名称 43 | * @param objectName 自定义对象名称 44 | * @return 文件地址 45 | */ 46 | String getObjectUrl(String bucketName, String objectName); 47 | 48 | /** 49 | * 获取对象的地址 50 | * @param bucketName 存储桶名称 51 | * @param objectName 自定义对象名称 52 | * @return CDN 文件地址 53 | */ 54 | String getObjectCdnUrl(String bucketName, String objectName); 55 | 56 | /** 57 | * 从存储桶中删除对象 58 | * @param bucketName 存储桶名称 59 | * @param objectName 自定义对象名称 60 | */ 61 | void removeObject(String bucketName, String objectName); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/resources/mapper/DepartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | id, parent_id, name, description, sort, creator, updater, create_time, update_time, del 22 | 23 | 24 | 35 | 36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/resources/mapper/DictMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | id, group_name, key, value, creator, updater, create_time, update_time, del, remark 22 | 23 | 24 | 34 | 35 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/util/SecurityUtils.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.util; 2 | 3 | import com.besscroft.pisces.framework.common.constant.AuthConstants; 4 | import com.besscroft.pisces.framework.common.entity.User; 5 | import com.besscroft.pisces.framework.common.exception.PiscesException; 6 | import com.fasterxml.jackson.core.JsonProcessingException; 7 | import com.fasterxml.jackson.databind.ObjectMapper; 8 | import lombok.RequiredArgsConstructor; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.data.redis.core.RedisTemplate; 12 | import org.springframework.util.Assert; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import java.util.Map; 16 | 17 | /** 18 | * @Description 用户安全信息帮助类 19 | * @Author Bess Croft 20 | * @Date 2022/3/24 16:48 21 | */ 22 | @Slf4j 23 | @Configuration 24 | @RequiredArgsConstructor 25 | public class SecurityUtils { 26 | 27 | private final HttpServletRequest request; 28 | private final ObjectMapper objectMapper = new ObjectMapper(); 29 | private final RedisTemplate redisTemplate; 30 | 31 | /** 32 | * 获取当前登录用户的信息 33 | * @return 用户信息 34 | */ 35 | public User getCurrentAdmin() { 36 | String header = request.getHeader(AuthConstants.USER_TOKEN_HEADER); 37 | Assert.notNull(header, "暂未登录或 token 已经过期!"); 38 | Map userDto; 39 | try { 40 | userDto = objectMapper.readValue(header, Map.class); 41 | } catch (JsonProcessingException e) { 42 | throw new PiscesException(500, "token 无效!"); 43 | } 44 | return (User) redisTemplate.opsForValue().get(String.join(":", AuthConstants.SYSTEM_USER, String.valueOf(userDto.get("user_name")))); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pisces-framework/pisces-mybatis/src/main/java/com/besscroft/pisces/framework/mybatis/handler/CustomMetaObjectHandler.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.mybatis.handler; 2 | 3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; 4 | import com.besscroft.pisces.framework.common.util.SecurityUtils; 5 | import lombok.RequiredArgsConstructor; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.apache.ibatis.reflection.MetaObject; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.time.LocalDateTime; 11 | 12 | /** 13 | * @Description Mybatis-Plus 自动填充自定义实现类 14 | * @Author Bess Croft 15 | * @Date 2022/10/19 11:51 16 | */ 17 | @Slf4j 18 | @Component 19 | @RequiredArgsConstructor 20 | public class CustomMetaObjectHandler implements MetaObjectHandler { 21 | 22 | private final SecurityUtils securityUtils; 23 | 24 | @Override 25 | public void insertFill(MetaObject metaObject) { 26 | log.info("username:{}", securityUtils.getCurrentAdmin().getUsername()); 27 | String username = securityUtils.getCurrentAdmin().getUsername(); 28 | log.info("username:{}", securityUtils.getCurrentAdmin().getUsername()); 29 | this.strictInsertFill(metaObject, "creator", String.class, username); 30 | this.strictInsertFill(metaObject, "createTime", LocalDateTime::now, LocalDateTime.class); 31 | this.strictInsertFill(metaObject, "updater", String.class, username); 32 | this.strictInsertFill(metaObject, "updateTime", LocalDateTime::now, LocalDateTime.class); 33 | } 34 | 35 | @Override 36 | public void updateFill(MetaObject metaObject) { 37 | this.strictUpdateFill(metaObject, "updater", () -> securityUtils.getCurrentAdmin().getUsername(), String.class); 38 | this.strictUpdateFill(metaObject, "updateTime", LocalDateTime::now, LocalDateTime.class); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/MenuService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.admin.domain.dto.MenuDictDto; 5 | import com.besscroft.pisces.admin.domain.dto.MenuDto; 6 | import com.besscroft.pisces.framework.common.entity.Menu; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | import java.util.Set; 11 | 12 | /** 13 | * @Description 菜单服务接口 14 | * @Author Bess Croft 15 | * @Date 2022/2/5 12:38 16 | */ 17 | public interface MenuService extends IService { 18 | 19 | /** 20 | * 获取当前用户菜单动态路由 21 | * @param userId 用户 id 22 | * @return 当前用户的所有动态路由 23 | */ 24 | Map getTreeListById(Long userId); 25 | 26 | /** 27 | * 获取菜单列表(分页) 28 | * @param queryKey 查询参数 29 | * @return 菜单列表分页对象 30 | */ 31 | List getMenuList(String queryKey); 32 | 33 | /** 34 | * 更改菜单可用状态 35 | * @param menuId 菜单 id 36 | * @param isHide 可用状态 37 | */ 38 | void changeStatus(Long menuId, Boolean isHide); 39 | 40 | /** 41 | * 菜单逻辑删除 42 | * @param menuId 菜单 id 43 | */ 44 | void deleteMenu(Long menuId); 45 | 46 | /** 47 | * 更新菜单 48 | * @param menu 菜单实体 49 | */ 50 | void updateMenu(Menu menu); 51 | 52 | /** 53 | * 根据角色 id 获取菜单 id 列表 54 | * @param roleId 角色 id 55 | * @return 菜单 id 列表 56 | */ 57 | Set getIdsByRoleId(Long roleId); 58 | 59 | /** 60 | * 获取所有菜单树 61 | * @return 所有菜单树 62 | */ 63 | List getAll(); 64 | 65 | /** 66 | * 新增菜单 67 | * @param menu 菜单实体 68 | */ 69 | void addMenu(Menu menu); 70 | 71 | /** 72 | * 获取菜单字典 73 | * @return 菜单字典 74 | */ 75 | List getMenuDict(); 76 | 77 | } 78 | -------------------------------------------------------------------------------- /pisces-framework/pisces-common/src/main/java/com/besscroft/pisces/framework/common/constant/HttpStatus.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.common.constant; 2 | 3 | /** 4 | * @Description 返回状态码 5 | * @Author Bess Croft 6 | * @Date 2022/2/2 21:47 7 | */ 8 | public class HttpStatus { 9 | 10 | /** 11 | * 操作成功 12 | */ 13 | public static final int SUCCESS = 200; 14 | 15 | /** 16 | * 对象创建成功 17 | */ 18 | public static final int CREATED = 201; 19 | 20 | /** 21 | * 请求已经被接受 22 | */ 23 | public static final int ACCEPTED = 202; 24 | 25 | /** 26 | * 操作已经执行成功,但是没有返回数据 27 | */ 28 | public static final int NO_CONTENT = 204; 29 | 30 | /** 31 | * 资源已被移除 32 | */ 33 | public static final int MOVED_PERM = 301; 34 | 35 | /** 36 | * 重定向 37 | */ 38 | public static final int SEE_OTHER = 303; 39 | 40 | /** 41 | * 资源没有被修改 42 | */ 43 | public static final int NOT_MODIFIED = 304; 44 | 45 | /** 46 | * 参数列表错误(缺少,格式不匹配) 47 | */ 48 | public static final int BAD_REQUEST = 400; 49 | 50 | /** 51 | * 未授权 52 | */ 53 | public static final int UNAUTHORIZED = 401; 54 | 55 | /** 56 | * 访问受限,授权过期 57 | */ 58 | public static final int FORBIDDEN = 403; 59 | 60 | /** 61 | * 资源,服务未找到 62 | */ 63 | public static final int NOT_FOUND = 404; 64 | 65 | /** 66 | * 不允许的http方法 67 | */ 68 | public static final int BAD_METHOD = 405; 69 | 70 | /** 71 | * 资源冲突,或者资源被锁 72 | */ 73 | public static final int CONFLICT = 409; 74 | 75 | /** 76 | * 不支持的数据,媒体类型 77 | */ 78 | public static final int UNSUPPORTED_TYPE = 415; 79 | 80 | /** 81 | * 系统内部错误 82 | */ 83 | public static final int ERROR = 500; 84 | 85 | /** 86 | * 接口未实现 87 | */ 88 | public static final int NOT_IMPLEMENTED = 501; 89 | 90 | } 91 | -------------------------------------------------------------------------------- /pisces-auth/src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | id, username, password, avatar, email, name, real_name, telephone, birthday, sex, remark, creator, updater, create_time, update_time, status, del 29 | 30 | 31 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.besscroft.pisces.admin.domain.dto.RoleDictDto; 5 | import com.besscroft.pisces.framework.common.entity.Role; 6 | 7 | import java.util.List; 8 | import java.util.Set; 9 | 10 | /** 11 | * @Description 角色服务接口 12 | * @Author Bess Croft 13 | * @Date 2022/2/5 12:37 14 | */ 15 | public interface RoleService extends IService { 16 | 17 | /** 18 | * 获取角色列表(分页) 19 | * @param pageNum 页码 20 | * @param pageSize 页大小 21 | * @param queryKey 查询参数 22 | * @return 角色列表分页对象 23 | */ 24 | List getRoleListPage(Integer pageNum, Integer pageSize, String queryKey); 25 | 26 | /** 27 | * 更改角色可用状态 28 | * @param roleId 角色 id 29 | * @param status 可用状态 30 | */ 31 | void changeStatus(Long roleId, Boolean status); 32 | 33 | /** 34 | * 更新角色的菜单 35 | * @param roleId 角色 id 36 | * @param menuIds 菜单 id 列表 37 | */ 38 | void updateMenu(Long roleId, Set menuIds); 39 | 40 | /** 41 | * 更新角色的资源 42 | * @param roleId 角色 id 43 | * @param resourceIds 资源 id 列表 44 | */ 45 | void updateResource(Long roleId, Set resourceIds); 46 | 47 | /** 48 | * 角色逻辑删除 49 | * @param roleId 角色 id 50 | */ 51 | void deleteRole(Long roleId); 52 | 53 | /** 54 | * 新增角色 55 | * @param role 角色实体 56 | */ 57 | void addRole(Role role); 58 | 59 | /** 60 | * 更新角色 61 | * @param role 角色实体 62 | */ 63 | void updateRole(Role role); 64 | 65 | /** 66 | * 获取角色字典 67 | * @return 角色字典 68 | */ 69 | List getRoleDict(); 70 | 71 | /** 72 | * 根据用户 id 获取角色信息 73 | * @param userId 用户 id 74 | * @return 角色信息 75 | */ 76 | List getRoleByUserId(Long userId); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/config/MinioOSSConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.config; 2 | 3 | import com.besscroft.pisces.file.service.StorageService; 4 | import com.besscroft.pisces.file.service.impl.MinioServiceImpl; 5 | import com.fasterxml.jackson.core.JsonProcessingException; 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | import io.minio.MinioClient; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | /** 15 | * @Description Minio OSS 配置 16 | * @Author Bess Croft 17 | * @Date 2022/11/16 13:54 18 | */ 19 | @Slf4j 20 | @Configuration 21 | @ConditionalOnProperty(prefix = "oss.minio", name = "active", havingValue = "true") 22 | @ConditionalOnClass(MinioClient.class) 23 | public class MinioOSSConfiguration { 24 | 25 | private final static ObjectMapper objectMapper = new ObjectMapper(); 26 | 27 | @Bean(name = "minioStorageService") 28 | StorageService minioStorage(OSSProperties ossProperties) { 29 | MinioClient client = minioClient(ossProperties); 30 | return new MinioServiceImpl(client, ossProperties); 31 | } 32 | 33 | @Bean 34 | public MinioClient minioClient(OSSProperties ossProperties) { 35 | OSSProperties.Minio minio = ossProperties.getMinio(); 36 | try { 37 | log.info("minio 初始化:{}", objectMapper.writeValueAsString(minio)); 38 | } catch (JsonProcessingException ignored) { 39 | log.error("minio 初始化配置解析异常!"); 40 | } 41 | return new MinioClient.Builder() 42 | .endpoint(minio.getEndpoint()) 43 | .credentials(minio.getAccessKey(), minio.getSecretKey()) 44 | .build(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/config/AliyunOSSConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.config; 2 | 3 | import com.aliyun.oss.OSS; 4 | import com.aliyun.oss.OSSClientBuilder; 5 | import com.besscroft.pisces.file.service.StorageService; 6 | import com.besscroft.pisces.file.service.impl.OssServiceImpl; 7 | import com.fasterxml.jackson.core.JsonProcessingException; 8 | import com.fasterxml.jackson.databind.ObjectMapper; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 11 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 12 | import org.springframework.context.annotation.Bean; 13 | import org.springframework.context.annotation.Configuration; 14 | 15 | /** 16 | * @Description 阿里云 OSS 配置 17 | * @Author Bess Croft 18 | * @Date 2022/8/5 12:07 19 | */ 20 | @Slf4j 21 | @Configuration 22 | @ConditionalOnProperty(prefix = "oss.aliyun", name = "active", havingValue = "true") 23 | @ConditionalOnClass(OSS.class) 24 | public class AliyunOSSConfiguration { 25 | 26 | private final static ObjectMapper objectMapper = new ObjectMapper(); 27 | 28 | @Bean(name = "aliyunStorageService") 29 | StorageService aliyunStorage(OSSProperties ossProperties) { 30 | OSS ossClient = ossClient(ossProperties); 31 | return new OssServiceImpl(ossClient, ossProperties); 32 | } 33 | 34 | @Bean 35 | public OSS ossClient(OSSProperties ossProperties) { 36 | OSSProperties.Aliyun aliyun = ossProperties.getAliyun(); 37 | try { 38 | log.info("oss 初始化:{}", objectMapper.writeValueAsString(aliyun)); 39 | } catch (JsonProcessingException ignored) { 40 | log.error("oss 初始化配置解析异常!"); 41 | } 42 | return new OSSClientBuilder() 43 | .build(aliyun.getEndpoint(), 44 | aliyun.getAccessKeyId(), 45 | aliyun.getAccessKeySecret()); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/java/com/besscroft/pisces/amqp/config/RabbitQueueConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp.config; 2 | 3 | import com.besscroft.pisces.framework.common.constant.AMQPConstant; 4 | import lombok.RequiredArgsConstructor; 5 | import org.springframework.amqp.core.Queue; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * @Description rabbitmq 配置 11 | * @Author Bess Croft 12 | * @Date 2022/9/3 23:54 13 | */ 14 | @Configuration 15 | @RequiredArgsConstructor 16 | public class RabbitQueueConfiguration { 17 | 18 | /** 19 | * 消息队列 20 | * @return Queue 21 | */ 22 | @Bean 23 | public Queue directMessageQueue() { 24 | return new Queue(AMQPConstant.MESSAGE_QUEUE); 25 | } 26 | 27 | /** 28 | * 短信队列 29 | * @return Queue 30 | */ 31 | @Bean 32 | public Queue directSMSQueue() { 33 | return new Queue(AMQPConstant.SMS_QUEUE); 34 | } 35 | 36 | /** 37 | * 邮件队列 38 | * @return Queue 39 | */ 40 | @Bean 41 | public Queue directEmailQueue() { 42 | return new Queue(AMQPConstant.EMAIL_QUEUE); 43 | } 44 | 45 | /** 46 | * server 酱队列 47 | * @return Queue 48 | */ 49 | @Bean 50 | public Queue directServerChanQueue() { 51 | return new Queue(AMQPConstant.SERVER_CHAN_QUEUE); 52 | } 53 | 54 | /** 55 | * Bark 队列 56 | * @return Queue 57 | */ 58 | @Bean 59 | public Queue directBarkQueue() { 60 | return new Queue(AMQPConstant.BARK_QUEUE); 61 | } 62 | 63 | /** 64 | * Telegram 队列 65 | * @return Queue 66 | */ 67 | @Bean 68 | public Queue directTGQueue() { 69 | return new Queue(AMQPConstant.TG_QUEUE); 70 | } 71 | 72 | /** 73 | * 企业微信队列 74 | * @return Queue 75 | */ 76 | @Bean 77 | public Queue directWorkWeixinQueue() { 78 | return new Queue(AMQPConstant.WORK_WEIXIN_QUEUE); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/service/impl/DictServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.besscroft.pisces.framework.common.entity.Dict; 5 | import com.besscroft.pisces.admin.mapper.DictMapper; 6 | import com.besscroft.pisces.admin.service.DictService; 7 | import com.github.pagehelper.PageHelper; 8 | import lombok.RequiredArgsConstructor; 9 | import org.springframework.lang.NonNull; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | import org.springframework.util.Assert; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @Description 字典服务实现类 18 | * @Author Bess Croft 19 | * @Date 2022/8/5 14:21 20 | */ 21 | @Service 22 | @RequiredArgsConstructor 23 | public class DictServiceImpl extends ServiceImpl implements DictService { 24 | 25 | @Override 26 | public List queryAllByGroup(@NonNull String groupName) { 27 | return this.baseMapper.selectAllByGroup(groupName); 28 | } 29 | 30 | @Override 31 | public List pageList(Integer pageNum, Integer pageSize, String queryKey) { 32 | PageHelper.startPage(pageNum, pageSize); 33 | return this.baseMapper.selectAllByQueryKey(queryKey); 34 | } 35 | 36 | @Override 37 | @Transactional(rollbackFor = Exception.class) 38 | public void addDict(@NonNull Dict dict) { 39 | Assert.isTrue(this.baseMapper.insert(dict) > 0, "新增字典失败!"); 40 | } 41 | 42 | @Override 43 | @Transactional(rollbackFor = Exception.class) 44 | public void updateDict(@NonNull Dict dict) { 45 | Assert.isTrue(this.baseMapper.updateById(dict) > 0, "更新字典失败!"); 46 | } 47 | 48 | @Override 49 | @Transactional(rollbackFor = Exception.class) 50 | public void deleteDict(@NonNull Long dictId) { 51 | Assert.isTrue(this.baseMapper.deleteById(dictId) > 0, "删除字典失败!"); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /pisces-auth/src/main/resources/mapper/RoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | id, role_name, role_code, description, sort, creator, updater, create_time, update_time, status, del 23 | 24 | 25 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /pisces-framework/pisces-cache/src/main/java/com/besscroft/pisces/framework/cache/config/CacheAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.framework.cache.config; 2 | 3 | import org.springframework.boot.autoconfigure.cache.CacheProperties; 4 | import org.springframework.cache.annotation.CachingConfigurerSupport; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Primary; 9 | import org.springframework.data.redis.cache.RedisCacheConfiguration; 10 | import org.springframework.data.redis.serializer.RedisSerializationContext; 11 | import org.springframework.data.redis.serializer.RedisSerializer; 12 | 13 | /** 14 | * @Description 缓存配置,基于 redis 的缓存 15 | * @Author Bess Croft 16 | * @Date 2022/5/21 21:55 17 | */ 18 | @Configuration 19 | @EnableCaching 20 | public class CacheAutoConfiguration extends CachingConfigurerSupport { 21 | 22 | @Bean 23 | @Primary 24 | public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) { 25 | // 设置使用 JSON 序列化方式 26 | RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig(); 27 | config = config.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(RedisSerializer.json())); 28 | 29 | // 设置 CacheProperties.Redis 的属性 30 | CacheProperties.Redis redisProperties = cacheProperties.getRedis(); 31 | if (redisProperties.getTimeToLive() != null) { 32 | config = config.entryTtl(redisProperties.getTimeToLive()); 33 | } 34 | if (redisProperties.getKeyPrefix() != null) { 35 | config = config.prefixCacheNameWith(redisProperties.getKeyPrefix()); 36 | } 37 | if (!redisProperties.isCacheNullValues()) { 38 | config = config.disableCachingNullValues(); 39 | } 40 | if (!redisProperties.isUseKeyPrefix()) { 41 | config = config.disableKeyPrefix(); 42 | } 43 | return config; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/sender/impl/MessageSenderImpl.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.sender.impl; 2 | 3 | import com.besscroft.pisces.admin.sender.MessageSender; 4 | import com.besscroft.pisces.framework.common.constant.AMQPConstant; 5 | import lombok.RequiredArgsConstructor; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.amqp.core.AmqpTemplate; 8 | import org.springframework.lang.NonNull; 9 | import org.springframework.scheduling.annotation.Async; 10 | import org.springframework.stereotype.Service; 11 | 12 | /** 13 | * @Description 消息发送服务实现 14 | * @Author Bess Croft 15 | * @Date 2022/9/4 11:27 16 | */ 17 | @Slf4j 18 | @Service 19 | @RequiredArgsConstructor 20 | public class MessageSenderImpl implements MessageSender { 21 | 22 | private final AmqpTemplate rabbitTemplate; 23 | 24 | @Override 25 | @Async 26 | public void send(@NonNull String message) { 27 | rabbitTemplate.convertAndSend(AMQPConstant.MESSAGE_QUEUE, message); 28 | } 29 | 30 | @Override 31 | @Async 32 | public void sendSMS(@NonNull String message) { 33 | rabbitTemplate.convertAndSend(AMQPConstant.SMS_QUEUE, message); 34 | } 35 | 36 | @Override 37 | @Async 38 | public void sendEmail(@NonNull String email) { 39 | rabbitTemplate.convertAndSend(AMQPConstant.EMAIL_QUEUE, email); 40 | } 41 | 42 | @Override 43 | @Async 44 | public void sendServerChan(@NonNull String message) { 45 | rabbitTemplate.convertAndSend(AMQPConstant.SERVER_CHAN_QUEUE, message); 46 | } 47 | 48 | @Override 49 | @Async 50 | public void sendBark(@NonNull String message) { 51 | rabbitTemplate.convertAndSend(AMQPConstant.BARK_QUEUE, message); 52 | } 53 | 54 | @Override 55 | @Async 56 | public void sendTG(@NonNull String message) { 57 | rabbitTemplate.convertAndSend(AMQPConstant.TG_QUEUE, message); 58 | } 59 | 60 | @Override 61 | @Async 62 | public void sendWorkWeixin(@NonNull String message) { 63 | rabbitTemplate.convertAndSend(AMQPConstant.WORK_WEIXIN_QUEUE, message); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/controller/MinioController.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.controller; 2 | 3 | import com.besscroft.pisces.file.service.StorageService; 4 | import com.besscroft.pisces.framework.common.result.AjaxResult; 5 | import io.swagger.v3.oas.annotations.Operation; 6 | import io.swagger.v3.oas.annotations.tags.Tag; 7 | import lombok.RequiredArgsConstructor; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.apache.commons.lang3.ObjectUtils; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestPart; 13 | import org.springframework.web.bind.annotation.RestController; 14 | import org.springframework.web.multipart.MultipartFile; 15 | 16 | /** 17 | * @Description Minio OSS 接口 18 | * @Author Bess Croft 19 | * @Date 2022/11/16 14:32 20 | */ 21 | @Slf4j 22 | @Tag(name = "Minio OSS 接口") 23 | @RestController 24 | @RequestMapping("/minio/oss") 25 | @RequiredArgsConstructor 26 | public class MinioController { 27 | 28 | private final StorageService minioStorageService; 29 | 30 | @PostMapping("/upload") 31 | @Operation(summary = "文件上传") 32 | public AjaxResult uploadFile(@RequestPart MultipartFile file) throws Exception { 33 | if (ObjectUtils.allNull(file)) { 34 | throw new RuntimeException("未上传文件!"); 35 | } 36 | String filename = file.getOriginalFilename(); 37 | String url = minioStorageService.putObject(null, filename, file.getInputStream(), "application/octet-stream"); 38 | return AjaxResult.success("上传成功!", url); 39 | } 40 | 41 | @PostMapping("/uploadCdn") 42 | @Operation(summary = "文件上传(CDN)") 43 | public AjaxResult uploadCdn(@RequestPart MultipartFile file) throws Exception { 44 | if (ObjectUtils.allNull(file)) { 45 | throw new RuntimeException("未上传文件!"); 46 | } 47 | String filename = file.getOriginalFilename(); 48 | String url = minioStorageService.putObjectCdn(null, filename, file.getInputStream(), "application/octet-stream"); 49 | return AjaxResult.success("上传成功!", url); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /pisces-api/pisces-file/src/main/java/com/besscroft/pisces/file/controller/AliyunOSSController.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.file.controller; 2 | 3 | import com.besscroft.pisces.file.service.StorageService; 4 | import com.besscroft.pisces.framework.common.result.AjaxResult; 5 | import io.swagger.v3.oas.annotations.Operation; 6 | import io.swagger.v3.oas.annotations.tags.Tag; 7 | import lombok.RequiredArgsConstructor; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.apache.commons.lang3.ObjectUtils; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestPart; 13 | import org.springframework.web.bind.annotation.RestController; 14 | import org.springframework.web.multipart.MultipartFile; 15 | 16 | /** 17 | * @Description 阿里云 OSS 接口 18 | * @Author Bess Croft 19 | * @Date 2022/7/28 15:27 20 | */ 21 | @Slf4j 22 | @Tag(name = "阿里云 OSS 接口") 23 | @RestController 24 | @RequestMapping("/aliyun/oss") 25 | @RequiredArgsConstructor 26 | public class AliyunOSSController { 27 | 28 | private final StorageService aliyunStorageService; 29 | 30 | @PostMapping("/upload") 31 | @Operation(summary = "文件上传") 32 | public AjaxResult uploadFile(@RequestPart MultipartFile file) throws Exception { 33 | if (ObjectUtils.allNull(file)) { 34 | throw new RuntimeException("未上传文件!"); 35 | } 36 | String filename = file.getOriginalFilename(); 37 | String url = aliyunStorageService.putObject(null, filename, file.getInputStream(), "application/octet-stream"); 38 | return AjaxResult.success("上传成功!", url); 39 | } 40 | 41 | @PostMapping("/uploadCdn") 42 | @Operation(summary = "文件上传(CDN)") 43 | public AjaxResult uploadCdn(@RequestPart MultipartFile file) throws Exception { 44 | if (ObjectUtils.allNull(file)) { 45 | throw new RuntimeException("未上传文件!"); 46 | } 47 | String filename = file.getOriginalFilename(); 48 | String url = aliyunStorageService.putObjectCdn(null, filename, file.getInputStream(), "application/octet-stream"); 49 | return AjaxResult.success("上传成功!", url); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /doc/front/readme.md: -------------------------------------------------------------------------------- 1 | --- 2 | icon: creative 3 | category: Pisces 4 | --- 5 | 6 | # 前端项目介绍 7 | 8 | [![](https://img.shields.io/badge/%E5%BC%80%E5%8F%91%E8%BF%9B%E5%BA%A6-%E5%BC%80%E5%8F%91%E4%B8%AD-brightgreen?style=flat-square)]() [![](https://img.shields.io/badge/license-GPL%20v3.0-green?style=flat-square)](https://github.com/besscroft/pisces-cloud-web/blob/master/LICENSE) ![GitHub repo size](https://img.shields.io/github/repo-size/besscroft/pisces-cloud-web?style=flat-square&color=328657) 9 | 10 | Pisces-Cloud 的前端,基于 Vue3 + Vite + Pinia + Vue Router + TypeScript + Element-PLUS 构建。 11 | 12 | ## 项目结构 13 | 14 | > 已重构,文档待更新! 15 | 16 | ``` 17 | ├── dist # 构建后的源码 18 | ├── public # 静态资源 19 | │ │── favicon.ico # favicon图标 20 | ├── src # 源代码 21 | │ ├── @types # 类型文件 22 | │ ├── api # 所有请求 23 | │ ├── assets # 主题 字体等静态资源 24 | │ ├── components # 全局公用组件 25 | │ ├── config # 配置文件夹 26 | │ ├── constant # 常量 27 | │ ├── icons # 图标 28 | │ ├── layout # 全局 layout 29 | | ├── plugins # 插件 30 | │ ├── router # 路由 31 | │ ├── store # 全局 store 管理 32 | │ ├── styles # 全局样式 33 | │ ├── types # 接口、页面ts类型约束 34 | │ ├── utils # 全局公用方法 35 | │ ├── views # views 所有页面 36 | │ ├── App.vue # 入口页面 37 | │ ├── main.ts # 入口文件 加载组件 初始化等 38 | │ └── shims-vue.d.ts # vue 类型约束 39 | ├── .browserslistrc # browserslist 配置文件 40 | ├── .editorconfig # editorconfig 配置文件 41 | ├── .env.xxx # 环境变量配置 42 | ├── .gitignore # gitignore 配置文件 43 | ├── auto-imports.d.ts # 自动导入配置文件 44 | ├── babel.config.js # babel 配置文件 45 | ├── components.d.ts # 组件配置文件 46 | ├── index.html # html模板 47 | ├── LICENSE # 许可证 48 | ├── package.json # package.json 49 | ├── README.md # README.md 50 | ├── tsconfig.json # ts配置文件 51 | └── vite.config.ts # vite配置文件 52 | ``` 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/filter/AuthGlobalFilter.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.filter; 2 | 3 | import com.besscroft.pisces.framework.common.constant.AuthConstants; 4 | import com.nimbusds.jose.JWSObject; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.springframework.core.Ordered; 8 | import org.springframework.http.server.reactive.ServerHttpRequest; 9 | import org.springframework.stereotype.Component; 10 | import org.springframework.web.server.ServerWebExchange; 11 | import org.springframework.web.server.WebFilter; 12 | import org.springframework.web.server.WebFilterChain; 13 | import reactor.core.publisher.Mono; 14 | 15 | import java.text.ParseException; 16 | 17 | /** 18 | * @Description 全局 token 过滤器 19 | * @Author Bess Croft 20 | * @Date 2022/3/4 22:33 21 | */ 22 | @Slf4j 23 | @Component 24 | public class AuthGlobalFilter implements WebFilter, Ordered { 25 | 26 | /** 27 | * 过滤器 28 | * @param exchange 请求 29 | * @param chain 过滤器链 30 | * @return 31 | */ 32 | @Override 33 | public Mono filter(ServerWebExchange exchange, WebFilterChain chain) { 34 | String token = exchange.getRequest().getHeaders().getFirst(AuthConstants.JWT_TOKEN_HEADER); 35 | log.info("请求进来了.[token={}]", token); 36 | if (StringUtils.isBlank(token)) { 37 | return chain.filter(exchange); 38 | } 39 | try { 40 | String repToken = token.replace(AuthConstants.JWT_TOKEN_PREFIX, ""); 41 | JWSObject jwsObject = JWSObject.parse(repToken); 42 | String user = jwsObject.getPayload().toString(); 43 | log.info("token中获取的[user={}]", user); 44 | ServerHttpRequest request = exchange.getRequest().mutate().header(AuthConstants.USER_TOKEN_HEADER, user).build(); 45 | exchange = exchange.mutate().request(request).build(); 46 | } catch (ParseException e) { 47 | log.error(e.getMessage()); 48 | } 49 | return chain.filter(exchange); 50 | } 51 | 52 | /** 53 | * 过滤器执行顺序,数值越小,优先级越高 54 | * @return 优先级 55 | */ 56 | @Override 57 | public int getOrder() { 58 | return 0; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/retry/impl/AuthRetryImpl.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.retry.impl; 2 | 3 | import com.besscroft.pisces.framework.common.constant.AuthConstants; 4 | import com.besscroft.pisces.framework.common.exception.PiscesException; 5 | import com.besscroft.pisces.gateway.retry.AuthRetry; 6 | import lombok.RequiredArgsConstructor; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.data.redis.core.RedisTemplate; 9 | import org.springframework.retry.annotation.Backoff; 10 | import org.springframework.retry.annotation.Recover; 11 | import org.springframework.retry.annotation.Retryable; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.util.CollectionUtils; 14 | import org.springframework.web.reactive.function.client.WebClient; 15 | 16 | import java.util.Map; 17 | 18 | /** 19 | * @Description 异步远程调用——处理权限关系载入缓存——重试方法 20 | * @Author Bess Croft 21 | * @Date 2022/9/16 20:40 22 | */ 23 | @Slf4j 24 | @Service 25 | @RequiredArgsConstructor 26 | public class AuthRetryImpl implements AuthRetry { 27 | 28 | private final WebClient.Builder webBuilder; 29 | private final RedisTemplate redisTemplate; 30 | 31 | @Override 32 | @Retryable( 33 | value = PiscesException.class, 34 | maxAttempts = 3, 35 | backoff = @Backoff(delay = 1000L, maxDelay = 3000L, multiplier = 2)) 36 | public boolean retryAuthTask() { 37 | webBuilder.build().get() 38 | .uri("lb://pisces-admin/resource/init") 39 | .retrieve() 40 | .bodyToMono(Object.class).subscribe(); 41 | Map roleResourceMap = redisTemplate.opsForHash().entries(AuthConstants.PERMISSION_RULES_KEY); 42 | log.info("执行请求权限缓存!"); 43 | if (CollectionUtils.isEmpty(roleResourceMap)) { 44 | throw new PiscesException(500, "执行请求权限缓存失败啦!"); 45 | } 46 | return true; 47 | } 48 | 49 | /** 50 | * 达到最大重试次数,或抛出了一个没有指定进行重试的异常 51 | * recover 机制 52 | * @param e 异常 53 | */ 54 | @Recover 55 | public boolean recover(PiscesException e) { 56 | log.error("达到最大重试次数,或抛出了一个没有指定进行重试的异常:", e); 57 | return false; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.besscroft.pisces.admin.domain.dto.RoleResourceRelationDto; 5 | import com.besscroft.pisces.framework.common.entity.Role; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | import java.util.Set; 10 | 11 | /** 12 | * @Description 角色 Mapper 接口 13 | * @Author Bess Croft 14 | * @Date 2022/2/5 12:35 15 | */ 16 | public interface RoleMapper extends BaseMapper { 17 | 18 | /** 19 | * 获取角色资源关系 20 | * @return 角色资源关系 21 | */ 22 | List findRoleResourceRelation(); 23 | 24 | /** 25 | * 根据用户id查询角色 26 | * @param userId 用户id 27 | * @return 角色 28 | */ 29 | List findAllByUserId(@Param("userId") Long userId); 30 | 31 | /** 32 | * 根据关键词查询角色信息 33 | * @param queryKey 关键词 34 | * @return 角色信息 35 | */ 36 | List selectAllByQueryKey(@Param("queryKey") String queryKey); 37 | 38 | /** 39 | * 修改角色可用状态 40 | * @param roleId 角色id 41 | * @param status 可用状态 42 | * @return 生效行数 43 | */ 44 | int updateStatusById(@Param("roleId") Long roleId, 45 | @Param("status") Integer status); 46 | 47 | /** 48 | * 根据角色 id 删除角色菜单关系 49 | * @param roleId 角色 id 50 | * @return 生效行数 51 | */ 52 | int deleteMenuByRoleId(@Param("roleId") Long roleId); 53 | 54 | /** 55 | * 根据角色 id,插入角色菜单关系 56 | * @param roleId 角色 id 57 | * @param menuIds 菜单 id 列表 58 | * @return 生效行数 59 | */ 60 | int insertMenuByRoleId(@Param("roleId") Long roleId, 61 | @Param("menuIds") Set menuIds); 62 | 63 | /** 64 | * 根据角色 id 删除角色资源关系 65 | * @param roleId 角色 id 66 | * @return 生效行数 67 | */ 68 | int deleteResourceByRoleId(@Param("roleId") Long roleId); 69 | 70 | /** 71 | * 根据角色 id,插入角色资源关系 72 | * @param roleId 角色 id 73 | * @param resourceIds 资源 id 列表 74 | * @return 生效行数 75 | */ 76 | int insertResourceByRoleId(@Param("roleId") Long roleId, 77 | @Param("resourceIds") Set resourceIds); 78 | 79 | } 80 | -------------------------------------------------------------------------------- /pisces-admin/admin-boot/src/main/java/com/besscroft/pisces/admin/domain/param/menu/AddMenuParam.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.admin.domain.param.menu; 2 | 3 | import io.swagger.v3.oas.annotations.media.Schema; 4 | import lombok.Data; 5 | 6 | import javax.validation.constraints.NotNull; 7 | 8 | /** 9 | * @Description 新增菜单 请求对象 10 | * @Author Bess Croft 11 | * @Date 2022/5/4 18:18 12 | */ 13 | @Data 14 | @Schema(title = "新增菜单请求对象") 15 | public class AddMenuParam { 16 | 17 | /** 父级 id */ 18 | @NotNull(message = "父级菜单 id 不能为空") 19 | @Schema(title = "父级 id", type = "Long", required = true) 20 | private Long parentId; 21 | 22 | /** 菜单名称 */ 23 | @Schema(title = "菜单名称", type = "String") 24 | private String title; 25 | 26 | /** 前端名称 */ 27 | @Schema(title = "前端名称", type = "String") 28 | private String name; 29 | 30 | /** 菜单级数 */ 31 | @Schema(title = "菜单级数", type = "Integer") 32 | private Integer level; 33 | 34 | /** 组件路径 */ 35 | @Schema(title = "组件路径", type = "String") 36 | private String component; 37 | 38 | /** 重定向地址 */ 39 | @Schema(title = "重定向地址", type = "String") 40 | private String redirect; 41 | 42 | /** 路由地址 */ 43 | @Schema(title = "路由地址", type = "String") 44 | private String path; 45 | 46 | /** 菜单图标名称 */ 47 | @Schema(title = "菜单图标名称", type = "String") 48 | private String icon; 49 | 50 | /** 外链(如果有填地址) */ 51 | @Schema(title = "外链(如果有填地址)", type = "String") 52 | private String isLink; 53 | 54 | /** 菜单显示状态:0->禁用;1->启用 */ 55 | @NotNull(message = "菜单显示状态必填") 56 | @Schema(title = "菜单显示状态:0->禁用;1->启用", type = "Integer") 57 | private Integer isHide; 58 | 59 | /** 是否全屏:0->否;1->是 */ 60 | @NotNull(message = "是否全屏必填") 61 | @Schema(title = "是否全屏:0->否;1->是", type = "Integer") 62 | private Integer isFull; 63 | 64 | /** 是否固定在 tabs nav:0->否;1->是 */ 65 | @NotNull(message = "是否固定必填") 66 | @Schema(title = "是否固定在 tabs nav:0->否;1->是", type = "Integer") 67 | private Integer isAffix; 68 | 69 | /** 是否缓存:0->否;1->是 */ 70 | @NotNull(message = "是否缓存必填") 71 | @Schema(title = "是否缓存:0->否;1->是", type = "Integer") 72 | private Integer isKeepAlive; 73 | 74 | /** 排序 */ 75 | @Schema(title = "排序", type = "Integer") 76 | private Integer sort; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/handler/SentinelExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.handler; 2 | 3 | import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler; 4 | import com.alibaba.csp.sentinel.slots.block.authority.AuthorityException; 5 | import com.alibaba.csp.sentinel.slots.block.degrade.DegradeException; 6 | import com.alibaba.csp.sentinel.slots.block.flow.FlowException; 7 | import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowException; 8 | import com.alibaba.csp.sentinel.slots.system.SystemBlockException; 9 | import com.besscroft.pisces.framework.common.result.AjaxResult; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.MediaType; 12 | import org.springframework.web.reactive.function.BodyInserters; 13 | import org.springframework.web.reactive.function.server.ServerResponse; 14 | import org.springframework.web.server.ServerWebExchange; 15 | import reactor.core.publisher.Mono; 16 | 17 | /** 18 | * @Description sentinel 限流降级处理器 19 | * @Author Bess Croft 20 | * @Date 2022/5/28 16:06 21 | */ 22 | public class SentinelExceptionHandler implements BlockRequestHandler { 23 | 24 | @Override 25 | public Mono handleRequest(ServerWebExchange serverWebExchange, Throwable throwable) { 26 | return ServerResponse.status(HttpStatus.TOO_MANY_REQUESTS) 27 | .contentType(MediaType.APPLICATION_JSON) 28 | .body(BodyInserters.fromValue(AjaxResult.error( 29 | HttpStatus.TOO_MANY_REQUESTS.value(), 30 | getMessage(throwable) 31 | ))); 32 | } 33 | 34 | private String getMessage(Throwable throwable) { 35 | if (throwable instanceof FlowException) { 36 | return "您的访问过于频繁,请稍后重试"; 37 | } else if (throwable instanceof DegradeException) { 38 | return "调用服务响应异常,已进行降级"; 39 | } else if (throwable instanceof ParamFlowException) { 40 | return "您对热点参数访问过于频繁,请稍后重试"; 41 | } else if (throwable instanceof SystemBlockException) { 42 | return "已触碰系统负载保护,请稍后重试"; 43 | } else if (throwable instanceof AuthorityException) { 44 | return "授权规则检测不同,请检查访问参数"; 45 | } else { 46 | return "非法访问,请稍后重试"; 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /pisces-amqp/src/main/java/com/besscroft/pisces/amqp/listener/MessageReceiverListener.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.amqp.listener; 2 | 3 | import com.besscroft.pisces.amqp.config.BarkConfiguration; 4 | import com.besscroft.pisces.amqp.service.PushService; 5 | import com.besscroft.pisces.framework.common.constant.AMQPConstant; 6 | import lombok.RequiredArgsConstructor; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.amqp.rabbit.annotation.RabbitHandler; 9 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * @Description 消息接收监听器 14 | * @Author Bess Croft 15 | * @Date 2022/9/3 15:10 16 | */ 17 | @Slf4j 18 | @Component 19 | @RequiredArgsConstructor 20 | public class MessageReceiverListener { 21 | 22 | private final PushService pushService; 23 | 24 | @RabbitHandler 25 | @RabbitListener(queues = AMQPConstant.MESSAGE_QUEUE) 26 | public void processMessage(String message) { 27 | log.info("Message Receiver:{}", message); 28 | } 29 | 30 | @RabbitHandler 31 | @RabbitListener(queues = AMQPConstant.SMS_QUEUE) 32 | public void processSms(String message) { 33 | log.info("Sms Receiver:{}", message); 34 | } 35 | 36 | @RabbitHandler 37 | @RabbitListener(queues = AMQPConstant.EMAIL_QUEUE) 38 | public void processEmail(String message) { 39 | log.info("Email Receiver:{}", message); 40 | } 41 | 42 | @RabbitHandler 43 | @RabbitListener(queues = AMQPConstant.SERVER_CHAN_QUEUE) 44 | public void processServerChan(String message) { 45 | log.info("ServerChan Receiver:{}", message); 46 | } 47 | 48 | @RabbitHandler 49 | @RabbitListener(queues = AMQPConstant.BARK_QUEUE) 50 | public void processBark(String message) { 51 | pushService.pushBark(BarkConfiguration.sendKey, message); 52 | log.info("Bark Receiver:{}", message); 53 | } 54 | 55 | @RabbitHandler 56 | @RabbitListener(queues = AMQPConstant.TG_QUEUE) 57 | public void processTG(String message) { 58 | log.info("TG Receiver:{}", message); 59 | } 60 | 61 | @RabbitHandler 62 | @RabbitListener(queues = AMQPConstant.WORK_WEIXIN_QUEUE) 63 | public void processWorkWeixin(String message) { 64 | log.info("WorkWeixin Receiver:{}", message); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /pisces-auth/src/main/java/com/besscroft/pisces/auth/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.auth.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.besscroft.pisces.auth.mapper.RoleMapper; 5 | import com.besscroft.pisces.auth.mapper.UserMapper; 6 | import com.besscroft.pisces.auth.service.UserService; 7 | import com.besscroft.pisces.framework.common.constant.AuthConstants; 8 | import com.besscroft.pisces.framework.common.dto.UserDto; 9 | import com.besscroft.pisces.framework.common.entity.Role; 10 | import com.besscroft.pisces.framework.common.entity.User; 11 | import lombok.RequiredArgsConstructor; 12 | import org.springframework.data.redis.core.RedisTemplate; 13 | import org.springframework.lang.NonNull; 14 | import org.springframework.stereotype.Service; 15 | import org.springframework.util.CollectionUtils; 16 | 17 | import java.util.List; 18 | import java.util.Objects; 19 | import java.util.stream.Collectors; 20 | 21 | /** 22 | * @Description 用户 service 实现类 23 | * @Author Bess Croft 24 | * @Date 2022/2/4 13:15 25 | */ 26 | @Service 27 | @RequiredArgsConstructor 28 | public class UserServiceImpl extends ServiceImpl implements UserService { 29 | 30 | private final RoleMapper roleMapper; 31 | private final RedisTemplate redisTemplate; 32 | 33 | @Override 34 | public UserDto loadUserByUsername(@NonNull String username) { 35 | User user = this.baseMapper.findByUsername(username); 36 | if (!Objects.isNull(user)) { 37 | List roles = roleMapper.findAllByUserId(user.getId()); 38 | UserDto dto = new UserDto(); 39 | dto.setUsername(username); 40 | dto.setPassword(user.getPassword()); 41 | dto.setId(user.getId()); 42 | dto.setStatus(user.getStatus()); 43 | if(!CollectionUtils.isEmpty(roles)){ 44 | List roleStrList = roles.stream().map(item -> item.getId() + "_" + item.getRoleName()).collect(Collectors.toList()); 45 | dto.setRoles(roleStrList); 46 | } 47 | user.setPassword(""); 48 | redisTemplate.opsForValue().set(String.join(":", AuthConstants.SYSTEM_USER, user.getUsername()), user); 49 | return dto; 50 | } 51 | return null; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /pisces-gateway/src/main/java/com/besscroft/pisces/gateway/retry/impl/WhiteRetryImpl.java: -------------------------------------------------------------------------------- 1 | package com.besscroft.pisces.gateway.retry.impl; 2 | 3 | import com.besscroft.pisces.framework.common.constant.SystemDictConstants; 4 | import com.besscroft.pisces.framework.common.dto.WhiteDictDto; 5 | import com.besscroft.pisces.framework.common.exception.PiscesException; 6 | import com.besscroft.pisces.gateway.retry.WhiteRetry; 7 | import lombok.RequiredArgsConstructor; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.retry.annotation.Backoff; 11 | import org.springframework.retry.annotation.Recover; 12 | import org.springframework.retry.annotation.Retryable; 13 | import org.springframework.stereotype.Service; 14 | import org.springframework.util.CollectionUtils; 15 | import org.springframework.web.reactive.function.client.WebClient; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * @Description 异步远程调用——处理白名单载入缓存——重试方法 21 | * @Author Bess Croft 22 | * @Date 2022/9/16 21:46 23 | */ 24 | @Slf4j 25 | @Service 26 | @RequiredArgsConstructor 27 | public class WhiteRetryImpl implements WhiteRetry { 28 | 29 | private final WebClient.Builder webBuilder; 30 | private final RedisTemplate redisTemplate; 31 | 32 | @Override 33 | @Retryable( 34 | value = PiscesException.class, 35 | maxAttempts = 3, 36 | backoff = @Backoff(delay = 1000L, maxDelay = 3000L, multiplier = 2)) 37 | public boolean retryWhiteTask() { 38 | webBuilder.build().get() 39 | .uri("lb://pisces-admin/white/getWhiteDict") 40 | .retrieve() 41 | .bodyToMono(Object.class).subscribe(); 42 | List whiteDictDtoList = (List) redisTemplate.opsForValue().get(SystemDictConstants.WHITE); 43 | log.info("执行请求白名单缓存!"); 44 | if (CollectionUtils.isEmpty(whiteDictDtoList)) { 45 | throw new PiscesException(500, "执行请求白名单缓存失败啦!"); 46 | } 47 | return true; 48 | } 49 | 50 | /** 51 | * 达到最大重试次数,或抛出了一个没有指定进行重试的异常 52 | * recover 机制 53 | * @param e 异常 54 | */ 55 | @Recover 56 | public boolean recover(PiscesException e) { 57 | log.error("达到最大重试次数,或抛出了一个没有指定进行重试的异常:", e); 58 | return false; 59 | } 60 | 61 | } 62 | --------------------------------------------------------------------------------