├── .gitignore ├── .idea └── httpRequests │ └── http-requests-log.http ├── README.md ├── chat ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── chat │ │ │ ├── WebsocketApplication.java │ │ │ ├── config │ │ │ └── WebSocketConfig.java │ │ │ ├── controller │ │ │ ├── ChatController.java │ │ │ └── WebSocketServer.java │ │ │ ├── pojo │ │ │ ├── ChatResult.java │ │ │ ├── Client2ServerMessage.java │ │ │ ├── Server2ClientMessage.java │ │ │ ├── TestVO.java │ │ │ └── WxLoginResult.java │ │ │ └── utils │ │ │ ├── FastJsonUtils.java │ │ │ └── HttpRequestUtil.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ ├── webSocket.html │ │ └── webSocket2.html │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── chat │ └── WebsocketApplicationTests.java ├── dubbo ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── HELP.md ├── api │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jason │ │ │ │ └── demo │ │ │ │ └── dubbo │ │ │ │ └── api │ │ │ │ ├── DubboApiApplication.java │ │ │ │ ├── model │ │ │ │ └── User.java │ │ │ │ └── service │ │ │ │ └── UserService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── jason │ │ └── demo │ │ └── dubbo │ │ └── api │ │ └── DubboApiApplicationTests.java ├── consumer │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jason │ │ │ │ └── demo │ │ │ │ └── dubbo │ │ │ │ └── consumer │ │ │ │ ├── DubboConsumerApplication.java │ │ │ │ └── controller │ │ │ │ └── OrderController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── jason │ │ └── demo │ │ └── dubbo │ │ └── consumer │ │ └── DubboConsumerApplicationTests.java ├── mvnw ├── mvnw.cmd ├── pom.xml └── server │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── dubbo │ │ │ └── server │ │ │ ├── DubboServerApplication.java │ │ │ └── service │ │ │ └── UserServiceImpl.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── dubbo │ └── server │ └── DubboServerApplicationTests.java ├── es ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── HELP.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── es │ │ │ ├── DemoEsApplication.java │ │ │ ├── controller │ │ │ └── ElasticController.java │ │ │ ├── model │ │ │ └── Release.java │ │ │ ├── repository │ │ │ └── ElasticRepository.java │ │ │ └── service │ │ │ ├── ElasticServiceImpl.java │ │ │ └── IElasticService.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── es │ └── DemoEsApplicationTests.java ├── feign ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── HELP.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── http │ │ │ ├── DemoHttpApplication.java │ │ │ ├── annotation │ │ │ └── RetryProcess.java │ │ │ ├── aspect │ │ │ └── AspectExceptionInterceptor.java │ │ │ ├── client │ │ │ └── TestClient.java │ │ │ ├── conf │ │ │ └── FeignConfig.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ └── model │ │ │ └── req │ │ │ └── LoginUserReq.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── http │ ├── DemoHttpApplicationTests.java │ └── client │ ├── TestClientTest.java │ └── TestRetryProcess.java ├── pom.xml ├── rabbitmq ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── HELP.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── rabbitmq │ │ │ ├── DemoRabbitmqApplication.java │ │ │ ├── controller │ │ │ └── RabbitMQController.java │ │ │ └── mq │ │ │ ├── MsgConsumer.java │ │ │ ├── MsgProducer.java │ │ │ └── RabbitConfig.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── rabbitmq │ └── DemoRabbitmqApplicationTests.java ├── redisson ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── redisson │ │ │ ├── RedissonApplication.java │ │ │ ├── config │ │ │ └── RedissonConfig.java │ │ │ └── controller │ │ │ └── RedissonController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── redisson │ └── RedissonApplicationTests.java ├── seata ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── account-service │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jason │ │ │ │ └── demo │ │ │ │ └── seata │ │ │ │ └── account │ │ │ │ ├── SeataAccountServiceApplication.java │ │ │ │ ├── config │ │ │ │ ├── DataSourceConfig.java │ │ │ │ └── RestTemplateConfig.java │ │ │ │ ├── controller │ │ │ │ └── AccountController.java │ │ │ │ ├── persistence │ │ │ │ ├── Account.java │ │ │ │ └── AccountMapper.java │ │ │ │ └── service │ │ │ │ └── AccountService.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── logback.xml │ │ │ └── mapper │ │ │ └── AccountMapper.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── jason │ │ └── demo │ │ └── seata │ │ └── account │ │ └── SeataAccountServiceApplicationTests.java ├── business-service │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jason │ │ │ │ └── demo │ │ │ │ └── seata │ │ │ │ └── business │ │ │ │ ├── SeataBusinessServiceApplication.java │ │ │ │ ├── client │ │ │ │ ├── OrderClient.java │ │ │ │ └── StorageClient.java │ │ │ │ ├── config │ │ │ │ └── RestTemplateConfig.java │ │ │ │ ├── controller │ │ │ │ └── BusinessController.java │ │ │ │ └── service │ │ │ │ └── BusinessService.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── logback.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── jason │ │ └── demo │ │ └── seata │ │ └── business │ │ └── SeataBusinessServiceApplicationTests.java ├── common-service │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── seata │ │ │ └── common │ │ │ ├── SeataCommonServiceApplication.java │ │ │ ├── SeataProperties.java │ │ │ ├── config │ │ │ └── SeataRestTemplateAutoConfiguration.java │ │ │ ├── filter │ │ │ └── SeataFilter.java │ │ │ └── interceptor │ │ │ └── SeataRestTemplateInterceptor.java │ │ └── test │ │ └── java │ │ └── com │ │ └── jason │ │ └── demo │ │ └── seata │ │ └── common │ │ └── SeataCommonServiceApplicationTests.java ├── mvnw ├── mvnw.cmd ├── order-service │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jason │ │ │ │ └── demo │ │ │ │ └── seata │ │ │ │ └── order │ │ │ │ ├── SeataOrderServiceApplication.java │ │ │ │ ├── client │ │ │ │ └── AccountClient.java │ │ │ │ ├── config │ │ │ │ ├── DataSourceConfig.java │ │ │ │ └── RestTemplateConfig.java │ │ │ │ ├── controller │ │ │ │ └── OrderController.java │ │ │ │ ├── persistence │ │ │ │ ├── Order.java │ │ │ │ └── OrderMapper.java │ │ │ │ └── service │ │ │ │ └── OrderService.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── logback.xml │ │ │ └── mapper │ │ │ └── OrderMapper.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── jason │ │ └── demo │ │ └── seata │ │ └── order │ │ └── SeataOrderServiceApplicationTests.java ├── pom.xml ├── sql │ └── all_in_one.sql └── storage-service │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── seata │ │ │ └── storage │ │ │ ├── SeataStorageServiceApplication.java │ │ │ ├── config │ │ │ ├── DataSourceConfig.java │ │ │ └── RestTemplateConfig.java │ │ │ ├── controller │ │ │ └── StorageController.java │ │ │ ├── persistence │ │ │ ├── Storage.java │ │ │ └── StorageMapper.java │ │ │ └── service │ │ │ └── StorageService.java │ └── resources │ │ ├── application.yml │ │ ├── logback.xml │ │ └── mapper │ │ └── StorageMapper.xml │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── seata │ └── storage │ └── SeataStorageServiceApplicationTests.java ├── shardingsphere ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml ├── sql │ └── test.sql └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── shardingsphere │ │ │ ├── ShardingsphereApplication.java │ │ │ ├── controller │ │ │ ├── AddressController.java │ │ │ └── UserController.java │ │ │ ├── mapper │ │ │ ├── AddressMapper.java │ │ │ └── UserMapper.java │ │ │ ├── model │ │ │ ├── Address.java │ │ │ └── User.java │ │ │ └── service │ │ │ └── UserService.java │ └── resources │ │ ├── application.yml │ │ └── mappers │ │ ├── AddressMapper.xml │ │ └── UserMapper.xml │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── shardingsphere │ ├── ShardingsphereApplicationTests.java │ └── mapper │ └── UserMapperTest.java ├── task ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── clickfarm │ │ │ ├── ClickFarmApplication.java │ │ │ ├── task │ │ │ └── CsdnClickScheduled.java │ │ │ └── util │ │ │ └── csdn │ │ │ └── UrlCrawBoke.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── clickfarm │ └── ClickFarmApplicationTests.java ├── vue ├── jason-sky-admin │ ├── .browserslistrc │ ├── .eslintrc.js │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ └── index.html │ └── src │ │ ├── App.vue │ │ ├── assets │ │ └── logo.png │ │ ├── components │ │ └── HelloWorld.vue │ │ ├── main.js │ │ ├── network │ │ └── request.js │ │ ├── router │ │ └── index.js │ │ └── views │ │ ├── About.vue │ │ ├── Home.vue │ │ └── Login.vue ├── seckill-master_1 │ ├── LICENSE │ ├── README.md │ ├── doc │ │ ├── design.png │ │ ├── seckill.mp │ │ └── usage.gif │ ├── src │ │ ├── css │ │ │ ├── form.css │ │ │ └── index.css │ │ ├── image │ │ │ ├── bell.png │ │ │ ├── clock.png │ │ │ ├── cursor.png │ │ │ ├── delete.png │ │ │ ├── like.png │ │ │ ├── link.png │ │ │ ├── pause.png │ │ │ ├── runing.png │ │ │ ├── seckill-128.png │ │ │ ├── seckill-16.png │ │ │ ├── seckill-48.png │ │ │ ├── send.png │ │ │ ├── setting.png │ │ │ ├── success.png │ │ │ ├── tip.png │ │ │ └── warning.png │ │ ├── index.html │ │ ├── js │ │ │ ├── background.js │ │ │ ├── newTask.js │ │ │ ├── secKill.js │ │ │ └── utils.js │ │ ├── lib │ │ │ └── jquery-3.2.1.min.js │ │ └── manifest.json │ └── time.gif └── supermall │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ ├── src │ ├── App.vue │ ├── assets │ │ └── css │ │ │ ├── base.css │ │ │ └── normalize.css │ ├── main.js │ ├── router │ │ └── index.js │ └── views │ │ ├── About.vue │ │ ├── Home.vue │ │ └── Login.vue │ └── vue.config.js └── xxl-job ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml ├── sql └── tables_xxl_job.sql ├── xxl-job-admin ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── Dockerfile ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jason │ │ │ └── demo │ │ │ └── xxljob │ │ │ └── admin │ │ │ ├── XxlJobAdminApplication.java │ │ │ ├── controller │ │ │ ├── IndexController.java │ │ │ ├── JobApiController.java │ │ │ ├── JobCodeController.java │ │ │ ├── JobGroupController.java │ │ │ ├── JobInfoController.java │ │ │ ├── JobLogController.java │ │ │ ├── UserController.java │ │ │ ├── annotation │ │ │ │ └── PermissionLimit.java │ │ │ ├── interceptor │ │ │ │ ├── CookieInterceptor.java │ │ │ │ ├── PermissionInterceptor.java │ │ │ │ └── WebMvcConfig.java │ │ │ └── resolver │ │ │ │ └── WebExceptionResolver.java │ │ │ ├── core │ │ │ ├── alarm │ │ │ │ ├── JobAlarm.java │ │ │ │ ├── JobAlarmer.java │ │ │ │ └── impl │ │ │ │ │ └── EmailJobAlarm.java │ │ │ ├── conf │ │ │ │ └── XxlJobAdminConfig.java │ │ │ ├── cron │ │ │ │ └── CronExpression.java │ │ │ ├── exception │ │ │ │ └── XxlJobException.java │ │ │ ├── model │ │ │ │ ├── XxlJobGroup.java │ │ │ │ ├── XxlJobInfo.java │ │ │ │ ├── XxlJobLog.java │ │ │ │ ├── XxlJobLogGlue.java │ │ │ │ ├── XxlJobLogReport.java │ │ │ │ ├── XxlJobRegistry.java │ │ │ │ └── XxlJobUser.java │ │ │ ├── old │ │ │ │ ├── RemoteHttpJobBean.java │ │ │ │ ├── XxlJobDynamicScheduler.java │ │ │ │ └── XxlJobThreadPool.java │ │ │ ├── route │ │ │ │ ├── ExecutorRouteStrategyEnum.java │ │ │ │ ├── ExecutorRouter.java │ │ │ │ └── strategy │ │ │ │ │ ├── ExecutorRouteBusyover.java │ │ │ │ │ ├── ExecutorRouteConsistentHash.java │ │ │ │ │ ├── ExecutorRouteFailover.java │ │ │ │ │ ├── ExecutorRouteFirst.java │ │ │ │ │ ├── ExecutorRouteLFU.java │ │ │ │ │ ├── ExecutorRouteLRU.java │ │ │ │ │ ├── ExecutorRouteLast.java │ │ │ │ │ ├── ExecutorRouteRandom.java │ │ │ │ │ └── ExecutorRouteRound.java │ │ │ ├── scheduler │ │ │ │ └── XxlJobScheduler.java │ │ │ ├── thread │ │ │ │ ├── JobFailMonitorHelper.java │ │ │ │ ├── JobLogReportHelper.java │ │ │ │ ├── JobLosedMonitorHelper.java │ │ │ │ ├── JobRegistryMonitorHelper.java │ │ │ │ ├── JobScheduleHelper.java │ │ │ │ └── JobTriggerPoolHelper.java │ │ │ ├── trigger │ │ │ │ ├── TriggerTypeEnum.java │ │ │ │ └── XxlJobTrigger.java │ │ │ └── util │ │ │ │ ├── CookieUtil.java │ │ │ │ ├── FtlUtil.java │ │ │ │ ├── I18nUtil.java │ │ │ │ ├── JacksonUtil.java │ │ │ │ └── LocalCacheUtil.java │ │ │ ├── dao │ │ │ ├── XxlJobGroupDao.java │ │ │ ├── XxlJobInfoDao.java │ │ │ ├── XxlJobLogDao.java │ │ │ ├── XxlJobLogGlueDao.java │ │ │ ├── XxlJobLogReportDao.java │ │ │ ├── XxlJobRegistryDao.java │ │ │ └── XxlJobUserDao.java │ │ │ └── service │ │ │ ├── LoginService.java │ │ │ ├── XxlJobService.java │ │ │ └── impl │ │ │ ├── AdminBizImpl.java │ │ │ └── XxlJobServiceImpl.java │ └── resources │ │ ├── application.properties │ │ ├── i18n │ │ ├── message_en.properties │ │ ├── message_zh_CN.properties │ │ └── message_zh_TC.properties │ │ ├── logback.xml │ │ ├── mapper │ │ ├── XxlJobGroupMapper.xml │ │ ├── XxlJobInfoMapper.xml │ │ ├── XxlJobLogGlueMapper.xml │ │ ├── XxlJobLogMapper.xml │ │ ├── XxlJobLogReportMapper.xml │ │ ├── XxlJobRegistryMapper.xml │ │ └── XxlJobUserMapper.xml │ │ ├── static │ │ ├── adminlte │ │ │ ├── bower_components │ │ │ │ ├── Ionicons │ │ │ │ │ ├── css │ │ │ │ │ │ └── ionicons.min.css │ │ │ │ │ └── fonts │ │ │ │ │ │ ├── ionicons.eot │ │ │ │ │ │ ├── ionicons.svg │ │ │ │ │ │ ├── ionicons.ttf │ │ │ │ │ │ └── ionicons.woff │ │ │ │ ├── PACE │ │ │ │ │ ├── pace.min.js │ │ │ │ │ └── themes │ │ │ │ │ │ └── blue │ │ │ │ │ │ └── pace-theme-flash.css │ │ │ │ ├── bootstrap-daterangepicker │ │ │ │ │ ├── daterangepicker.css │ │ │ │ │ └── daterangepicker.js │ │ │ │ ├── bootstrap │ │ │ │ │ ├── css │ │ │ │ │ │ ├── bootstrap.min.css │ │ │ │ │ │ └── bootstrap.min.css.map │ │ │ │ │ ├── fonts │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ │ └── js │ │ │ │ │ │ └── bootstrap.min.js │ │ │ │ ├── datatables.net-bs │ │ │ │ │ ├── css │ │ │ │ │ │ └── dataTables.bootstrap.min.css │ │ │ │ │ └── js │ │ │ │ │ │ └── dataTables.bootstrap.min.js │ │ │ │ ├── datatables.net │ │ │ │ │ └── js │ │ │ │ │ │ └── jquery.dataTables.min.js │ │ │ │ ├── fastclick │ │ │ │ │ └── fastclick.js │ │ │ │ ├── font-awesome │ │ │ │ │ ├── css │ │ │ │ │ │ ├── font-awesome.css.map │ │ │ │ │ │ └── font-awesome.min.css │ │ │ │ │ └── fonts │ │ │ │ │ │ ├── FontAwesome.otf │ │ │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ │ │ ├── fontawesome-webfont.svg │ │ │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ │ │ └── fontawesome-webfont.woff2 │ │ │ │ ├── jquery-slimscroll │ │ │ │ │ └── jquery.slimscroll.min.js │ │ │ │ ├── jquery │ │ │ │ │ └── jquery.min.js │ │ │ │ └── moment │ │ │ │ │ └── moment.min.js │ │ │ ├── dist │ │ │ │ ├── css │ │ │ │ │ ├── AdminLTE.min.css │ │ │ │ │ └── skins │ │ │ │ │ │ └── _all-skins.min.css │ │ │ │ └── js │ │ │ │ │ └── adminlte.min.js │ │ │ └── plugins │ │ │ │ └── iCheck │ │ │ │ ├── icheck.min.js │ │ │ │ └── square │ │ │ │ ├── blue.css │ │ │ │ ├── blue.png │ │ │ │ └── blue@2x.png │ │ ├── favicon.ico │ │ ├── js │ │ │ ├── common.1.js │ │ │ ├── index.js │ │ │ ├── jobcode.index.1.js │ │ │ ├── jobgroup.index.1.js │ │ │ ├── jobinfo.index.1.js │ │ │ ├── joblog.detail.1.js │ │ │ ├── joblog.index.1.js │ │ │ ├── login.1.js │ │ │ └── user.index.1.js │ │ └── plugins │ │ │ ├── codemirror │ │ │ ├── addon │ │ │ │ └── hint │ │ │ │ │ ├── anyword-hint.js │ │ │ │ │ ├── show-hint.css │ │ │ │ │ └── show-hint.js │ │ │ ├── lib │ │ │ │ ├── codemirror.css │ │ │ │ └── codemirror.js │ │ │ └── mode │ │ │ │ ├── clike │ │ │ │ └── clike.js │ │ │ │ ├── javascript │ │ │ │ └── javascript.js │ │ │ │ ├── php │ │ │ │ └── php.js │ │ │ │ ├── powershell │ │ │ │ └── powershell.js │ │ │ │ ├── python │ │ │ │ └── python.js │ │ │ │ └── shell │ │ │ │ └── shell.js │ │ │ ├── cronGen │ │ │ ├── cronGen.js │ │ │ └── cronGen_en.js │ │ │ ├── echarts │ │ │ └── echarts.common.min.js │ │ │ ├── jquery │ │ │ ├── jquery.cookie.js │ │ │ └── jquery.validate.min.js │ │ │ └── layer │ │ │ ├── layer.js │ │ │ └── theme │ │ │ └── default │ │ │ ├── icon-ext.png │ │ │ ├── icon.png │ │ │ ├── layer.css │ │ │ ├── loading-0.gif │ │ │ ├── loading-1.gif │ │ │ └── loading-2.gif │ │ └── templates │ │ ├── common │ │ ├── common.exception.ftl │ │ └── common.macro.ftl │ │ ├── help.ftl │ │ ├── index.ftl │ │ ├── jobcode │ │ └── jobcode.index.ftl │ │ ├── jobgroup │ │ └── jobgroup.index.ftl │ │ ├── jobinfo │ │ └── jobinfo.index.ftl │ │ ├── joblog │ │ ├── joblog.detail.ftl │ │ └── joblog.index.ftl │ │ ├── login.ftl │ │ └── user │ │ └── user.index.ftl │ └── test │ └── java │ └── com │ └── jason │ └── demo │ └── xxljob │ └── admin │ └── XxlJobAdminApplicationTests.java └── xxl-job-excutor ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── jason │ │ └── demo │ │ └── xxljob │ │ └── excutor │ │ ├── XxlJobExcutorApplication.java │ │ ├── config │ │ └── XxlJobConfig.java │ │ └── jobhandler │ │ └── SampleXxlJob.java └── resources │ ├── application.properties │ └── logback.xml └── test └── java └── com └── jason └── demo └── xxljob └── excutor └── XxlJobExcutorApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### STS ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | .sts4-cache 14 | 15 | ### IntelliJ IDEA ### 16 | .idea 17 | *.iws 18 | *.iml 19 | *.ipr 20 | 21 | ### NetBeans ### 22 | /nbproject/private/ 23 | /nbbuild/ 24 | /dist/ 25 | /nbdist/ 26 | /.nb-gradle/ 27 | build/ 28 | !**/src/main/**/build/ 29 | !**/src/test/**/build/ 30 | 31 | ### VS Code ### 32 | .vscode/ 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # java技术栈全家桶 2 | springboot,dubbo,zookeeper,elasticsearch,feign,rabbitmq,redisson,shardingjdbc,seata 3 | ## csdn博客地址 https://blog.csdn.net/zhu719224032/article/details/107999106 4 | ## dubbo 5 | 参考: 6 | springboot+dubbo搭建: 7 | https://www.cnblogs.com/chy18883701161/p/12783892.html 8 | 9 | zookeeper安装: 10 | https://www.yuque.com/chaoyueshikong/project/nva9rl 11 | 本地启动服务: 12 | cd /usr/local/zookeeper 13 | ./bin/zkServer.sh start 14 | 15 | dubbbo调优: 16 | https://www.yuque.com/chaoyueshikong/project/wa0emg 17 | 18 | ## es 19 | 参考: 20 | https://www.jianshu.com/p/8fe4bc1c584d?utm_campaign=hugo 21 | https://developer.51cto.com/art/201904/594615.htm 22 | 反向索引又叫倒排索引,是根据文章内容中的关键字建立索引。 23 | 搜索引擎原理就是建立反向索引。 24 | Elasticsearch 在 Lucene 的基础上进行封装,实现了分布式搜索引擎。 25 | Elasticsearch 中的索引、类型和文档的概念比较重要,类似于 MySQL 中的数据库、表和行。 26 | Elasticsearch 也是 Master-slave 架构,也实现了数据的分片和备份。 27 | Elasticsearch 一个典型应用就是 ELK 日志分析系统。 28 | 29 | ## feign 30 | 参考: https://www.cnblogs.com/lushichao/p/12796408.html 31 | add 接口调用失败重试方案 2020-09-14 32 | 33 | 34 | ## rabbitmq 35 | 参考: https://www.jianshu.com/p/8fe4bc1c584d?utm_campaign=hugo 36 | 37 | ## redisson 38 | org.redisson.api.RedissonClient 39 | 40 | ## shardingjdbc 41 | 参考: https://blog.csdn.net/u010391342/article/details/89526366 42 | 43 | ## seata 44 | 参考: https://github.com/seata/seata 45 | 46 | ## xxl-job 47 | 参考: https://www.fangzhipeng.com/architecture/2020/06/13/xxljob-test.html 48 | 49 | 2 50 | -------------------------------------------------------------------------------- /chat/README.md: -------------------------------------------------------------------------------- 1 | 微信小程序匿名聊天后端demo 2 | 3 | springboot+websocket的简单整合 4 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/WebsocketApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WebsocketApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WebsocketApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.socket.server.standard.ServerEndpointExporter; 6 | 7 | @Configuration 8 | public class WebSocketConfig { 9 | @Bean 10 | public ServerEndpointExporter serverEndpointExporter(){ 11 | return new ServerEndpointExporter(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/controller/ChatController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat.controller; 2 | 3 | import com.jason.demo.chat.pojo.ChatResult; 4 | import com.jason.demo.chat.pojo.WxLoginResult; 5 | import com.jason.demo.chat.utils.FastJsonUtils; 6 | import com.jason.demo.chat.utils.HttpRequestUtil; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.io.IOException; 10 | import java.util.Random; 11 | 12 | @RestController 13 | @RequestMapping("chat") 14 | public class ChatController { 15 | 16 | private Integer count; 17 | private String SECRET = ""; 18 | private String APPID = ""; 19 | private String JS_CODE; 20 | @RequestMapping(value = "/random",method = RequestMethod.POST) 21 | public ChatResult randomChat(){ 22 | 23 | //用户随机分配聊天室 24 | Random random = new Random(); 25 | int i = random.nextInt(3); 26 | return new ChatResult(100,"分配成功",i); 27 | 28 | } 29 | @PostMapping("/login/{code}") 30 | public ChatResult auth(@PathVariable("code")String code){ 31 | WxLoginResult wxLoginResult = null; 32 | JS_CODE = code; 33 | String msg; 34 | String loginValidURL = "https://api.weixin.qq.com/sns/jscode2session?appid="+APPID+"&secret="+SECRET+"&js_code="+JS_CODE+"&grant_type=authorization_code"; 35 | try { 36 | wxLoginResult = FastJsonUtils.toBean(HttpRequestUtil.get(loginValidURL), WxLoginResult.class); 37 | } catch (IOException e) { 38 | e.printStackTrace(); 39 | } 40 | System.out.println(wxLoginResult.getOpenid()); 41 | return new ChatResult(200,"success",null); 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/pojo/ChatResult.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat.pojo; 2 | 3 | public class ChatResult { 4 | private Integer code; 5 | 6 | private String message; 7 | 8 | private Object data; 9 | 10 | public ChatResult(Integer code,String message,Object data){ 11 | this.code = code; 12 | this.message = message; 13 | this.data = data; 14 | } 15 | public Integer getCode() { 16 | return code; 17 | } 18 | 19 | public void setCode(Integer code) { 20 | this.code = code; 21 | } 22 | 23 | public String getMessage() { 24 | return message; 25 | } 26 | 27 | public void setMessage(String message) { 28 | this.message = message; 29 | } 30 | 31 | public Object getData() { 32 | return data; 33 | } 34 | 35 | public void setData(Object data) { 36 | this.data = data; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/pojo/Client2ServerMessage.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Client2ServerMessage { 6 | private String message; 7 | 8 | private Date sendDate; 9 | 10 | private Integer type; 11 | 12 | public String getMessage() { 13 | return message; 14 | } 15 | 16 | public void setMessage(String message) { 17 | this.message = message; 18 | } 19 | 20 | public Date getSendDate() { 21 | return sendDate; 22 | } 23 | 24 | public void setSendDate(Date sendDate) { 25 | this.sendDate = sendDate; 26 | } 27 | 28 | public Integer getType() { 29 | return type; 30 | } 31 | 32 | public void setType(Integer type) { 33 | this.type = type; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/pojo/Server2ClientMessage.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat.pojo; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | public class Server2ClientMessage { 7 | private static SimpleDateFormat time=new SimpleDateFormat("HH:mm:ss"); 8 | public Server2ClientMessage(String message,Date date,Integer type){ 9 | this.message = message; 10 | this.date = date; 11 | this.type = type; 12 | } 13 | private String message; 14 | 15 | private Date date; 16 | 17 | private Integer type; 18 | 19 | public String getMessage() { 20 | return message; 21 | } 22 | 23 | public void setMessage(String message) { 24 | this.message = message; 25 | } 26 | 27 | public String getDate() { 28 | return time.format(date); 29 | } 30 | 31 | public void setDate(Date date) { 32 | this.date = date; 33 | } 34 | 35 | public Integer getType() { 36 | return type; 37 | } 38 | 39 | public void setType(Integer type) { 40 | this.type = type; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/pojo/TestVO.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat.pojo; 2 | 3 | /** 4 | * @author: jason 5 | * @Date: 2020-10-12 6 | */ 7 | 8 | public class TestVO { 9 | private String fileId; 10 | private Integer order; 11 | 12 | public String getFileId() { 13 | return fileId; 14 | } 15 | 16 | public void setFileId(String fileId) { 17 | this.fileId = fileId; 18 | } 19 | 20 | public Integer getOrder() { 21 | return order; 22 | } 23 | 24 | public void setOrder(Integer order) { 25 | this.order = order; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /chat/src/main/java/com/jason/demo/chat/pojo/WxLoginResult.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat.pojo; 2 | 3 | public class WxLoginResult { 4 | 5 | 6 | private String openid; 7 | private String session_key; 8 | private String unionid; 9 | private int errcode; 10 | private String errmsg; 11 | 12 | public String getOpenid() { 13 | return openid; 14 | } 15 | 16 | public void setOpenid(String openid) { 17 | this.openid = openid; 18 | } 19 | 20 | public String getSession_key() { 21 | return session_key; 22 | } 23 | 24 | public void setSession_key(String session_key) { 25 | this.session_key = session_key; 26 | } 27 | 28 | public String getUnionid() { 29 | return unionid; 30 | } 31 | 32 | public void setUnionid(String unionid) { 33 | this.unionid = unionid; 34 | } 35 | 36 | public int getErrcode() { 37 | return errcode; 38 | } 39 | 40 | public void setErrcode(int errcode) { 41 | this.errcode = errcode; 42 | } 43 | 44 | public String getErrmsg() { 45 | return errmsg; 46 | } 47 | 48 | public void setErrmsg(String errmsg) { 49 | this.errmsg = errmsg; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /chat/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9000 3 | spring: 4 | application: 5 | name: chat 6 | -------------------------------------------------------------------------------- /chat/src/main/resources/templates/webSocket.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SpringBoot实现广播式WebSocket 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 | 17 |
18 | 19 | 36 | 37 | -------------------------------------------------------------------------------- /chat/src/main/resources/templates/webSocket2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SpringBoot实现广播式WebSocket 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 | 17 |
18 | 19 | 36 | 37 | -------------------------------------------------------------------------------- /chat/src/test/java/com/jason/demo/chat/WebsocketApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.chat; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class WebsocketApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /dubbo/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### STS ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | .sts4-cache 14 | 15 | ### IntelliJ IDEA ### 16 | .idea 17 | *.iws 18 | *.iml 19 | *.ipr 20 | 21 | ### NetBeans ### 22 | /nbproject/private/ 23 | /nbbuild/ 24 | /dist/ 25 | /nbdist/ 26 | /.nb-gradle/ 27 | build/ 28 | !**/src/main/**/build/ 29 | !**/src/test/**/build/ 30 | 31 | ### VS Code ### 32 | .vscode/ 33 | -------------------------------------------------------------------------------- /dubbo/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/dubbo/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/#build-image) 9 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications) 10 | 11 | ### Guides 12 | The following guides illustrate how to use some features concretely: 13 | 14 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 15 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 16 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 17 | 18 | ###参考 19 | springboot+dubbo搭建: 20 | https://www.cnblogs.com/chy18883701161/p/12783892.html 21 | 22 | zookeeper安装: 23 | https://www.yuque.com/chaoyueshikong/project/nva9rl 24 | 本地启动服务: 25 | cd /usr/local/zookeeper 26 | ./bin/zkServer.sh start 27 | 28 | dubbbo调优: 29 | https://www.yuque.com/chaoyueshikong/project/wa0emg -------------------------------------------------------------------------------- /dubbo/api/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo/api/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/dubbo/api/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo/api/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo/api/src/main/java/com/jason/demo/dubbo/api/DubboApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.api; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DubboApiApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DubboApiApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo/api/src/main/java/com/jason/demo/dubbo/api/model/User.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.api.model; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author: jason 10 | * @Date: 2020-08-11 11 | */ 12 | //注意:实体类要可序列化 13 | @Getter 14 | @Setter 15 | public class User implements Serializable { 16 | private Integer id; 17 | private String username; 18 | private String password; 19 | private String tel; 20 | private String address; 21 | } -------------------------------------------------------------------------------- /dubbo/api/src/main/java/com/jason/demo/dubbo/api/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.api.service; 2 | 3 | import com.jason.demo.dubbo.api.model.User; 4 | 5 | /** 6 | * @author: jason 7 | * @Date: 2020-08-11 8 | */ 9 | public interface UserService { 10 | User findUserById(Integer id); 11 | } -------------------------------------------------------------------------------- /dubbo/api/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dubbo/api/src/test/java/com/jason/demo/dubbo/api/DubboApiApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.api; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboApiApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo/consumer/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo/consumer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/dubbo/consumer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo/consumer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo/consumer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.jason.demo 7 | dubbo 8 | 0.0.1-SNAPSHOT 9 | 10 | com.jason.demo 11 | dubbo-consumer 12 | 0.0.1-SNAPSHOT 13 | dubbo-consumer 14 | Demo project for Spring Boot 15 | 16 | 17 | 1.8 18 | 19 | 20 | 21 | 22 | 23 | com.jason.demo 24 | dubbo-api 25 | 0.0.1-SNAPSHOT 26 | 27 | 28 | 29 | org.apache.dubbo 30 | dubbo-spring-boot-starter 31 | 2.7.5 32 | 33 | 34 | 35 | 36 | org.apache.dubbo 37 | dubbo-dependencies-zookeeper 38 | 2.7.5 39 | pom 40 | 41 | 42 | org.slf4j 43 | slf4j-log4j12 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | org.springframework.boot 54 | spring-boot-maven-plugin 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /dubbo/consumer/src/main/java/com/jason/demo/dubbo/consumer/DubboConsumerApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.consumer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DubboConsumerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DubboConsumerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo/consumer/src/main/java/com/jason/demo/dubbo/consumer/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.consumer.controller; 2 | 3 | import com.jason.demo.dubbo.api.model.User; 4 | import com.jason.demo.dubbo.api.service.UserService; 5 | import org.apache.dubbo.config.annotation.Reference; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * @author: jason 12 | * @Date: 2020-08-12 13 | */ 14 | @RestController 15 | public class OrderController { 16 | 17 | @Reference //注入要调用的服务 18 | private UserService userService; 19 | 20 | @GetMapping("/user/{id}") 21 | public User getUser(@PathVariable Integer id) { 22 | //调用服务 23 | User user = userService.findUserById(id); 24 | return user; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /dubbo/consumer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #应用名称 2 | spring.application.name=dubbo-consumer 3 | #dubbo.application.name=dubbo-consumer 4 | server.port=7001 5 | 6 | #注册中心地址 7 | dubbo.registry.address=zookeeper://127.0.0.1:2181 8 | #dubbo.registry.port=2181 9 | 10 | #协议、端口 11 | dubbo.protocol.name=dubbo 12 | dubbo.protocol.port=20880 13 | 14 | #连接zk的超时时间,ms 15 | dubbo.registry.timeout=10000 16 | 17 | #启动应用时是否检查注册中心上有没有依赖的服务,默认true;缺省dubbo.consumer.check配置时,默认为true,要检查。 18 | #消费者连接注册中心时,会订阅要调用的服务,如果提供该服务的服务器一台都没有,会报错,这个消费者无法启动,这样在消费者启动时就能检查到是否有可用的生产者,提前发现问题。 19 | #调试时,如果先启动消费者,后启动|未启动生产者,消费者往往启动不了,报错:创建不了xxx bean,因为 Injection of @Reference dependencies is failed ,没有生产者提供该服务。 20 | # 设置为false,消费者启动时不检查,就算没有生产者提供该服务,消费者也能正常启动,只是调用该服务时会出错。 21 | #dubbo.consumer.check=false 22 | -------------------------------------------------------------------------------- /dubbo/consumer/src/test/java/com/jason/demo/dubbo/consumer/DubboConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.consumer; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboConsumerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo/server/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo/server/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/dubbo/server/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo/server/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo/server/src/main/java/com/jason/demo/dubbo/server/DubboServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.server; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | // @EnableDubbo //会扫描所有的包,从中找出dubbo的@Service标注的类 8 | // @DubboComponentScan(basePackages = "com.chy.user-service.service") //只扫描指定的包 9 | public class DubboServerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(DubboServerApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dubbo/server/src/main/java/com/jason/demo/dubbo/server/service/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.server.service; 2 | 3 | import com.jason.demo.dubbo.api.model.User; 4 | import com.jason.demo.dubbo.api.service.UserService; 5 | import org.apache.dubbo.config.annotation.Service; 6 | 7 | /** 8 | * @author: jason 9 | * @Date: 2020-08-12 10 | */ 11 | @Service 12 | public class UserServiceImpl implements UserService { 13 | @Override 14 | public User findUserById(Integer id) { 15 | User user = new User(); 16 | user.setId(id); 17 | user.setUsername("chy"); 18 | return user; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dubbo/server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | spring.application.name=dubbo-server 3 | #如果指定了spring应用名称,可以缺省dubbo的应用名称,这2个至少要配置1个。缺省dubbo的应用名称时默认值是spring的应用名称 4 | #dubbo.application.name=dubbo-server 5 | 6 | #注册中心地址 7 | dubbo.registry.address=zookeeper://127.0.0.1:2181 8 | #端口号可以写在address中,也可以单独写。实质是从address中获取的port是null,后面设置的port覆盖了null 9 | #dubbo.registry.port=2181 10 | 11 | #指定dubbo使用的协议、端口 12 | dubbo.protocol.name=dubbo 13 | dubbo.protocol.port=20880 14 | 15 | #指定注册到zk上超时时间,ms 16 | dubbo.registry.timeout=10000 17 | 18 | #指定实现服务(提供服务)的包 19 | dubbo.scan.base-packages=com.jason.demo.dubbo.server.service -------------------------------------------------------------------------------- /dubbo/server/src/test/java/com/jason/demo/dubbo/server/DubboServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.dubbo.server; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboServerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /es/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### STS ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | .sts4-cache 14 | 15 | ### IntelliJ IDEA ### 16 | .idea 17 | *.iws 18 | *.iml 19 | *.ipr 20 | 21 | ### NetBeans ### 22 | /nbproject/private/ 23 | /nbbuild/ 24 | /dist/ 25 | /nbdist/ 26 | /.nb-gradle/ 27 | build/ 28 | !**/src/main/**/build/ 29 | !**/src/test/**/build/ 30 | 31 | ### VS Code ### 32 | .vscode/ 33 | -------------------------------------------------------------------------------- /es/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/es/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /es/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /es/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/#build-image) 9 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications) 10 | 11 | ### Guides 12 | The following guides illustrate how to use some features concretely: 13 | 14 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 15 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 16 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 17 | 18 | ###参考: 19 | https://www.jianshu.com/p/8fe4bc1c584d?utm_campaign=hugo 20 | https://developer.51cto.com/art/201904/594615.htm 21 | 22 | 反向索引又叫倒排索引,是根据文章内容中的关键字建立索引。 23 | 搜索引擎原理就是建立反向索引。 24 | Elasticsearch 在 Lucene 的基础上进行封装,实现了分布式搜索引擎。 25 | Elasticsearch 中的索引、类型和文档的概念比较重要,类似于 MySQL 中的数据库、表和行。 26 | Elasticsearch 也是 Master-slave 架构,也实现了数据的分片和备份。 27 | Elasticsearch 一个典型应用就是 ELK 日志分析系统。 -------------------------------------------------------------------------------- /es/src/main/java/com/jason/demo/es/DemoEsApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.es; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoEsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoEsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /es/src/main/java/com/jason/demo/es/controller/ElasticController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.es.controller; 2 | 3 | import com.jason.demo.es.model.Release; 4 | import com.jason.demo.es.service.IElasticService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Iterator; 12 | import java.util.List; 13 | 14 | /** 15 | * @author: jason 16 | * @Date: 2020-08-03 17 | */ 18 | @RestController 19 | @RequestMapping("/elastic") 20 | public class ElasticController { 21 | 22 | @Autowired 23 | private IElasticService elasticService; 24 | 25 | @GetMapping("/init") 26 | public void init() { 27 | elasticService.createIndex(); 28 | List list = new ArrayList<>(); 29 | list.add(Release.builder().id(1L).contentText("niahoasadasd").build()); 30 | list.add(Release.builder().id(2L).contentText("那就飒飒").build()); 31 | list.add(Release.builder().id(3L).contentText("打打瞌睡但是但是多").build()); 32 | elasticService.saveAll(list); 33 | 34 | } 35 | 36 | @GetMapping("/all") 37 | public Iterator all() { 38 | return elasticService.findAll(); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /es/src/main/java/com/jason/demo/es/model/Release.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.es.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.springframework.data.elasticsearch.annotations.Document; 8 | import org.springframework.data.elasticsearch.annotations.Field; 9 | import org.springframework.data.elasticsearch.annotations.FieldType; 10 | 11 | import java.util.Date; 12 | 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @Builder 16 | @Data 17 | @Document(indexName = "jason-es", type = "release2", shards = 1, replicas = 0) 18 | public class Release { 19 | 20 | private Long id; 21 | 22 | private Long creatorId; 23 | 24 | private Long topicTypeId; 25 | 26 | private Date createTime; 27 | 28 | private Byte status; 29 | 30 | /** 31 | * 文件顺序数据,以json数组格式保存,[{"fileId":1,"order":1},{"fileId":2,"order":2}] 32 | */ 33 | private String fileIdOrders; 34 | 35 | @Field(type = FieldType.Text) 36 | private String contentText; 37 | 38 | private Integer likes; 39 | 40 | private Integer reviews; 41 | 42 | private Integer schoolId; 43 | 44 | /** 45 | * 上传视频时返回的traceId 46 | */ 47 | private String traceId; 48 | 49 | public Release(Long id, Integer likes) { 50 | this.id = id; 51 | this.likes = likes; 52 | } 53 | } -------------------------------------------------------------------------------- /es/src/main/java/com/jason/demo/es/repository/ElasticRepository.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.es.repository; 2 | 3 | import com.jason.demo.es.model.Release; 4 | import org.springframework.data.domain.Page; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 7 | 8 | /** 9 | * @author: jason 10 | * @Date: 2020-08-03 11 | */ 12 | public interface ElasticRepository extends ElasticsearchRepository { 13 | //默认的注释 14 | Page findByContentText(String contentText, Pageable pageable); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /es/src/main/java/com/jason/demo/es/service/IElasticService.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.es.service; 2 | 3 | import com.jason.demo.es.model.Release; 4 | import org.springframework.data.domain.Page; 5 | 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | /** 10 | * @author: jason 11 | * @Date: 2020-08-03 12 | */ 13 | public interface IElasticService { 14 | void createIndex(); 15 | 16 | void deleteIndex(String index); 17 | 18 | void save(Release docBean); 19 | 20 | void saveAll(List list); 21 | 22 | Iterator findAll(); 23 | 24 | Page findByContentText(String contentText); 25 | 26 | Page query(String key); 27 | } 28 | -------------------------------------------------------------------------------- /es/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | #elasticsearch 2 | spring: 3 | elasticsearch: 4 | rest: 5 | uris: "http://localhost:9200 -------------------------------------------------------------------------------- /es/src/test/java/com/jason/demo/es/DemoEsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.es; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DemoEsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /feign/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### STS ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | .sts4-cache 14 | 15 | ### IntelliJ IDEA ### 16 | .idea 17 | *.iws 18 | *.iml 19 | *.ipr 20 | 21 | ### NetBeans ### 22 | /nbproject/private/ 23 | /nbbuild/ 24 | /dist/ 25 | /nbdist/ 26 | /.nb-gradle/ 27 | build/ 28 | !**/src/main/**/build/ 29 | !**/src/test/**/build/ 30 | 31 | ### VS Code ### 32 | .vscode/ 33 | -------------------------------------------------------------------------------- /feign/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/feign/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /feign/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /feign/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/#build-image) 9 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications) 10 | * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/htmlsingle/#using-boot-devtools) 11 | 12 | ### Guides 13 | The following guides illustrate how to use some features concretely: 14 | 15 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 16 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 17 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 18 | 19 | ###参考 20 | https://www.cnblogs.com/lushichao/p/12796408.html -------------------------------------------------------------------------------- /feign/src/main/java/com/jason/demo/http/DemoHttpApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.openfeign.EnableFeignClients; 6 | 7 | @SpringBootApplication 8 | @EnableFeignClients 9 | public class DemoHttpApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(DemoHttpApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /feign/src/main/java/com/jason/demo/http/annotation/RetryProcess.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http.annotation; 2 | 3 | /** 4 | * @author: jason 5 | * @Date: 2020-09-14 6 | */ 7 | 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.lang.annotation.*; 11 | 12 | @Target({ElementType.METHOD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | @Component 16 | public @interface RetryProcess { 17 | //重试的次数 18 | int value() default 1; 19 | } 20 | -------------------------------------------------------------------------------- /feign/src/main/java/com/jason/demo/http/aspect/AspectExceptionInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http.aspect; 2 | 3 | import com.jason.demo.http.annotation.RetryProcess; 4 | import org.aspectj.lang.JoinPoint; 5 | import org.aspectj.lang.annotation.AfterThrowing; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.reflect.MethodSignature; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.concurrent.atomic.AtomicInteger; 14 | 15 | /** 16 | * @author: jason 17 | * @Date: 2020-09-14 18 | */ 19 | @Aspect 20 | @Component 21 | public class AspectExceptionInterceptor { 22 | private final Logger logger = LoggerFactory.getLogger(this.getClass()); 23 | private AtomicInteger atomicInteger = new AtomicInteger(0); 24 | 25 | @AfterThrowing(pointcut = ("execution(* com.jason.demo.http..*(..)) && @annotation(com.jason.demo.http.annotation.RetryProcess)")) 26 | public void tryAgain(JoinPoint point) { 27 | try { 28 | MethodSignature methodSignature = (MethodSignature)point.getSignature(); 29 | RetryProcess retryProcess = methodSignature.getMethod().getAnnotation(RetryProcess.class); 30 | 31 | if (atomicInteger.intValue() < retryProcess.value()) { 32 | int i = atomicInteger.incrementAndGet(); 33 | 34 | // 阻塞i秒后再进行重试,如果网络问题立即重试失败几率非常大所以建议阻塞一下再试 35 | Thread.sleep(1000 * i); 36 | 37 | logger.info("开始重试第" + i + "次"); 38 | MethodInvocationProceedingJoinPoint methodPoint = ((MethodInvocationProceedingJoinPoint)point); 39 | // 再次调用方法 40 | methodPoint.proceed(); 41 | } 42 | } catch (Throwable throwable) { 43 | // 捕获到异常后再次重试 44 | tryAgain(point); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /feign/src/main/java/com/jason/demo/http/client/TestClient.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http.client; 2 | 3 | import com.jason.demo.http.model.req.LoginUserReq; 4 | import org.springframework.cloud.openfeign.FeignClient; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | 10 | @FeignClient(name = "test-xnxw", path = "/", url = "http://localhost:8080") 11 | public interface TestClient { 12 | 13 | @GetMapping("/xnxw/release/detail/{id}") 14 | String get(@PathVariable Long id); 15 | 16 | @PostMapping("/xnxw/admin/login") 17 | String post(@RequestBody LoginUserReq req); 18 | 19 | } -------------------------------------------------------------------------------- /feign/src/main/java/com/jason/demo/http/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http.controller; 2 | 3 | import com.jason.demo.http.annotation.RetryProcess; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | /** 9 | * @author: jason 10 | * @Date: 2020-09-14 11 | */ 12 | @RestController 13 | @RequestMapping("/") 14 | public class TestController { 15 | 16 | @RetryProcess(value = 3) 17 | @PostMapping("/testException") 18 | public void testException() throws Exception { 19 | // 这里为了方便测试手动抛一个异常,实际此处应该是调用接口逻辑 20 | throw new RuntimeException("测试重试异常"); 21 | } 22 | 23 | @RetryProcess(value = 2) 24 | @PostMapping("/testException2") 25 | public void testException2() throws Exception { 26 | // 这里为了方便测试手动抛一个异常,实际此处应该是调用接口逻辑 27 | test(); 28 | } 29 | 30 | private void test() throws Exception { 31 | // 这里为了方便测试手动抛一个异常,实际此处应该是调用接口逻辑 32 | throw new RuntimeException("测试重试异常2"); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /feign/src/main/java/com/jason/demo/http/model/req/LoginUserReq.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http.model.req; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | /** 9 | * @author: jason 10 | * @Date: 2020-08-06 11 | */ 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @Builder 16 | public class LoginUserReq { 17 | private String username; 18 | private String password; 19 | } 20 | -------------------------------------------------------------------------------- /feign/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=7071 2 | -------------------------------------------------------------------------------- /feign/src/test/java/com/jason/demo/http/DemoHttpApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DemoHttpApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /feign/src/test/java/com/jason/demo/http/client/TestClientTest.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http.client; 2 | 3 | import com.jason.demo.http.model.req.LoginUserReq; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | /** 12 | * @author: jason 13 | * @Date: 2020-08-06 14 | */ 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest 17 | @Slf4j 18 | public class TestClientTest { 19 | @Autowired 20 | private TestClient testClient; 21 | 22 | @Test 23 | public void testGet() { 24 | System.out.println("result:" + testClient.get(437L)); 25 | } 26 | 27 | @Test 28 | public void testPost() { 29 | LoginUserReq req = LoginUserReq.builder().username("xnxw_2020@").password("tunshuo_2020@").build(); 30 | System.out.println("result:" + testClient.post(req)); 31 | } 32 | 33 | @Test 34 | public void testGetPost() { 35 | testGet(); 36 | testPost(); 37 | } 38 | } -------------------------------------------------------------------------------- /feign/src/test/java/com/jason/demo/http/client/TestRetryProcess.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.http.client; 2 | 3 | /** 4 | * @author: jason 5 | * @Date: 2020-09-14 6 | */ 7 | public class TestRetryProcess { 8 | } 9 | -------------------------------------------------------------------------------- /rabbitmq/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### STS ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | .sts4-cache 14 | 15 | ### IntelliJ IDEA ### 16 | .idea 17 | *.iws 18 | *.iml 19 | *.ipr 20 | 21 | ### NetBeans ### 22 | /nbproject/private/ 23 | /nbbuild/ 24 | /dist/ 25 | /nbdist/ 26 | /.nb-gradle/ 27 | build/ 28 | !**/src/main/**/build/ 29 | !**/src/test/**/build/ 30 | 31 | ### VS Code ### 32 | .vscode/ 33 | -------------------------------------------------------------------------------- /rabbitmq/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/rabbitmq/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /rabbitmq/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /rabbitmq/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/maven-plugin/reference/html/#build-image) 9 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications) 10 | * [Spring for RabbitMQ](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/htmlsingle/#boot-features-amqp) 11 | * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/htmlsingle/#using-boot-devtools) 12 | 13 | ### Guides 14 | The following guides illustrate how to use some features concretely: 15 | 16 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 17 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 18 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 19 | * [Messaging with RabbitMQ](https://spring.io/guides/gs/messaging-rabbitmq/) 20 | 21 | ###参考: https://www.jianshu.com/p/8fe4bc1c584d?utm_campaign=hugo -------------------------------------------------------------------------------- /rabbitmq/src/main/java/com/jason/demo/rabbitmq/DemoRabbitmqApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.rabbitmq; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoRabbitmqApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoRabbitmqApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /rabbitmq/src/main/java/com/jason/demo/rabbitmq/mq/MsgProducer.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.rabbitmq.mq; 2 | 3 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * 类功能描述:
9 | *
    10 | *
  • 类功能描述1
    11 | *
  • 类功能描述2
    12 | *
  • 类功能描述3
    13 | *
14 | * 修改记录:
15 | *
    16 | *
  • 修改记录描述1
    17 | *
  • 修改记录描述2
    18 | *
  • 修改记录描述3
    19 | *
20 | * 21 | * @author xuefl 22 | * @version 5.0 since 2020-01-02 23 | */ 24 | @Component 25 | public class MsgProducer { 26 | 27 | @Autowired 28 | private RabbitTemplate rabbitTemplate; 29 | 30 | public void send2FanoutTestQueue(String massage) { 31 | rabbitTemplate.convertAndSend(RabbitConfig.TEST_FANOUT_EXCHANGE, 32 | "", massage); 33 | } 34 | 35 | public void send2DirectTestQueue(String massage) { 36 | rabbitTemplate.convertAndSend(RabbitConfig.TEST_DIRECT_EXCHANGE, 37 | RabbitConfig.DIRECT_ROUTINGKEY, massage); 38 | } 39 | 40 | public void send2TopicTestAQueue(String massage) { 41 | rabbitTemplate.convertAndSend(RabbitConfig.TEST_TOPIC_EXCHANGE, 42 | "test.aaa", massage); 43 | } 44 | 45 | public void send2TopicTestBQueue(String massage) { 46 | rabbitTemplate.convertAndSend(RabbitConfig.TEST_TOPIC_EXCHANGE, 47 | "test.bbb", massage); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /rabbitmq/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | #... 3 | rabbitmq: 4 | host: 127.0.0.1 5 | port: 5672 6 | username: guest 7 | password: guest 8 | -------------------------------------------------------------------------------- /rabbitmq/src/test/java/com/jason/demo/rabbitmq/DemoRabbitmqApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.rabbitmq; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DemoRabbitmqApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /redisson/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /redisson/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/redisson/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /redisson/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /redisson/src/main/java/com/jason/demo/redisson/RedissonApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.redisson; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class RedissonApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(RedissonApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /redisson/src/main/java/com/jason/demo/redisson/config/RedissonConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.redisson.config; 2 | 3 | import org.redisson.Redisson; 4 | import org.redisson.api.RedissonClient; 5 | import org.redisson.config.Config; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | @Configuration 11 | public class RedissonConfig { 12 | 13 | @Value("${spring.redis.host}") 14 | private String host; 15 | 16 | @Value("${spring.redis.port}") 17 | private String port; 18 | 19 | @Value("${spring.redis.password}") 20 | private String password; 21 | 22 | @Bean 23 | public RedissonClient redissonClient() { 24 | Config config = new Config(); 25 | config.useSingleServer().setAddress("redis://" + host + ":" + port).setPassword(password); 26 | return Redisson.create(config); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /redisson/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=7002 2 | # redis 3 | spring.redis.host=localhost 4 | spring.redis.port=6379 5 | spring.redis.password=Dtip7gQsnx6j 6 | spring.redis.jedis.pool.max-idle=32 7 | spring.redis.jedis.pool.max-wait=-1 8 | spring.redis.jedis.pool.min-idle=0 9 | spring.redis.timeout=0 -------------------------------------------------------------------------------- /redisson/src/test/java/com/jason/demo/redisson/RedissonApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.redisson; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class RedissonApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /seata/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/seata/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /seata/account-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /seata/account-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/seata/account-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata/account-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /seata/account-service/src/main/java/com/jason/demo/seata/account/SeataAccountServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | @SpringBootApplication(scanBasePackages = "com.jason.demo.seata", exclude = DataSourceAutoConfiguration.class) 8 | public class SeataAccountServiceApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(SeataAccountServiceApplication.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /seata/account-service/src/main/java/com/jason/demo/seata/account/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.apache.ibatis.session.SqlSessionFactory; 5 | import org.mybatis.spring.SqlSessionFactoryBean; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 10 | 11 | import javax.sql.DataSource; 12 | 13 | @Configuration 14 | public class DataSourceConfig { 15 | 16 | @Bean 17 | @ConfigurationProperties(prefix = "spring.datasource") 18 | public DataSource druidDataSource() { 19 | DruidDataSource druidDataSource = new DruidDataSource(); 20 | return druidDataSource; 21 | } 22 | 23 | @Bean 24 | public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { 25 | SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); 26 | factoryBean.setDataSource(dataSource); 27 | factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver() 28 | .getResources("classpath*:/mapper/*.xml")); 29 | return factoryBean.getObject(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /seata/account-service/src/main/java/com/jason/demo/seata/account/config/RestTemplateConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.client.RestTemplate; 6 | 7 | @Configuration 8 | public class RestTemplateConfig { 9 | 10 | @Bean 11 | public RestTemplate restTemplate() { 12 | RestTemplate restTemplate = new RestTemplate(); 13 | return restTemplate; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /seata/account-service/src/main/java/com/jason/demo/seata/account/controller/AccountController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account.controller; 2 | 3 | import com.jason.demo.seata.account.service.AccountService; 4 | import io.seata.core.context.RootContext; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.math.BigDecimal; 11 | 12 | @RestController 13 | public class AccountController { 14 | 15 | @Autowired 16 | AccountService accountService; 17 | 18 | @GetMapping 19 | public void debit(@RequestParam String userId, @RequestParam BigDecimal orderMoney) { 20 | System.out.println("account XID " + RootContext.getXID()); 21 | accountService.debit(userId, orderMoney); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /seata/account-service/src/main/java/com/jason/demo/seata/account/persistence/Account.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account.persistence; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigDecimal; 6 | 7 | @Data 8 | public class Account { 9 | private Integer id; 10 | 11 | private String userId; 12 | 13 | private BigDecimal money; 14 | 15 | } -------------------------------------------------------------------------------- /seata/account-service/src/main/java/com/jason/demo/seata/account/persistence/AccountMapper.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account.persistence; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | @Mapper 7 | public interface AccountMapper { 8 | 9 | Account selectByUserId(@Param("userId") String userId); 10 | 11 | int updateById(Account record); 12 | 13 | } -------------------------------------------------------------------------------- /seata/account-service/src/main/java/com/jason/demo/seata/account/service/AccountService.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account.service; 2 | 3 | import com.jason.demo.seata.account.persistence.Account; 4 | import com.jason.demo.seata.account.persistence.AccountMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.math.BigDecimal; 9 | 10 | @Service 11 | public class AccountService { 12 | 13 | private static final String ERROR_USER_ID = "1002"; 14 | 15 | @Autowired 16 | private AccountMapper accountMapper; 17 | 18 | public void debit(String userId, BigDecimal num) { 19 | Account account = accountMapper.selectByUserId(userId); 20 | account.setMoney(account.getMoney().subtract(num)); 21 | accountMapper.updateById(account); 22 | 23 | if (ERROR_USER_ID.equals(userId)) { 24 | throw new RuntimeException("account branch exception"); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /seata/account-service/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | utf-8 8 | %date %(${LOG_LEVEL_PATTERN:-%5p}) [%thread] %logger{36} [%file : %line] %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /seata/account-service/src/main/resources/mapper/AccountMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | update account_tbl 17 | set money = #{money,jdbcType=DECIMAL} 18 | where id = #{id} 19 | 20 | 21 | -------------------------------------------------------------------------------- /seata/account-service/src/test/java/com/jason/demo/seata/account/SeataAccountServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.account; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataAccountServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata/business-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /seata/business-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/seata/business-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata/business-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /seata/business-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.jason.demo 7 | seata 8 | 0.0.1-SNAPSHOT 9 | 10 | com.jason.demo 11 | seata-business-service 12 | 0.0.1-SNAPSHOT 13 | seata-business-service 14 | Demo project for Spring Boot 15 | 16 | 17 | 1.8 18 | 19 | 20 | 21 | 22 | 23 | com.jason.demo 24 | seata-common-service 25 | 0.0.1-SNAPSHOT 26 | 27 | 28 | 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-maven-plugin 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /seata/business-service/src/main/java/com/jason/demo/seata/business/SeataBusinessServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.business; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; 7 | 8 | @SpringBootApplication(scanBasePackages = "com.jason.demo.seata", 9 | exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class}) 10 | public class SeataBusinessServiceApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(SeataBusinessServiceApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /seata/business-service/src/main/java/com/jason/demo/seata/business/client/OrderClient.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.business.client; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @Slf4j 9 | @Component 10 | public class OrderClient { 11 | 12 | @Autowired 13 | private RestTemplate restTemplate; 14 | 15 | public void create(String userId, String commodityCode, int orderCount) { 16 | String url = "http://127.0.0.1:8082/api/order/debit?userId=" + userId + "&commodityCode=" + commodityCode + "&count=" + orderCount; 17 | try { 18 | restTemplate.getForEntity(url, Void.class); 19 | } catch (Exception e) { 20 | log.error("create url {} ,error:", url); 21 | throw new RuntimeException(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /seata/business-service/src/main/java/com/jason/demo/seata/business/client/StorageClient.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.business.client; 2 | 3 | import io.seata.core.context.RootContext; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | @Slf4j 10 | @Component 11 | public class StorageClient { 12 | 13 | @Autowired 14 | private RestTemplate restTemplate; 15 | 16 | public void deduct(String commodityCode, int orderCount) { 17 | System.out.println("business to storage " + RootContext.getXID()); 18 | String url = "http://127.0.0.1:8081/api/storage/deduct?commodityCode=" + commodityCode + "&count=" + orderCount; 19 | try { 20 | restTemplate.getForEntity(url, Void.class); 21 | } catch (Exception e) { 22 | log.error("deduct url {} ,error:", url, e); 23 | throw new RuntimeException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /seata/business-service/src/main/java/com/jason/demo/seata/business/config/RestTemplateConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.business.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.client.RestTemplate; 6 | 7 | @Configuration 8 | public class RestTemplateConfig { 9 | 10 | @Bean 11 | public RestTemplate restTemplate() { 12 | RestTemplate restTemplate = new RestTemplate(); 13 | return restTemplate; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /seata/business-service/src/main/java/com/jason/demo/seata/business/controller/BusinessController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.business.controller; 2 | 3 | import com.jason.demo.seata.business.service.BusinessService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | @RequestMapping("/api/business") 11 | @RestController 12 | public class BusinessController { 13 | 14 | @Autowired 15 | private BusinessService businessService; 16 | 17 | /** 18 | * 购买下单,模拟全局事务提交 19 | * 20 | * @return 21 | */ 22 | @RequestMapping("/purchase/commit") 23 | public Boolean purchaseCommit(HttpServletRequest request) { 24 | businessService.purchase("1001", "2001", 1); 25 | return true; 26 | } 27 | 28 | /** 29 | * 购买下单,模拟全局事务回滚 30 | * 31 | * @return 32 | */ 33 | @RequestMapping("/purchase/rollback") 34 | public Boolean purchaseRollback() { 35 | try { 36 | businessService.purchase("1002", "2001", 1); 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | return false; 40 | } 41 | 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /seata/business-service/src/main/java/com/jason/demo/seata/business/service/BusinessService.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.business.service; 2 | 3 | import com.jason.demo.seata.business.client.OrderClient; 4 | import com.jason.demo.seata.business.client.StorageClient; 5 | import io.seata.core.context.RootContext; 6 | import io.seata.spring.annotation.GlobalTransactional; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | @Service 13 | public class BusinessService { 14 | 15 | private static final Logger LOGGER = LoggerFactory.getLogger(BusinessService.class); 16 | 17 | @Autowired 18 | private StorageClient storageClient; 19 | @Autowired 20 | private OrderClient orderClient; 21 | 22 | /** 23 | * 减库存,下订单 24 | * 25 | * @param userId 26 | * @param commodityCode 27 | * @param orderCount 28 | */ 29 | @GlobalTransactional 30 | public void purchase(String userId, String commodityCode, int orderCount) { 31 | LOGGER.info("purchase begin ... xid: " + RootContext.getXID()); 32 | storageClient.deduct(commodityCode, orderCount); 33 | orderClient.create(userId, commodityCode, orderCount); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /seata/business-service/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | utf-8 8 | %date %(${LOG_LEVEL_PATTERN:-%5p}) [%thread] %logger{36} [%file : %line] %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /seata/business-service/src/test/java/com/jason/demo/seata/business/SeataBusinessServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.business; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataBusinessServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata/common-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /seata/common-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/seata/common-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata/common-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /seata/common-service/src/main/java/com/jason/demo/seata/common/SeataCommonServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.common; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | @SpringBootApplication(scanBasePackages = "com.jason.demo.seata", exclude = DataSourceAutoConfiguration.class) 8 | public class SeataCommonServiceApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(SeataCommonServiceApplication.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /seata/common-service/src/main/java/com/jason/demo/seata/common/SeataProperties.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.common; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | @ConfigurationProperties("spring.cloud.alibaba.seata") 6 | public class SeataProperties { 7 | private String txServiceGroup; 8 | 9 | public SeataProperties() { 10 | } 11 | 12 | public String getTxServiceGroup() { 13 | return this.txServiceGroup; 14 | } 15 | 16 | public void setTxServiceGroup(String txServiceGroup) { 17 | this.txServiceGroup = txServiceGroup; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /seata/common-service/src/main/java/com/jason/demo/seata/common/config/SeataRestTemplateAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.common.config; 2 | 3 | import com.jason.demo.seata.common.interceptor.SeataRestTemplateInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.http.client.ClientHttpRequestInterceptor; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | import javax.annotation.PostConstruct; 11 | import java.util.ArrayList; 12 | import java.util.Collection; 13 | import java.util.Iterator; 14 | import java.util.List; 15 | 16 | @Configuration 17 | public class SeataRestTemplateAutoConfiguration { 18 | @Autowired( 19 | required = false 20 | ) 21 | private Collection restTemplates; 22 | @Autowired 23 | private SeataRestTemplateInterceptor seataRestTemplateInterceptor; 24 | 25 | public SeataRestTemplateAutoConfiguration() { 26 | } 27 | 28 | @Bean 29 | public SeataRestTemplateInterceptor seataRestTemplateInterceptor() { 30 | return new SeataRestTemplateInterceptor(); 31 | } 32 | 33 | @PostConstruct 34 | public void init() { 35 | if (this.restTemplates != null) { 36 | Iterator var1 = this.restTemplates.iterator(); 37 | 38 | while (var1.hasNext()) { 39 | RestTemplate restTemplate = (RestTemplate)var1.next(); 40 | List interceptors = new ArrayList(restTemplate.getInterceptors()); 41 | interceptors.add(this.seataRestTemplateInterceptor); 42 | restTemplate.setInterceptors(interceptors); 43 | } 44 | } 45 | 46 | } 47 | } -------------------------------------------------------------------------------- /seata/common-service/src/main/java/com/jason/demo/seata/common/filter/SeataFilter.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.common.filter; 2 | 3 | import io.seata.core.context.RootContext; 4 | import org.apache.commons.lang.StringUtils; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.servlet.*; 8 | import javax.servlet.http.HttpServletRequest; 9 | import java.io.IOException; 10 | 11 | @Component 12 | public class SeataFilter implements Filter { 13 | @Override 14 | public void init(FilterConfig filterConfig) throws ServletException { 15 | } 16 | 17 | @Override 18 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 19 | HttpServletRequest req = (HttpServletRequest) servletRequest; 20 | String xid = req.getHeader(RootContext.KEY_XID.toLowerCase()); 21 | boolean isBind = false; 22 | if (StringUtils.isNotBlank(xid)) { 23 | RootContext.bind(xid); 24 | isBind = true; 25 | } 26 | try { 27 | filterChain.doFilter(servletRequest, servletResponse); 28 | } finally { 29 | if (isBind) { 30 | RootContext.unbind(); 31 | } 32 | } 33 | } 34 | 35 | @Override 36 | public void destroy() { 37 | } 38 | } -------------------------------------------------------------------------------- /seata/common-service/src/main/java/com/jason/demo/seata/common/interceptor/SeataRestTemplateInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.common.interceptor; 2 | 3 | import io.seata.core.context.RootContext; 4 | import org.apache.commons.lang.StringUtils; 5 | import org.springframework.http.HttpRequest; 6 | import org.springframework.http.client.ClientHttpRequestExecution; 7 | import org.springframework.http.client.ClientHttpRequestInterceptor; 8 | import org.springframework.http.client.ClientHttpResponse; 9 | import org.springframework.http.client.support.HttpRequestWrapper; 10 | 11 | import java.io.IOException; 12 | 13 | public class SeataRestTemplateInterceptor implements ClientHttpRequestInterceptor { 14 | public SeataRestTemplateInterceptor() { 15 | } 16 | 17 | public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution) throws IOException { 18 | HttpRequestWrapper requestWrapper = new HttpRequestWrapper(httpRequest); 19 | String xid = RootContext.getXID(); 20 | if (StringUtils.isNotEmpty(xid)) { 21 | requestWrapper.getHeaders().add(RootContext.KEY_XID, xid); 22 | } 23 | 24 | return clientHttpRequestExecution.execute(requestWrapper, bytes); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /seata/common-service/src/test/java/com/jason/demo/seata/common/SeataCommonServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.common; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataCommonServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata/order-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /seata/order-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/seata/order-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata/order-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/SeataOrderServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | @SpringBootApplication(scanBasePackages = "com.jason.demo.seata", exclude = DataSourceAutoConfiguration.class) 8 | public class SeataOrderServiceApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(SeataOrderServiceApplication.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/client/AccountClient.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order.client; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | import java.math.BigDecimal; 9 | 10 | @Slf4j 11 | @Component 12 | public class AccountClient { 13 | 14 | @Autowired 15 | private RestTemplate restTemplate; 16 | 17 | public void debit(String userId, BigDecimal orderMoney) { 18 | String url = "http://127.0.0.1:8083?userId=" + userId + "&orderMoney=" + orderMoney; 19 | try { 20 | restTemplate.getForEntity(url, Void.class); 21 | } catch (Exception e) { 22 | log.error("debit url {} ,error:", url, e); 23 | throw new RuntimeException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.apache.ibatis.session.SqlSessionFactory; 5 | import org.mybatis.spring.SqlSessionFactoryBean; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 10 | 11 | import javax.sql.DataSource; 12 | 13 | @Configuration 14 | public class DataSourceConfig { 15 | 16 | @Bean 17 | @ConfigurationProperties(prefix = "spring.datasource") 18 | public DataSource druidDataSource() { 19 | DruidDataSource druidDataSource = new DruidDataSource(); 20 | return druidDataSource; 21 | } 22 | 23 | @Bean 24 | public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { 25 | SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); 26 | factoryBean.setDataSource(dataSource); 27 | factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver() 28 | .getResources("classpath*:/mapper/*.xml")); 29 | return factoryBean.getObject(); 30 | } 31 | } -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/config/RestTemplateConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.client.RestTemplate; 6 | 7 | @Configuration 8 | public class RestTemplateConfig { 9 | 10 | @Bean 11 | public RestTemplate restTemplate() { 12 | RestTemplate restTemplate = new RestTemplate(); 13 | return restTemplate; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order.controller; 2 | 3 | import com.jason.demo.seata.order.service.OrderService; 4 | import io.seata.core.context.RootContext; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RequestMapping("/api/order") 12 | @RestController 13 | public class OrderController { 14 | 15 | @Autowired 16 | OrderService orderService; 17 | 18 | @GetMapping(value = "/debit") 19 | public void debit(@RequestParam String userId, @RequestParam String commodityCode, @RequestParam Integer count) { 20 | System.out.println("order XID " + RootContext.getXID()); 21 | orderService.create(userId, commodityCode, count); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/persistence/Order.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order.persistence; 2 | 3 | 4 | import lombok.Data; 5 | 6 | import java.math.BigDecimal; 7 | 8 | @Data 9 | public class Order { 10 | private Integer id; 11 | 12 | private String userId; 13 | 14 | private String commodityCode; 15 | 16 | private Integer count; 17 | 18 | private BigDecimal money; 19 | 20 | } -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/persistence/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order.persistence; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | 5 | @Mapper 6 | public interface OrderMapper { 7 | 8 | int insert(Order record); 9 | 10 | } -------------------------------------------------------------------------------- /seata/order-service/src/main/java/com/jason/demo/seata/order/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order.service; 2 | 3 | import com.jason.demo.seata.order.client.AccountClient; 4 | import com.jason.demo.seata.order.persistence.Order; 5 | import com.jason.demo.seata.order.persistence.OrderMapper; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Service 12 | public class OrderService { 13 | 14 | @Autowired 15 | private AccountClient accountClient; 16 | @Autowired 17 | private OrderMapper orderMapper; 18 | 19 | public void create(String userId, String commodityCode, Integer count) { 20 | BigDecimal orderMoney = new BigDecimal(count).multiply(new BigDecimal(5)); 21 | Order order = new Order(); 22 | order.setUserId(userId); 23 | order.setCommodityCode(commodityCode); 24 | order.setCount(count); 25 | order.setMoney(orderMoney); 26 | 27 | orderMapper.insert(order); 28 | 29 | accountClient.debit(userId, orderMoney); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /seata/order-service/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | utf-8 8 | %date %(${LOG_LEVEL_PATTERN:-%5p}) [%thread] %logger{36} [%file : %line] %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /seata/order-service/src/main/resources/mapper/OrderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | insert into order_tbl (user_id,commodity_code,count,money) 14 | values (#{userId,jdbcType=VARCHAR}, #{commodityCode,jdbcType=VARCHAR}, #{count,jdbcType=INTEGER}, #{money,jdbcType=DECIMAL}) 15 | 16 | 17 | -------------------------------------------------------------------------------- /seata/order-service/src/test/java/com/jason/demo/seata/order/SeataOrderServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.order; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataOrderServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.jason.demo 7 | demo 8 | 0.0.1-SNAPSHOT 9 | 10 | com.jason.demo 11 | seata 12 | 0.0.1-SNAPSHOT 13 | seata 14 | pom 15 | Demo project for Spring Boot 16 | 17 | 18 | common-service 19 | account-service 20 | storage-service 21 | order-service 22 | business-service 23 | 24 | 25 | 1.8 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-maven-plugin 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /seata/storage-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /seata/storage-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/seata/storage-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata/storage-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /seata/storage-service/src/main/java/com/jason/demo/seata/storage/SeataStorageServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.storage; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | @SpringBootApplication(scanBasePackages = "com.jason.demo.seata", exclude = DataSourceAutoConfiguration.class) 8 | public class SeataStorageServiceApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(SeataStorageServiceApplication.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /seata/storage-service/src/main/java/com/jason/demo/seata/storage/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.storage.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.apache.ibatis.session.SqlSessionFactory; 5 | import org.mybatis.spring.SqlSessionFactoryBean; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 10 | 11 | import javax.sql.DataSource; 12 | 13 | @Configuration 14 | public class DataSourceConfig { 15 | 16 | @Bean 17 | @ConfigurationProperties(prefix = "spring.datasource") 18 | public DataSource druidDataSource() { 19 | DruidDataSource druidDataSource = new DruidDataSource(); 20 | return druidDataSource; 21 | } 22 | 23 | @Bean 24 | public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { 25 | SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); 26 | factoryBean.setDataSource(dataSource); 27 | factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver() 28 | .getResources("classpath*:/mapper/*.xml")); 29 | return factoryBean.getObject(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /seata/storage-service/src/main/java/com/jason/demo/seata/storage/config/RestTemplateConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.storage.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.client.RestTemplate; 6 | 7 | @Configuration 8 | public class RestTemplateConfig { 9 | 10 | @Bean 11 | public RestTemplate restTemplate() { 12 | RestTemplate restTemplate = new RestTemplate(); 13 | return restTemplate; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /seata/storage-service/src/main/java/com/jason/demo/seata/storage/controller/StorageController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.storage.controller; 2 | 3 | import com.jason.demo.seata.storage.persistence.Storage; 4 | import com.jason.demo.seata.storage.service.StorageService; 5 | import io.seata.core.context.RootContext; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.sql.SQLException; 10 | 11 | @RequestMapping("/api/storage") 12 | @RestController 13 | public class StorageController { 14 | 15 | @Autowired 16 | StorageService storageService; 17 | 18 | @GetMapping(value = "/deduct") 19 | public void deduct(@RequestParam String commodityCode, @RequestParam Integer count) throws SQLException { 20 | System.out.println("storage XID " + RootContext.getXID()); 21 | storageService.deduct(commodityCode, count); 22 | } 23 | 24 | @GetMapping(value = "/get/{id}") 25 | public Storage getById(@PathVariable("id") Integer id) { 26 | return storageService.get(id); 27 | } 28 | 29 | @GetMapping(value = "/batch/update") 30 | public void batchUpdateCond() { 31 | try { 32 | storageService.batchUpdate(); 33 | } catch (SQLException e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | @GetMapping(value = "/batch/delete") 39 | public void batchDeleteCond() { 40 | try { 41 | storageService.batchDelete(); 42 | } catch (SQLException e) { 43 | e.printStackTrace(); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /seata/storage-service/src/main/java/com/jason/demo/seata/storage/persistence/Storage.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.storage.persistence; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Storage { 7 | private Integer id; 8 | 9 | private String commodityCode; 10 | 11 | private Integer count; 12 | 13 | } -------------------------------------------------------------------------------- /seata/storage-service/src/main/java/com/jason/demo/seata/storage/persistence/StorageMapper.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.storage.persistence; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | @Mapper 9 | public interface StorageMapper { 10 | 11 | Storage selectById(@Param("id") Integer id); 12 | 13 | Storage findByCommodityCode(@Param("commodityCode") String commodityCode); 14 | 15 | int updateById(Storage record); 16 | 17 | void insert(Storage record); 18 | 19 | void insertBatch(List records); 20 | 21 | int updateBatch(@Param("list") List ids, @Param("commodityCode") String commodityCode); 22 | } -------------------------------------------------------------------------------- /seata/storage-service/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | utf-8 8 | %date %(${LOG_LEVEL_PATTERN:-%5p}) [%thread] %logger{36} [%file : %line] %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /seata/storage-service/src/test/java/com/jason/demo/seata/storage/SeataStorageServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.seata.storage; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataStorageServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /shardingsphere/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /shardingsphere/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/shardingsphere/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /shardingsphere/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /shardingsphere/sql/test.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `t_address` ( 2 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 3 | `code` varchar(64) DEFAULT NULL COMMENT '编码', 4 | `name` varchar(64) DEFAULT NULL COMMENT '名称', 5 | `pid` varchar(64) NOT NULL DEFAULT '0' COMMENT '父id', 6 | `type` int(11) DEFAULT NULL COMMENT '1国家2省3市4县区', 7 | `lit` int(11) DEFAULT NULL, 8 | PRIMARY KEY (`id`) 9 | ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; 10 | 11 | CREATE TABLE `t_user0` ( 12 | `id` bigint(20) NOT NULL, 13 | `name` varchar(64) DEFAULT NULL COMMENT '名称', 14 | `city_id` int(12) DEFAULT NULL COMMENT '城市', 15 | `sex` tinyint(1) DEFAULT NULL COMMENT '性别', 16 | `phone` varchar(32) DEFAULT NULL COMMENT '电话', 17 | `email` varchar(32) DEFAULT NULL COMMENT '邮箱', 18 | `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', 19 | `password` varchar(32) DEFAULT NULL COMMENT '密码', 20 | PRIMARY KEY (`id`) 21 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 22 | 23 | CREATE TABLE `t_user1` ( 24 | `id` bigint(20) NOT NULL, 25 | `name` varchar(64) DEFAULT NULL COMMENT '名称', 26 | `city_id` int(12) DEFAULT NULL COMMENT '城市', 27 | `sex` tinyint(1) DEFAULT NULL COMMENT '性别', 28 | `phone` varchar(32) DEFAULT NULL COMMENT '电话', 29 | `email` varchar(32) DEFAULT NULL COMMENT '邮箱', 30 | `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', 31 | `password` varchar(32) DEFAULT NULL COMMENT '密码', 32 | PRIMARY KEY (`id`) 33 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 34 | 35 | -------------------------------------------------------------------------------- /shardingsphere/src/main/java/com/jason/demo/shardingsphere/ShardingsphereApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ShardingsphereApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ShardingsphereApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /shardingsphere/src/main/java/com/jason/demo/shardingsphere/controller/AddressController.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere.controller; 2 | 3 | import com.jason.demo.shardingsphere.mapper.AddressMapper; 4 | import com.jason.demo.shardingsphere.model.Address; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * @author: jason 12 | * @Date: 2020-08-13 13 | */ 14 | @RestController 15 | public class AddressController { 16 | 17 | @Autowired 18 | private AddressMapper addressMapper; 19 | 20 | @RequestMapping("/address/save") 21 | public String save() { 22 | for (int i = 0; i <10 ; i++) { 23 | Address address=new Address(); 24 | address.setCode("code_"+i); 25 | address.setName("name_"+i); 26 | address.setPid(i+""); 27 | address.setType(0); 28 | address.setLit(i%2==0?1:2); 29 | addressMapper.save(address); 30 | } 31 | 32 | return "success"; 33 | } 34 | 35 | @RequestMapping("/address/get/{id}") 36 | public Address get(@PathVariable Long id) { 37 | return addressMapper.get(id); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /shardingsphere/src/main/java/com/jason/demo/shardingsphere/mapper/AddressMapper.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere.mapper; 2 | 3 | import com.jason.demo.shardingsphere.model.Address; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | /** 7 | * @author: jason 8 | * @Date: 2020-08-13 9 | */ 10 | @Mapper 11 | public interface AddressMapper { 12 | /** 13 | * 保存 14 | */ 15 | void save(Address address); 16 | 17 | /** 18 | * 查询 19 | * @param id 20 | * @return 21 | */ 22 | Address get(Long id); 23 | } -------------------------------------------------------------------------------- /shardingsphere/src/main/java/com/jason/demo/shardingsphere/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere.mapper; 2 | 3 | import com.jason.demo.shardingsphere.model.User; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Select; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author: jason 13 | * @Date: 2020-08-13 14 | */ 15 | @Mapper 16 | public interface UserMapper { 17 | /** 18 | * 保存 19 | */ 20 | void save(User user); 21 | 22 | /** 23 | * 查询 24 | * 25 | * @param id 26 | * @return 27 | */ 28 | User get(Long id); 29 | 30 | @Select("select * from t_user where id > 500827793022517248") 31 | List getList(); 32 | 33 | @Select("select * from t_user where id = #{id} for update") 34 | User selectByIdForUpadate(Long id); 35 | 36 | @Update("update t_user set `name`= #{name} ,city_id =city_id+1 where id = #{id}") 37 | int updateById(@Param("id") Long id, @Param("name") String name); 38 | } 39 | -------------------------------------------------------------------------------- /shardingsphere/src/main/java/com/jason/demo/shardingsphere/model/Address.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author: jason 7 | * @Date: 2020-08-13 8 | */ 9 | @Data 10 | public class Address { 11 | private Long id; 12 | private String code; 13 | private String name; 14 | private String pid; 15 | private Integer type; 16 | private Integer lit; 17 | } 18 | -------------------------------------------------------------------------------- /shardingsphere/src/main/java/com/jason/demo/shardingsphere/model/User.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere.model; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * @author: jason 9 | * @Date: 2020-08-13 10 | */ 11 | @Data 12 | public class User { 13 | private Long id; 14 | private String name; 15 | private String phone; 16 | private String email; 17 | private String password; 18 | private Integer cityId; 19 | private Date createTime; 20 | private Integer sex; 21 | } 22 | -------------------------------------------------------------------------------- /shardingsphere/src/main/java/com/jason/demo/shardingsphere/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere.service; 2 | 3 | import com.jason.demo.shardingsphere.mapper.UserMapper; 4 | import com.jason.demo.shardingsphere.model.User; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.transaction.annotation.Transactional; 9 | 10 | /** 11 | * @author: jason 12 | * @Date: 2020-09-12 13 | */ 14 | @Slf4j 15 | @Service 16 | public class UserService { 17 | 18 | @Autowired 19 | private UserMapper userMapper; 20 | 21 | @Transactional(rollbackFor = Throwable.class) 22 | public int testRepeatedRead(Long userId) { 23 | log.info("test start..."); 24 | User user = userMapper.selectByIdForUpadate(userId); 25 | Thread thread = Thread.currentThread(); 26 | log.info("当前线程" + thread.getName()); 27 | log.info("用户名字{},用户城市{}", user.getName(), user.getCityId()); 28 | int res = userMapper.updateById(userId, "jason"); 29 | log.info("res-------->{}", res); 30 | //int a = 6; 31 | //if (a > 1) { 32 | // throw new RuntimeException("rollback"); 33 | //} 34 | return res; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /shardingsphere/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 7005 3 | spring: 4 | application: 5 | name: shardingjdbc 6 | mybatis: 7 | configuration: 8 | mapUnderscoreToCamelCase: true 9 | useColumnLabel: true 10 | mapperLocations: classpath:mappers/**/*.xml 11 | typeAliasesPackage: com.jason.demo.shardingsphere.model 12 | sharding: 13 | jdbc: 14 | datasource: 15 | names: ds0 16 | # 数据源ds0 17 | ds0: 18 | type: com.alibaba.druid.pool.DruidDataSource 19 | driver-class-name: com.mysql.jdbc.Driver 20 | url: jdbc:mysql://localhost:3306/demo-shardingjdbc 21 | username: root 22 | password: TbbXkkjCrm@2020 23 | config: 24 | sharding: 25 | props: 26 | sql.show: true 27 | tables: 28 | t_user: #t_user表 29 | key-generator-column-name: id #主键 30 | actual-data-nodes: ds0.t_user${0..1} #数据节点,均匀分布 31 | table-strategy: #分表策略 32 | inline: #行表达式 33 | sharding-column: sex 34 | algorithm-expression: t_user${sex % 2} #按模运算分配 35 | 36 | -------------------------------------------------------------------------------- /shardingsphere/src/main/resources/mappers/AddressMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | INSERT INTO t_address(code,name,pid,type,lit) 7 | VALUES 8 | ( 9 | #{code},#{name},#{pid},#{type},#{lit} 10 | ) 11 | 12 | 13 | 16 | 17 | -------------------------------------------------------------------------------- /shardingsphere/src/main/resources/mappers/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | INSERT INTO t_user(name,phone,email,city_id,sex,password) 7 | VALUES 8 | ( 9 | #{name},#{phone},#{email},#{cityId},#{sex},#{password} 10 | ) 11 | 12 | 13 | 16 | 17 | -------------------------------------------------------------------------------- /shardingsphere/src/test/java/com/jason/demo/shardingsphere/ShardingsphereApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ShardingsphereApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /shardingsphere/src/test/java/com/jason/demo/shardingsphere/mapper/UserMapperTest.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.shardingsphere.mapper; 2 | 3 | import com.jason.demo.shardingsphere.ShardingsphereApplication; 4 | import com.jason.demo.shardingsphere.model.User; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * @author: jason 16 | * @Date: 2020-08-14 17 | */ 18 | @Slf4j 19 | @RunWith(SpringRunner.class) 20 | @SpringBootTest(classes = {ShardingsphereApplication.class}) 21 | public class UserMapperTest { 22 | 23 | @Autowired 24 | private UserMapper userMapper; 25 | 26 | @Test 27 | public void test() { 28 | List list = userMapper.getList(); 29 | log.info("res" + list.size()); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /task/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /task/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/task/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /task/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /task/README.md: -------------------------------------------------------------------------------- 1 | ##项目意图 2 | 刷访问量 -------------------------------------------------------------------------------- /task/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.jason.demo 7 | demo 8 | 0.0.1-SNAPSHOT 9 | 10 | com.jason.demo 11 | click-farm 12 | 0.0.1-SNAPSHOT 13 | click-farm 14 | Demo project for Spring Boot 15 | 16 | 17 | 1.8 18 | 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-starter 24 | 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-test 29 | test 30 | 31 | 32 | org.junit.vintage 33 | junit-vintage-engine 34 | 35 | 36 | 37 | 38 | cn.hutool 39 | hutool-all 40 | 4.5.7 41 | 42 | 43 | org.projectlombok 44 | lombok 45 | 1.18.12 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-maven-plugin 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /task/src/main/java/com/jason/demo/clickfarm/ClickFarmApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.clickfarm; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @EnableScheduling 8 | @SpringBootApplication 9 | public class ClickFarmApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ClickFarmApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /task/src/main/java/com/jason/demo/clickfarm/task/CsdnClickScheduled.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.clickfarm.task; 2 | 3 | import com.jason.demo.clickfarm.util.csdn.UrlCrawBoke; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.scheduling.annotation.Scheduled; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.io.IOException; 9 | 10 | /** 11 | * 同步定时任务 12 | * 13 | * @author jason 14 | * @date 2020/3/2 15 | */ 16 | @Slf4j 17 | @Component 18 | public class CsdnClickScheduled { 19 | 20 | /** 21 | * 同步知乎线索数据 22 | */ 23 | @Scheduled(cron = "30 * * * * ?") 24 | public void clickCsdn() { 25 | log.info("定时刷新csdn点击量"); 26 | try { 27 | UrlCrawBoke.main(null); 28 | } catch (IOException e) { 29 | e.printStackTrace(); 30 | } catch (InterruptedException e) { 31 | e.printStackTrace(); 32 | } 33 | } 34 | 35 | /** 36 | * 刷新百科点击量 37 | */ 38 | //@Scheduled(cron = "0/1 * * * * ?") 39 | @Scheduled(cron = "30 * * * * ?") 40 | public void clickWebBaike() { 41 | log.info("定时刷新csdn的springboot技术栈博客点击量"); 42 | try { 43 | UrlCrawBoke.doGet("https://blog.csdn.net/zhu719224032/article/details/107999106"); 44 | } catch (Exception e) { 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /task/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=7070 2 | -------------------------------------------------------------------------------- /task/src/test/java/com/jason/demo/clickfarm/ClickFarmApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.clickfarm; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ClickFarmApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/vue3-essential', 8 | 'eslint:recommended' 9 | ], 10 | parserOptions: { 11 | parser: 'babel-eslint' 12 | }, 13 | rules: { 14 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/README.md: -------------------------------------------------------------------------------- 1 | # jason-sky-admin 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | npm run lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jason-sky-admin", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.21.0", 12 | "core-js": "^3.6.5", 13 | "vue": "^3.0.0", 14 | "vue-router": "^4.0.0-0", 15 | "vuex": "^3.5.1" 16 | }, 17 | "devDependencies": { 18 | "@vue/cli-plugin-babel": "~4.5.0", 19 | "@vue/cli-plugin-eslint": "~4.5.0", 20 | "@vue/cli-plugin-router": "~4.5.0", 21 | "@vue/cli-service": "~4.5.0", 22 | "@vue/compiler-sfc": "^3.0.0", 23 | "babel-eslint": "^10.1.0", 24 | "eslint": "^6.7.2", 25 | "eslint-plugin-vue": "^7.0.0-0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/jason-sky-admin/public/favicon.ico -------------------------------------------------------------------------------- /vue/jason-sky-admin/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/App.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 15 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/jason-sky-admin/src/assets/logo.png -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/main.js: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | // import axios from 'axios' 5 | 6 | createApp(App).use(router).mount('#app') 7 | 8 | 9 | 10 | //axios 11 | 12 | // axios.defaults.baseURL = 'https://www.qiyuanheshan.com/xnxw' 13 | // axios.defaults.timeout = 10000 14 | // 1基本使用 15 | // axios({ 16 | // u rl: 'https://www.qiyuanheshan.com/xnxw/release/list?schoolId=4', 17 | // method: 'get' //默认是get请求,可不传 18 | // }).then(res=>{ 19 | // console.log(res); 20 | // }) 21 | 22 | // axios({ 23 | // url: 'https://www.qiyuanheshan.com/xnxw/release/list', 24 | // params: { 25 | // schoolId: 3 26 | // } 27 | // }).then(res=>{ 28 | // console.log(res); 29 | // }) 30 | 31 | // 2.多个请求同时进行(并发请求) 32 | 33 | // axios.all([axios({ 34 | // url:'/index/get_prize_draw_status' 35 | // }),axios({ 36 | // url: '/index/get_video_status' 37 | // })]).then(axios.spread((res1,res2)=>{ 38 | // console.log(res1); 39 | // console.log(res2); 40 | 41 | // })) 42 | 43 | 44 | //3.创建对应的axios实例 45 | // const instance1 = axios.create({ 46 | // baseURL : 'https://www.qiyuanheshan.com/xnxw', 47 | // timeout : 5000 48 | // }) 49 | 50 | // instance1({ 51 | // url : '/index/get_video_status' 52 | // }).then(res =>{ 53 | // console.log(res); 54 | // }) 55 | 56 | //4.封装request请求 57 | import {request} from './network/request' 58 | 59 | // request({ 60 | // url:'/index/get_video_status' 61 | // },res =>{ 62 | // console.log(res) 63 | // },err =>{ 64 | // console.log(err) 65 | // }) 66 | 67 | request({ 68 | url:'/index/get_video_status' 69 | }).then(res=>{ 70 | console.log(res) 71 | }).catch(err =>{ 72 | console.log(err) 73 | }) -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/network/request.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | 4 | export function request(config){ 5 | //1.创建axios实例 6 | const instance = axios.create({ 7 | baseURL : 'http://test.qiyuanheshan.com/xnxw', 8 | timeout : 5000 9 | }) 10 | 11 | //2.axios拦截器 12 | instance.interceptors.request.use(config=>{ 13 | console.log(config); 14 | return config 15 | },err =>{ 16 | console.log(err) 17 | }) 18 | 19 | instance.interceptors.response.use(res =>{ 20 | console.log(res) 21 | return res; 22 | },err=>{ 23 | console.log(err) 24 | }) 25 | 26 | //3.发送真正的网络请求 27 | return instance(config) 28 | 29 | } 30 | 31 | 32 | // export function request(config){ 33 | // return new Promise((resolve,reject) =>{ 34 | // //1.创建axios实例 35 | // const instance = axios.create({ 36 | // baseURL : 'http://test.qiyuanheshan.com/xnxw', 37 | // timeout : 5000 38 | // }) 39 | 40 | // //发送真正的网络请求 41 | // instance(config).then(res=>{ 42 | // resolve(res) 43 | // }).catch(err=>{ 44 | // reject(err) 45 | // }) 46 | // }) 47 | 48 | // } 49 | 50 | // export function request(config,success,failure){ 51 | // //1.创建axios实例 52 | // const instance = axios.create({ 53 | // baseURL : 'http://test.qiyuanheshan.com/xnxw', 54 | // timeout : 5000 55 | // }) 56 | 57 | // //发送真正的网络请求 58 | // instance(config).then(res =>{ 59 | // success(res) 60 | // }).catch(err =>{ 61 | // failure(err) 62 | // }) 63 | // } -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/router/index.js: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHistory } from 'vue-router' 2 | // import Home from '../views/Home.vue' 3 | 4 | const routes = [ 5 | // { 6 | // path: '/', 7 | // name: 'Home', 8 | // component: Home 9 | // }, 10 | { 11 | path: '/', 12 | name: 'login', 13 | component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue'), 14 | meta:{ 15 | title:"登录" 16 | } 17 | }, 18 | { 19 | path: '/about', 20 | name: 'About', 21 | // route level code-splitting 22 | // this generates a separate chunk (about.[hash].js) for this route 23 | // which is lazy-loaded when the route is visited. 24 | component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') 25 | } 26 | ] 27 | 28 | const router = createRouter({ 29 | history: createWebHistory(process.env.BASE_URL), 30 | routes 31 | }) 32 | 33 | export default router 34 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/views/About.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 19 | -------------------------------------------------------------------------------- /vue/jason-sky-admin/src/views/Login.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 31 | 32 | 35 | -------------------------------------------------------------------------------- /vue/seckill-master_1/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 gongjunhao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vue/seckill-master_1/README.md: -------------------------------------------------------------------------------- 1 | # 秒杀插件(seckill) 2 | 3 | Chrome浏览器 抢购、秒杀插件(秒杀助手) 可自定义 秒杀辅助插件(减少人肉失误) 4 | 5 | * 任意网站,自定义添加秒杀定时任务 6 | * 支持可视化选择“秒杀”按钮+自定义选择dom元素 7 | * 自定义秒杀频率,秒杀次数 8 | * 秒杀前2分钟提醒 9 | * 北京时间,本机时间随意选择 10 | * 北京时间手动校对,准时秒杀 11 | * 任务实时修改保存 12 | 13 | #### 注意事项 14 | * 请提前登陆,选择商品的规格型号 15 | * 选取目标按钮时,请点击“鼠标右键” 16 | * 暂不支持秒杀时输入验证码验证和其他复杂的(多步骤)抢购秒杀 17 | * 秒杀助手只是辅助,不保证100%秒杀成功 18 | 19 | #### ~~安装~~ 20 | * ~~chrome浏览器,设置 --> 更多工具 --> 扩展程序~~ 21 | * ~~勾选开发者模式~~ 22 | * ~~拖拽[*.crx](https://github.com/gongjunhao/seckill/releases/download/0.0.1/seckill.v0.0.1.crx "seckill.v0.0.1.crx")包至此扩展页面释放,确认安装即可~~ 23 | * ~~详细操作步骤,参考:http://www.jianshu.com/p/12ca04c61fc6~~ 24 | 25 | ### 新的安装方式 26 | > 上一种安装已失效,(原因:Chrome版本升级至63导致的),可通过另一种方式安装 27 | * 下载源码包:https://github.com/gongjunhao/seckill/archive/master.zip 28 | * 解压:seckill-master.zip 29 | * 打开chrome浏览器,设置 --> 更多工具 --> 扩展程序 30 | * 勾选开发者模式 31 | * 点击“加载已解压的扩展程序”按钮,选择解压目录下的src目录,点击“确定”,即可完成安装 32 | 33 | #### 使用(【鼠标右键】选取目标) 34 | ![usage](https://github.com/gongjunhao/seckill/blob/master/doc/usage.gif) 35 | 36 | #### Chrome WebStore 37 | 38 | * 后续发布至市场 39 | 40 | ### 问题反馈 41 | 42 | * https://github.com/gongjunhao/seckill/issues 43 | 44 | #### 引用资源 45 | 46 | - Logo http://www.easyicon.net/1159587-clock_icon.html 47 | - Pics http://www.easyicon.net/iconsearch/iconset:bollhavet-icons/1/ 48 | 49 | 50 | ### 后续功能(if stared >= 100) 51 | 52 | * :tada: star数量已经大于100 53 | * :black_square_button:支持cron定时执行(辅助登录并签到,刷积分) 54 | 55 | 56 | ### LICENSE 57 | MIT License 58 | -------------------------------------------------------------------------------- /vue/seckill-master_1/doc/design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/doc/design.png -------------------------------------------------------------------------------- /vue/seckill-master_1/doc/seckill.mp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/doc/seckill.mp -------------------------------------------------------------------------------- /vue/seckill-master_1/doc/usage.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/doc/usage.gif -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/bell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/bell.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/clock.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/cursor.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/delete.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/like.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/link.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/pause.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/runing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/runing.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/seckill-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/seckill-128.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/seckill-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/seckill-16.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/seckill-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/seckill-48.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/send.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/setting.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/success.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/tip.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/image/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/src/image/warning.png -------------------------------------------------------------------------------- /vue/seckill-master_1/src/js/secKill.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 根据任务ID获取任务,执行点击 3 | * @param taskId 4 | */ 5 | function secKill(taskId) { 6 | console.log("开始秒杀!"); 7 | console.log(taskId); 8 | chrome.storage.local.get({"tasks": new Array()}, function(value) { 9 | tasks = value.tasks; 10 | if(tasks != undefined && tasks != null && tasks.length > 0) { 11 | for(var i=0; itask.count) { 53 | clearInterval(timer); 54 | } 55 | }, task.frequency); 56 | 57 | } -------------------------------------------------------------------------------- /vue/seckill-master_1/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "秒杀助手", 3 | "description": "购物秒杀辅助,提升秒杀几率!", 4 | "version": "0.0.3", 5 | "icons": { "16": "image/seckill-16.png", 6 | "48": "image/seckill-48.png", 7 | "128": "image/seckill-128.png" }, 8 | "permissions": [ 9 | "tabs", 10 | "storage", 11 | "webNavigation", 12 | "notifications", 13 | "activeTab", 14 | "cookies", 15 | "http://*/*", 16 | "https://*/*" 17 | ], 18 | "background": { 19 | "scripts": ["lib/jquery-3.2.1.min.js","js/background.js"] 20 | }, 21 | "content_scripts": [ 22 | { 23 | "matches": ["http://*/*", "https://*/*"], 24 | "js": ["lib/jquery-3.2.1.min.js", "js/secKill.js"], 25 | "css" : ["css/form.css"] 26 | } 27 | ], 28 | "content_security_policy": "script-src 'self' 'unsafe-eval' https://sapi.k780.com/; object-src 'self'", 29 | "browser_action": { 30 | "default_icon": "image/seckill-16.png", 31 | "default_title": "秒杀助手", 32 | "default_popup": "index.html" 33 | }, 34 | "manifest_version": 2, 35 | "web_accessible_resources": ["page/newTask.html", 36 | "lib/*/*/*", 37 | "js/newTask.js"], 38 | "update_url": "http://www.google.com/" 39 | } 40 | 41 | -------------------------------------------------------------------------------- /vue/seckill-master_1/time.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/seckill-master_1/time.gif -------------------------------------------------------------------------------- /vue/supermall/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = 1f 8 | insert_final_newline =true 9 | trim_trailing_whitespace = true -------------------------------------------------------------------------------- /vue/supermall/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /vue/supermall/README.md: -------------------------------------------------------------------------------- 1 | # supermall 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | npm run lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /vue/supermall/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /vue/supermall/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "supermall", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "core-js": "^3.6.5", 12 | "vue": "^2.6.11", 13 | "vue-router": "^3.4.9" 14 | }, 15 | "devDependencies": { 16 | "@vue/cli-plugin-babel": "~4.5.0", 17 | "@vue/cli-plugin-eslint": "~4.5.0", 18 | "@vue/cli-service": "~4.5.0", 19 | "babel-eslint": "^10.1.0", 20 | "eslint": "^6.7.2", 21 | "eslint-plugin-vue": "^6.2.2", 22 | "vue-template-compiler": "^2.6.11" 23 | }, 24 | "eslintConfig": { 25 | "root": true, 26 | "env": { 27 | "node": true 28 | }, 29 | "extends": [ 30 | "plugin:vue/essential", 31 | "eslint:recommended" 32 | ], 33 | "parserOptions": { 34 | "parser": "babel-eslint" 35 | }, 36 | "rules": {} 37 | }, 38 | "browserslist": [ 39 | "> 1%", 40 | "last 2 versions", 41 | "not dead" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /vue/supermall/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/vue/supermall/public/favicon.ico -------------------------------------------------------------------------------- /vue/supermall/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /vue/supermall/src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 20 | -------------------------------------------------------------------------------- /vue/supermall/src/assets/css/base.css: -------------------------------------------------------------------------------- 1 | @import './normalize.css'; 2 | 3 | /* :root -> 获取根元素html */ 4 | :root { 5 | --color-text: #666; 6 | --color-high-text: #ff5777; 7 | --color-tint: #ff8198; 8 | --color-background: #fff; 9 | --font-size: 14px; 10 | --line-height: 1.5; 11 | } 12 | 13 | *, 14 | *::before, 15 | *::after { 16 | margin: 0; 17 | padding: 0; 18 | box-sizing: border-box; 19 | } 20 | 21 | body { 22 | font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;; 23 | user-select: none;/* 禁止用户鼠标在页面上选中文字/图片等 */ 24 | -webkit-tap-highlight-color: transparent;/* webkit是苹果浏览器引擎,tap点击,highlight背景高亮,color颜色,颜色用数值调节*/ 25 | background: var(--color-background); 26 | color: var(--color-text); 27 | width: 100vw; 28 | } 29 | 30 | a { 31 | color: var(--color-text); 32 | text-decoration: none; 33 | } 34 | 35 | .clear-fix::after { 36 | clear: both; 37 | content: ''; 38 | display: block; 39 | width: 0; 40 | height: 0; 41 | visibility: hidden; 42 | } 43 | 44 | .clear-fix { 45 | zoom: 1; 46 | } 47 | 48 | .left { 49 | float: left; 50 | } 51 | 52 | .right { 53 | float: right; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /vue/supermall/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | 5 | Vue.config.productionTip = false 6 | 7 | new Vue({ 8 | render: h => h(App), 9 | router 10 | }).$mount('#app') 11 | -------------------------------------------------------------------------------- /vue/supermall/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | 4 | // 1.安装插件 5 | Vue.use(VueRouter) 6 | 7 | // 2.创建router 8 | const routes = [ 9 | { 10 | path: '/', 11 | name: 'Home', 12 | component: () => import('../views/Home.vue'), 13 | }, 14 | { 15 | path: '/login', 16 | name: 'login', 17 | component: () => import('../views/Login.vue'), 18 | meta:{ 19 | title:"登录" 20 | } 21 | }, 22 | { 23 | path: '/about', 24 | name: 'About', 25 | component: () => import('../views/About.vue') 26 | } 27 | ] 28 | const router = new VueRouter({ 29 | routes, 30 | mode: 'history' 31 | }) 32 | 33 | export default router -------------------------------------------------------------------------------- /vue/supermall/src/views/About.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /vue/supermall/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 15 | -------------------------------------------------------------------------------- /vue/supermall/src/views/Login.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 31 | 32 | 35 | -------------------------------------------------------------------------------- /vue/supermall/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | configureWebpack: { 3 | resolve: { 4 | extensions: [], 5 | alias: { 6 | 'assets' : '@/assets', 7 | 'common' : '@/common', 8 | 'components' : '@/components', 9 | 'network' : '@/network', 10 | 'views' : '@/views', 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /xxl-job/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /xxl-job/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /xxl-job/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | MAINTAINER xuxueli 3 | 4 | ENV PARAMS="" 5 | 6 | ENV TZ=PRC 7 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone 8 | 9 | ADD target/xxl-job-admin-*.jar /app.jar 10 | 11 | ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"] -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/XxlJobAdminApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class XxlJobAdminApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(XxlJobAdminApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/controller/annotation/PermissionLimit.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.controller.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 权限限制 11 | * @author jason 2015-12-12 18:29:02 12 | */ 13 | @Target(ElementType.METHOD) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface PermissionLimit { 16 | 17 | /** 18 | * 登录拦截 (默认拦截) 19 | */ 20 | boolean limit() default true; 21 | 22 | /** 23 | * 要求管理员权限 24 | * 25 | * @return 26 | */ 27 | boolean adminuser() default false; 28 | 29 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/controller/interceptor/CookieInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.controller.interceptor; 2 | 3 | import com.jason.demo.xxljob.admin.core.util.FtlUtil; 4 | import com.jason.demo.xxljob.admin.core.util.I18nUtil; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.servlet.ModelAndView; 7 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; 8 | 9 | import javax.servlet.http.Cookie; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.util.HashMap; 13 | 14 | /** 15 | * push cookies to model as cookieMap 16 | * 17 | * @author jason 2015-12-12 18:09:04 18 | */ 19 | @Component 20 | public class CookieInterceptor extends HandlerInterceptorAdapter { 21 | 22 | @Override 23 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, 24 | ModelAndView modelAndView) throws Exception { 25 | 26 | // cookie 27 | if (modelAndView!=null && request.getCookies()!=null && request.getCookies().length>0) { 28 | HashMap cookieMap = new HashMap(); 29 | for (Cookie ck : request.getCookies()) { 30 | cookieMap.put(ck.getName(), ck); 31 | } 32 | modelAndView.addObject("cookieMap", cookieMap); 33 | } 34 | 35 | // static method 36 | if (modelAndView != null) { 37 | modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName())); 38 | } 39 | 40 | super.postHandle(request, response, handler, modelAndView); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/controller/interceptor/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.controller.interceptor; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * web mvc config 11 | * 12 | * @author jason 2018-04-02 20:48:20 13 | */ 14 | @Configuration 15 | public class WebMvcConfig implements WebMvcConfigurer { 16 | 17 | @Resource 18 | private PermissionInterceptor permissionInterceptor; 19 | @Resource 20 | private CookieInterceptor cookieInterceptor; 21 | 22 | @Override 23 | public void addInterceptors(InterceptorRegistry registry) { 24 | registry.addInterceptor(permissionInterceptor).addPathPatterns("/**"); 25 | registry.addInterceptor(cookieInterceptor).addPathPatterns("/**"); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/alarm/JobAlarm.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.alarm; 2 | 3 | import com.jason.demo.xxljob.admin.core.model.XxlJobInfo; 4 | import com.jason.demo.xxljob.admin.core.model.XxlJobLog; 5 | 6 | /** 7 | * @author jason 2020-01-19 8 | */ 9 | public interface JobAlarm { 10 | 11 | /** 12 | * job alarm 13 | * 14 | * @param info 15 | * @param jobLog 16 | * @return 17 | */ 18 | public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/exception/XxlJobException.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.exception; 2 | 3 | /** 4 | * @author jason 2019-05-04 23:19:29 5 | */ 6 | public class XxlJobException extends RuntimeException { 7 | 8 | public XxlJobException() { 9 | } 10 | public XxlJobException(String message) { 11 | super(message); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/model/XxlJobGroup.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | /** 8 | * Created by jason on 16/9/30. 9 | */ 10 | public class XxlJobGroup { 11 | 12 | private int id; 13 | private String appname; 14 | private String title; 15 | private int addressType; // 执行器地址类型:0=自动注册、1=手动录入 16 | private String addressList; // 执行器地址列表,多地址逗号分隔(手动录入) 17 | 18 | // registry list 19 | private List registryList; // 执行器地址列表(系统注册) 20 | public List getRegistryList() { 21 | if (addressList!=null && addressList.trim().length()>0) { 22 | registryList = new ArrayList(Arrays.asList(addressList.split(","))); 23 | } 24 | return registryList; 25 | } 26 | 27 | public int getId() { 28 | return id; 29 | } 30 | 31 | public void setId(int id) { 32 | this.id = id; 33 | } 34 | 35 | public String getAppname() { 36 | return appname; 37 | } 38 | 39 | public void setAppname(String appname) { 40 | this.appname = appname; 41 | } 42 | 43 | public String getTitle() { 44 | return title; 45 | } 46 | 47 | public void setTitle(String title) { 48 | this.title = title; 49 | } 50 | 51 | public int getAddressType() { 52 | return addressType; 53 | } 54 | 55 | public void setAddressType(int addressType) { 56 | this.addressType = addressType; 57 | } 58 | 59 | public String getAddressList() { 60 | return addressList; 61 | } 62 | 63 | public void setAddressList(String addressList) { 64 | this.addressList = addressList; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/model/XxlJobLogGlue.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * xxl-job log for glue, used to track job code process 7 | * @author jason 2016-5-19 17:57:46 8 | */ 9 | public class XxlJobLogGlue { 10 | 11 | private int id; 12 | private int jobId; // 任务主键ID 13 | private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum 14 | private String glueSource; 15 | private String glueRemark; 16 | private Date addTime; 17 | private Date updateTime; 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | public int getJobId() { 28 | return jobId; 29 | } 30 | 31 | public void setJobId(int jobId) { 32 | this.jobId = jobId; 33 | } 34 | 35 | public String getGlueType() { 36 | return glueType; 37 | } 38 | 39 | public void setGlueType(String glueType) { 40 | this.glueType = glueType; 41 | } 42 | 43 | public String getGlueSource() { 44 | return glueSource; 45 | } 46 | 47 | public void setGlueSource(String glueSource) { 48 | this.glueSource = glueSource; 49 | } 50 | 51 | public String getGlueRemark() { 52 | return glueRemark; 53 | } 54 | 55 | public void setGlueRemark(String glueRemark) { 56 | this.glueRemark = glueRemark; 57 | } 58 | 59 | public Date getAddTime() { 60 | return addTime; 61 | } 62 | 63 | public void setAddTime(Date addTime) { 64 | this.addTime = addTime; 65 | } 66 | 67 | public Date getUpdateTime() { 68 | return updateTime; 69 | } 70 | 71 | public void setUpdateTime(Date updateTime) { 72 | this.updateTime = updateTime; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/model/XxlJobLogReport.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.model; 2 | 3 | import java.util.Date; 4 | 5 | public class XxlJobLogReport { 6 | 7 | private int id; 8 | 9 | private Date triggerDay; 10 | 11 | private int runningCount; 12 | private int sucCount; 13 | private int failCount; 14 | 15 | public int getId() { 16 | return id; 17 | } 18 | 19 | public void setId(int id) { 20 | this.id = id; 21 | } 22 | 23 | public Date getTriggerDay() { 24 | return triggerDay; 25 | } 26 | 27 | public void setTriggerDay(Date triggerDay) { 28 | this.triggerDay = triggerDay; 29 | } 30 | 31 | public int getRunningCount() { 32 | return runningCount; 33 | } 34 | 35 | public void setRunningCount(int runningCount) { 36 | this.runningCount = runningCount; 37 | } 38 | 39 | public int getSucCount() { 40 | return sucCount; 41 | } 42 | 43 | public void setSucCount(int sucCount) { 44 | this.sucCount = sucCount; 45 | } 46 | 47 | public int getFailCount() { 48 | return failCount; 49 | } 50 | 51 | public void setFailCount(int failCount) { 52 | this.failCount = failCount; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/model/XxlJobRegistry.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by jason on 16/9/30. 7 | */ 8 | public class XxlJobRegistry { 9 | 10 | private int id; 11 | private String registryGroup; 12 | private String registryKey; 13 | private String registryValue; 14 | private Date updateTime; 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getRegistryGroup() { 25 | return registryGroup; 26 | } 27 | 28 | public void setRegistryGroup(String registryGroup) { 29 | this.registryGroup = registryGroup; 30 | } 31 | 32 | public String getRegistryKey() { 33 | return registryKey; 34 | } 35 | 36 | public void setRegistryKey(String registryKey) { 37 | this.registryKey = registryKey; 38 | } 39 | 40 | public String getRegistryValue() { 41 | return registryValue; 42 | } 43 | 44 | public void setRegistryValue(String registryValue) { 45 | this.registryValue = registryValue; 46 | } 47 | 48 | public Date getUpdateTime() { 49 | return updateTime; 50 | } 51 | 52 | public void setUpdateTime(Date updateTime) { 53 | this.updateTime = updateTime; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/model/XxlJobUser.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.model; 2 | 3 | import org.springframework.util.StringUtils; 4 | 5 | /** 6 | * @author jason 2019-05-04 16:43:12 7 | */ 8 | public class XxlJobUser { 9 | 10 | private int id; 11 | private String username; // 账号 12 | private String password; // 密码 13 | private int role; // 角色:0-普通用户、1-管理员 14 | private String permission; // 权限:执行器ID列表,多个逗号分割 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getUsername() { 25 | return username; 26 | } 27 | 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getPassword() { 33 | return password; 34 | } 35 | 36 | public void setPassword(String password) { 37 | this.password = password; 38 | } 39 | 40 | public int getRole() { 41 | return role; 42 | } 43 | 44 | public void setRole(int role) { 45 | this.role = role; 46 | } 47 | 48 | public String getPermission() { 49 | return permission; 50 | } 51 | 52 | public void setPermission(String permission) { 53 | this.permission = permission; 54 | } 55 | 56 | // plugin 57 | public boolean validPermission(int jobGroup){ 58 | if (this.role == 1) { 59 | return true; 60 | } else { 61 | if (StringUtils.hasText(this.permission)) { 62 | for (String permissionItem : this.permission.split(",")) { 63 | if (String.valueOf(jobGroup).equals(permissionItem)) { 64 | return true; 65 | } 66 | } 67 | } 68 | return false; 69 | } 70 | 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/old/RemoteHttpJobBean.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.old;//package com.xxl.job.admin.core.jobbean; 2 | // 3 | //import com.xxl.job.admin.core.thread.JobTriggerPoolHelper; 4 | //import com.xxl.job.admin.core.trigger.TriggerTypeEnum; 5 | //import org.quartz.JobExecutionContext; 6 | //import org.quartz.JobExecutionException; 7 | //import org.quartz.JobKey; 8 | //import org.slf4j.Logger; 9 | //import org.slf4j.LoggerFactory; 10 | //import org.springframework.scheduling.quartz.QuartzJobBean; 11 | // 12 | ///** 13 | // * http job bean 14 | // * “@DisallowConcurrentExecution” disable concurrent, thread size can not be only one, better given more 15 | // * @author jason 2015-12-17 18:20:34 16 | // */ 17 | ////@DisallowConcurrentExecution 18 | //public class RemoteHttpJobBean extends QuartzJobBean { 19 | // private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class); 20 | // 21 | // @Override 22 | // protected void executeInternal(JobExecutionContext context) 23 | // throws JobExecutionException { 24 | // 25 | // // load jobId 26 | // JobKey jobKey = context.getTrigger().getJobKey(); 27 | // Integer jobId = Integer.valueOf(jobKey.getName()); 28 | // 29 | // 30 | // } 31 | // 32 | //} -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/old/XxlJobThreadPool.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.old;//package com.xxl.job.admin.core.quartz; 2 | // 3 | //import org.quartz.SchedulerConfigException; 4 | //import org.quartz.spi.ThreadPool; 5 | // 6 | ///** 7 | // * single thread pool, for async trigger 8 | // * 9 | // * @author jason 2019-03-06 10 | // */ 11 | //public class XxlJobThreadPool implements ThreadPool { 12 | // 13 | // @Override 14 | // public boolean runInThread(Runnable runnable) { 15 | // 16 | // // async run 17 | // runnable.run(); 18 | // return true; 19 | // 20 | // //return false; 21 | // } 22 | // 23 | // @Override 24 | // public int blockForAvailableThreads() { 25 | // return 1; 26 | // } 27 | // 28 | // @Override 29 | // public void initialize() throws SchedulerConfigException { 30 | // 31 | // } 32 | // 33 | // @Override 34 | // public void shutdown(boolean waitForJobsToComplete) { 35 | // 36 | // } 37 | // 38 | // @Override 39 | // public int getPoolSize() { 40 | // return 1; 41 | // } 42 | // 43 | // @Override 44 | // public void setInstanceId(String schedInstId) { 45 | // 46 | // } 47 | // 48 | // @Override 49 | // public void setInstanceName(String schedName) { 50 | // 51 | // } 52 | // 53 | // // support 54 | // public void setThreadCount(int count) { 55 | // // 56 | // } 57 | // 58 | //} 59 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/route/ExecutorRouter.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.route; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.biz.model.TriggerParam; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by jason on 17/3/10. 12 | */ 13 | public abstract class ExecutorRouter { 14 | protected static Logger logger = LoggerFactory.getLogger(ExecutorRouter.class); 15 | 16 | /** 17 | * route address 18 | * 19 | * @param addressList 20 | * @return ReturnT.content=address 21 | */ 22 | public abstract ReturnT route(TriggerParam triggerParam, List addressList); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/route/strategy/ExecutorRouteFirst.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.route.strategy; 2 | 3 | import com.jason.demo.xxljob.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by jason on 17/3/10. 11 | */ 12 | public class ExecutorRouteFirst extends ExecutorRouter { 13 | 14 | @Override 15 | public ReturnT route(TriggerParam triggerParam, List addressList){ 16 | return new ReturnT(addressList.get(0)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/route/strategy/ExecutorRouteLast.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.route.strategy; 2 | 3 | import com.jason.demo.xxljob.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by jason on 17/3/10. 11 | */ 12 | public class ExecutorRouteLast extends ExecutorRouter { 13 | 14 | @Override 15 | public ReturnT route(TriggerParam triggerParam, List addressList) { 16 | return new ReturnT(addressList.get(addressList.size()-1)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/route/strategy/ExecutorRouteRandom.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.route.strategy; 2 | 3 | import com.jason.demo.xxljob.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | import java.util.Random; 9 | 10 | /** 11 | * Created by jason on 17/3/10. 12 | */ 13 | public class ExecutorRouteRandom extends ExecutorRouter { 14 | 15 | private static Random localRandom = new Random(); 16 | 17 | @Override 18 | public ReturnT route(TriggerParam triggerParam, List addressList) { 19 | String address = addressList.get(localRandom.nextInt(addressList.size())); 20 | return new ReturnT(address); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/route/strategy/ExecutorRouteRound.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.route.strategy; 2 | 3 | import com.jason.demo.xxljob.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | import java.util.Random; 9 | import java.util.concurrent.ConcurrentHashMap; 10 | import java.util.concurrent.ConcurrentMap; 11 | 12 | /** 13 | * Created by jason on 17/3/10. 14 | */ 15 | public class ExecutorRouteRound extends ExecutorRouter { 16 | 17 | private static ConcurrentMap routeCountEachJob = new ConcurrentHashMap(); 18 | private static long CACHE_VALID_TIME = 0; 19 | private static int count(int jobId) { 20 | // cache clear 21 | if (System.currentTimeMillis() > CACHE_VALID_TIME) { 22 | routeCountEachJob.clear(); 23 | CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24; 24 | } 25 | 26 | // count++ 27 | Integer count = routeCountEachJob.get(jobId); 28 | count = (count==null || count>1000000)?(new Random().nextInt(100)):++count; // 初始化时主动Random一次,缓解首次压力 29 | routeCountEachJob.put(jobId, count); 30 | return count; 31 | } 32 | 33 | @Override 34 | public ReturnT route(TriggerParam triggerParam, List addressList) { 35 | String address = addressList.get(count(triggerParam.getJobId())%addressList.size()); 36 | return new ReturnT(address); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/trigger/TriggerTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.trigger; 2 | 3 | import com.jason.demo.xxljob.admin.core.util.I18nUtil; 4 | 5 | /** 6 | * trigger type enum 7 | * 8 | * @author jason 2018-09-16 04:56:41 9 | */ 10 | public enum TriggerTypeEnum { 11 | 12 | MANUAL(I18nUtil.getString("jobconf_trigger_type_manual")), 13 | CRON(I18nUtil.getString("jobconf_trigger_type_cron")), 14 | RETRY(I18nUtil.getString("jobconf_trigger_type_retry")), 15 | PARENT(I18nUtil.getString("jobconf_trigger_type_parent")), 16 | API(I18nUtil.getString("jobconf_trigger_type_api")); 17 | 18 | private TriggerTypeEnum(String title){ 19 | this.title = title; 20 | } 21 | private String title; 22 | public String getTitle() { 23 | return title; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/core/util/FtlUtil.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.core.util; 2 | 3 | import freemarker.ext.beans.BeansWrapper; 4 | import freemarker.ext.beans.BeansWrapperBuilder; 5 | import freemarker.template.Configuration; 6 | import freemarker.template.TemplateHashModel; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | /** 11 | * ftl util 12 | * 13 | * @author jason 2018-01-17 20:37:48 14 | */ 15 | public class FtlUtil { 16 | private static Logger logger = LoggerFactory.getLogger(FtlUtil.class); 17 | 18 | private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance(); 19 | 20 | public static TemplateHashModel generateStaticModel(String packageName) { 21 | try { 22 | TemplateHashModel staticModels = wrapper.getStaticModels(); 23 | TemplateHashModel fileStatics = (TemplateHashModel) staticModels.get(packageName); 24 | return fileStatics; 25 | } catch (Exception e) { 26 | logger.error(e.getMessage(), e); 27 | } 28 | return null; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/dao/XxlJobGroupDao.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.dao; 2 | 3 | import com.jason.demo.xxljob.admin.core.model.XxlJobGroup; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by jason on 16/9/30. 11 | */ 12 | @Mapper 13 | public interface XxlJobGroupDao { 14 | 15 | public List findAll(); 16 | 17 | public List findByAddressType(@Param("addressType") int addressType); 18 | 19 | public int save(XxlJobGroup xxlJobGroup); 20 | 21 | public int update(XxlJobGroup xxlJobGroup); 22 | 23 | public int remove(@Param("id") int id); 24 | 25 | public XxlJobGroup load(@Param("id") int id); 26 | 27 | public List pageList(@Param("offset") int offset, 28 | @Param("pagesize") int pagesize, 29 | @Param("appname") String appname, 30 | @Param("title") String title); 31 | 32 | public int pageListCount(@Param("offset") int offset, 33 | @Param("pagesize") int pagesize, 34 | @Param("appname") String appname, 35 | @Param("title") String title); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/dao/XxlJobInfoDao.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.dao; 2 | 3 | import com.jason.demo.xxljob.admin.core.model.XxlJobInfo; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * job info 11 | * @author jason 2016-1-12 18:03:45 12 | */ 13 | @Mapper 14 | public interface XxlJobInfoDao { 15 | 16 | public List pageList(@Param("offset") int offset, 17 | @Param("pagesize") int pagesize, 18 | @Param("jobGroup") int jobGroup, 19 | @Param("triggerStatus") int triggerStatus, 20 | @Param("jobDesc") String jobDesc, 21 | @Param("executorHandler") String executorHandler, 22 | @Param("author") String author); 23 | public int pageListCount(@Param("offset") int offset, 24 | @Param("pagesize") int pagesize, 25 | @Param("jobGroup") int jobGroup, 26 | @Param("triggerStatus") int triggerStatus, 27 | @Param("jobDesc") String jobDesc, 28 | @Param("executorHandler") String executorHandler, 29 | @Param("author") String author); 30 | 31 | public int save(XxlJobInfo info); 32 | 33 | public XxlJobInfo loadById(@Param("id") int id); 34 | 35 | public int update(XxlJobInfo xxlJobInfo); 36 | 37 | public int delete(@Param("id") long id); 38 | 39 | public List getJobsByGroup(@Param("jobGroup") int jobGroup); 40 | 41 | public int findAllCount(); 42 | 43 | public List scheduleJobQuery(@Param("maxNextTime") long maxNextTime, @Param("pagesize") int pagesize); 44 | 45 | public int scheduleUpdate(XxlJobInfo xxlJobInfo); 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/dao/XxlJobLogGlueDao.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.dao; 2 | 3 | import com.jason.demo.xxljob.admin.core.model.XxlJobLogGlue; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * job log for glue 11 | * @author jason 2016-5-19 18:04:56 12 | */ 13 | @Mapper 14 | public interface XxlJobLogGlueDao { 15 | 16 | public int save(XxlJobLogGlue xxlJobLogGlue); 17 | 18 | public List findByJobId(@Param("jobId") int jobId); 19 | 20 | public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit); 21 | 22 | public int deleteByJobId(@Param("jobId") int jobId); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/dao/XxlJobLogReportDao.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.dao; 2 | 3 | import com.jason.demo.xxljob.admin.core.model.XxlJobLogReport; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * job log 12 | * @author jason 2019-11-22 13 | */ 14 | @Mapper 15 | public interface XxlJobLogReportDao { 16 | 17 | public int save(XxlJobLogReport xxlJobLogReport); 18 | 19 | public int update(XxlJobLogReport xxlJobLogReport); 20 | 21 | public List queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom, 22 | @Param("triggerDayTo") Date triggerDayTo); 23 | 24 | public XxlJobLogReport queryLogReportTotal(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/dao/XxlJobRegistryDao.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.dao; 2 | 3 | import com.jason.demo.xxljob.admin.core.model.XxlJobRegistry; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by jason on 16/9/30. 12 | */ 13 | @Mapper 14 | public interface XxlJobRegistryDao { 15 | 16 | public List findDead(@Param("timeout") int timeout, 17 | @Param("nowTime") Date nowTime); 18 | 19 | public int removeDead(@Param("ids") List ids); 20 | 21 | public List findAll(@Param("timeout") int timeout, 22 | @Param("nowTime") Date nowTime); 23 | 24 | public int registryUpdate(@Param("registryGroup") String registryGroup, 25 | @Param("registryKey") String registryKey, 26 | @Param("registryValue") String registryValue, 27 | @Param("updateTime") Date updateTime); 28 | 29 | public int registrySave(@Param("registryGroup") String registryGroup, 30 | @Param("registryKey") String registryKey, 31 | @Param("registryValue") String registryValue, 32 | @Param("updateTime") Date updateTime); 33 | 34 | public int registryDelete(@Param("registryGroup") String registryGroup, 35 | @Param("registryKey") String registryKey, 36 | @Param("registryValue") String registryValue); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/dao/XxlJobUserDao.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.dao; 2 | 3 | import com.jason.demo.xxljob.admin.core.model.XxlJobUser; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author jason 2019-05-04 16:44:59 11 | */ 12 | @Mapper 13 | public interface XxlJobUserDao { 14 | 15 | public List pageList(@Param("offset") int offset, 16 | @Param("pagesize") int pagesize, 17 | @Param("username") String username, 18 | @Param("role") int role); 19 | public int pageListCount(@Param("offset") int offset, 20 | @Param("pagesize") int pagesize, 21 | @Param("username") String username, 22 | @Param("role") int role); 23 | 24 | public XxlJobUser loadByUserName(@Param("username") String username); 25 | 26 | public int save(XxlJobUser xxlJobUser); 27 | 28 | public int update(XxlJobUser xxlJobUser); 29 | 30 | public int delete(@Param("id") int id); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/jason/demo/xxljob/admin/service/XxlJobService.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin.service; 2 | 3 | 4 | import com.jason.demo.xxljob.admin.core.model.XxlJobInfo; 5 | import com.xxl.job.core.biz.model.ReturnT; 6 | 7 | import java.util.Date; 8 | import java.util.Map; 9 | 10 | /** 11 | * core job action for xxl-job 12 | * 13 | * @author jason 2016-5-28 15:30:33 14 | */ 15 | public interface XxlJobService { 16 | 17 | /** 18 | * page list 19 | * 20 | * @param start 21 | * @param length 22 | * @param jobGroup 23 | * @param jobDesc 24 | * @param executorHandler 25 | * @param author 26 | * @return 27 | */ 28 | public Map pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, 29 | String executorHandler, String author); 30 | 31 | /** 32 | * add job 33 | * 34 | * @param jobInfo 35 | * @return 36 | */ 37 | public ReturnT add(XxlJobInfo jobInfo); 38 | 39 | /** 40 | * update job 41 | * 42 | * @param jobInfo 43 | * @return 44 | */ 45 | public ReturnT update(XxlJobInfo jobInfo); 46 | 47 | /** 48 | * remove job 49 | * * 50 | * @param id 51 | * @return 52 | */ 53 | public ReturnT remove(int id); 54 | 55 | /** 56 | * start job 57 | * 58 | * @param id 59 | * @return 60 | */ 61 | public ReturnT start(int id); 62 | 63 | /** 64 | * stop job 65 | * 66 | * @param id 67 | * @return 68 | */ 69 | public ReturnT stop(int id); 70 | 71 | /** 72 | * dashboard info 73 | * 74 | * @return 75 | */ 76 | public Map dashboardInfo(); 77 | 78 | /** 79 | * chart info 80 | * 81 | * @param startDate 82 | * @param endDate 83 | * @return 84 | */ 85 | public ReturnT> chartInfo(Date startDate, Date endDate); 86 | 87 | } 88 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue.css: -------------------------------------------------------------------------------- 1 | /* iCheck plugin Square skin, blue 2 | ----------------------------------- */ 3 | .icheckbox_square-blue, 4 | .iradio_square-blue { 5 | display: inline-block; 6 | *display: inline; 7 | vertical-align: middle; 8 | margin: 0; 9 | padding: 0; 10 | width: 22px; 11 | height: 22px; 12 | background: url(blue.png) no-repeat; 13 | border: none; 14 | cursor: pointer; 15 | } 16 | 17 | .icheckbox_square-blue { 18 | background-position: 0 0; 19 | } 20 | .icheckbox_square-blue.hover { 21 | background-position: -24px 0; 22 | } 23 | .icheckbox_square-blue.checked { 24 | background-position: -48px 0; 25 | } 26 | .icheckbox_square-blue.disabled { 27 | background-position: -72px 0; 28 | cursor: default; 29 | } 30 | .icheckbox_square-blue.checked.disabled { 31 | background-position: -96px 0; 32 | } 33 | 34 | .iradio_square-blue { 35 | background-position: -120px 0; 36 | } 37 | .iradio_square-blue.hover { 38 | background-position: -144px 0; 39 | } 40 | .iradio_square-blue.checked { 41 | background-position: -168px 0; 42 | } 43 | .iradio_square-blue.disabled { 44 | background-position: -192px 0; 45 | cursor: default; 46 | } 47 | .iradio_square-blue.checked.disabled { 48 | background-position: -216px 0; 49 | } 50 | 51 | /* Retina support */ 52 | @media only screen and (-webkit-min-device-pixel-ratio: 1.5), 53 | only screen and (-moz-min-device-pixel-ratio: 1.5), 54 | only screen and (-o-min-device-pixel-ratio: 3/2), 55 | only screen and (min-device-pixel-ratio: 1.5) { 56 | .icheckbox_square-blue, 57 | .iradio_square-blue { 58 | background-image: url(blue@2x.png); 59 | -webkit-background-size: 240px 24px; 60 | background-size: 240px 24px; 61 | } 62 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/favicon.ico -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/codemirror/addon/hint/anyword-hint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var WORD = /[\w$]+/, RANGE = 500; 15 | 16 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) { 17 | var word = options && options.word || WORD; 18 | var range = options && options.range || RANGE; 19 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line); 20 | var end = cur.ch, start = end; 21 | while (start && word.test(curLine.charAt(start - 1))) --start; 22 | var curWord = start != end && curLine.slice(start, end); 23 | 24 | var list = options && options.list || [], seen = {}; 25 | var re = new RegExp(word.source, "g"); 26 | for (var dir = -1; dir <= 1; dir += 2) { 27 | var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir; 28 | for (; line != endLine; line += dir) { 29 | var text = editor.getLine(line), m; 30 | while (m = re.exec(text)) { 31 | if (line == cur.line && m[0] === curWord) continue; 32 | if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) { 33 | seen[m[0]] = true; 34 | list.push(m[0]); 35 | } 36 | } 37 | } 38 | } 39 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)}; 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/codemirror/addon/hint/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | white-space: pre; 29 | color: black; 30 | cursor: pointer; 31 | } 32 | 33 | li.CodeMirror-hint-active { 34 | background: #08f; 35 | color: white; 36 | } 37 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/templates/common/common.exception.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error 6 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

System Error

25 |

${exceptionMsg}

26 | Back 27 |

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/templates/help.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <#import "./common/common.macro.ftl" as netCommon> 5 | <@netCommon.commonStyle /> 6 | ${I18n.admin_name} 7 | 8 | sidebar-collapse "> 9 |
10 | 11 | <@netCommon.commonHeader /> 12 | 13 | <@netCommon.commonLeft "help" /> 14 | 15 | 16 |
17 | 18 |
19 |

${I18n.job_help}

20 |
21 | 22 | 23 |
24 |
25 |

${I18n.admin_name_full}

26 |
27 |

28 | Github     29 | 30 |

31 | ${I18n.job_help_document} 32 |

33 | 34 |

35 |

36 |
37 |
38 | 39 |
40 | 41 | 42 | 43 | <@netCommon.commonFooter /> 44 |
45 | <@netCommon.commonScript /> 46 | 47 | 48 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/test/java/com/jason/demo/xxljob/admin/XxlJobAdminApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.admin; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class XxlJobAdminApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-excutor/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-excutor/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jason1210/java-bucket/35b36216775d8fe58e1122203b1a2f9e17e61966/xxl-job/xxl-job-excutor/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /xxl-job/xxl-job-excutor/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-excutor/src/main/java/com/jason/demo/xxljob/excutor/XxlJobExcutorApplication.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.excutor; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class XxlJobExcutorApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(XxlJobExcutorApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-excutor/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # web port 2 | server.port=8082 3 | # no web 4 | #spring.main.web-environment=false 5 | 6 | # log config 7 | logging.config=classpath:logback.xml 8 | 9 | 10 | ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" 11 | xxl.job.admin.addresses=http://127.0.0.1:8081/xxl-job-admin 12 | 13 | ### xxl-job, access token 14 | xxl.job.accessToken= 15 | 16 | ### xxl-job executor appname 17 | xxl.job.executor.appname=xxl-job-executor-sample 18 | ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null 19 | xxl.job.executor.address= 20 | ### xxl-job executor server-info 21 | xxl.job.executor.ip= 22 | xxl.job.executor.port=9999 23 | ### xxl-job executor log-path 24 | xxl.job.executor.logpath=../applogs/xxl-job/jobhandler 25 | ### xxl-job executor log-retention-days 26 | xxl.job.executor.logretentiondays=30 27 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-excutor/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-excutor/src/test/java/com/jason/demo/xxljob/excutor/XxlJobExcutorApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jason.demo.xxljob.excutor; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class XxlJobExcutorApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | --------------------------------------------------------------------------------