├── .gitignore ├── LICENSE ├── README.md ├── codetemplates.xml ├── pom.xml ├── zhuque-adserv-ngx ├── pom.xml ├── zhuque-adserv-ngx-core │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── ai │ │ └── houyi │ │ └── zhuque │ │ └── adserv │ │ └── ngx │ │ ├── package-info.java │ │ └── service │ │ ├── BiddingServiceImpl.java │ │ └── package-info.java ├── zhuque-adserv-ngx-proto │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── ai │ │ │ └── houyi │ │ │ └── adserv │ │ │ └── ngx │ │ │ └── proto │ │ │ ├── BiddingProto.java │ │ │ ├── CommonProto.java │ │ │ └── ModelProto.java │ │ └── proto │ │ ├── bidding.proto │ │ ├── common.proto │ │ └── model.proto └── zhuque-adserv-ngx-server │ ├── pom.xml │ └── src │ └── main │ └── java │ └── ai │ └── houyi │ └── zhuque │ └── adserv │ └── ngx │ └── server │ ├── Application.java │ └── package-info.java ├── zhuque-adx-connector ├── pom.xml ├── zhuque-adx-connector-api │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── ai │ │ └── houyi │ │ └── zhuque │ │ └── adx │ │ └── connector │ │ └── api │ │ ├── RtbMsgMapper.java │ │ └── package-info.java └── zhuque-adx-connector-builtin │ ├── pom.xml │ └── src │ └── main │ └── java │ └── ai │ └── houyi │ └── zhuque │ └── adx │ └── connector │ └── builtin │ └── package-info.java ├── zhuque-auth ├── pom.xml └── src │ └── main │ ├── java │ └── ai │ │ └── houyi │ │ └── zhuque │ │ └── auth │ │ ├── Application.java │ │ ├── controller │ │ ├── AuthController.java │ │ ├── MenuController.java │ │ ├── PermissionController.java │ │ ├── RoleController.java │ │ ├── UserController.java │ │ └── package-info.java │ │ ├── model │ │ ├── AuthReq.java │ │ ├── ChangePwdReq.java │ │ ├── ResetPasswdReq.java │ │ ├── Subject.java │ │ └── package-info.java │ │ ├── package-info.java │ │ └── service │ │ ├── AuthService.java │ │ ├── MenuService.java │ │ ├── PermissionService.java │ │ ├── RoleService.java │ │ ├── SessionService.java │ │ ├── UserService.java │ │ ├── impl │ │ ├── AuthServiceImpl.java │ │ ├── MenuServiceImpl.java │ │ ├── PermissionServiceImpl.java │ │ ├── RoleServiceImpl.java │ │ ├── SessionServiceImpl.java │ │ ├── UserServiceImpl.java │ │ └── package-info.java │ │ └── package-info.java │ └── resources │ ├── application-dev.properties │ ├── application-prod.properties │ └── application.properties ├── zhuque-commons-web ├── pom.xml └── src │ └── main │ └── java │ └── ai │ └── houyi │ └── zhuque │ └── commons │ └── web │ ├── AuthFailedException.java │ ├── IController.java │ ├── Response.java │ ├── ZhuqueExceptionAdvisor.java │ ├── ZhuqueMethodReturnValueHandler.java │ └── package-info.java ├── zhuque-commons ├── pom.xml └── src │ └── main │ └── java │ └── ai │ └── houyi │ └── zhuque │ └── commons │ ├── ClassLoaderUtils.java │ ├── Constants.java │ ├── SQLUtils.java │ ├── UUIDUtils.java │ ├── exception │ ├── ExceptionUtils.java │ ├── ZhuqueException.java │ └── package-info.java │ ├── model │ ├── QueryReq.java │ └── package-info.java │ ├── package-info.java │ ├── page │ ├── Page.java │ └── package-info.java │ └── redis │ ├── RedisCallback.java │ ├── RedisConfig.java │ ├── RedisConfiguration.java │ ├── RedisTemplate.java │ ├── RedisUtils.java │ └── package-info.java ├── zhuque-core ├── pom.xml └── src │ └── main │ └── java │ └── ai │ └── houyi │ └── zhuque │ └── core │ ├── IService.java │ ├── model │ ├── AuthContext.java │ ├── AuthInfo.java │ └── query │ │ ├── AdGroupQueryReq.java │ │ ├── AdvertiserQueryReq.java │ │ ├── AgentQueryReq.java │ │ ├── AuditAdvertiserQueryReq.java │ │ ├── CampaignQueryReq.java │ │ ├── CreativeQueryReq.java │ │ ├── DspQueryReq.java │ │ ├── MaterialQueryReq.java │ │ ├── MenuQueryReq.java │ │ ├── PermissionQueryReq.java │ │ ├── RoleQueryReq.java │ │ ├── TemplateQueryReq.java │ │ ├── UserQueryReq.java │ │ └── package-info.java │ ├── package-info.java │ └── service │ ├── AdGroupService.java │ ├── AdvertiserService.java │ ├── AgentService.java │ ├── AuditAdvertiserService.java │ ├── CampaignService.java │ ├── CreativeService.java │ ├── DspService.java │ ├── MaterialService.java │ ├── TemplateService.java │ ├── impl │ ├── AdGroupServiceImpl.java │ ├── AdvertiserServiceImpl.java │ ├── AgentServiceImpl.java │ ├── AuditAdvertiserServiceImpl.java │ ├── CampaignServiceImpl.java │ ├── CreativeServiceImpl.java │ ├── DspServiceImpl.java │ ├── MaterialServiceImpl.java │ ├── TemplateServiceImpl.java │ └── package-info.java │ └── package-info.java ├── zhuque-crontab ├── pom.xml └── src │ └── main │ └── java │ └── ai │ └── houyi │ └── zhuque │ └── crontab │ └── package-info.java ├── zhuque-dao ├── pom.xml └── src │ └── main │ ├── db │ └── zhuque.sql │ ├── java │ └── ai │ │ └── houyi │ │ └── zhuque │ │ └── dao │ │ ├── AdGroupMapper.java │ │ ├── AdPositionMapper.java │ │ ├── AdvertiserBillMapper.java │ │ ├── AdvertiserMapper.java │ │ ├── AdvertiserQualificationMapper.java │ │ ├── AgentBillMapper.java │ │ ├── AgentMapper.java │ │ ├── AuditAdvertiserMapper.java │ │ ├── CampaignMapper.java │ │ ├── CreativeMapper.java │ │ ├── DspMapper.java │ │ ├── MaterialMapper.java │ │ ├── MenuMapper.java │ │ ├── PermissionMapper.java │ │ ├── RoleMapper.java │ │ ├── RolePermissionMapper.java │ │ ├── SessionMapper.java │ │ ├── TemplateMapper.java │ │ ├── UserMapper.java │ │ ├── UserRoleMapper.java │ │ ├── model │ │ ├── AdGroup.java │ │ ├── AdGroupExample.java │ │ ├── AdPosition.java │ │ ├── AdPositionExample.java │ │ ├── Advertiser.java │ │ ├── AdvertiserBill.java │ │ ├── AdvertiserBillExample.java │ │ ├── AdvertiserExample.java │ │ ├── AdvertiserQualification.java │ │ ├── AdvertiserQualificationExample.java │ │ ├── Agent.java │ │ ├── AgentBill.java │ │ ├── AgentBillExample.java │ │ ├── AgentExample.java │ │ ├── AuditAdvertiser.java │ │ ├── AuditAdvertiserExample.java │ │ ├── Campaign.java │ │ ├── CampaignExample.java │ │ ├── Creative.java │ │ ├── CreativeExample.java │ │ ├── Dsp.java │ │ ├── DspExample.java │ │ ├── Material.java │ │ ├── MaterialExample.java │ │ ├── Menu.java │ │ ├── MenuExample.java │ │ ├── Permission.java │ │ ├── PermissionExample.java │ │ ├── Role.java │ │ ├── RoleExample.java │ │ ├── RolePermission.java │ │ ├── RolePermissionExample.java │ │ ├── Session.java │ │ ├── SessionExample.java │ │ ├── Template.java │ │ ├── TemplateExample.java │ │ ├── User.java │ │ ├── UserExample.java │ │ ├── UserRole.java │ │ ├── UserRoleExample.java │ │ └── ext │ │ │ ├── ExtAdGroupExample.java │ │ │ └── package-info.java │ │ └── package-info.java │ └── resources │ ├── mapper │ ├── AdGroupMapper.xml │ ├── AdPositionMapper.xml │ ├── AdvertiserBillMapper.xml │ ├── AdvertiserMapper.xml │ ├── AdvertiserQualificationMapper.xml │ ├── AgentBillMapper.xml │ ├── AgentMapper.xml │ ├── AuditAdvertiserMapper.xml │ ├── CampaignMapper.xml │ ├── CreativeMapper.xml │ ├── DspMapper.xml │ ├── MaterialMapper.xml │ ├── MenuMapper.xml │ ├── PermissionMapper.xml │ ├── RoleMapper.xml │ ├── RolePermissionMapper.xml │ ├── SessionMapper.xml │ ├── TemplateMapper.xml │ ├── UserMapper.xml │ └── UserRoleMapper.xml │ ├── mybatis-generator.xml │ └── mybatis │ └── mybatis-config.xml ├── zhuque-dashboard ├── pom.xml ├── zhuque-dashboard-api │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── ai │ │ │ └── houyi │ │ │ └── zhuque │ │ │ └── dashboard │ │ │ ├── Application.java │ │ │ ├── controller │ │ │ ├── AdGroupController.java │ │ │ ├── AdvertiserController.java │ │ │ ├── AgentController.java │ │ │ ├── AuditAdvertiserController.java │ │ │ ├── AuthController.java │ │ │ ├── CampaignController.java │ │ │ ├── CreativeController.java │ │ │ ├── DspController.java │ │ │ ├── MaterialController.java │ │ │ ├── TemplateController.java │ │ │ └── package-info.java │ │ │ └── filter │ │ │ ├── AuthFilter.java │ │ │ ├── MockAuthFilter.java │ │ │ └── package-info.java │ │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ └── application.properties └── zhuque-dashboard-fe │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .postcssrc.js │ ├── .travis.yml │ ├── LICENSE │ ├── README-zh.md │ ├── README.md │ ├── build │ ├── build.js │ ├── check-versions.js │ ├── logo.png │ ├── utils.js │ ├── vue-loader.conf.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js │ ├── config │ ├── dev.env.js │ ├── index.js │ └── prod.env.js │ ├── favicon.ico │ ├── index.html │ ├── package.json │ ├── src │ ├── App.vue │ ├── api │ │ ├── login.js │ │ └── table.js │ ├── assets │ │ └── 404_images │ │ │ ├── 404.png │ │ │ └── 404_cloud.png │ ├── components │ │ ├── Breadcrumb │ │ │ └── index.vue │ │ ├── Hamburger │ │ │ └── index.vue │ │ └── SvgIcon │ │ │ └── index.vue │ ├── icons │ │ ├── index.js │ │ ├── svg │ │ │ ├── example.svg │ │ │ ├── eye-open.svg │ │ │ ├── eye.svg │ │ │ ├── form.svg │ │ │ ├── link.svg │ │ │ ├── nested.svg │ │ │ ├── password.svg │ │ │ ├── table.svg │ │ │ ├── tree.svg │ │ │ └── user.svg │ │ └── svgo.yml │ ├── main.js │ ├── permission.js │ ├── router │ │ └── index.js │ ├── store │ │ ├── getters.js │ │ ├── index.js │ │ └── modules │ │ │ ├── app.js │ │ │ └── user.js │ ├── styles │ │ ├── element-ui.scss │ │ ├── index.scss │ │ ├── mixin.scss │ │ ├── sidebar.scss │ │ ├── transition.scss │ │ └── variables.scss │ ├── utils │ │ ├── auth.js │ │ ├── index.js │ │ ├── request.js │ │ └── validate.js │ └── views │ │ ├── 404.vue │ │ ├── dashboard │ │ └── index.vue │ │ ├── form │ │ └── index.vue │ │ ├── layout │ │ ├── Layout.vue │ │ ├── components │ │ │ ├── AppMain.vue │ │ │ ├── Navbar.vue │ │ │ ├── Sidebar │ │ │ │ ├── Item.vue │ │ │ │ ├── Link.vue │ │ │ │ ├── SidebarItem.vue │ │ │ │ └── index.vue │ │ │ └── index.js │ │ └── mixin │ │ │ └── ResizeHandler.js │ │ ├── login │ │ └── index.vue │ │ ├── nested │ │ ├── menu1 │ │ │ ├── index.vue │ │ │ ├── menu1-1 │ │ │ │ └── index.vue │ │ │ ├── menu1-2 │ │ │ │ ├── index.vue │ │ │ │ ├── menu1-2-1 │ │ │ │ │ └── index.vue │ │ │ │ └── menu1-2-2 │ │ │ │ │ └── index.vue │ │ │ └── menu1-3 │ │ │ │ └── index.vue │ │ └── menu2 │ │ │ └── index.vue │ │ ├── table │ │ └── index.vue │ │ └── tree │ │ └── index.vue │ └── static │ └── .gitkeep ├── zhuque-openapi ├── pom.xml ├── zhuque-openapi-dsp │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── ai │ │ └── houyi │ │ └── zhuque │ │ └── openapi │ │ └── dsp │ │ └── package-info.java └── zhuque-openapi-ssp │ ├── pom.xml │ └── src │ └── main │ └── java │ └── ai │ └── houyi │ └── zhuque │ └── openapi │ └── ssp │ └── package-info.java ├── zhuque-pixel-services ├── pom.xml ├── zhuque-pixel-service-click │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── ai │ │ └── houyi │ │ └── zhuque │ │ └── pixel │ │ └── click │ │ └── package-info.java └── zhuque-pixel-service-imp │ ├── pom.xml │ └── src │ └── main │ └── java │ └── ai │ └── houiyi │ └── zhuque │ └── pixel │ └── imp │ └── package-info.java └── zhuque-rtb-proto ├── pom.xml └── src └── main ├── java └── ai │ └── houyi │ └── zhuque │ └── rtb │ └── proto │ └── ZhuqueRtb.java └── proto └── zhuque-rtb.proto /.gitignore: -------------------------------------------------------------------------------- 1 | .target/ 2 | .logs/ 3 | */logs/ 4 | */*/logs/ 5 | */target/ 6 | 7 | # maven ignore 8 | target/ 9 | *.war 10 | *.zip 11 | *.tar 12 | *.tar.gz 13 | 14 | # eclipse ignore 15 | .settings/ 16 | .project 17 | .classpath 18 | 19 | # idea ignore 20 | .idea/ 21 | *.ipr 22 | *.iml 23 | *.iws 24 | 25 | # temp ignore 26 | *.log 27 | *.cache 28 | *.diff 29 | *.patch 30 | *.tmp 31 | 32 | # system ignore 33 | .DS_Store 34 | Thumbs.db 35 | logs/ 36 | bin/ 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zhuque 2 | 开发源码的一站式广告平台,包含ssp/adx/dsp/dmp模块 3 | -------------------------------------------------------------------------------- /zhuque-adserv-ngx/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-all 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-adserv-ngx 9 | pom 10 | zhuque-adserv-ngx 11 | the adserv engine module for zhuque 12 | 13 | zhuque-adserv-ngx-proto 14 | zhuque-adserv-ngx-core 15 | zhuque-adserv-ngx-server 16 | 17 | -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-adserv-ngx 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-adserv-ngx-core 9 | zhuque-adserv-ngx-core 10 | zhuque-adserv-ngx-core 11 | 12 | 13 | ai.houyi 14 | zhuque-adserv-ngx-proto 15 | 0.0.1-SNAPSHOT 16 | 17 | 18 | com.f2time.albatross 19 | albatross-rpc 20 | 21 | 22 | org.apache.commons 23 | commons-lang3 24 | 25 | 26 | -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-core/src/main/java/ai/houyi/zhuque/adserv/ngx/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.adserv.ngx; -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-core/src/main/java/ai/houyi/zhuque/adserv/ngx/service/BiddingServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.adserv.ngx.service; 17 | 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | 21 | import com.google.protobuf.RpcCallback; 22 | import com.google.protobuf.RpcController; 23 | import com.google.protobuf.ServiceException; 24 | 25 | import ai.houyi.adserv.ngx.proto.BiddingProto.BiddingReq; 26 | import ai.houyi.adserv.ngx.proto.BiddingProto.BiddingRsp; 27 | import ai.houyi.adserv.ngx.proto.BiddingProto.BiddingService; 28 | import ai.houyi.adserv.ngx.proto.BiddingProto.BiddingService.BlockingInterface; 29 | import ai.houyi.adserv.ngx.proto.BiddingProto.BiddingService.Interface; 30 | 31 | /** 32 | * 33 | * @author weiping wang 34 | */ 35 | public class BiddingServiceImpl implements BlockingInterface, Interface { 36 | private static final Logger LOG = LoggerFactory.getLogger(BiddingService.class); 37 | 38 | @Override 39 | public void search(RpcController controller, BiddingReq request, RpcCallback done) { 40 | try { 41 | done.run(search(controller, request)); 42 | } catch (ServiceException ex) { 43 | LOG.error("handle search ad request error, cause: "+ex.getMessage(),ex); 44 | } 45 | } 46 | 47 | @Override 48 | public BiddingRsp search(RpcController controller, BiddingReq request) throws ServiceException { 49 | //TODO 50 | return null; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-core/src/main/java/ai/houyi/zhuque/adserv/ngx/service/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * 18 | * @author weiping wang 19 | */ 20 | package ai.houyi.zhuque.adserv.ngx.service; -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-proto/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | ai.houyi 7 | zhuque-adserv-ngx 8 | 0.0.1-SNAPSHOT 9 | 10 | zhuque-adserv-ngx-proto 11 | zhuque-adserv-ngx-proto 12 | the adserv ngx proto module for zhuque 13 | 14 | 15 | com.google.protobuf 16 | protobuf-java 17 | 18 | 19 | 20 | 21 | 22 | 23 | com.github.os72 24 | protoc-jar-maven-plugin 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-proto/src/main/proto/model.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | syntax = "proto2"; 17 | 18 | package ai.houyi.adserv.ngx.proto; 19 | 20 | import "common.proto"; 21 | 22 | option java_outer_classname = "ModelProto"; 23 | 24 | option optimize_for = SPEED; 25 | 26 | //推广活动/计划 27 | message Campaign{ 28 | optional uint32 campaign_id = 1; 29 | optional uint32 advertiser_id = 2; 30 | optional string name = 3; 31 | optional uint32 status = 4; 32 | } 33 | 34 | //广告组 35 | message AdGroup{ 36 | optional uint32 group_id = 1; 37 | optional uint32 campaign_id = 2; 38 | optional DeliveryMethod delivery_method = 3; 39 | optional PromotionType promotion_type = 4; 40 | optional string landing_page = 5; 41 | optional CostType cost_type = 6; 42 | optional string app_id = 7; 43 | optional string pkg_name = 8; 44 | optional BidStrategy bid_strategy = 9; 45 | optional FreqCapping freq_capping = 10; 46 | 47 | optional TimeTarget time_target = 4; 48 | } 49 | 50 | //推广创意 51 | message Creative { 52 | } 53 | 54 | //代理商 55 | message Agent{ 56 | } 57 | 58 | //广告主 59 | message Advertiser{ 60 | } 61 | 62 | //代理商底价 63 | message AgentFloor { 64 | } 65 | 66 | //广告位底价 67 | message AdPositionFloor { 68 | } 69 | 70 | //第三方广告平台 71 | message Dsp { 72 | } 73 | 74 | //第三方广告平台创意 75 | message DspCreative { 76 | } 77 | 78 | //联盟媒体app 79 | message App {} -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-adserv-ngx 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-adserv-ngx-server 9 | zhuque-adserv-ngx-server 10 | zhuque-adserv-ngx-server 11 | 12 | 13 | com.f2time.albatross 14 | albatross-rpc 15 | 16 | 17 | ai.houyi 18 | zhuque-adserv-ngx-core 19 | 0.0.1-SNAPSHOT 20 | 21 | 22 | -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-server/src/main/java/ai/houyi/zhuque/adserv/ngx/server/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.adserv.ngx.server; 17 | 18 | import org.apache.commons.lang3.math.NumberUtils; 19 | 20 | import com.f2time.albatross.rpc.server.AlbatrossRpcServer; 21 | 22 | import ai.houyi.zhuque.adserv.ngx.service.BiddingServiceImpl; 23 | 24 | /** 25 | * @author weiping wang 26 | */ 27 | public class Application { 28 | private static final int DEFAULT_PORT = 16888; 29 | 30 | public static void main(String[] args) throws Exception { 31 | int port = DEFAULT_PORT; 32 | if (args.length > 0) { 33 | port = NumberUtils.toInt(args[0], DEFAULT_PORT); 34 | } 35 | 36 | AlbatrossRpcServer adservNgxServer = new AlbatrossRpcServer(port); 37 | adservNgxServer.registerRpcService(new BiddingServiceImpl()); 38 | 39 | adservNgxServer.start(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /zhuque-adserv-ngx/zhuque-adserv-ngx-server/src/main/java/ai/houyi/zhuque/adserv/ngx/server/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.adserv.ngx.server; -------------------------------------------------------------------------------- /zhuque-adx-connector/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-all 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-adx-connector 9 | pom 10 | zhuque-adx-connector 11 | the ad-exchange connector module for zhuque 12 | 13 | zhuque-adx-connector-api 14 | zhuque-adx-connector-builtin 15 | 16 | -------------------------------------------------------------------------------- /zhuque-adx-connector/zhuque-adx-connector-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-adx-connector 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-adx-connector-api 9 | zhuque-adx-connector-api 10 | zhuque-adx-connector-api 11 | -------------------------------------------------------------------------------- /zhuque-adx-connector/zhuque-adx-connector-api/src/main/java/ai/houyi/zhuque/adx/connector/api/RtbMsgMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.adx.connector.api; 17 | 18 | /** 19 | * @author weiping wang 20 | */ 21 | public interface RtbMsgMapper { 22 | BidRequest toBidRequest(AdxRequest in); 23 | 24 | AdxResponse toAdxResponse(BidResponse bidResponse, BidRequest bidRequest); 25 | } 26 | -------------------------------------------------------------------------------- /zhuque-adx-connector/zhuque-adx-connector-api/src/main/java/ai/houyi/zhuque/adx/connector/api/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.adx.connector.api; -------------------------------------------------------------------------------- /zhuque-adx-connector/zhuque-adx-connector-builtin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-adx-connector 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-adx-connector-builtin 9 | zhuque-adx-connector-builtin 10 | zhuque-adx-connector-builtin 11 | -------------------------------------------------------------------------------- /zhuque-adx-connector/zhuque-adx-connector-builtin/src/main/java/ai/houyi/zhuque/adx/connector/builtin/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.adx.connector.builtin; -------------------------------------------------------------------------------- /zhuque-auth/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | ai.houyi 7 | zhuque-all 8 | 0.0.1-SNAPSHOT 9 | 10 | zhuque-auth 11 | zhuque-auth 12 | 认证&授权服务模块 13 | 14 | 15 | ai.houyi 16 | zhuque-commons 17 | 0.0.1-SNAPSHOT 18 | 19 | 20 | ai.houyi 21 | dorado-spring-boot-starter 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-log4j2 26 | 27 | 28 | ai.houyi 29 | zhuque-dao 30 | 0.0.1-SNAPSHOT 31 | 32 | 33 | ai.houyi 34 | zhuque-core 35 | 0.0.1-SNAPSHOT 36 | 37 | 38 | commons-codec 39 | commons-codec 40 | 41 | 42 | ai.houyi 43 | zhuque-commons-web 44 | 0.0.1-SNAPSHOT 45 | 46 | 47 | ai.houyi 48 | dorado-swagger-ui 49 | 50 | 51 | org.mybatis.spring.boot 52 | mybatis-spring-boot-starter 53 | 54 | 55 | ai.houyi 56 | dorado-swagger-spring-boot-starter 57 | 58 | 59 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth; 17 | 18 | import org.mybatis.spring.annotation.MapperScan; 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.context.annotation.ComponentScan; 21 | 22 | import ai.houyi.dorado.springboot.DoradoSpringBootApplication; 23 | 24 | /** 25 | * 26 | * @author weiping wang 27 | */ 28 | @DoradoSpringBootApplication 29 | @MapperScan("ai.houyi.zhuque.dao") 30 | @ComponentScan(basePackages= {"ai.houyi.zhuque"}) 31 | public class Application { 32 | 33 | public static void main(String[] args) { 34 | SpringApplication.run(Application.class, args); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/controller/AuthController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.controller; 17 | 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | 20 | import ai.houyi.dorado.rest.annotation.Controller; 21 | import ai.houyi.dorado.rest.annotation.POST; 22 | import ai.houyi.dorado.rest.annotation.Path; 23 | import ai.houyi.zhuque.auth.model.AuthReq; 24 | import ai.houyi.zhuque.auth.model.Subject; 25 | import ai.houyi.zhuque.auth.service.AuthService; 26 | import io.swagger.annotations.Api; 27 | 28 | /** 29 | * 30 | * @author weiping wang 31 | */ 32 | @Controller 33 | @Path("/auth") 34 | @Api(tags="用户认证api") 35 | public class AuthController { 36 | @Autowired 37 | private AuthService authService; 38 | 39 | @POST 40 | public Subject auth(AuthReq authReq) { 41 | return authService.auth(authReq); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/controller/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * 18 | * @author weiping wang 19 | */ 20 | package ai.houyi.zhuque.auth.controller; -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/model/AuthReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.model; 17 | 18 | /** 19 | * 20 | * @author weiping wang 21 | */ 22 | public class AuthReq { 23 | private String userName; 24 | private String passwd; 25 | /** 26 | * @return the userName 27 | */ 28 | public String getUserName() { 29 | return userName; 30 | } 31 | /** 32 | * @param userName the userName to set 33 | */ 34 | public void setUserName(String userName) { 35 | this.userName = userName; 36 | } 37 | /** 38 | * @return the passwd 39 | */ 40 | public String getPasswd() { 41 | return passwd; 42 | } 43 | /** 44 | * @param passwd the passwd to set 45 | */ 46 | public void setPasswd(String passwd) { 47 | this.passwd = passwd; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/model/ChangePwdReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.model; 17 | 18 | /** 19 | * @author weiping wang 20 | */ 21 | public class ChangePwdReq { 22 | private Integer userId; 23 | private String oldPasswd; 24 | private String passwd; 25 | 26 | public Integer getUserId() { 27 | return userId; 28 | } 29 | 30 | public void setUserId(Integer userId) { 31 | this.userId = userId; 32 | } 33 | 34 | public String getOldPasswd() { 35 | return oldPasswd; 36 | } 37 | 38 | public void setOldPasswd(String oldPasswd) { 39 | this.oldPasswd = oldPasswd; 40 | } 41 | 42 | public String getPasswd() { 43 | return passwd; 44 | } 45 | 46 | public void setPasswd(String passwd) { 47 | this.passwd = passwd; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/model/ResetPasswdReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.model; 17 | 18 | /** 19 | * @author weiping wang 20 | */ 21 | public class ResetPasswdReq { 22 | private Integer userId; 23 | private String passwd; 24 | 25 | public Integer getUserId() { 26 | return userId; 27 | } 28 | 29 | public void setUserId(Integer userId) { 30 | this.userId = userId; 31 | } 32 | 33 | public String getPasswd() { 34 | return passwd; 35 | } 36 | 37 | public void setPasswd(String passwd) { 38 | this.passwd = passwd; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/model/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.auth.model; -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * 18 | * @author weiping wang 19 | */ 20 | package ai.houyi.zhuque.auth; -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/AuthService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.service; 17 | 18 | import ai.houyi.zhuque.auth.model.AuthReq; 19 | import ai.houyi.zhuque.auth.model.Subject; 20 | 21 | /** 22 | * 23 | * @author weiping wang 24 | */ 25 | public interface AuthService { 26 | 27 | Subject auth(AuthReq authReq); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/MenuService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.core.IService; 21 | import ai.houyi.zhuque.core.model.query.MenuQueryReq; 22 | import ai.houyi.zhuque.dao.model.Menu; 23 | 24 | /** 25 | * @author weiping wang 26 | * 27 | */ 28 | public interface MenuService extends IService { 29 | 30 | List selectByUserId(Integer id); 31 | } 32 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/PermissionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.core.IService; 21 | import ai.houyi.zhuque.core.model.query.PermissionQueryReq; 22 | import ai.houyi.zhuque.dao.model.Permission; 23 | 24 | /** 25 | * @author weiping wang 26 | */ 27 | public interface PermissionService extends IService { 28 | 29 | List selectPermissionsAsTree(); 30 | } 31 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/RoleService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.core.IService; 21 | import ai.houyi.zhuque.core.model.query.RoleQueryReq; 22 | import ai.houyi.zhuque.dao.model.Permission; 23 | import ai.houyi.zhuque.dao.model.Role; 24 | 25 | /** 26 | * @author weiping wang 27 | */ 28 | public interface RoleService extends IService { 29 | 30 | void updateRolePermissions(Integer roleId, List permissions); 31 | 32 | List getRolePermissions(Integer roleId); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/SessionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.service; 17 | 18 | import ai.houyi.zhuque.commons.model.QueryReq; 19 | import ai.houyi.zhuque.core.IService; 20 | import ai.houyi.zhuque.dao.model.Session; 21 | 22 | /** 23 | * 24 | * @author weiping wang 25 | */ 26 | public interface SessionService extends IService, Integer> { 27 | void deleteBySessionId(String sessionId); 28 | 29 | Session createOrSaveSession(Integer userId); 30 | } 31 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/UserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.auth.model.AuthReq; 21 | import ai.houyi.zhuque.auth.model.ChangePwdReq; 22 | import ai.houyi.zhuque.auth.model.ResetPasswdReq; 23 | import ai.houyi.zhuque.auth.model.Subject; 24 | import ai.houyi.zhuque.core.IService; 25 | import ai.houyi.zhuque.core.model.query.UserQueryReq; 26 | import ai.houyi.zhuque.dao.model.Permission; 27 | import ai.houyi.zhuque.dao.model.Role; 28 | import ai.houyi.zhuque.dao.model.User; 29 | 30 | /** 31 | * @author weiping wang 32 | * 33 | */ 34 | public interface UserService extends IService { 35 | 36 | void resetPasswd(ResetPasswdReq req); 37 | 38 | void updatePasswd(ChangePwdReq req); 39 | 40 | void updateUserRoles(Integer userId, List roleIds); 41 | 42 | List getUserRoles(Integer userId); 43 | 44 | List getUserPermissions(Integer userId); 45 | 46 | Subject auth(AuthReq authReq); 47 | } 48 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/impl/AuthServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.auth.service.impl; 17 | 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.stereotype.Service; 20 | 21 | import ai.houyi.zhuque.auth.model.AuthReq; 22 | import ai.houyi.zhuque.auth.model.Subject; 23 | import ai.houyi.zhuque.auth.service.AuthService; 24 | import ai.houyi.zhuque.auth.service.UserService; 25 | 26 | /** 27 | * 28 | * @author weiping wang 29 | */ 30 | @Service 31 | public class AuthServiceImpl implements AuthService { 32 | @Autowired 33 | private UserService userService; 34 | 35 | @Override 36 | public Subject auth(AuthReq authReq) { 37 | return userService.auth(authReq); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.auth.service.impl; -------------------------------------------------------------------------------- /zhuque-auth/src/main/java/ai/houyi/zhuque/auth/service/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.auth.service; -------------------------------------------------------------------------------- /zhuque-auth/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 2 | spring.datasource.url=jdbc:mysql://182.92.173.117:3306/zhuque?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull 3 | spring.datasource.username=test 4 | spring.datasource.password=test@fftime 5 | # Hikari will use the above plus the following to setup connection pooling 6 | spring.datasource.type=com.zaxxer.hikari.HikariDataSource 7 | spring.datasource.hikari.minimum-idle=5 8 | spring.datasource.hikari.maximum-pool-size=15 9 | 10 | logging.level.ai.houyi.zhuque.dao=debug 11 | logging.level.ai.houyi.dorado.swagger.Reader=debug 12 | dorado.min-workers=10 13 | dorado.max-workers=10 -------------------------------------------------------------------------------- /zhuque-auth/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javagossip/zhuque/ecbeb9672dacceee7081a2296873871da8bff080/zhuque-auth/src/main/resources/application-prod.properties -------------------------------------------------------------------------------- /zhuque-auth/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=@env.id@ 2 | 3 | spring.messages.encoding=UTF-8 4 | mybatis.mapperLocations=classpath:mapper/*.xml 5 | mybatis.config-location=classpath:mybatis/mybatis-config.xml 6 | dorado.port=18889 7 | 8 | #dorado.swagger.title=Zhuque's Authentication&Authorization api 9 | dorado.swagger.title=Zhuque's\u8ba4\u8bc1&\u6388\u6743api 10 | dorado.swagger.description=${dorado.swagger.title} 11 | dorado.swagger.license=Apache License 12 | dorado.swagger.licenseUrl=http://www.apache.org/licenses/LICENSE-2.0 13 | dorado.swagger.contact.name=weiping wang 14 | dorado.swagger.contact.email=wangweiping@f2time.com 15 | dorado.swagger.contact.url=https://github.com/javagossip 16 | 17 | dorado.swagger.apiKey.name=Authorization 18 | dorado.swagger.apiKey.in=header -------------------------------------------------------------------------------- /zhuque-commons-web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-all 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-commons-web 9 | zhuque-commons-web 10 | web controller helper classes 11 | 12 | 13 | ai.houyi 14 | dorado-core 15 | 16 | 17 | ai.houyi 18 | zhuque-commons 19 | 0.0.1-SNAPSHOT 20 | 21 | 22 | javax.validation 23 | validation-api 24 | 25 | 26 | -------------------------------------------------------------------------------- /zhuque-commons-web/src/main/java/ai/houyi/zhuque/commons/web/AuthFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.web; 17 | 18 | /** 19 | * 20 | * @author weiping wang 21 | */ 22 | @SuppressWarnings("serial") 23 | public class AuthFailedException extends RuntimeException { 24 | 25 | public AuthFailedException() { 26 | super(); 27 | } 28 | 29 | public AuthFailedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 30 | super(message, cause, enableSuppression, writableStackTrace); 31 | } 32 | 33 | 34 | public AuthFailedException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | 38 | 39 | public AuthFailedException(String message) { 40 | super(message); 41 | } 42 | 43 | 44 | public AuthFailedException(Throwable cause) { 45 | super(cause); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /zhuque-commons-web/src/main/java/ai/houyi/zhuque/commons/web/IController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.web; 17 | 18 | import java.io.Serializable; 19 | 20 | import ai.houyi.zhuque.commons.page.Page; 21 | 22 | /** 23 | * @author weiping wang 24 | */ 25 | public interface IController { 26 | void saveOrUpdate(T t); 27 | 28 | void deleteById(PK id); 29 | 30 | T loadById(PK id); 31 | 32 | Page selectPage(Query queryReq); 33 | } 34 | -------------------------------------------------------------------------------- /zhuque-commons-web/src/main/java/ai/houyi/zhuque/commons/web/Response.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.web; 17 | 18 | /** 19 | * @author weiping wang 20 | * 21 | */ 22 | public class Response { 23 | private int code; 24 | private String msg; 25 | private Object data; 26 | 27 | public Response(int code, String msg, Object data) { 28 | this.code = code; 29 | this.msg = msg; 30 | this.data = data; 31 | } 32 | 33 | public int getCode() { 34 | return code; 35 | } 36 | 37 | public String getMsg() { 38 | return msg; 39 | } 40 | 41 | public Object getData() { 42 | return data; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /zhuque-commons-web/src/main/java/ai/houyi/zhuque/commons/web/ZhuqueExceptionAdvisor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.web; 17 | 18 | import ai.houyi.dorado.rest.annotation.ExceptionAdvice; 19 | import ai.houyi.dorado.rest.annotation.ExceptionType; 20 | import ai.houyi.dorado.rest.annotation.Status; 21 | import ai.houyi.zhuque.commons.exception.ZhuqueException; 22 | 23 | /** 24 | * 全局异常处理器 25 | * 26 | * @author weiping wang 27 | */ 28 | @ExceptionAdvice 29 | public class ZhuqueExceptionAdvisor { 30 | 31 | @ExceptionType(value = ZhuqueException.class) 32 | public Response handleException(ZhuqueException exception) { 33 | return new Response(1, exception.getMessage(), null); 34 | } 35 | 36 | @ExceptionType(value = Exception.class) 37 | public Response handleException(Exception exception) { 38 | exception.printStackTrace(); 39 | return new Response(1, exception.getMessage(), null); 40 | } 41 | 42 | @Status(value = 403) 43 | public Response handleException(AuthFailedException exception) { 44 | return new Response(1, exception.getMessage(), null); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /zhuque-commons-web/src/main/java/ai/houyi/zhuque/commons/web/ZhuqueMethodReturnValueHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.web; 17 | 18 | import ai.houyi.dorado.rest.http.MethodReturnValueHandler; 19 | import ai.houyi.dorado.rest.util.MethodDescriptor; 20 | import ai.houyi.dorado.rest.util.TypeUtils; 21 | 22 | /** 23 | * @author weiping wang 24 | * 25 | */ 26 | public class ZhuqueMethodReturnValueHandler implements MethodReturnValueHandler { 27 | 28 | @Override 29 | public Object handleMethodReturnValue(Object value, MethodDescriptor methodDescriptor) { 30 | return new Response(0, "ok", value); 31 | } 32 | 33 | @Override 34 | public boolean supportsReturnType(MethodDescriptor returnType) { 35 | return TypeUtils.isSerializableType(returnType.getReturnType()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /zhuque-commons-web/src/main/java/ai/houyi/zhuque/commons/web/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * 18 | * @author weiping wang 19 | */ 20 | package ai.houyi.zhuque.commons.web; -------------------------------------------------------------------------------- /zhuque-commons/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-all 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-commons 9 | zhuque-commons 10 | 公共模块 11 | 12 | 13 | org.apache.commons 14 | commons-lang3 15 | 16 | 17 | redis.clients 18 | jedis 19 | 20 | 21 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons; 17 | 18 | /** 19 | * 20 | * @author weiping wang 21 | */ 22 | public final class Constants { 23 | public static final int DEFAULT_PAGE_SIZE = 20; 24 | public static final int INIT_PAGE_NO = 1; 25 | public static final String SIGN_COMMA = ","; 26 | } 27 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/SQLUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons; 17 | 18 | import org.apache.commons.lang3.StringUtils; 19 | 20 | /** 21 | * @author weiping wang 22 | */ 23 | public final class SQLUtils { 24 | public static String toLikeString(String str) { 25 | return StringUtils.join("%", str, "%"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/UUIDUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons; 17 | 18 | import java.util.UUID; 19 | 20 | /** 21 | * @author weiping wang 22 | */ 23 | public final class UUIDUtils { 24 | 25 | public static String uuid() { 26 | return UUID.randomUUID().toString().replace("-", ""); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/exception/ExceptionUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.exception; 17 | 18 | /** 19 | * 20 | * @author weiping wang 21 | */ 22 | public final class ExceptionUtils { 23 | 24 | public static void throwZhuqueException(String msg) { 25 | throw new ZhuqueException(msg); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/exception/ZhuqueException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.exception; 17 | 18 | /** 19 | * 自定义异常 20 | * 21 | * @author weiping wang 22 | */ 23 | @SuppressWarnings("serial") 24 | public class ZhuqueException extends RuntimeException { 25 | private int code; 26 | 27 | public ZhuqueException() { 28 | super(); 29 | } 30 | 31 | public ZhuqueException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 32 | super(message, cause, enableSuppression, writableStackTrace); 33 | } 34 | 35 | public ZhuqueException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public ZhuqueException(String message) { 40 | super(message); 41 | } 42 | 43 | public ZhuqueException(Throwable cause) { 44 | super(cause); 45 | } 46 | 47 | public ZhuqueException(int code, String message) { 48 | super(message); 49 | this.code = code; 50 | } 51 | 52 | public int getCode() { 53 | return code; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.commons.exception; -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/model/QueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.model; 17 | 18 | import ai.houyi.zhuque.commons.Constants; 19 | 20 | /** 21 | * 22 | * @author weiping wang 23 | */ 24 | public abstract class QueryReq { 25 | 26 | public Integer getPageNo() { 27 | return pageNo; 28 | } 29 | 30 | public void setPageNo(Integer pageNo) { 31 | this.pageNo = pageNo; 32 | } 33 | 34 | public Integer getPageSize() { 35 | return pageSize; 36 | } 37 | 38 | public void setPageSize(Integer pageSize) { 39 | this.pageSize = pageSize; 40 | } 41 | 42 | protected Integer pageNo; 43 | protected Integer pageSize; 44 | 45 | public void initPageInfoIfNeed() { 46 | if (pageNo != null && pageNo > 0) 47 | pageNo = pageNo - 1; 48 | if (pageNo == null) 49 | pageNo = Constants.INIT_PAGE_NO - 1; 50 | if (pageSize == null) 51 | pageSize = Constants.DEFAULT_PAGE_SIZE; 52 | 53 | } 54 | 55 | public final E toExample() { 56 | initPageInfoIfNeed(); 57 | return buildExample(); 58 | } 59 | 60 | public abstract E buildExample(); 61 | } 62 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/model/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * 18 | * @author weiping wang 19 | */ 20 | package ai.houyi.zhuque.commons.model; -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.commons; -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/page/Page.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.commons.page; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * @author weiping wang 22 | * 23 | */ 24 | public final class Page { 25 | private int total; 26 | private int pageSize; 27 | private int pageCount; 28 | 29 | private List result; 30 | 31 | private Page(int total, int pageSize, List result) { 32 | this.total = total; 33 | this.pageSize = pageSize; 34 | 35 | this.pageCount = total % pageSize == 0 ? total / pageSize : total / pageSize + 1; 36 | this.result=result; 37 | } 38 | 39 | public static Page create(int total,int pageSize,List result){ 40 | return new Page(total,pageSize,result); 41 | } 42 | 43 | public int getTotal() { 44 | return total; 45 | } 46 | 47 | public int getPageSize() { 48 | return pageSize; 49 | } 50 | 51 | public int getPageCount() { 52 | return pageCount; 53 | } 54 | 55 | public List getResult() { 56 | return result; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/page/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.commons.page; -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/redis/RedisCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 f2time.com All right reserved. 3 | */ 4 | package ai.houyi.zhuque.commons.redis; 5 | 6 | import redis.clients.jedis.Jedis; 7 | 8 | /** 9 | * 10 | * @author wangwp 11 | */ 12 | public interface RedisCallback { 13 | Object doRedis(Jedis jedis); 14 | } 15 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/redis/RedisTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 f2time.com All right reserved. 3 | */ 4 | package ai.houyi.zhuque.commons.redis; 5 | 6 | import redis.clients.jedis.Jedis; 7 | 8 | /** 9 | * 10 | * @author wangwp 11 | */ 12 | public class RedisTemplate { 13 | 14 | public static Object execute(RedisCallback callback) { 15 | Jedis jedis = null; 16 | try { 17 | jedis = RedisUtils.getRedisClient(); 18 | return callback.doRedis(jedis); 19 | } catch (Exception ex) { 20 | throw new RuntimeException(ex); 21 | } finally { 22 | try { 23 | if (jedis != null) { 24 | jedis.close(); 25 | } 26 | } catch (Exception ex) { 27 | // ignore this exception 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /zhuque-commons/src/main/java/ai/houyi/zhuque/commons/redis/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.commons.redis; -------------------------------------------------------------------------------- /zhuque-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | ai.houyi 5 | zhuque-all 6 | 0.0.1-SNAPSHOT 7 | 8 | zhuque-core 9 | zhuque-core 10 | the core module for zhuque 11 | 12 | 13 | ai.houyi 14 | zhuque-commons 15 | 0.0.1-SNAPSHOT 16 | 17 | 18 | ai.houyi 19 | zhuque-dao 20 | 0.0.1-SNAPSHOT 21 | 22 | 23 | org.springframework 24 | spring-context 25 | 26 | 27 | org.springframework 28 | spring-tx 29 | 30 | 31 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/IService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core; 17 | 18 | import java.io.Serializable; 19 | import java.util.List; 20 | 21 | import ai.houyi.zhuque.commons.page.Page; 22 | 23 | /** 24 | * @author weiping wang 25 | */ 26 | public interface IService { 27 | void save(T t); 28 | 29 | void update(T t); 30 | 31 | void deleteById(PK pk); 32 | 33 | void softDeleteById(PK pk); 34 | 35 | T loadById(PK pk); 36 | 37 | List selectAll(); 38 | 39 | List selectByQueryReq(Q query); 40 | 41 | Page selectPageList(Q query); 42 | } 43 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/AuthContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model; 17 | 18 | import ai.houyi.zhuque.dao.model.User; 19 | 20 | /** 21 | * 22 | * @author weiping wang 23 | */ 24 | public class AuthContext { 25 | private static ThreadLocal AUTH_INFO_HOLDER = new ThreadLocal(); 26 | 27 | public static void set(AuthInfo authInfo) { 28 | AUTH_INFO_HOLDER.set(authInfo); 29 | } 30 | 31 | public static AuthInfo get() { 32 | return AUTH_INFO_HOLDER.get(); 33 | } 34 | 35 | public static User currentUser() { 36 | AuthInfo authInfo = AUTH_INFO_HOLDER.get(); 37 | if (authInfo == null) 38 | return null; 39 | return authInfo.getUser(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/AuthInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model; 17 | 18 | import ai.houyi.zhuque.dao.model.User; 19 | 20 | /** 21 | * 22 | * @author weiping wang 23 | */ 24 | public class AuthInfo { 25 | private String token; 26 | private User user; 27 | 28 | public AuthInfo() { 29 | } 30 | 31 | public AuthInfo(String token, User user) { 32 | this.token = token; 33 | this.user = user; 34 | } 35 | 36 | /** 37 | * @return the token 38 | */ 39 | public String getToken() { 40 | return token; 41 | } 42 | 43 | /** 44 | * @param token the token to set 45 | */ 46 | public void setToken(String token) { 47 | this.token = token; 48 | } 49 | 50 | /** 51 | * @return the user 52 | */ 53 | public User getUser() { 54 | return user; 55 | } 56 | 57 | /** 58 | * @param user the user to set 59 | */ 60 | public void setUser(User user) { 61 | this.user = user; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/AgentQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import org.apache.commons.lang3.StringUtils; 19 | 20 | import ai.houyi.zhuque.commons.SQLUtils; 21 | import ai.houyi.zhuque.commons.model.QueryReq; 22 | import ai.houyi.zhuque.dao.model.AgentExample; 23 | 24 | /** 25 | * 26 | * @author weiping wang 27 | */ 28 | public class AgentQueryReq extends QueryReq { 29 | private String name; 30 | 31 | @Override 32 | public AgentExample buildExample() { 33 | AgentExample example = new AgentExample(); 34 | AgentExample.Criteria criteria = example.createCriteria(); 35 | 36 | if (StringUtils.isNotBlank(name)) { 37 | criteria.andNameLike(SQLUtils.toLikeString(name)); 38 | } 39 | 40 | if (pageNo != null && pageSize != null) { 41 | example.page(pageNo, pageSize); 42 | } 43 | return example; 44 | } 45 | 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | /** 51 | * @param name the name to set 52 | */ 53 | public void setName(String name) { 54 | this.name = name; 55 | } 56 | 57 | public static void main(String[] args) throws Exception { 58 | System.out.println(String.format("%%s%", "hello")); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/AuditAdvertiserQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import org.apache.commons.lang3.StringUtils; 19 | 20 | import ai.houyi.zhuque.commons.SQLUtils; 21 | import ai.houyi.zhuque.commons.model.QueryReq; 22 | import ai.houyi.zhuque.dao.model.AuditAdvertiserExample; 23 | 24 | /** 25 | * @author weiping wang 26 | */ 27 | public class AuditAdvertiserQueryReq extends QueryReq { 28 | private String name; 29 | 30 | @Override 31 | public AuditAdvertiserExample buildExample() { 32 | AuditAdvertiserExample example = new AuditAdvertiserExample(); 33 | if(StringUtils.isNotBlank(name)) { 34 | example.createCriteria().andNameLike(SQLUtils.toLikeString(name)); 35 | } 36 | example.page(pageNo, pageSize); 37 | return example; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public void setName(String name) { 45 | this.name = name; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/DspQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import ai.houyi.zhuque.commons.SQLUtils; 19 | import ai.houyi.zhuque.commons.model.QueryReq; 20 | import ai.houyi.zhuque.dao.model.DspExample; 21 | 22 | /** 23 | * 24 | * @author weiping wang 25 | */ 26 | public class DspQueryReq extends QueryReq { 27 | private Integer id; 28 | private Integer status; 29 | private String name; 30 | 31 | @Override 32 | public DspExample buildExample() { 33 | DspExample example = new DspExample(); 34 | DspExample.Criteria criteria = example.createCriteria(); 35 | 36 | if (id != null) 37 | criteria.andIdEqualTo(id); 38 | if (status != null) 39 | criteria.andStatusEqualTo(status); 40 | if (name != null) 41 | criteria.andNameLike(SQLUtils.toLikeString(name)); 42 | 43 | if(pageNo!=null&&pageSize!=null) { 44 | example.page(pageNo, pageSize); 45 | } 46 | return example; 47 | } 48 | 49 | /** 50 | * @param id the id to set 51 | */ 52 | public void setId(Integer id) { 53 | this.id = id; 54 | } 55 | 56 | /** 57 | * @param status the status to set 58 | */ 59 | public void setStatus(Integer status) { 60 | this.status = status; 61 | } 62 | 63 | /** 64 | * @param name the name to set 65 | */ 66 | public void setName(String name) { 67 | this.name = name; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/MaterialQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import ai.houyi.zhuque.commons.model.QueryReq; 19 | import ai.houyi.zhuque.dao.model.MaterialExample; 20 | 21 | /** 22 | * @author weiping wang 23 | * 24 | */ 25 | public class MaterialQueryReq extends QueryReq { 26 | 27 | @Override 28 | public MaterialExample buildExample() { 29 | //TODO 30 | return null; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/MenuQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import ai.houyi.zhuque.commons.model.QueryReq; 19 | import ai.houyi.zhuque.dao.model.MenuExample; 20 | 21 | /** 22 | * @author weiping wang 23 | * 24 | */ 25 | public class MenuQueryReq extends QueryReq { 26 | 27 | @Override 28 | public MenuExample buildExample() { 29 | return null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/PermissionQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import ai.houyi.zhuque.commons.model.QueryReq; 19 | import ai.houyi.zhuque.dao.model.PermissionExample; 20 | 21 | /** 22 | * @author weiping wang 23 | * 24 | */ 25 | public class PermissionQueryReq extends QueryReq { 26 | 27 | @Override 28 | public PermissionExample buildExample() { 29 | return null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/RoleQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import org.apache.commons.lang3.StringUtils; 19 | 20 | import ai.houyi.zhuque.commons.SQLUtils; 21 | import ai.houyi.zhuque.commons.model.QueryReq; 22 | import ai.houyi.zhuque.dao.model.RoleExample; 23 | 24 | /** 25 | * @author weiping wang 26 | * 27 | */ 28 | public class RoleQueryReq extends QueryReq { 29 | private String name; 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | @Override 36 | public RoleExample buildExample() { 37 | RoleExample example = new RoleExample(); 38 | if (StringUtils.isNotBlank(name)) 39 | example.createCriteria().andNameLike(SQLUtils.toLikeString(name)); 40 | 41 | if(pageNo!=null&&pageSize!=null) { 42 | example.page(pageNo, pageSize); 43 | } 44 | return example; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/TemplateQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import ai.houyi.zhuque.commons.model.QueryReq; 19 | import ai.houyi.zhuque.dao.model.TemplateExample; 20 | 21 | /** 22 | * @author weiping wang 23 | * 24 | */ 25 | public class TemplateQueryReq extends QueryReq { 26 | 27 | @Override 28 | public TemplateExample buildExample() { 29 | return null; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/UserQueryReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.model.query; 17 | 18 | import org.apache.commons.lang3.StringUtils; 19 | 20 | import ai.houyi.zhuque.commons.SQLUtils; 21 | import ai.houyi.zhuque.commons.model.QueryReq; 22 | import ai.houyi.zhuque.dao.model.UserExample; 23 | 24 | /** 25 | * @author weiping wang 26 | * 27 | */ 28 | public class UserQueryReq extends QueryReq { 29 | private String name; 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | @Override 36 | public UserExample buildExample() { 37 | UserExample example = new UserExample(); 38 | 39 | if (StringUtils.isNotBlank(name)) 40 | example.createCriteria().andNameLike(SQLUtils.toLikeString(name)); 41 | 42 | if (pageNo != null && pageSize != null) { 43 | example.page(pageNo, pageSize); 44 | } 45 | return example; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/model/query/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * 18 | * @author weiping wang 19 | */ 20 | package ai.houyi.zhuque.core.model.query; -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | /** 17 | * @author weiping wang 18 | * 19 | */ 20 | package ai.houyi.zhuque.core; -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/AdGroupService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import ai.houyi.zhuque.commons.page.Page; 19 | import ai.houyi.zhuque.core.IService; 20 | import ai.houyi.zhuque.core.model.query.AdGroupQueryReq; 21 | import ai.houyi.zhuque.dao.model.AdGroup; 22 | 23 | /** 24 | * 25 | * @author weiping wang 26 | */ 27 | public interface AdGroupService extends IService { 28 | 29 | Page selectPageListByAdvertiserId(Integer advertiserId, Integer pageNo); 30 | } 31 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/AdvertiserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.core.IService; 21 | import ai.houyi.zhuque.core.model.query.AdvertiserQueryReq; 22 | import ai.houyi.zhuque.dao.model.Advertiser; 23 | 24 | /** 25 | * 26 | * @author weiping wang 27 | */ 28 | public interface AdvertiserService extends IService { 29 | 30 | List selectByName(String name); 31 | 32 | void updateStatus(Integer advertiserId, int status); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/AgentService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.core.IService; 21 | import ai.houyi.zhuque.core.model.query.AgentQueryReq; 22 | import ai.houyi.zhuque.dao.model.Agent; 23 | 24 | /** 25 | * 26 | * @author weiping wang 27 | */ 28 | public interface AgentService extends IService { 29 | 30 | void updateStatus(int agentId, int i); 31 | 32 | List selectByName(String name); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/AuditAdvertiserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.core.IService; 21 | import ai.houyi.zhuque.core.model.query.AuditAdvertiserQueryReq; 22 | import ai.houyi.zhuque.dao.model.AdvertiserQualification; 23 | import ai.houyi.zhuque.dao.model.AuditAdvertiser; 24 | 25 | /** 26 | * @author weiping wang 27 | * 28 | */ 29 | public interface AuditAdvertiserService extends IService { 30 | void addAdvertiserQualification(AdvertiserQualification qualification); 31 | 32 | void deleteAdvertiserQualification(Integer qualificationId); 33 | 34 | List getAdvertiserQualificationsByAdvertiserId(Integer auditAdvertiserId); 35 | } 36 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/CampaignService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import ai.houyi.zhuque.core.IService; 19 | import ai.houyi.zhuque.core.model.query.CampaignQueryReq; 20 | import ai.houyi.zhuque.dao.model.Campaign; 21 | 22 | /** 23 | * 24 | * @author weiping wang 25 | */ 26 | public interface CampaignService extends IService { 27 | } 28 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/CreativeService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import ai.houyi.zhuque.core.IService; 19 | import ai.houyi.zhuque.core.model.query.CreativeQueryReq; 20 | import ai.houyi.zhuque.dao.model.Creative; 21 | 22 | /** 23 | * 24 | * @author weiping wang 25 | */ 26 | public interface CreativeService extends IService { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/DspService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import java.util.List; 19 | 20 | import ai.houyi.zhuque.core.IService; 21 | import ai.houyi.zhuque.core.model.query.DspQueryReq; 22 | import ai.houyi.zhuque.dao.model.Dsp; 23 | 24 | /** 25 | * @author weiping wang 26 | * 27 | */ 28 | public interface DspService extends IService{ 29 | 30 | void updateStatus(int dspId, int status); 31 | 32 | List selectByName(String name); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/MaterialService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenAds Project 3 | * 4 | * The OpenAds Project licenses this file to you under the Apache License, 5 | * version 2.0 (the "License"); you may not use this file except in compliance 6 | * with the License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | package ai.houyi.zhuque.core.service; 17 | 18 | import ai.houyi.zhuque.core.IService; 19 | import ai.houyi.zhuque.core.model.query.MaterialQueryReq; 20 | import ai.houyi.zhuque.dao.model.Material; 21 | 22 | /** 23 | * 24 | * @author weiping wang 25 | */ 26 | public interface MaterialService extends IService { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /zhuque-core/src/main/java/ai/houyi/zhuque/core/service/TemplateService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package ai.houyi.zhuque.core.service; 5 | 6 | import java.util.List; 7 | 8 | import ai.houyi.zhuque.core.IService; 9 | import ai.houyi.zhuque.core.model.query.TemplateQueryReq; 10 | import ai.houyi.zhuque.dao.model.Template; 11 | 12 | /** 13 | * @author Administrator 14 | * 15 | */ 16 | public interface TemplateService extends IService{ 17 | 18 | List