├── .gitignore ├── README.md ├── admin ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── admin │ │ │ ├── AdminApplication.java │ │ │ ├── annotation │ │ │ └── AuthRuleAnnotation.java │ │ │ ├── aspect │ │ │ └── AuthorizeAspect.java │ │ │ ├── config │ │ │ ├── DruidStatFilter.java │ │ │ ├── DruidStatViewServlet.java │ │ │ ├── PageHelperConfig.java │ │ │ ├── PublicFileUrlConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── constant │ │ │ ├── CacheConstant.java │ │ │ └── CookieConstant.java │ │ │ ├── controller │ │ │ ├── auth │ │ │ │ ├── AuthAdminController.java │ │ │ │ ├── AuthPermissionRuleController.java │ │ │ │ ├── AuthRoleController.java │ │ │ │ └── LoginController.java │ │ │ ├── other │ │ │ │ ├── AreaCodeController.java │ │ │ │ ├── CodeTemplateController.java │ │ │ │ ├── ProtocolController.java │ │ │ │ ├── QuestionHotController.java │ │ │ │ ├── SettingController.java │ │ │ │ └── SystemAppVersionController.java │ │ │ ├── trade │ │ │ │ ├── PairController.java │ │ │ │ ├── PairRobotController.java │ │ │ │ └── UsdtRateController.java │ │ │ └── wallet │ │ │ │ ├── CoinConfController.java │ │ │ │ ├── CoinController.java │ │ │ │ └── CoinProtocolController.java │ │ │ ├── converter │ │ │ └── AdSaveForm2AdConverter.java │ │ │ ├── dao │ │ │ └── auth │ │ │ │ ├── AuthAdminDao.java │ │ │ │ ├── AuthPermissionDao.java │ │ │ │ ├── AuthPermissionRuleDao.java │ │ │ │ ├── AuthRoleAdminDao.java │ │ │ │ └── AuthRoleDao.java │ │ │ ├── entity │ │ │ └── auth │ │ │ │ ├── AuthAdmin.java │ │ │ │ ├── AuthPermission.java │ │ │ │ ├── AuthPermissionRule.java │ │ │ │ ├── AuthRole.java │ │ │ │ └── AuthRoleAdmin.java │ │ │ ├── enums │ │ │ └── ResultEnum.java │ │ │ ├── exception │ │ │ └── JsonException.java │ │ │ ├── handler │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── req │ │ │ ├── DeleteIdReq.java │ │ │ ├── ListPageReq.java │ │ │ └── auth │ │ │ │ ├── AuthAdminQueryReq.java │ │ │ │ ├── AuthAdminSaveReq.java │ │ │ │ ├── AuthPermissionRuleSaveReq.java │ │ │ │ ├── AuthRoleAuthReq.java │ │ │ │ ├── AuthRoleQueryReq.java │ │ │ │ ├── AuthRoleSaveReq.java │ │ │ │ ├── LoginReq.java │ │ │ │ └── UpdatePasswordReq.java │ │ │ ├── res │ │ │ ├── BaseRes.java │ │ │ ├── PageSimpleRes.java │ │ │ └── auth │ │ │ │ ├── AuthAdminRes.java │ │ │ │ ├── AuthAdminRoleRes.java │ │ │ │ ├── AuthPermissionRuleMergeRes.java │ │ │ │ ├── AuthRoleRes.java │ │ │ │ ├── LoginRes.java │ │ │ │ └── LoginUserInfoRes.java │ │ │ ├── service │ │ │ └── auth │ │ │ │ ├── AuthAdminService.java │ │ │ │ ├── AuthLoginService.java │ │ │ │ ├── AuthPermissionRuleService.java │ │ │ │ ├── AuthPermissionService.java │ │ │ │ ├── AuthRoleAdminService.java │ │ │ │ ├── AuthRoleService.java │ │ │ │ └── impl │ │ │ │ ├── AuthAdminServiceImpl.java │ │ │ │ ├── AuthLoginServiceImpl.java │ │ │ │ ├── AuthPermissionRuleServiceImpl.java │ │ │ │ ├── AuthPermissionServiceImpl.java │ │ │ │ ├── AuthRoleAdminServiceImpl.java │ │ │ │ └── AuthRoleServiceImpl.java │ │ │ └── util │ │ │ ├── IpUtils.java │ │ │ ├── JwtUtils.java │ │ │ ├── PasswordUtils.java │ │ │ ├── PermissionRuleTreeUtils.java │ │ │ └── ResultVOUtils.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── mybatis │ │ ├── mapper │ │ └── auth │ │ │ ├── AuthAdminDao.xml │ │ │ ├── AuthPermissionDao.xml │ │ │ ├── AuthPermissionRuleDao.xml │ │ │ ├── AuthRoleAdminDao.xml │ │ │ └── AuthRoleDao.xml │ │ └── mybatis-config.xml │ └── test │ └── java │ └── com │ └── lmxdawn │ └── admin │ └── AdminApplicationTest.java ├── dubbo-api ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── lmxdawn │ │ └── dubboapi │ │ ├── config │ │ └── AuthConfig.java │ │ ├── interceptor │ │ ├── ConsumerAuthFilter.java │ │ └── ProviderRpcFilter.java │ │ ├── req │ │ ├── ListPageDubboReq.java │ │ ├── match │ │ │ └── MatchEventDubboReq.java │ │ ├── other │ │ │ ├── AreaCodeQueryDubboReq.java │ │ │ ├── AreaCodeSaveDubboReq.java │ │ │ ├── CodeTemplateQueryDubboReq.java │ │ │ ├── CodeTemplateSaveDubboReq.java │ │ │ ├── ProtocolQueryDubboReq.java │ │ │ ├── ProtocolSaveDubboReq.java │ │ │ ├── QuestionHotQueryDubboReq.java │ │ │ ├── QuestionHotSaveDubboReq.java │ │ │ ├── SettingQueryDubboReq.java │ │ │ ├── SettingSaveDubboReq.java │ │ │ ├── SystemAppVersionQueryDubboReq.java │ │ │ └── SystemAppVersionSaveDubboReq.java │ │ ├── trade │ │ │ ├── EntrustOrderMatchDubboReq.java │ │ │ ├── EntrustOrderRobotCreateDubboReq.java │ │ │ ├── PairQueryDubboReq.java │ │ │ ├── PairRobotSaveDubboReq.java │ │ │ ├── PairSaveDubboReq.java │ │ │ ├── UsdtRateQueryDubboReq.java │ │ │ └── UsdtRateSaveDubboReq.java │ │ ├── user │ │ │ └── MemberCoinMatchDubboReq.java │ │ ├── wallet │ │ │ ├── CoinConfQueryDubboReq.java │ │ │ ├── CoinConfSaveDubboReq.java │ │ │ ├── CoinProtocolQueryDubboReq.java │ │ │ ├── CoinProtocolSaveDubboReq.java │ │ │ ├── CoinQueryDubboReq.java │ │ │ └── CoinSaveDubboReq.java │ │ └── ws │ │ │ └── WsMarketDubboReq.java │ │ ├── res │ │ ├── PageSimpleDubboRes.java │ │ ├── market │ │ │ └── DepthSizeDubboRes.java │ │ ├── other │ │ │ ├── AreaCodeInfoDubboRes.java │ │ │ ├── CodeTemplateInfoDubboRes.java │ │ │ ├── ProtocolInfoDubboRes.java │ │ │ ├── QuestionHotInfoDubboRes.java │ │ │ ├── SettingInfoDubboRes.java │ │ │ ├── StorageSettingVoDubboRes.java │ │ │ ├── SystemAppVersionInfoDubboRes.java │ │ │ └── UploadUrlAndThumbDubboRes.java │ │ ├── trade │ │ │ ├── EntrustOrderMatchDubboRes.java │ │ │ ├── PairDubboRes.java │ │ │ ├── PairRobotDubboRes.java │ │ │ ├── PairSimpleDubboRes.java │ │ │ └── UsdtRateDubboRes.java │ │ ├── user │ │ │ └── MemberCoinSimpleDubboRes.java │ │ └── wallet │ │ │ ├── CoinConfDubboRes.java │ │ │ ├── CoinDubboRes.java │ │ │ ├── CoinProtocolDubboRes.java │ │ │ ├── CoinProtocolSimpleDubboRes.java │ │ │ └── CoinSimpleDubboRes.java │ │ ├── service │ │ ├── EchoDubboService.java │ │ ├── market │ │ │ └── DepthDubboService.java │ │ ├── match │ │ │ └── MatchDubboService.java │ │ ├── other │ │ │ ├── AreaCodeDubboService.java │ │ │ ├── CodeDubboService.java │ │ │ ├── CodeTemplateDubboService.java │ │ │ ├── ProtocolDubboService.java │ │ │ ├── QuestionHotDubboService.java │ │ │ ├── SettingDubboService.java │ │ │ └── SystemAppVersionDubboService.java │ │ ├── trade │ │ │ ├── EntrustOrderDubboService.java │ │ │ ├── PairDubboService.java │ │ │ ├── PairRobotDubboService.java │ │ │ └── UsdtRateDubboService.java │ │ ├── user │ │ │ ├── MemberCoinDubboService.java │ │ │ ├── MemberDubboService.java │ │ │ └── UserDubboService.java │ │ ├── wallet │ │ │ ├── CoinConfDubboService.java │ │ │ ├── CoinDubboService.java │ │ │ └── CoinProtocolDubboService.java │ │ └── ws │ │ │ └── WsPushDubboService.java │ │ └── util │ │ └── JwtUtils.java │ └── resources │ └── META-INF │ └── dubbo │ └── com.alibaba.dubbo.rpc.Filter ├── example ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── example │ │ │ ├── ExampleApplication.java │ │ │ ├── annotation │ │ │ └── LoginAuthAnnotation.java │ │ │ ├── aspect │ │ │ └── LoginAuthorizeAspect.java │ │ │ ├── config │ │ │ ├── DruidStatFilter.java │ │ │ ├── DruidStatViewServlet.java │ │ │ ├── OkHttpConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── constant │ │ │ └── CacheConstant.java │ │ │ ├── controller │ │ │ └── EchoController.java │ │ │ ├── dao │ │ │ └── MemberDao.java │ │ │ ├── dubbo │ │ │ └── service │ │ │ │ └── EchoDubboServiceImpl.java │ │ │ ├── entity │ │ │ └── Member.java │ │ │ ├── enums │ │ │ └── ResultEnum.java │ │ │ ├── exception │ │ │ └── JsonException.java │ │ │ ├── handler │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── req │ │ │ └── EchoReq.java │ │ │ ├── res │ │ │ ├── BaseRes.java │ │ │ └── EchoRes.java │ │ │ ├── service │ │ │ ├── LoginService.java │ │ │ └── impl │ │ │ │ └── .gitignore │ │ │ └── util │ │ │ ├── JwtUtils.java │ │ │ ├── OkHttpUtil.java │ │ │ ├── PasswordUtils.java │ │ │ ├── ResultVOUtils.java │ │ │ └── SpringBeanFactoryUtils.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── mybatis │ │ ├── mapper │ │ └── MemberDao.xml │ │ └── mybatis-config.xml │ └── test │ └── java │ └── ExampleApplicationTest.java ├── gateway ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── gateway │ │ │ ├── GatewayApplication.java │ │ │ └── swagger │ │ │ ├── config │ │ │ └── SwaggerProvider.java │ │ │ └── handler │ │ │ └── SwaggerHandler.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ └── application.properties │ └── test │ └── java │ └── com │ └── lmxdawn │ └── gateway │ └── GatewayApplicationTest.java ├── market ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── market │ │ │ ├── MarketApplication.java │ │ │ ├── annotation │ │ │ └── LoginAuthAnnotation.java │ │ │ ├── aspect │ │ │ └── LoginAuthorizeAspect.java │ │ │ ├── config │ │ │ ├── DruidStatFilter.java │ │ │ ├── DruidStatViewServlet.java │ │ │ ├── OkHttpConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── constant │ │ │ ├── CacheConstant.java │ │ │ └── MqTopicConstant.java │ │ │ ├── controller │ │ │ ├── DepthController.java │ │ │ ├── EchoController.java │ │ │ └── KLineController.java │ │ │ ├── dao │ │ │ └── KLineDao.java │ │ │ ├── dubbo │ │ │ └── service │ │ │ │ └── DepthDubboServiceImpl.java │ │ │ ├── entity │ │ │ └── KLine.java │ │ │ ├── enums │ │ │ └── ResultEnum.java │ │ │ ├── exception │ │ │ └── JsonException.java │ │ │ ├── handler │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── mq │ │ │ ├── EntrustOrderMq.java │ │ │ ├── MatchDetailMq.java │ │ │ └── WsMarketMq.java │ │ │ ├── req │ │ │ ├── DepthListReq.java │ │ │ ├── EchoReq.java │ │ │ ├── KLineListReq.java │ │ │ └── ListPageReq.java │ │ │ ├── res │ │ │ ├── BaseRes.java │ │ │ ├── DepthListRes.java │ │ │ ├── DepthRes.java │ │ │ ├── EchoRes.java │ │ │ └── KLineListRes.java │ │ │ ├── service │ │ │ ├── KLineService.java │ │ │ ├── MatchService.java │ │ │ └── impl │ │ │ │ ├── KLineServiceImpl.java │ │ │ │ └── MatchServiceImpl.java │ │ │ ├── stream │ │ │ ├── EntrustOrderStream.java │ │ │ └── MatchDetailStream.java │ │ │ ├── util │ │ │ ├── JwtUtils.java │ │ │ ├── KLineUtil.java │ │ │ ├── OkHttpUtil.java │ │ │ ├── PageUtils.java │ │ │ ├── PasswordUtils.java │ │ │ ├── ResultVOUtils.java │ │ │ └── SpringBeanFactoryUtils.java │ │ │ ├── vo │ │ │ └── KLineDateTimeVo.java │ │ │ └── ws │ │ │ ├── DataVo.java │ │ │ ├── DepthVo.java │ │ │ └── MatchVo.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── mybatis │ │ ├── mapper │ │ └── MemberDao.xml │ │ └── mybatis-config.xml │ └── test │ └── java │ └── com │ └── lmxdawn │ └── market │ ├── MarketApplicationTest.java │ ├── TimeTest.java │ └── service │ └── impl │ └── KLineServiceImplTest.java ├── match ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── lmxdawn │ │ └── match │ │ ├── MatchApplication.java │ │ ├── constant │ │ └── MqTopicConstant.java │ │ ├── disruptor │ │ ├── MatchDataLimitBuyHolder.java │ │ ├── MatchDataLimitSellHolder.java │ │ ├── MatchDataMarketBuyHolder.java │ │ ├── MatchDataMarketSellHolder.java │ │ ├── MatchEvent.java │ │ ├── MatchEventHandler.java │ │ └── MatchEventProducer.java │ │ ├── dubbo │ │ └── service │ │ │ └── MatchDubboServiceImpl.java │ │ ├── mq │ │ └── MatchDetailMq.java │ │ └── service │ │ ├── MatchService.java │ │ └── impl │ │ └── MatchServiceImpl.java │ └── resources │ ├── application-dev.properties │ ├── application-prod.properties │ ├── application.properties │ └── mybatis │ ├── mapper │ └── .gitignore │ └── mybatis-config.xml ├── other ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── other │ │ │ ├── OtherApplication.java │ │ │ ├── config │ │ │ ├── DruidStatFilter.java │ │ │ ├── DruidStatViewServlet.java │ │ │ ├── OkHttpConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── constant │ │ │ ├── CacheConstant.java │ │ │ ├── CodeConstant.java │ │ │ └── SettingKeyConstant.java │ │ │ ├── controller │ │ │ ├── AreaCodeController.java │ │ │ ├── EmailController.java │ │ │ ├── ProtocolController.java │ │ │ ├── QuestionHotController.java │ │ │ ├── RegionController.java │ │ │ ├── SettingController.java │ │ │ ├── SmsController.java │ │ │ ├── StorageController.java │ │ │ └── TestController.java │ │ │ ├── dao │ │ │ ├── AreaCodeDao.java │ │ │ ├── CodeTemplateDao.java │ │ │ ├── ProtocolDao.java │ │ │ ├── QuestionHotDao.java │ │ │ ├── RegionDao.java │ │ │ ├── SettingDao.java │ │ │ └── SystemAppVersionDao.java │ │ │ ├── dubbo │ │ │ └── service │ │ │ │ ├── AreaCodeDubboServiceImpl.java │ │ │ │ ├── CodeDubboServiceImpl.java │ │ │ │ ├── CodeTemplateDubboServiceImpl.java │ │ │ │ ├── ProtocolDubboServiceImpl.java │ │ │ │ ├── QuestionHotDubboServiceImpl.java │ │ │ │ ├── SettingDubboServiceImpl.java │ │ │ │ └── SystemAppVersionDubboServiceImpl.java │ │ │ ├── entity │ │ │ ├── AreaCode.java │ │ │ ├── CodeTemplate.java │ │ │ ├── Protocol.java │ │ │ ├── QuestionHot.java │ │ │ ├── Region.java │ │ │ ├── Setting.java │ │ │ └── SystemAppVersion.java │ │ │ ├── enums │ │ │ └── ResultEnum.java │ │ │ ├── exception │ │ │ └── JsonException.java │ │ │ ├── handler │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── req │ │ │ ├── AreaCodeListPageReq.java │ │ │ ├── EmailSendReq.java │ │ │ ├── HuaWeiObsAllReq.java │ │ │ ├── HuaWeiObsReq.java │ │ │ ├── ListPageReq.java │ │ │ ├── ProtocolReadReq.java │ │ │ ├── QuestionHotListPageReq.java │ │ │ ├── RegionListReq.java │ │ │ ├── SmsSendReq.java │ │ │ ├── SystemAppVersionReq.java │ │ │ └── VideoToImageReq.java │ │ │ ├── res │ │ │ ├── AreaCodeInfoRes.java │ │ │ ├── BaseRes.java │ │ │ ├── HuaWeiObsPostParamRes.java │ │ │ ├── HuaWeiObsPutParamRes.java │ │ │ ├── HuaWeiSmsSendRes.java │ │ │ ├── OnlineServiceInfoRes.java │ │ │ ├── ProtocolInfoRes.java │ │ │ ├── QuestionHotListInfoRes.java │ │ │ ├── RegionListInfoRes.java │ │ │ ├── SettingAppInfoRes.java │ │ │ ├── SmsCountryCodeInfoRes.java │ │ │ └── SystemAppVersionInfoRes.java │ │ │ ├── service │ │ │ ├── AppSettingService.java │ │ │ ├── AreaCodeService.java │ │ │ ├── CodeTemplateService.java │ │ │ ├── HuaWeiObsService.java │ │ │ ├── ProtocolService.java │ │ │ ├── QuestionHotService.java │ │ │ ├── RegionService.java │ │ │ ├── SettingService.java │ │ │ ├── SystemAppVersionService.java │ │ │ └── impl │ │ │ │ ├── AppSettingServiceImpl.java │ │ │ │ ├── AreaCodeServiceImpl.java │ │ │ │ ├── CodeTemplateServiceImpl.java │ │ │ │ ├── HuaWeiObsServiceImpl.java │ │ │ │ ├── ProtocolServiceImpl.java │ │ │ │ ├── QuestionHotServiceImpl.java │ │ │ │ ├── RegionServiceImpl.java │ │ │ │ ├── SettingServiceImpl.java │ │ │ │ └── SystemAppVersionServiceImpl.java │ │ │ ├── util │ │ │ ├── EmailUtil.java │ │ │ ├── HuaWeiSmsUtil.java │ │ │ ├── OkHttpUtil.java │ │ │ ├── PageUtils.java │ │ │ ├── PublicFileUtils.java │ │ │ ├── ResultVOUtils.java │ │ │ ├── SpringBeanFactoryUtils.java │ │ │ ├── UUIDStringUtils.java │ │ │ └── UploadUrlUtils.java │ │ │ └── vo │ │ │ ├── EmailSendVo.java │ │ │ ├── HuaWeiSmsSendVo.java │ │ │ └── StorageSettingVo.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── mybatis │ │ ├── mapper │ │ ├── AreaCodeDao.xml │ │ ├── CodeTemplateDao.xml │ │ ├── ProtocolDao.xml │ │ ├── QuestionHotlDao.xml │ │ ├── RegionDao.xml │ │ ├── SettingDao.xml │ │ └── SystemAppVersionDao.xml │ │ └── mybatis-config.xml │ └── test │ └── java │ └── com │ └── lmxdawn │ └── other │ └── OtherApplicationTest.java ├── pom.xml ├── robot ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── robot │ │ │ ├── RobotApplication.java │ │ │ ├── config │ │ │ ├── OkHttpConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── dubbo │ │ │ └── service │ │ │ │ └── EchoDubboServiceImpl.java │ │ │ ├── job │ │ │ └── MarketJob.java │ │ │ ├── run │ │ │ ├── MarketRun.java │ │ │ └── MarketStartRun.java │ │ │ ├── util │ │ │ ├── JwtUtils.java │ │ │ ├── OkHttpUtil.java │ │ │ ├── PasswordUtils.java │ │ │ └── SpringBeanFactoryUtils.java │ │ │ └── vo │ │ │ └── PairRobotVo.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ └── application.properties │ └── test │ └── java │ └── com │ └── lmxdawn │ └── robot │ └── run │ └── MarketRunTest.java ├── script ├── mysql │ ├── exchange-admin.sql │ ├── exchange-market.sql │ ├── exchange-match.sql │ ├── exchange-other.sql │ ├── exchange-trade.sql │ ├── exchange-user.sql │ └── exchange-wallet.sql └── seata │ ├── README.md │ ├── client │ └── conf │ │ ├── file.conf │ │ └── registry.conf │ ├── config-center │ ├── config.txt │ └── nacos │ │ ├── nacos-config.py │ │ └── nacos-config.sh │ └── server │ └── db │ └── mysql.sql ├── trade ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── lmxdawn │ │ └── trade │ │ ├── TradeApplication.java │ │ ├── annotation │ │ └── LoginAuthAnnotation.java │ │ ├── aspect │ │ └── LoginAuthorizeAspect.java │ │ ├── config │ │ ├── DruidStatFilter.java │ │ ├── DruidStatViewServlet.java │ │ ├── OkHttpConfig.java │ │ └── SwaggerConfig.java │ │ ├── constant │ │ ├── CacheConstant.java │ │ └── MqTopicConstant.java │ │ ├── controller │ │ ├── EchoController.java │ │ ├── EntrustOrderController.java │ │ ├── EntrustOrderDetailController.java │ │ ├── PairController.java │ │ └── UsdtRateController.java │ │ ├── dao │ │ ├── EntrustOrderDao.java │ │ ├── EntrustOrderDetailDao.java │ │ ├── PairDao.java │ │ ├── PairRobotDao.java │ │ └── UsdtRateDao.java │ │ ├── dubbo │ │ └── service │ │ │ ├── EntrustOrderDubboServiceImpl.java │ │ │ ├── PairDubboServiceImpl.java │ │ │ ├── PairRobotDubboServiceImpl.java │ │ │ └── UsdtRateDubboServiceImpl.java │ │ ├── entity │ │ ├── EntrustOrder.java │ │ ├── EntrustOrderDetail.java │ │ ├── Pair.java │ │ ├── PairRobot.java │ │ └── UsdtRate.java │ │ ├── enums │ │ └── ResultEnum.java │ │ ├── exception │ │ └── JsonException.java │ │ ├── handler │ │ └── GlobalExceptionHandler.java │ │ ├── mq │ │ └── EntrustOrderMq.java │ │ ├── req │ │ ├── EchoReq.java │ │ ├── EntrustOrderCreateReq.java │ │ ├── EntrustOrderDetailReq.java │ │ ├── EntrustOrderListPageReq.java │ │ ├── EntrustOrderReadReq.java │ │ ├── ListPageReq.java │ │ ├── PairListPageReq.java │ │ ├── PairReadReq.java │ │ └── UsdtRateReadReq.java │ │ ├── res │ │ ├── BaseRes.java │ │ ├── EchoRes.java │ │ ├── EntrustOrderDetailRes.java │ │ ├── EntrustOrderRes.java │ │ ├── PairRes.java │ │ └── UsdtRateRes.java │ │ ├── service │ │ ├── EntrustOrderDetailService.java │ │ ├── EntrustOrderService.java │ │ ├── PairService.java │ │ ├── UsdtRateService.java │ │ └── impl │ │ │ ├── EntrustOrderDetailServiceImpl.java │ │ │ ├── EntrustOrderServiceImpl.java │ │ │ ├── PairServiceImpl.java │ │ │ └── UsdtRateServiceImpl.java │ │ └── util │ │ ├── JwtUtils.java │ │ ├── OkHttpUtil.java │ │ ├── PageUtils.java │ │ ├── PasswordUtils.java │ │ ├── ResultVOUtils.java │ │ └── SpringBeanFactoryUtils.java │ └── resources │ ├── application-dev.properties │ ├── application-prod.properties │ ├── application.properties │ └── mybatis │ ├── mapper │ ├── EntrustOrderDao.xml │ ├── EntrustOrderDetailDao.xml │ ├── PairDao.xml │ ├── PairRobotDao.xml │ └── UsdtRateDao.xml │ └── mybatis-config.xml ├── user ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── user │ │ │ ├── UserApplication.java │ │ │ ├── annotation │ │ │ └── LoginAuthAnnotation.java │ │ │ ├── aspect │ │ │ └── LoginAuthorizeAspect.java │ │ │ ├── config │ │ │ ├── DruidStatFilter.java │ │ │ ├── DruidStatViewServlet.java │ │ │ ├── OkHttpConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── constant │ │ │ ├── CacheConstant.java │ │ │ ├── CodeSceneConstant.java │ │ │ └── MemberBillCategoryConstant.java │ │ │ ├── controller │ │ │ ├── EchoController.java │ │ │ ├── LoginController.java │ │ │ ├── MemberBillController.java │ │ │ ├── MemberCoinController.java │ │ │ ├── MemberController.java │ │ │ └── RegisterController.java │ │ │ ├── dao │ │ │ ├── MemberBillCategoryDao.java │ │ │ ├── MemberBillDao.java │ │ │ ├── MemberCoinDao.java │ │ │ └── MemberDao.java │ │ │ ├── dubbo │ │ │ └── service │ │ │ │ ├── EchoDubboServiceImpl.java │ │ │ │ ├── MemberCoinDubboServiceImpl.java │ │ │ │ └── UserDubboServiceImpl.java │ │ │ ├── entity │ │ │ ├── Member.java │ │ │ ├── MemberBill.java │ │ │ ├── MemberBillCategory.java │ │ │ └── MemberCoin.java │ │ │ ├── enums │ │ │ └── ResultEnum.java │ │ │ ├── exception │ │ │ └── JsonException.java │ │ │ ├── handler │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── req │ │ │ ├── ListPageReq.java │ │ │ ├── LoginPwdReq.java │ │ │ ├── MemberBillListPageReq.java │ │ │ ├── MemberCoinBalanceReq.java │ │ │ ├── MemberCoinPairBalanceReq.java │ │ │ ├── RegisterEmailReq.java │ │ │ ├── RegisterTelReq.java │ │ │ ├── ReviseLoginPwdReq.java │ │ │ ├── RevisePayPwdReq.java │ │ │ └── SetPayPwdReq.java │ │ │ ├── res │ │ │ ├── BaseRes.java │ │ │ ├── EchoRes.java │ │ │ ├── LoginTokenRes.java │ │ │ ├── MemberBillCategoryRes.java │ │ │ ├── MemberBillRes.java │ │ │ ├── MemberCoinBalanceRes.java │ │ │ ├── MemberCoinPairBalanceRes.java │ │ │ ├── MemberCoinRes.java │ │ │ └── MemberLoginInfoRes.java │ │ │ ├── service │ │ │ ├── LoginService.java │ │ │ ├── MemberBillCategoryService.java │ │ │ ├── MemberBillService.java │ │ │ ├── MemberCoinService.java │ │ │ ├── MemberService.java │ │ │ └── impl │ │ │ │ ├── LoginServiceImpl.java │ │ │ │ ├── MemberBillCategoryServiceImpl.java │ │ │ │ ├── MemberBillServiceImpl.java │ │ │ │ ├── MemberCoinServiceImpl.java │ │ │ │ └── MemberServiceImpl.java │ │ │ └── util │ │ │ ├── JwtUtils.java │ │ │ ├── OkHttpUtil.java │ │ │ ├── PageUtils.java │ │ │ ├── PasswordUtils.java │ │ │ ├── ResultVOUtils.java │ │ │ └── SpringBeanFactoryUtils.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── mybatis │ │ ├── mapper │ │ ├── MemberBillCategoryDao.xml │ │ ├── MemberBillDao.xml │ │ ├── MemberCoinDao.xml │ │ └── MemberDao.xml │ │ └── mybatis-config.xml │ └── test │ └── java │ └── com │ └── lmxdawn │ └── user │ └── UserApplicationTest.java ├── wallet ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lmxdawn │ │ │ └── wallet │ │ │ ├── WalletApplication.java │ │ │ ├── annotation │ │ │ └── LoginAuthAnnotation.java │ │ │ ├── aspect │ │ │ └── LoginAuthorizeAspect.java │ │ │ ├── config │ │ │ ├── DruidStatFilter.java │ │ │ ├── DruidStatViewServlet.java │ │ │ ├── OkHttpConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── constant │ │ │ └── CacheConstant.java │ │ │ ├── controller │ │ │ └── EchoController.java │ │ │ ├── dao │ │ │ ├── CoinConfDao.java │ │ │ ├── CoinDao.java │ │ │ └── CoinProtocolDao.java │ │ │ ├── dubbo │ │ │ └── service │ │ │ │ ├── CoinConfDubboServiceImpl.java │ │ │ │ ├── CoinDubboServiceImpl.java │ │ │ │ └── CoinProtocolDubboServiceImpl.java │ │ │ ├── entity │ │ │ ├── Coin.java │ │ │ ├── CoinConf.java │ │ │ └── CoinProtocol.java │ │ │ ├── enums │ │ │ └── ResultEnum.java │ │ │ ├── exception │ │ │ └── JsonException.java │ │ │ ├── handler │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── req │ │ │ └── EchoReq.java │ │ │ ├── res │ │ │ ├── BaseRes.java │ │ │ └── EchoRes.java │ │ │ ├── service │ │ │ ├── LoginService.java │ │ │ └── impl │ │ │ │ └── .gitignore │ │ │ └── util │ │ │ ├── JwtUtils.java │ │ │ ├── OkHttpUtil.java │ │ │ ├── PageUtils.java │ │ │ ├── PasswordUtils.java │ │ │ ├── ResultVOUtils.java │ │ │ └── SpringBeanFactoryUtils.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── mybatis │ │ ├── mapper │ │ ├── CoinConfDao.xml │ │ ├── CoinDao.xml │ │ └── CoinProtocolDao.xml │ │ └── mybatis-config.xml │ └── test │ └── java │ └── WalletApplicationTest.java ├── ws-route ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── lmxdawn │ │ └── wsroute │ │ ├── WsRouteApplication.java │ │ ├── config │ │ ├── OkHttpConfig.java │ │ └── SwaggerConfig.java │ │ ├── constant │ │ └── CacheConstant.java │ │ ├── controller │ │ └── ConnectionController.java │ │ ├── enums │ │ └── ResultEnum.java │ │ ├── mq │ │ ├── WsMarketMq.java │ │ └── WsOfflineMq.java │ │ ├── req │ │ └── EchoReq.java │ │ ├── res │ │ ├── BaseRes.java │ │ ├── ConnectionInfoRes.java │ │ └── LoadBalancingIpRes.java │ │ ├── service │ │ ├── LoadBalancingService.java │ │ ├── UserLoginService.java │ │ ├── WsRouteService.java │ │ └── impl │ │ │ ├── LoadBalancingServiceImpl.java │ │ │ ├── UserLoginServiceImpl.java │ │ │ └── WsRouteServiceImpl.java │ │ ├── stream │ │ ├── WsMarketStream.java │ │ └── WsOfflineStream.java │ │ └── util │ │ ├── OkHttpUtil.java │ │ ├── ResultVOUtils.java │ │ └── SpringBeanFactoryUtils.java │ └── resources │ ├── application-dev.properties │ ├── application-prod.properties │ └── application.properties ├── ws ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── lmxdawn │ │ └── ws │ │ ├── WsApplication.java │ │ ├── config │ │ ├── OkHttpConfig.java │ │ └── SwaggerConfig.java │ │ ├── constant │ │ └── MqTopicConstant.java │ │ ├── controller │ │ └── PushController.java │ │ ├── dubbo │ │ └── service │ │ │ └── WsPushDubboServiceImpl.java │ │ ├── enums │ │ └── ResultEnum.java │ │ ├── mq │ │ └── WsOfflineMq.java │ │ ├── req │ │ ├── WSBaseReq.java │ │ └── WsMarketReq.java │ │ ├── res │ │ ├── BaseRes.java │ │ └── WSBaseRes.java │ │ ├── service │ │ ├── UserLoginService.java │ │ └── impl │ │ │ └── UserLoginServiceImpl.java │ │ ├── util │ │ └── ResultVOUtils.java │ │ └── ws │ │ ├── WSServer.java │ │ ├── WSServerHandler.java │ │ ├── WSServerInitializer.java │ │ └── WSSocketHolder.java │ └── resources │ ├── application-dev.properties │ ├── application-prod.properties │ └── application.properties └── wsTest.html /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/AdminApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class AdminApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(AdminApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/annotation/AuthRuleAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 后台登录授权/权限验证的注解 10 | */ 11 | //此注解只能修饰方法 12 | @Target(ElementType.METHOD) 13 | //当前注解如何去保持 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface AuthRuleAnnotation { 16 | String value(); 17 | } 18 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/config/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.config; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.annotation.WebInitParam; 7 | 8 | /** 9 | * 配置监控拦截器 (过滤不需要监控的后缀) 10 | * druid监控拦截器 11 | */ 12 | @WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*", 13 | initParams = { 14 | @WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")//忽略资源 15 | } 16 | ) 17 | public class DruidStatFilter extends WebStatFilter { 18 | } 19 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/config/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.config; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebInitParam; 6 | import javax.servlet.annotation.WebServlet; 7 | 8 | /** 9 | * druid监控视图配置 (监控视图配置) 10 | */ 11 | @WebServlet(urlPatterns = "/druid/*", initParams={ 12 | @WebInitParam(name="allow",value="127.0.0.1"),// IP白名单 (没有配置或者为空,则允许所有访问) 13 | @WebInitParam(name="deny",value="192.168.16.111"),// IP黑名单 (存在共同时,deny优先于allow) 14 | @WebInitParam(name="loginUsername",value="uu"),// 用户名 15 | @WebInitParam(name="loginPassword",value="HewG7p"),// 密码 16 | @WebInitParam(name="resetEnable",value="true")// 禁用HTML页面上的“Reset All”功能 17 | }) 18 | public class DruidStatViewServlet extends StatViewServlet { 19 | private static final long serialVersionUID = 2359758657306626394L; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | 8 | String ADMIN_AUTH_RULES = "aar:%s"; // 管理员的权限 9 | 10 | } 11 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/constant/CookieConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.constant; 2 | 3 | /** 4 | * cookie常量 5 | */ 6 | public interface CookieConstant { 7 | 8 | String TOKEN = "token"; 9 | 10 | Integer EXPIRE = 7200; 11 | } 12 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/converter/AdSaveForm2AdConverter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.converter; 2 | 3 | 4 | /** 5 | * 将 广告的表单 转为 广告实体类 6 | */ 7 | public class AdSaveForm2AdConverter { 8 | } 9 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/entity/auth/AuthAdmin.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.entity.auth; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class AuthAdmin { 9 | 10 | // 主键 11 | private Long id; 12 | // 昵称 13 | private String username; 14 | // 登录密码 15 | private String password; 16 | // 手机号 17 | private String tel; 18 | // 邮箱 19 | private String email; 20 | // 头像 21 | private String avatar; 22 | // 性别 23 | private Integer sex; 24 | // 最后登录ip 25 | private String lastLoginIp; 26 | // 最后登录时间 27 | private Date lastLoginTime; 28 | // 创建时间 29 | private Date createTime; 30 | // 状态 31 | private Integer status; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/entity/auth/AuthPermission.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.entity.auth; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 权限授权表 7 | */ 8 | @Data 9 | public class AuthPermission { 10 | 11 | private Long id; 12 | 13 | private Long roleId; 14 | 15 | private Long permissionRuleId; 16 | 17 | private String type; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/entity/auth/AuthPermissionRule.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.entity.auth; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 规则表 9 | */ 10 | @Data 11 | public class AuthPermissionRule { 12 | 13 | private Long id; 14 | private Long pid; 15 | private String name; 16 | private String title; 17 | private Integer status; 18 | private String condition; 19 | private Integer listorder; 20 | private Date createTime; 21 | private Date updateTime; 22 | } 23 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/entity/auth/AuthRole.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.entity.auth; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * 角色表 9 | */ 10 | @Data 11 | public class AuthRole { 12 | 13 | private Long id; 14 | private String name; 15 | private Long pid; 16 | private Long status; 17 | private String remark; 18 | private Long listorder; 19 | private Date createTime; 20 | private Date updateTime; 21 | } 22 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/entity/auth/AuthRoleAdmin.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.entity.auth; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 用户角色对应表 7 | */ 8 | @Data 9 | public class AuthRoleAdmin { 10 | private Long id; 11 | private Long roleId; 12 | private Long adminId; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | SUCCESS(0, "success"), 11 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 12 | LOGIN_VERIFY_FALL(2, "登录失效"), 13 | PARAM_VERIFY_FALL(3, "参数验证错误"), 14 | AUTH_FAILED(4, "权限验证失败"), 15 | DATA_NOT(5, "没有相关数据"), 16 | DATA_CHANGE(6, "数据没有任何更改"), 17 | DATA_REPEAT(7, "数据已存在"), 18 | ; 19 | private Integer code; 20 | private String message; 21 | ResultEnum(Integer code, String message) { 22 | this.code = code; 23 | this.message = message; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.exception; 2 | 3 | import com.lmxdawn.admin.enums.ResultEnum; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 错误处理类 8 | */ 9 | @Getter 10 | public class JsonException extends RuntimeException{ 11 | 12 | private Integer code; 13 | 14 | public JsonException(ResultEnum resultEnum) { 15 | super(resultEnum.getMessage()); 16 | this.code = resultEnum.getCode(); 17 | } 18 | 19 | public JsonException(ResultEnum resultEnum, String message) { 20 | super(message); 21 | this.code = resultEnum.getCode(); 22 | } 23 | 24 | public JsonException(Integer code, String message) { 25 | super(message); 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/DeleteIdReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Min; 8 | import javax.validation.constraints.NotNull; 9 | 10 | @ApiModel 11 | @Data 12 | public class DeleteIdReq { 13 | 14 | @NotNull(message = "ID必传") 15 | @Min(value = 1,message = "ID必传") 16 | @ApiModelProperty(value = "ID", required = true) 17 | private Long id; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/ListPageReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Max; 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotNull; 10 | 11 | /** 12 | * 分页的表单 13 | */ 14 | @ApiModel 15 | @Data 16 | public class ListPageReq { 17 | 18 | @NotNull(message = "请选择第几页") 19 | @Min(message = "分页参数错误", value = 1) 20 | @ApiModelProperty(value = "页数", required = true) 21 | private Integer page; 22 | 23 | @NotNull(message = "请填写每页查询数量") 24 | @Min(value = 1, message = "分页参数不能小于1") 25 | @Max(value = 50, message = "分页参数不能大于50") 26 | @ApiModelProperty(value = "每页返回多少", required = true) 27 | private Integer limit; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/auth/AuthAdminQueryReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req.auth; 2 | 3 | import com.lmxdawn.admin.req.ListPageReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | import java.util.List; 10 | 11 | @ApiModel 12 | @EqualsAndHashCode(callSuper = true) 13 | @Data 14 | public class AuthAdminQueryReq extends ListPageReq { 15 | 16 | @ApiModelProperty(value = "用户名") 17 | private String username; 18 | 19 | @ApiModelProperty(value = "用户状态(0:禁用; 1:正常 ;2:未验证)") 20 | private Integer status; 21 | 22 | @ApiModelProperty(value = "角色ID列表") 23 | private Long roleId; 24 | 25 | @ApiModelProperty(value = "用户ID列表") 26 | private List ids; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/auth/AuthRoleAuthReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | import javax.validation.constraints.NotNull; 9 | import java.util.List; 10 | 11 | /** 12 | * 角色的授权提交表单 13 | */ 14 | @ApiModel 15 | @Data 16 | public class AuthRoleAuthReq { 17 | @NotNull(message = "请选择角色") 18 | @ApiModelProperty(value = "角色ID", required = true) 19 | private Long roleId; 20 | @NotEmpty(message = "请选择授权的权限规则") 21 | @ApiModelProperty(value = "权限规则", required = true) 22 | private List authRules; 23 | } 24 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/auth/AuthRoleQueryReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req.auth; 2 | 3 | import com.lmxdawn.admin.req.ListPageReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 角色的查询表单 11 | */ 12 | @ApiModel 13 | @EqualsAndHashCode(callSuper = true) 14 | @Data 15 | public class AuthRoleQueryReq extends ListPageReq { 16 | @ApiModelProperty(value = "权限名称") 17 | private String name; 18 | @ApiModelProperty(value = "状态(1:正常,0:禁用)") 19 | private Integer status; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/auth/AuthRoleSaveReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | 9 | /** 10 | * 角色的提交保存表单 11 | */ 12 | @ApiModel 13 | @Data 14 | public class AuthRoleSaveReq { 15 | @ApiModelProperty(value = "权限ID") 16 | private Long id; 17 | @NotEmpty(message = "请输入权限名") 18 | @ApiModelProperty(value = "权限名", required = true) 19 | private String name; 20 | @ApiModelProperty(value = "权限上级ID") 21 | private Long pid; 22 | @ApiModelProperty(value = "状态(1:正常,0:禁用)") 23 | private Long status; 24 | @ApiModelProperty(value = "备注") 25 | private String remark; 26 | @ApiModelProperty(value = "排序") 27 | private Long listorder; 28 | } 29 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/auth/LoginReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | 9 | /** 10 | * 登录验证 11 | */ 12 | @ApiModel() 13 | @Data 14 | public class LoginReq { 15 | 16 | @NotEmpty(message = "用户名不能为空") 17 | @ApiModelProperty(value = "用户名", required = true) 18 | private String userName; 19 | 20 | @NotEmpty(message = "密码不能为空") 21 | @ApiModelProperty(value = "密码", required = true) 22 | private String pwd; 23 | 24 | } -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/req/auth/UpdatePasswordReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.req.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | import javax.validation.constraints.NotNull; 9 | 10 | /** 11 | * 修改密码的表单 12 | */ 13 | @ApiModel 14 | @Data 15 | public class UpdatePasswordReq { 16 | 17 | @NotNull(message = "参数错误!") 18 | @ApiModelProperty(value = "管理员ID", required = true) 19 | private Long adminId; 20 | 21 | @NotEmpty(message = "请输入旧密码") 22 | @ApiModelProperty(value = "旧密码", required = true) 23 | private String oldPassword; 24 | 25 | @NotEmpty(message = "请输入新密码") 26 | @ApiModelProperty(value = "新密码", required = true) 27 | private String newPassword; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/res/PageSimpleRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 简单的分页返回对象 11 | */ 12 | @ApiModel 13 | @Data 14 | public class PageSimpleRes { 15 | // 总数 16 | @ApiModelProperty(value = "分页总数") 17 | private Long total; 18 | // 列表 19 | @ApiModelProperty(value = "分页列表") 20 | private List list; 21 | } 22 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/res/auth/AuthAdminRoleRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.res.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 管理员页面的筛选的角色列表 9 | */ 10 | @ApiModel 11 | @Data 12 | public class AuthAdminRoleRes { 13 | 14 | @ApiModelProperty(value = "ID") 15 | private Long id; 16 | 17 | @ApiModelProperty(value = "角色名称") 18 | private String name; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/res/auth/AuthRoleRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.res.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 角色视图 9 | */ 10 | @ApiModel 11 | @Data 12 | public class AuthRoleRes { 13 | @ApiModelProperty(value = "角色ID") 14 | private Long id; 15 | @ApiModelProperty(value = "角色名称") 16 | private String name; 17 | @ApiModelProperty(value = "角色父级ID") 18 | private Long pid; 19 | @ApiModelProperty(value = "状态(1:正常,0:禁用)") 20 | private Long status; 21 | @ApiModelProperty(value = "备注") 22 | private String remark; 23 | @ApiModelProperty(value = "排序,优先级,越小优先级越高") 24 | private Long listorder; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/res/auth/LoginRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.res.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 登录用户的信息视图 11 | */ 12 | @ApiModel 13 | @Data 14 | public class LoginRes { 15 | @ApiModelProperty(value = "用户ID") 16 | private Long id; 17 | @ApiModelProperty(value = "登录的token") 18 | private String token; 19 | } 20 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/res/auth/LoginUserInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.res.auth; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 登录用户的信息视图 11 | */ 12 | @ApiModel 13 | @Data 14 | public class LoginUserInfoRes { 15 | @ApiModelProperty(value = "用户ID") 16 | private Long id; 17 | @ApiModelProperty(value = "用户名") 18 | private String username; 19 | @ApiModelProperty(value = "头像") 20 | private String avatar; 21 | // 权限列表 22 | @ApiModelProperty(value = "权限列表") 23 | private List authRules; 24 | } 25 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/service/auth/AuthAdminService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.service.auth; 2 | 3 | import com.lmxdawn.admin.entity.auth.AuthAdmin; 4 | import com.lmxdawn.admin.req.auth.AuthAdminQueryReq; 5 | 6 | import java.util.List; 7 | 8 | public interface AuthAdminService { 9 | 10 | List listAdminPage(AuthAdminQueryReq authAdminQueryRequest); 11 | 12 | AuthAdmin findByUserName(String userName); 13 | 14 | 15 | AuthAdmin findById(Long id); 16 | 17 | 18 | AuthAdmin findPwdById(Long id); 19 | 20 | boolean insertAuthAdmin(AuthAdmin authAdmin); 21 | 22 | boolean updateAuthAdmin(AuthAdmin authAdmin); 23 | 24 | boolean deleteById(Long id); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/service/auth/AuthLoginService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.service.auth; 2 | 3 | import java.util.List; 4 | 5 | public interface AuthLoginService { 6 | 7 | List listRuleByAdminId(Long adminId); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/service/auth/AuthPermissionRuleService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.service.auth; 2 | 3 | import com.lmxdawn.admin.entity.auth.AuthPermissionRule; 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public interface AuthPermissionRuleService { 9 | 10 | 11 | List listByIdIn(List ids); 12 | 13 | 14 | List listByPid(Long pid); 15 | 16 | List listAll(); 17 | 18 | boolean insertAuthPermissionRule(AuthPermissionRule authPermissionRule); 19 | 20 | boolean updateAuthPermissionRule(AuthPermissionRule authPermissionRule); 21 | 22 | boolean deleteById(Long id); 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/service/auth/AuthPermissionService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.service.auth; 2 | 3 | import com.lmxdawn.admin.entity.auth.AuthPermission; 4 | 5 | import java.util.List; 6 | 7 | public interface AuthPermissionService { 8 | 9 | 10 | List listByRoleIdIn(List roleIds); 11 | 12 | List listByRoleId(Long roleId); 13 | 14 | int insertAuthPermissionAll(List authPermissionList); 15 | 16 | boolean deleteByRoleId(Long roleId); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/service/auth/AuthRoleAdminService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.service.auth; 2 | 3 | import com.lmxdawn.admin.entity.auth.AuthRoleAdmin; 4 | 5 | import java.util.List; 6 | 7 | public interface AuthRoleAdminService { 8 | 9 | List listByAdminId(Long adminId); 10 | 11 | List listByAdminIdIn(List adminIds); 12 | 13 | List listByRoleId(Long roleId); 14 | 15 | int insertAuthRoleAdminAll(List authRoleAdminList); 16 | 17 | int insertRolesAdminIdAll(List roles, Long adminId); 18 | 19 | boolean deleteByAdminId(Long adminId); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/service/auth/AuthRoleService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.service.auth; 2 | 3 | import com.lmxdawn.admin.entity.auth.AuthRole; 4 | import com.lmxdawn.admin.req.auth.AuthRoleQueryReq; 5 | 6 | import java.util.List; 7 | 8 | public interface AuthRoleService { 9 | 10 | List listAdminPage(AuthRoleQueryReq authRoleQueryRequest); 11 | 12 | List listAuthAdminRolePage(Integer page, Integer limit, Integer status); 13 | 14 | AuthRole findByName(String name); 15 | 16 | boolean insertAuthRole(AuthRole authRole); 17 | 18 | boolean updateAuthRole(AuthRole authRole); 19 | 20 | boolean deleteById(Long id); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /admin/src/main/java/com/lmxdawn/admin/util/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin.util; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | /** 6 | * 密码相关的工具类 7 | */ 8 | public class PasswordUtils { 9 | 10 | public static String authAdminPwd(String pwd) { 11 | return DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex(pwd.getBytes()).getBytes()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /admin/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=prod 3 | 4 | server.port=9002 5 | spring.application.name=service-admin 6 | management.endpoints.web.exposure.include=* 7 | 8 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 9 | 10 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 11 | mybatis.mapper-locations=classpath:mybatis/mapper/*/*.xml 12 | 13 | #dubbo.scan.base-packages=com.lmxdawn.admin.dubbo.service 14 | dubbo.protocol.name=dubbo 15 | dubbo.protocol.port=-1 16 | dubbo.cloud.subscribed-services=service-user,service-other,service-wallet,service-trade,service-market 17 | dubbo.consumer.check=false 18 | dubbo.consumer.filter=consumerAuthFilter 19 | 20 | spring.config.import=classpath:application-${spring.profiles.active}.properties 21 | -------------------------------------------------------------------------------- /admin/src/test/java/com/lmxdawn/admin/AdminApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.admin; 2 | 3 | import com.lmxdawn.admin.util.JwtUtils; 4 | import io.jsonwebtoken.Claims; 5 | import org.junit.jupiter.api.Test; 6 | 7 | class AdminApplicationTest { 8 | 9 | @Test 10 | void contextLoads() { 11 | // 验证 token 12 | Claims claims = JwtUtils.parse("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhZG1pbl9pZCI6MSwiZXhwIjoxNjMwNzMwNzAzfQ.00nXEYtMhshr_5RDNlpKLhWn310hNiedjCxNJrFwKX8"); 13 | long l = Long.parseLong(claims.get("admin_id").toString()); 14 | System.out.println(l); 15 | } 16 | } -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/config/AuthConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ConfigurationProperties(prefix = "dubboapi") 8 | public class AuthConfig { 9 | private String authKey = "xxx"; 10 | 11 | public String getAuthKey() { 12 | return authKey; 13 | } 14 | 15 | public void setAuthKey(String authKey) { 16 | this.authKey = authKey; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/interceptor/ConsumerAuthFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.interceptor; 2 | 3 | import com.lmxdawn.dubboapi.util.JwtUtils; 4 | import org.apache.dubbo.rpc.*; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class ConsumerAuthFilter implements Filter { 10 | 11 | @Override 12 | public Result invoke(Invoker invoker, Invocation invocation) throws RpcException { 13 | String key = "x3EEX8Di6sWfNjer486bnQAzfXWkX1R1"; 14 | Map claims = new HashMap<>(); 15 | claims.put("key", 1); 16 | String token = JwtUtils.createToken(claims, key,86400L); // 一天后过期 17 | // System.out.println("消费端拦截了*****************************" + token); 18 | invocation.setAttachment("token",token); 19 | return invoker.invoke(invocation); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/other/AreaCodeQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.other; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 协议 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class AreaCodeQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(-1: 全部,0:禁用,1:正常)") 18 | private Integer status; 19 | 20 | @ApiModelProperty(value = "语言") 21 | private String lang; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/other/CodeTemplateQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.other; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 短信模板 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class CodeTemplateQueryDubboReq extends ListPageDubboReq { 16 | @ApiModelProperty(value = "平台(1:华为云短信,2:阿里云短信,3:邮件)", position = 1) 17 | private Integer platform; 18 | 19 | @ApiModelProperty(value = "场景(1:注册,2:登录,3:绑定邮箱,4:绑定手机,5:找回登录密码,6:设置支付密码,7:找回支付密码,8:绑定谷歌验证码,9:找回谷歌验证码)", position = 2) 20 | private Integer scene; 21 | 22 | @ApiModelProperty(value = "语言", position = 2) 23 | private String lang; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/other/ProtocolQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.other; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 协议 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class ProtocolQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(-1: 全部,0:禁用,1:正常)") 18 | private Integer status; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/other/QuestionHotQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.other; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 热门问题 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class QuestionHotQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(-1: 全部,0:禁用,1:正常)") 18 | private Integer status; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/other/SettingQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.other; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 配置 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class SettingQueryDubboReq extends ListPageDubboReq { 16 | @ApiModelProperty(value = "模块(1:运营配置,2:文件存储相关,3:华为云短信)", position = 1) 17 | private Integer module; 18 | 19 | @ApiModelProperty(value = "配置的key", position = 2) 20 | private String key; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/other/SettingSaveDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.other; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 配置 12 | */ 13 | @ApiModel 14 | @Data 15 | public class SettingSaveDubboReq implements Serializable { 16 | @ApiModelProperty(value = "ID", position = 1) 17 | @NotNull(message = "Id必传") 18 | private Integer id; 19 | 20 | @ApiModelProperty(value = "配置的值", position = 2) 21 | @NotNull(message = "value必传") 22 | private String value; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/other/SystemAppVersionQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.other; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 热门问题 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class SystemAppVersionQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(-1: 全部,0:禁用,1:正常)") 18 | private Integer status; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/trade/EntrustOrderRobotCreateDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.trade; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * 委托订单创建 9 | */ 10 | @Data 11 | public class EntrustOrderRobotCreateDubboReq implements Serializable { 12 | 13 | /** 14 | * 交易币种ID 15 | * */ 16 | private Long tradeCoinId; 17 | /** 18 | * 计价币种ID 19 | * */ 20 | private Long coinId; 21 | /** 22 | * 类型(1:限价,2:市价) 23 | * */ 24 | private Integer type; 25 | /** 26 | * 方向(1:买入,2:卖出) 27 | * */ 28 | private Integer direction; 29 | /** 30 | * 价格(如果是市价则为空) 31 | * */ 32 | private Double price; 33 | /** 34 | * 数量 35 | * */ 36 | private Double amount; 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/trade/PairQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.trade; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 交易对 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class PairQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(0: 全部,1:禁用,2:正常)") 18 | private Integer status; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/trade/UsdtRateQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.trade; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * USDT汇率 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class UsdtRateQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(0: 全部,1:禁用,2:正常)") 18 | private Integer status; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/wallet/CoinConfQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.wallet; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 币种配置 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class CoinConfQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "币种ID") 18 | private Long coinId; 19 | 20 | @ApiModelProperty(value = "协议ID") 21 | private Long protocolId; 22 | 23 | @ApiModelProperty(value = "状态(0: 全部,1:禁用,2:正常)") 24 | private Integer status; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/wallet/CoinProtocolQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.wallet; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 币种 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class CoinProtocolQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(0: 全部,1:禁用,2:正常)") 18 | private Integer status; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/wallet/CoinQueryDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.wallet; 2 | 3 | import com.lmxdawn.dubboapi.req.ListPageDubboReq; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | /** 10 | * 币种 11 | */ 12 | @ApiModel 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class CoinQueryDubboReq extends ListPageDubboReq { 16 | 17 | @ApiModelProperty(value = "状态(0: 全部,1:禁用,2:正常)") 18 | private Integer status; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/req/ws/WsMarketDubboReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.req.ws; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * ws 行情消息推送 9 | */ 10 | @Data 11 | public class WsMarketDubboReq implements Serializable { 12 | 13 | /** 14 | * 委托单变化的用户ID 15 | */ 16 | private Long memberId; 17 | 18 | /** 19 | * 委托单变化的订单号 20 | */ 21 | private Long orderId; 22 | 23 | /** 24 | * 数据 25 | */ 26 | private String Data; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/PageSimpleDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | /** 12 | * 简单的分页返回对象 13 | */ 14 | @ApiModel 15 | @Data 16 | public class PageSimpleDubboRes implements Serializable { 17 | // 总数 18 | @ApiModelProperty(value = "分页总数") 19 | private Long total = 0L; 20 | // 列表 21 | @ApiModelProperty(value = "分页列表") 22 | private List list = new ArrayList<>(); 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/other/SettingInfoDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res.other; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | @Data 11 | @ApiModel 12 | public class SettingInfoDubboRes implements Serializable { 13 | 14 | @ApiModelProperty(value = "自增ID") 15 | private Integer id; 16 | 17 | @ApiModelProperty(value = "模块(1:运营配置,2:文件存储相关,3:华为云短信)") 18 | private Integer module; 19 | 20 | @ApiModelProperty(value = "配置的key") 21 | private String key; 22 | 23 | @ApiModelProperty(value = "描述") 24 | private String describe; 25 | 26 | @ApiModelProperty(value = "具体值") 27 | private String value; 28 | 29 | @ApiModelProperty(value = "更新时间") 30 | private Date modifiedTime; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/other/StorageSettingVoDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res.other; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class StorageSettingVoDubboRes implements Serializable { 9 | private String domain; 10 | private String uploadUrl; 11 | private String accessKey; 12 | private String secretKey; 13 | private String bucket; 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/other/UploadUrlAndThumbDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res.other; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | @Data 10 | @ApiModel 11 | public class UploadUrlAndThumbDubboRes implements Serializable { 12 | 13 | @ApiModelProperty(value = "原url") 14 | private String url; 15 | 16 | @ApiModelProperty(value = "缩略图url") 17 | private String thumbUrl; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/trade/EntrustOrderMatchDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res.trade; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class EntrustOrderMatchDubboRes implements Serializable { 9 | 10 | /** 11 | * 订单号 12 | */ 13 | private Long id; 14 | 15 | /** 16 | * 数量 17 | */ 18 | private Double amount; 19 | 20 | /** 21 | * 已完成数量 22 | */ 23 | private Double amountComplete; 24 | 25 | /** 26 | * 交易额 27 | */ 28 | private Double total; 29 | 30 | /** 31 | * 已完成的交易额 32 | */ 33 | private Double totalComplete; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/user/MemberCoinSimpleDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res.user; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | @Data 10 | @ApiModel 11 | public class MemberCoinSimpleDubboRes implements Serializable { 12 | 13 | @ApiModelProperty(value = "可用余额") 14 | private Double balance; 15 | 16 | @ApiModelProperty(value = "冻结余额") 17 | private Double frozenBalance; 18 | 19 | @ApiModelProperty(value = "状态(1:关闭,2:开启)") 20 | private Integer status; 21 | } 22 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/wallet/CoinProtocolSimpleDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res.wallet; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | @Data 11 | @ApiModel 12 | public class CoinProtocolSimpleDubboRes implements Serializable { 13 | @ApiModelProperty(value = "协议ID自增") 14 | private Long id; 15 | 16 | @ApiModelProperty(value = "协议名称") 17 | private String name; 18 | } 19 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/res/wallet/CoinSimpleDubboRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.res.wallet; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | @Data 11 | @ApiModel 12 | public class CoinSimpleDubboRes implements Serializable { 13 | @ApiModelProperty(value = "币种ID自增") 14 | private Long id; 15 | 16 | @ApiModelProperty(value = "币种别名") 17 | private String name; 18 | 19 | @ApiModelProperty(value = "币种全称") 20 | private String coinName; 21 | 22 | @ApiModelProperty(value = "币种单位") 23 | private String symbol; 24 | 25 | @ApiModelProperty(value = "币种精度") 26 | private Integer precision; 27 | 28 | @ApiModelProperty(value = "USDT价格") 29 | private Double usdtPrice; 30 | } 31 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/EchoDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service; 2 | 3 | /** 4 | * Echo Service. 5 | */ 6 | public interface EchoDubboService { 7 | 8 | String echo(String message); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/market/DepthDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.market; 2 | 3 | import com.lmxdawn.dubboapi.res.market.DepthSizeDubboRes; 4 | 5 | import java.math.BigDecimal; 6 | 7 | /** 8 | * 深度行情服务 9 | */ 10 | public interface DepthDubboService { 11 | 12 | DepthSizeDubboRes size(Long tradeCoinId, Long coinId, BigDecimal price, Integer initCount, Integer amountPrecision); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/match/MatchDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.match; 2 | 3 | import com.lmxdawn.dubboapi.req.match.MatchEventDubboReq; 4 | 5 | /** 6 | * 撮合引擎 7 | */ 8 | public interface MatchDubboService { 9 | 10 | /** 11 | * 加入撮合队列 12 | */ 13 | boolean push(MatchEventDubboReq req); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/other/AreaCodeDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.other; 2 | 3 | import com.lmxdawn.dubboapi.req.other.AreaCodeQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.other.AreaCodeSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.other.AreaCodeInfoDubboRes; 7 | 8 | /** 9 | * 电话地区 10 | */ 11 | public interface AreaCodeDubboService { 12 | 13 | PageSimpleDubboRes list(AreaCodeQueryDubboReq req); 14 | 15 | Long insert(AreaCodeSaveDubboReq req); 16 | 17 | boolean update(AreaCodeSaveDubboReq req); 18 | } 19 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/other/CodeDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.other; 2 | 3 | 4 | /** 5 | * 验证码服务 6 | */ 7 | public interface CodeDubboService { 8 | 9 | boolean verify(String str, Integer scene, String code); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/other/CodeTemplateDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.other; 2 | 3 | import com.lmxdawn.dubboapi.req.other.CodeTemplateQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.other.CodeTemplateSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.other.CodeTemplateInfoDubboRes; 7 | 8 | /** 9 | * 短信模板 10 | */ 11 | public interface CodeTemplateDubboService { 12 | 13 | PageSimpleDubboRes list(CodeTemplateQueryDubboReq req); 14 | 15 | Long insert(CodeTemplateSaveDubboReq req); 16 | 17 | boolean update(CodeTemplateSaveDubboReq req); 18 | 19 | boolean delete(Long id); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/other/ProtocolDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.other; 2 | 3 | import com.lmxdawn.dubboapi.req.other.ProtocolQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.other.ProtocolSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.other.ProtocolInfoDubboRes; 7 | 8 | /** 9 | * 协议 10 | */ 11 | public interface ProtocolDubboService { 12 | 13 | PageSimpleDubboRes list(ProtocolQueryDubboReq req); 14 | 15 | Long insert(ProtocolSaveDubboReq req); 16 | 17 | boolean update(ProtocolSaveDubboReq req); 18 | } 19 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/other/QuestionHotDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.other; 2 | 3 | import com.lmxdawn.dubboapi.req.other.QuestionHotQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.other.QuestionHotSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.other.QuestionHotInfoDubboRes; 7 | 8 | /** 9 | * 热门问题 10 | */ 11 | public interface QuestionHotDubboService { 12 | 13 | PageSimpleDubboRes list(QuestionHotQueryDubboReq req); 14 | 15 | Long insert(QuestionHotSaveDubboReq req); 16 | 17 | boolean update(QuestionHotSaveDubboReq req); 18 | } 19 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/other/SystemAppVersionDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.other; 2 | 3 | import com.lmxdawn.dubboapi.req.other.SystemAppVersionQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.other.SystemAppVersionSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.other.SystemAppVersionInfoDubboRes; 7 | 8 | /** 9 | * app版本 10 | */ 11 | public interface SystemAppVersionDubboService { 12 | 13 | PageSimpleDubboRes list(SystemAppVersionQueryDubboReq req); 14 | 15 | Long insert(SystemAppVersionSaveDubboReq req); 16 | 17 | boolean update(SystemAppVersionSaveDubboReq req); 18 | } 19 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/trade/EntrustOrderDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.trade; 2 | 3 | import com.lmxdawn.dubboapi.req.trade.EntrustOrderMatchDubboReq; 4 | import com.lmxdawn.dubboapi.req.trade.EntrustOrderRobotCreateDubboReq; 5 | import com.lmxdawn.dubboapi.res.trade.EntrustOrderMatchDubboRes; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * 委托 12 | */ 13 | public interface EntrustOrderDubboService { 14 | 15 | Map mapByIdIn(List ids); 16 | 17 | 18 | boolean matchIncr(EntrustOrderMatchDubboReq req); 19 | 20 | /** 21 | * 机器人创建订单 22 | * @return 23 | */ 24 | boolean robotCreate(EntrustOrderRobotCreateDubboReq req); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/trade/PairDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.trade; 2 | 3 | import com.lmxdawn.dubboapi.req.trade.PairQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.trade.PairSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.trade.PairDubboRes; 7 | import com.lmxdawn.dubboapi.res.trade.PairSimpleDubboRes; 8 | 9 | /** 10 | * 交易对 11 | */ 12 | public interface PairDubboService { 13 | 14 | PageSimpleDubboRes list(PairQueryDubboReq req); 15 | 16 | Long insert(PairSaveDubboReq req); 17 | 18 | boolean update(PairSaveDubboReq req); 19 | 20 | PairSimpleDubboRes findByTidAndCid(Long tradeCoinId, Long coinId); 21 | } 22 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/trade/PairRobotDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.trade; 2 | 3 | import com.lmxdawn.dubboapi.req.trade.PairRobotSaveDubboReq; 4 | import com.lmxdawn.dubboapi.res.trade.PairRobotDubboRes; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 交易对机器人 10 | */ 11 | public interface PairRobotDubboService { 12 | 13 | List listAll(); 14 | 15 | Long insert(PairRobotSaveDubboReq req); 16 | 17 | boolean update(PairRobotSaveDubboReq req); 18 | 19 | PairRobotDubboRes findByTidAndCid(Long tradeCoinId, Long coinId); 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/trade/UsdtRateDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.trade; 2 | 3 | import com.lmxdawn.dubboapi.req.trade.UsdtRateQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.trade.UsdtRateSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.trade.UsdtRateDubboRes; 7 | 8 | /** 9 | * USDT汇率 10 | */ 11 | public interface UsdtRateDubboService { 12 | 13 | PageSimpleDubboRes list(UsdtRateQueryDubboReq req); 14 | 15 | Long insert(UsdtRateSaveDubboReq req); 16 | 17 | boolean update(UsdtRateSaveDubboReq req); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/user/MemberCoinDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.user; 2 | 3 | import com.lmxdawn.dubboapi.req.user.MemberCoinMatchDubboReq; 4 | import com.lmxdawn.dubboapi.res.user.MemberCoinSimpleDubboRes; 5 | 6 | /** 7 | * 用户钱包dubbo服务 8 | */ 9 | public interface MemberCoinDubboService { 10 | 11 | // 增加所有用户的钱包币种 12 | boolean createAll(Long coinId); 13 | 14 | // 查询账户余额 15 | MemberCoinSimpleDubboRes balance(Long memberId, Long coinId); 16 | 17 | // 冻结余额 18 | boolean frozenBalance(Long memberId, Long coinId, double money); 19 | 20 | // 撮合更新余额 21 | boolean matchBalance(MemberCoinMatchDubboReq req); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/user/MemberDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.user; 2 | 3 | /** 4 | * 5 | */ 6 | public interface MemberDubboService { 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/user/UserDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.user; 2 | 3 | /** 4 | * 5 | */ 6 | public interface UserDubboService { 7 | 8 | Long Login(String token); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/wallet/CoinConfDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.wallet; 2 | 3 | import com.lmxdawn.dubboapi.req.wallet.CoinConfQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.wallet.CoinConfSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.wallet.CoinConfDubboRes; 7 | 8 | /** 9 | * 币种配置 10 | */ 11 | public interface CoinConfDubboService { 12 | 13 | PageSimpleDubboRes list(CoinConfQueryDubboReq req); 14 | 15 | Long insert(CoinConfSaveDubboReq req); 16 | 17 | boolean update(CoinConfSaveDubboReq req); 18 | } 19 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/wallet/CoinDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.wallet; 2 | 3 | import com.lmxdawn.dubboapi.req.wallet.CoinQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.wallet.CoinSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.wallet.CoinDubboRes; 7 | import com.lmxdawn.dubboapi.res.wallet.CoinSimpleDubboRes; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 币种 14 | */ 15 | public interface CoinDubboService { 16 | 17 | List listAll(); 18 | 19 | PageSimpleDubboRes list(CoinQueryDubboReq req); 20 | 21 | Map mapByCoinIds(List coinIds); 22 | 23 | Long insert(CoinSaveDubboReq req); 24 | 25 | boolean update(CoinSaveDubboReq req); 26 | } 27 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/wallet/CoinProtocolDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.wallet; 2 | 3 | import com.lmxdawn.dubboapi.req.wallet.CoinProtocolQueryDubboReq; 4 | import com.lmxdawn.dubboapi.req.wallet.CoinProtocolSaveDubboReq; 5 | import com.lmxdawn.dubboapi.res.PageSimpleDubboRes; 6 | import com.lmxdawn.dubboapi.res.wallet.CoinProtocolDubboRes; 7 | import com.lmxdawn.dubboapi.res.wallet.CoinProtocolSimpleDubboRes; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 币种协议 13 | */ 14 | public interface CoinProtocolDubboService { 15 | 16 | List listAll(); 17 | 18 | PageSimpleDubboRes list(CoinProtocolQueryDubboReq req); 19 | 20 | Long insert(CoinProtocolSaveDubboReq req); 21 | 22 | boolean update(CoinProtocolSaveDubboReq req); 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-api/src/main/java/com/lmxdawn/dubboapi/service/ws/WsPushDubboService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.dubboapi.service.ws; 2 | 3 | import com.lmxdawn.dubboapi.req.ws.WsMarketDubboReq; 4 | 5 | /** 6 | * ws 消息推送 7 | */ 8 | public interface WsPushDubboService { 9 | 10 | /** 11 | * 推送行情 12 | */ 13 | boolean market(WsMarketDubboReq req); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dubbo-api/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter: -------------------------------------------------------------------------------- 1 | consumerAuthFilter=com.lmxdawn.dubboapi.interceptor.ConsumerAuthFilter 2 | providerRpcFilter=com.lmxdawn.dubboapi.interceptor.ProviderRpcFilter -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/ExampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ExampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ExampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/annotation/LoginAuthAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 后台登录授权/权限验证的注解 10 | */ 11 | //此注解只能修饰方法 12 | @Target(ElementType.METHOD) 13 | //当前注解如何去保持 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface LoginAuthAnnotation { 16 | boolean isLogin() default true; 17 | } 18 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/config/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.config; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.annotation.WebInitParam; 7 | 8 | /** 9 | * 配置监控拦截器 (过滤不需要监控的后缀) 10 | * druid监控拦截器 11 | */ 12 | @WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*", 13 | initParams = { 14 | @WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")//忽略资源 15 | } 16 | ) 17 | public class DruidStatFilter extends WebStatFilter { 18 | } 19 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | 8 | String EXAMPLE = "example:%s"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/dao/MemberDao.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.dao; 2 | 3 | import com.lmxdawn.example.entity.Member; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper 7 | public interface MemberDao { 8 | 9 | /** 10 | * 根据uid查询 11 | * @param uid 12 | * @return 13 | */ 14 | Member findByUid(Long uid); 15 | 16 | /** 17 | * 根据手机号查询 18 | * @param tel 19 | * @return 20 | */ 21 | Member findByTel(String tel); 22 | 23 | /** 24 | * 插入 25 | * @param member 26 | * @return 27 | */ 28 | boolean insertMember(Member member); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/dubbo/service/EchoDubboServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.dubbo.service; 2 | 3 | import com.lmxdawn.dubboapi.service.EchoDubboService; 4 | import org.apache.dubbo.config.annotation.DubboService; 5 | 6 | @DubboService 7 | public class EchoDubboServiceImpl implements EchoDubboService { 8 | @Override 9 | public String echo(String message) { 10 | return "Echo " + message; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/entity/Member.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class Member { 9 | 10 | /** 11 | * 用户ID 12 | */ 13 | private Long uid; 14 | 15 | /** 16 | * 手机号 17 | */ 18 | private String tel; 19 | 20 | /** 21 | * 密码 22 | */ 23 | private String pwd; 24 | 25 | /** 26 | * 用户昵称 27 | */ 28 | private String name; 29 | 30 | /** 31 | * 用户头像 32 | */ 33 | private String avatar; 34 | 35 | /** 36 | * 个性签名 37 | */ 38 | private String remark; 39 | 40 | /** 41 | * 创建时间 42 | */ 43 | private Date createTime; 44 | 45 | /** 46 | * 更新时间 47 | */ 48 | private Date modifiedTime; 49 | } 50 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | ; 21 | 22 | private Integer code; 23 | 24 | private String message; 25 | 26 | ResultEnum(Integer code, String message) { 27 | this.code = code; 28 | this.message = message; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.exception; 2 | 3 | import com.lmxdawn.example.enums.ResultEnum; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 错误处理类 8 | */ 9 | @Getter 10 | public class JsonException extends RuntimeException{ 11 | 12 | private Integer code; 13 | 14 | public JsonException(ResultEnum resultEnum) { 15 | super(resultEnum.getMessage()); 16 | this.code = resultEnum.getCode(); 17 | } 18 | 19 | public JsonException(ResultEnum resultEnum, String message) { 20 | super(message); 21 | this.code = resultEnum.getCode(); 22 | } 23 | 24 | public JsonException(Integer code, String message) { 25 | super(message); 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/req/EchoReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | 9 | @ApiModel 10 | @Data 11 | public class EchoReq { 12 | 13 | // 用户手机 14 | @ApiModelProperty(value = "手机号") 15 | @NotEmpty(message = "Phone number cannot be empty") 16 | private String tel; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/res/EchoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel(value = "打印信息类") 8 | @Data 9 | public class EchoRes { 10 | @ApiModelProperty(value = "具体信息", required = true) 11 | private String str; 12 | } 13 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/service/LoginService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.service; 2 | 3 | public interface LoginService { 4 | String createToken(Long uid); 5 | Long verify(String token); 6 | void delete(Long uid); 7 | } 8 | -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/service/impl/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmxdawn/exchange/7d331e5013e08c122c5d498dc22375b5f74d9e6e/example/src/main/java/com/lmxdawn/example/service/impl/.gitignore -------------------------------------------------------------------------------- /example/src/main/java/com/lmxdawn/example/util/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.example.util; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | /** 6 | * 密码相关的工具类 7 | */ 8 | public class PasswordUtils { 9 | 10 | public static String memberPwd(String pwd) { 11 | return DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex(pwd.getBytes()).getBytes()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9004 5 | spring.application.name=service-example 6 | management.endpoints.web.exposure.include=* 7 | 8 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 9 | 10 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 11 | mybatis.mapper-locations=classpath:mybatis/mapper/*.xml 12 | 13 | dubbo.scan.base-packages=com.lmxdawn.example.dubbo.service 14 | dubbo.protocol.name=dubbo 15 | dubbo.protocol.port=-1 16 | dubbo.cloud.subscribed-services=service-user 17 | dubbo.consumer.check=false 18 | dubbo.consumer.filter=consumerAuthFilter 19 | dubbo.provider.filter=providerRpcFilter 20 | 21 | spring.config.import=classpath:application-${spring.profiles.active}.properties 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/src/test/java/ExampleApplicationTest.java: -------------------------------------------------------------------------------- 1 | import org.junit.jupiter.api.Test; 2 | 3 | import static org.junit.jupiter.api.Assertions.*; 4 | 5 | class ExampleApplicationTest { 6 | 7 | @Test 8 | void main() { 9 | } 10 | } -------------------------------------------------------------------------------- /gateway/src/main/java/com/lmxdawn/gateway/GatewayApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.gateway; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class GatewayApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(GatewayApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /gateway/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 2 | spring.cloud.nacos.discovery.username=nacos 3 | spring.cloud.nacos.discovery.password=nacos -------------------------------------------------------------------------------- /gateway/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 2 | spring.cloud.nacos.discovery.username=nacos 3 | spring.cloud.nacos.discovery.password=nacos -------------------------------------------------------------------------------- /gateway/src/test/java/com/lmxdawn/gateway/GatewayApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.gateway; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | class GatewayApplicationTest { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | } -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/MarketApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class MarketApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(MarketApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/annotation/LoginAuthAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 后台登录授权/权限验证的注解 10 | */ 11 | //此注解只能修饰方法 12 | @Target(ElementType.METHOD) 13 | //当前注解如何去保持 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface LoginAuthAnnotation { 16 | boolean isLogin() default true; 17 | } 18 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/config/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.config; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.annotation.WebInitParam; 7 | 8 | /** 9 | * 配置监控拦截器 (过滤不需要监控的后缀) 10 | * druid监控拦截器 11 | */ 12 | @WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*", 13 | initParams = { 14 | @WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")//忽略资源 15 | } 16 | ) 17 | public class DruidStatFilter extends WebStatFilter { 18 | } 19 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | 8 | // 买盘深度 9 | String BUY_DEPTH = "buy_depth:%s"; 10 | String BUY_DEPTH_INFO = "buy_depth:%s:%s"; 11 | 12 | // 卖盘深度 13 | String SELL_DEPTH = "sell_depth:%s"; 14 | String SELL_DEPTH_INFO = "sell_depth:%s:%s"; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/constant/MqTopicConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.constant; 2 | 3 | /** 4 | * 消息队列主题常量 5 | */ 6 | public interface MqTopicConstant { 7 | 8 | String WS_MARKET_TOPIC = "ws-market-topic"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/dao/KLineDao.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.dao; 2 | 3 | import com.lmxdawn.market.entity.KLine; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper 7 | public interface KLineDao { 8 | 9 | 10 | 11 | /** 12 | * 根据uid查询 13 | * @param uid 14 | * @return 15 | */ 16 | KLine findByUid(Long uid); 17 | 18 | /** 19 | * 根据手机号查询 20 | * @param tel 21 | * @return 22 | */ 23 | KLine findByTel(String tel); 24 | 25 | /** 26 | * 插入 27 | * @param member 28 | * @return 29 | */ 30 | boolean insertMember(KLine member); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | ; 21 | 22 | private Integer code; 23 | 24 | private String message; 25 | 26 | ResultEnum(Integer code, String message) { 27 | this.code = code; 28 | this.message = message; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.exception; 2 | 3 | import com.lmxdawn.market.enums.ResultEnum; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 错误处理类 8 | */ 9 | @Getter 10 | public class JsonException extends RuntimeException{ 11 | 12 | private Integer code; 13 | 14 | public JsonException(ResultEnum resultEnum) { 15 | super(resultEnum.getMessage()); 16 | this.code = resultEnum.getCode(); 17 | } 18 | 19 | public JsonException(ResultEnum resultEnum, String message) { 20 | super(message); 21 | this.code = resultEnum.getCode(); 22 | } 23 | 24 | public JsonException(Integer code, String message) { 25 | super(message); 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/mq/WsMarketMq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.mq; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class WsMarketMq { 7 | 8 | /** 9 | * 委托单变化的用户ID 10 | */ 11 | private Long memberId; 12 | 13 | /** 14 | * 委托单变化的订单号 15 | */ 16 | private Long orderId; 17 | 18 | /** 19 | * 对手委托单变化的用户ID 20 | */ 21 | private Long matchMemberId; 22 | 23 | /** 24 | * 对手委托单变化的订单号 25 | */ 26 | private Long matchOrderId; 27 | 28 | /** 29 | * 数据 30 | */ 31 | private String Data; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/req/DepthListReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Min; 8 | import javax.validation.constraints.NotNull; 9 | 10 | @ApiModel 11 | @Data 12 | public class DepthListReq { 13 | 14 | @ApiModelProperty(value = "交易币种ID") 15 | @NotNull(message = "交易币种ID不能为空") 16 | @Min(value = 1, message = "交易币种ID不能为空") 17 | private Long tradeCoinId; 18 | 19 | @ApiModelProperty(value = "计价币种ID") 20 | @NotNull(message = "计价币种ID不能为空") 21 | @Min(value = 1, message = "计价币种ID不能为空") 22 | private Long coinId; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/req/EchoReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | 9 | @ApiModel 10 | @Data 11 | public class EchoReq { 12 | 13 | // 用户手机 14 | @ApiModelProperty(value = "手机号") 15 | @NotEmpty(message = "Phone number cannot be empty") 16 | private String tel; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/res/DepthListRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | @ApiModel 11 | @Data 12 | public class DepthListRes { 13 | @ApiModelProperty(value = "买入深度") 14 | private List buyList = new ArrayList<>(); 15 | 16 | @ApiModelProperty(value = "卖出深度") 17 | private List sellList = new ArrayList<>(); 18 | } 19 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/res/DepthRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel 8 | @Data 9 | public class DepthRes { 10 | 11 | @ApiModelProperty(value = "价格") 12 | private Double price; 13 | 14 | @ApiModelProperty(value = "数量") 15 | private Double amount; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/res/EchoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel(value = "打印信息类") 8 | @Data 9 | public class EchoRes { 10 | @ApiModelProperty(value = "具体信息", required = true) 11 | private String str; 12 | } 13 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/res/KLineListRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | @ApiModel 12 | @Data 13 | public class KLineListRes { 14 | 15 | @ApiModelProperty(value = "时间") 16 | private Long time; 17 | 18 | @ApiModelProperty(value = "开盘") 19 | private BigDecimal open; 20 | 21 | @ApiModelProperty(value = "收盘") 22 | private BigDecimal close; 23 | 24 | @ApiModelProperty(value = "最低") 25 | private BigDecimal low; 26 | 27 | @ApiModelProperty(value = "最高") 28 | private BigDecimal high; 29 | 30 | @ApiModelProperty(value = "数量") 31 | private BigDecimal vol; 32 | } 33 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/service/KLineService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.service; 2 | 3 | import com.lmxdawn.market.req.KLineListReq; 4 | import com.lmxdawn.market.res.KLineListRes; 5 | 6 | import java.math.BigDecimal; 7 | import java.util.List; 8 | 9 | public interface KLineService { 10 | 11 | /** 12 | * 创建k线 13 | * @param tradeCoinId 交易币种ID 14 | * @param coinId 计价币种ID 15 | * @param price 价格 16 | * @param amount 交易量 17 | * @return 18 | */ 19 | boolean install(Long tradeCoinId, Long coinId, BigDecimal price, BigDecimal amount); 20 | 21 | List list(KLineListReq req); 22 | } 23 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/service/MatchService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.service; 2 | 3 | import com.lmxdawn.dubboapi.req.trade.EntrustOrderMatchDubboReq; 4 | import com.lmxdawn.dubboapi.req.user.MemberCoinMatchDubboReq; 5 | 6 | public interface MatchService { 7 | /** 8 | * 撮合完成 9 | */ 10 | boolean complete(MemberCoinMatchDubboReq memberCoinMatchDubboReq, EntrustOrderMatchDubboReq entrustOrderMatchDubboReq); 11 | } 12 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/util/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.util; 2 | 3 | /** 4 | * 分页工具类 5 | */ 6 | public class PageUtils { 7 | 8 | /** 9 | * 根据页数和每页显示条数返回 偏移量 10 | * @param page 11 | * @param limit 12 | * @return 13 | */ 14 | public static Integer createOffset(Integer page, Integer limit) { 15 | if (null == page || page <= 0) { 16 | page = 1; 17 | } 18 | if (null == limit || limit <= 0) { 19 | limit = 10; 20 | } 21 | return (page - 1) * limit; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/util/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.util; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | /** 6 | * 密码相关的工具类 7 | */ 8 | public class PasswordUtils { 9 | 10 | public static String memberPwd(String pwd) { 11 | return DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex(pwd.getBytes()).getBytes()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/util/SpringBeanFactoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public final class SpringBeanFactoryUtils implements ApplicationContextAware{ 10 | private static ApplicationContext context; 11 | 12 | public static T getBean(Class c){ 13 | return context.getBean(c); 14 | } 15 | 16 | 17 | public static T getBean(String name,Class clazz){ 18 | return context.getBean(name,clazz); 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/vo/KLineDateTimeVo.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 时间分组 7 | */ 8 | @Data 9 | public class KLineDateTimeVo { 10 | 11 | private Long time; 12 | private Long prevTime; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/ws/DataVo.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.ws; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | @Data 8 | public class DataVo { 9 | 10 | /** 11 | * 交易币种ID 12 | */ 13 | private Long tradeCoinId; 14 | 15 | /** 16 | * 计价币种ID 17 | */ 18 | private Long coinId; 19 | 20 | /** 21 | * 买入深度 22 | */ 23 | private List buyList; 24 | 25 | /** 26 | * 卖出深度 27 | */ 28 | private List sellList; 29 | 30 | /** 31 | * 撮合信息 32 | */ 33 | private MatchVo match; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/ws/DepthVo.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.ws; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class DepthVo { 7 | 8 | // 价格 9 | private Double price; 10 | 11 | // 数量 12 | private Double amount; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /market/src/main/java/com/lmxdawn/market/ws/MatchVo.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.ws; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class MatchVo { 7 | 8 | // 数量 9 | private Double amount; 10 | 11 | // 价格 12 | private Double price; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /market/src/test/java/com/lmxdawn/market/MarketApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market; 2 | 3 | import com.lmxdawn.market.util.KLineUtil; 4 | import com.lmxdawn.market.vo.KLineDateTimeVo; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import java.text.SimpleDateFormat; 8 | 9 | class MarketApplicationTest { 10 | 11 | @Test 12 | void main() { 13 | 14 | 15 | KLineUtil.timeMap.keySet().forEach(timeStr -> { 16 | 17 | KLineDateTimeVo timeVo = KLineUtil.createDateTime(timeStr, null, 1); 18 | 19 | System.out.println(timeStr); 20 | ss(timeVo.getTime()); 21 | ss(timeVo.getPrevTime()); 22 | }); 23 | 24 | } 25 | 26 | private static void ss(Long time) { 27 | String format = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(time * 1000); 28 | System.out.println(time); 29 | System.out.println(format); 30 | } 31 | } -------------------------------------------------------------------------------- /market/src/test/java/com/lmxdawn/market/service/impl/KLineServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.market.service.impl; 2 | 3 | import com.lmxdawn.market.service.KLineService; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | 8 | import java.math.BigDecimal; 9 | 10 | import static org.junit.jupiter.api.Assertions.*; 11 | 12 | @SpringBootTest 13 | class KLineServiceImplTest { 14 | 15 | @Autowired 16 | private KLineService kLineService; 17 | 18 | @Test 19 | void install() { 20 | 21 | 22 | Long tradeCoinId = 2L; 23 | Long coinId = 1L; 24 | BigDecimal price = BigDecimal.valueOf(1.5); 25 | BigDecimal amount = BigDecimal.valueOf(1); 26 | kLineService.install(tradeCoinId, coinId, price, amount); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /match/src/main/java/com/lmxdawn/match/MatchApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.match; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class MatchApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(MatchApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /match/src/main/java/com/lmxdawn/match/constant/MqTopicConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.match.constant; 2 | 3 | /** 4 | * 消息队列主题常量 5 | */ 6 | public interface MqTopicConstant { 7 | 8 | String MATCH_DETAIL_TOPIC = "match-detail-topic"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /match/src/main/java/com/lmxdawn/match/service/MatchService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.match.service; 2 | 3 | import com.lmxdawn.match.disruptor.MatchEvent; 4 | 5 | public interface MatchService { 6 | 7 | void publish(MatchEvent req); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /match/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9008 5 | spring.application.name=service-match 6 | management.endpoints.web.exposure.include=* 7 | 8 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 9 | 10 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 11 | mybatis.mapper-locations=classpath:mybatis/mapper/*.xml 12 | 13 | dubbo.scan.base-packages=com.lmxdawn.match.dubbo.service 14 | dubbo.protocol.name=dubbo 15 | dubbo.protocol.port=-1 16 | dubbo.cloud.subscribed-services=service-user,service-other,service-wallet 17 | dubbo.consumer.check=false 18 | dubbo.consumer.filter=consumerAuthFilter 19 | dubbo.provider.filter=providerRpcFilter 20 | 21 | spring.config.import=classpath:application-${spring.profiles.active}.properties 22 | 23 | 24 | -------------------------------------------------------------------------------- /match/src/main/resources/mybatis/mapper/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/OtherApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OtherApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(OtherApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/config/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.config; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.annotation.WebInitParam; 7 | 8 | /** 9 | * 配置监控拦截器 (过滤不需要监控的后缀) 10 | * druid监控拦截器 11 | */ 12 | @WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*", 13 | initParams = { 14 | @WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")//忽略资源 15 | } 16 | ) 17 | public class DruidStatFilter extends WebStatFilter { 18 | } 19 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/config/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.config; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebInitParam; 6 | import javax.servlet.annotation.WebServlet; 7 | 8 | /** 9 | * druid监控视图配置 (监控视图配置) 10 | */ 11 | @WebServlet(urlPatterns = "/druid/*", initParams={ 12 | @WebInitParam(name="allow",value="127.0.0.1"),// IP白名单 (没有配置或者为空,则允许所有访问) 13 | @WebInitParam(name="deny",value="192.168.16.111"),// IP黑名单 (存在共同时,deny优先于allow) 14 | @WebInitParam(name="loginUsername",value="uu"),// 用户名 15 | @WebInitParam(name="loginPassword",value="HewG7p"),// 密码 16 | @WebInitParam(name="resetEnable",value="true")// 禁用HTML页面上的“Reset All”功能 17 | }) 18 | public class DruidStatViewServlet extends StatViewServlet { 19 | private static final long serialVersionUID = 2359758657306626394L; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | 8 | String CODE_SEND = "code_send:%s"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/constant/CodeConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.constant; 2 | 3 | /** 4 | * 发送短信的常量(场景(1:注册,2:登录,3:绑定邮箱,4:绑定手机,5:找回登录密码,6:设置支付密码,7:找回支付密码,8:绑定谷歌验证码,9:找回谷歌验证码)) 5 | */ 6 | public interface CodeConstant { 7 | 8 | //************************** 9 | // 平台 10 | //************************** 11 | /** 12 | * 华为云短信 13 | */ 14 | Integer HUAWEI_PLATFORM_SMS = 1; 15 | /** 16 | * 阿里云短信 17 | */ 18 | Integer ALI_PLATFORM_SMS = 2; 19 | 20 | /** 21 | * 阿里云短信 22 | */ 23 | Integer EMAIL = 3; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.controller; 2 | 3 | import com.lmxdawn.other.res.BaseRes; 4 | import com.lmxdawn.other.util.ResultVOUtils; 5 | import io.swagger.annotations.Api; 6 | import io.swagger.annotations.ApiOperation; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @Api(tags = "测试接口") 12 | @RestController 13 | @RequestMapping("/test") 14 | public class TestController { 15 | 16 | 17 | @ApiOperation(value = "打印信息", notes = "打印信息出来") 18 | @GetMapping("/echo") 19 | public BaseRes echo() { 20 | 21 | return ResultVOUtils.success(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/dao/ProtocolDao.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.dao; 2 | 3 | import com.lmxdawn.dubboapi.req.other.ProtocolQueryDubboReq; 4 | import com.lmxdawn.dubboapi.res.other.ProtocolInfoDubboRes; 5 | import com.lmxdawn.other.entity.Protocol; 6 | import org.apache.ibatis.annotations.Mapper; 7 | 8 | import java.util.List; 9 | 10 | @Mapper 11 | public interface ProtocolDao { 12 | 13 | List listPageDubbo(ProtocolQueryDubboReq req); 14 | 15 | /** 16 | * 查询 17 | * 18 | * @param 19 | * @return 20 | */ 21 | Protocol findByKey(String key); 22 | 23 | /** 24 | * 插入 25 | * 26 | * @param 27 | * @return 28 | */ 29 | Boolean insert(Protocol protocol); 30 | 31 | /** 32 | * 修改 33 | * 34 | * @param 35 | * @return 36 | */ 37 | Boolean update(Protocol protocol); 38 | } 39 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/dao/RegionDao.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.dao; 2 | 3 | import com.lmxdawn.other.entity.Region; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | 10 | @Mapper 11 | public interface RegionDao { 12 | 13 | /** 14 | * 添加 15 | * @param 16 | * @return 17 | */ 18 | List listAllByParams(@Param("provinceId") Integer provinceId, 19 | @Param("cityId") Integer cityId, 20 | @Param("countyId") Integer countyId); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/entity/AreaCode.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.entity; 2 | 3 | import lombok.Data; 4 | import java.util.Date; 5 | 6 | @Data 7 | public class AreaCode { 8 | 9 | /** 10 | * null 11 | */ 12 | private Long id; 13 | 14 | /** 15 | * 语言 16 | */ 17 | private String lang; 18 | 19 | /** 20 | * 地区名字 21 | */ 22 | private String name; 23 | 24 | /** 25 | * 地区编号 26 | */ 27 | private Integer code; 28 | 29 | /** 30 | * 排序(升序) 31 | */ 32 | private Integer sort; 33 | 34 | /** 35 | * 状态(0:禁用,1:开启) 36 | */ 37 | private Integer status; 38 | 39 | /** 40 | * 创建时间 41 | */ 42 | private Date createTime; 43 | 44 | /** 45 | * 更新时间 46 | */ 47 | private Date modifiedTime; 48 | } 49 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/entity/Protocol.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class Protocol { 9 | 10 | /** 11 | * 自增ID 12 | */ 13 | private Long id; 14 | 15 | /** 16 | * 协议的key 17 | */ 18 | private String key; 19 | 20 | /** 21 | * 标题 22 | */ 23 | private String title; 24 | 25 | /** 26 | * 内容 27 | */ 28 | private String content; 29 | 30 | /** 31 | * 状态(0:禁用,1:开启) 32 | */ 33 | private Integer status; 34 | 35 | /** 36 | * 创建时间 37 | */ 38 | private Date createTime; 39 | 40 | /** 41 | * 更新时间 42 | */ 43 | private Date modifiedTime; 44 | } 45 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/entity/QuestionHot.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class QuestionHot { 9 | 10 | /** 11 | * 自增ID 12 | */ 13 | private Long id; 14 | 15 | /** 16 | * 标题 17 | */ 18 | private String title; 19 | 20 | /** 21 | * 内容 22 | */ 23 | private String content; 24 | 25 | /** 26 | * 排序(升序) 27 | */ 28 | private Integer sort; 29 | 30 | /** 31 | * 状态(0:禁用,1:正常) 32 | */ 33 | private Integer status; 34 | 35 | /** 36 | * 创建时间 37 | */ 38 | private Date createTime; 39 | 40 | /** 41 | * 更新时间 42 | */ 43 | private Date modifiedTime; 44 | } 45 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/entity/Region.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class Region { 9 | 10 | /** 11 | * ID 12 | */ 13 | private Integer id; 14 | 15 | /** 16 | * 上级省份ID 17 | */ 18 | private Integer provinceId; 19 | 20 | /** 21 | * 上级城市ID 22 | */ 23 | private Integer cityId; 24 | 25 | /** 26 | * 上级县ID 27 | */ 28 | private Integer countyId; 29 | 30 | /** 31 | * 名称 32 | */ 33 | private String name; 34 | 35 | /** 36 | * 是否是叶子节点(0:不是,1是) 37 | */ 38 | private Integer isLeaf; 39 | 40 | /** 41 | * 创建时间 42 | */ 43 | private Date createTime; 44 | 45 | /** 46 | * 更新时间 47 | */ 48 | private Date modifiedTime; 49 | } 50 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/entity/Setting.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Date; 6 | 7 | @Data 8 | public class Setting { 9 | 10 | /** 11 | * 自增ID 12 | */ 13 | private Integer id; 14 | 15 | /** 16 | * 模块(1:运营配置,2:文件存储相关,3:华为云短信) 17 | */ 18 | private Integer module; 19 | 20 | /** 21 | * 配置的key 22 | */ 23 | private String key; 24 | 25 | /** 26 | * 描述 27 | */ 28 | private String describe; 29 | 30 | /** 31 | * 具体值 32 | */ 33 | private String value; 34 | 35 | /** 36 | * 更新时间 37 | */ 38 | private Date modifiedTime; 39 | } 40 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | OTHER_SMS_ERR(30000, "短信发送失败"), 21 | OTHER_EMAIL_ERR(30001, "邮件发送失败"), 22 | 23 | ; 24 | 25 | private Integer code; 26 | 27 | private String message; 28 | 29 | ResultEnum(Integer code, String message) { 30 | this.code = code; 31 | this.message = message; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.exception; 2 | 3 | import com.lmxdawn.other.enums.ResultEnum; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 错误处理类 8 | */ 9 | @Getter 10 | public class JsonException extends RuntimeException{ 11 | 12 | private Integer code; 13 | 14 | public JsonException(ResultEnum resultEnum) { 15 | super(resultEnum.getMessage()); 16 | this.code = resultEnum.getCode(); 17 | } 18 | 19 | public JsonException(ResultEnum resultEnum, String message) { 20 | super(message); 21 | this.code = resultEnum.getCode(); 22 | } 23 | 24 | public JsonException(Integer code, String message) { 25 | super(message); 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/AreaCodeListPageReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | import javax.validation.constraints.NotBlank; 9 | 10 | 11 | @EqualsAndHashCode(callSuper = true) 12 | @ApiModel 13 | @Data 14 | public class AreaCodeListPageReq extends ListPageReq{ 15 | 16 | @NotBlank(message = "请选择语言") 17 | @ApiModelProperty(value = "语言", required = true) 18 | private String lang; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/EmailSendReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotNull; 9 | 10 | @ApiModel 11 | @Data 12 | public class EmailSendReq { 13 | @ApiModelProperty(value = "场景(1:注册,2:登录,3:绑定邮箱,4:绑定手机,5:找回登录密码,6:设置支付密码,7:找回支付密码,8:绑定谷歌验证码,9:找回谷歌验证码)", required = true) 14 | @NotNull(message = "场景不能为空") 15 | private Integer scene; 16 | 17 | @ApiModelProperty(value = "语言(国际化)", required = true) 18 | @NotBlank(message = "语言不能为空") 19 | private String lang; 20 | 21 | @ApiModelProperty(value = "邮箱", required = true) 22 | @NotBlank(message = "邮箱不能为空") 23 | private String email; 24 | } 25 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/HuaWeiObsAllReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | import javax.validation.constraints.Size; 9 | import java.util.List; 10 | 11 | @ApiModel 12 | @Data 13 | public class HuaWeiObsAllReq { 14 | @ApiModelProperty(value = "文件后缀列表", required = true) 15 | @NotNull(message = "至少传一个后缀") 16 | @Size(min = 1, message = "至少传一个后缀") 17 | private List suffixs; 18 | } 19 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/HuaWeiObsReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | @ApiModel 10 | @Data 11 | public class HuaWeiObsReq { 12 | @ApiModelProperty(value = "文件后缀", required = true) 13 | @NotBlank(message = "文件后缀不能为空") 14 | private String suffix; 15 | } 16 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/ListPageReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Max; 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotNull; 10 | 11 | /** 12 | * 分页的表单 13 | */ 14 | @ApiModel 15 | @Data 16 | public class ListPageReq { 17 | 18 | @NotNull(message = "请选择第几页") 19 | @Min(message = "分页参数错误", value = 1) 20 | @ApiModelProperty(value = "页数", required = true) 21 | private Integer page; 22 | 23 | @NotNull(message = "请填写每页查询数量") 24 | @Min(value = 1, message = "分页参数不能小于1") 25 | @Max(value = 5000, message = "分页参数不能大于5000") 26 | @ApiModelProperty(value = "每页返回多少", required = true) 27 | private Integer limit; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/ProtocolReadReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | @ApiModel 10 | @Data 11 | public class ProtocolReadReq { 12 | 13 | @ApiModelProperty(value = "协议key(后台获取)") 14 | @NotBlank(message = "协议不能为空") 15 | private String key; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/QuestionHotListPageReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | 8 | @EqualsAndHashCode(callSuper = true) 9 | @ApiModel 10 | @Data 11 | public class QuestionHotListPageReq extends ListPageReq{ 12 | } 13 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/RegionListReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | 9 | @ApiModel 10 | @Data 11 | public class RegionListReq { 12 | @ApiModelProperty(value = "上级省份ID", required = true, example = "0") 13 | @NotNull(message = "上级省份不能为空") 14 | private Integer provinceId; 15 | 16 | @ApiModelProperty(value = "上级城市ID", required = true, example = "0") 17 | @NotNull(message = "上级城市不能为空") 18 | private Integer cityId; 19 | 20 | @ApiModelProperty(value = "上级县ID", required = true, example = "0") 21 | @NotNull(message = "上级区县不能为空") 22 | private Integer countyId; 23 | } 24 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/SystemAppVersionReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Max; 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotBlank; 10 | import javax.validation.constraints.NotNull; 11 | 12 | @ApiModel 13 | @Data 14 | public class SystemAppVersionReq { 15 | @ApiModelProperty(value = "平台(1:苹果,2:安卓)") 16 | @NotNull(message = "请选择平台") 17 | @Min(value = 1, message = "请选择平台") 18 | @Max(value = 2, message = "请选择平台") 19 | private Integer platform; 20 | 21 | @ApiModelProperty(value = "版本号") 22 | @NotBlank(message = "请上传版本号") 23 | private String version; 24 | } 25 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/req/VideoToImageReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | @ApiModel 10 | @Data 11 | public class VideoToImageReq { 12 | @ApiModelProperty(value = "视频key", required = true) 13 | @NotBlank(message = "视频key不能为空") 14 | private String key; 15 | } 16 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/AreaCodeInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel 8 | @Data 9 | public class AreaCodeInfoRes { 10 | @ApiModelProperty(value = "ID") 11 | private Long id; 12 | @ApiModelProperty(value = "地区名字") 13 | private String name; 14 | @ApiModelProperty(value = "地区编号") 15 | private Integer code; 16 | } 17 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/HuaWeiObsPostParamRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel 8 | @Data 9 | public class HuaWeiObsPostParamRes { 10 | 11 | @ApiModelProperty(value = "上传URL") 12 | private String url; 13 | 14 | @ApiModelProperty(value = "对象名称") 15 | private String key; 16 | 17 | @ApiModelProperty(value = "x-obs-acl权限控制策略") 18 | private String xObsAcl; 19 | 20 | @ApiModelProperty(value = "Access Key") 21 | private String contentType; 22 | 23 | @ApiModelProperty(value = "Access Key") 24 | private String accessKeyId; 25 | 26 | @ApiModelProperty(value = "请求的安全策略描述") 27 | private String policy; 28 | 29 | @ApiModelProperty(value = "签名") 30 | private String signature; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/HuaWeiObsPutParamRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel 8 | @Data 9 | public class HuaWeiObsPutParamRes { 10 | 11 | @ApiModelProperty(value = "签名URL") 12 | private String signedUrl; 13 | } 14 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/HuaWeiSmsSendRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class HuaWeiSmsSendRes { 7 | 8 | private String code; 9 | 10 | private String description; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/OnlineServiceInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel 9 | public class OnlineServiceInfoRes { 10 | 11 | @ApiModelProperty(value = "用户ID") 12 | private String userId; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/ProtocolInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.Date; 8 | 9 | 10 | @ApiModel 11 | @Data 12 | public class ProtocolInfoRes { 13 | @ApiModelProperty(value = "标题") 14 | private String title; 15 | @ApiModelProperty(value = "内容") 16 | private String content; 17 | @ApiModelProperty(value = "创建时间") 18 | private Date createTime; 19 | @ApiModelProperty(value = "修改时间") 20 | private Date modifiedTime; 21 | } 22 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/QuestionHotListInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.Date; 8 | 9 | 10 | @ApiModel 11 | @Data 12 | public class QuestionHotListInfoRes { 13 | @ApiModelProperty(value = "ID") 14 | private Long id; 15 | @ApiModelProperty(value = "标题") 16 | private String title; 17 | @ApiModelProperty(value = "内容") 18 | private String content; 19 | @ApiModelProperty(value = "创建时间") 20 | private Date createTime; 21 | } 22 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/RegionListInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel 8 | @Data 9 | public class RegionListInfoRes { 10 | 11 | @ApiModelProperty(value = "ID") 12 | private Integer id; 13 | 14 | @ApiModelProperty(value = "名称") 15 | private String name; 16 | 17 | @ApiModelProperty(value = "是否是叶子节点(0:不是,1是)") 18 | private Integer isLeaf; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/SettingAppInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SettingAppInfoRes { 7 | 8 | private String iosDownloadUrl; 9 | 10 | private String androidDownloadUrl; 11 | 12 | private String h5Url; 13 | } 14 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/res/SmsCountryCodeInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel 8 | @Data 9 | public class SmsCountryCodeInfoRes { 10 | 11 | @ApiModelProperty(value = "英文名称") 12 | private String englishName; 13 | 14 | @ApiModelProperty(value = "中文名称") 15 | private String chineseName; 16 | 17 | @ApiModelProperty(value = "国家区域Code") 18 | private String countryCode; 19 | 20 | @ApiModelProperty(value = "电话区号") 21 | private String phoneCode; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/AppSettingService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.res.SettingAppInfoRes; 4 | 5 | 6 | public interface AppSettingService { 7 | 8 | /** 9 | * 获取app配置 10 | * @return 11 | */ 12 | SettingAppInfoRes appSettingInfo(); 13 | } 14 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/AreaCodeService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.req.AreaCodeListPageReq; 4 | import com.lmxdawn.other.res.AreaCodeInfoRes; 5 | 6 | import java.util.List; 7 | 8 | public interface AreaCodeService { 9 | 10 | List listByLang(AreaCodeListPageReq req); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/CodeTemplateService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.entity.CodeTemplate; 4 | 5 | 6 | public interface CodeTemplateService { 7 | 8 | /** 9 | * 根据模块获取华为云短信的全部配置,返回一个对象 10 | * @return 11 | */ 12 | CodeTemplate find(Integer platform, Integer scene, String lang); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/HuaWeiObsService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.res.HuaWeiObsPostParamRes; 4 | import com.lmxdawn.other.res.HuaWeiObsPutParamRes; 5 | 6 | import java.util.List; 7 | 8 | 9 | public interface HuaWeiObsService { 10 | 11 | /** 12 | * 获取华为云存储的上传参数 13 | * @return 14 | */ 15 | HuaWeiObsPostParamRes createUploadPostParam(String suffix); 16 | 17 | /** 18 | * 获取华为云存储的上传参数 19 | * @return 20 | */ 21 | List createUploadPostParamAll(List suffixs); 22 | 23 | /** 24 | * 获取华为云存储的上传参数 25 | * @return 26 | */ 27 | HuaWeiObsPutParamRes createUploadPutParam(String suffix); 28 | 29 | /** 30 | * 获取华为云存储的上传参数 31 | * @return 32 | */ 33 | List createUploadPutParamAll(List suffixs); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/ProtocolService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.res.ProtocolInfoRes; 4 | 5 | public interface ProtocolService { 6 | 7 | ProtocolInfoRes findByKey(String key); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/QuestionHotService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.req.QuestionHotListPageReq; 4 | import com.lmxdawn.other.res.QuestionHotListInfoRes; 5 | 6 | import java.util.List; 7 | 8 | public interface QuestionHotService { 9 | 10 | List listPage(QuestionHotListPageReq req); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/RegionService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.req.RegionListReq; 4 | import com.lmxdawn.other.res.RegionListInfoRes; 5 | 6 | import java.util.List; 7 | 8 | 9 | public interface RegionService { 10 | 11 | List listAllByParams(RegionListReq req); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/SettingService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.vo.EmailSendVo; 4 | import com.lmxdawn.other.vo.HuaWeiSmsSendVo; 5 | import com.lmxdawn.other.vo.StorageSettingVo; 6 | 7 | 8 | public interface SettingService { 9 | 10 | /** 11 | * 上传的 12 | * @return 13 | */ 14 | StorageSettingVo listToStorageSettingVo(); 15 | 16 | /** 17 | * 根据模块获取华为云短信的全部配置,返回一个对象 18 | * @return 19 | */ 20 | HuaWeiSmsSendVo listToHuaWeiSmsVo(); 21 | 22 | /** 23 | * 根据模块获取邮件配置 24 | * @return 25 | */ 26 | EmailSendVo listToEmailSendVo(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/SystemAppVersionService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service; 2 | 3 | import com.lmxdawn.other.req.SystemAppVersionReq; 4 | import com.lmxdawn.other.res.SystemAppVersionInfoRes; 5 | 6 | 7 | public interface SystemAppVersionService { 8 | 9 | SystemAppVersionInfoRes update(SystemAppVersionReq req); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/service/impl/CodeTemplateServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.service.impl; 2 | 3 | import com.lmxdawn.other.dao.CodeTemplateDao; 4 | import com.lmxdawn.other.entity.CodeTemplate; 5 | import com.lmxdawn.other.service.CodeTemplateService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class CodeTemplateServiceImpl implements CodeTemplateService { 11 | 12 | @Autowired 13 | private CodeTemplateDao codeTemplateDao; 14 | 15 | @Override 16 | public CodeTemplate find(Integer platform, Integer scene, String lang) { 17 | return codeTemplateDao.find(platform, scene, lang); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/util/EmailUtil.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.util; 2 | 3 | import com.lmxdawn.other.vo.EmailSendVo; 4 | 5 | public class EmailUtil { 6 | 7 | public static Boolean send(EmailSendVo vo) { 8 | 9 | return true; 10 | } 11 | 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/util/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.util; 2 | 3 | /** 4 | * 分页工具类 5 | */ 6 | public class PageUtils { 7 | 8 | /** 9 | * 根据页数和每页显示条数返回 偏移量 10 | * @param page 11 | * @param limit 12 | * @return 13 | */ 14 | public static Integer createOffset(Integer page, Integer limit) { 15 | if (null == page || page <= 0) { 16 | page = 1; 17 | } 18 | if (null == limit || limit <= 0) { 19 | limit = 10; 20 | } 21 | return (page - 1) * limit; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/util/SpringBeanFactoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public final class SpringBeanFactoryUtils implements ApplicationContextAware{ 10 | private static ApplicationContext context; 11 | 12 | public static T getBean(Class c){ 13 | return context.getBean(c); 14 | } 15 | 16 | 17 | public static T getBean(String name,Class clazz){ 18 | return context.getBean(name,clazz); 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/util/UUIDStringUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.util; 2 | 3 | import java.util.UUID; 4 | 5 | public class UUIDStringUtils { 6 | public static String randomUUID() { 7 | UUID uuid = UUID.randomUUID(); 8 | return uuid.toString().replace("-", "").toUpperCase(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/util/UploadUrlUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.util; 2 | 3 | /** 4 | * 分页工具类 5 | */ 6 | public class UploadUrlUtils { 7 | 8 | /** 9 | * 格式化上传url 10 | * @return 11 | */ 12 | public static String format(String url, String filePath) { 13 | 14 | if (filePath == null || filePath.isEmpty()) { 15 | return ""; 16 | } 17 | 18 | if (filePath.indexOf("http") == 0 || filePath.indexOf("/") == 0) { 19 | return filePath; 20 | } 21 | 22 | return String.format(url, filePath); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/vo/EmailSendVo.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class EmailSendVo { 7 | private String emailHost; 8 | private String emailUsername; 9 | private String emailPassword; 10 | // 发件人 11 | private String from; 12 | // 收件人 13 | private String to; 14 | // 主题 15 | private String subject; 16 | // 内容 17 | private String text; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/vo/HuaWeiSmsSendVo.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class HuaWeiSmsSendVo { 7 | private String smsAccessKey; 8 | private String smsAppSecret; 9 | private String smsSendUrl; 10 | private String smsSender; 11 | private String smsSignature; 12 | private String templateId; 13 | private String templateParas; 14 | private String receiver; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /other/src/main/java/com/lmxdawn/other/vo/StorageSettingVo.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class StorageSettingVo { 7 | private String domain; 8 | private String uploadUrl; 9 | private String accessKey; 10 | private String secretKey; 11 | private String bucket; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /other/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9003 5 | spring.application.name=service-other 6 | management.endpoints.web.exposure.include=* 7 | 8 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 9 | 10 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 11 | mybatis.mapper-locations=classpath:mybatis/mapper/*.xml 12 | 13 | dubbo.scan.base-packages=com.lmxdawn.other.dubbo.service 14 | dubbo.protocol.name=dubbo 15 | dubbo.protocol.port=-1 16 | dubbo.cloud.subscribed-services= 17 | dubbo.consumer.check=false 18 | dubbo.consumer.filter=consumerAuthFilter 19 | dubbo.provider.filter=providerRpcFilter 20 | 21 | spring.config.import=classpath:application-${spring.profiles.active}.properties 22 | 23 | 24 | -------------------------------------------------------------------------------- /other/src/main/resources/mybatis/mapper/RegionDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 21 | 22 | -------------------------------------------------------------------------------- /other/src/test/java/com/lmxdawn/other/OtherApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.other; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | class OtherApplicationTest { 8 | 9 | @Test 10 | void main() { 11 | } 12 | } -------------------------------------------------------------------------------- /robot/src/main/java/com/lmxdawn/robot/RobotApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.robot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class RobotApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(RobotApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /robot/src/main/java/com/lmxdawn/robot/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.robot.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /robot/src/main/java/com/lmxdawn/robot/dubbo/service/EchoDubboServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.robot.dubbo.service; 2 | 3 | import com.lmxdawn.dubboapi.service.EchoDubboService; 4 | import org.apache.dubbo.config.annotation.DubboService; 5 | 6 | @DubboService 7 | public class EchoDubboServiceImpl implements EchoDubboService { 8 | @Override 9 | public String echo(String message) { 10 | return "Echo " + message; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /robot/src/main/java/com/lmxdawn/robot/util/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.robot.util; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | /** 6 | * 密码相关的工具类 7 | */ 8 | public class PasswordUtils { 9 | 10 | public static String memberPwd(String pwd) { 11 | return DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex(pwd.getBytes()).getBytes()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /robot/src/main/java/com/lmxdawn/robot/util/SpringBeanFactoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.robot.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public final class SpringBeanFactoryUtils implements ApplicationContextAware{ 10 | private static ApplicationContext context; 11 | 12 | public static T getBean(Class c){ 13 | return context.getBean(c); 14 | } 15 | 16 | 17 | public static T getBean(String name,Class clazz){ 18 | return context.getBean(name,clazz); 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /robot/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | # 本地环境 2 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 3 | spring.cloud.nacos.discovery.username=nacos 4 | spring.cloud.nacos.discovery.password=nacos 5 | spring.cloud.nacos.config.server-addr=127.0.0.1:8848 6 | 7 | server.servlet.context-path= 8 | 9 | logging.level.com.lmxdawn.example.dao=debug 10 | 11 | 12 | springfox.documentation.swagger-ui.enabled=true -------------------------------------------------------------------------------- /robot/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | # 生产环境 2 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 3 | spring.cloud.nacos.discovery.username=nacos 4 | spring.cloud.nacos.discovery.password=nacos 5 | spring.cloud.nacos.config.server-addr=127.0.0.1:8848 6 | 7 | server.servlet.context-path= 8 | 9 | springfox.documentation.swagger-ui.enabled=false -------------------------------------------------------------------------------- /robot/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9011 5 | spring.application.name=service-robot 6 | management.endpoints.web.exposure.include=* 7 | 8 | dubbo.scan.base-packages=com.lmxdawn.robot.dubbo.service 9 | dubbo.protocol.name=dubbo 10 | dubbo.protocol.port=-1 11 | dubbo.cloud.subscribed-services=service-trade,service-market 12 | dubbo.consumer.check=false 13 | dubbo.consumer.filter=consumerAuthFilter 14 | dubbo.provider.filter=providerRpcFilter 15 | 16 | spring.config.import=classpath:application-${spring.profiles.active}.properties 17 | 18 | 19 | -------------------------------------------------------------------------------- /robot/src/test/java/com/lmxdawn/robot/run/MarketRunTest.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.robot.run; 2 | 3 | import com.lmxdawn.robot.vo.PairRobotVo; 4 | import org.junit.jupiter.api.Test; 5 | 6 | class MarketRunTest { 7 | 8 | @Test 9 | void run() { 10 | 11 | PairRobotVo pairRobotVo = new PairRobotVo(); 12 | pairRobotVo.setCoinId(1L); 13 | pairRobotVo.setTradeCoinId(3L); 14 | pairRobotVo.setLowerCoinName("ethusdt"); 15 | MarketRun marketRun = new MarketRun(pairRobotVo, null, null); 16 | new Thread(marketRun).start(); 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /script/seata/README.md: -------------------------------------------------------------------------------- 1 | # Seata 操作步骤 2 | 3 | ## 下载 4 | 5 | > https://github.com/seata/seata/releases 6 | 7 | ## 创建数据库 8 | 9 | > 在 `server/db` 目录找到数据文件,创建一个 seata 数据库,utf8字符,导入SQL 10 | 11 | ## 上传配置文件到 nacos 12 | 13 | > 注册中心和配置中心用的 nacos,所以先启动 nacos 14 | 15 | > 在 `config-center/nacos` 目录里面找到运行命令,把配置文件写入 nacos,配置文件里面写入了 seata 的db配置,把里面的db链接信息替换掉,seata 就会用 nacos 获取到数据库配置 16 | 17 | ```shell 18 | $ ./nacos-config.sh -h localhost -p 8848 -g SEATA_GROUP -u nacos -w nacos 19 | ``` 20 | 21 | ## 启动 22 | > 配置文件在 `client/conf` 目录 23 | 24 | > `./bin/seata-server.sh -h 公网ip(和项目同网就不用指定了)` -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/TradeApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class TradeApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(TradeApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/annotation/LoginAuthAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 后台登录授权/权限验证的注解 10 | */ 11 | //此注解只能修饰方法 12 | @Target(ElementType.METHOD) 13 | //当前注解如何去保持 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface LoginAuthAnnotation { 16 | boolean isLogin() default true; 17 | } 18 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/config/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.config; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.annotation.WebInitParam; 7 | 8 | /** 9 | * 配置监控拦截器 (过滤不需要监控的后缀) 10 | * druid监控拦截器 11 | */ 12 | @WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*", 13 | initParams = { 14 | @WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")//忽略资源 15 | } 16 | ) 17 | public class DruidStatFilter extends WebStatFilter { 18 | } 19 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/config/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.config; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebInitParam; 6 | import javax.servlet.annotation.WebServlet; 7 | 8 | /** 9 | * druid监控视图配置 (监控视图配置) 10 | */ 11 | @WebServlet(urlPatterns = "/druid/*", initParams={ 12 | @WebInitParam(name="allow",value="127.0.0.1"),// IP白名单 (没有配置或者为空,则允许所有访问) 13 | @WebInitParam(name="deny",value="192.168.16.111"),// IP黑名单 (存在共同时,deny优先于allow) 14 | @WebInitParam(name="loginUsername",value="uu"),// 用户名 15 | @WebInitParam(name="loginPassword",value="HewG7p"),// 密码 16 | @WebInitParam(name="resetEnable",value="true")// 禁用HTML页面上的“Reset All”功能 17 | }) 18 | public class DruidStatViewServlet extends StatViewServlet { 19 | private static final long serialVersionUID = 2359758657306626394L; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | 8 | String trade = "trade:%s"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/constant/MqTopicConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.constant; 2 | 3 | /** 4 | * 消息队列主题常量 5 | */ 6 | public interface MqTopicConstant { 7 | 8 | String ENTRUST_ORDER_TOPIC = "entrust-order-topic"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/dao/EntrustOrderDetailDao.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.dao; 2 | 3 | import com.lmxdawn.trade.entity.EntrustOrderDetail; 4 | import com.lmxdawn.trade.req.EntrustOrderDetailReq; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface EntrustOrderDetailDao { 11 | 12 | /** 13 | * 查询 14 | * 15 | * @return 16 | */ 17 | List listPageByMemberIdAndOrderId(EntrustOrderDetailReq req); 18 | 19 | /** 20 | * 插入 21 | * 22 | * @return 23 | */ 24 | boolean insert(EntrustOrderDetail entrustOrderDetail); 25 | 26 | /** 27 | * 批量插入 28 | * 29 | * @return 30 | */ 31 | boolean insertBatch(List list); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/entity/EntrustOrderDetail.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.entity; 2 | 3 | import lombok.Data; 4 | import java.util.Date; 5 | 6 | @Data 7 | public class EntrustOrderDetail { 8 | 9 | /** 10 | * 自增ID 11 | */ 12 | private Long id; 13 | 14 | /** 15 | * 交易币种ID 16 | */ 17 | private Long tradeCoinId; 18 | 19 | /** 20 | * 计价币种ID 21 | */ 22 | private Long coinId; 23 | 24 | /** 25 | * 用户ID 26 | */ 27 | private Long memberId; 28 | 29 | /** 30 | * 订单ID 31 | */ 32 | private Long orderId; 33 | 34 | /** 35 | * 手续费 36 | */ 37 | private Double fee; 38 | 39 | /** 40 | * 价格 41 | */ 42 | private Double price; 43 | 44 | /** 45 | * 数量 46 | */ 47 | private Double amount; 48 | 49 | /** 50 | * 创建时间 51 | */ 52 | private Date createTime; 53 | 54 | /** 55 | * 更新时间 56 | */ 57 | private Date modifiedTime; 58 | } 59 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/entity/UsdtRate.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.entity; 2 | 3 | import lombok.Data; 4 | import java.util.Date; 5 | 6 | @Data 7 | public class UsdtRate { 8 | 9 | /** 10 | * 自增ID 11 | */ 12 | private Long id; 13 | 14 | /** 15 | * 名称 16 | */ 17 | private String name; 18 | 19 | /** 20 | * 符号 21 | */ 22 | private String symbol; 23 | 24 | /** 25 | * USDT汇率 26 | */ 27 | private Double price; 28 | 29 | /** 30 | * 精度 31 | */ 32 | private Integer precision; 33 | 34 | /** 35 | * 排序(升序) 36 | */ 37 | private Integer sort; 38 | 39 | /** 40 | * 状态(1:关闭,2:开启) 41 | */ 42 | private Integer status; 43 | 44 | /** 45 | * 创建时间 46 | */ 47 | private Date createTime; 48 | 49 | /** 50 | * 更新时间 51 | */ 52 | private Date modifiedTime; 53 | } 54 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | BALANCE_NOT(70001, "钱包余额不足"), 21 | PAIR_NOT(70002, "交易对不存在"), 22 | MIN_AMOUNT(70003, "不能小于最低交易量"), 23 | MIN_TOTAL(70005, "不能小于最低交易额"), 24 | 25 | ; 26 | 27 | private Integer code; 28 | 29 | private String message; 30 | 31 | ResultEnum(Integer code, String message) { 32 | this.code = code; 33 | this.message = message; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.exception; 2 | 3 | import com.lmxdawn.trade.enums.ResultEnum; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 错误处理类 8 | */ 9 | @Getter 10 | public class JsonException extends RuntimeException{ 11 | 12 | private Integer code; 13 | 14 | public JsonException(ResultEnum resultEnum) { 15 | super(resultEnum.getMessage()); 16 | this.code = resultEnum.getCode(); 17 | } 18 | 19 | public JsonException(ResultEnum resultEnum, String message) { 20 | super(message); 21 | this.code = resultEnum.getCode(); 22 | } 23 | 24 | public JsonException(Integer code, String message) { 25 | super(message); 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/req/EchoReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | 9 | @ApiModel 10 | @Data 11 | public class EchoReq { 12 | 13 | // 用户手机 14 | @ApiModelProperty(value = "手机号") 15 | @NotEmpty(message = "Phone number cannot be empty") 16 | private String tel; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/req/EntrustOrderDetailReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | import javax.validation.constraints.NotNull; 9 | 10 | // 查询委托订单明细列表 11 | @EqualsAndHashCode(callSuper = true) 12 | @ApiModel 13 | @Data 14 | public class EntrustOrderDetailReq extends ListPageReq { 15 | 16 | @ApiModelProperty(value = "用户ID", hidden = true) 17 | private Long memberId; 18 | 19 | @ApiModelProperty(value = "订单ID") 20 | @NotNull(message = "订单ID不能为空") 21 | private Long orderId; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/req/EntrustOrderReadReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | 9 | // 查询委托订单详情 10 | @ApiModel 11 | @Data 12 | public class EntrustOrderReadReq { 13 | 14 | @ApiModelProperty(value = "用户ID", hidden = true) 15 | private Long memberId; 16 | 17 | @ApiModelProperty(value = "订单ID") 18 | @NotNull(message = "订单ID必传") 19 | private Long id; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/req/PairListPageReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | // 查询交易对列表 9 | @EqualsAndHashCode(callSuper = true) 10 | @ApiModel 11 | @Data 12 | public class PairListPageReq extends ListPageReq { 13 | 14 | @ApiModelProperty(value = "计价币种ID") 15 | private Long coinId; 16 | 17 | @ApiModelProperty(value = "收藏的id") 18 | private String collect; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/req/PairReadReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Min; 8 | import javax.validation.constraints.NotNull; 9 | 10 | // 查询交易对 11 | @ApiModel 12 | @Data 13 | public class PairReadReq { 14 | 15 | @ApiModelProperty(value = "交易币种ID") 16 | @NotNull(message = "交易币种ID不能为空") 17 | @Min(value = 1, message = "交易币种ID不能为空") 18 | private Long tradeCoinId; 19 | 20 | @ApiModelProperty(value = "计价币种ID") 21 | @NotNull(message = "计价币种ID不能为空") 22 | @Min(value = 1, message = "计价币种ID不能为空") 23 | private Long coinId; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/req/UsdtRateReadReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | // 查询交易对列表 10 | @ApiModel 11 | @Data 12 | public class UsdtRateReadReq{ 13 | 14 | @ApiModelProperty(value = "名称") 15 | @NotBlank(message = "名称不能为空") 16 | private String name; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/res/EchoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel(value = "打印信息类") 8 | @Data 9 | public class EchoRes { 10 | @ApiModelProperty(value = "具体信息", required = true) 11 | private String str; 12 | } 13 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/res/EntrustOrderDetailRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.Date; 8 | 9 | @ApiModel(value = "委托订单明细") 10 | @Data 11 | public class EntrustOrderDetailRes { 12 | @ApiModelProperty(value = "自增ID") 13 | private Long id; 14 | 15 | @ApiModelProperty(value = "手续费") 16 | private Double fee; 17 | 18 | @ApiModelProperty(value = "价格") 19 | private Double price; 20 | 21 | @ApiModelProperty(value = "数量") 22 | private Double amount; 23 | 24 | @ApiModelProperty(value = "创建时间") 25 | private Date createTime; 26 | } 27 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/res/UsdtRateRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel(value = "USDT汇率") 8 | @Data 9 | public class UsdtRateRes { 10 | 11 | @ApiModelProperty(value = "自增ID") 12 | private Long id; 13 | 14 | @ApiModelProperty(value = "名称") 15 | private String name; 16 | 17 | @ApiModelProperty(value = "符号") 18 | private String symbol; 19 | 20 | @ApiModelProperty(value = "USDT汇率") 21 | private Double price; 22 | 23 | @ApiModelProperty(value = "精度") 24 | private Integer precision; 25 | } 26 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/service/EntrustOrderDetailService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.service; 2 | 3 | import com.lmxdawn.trade.req.EntrustOrderDetailReq; 4 | import com.lmxdawn.trade.res.EntrustOrderDetailRes; 5 | 6 | import java.util.List; 7 | 8 | public interface EntrustOrderDetailService { 9 | 10 | List listPageByMemberIdAndOrderId(EntrustOrderDetailReq req); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/service/EntrustOrderService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.service; 2 | 3 | import com.lmxdawn.trade.req.EntrustOrderCreateReq; 4 | import com.lmxdawn.trade.req.EntrustOrderListPageReq; 5 | import com.lmxdawn.trade.req.EntrustOrderReadReq; 6 | import com.lmxdawn.trade.res.EntrustOrderRes; 7 | 8 | import java.util.List; 9 | 10 | public interface EntrustOrderService { 11 | 12 | List listPage(EntrustOrderListPageReq req); 13 | 14 | EntrustOrderRes read(EntrustOrderReadReq req); 15 | 16 | Long create(EntrustOrderCreateReq req); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/service/PairService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.service; 2 | 3 | import com.lmxdawn.trade.entity.Pair; 4 | import com.lmxdawn.trade.req.PairListPageReq; 5 | import com.lmxdawn.trade.req.PairReadReq; 6 | import com.lmxdawn.trade.res.PairRes; 7 | 8 | import java.util.List; 9 | 10 | public interface PairService { 11 | 12 | List listPage(PairListPageReq req); 13 | 14 | Pair findByTidAndCid(Long tradeCoinId, Long coinId); 15 | 16 | PairRes read(PairReadReq req); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/service/UsdtRateService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.service; 2 | 3 | import com.lmxdawn.trade.res.UsdtRateRes; 4 | 5 | import java.util.List; 6 | 7 | public interface UsdtRateService { 8 | 9 | List listAll(); 10 | 11 | UsdtRateRes read(String name); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/util/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.util; 2 | 3 | /** 4 | * 分页工具类 5 | */ 6 | public class PageUtils { 7 | 8 | /** 9 | * 根据页数和每页显示条数返回 偏移量 10 | * @param page 11 | * @param limit 12 | * @return 13 | */ 14 | public static Integer createOffset(Integer page, Integer limit) { 15 | if (null == page || page <= 0) { 16 | page = 1; 17 | } 18 | if (null == limit || limit <= 0) { 19 | limit = 10; 20 | } 21 | return (page - 1) * limit; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/util/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.util; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | /** 6 | * 密码相关的工具类 7 | */ 8 | public class PasswordUtils { 9 | 10 | public static String memberPwd(String pwd) { 11 | return DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex(pwd.getBytes()).getBytes()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /trade/src/main/java/com/lmxdawn/trade/util/SpringBeanFactoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.trade.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public final class SpringBeanFactoryUtils implements ApplicationContextAware{ 10 | private static ApplicationContext context; 11 | 12 | public static T getBean(Class c){ 13 | return context.getBean(c); 14 | } 15 | 16 | 17 | public static T getBean(String name,Class clazz){ 18 | return context.getBean(name,clazz); 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /trade/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9007 5 | spring.application.name=service-trade 6 | management.endpoints.web.exposure.include=* 7 | 8 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 9 | 10 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 11 | mybatis.mapper-locations=classpath:mybatis/mapper/*.xml 12 | 13 | dubbo.scan.base-packages=com.lmxdawn.trade.dubbo.service 14 | dubbo.protocol.name=dubbo 15 | dubbo.protocol.port=-1 16 | dubbo.cloud.subscribed-services=service-user,service-other,service-wallet 17 | dubbo.consumer.check=false 18 | dubbo.consumer.filter=consumerAuthFilter 19 | dubbo.provider.filter=providerRpcFilter 20 | 21 | spring.config.import=classpath:application-${spring.profiles.active}.properties 22 | 23 | 24 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/UserApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class UserApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(UserApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/annotation/LoginAuthAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 后台登录授权/权限验证的注解 10 | */ 11 | //此注解只能修饰方法 12 | @Target(ElementType.METHOD) 13 | //当前注解如何去保持 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface LoginAuthAnnotation { 16 | boolean isLogin() default true; 17 | } 18 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/config/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.config; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.annotation.WebInitParam; 7 | 8 | /** 9 | * 配置监控拦截器 (过滤不需要监控的后缀) 10 | * druid监控拦截器 11 | */ 12 | @WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*", 13 | initParams = { 14 | @WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")//忽略资源 15 | } 16 | ) 17 | public class DruidStatFilter extends WebStatFilter { 18 | } 19 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/config/DruidStatViewServlet.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.config; 2 | 3 | import com.alibaba.druid.support.http.StatViewServlet; 4 | 5 | import javax.servlet.annotation.WebInitParam; 6 | import javax.servlet.annotation.WebServlet; 7 | 8 | /** 9 | * druid监控视图配置 (监控视图配置) 10 | */ 11 | @WebServlet(urlPatterns = "/druid/*", initParams={ 12 | @WebInitParam(name="allow",value="127.0.0.1"),// IP白名单 (没有配置或者为空,则允许所有访问) 13 | @WebInitParam(name="deny",value="192.168.16.111"),// IP黑名单 (存在共同时,deny优先于allow) 14 | @WebInitParam(name="loginUsername",value="uu"),// 用户名 15 | @WebInitParam(name="loginPassword",value="HewG7p"),// 密码 16 | @WebInitParam(name="resetEnable",value="true")// 禁用HTML页面上的“Reset All”功能 17 | }) 18 | public class DruidStatViewServlet extends StatViewServlet { 19 | private static final long serialVersionUID = 2359758657306626394L; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | 8 | String USER_LOGIN = "ul:%s"; // 用户登录 9 | 10 | } 11 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/constant/CodeSceneConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.constant; 2 | 3 | /** 4 | * 验证码的场景的常量(场景(1:注册,2:登录,3:绑定邮箱,4:绑定手机,5:找回登录密码,6:设置支付密码,7:找回支付密码,8:绑定谷歌验证码,9:找回谷歌验证码)) 5 | */ 6 | public interface CodeSceneConstant { 7 | 8 | Integer REGISTER = 1; // 注册 9 | Integer LOGIN = 2; // 登录 10 | Integer BIND_EMAIL = 3; // 绑定邮箱 11 | Integer BIND_TEL = 4; // 绑定手机 12 | Integer FORGET_PWD = 5; // 找回登录密码 13 | Integer SET_PAY_PWD = 6; // 设置支付密码 14 | Integer FORGET_PAY_PWD = 7; // 找回支付密码 15 | Integer BIND_GOOGLE_KEY = 8; // 绑定谷歌验证码 16 | Integer FORGET_GOOGLE_KEY = 9; // 找回谷歌验证码 17 | 18 | } 19 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/constant/MemberBillCategoryConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.constant; 2 | 3 | /** 4 | * 用户账单类型 常量 5 | */ 6 | public interface MemberBillCategoryConstant { 7 | 8 | String RECHARGE = "recharge"; // 充值 9 | 10 | String WITHDRAW = "withdraw"; // 提现 11 | 12 | String TRANSFER = "transfer"; // 转账 13 | 14 | String ENTRUST_ORDER = "entrust_order"; // 委托订单 15 | 16 | } 17 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/dao/MemberBillCategoryDao.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.dao; 2 | 3 | import com.lmxdawn.user.entity.MemberBillCategory; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | import java.util.List; 7 | 8 | @Mapper 9 | public interface MemberBillCategoryDao { 10 | 11 | /** 12 | * 获取所有 13 | * 14 | * @param 15 | * @return 16 | */ 17 | List listSimpleAll(); 18 | 19 | /** 20 | * 获取列表 21 | * 22 | * @param 23 | * @return 24 | */ 25 | List listSimpleByNameIn(List names); 26 | 27 | /** 28 | * 获取 29 | * 30 | * @param 31 | * @return 32 | */ 33 | MemberBillCategory findByName(String name); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/dao/MemberBillDao.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.dao; 2 | 3 | import com.lmxdawn.user.entity.MemberBill; 4 | import com.lmxdawn.user.req.MemberBillListPageReq; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | @Mapper 11 | public interface MemberBillDao { 12 | 13 | /** 14 | * 获取列表 15 | * 16 | * @param 17 | * @return 18 | */ 19 | List listPage(MemberBillListPageReq req); 20 | 21 | /** 22 | * 插入 23 | * 24 | * @param 25 | * @return 26 | */ 27 | Boolean insert(MemberBill memberBill); 28 | 29 | /** 30 | * 批量插入 31 | * 32 | * @param 33 | * @return 34 | */ 35 | Boolean insertBatch(List list); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/dubbo/service/EchoDubboServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.dubbo.service; 2 | 3 | import com.lmxdawn.dubboapi.service.EchoDubboService; 4 | import org.apache.dubbo.config.annotation.DubboService; 5 | 6 | @DubboService 7 | public class EchoDubboServiceImpl implements EchoDubboService { 8 | @Override 9 | public String echo(String message) { 10 | return "Echo " + message; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/dubbo/service/UserDubboServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.dubbo.service; 2 | 3 | import com.lmxdawn.dubboapi.service.user.UserDubboService; 4 | import com.lmxdawn.user.service.LoginService; 5 | import org.apache.dubbo.config.annotation.DubboService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | @DubboService 9 | public class UserDubboServiceImpl implements UserDubboService { 10 | 11 | @Autowired 12 | private LoginService loginService; 13 | 14 | @Override 15 | public Long Login(String token) { 16 | return loginService.verify(token); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/entity/MemberBillCategory.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.entity; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class MemberBillCategory { 7 | 8 | /** 9 | * 自增ID 10 | */ 11 | private Long id; 12 | 13 | /** 14 | * 名称 15 | */ 16 | private String name; 17 | 18 | /** 19 | * 标题 20 | */ 21 | private String title; 22 | } 23 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/entity/MemberCoin.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.entity; 2 | 3 | import lombok.Data; 4 | import java.util.Date; 5 | 6 | @Data 7 | public class MemberCoin { 8 | 9 | /** 10 | * null 11 | */ 12 | private Long id; 13 | 14 | /** 15 | * 用户ID 16 | */ 17 | private Long memberId; 18 | 19 | /** 20 | * 币种ID 21 | */ 22 | private Long coinId; 23 | 24 | /** 25 | * 可用余额 26 | */ 27 | private Double balance; 28 | 29 | /** 30 | * 冻结余额 31 | */ 32 | private Double frozenBalance; 33 | 34 | /** 35 | * 状态(1:关闭,2:开启) 36 | */ 37 | private Integer status; 38 | 39 | /** 40 | * 创建时间 41 | */ 42 | private Date createTime; 43 | 44 | /** 45 | * 更新时间 46 | */ 47 | private Date modifiedTime; 48 | } 49 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | USER_LOGIN_PWD_ERR(40000, "账号或密码错误"), 21 | USER_REGISTER_TEL_EXISTS(40001, "手机号已存在"), 22 | USER_REGISTER_EMAIL_EXISTS(40002, "邮箱已存在"), 23 | USER_CODE_ERR(40003, "验证码错误"), 24 | 25 | ; 26 | 27 | private Integer code; 28 | 29 | private String message; 30 | 31 | ResultEnum(Integer code, String message) { 32 | this.code = code; 33 | this.message = message; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.exception; 2 | 3 | import com.lmxdawn.user.enums.ResultEnum; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 错误处理类 8 | */ 9 | @Getter 10 | public class JsonException extends RuntimeException{ 11 | 12 | private Integer code; 13 | 14 | public JsonException(ResultEnum resultEnum) { 15 | super(resultEnum.getMessage()); 16 | this.code = resultEnum.getCode(); 17 | } 18 | 19 | public JsonException(ResultEnum resultEnum, String message) { 20 | super(message); 21 | this.code = resultEnum.getCode(); 22 | } 23 | 24 | public JsonException(Integer code, String message) { 25 | super(message); 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/req/LoginPwdReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | import javax.validation.constraints.NotEmpty; 9 | 10 | @ApiModel 11 | @Data 12 | public class LoginPwdReq { 13 | 14 | @ApiModelProperty(value = "类型(email:邮箱,tel:手机号)") 15 | @NotBlank(message = "类型不能为空") 16 | private String type; 17 | 18 | @ApiModelProperty(value = "手机号") 19 | private String tel; 20 | 21 | @ApiModelProperty(value = "邮箱") 22 | private String email; 23 | 24 | @ApiModelProperty(value = "密码") 25 | @NotEmpty(message = "password can not be blank") 26 | private String password; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/req/MemberBillListPageReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | import java.util.Date; 9 | 10 | @EqualsAndHashCode(callSuper = true) 11 | @ApiModel 12 | @Data 13 | public class MemberBillListPageReq extends ListPageReq{ 14 | 15 | @ApiModelProperty(value = "用户ID", hidden = true) 16 | private Long memberId; 17 | 18 | @ApiModelProperty(value = "币种ID") 19 | private Long coinId; 20 | 21 | @ApiModelProperty(value = "创建时间") 22 | private Date createDate; 23 | 24 | @ApiModelProperty(value = "账单分类") 25 | private String category; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/req/MemberCoinBalanceReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Min; 8 | import javax.validation.constraints.NotNull; 9 | 10 | @ApiModel 11 | @Data 12 | public class MemberCoinBalanceReq { 13 | 14 | @ApiModelProperty(value = "币种ID") 15 | @NotNull(message = "币种ID不能为空") 16 | @Min(value = 1, message = "币种ID不能为空") 17 | private Long coinId; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/req/MemberCoinPairBalanceReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.Min; 8 | import javax.validation.constraints.NotNull; 9 | 10 | @ApiModel 11 | @Data 12 | public class MemberCoinPairBalanceReq { 13 | 14 | @ApiModelProperty(value = "交易币种ID") 15 | @NotNull(message = "交易币种ID不能为空") 16 | @Min(value = 1, message = "交易币种ID不能为空") 17 | private Long tradeCoinId; 18 | 19 | @ApiModelProperty(value = "计价币种ID") 20 | @NotNull(message = "计价币种ID不能为空") 21 | @Min(value = 1, message = "计价币种ID不能为空") 22 | private Long coinId; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/req/ReviseLoginPwdReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | @ApiModel 10 | @Data 11 | public class ReviseLoginPwdReq { 12 | 13 | @ApiModelProperty(value = "旧密码") 14 | @NotBlank(message = "password can not be blank") 15 | private String password; 16 | 17 | @ApiModelProperty(value = "新密码") 18 | @NotBlank(message = "password can not be blank") 19 | private String newPassword; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/req/RevisePayPwdReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | @ApiModel 10 | @Data 11 | public class RevisePayPwdReq { 12 | 13 | @ApiModelProperty(value = "旧密码") 14 | @NotBlank(message = "password can not be blank") 15 | private String password; 16 | 17 | @ApiModelProperty(value = "新密码") 18 | @NotBlank(message = "password can not be blank") 19 | private String newPassword; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/req/SetPayPwdReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotBlank; 8 | 9 | @ApiModel 10 | @Data 11 | public class SetPayPwdReq { 12 | 13 | @ApiModelProperty(value = "手机号或者邮箱号,具体看前端发送用的哪一个") 14 | @NotBlank(message = "手机号或者邮箱号不能为空") 15 | private String telOrEmail; 16 | 17 | @ApiModelProperty(value = "验证码") 18 | @NotBlank(message = "验证码不能为空") 19 | private String code; 20 | 21 | @ApiModelProperty(value = "密码") 22 | @NotBlank(message = "password can not be blank") 23 | private String password; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/EchoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel(value = "打印信息类") 8 | @Data 9 | public class EchoRes { 10 | @ApiModelProperty(value = "具体信息", required = true) 11 | private String str; 12 | } 13 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/LoginTokenRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel 9 | public class LoginTokenRes { 10 | 11 | @ApiModelProperty(value = "用户ID") 12 | private Long memberId; 13 | 14 | @ApiModelProperty(value = "用户token") 15 | private String token; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/MemberBillCategoryRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel 9 | public class MemberBillCategoryRes { 10 | 11 | @ApiModelProperty(value = "账单分类名称") 12 | private String name; 13 | 14 | @ApiModelProperty(value = "账单分类标题") 15 | private String title; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/MemberBillRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import com.lmxdawn.dubboapi.res.wallet.CoinSimpleDubboRes; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.util.Date; 9 | 10 | @Data 11 | @ApiModel 12 | public class MemberBillRes { 13 | 14 | @ApiModelProperty(value = "币种信息") 15 | private CoinSimpleDubboRes coin; 16 | 17 | @ApiModelProperty(value = "账单分类名称") 18 | private String category; 19 | 20 | @ApiModelProperty(value = "类型(1:收入,2:支出)") 21 | private String type; 22 | 23 | @ApiModelProperty(value = "金额") 24 | private Double money; 25 | 26 | @ApiModelProperty(value = "备注") 27 | private String remark; 28 | 29 | @ApiModelProperty(value = "创建时间") 30 | private Date createTime; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/MemberCoinBalanceRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel 9 | public class MemberCoinBalanceRes { 10 | 11 | @ApiModelProperty(value = "可用余额") 12 | private Double balance; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/MemberCoinPairBalanceRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel 9 | public class MemberCoinPairBalanceRes { 10 | 11 | @ApiModelProperty(value = "交易币种可用余额") 12 | private Double tradeBalance; 13 | 14 | @ApiModelProperty(value = "计价币种可用余额") 15 | private Double balance; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/res/MemberCoinRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.res; 2 | 3 | import com.lmxdawn.dubboapi.res.wallet.CoinSimpleDubboRes; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | @Data 9 | @ApiModel 10 | public class MemberCoinRes { 11 | 12 | @ApiModelProperty(value = "币种信息") 13 | private CoinSimpleDubboRes coin; 14 | 15 | @ApiModelProperty(value = "可用余额") 16 | private Double balance; 17 | 18 | @ApiModelProperty(value = "冻结余额") 19 | private Double frozenBalance; 20 | 21 | @ApiModelProperty(value = "状态(1:关闭,2:开启)") 22 | private Integer status; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/service/LoginService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.service; 2 | 3 | public interface LoginService { 4 | String createToken(Long memberId); 5 | Long verify(String token); 6 | void delete(Long memberId); 7 | } 8 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/service/MemberBillCategoryService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.service; 2 | 3 | import com.lmxdawn.user.entity.MemberBillCategory; 4 | import com.lmxdawn.user.res.MemberBillCategoryRes; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public interface MemberBillCategoryService { 10 | 11 | List listAll(); 12 | 13 | Map mapByNameIn(List names); 14 | 15 | MemberBillCategory findByName(String name); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/service/MemberBillService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.service; 2 | 3 | import com.lmxdawn.user.req.MemberBillListPageReq; 4 | import com.lmxdawn.user.res.MemberBillRes; 5 | 6 | import java.util.List; 7 | 8 | public interface MemberBillService { 9 | 10 | List listPage(MemberBillListPageReq req); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/service/MemberCoinService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.service; 2 | 3 | import com.lmxdawn.user.entity.MemberCoin; 4 | import com.lmxdawn.user.res.MemberCoinRes; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public interface MemberCoinService { 10 | 11 | List listAllByMemberId(Long memberId); 12 | 13 | // 获取 14 | MemberCoin findByMemberIdCoinId(Long memberId, Long coinId); 15 | 16 | // 获取 17 | Map mapByMemberIdCoinIds(Long memberId, List coinIds); 18 | 19 | // 冻结余额 20 | boolean frozenBalance(Long memberId, Long coinId, double money); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/service/MemberService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.service; 2 | 3 | import com.lmxdawn.user.entity.Member; 4 | 5 | public interface MemberService { 6 | 7 | Member findByMemberId(Long memberId); 8 | Member findPwdByMemberId(Long memberId); 9 | Member findByTel(String tel); 10 | Member findByEmail(String email); 11 | boolean create(Member member); 12 | boolean update(Member member); 13 | } 14 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/util/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.util; 2 | 3 | /** 4 | * 分页工具类 5 | */ 6 | public class PageUtils { 7 | 8 | /** 9 | * 根据页数和每页显示条数返回 偏移量 10 | * @param page 11 | * @param limit 12 | * @return 13 | */ 14 | public static Integer createOffset(Integer page, Integer limit) { 15 | if (null == page || page <= 0) { 16 | page = 1; 17 | } 18 | if (null == limit || limit <= 0) { 19 | limit = 10; 20 | } 21 | return (page - 1) * limit; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/util/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.util; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | /** 6 | * 密码相关的工具类 7 | */ 8 | public class PasswordUtils { 9 | 10 | public static String memberPwd(String pwd) { 11 | return DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex(pwd.getBytes()).getBytes()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /user/src/main/java/com/lmxdawn/user/util/SpringBeanFactoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public final class SpringBeanFactoryUtils implements ApplicationContextAware{ 10 | private static ApplicationContext context; 11 | 12 | public static T getBean(Class c){ 13 | return context.getBean(c); 14 | } 15 | 16 | 17 | public static T getBean(String name,Class clazz){ 18 | return context.getBean(name,clazz); 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /user/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9004 5 | spring.application.name=service-user 6 | management.endpoints.web.exposure.include=* 7 | 8 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 9 | 10 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 11 | mybatis.mapper-locations=classpath:mybatis/mapper/*.xml 12 | 13 | dubbo.scan.base-packages=com.lmxdawn.user.dubbo.service 14 | dubbo.protocol.name=dubbo 15 | dubbo.protocol.port=-1 16 | dubbo.cloud.subscribed-services=service-other 17 | dubbo.consumer.check=false 18 | dubbo.consumer.filter=consumerAuthFilter 19 | dubbo.provider.filter=providerRpcFilter 20 | 21 | spring.config.import=classpath:application-${spring.profiles.active}.properties 22 | 23 | 24 | -------------------------------------------------------------------------------- /user/src/main/resources/mybatis/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /user/src/test/java/com/lmxdawn/user/UserApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.user; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | class UserApplicationTest { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/WalletApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WalletApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WalletApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/annotation/LoginAuthAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 后台登录授权/权限验证的注解 10 | */ 11 | //此注解只能修饰方法 12 | @Target(ElementType.METHOD) 13 | //当前注解如何去保持 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface LoginAuthAnnotation { 16 | boolean isLogin() default true; 17 | } 18 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/config/DruidStatFilter.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.config; 2 | 3 | import com.alibaba.druid.support.http.WebStatFilter; 4 | 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.annotation.WebInitParam; 7 | 8 | /** 9 | * 配置监控拦截器 (过滤不需要监控的后缀) 10 | * druid监控拦截器 11 | */ 12 | @WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*", 13 | initParams = { 14 | @WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")//忽略资源 15 | } 16 | ) 17 | public class DruidStatFilter extends WebStatFilter { 18 | } 19 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | 8 | String USER_LOGIN = "ul:%s"; // 用户登录 9 | 10 | } 11 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/entity/Coin.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.entity; 2 | 3 | import lombok.Data; 4 | import java.util.Date; 5 | 6 | @Data 7 | public class Coin { 8 | 9 | /** 10 | * 币种ID自增 11 | */ 12 | private Long id; 13 | 14 | /** 15 | * 币种别名 16 | */ 17 | private String name; 18 | 19 | /** 20 | * 币种全称 21 | */ 22 | private String coinName; 23 | 24 | /** 25 | * 币种单位 26 | */ 27 | private String symbol; 28 | 29 | /** 30 | * 币种精度 31 | */ 32 | private Integer precision; 33 | 34 | /** 35 | * USDT价格 36 | */ 37 | private Double usdtPrice; 38 | 39 | /** 40 | * 排序(升序) 41 | */ 42 | private Integer sort; 43 | 44 | /** 45 | * 状态(1:关闭,2:开启) 46 | */ 47 | private Integer status; 48 | 49 | /** 50 | * 创建时间 51 | */ 52 | private Date createTime; 53 | 54 | /** 55 | * 更新时间 56 | */ 57 | private Date modifiedTime; 58 | } 59 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/entity/CoinProtocol.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.entity; 2 | 3 | import lombok.Data; 4 | import java.util.Date; 5 | 6 | @Data 7 | public class CoinProtocol { 8 | 9 | /** 10 | * 协议ID自增 11 | */ 12 | private Long id; 13 | 14 | /** 15 | * 协议名称 16 | */ 17 | private String name; 18 | 19 | /** 20 | * rpc主机 21 | */ 22 | private String rpcHost; 23 | 24 | /** 25 | * rpc登录用户 26 | */ 27 | private String rpcUser; 28 | 29 | /** 30 | * rpc登录密码 31 | */ 32 | private String rpcPwd; 33 | 34 | /** 35 | * 排序(升序) 36 | */ 37 | private Integer sort; 38 | 39 | /** 40 | * 状态(1:关闭,2:开启) 41 | */ 42 | private Integer status; 43 | 44 | /** 45 | * 创建时间 46 | */ 47 | private Date createTime; 48 | 49 | /** 50 | * 更新时间 51 | */ 52 | private Date modifiedTime; 53 | } 54 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | 21 | ; 22 | 23 | private Integer code; 24 | 25 | private String message; 26 | 27 | ResultEnum(Integer code, String message) { 28 | this.code = code; 29 | this.message = message; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.exception; 2 | 3 | import com.lmxdawn.wallet.enums.ResultEnum; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 错误处理类 8 | */ 9 | @Getter 10 | public class JsonException extends RuntimeException{ 11 | 12 | private Integer code; 13 | 14 | public JsonException(ResultEnum resultEnum) { 15 | super(resultEnum.getMessage()); 16 | this.code = resultEnum.getCode(); 17 | } 18 | 19 | public JsonException(ResultEnum resultEnum, String message) { 20 | super(message); 21 | this.code = resultEnum.getCode(); 22 | } 23 | 24 | public JsonException(Integer code, String message) { 25 | super(message); 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/req/EchoReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotEmpty; 8 | 9 | @ApiModel 10 | @Data 11 | public class EchoReq { 12 | 13 | // 用户手机 14 | @ApiModelProperty(value = "手机号") 15 | @NotEmpty(message = "Phone number cannot be empty") 16 | private String tel; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/res/EchoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel(value = "打印信息类") 8 | @Data 9 | public class EchoRes { 10 | @ApiModelProperty(value = "具体信息", required = true) 11 | private String str; 12 | } 13 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/service/LoginService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.service; 2 | 3 | public interface LoginService { 4 | String createToken(Long uid); 5 | Long verify(String token); 6 | void delete(Long uid); 7 | } 8 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/service/impl/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmxdawn/exchange/7d331e5013e08c122c5d498dc22375b5f74d9e6e/wallet/src/main/java/com/lmxdawn/wallet/service/impl/.gitignore -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/util/PageUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.util; 2 | 3 | /** 4 | * 分页工具类 5 | */ 6 | public class PageUtils { 7 | 8 | /** 9 | * 根据页数和每页显示条数返回 偏移量 10 | * @param page 11 | * @param limit 12 | * @return 13 | */ 14 | public static Integer createOffset(Integer page, Integer limit) { 15 | if (null == page || page <= 0) { 16 | page = 1; 17 | } 18 | if (null == limit || limit <= 0) { 19 | limit = 10; 20 | } 21 | return (page - 1) * limit; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/util/PasswordUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.util; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | /** 6 | * 密码相关的工具类 7 | */ 8 | public class PasswordUtils { 9 | 10 | public static String memberPwd(String pwd) { 11 | return DigestUtils.md5DigestAsHex(DigestUtils.md5DigestAsHex(pwd.getBytes()).getBytes()); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /wallet/src/main/java/com/lmxdawn/wallet/util/SpringBeanFactoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wallet.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public final class SpringBeanFactoryUtils implements ApplicationContextAware{ 10 | private static ApplicationContext context; 11 | 12 | public static T getBean(Class c){ 13 | return context.getBean(c); 14 | } 15 | 16 | 17 | public static T getBean(String name,Class clazz){ 18 | return context.getBean(name,clazz); 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /wallet/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9005 5 | spring.application.name=service-wallet 6 | management.endpoints.web.exposure.include=* 7 | 8 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 9 | 10 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 11 | mybatis.mapper-locations=classpath:mybatis/mapper/*.xml 12 | 13 | dubbo.scan.base-packages=com.lmxdawn.wallet.dubbo.service 14 | dubbo.protocol.name=dubbo 15 | dubbo.protocol.port=-1 16 | dubbo.cloud.subscribed-services=service-user,service-other 17 | dubbo.consumer.check=false 18 | dubbo.consumer.filter=consumerAuthFilter 19 | dubbo.provider.filter=providerRpcFilter 20 | 21 | spring.config.import=classpath:application-${spring.profiles.active}.properties 22 | 23 | 24 | -------------------------------------------------------------------------------- /wallet/src/test/java/WalletApplicationTest.java: -------------------------------------------------------------------------------- 1 | import org.junit.jupiter.api.Test; 2 | 3 | import static org.junit.jupiter.api.Assertions.*; 4 | 5 | class WalletApplicationTest { 6 | 7 | @Test 8 | void main() { 9 | } 10 | } -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/WsRouteApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WsRouteApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WsRouteApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.constant; 2 | 3 | /** 4 | * redis 常量 5 | */ 6 | public interface CacheConstant { 7 | String WS_ROUTE_MEMBER_ID = "wsmid:%s"; // WS路由服务保存的用户key前缀 8 | } 9 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | ; 21 | 22 | private Integer code; 23 | 24 | private String message; 25 | 26 | ResultEnum(Integer code, String message) { 27 | this.code = code; 28 | this.message = message; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/mq/WsMarketMq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.mq; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class WsMarketMq { 7 | 8 | /** 9 | * 委托单变化的用户ID 10 | */ 11 | private Long memberId; 12 | 13 | /** 14 | * 委托单变化的订单号 15 | */ 16 | private Long orderId; 17 | 18 | /** 19 | * 对手委托单变化的用户ID 20 | */ 21 | private Long matchMemberId; 22 | 23 | /** 24 | * 对手委托单变化的订单号 25 | */ 26 | private Long matchOrderId; 27 | 28 | /** 29 | * 数据 30 | */ 31 | private String Data; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/mq/WsOfflineMq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.mq; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * ws 下线通知 7 | */ 8 | @Data 9 | public class WsOfflineMq { 10 | 11 | private String memberId; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/req/EchoReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.req; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @ApiModel 8 | @Data 9 | public class EchoReq { 10 | 11 | @ApiModelProperty(value = "用户token,不传表示游客登录") 12 | private String token; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/res/ConnectionInfoRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 连接信息 9 | */ 10 | @ApiModel(value = "连接信息") 11 | @Data 12 | public class ConnectionInfoRes { 13 | 14 | @ApiModelProperty(value = "用户ID") 15 | private String memberId; 16 | 17 | @ApiModelProperty(value = "url地址") 18 | private String url; 19 | 20 | @ApiModelProperty(value = "http端口") 21 | private String httpPort; 22 | 23 | @ApiModelProperty(value = "ws端口") 24 | private String wsPort; 25 | } 26 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/res/LoadBalancingIpRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.res; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class LoadBalancingIpRes { 7 | 8 | // ip地址 9 | private String url; 10 | 11 | // http端口 12 | private String httpPort; 13 | 14 | // ws端口 15 | private String wsPort; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/service/LoadBalancingService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.service; 2 | 3 | import com.lmxdawn.wsroute.res.LoadBalancingIpRes; 4 | import com.lmxdawn.wsroute.service.impl.LoadBalancingServiceImpl; 5 | 6 | import java.util.Map; 7 | 8 | 9 | public interface LoadBalancingService { 10 | 11 | Map getServerMap(); 12 | 13 | LoadBalancingIpRes wsIpHash(String memberId); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/service/UserLoginService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.service; 2 | 3 | public interface UserLoginService { 4 | 5 | Long Login(String token); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/service/WsRouteService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.service; 2 | 3 | import com.lmxdawn.wsroute.res.ConnectionInfoRes; 4 | 5 | public interface WsRouteService { 6 | ConnectionInfoRes connectionLogin(String memberId); 7 | } 8 | -------------------------------------------------------------------------------- /ws-route/src/main/java/com/lmxdawn/wsroute/service/impl/UserLoginServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.wsroute.service.impl; 2 | 3 | import com.lmxdawn.dubboapi.service.user.UserDubboService; 4 | import com.lmxdawn.wsroute.service.UserLoginService; 5 | import org.apache.dubbo.config.annotation.DubboReference; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class UserLoginServiceImpl implements UserLoginService { 10 | 11 | @DubboReference 12 | private UserDubboService userDubboService; 13 | 14 | @Override 15 | public Long Login(String token) { 16 | return userDubboService.Login(token); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/WsApplication.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.config; 2 | 3 | import okhttp3.OkHttpClient; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Configuration 10 | public class OkHttpConfig { 11 | 12 | /** 13 | * http client 14 | * @return okHttp 15 | */ 16 | @Bean 17 | public OkHttpClient okHttpClient() { 18 | OkHttpClient.Builder builder = new OkHttpClient.Builder(); 19 | builder.connectTimeout(30, TimeUnit.SECONDS) 20 | .readTimeout(10, TimeUnit.SECONDS) 21 | .writeTimeout(10,TimeUnit.SECONDS) 22 | .retryOnConnectionFailure(true); 23 | return builder.build(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/constant/MqTopicConstant.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.constant; 2 | 3 | /** 4 | * 消息队列主题常量 5 | */ 6 | public interface MqTopicConstant { 7 | 8 | String WS_OFFLINE_TOPIC = "ws-offline-topic"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/enums/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * 返回结果的枚举类 7 | */ 8 | @Getter 9 | public enum ResultEnum { 10 | 11 | SUCCESS(0, "success"), 12 | NOT_NETWORK(1, "系统繁忙,请稍后再试。"), 13 | LOGIN_VERIFY_FALL(2, "登录失效"), 14 | PARAM_VERIFY_FALL(3, "参数验证错误"), 15 | AUTH_FAILED(4, "权限验证失败"), 16 | DATA_NOT(5, "没有相关数据"), 17 | DATA_CHANGE(6, "数据没有任何更改"), 18 | DATA_REPEAT(7, "数据已存在"), 19 | 20 | ; 21 | 22 | private Integer code; 23 | 24 | private String message; 25 | 26 | ResultEnum(Integer code, String message) { 27 | this.code = code; 28 | this.message = message; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/mq/WsOfflineMq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.mq; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * ws 下线通知 7 | */ 8 | @Data 9 | public class WsOfflineMq { 10 | 11 | private String memberId; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/req/WSBaseReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.req; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * websocket 通信的类 7 | */ 8 | @Data 9 | public class WSBaseReq { 10 | 11 | /** 12 | * 类型(0: 心跳,1:用户登录,2:游客登录,3:推送行情,4:委托订单变化) 13 | */ 14 | private Integer type; 15 | 16 | /** 17 | * 用户ID(包含游客登录的ID) 18 | */ 19 | private String memberId; 20 | 21 | /** 22 | * 连接 wsId 23 | */ 24 | private String wsId; 25 | 26 | /** 27 | * 内容(如果 type = 1 时,该值为token值) 28 | */ 29 | private String data; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/req/WsMarketReq.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * ws 行情消息推送 10 | */ 11 | @Data 12 | public class WsMarketReq implements Serializable { 13 | 14 | @ApiModelProperty(value = "委托单变化的用户ID") 15 | private Long memberId; 16 | 17 | @ApiModelProperty(value = "委托单变化的订单号") 18 | private Long orderId; 19 | 20 | @ApiModelProperty(value = "对手委托单变化的用户ID") 21 | private Long matchMemberId; 22 | 23 | @ApiModelProperty(value = "对手委托单变化的订单号") 24 | private Long matchOrderId; 25 | 26 | @ApiModelProperty(value = "数据") 27 | private String Data; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/res/BaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.res; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | /** 8 | * 返回结果类 9 | * @param 10 | */ 11 | @ApiModel(value = "返回结果") 12 | @Data 13 | public class BaseRes { 14 | 15 | @ApiModelProperty(value = "code码") 16 | private Integer code; 17 | 18 | @ApiModelProperty(value = "错误信息,成功则返回success") 19 | private String message; 20 | 21 | @ApiModelProperty(value = "成功返回的数据") 22 | private T data; 23 | } 24 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/res/WSBaseRes.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.res; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * websocket 通信的类 7 | */ 8 | @Data 9 | public class WSBaseRes { 10 | 11 | /** 12 | * 返回类型(0:心跳,1:登录成功的返回,2:行情的推送,3:委托订单变化) 13 | */ 14 | private Integer type; 15 | 16 | /** 17 | * 返回的ws的ID 18 | */ 19 | private String wsId; 20 | 21 | /** 22 | * 返回的数据 23 | */ 24 | private String data; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/service/UserLoginService.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.service; 2 | 3 | public interface UserLoginService { 4 | 5 | Long Login(String token); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /ws/src/main/java/com/lmxdawn/ws/service/impl/UserLoginServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lmxdawn.ws.service.impl; 2 | 3 | import com.lmxdawn.dubboapi.service.user.UserDubboService; 4 | import com.lmxdawn.ws.service.UserLoginService; 5 | import org.apache.dubbo.config.annotation.DubboReference; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class UserLoginServiceImpl implements UserLoginService { 10 | 11 | @DubboReference 12 | private UserDubboService userDubboService; 13 | 14 | @Override 15 | public Long Login(String token) { 16 | return userDubboService.Login(token); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ws/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 环境配置 2 | spring.profiles.active=dev 3 | 4 | server.port=9009 5 | spring.application.name=service-ws 6 | management.endpoints.web.exposure.include=* 7 | 8 | # WS 配置,做负载时需要更改 9 | # 请求url 10 | ws.url=192.168.0.173 11 | # 端口 12 | ws.port=10001 13 | 14 | dubbo.scan.base-packages=com.lmxdawn.ws.dubbo.service 15 | dubbo.protocol.name=dubbo 16 | dubbo.protocol.port=-1 17 | dubbo.cloud.subscribed-services=service-user 18 | dubbo.consumer.check=false 19 | dubbo.consumer.filter=consumerAuthFilter 20 | dubbo.provider.filter=providerRpcFilter 21 | 22 | # 设置dubbo元数据 23 | spring.cloud.nacos.discovery.metadata.server-port=${server.port} 24 | spring.cloud.nacos.discovery.metadata.ws-url=${ws.url} 25 | spring.cloud.nacos.discovery.metadata.ws-port=${ws.port} 26 | 27 | spring.config.import=classpath:application-${spring.profiles.active}.properties 28 | 29 | 30 | --------------------------------------------------------------------------------