├── README.md ├── .gitignore ├── .idea ├── dataSources │ ├── 1131dc9c-8e55-43dc-92de-dd9d063ceb74 │ │ └── storage_v2 │ │ │ └── _src_ │ │ │ └── schema │ │ │ ├── orange.Libeww.meta │ │ │ └── orange.Libeww.zip │ └── 95f31c06-3c2e-4312-8005-2c585b6e147e │ │ └── storage_v2 │ │ └── _src_ │ │ └── schema │ │ ├── orange.Libeww.meta │ │ └── orange.Libeww.zip ├── vcs.xml ├── encodings.xml ├── inspectionProfiles │ └── Project_Default.xml ├── dataSources.local.xml ├── dataSources.xml ├── misc.xml └── compiler.xml ├── .txlcn ├── application-5555.mv.db ├── application-9999.mv.db ├── order-service-9999.mv.db └── seller-service-5555.mv.db ├── txlcn-tm └── src │ ├── main │ ├── resources │ │ ├── static │ │ │ └── admin │ │ │ │ ├── favicon.png │ │ │ │ ├── assets │ │ │ │ └── 8c382430f673ad2237bbf19e5c8a4b00.png │ │ │ │ └── index.html │ │ ├── application.properties │ │ └── tx-manager.sql │ └── java │ │ └── com │ │ └── codingapi │ │ └── txlcn │ │ └── tm │ │ ├── config │ │ └── EnableTransactionManagerServer.java │ │ ├── cluster │ │ └── TMProperties.java │ │ ├── support │ │ ├── restapi │ │ │ ├── auth │ │ │ │ ├── sauth │ │ │ │ │ ├── SAuthHandleException.java │ │ │ │ │ ├── DefaultSAuthLogic.java │ │ │ │ │ ├── token │ │ │ │ │ │ └── TokenStorage.java │ │ │ │ │ └── SAuthLogic.java │ │ │ │ └── TxManagerAdminAuthLogic.java │ │ │ ├── vo │ │ │ │ ├── Token.java │ │ │ │ ├── DeleteExceptions.java │ │ │ │ ├── ExceptionList.java │ │ │ │ ├── TxLogList.java │ │ │ │ ├── DeleteLogsReq.java │ │ │ │ ├── ListAppMods.java │ │ │ │ ├── ErrorResponse.java │ │ │ │ ├── DTXInfo.java │ │ │ │ └── TxManagerLog.java │ │ │ ├── RedirectController.java │ │ │ └── ao │ │ │ │ └── WriteTxExceptionDTO.java │ │ ├── txex │ │ │ └── TxExceptionListener.java │ │ └── db │ │ │ └── jpa │ │ │ └── TxExceptionRepository.java │ │ ├── core │ │ └── storage │ │ │ ├── FastStorageProvider.java │ │ │ ├── LockValue.java │ │ │ └── GroupProps.java │ │ ├── txmsg │ │ ├── RpcExecuteService.java │ │ ├── RpcExceptionHandler.java │ │ └── TransactionCmd.java │ │ └── TMApplication.java │ └── test │ └── java │ └── com │ └── codingapi │ └── txlcn │ └── tm │ └── TestFastStorage.java ├── yitao-sms-service └── src │ └── main │ ├── resources │ ├── lib │ │ ├── dom4j-1.6.1.jar │ │ ├── commons-codec-1.3.jar │ │ ├── commons-logging-1.0.4.jar │ │ └── commons-httpclient-3.0-rc4.jar │ └── application.yml │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaosmsservice │ ├── YitaoSmsServiceApplication.java │ └── config │ └── SmsProperties.java ├── yitao-upload-service └── src │ ├── main │ ├── resources │ │ ├── fdfs │ │ │ └── fdfs_client.conf │ │ └── application.yml │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaouploadservice │ │ ├── config │ │ ├── UploadProperties.java │ │ ├── FastdfsClientConfig.java │ │ └── FastClientImporter.java │ │ └── YitaoUploadServiceApplication.java │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaouploadservice │ ├── YitaoSellerServiceApplicationTests.java │ └── Testts.java ├── yitao-mapper ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── mapper │ │ ├── SpecGroupMapper.java │ │ ├── SpecParamMapper.java │ │ ├── PayLogMapper.java │ │ ├── OrderMapper.java │ │ ├── SpuDetailMapper.java │ │ ├── SeckillMapper.java │ │ ├── SpuMapper.java │ │ ├── UserMapper.java │ │ ├── SeckillOrderMapper.java │ │ ├── OrderStatusMapper.java │ │ ├── SkuMapper.java │ │ ├── CategoryMapper.java │ │ ├── OrderDetailMapper.java │ │ ├── StockMapper.java │ │ └── BrandMapper.java └── pom.xml ├── yitao-user-webapi └── src │ ├── main │ ├── resources │ │ └── application.yml │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaouserservicewebapi │ │ └── YitaoUserWebApplication.java │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaouserservice │ └── YitaoUserServiceApplicationTests.java ├── yitao-seller-webapi └── src │ ├── main │ ├── resources │ │ └── application.yml │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaosellerservice │ │ └── YitaoSellerWebApiApplication.java │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaosellerservice │ └── YitaoSellerServiceApplicationTests.java ├── yitao-cart-webapi ├── src │ ├── main │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── gerry │ │ │ └── yitao │ │ │ └── yitaocartservicewebapi │ │ │ ├── YitaoCartWebApplication.java │ │ │ └── config │ │ │ ├── JwtProperties.java │ │ │ └── MvcConfig.java │ └── test │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaocartweb │ │ └── YitaoCartWebApplicationTests.java └── pom.xml ├── yitao-detail-webapi └── src │ ├── main │ ├── resources │ │ └── application.yml │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaodetailservicewebapi │ │ ├── YitaoDetailWebApplication.java │ │ └── controller │ │ └── PageDetailController.java │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaosearchservice │ ├── YitaoDetailServiceApplicationTests.java │ └── PageDetailTests.java ├── yitao-search-webapi └── src │ ├── main │ ├── resources │ │ └── application.yml │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaosearchservicewebapi │ │ ├── YitaoSearchWebApiApplication.java │ │ └── controller │ │ └── GoodsSearchController.java │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaosearchservice │ └── YitaoSellerServiceApplicationTests.java ├── yitao-common └── src │ └── main │ ├── java │ └── com │ │ └── gerry │ │ └── yitao │ │ ├── common │ │ ├── base │ │ │ ├── mapper │ │ │ │ └── BaseMapper.java │ │ │ └── interceptor │ │ │ │ └── properties │ │ │ │ ├── FilterProperties.java │ │ │ │ └── AuthProperties.java │ │ ├── entity │ │ │ ├── JwtConstants.java │ │ │ └── UserInfo.java │ │ ├── util │ │ │ ├── ObjectUtils.java │ │ │ └── DateUtil.java │ │ └── exception │ │ │ ├── VersionValidationException.java │ │ │ ├── ParamValidationException.java │ │ │ ├── PermissionDeniedException.java │ │ │ ├── SystemException.java │ │ │ └── ResourceNotFoundException.java │ │ └── response │ │ ├── Result.java │ │ └── CodeMsg.java │ └── resources │ └── application-common.yml ├── yitao-seckill-webapi ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── gerry │ │ │ │ └── yitao │ │ │ │ └── yitaoseckillwebapi │ │ │ │ ├── entity │ │ │ │ ├── StockParam.java │ │ │ │ └── SecKillParam.java │ │ │ │ ├── ex │ │ │ │ └── StockException.java │ │ │ │ ├── YitaoSeckillWebApplication.java │ │ │ │ ├── limiting │ │ │ │ └── AccessLimiter.java │ │ │ │ └── config │ │ │ │ ├── JwtProperties.java │ │ │ │ └── MvcConfig.java │ │ └── resources │ │ │ └── application.yml │ └── test │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaouserservice │ │ └── YitaoUserServiceApplicationTests.java └── pom.xml ├── yitao-order-webapi ├── src │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaoorderwebapi │ │ ├── YitaoOrderWebApplication.java │ │ ├── config │ │ ├── JwtProperties.java │ │ └── MvcConfig.java │ │ └── controller │ │ └── PayNotifyController.java └── pom.xml ├── yitao-upload-webapi └── src │ ├── main │ ├── resources │ │ └── application.yml │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaouploadwebapi │ │ ├── YitaoUploadWebApiApplication.java │ │ └── controller │ │ └── UploadController.java │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaouploadservice │ └── YitaoSellerServiceApplicationTests.java ├── yitao-seller-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── seller │ │ ├── service │ │ ├── CategoryService.java │ │ ├── SpecService.java │ │ ├── BrandService.java │ │ └── GoodsService.java │ │ ├── dto │ │ └── CartDto.java │ │ └── bo │ │ ├── BrandBo.java │ │ └── SeckillParameter.java └── pom.xml ├── yitao-order-service └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── gerry │ │ │ └── yitao │ │ │ └── yitaoorderservice │ │ │ ├── config │ │ │ ├── IdWorkerProperties.java │ │ │ ├── IdWorkerConfig.java │ │ │ ├── PayConfiguration.java │ │ │ └── WxPayConfig.java │ │ │ └── YitaoOrderServiceApplication.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaocartservice │ └── YitaoCartServiceApplicationTests.java ├── yitao-upload-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── upload │ │ ├── service │ │ └── UploadService.java │ │ └── bo │ │ └── UploadBo.java └── pom.xml ├── yitao-user-service └── src │ ├── test │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaouserservice │ │ └── YitaoUserApplicationTests.java │ └── main │ ├── java │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaouserservice │ │ ├── YitaoUserServiceApplication.java │ │ └── utils │ │ └── CodecUtils.java │ └── resources │ └── application.yml ├── yitao-auth-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── auth │ │ └── service │ │ └── AuthService.java └── pom.xml ├── yitao-cart-service └── src │ ├── test │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaocartservice │ │ └── YitaoCartServiceApplicationTests.java │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaocartservice │ ├── YitaoCartServiceApplication.java │ └── listener │ └── CartListener.java ├── yitao-detail-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── detail │ │ └── service │ │ └── PageDetailService.java └── pom.xml ├── yitao-detail-service └── src │ ├── main │ ├── resources │ │ └── application.yml │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaosearchservice │ │ ├── utils │ │ └── ThreadUtil.java │ │ ├── YitaoDetailServiceApplication.java │ │ └── client │ │ ├── CategoryClient.java │ │ └── BrandClient.java │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaodetailservice │ ├── YitaoPageDetailApplicationTests.java │ └── PageDetailTests.java ├── yitao-search-service └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── gerry │ │ │ └── yitao │ │ │ └── yitaosearchservice │ │ │ ├── respository │ │ │ └── GoodsRepository.java │ │ │ ├── YitaoSearchServiceApplication.java │ │ │ └── client │ │ │ ├── CategoryClient.java │ │ │ └── BrandClient.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaosearchservice │ └── YitaoSearchApplicationTests.java ├── yitao-order-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── order │ │ ├── status │ │ ├── PayStateEnum.java │ │ └── OrderStatusEnum.java │ │ ├── service │ │ ├── PayLogService.java │ │ └── OrderService.java │ │ └── dto │ │ ├── AddressDTO.java │ │ └── OrderDto.java └── pom.xml ├── yitao-seller-service └── src │ ├── test │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaosellerservice │ │ └── YitaoSellerServiceApplicationTests.java │ └── main │ ├── java │ └── com │ │ └── gerry │ │ └── yitao │ │ └── yitaosellerservice │ │ └── YitaoSellerServiceApplication.java │ └── resources │ └── application.yml ├── yitao-auth-webapi └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaoauthservicewebapi │ └── YitaoAuthWebApplication.java ├── yitao-domain ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ ├── domain │ │ ├── Stock.java │ │ ├── Brand.java │ │ ├── Category.java │ │ ├── SeckillOrder.java │ │ ├── SpecGroup.java │ │ ├── SpuDetail.java │ │ ├── PayLog.java │ │ ├── OrderDetail.java │ │ ├── OrderStatus.java │ │ ├── SpecParam.java │ │ ├── Sku.java │ │ ├── User.java │ │ ├── Spu.java │ │ └── SeckillGoods.java │ │ └── entity │ │ └── PageResult.java └── pom.xml ├── yitao-cart-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── cart │ │ ├── entity │ │ └── Cart.java │ │ └── service │ │ └── CartService.java └── pom.xml ├── yitao-auth-service └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaoauthservice │ ├── YitaoAuthServiceApplication.java │ ├── client │ └── UserClient.java │ └── service │ └── AuthServiceImpl.java ├── yitao-seckill-service └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── gerry │ │ │ └── yitao │ │ │ └── yitaoseckillservice │ │ │ ├── YitaoSeckillServiceApplication.java │ │ │ └── utils │ │ │ └── CodecUtils.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── gerry │ └── yitao │ └── yitaouserservice │ └── YitaoSecKillApplicationTests.java ├── yitao-seckill-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── seckill │ │ ├── dto │ │ └── SeckillDTO.java │ │ └── utils │ │ └── ImageUtil.java └── pom.xml ├── yitao-search-interface ├── src │ └── main │ │ └── java │ │ └── com │ │ └── gerry │ │ └── yitao │ │ └── search │ │ ├── service │ │ └── SearchService.java │ │ └── entity │ │ ├── SearchRequest.java │ │ ├── SearchResult.java │ │ └── Goods.java └── pom.xml └── yitao-user-interface ├── src └── main │ └── java │ └── com │ └── gerry │ └── yitao │ └── user │ └── service │ └── UserService.java └── pom.xml /README.md: -------------------------------------------------------------------------------- 1 | # yitao-parent 2 | yitao电商项目 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | target/ -------------------------------------------------------------------------------- /.idea/dataSources/1131dc9c-8e55-43dc-92de-dd9d063ceb74/storage_v2/_src_/schema/orange.Libeww.meta: -------------------------------------------------------------------------------- 1 | #n:orange -------------------------------------------------------------------------------- /.idea/dataSources/95f31c06-3c2e-4312-8005-2c585b6e147e/storage_v2/_src_/schema/orange.Libeww.meta: -------------------------------------------------------------------------------- 1 | #n:orange -------------------------------------------------------------------------------- /.txlcn/application-5555.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/.txlcn/application-5555.mv.db -------------------------------------------------------------------------------- /.txlcn/application-9999.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/.txlcn/application-9999.mv.db -------------------------------------------------------------------------------- /.txlcn/order-service-9999.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/.txlcn/order-service-9999.mv.db -------------------------------------------------------------------------------- /.txlcn/seller-service-5555.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/.txlcn/seller-service-5555.mv.db -------------------------------------------------------------------------------- /txlcn-tm/src/main/resources/static/admin/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/txlcn-tm/src/main/resources/static/admin/favicon.png -------------------------------------------------------------------------------- /yitao-sms-service/src/main/resources/lib/dom4j-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/yitao-sms-service/src/main/resources/lib/dom4j-1.6.1.jar -------------------------------------------------------------------------------- /yitao-sms-service/src/main/resources/lib/commons-codec-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/yitao-sms-service/src/main/resources/lib/commons-codec-1.3.jar -------------------------------------------------------------------------------- /yitao-sms-service/src/main/resources/lib/commons-logging-1.0.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/yitao-sms-service/src/main/resources/lib/commons-logging-1.0.4.jar -------------------------------------------------------------------------------- /yitao-sms-service/src/main/resources/lib/commons-httpclient-3.0-rc4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/yitao-sms-service/src/main/resources/lib/commons-httpclient-3.0-rc4.jar -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/resources/static/admin/assets/8c382430f673ad2237bbf19e5c8a4b00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/txlcn-tm/src/main/resources/static/admin/assets/8c382430f673ad2237bbf19e5c8a4b00.png -------------------------------------------------------------------------------- /yitao-upload-service/src/main/resources/fdfs/fdfs_client.conf: -------------------------------------------------------------------------------- 1 | connect_timeout = 30 2 | network_timeout = 30 3 | charset = UTF-8 4 | http.tracker_http_port = 8888 5 | http.anti_steal_token = no 6 | tracker_server = 192.168.3.201:22122 -------------------------------------------------------------------------------- /.idea/dataSources/1131dc9c-8e55-43dc-92de-dd9d063ceb74/storage_v2/_src_/schema/orange.Libeww.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/.idea/dataSources/1131dc9c-8e55-43dc-92de-dd9d063ceb74/storage_v2/_src_/schema/orange.Libeww.zip -------------------------------------------------------------------------------- /.idea/dataSources/95f31c06-3c2e-4312-8005-2c585b6e147e/storage_v2/_src_/schema/orange.Libeww.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygs12/yitao-parent/HEAD/.idea/dataSources/95f31c06-3c2e-4312-8005-2c585b6e147e/storage_v2/_src_/schema/orange.Libeww.zip -------------------------------------------------------------------------------- /yitao-sms-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | rabbitmq: 3 | virtual-host: / 4 | username: test 5 | password: test 6 | host: 192.168.3.201 7 | server: 8 | port: 7783 9 | 10 | yt: 11 | sms: 12 | accessKeyId: C13907872 13 | accessKeySecret: 3b38c5611c052c7de17d36f840fb4052 -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/SpecGroupMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.SpecGroup; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author bystander 8 | * @date 2018/9/18 9 | */ 10 | public interface SpecGroupMapper extends Mapper { 11 | } 12 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/SpecParamMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.SpecParam; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @author bystander 8 | * @date 2018/9/18 9 | */ 10 | public interface SpecParamMapper extends Mapper { 11 | } 12 | -------------------------------------------------------------------------------- /yitao-user-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10050 3 | dubbo: 4 | application: 5 | name: yitao-user-web 6 | qos-enable: false 7 | registry: 8 | address: zookeeper://192.168.3.201:2181 9 | spring: 10 | jackson: 11 | default-property-inclusion: non_null 12 | profiles: 13 | active: common -------------------------------------------------------------------------------- /yitao-seller-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | application: 3 | name: yitao-seller-webapi 4 | registry: 5 | address: zookeeper://192.168.3.201:2181 6 | # address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 7 | server: 8 | port: 10010 9 | spring: 10 | profiles: 11 | active: common -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /yitao-cart-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10070 3 | dubbo: 4 | application: 5 | name: yitao-cart-web 6 | qos-enable: false 7 | registry: 8 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 9 | spring: 10 | jackson: 11 | default-property-inclusion: non_null 12 | profiles: 13 | active: common -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/PayLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.PayLog; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/5/15 15:05 10 | * @Description: 11 | */ 12 | public interface PayLogMapper extends Mapper { 13 | } -------------------------------------------------------------------------------- /yitao-detail-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10040 3 | dubbo: 4 | application: 5 | name: yitao-detail-web 6 | qos-enable: false 7 | registry: 8 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 9 | spring: 10 | jackson: 11 | default-property-inclusion: non_null 12 | profiles: 13 | active: common -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.Order; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/4/14 15:21 10 | * @Description: 11 | */ 12 | 13 | public interface OrderMapper extends Mapper { 14 | } 15 | -------------------------------------------------------------------------------- /yitao-search-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10030 3 | dubbo: 4 | application: 5 | name: yitao-search-webapi 6 | qos-enable: false 7 | registry: 8 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 9 | spring: 10 | jackson: 11 | default-property-inclusion: non_null 12 | profiles: 13 | active: common -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/base/mapper/BaseMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.common.base.mapper; 2 | 3 | import tk.mybatis.mapper.common.Mapper; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/4/14 14:59 9 | * @Description: 所有Mapper类的基类(只针对单表) 10 | */ 11 | public interface BaseMapper extends Mapper { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/SpuDetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.SpuDetail; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/4/14 15:26 10 | * @Description: 11 | */ 12 | public interface SpuDetailMapper extends Mapper { 13 | } 14 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/entity/JwtConstants.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.common.entity; 2 | 3 | /** 4 | * @ProjectName: yitao-parent 5 | * @Auther: GERRY 6 | * @Date: 2019/5/6 19:00 7 | * @Description: 8 | */ 9 | public class JwtConstants { 10 | public static final String JWT_KEY_ID = "id"; 11 | public static final String JWT_KEY_USER_NAME = "username"; 12 | } 13 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/SeckillMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.SeckillGoods; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/5/15 15:05 10 | * @Description: 秒杀的商品 11 | */ 12 | public interface SeckillMapper extends Mapper { 13 | } 14 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/SpuMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.common.base.mapper.BaseMapper; 4 | import com.gerry.yitao.domain.Spu; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/4/14 15:25 10 | * @Description: 11 | */ 12 | 13 | public interface SpuMapper extends BaseMapper { 14 | } 15 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.common.base.mapper.BaseMapper; 4 | import com.gerry.yitao.domain.User; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/4/14 15:28 10 | * @Description: 11 | */ 12 | 13 | public interface UserMapper extends BaseMapper { 14 | } 15 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/java/com/gerry/yitao/yitaoseckillwebapi/entity/StockParam.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillwebapi.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/5/28 21:19 9 | * @Description: 10 | */ 11 | @Data 12 | public class StockParam { 13 | private Long goodsId; 14 | private Long stock; 15 | } 16 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10090 3 | dubbo: 4 | application: 5 | name: yitao-seckill-web 6 | qos-enable: false 7 | registry: 8 | address: zookeeper://192.168.3.201:2181 9 | spring: 10 | jackson: 11 | default-property-inclusion: non_null 12 | profiles: 13 | active: common 14 | redis: 15 | host: 192.168.3.201 16 | password: redis-01 -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/SeckillOrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.SeckillOrder; 4 | import tk.mybatis.mapper.common.Mapper; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/5/15 15:05 10 | * @Description: 秒杀订单Mapper 11 | */ 12 | public interface SeckillOrderMapper extends Mapper { 13 | } 14 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/java/com/gerry/yitao/yitaoseckillwebapi/entity/SecKillParam.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillwebapi.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/5/27 14:54 9 | * @Description: 10 | */ 11 | @Data 12 | public class SecKillParam { 13 | private Long goodsId; 14 | private Integer verifyCode = 0; 15 | } 16 | -------------------------------------------------------------------------------- /yitao-order-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10080 3 | dubbo: 4 | application: 5 | name: yitao-order-web 6 | qos-enable: false 7 | registry: 8 | address: zookeeper://192.168.3.201:2181 9 | # address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 10 | spring: 11 | jackson: 12 | default-property-inclusion: non_null 13 | profiles: 14 | active: common -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/OrderStatusMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.common.base.mapper.BaseMapper; 4 | import com.gerry.yitao.domain.OrderStatus; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/4/14 15:22 10 | * @Description: 11 | */ 12 | 13 | public interface OrderStatusMapper extends BaseMapper { 14 | } 15 | -------------------------------------------------------------------------------- /yitao-upload-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10020 3 | dubbo: 4 | protocol: 5 | name: hessian 6 | application: 7 | name: yitao-upload-webapi 8 | registry: 9 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 10 | spring: 11 | servlet: 12 | multipart: 13 | max-request-size: 100MB 14 | max-file-size: 100MB 15 | profiles: 16 | active: common -------------------------------------------------------------------------------- /yitao-seller-interface/src/main/java/com/gerry/yitao/seller/service/CategoryService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seller.service; 2 | 3 | import com.gerry.yitao.domain.Category; 4 | 5 | import java.util.List; 6 | 7 | 8 | public interface CategoryService { 9 | 10 | 11 | List queryCategoryByPid(Long pid); 12 | 13 | List queryCategoryByIds(List ids); 14 | 15 | List queryAllByCid3(Long id); 16 | } 17 | -------------------------------------------------------------------------------- /yitao-order-service/src/main/java/com/gerry/yitao/yitaoorderservice/config/IdWorkerProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderservice.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | @Data 7 | @ConfigurationProperties(prefix = "yt.worker") 8 | public class IdWorkerProperties { 9 | 10 | private long workerId;// 当前机器id 11 | 12 | private long dataCenterId;// 序列号 13 | } -------------------------------------------------------------------------------- /yitao-upload-interface/src/main/java/com/gerry/yitao/upload/service/UploadService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.upload.service; 2 | 3 | import com.gerry.yitao.upload.bo.UploadBo; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/4/17 18:12 9 | * @Description: 上传图片的服务接口 10 | */ 11 | public interface UploadService { 12 | String uploadImage(UploadBo uploadBo); 13 | Integer deleteImage(String imagePath); 14 | } 15 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/SkuMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.Sku; 4 | import tk.mybatis.mapper.additional.idlist.IdListMapper; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | /** 8 | * @ProjectName: yitao-parent 9 | * @Auther: GERRY 10 | * @Date: 2019/4/14 15:24 11 | * @Description: 12 | */ 13 | 14 | public interface SkuMapper extends Mapper, IdListMapper { 15 | } 16 | -------------------------------------------------------------------------------- /yitao-user-service/src/test/java/com/gerry/yitao/yitaouserservice/YitaoUserApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouserservice; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | import org.springframework.test.context.junit4.SpringRunner; 6 | 7 | @RunWith(SpringRunner.class) 8 | @SpringBootTest(classes = YitaoUserServiceApplication.class) 9 | public class YitaoUserApplicationTests { 10 | } 11 | -------------------------------------------------------------------------------- /yitao-auth-interface/src/main/java/com/gerry/yitao/auth/service/AuthService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.auth.service; 2 | 3 | /** 4 | * @ProjectName: yitao-parent 5 | * @Auther: GERRY 6 | * @Date: 2019/5/6 19:02 7 | * @Description: 8 | */ 9 | public interface AuthService { 10 | /** 11 | * 用户登录的方法 12 | * @param username 13 | * @param password 14 | * @return 15 | */ 16 | String login(String username, String password); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /yitao-cart-service/src/test/java/com/gerry/yitao/yitaocartservice/YitaoCartServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartservice; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | import org.springframework.test.context.junit4.SpringRunner; 6 | 7 | @RunWith(SpringRunner.class) 8 | @SpringBootTest(classes = YitaoCartServiceApplication.class) 9 | public class YitaoCartServiceApplicationTests { 10 | } 11 | -------------------------------------------------------------------------------- /yitao-cart-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | redis: 3 | host: 192.168.3.172 4 | password: redis-01 5 | rabbitmq: 6 | virtual-host: / 7 | username: test 8 | password: test 9 | host: 192.168.3.201 10 | dubbo: 11 | application: 12 | name: yitao-cart-service 13 | protocol: 14 | port: 20887 15 | registry: 16 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 17 | server: 18 | port: 7782 -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/CategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.Category; 4 | import tk.mybatis.mapper.additional.idlist.IdListMapper; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | /** 8 | * @ProjectName: yitao-parent 9 | * @Auther: GERRY 10 | * @Date: 2019/4/14 15:19 11 | * @Description: 12 | */ 13 | 14 | public interface CategoryMapper extends Mapper, IdListMapper { 15 | } 16 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/OrderDetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.OrderDetail; 4 | import tk.mybatis.mapper.additional.insert.InsertListMapper; 5 | import tk.mybatis.mapper.common.Mapper; 6 | 7 | /** 8 | * @ProjectName: yitao-parent 9 | * @Auther: GERRY 10 | * @Date: 2019/4/14 15:21 11 | * @Description: 12 | */ 13 | public interface OrderDetailMapper extends Mapper, InsertListMapper { 14 | } 15 | -------------------------------------------------------------------------------- /yitao-sms-service/src/main/java/com/gerry/yitao/yitaosmsservice/YitaoSmsServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosmsservice; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class YitaoSmsServiceApplication { 8 | 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(YitaoSmsServiceApplication.class); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /yitao-upload-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | application: 3 | name: yitao-upload-service 4 | protocol: 5 | port: 20881 6 | payload: 104857600 7 | name: hessian 8 | registry: 9 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 10 | 11 | yitao: 12 | upload: 13 | allowTypes: 14 | - image/jpeg 15 | - image/png 16 | - image/bmp 17 | baseUrl: http://yitao.image.com/ 18 | server: 19 | port: 7777 20 | -------------------------------------------------------------------------------- /yitao-common/src/main/resources/application-common.yml: -------------------------------------------------------------------------------- 1 | yt: 2 | jwt: 3 | pubKeyPath: D:/vip/keys/gerry/id_rsa.pub # 公钥地址 4 | cookieName: YT_TOKEN # cookie的名称 5 | filter: 6 | allowPaths: 7 | - /api/auth # 授权中心 8 | - /api/search # 商品搜索 9 | - /api/user/register #注册 10 | - /api/user/check # 检验数据类型 11 | - /api/user/send # 发送验证码 12 | - /api/user/query # 用户查询 13 | - /api/item # 商品页 14 | - /item # 商品详情 15 | - /api/upload # 图片服务器 16 | - /api/order 17 | - /error -------------------------------------------------------------------------------- /yitao-detail-interface/src/main/java/com/gerry/yitao/detail/service/PageDetailService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.detail.service; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/4/29 18:11 9 | * @Description: 10 | */ 11 | public interface PageDetailService { 12 | Map loadModel(Long spuId); 13 | void createHtml(Long spuId); 14 | void asyncExecute(Long spuId); 15 | void deleteHtml(Long id); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /yitao-detail-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | rabbitmq: 3 | virtual-host: / 4 | username: test 5 | password: test 6 | host: 192.168.3.201 7 | dubbo: 8 | application: 9 | name: yitao-detail-service 10 | protocol: 11 | port: 20884 12 | registry: 13 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 14 | server: 15 | port: 7780 16 | # 调用外部服务接口的前缀 17 | client.url: http://api.yitao.com/ 18 | yt.page.path: D:/vip/yitao/pages -------------------------------------------------------------------------------- /yitao-search-service/src/main/java/com/gerry/yitao/yitaosearchservice/respository/GoodsRepository.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice.respository; 2 | 3 | import com.gerry.yitao.search.entity.Goods; 4 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/4/23 18:23 10 | * @Description: 11 | */ 12 | public interface GoodsRepository extends ElasticsearchRepository { 13 | } 14 | -------------------------------------------------------------------------------- /yitao-order-interface/src/main/java/com/gerry/yitao/order/status/PayStateEnum.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.order.status; 2 | 3 | /** 4 | * @ProjectName: yitao-parent 5 | * @Auther: GERRY 6 | * @Date: 2019/5/14 19:38 7 | * @Description: 支付状态枚举 8 | */ 9 | public enum PayStateEnum { 10 | 11 | NOT_PAY(0), SUCCESS(1), FAIL(2); 12 | 13 | int value; 14 | 15 | PayStateEnum(int value) { 16 | this.value = value; 17 | } 18 | 19 | public int getValue() { 20 | return value; 21 | } 22 | } -------------------------------------------------------------------------------- /yitao-order-interface/src/main/java/com/gerry/yitao/order/service/PayLogService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.order.service; 2 | 3 | import com.gerry.yitao.common.entity.UserInfo; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/5/14 19:42 9 | * @Description: 支付日志接口 10 | */ 11 | public interface PayLogService { 12 | /** 13 | * 添加支付日志 14 | * @param orderId 15 | * @param actualPay 16 | */ 17 | void createPayLog(Long orderId, Double actualPay, UserInfo user); 18 | } 19 | -------------------------------------------------------------------------------- /yitao-upload-interface/src/main/java/com/gerry/yitao/upload/bo/UploadBo.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.upload.bo; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @ProjectName: yitao-parent 9 | * @Auther: GERRY 10 | * @Date: 2019/4/18 21:15 11 | * @Description: 12 | */ 13 | @Data 14 | public class UploadBo implements Serializable { 15 | private static final long serialVersionUID = 1L; 16 | private byte[] bytes; 17 | private String contentType; 18 | private String fileName; 19 | } 20 | -------------------------------------------------------------------------------- /yitao-search-webapi/src/test/java/com/gerry/yitao/yitaosearchservice/YitaoSellerServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class YitaoSellerServiceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yitao-seller-service/src/test/java/com/gerry/yitao/yitaosellerservice/YitaoSellerServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosellerservice; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class YitaoSellerServiceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yitao-seller-webapi/src/test/java/com/gerry/yitao/yitaosellerservice/YitaoSellerServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosellerservice; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class YitaoSellerServiceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yitao-upload-webapi/src/test/java/com/gerry/yitao/yitaouploadservice/YitaoSellerServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadservice; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class YitaoSellerServiceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yitao-order-service/src/test/java/com/gerry/yitao/yitaocartservice/YitaoCartServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartservice; 2 | 3 | import com.gerry.yitao.yitaoorderservice.YitaoOrderServiceApplication; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest(classes = YitaoOrderServiceApplication.class) 10 | public class YitaoCartServiceApplicationTests { 11 | } 12 | -------------------------------------------------------------------------------- /yitao-search-service/src/test/java/com/gerry/yitao/yitaosearchservice/YitaoSearchApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice; 2 | 3 | import com.gerry.yitao.yitaosearchservice.YitaoSearchServiceApplication; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest(classes = YitaoSearchServiceApplication.class) 10 | public class YitaoSearchApplicationTests { 11 | } 12 | -------------------------------------------------------------------------------- /yitao-detail-service/src/test/java/com/gerry/yitao/yitaodetailservice/YitaoPageDetailApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaodetailservice; 2 | 3 | import com.gerry.yitao.yitaosearchservice.YitaoDetailServiceApplication; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest(classes = YitaoDetailServiceApplication.class) 10 | public class YitaoPageDetailApplicationTests { 11 | } 12 | -------------------------------------------------------------------------------- /yitao-sms-service/src/main/java/com/gerry/yitao/yitaosmsservice/config/SmsProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosmsservice.config; 2 | 3 | /** 4 | * @ProjectName: yitao-parent 5 | * @Auther: GERRY 6 | * @Date: 2019/5/6 18:21 7 | * @Description: 8 | */ 9 | 10 | import lombok.Data; 11 | import org.springframework.boot.context.properties.ConfigurationProperties; 12 | @ConfigurationProperties(prefix = "yt.sms") 13 | @Data 14 | public class SmsProperties { 15 | private String accessKeyId; 16 | private String accessKeySecret; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/entity/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.common.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @ProjectName: yitao-parent 11 | * @Auther: GERRY 12 | * @Date: 2019/5/6 19:00 13 | * @Description: 14 | */ 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | public class UserInfo implements Serializable { 19 | private Long id; 20 | private String username; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/base/interceptor/properties/FilterProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.common.base.interceptor.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/8 11:55 12 | * @Description: 13 | */ 14 | @Data 15 | @ConfigurationProperties(prefix = "yt.filter") 16 | public class FilterProperties { 17 | private List allowPaths; 18 | } -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /yitao-seller-interface/src/main/java/com/gerry/yitao/seller/dto/CartDto.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seller.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @ProjectName: yitao-parent 11 | * @Auther: GERRY 12 | * @Date: 2019/4/16 19:30 13 | * @Description: 14 | */ 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | public class CartDto implements Serializable { 19 | private Long skuId; //商品skuId 20 | private Integer num; //购买数量 21 | } 22 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/config/EnableTransactionManagerServer.java: -------------------------------------------------------------------------------- 1 | package com.codingapi.txlcn.tm.config; 2 | 3 | import com.codingapi.txlcn.tm.TMAutoConfiguration; 4 | import org.springframework.context.annotation.Import; 5 | 6 | import java.lang.annotation.*; 7 | 8 | /** 9 | * Description: 10 | * Date: 19-2-15 下午5:25 11 | * 12 | * @author ujued 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target(ElementType.TYPE) 16 | @Documented 17 | @Import(value = {TMAutoConfiguration.class}) 18 | public @interface EnableTransactionManagerServer { 19 | } 20 | -------------------------------------------------------------------------------- /yitao-upload-service/src/test/java/com/gerry/yitao/yitaouploadservice/YitaoSellerServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadservice; 2 | 3 | import com.gerry.yitao.upload.service.UploadService; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest 11 | public class YitaoSellerServiceApplicationTests { 12 | 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=TransactionManager 2 | server.port=7970 3 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 4 | spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tx-manager?characterEncoding=UTF-8&useSSL=false 5 | spring.datasource.username=root 6 | spring.datasource.password=123 7 | spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect 8 | spring.jpa.hibernate.ddl-auto=update 9 | spring.redis.host=192.168.3.201 10 | spring.redis.password=redis-01 11 | spring.redis.port=6379 12 | tx-lcn.logger.enabled=true -------------------------------------------------------------------------------- /yitao-search-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | data: 3 | elasticsearch: 4 | cluster-name: elasticsearch 5 | cluster-nodes: 192.168.3.201:9300 6 | rabbitmq: 7 | virtual-host: / 8 | username: test 9 | password: test 10 | host: 192.168.3.201 11 | dubbo: 12 | application: 13 | name: yitao-search-service 14 | protocol: 15 | port: 20882 16 | registry: 17 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 18 | server: 19 | port: 7778 20 | # 调用外部服务接口的前缀 21 | client.url: http://api.yitao.com/ -------------------------------------------------------------------------------- /yitao-auth-webapi/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 10060 3 | dubbo: 4 | application: 5 | name: yitao-auth-web 6 | qos-enable: false 7 | registry: 8 | address: zookeeper://192.168.3.201:2181 9 | spring: 10 | jackson: 11 | default-property-inclusion: non_null 12 | profiles: 13 | active: common 14 | yt: 15 | jwt: 16 | secret: yt@Login(Auth}*^778)&gerry%f35YUE2 # 登录校验的密钥 17 | pubKeyPath: D:/vip/keys/gerry/id_rsa.pub # 公钥地址 18 | priKeyPath: D:/vip/keys/gerry/id_rsa # 私钥地址 19 | expire: 30 # 过期时间,单位分钟 20 | cookieName: YT_TOKEN 21 | cookieMaxAge: 1800 -------------------------------------------------------------------------------- /yitao-detail-service/src/main/java/com/gerry/yitao/yitaosearchservice/utils/ThreadUtil.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice.utils; 2 | 3 | import java.util.concurrent.ExecutorService; 4 | import java.util.concurrent.Executors; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/4/29 23:42 10 | * @Description: 11 | */ 12 | public class ThreadUtil { 13 | private static final ExecutorService executorService = Executors.newFixedThreadPool(10); 14 | 15 | public static void execute(Runnable runnable) { 16 | executorService.submit(runnable); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /yitao-seller-webapi/src/main/java/com/gerry/yitao/yitaosellerservice/YitaoSellerWebApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosellerservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication(scanBasePackages = "com.gerry.yitao") 8 | @EnableDubbo 9 | public class YitaoSellerWebApiApplication { 10 | 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(YitaoSellerWebApiApplication.class); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /yitao-cart-webapi/src/test/java/com/gerry/yitao/yitaocartweb/YitaoCartWebApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartweb; 2 | 3 | import com.gerry.yitao.yitaocartservicewebapi.YitaoCartWebApplication; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest(classes = {YitaoCartWebApplication.class}) 11 | public class YitaoCartWebApplicationTests { 12 | 13 | 14 | 15 | @Test 16 | public void contextLoads() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/Stock.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @ProjectName: yitao-parent 11 | * @Auther: GERRY 12 | * @Date: 2019/4/15 21:41 13 | * @Description: 14 | */ 15 | @Table(name = "tb_stock") 16 | @Data 17 | public class Stock implements Serializable { 18 | 19 | @Id 20 | private Long skuId; 21 | 22 | private Integer seckillStock;// 秒杀可用库存 23 | 24 | private Integer seckillTotal;// 已秒杀数量 25 | 26 | private Integer stock;// 正常库存 27 | } -------------------------------------------------------------------------------- /yitao-user-webapi/src/test/java/com/gerry/yitao/yitaouserservice/YitaoUserServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouserservice; 2 | 3 | import com.gerry.yitao.yitaouserservicewebapi.YitaoUserWebApplication; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest(classes = {YitaoUserWebApplication.class}) 11 | public class YitaoUserServiceApplicationTests { 12 | 13 | 14 | 15 | @Test 16 | public void contextLoads() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/test/java/com/gerry/yitao/yitaouserservice/YitaoUserServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouserservice; 2 | 3 | import com.gerry.yitao.yitaoseckillwebapi.YitaoSeckillWebApplication; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest(classes = {YitaoSeckillWebApplication.class}) 11 | public class YitaoUserServiceApplicationTests { 12 | 13 | 14 | 15 | @Test 16 | public void contextLoads() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /yitao-upload-service/src/main/java/com/gerry/yitao/yitaouploadservice/config/UploadProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadservice.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.List; 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/4/17 18:19 12 | * @Description: 13 | */ 14 | @Data 15 | @Component 16 | @ConfigurationProperties(prefix = "yitao.upload") 17 | public class UploadProperties { 18 | 19 | private String baseUrl; 20 | private List allowTypes; 21 | } 22 | -------------------------------------------------------------------------------- /yitao-detail-webapi/src/test/java/com/gerry/yitao/yitaosearchservice/YitaoDetailServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice; 2 | 3 | import com.gerry.yitao.yitaodetailservicewebapi.YitaoDetailWebApplication; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | @RunWith(SpringRunner.class) 10 | @SpringBootTest(classes = {YitaoDetailWebApplication.class}) 11 | public class YitaoDetailServiceApplicationTests { 12 | 13 | 14 | 15 | @Test 16 | public void contextLoads() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/resources/static/admin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | TxManager系统后台 9 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /yitao-upload-service/src/main/java/com/gerry/yitao/yitaouploadservice/config/FastdfsClientConfig.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadservice.config; 2 | 3 | import com.gerry.yitao.common.upload.FastdfsClient; 4 | import org.springframework.boot.SpringBootConfiguration; 5 | import org.springframework.context.annotation.Bean; 6 | 7 | /** 8 | * @ProjectName: yitao-parent 9 | * @Auther: GERRY 10 | * @Date: 2019/4/20 02:04 11 | * @Description: 12 | */ 13 | @SpringBootConfiguration 14 | public class FastdfsClientConfig { 15 | @Bean 16 | public FastdfsClient fastdfsClient() { 17 | return new FastdfsClient("classpath:fdfs/fdfs_client.conf"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/Brand.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | import tk.mybatis.mapper.annotation.KeySql; 5 | 6 | import javax.persistence.Id; 7 | import javax.persistence.Table; 8 | import java.io.Serializable; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/15 21:41 14 | * @Description: 15 | */ 16 | @Table(name = "tb_brand") 17 | @Data 18 | public class Brand implements Serializable { 19 | 20 | @Id 21 | @KeySql(useGeneratedKeys = true) 22 | private Long id; 23 | private String name; 24 | private String image; 25 | private Character letter; 26 | } 27 | -------------------------------------------------------------------------------- /yitao-cart-interface/src/main/java/com/gerry/yitao/cart/entity/Cart.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.cart.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @ProjectName: yitao-parent 9 | * @Auther: GERRY 10 | * @Date: 2019/5/3 19:12 11 | * @Description: 12 | */ 13 | @Data 14 | public class Cart implements Serializable { 15 | 16 | //商品id 17 | private Long skuId; 18 | 19 | //商品标题 20 | private String title; 21 | 22 | //购买数量 23 | private Integer num; 24 | 25 | //商品图片 26 | private String image; 27 | 28 | //加入购物车时商品的价格 29 | private Long price; 30 | 31 | //商品的规格参数 32 | private String ownSpec; 33 | } 34 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/java/com/gerry/yitao/yitaoseckillwebapi/ex/StockException.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillwebapi.ex; 2 | 3 | import com.gerry.yitao.yitaoseckillwebapi.entity.StockParam; 4 | import lombok.Data; 5 | 6 | /** 7 | * @ProjectName: yitao-parent 8 | * @Auther: GERRY 9 | * @Date: 2019/5/28 21:17 10 | * @Description: 自定义异常处理类 11 | */ 12 | @Data 13 | public class StockException extends RuntimeException { 14 | private StockParam param; 15 | 16 | public StockException() { 17 | 18 | } 19 | 20 | public StockException(StockParam param, String message) { 21 | super(message); 22 | this.param = param; 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /yitao-auth-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | rabbitmq: 3 | virtual-host: / 4 | username: test 5 | password: test 6 | host: 192.168.3.201 7 | dubbo: 8 | application: 9 | name: yitao-auth-service 10 | protocol: 11 | port: 20885 12 | registry: 13 | address: zookeeper://192.168.3.201:2181 14 | server: 15 | port: 7781 16 | yt: 17 | jwt: 18 | secret: yt@Login(Auth}*^778)&gerry%f35YUE2 # 登录校验的密钥 19 | pubKeyPath: D:/vip/keys/gerry/id_rsa.pub # 公钥地址 20 | priKeyPath: D:/vip/keys/gerry/id_rsa # 私钥地址 21 | expire: 30 # 过期时间,单位分钟 22 | cookieName: YT_TOKEN 23 | cookieMaxAge: 1800 24 | # 调用外部服务接口的前缀 25 | client.url: http://api.yitao.com/ -------------------------------------------------------------------------------- /yitao-order-interface/src/main/java/com/gerry/yitao/order/dto/AddressDTO.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.order.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @ProjectName: yitao-parent 9 | * @Auther: GERRY 10 | * @Date: 2019/5/14 19:33 11 | * @Description: 12 | */ 13 | @Data 14 | public class AddressDTO implements Serializable { 15 | private Long id; 16 | private String name;// 收件人姓名 17 | private String phone;// 电话 18 | private String state;// 省份 19 | private String city;// 城市 20 | private String district;// 区 21 | private String address;// 街道地址 22 | private String zipCode;// 邮编 23 | private Boolean isDefault; 24 | } 25 | -------------------------------------------------------------------------------- /yitao-order-interface/src/main/java/com/gerry/yitao/order/dto/OrderDto.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.order.dto; 2 | 3 | import com.gerry.yitao.seller.dto.CartDto; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/5/14 19:33 15 | * @Description: 16 | */ 17 | @Data 18 | @AllArgsConstructor 19 | @NoArgsConstructor 20 | public class OrderDto implements Serializable { 21 | private Long addressId; // 收获人地址id 22 | private Integer paymentType;// 付款类型 23 | private List carts;// 订单详情 24 | } -------------------------------------------------------------------------------- /yitao-user-service/src/main/java/com/gerry/yitao/yitaouserservice/YitaoUserServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouserservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import tk.mybatis.spring.annotation.MapperScan; 7 | 8 | @SpringBootApplication 9 | @EnableDubbo 10 | @MapperScan(basePackages = "com.gerry.yitao.mapper") 11 | public class YitaoUserServiceApplication { 12 | 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(YitaoUserServiceApplication.class); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /yitao-cart-service/src/main/java/com/gerry/yitao/yitaocartservice/YitaoCartServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) 9 | @EnableDubbo 10 | public class YitaoCartServiceApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoCartServiceApplication.class); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/Category.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | import tk.mybatis.mapper.annotation.KeySql; 5 | 6 | import javax.persistence.Id; 7 | import javax.persistence.Table; 8 | import java.io.Serializable; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/15 21:41 14 | * @Description: 15 | */ 16 | @Data 17 | @Table(name = "tb_category") 18 | public class Category implements Serializable { 19 | 20 | @Id 21 | @KeySql(useGeneratedKeys = true) 22 | private Long id; 23 | private String name; 24 | private Long parentId; 25 | private Boolean isParent; 26 | private Integer sort; 27 | } 28 | -------------------------------------------------------------------------------- /yitao-seckill-service/src/main/java/com/gerry/yitao/yitaoseckillservice/YitaoSeckillServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import tk.mybatis.spring.annotation.MapperScan; 7 | 8 | @SpringBootApplication 9 | @EnableDubbo 10 | @MapperScan(basePackages = "com.gerry.yitao.mapper") 11 | public class YitaoSeckillServiceApplication { 12 | 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(YitaoSeckillServiceApplication.class); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /yitao-detail-service/src/main/java/com/gerry/yitao/yitaosearchservice/YitaoDetailServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) 9 | @EnableDubbo 10 | public class YitaoDetailServiceApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoDetailServiceApplication.class); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /yitao-search-service/src/main/java/com/gerry/yitao/yitaosearchservice/YitaoSearchServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) 9 | @EnableDubbo 10 | public class YitaoSearchServiceApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoSearchServiceApplication.class); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /yitao-upload-service/src/main/java/com/gerry/yitao/yitaouploadservice/YitaoUploadServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) 9 | @EnableDubbo 10 | public class YitaoUploadServiceApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoUploadServiceApplication.class); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /yitao-upload-service/src/main/java/com/gerry/yitao/yitaouploadservice/config/FastClientImporter.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadservice.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.context.annotation.EnableMBeanExport; 5 | import org.springframework.context.annotation.Import; 6 | import org.springframework.jmx.support.RegistrationPolicy; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/4/17 18:19 12 | * @Description: 13 | */ 14 | @Configuration 15 | @Import(FastdfsClientConfig.class) 16 | // 解决jmx重复注册bean的问题 17 | @EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING) 18 | public class FastClientImporter { 19 | } -------------------------------------------------------------------------------- /yitao-order-service/src/main/java/com/gerry/yitao/yitaoorderservice/YitaoOrderServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import tk.mybatis.spring.annotation.MapperScan; 7 | 8 | @SpringBootApplication 9 | @EnableDubbo 10 | @MapperScan(basePackages = "com.gerry.yitao.mapper") 11 | //@EnableDistributedTransaction 12 | public class YitaoOrderServiceApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(YitaoOrderServiceApplication.class); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /yitao-order-webapi/src/main/java/com/gerry/yitao/yitaoorderwebapi/YitaoOrderWebApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderwebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages = {"com.gerry.yitao"}) 9 | @EnableDubbo 10 | public class YitaoOrderWebApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoOrderWebApplication.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /yitao-cart-webapi/src/main/java/com/gerry/yitao/yitaocartservicewebapi/YitaoCartWebApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartservicewebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages = {"com.gerry.yitao"}) 9 | @EnableDubbo 10 | public class YitaoCartWebApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoCartWebApplication.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /yitao-seller-service/src/main/java/com/gerry/yitao/yitaosellerservice/YitaoSellerServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosellerservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import tk.mybatis.spring.annotation.MapperScan; 7 | 8 | @SpringBootApplication 9 | @EnableDubbo 10 | @MapperScan(basePackages = "com.gerry.yitao.mapper") 11 | // @EnableDistributedTransaction 12 | public class YitaoSellerServiceApplication { 13 | 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(YitaoSellerServiceApplication.class); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /yitao-upload-webapi/src/main/java/com/gerry/yitao/yitaouploadwebapi/YitaoUploadWebApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadwebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages = {"com.gerry.yitao"}) 9 | @EnableDubbo 10 | public class YitaoUploadWebApiApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoUploadWebApiApplication.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /yitao-detail-webapi/src/main/java/com/gerry/yitao/yitaodetailservicewebapi/YitaoDetailWebApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaodetailservicewebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages = {"com.gerry.yitao"}) 9 | @EnableDubbo 10 | public class YitaoDetailWebApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoDetailWebApplication.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /yitao-search-webapi/src/main/java/com/gerry/yitao/yitaosearchservicewebapi/YitaoSearchWebApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservicewebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages = {"com.gerry.yitao"}) 9 | @EnableDubbo 10 | public class YitaoSearchWebApiApplication { 11 | 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(YitaoSearchWebApiApplication.class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/SeckillOrder.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.GeneratedValue; 6 | import javax.persistence.GenerationType; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | import java.io.Serializable; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/4/15 21:41 15 | * @Description: 秒杀订单 16 | */ 17 | @Table(name = "tb_seckill_order") 18 | @Data 19 | public class SeckillOrder implements Serializable { 20 | 21 | @Id 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) 23 | private Long id; 24 | 25 | private Long userId; 26 | 27 | private Long skuId; 28 | 29 | private Long orderId; 30 | } 31 | -------------------------------------------------------------------------------- /yitao-user-webapi/src/main/java/com/gerry/yitao/yitaouserservicewebapi/YitaoUserWebApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouserservicewebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication( 9 | exclude = DataSourceAutoConfiguration.class, 10 | scanBasePackages = {"com.gerry.yitao"}) 11 | @EnableDubbo 12 | public class YitaoUserWebApplication { 13 | 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(YitaoUserWebApplication.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /yitao-seckill-interface/src/main/java/com/gerry/yitao/seckill/dto/SeckillDTO.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seckill.dto; 2 | 3 | import com.gerry.yitao.common.entity.UserInfo; 4 | import com.gerry.yitao.domain.SeckillGoods; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/5/23 18:38 15 | * @Description: 秒杀信息传输类 16 | */ 17 | @Data 18 | @AllArgsConstructor 19 | @NoArgsConstructor 20 | public class SeckillDTO implements Serializable { 21 | /** 22 | * 用户信息 23 | */ 24 | private UserInfo userInfo; 25 | 26 | /** 27 | * 秒杀商品 28 | */ 29 | private SeckillGoods seckillGoods; 30 | } 31 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/java/com/gerry/yitao/yitaoseckillwebapi/YitaoSeckillWebApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillwebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | 8 | @SpringBootApplication( 9 | exclude = DataSourceAutoConfiguration.class, 10 | scanBasePackages = {"com.gerry.yitao"}) 11 | @EnableDubbo 12 | public class YitaoSeckillWebApplication { 13 | 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(YitaoSeckillWebApplication.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /yitao-seller-interface/src/main/java/com/gerry/yitao/seller/bo/BrandBo.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seller.bo; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/16 19:29 14 | * @Description: 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | // BO 业务对象=> 把请求的数据封装为BO从传入业务层(输入) 20 | // DTO (输入=参数,输出=返回结果) 21 | // VO (封装页面渲染的数据(来源不同实体情况可以选择定义)) 22 | public class BrandBo implements Serializable { 23 | private Long id; 24 | private String name; 25 | private String image; 26 | private List cids; 27 | private Character letter; 28 | } 29 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/SpecGroup.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | import tk.mybatis.mapper.annotation.KeySql; 5 | 6 | import javax.persistence.Id; 7 | import javax.persistence.Table; 8 | import javax.persistence.Transient; 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | /** 13 | * @ProjectName: yitao-parent 14 | * @Auther: GERRY 15 | * @Date: 2019/4/15 21:41 16 | * @Description: 17 | */ 18 | @Data 19 | @Table(name = "tb_spec_group") 20 | public class SpecGroup implements Serializable { 21 | 22 | @Id 23 | @KeySql(useGeneratedKeys = true) 24 | private Long id; 25 | private Long cid; 26 | private String name; 27 | 28 | @Transient 29 | private List params; 30 | } 31 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/SpuDetail.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @ProjectName: yitao-parent 11 | * @Auther: GERRY 12 | * @Date: 2019/4/15 21:41 13 | * @Description: 14 | */ 15 | @Table(name = "tb_spu_detail") 16 | @Data 17 | public class SpuDetail implements Serializable { 18 | 19 | @Id 20 | private Long spuId; 21 | 22 | //商品描述 23 | private String description; 24 | 25 | //通用规格参数数据 26 | private String genericSpec; 27 | 28 | //特殊规格参数数据 29 | private String specialSpec; 30 | 31 | //包装清单 32 | private String packingList; 33 | 34 | //售后服务 35 | private String afterService; 36 | } 37 | -------------------------------------------------------------------------------- /yitao-detail-webapi/src/test/java/com/gerry/yitao/yitaosearchservice/PageDetailTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.gerry.yitao.detail.service.PageDetailService; 5 | import org.junit.Test; 6 | 7 | import javax.annotation.Resource; 8 | import java.util.Map; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/29 20:46 14 | * @Description: 15 | */ 16 | public class PageDetailTests extends YitaoDetailServiceApplicationTests { 17 | 18 | @Resource 19 | private PageDetailService pageDetailService; 20 | 21 | @Test 22 | public void test1() { 23 | Map map = pageDetailService.loadModel(51L); 24 | System.out.println(JSON.toJSONString(map,true)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /yitao-seller-interface/src/main/java/com/gerry/yitao/seller/bo/SeckillParameter.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seller.bo; 2 | 3 | 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/4/16 19:29 12 | * @Description: 秒杀的参数类 13 | */ 14 | @Data 15 | 16 | public class SeckillParameter implements Serializable { 17 | 18 | /** 19 | * 要秒杀的sku id 20 | */ 21 | private Long id; 22 | 23 | /** 24 | * 秒杀开始时间 25 | */ 26 | private String startTime; 27 | 28 | /** 29 | * 秒杀结束时间 30 | */ 31 | private String endTime; 32 | 33 | /** 34 | * 参与秒杀的商品数量 35 | */ 36 | private Integer count; 37 | 38 | /** 39 | * 折扣 40 | */ 41 | private double discount; 42 | } 43 | -------------------------------------------------------------------------------- /yitao-order-interface/src/main/java/com/gerry/yitao/order/status/OrderStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.order.status; 2 | 3 | /** 4 | * @ProjectName: yitao-parent 5 | * @Auther: GERRY 6 | * @Date: 2019/5/14 19:37 7 | * @Description: 定义状态枚举 8 | */ 9 | public enum OrderStatusEnum { 10 | 11 | INIT(1, "初始化,未付款"), 12 | PAY_UP(2, "已付款,未发货"), 13 | DELIVERED(3, "已发货,未确认"), 14 | CONFIRMED(4, "已确认,未评价"), 15 | CLOSED(5, "已关闭"), 16 | RATED(6, "已评价,交易结束"); 17 | 18 | private Integer code; 19 | private String msg; 20 | 21 | OrderStatusEnum(Integer code, String msg) { 22 | this.code = code; 23 | this.msg = msg; 24 | } 25 | 26 | public Integer value(){ 27 | return this.code; 28 | } 29 | 30 | public String msg(){ 31 | return msg; 32 | } 33 | } -------------------------------------------------------------------------------- /yitao-order-service/src/main/java/com/gerry/yitao/yitaoorderservice/config/IdWorkerConfig.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderservice.config; 2 | 3 | import com.gerry.yitao.common.util.IdWorker; 4 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/15 15:29 12 | * @Description: IdWorker配置类 13 | */ 14 | @Configuration 15 | @EnableConfigurationProperties(IdWorkerProperties.class) 16 | public class IdWorkerConfig { 17 | 18 | @Bean 19 | public IdWorker idWorker(IdWorkerProperties prop) { 20 | return new IdWorker(prop.getWorkerId(), prop.getDataCenterId()); 21 | } 22 | } -------------------------------------------------------------------------------- /yitao-seller-interface/src/main/java/com/gerry/yitao/seller/service/SpecService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seller.service; 2 | 3 | import com.gerry.yitao.domain.SpecGroup; 4 | import com.gerry.yitao.domain.SpecParam; 5 | 6 | import java.util.List; 7 | 8 | public interface SpecService { 9 | 10 | List querySpecGroupByCid(Long cid); 11 | 12 | void saveSpecGroup(SpecGroup specGroup); 13 | 14 | void deleteSpecGroup(Long id); 15 | 16 | void updateSpecGroup(SpecGroup specGroup); 17 | 18 | List querySpecParams(Long gid, Long cid, Boolean searching, Boolean generic); 19 | 20 | void saveSpecParam(SpecParam specParam); 21 | 22 | void updateSpecParam(SpecParam specParam); 23 | 24 | void deleteSpecParam(Long id); 25 | 26 | List querySpecsByCid(Long cid); 27 | } 28 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/entity/PageResult.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/14 17:32 14 | * @Description: 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | public class PageResult implements Serializable { 20 | private static final long serialVersionUID = 4612105649493688532L; 21 | private long total; // 总记录数 22 | private Integer totalPages; //总页数 23 | private List rows; // 每页显示的数据集合 24 | 25 | public PageResult(long total, List rows) { 26 | this.total = total; 27 | this.rows = rows; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/StockMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.Stock; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.apache.ibatis.annotations.Update; 6 | import tk.mybatis.mapper.additional.idlist.IdListMapper; 7 | import tk.mybatis.mapper.additional.insert.InsertListMapper; 8 | import tk.mybatis.mapper.common.Mapper; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/14 15:27 14 | * @Description: 15 | */ 16 | 17 | public interface StockMapper extends Mapper, IdListMapper,InsertListMapper { 18 | 19 | @Update("update tb_stock set stock = stock - #{num} where sku_id = #{skuId} and stock >= #{num}") 20 | int decreaseStock(@Param("skuId") Long skuId, @Param("num") Integer num); 21 | } 22 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/PayLog.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/15 21:41 14 | * @Description: 15 | */ 16 | @Data 17 | @Table(name = "tb_pay_log") 18 | public class PayLog implements Serializable { 19 | @Id 20 | private Long orderId; 21 | private Double totalFee; 22 | private Long userId; 23 | private String transactionId; 24 | private Integer status; 25 | private Integer payType; 26 | private String bankType; 27 | private Date createTime; 28 | private Date payTime; 29 | private Date refundTime; 30 | private Date closedTime; 31 | } 32 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/java/com/gerry/yitao/yitaoseckillwebapi/limiting/AccessLimiter.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillwebapi.limiting; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/27 00:52 12 | * @Description: 接口限流注解 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target(ElementType.METHOD) 16 | public @interface AccessLimiter { 17 | /** 18 | * 限流时间 19 | * @return 20 | */ 21 | int seconds(); 22 | 23 | /** 24 | * 最大请求次数 25 | * @return 26 | */ 27 | int maxCount(); 28 | 29 | /** 30 | * 是否需要登录 31 | * @return 32 | */ 33 | boolean needLogin() default true; 34 | } 35 | -------------------------------------------------------------------------------- /yitao-search-interface/src/main/java/com/gerry/yitao/search/service/SearchService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.search.service; 2 | 3 | import com.gerry.yitao.domain.Category; 4 | import com.gerry.yitao.domain.Spu; 5 | import com.gerry.yitao.search.entity.Goods; 6 | import com.gerry.yitao.search.entity.SearchRequest; 7 | import com.gerry.yitao.search.entity.SearchResult; 8 | import org.elasticsearch.search.aggregations.bucket.terms.LongTerms; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @ProjectName: yitao-parent 14 | * @Auther: GERRY 15 | * @Date: 2019/4/23 18:21 16 | * @Description: 17 | */ 18 | public interface SearchService { 19 | Goods buildGoods(Spu spu); 20 | SearchResult search(SearchRequest searchRequest); 21 | List handleCategoryAgg(LongTerms terms); 22 | void insertOrUpdate(Long id); 23 | void delete(Long id); 24 | } 25 | -------------------------------------------------------------------------------- /yitao-order-service/src/main/java/com/gerry/yitao/yitaoorderservice/config/PayConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderservice.config; 2 | 3 | import org.springframework.boot.SpringBootConfiguration; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/15 15:29 12 | * @Description: 支付配置类 13 | */ 14 | @SpringBootConfiguration 15 | public class PayConfiguration { 16 | @Bean 17 | public RestTemplate restTemplate() { 18 | return new RestTemplate(); 19 | } 20 | 21 | @Bean 22 | @ConfigurationProperties(prefix = "yt.wxpay") 23 | public WxPayConfig payConfig() { 24 | return new WxPayConfig(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /yitao-seller-interface/src/main/java/com/gerry/yitao/seller/service/BrandService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seller.service; 2 | 3 | import com.gerry.yitao.seller.bo.BrandBo; 4 | import com.gerry.yitao.domain.Brand; 5 | import com.gerry.yitao.domain.Category; 6 | import com.gerry.yitao.entity.PageResult; 7 | 8 | import java.util.List; 9 | 10 | 11 | public interface BrandService { 12 | 13 | PageResult queryBrandByPageAndSort(Integer page, Integer rows, String sortBy, Boolean desc, String key); 14 | 15 | void saveBrand(Brand brand, List cids); 16 | 17 | List queryCategoryByBid(Long bid); 18 | 19 | void updateBrand(BrandBo brandbo); 20 | 21 | void deleteBrand(Long bid); 22 | 23 | List queryBrandByCid(Long cid); 24 | 25 | Brand queryBrandByBid(Long id); 26 | 27 | List queryBrandByIds(List ids); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/OrderDetail.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | import tk.mybatis.mapper.annotation.KeySql; 5 | 6 | import javax.persistence.Id; 7 | import javax.persistence.Table; 8 | import java.io.Serializable; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/15 21:41 14 | * @Description: 15 | */ 16 | @Data 17 | @Table(name = "tb_order_detail") 18 | public class OrderDetail implements Serializable { 19 | 20 | @Id 21 | @KeySql(useGeneratedKeys = true) 22 | private Long id; 23 | 24 | private Long orderId;// 订单id 25 | 26 | private Long skuId;// 商品id 27 | 28 | private Integer num;// 商品购买数量 29 | 30 | private String title;// 商品标题 31 | 32 | private Double price;// 商品单价 33 | 34 | private String ownSpec;// 商品规格数据 35 | 36 | private String image;// 图片 37 | } 38 | -------------------------------------------------------------------------------- /.idea/dataSources.local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #@ 7 | ` 8 | 9 | 10 | master_key 11 | root 12 | *:@ 13 | 14 | 15 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/OrderStatus.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/15 21:41 14 | * @Description: 15 | */ 16 | @Data 17 | @Table(name = "tb_order_status") 18 | public class OrderStatus implements Serializable { 19 | 20 | @Id 21 | private Long orderId; 22 | 23 | private Integer status; //1、未付款 2、已付款,未发货 3、已发货,未确认 4、交易成功 5、交易关闭 6、已评价' 24 | 25 | private Date createTime;// 创建时间 26 | 27 | private Date paymentTime;// 付款时间 28 | 29 | private Date consignTime;// 发货时间 30 | 31 | private Date endTime;// 交易结束时间 32 | 33 | private Date closeTime;// 交易关闭时间 34 | 35 | private Date commentTime;// 评价时间 36 | } 37 | -------------------------------------------------------------------------------- /yitao-auth-service/src/main/java/com/gerry/yitao/yitaoauthservice/YitaoAuthServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoauthservice; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import com.gerry.yitao.auth.entity.JwtProperties; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 8 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 9 | 10 | @SpringBootApplication( 11 | exclude = DataSourceAutoConfiguration.class) 12 | @EnableDubbo 13 | @EnableConfigurationProperties(JwtProperties.class) 14 | public class YitaoAuthServiceApplication { 15 | 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(YitaoAuthServiceApplication.class); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/SpecParam.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | import tk.mybatis.mapper.annotation.KeySql; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | import java.io.Serializable; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/4/15 21:41 15 | * @Description: 16 | */ 17 | @Data 18 | @Table(name = "tb_spec_param") 19 | public class SpecParam implements Serializable { 20 | 21 | @Id 22 | @KeySql(useGeneratedKeys = true) 23 | private Long id; 24 | private Long cid; 25 | private Long groupId; 26 | private String name; 27 | @Column(name = "`numeric`") 28 | private Boolean numeric; 29 | private String unit; 30 | private Boolean generic; 31 | private Boolean searching; 32 | private String segments; 33 | } 34 | -------------------------------------------------------------------------------- /yitao-mapper/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-mapper 13 | 14 | 15 | 16 | com.gerry.yitao 17 | yitao-domain 18 | 19 | 20 | 21 | com.gerry.yitao 22 | yitao-common 23 | 24 | 25 | -------------------------------------------------------------------------------- /yitao-auth-webapi/src/main/java/com/gerry/yitao/yitaoauthservicewebapi/YitaoAuthWebApplication.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoauthservicewebapi; 2 | 3 | import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import com.gerry.yitao.auth.entity.JwtProperties; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 8 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 9 | 10 | @SpringBootApplication(exclude = DataSourceAutoConfiguration.class,scanBasePackages = {"com.gerry.yitao"}) 11 | @EnableDubbo 12 | @EnableConfigurationProperties(JwtProperties.class) 13 | public class YitaoAuthWebApplication { 14 | 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(YitaoAuthWebApplication.class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /yitao-user-interface/src/main/java/com/gerry/yitao/user/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.user.service; 2 | 3 | import com.gerry.yitao.domain.User; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/5/3 19:12 9 | * @Description: 用户操作接口 10 | */ 11 | public interface UserService { 12 | /** 13 | * 校验用户对象数据类型 14 | * @param data 15 | * @param type 16 | * @return 17 | */ 18 | Boolean checkData(String data, Integer type); 19 | 20 | /** 21 | * 发送验证码 22 | * @param phone 23 | */ 24 | void sendVerifyCode(String phone); 25 | 26 | /** 27 | * 用户注册 28 | * @param user 29 | * @param code 30 | */ 31 | void register(User user, String code); 32 | 33 | /** 34 | * 根据账号和密码查询用户信息 35 | * @param username 36 | * @param password 37 | * @return 38 | */ 39 | User queryUser(String username, String password); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mysql 6 | true 7 | com.mysql.jdbc.Driver 8 | jdbc:mysql://localhost:3306/orange 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /yitao-seller-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-seller-interface 13 | 14 | yitao-seller-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-domain 20 | 21 | 22 | 23 | com.gerry.yitao 24 | yitao-common 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/Sku.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | import tk.mybatis.mapper.annotation.KeySql; 5 | 6 | import javax.persistence.Id; 7 | import javax.persistence.Table; 8 | import javax.persistence.Transient; 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * @ProjectName: yitao-parent 14 | * @Auther: GERRY 15 | * @Date: 2019/4/15 21:41 16 | * @Description: 17 | */ 18 | @Table(name = "tb_sku") 19 | @Data 20 | public class Sku implements Serializable { 21 | @Id 22 | @KeySql(useGeneratedKeys = true) 23 | private Long id; 24 | private Long spuId; 25 | private String title; 26 | private String images; 27 | private Double price; 28 | private String ownSpec;// 商品特殊规格的键值对 29 | private String indexes;// 商品特殊规格的下标 30 | private Boolean enable;// 是否有效,逻辑删除用 31 | private Date createTime;// 创建时间 32 | private Date lastUpdateTime;// 最后修改时间 33 | @Transient 34 | private Integer stock;// 库存 35 | } 36 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/cluster/TMProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.cluster; 17 | 18 | import lombok.Data; 19 | 20 | /** 21 | * Description: 22 | * Date: 19-1-25 上午10:31 23 | * 24 | * @author ujued 25 | */ 26 | @Data 27 | public class TMProperties { 28 | private String host; 29 | private Integer httpPort; 30 | private Integer transactionPort; 31 | } 32 | -------------------------------------------------------------------------------- /yitao-search-interface/src/main/java/com/gerry/yitao/search/entity/SearchRequest.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.search.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.util.Map; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/4/23 18:21 12 | * @Description: 13 | */ 14 | @Data 15 | public class SearchRequest implements Serializable { 16 | 17 | private static final Integer DEFAULT_PAGE = 1; 18 | private static final Integer DEFAULT_SIZE = 20; 19 | private String key; 20 | private Integer page; 21 | //排序字段 22 | private String sortBy; 23 | //是否降序 24 | private Boolean descending; 25 | //过滤字段 26 | private Map filter; 27 | 28 | public Integer getPage() { 29 | if (page == null) { 30 | return DEFAULT_PAGE; 31 | } 32 | // 获取页码时做一些校验,不能小于1 33 | return Math.max(DEFAULT_PAGE, page); 34 | } 35 | 36 | public Integer getSize() { 37 | return DEFAULT_SIZE; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/auth/sauth/SAuthHandleException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.auth.sauth; 17 | 18 | /** 19 | * Description: 20 | * Date: 2018/11/23 21 | * 22 | * @author ujued 23 | */ 24 | public class SAuthHandleException extends Exception { 25 | 26 | public SAuthHandleException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /yitao-order-webapi/src/main/java/com/gerry/yitao/yitaoorderwebapi/config/JwtProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderwebapi.config; 2 | 3 | import com.gerry.yitao.common.util.RsaUtils; 4 | import lombok.Data; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | 8 | import javax.annotation.PostConstruct; 9 | import java.security.PublicKey; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/5/9 19:17 15 | * @Description: 16 | */ 17 | @Data 18 | @Slf4j 19 | @ConfigurationProperties(prefix = "yt.jwt") 20 | public class JwtProperties { 21 | 22 | private String pubKeyPath; 23 | 24 | private String cookieName; 25 | 26 | private PublicKey publicKey; 27 | 28 | @PostConstruct 29 | public void init() { 30 | try { 31 | publicKey = RsaUtils.getPublicKey(pubKeyPath); 32 | } catch (Exception e) { 33 | log.error("初始化公钥失败", e); 34 | throw new RuntimeException(); 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/java/com/gerry/yitao/yitaoseckillwebapi/config/JwtProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillwebapi.config; 2 | 3 | import com.gerry.yitao.common.util.RsaUtils; 4 | import lombok.Data; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | 8 | import javax.annotation.PostConstruct; 9 | import java.security.PublicKey; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/5/9 19:17 15 | * @Description: 16 | */ 17 | @Data 18 | @Slf4j 19 | @ConfigurationProperties(prefix = "yt.jwt") 20 | public class JwtProperties { 21 | 22 | private String pubKeyPath; 23 | 24 | private String cookieName; 25 | 26 | private PublicKey publicKey; 27 | 28 | @PostConstruct 29 | public void init() { 30 | try { 31 | publicKey = RsaUtils.getPublicKey(pubKeyPath); 32 | } catch (Exception e) { 33 | log.error("初始化公钥失败", e); 34 | throw new RuntimeException(); 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /yitao-cart-webapi/src/main/java/com/gerry/yitao/yitaocartservicewebapi/config/JwtProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartservicewebapi.config; 2 | 3 | import com.gerry.yitao.common.util.RsaUtils; 4 | import lombok.Data; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | 8 | import javax.annotation.PostConstruct; 9 | import java.security.PublicKey; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/5/9 19:17 15 | * @Description: 16 | */ 17 | @Data 18 | @Slf4j 19 | @ConfigurationProperties(prefix = "yt.jwt") 20 | public class JwtProperties { 21 | 22 | private String pubKeyPath; 23 | 24 | private String cookieName; 25 | 26 | private PublicKey publicKey; 27 | 28 | @PostConstruct 29 | public void init() { 30 | try { 31 | publicKey = RsaUtils.getPublicKey(pubKeyPath); 32 | } catch (Exception e) { 33 | log.error("初始化公钥失败", e); 34 | throw new RuntimeException(); 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /yitao-user-service/src/main/java/com/gerry/yitao/yitaouserservice/utils/CodecUtils.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouserservice.utils; 2 | 3 | import org.apache.commons.codec.digest.DigestUtils; 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import java.util.UUID; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/6 11:56 12 | * @Description: 13 | */ 14 | public class CodecUtils { 15 | public static String md5Hex(String data,String salt) { 16 | if (StringUtils.isBlank(salt)) { 17 | salt = data.hashCode() + ""; 18 | } 19 | 20 | return DigestUtils.md5Hex(salt + DigestUtils.md5Hex(data)); 21 | } 22 | 23 | public static String shaHex(String data, String salt) { 24 | if (StringUtils.isBlank(salt)) { 25 | salt = data.hashCode() + ""; 26 | } 27 | return DigestUtils.sha512Hex(salt + DigestUtils.sha512Hex(data)); 28 | } 29 | 30 | public static String generateSalt(){ 31 | return StringUtils.replace(UUID.randomUUID().toString(), "-", ""); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/core/storage/FastStorageProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.core.storage; 17 | 18 | /** 19 | * Description: 20 | * Date: 19-1-22 下午2:18 21 | * 22 | * @author ujued 23 | */ 24 | public interface FastStorageProvider { 25 | 26 | /** 27 | * TM FastStorage's implementation. 28 | * 29 | * @return fast storage's implementation 30 | */ 31 | FastStorage provide(); 32 | } 33 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/Token.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | /** 23 | * Description: 24 | * Date: 2018/12/29 25 | * 26 | * @author ujued 27 | */ 28 | @AllArgsConstructor 29 | @NoArgsConstructor 30 | @Data 31 | public class Token { 32 | private String token; 33 | } 34 | -------------------------------------------------------------------------------- /yitao-seckill-service/src/main/java/com/gerry/yitao/yitaoseckillservice/utils/CodecUtils.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillservice.utils; 2 | 3 | import org.apache.commons.codec.digest.DigestUtils; 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import java.util.UUID; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/6 11:56 12 | * @Description: 13 | */ 14 | public class CodecUtils { 15 | public static String md5Hex(String data,String salt) { 16 | if (StringUtils.isBlank(salt)) { 17 | salt = data.hashCode() + ""; 18 | } 19 | 20 | return DigestUtils.md5Hex(salt + DigestUtils.md5Hex(data)); 21 | } 22 | 23 | public static String shaHex(String data, String salt) { 24 | if (StringUtils.isBlank(salt)) { 25 | salt = data.hashCode() + ""; 26 | } 27 | return DigestUtils.sha512Hex(salt + DigestUtils.sha512Hex(data)); 28 | } 29 | 30 | public static String generateSalt(){ 31 | return StringUtils.replace(UUID.randomUUID().toString(), "-", ""); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/base/interceptor/properties/AuthProperties.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.common.base.interceptor.properties; 2 | 3 | import com.gerry.yitao.common.util.RsaUtils; 4 | import lombok.Data; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | 8 | import javax.annotation.PostConstruct; 9 | import java.security.PublicKey; 10 | 11 | /** 12 | * @ProjectName: yitao-parent 13 | * @Auther: GERRY 14 | * @Date: 2019/5/8 11:56 15 | * @Description: 16 | */ 17 | 18 | @Data 19 | @Slf4j 20 | @ConfigurationProperties(prefix = "yt.jwt") 21 | public class AuthProperties { 22 | 23 | private String pubKeyPath; 24 | private PublicKey publicKey; 25 | private String cookieName; 26 | 27 | @PostConstruct 28 | public void init() { 29 | try { 30 | //获取公钥 31 | this.publicKey = RsaUtils.getPublicKey(pubKeyPath); 32 | } catch (Exception e) { 33 | log.error("初始化公钥失败", e); 34 | throw new RuntimeException(); 35 | } 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /yitao-seckill-service/src/test/java/com/gerry/yitao/yitaouserservice/YitaoSecKillApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouserservice; 2 | 3 | import com.gerry.yitao.domain.SeckillGoods; 4 | import com.gerry.yitao.seckill.service.SeckillService; 5 | import com.gerry.yitao.yitaoseckillservice.YitaoSeckillServiceApplication; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | import java.util.List; 13 | 14 | @RunWith(SpringRunner.class) 15 | @SpringBootTest(classes = YitaoSeckillServiceApplication.class) 16 | public class YitaoSecKillApplicationTests { 17 | @Autowired 18 | private SeckillService seckillService; 19 | 20 | @Test 21 | public void testFindSeckillList() { 22 | List seckillGoods = seckillService.querySecKillList(); 23 | for (SeckillGoods seckillGood : seckillGoods) { 24 | System.out.println(seckillGood); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /yitao-order-webapi/src/main/java/com/gerry/yitao/yitaoorderwebapi/config/MvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderwebapi.config; 2 | 3 | import com.gerry.yitao.yitaoorderwebapi.filter.LoginInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/5/9 19:09 14 | * @Description: 15 | */ 16 | @Configuration 17 | @EnableConfigurationProperties(JwtProperties.class) 18 | public class MvcConfig implements WebMvcConfigurer { 19 | 20 | @Autowired(required = false) 21 | private JwtProperties props; 22 | 23 | @Override 24 | public void addInterceptors(InterceptorRegistry registry) { 25 | //配置登录拦截器 26 | registry.addInterceptor(new LoginInterceptor(props)).addPathPatterns("/**"); 27 | } 28 | } -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/txex/TxExceptionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.txex; 17 | 18 | import com.codingapi.txlcn.tm.support.db.domain.TxException; 19 | 20 | /** 21 | * Description: 22 | * Date: 19-1-3 上午9:40 23 | * 24 | * @author ujued 25 | */ 26 | public interface TxExceptionListener { 27 | 28 | /** 29 | * 实务异常时 30 | * 31 | * @param txException txException 32 | */ 33 | void onException(TxException txException); 34 | } 35 | -------------------------------------------------------------------------------- /yitao-cart-webapi/src/main/java/com/gerry/yitao/yitaocartservicewebapi/config/MvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartservicewebapi.config; 2 | 3 | import com.gerry.yitao.yitaocartservicewebapi.filter.LoginInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/5/9 19:09 14 | * @Description: 15 | */ 16 | @Configuration 17 | @EnableConfigurationProperties(JwtProperties.class) 18 | public class MvcConfig implements WebMvcConfigurer { 19 | 20 | @Autowired(required = false) 21 | private JwtProperties props; 22 | 23 | @Override 24 | public void addInterceptors(InterceptorRegistry registry) { 25 | //配置登录拦截器 26 | registry.addInterceptor(new LoginInterceptor(props)).addPathPatterns("/**"); 27 | } 28 | } -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/DeleteExceptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * Description: 26 | * Date: 19-1-18 上午11:48 27 | * 28 | * @author ujued 29 | */ 30 | @AllArgsConstructor 31 | @NoArgsConstructor 32 | @Data 33 | public class DeleteExceptions { 34 | private List id; 35 | } -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/core/storage/LockValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.core.storage; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * Description: 24 | * Date: 19-1-23 下午5:41 25 | * 26 | * @author ujued 27 | */ 28 | @Data 29 | public class LockValue implements Serializable { 30 | /** 31 | * 事务组ID 32 | */ 33 | private String groupId; 34 | 35 | /** 36 | * 锁类型 37 | */ 38 | private int lockType; 39 | } 40 | -------------------------------------------------------------------------------- /yitao-auth-service/src/main/java/com/gerry/yitao/yitaoauthservice/client/UserClient.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoauthservice.client; 2 | 3 | import com.gerry.yitao.common.util.RestTemplateUtils; 4 | import com.gerry.yitao.domain.User; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | /** 13 | * @ProjectName: yitao-parent 14 | * @Auther: GERRY 15 | * @Date: 2019/5/6 19:07 16 | * @Description: 17 | */ 18 | @Component 19 | public class UserClient { 20 | @Value("${client.url:}") 21 | private String url; 22 | 23 | public User queryUser(String username, String password) { 24 | String requestUrl = url+"api/user/query?username={username}&password={password}"; 25 | Map params = new HashMap<>(); 26 | params.put("username", username); 27 | params.put("password", password); 28 | ResponseEntity entity = RestTemplateUtils.get(requestUrl,User.class,params); 29 | 30 | return entity.getBody(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/User.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import lombok.Data; 5 | import org.hibernate.validator.constraints.Length; 6 | import tk.mybatis.mapper.annotation.KeySql; 7 | 8 | import javax.persistence.Id; 9 | import javax.persistence.Table; 10 | import javax.validation.constraints.Pattern; 11 | import java.io.Serializable; 12 | import java.util.Date; 13 | 14 | /** 15 | * @ProjectName: yitao-parent 16 | * @Auther: GERRY 17 | * @Date: 2019/4/15 21:41 18 | * @Description: 19 | */ 20 | @Data 21 | @Table(name = "tb_user") 22 | public class User implements Serializable { 23 | @Id 24 | @KeySql(useGeneratedKeys = true) 25 | private Long id; 26 | @Length(max = 30, min = 4, message = "用户名长度只能在4-30之间") 27 | private String username;// 用户名 28 | @JsonIgnore 29 | @Length(max = 30, min = 4, message = "密码长度只能在4-30之间") 30 | private String password;// 密码 31 | @Pattern(regexp = "^1[35678]\\d{9}$",message = "手机号格式不正确") 32 | private String phone;// 电话 33 | private Date created; 34 | @JsonIgnore 35 | private String salt; 36 | } 37 | -------------------------------------------------------------------------------- /yitao-upload-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-upload-interface 13 | 14 | yitao-upload-interface 15 | 16 | 17 | 18 | org.projectlombok 19 | lombok 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | 28 | com.caucho 29 | hessian 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/util/ObjectUtils.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.common.util; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/5/6 19:05 9 | * @Description: 10 | */ 11 | public class ObjectUtils { 12 | public static String toString(Object obj) { 13 | if (obj == null) { 14 | return null; 15 | } 16 | return obj.toString(); 17 | } 18 | 19 | public static Long toLong(Object obj) { 20 | if (obj == null) { 21 | return 0L; 22 | } 23 | if (obj instanceof Double || obj instanceof Float) { 24 | return Long.valueOf(StringUtils.substringBefore(obj.toString(), ".")); 25 | } 26 | if (obj instanceof Number) { 27 | return Long.valueOf(obj.toString()); 28 | } 29 | if (obj instanceof String) { 30 | return Long.valueOf(obj.toString()); 31 | } else { 32 | return 0L; 33 | } 34 | } 35 | 36 | public static Integer toInt(Object obj) { 37 | return toLong(obj).intValue(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/core/storage/GroupProps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.core.storage; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * Description: 24 | * Date: 19-1-30 下午4:38 25 | * 26 | * @author ujued 27 | */ 28 | @Data 29 | public class GroupProps implements Serializable { 30 | 31 | /** 32 | * 事务组ID 33 | */ 34 | private String groupId; 35 | 36 | /** 37 | * 创建时间 38 | */ 39 | private long createTimeMillis; 40 | } 41 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.common.util; 2 | 3 | import java.util.Date; 4 | import java.util.GregorianCalendar; 5 | 6 | /** 7 | * 类描述:时间操作工具栏 8 | * @auther Gerry 9 | * @create 2018/03/31 10 | */ 11 | public class DateUtil { 12 | 13 | /** 14 | * 功能描述:根据时间和传过来的格式 格式化显示时间 15 | * @param date 16 | * @param pattern 17 | * @return 18 | */ 19 | public static String format(Date date, String pattern) { 20 | if (date == null) { 21 | return "null"; 22 | } 23 | if (pattern == null || pattern.equals("") || pattern.equals("null")) { 24 | pattern = "yyyy-MM-dd HH:mm:ss"; 25 | } 26 | return new java.text.SimpleDateFormat(pattern).format(date); 27 | } 28 | 29 | /** 30 | * 功能描述:实现日期的加减 31 | * @param date 32 | * @param day 33 | * @return 34 | */ 35 | public static Date addDay(Date date,int day){ 36 | GregorianCalendar calendar=new GregorianCalendar(); 37 | calendar.setTime(date); 38 | calendar.add(GregorianCalendar.DATE, day); 39 | return calendar.getTime(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /yitao-detail-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-detail-interface 13 | 14 | yitao-detail-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-domain 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-thymeleaf 25 | 26 | 27 | 28 | org.projectlombok 29 | lombok 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/RedirectController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi; 17 | 18 | import org.springframework.stereotype.Controller; 19 | import org.springframework.web.bind.annotation.RequestMapping; 20 | 21 | /** 22 | * Description: 23 | * Date: 1/11/19 24 | * 25 | * @author ujued 26 | */ 27 | @Controller 28 | public class RedirectController { 29 | 30 | @RequestMapping("/") 31 | public String index() { 32 | return "redirect:/admin/index.html"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/ExceptionList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * Description: 26 | * Date: 2018/12/20 27 | * 28 | * @author ujued 29 | */ 30 | @AllArgsConstructor 31 | @NoArgsConstructor 32 | @Data 33 | public class ExceptionList { 34 | private long total; 35 | private List exceptions; 36 | } 37 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/TxLogList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * Description: 26 | * Date: 2018/12/24 27 | * 28 | * @author ujued 29 | */ 30 | @AllArgsConstructor 31 | @NoArgsConstructor 32 | @Data 33 | public class TxLogList { 34 | 35 | private long total; 36 | 37 | private List logs; 38 | } 39 | -------------------------------------------------------------------------------- /yitao-detail-service/src/test/java/com/gerry/yitao/yitaodetailservice/PageDetailTests.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaodetailservice; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.gerry.yitao.detail.service.PageDetailService; 5 | import org.junit.Test; 6 | 7 | import javax.annotation.Resource; 8 | import java.util.Map; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/29 20:46 14 | * @Description: 15 | */ 16 | public class PageDetailTests extends YitaoPageDetailApplicationTests { 17 | 18 | @Resource 19 | private PageDetailService pageDetailService; 20 | 21 | @Test 22 | public void test1() { 23 | Map map = pageDetailService.loadModel(51L); 24 | System.out.println(JSON.toJSONString(map,true)); 25 | } 26 | 27 | @Test 28 | public void createHtml() { 29 | // 当你首次访问的商品详情页时。 30 | // 1、动态渲染 31 | // 2、判断指定目录下面是否存在了静态页面,如果存在直接访问,如果不存在通过,重新访问生成对应静态页面 32 | // if (!f -name $) { 33 | // root html; 34 | //} 35 | // proxy_pass = "192.168.3.101:10040"; 36 | 37 | pageDetailService.createHtml(57L); 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /yitao-search-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-search-interface 13 | 14 | yitao-search-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-domain 20 | 21 | 22 | 23 | org.projectlombok 24 | lombok 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-data-elasticsearch 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/DeleteLogsReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | /** 23 | * Description: 24 | * Date: 19-1-17 下午6:39 25 | * 26 | * @author ujued 27 | */ 28 | @AllArgsConstructor 29 | @NoArgsConstructor 30 | @Data 31 | public class DeleteLogsReq { 32 | private String groupId; 33 | private String tag; 34 | private String lTime; 35 | private String rTime; 36 | } -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/response/Result.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.response; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @ProjectName: yitao-parent 7 | * @Auther: GERRY 8 | * @Date: 2019/5/24 14:00 9 | * @Description: 结果类 10 | */ 11 | @Data 12 | public class Result { 13 | 14 | private int code; 15 | private String msg; 16 | private T data; 17 | 18 | /** 19 | * 成功时候的调用 20 | * */ 21 | public static Result success(T data){ 22 | Result result = new Result(data); 23 | result.code = CodeMsg.SUCCESS.getCode(); 24 | return new Result(data); 25 | } 26 | 27 | /** 28 | * 失败时候的调用 29 | * */ 30 | public static Result error(CodeMsg codeMsg){ 31 | return new Result(codeMsg); 32 | } 33 | 34 | private Result(T data) { 35 | this.data = data; 36 | } 37 | 38 | private Result(int code, String msg) { 39 | this.code = code; 40 | this.msg = msg; 41 | } 42 | 43 | private Result(CodeMsg codeMsg) { 44 | if(codeMsg != null) { 45 | this.code = codeMsg.getCode(); 46 | this.msg = codeMsg.getMsg(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /yitao-search-interface/src/main/java/com/gerry/yitao/search/entity/SearchResult.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.search.entity; 2 | 3 | 4 | import com.gerry.yitao.domain.Brand; 5 | import com.gerry.yitao.domain.Category; 6 | import com.gerry.yitao.entity.PageResult; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @ProjectName: yitao-parent 15 | * @Auther: GERRY 16 | * @Date: 2019/4/23 18:21 17 | * @Description: 18 | */ 19 | @Data 20 | @NoArgsConstructor 21 | public class SearchResult extends PageResult { 22 | 23 | private List brands; 24 | private List categories; 25 | //规格参数过滤条件 26 | private List> specs; 27 | 28 | public SearchResult(Long total, 29 | Integer totalPage, 30 | List items, 31 | List categories, 32 | List brands, 33 | List> specs) { 34 | super(total, totalPage, items); 35 | this.categories = categories; 36 | this.brands = brands; 37 | this.specs = specs; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/ListAppMods.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.Data; 19 | 20 | import java.util.List; 21 | 22 | /** 23 | * Description: 24 | * Date: 19-1-17 上午11:56 25 | * 26 | * @author ujued 27 | */ 28 | @Data 29 | public class ListAppMods { 30 | private long total; 31 | private List appMods; 32 | 33 | @Data 34 | public static class AppMod { 35 | private String modName; 36 | private String modId; 37 | private String registerTime; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /yitao-cart-interface/src/main/java/com/gerry/yitao/cart/service/CartService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.cart.service; 2 | 3 | import com.gerry.yitao.cart.entity.Cart; 4 | import com.gerry.yitao.common.entity.UserInfo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/3 19:12 12 | * @Description: 13 | */ 14 | public interface CartService { 15 | /** 16 | * 添加到购物车 17 | * @param cart 18 | */ 19 | void addCart(Cart cart, UserInfo user); 20 | 21 | /** 22 | * 批量添加商品到购物 23 | * @param carts 24 | * @param loginUser 25 | */ 26 | void addCarts(List carts,UserInfo loginUser); 27 | 28 | /** 29 | * 查询购物车 30 | * @return 31 | */ 32 | List listCart(UserInfo user); 33 | 34 | /** 35 | * 根据id更新商品数量 36 | * @param id 37 | * @param num 38 | */ 39 | void updateNum(Long id, Integer num,UserInfo user); 40 | 41 | /** 42 | * 删除购物车商品 43 | * @param id 44 | */ 45 | void deleteCart(Long id,UserInfo user); 46 | 47 | /** 48 | * 批量删除购物车商品 49 | * @param ids 50 | * @param userId 51 | */ 52 | void deleteCarts(List ids, Integer userId); 53 | } 54 | -------------------------------------------------------------------------------- /yitao-detail-webapi/src/main/java/com/gerry/yitao/yitaodetailservicewebapi/controller/PageDetailController.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaodetailservicewebapi.controller; 2 | 3 | import com.alibaba.dubbo.config.annotation.Reference; 4 | import com.gerry.yitao.detail.service.PageDetailService; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.ui.Model; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | 10 | import java.util.Map; 11 | 12 | /** 13 | * @ProjectName: yitao-parent 14 | * @Auther: GERRY 15 | * @Date: 2019/4/29 18:49 16 | * @Description: 17 | */ 18 | @Controller 19 | public class PageDetailController { 20 | @Reference(timeout = 40000) 21 | private PageDetailService detailService; 22 | 23 | @GetMapping("item/{id}.html") 24 | public String toItemPage(@PathVariable("id") Long spuId, Model model) { 25 | Map attributes = detailService.loadModel(spuId); 26 | model.addAllAttributes(attributes); 27 | // 同步 28 | //detailService.createHtml(spuId); 29 | // 异步生成静态详情页 30 | detailService.asyncExecute(spuId); 31 | 32 | return "item"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/txmsg/RpcExecuteService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.txmsg; 17 | 18 | import com.codingapi.txlcn.common.exception.TxManagerException; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * LCN分布式事务 manager业务处理 24 | * @author lorne 25 | */ 26 | public interface RpcExecuteService { 27 | 28 | /** 29 | * 执行业务 30 | * @param transactionCmd transactionCmd 31 | * @return Object 32 | * @throws TxManagerException TxManagerException 33 | */ 34 | Serializable execute(TransactionCmd transactionCmd) throws TxManagerException; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/ErrorResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import com.alibaba.fastjson.JSON; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | /** 24 | * Description: 25 | * Date: 2018/11/23 26 | * 27 | * @author ujued 28 | */ 29 | @AllArgsConstructor 30 | @NoArgsConstructor 31 | @Data 32 | public class ErrorResponse { 33 | private int code; 34 | private String message; 35 | 36 | @Override 37 | public String toString() { 38 | return JSON.toJSONString(this); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/txmsg/RpcExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.txmsg; 17 | 18 | /** 19 | * Description: 20 | * Date: 2018/12/18 21 | * 22 | * @author ujued 23 | */ 24 | public interface RpcExceptionHandler { 25 | 26 | /** 27 | * 通知事务单元业务异常 28 | * 29 | * @param params params 30 | * @param e e 31 | */ 32 | void handleNotifyUnitBusinessException(Object params, Throwable e); 33 | 34 | /** 35 | * 通知事务单元通讯异常 36 | * 37 | * @param params params 38 | * @param e e 39 | */ 40 | void handleNotifyUnitMessageException(Object params, Throwable e); 41 | } 42 | -------------------------------------------------------------------------------- /yitao-search-webapi/src/main/java/com/gerry/yitao/yitaosearchservicewebapi/controller/GoodsSearchController.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservicewebapi.controller; 2 | 3 | import com.alibaba.dubbo.config.annotation.Reference; 4 | import com.gerry.yitao.search.entity.Goods; 5 | import com.gerry.yitao.search.entity.SearchRequest; 6 | import com.gerry.yitao.search.entity.SearchResult; 7 | import com.gerry.yitao.search.service.SearchService; 8 | import org.springframework.http.ResponseEntity; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | /** 15 | * @ProjectName: yitao-parent 16 | * @Auther: GERRY 17 | * @Date: 2019/4/24 16:13 18 | * @Description: 19 | */ 20 | @RestController 21 | @RequestMapping("api/search") 22 | public class GoodsSearchController { 23 | @Reference(check = false,timeout = 30000) 24 | private SearchService searchService; 25 | 26 | @PostMapping("page") 27 | public ResponseEntity> search(@RequestBody SearchRequest searchRequest) { 28 | return ResponseEntity.ok(searchService.search(searchRequest)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /yitao-domain/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-domain 13 | 14 | yitao-domain 15 | 16 | 17 | 18 | org.projectlombok 19 | lombok 20 | 21 | 22 | 23 | com.fasterxml.jackson.core 24 | jackson-databind 25 | 26 | 27 | 28 | org.hibernate.validator 29 | hibernate-validator 30 | 31 | 32 | 33 | tk.mybatis 34 | mapper-spring-boot-starter 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/auth/sauth/DefaultSAuthLogic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.auth.sauth; 17 | 18 | import com.codingapi.txlcn.tm.support.restapi.auth.sauth.token.TokenStorage; 19 | 20 | /** 21 | * Description: 22 | * Date: 2018/12/28 23 | * 24 | * @author ujued 25 | */ 26 | public class DefaultSAuthLogic implements SAuthLogic { 27 | 28 | private TokenStorage tokenStorage; 29 | 30 | public DefaultSAuthLogic(TokenStorage tokenStorage) { 31 | this.tokenStorage = tokenStorage; 32 | } 33 | 34 | @Override 35 | public boolean verify(String token) { 36 | return tokenStorage.exist(token); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/exception/VersionValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.gerry.yitao.common.exception; 19 | 20 | 21 | import org.springframework.http.HttpStatus; 22 | import org.springframework.web.bind.annotation.ResponseStatus; 23 | 24 | @ResponseStatus(value = HttpStatus.BAD_REQUEST) 25 | public class VersionValidationException extends SystemException{ 26 | 27 | public VersionValidationException(String message) { 28 | super(message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /yitao-seckill-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-seckill-interface 13 | 14 | yitao-seckill-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-common 20 | 21 | 22 | 23 | com.gerry.yitao 24 | yitao-domain 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-data-redis 30 | 31 | 32 | 33 | org.projectlombok 34 | lombok 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /yitao-user-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | hikari: 5 | auto-commit: true 6 | connection-test-query: SELECT 1 7 | connection-timeout: 30000 8 | idle-timeout: 30000 9 | max-lifetime: 1800000 10 | maximum-pool-size: 15 11 | minimum-idle: 5 12 | pool-name: DatebookHikariCP 13 | password: 123 14 | type: com.zaxxer.hikari.HikariDataSource 15 | url: jdbc:mysql://192.168.3.121:3306/orange?useSSL=false&serverTimezone=UTC 16 | username: root 17 | redis: 18 | host: 192.168.3.201 19 | password: redis-01 20 | rabbitmq: 21 | host: 192.168.3.201 22 | username: test 23 | password: test 24 | virtual-host: / 25 | template: 26 | retry: 27 | enabled: true 28 | initial-interval: 10000ms 29 | max-interval: 30000ms 30 | multiplier: 2 31 | exchange: yt.sms.queue 32 | publisher-confirms: true 33 | dubbo: 34 | application: 35 | name: yitao-user-service 36 | qos-enable: false 37 | protocol: 38 | port: 20886 39 | registry: 40 | address: zookeeper://192.168.3.201:2181 41 | # address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 42 | server: 43 | port: 7779 44 | logging: 45 | level: 46 | com.gerry.yitao.mapper: debug -------------------------------------------------------------------------------- /yitao-detail-service/src/main/java/com/gerry/yitao/yitaosearchservice/client/CategoryClient.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice.client; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.gerry.yitao.common.util.RestTemplateUtils; 6 | import com.gerry.yitao.domain.Category; 7 | import com.google.common.base.Joiner; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.stereotype.Component; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * @ProjectName: yitao-parent 18 | * @Auther: GERRY 19 | * @Date: 2019/4/23 19:31 20 | * @Description: 21 | */ 22 | @Component 23 | public class CategoryClient { 24 | @Value("${client.url:}") 25 | private String url; 26 | 27 | public List queryByIds(List ids) { 28 | String requestUrl = url+"api/item/category/list/ids?ids={ids}"; 29 | Map params = new HashMap<>(); 30 | params.put("ids", Joiner.on(",").join(ids)); 31 | ResponseEntity entity = RestTemplateUtils.get(requestUrl,List.class,params); 32 | List categories = JSONObject.parseArray(JSON.toJSONString(entity.getBody()), Category.class); 33 | return categories; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /yitao-seckill-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | hikari: 5 | auto-commit: true 6 | connection-test-query: SELECT 1 7 | connection-timeout: 30000 8 | idle-timeout: 30000 9 | max-lifetime: 1800000 10 | maximum-pool-size: 15 11 | minimum-idle: 5 12 | pool-name: DatebookHikariCP 13 | password: 123 14 | type: com.zaxxer.hikari.HikariDataSource 15 | url: jdbc:mysql://192.168.3.121:3306/orange?useSSL=false&serverTimezone=UTC 16 | username: root 17 | redis: 18 | host: 192.168.3.201 19 | password: redis-01 20 | rabbitmq: 21 | host: 192.168.3.201 22 | username: test 23 | password: test 24 | virtual-host: / 25 | template: 26 | retry: 27 | enabled: true 28 | initial-interval: 10000ms 29 | max-interval: 30000ms 30 | multiplier: 2 31 | exchange: yt.order.exchange 32 | publisher-confirms: true 33 | dubbo: 34 | application: 35 | name: yitao-seckill-service 36 | qos-enable: false 37 | protocol: 38 | port: 20889 39 | registry: 40 | address: zookeeper://192.168.3.201:2181 41 | # address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 42 | server: 43 | port: 7782 44 | logging: 45 | level: 46 | com.gerry.yitao.mapper: debug -------------------------------------------------------------------------------- /yitao-search-service/src/main/java/com/gerry/yitao/yitaosearchservice/client/CategoryClient.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice.client; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.gerry.yitao.common.util.RestTemplateUtils; 6 | import com.gerry.yitao.domain.Category; 7 | import com.google.common.base.Joiner; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.stereotype.Component; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * @ProjectName: yitao-parent 18 | * @Auther: GERRY 19 | * @Date: 2019/4/23 19:31 20 | * @Description: 21 | */ 22 | @Component 23 | public class CategoryClient { 24 | @Value("${client.url:}") 25 | private String url; 26 | 27 | public List queryByIds(List ids) { 28 | String requestUrl = url+"api/item/category/list/ids?ids={ids}"; 29 | Map params = new HashMap<>(); 30 | params.put("ids", Joiner.on(",").join(ids)); 31 | ResponseEntity entity = RestTemplateUtils.get(requestUrl,List.class,params); 32 | List categories = JSONObject.parseArray(JSON.toJSONString(entity.getBody()), Category.class); 33 | 34 | return categories; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/exception/ParamValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.gerry.yitao.common.exception; 18 | 19 | import org.springframework.http.HttpStatus; 20 | import org.springframework.web.bind.annotation.ResponseStatus; 21 | 22 | /** 23 | * Parameter validation failure exception 24 | */ 25 | @ResponseStatus(value = HttpStatus.BAD_REQUEST) 26 | public class ParamValidationException extends SystemException { 27 | 28 | public ParamValidationException(String message) { 29 | super(message); 30 | } 31 | } -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/TMApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm; 17 | 18 | import com.codingapi.txlcn.tm.support.TxLcnManagerBanner; 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * Description: 24 | * Company: CodingApi 25 | * Date: 2018/11/29 26 | * 27 | * @author lorne 28 | */ 29 | @SpringBootApplication 30 | public class TMApplication { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication springApplication = new SpringApplication(TMApplication.class); 34 | springApplication.setBanner(new TxLcnManagerBanner()); 35 | springApplication.run(args); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /yitao-cart-webapi/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.gerry.yitao 7 | yitao-parent 8 | 1.0-SNAPSHOT 9 | 10 | yitao-cart-webapi 11 | yitao-cart-webapi 12 | 13 | 14 | 15 | 16 | com.gerry.yitao 17 | yitao-cart-interface 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | 26 | com.alibaba.boot 27 | dubbo-spring-boot-starter 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-starter-test 33 | test 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /yitao-order-webapi/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.gerry.yitao 7 | yitao-parent 8 | 1.0-SNAPSHOT 9 | 10 | yitao-order-webapi 11 | yitao-order-webapi 12 | 13 | 14 | 15 | 16 | com.gerry.yitao 17 | yitao-order-interface 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | 26 | com.alibaba.boot 27 | dubbo-spring-boot-starter 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-starter-test 33 | test 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/txmsg/TransactionCmd.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.txmsg; 17 | 18 | 19 | import com.codingapi.txlcn.txmsg.LCNCmdType; 20 | import com.codingapi.txlcn.txmsg.dto.MessageDto; 21 | import lombok.Data; 22 | 23 | /** 24 | * @author lorne 25 | */ 26 | @Data 27 | public class TransactionCmd { 28 | 29 | /** 30 | * 业务状态 31 | */ 32 | private LCNCmdType type; 33 | 34 | /** 35 | * 请求唯一标识 36 | */ 37 | private String requestKey; 38 | 39 | /** 40 | * 事务组id 41 | */ 42 | private String groupId; 43 | 44 | /** 45 | * TxClient标识键 46 | */ 47 | private String remoteKey; 48 | 49 | /** 50 | * 通讯数据 51 | */ 52 | private MessageDto msg; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /yitao-order-webapi/src/main/java/com/gerry/yitao/yitaoorderwebapi/controller/PayNotifyController.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderwebapi.controller; 2 | 3 | import com.alibaba.dubbo.config.annotation.Reference; 4 | import com.gerry.yitao.order.service.OrderService; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.Map; 12 | 13 | /** 14 | * @ProjectName: yitao-parent 15 | * @Auther: GERRY 16 | * @Date: 2019/5/15 16:45 17 | * @Description: 18 | */ 19 | @RestController 20 | @Slf4j 21 | public class PayNotifyController { 22 | 23 | @Reference(timeout = 4000, check = false) 24 | private OrderService orderService; 25 | 26 | @PostMapping(value = "/wxpay/notify",produces = "application/xml") 27 | public ResponseEntity payNotify(@RequestBody Map msg) { 28 | //处理回调结果 29 | orderService.handleNotify(msg); 30 | // 没有异常,则返回成功 31 | String result = "\n" + 32 | " \n" + 33 | " \n" + 34 | ""; 35 | return ResponseEntity.ok(result); 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/DTXInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | /** 23 | * Description: 24 | * Date: 2018/12/24 25 | * 26 | * @author ujued 27 | */ 28 | @AllArgsConstructor 29 | @NoArgsConstructor 30 | @Data 31 | public class DTXInfo { 32 | 33 | /** 34 | * 本周处理事务数量 35 | */ 36 | private long dtxCount; 37 | 38 | /** 39 | * 本周失败的事务数量 40 | */ 41 | private int errorDtxCount; 42 | 43 | /** 44 | * 今天事务数量 45 | */ 46 | private int todayDtxCount; 47 | 48 | /** 49 | * 今天失败的事务数量 50 | */ 51 | private int todayErrorDtxCount; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /yitao-seller-interface/src/main/java/com/gerry/yitao/seller/service/GoodsService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seller.service; 2 | 3 | import com.gerry.yitao.domain.SeckillGoods; 4 | import com.gerry.yitao.domain.Sku; 5 | import com.gerry.yitao.domain.Spu; 6 | import com.gerry.yitao.domain.SpuDetail; 7 | import com.gerry.yitao.entity.PageResult; 8 | import com.gerry.yitao.seller.bo.SeckillParameter; 9 | import com.gerry.yitao.seller.dto.CartDto; 10 | 11 | import java.text.ParseException; 12 | import java.util.List; 13 | 14 | public interface GoodsService { 15 | PageResult querySpuByPage(Integer page, Integer rows, String key, Boolean saleable); 16 | 17 | SpuDetail querySpuDetailBySpuId(Long spuId); 18 | 19 | List querySkuBySpuId(Long spuId); 20 | 21 | void deleteGoodsBySpuId(Long spuId); 22 | 23 | void addGoods(Spu spu); 24 | 25 | void updateGoods(Spu spu); 26 | 27 | void handleSaleable(Spu spu); 28 | 29 | Spu querySpuBySpuId(Long spuId); 30 | 31 | List querySkusByIds(List ids); 32 | 33 | void decreaseStock(List cartDtos); 34 | 35 | ///////// 秒杀 ///////////////// 36 | /** 37 | * 查询秒杀商品 38 | * @return 39 | */ 40 | List querySeckillGoods(); 41 | 42 | /** 43 | * 添加秒杀商品 44 | * @param seckillParameter 45 | */ 46 | void addSeckillGoods(SeckillParameter seckillParameter) throws ParseException; 47 | } 48 | -------------------------------------------------------------------------------- /yitao-seller-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | hikari: 5 | auto-commit: true 6 | connection-test-query: SELECT 1 7 | connection-timeout: 30000 8 | idle-timeout: 30000 9 | max-lifetime: 1800000 10 | maximum-pool-size: 15 11 | minimum-idle: 5 12 | pool-name: DatebookHikariCP 13 | password: 123 14 | type: com.zaxxer.hikari.HikariDataSource 15 | url: jdbc:mysql://192.168.3.121:3306/orange?useSSL=false&serverTimezone=UTC 16 | username: root 17 | rabbitmq: 18 | host: 192.168.3.201 19 | username: test 20 | password: test 21 | virtual-host: / 22 | template: 23 | retry: 24 | enabled: true 25 | initial-interval: 10000ms 26 | max-interval: 30000ms 27 | multiplier: 2 28 | exchange: yt.item.exchange 29 | publisher-confirms: true 30 | redis: 31 | host: 192.168.3.201 32 | port: 6379 33 | password: redis-01 34 | application: 35 | name: seller-service 36 | dubbo: 37 | application: 38 | name: yitao-seller-service 39 | qos-enable: false 40 | protocol: 41 | port: 20880 42 | registry: 43 | address: zookeeper://192.168.3.201:2181 44 | # address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 45 | logging: 46 | level: 47 | com.gerry.yitao.mapper: debug 48 | server: 49 | port: 5555 -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/Spu.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import lombok.Data; 5 | import tk.mybatis.mapper.annotation.KeySql; 6 | 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | import javax.persistence.Transient; 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | import java.util.List; 13 | 14 | /** 15 | * @ProjectName: yitao-parent 16 | * @Auther: GERRY 17 | * @Date: 2019/4/15 21:41 18 | * @Description: 19 | */ 20 | @Table(name = "tb_spu") 21 | @Data 22 | public class Spu implements Serializable { 23 | 24 | private static final long serialVersionUID = -1223915015811104991L; 25 | @Id 26 | @KeySql(useGeneratedKeys = true) 27 | private Long id; 28 | private String title; 29 | private String subTitle; 30 | private Long cid1; 31 | private Long cid2; 32 | private Long cid3; 33 | private Long brandId; 34 | private Boolean saleable; 35 | private Boolean valid; 36 | private Date createTime; 37 | 38 | @JsonIgnore 39 | private Date lastUpdateTime; 40 | 41 | 42 | //spu所属的分类名称 43 | @Transient 44 | private String cname; 45 | 46 | //spu所属品牌名 47 | @Transient 48 | private String bname; 49 | 50 | //spu详情 51 | @Transient 52 | private SpuDetail spuDetail; 53 | 54 | //sku集合 55 | @Transient 56 | private List skus; 57 | } 58 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/auth/sauth/token/TokenStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.auth.sauth.token; 17 | 18 | /** 19 | * Description: 20 | * Date: 2018/11/23 21 | * 22 | * @author ujued 23 | */ 24 | public interface TokenStorage { 25 | 26 | /** 27 | * has token 28 | * 29 | * @param token token 30 | * @return bool 31 | */ 32 | boolean exist(String token); 33 | 34 | /** 35 | * add token 36 | * 37 | * @param token token 38 | */ 39 | void add(String token); 40 | 41 | /** 42 | * remove token 43 | * 44 | * @param token token 45 | */ 46 | void remove(String token); 47 | 48 | /** 49 | * del all 50 | */ 51 | void clear(); 52 | } 53 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /yitao-order-service/src/main/java/com/gerry/yitao/yitaoorderservice/config/WxPayConfig.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoorderservice.config; 2 | 3 | import com.github.wxpay.sdk.WXPayConfig; 4 | import lombok.Data; 5 | import lombok.extern.slf4j.Slf4j; 6 | 7 | import java.io.File; 8 | import java.io.FileInputStream; 9 | import java.io.FileNotFoundException; 10 | import java.io.InputStream; 11 | 12 | /** 13 | * @ProjectName: yitao-parent 14 | * @Auther: GERRY 15 | * @Date: 2019/5/15 15:24 16 | * @Description: 17 | */ 18 | @Data 19 | @Slf4j 20 | public class WxPayConfig implements WXPayConfig { 21 | 22 | private String appID; //公众账号ID 23 | 24 | private String mchID; //商户号 25 | 26 | private String key; //生成签名的密钥 27 | 28 | private String certPath; // API证书绝对路径 29 | 30 | private int httpConnectTimeoutMs=8000; //连接超时时间 31 | 32 | private int httpReadTimeoutMs=10000; //读取超时时间 33 | 34 | private String notifyUrl;// 下单通知回调地址 35 | 36 | 37 | /** 38 | * 获取商户证书内容 39 | * 40 | * @return 商户证书内容 41 | */ 42 | @Override 43 | public InputStream getCertStream() { 44 | File certFile = new File(certPath); 45 | InputStream inputStream = null; 46 | try { 47 | inputStream = new FileInputStream(certFile); 48 | } catch (FileNotFoundException e) { 49 | log.error("cert file not found, path={}, exception is:{}", certPath, e); 50 | } 51 | return inputStream; 52 | } 53 | } -------------------------------------------------------------------------------- /yitao-order-interface/src/main/java/com/gerry/yitao/order/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.order.service; 2 | 3 | import com.gerry.yitao.common.entity.UserInfo; 4 | import com.gerry.yitao.order.dto.OrderDto; 5 | import com.gerry.yitao.domain.Order; 6 | import com.gerry.yitao.entity.PageResult; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/5/14 19:40 14 | * @Description: 订单服务接口 15 | */ 16 | public interface OrderService { 17 | 18 | String KEY_PAY_PREFIX = "order:pay:url:"; 19 | 20 | /** 21 | * 创建订单 22 | * @param orderDto 23 | * @return 24 | */ 25 | Long createOrder(OrderDto orderDto, UserInfo user); 26 | 27 | /** 28 | * 生成支付链接 29 | * @param orderId 30 | * @return 31 | */ 32 | String generateUrl(Long orderId, UserInfo user); 33 | 34 | /** 35 | * 根据订单号,查询订单信息 36 | * @param orderId 37 | * @return 38 | */ 39 | Order queryById(Long orderId); 40 | 41 | /** 42 | * 根据订单编号查询订单状态码 43 | * @param orderId 44 | * @return 45 | */ 46 | Integer queryOrderStateByOrderId(Long orderId); 47 | 48 | /** 49 | * 处理回到通知 50 | * @param msg 51 | */ 52 | void handleNotify(Map msg); 53 | 54 | /** 55 | * 分页查询订单信息 56 | * @param page 57 | * @param rows 58 | * @return 59 | */ 60 | PageResult queryOrderByPage(Integer page, Integer rows); 61 | } 62 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/vo/TxManagerLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.vo; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | /** 23 | * Description: 24 | * Date: 2018/12/24 25 | * 26 | * @author ujued 27 | */ 28 | @AllArgsConstructor 29 | @NoArgsConstructor 30 | @Data 31 | public class TxManagerLog { 32 | private Long id; 33 | /** 34 | * 事务组ID 35 | */ 36 | private String groupId; 37 | 38 | /** 39 | * 事务单元ID 40 | */ 41 | private String unitId; 42 | 43 | /** 44 | * TAG 45 | */ 46 | private String tag; 47 | 48 | /** 49 | * 日志内容 50 | */ 51 | private String content; 52 | 53 | /** 54 | * 创建时间 55 | */ 56 | private String createTime; 57 | } 58 | -------------------------------------------------------------------------------- /yitao-search-interface/src/main/java/com/gerry/yitao/search/entity/Goods.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.search.entity; 2 | 3 | import lombok.Data; 4 | import org.springframework.data.annotation.Id; 5 | import org.springframework.data.elasticsearch.annotations.Document; 6 | import org.springframework.data.elasticsearch.annotations.Field; 7 | import org.springframework.data.elasticsearch.annotations.FieldType; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | import java.util.Map; 12 | import java.util.Set; 13 | 14 | /** 15 | * @ProjectName: yitao-parent 16 | * @Auther: GERRY 17 | * @Date: 2019/4/23 18:21 18 | * @Description: 19 | */ 20 | @Data 21 | @Document(indexName = "goods", type = "docs", shards = 1, replicas = 1) 22 | public class Goods implements Serializable { 23 | @Id 24 | private Long id; //SpuId 25 | 26 | @Field(type = FieldType.Text, analyzer = "ik_max_word") 27 | private String all; //所有需要被搜索的信息,包括品牌,分类,标题 28 | 29 | @Field(type = FieldType.Keyword, index = false) 30 | private String subtitle; //子标题 31 | 32 | private Long brandId; 33 | private Long cid1; 34 | private Long cid2; 35 | private Long cid3; 36 | 37 | private Date createTime; 38 | private Set price; //是所有sku的价格集合。方便根据价格进行筛选过滤 39 | 40 | @Field(type = FieldType.Keyword, index = false) 41 | private String skus; //sku信息的json结构数据 42 | private Map specs; //可搜索的规格参数,key是参数名,值是参数值 43 | 44 | } 45 | -------------------------------------------------------------------------------- /yitao-cart-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-cart-interface 13 | 14 | yitao-cart-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-domain 20 | 21 | 22 | 23 | com.gerry.yitao 24 | yitao-common 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-data-redis 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-amqp 35 | 36 | 37 | 38 | org.projectlombok 39 | lombok 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /yitao-user-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-user-interface 13 | 14 | yitao-user-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-common 20 | 21 | 22 | 23 | com.gerry.yitao 24 | yitao-domain 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-data-redis 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-amqp 35 | 36 | 37 | 38 | org.projectlombok 39 | lombok 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/src/main/java/com/gerry/yitao/yitaoseckillwebapi/config/MvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoseckillwebapi.config; 2 | 3 | import com.gerry.yitao.yitaoseckillwebapi.filter.AccessInterceptor; 4 | import com.gerry.yitao.yitaoseckillwebapi.filter.LoginInterceptor; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * @ProjectName: yitao-parent 16 | * @Auther: GERRY 17 | * @Date: 2019/5/9 19:09 18 | * @Description: 19 | */ 20 | @Configuration 21 | @EnableConfigurationProperties(JwtProperties.class) 22 | public class MvcConfig implements WebMvcConfigurer { 23 | 24 | @Autowired(required = false) 25 | private JwtProperties props; 26 | 27 | @Autowired 28 | private AccessInterceptor accessInterceptor; 29 | 30 | @Override 31 | public void addInterceptors(InterceptorRegistry registry) { 32 | 33 | List excludePath = new ArrayList<>(); 34 | excludePath.add("/api/seckill/list"); 35 | registry.addInterceptor(new LoginInterceptor(props)) 36 | .addPathPatterns("/**").excludePathPatterns(excludePath); 37 | registry.addInterceptor(accessInterceptor); 38 | } 39 | } -------------------------------------------------------------------------------- /yitao-domain/src/main/java/com/gerry/yitao/domain/SeckillGoods.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.domain; 2 | 3 | import lombok.Data; 4 | import lombok.ToString; 5 | 6 | import javax.persistence.*; 7 | import java.io.Serializable; 8 | import java.util.Date; 9 | 10 | /** 11 | * @ProjectName: yitao-parent 12 | * @Auther: GERRY 13 | * @Date: 2019/4/15 21:41 14 | * @Description: 秒杀商品类 15 | */ 16 | @Data 17 | @ToString 18 | @Table(name = "tb_seckill_sku") 19 | public class SeckillGoods implements Serializable { 20 | 21 | @Id 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) 23 | private Long id; 24 | /** 25 | * 秒杀商品的id 26 | */ 27 | private Long skuId; 28 | /** 29 | * 秒杀开始时间 30 | */ 31 | private Date startTime; 32 | /** 33 | * 秒杀结束时间 34 | */ 35 | private Date endTime; 36 | 37 | /** 38 | * 获取服务端当前时间 39 | */ 40 | @Transient 41 | private Date currentTime; 42 | 43 | /** 44 | * 秒杀价格 45 | */ 46 | private Double seckillPrice; 47 | /** 48 | * 商品标题 49 | */ 50 | private String title; 51 | 52 | /** 53 | * 商品图片 54 | */ 55 | private String image; 56 | 57 | /** 58 | * 是否可以秒杀 59 | */ 60 | private Boolean enable; 61 | 62 | /** 63 | * 秒杀库存 64 | */ 65 | @Transient 66 | private Integer stock; 67 | 68 | /** 69 | * 原价 70 | */ 71 | @Transient 72 | private Double price; 73 | 74 | /** 75 | * 秒杀总数 76 | */ 77 | @Transient 78 | private Integer seckillTotal; 79 | } 80 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/ao/WriteTxExceptionDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.ao; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | /** 23 | * Description: 24 | * Date: 2018/12/18 25 | * 26 | * @author ujued 27 | */ 28 | @AllArgsConstructor 29 | @NoArgsConstructor 30 | @Data 31 | public class WriteTxExceptionDTO { 32 | private String groupId; 33 | private String unitId; 34 | private String modId; 35 | private Integer transactionState; 36 | private Short registrar; 37 | private String remark; 38 | 39 | public WriteTxExceptionDTO(String groupId, String unitId, String modId, Integer transactionState) { 40 | this.groupId = groupId; 41 | this.unitId = unitId; 42 | this.transactionState = transactionState; 43 | this.modId = modId; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /yitao-seckill-webapi/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.gerry.yitao 7 | yitao-parent 8 | 1.0-SNAPSHOT 9 | 10 | yitao-seckill-webapi 11 | yitao-seckill-webapi 12 | 13 | 14 | 15 | 16 | com.gerry.yitao 17 | yitao-common 18 | 19 | 20 | 21 | com.gerry.yitao 22 | yitao-seckill-interface 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | 31 | com.alibaba.boot 32 | dubbo-spring-boot-starter 33 | 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-test 38 | test 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /yitao-mapper/src/main/java/com/gerry/yitao/mapper/BrandMapper.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.mapper; 2 | 3 | import com.gerry.yitao.domain.Brand; 4 | import com.gerry.yitao.domain.Category; 5 | import org.apache.ibatis.annotations.Delete; 6 | import org.apache.ibatis.annotations.Insert; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.apache.ibatis.annotations.Select; 9 | import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper; 10 | import tk.mybatis.mapper.common.Mapper; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * @ProjectName: yitao-parent 16 | * @Auther: GERRY 17 | * @Date: 2019/4/14 15:16 18 | * @Description: 品牌Mapper 19 | * 20 | * in 子查询 in (1,3,4,6,7) 21 | * exists / not exists (循环嵌套) 22 | */ 23 | 24 | public interface BrandMapper extends Mapper, SelectByIdListMapper { 25 | // 第二期课程(就业基础内容) 26 | // mybatis 注解【如果需要处理2个参数必须加@Param注解,如果一个可加可不加】 27 | @Insert("insert into tb_category_brand (category_id, brand_id) values (#{cid}, #{bid})") 28 | int saveCategoryBrand(@Param("cid") Long cid, @Param("bid") Long bid); 29 | 30 | @Select("select * from tb_category where id in (select category_id from tb_category_brand where brand_id = #{bid})") 31 | List queryCategoryByBid(Long bid); 32 | 33 | @Delete("delete from tb_category_brand where brand_id = #{bid}") 34 | int deleteCategoryBrandByBid(Long bid); 35 | 36 | @Select("select * from tb_brand where id in (select brand_id from tb_category_brand where category_id = #{cid})") 37 | List queryBrandByCid(Long cid); 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /yitao-seckill-interface/src/main/java/com/gerry/yitao/seckill/utils/ImageUtil.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.seckill.utils; 2 | 3 | import javax.imageio.ImageIO; 4 | import java.awt.image.BufferedImage; 5 | import java.io.ByteArrayInputStream; 6 | import java.io.ByteArrayOutputStream; 7 | import java.io.IOException; 8 | 9 | /** 10 | * @ProjectName: yitao-parent 11 | * @Auther: GERRY 12 | * @Date: 2019/5/27 15:36 13 | * @Description: 14 | */ 15 | public class ImageUtil { 16 | /** 17 | * 转换BufferedImage 数据为byte数组 18 | * 19 | * @param bImage 20 | * Image对象 21 | * @param format 22 | * image格式字符串.如"gif","png" 23 | * @return byte数组 24 | */ 25 | public static byte[] imageToBytes(BufferedImage bImage, String format) { 26 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 27 | try { 28 | ImageIO.write(bImage, format, out); 29 | } catch (IOException e) { 30 | e.printStackTrace(); 31 | } 32 | return out.toByteArray(); 33 | } 34 | 35 | /** 36 | * 转换byte数组为BufferedImage 37 | * 38 | * @param bytes 39 | * @return Image 40 | */ 41 | public static BufferedImage bytesToImage(byte[] bytes) { 42 | BufferedImage bufferedImage = null; 43 | ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(bytes); 44 | try { 45 | bufferedImage = ImageIO.read(arrayInputStream); 46 | } catch (IOException e) { 47 | e.printStackTrace(); 48 | } 49 | 50 | return bufferedImage; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/auth/TxManagerAdminAuthLogic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.auth; 17 | 18 | import com.codingapi.txlcn.tm.support.restapi.auth.sauth.DefaultSAuthLogic; 19 | import org.springframework.stereotype.Component; 20 | 21 | import java.util.Arrays; 22 | import java.util.List; 23 | 24 | /** 25 | * Description: 26 | * Date: 2018/12/28 27 | * 28 | * @author ujued 29 | */ 30 | @Component 31 | public class TxManagerAdminAuthLogic extends DefaultSAuthLogic { 32 | 33 | public TxManagerAdminAuthLogic(DefaultTokenStorage tokenStorage) { 34 | super(tokenStorage); 35 | } 36 | 37 | 38 | @Override 39 | public List ignoreUrls() { 40 | return Arrays.asList("/admin/login", "/admin/index*", "/admin/js/*", "/admin/css/*", "/admin/assets/*", 41 | "/assets/*", "/error", "/manager/refresh", "/provider/*", "/"); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/exception/PermissionDeniedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.gerry.yitao.common.exception; 18 | 19 | import org.springframework.http.HttpStatus; 20 | import org.springframework.web.bind.annotation.ResponseStatus; 21 | 22 | /** 23 | * Permission denied exception 24 | */ 25 | @ResponseStatus(value = HttpStatus.UNAUTHORIZED) 26 | public class PermissionDeniedException extends RuntimeException { 27 | 28 | public PermissionDeniedException(String message) { 29 | super(message); 30 | } 31 | 32 | public PermissionDeniedException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | protected PermissionDeniedException() { 37 | super(); 38 | } 39 | } -------------------------------------------------------------------------------- /txlcn-tm/src/main/resources/tx-manager.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : local 5 | Source Server Type : MySQL 6 | Source Server Version : 100309 7 | Source Host : localhost:3306 8 | Source Schema : tx-manager 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 100309 12 | File Encoding : 65001 13 | 14 | Date: 29/12/2018 18:35:59 15 | */ 16 | CREATE DATABASE IF NOT EXISTS `tx-manager` DEFAULT CHARSET utf8 COLLATE utf8_general_ci; 17 | USE `tx-manager`; 18 | 19 | SET NAMES utf8mb4; 20 | SET FOREIGN_KEY_CHECKS = 0; 21 | 22 | -- ---------------------------- 23 | -- Table structure for t_tx_exception 24 | -- ---------------------------- 25 | DROP TABLE IF EXISTS `t_tx_exception`; 26 | CREATE TABLE `t_tx_exception` ( 27 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 28 | `group_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, 29 | `unit_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, 30 | `mod_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, 31 | `transaction_state` tinyint(4) NULL DEFAULT NULL, 32 | `registrar` tinyint(4) NULL DEFAULT NULL, 33 | `ex_state` tinyint(4) NULL DEFAULT NULL COMMENT '0 待处理 1已处理', 34 | `remark` varchar(10240) NULL DEFAULT NULL COMMENT '备注', 35 | `create_time` datetime(0) NULL DEFAULT NULL, 36 | PRIMARY KEY (`id`) USING BTREE 37 | ) ENGINE = InnoDB AUTO_INCREMENT = 967 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; 38 | 39 | SET FOREIGN_KEY_CHECKS = 1; 40 | -------------------------------------------------------------------------------- /yitao-detail-service/src/main/java/com/gerry/yitao/yitaosearchservice/client/BrandClient.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice.client; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.gerry.yitao.common.util.RestTemplateUtils; 6 | import com.gerry.yitao.domain.Brand; 7 | import com.google.common.base.Joiner; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.stereotype.Component; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * @ProjectName: yitao-parent 18 | * @Auther: GERRY 19 | * @Date: 2019/4/23 18:46 20 | * @Description: 21 | */ 22 | @Component 23 | public class BrandClient { 24 | 25 | @Value("${client.url:}") 26 | private String url; 27 | 28 | public Brand queryById(Long id) { 29 | String requestUrl = url+"api/item/brand/{id}"; 30 | ResponseEntity entity = RestTemplateUtils.get(requestUrl,Brand.class,id); 31 | 32 | return entity.getBody(); 33 | } 34 | 35 | public List queryBrandsByIds(List ids) { 36 | String requestUrl = url+"api/item/brand/list?ids={ids}"; 37 | Map params = new HashMap<>(); 38 | params.put("ids", Joiner.on(",").join(ids)); 39 | ResponseEntity entity = RestTemplateUtils.get(requestUrl,List.class,params); 40 | List brands = JSONObject.parseArray(JSON.toJSONString(entity.getBody()), Brand.class); 41 | 42 | return brands; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /yitao-search-service/src/main/java/com/gerry/yitao/yitaosearchservice/client/BrandClient.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaosearchservice.client; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | import com.gerry.yitao.common.util.RestTemplateUtils; 6 | import com.gerry.yitao.domain.Brand; 7 | import com.google.common.base.Joiner; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.stereotype.Component; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * @ProjectName: yitao-parent 18 | * @Auther: GERRY 19 | * @Date: 2019/4/23 18:46 20 | * @Description: 21 | */ 22 | @Component 23 | public class BrandClient { 24 | 25 | @Value("${client.url:}") 26 | private String url; 27 | 28 | public Brand queryById(Long id) { 29 | String requestUrl = url+"api/item/brand/{id}"; 30 | ResponseEntity entity = RestTemplateUtils.get(requestUrl,Brand.class,id); 31 | 32 | return entity.getBody(); 33 | } 34 | 35 | public List queryBrandsByIds(List ids) { 36 | String requestUrl = url+"api/item/brand/list?ids={ids}"; 37 | Map params = new HashMap<>(); 38 | params.put("ids", Joiner.on(",").join(ids)); 39 | ResponseEntity entity = RestTemplateUtils.get(requestUrl,List.class,params); 40 | List brands = JSONObject.parseArray(JSON.toJSONString(entity.getBody()), Brand.class); 41 | 42 | return brands; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /yitao-auth-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-auth-interface 13 | 14 | yitao-auth-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-common 20 | 21 | 22 | com.gerry.yitao 23 | yitao-domain 24 | 25 | 26 | 27 | io.jsonwebtoken 28 | jjwt 29 | 30 | 31 | 32 | joda-time 33 | joda-time 34 | 35 | 36 | 37 | org.apache.commons 38 | commons-lang3 39 | 40 | 41 | 42 | org.projectlombok 43 | lombok 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /yitao-upload-service/src/test/java/com/gerry/yitao/yitaouploadservice/Testts.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadservice; 2 | 3 | import com.gerry.yitao.common.upload.FastdfsClient; 4 | import org.junit.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | 7 | import java.io.*; 8 | 9 | /** 10 | * @ProjectName: yitao-parent 11 | * @Auther: GERRY 12 | * @Date: 2019/4/17 19:03 13 | * @Description: 14 | */ 15 | public class Testts extends YitaoSellerServiceApplicationTests { 16 | @Autowired 17 | private FastdfsClient storageClient; 18 | 19 | @Test 20 | public void test1() throws Exception{ 21 | File file = new File("D:\\hr.jpg"); 22 | String jpg = storageClient.uploadFile(getBytes(file.getCanonicalPath()), file.getName()); 23 | System.out.println(jpg); 24 | } 25 | 26 | private byte[] getBytes(String filePath){ 27 | byte[] buffer = null; 28 | try { 29 | File file = new File(filePath); 30 | FileInputStream fis = new FileInputStream(file); 31 | ByteArrayOutputStream bos = new ByteArrayOutputStream(1000); 32 | byte[] b = new byte[1000]; 33 | int n; 34 | while ((n = fis.read(b)) != -1) { 35 | bos.write(b, 0, n); 36 | } 37 | fis.close(); 38 | bos.close(); 39 | buffer = bos.toByteArray(); 40 | } catch (FileNotFoundException e) { 41 | e.printStackTrace(); 42 | } catch (IOException e) { 43 | e.printStackTrace(); 44 | } 45 | return buffer; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /yitao-order-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.cj.jdbc.Driver 4 | hikari: 5 | auto-commit: true 6 | connection-test-query: SELECT 1 7 | connection-timeout: 30000 8 | idle-timeout: 30000 9 | max-lifetime: 1800000 10 | maximum-pool-size: 15 11 | minimum-idle: 5 12 | pool-name: DatebookHikariCP 13 | password: 123 14 | type: com.zaxxer.hikari.HikariDataSource 15 | url: jdbc:mysql://127.0.0.1:3306/orange?useSSL=false&serverTimezone=UTC 16 | username: root 17 | redis: 18 | host: 192.168.3.172 19 | password: redis-01 20 | rabbitmq: 21 | host: 192.168.3.201 22 | username: test 23 | password: test 24 | virtual-host: / 25 | template: 26 | retry: 27 | enabled: true 28 | initial-interval: 10000ms 29 | max-interval: 30000ms 30 | multiplier: 2 31 | exchange: yt.cart.exchange 32 | publisher-confirms: true 33 | dubbo: 34 | application: 35 | name: yitao-order-service 36 | protocol: 37 | port: 20888 38 | registry: 39 | address: zookeeper://192.168.3.220:2181?backup=192.168.3.221:2181,192.168.3.222:2181 40 | logging: 41 | level: 42 | com.gerry.yitao.mapper: debug 43 | server: 44 | port: 9999 45 | # 调用外部服务接口的前缀 46 | client: 47 | url: http://api.yitao.com/ 48 | yt: 49 | worker: 50 | workerId: 29 51 | dataCenterId: 12 52 | wxpay: 53 | appID: wxfbe9458 54 | mchID: 1516374 55 | key: 5d9f0cc24 56 | certPath: D:/vip/keys/apiclient_cert.p12 57 | notifyUrl: http://zzcgcg.natappfree.cc/wxpay/notify -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/exception/SystemException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.gerry.yitao.common.exception; 18 | 19 | import org.springframework.http.HttpStatus; 20 | import org.springframework.web.bind.annotation.ResponseStatus; 21 | 22 | /** 23 | * System Exception 24 | */ 25 | @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) 26 | public class SystemException extends RuntimeException { 27 | 28 | public SystemException() { 29 | super(); 30 | } 31 | 32 | public SystemException(String message) { 33 | super(message); 34 | } 35 | 36 | public SystemException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public SystemException(Throwable cause) { 41 | super(cause); 42 | } 43 | } -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/common/exception/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.gerry.yitao.common.exception; 18 | 19 | import org.springframework.http.HttpStatus; 20 | import org.springframework.web.bind.annotation.ResponseStatus; 21 | 22 | /** 23 | * Resource not found exception 24 | */ 25 | @ResponseStatus(value = HttpStatus.NOT_FOUND) 26 | public class ResourceNotFoundException extends SystemException { 27 | 28 | public ResourceNotFoundException() { 29 | } 30 | 31 | public ResourceNotFoundException(String message) { 32 | super(message); 33 | } 34 | 35 | public ResourceNotFoundException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | public ResourceNotFoundException(Throwable cause) { 40 | super(cause); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/db/jpa/TxExceptionRepository.java: -------------------------------------------------------------------------------- 1 | package com.codingapi.txlcn.tm.support.db.jpa; 2 | 3 | import com.codingapi.txlcn.tm.support.db.domain.TxException; 4 | import org.springframework.data.domain.Pageable; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 7 | import org.springframework.data.jpa.repository.Modifying; 8 | import org.springframework.data.jpa.repository.Query; 9 | import org.springframework.stereotype.Repository; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @author meetzy 2019-02-14 12:09 15 | */ 16 | @Repository 17 | public interface TxExceptionRepository extends JpaRepository , JpaSpecificationExecutor { 18 | 19 | /** 20 | * find TxException by groupId and unitId 21 | * @param groupId groupId 22 | * @param unitId unitId 23 | * @return TxException 24 | */ 25 | TxException findByGroupIdAndUnitId(String groupId, String unitId); 26 | 27 | /** 28 | * update exSate 29 | * @param id id 30 | * @param state state 31 | */ 32 | @Query(value = "update t_tx_exception set ex_state=?2 where id=?1",nativeQuery = true) 33 | @Modifying 34 | void changeExState(Long id, short state); 35 | 36 | /** 37 | * find status 38 | * @param page page need one 39 | * @param groupId groupId 40 | * @return list get(0) 41 | */ 42 | @Query(value = "select transaction_state from t_tx_exception where group_id=?1",nativeQuery = true) 43 | List getTransactionStateByGroupId(String groupId,Pageable page); 44 | } 45 | -------------------------------------------------------------------------------- /txlcn-tm/src/test/java/com/codingapi/txlcn/tm/TestFastStorage.java: -------------------------------------------------------------------------------- 1 | package com.codingapi.txlcn.tm; 2 | 3 | import com.codingapi.txlcn.common.exception.FastStorageException; 4 | import com.codingapi.txlcn.common.util.Maps; 5 | import com.codingapi.txlcn.tm.core.storage.FastStorage; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.data.redis.core.RedisTemplate; 11 | import org.springframework.test.context.junit4.SpringRunner; 12 | 13 | /** 14 | * Description: 15 | * Date: 19-1-31 上午10:26 16 | * 17 | * @author ujued 18 | */ 19 | @RunWith(SpringRunner.class) 20 | @SpringBootTest(classes = TMApplication.class) 21 | public class TestFastStorage { 22 | 23 | @Autowired 24 | private FastStorage fastStorage; 25 | 26 | @Autowired 27 | private RedisTemplate redisTemplate; 28 | 29 | @Autowired 30 | private RedisTemplate stringStringRedisTemplate; 31 | 32 | @Test 33 | public void testMacId() throws FastStorageException { 34 | 35 | } 36 | 37 | @Test 38 | public void testMutiSetIf() { 39 | Boolean result = redisTemplate.opsForValue().multiSetIfAbsent(Maps.newHashMap("a", 1, "b", 2, "c", 3)); 40 | System.out.println(result); 41 | } 42 | 43 | @Test 44 | public void testRedisInc(){ 45 | stringStringRedisTemplate.opsForValue().setIfAbsent("o", "1"); 46 | stringStringRedisTemplate.opsForValue().increment("o", 1); 47 | System.out.println(stringStringRedisTemplate.opsForValue().get("o")); 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /yitao-common/src/main/java/com/gerry/yitao/response/CodeMsg.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.response; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.ToString; 7 | 8 | /** 9 | * @ProjectName: yitao-parent 10 | * @Auther: GERRY 11 | * @Date: 2019/5/14 14:00 12 | * @Description: 返回状态码 13 | */ 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @ToString 18 | public class CodeMsg { 19 | 20 | private int code; 21 | private String msg; 22 | 23 | /** 24 | * 通用的错误码 25 | */ 26 | public static CodeMsg SUCCESS = new CodeMsg(0, "success"); 27 | public static CodeMsg SERVER_ERROR = new CodeMsg(500100, "服务端异常"); 28 | public static CodeMsg BIND_ERROR = new CodeMsg(500101, "参数校验异常:%s"); 29 | public static CodeMsg REQUEST_ILLEGAL = new CodeMsg(500102, "非法请求"); 30 | public static CodeMsg ACCESS_LIMIT_REACHED= new CodeMsg(500104, "访问太频繁!"); 31 | 32 | /** 33 | * 登录模块 5002XX 34 | */ 35 | //登录模块 5002XX 36 | public static CodeMsg SESSION_ERROR = new CodeMsg(500210, "Session不存在或者已经失效"); 37 | public static CodeMsg LOGIN_ERROR = new CodeMsg(500210, "用户未登录"); 38 | 39 | 40 | /** 41 | * 秒杀模块 5005XX 42 | */ 43 | public static CodeMsg MIAO_SHA_OVER = new CodeMsg(500500, "商品已经秒杀完毕"); 44 | public static CodeMsg REPEATE_MIAOSHA = new CodeMsg(500501, "不能重复秒杀"); 45 | public static CodeMsg MIAOSHA_FAIL = new CodeMsg(500502, "秒杀失败"); 46 | 47 | 48 | public CodeMsg fillArgs(Object... args) { 49 | int code = this.code; 50 | String message = String.format(this.msg, args); 51 | return new CodeMsg(code, message); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /yitao-cart-service/src/main/java/com/gerry/yitao/yitaocartservice/listener/CartListener.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaocartservice.listener; 2 | 3 | import com.gerry.yitao.cart.service.CartService; 4 | import com.gerry.yitao.common.util.JsonUtils; 5 | import org.springframework.amqp.core.ExchangeTypes; 6 | import org.springframework.amqp.rabbit.annotation.Exchange; 7 | import org.springframework.amqp.rabbit.annotation.Queue; 8 | import org.springframework.amqp.rabbit.annotation.QueueBinding; 9 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * @ProjectName: yitao-parent 18 | * @Auther: GERRY 19 | * @Date: 2019/5/3 19:10 20 | * @Description: 异步删除购物车商品信息 21 | */ 22 | @Component 23 | public class CartListener { 24 | 25 | @Autowired(required = false) 26 | private CartService cartService; 27 | 28 | @RabbitListener(bindings = @QueueBinding( 29 | value = @Queue(name = "yt.cart.delete.queue", durable = "true"), 30 | exchange = @Exchange(name = "yt.cart.exchange", 31 | type = ExchangeTypes.TOPIC, 32 | ignoreDeclarationExceptions = "true"), 33 | key = {"cart.delete"} 34 | )) 35 | public void listenDelete(String params) { 36 | Map map = JsonUtils.toMap(params, String.class, Object.class); 37 | List ids = (List) map.get("skuIds"); 38 | Integer userId = (Integer) map.get("userId"); 39 | cartService.deleteCarts(ids, userId); 40 | } 41 | } -------------------------------------------------------------------------------- /yitao-upload-webapi/src/main/java/com/gerry/yitao/yitaouploadwebapi/controller/UploadController.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaouploadwebapi.controller; 2 | 3 | import com.alibaba.dubbo.config.annotation.Reference; 4 | import com.gerry.yitao.upload.bo.UploadBo; 5 | import com.gerry.yitao.upload.service.UploadService; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.*; 8 | import org.springframework.web.multipart.MultipartFile; 9 | 10 | import java.io.IOException; 11 | 12 | /** 13 | * @ProjectName: yitao-parent 14 | * @Auther: GERRY 15 | * @Date: 2019/4/17 18:31 16 | * @Description: 17 | */ 18 | @RestController 19 | @RequestMapping("api/upload") 20 | public class UploadController { 21 | 22 | @Reference(check = false, timeout = 40000) 23 | private UploadService uploadService; 24 | 25 | 26 | /** 27 | * 图片的上传 28 | * 29 | * @param file 30 | * @return 31 | */ 32 | @PostMapping("image") 33 | public ResponseEntity uploadImage(UploadBo uploadBo, @RequestParam("file") MultipartFile file) throws IOException { 34 | uploadBo.setBytes(file.getBytes()); 35 | uploadBo.setContentType(file.getContentType()); 36 | uploadBo.setFileName(file.getOriginalFilename()); 37 | 38 | return ResponseEntity.ok(uploadService.uploadImage(uploadBo)); 39 | } 40 | 41 | /** 42 | * 删除图片 43 | * 44 | * @param path 45 | * @return 46 | */ 47 | @GetMapping("delete") 48 | public ResponseEntity delete(@RequestParam("path") String path) throws IOException { 49 | 50 | return ResponseEntity.ok(uploadService.deleteImage(path).toString()); 51 | } 52 | } -------------------------------------------------------------------------------- /yitao-order-interface/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | yitao-parent 7 | com.gerry.yitao 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yitao-order-interface 13 | 14 | yitao-order-interface 15 | 16 | 17 | 18 | com.gerry.yitao 19 | yitao-domain 20 | 21 | 22 | 23 | com.gerry.yitao 24 | yitao-common 25 | 26 | 27 | 28 | com.gerry.yitao 29 | yitao-seller-interface 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-data-redis 35 | 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-amqp 40 | 41 | 42 | 43 | org.projectlombok 44 | lombok 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /yitao-auth-service/src/main/java/com/gerry/yitao/yitaoauthservice/service/AuthServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.gerry.yitao.yitaoauthservice.service; 2 | 3 | import com.alibaba.dubbo.config.annotation.Service; 4 | import com.gerry.yitao.auth.entity.JwtProperties; 5 | import com.gerry.yitao.auth.service.AuthService; 6 | import com.gerry.yitao.common.entity.UserInfo; 7 | import com.gerry.yitao.common.exception.ServiceException; 8 | import com.gerry.yitao.common.util.JwtUtils; 9 | import com.gerry.yitao.domain.User; 10 | import com.gerry.yitao.yitaoauthservice.client.UserClient; 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | 14 | /** 15 | * @ProjectName: yitao-parent 16 | * @Auther: GERRY 17 | * @Date: 2019/5/6 19:10 18 | * @Description: 19 | */ 20 | @Slf4j 21 | @Service(timeout = 40000) 22 | public class AuthServiceImpl implements AuthService { 23 | @Autowired 24 | private UserClient userClient; 25 | 26 | @Autowired(required = false) 27 | private JwtProperties props; 28 | 29 | public String login(String username, String password) { 30 | try { 31 | User user = userClient.queryUser(username, password); 32 | if (user == null) { 33 | return null; 34 | } 35 | UserInfo userInfo = new UserInfo(user.getId(), user.getUsername()); 36 | //生成Token 37 | String token = JwtUtils.generateToken(userInfo, props.getPrivateKey(), props.getExpire()); 38 | 39 | return token; 40 | } catch (Exception e) { 41 | log.error("【授权中心】用户名和密码错误,用户名:{}", username,e); 42 | throw new ServiceException("用户名或者密码输入错误"); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /txlcn-tm/src/main/java/com/codingapi/txlcn/tm/support/restapi/auth/sauth/SAuthLogic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 CodingApi . 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * 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, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.codingapi.txlcn.tm.support.restapi.auth.sauth; 17 | 18 | 19 | import javax.servlet.http.HttpServletRequest; 20 | import java.util.Collections; 21 | import java.util.List; 22 | 23 | /** 24 | * Description: 25 | * Date: 2018/11/23 26 | * 27 | * @author ujued 28 | */ 29 | public interface SAuthLogic { 30 | 31 | /** 32 | * ignore path 33 | * 34 | * @return list 35 | */ 36 | default List ignoreUrls() { 37 | return Collections.emptyList(); 38 | } 39 | 40 | /** 41 | * is ignore 42 | * 43 | * @param request request 44 | * @return bool 45 | * @throws SAuthHandleException SAuthHandleException 46 | */ 47 | default boolean isIgnored(HttpServletRequest request) throws SAuthHandleException { 48 | return false; 49 | } 50 | 51 | /** 52 | * verify token 53 | * 54 | * @param token token 55 | * @return bool 56 | */ 57 | boolean verify(String token); 58 | } 59 | --------------------------------------------------------------------------------