├── .gitee └── ISSUE_TEMPLATE.zh-CN.md ├── doc └── docker │ ├── Dockerfile-config │ ├── Dockerfile-eureka │ ├── Dockerfile-auth │ ├── Dockerfile-gateway │ ├── Dockerfile-upms │ └── docker-compose.yml ├── .gitignore ├── pig-eureka ├── src │ └── main │ │ ├── resources │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── eureka │ │ └── PigEurekaApplication.java └── pom.xml ├── pig-auth └── src │ └── main │ ├── resources │ ├── bootstrap.yml │ ├── templates │ │ └── ftl │ │ │ └── login.ftl │ └── static │ │ └── css │ │ └── signin.css │ └── java │ └── com │ └── github │ └── pig │ └── auth │ ├── config │ ├── SocialPropertiesConfig.java │ └── PigJwtAccessTokenConverter.java │ ├── PigAuthServerApplication.java │ ├── service │ └── UserDetailServiceImpl.java │ └── feign │ ├── UserService.java │ └── fallback │ └── UserServiceFallbackImpl.java ├── pig-visual ├── pig-monitor │ └── src │ │ └── main │ │ ├── resources │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── monitor │ │ └── config │ │ ├── MonitorDingTalkPropertiesConfig.java │ │ ├── MonitorMobilePropertiesConfig.java │ │ └── MonitorPropertiesConfig.java ├── pig-zipkin-db │ └── src │ │ └── main │ │ ├── resources │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── zipkin │ │ └── PigZipkinDbApplication.java ├── pig-zipkin-elk │ └── src │ │ └── main │ │ ├── resources │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── zipkin │ │ └── PigZipkinElkApplication.java └── pom.xml ├── pig-modules ├── pig-mc-service │ └── src │ │ └── main │ │ ├── resources │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── mc │ │ ├── config │ │ ├── DingTalkPropertiesConfig.java │ │ └── SmsAliyunPropertiesConfig.java │ │ ├── PigMessageCenterApplication.java │ │ ├── handler │ │ ├── SmsMessageHandler.java │ │ └── AbstractMessageHandler.java │ │ └── listener │ │ └── DingTalkServiceChangeReceiveListener.java ├── pig-daemon-service │ └── src │ │ └── main │ │ ├── resources │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── daemon │ │ ├── PigDaemonApplication.java │ │ └── job │ │ ├── PigDataflowJob.java │ │ ├── DemoSimpleJob.java │ │ └── PigSimpleJob.java ├── pig-upms-service │ └── src │ │ ├── main │ │ ├── resources │ │ │ ├── bootstrap.yml │ │ │ ├── templates │ │ │ │ └── menu.sql.vm │ │ │ └── mapper │ │ │ │ ├── SysRoleMenuMapper.xml │ │ │ │ ├── SysUserRoleMapper.xml │ │ │ │ ├── SysRoleDeptMapper.xml │ │ │ │ ├── SysDictMapper.xml │ │ │ │ ├── SysDeptMapper.xml │ │ │ │ └── SysZuulRouteMapper.xml │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── pig │ │ │ └── admin │ │ │ ├── model │ │ │ ├── dto │ │ │ │ ├── DeptTree.java │ │ │ │ ├── RoleDTO.java │ │ │ │ ├── TreeNode.java │ │ │ │ ├── UserDTO.java │ │ │ │ └── UserInfo.java │ │ │ └── entity │ │ │ │ ├── SysDeptRelation.java │ │ │ │ ├── SysRoleMenu.java │ │ │ │ ├── SysUserRole.java │ │ │ │ └── SysRoleDept.java │ │ │ ├── mapper │ │ │ ├── SysLogMapper.java │ │ │ ├── SysDictMapper.java │ │ │ ├── SysRoleDeptMapper.java │ │ │ ├── SysRoleMenuMapper.java │ │ │ ├── SysZuulRouteMapper.java │ │ │ ├── SysOauthClientDetailsMapper.java │ │ │ ├── SysDeptMapper.java │ │ │ ├── SysMenuMapper.java │ │ │ ├── SysDeptRelationMapper.java │ │ │ ├── SysUserRoleMapper.java │ │ │ └── SysRoleMapper.java │ │ │ ├── service │ │ │ ├── SysDictService.java │ │ │ ├── SysRoleDeptService.java │ │ │ ├── SysDeptRelationService.java │ │ │ ├── SysOauthClientDetailsService.java │ │ │ ├── SysZuulRouteService.java │ │ │ ├── SysLogService.java │ │ │ ├── impl │ │ │ │ ├── SysDictServiceImpl.java │ │ │ │ ├── SysRoleDeptServiceImpl.java │ │ │ │ ├── SysDeptRelationServiceImpl.java │ │ │ │ ├── SysOauthClientDetailsServiceImpl.java │ │ │ │ ├── SysUserRoleServiceImpl.java │ │ │ │ └── SysLogServiceImpl.java │ │ │ ├── SysUserRoleService.java │ │ │ ├── SysRoleMenuService.java │ │ │ ├── SysMenuService.java │ │ │ ├── SysDeptService.java │ │ │ └── SysRoleService.java │ │ │ ├── PigAdminApplication.java │ │ │ └── common │ │ │ ├── config │ │ │ └── MybatisPlusConfig.java │ │ │ └── listener │ │ │ └── LogReceiveListener.java │ │ └── test │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── admin │ │ └── PigAdminApplicationTest.java ├── pig-sso-client-demo │ └── src │ │ └── main │ │ ├── resources │ │ ├── static │ │ │ └── index.html │ │ └── bootstrap.yml │ │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── sso │ │ ├── controller │ │ └── DemoController.java │ │ ├── PigSsoClientDemoApplication.java │ │ └── config │ │ └── ResourceServerConfiguration.java └── pom.xml ├── pig-gateway └── src │ ├── main │ ├── resources │ │ └── bootstrap.yml │ └── java │ │ └── com │ │ └── github │ │ └── pig │ │ └── gateway │ │ ├── service │ │ ├── LogSendService.java │ │ └── PermissionService.java │ │ ├── util │ │ └── RibbonVersionHolder.java │ │ ├── feign │ │ ├── fallback │ │ │ └── MenuServiceFallbackImpl.java │ │ └── MenuService.java │ │ └── component │ │ ├── filter │ │ ├── LoggerFilter.java │ │ ├── ErrorHandlerFilter.java │ │ └── XssSecurityFilter.java │ │ └── handler │ │ └── ZuulRateLimiterErrorHandler.java │ └── test │ └── java │ └── com │ └── github │ └── pig │ └── common │ └── util │ └── UserUtilsTest.java ├── LICENSE ├── pig-common └── src │ └── main │ └── java │ └── com │ └── github │ └── pig │ └── common │ ├── constant │ ├── ServiceNameConstant.java │ ├── MqQueueConstant.java │ ├── enums │ │ ├── EnumSmsChannelTemplate.java │ │ └── EnumSmsChannel.java │ └── CommonConstant.java │ ├── vo │ ├── LogVO.java │ ├── ImageCode.java │ ├── ErrorPojo.java │ ├── SysRole.java │ └── UserVO.java │ ├── util │ ├── exception │ │ ├── ValidateCodeException.java │ │ ├── UnloginException.java │ │ ├── CheckedException.java │ │ └── PigDeniedException.java │ ├── template │ │ ├── MobileMsgTemplate.java │ │ └── DingTalkMsgTemplate.java │ ├── Query.java │ └── R.java │ ├── bean │ ├── interceptor │ │ └── DataScope.java │ ├── config │ │ ├── WebMvcConfig.java │ │ ├── FdfsPropertiesConfig.java │ │ ├── FilterIgnorePropertiesConfig.java │ │ └── QiniuPropertiesConfig.java │ ├── handler │ │ └── GlobalExceptionHandler.java │ └── xss │ │ └── SqlFilter.java │ └── web │ └── BaseController.java └── pig-config └── src └── main ├── resources └── bootstrap.yml └── java └── com └── github └── pig └── config └── PigConfigApplication.java /.gitee/ISSUE_TEMPLATE.zh-CN.md: -------------------------------------------------------------------------------- 1 | > **错误描述** (提供必要的回显步骤) 2 | 3 | 4 | 5 | > **异常日志** (注意使用MD语法 `日志` 使用``格式化日志,越详细越好) 6 | 7 | 8 | > **异常截图** (issue 支持直接粘贴 ) 9 | -------------------------------------------------------------------------------- /doc/docker/Dockerfile-config: -------------------------------------------------------------------------------- 1 | FROM java:8-jre 2 | MAINTAINER Pig lengleng 3 | 4 | ADD ./jar/pig-config.jar /app/ 5 | CMD ["java", "-Xmx200m", "-jar", "/app/pig-config.jar"] 6 | 7 | EXPOSE 4001 -------------------------------------------------------------------------------- /doc/docker/Dockerfile-eureka: -------------------------------------------------------------------------------- 1 | FROM java:8-jre 2 | MAINTAINER Pig lengleng 3 | 4 | ADD ./jar/pig-eureka.jar /app/ 5 | CMD ["java", "-Xmx200m", "-jar", "/app/pig-eureka.jar"] 6 | 7 | EXPOSE 1025 -------------------------------------------------------------------------------- /doc/docker/Dockerfile-auth: -------------------------------------------------------------------------------- 1 | FROM java:8-jre 2 | MAINTAINER Pig lengleng 3 | 4 | ADD ./jar/pig-auth.jar /app/ 5 | ADD ./jar/pinpoint-agent /app/pinpoint-agent 6 | 7 | CMD ["java", "-Xmx500m", "-javaagent:/app/pinpoint-agent/pinpoint-bootstrap-1.5.0.jar", "-Dpinpoint.agentId=pig-auth", "-Dpinpoint.applicationName=AUTH", "-jar", "/app/pig-auth.jar"] 8 | -------------------------------------------------------------------------------- /doc/docker/Dockerfile-gateway: -------------------------------------------------------------------------------- 1 | FROM java:8-jre 2 | MAINTAINER Pig lengleng 3 | 4 | ADD ./jar/pig-gateway.jar /app/ 5 | ADD ./jar/pinpoint-agent /app/pinpoint-agent 6 | 7 | CMD ["java", "-Xmx500m", "-javaagent:/app/pinpoint-agent/pinpoint-bootstrap-1.5.0.jar", "-Dpinpoint.agentId=pig-gateway", "-Dpinpoint.applicationName=GATEWAY", "-jar", "/app/pig-gateway.jar"] 8 | 9 | EXPOSE 9999 -------------------------------------------------------------------------------- /doc/docker/Dockerfile-upms: -------------------------------------------------------------------------------- 1 | FROM java:8-jre 2 | MAINTAINER Pig lengleng 3 | 4 | ADD ./jar/pig-upms-service.jar /app/ 5 | ADD ./jar/pinpoint-agent /app/pinpoint-agent 6 | 7 | CMD ["java", "-Xmx1000m", "-javaagent:/app/pinpoint-agent/pinpoint-bootstrap-1.5.0.jar", "-Dpinpoint.agentId=pig-upms-service", "-Dpinpoint.applicationName=PIG-UPMS-SERVICE", "-jar", "/app/pig-upms-service.jar"] 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # maven ignore 2 | target/ 3 | *.war 4 | *.ear 5 | *.zip 6 | *.tar 7 | *.tar.gz 8 | 9 | # eclipse ignore 10 | .settings/ 11 | .project 12 | .classpath 13 | 14 | # idea ignore 15 | .idea/ 16 | *.ipr 17 | *.iml 18 | *.iws 19 | 20 | # logs # 21 | logs 22 | 23 | # temp ignore 24 | *.log 25 | *.cache 26 | *.diff 27 | *.patch 28 | *.tmp 29 | *.java~ 30 | *.properties~ 31 | *.xml~ 32 | 33 | # system ignore 34 | .DS_Store 35 | Thumbs.db 36 | Servers 37 | .metadata 38 | upload -------------------------------------------------------------------------------- /pig-eureka/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 1025 3 | 4 | spring: 5 | application: 6 | name: pig-eureka-server 7 | cloud: 8 | config: 9 | enabled: false 10 | 11 | security: 12 | basic: 13 | enabled: true # 启用身份认证 14 | user: 15 | name: pig # 定义用户名 16 | password: gip6666 # 定义密码 17 | 18 | eureka: 19 | client: 20 | fetch-registry: false 21 | register-with-eureka: false 22 | serviceUrl: 23 | defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ 24 | instance: 25 | hostname: localhost 26 | server: #配置属性,但由于 Eureka 自我保护模式以及心跳周期长的原因,经常会遇到 Eureka Server 不剔除已关停的节点的问题 27 | enable-self-preservation: false 28 | eviction-interval-timer-in-ms: 5000 29 | -------------------------------------------------------------------------------- /pig-auth/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-auth 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | --- 15 | spring: 16 | profiles: dev 17 | eureka: 18 | instance: 19 | prefer-ip-address: true 20 | lease-renewal-interval-in-seconds: 5 21 | lease-expiration-duration-in-seconds: 20 22 | client: 23 | serviceUrl: 24 | defaultZone: http://pig:gip6666@localhost:1025/eureka 25 | registry-fetch-interval-seconds: 10 26 | 27 | --- 28 | spring: 29 | profiles: prd 30 | eureka: 31 | instance: 32 | prefer-ip-address: true 33 | client: 34 | serviceUrl: 35 | defaultZone: http://pig:gip6666@eureka:1025/eureka 36 | -------------------------------------------------------------------------------- /pig-visual/pig-monitor/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-monitor 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | --- 15 | spring: 16 | profiles: dev 17 | eureka: 18 | instance: 19 | prefer-ip-address: true 20 | lease-renewal-interval-in-seconds: 5 21 | lease-expiration-duration-in-seconds: 20 22 | client: 23 | serviceUrl: 24 | defaultZone: http://pig:gip6666@localhost:1025/eureka 25 | registry-fetch-interval-seconds: 10 26 | 27 | --- 28 | spring: 29 | profiles: prd 30 | eureka: 31 | instance: 32 | prefer-ip-address: true 33 | client: 34 | serviceUrl: 35 | defaultZone: http://pig:gip6666@eureka:1025/eureka -------------------------------------------------------------------------------- /pig-modules/pig-mc-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-mc-service 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | --- 15 | spring: 16 | profiles: dev 17 | eureka: 18 | instance: 19 | prefer-ip-address: true 20 | lease-renewal-interval-in-seconds: 5 21 | lease-expiration-duration-in-seconds: 20 22 | client: 23 | serviceUrl: 24 | defaultZone: http://pig:gip6666@localhost:1025/eureka 25 | registry-fetch-interval-seconds: 10 26 | 27 | --- 28 | spring: 29 | profiles: prd 30 | eureka: 31 | instance: 32 | prefer-ip-address: true 33 | client: 34 | serviceUrl: 35 | defaultZone: http://pig:gip6666@eureka:1025/eureka -------------------------------------------------------------------------------- /pig-visual/pig-zipkin-db/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-zipkin-db 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | 15 | --- 16 | spring: 17 | profiles: dev 18 | eureka: 19 | instance: 20 | prefer-ip-address: true 21 | lease-renewal-interval-in-seconds: 5 22 | lease-expiration-duration-in-seconds: 20 23 | client: 24 | serviceUrl: 25 | defaultZone: http://pig:gip6666@localhost:1025/eureka 26 | registry-fetch-interval-seconds: 10 27 | 28 | --- 29 | spring: 30 | profiles: prd 31 | eureka: 32 | instance: 33 | prefer-ip-address: true 34 | client: 35 | serviceUrl: 36 | defaultZone: http://pig:gip6666@eureka:1025/eureka -------------------------------------------------------------------------------- /pig-visual/pig-zipkin-elk/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-zipkin-elk 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | 15 | --- 16 | spring: 17 | profiles: dev 18 | eureka: 19 | instance: 20 | prefer-ip-address: true 21 | lease-renewal-interval-in-seconds: 5 22 | lease-expiration-duration-in-seconds: 20 23 | client: 24 | serviceUrl: 25 | defaultZone: http://pig:gip6666@localhost:1025/eureka 26 | registry-fetch-interval-seconds: 10 27 | 28 | --- 29 | spring: 30 | profiles: prd 31 | eureka: 32 | instance: 33 | prefer-ip-address: true 34 | client: 35 | serviceUrl: 36 | defaultZone: http://pig:gip6666@eureka:1025/eureka -------------------------------------------------------------------------------- /pig-modules/pig-daemon-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-daemon-service 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | --- 15 | spring: 16 | profiles: dev 17 | eureka: 18 | instance: 19 | prefer-ip-address: true 20 | lease-renewal-interval-in-seconds: 5 21 | lease-expiration-duration-in-seconds: 20 22 | client: 23 | serviceUrl: 24 | defaultZone: http://pig:gip6666@localhost:1025/eureka 25 | registry-fetch-interval-seconds: 10 26 | 27 | --- 28 | spring: 29 | profiles: prd 30 | eureka: 31 | instance: 32 | prefer-ip-address: true 33 | client: 34 | serviceUrl: 35 | defaultZone: http://pig:gip6666@eureka:1025/eureka -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-upms-service 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | 15 | --- 16 | spring: 17 | profiles: dev 18 | eureka: 19 | instance: 20 | prefer-ip-address: true 21 | lease-renewal-interval-in-seconds: 5 22 | lease-expiration-duration-in-seconds: 20 23 | client: 24 | serviceUrl: 25 | defaultZone: http://pig:gip6666@localhost:1025/eureka 26 | registry-fetch-interval-seconds: 10 27 | 28 | --- 29 | spring: 30 | profiles: prd 31 | eureka: 32 | instance: 33 | prefer-ip-address: true 34 | client: 35 | serviceUrl: 36 | defaultZone: http://pig:gip6666@eureka:1025/eureka 37 | -------------------------------------------------------------------------------- /doc/docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | pig-eureka: 4 | build: 5 | context: ./ 6 | dockerfile: Dockerfile-eureka 7 | restart: always 8 | ports: 9 | - 1025:1025 10 | 11 | pig-config: 12 | links: 13 | - pig-eureka:eureka 14 | build: 15 | context: ./ 16 | dockerfile: Dockerfile-config 17 | restart: always 18 | 19 | pig-gateway: 20 | links: 21 | - pig-eureka:eureka 22 | - pig-auth:auth 23 | build: 24 | context: ./ 25 | dockerfile: Dockerfile-gateway 26 | restart: always 27 | ports: 28 | - 9999:9999 29 | 30 | pig-auth: 31 | links: 32 | - pig-eureka:eureka 33 | build: 34 | context: ./ 35 | dockerfile: Dockerfile-auth 36 | restart: always 37 | ports: 38 | - 3000:3000 39 | 40 | pig-upms-service: 41 | links: 42 | - pig-eureka:eureka 43 | build: 44 | context: ./ 45 | dockerfile: Dockerfile-upms 46 | restart: always -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/templates/menu.sql.vm: -------------------------------------------------------------------------------- 1 | -- 菜单SQL 2 | INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) 3 | VALUES ('1', '$!{comments}', 'modules/generator/$!{pathName}.html', NULL, '1', 'fa fa-file-code-o', '6'); 4 | 5 | -- 按钮父菜单ID 6 | set @parentId = @@identity; 7 | 8 | -- 菜单对应按钮SQL 9 | INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) 10 | SELECT @parentId, '查看', null, '$!{pathName}:list,$!{pathName}:info', '2', null, '6'; 11 | INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) 12 | SELECT @parentId, '新增', null, '$!{pathName}:save', '2', null, '6'; 13 | INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) 14 | SELECT @parentId, '修改', null, '$!{pathName}:update', '2', null, '6'; 15 | INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) 16 | SELECT @parentId, '删除', null, '$!{pathName}:delete', '2', null, '6'; 17 | -------------------------------------------------------------------------------- /pig-gateway/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: pig-gateway 4 | profiles: 5 | active: dev 6 | cloud: 7 | config: 8 | fail-fast: true 9 | discovery: 10 | service-id: pig-config-server 11 | enabled: true 12 | profile: ${spring.profiles.active} 13 | label: ${spring.profiles.active} 14 | 15 | logging: 16 | level: error 17 | 18 | --- 19 | spring: 20 | profiles: dev 21 | eureka: 22 | instance: 23 | prefer-ip-address: true 24 | lease-renewal-interval-in-seconds: 5 25 | lease-expiration-duration-in-seconds: 20 26 | client: 27 | serviceUrl: 28 | defaultZone: http://pig:gip6666@localhost:1025/eureka 29 | registry-fetch-interval-seconds: 10 30 | #认证服务器地址 31 | security: 32 | auth: 33 | server: http://localhost:3000 34 | --- 35 | spring: 36 | profiles: prd 37 | eureka: 38 | instance: 39 | prefer-ip-address: true 40 | client: 41 | serviceUrl: 42 | defaultZone: http://pig:gip6666@eureka:1025/eureka 43 | 44 | #建议使用ng负载均衡 45 | security: 46 | auth: 47 | server: http://localhost:3000 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 lengleng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /pig-modules/pig-sso-client-demo/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | Title 23 | 24 | 25 | 获取登录信息 26 | 27 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/dto/DeptTree.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.dto; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author lengleng 24 | * @date 2018/1/20 25 | * 部门树 26 | */ 27 | @Data 28 | public class DeptTree extends TreeNode { 29 | private String name; 30 | } 31 | -------------------------------------------------------------------------------- /pig-modules/pig-sso-client-demo/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 4040 3 | context-path: /sso1 4 | 5 | #监控短点配置 6 | management: 7 | security: 8 | enabled: false 9 | endpoints: 10 | actuator: 11 | enabled: true 12 | shutdown: 13 | enabled: false 14 | 15 | security: 16 | oauth2: 17 | client: 18 | client-id: pig 19 | client-secret: pig 20 | user-authorization-uri: http://localhost:3000/oauth/authorize 21 | access-token-uri: http://localhost:3000/oauth/token 22 | scope: server 23 | resource: 24 | jwt: 25 | key-uri: http://localhost:3000/oauth/token_key 26 | 27 | spring: 28 | application: 29 | name: pig-sso-client-demo 30 | profiles: 31 | active: dev 32 | --- 33 | spring: 34 | profiles: dev 35 | eureka: 36 | instance: 37 | prefer-ip-address: true 38 | lease-renewal-interval-in-seconds: 5 39 | lease-expiration-duration-in-seconds: 20 40 | client: 41 | serviceUrl: 42 | defaultZone: http://pig:gip6666@localhost:1025/eureka 43 | 44 | --- 45 | spring: 46 | profiles: prd 47 | eureka: 48 | instance: 49 | prefer-ip-address: true 50 | client: 51 | serviceUrl: 52 | defaultZone: http://pig:gip6666@eureka:1025/eureka 53 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysLogMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.common.entity.SysLog; 22 | 23 | /** 24 | *

25 | * 日志表 Mapper 接口 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2017-11-20 30 | */ 31 | public interface SysLogMapper extends BaseMapper { 32 | 33 | } -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysDictMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.admin.model.entity.SysDict; 22 | 23 | /** 24 | *

25 | * 字典表 Mapper 接口 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2017-11-19 30 | */ 31 | public interface SysDictMapper extends BaseMapper { 32 | 33 | } -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysDictService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.service.IService; 21 | import com.github.pig.admin.model.entity.SysDict; 22 | 23 | /** 24 | *

25 | * 字典表 服务类 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2017-11-19 30 | */ 31 | public interface SysDictService extends IService { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/service/LogSendService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.service; 19 | 20 | import com.netflix.zuul.context.RequestContext; 21 | 22 | /** 23 | * @author lengleng 24 | * @date 2017/11/16 25 | */ 26 | public interface LogSendService { 27 | /** 28 | * 往消息通道发消息 29 | * 30 | * @param requestContext requestContext 31 | */ 32 | void send(RequestContext requestContext); 33 | } 34 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/constant/ServiceNameConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.constant; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2018/1/25 23 | * 服务名称 24 | */ 25 | public interface ServiceNameConstant { 26 | /** 27 | * 认证服务的SERVICEID(zuul 配置的对应) 28 | */ 29 | String AUTH_SERVICE = "pig-auth"; 30 | 31 | /** 32 | * UMPS模块 33 | */ 34 | String UMPS_SERVICE = "pig-upms-service"; 35 | } 36 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysRoleDeptMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.admin.model.entity.SysRoleDept; 22 | 23 | /** 24 | *

25 | * 角色与部门对应关系 Mapper 接口 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2018-01-20 30 | */ 31 | public interface SysRoleDeptMapper extends BaseMapper { 32 | 33 | } -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysRoleMenuMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | 21 | import com.baomidou.mybatisplus.mapper.BaseMapper; 22 | import com.github.pig.admin.model.entity.SysRoleMenu; 23 | 24 | /** 25 | *

26 | * 角色菜单表 Mapper 接口 27 | *

28 | * 29 | * @author lengleng 30 | * @since 2017-10-29 31 | */ 32 | public interface SysRoleMenuMapper extends BaseMapper { 33 | 34 | } -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysZuulRouteMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.common.entity.SysZuulRoute; 22 | 23 | /** 24 | *

25 | * 动态路由配置表 Mapper 接口 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2018-05-15 30 | */ 31 | public interface SysZuulRouteMapper extends BaseMapper { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysRoleDeptService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.service.IService; 21 | import com.github.pig.admin.model.entity.SysRoleDept; 22 | 23 | /** 24 | *

25 | * 角色与部门对应关系 服务类 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2018-01-20 30 | */ 31 | public interface SysRoleDeptService extends IService { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysDeptRelationService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.service.IService; 21 | import com.github.pig.admin.model.entity.SysDeptRelation; 22 | 23 | /** 24 | *

25 | * 服务类 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2018-02-12 30 | */ 31 | public interface SysDeptRelationService extends IService { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/vo/LogVO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.vo; 19 | 20 | import com.github.pig.common.entity.SysLog; 21 | import lombok.Data; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2017/11/20 28 | */ 29 | @Data 30 | public class LogVO implements Serializable { 31 | private static final long serialVersionUID = 1L; 32 | 33 | private SysLog sysLog; 34 | private String username; 35 | } 36 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysOauthClientDetailsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.service.IService; 21 | import com.github.pig.admin.model.entity.SysOauthClientDetails; 22 | 23 | /** 24 | *

25 | * 服务类 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2018-05-15 30 | */ 31 | public interface SysOauthClientDetailsService extends IService { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/exception/ValidateCodeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util.exception; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2017年12月21日20:45:38 23 | */ 24 | public class ValidateCodeException extends Exception { 25 | 26 | /** 27 | * 28 | */ 29 | private static final long serialVersionUID = -7285211528095468156L; 30 | 31 | public ValidateCodeException(String msg) { 32 | super(msg); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysOauthClientDetailsMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | 21 | import com.baomidou.mybatisplus.mapper.BaseMapper; 22 | import com.github.pig.admin.model.entity.SysOauthClientDetails; 23 | 24 | /** 25 | *

26 | * Mapper 接口 27 | *

28 | * 29 | * @author lengleng 30 | * @since 2018-05-15 31 | */ 32 | public interface SysOauthClientDetailsMapper extends BaseMapper { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/dto/RoleDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.dto; 19 | 20 | import com.github.pig.admin.model.entity.SysRole; 21 | import lombok.Data; 22 | 23 | /** 24 | * @author lengleng 25 | * @date 2018/1/20 26 | * 角色Dto 27 | */ 28 | @Data 29 | public class RoleDTO extends SysRole { 30 | /** 31 | * 角色部门Id 32 | */ 33 | private Integer roleDeptId; 34 | 35 | /** 36 | * 部门名称 37 | */ 38 | private String deptName; 39 | } 40 | -------------------------------------------------------------------------------- /pig-auth/src/main/resources/templates/ftl/login.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Pig微服务统一认证 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 25 |
26 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /pig-auth/src/main/java/com/github/pig/auth/config/SocialPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.auth.config; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author lengleng 24 | * @date 2017/10/28 25 | * social 登录基础配置 26 | */ 27 | @Data 28 | public class SocialPropertiesConfig { 29 | /** 30 | * 提供商 31 | */ 32 | private String providerId; 33 | /** 34 | * 应用ID 35 | */ 36 | private String clientId; 37 | /** 38 | * 应用密钥 39 | */ 40 | private String clientSecret; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /pig-visual/pig-monitor/src/main/java/com/github/pig/monitor/config/MonitorDingTalkPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.monitor.config; 19 | 20 | import lombok.Data; 21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; 22 | 23 | /** 24 | * @author lengleng 25 | * @date 2018/4/22 26 | */ 27 | @Data 28 | @ConditionalOnExpression("!'${webhook}'.isEmpty()") 29 | public class MonitorDingTalkPropertiesConfig { 30 | /** 31 | * 是否开启钉钉通知 32 | */ 33 | private Boolean enabled; 34 | } 35 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysZuulRouteService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.service.IService; 21 | import com.github.pig.common.entity.SysZuulRoute; 22 | 23 | /** 24 | *

25 | * 动态路由配置表 服务类 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2018-05-15 30 | */ 31 | public interface SysZuulRouteService extends IService { 32 | 33 | /** 34 | * 立即生效配置 35 | * @return 36 | */ 37 | Boolean applyZuulRoute(); 38 | } 39 | -------------------------------------------------------------------------------- /pig-config/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 4001 3 | 4 | spring: 5 | application: 6 | name: pig-config-server 7 | profiles: 8 | active: dev 9 | cloud: 10 | config: 11 | server: 12 | git: 13 | uri: https://gitee.com/cqzqxq_lxh/pig-config.git 14 | default-label: ${spring.profiles.active} #解决监控down 15 | 16 | # 关闭安全管理 17 | management: 18 | security: 19 | enabled: false 20 | endpoints: 21 | health: 22 | sensitive: false 23 | --- 24 | spring: 25 | profiles: dev 26 | rabbitmq: 27 | host: 139.224.200.249 28 | port: 5682 29 | username: pig 30 | password: lengleng 31 | eureka: 32 | instance: 33 | prefer-ip-address: true 34 | lease-renewal-interval-in-seconds: 5 35 | lease-expiration-duration-in-seconds: 20 36 | client: 37 | serviceUrl: 38 | defaultZone: http://pig:gip6666@localhost:1025/eureka 39 | registry-fetch-interval-seconds: 10 40 | --- 41 | spring: 42 | profiles: prd 43 | rabbitmq: 44 | host: 127.0.0.1 45 | port: 5682 46 | username: pig 47 | password: lengleng 48 | cloud: 49 | config: 50 | retry: 51 | initial-interval: 3000 52 | multiplier: 1.5 53 | max-interval: 20000 54 | max-attempts: 6 55 | eureka: 56 | instance: 57 | prefer-ip-address: true 58 | client: 59 | serviceUrl: 60 | defaultZone: http://pig:gip6666@eureka:1025/eureka 61 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/dto/TreeNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.dto; 19 | 20 | import lombok.Data; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2017年11月9日23:33:45 28 | */ 29 | @Data 30 | public class TreeNode { 31 | protected int id; 32 | protected int parentId; 33 | protected List children = new ArrayList(); 34 | 35 | public void add(TreeNode node) { 36 | children.add(node); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/mapper/SysRoleMenuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/dto/UserDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.dto; 19 | 20 | import com.github.pig.admin.model.entity.SysUser; 21 | import lombok.Data; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2017/11/5 28 | */ 29 | @Data 30 | public class UserDTO extends SysUser { 31 | /** 32 | * 角色ID 33 | */ 34 | private List role; 35 | 36 | private Integer deptId; 37 | 38 | /** 39 | * 新密码 40 | */ 41 | private String newpassword1; 42 | } 43 | -------------------------------------------------------------------------------- /pig-eureka/src/main/java/com/github/pig/eureka/PigEurekaApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.eureka; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 23 | 24 | /** 25 | * @author lengleng 26 | */ 27 | @EnableEurekaServer 28 | @SpringBootApplication 29 | public class PigEurekaApplication { 30 | 31 | public static void main(String[] args) { 32 | SpringApplication.run(PigEurekaApplication.class, args); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysLogService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.service.IService; 21 | import com.github.pig.common.entity.SysLog; 22 | 23 | /** 24 | *

25 | * 日志表 服务类 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2017-11-20 30 | */ 31 | public interface SysLogService extends IService { 32 | 33 | /** 34 | * 通过ID删除日志(逻辑删除) 35 | * 36 | * @param id 日志ID 37 | * @return true/false 38 | */ 39 | Boolean updateByLogId(Long id); 40 | } 41 | -------------------------------------------------------------------------------- /pig-modules/pig-mc-service/src/main/java/com/github/pig/mc/config/DingTalkPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.mc.config; 19 | 20 | import lombok.Data; 21 | import org.springframework.boot.context.properties.ConfigurationProperties; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018/4/2 27 | * 钉钉服务配置 28 | */ 29 | @Data 30 | @Configuration 31 | @ConfigurationProperties(prefix = "sms.dingtalk") 32 | public class DingTalkPropertiesConfig { 33 | /** 34 | * webhook 35 | */ 36 | private String webhook; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /pig-visual/pig-monitor/src/main/java/com/github/pig/monitor/config/MonitorMobilePropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.monitor.config; 19 | 20 | import lombok.Data; 21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2018/4/22 29 | */ 30 | @Data 31 | @ConditionalOnExpression("!'${mobiles}'.isEmpty()") 32 | public class MonitorMobilePropertiesConfig { 33 | private Boolean enabled; 34 | private List mobiles = new ArrayList<>(); 35 | } 36 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/service/PermissionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.service; 19 | 20 | import org.springframework.security.core.Authentication; 21 | 22 | import javax.servlet.http.HttpServletRequest; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2017/10/28 27 | */ 28 | public interface PermissionService { 29 | /** 30 | * 判断请求是否有权限 31 | * 32 | * @param request HttpServletRequest 33 | * @param authentication 认证信息 34 | * @return 是否有权限 35 | */ 36 | boolean hasPermission(HttpServletRequest request, Authentication authentication); 37 | } 38 | -------------------------------------------------------------------------------- /pig-modules/pig-sso-client-demo/src/main/java/com/github/pig/sso/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.sso.controller; 19 | 20 | import org.springframework.security.core.Authentication; 21 | import org.springframework.web.bind.annotation.GetMapping; 22 | import org.springframework.web.bind.annotation.RestController; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018/1/27 27 | * demo controller 28 | */ 29 | @RestController 30 | public class DemoController { 31 | @GetMapping("/") 32 | public Authentication user(Authentication authentication) { 33 | return authentication; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysDeptMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.admin.model.entity.SysDept; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | *

27 | * 部门管理 Mapper 接口 28 | *

29 | * 30 | * @author lengleng 31 | * @since 2018-01-20 32 | */ 33 | public interface SysDeptMapper extends BaseMapper { 34 | 35 | /** 36 | * 关联dept——relation 37 | * 38 | * @param delFlag 删除标记 39 | * @return 数据列表 40 | */ 41 | List selectDeptDtoList(String delFlag); 42 | } -------------------------------------------------------------------------------- /pig-visual/pig-monitor/src/main/java/com/github/pig/monitor/config/MonitorPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.monitor.config; 19 | 20 | import lombok.Data; 21 | import org.springframework.boot.context.properties.ConfigurationProperties; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018/1/25 27 | * 监控配置 28 | */ 29 | @Data 30 | @Configuration 31 | @ConfigurationProperties(prefix = "notifier") 32 | public class MonitorPropertiesConfig { 33 | 34 | private MonitorMobilePropertiesConfig mobile; 35 | 36 | private MonitorDingTalkPropertiesConfig dingTalk; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /pig-modules/pig-daemon-service/src/main/java/com/github/pig/daemon/PigDaemonApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.daemon; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018年02月07日20:35:35 27 | * 分布式任务调度模块 28 | */ 29 | @EnableDiscoveryClient 30 | @SpringBootApplication 31 | public class PigDaemonApplication { 32 | 33 | public static void main(String[] args) { 34 | SpringApplication.run(PigDaemonApplication.class, args); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pig-modules/pig-mc-service/src/main/java/com/github/pig/mc/PigMessageCenterApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.mc; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018年01月15日13:24:23 27 | * 消息中心 28 | */ 29 | @EnableDiscoveryClient 30 | @SpringBootApplication 31 | public class PigMessageCenterApplication { 32 | 33 | public static void main(String[] args) { 34 | SpringApplication.run(PigMessageCenterApplication.class, args); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/bean/interceptor/DataScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.bean.interceptor; 19 | 20 | import lombok.Data; 21 | 22 | import java.util.HashMap; 23 | import java.util.List; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2018/1/19 28 | * 数据权限、参考guns实现 29 | * 2018年02月12日 增强查询参数 30 | */ 31 | @Data 32 | public class DataScope extends HashMap { 33 | /** 34 | * 限制范围的字段名称 35 | */ 36 | private String scopeName = "dept_id"; 37 | 38 | /** 39 | * 具体的数据范围 40 | */ 41 | private List deptIds; 42 | 43 | /** 44 | * 是否只查询本部门 45 | */ 46 | private Boolean isOnly = false; 47 | } 48 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/util/RibbonVersionHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.util; 19 | 20 | import com.alibaba.ttl.TransmittableThreadLocal; 21 | 22 | /** 23 | * @author lengleng 24 | * @date 2018/10/19 25 | */ 26 | public class RibbonVersionHolder { 27 | private static final ThreadLocal context = new TransmittableThreadLocal<>(); 28 | 29 | 30 | public static String getContext() { 31 | return context.get(); 32 | } 33 | 34 | public static void setContext(String value) { 35 | context.set(value); 36 | } 37 | 38 | public static void clearContext() { 39 | context.remove(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/impl/SysDictServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service.impl; 19 | 20 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 21 | import com.github.pig.admin.mapper.SysDictMapper; 22 | import com.github.pig.admin.model.entity.SysDict; 23 | import com.github.pig.admin.service.SysDictService; 24 | import org.springframework.stereotype.Service; 25 | 26 | /** 27 | *

28 | * 字典表 服务实现类 29 | *

30 | * 31 | * @author lengleng 32 | * @since 2017-11-19 33 | */ 34 | @Service 35 | public class SysDictServiceImpl extends ServiceImpl implements SysDictService { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pig-config/src/main/java/com/github/pig/config/PigConfigApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.config; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | import org.springframework.cloud.config.server.EnableConfigServer; 24 | 25 | /** 26 | * @author lengleng 27 | */ 28 | @EnableDiscoveryClient 29 | @EnableConfigServer 30 | @SpringBootApplication 31 | public class PigConfigApplication { 32 | 33 | public static void main(String[] args) { 34 | SpringApplication.run(PigConfigApplication.class, args); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /pig-modules/pig-sso-client-demo/src/main/java/com/github/pig/sso/PigSsoClientDemoApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.sso; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018年01月27日13:00:09 27 | * 单点登录客户端 28 | */ 29 | @EnableOAuth2Sso 30 | @SpringBootApplication 31 | public class PigSsoClientDemoApplication { 32 | 33 | public static void main(String[] args) { 34 | SpringApplication.run(PigSsoClientDemoApplication.class, args); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysUserRoleService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | 21 | import com.baomidou.mybatisplus.service.IService; 22 | import com.github.pig.admin.model.entity.SysUserRole; 23 | 24 | /** 25 | *

26 | * 用户角色表 服务类 27 | *

28 | * 29 | * @author lengleng 30 | * @since 2017-10-29 31 | */ 32 | public interface SysUserRoleService extends IService { 33 | 34 | /** 35 | * 根据用户Id删除该用户的角色关系 36 | * 37 | * @author 寻欢·李 38 | * @date 2017年12月7日 16:31:38 39 | * @param userId 用户ID 40 | * @return boolean 41 | */ 42 | Boolean deleteByUserId(Integer userId); 43 | } 44 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysRoleMenuService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | 21 | import com.baomidou.mybatisplus.service.IService; 22 | import com.github.pig.admin.model.entity.SysRoleMenu; 23 | 24 | /** 25 | *

26 | * 角色菜单表 服务类 27 | *

28 | * 29 | * @author lengleng 30 | * @since 2017-10-29 31 | */ 32 | public interface SysRoleMenuService extends IService { 33 | 34 | /** 35 | * 更新角色菜单 36 | * 37 | * 38 | * @param role 39 | * @param roleId 角色 40 | * @param menuIds 菜单列表 41 | * @return 42 | */ 43 | Boolean insertRoleMenus(String role, Integer roleId, String menuIds); 44 | } 45 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/mapper/SysUserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | DELETE FROM sys_user_role WHERE user_id = #{userId} 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/impl/SysRoleDeptServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service.impl; 19 | 20 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 21 | import com.github.pig.admin.mapper.SysRoleDeptMapper; 22 | import com.github.pig.admin.model.entity.SysRoleDept; 23 | import com.github.pig.admin.service.SysRoleDeptService; 24 | import org.springframework.stereotype.Service; 25 | 26 | /** 27 | *

28 | * 角色与部门对应关系 服务实现类 29 | *

30 | * 31 | * @author lengleng 32 | * @since 2018-01-20 33 | */ 34 | @Service 35 | public class SysRoleDeptServiceImpl extends ServiceImpl implements SysRoleDeptService { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pig-visual/pig-zipkin-db/src/main/java/com/github/pig/zipkin/PigZipkinDbApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.zipkin; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | import zipkin.server.EnableZipkinServer; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2018-01-24 28 | * zipkin mysql 存储实现 29 | */ 30 | @EnableDiscoveryClient 31 | @SpringBootApplication 32 | @EnableZipkinServer 33 | public class PigZipkinDbApplication { 34 | public static void main(String[] args) { 35 | SpringApplication.run(PigZipkinDbApplication.class, args); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/impl/SysDeptRelationServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service.impl; 19 | 20 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 21 | import com.github.pig.admin.mapper.SysDeptRelationMapper; 22 | import com.github.pig.admin.model.entity.SysDeptRelation; 23 | import com.github.pig.admin.service.SysDeptRelationService; 24 | import org.springframework.stereotype.Service; 25 | 26 | /** 27 | *

28 | * 服务实现类 29 | *

30 | * 31 | * @author lengleng 32 | * @since 2018-02-12 33 | */ 34 | @Service 35 | public class SysDeptRelationServiceImpl extends ServiceImpl implements SysDeptRelationService { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pig-visual/pig-zipkin-elk/src/main/java/com/github/pig/zipkin/PigZipkinElkApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.zipkin; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | import zipkin.server.EnableZipkinServer; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2017-12-29 13:02:29 28 | * zipkin 链路追踪 29 | */ 30 | @EnableDiscoveryClient 31 | @SpringBootApplication 32 | @EnableZipkinServer 33 | public class PigZipkinElkApplication { 34 | 35 | public static void main(String[] args) { 36 | SpringApplication.run(PigZipkinElkApplication.class, args); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysMenuMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.admin.model.entity.SysMenu; 22 | import com.github.pig.common.vo.MenuVO; 23 | import org.apache.ibatis.annotations.Param; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | *

29 | * 菜单权限表 Mapper 接口 30 | *

31 | * 32 | * @author lengleng 33 | * @since 2017-10-29 34 | */ 35 | public interface SysMenuMapper extends BaseMapper { 36 | 37 | /** 38 | * 通过角色名查询菜单 39 | * 40 | * @param role 角色名称 41 | * @return 菜单列表 42 | */ 43 | List findMenuByRoleName(@Param("role") String role); 44 | } -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/mapper/SysRoleDeptMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | id, role_id AS roleId, dept_id AS deptId 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysDeptRelationMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.admin.model.entity.SysDeptRelation; 22 | 23 | /** 24 | *

25 | * Mapper 接口 26 | *

27 | * 28 | * @author lengleng 29 | * @since 2018-02-12 30 | */ 31 | public interface SysDeptRelationMapper extends BaseMapper { 32 | /** 33 | * 删除部门关系表数据 34 | * 35 | * @param id 部门ID 36 | */ 37 | void deleteAllDeptRealtion(Integer id); 38 | 39 | /** 40 | * 更改部分关系表数据 41 | * 42 | * @param deptRelation 43 | */ 44 | void updateDeptRealtion(SysDeptRelation deptRelation); 45 | } -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysUserRoleMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | 21 | import com.baomidou.mybatisplus.mapper.BaseMapper; 22 | import com.github.pig.admin.model.entity.SysUserRole; 23 | import org.apache.ibatis.annotations.Param; 24 | 25 | /** 26 | *

27 | * 用户角色表 Mapper 接口 28 | *

29 | * 30 | * @author lengleng 31 | * @since 2017-10-29 32 | */ 33 | public interface SysUserRoleMapper extends BaseMapper { 34 | /** 35 | * 根据用户Id删除该用户的角色关系 36 | * 37 | * @param userId 用户ID 38 | * @return boolean 39 | * @author 寻欢·李 40 | * @date 2017年12月7日 16:31:38 41 | */ 42 | Boolean deleteByUserId(@Param("userId") Integer userId); 43 | } -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/vo/ImageCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.vo; 19 | 20 | import lombok.Data; 21 | 22 | import java.awt.image.BufferedImage; 23 | import java.io.Serializable; 24 | import java.time.LocalDateTime; 25 | 26 | 27 | /** 28 | * @author lengleng 29 | * @date 2017-12-18 30 | */ 31 | @Data 32 | public class ImageCode implements Serializable { 33 | private String code; 34 | 35 | private LocalDateTime expireTime; 36 | 37 | private BufferedImage image; 38 | 39 | public ImageCode(BufferedImage image, String sRand, int defaultImageExpire) { 40 | this.image = image; 41 | this.code = sRand; 42 | this.expireTime = LocalDateTime.now().plusSeconds(defaultImageExpire); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service.impl; 19 | 20 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 21 | import com.github.pig.admin.mapper.SysOauthClientDetailsMapper; 22 | import com.github.pig.admin.model.entity.SysOauthClientDetails; 23 | import com.github.pig.admin.service.SysOauthClientDetailsService; 24 | import org.springframework.stereotype.Service; 25 | 26 | /** 27 | *

28 | * 服务实现类 29 | *

30 | * 31 | * @author lengleng 32 | * @since 2018-05-15 33 | */ 34 | @Service 35 | public class SysOauthClientDetailsServiceImpl extends ServiceImpl implements SysOauthClientDetailsService { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/vo/ErrorPojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.vo; 19 | 20 | import com.alibaba.fastjson.annotation.JSONField; 21 | import lombok.Data; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2017/12/25 28 | * spring boot 的异常对象 29 | */ 30 | @Data 31 | public class ErrorPojo implements Serializable { 32 | 33 | @JSONField(name = "timestamp") 34 | private long timestamp; 35 | @JSONField(name = "status") 36 | private int status; 37 | @JSONField(name = "error") 38 | private String error; 39 | @JSONField(name = "exception") 40 | private String exception; 41 | @JSONField(name = "message") 42 | private String message; 43 | @JSONField(name = "path") 44 | private String path; 45 | } 46 | -------------------------------------------------------------------------------- /pig-gateway/src/test/java/com/github/pig/common/util/UserUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util; 19 | 20 | import com.github.pig.common.constant.CommonConstant; 21 | import org.apache.commons.lang.StringUtils; 22 | import org.junit.Test; 23 | 24 | import java.util.Optional; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2017/12/22 29 | */ 30 | public class UserUtilsTest { 31 | @Test 32 | public void getToken() throws Exception { 33 | String authorization = null; 34 | System.out.println(StringUtils.substringAfter(authorization, CommonConstant.TOKEN_SPLIT)); 35 | } 36 | 37 | @Test 38 | public void optionalTest() { 39 | Optional optional = Optional.ofNullable(""); 40 | System.out.println(optional.isPresent()); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/bean/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.bean.config; 19 | 20 | import com.github.pig.common.bean.resolver.TokenArgumentResolver; 21 | import org.springframework.context.annotation.Configuration; 22 | import org.springframework.web.method.support.HandlerMethodArgumentResolver; 23 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | * @author lengleng 29 | * @date 2017/12/21 30 | * mvc配置 31 | */ 32 | @Configuration 33 | public class WebMvcConfig extends WebMvcConfigurerAdapter { 34 | @Override 35 | public void addArgumentResolvers(List argumentResolvers) { 36 | argumentResolvers.add(new TokenArgumentResolver()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/dto/UserInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.dto; 19 | 20 | import com.github.pig.admin.model.entity.SysUser; 21 | import lombok.Data; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2017/11/11 28 | *

29 | * commit('SET_ROLES', data) 30 | * commit('SET_NAME', data) 31 | * commit('SET_AVATAR', data) 32 | * commit('SET_INTRODUCTION', data) 33 | * commit('SET_PERMISSIONS', data) 34 | */ 35 | @Data 36 | public class UserInfo implements Serializable { 37 | /** 38 | * 用户基本信息 39 | */ 40 | private SysUser sysUser; 41 | /** 42 | * 权限标识集合 43 | */ 44 | private String[] permissions; 45 | 46 | /** 47 | * 角色集合 48 | */ 49 | private String[] roles; 50 | } 51 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/bean/config/FdfsPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.bean.config; 19 | 20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 21 | import org.springframework.boot.context.properties.ConfigurationProperties; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018年01月14日19:51:08 27 | * FastDFs参数 28 | */ 29 | @Configuration 30 | @ConditionalOnProperty(prefix = "fdfs", name = "file-host") 31 | @ConfigurationProperties(prefix = "fdfs") 32 | public class FdfsPropertiesConfig { 33 | private String fileHost; 34 | 35 | public String getFileHost() { 36 | return fileHost; 37 | } 38 | 39 | public void setFileHost(String fileHost) { 40 | this.fileHost = fileHost; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/PigAdminApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | import org.springframework.context.annotation.ComponentScan; 24 | import org.springframework.scheduling.annotation.EnableAsync; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2017年10月27日13:59:05 29 | */ 30 | @EnableAsync 31 | @SpringBootApplication 32 | @EnableDiscoveryClient 33 | @ComponentScan(basePackages = {"com.github.pig.admin", "com.github.pig.common.bean"}) 34 | public class PigAdminApplication { 35 | public static void main(String[] args) { 36 | SpringApplication.run(PigAdminApplication.class, args); 37 | } 38 | } -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/feign/fallback/MenuServiceFallbackImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.feign.fallback; 19 | 20 | import com.github.pig.common.vo.MenuVO; 21 | import com.github.pig.gateway.feign.MenuService; 22 | import com.xiaoleilu.hutool.collection.CollUtil; 23 | import lombok.extern.slf4j.Slf4j; 24 | import org.springframework.stereotype.Service; 25 | 26 | import java.util.Set; 27 | 28 | /** 29 | * @author lengleng 30 | * @date 2017/10/31 31 | * why add @Service when i up version ? 32 | * https://github.com/spring-cloud/spring-cloud-netflix/issues/762 33 | */ 34 | @Slf4j 35 | @Service 36 | public class MenuServiceFallbackImpl implements MenuService { 37 | @Override 38 | public Set findMenuByRole(String role) { 39 | log.error("调用{}异常{}","findMenuByRole",role); 40 | return CollUtil.newHashSet(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/feign/MenuService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.feign; 19 | 20 | import com.github.pig.common.vo.MenuVO; 21 | import com.github.pig.gateway.feign.fallback.MenuServiceFallbackImpl; 22 | import org.springframework.cloud.netflix.feign.FeignClient; 23 | import org.springframework.web.bind.annotation.GetMapping; 24 | import org.springframework.web.bind.annotation.PathVariable; 25 | 26 | import java.util.Set; 27 | 28 | /** 29 | * @author lengleng 30 | * @date 2017/10/31 31 | */ 32 | @FeignClient(name = "pig-upms-service", fallback = MenuServiceFallbackImpl.class) 33 | public interface MenuService { 34 | /** 35 | * 通过角色名查询菜单 36 | * 37 | * @param role 角色名称 38 | * @return 菜单列表 39 | */ 40 | @GetMapping(value = "/menu/findMenuByRole/{role}") 41 | Set findMenuByRole(@PathVariable("role") String role); 42 | } 43 | -------------------------------------------------------------------------------- /pig-modules/pig-daemon-service/src/main/java/com/github/pig/daemon/job/PigDataflowJob.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.daemon.job; 19 | 20 | import com.dangdang.ddframe.job.api.ShardingContext; 21 | import com.dangdang.ddframe.job.api.dataflow.DataflowJob; 22 | import com.zen.elasticjob.spring.boot.annotation.ElasticJobConfig; 23 | 24 | import java.util.List; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2018/2/8 29 | */ 30 | @ElasticJobConfig(cron = "0 0 0/1 * * ? ", shardingTotalCount = 3, shardingItemParameters = "0=Beijing,1=Shanghai,2=Guangzhou") 31 | public class PigDataflowJob implements DataflowJob { 32 | 33 | 34 | @Override 35 | public List fetchData(ShardingContext shardingContext) { 36 | return null; 37 | } 38 | 39 | @Override 40 | public void processData(ShardingContext shardingContext, List list) { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/constant/MqQueueConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.constant; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2018/1/15 23 | * MQ 消息队列 24 | */ 25 | public interface MqQueueConstant { 26 | /** 27 | * log rabbit队列名称 28 | */ 29 | String LOG_QUEUE = "log"; 30 | 31 | /** 32 | * 发送短信验证码队列 33 | */ 34 | String MOBILE_CODE_QUEUE = "mobile_code_queue"; 35 | 36 | /** 37 | * 短信服务状态队列 38 | */ 39 | String MOBILE_SERVICE_STATUS_CHANGE = "mobile_service_status_change"; 40 | 41 | /** 42 | * 钉钉服务状态队列 43 | */ 44 | String DINGTALK_SERVICE_STATUS_CHANGE = "dingtalk_service_status_change"; 45 | 46 | /** 47 | * zipkin 队列 48 | */ 49 | String ZIPKIN_NAME_QUEUE = "zipkin"; 50 | 51 | /** 52 | * 路由配置状态队列 53 | */ 54 | String ROUTE_CONFIG_CHANGE = "route_config_change"; 55 | } 56 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/exception/UnloginException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util.exception; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2017年12月21日20:45:10 23 | */ 24 | public class UnloginException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | public UnloginException() { 29 | } 30 | 31 | public UnloginException(String message) { 32 | super(message); 33 | } 34 | 35 | public UnloginException(Throwable cause) { 36 | super(cause); 37 | } 38 | 39 | public UnloginException(String message, Throwable cause) { 40 | super(message, cause); 41 | } 42 | 43 | public UnloginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 44 | super(message, cause, enableSuppression, writableStackTrace); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/exception/CheckedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util.exception; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 😴2017年12月21日20:44:38 23 | */ 24 | public class CheckedException extends RuntimeException { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | public CheckedException() { 29 | } 30 | 31 | public CheckedException(String message) { 32 | super(message); 33 | } 34 | 35 | public CheckedException(Throwable cause) { 36 | super(cause); 37 | } 38 | 39 | public CheckedException(String message, Throwable cause) { 40 | super(message, cause); 41 | } 42 | 43 | public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 44 | super(message, cause, enableSuppression, writableStackTrace); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/constant/enums/EnumSmsChannelTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.constant.enums; 19 | 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | /** 24 | * @author LiXunHuan 25 | * @date 2018/1/16 26 | * 短信通道模板 27 | */ 28 | public enum EnumSmsChannelTemplate { 29 | /** 30 | * 登录验证 31 | */ 32 | LOGIN_NAME_LOGIN("loginCodeChannel", "登录验证"), 33 | /** 34 | * 服务异常提醒 35 | */ 36 | SERVICE_STATUS_CHANGE("serviceStatusChange", "Pig4Cloud"); 37 | 38 | 39 | /** 40 | * 模板名称 41 | */ 42 | @Getter 43 | @Setter 44 | private String template; 45 | /** 46 | * 模板签名 47 | */ 48 | @Getter 49 | @Setter 50 | private String signName; 51 | 52 | EnumSmsChannelTemplate(String template, String signName) { 53 | this.template = template; 54 | this.signName = signName; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/bean/config/FilterIgnorePropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.bean.config; 19 | 20 | import lombok.Data; 21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; 22 | import org.springframework.boot.context.properties.ConfigurationProperties; 23 | import org.springframework.cloud.context.config.annotation.RefreshScope; 24 | import org.springframework.context.annotation.Configuration; 25 | 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | /** 30 | * @author lengleng 31 | * @date 2018/1/9 32 | */ 33 | @Data 34 | @Configuration 35 | @RefreshScope 36 | @ConditionalOnExpression("!'${ignore}'.isEmpty()") 37 | @ConfigurationProperties(prefix = "ignore") 38 | public class FilterIgnorePropertiesConfig { 39 | private List urls = new ArrayList<>(); 40 | 41 | private List clients = new ArrayList<>(); 42 | } 43 | -------------------------------------------------------------------------------- /pig-visual/pom.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 4.0.0 21 | 22 | com.github.pig 23 | pig-visual 24 | 1.3.1 25 | pom 26 | 27 | pig-visual 28 | 图形化管理模块 29 | 30 | 31 | pig 32 | com.github 33 | 1.3.1 34 | 35 | 36 | 37 | pig-monitor 38 | pig-zipkin-elk 39 | pig-zipkin-db 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/mapper/SysRoleMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.mapper; 19 | 20 | import com.baomidou.mybatisplus.mapper.BaseMapper; 21 | import com.github.pig.admin.model.entity.SysRole; 22 | import com.github.pig.common.util.Query; 23 | 24 | import java.util.List; 25 | import java.util.Map; 26 | 27 | /** 28 | *

29 | * Mapper 接口 30 | *

31 | * 32 | * @author lengleng 33 | * @since 2017-10-29 34 | */ 35 | public interface SysRoleMapper extends BaseMapper { 36 | 37 | /** 38 | * 查询角色列表含有部门信息 39 | * @param query 查询对象 40 | * @param condition 条件 41 | * @return List 42 | */ 43 | List selectRolePage(Query query, Map condition); 44 | 45 | /** 46 | * 通过部门ID查询角色列表 47 | * 48 | * @param deptId 部门ID 49 | * @return 角色列表 50 | */ 51 | List selectListByDeptId(Integer deptId); 52 | } -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/exception/PigDeniedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util.exception; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2017-12-29 17:05:10 23 | * 403 授权拒绝 24 | */ 25 | public class PigDeniedException extends RuntimeException { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | public PigDeniedException() { 30 | } 31 | 32 | public PigDeniedException(String message) { 33 | super(message); 34 | } 35 | 36 | public PigDeniedException(Throwable cause) { 37 | super(cause); 38 | } 39 | 40 | public PigDeniedException(String message, Throwable cause) { 41 | super(message, cause); 42 | } 43 | 44 | public PigDeniedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 45 | super(message, cause, enableSuppression, writableStackTrace); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /pig-auth/src/main/java/com/github/pig/auth/PigAuthServerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.auth; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 24 | import org.springframework.context.annotation.ComponentScan; 25 | 26 | /** 27 | * @author lengleng 28 | * 获取用户信息也是通过这个应用实现 29 | * 这里既是认证服务器,也是资源服务器 30 | * EnableResourceServer 31 | */ 32 | @SpringBootApplication 33 | @EnableDiscoveryClient 34 | @EnableFeignClients 35 | @ComponentScan(basePackages = {"com.github.pig.auth", "com.github.pig.common.bean"}) 36 | public class PigAuthServerApplication { 37 | 38 | public static void main(String[] args) { 39 | SpringApplication.run(PigAuthServerApplication.class, args); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /pig-modules/pig-mc-service/src/main/java/com/github/pig/mc/config/SmsAliyunPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.mc.config; 19 | 20 | import lombok.Data; 21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; 22 | import org.springframework.boot.context.properties.ConfigurationProperties; 23 | import org.springframework.context.annotation.Configuration; 24 | 25 | import java.util.Map; 26 | 27 | /** 28 | * @author lengleng 29 | * @date 2018/1/16 30 | * 阿里大鱼短息服务配置 31 | */ 32 | @Data 33 | @Configuration 34 | @ConditionalOnExpression("!'${sms.aliyun}'.isEmpty()") 35 | @ConfigurationProperties(prefix = "sms.aliyun") 36 | public class SmsAliyunPropertiesConfig { 37 | /** 38 | * 应用ID 39 | */ 40 | private String accessKey; 41 | 42 | /** 43 | * 应用秘钥 44 | */ 45 | private String secretKey; 46 | 47 | /** 48 | * 短信模板配置 49 | */ 50 | private Map channels; 51 | } 52 | -------------------------------------------------------------------------------- /pig-modules/pig-mc-service/src/main/java/com/github/pig/mc/handler/SmsMessageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.mc.handler; 19 | 20 | import com.github.pig.common.util.template.MobileMsgTemplate; 21 | 22 | /** 23 | * @author lengleng 24 | * @date 2018/1/16 25 | */ 26 | public interface SmsMessageHandler { 27 | /** 28 | * 执行入口 29 | * 30 | * @param mobileMsgTemplate 信息 31 | */ 32 | void execute(MobileMsgTemplate mobileMsgTemplate); 33 | 34 | /** 35 | * 数据校验 36 | * 37 | * @param mobileMsgTemplate 信息 38 | */ 39 | void check(MobileMsgTemplate mobileMsgTemplate); 40 | 41 | /** 42 | * 业务处理 43 | * 44 | * @param mobileMsgTemplate 信息 45 | * @return boolean 46 | */ 47 | boolean process(MobileMsgTemplate mobileMsgTemplate); 48 | 49 | /** 50 | * 失败处理 51 | * 52 | * @param mobileMsgTemplate 信息 53 | */ 54 | void fail(MobileMsgTemplate mobileMsgTemplate); 55 | } 56 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/web/BaseController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.web; 19 | 20 | import com.github.pig.common.util.UserUtils; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | 23 | import javax.servlet.http.HttpServletRequest; 24 | import java.util.List; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2017/10/28 29 | */ 30 | public class BaseController { 31 | @Autowired 32 | private HttpServletRequest request; 33 | protected org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(this.getClass()); 34 | 35 | /** 36 | * 根据请求heard中的token获取用户角色 37 | * 38 | * @return 角色名 39 | */ 40 | public List getRole() { 41 | return UserUtils.getRole(request); 42 | } 43 | 44 | /** 45 | * 根据请求heard中的token获取用户ID 46 | * 47 | * @return 用户ID 48 | */ 49 | public Integer getUserId() { 50 | return UserUtils.getUserId(request); 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/constant/enums/EnumSmsChannel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.constant.enums; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2018/1/16 23 | * 短信通道枚举 24 | */ 25 | public enum EnumSmsChannel { 26 | /** 27 | * 阿里大鱼短信通道 28 | */ 29 | ALIYUN("ALIYUN_SMS", "阿里大鱼"); 30 | /** 31 | * 通道名称 32 | */ 33 | private String name; 34 | /** 35 | * 通道描述 36 | */ 37 | private String description; 38 | 39 | EnumSmsChannel(String name, String description) { 40 | this.name = name; 41 | this.description = description; 42 | } 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setName(String name) { 49 | this.name = name; 50 | } 51 | 52 | public String getDescription() { 53 | return description; 54 | } 55 | 56 | public void setDescription(String description) { 57 | this.description = description; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysMenuService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | 21 | import com.baomidou.mybatisplus.service.IService; 22 | import com.github.pig.admin.model.entity.SysMenu; 23 | import com.github.pig.common.vo.MenuVO; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | *

29 | * 菜单权限表 服务类 30 | *

31 | * 32 | * @author lengleng 33 | * @since 2017-10-29 34 | */ 35 | public interface SysMenuService extends IService { 36 | /** 37 | * 通过角色名称查询URL 权限 38 | * 39 | * @param role 角色名称 40 | * @return 菜单列表 41 | */ 42 | List findMenuByRoleName(String role); 43 | 44 | /** 45 | * 级联删除菜单 46 | * 47 | * @param id 菜单ID 48 | * @return 成功、失败 49 | */ 50 | Boolean deleteMenu(Integer id); 51 | 52 | /** 53 | * 更新菜单信息 54 | * 55 | * @param sysMenu 菜单信息 56 | * @return 成功、失败 57 | */ 58 | Boolean updateMenuById(SysMenu sysMenu); 59 | } 60 | -------------------------------------------------------------------------------- /pig-modules/pig-daemon-service/src/main/java/com/github/pig/daemon/job/DemoSimpleJob.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.daemon.job; 19 | 20 | import com.dangdang.ddframe.job.api.ShardingContext; 21 | import com.dangdang.ddframe.job.api.simple.SimpleJob; 22 | import com.zen.elasticjob.spring.boot.annotation.ElasticJobConfig; 23 | import lombok.extern.slf4j.Slf4j; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2018/2/7 28 | * 测试Job 29 | */ 30 | @Slf4j 31 | @ElasticJobConfig(cron = "0 0 0/1 * * ?", shardingTotalCount = 3, 32 | shardingItemParameters = "0=pig1,1=pig2,2=pig3", 33 | startedTimeoutMilliseconds = 5000L, 34 | completedTimeoutMilliseconds = 10000L, 35 | eventTraceRdbDataSource = "dataSource") 36 | public class DemoSimpleJob implements SimpleJob { 37 | /** 38 | * 业务执行逻辑 39 | * 40 | * @param shardingContext 分片信息 41 | */ 42 | @Override 43 | public void execute(ShardingContext shardingContext) { 44 | log.info("--------------"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /pig-modules/pig-sso-client-demo/src/main/java/com/github/pig/sso/config/ResourceServerConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.sso.config; 19 | 20 | import org.springframework.context.annotation.Configuration; 21 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 22 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 23 | import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2018年1月31日23:15:08 28 | * 当前配置 暴露监控信息 29 | */ 30 | @Configuration 31 | @EnableResourceServer 32 | public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter { 33 | 34 | @Override 35 | public void configure(HttpSecurity http) throws Exception { 36 | http 37 | .authorizeRequests() 38 | .anyRequest().authenticated() 39 | .and() 40 | .csrf().disable(); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /pig-modules/pig-daemon-service/src/main/java/com/github/pig/daemon/job/PigSimpleJob.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.daemon.job; 19 | 20 | import com.dangdang.ddframe.job.api.ShardingContext; 21 | import com.dangdang.ddframe.job.api.simple.SimpleJob; 22 | import com.zen.elasticjob.spring.boot.annotation.ElasticJobConfig; 23 | import lombok.extern.slf4j.Slf4j; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2018/2/7 28 | * 测试Job 29 | */ 30 | @Slf4j 31 | @ElasticJobConfig(cron = "0 0 0/1 * * ?", shardingTotalCount = 3, 32 | shardingItemParameters = "0=pig1,1=pig2,2=pig3", 33 | startedTimeoutMilliseconds = 5000L, 34 | completedTimeoutMilliseconds = 10000L, 35 | eventTraceRdbDataSource = "dataSource") 36 | public class PigSimpleJob implements SimpleJob { 37 | /** 38 | * 业务执行逻辑 39 | * 40 | * @param shardingContext 分片信息 41 | */ 42 | @Override 43 | public void execute(ShardingContext shardingContext) { 44 | log.info("shardingContext:{}", shardingContext); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/impl/SysUserRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service.impl; 19 | 20 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 21 | import com.github.pig.admin.mapper.SysUserRoleMapper; 22 | import com.github.pig.admin.model.entity.SysUserRole; 23 | import com.github.pig.admin.service.SysUserRoleService; 24 | import org.springframework.stereotype.Service; 25 | 26 | /** 27 | *

28 | * 用户角色表 服务实现类 29 | *

30 | * 31 | * @author lengleng 32 | * @since 2017-10-29 33 | */ 34 | @Service 35 | public class SysUserRoleServiceImpl extends ServiceImpl implements SysUserRoleService { 36 | 37 | /** 38 | * 根据用户Id删除该用户的角色关系 39 | * 40 | * @param userId 用户ID 41 | * @return boolean 42 | * @author 寻欢·李 43 | * @date 2017年12月7日 16:31:38 44 | */ 45 | @Override 46 | public Boolean deleteByUserId(Integer userId) { 47 | return baseMapper.deleteByUserId(userId); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/entity/SysDeptRelation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.entity; 19 | 20 | import com.baomidou.mybatisplus.activerecord.Model; 21 | import com.baomidou.mybatisplus.annotations.TableName; 22 | import lombok.Data; 23 | 24 | import java.io.Serializable; 25 | 26 | /** 27 | *

28 | * 29 | *

30 | * 31 | * @author lengleng 32 | * @since 2018-01-22 33 | */ 34 | @Data 35 | @TableName("sys_dept_relation") 36 | public class SysDeptRelation extends Model { 37 | 38 | private static final long serialVersionUID = 1L; 39 | 40 | /** 41 | * 祖先节点 42 | */ 43 | private Integer ancestor; 44 | /** 45 | * 后代节点 46 | */ 47 | private Integer descendant; 48 | 49 | 50 | @Override 51 | protected Serializable pkVal() { 52 | return this.ancestor; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "SysDeptRelation{" + 58 | ", ancestor=" + ancestor + 59 | ", descendant=" + descendant + 60 | "}"; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /pig-modules/pom.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | pig 22 | com.github 23 | 1.3.1 24 | 25 | 4.0.0 26 | 27 | com.github.pig 28 | pig-modules 29 | 1.3.1 30 | pom 31 | 32 | pig-modules 33 | http://maven.apache.org 34 | 35 | 36 | UTF-8 37 | 38 | 39 | 40 | pig-daemon-service 41 | pig-mc-service 42 | pig-sso-client-demo 43 | pig-upms-service 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/test/java/com/github/pig/admin/PigAdminApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin; 19 | 20 | import com.ulisesbocchio.jasyptspringboot.encryptor.DefaultLazyEncryptor; 21 | import org.jasypt.encryption.StringEncryptor; 22 | import org.junit.Test; 23 | import org.springframework.core.env.StandardEnvironment; 24 | 25 | /** 26 | * 配置文件加解密工具类 27 | * 28 | * @author lengleng 29 | */ 30 | public class PigAdminApplicationTest { 31 | private static final String JASYPT_ENCRYPTOR_PASSWORD = "jasypt.encryptor.password"; 32 | 33 | /** 34 | * jasypt.encryptor.password 对应 配置中心 application-dev.yml 中的密码 35 | */ 36 | @Test 37 | public void testEnvironmentProperties() { 38 | System.setProperty(JASYPT_ENCRYPTOR_PASSWORD, "lengleng"); 39 | StringEncryptor stringEncryptor = new DefaultLazyEncryptor(new StandardEnvironment()); 40 | 41 | //加密方法 42 | System.out.println(stringEncryptor.encrypt("123456")); 43 | //解密方法 44 | System.out.println(stringEncryptor.decrypt("saRv7ZnXsNAfsl3AL9OpCQ==")); 45 | } 46 | } -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/common/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.common.config; 19 | 20 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 21 | import com.github.pig.common.bean.interceptor.DataScopeInterceptor; 22 | import org.mybatis.spring.annotation.MapperScan; 23 | import org.springframework.context.annotation.Bean; 24 | import org.springframework.context.annotation.Configuration; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2017/10/29 29 | */ 30 | @Configuration 31 | @MapperScan("com.github.pig.admin.mapper") 32 | public class MybatisPlusConfig { 33 | /** 34 | * 分页插件 35 | * 36 | * @return PaginationInterceptor 37 | */ 38 | @Bean 39 | public PaginationInterceptor paginationInterceptor() { 40 | return new PaginationInterceptor(); 41 | } 42 | 43 | /** 44 | * 数据权限插件 45 | * 46 | * @return DataScopeInterceptor 47 | */ 48 | @Bean 49 | public DataScopeInterceptor dataScopeInterceptor() { 50 | return new DataScopeInterceptor(); 51 | } 52 | } -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/vo/SysRole.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.vo; 19 | 20 | import lombok.Data; 21 | 22 | import java.io.Serializable; 23 | import java.util.Date; 24 | 25 | /** 26 | *

27 | *

28 | *

29 | * 30 | * @author lengleng 31 | * @since 2017-10-29 32 | */ 33 | @Data 34 | public class SysRole implements Serializable { 35 | private static final long serialVersionUID = 1L; 36 | 37 | private Integer roleId; 38 | private String roleName; 39 | private String roleCode; 40 | private String roleDesc; 41 | private Date createTime; 42 | private Date updateTime; 43 | private String delFlag; 44 | 45 | @Override 46 | public String toString() { 47 | return "SysRole{" + 48 | ", roleId=" + roleId + 49 | ", roleName=" + roleName + 50 | ", roleCode=" + roleCode + 51 | ", roleDesc=" + roleDesc + 52 | ", createTime=" + createTime + 53 | ", updateTime=" + updateTime + 54 | ", delFlag=" + delFlag + 55 | "}"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/impl/SysLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service.impl; 19 | 20 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 21 | import com.github.pig.admin.mapper.SysLogMapper; 22 | import com.github.pig.admin.service.SysLogService; 23 | import com.github.pig.common.constant.CommonConstant; 24 | import com.github.pig.common.entity.SysLog; 25 | import com.github.pig.common.util.Assert; 26 | import org.springframework.stereotype.Service; 27 | 28 | import java.util.Date; 29 | 30 | /** 31 | *

32 | * 日志表 服务实现类 33 | *

34 | * 35 | * @author lengleng 36 | * @since 2017-11-20 37 | */ 38 | @Service 39 | public class SysLogServiceImpl extends ServiceImpl implements SysLogService { 40 | 41 | @Override 42 | public Boolean updateByLogId(Long id) { 43 | Assert.isNull(id, "日志ID为空"); 44 | 45 | SysLog sysLog = new SysLog(); 46 | sysLog.setId(id); 47 | sysLog.setDelFlag(CommonConstant.STATUS_DEL); 48 | sysLog.setUpdateTime(new Date()); 49 | return updateById(sysLog); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/bean/handler/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.bean.handler; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2018/5/24 23 | */ 24 | 25 | import com.github.pig.common.util.R; 26 | import lombok.extern.slf4j.Slf4j; 27 | import org.springframework.http.HttpStatus; 28 | import org.springframework.web.bind.annotation.ExceptionHandler; 29 | import org.springframework.web.bind.annotation.ResponseBody; 30 | import org.springframework.web.bind.annotation.ResponseStatus; 31 | import org.springframework.web.bind.annotation.RestControllerAdvice; 32 | 33 | /** 34 | * 全局的的异常拦截器 35 | * 36 | * @author lengleng 37 | * @date 2018/05/22 38 | */ 39 | @Slf4j 40 | @RestControllerAdvice 41 | public class GlobalExceptionHandler { 42 | /** 43 | * 全局异常. 44 | * 45 | * @param e the e 46 | * @return R 47 | */ 48 | @ExceptionHandler(Exception.class) 49 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 50 | @ResponseBody 51 | public R exception(Exception e) { 52 | log.info("保存全局异常信息 ex={}", e.getMessage(), e); 53 | return new R<>(e); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /pig-auth/src/main/java/com/github/pig/auth/service/UserDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.auth.service; 19 | 20 | import com.github.pig.auth.feign.UserService; 21 | import com.github.pig.auth.util.UserDetailsImpl; 22 | import com.github.pig.common.vo.UserVO; 23 | import org.springframework.beans.factory.annotation.Autowired; 24 | import org.springframework.security.core.userdetails.UserDetailsService; 25 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 26 | import org.springframework.stereotype.Service; 27 | 28 | /** 29 | * @author lengleng 30 | * @date 2017/10/26 31 | *

32 | */ 33 | @Service("userDetailService") 34 | public class UserDetailServiceImpl implements UserDetailsService { 35 | @Autowired 36 | private UserService userService; 37 | 38 | @Override 39 | public UserDetailsImpl loadUserByUsername(String username) throws UsernameNotFoundException { 40 | UserVO userVo = userService.findUserByUsername(username); 41 | if (userVo == null) { 42 | throw new UsernameNotFoundException("用户名不存在或者密码错误"); 43 | } 44 | return new UserDetailsImpl(userVo); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/template/MobileMsgTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util.template; 19 | 20 | import lombok.Data; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2018/1/15 27 | * 短信消息模板 28 | */ 29 | @Data 30 | public class MobileMsgTemplate implements Serializable { 31 | /** 32 | * 手机号 33 | */ 34 | private String mobile; 35 | /** 36 | * 组装后的模板内容JSON字符串 37 | */ 38 | private String context; 39 | /** 40 | * 短信通道 41 | */ 42 | private String channel; 43 | /** 44 | * 短信类型(验证码或者通知短信) 45 | * 暂时不用,留着后面存数据库备用吧 46 | */ 47 | private String type; 48 | /** 49 | * 短信签名 50 | */ 51 | private String signName; 52 | /** 53 | * 短信模板 54 | */ 55 | private String template; 56 | 57 | public MobileMsgTemplate(String mobile, String context, String channel, String signName, String template){ 58 | this.mobile = mobile; 59 | this.context = context; 60 | this.channel = channel; 61 | this.signName = signName; 62 | this.template = template; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/mapper/SysDictMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | id, value, label, type, description, sort, create_time AS createTime, update_time AS updateTime, remarks, del_flag AS delFlag 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /pig-auth/src/main/resources/static/css/signin.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | body { 19 | padding-top: 40px; 20 | padding-bottom: 40px; 21 | background-color: #eee; 22 | } 23 | 24 | .form-signin { 25 | max-width: 330px; 26 | padding: 15px; 27 | margin: 0 auto; 28 | } 29 | .form-margin-top { 30 | margin-top: 50px; 31 | } 32 | .form-signin .form-signin-heading, 33 | .form-signin .checkbox { 34 | margin-bottom: 10px; 35 | } 36 | .form-signin .checkbox { 37 | font-weight: normal; 38 | } 39 | .form-signin .form-control { 40 | position: relative; 41 | height: auto; 42 | -webkit-box-sizing: border-box; 43 | -moz-box-sizing: border-box; 44 | box-sizing: border-box; 45 | padding: 10px; 46 | font-size: 16px; 47 | } 48 | .form-signin .form-control:focus { 49 | z-index: 2; 50 | } 51 | .form-signin input[type="email"] { 52 | margin-bottom: -1px; 53 | border-bottom-right-radius: 0; 54 | border-bottom-left-radius: 0; 55 | } 56 | .form-signin input[type="password"] { 57 | margin-bottom: 10px; 58 | border-top-left-radius: 0; 59 | border-top-right-radius: 0; 60 | } 61 | footer{ 62 | text-align: center; 63 | position:absolute; 64 | bottom:0; 65 | width:100%; 66 | height:100px; 67 | } 68 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/entity/SysRoleMenu.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.entity; 19 | 20 | import com.baomidou.mybatisplus.activerecord.Model; 21 | import com.baomidou.mybatisplus.annotations.TableId; 22 | import com.baomidou.mybatisplus.annotations.TableName; 23 | import com.baomidou.mybatisplus.enums.IdType; 24 | import lombok.Data; 25 | 26 | import java.io.Serializable; 27 | 28 | /** 29 | *

30 | * 角色菜单表 31 | *

32 | * 33 | * @author lengleng 34 | * @since 2017-10-29 35 | */ 36 | @Data 37 | @TableName("sys_role_menu") 38 | public class SysRoleMenu extends Model { 39 | 40 | private static final long serialVersionUID = 1L; 41 | 42 | /** 43 | * 角色ID 44 | */ 45 | @TableId(type = IdType.INPUT) 46 | private Integer roleId; 47 | /** 48 | * 菜单ID 49 | */ 50 | @TableId(type = IdType.INPUT) 51 | private Integer menuId; 52 | 53 | @Override 54 | protected Serializable pkVal() { 55 | return this.roleId; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "SysRoleMenu{" + 61 | ", roleId=" + roleId + 62 | ", menuId=" + menuId + 63 | "}"; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/entity/SysUserRole.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.entity; 19 | 20 | import com.baomidou.mybatisplus.activerecord.Model; 21 | import com.baomidou.mybatisplus.annotations.TableId; 22 | import com.baomidou.mybatisplus.annotations.TableName; 23 | import com.baomidou.mybatisplus.enums.IdType; 24 | import lombok.Data; 25 | 26 | import java.io.Serializable; 27 | 28 | /** 29 | *

30 | * 用户角色表 31 | *

32 | * 33 | * @author lengleng 34 | * @since 2017-10-29 35 | */ 36 | @Data 37 | @TableName("sys_user_role") 38 | public class SysUserRole extends Model { 39 | 40 | private static final long serialVersionUID = 1L; 41 | 42 | /** 43 | * 用户ID 44 | */ 45 | @TableId(type = IdType.INPUT) 46 | private Integer userId; 47 | /** 48 | * 角色ID 49 | */ 50 | @TableId(type = IdType.INPUT) 51 | private Integer roleId; 52 | 53 | 54 | @Override 55 | protected Serializable pkVal() { 56 | return this.userId; 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return "SysUserRole{" + 62 | ", userId=" + userId + 63 | ", roleId=" + roleId + 64 | "}"; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysDeptService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 21 | import com.baomidou.mybatisplus.service.IService; 22 | import com.github.pig.admin.model.dto.DeptTree; 23 | import com.github.pig.admin.model.entity.SysDept; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | *

29 | * 部门管理 服务类 30 | *

31 | * 32 | * @author lengleng 33 | * @since 2018-01-20 34 | */ 35 | public interface SysDeptService extends IService { 36 | 37 | /** 38 | * 查询部门树菜单 39 | * @param sysDeptEntityWrapper 40 | * @return 树 41 | */ 42 | List selectListTree(EntityWrapper sysDeptEntityWrapper); 43 | 44 | /** 45 | * 添加信息部门 46 | * @param sysDept 47 | * @return 48 | */ 49 | Boolean insertDept(SysDept sysDept); 50 | 51 | /** 52 | * 删除部门 53 | * @param id 部门 ID 54 | * @return 成功、失败 55 | */ 56 | Boolean deleteDeptById(Integer id); 57 | 58 | /** 59 | * 更新部门 60 | * @param sysDept 部门信息 61 | * @return 成功、失败 62 | */ 63 | Boolean updateDeptById(SysDept sysDept); 64 | } 65 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/common/listener/LogReceiveListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.common.listener; 19 | 20 | import com.github.pig.admin.service.SysLogService; 21 | import com.github.pig.common.constant.MqQueueConstant; 22 | import com.github.pig.common.entity.SysLog; 23 | import com.github.pig.common.vo.LogVO; 24 | import org.slf4j.MDC; 25 | import org.springframework.amqp.rabbit.annotation.RabbitHandler; 26 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 27 | import org.springframework.beans.factory.annotation.Autowired; 28 | import org.springframework.stereotype.Component; 29 | 30 | /** 31 | * @author lengleng 32 | * @date 2017/11/17 33 | */ 34 | @Component 35 | @RabbitListener(queues = MqQueueConstant.LOG_QUEUE) 36 | public class LogReceiveListener { 37 | private static final String KEY_USER = "user"; 38 | 39 | @Autowired 40 | private SysLogService sysLogService; 41 | 42 | @RabbitHandler 43 | public void receive(LogVO logVo) { 44 | SysLog sysLog = logVo.getSysLog(); 45 | MDC.put(KEY_USER, logVo.getUsername()); 46 | sysLog.setCreateBy(logVo.getUsername()); 47 | sysLogService.insert(sysLog); 48 | MDC.remove(KEY_USER); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /pig-modules/pig-mc-service/src/main/java/com/github/pig/mc/listener/DingTalkServiceChangeReceiveListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.mc.listener; 19 | 20 | import com.github.pig.common.constant.MqQueueConstant; 21 | import com.github.pig.mc.handler.DingTalkMessageHandler; 22 | import lombok.extern.slf4j.Slf4j; 23 | import org.springframework.amqp.rabbit.annotation.RabbitHandler; 24 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 25 | import org.springframework.beans.factory.annotation.Autowired; 26 | import org.springframework.stereotype.Component; 27 | 28 | /** 29 | * @author lengleng 30 | * @date 2018/4/22 31 | * 监听服务状态改变发送请求 32 | */ 33 | @Slf4j 34 | @Component 35 | @RabbitListener(queues = MqQueueConstant.DINGTALK_SERVICE_STATUS_CHANGE) 36 | public class DingTalkServiceChangeReceiveListener { 37 | @Autowired 38 | private DingTalkMessageHandler dingTalkMessageHandler; 39 | 40 | @RabbitHandler 41 | public void receive(String text) { 42 | long startTime = System.currentTimeMillis(); 43 | log.info("消息中心接收到钉钉发送请求-> 内容:{} ", text); 44 | dingTalkMessageHandler.process(text); 45 | long useTime = System.currentTimeMillis() - startTime; 46 | log.info("调用 钉钉网关处理完毕,耗时 {}毫秒", useTime); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/template/DingTalkMsgTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util.template; 19 | 20 | import lombok.Data; 21 | import lombok.ToString; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2018/1/15 28 | * 钉钉消息模板 29 | * msgtype : text 30 | * text : {"content":"服务: pig-upms-service 状态:UP"} 31 | */ 32 | @Data 33 | @ToString 34 | public class DingTalkMsgTemplate implements Serializable { 35 | private String msgtype; 36 | private TextBean text; 37 | 38 | public String getMsgtype() { 39 | return msgtype; 40 | } 41 | 42 | public void setMsgtype(String msgtype) { 43 | this.msgtype = msgtype; 44 | } 45 | 46 | public TextBean getText() { 47 | return text; 48 | } 49 | 50 | public void setText(TextBean text) { 51 | this.text = text; 52 | } 53 | 54 | public static class TextBean { 55 | /** 56 | * content : 服务: pig-upms-service 状态:UP 57 | */ 58 | 59 | private String content; 60 | 61 | public String getContent() { 62 | return content; 63 | } 64 | 65 | public void setContent(String content) { 66 | this.content = content; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /pig-modules/pig-mc-service/src/main/java/com/github/pig/mc/handler/AbstractMessageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.mc.handler; 19 | 20 | import com.github.pig.common.util.template.MobileMsgTemplate; 21 | 22 | /** 23 | * @author lengleng 24 | * @date 2018/1/16 25 | * 抽象hander 26 | */ 27 | public abstract class AbstractMessageHandler implements SmsMessageHandler { 28 | 29 | /** 30 | * 执行入口 31 | * 32 | * @param mobileMsgTemplate 信息 33 | */ 34 | @Override 35 | public void execute(MobileMsgTemplate mobileMsgTemplate) { 36 | check(mobileMsgTemplate); 37 | if (!process(mobileMsgTemplate)) { 38 | fail(mobileMsgTemplate); 39 | } 40 | } 41 | 42 | /** 43 | * 数据校验 44 | * 45 | * @param mobileMsgTemplate 信息 46 | */ 47 | @Override 48 | public abstract void check(MobileMsgTemplate mobileMsgTemplate); 49 | 50 | /** 51 | * 业务处理 52 | * 53 | * @param mobileMsgTemplate 信息 54 | * @return boolean 55 | */ 56 | @Override 57 | public abstract boolean process(MobileMsgTemplate mobileMsgTemplate); 58 | 59 | /** 60 | * 失败处理 61 | * 62 | * @param mobileMsgTemplate 信息 63 | */ 64 | @Override 65 | public abstract void fail(MobileMsgTemplate mobileMsgTemplate); 66 | } 67 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/vo/UserVO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.vo; 19 | 20 | import lombok.Data; 21 | 22 | import java.io.Serializable; 23 | import java.util.Date; 24 | import java.util.List; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2017/10/29 29 | */ 30 | @Data 31 | public class UserVO implements Serializable { 32 | private static final long serialVersionUID = 1L; 33 | 34 | /** 35 | * 主键ID 36 | */ 37 | private Integer userId; 38 | /** 39 | * 用户名 40 | */ 41 | private String username; 42 | /** 43 | * 密码 44 | */ 45 | private String password; 46 | /** 47 | * 随机盐 48 | */ 49 | private String salt; 50 | /** 51 | * 创建时间 52 | */ 53 | private Date createTime; 54 | /** 55 | * 修改时间 56 | */ 57 | private Date updateTime; 58 | /** 59 | * 0-正常,1-删除 60 | */ 61 | private String delFlag; 62 | /** 63 | * 简介 64 | */ 65 | private String phone; 66 | /** 67 | * 头像 68 | */ 69 | private String avatar; 70 | 71 | /** 72 | * 部门ID 73 | */ 74 | private Integer deptId; 75 | /** 76 | * 部门名称 77 | */ 78 | private String deptName; 79 | 80 | /** 81 | * 角色列表 82 | */ 83 | private List roleList; 84 | } 85 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/model/entity/SysRoleDept.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.model.entity; 19 | 20 | import com.baomidou.mybatisplus.activerecord.Model; 21 | import com.baomidou.mybatisplus.annotations.TableField; 22 | import com.baomidou.mybatisplus.annotations.TableId; 23 | import com.baomidou.mybatisplus.annotations.TableName; 24 | import com.baomidou.mybatisplus.enums.IdType; 25 | import lombok.Data; 26 | 27 | import java.io.Serializable; 28 | 29 | /** 30 | *

31 | * 角色与部门对应关系 32 | *

33 | * 34 | * @author lengleng 35 | * @since 2018-01-20 36 | */ 37 | @Data 38 | @TableName("sys_role_dept") 39 | public class SysRoleDept extends Model { 40 | 41 | private static final long serialVersionUID = 1L; 42 | 43 | @TableId(value="id", type= IdType.AUTO) 44 | private Integer id; 45 | /** 46 | * 角色ID 47 | */ 48 | @TableField("role_id") 49 | private Integer roleId; 50 | /** 51 | * 部门ID 52 | */ 53 | @TableField("dept_id") 54 | private Integer deptId; 55 | 56 | 57 | @Override 58 | protected Serializable pkVal() { 59 | return this.id; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return "SysRoleDept{" + 65 | ", id=" + id + 66 | ", roleId=" + roleId + 67 | ", deptId=" + deptId + 68 | "}"; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/mapper/SysDeptMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | dept_id AS deptId, parent_id AS parentId, name, order_num AS orderNum, create_time AS createTime, update_time AS updateTime, del_flag AS delFlag 35 | 36 | 37 | 38 | 46 | 47 | -------------------------------------------------------------------------------- /pig-auth/src/main/java/com/github/pig/auth/config/PigJwtAccessTokenConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.auth.config; 19 | 20 | import com.github.pig.common.constant.SecurityConstants; 21 | import org.springframework.security.oauth2.common.OAuth2AccessToken; 22 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 23 | import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; 24 | 25 | import java.util.Map; 26 | 27 | /** 28 | * @author lengleng 29 | * @date 2018/4/7 30 | * token 声明版权 31 | */ 32 | public class PigJwtAccessTokenConverter extends JwtAccessTokenConverter { 33 | @Override 34 | public Map convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) { 35 | Map representation = (Map) super.convertAccessToken(token, authentication); 36 | representation.put("license", SecurityConstants.PIG_LICENSE); 37 | return representation; 38 | } 39 | 40 | @Override 41 | public OAuth2AccessToken extractAccessToken(String value, Map map) { 42 | return super.extractAccessToken(value, map); 43 | } 44 | 45 | @Override 46 | public OAuth2Authentication extractAuthentication(Map map) { 47 | return super.extractAuthentication(map); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/constant/CommonConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.constant; 19 | 20 | /** 21 | * @author lengleng 22 | * @date 2017/10/29 23 | */ 24 | public interface CommonConstant { 25 | /** 26 | * token请求头名称 27 | */ 28 | String REQ_HEADER = "Authorization"; 29 | 30 | /** 31 | * token分割符 32 | */ 33 | String TOKEN_SPLIT = "Bearer "; 34 | 35 | /** 36 | * jwt签名 37 | */ 38 | String SIGN_KEY = "PIG"; 39 | /** 40 | * 删除 41 | */ 42 | String STATUS_DEL = "1"; 43 | /** 44 | * 正常 45 | */ 46 | String STATUS_NORMAL = "0"; 47 | 48 | /** 49 | * 锁定 50 | */ 51 | String STATUS_LOCK = "9"; 52 | 53 | /** 54 | * 菜单 55 | */ 56 | String MENU = "0"; 57 | 58 | /** 59 | * 按钮 60 | */ 61 | String BUTTON = "1"; 62 | 63 | /** 64 | * 删除标记 65 | */ 66 | String DEL_FLAG = "del_flag"; 67 | 68 | /** 69 | * 编码 70 | */ 71 | String UTF8 = "UTF-8"; 72 | 73 | /** 74 | * JSON 资源 75 | */ 76 | String CONTENT_TYPE = "application/json; charset=utf-8"; 77 | 78 | /** 79 | * 阿里大鱼 80 | */ 81 | String ALIYUN_SMS = "aliyun_sms"; 82 | 83 | /** 84 | * 路由信息Redis保存的key 85 | */ 86 | String ROUTE_KEY = "_ROUTE_KEY"; 87 | } 88 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/component/filter/LoggerFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.component.filter; 19 | 20 | import com.github.pig.gateway.service.LogSendService; 21 | import com.netflix.zuul.ZuulFilter; 22 | import com.netflix.zuul.context.RequestContext; 23 | import org.springframework.beans.factory.annotation.Autowired; 24 | import org.springframework.stereotype.Component; 25 | 26 | import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.POST_TYPE; 27 | import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.SEND_RESPONSE_FILTER_ORDER; 28 | 29 | /** 30 | * @author lengleng 31 | * @date 2017/11/16 32 | * 网关日志拦截器 33 | */ 34 | @Component 35 | public class LoggerFilter extends ZuulFilter { 36 | 37 | @Autowired 38 | private LogSendService logSendService; 39 | 40 | @Override 41 | public String filterType() { 42 | return POST_TYPE; 43 | } 44 | 45 | @Override 46 | public int filterOrder() { 47 | return SEND_RESPONSE_FILTER_ORDER - 1; 48 | } 49 | 50 | @Override 51 | public boolean shouldFilter() { 52 | return true; 53 | } 54 | 55 | @Override 56 | public Object run() { 57 | logSendService.send(RequestContext.getCurrentContext()); 58 | return null; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/Query.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util; 19 | 20 | import com.baomidou.mybatisplus.plugins.Page; 21 | import org.apache.commons.lang.StringUtils; 22 | 23 | import java.util.Map; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2017/12/10 28 | */ 29 | public class Query extends Page { 30 | private static final String PAGE = "page"; 31 | private static final String LIMIT = "limit"; 32 | private static final String ORDER_BY_FIELD = "orderByField"; 33 | private static final String IS_ASC = "isAsc"; 34 | 35 | public Query(Map params) { 36 | super(Integer.parseInt(params.getOrDefault(PAGE, 1).toString()) 37 | , Integer.parseInt(params.getOrDefault(LIMIT, 10).toString())); 38 | 39 | String orderByField = params.getOrDefault(ORDER_BY_FIELD, "").toString(); 40 | if (StringUtils.isNotEmpty(orderByField)) { 41 | this.setOrderByField(orderByField); 42 | } 43 | 44 | Boolean isAsc = Boolean.parseBoolean(params.getOrDefault(IS_ASC, Boolean.TRUE).toString()); 45 | this.setAsc(isAsc); 46 | 47 | params.remove(PAGE); 48 | params.remove(LIMIT); 49 | params.remove(ORDER_BY_FIELD); 50 | params.remove(IS_ASC); 51 | this.setCondition(params); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pig-auth/src/main/java/com/github/pig/auth/feign/UserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.auth.feign; 19 | 20 | import com.github.pig.auth.feign.fallback.UserServiceFallbackImpl; 21 | import com.github.pig.common.vo.UserVO; 22 | import org.springframework.cloud.netflix.feign.FeignClient; 23 | import org.springframework.web.bind.annotation.GetMapping; 24 | import org.springframework.web.bind.annotation.PathVariable; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2017/10/31 29 | */ 30 | @FeignClient(name = "pig-upms-service", fallback = UserServiceFallbackImpl.class) 31 | public interface UserService { 32 | /** 33 | * 通过用户名查询用户、角色信息 34 | * 35 | * @param username 用户名 36 | * @return UserVo 37 | */ 38 | @GetMapping("/user/findUserByUsername/{username}") 39 | UserVO findUserByUsername(@PathVariable("username") String username); 40 | 41 | /** 42 | * 通过手机号查询用户、角色信息 43 | * 44 | * @param mobile 手机号 45 | * @return UserVo 46 | */ 47 | @GetMapping("/user/findUserByMobile/{mobile}") 48 | UserVO findUserByMobile(@PathVariable("mobile") String mobile); 49 | 50 | /** 51 | * 根据OpenId查询用户信息 52 | * @param openId openId 53 | * @return UserVo 54 | */ 55 | @GetMapping("/user/findUserByOpenId/{openId}") 56 | UserVO findUserByOpenId(@PathVariable("openId") String openId); 57 | } 58 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/component/handler/ZuulRateLimiterErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.component.handler; 19 | 20 | import com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.config.repository.DefaultRateLimiterErrorHandler; 21 | import com.marcosbarbero.cloud.autoconfigure.zuul.ratelimit.config.repository.RateLimiterErrorHandler; 22 | import lombok.extern.slf4j.Slf4j; 23 | import org.springframework.context.annotation.Bean; 24 | import org.springframework.context.annotation.Configuration; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2018/2/26 29 | * 限流降级处理 30 | */ 31 | @Slf4j 32 | @Configuration 33 | public class ZuulRateLimiterErrorHandler { 34 | 35 | @Bean 36 | public RateLimiterErrorHandler rateLimitErrorHandler() { 37 | return new DefaultRateLimiterErrorHandler() { 38 | @Override 39 | public void handleSaveError(String key, Exception e) { 40 | log.error("保存key:[{}]异常", key, e); 41 | } 42 | 43 | @Override 44 | public void handleFetchError(String key, Exception e) { 45 | log.error("路由失败:[{}]异常", key); 46 | } 47 | 48 | @Override 49 | public void handleError(String msg, Exception e) { 50 | log.error("限流异常:[{}]", msg, e); 51 | } 52 | }; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /pig-auth/src/main/java/com/github/pig/auth/feign/fallback/UserServiceFallbackImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.auth.feign.fallback; 19 | 20 | import com.github.pig.auth.feign.UserService; 21 | import com.github.pig.common.vo.UserVO; 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | import org.springframework.stereotype.Service; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2017/10/31 29 | * 用户服务的fallback 30 | */ 31 | @Service 32 | public class UserServiceFallbackImpl implements UserService { 33 | private Logger logger = LoggerFactory.getLogger(this.getClass()); 34 | 35 | @Override 36 | public UserVO findUserByUsername(String username) { 37 | logger.error("调用{}异常:{}", "findUserByUsername", username); 38 | return null; 39 | } 40 | 41 | /** 42 | * 通过手机号查询用户、角色信息 43 | * 44 | * @param mobile 手机号 45 | * @return UserVo 46 | */ 47 | @Override 48 | public UserVO findUserByMobile(String mobile) { 49 | logger.error("调用{}异常:{}", "通过手机号查询用户", mobile); 50 | return null; 51 | } 52 | 53 | /** 54 | * 根据OpenId查询用户信息 55 | * 56 | * @param openId openId 57 | * @return UserVo 58 | */ 59 | @Override 60 | public UserVO findUserByOpenId(String openId) { 61 | logger.error("调用{}异常:{}", "通过OpenId查询用户", openId); 62 | return null; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /pig-eureka/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 4.0.0 22 | 23 | com.github.pig 24 | pig-eureka 25 | 1.3.1 26 | jar 27 | 28 | pig-eureka 29 | eureka server 30 | 31 | 32 | com.github 33 | pig 34 | 1.3.1 35 | 36 | 37 | 38 | 39 | org.springframework.cloud 40 | spring-cloud-starter-eureka-server 41 | 42 | 43 | org.springframework.cloud 44 | spring-cloud-starter-security 45 | 46 | 47 | 48 | 49 | 50 | 51 | org.springframework.boot 52 | spring-boot-maven-plugin 53 | 54 | ${project.name} 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/bean/xss/SqlFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.bean.xss; 19 | 20 | import com.github.pig.common.util.exception.CheckedException; 21 | import org.apache.commons.lang3.StringUtils; 22 | 23 | /** 24 | * SQL过滤 25 | * @author chenshun 26 | * @email sunlightcs@gmail.com 27 | * @date 2017-04-01 16:16 28 | * https://gitee.com/renrenio/renren-fast/blob/master/src/main/java/io/renren/common/xss/SQLFilter.java 29 | */ 30 | public class SqlFilter { 31 | 32 | /** 33 | * SQL注入过滤 34 | * @param str 待验证的字符串 35 | */ 36 | public static String sqlInject(String str){ 37 | if(StringUtils.isBlank(str)){ 38 | return null; 39 | } 40 | //去掉'|"|;|\字符 41 | str = StringUtils.replace(str, "'", ""); 42 | str = StringUtils.replace(str, "\"", ""); 43 | str = StringUtils.replace(str, ";", ""); 44 | str = StringUtils.replace(str, "\\", ""); 45 | 46 | //转换成小写 47 | str = str.toLowerCase(); 48 | 49 | //非法字符 50 | String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alert", "drop"}; 51 | 52 | //判断是否包含非法字符 53 | for(String keyword : keywords){ 54 | if(str.indexOf(keyword) != -1){ 55 | throw new CheckedException("包含非法字符"); 56 | } 57 | } 58 | 59 | return str; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/java/com/github/pig/admin/service/SysRoleService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.admin.service; 19 | 20 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 21 | import com.baomidou.mybatisplus.plugins.Page; 22 | import com.baomidou.mybatisplus.service.IService; 23 | import com.github.pig.admin.model.dto.RoleDTO; 24 | import com.github.pig.admin.model.entity.SysRole; 25 | import com.github.pig.common.util.Query; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | *

31 | * 服务类 32 | *

33 | * 34 | * @author lengleng 35 | * @since 2017-10-29 36 | */ 37 | public interface SysRoleService extends IService { 38 | 39 | /** 40 | * 添加角色 41 | * 42 | * @param roleDto 角色信息 43 | * @return 成功、失败 44 | */ 45 | Boolean insertRole(RoleDTO roleDto); 46 | 47 | /** 48 | * 分页查角色列表 49 | * 50 | * @param objectQuery 查询条件 51 | * @param objectEntityWrapper wapper 52 | * @return page 53 | */ 54 | Page selectwithDeptPage(Query objectQuery, EntityWrapper objectEntityWrapper); 55 | 56 | /** 57 | * 更新角色 58 | * @param roleDto 含有部门信息 59 | * @return 成功、失败 60 | */ 61 | Boolean updateRoleById(RoleDTO roleDto); 62 | 63 | /** 64 | * 通过部门ID查询角色列表 65 | * @param deptId 部门ID 66 | * @return 角色列表 67 | */ 68 | List selectListByDeptId(Integer deptId); 69 | } 70 | -------------------------------------------------------------------------------- /pig-modules/pig-upms-service/src/main/resources/mapper/SysZuulRouteMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | id, path, service_id AS serviceId, url, strip_prefix AS stripPrefix, retryable, enabled, sensitiveHeaders_list AS sensitiveheadersList, create_time AS createTime, update_time AS updateTime, del_flag AS delFlag 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/bean/config/QiniuPropertiesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.bean.config; 19 | 20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 21 | import org.springframework.boot.context.properties.ConfigurationProperties; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2017/12/6 27 | * 七牛参数 28 | */ 29 | @Configuration 30 | @ConditionalOnProperty(prefix = "qiniu", name = "accessKey") 31 | @ConfigurationProperties(prefix = "qiniu") 32 | public class QiniuPropertiesConfig { 33 | private String accessKey; 34 | private String secretKey; 35 | private String bucket; 36 | private String qiniuHost; 37 | 38 | public String getAccessKey() { 39 | return accessKey; 40 | } 41 | 42 | public void setAccessKey(String accessKey) { 43 | this.accessKey = accessKey; 44 | } 45 | 46 | public String getSecretKey() { 47 | return secretKey; 48 | } 49 | 50 | public void setSecretKey(String secretKey) { 51 | this.secretKey = secretKey; 52 | } 53 | 54 | public String getBucket() { 55 | return bucket; 56 | } 57 | 58 | public void setBucket(String bucket) { 59 | this.bucket = bucket; 60 | } 61 | 62 | public String getQiniuHost() { 63 | return qiniuHost; 64 | } 65 | 66 | public void setQiniuHost(String qiniuHost) { 67 | this.qiniuHost = qiniuHost; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/component/filter/ErrorHandlerFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.component.filter; 19 | 20 | import com.github.pig.gateway.service.LogSendService; 21 | import com.netflix.zuul.ZuulFilter; 22 | import com.netflix.zuul.context.RequestContext; 23 | import org.springframework.beans.factory.annotation.Autowired; 24 | import org.springframework.stereotype.Component; 25 | 26 | import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.ERROR_TYPE; 27 | import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.SEND_RESPONSE_FILTER_ORDER; 28 | 29 | /** 30 | * @author lengleng 31 | * @date 2017-12-25 17:53:38 32 | * 网关统一异常处理 33 | */ 34 | @Component 35 | public class ErrorHandlerFilter extends ZuulFilter { 36 | @Autowired 37 | private LogSendService logSendService; 38 | 39 | @Override 40 | public String filterType() { 41 | return ERROR_TYPE; 42 | } 43 | 44 | @Override 45 | public int filterOrder() { 46 | return SEND_RESPONSE_FILTER_ORDER + 1; 47 | } 48 | 49 | @Override 50 | public boolean shouldFilter() { 51 | RequestContext requestContext = RequestContext.getCurrentContext(); 52 | return requestContext.getThrowable() != null; 53 | } 54 | 55 | @Override 56 | public Object run() { 57 | RequestContext requestContext = RequestContext.getCurrentContext(); 58 | logSendService.send(requestContext); 59 | return null; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /pig-common/src/main/java/com/github/pig/common/util/R.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.common.util; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * 响应信息主体 24 | * 25 | * @param 26 | * @author lengleng 27 | */ 28 | public class R implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | public static final int NO_LOGIN = -1; 33 | 34 | public static final int SUCCESS = 0; 35 | 36 | public static final int FAIL = 1; 37 | 38 | public static final int NO_PERMISSION = 2; 39 | 40 | private String msg = "success"; 41 | 42 | private int code = SUCCESS; 43 | 44 | private T data; 45 | 46 | public R() { 47 | super(); 48 | } 49 | 50 | public R(T data) { 51 | super(); 52 | this.data = data; 53 | } 54 | 55 | public R(T data, String msg) { 56 | super(); 57 | this.data = data; 58 | this.msg = msg; 59 | } 60 | 61 | public R(Throwable e) { 62 | super(); 63 | this.msg = e.getMessage(); 64 | this.code = FAIL; 65 | } 66 | 67 | public String getMsg() { 68 | return msg; 69 | } 70 | 71 | public void setMsg(String msg) { 72 | this.msg = msg; 73 | } 74 | 75 | public int getCode() { 76 | return code; 77 | } 78 | 79 | public void setCode(int code) { 80 | this.code = code; 81 | } 82 | 83 | public T getData() { 84 | return data; 85 | } 86 | 87 | public void setData(T data) { 88 | this.data = data; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /pig-gateway/src/main/java/com/github/pig/gateway/component/filter/XssSecurityFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.github.pig.gateway.component.filter; 19 | 20 | import com.github.pig.common.bean.xss.XssHttpServletRequestWrapper; 21 | import lombok.extern.slf4j.Slf4j; 22 | import org.springframework.stereotype.Component; 23 | import org.springframework.web.filter.OncePerRequestFilter; 24 | 25 | import javax.servlet.FilterChain; 26 | import javax.servlet.ServletException; 27 | import javax.servlet.http.HttpServletRequest; 28 | import javax.servlet.http.HttpServletResponse; 29 | import java.io.IOException; 30 | 31 | /** 32 | * @author lengleng 33 | * @date 2018/5/26 34 | * XSS 过滤 35 | */ 36 | @Slf4j 37 | @Component 38 | public class XssSecurityFilter extends OncePerRequestFilter { 39 | 40 | /** 41 | * Same contract as for {@code doFilter}, but guaranteed to be 42 | * just invoked once per request within a single request thread. 43 | * See {@link #shouldNotFilterAsyncDispatch()} for details. 44 | *

Provides HttpServletRequest and HttpServletResponse arguments instead of the 45 | * default ServletRequest and ServletResponse ones. 46 | * 47 | * @param request 48 | * @param response 49 | * @param filterChain 50 | */ 51 | @Override 52 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { 53 | XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper(request); 54 | filterChain.doFilter(xssRequest, response); 55 | } 56 | } --------------------------------------------------------------------------------