├── psd-gateway ├── src │ └── main │ │ ├── resources │ │ ├── application-prod.yml │ │ ├── application-test.yml │ │ ├── bootstrap.yml │ │ ├── application-dev.yml │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── gateway │ │ ├── GatewayServiceApplication.java │ │ ├── config │ │ ├── CROSConfig.java │ │ ├── JwtConfig.java │ │ └── SecurityTokenConfig.java │ │ ├── router │ │ └── Router.java │ │ └── web │ │ └── GateWayController.java ├── out │ └── production │ │ └── resources │ │ ├── bootstrap.yml │ │ └── application.yml ├── Dockerfile └── build.gradle ├── psd-web-auth ├── src │ ├── main │ │ ├── resources │ │ │ ├── application-prod.yml │ │ │ ├── application-test.yml │ │ │ ├── bootstrap.yml │ │ │ ├── application-dev.yml │ │ │ ├── mapper │ │ │ │ └── MemberMapper.xml │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── yoke │ │ │ └── poseidon │ │ │ └── auth │ │ │ ├── service │ │ │ ├── ConvertService.java │ │ │ └── MemberService.java │ │ │ ├── mapper │ │ │ └── MemberMapper.java │ │ │ ├── AuthApplication.java │ │ │ ├── serviceImpl │ │ │ ├── ConvertServiceImpl.java │ │ │ ├── MemberServiceImpl.java │ │ │ └── SecurityUserDetailsService.java │ │ │ ├── cache │ │ │ └── ApplicationContextHolder.java │ │ │ └── config │ │ │ ├── JwtConfig.java │ │ │ └── SecurityConfiguration.java │ └── test │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── auth │ │ └── serviceImpl │ │ └── MemberServiceImplTest.java ├── settings.gradle ├── Dockerfile └── build.gradle ├── psd-web-es ├── src │ ├── main │ │ ├── resources │ │ │ ├── application-test.yml │ │ │ ├── bootstrap.yml │ │ │ ├── application-prod.yml │ │ │ ├── application.yml │ │ │ └── application-dev.yml │ │ └── java │ │ │ └── com │ │ │ └── yoke │ │ │ └── poseidon │ │ │ └── elasticsearch │ │ │ ├── config │ │ │ └── JSONConfig.java │ │ │ ├── fallback │ │ │ └── ItemFallback.java │ │ │ ├── feign │ │ │ └── ItemFeign.java │ │ │ ├── web │ │ │ ├── ESItem.http │ │ │ └── ItemController.java │ │ │ ├── dao │ │ │ └── ItemRepository.java │ │ │ ├── ElasticSearchApplication.java │ │ │ ├── service │ │ │ └── ItemService.java │ │ │ └── dto │ │ │ ├── Message.java │ │ │ └── ItemDto.java │ └── test │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── elasticsearch │ │ └── dao │ │ └── CustomerRepositoryTest.java └── build.gradle ├── psd-web-order ├── src │ └── main │ │ ├── resources │ │ ├── application-test.yml │ │ ├── bootstrap.yml │ │ ├── application-prod.yml │ │ ├── application-dev.yml │ │ ├── mapper │ │ │ ├── AddressMapper.xml │ │ │ ├── OrderItemMapper.xml │ │ │ └── OrderMapper.xml │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── order │ │ ├── constants │ │ └── OrderConstant.java │ │ ├── mapper │ │ ├── AddressMapper.java │ │ ├── OrderItemMapper.java │ │ └── OrderMapper.java │ │ ├── service │ │ ├── AddressService.java │ │ ├── OrderItemService.java │ │ ├── ConvertService.java │ │ └── OrderService.java │ │ ├── web │ │ ├── AddressController.java │ │ ├── OrderItemController.java │ │ └── orderRequest.http │ │ ├── serviceImpl │ │ ├── AddressServiceImpl.java │ │ ├── OrderItemServiceImpl.java │ │ └── ConvertServiceImpl.java │ │ ├── config │ │ ├── MybatisPlusConfig.java │ │ └── SwaggerConfig.java │ │ ├── OrderApplication.java │ │ ├── cache │ │ └── ApplicationContextHolder.java │ │ ├── dto │ │ ├── AddressDto.java │ │ ├── Message.java │ │ └── OrderItemDto.java │ │ └── entity │ │ ├── Address.java │ │ └── OrderItem.java └── Dockerfile ├── psd-web-view ├── src │ ├── main │ │ ├── resources │ │ │ ├── application-test.yml │ │ │ ├── bootstrap.yml │ │ │ ├── application-prod.yml │ │ │ ├── application-dev.yml │ │ │ ├── mapper │ │ │ │ ├── ItemAttributeNameMapper.xml │ │ │ │ ├── ItemAttributeValueMapper.xml │ │ │ │ ├── ItemSkuMapper.xml │ │ │ │ ├── PanelContentMapper.xml │ │ │ │ └── PanelMapper.xml │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── yoke │ │ │ └── poseidon │ │ │ └── web │ │ │ └── itemShow │ │ │ ├── Main.java │ │ │ ├── mapper │ │ │ ├── ItemSkuMapper.java │ │ │ ├── ItemAttributeValueMapper.java │ │ │ ├── ItemAttributeNameMapper.java │ │ │ ├── PanelContentMapper.java │ │ │ ├── PanelMapper.java │ │ │ ├── ItemCatMapper.java │ │ │ └── ItemMapper.java │ │ │ ├── service │ │ │ ├── ItemAttributeValueService.java │ │ │ ├── ItemAttributeNameService.java │ │ │ ├── PanelContentService.java │ │ │ ├── ItemSkuService.java │ │ │ ├── ConvertService.java │ │ │ ├── ItemService.java │ │ │ ├── PanelService.java │ │ │ └── ItemCatService.java │ │ │ ├── web │ │ │ ├── PanelContentController.java │ │ │ ├── ItemAttributeNameController.java │ │ │ ├── ItemAttributeValueController.java │ │ │ ├── ItemSkuController.java │ │ │ └── ItemCatController.java │ │ │ ├── config │ │ │ ├── JSONConfig.java │ │ │ ├── RabbitmqConfig.java │ │ │ ├── SwaggerConfig.java │ │ │ └── JwtConfig.java │ │ │ ├── serviceImpl │ │ │ ├── ItemAttributeNameServiceImpl.java │ │ │ ├── ItemAttributeValueServiceImpl.java │ │ │ ├── PanelContentServiceImpl.java │ │ │ ├── ItemSkuServiceImpl.java │ │ │ └── ConvertServiceImpl.java │ │ │ ├── entity │ │ │ ├── ItemAttribute.java │ │ │ ├── ItemAttributeName.java │ │ │ ├── ItemAttributeValue.java │ │ │ ├── ItemSku.java │ │ │ ├── PanelContent.java │ │ │ └── Panel.java │ │ │ ├── ItemShowServiceApplication.java │ │ │ ├── cache │ │ │ └── ApplicationContextHolder.java │ │ │ ├── event │ │ │ └── EventDispatcher.java │ │ │ └── dto │ │ │ ├── PanelContentDto.java │ │ │ ├── Message.java │ │ │ ├── PanelDto.java │ │ │ └── ItemCatDto.java │ └── test │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── web │ │ └── itemShow │ │ └── serviceImpl │ │ ├── ItemCatServiceImplTest.java │ │ └── PanelServiceImplTest.java └── Dockerfile ├── psd-web-member ├── src │ └── main │ │ ├── resources │ │ ├── application-test.yml │ │ ├── bootstrap.yml │ │ ├── application-prod.yml │ │ ├── application-dev.yml │ │ ├── mapper │ │ │ └── MemberMapper.xml │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── member │ │ ├── service │ │ ├── ConvertService.java │ │ └── MemberService.java │ │ ├── web │ │ ├── member.http │ │ └── MemberController.java │ │ ├── mapper │ │ └── MemberMapper.java │ │ ├── MemberApplication.java │ │ ├── serviceImpl │ │ ├── ConvertServiceImpl.java │ │ └── MemberServiceImpl.java │ │ ├── config │ │ └── SwaggerConfig.java │ │ ├── cache │ │ └── ApplicationContextHolder.java │ │ └── dto │ │ └── Message.java ├── out │ └── production │ │ ├── resources │ │ ├── application-test.yml │ │ ├── bootstrap.yml │ │ ├── application-prod.yml │ │ ├── application-dev.yml │ │ ├── mapper │ │ │ └── MemberMapper.xml │ │ └── application.yml │ │ └── classes │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── member │ │ ├── dto │ │ ├── Message.class │ │ └── MemberDto.class │ │ ├── entity │ │ └── Member.class │ │ ├── MemberApplication.class │ │ ├── cache │ │ ├── RedisCache.class │ │ └── ApplicationContextHolder.class │ │ ├── mapper │ │ └── MemberMapper.class │ │ ├── config │ │ └── SwaggerConfig.class │ │ ├── service │ │ ├── ConvertService.class │ │ └── MemberService.class │ │ ├── web │ │ └── MemberController.class │ │ └── serviceImpl │ │ ├── MemberServiceImpl.class │ │ └── ConvertServiceImpl.class └── Dockerfile ├── psd-web-shop-cart ├── src │ ├── main │ │ ├── resources │ │ │ ├── application-prod.yml │ │ │ ├── application-test.yml │ │ │ ├── bootstrap.yml │ │ │ ├── application-dev.yml │ │ │ ├── mapper │ │ │ │ └── ItemCartMapper.xml │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── yoke │ │ │ └── poseidon │ │ │ └── cart │ │ │ ├── mapper │ │ │ └── ItemCartMapper.java │ │ │ ├── service │ │ │ ├── ConvertService.java │ │ │ └── ItemCartService.java │ │ │ ├── ItemCartApplication.java │ │ │ ├── config │ │ │ └── SwaggerConfig.java │ │ │ ├── cache │ │ │ └── ApplicationContextHolder.java │ │ │ ├── serviceImpl │ │ │ └── ConvertServiceImpl.java │ │ │ └── dto │ │ │ └── Message.java │ └── test │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── cart │ │ └── serviceImpl │ │ └── ItemCartServiceImplTest.java └── Dockerfile ├── psd-generate ├── src │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── gateway │ │ └── generate │ │ └── CodeGeneration.java └── build.gradle ├── doc └── img │ ├── cart.png │ ├── db.png │ ├── item.png │ ├── index.png │ ├── order.png │ └── personalCenter.png ├── psd-config ├── src │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── config │ │ ├── SpringEurekaConfigApp.java │ │ └── jwt │ │ └── JwtConfig.java └── build.gradle ├── psd-discovery ├── src │ └── main │ │ ├── resources │ │ ├── bootstrap.yml │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── yoke │ │ └── poseidon │ │ └── gateway │ │ └── discovery │ │ └── EurekaServerApplication.java ├── Dockerfile └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── config.env ├── .idea └── vcs.xml ├── settings.gradle ├── config └── checkstyle │ └── checkstyle.xml ├── .gitignore ├── gradlew.bat └── docker-compose.yml /psd-gateway/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-gateway/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-es/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-member/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-web-auth/settings.gradle: -------------------------------------------------------------------------------- 1 | includeFlat("psd-config") 2 | 3 | -------------------------------------------------------------------------------- /psd-web-member/out/production/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /psd-generate/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | yoke: 2 | test: "hello" -------------------------------------------------------------------------------- /doc/img/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/doc/img/cart.png -------------------------------------------------------------------------------- /doc/img/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/doc/img/db.png -------------------------------------------------------------------------------- /doc/img/item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/doc/img/item.png -------------------------------------------------------------------------------- /doc/img/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/doc/img/index.png -------------------------------------------------------------------------------- /doc/img/order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/doc/img/order.png -------------------------------------------------------------------------------- /psd-config/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: config-service -------------------------------------------------------------------------------- /psd-gateway/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: service-zuul -------------------------------------------------------------------------------- /psd-web-es/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-es-service -------------------------------------------------------------------------------- /doc/img/personalCenter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/doc/img/personalCenter.png -------------------------------------------------------------------------------- /psd-gateway/out/production/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: service-zuul -------------------------------------------------------------------------------- /psd-web-auth/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-auth-service -------------------------------------------------------------------------------- /psd-discovery/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: poseidon-discovery -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-view-service 4 | -------------------------------------------------------------------------------- /psd-web-member/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-member-service 4 | -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-order-service 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /psd-web-member/out/production/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-member-service 4 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-shop-cart-service 4 | -------------------------------------------------------------------------------- /config.env: -------------------------------------------------------------------------------- 1 | MYSQL_ROOT_PASSWORD=123456 2 | MYSQL_ROOT_HOST=% 3 | MYSQL_DATABASE=poseidon 4 | db.server=mysql 5 | db.port=3306 6 | db.username=root 7 | db.password=123456 -------------------------------------------------------------------------------- /psd-config/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | eureka: 2 | client: 3 | serviceUrl: 4 | defaultZone: http://localhost:8761/eureka/ 5 | server: 6 | port: 9200 7 | -------------------------------------------------------------------------------- /psd-web-view/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | VOLUME /tmp 3 | ADD ./build/libs/psd-web-view-0.1.0.jar view.jar 4 | EXPOSE 8080 5 | ENTRYPOINT ["java","-jar","view.jar"] -------------------------------------------------------------------------------- /psd-gateway/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | VOLUME /tmp 3 | ADD ./build/libs/psd-gateway-0.1.0.jar gateway.jar 4 | EXPOSE 8769 5 | ENTRYPOINT ["java","-jar","gateway.jar"] -------------------------------------------------------------------------------- /psd-web-auth/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | VOLUME /tmp/web-view 3 | ADD ./build/libs/psd-web-view-0.1.0.jar view.jar 4 | EXPOSE 8080 5 | ENTRYPOINT ["java","-jar","view.jar"] -------------------------------------------------------------------------------- /psd-web-shop-cart/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | VOLUME /tmp 3 | ADD ./build/libs/psd-web-shop-cart-0.1.0.jar cart.jar 4 | EXPOSE 8090 5 | ENTRYPOINT ["java","-jar","cart.jar"] -------------------------------------------------------------------------------- /psd-discovery/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | VOLUME /tmp 3 | ADD ./build/libs/poseidon-eureka-server-0.1.0.jar eureka.jar 4 | EXPOSE 8761 5 | ENTRYPOINT ["java","-jar","eureka.jar"] -------------------------------------------------------------------------------- /psd-web-order/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | VOLUME /tmp 3 | ADD ./build/libs/psd-web-order-0.1.0.jar order.jar 4 | EXPOSE 9100 5 | ENTRYPOINT ["java","-jar","order.jar"] 6 | 7 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /psd-web-member/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | VOLUME /tmp 3 | ADD ./build/libs/psd-web-member-0.1.0.jar member.jar 4 | EXPOSE 9000 5 | ENTRYPOINT ["java","-jar","member.jar"] 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/dto/Message.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/dto/Message.class -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/Main.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/dto/MemberDto.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/dto/MemberDto.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/entity/Member.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/entity/Member.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/MemberApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/MemberApplication.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/cache/RedisCache.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/cache/RedisCache.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/mapper/MemberMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/mapper/MemberMapper.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/config/SwaggerConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/config/SwaggerConfig.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/service/ConvertService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/service/ConvertService.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/service/MemberService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/service/MemberService.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/web/MemberController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/web/MemberController.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/serviceImpl/MemberServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/serviceImpl/MemberServiceImpl.class -------------------------------------------------------------------------------- /psd-gateway/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /psd-web-auth/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /psd-web-es/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/cache/ApplicationContextHolder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/cache/ApplicationContextHolder.class -------------------------------------------------------------------------------- /psd-web-member/out/production/classes/com/yoke/poseidon/member/serviceImpl/ConvertServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Saseke/poseidon/HEAD/psd-web-member/out/production/classes/com/yoke/poseidon/member/serviceImpl/ConvertServiceImpl.class -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /psd-web-member/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /psd-web-member/out/production/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Feb 05 17:47:23 CST 2020 2 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip 3 | distributionBase=GRADLE_USER_HOME 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | #db: 2 | # server: localhost 3 | # port: 3306 4 | # username: root 5 | # password: 123456 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ 10 | common: 11 | password: "FJEOIRFWQ132EW" 12 | -------------------------------------------------------------------------------- /psd-discovery/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8761 3 | eureka: 4 | instance: 5 | hostname: localhost 6 | client: 7 | registerWithEureka: false 8 | fetchRegistry: false 9 | serviceUrl: 10 | defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ 11 | 12 | -------------------------------------------------------------------------------- /psd-web-es/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | ribbon.ReadTimeout: 120000 2 | #请求连接的超时时间 3 | ribbon.ConnectTimeout: 30000 4 | server: 5 | port: 8900 6 | profiles: 7 | active: dev 8 | spring: 9 | data: 10 | elasticsearch: 11 | cluster-nodes: 127.0.0.1:9300 12 | cluster-name: elasticsearch 13 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'web' 2 | include 'psd-discovery' 3 | include 'psd-gateway' 4 | include 'psd-web-view' 5 | include 'psd-generate' 6 | include 'psd-web-auth' 7 | include 'psd-config' 8 | include 'psd-web-es' 9 | include 'psd-web-shop-cart' 10 | include 'psd-web-member' 11 | include 'psd-web-order' -------------------------------------------------------------------------------- /config/checkstyle/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /psd-web-es/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: localhost 3 | port: 3306 4 | username: root 5 | password: 123456 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ 10 | spring: 11 | redis: 12 | host: www.test.com 13 | password: ${common.password} 14 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/constants/OrderConstant.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.constants; 2 | 3 | /** 4 | * @Author Yoke 5 | * @Date 2019/02/15 下午2:31 6 | */ 7 | public class OrderConstant { 8 | 9 | public static final int CANCEL = 3; 10 | 11 | public static final int SUCCESS = 1; 12 | 13 | public static final int UN_PAID = 0; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/service/ConvertService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.service; 2 | 3 | import com.yoke.poseidon.member.dto.MemberDto; 4 | import com.yoke.poseidon.member.entity.Member; 5 | 6 | /** 7 | * @Author Yoke 8 | * @Date 2019/01/24 下午2:16 9 | */ 10 | public interface ConvertService { 11 | 12 | MemberDto convert(Member member); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /psd-web-member/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: ${common.password} 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ 10 | spring: 11 | redis: 12 | host: www.test.com 13 | password: ${common.password} 14 | database: 3 15 | common: 16 | password: "FJEOIRFWQ132EW" -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: 'FJEOIRFWQ132EW' 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ 10 | spring: 11 | redis: 12 | host: www.test.com 13 | password: ${common.password} 14 | database: 1 15 | common: 16 | password: "FJEOIRFWQ132EW" -------------------------------------------------------------------------------- /psd-web-member/out/production/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: www.test.com 3 | port: 13306 4 | username: root 5 | password: ${common.password} 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ 10 | spring: 11 | redis: 12 | host: www.test.com 13 | password: ${common.password} 14 | database: 3 15 | common: 16 | password: "FJEOIRFWQ132EW" -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/mapper/AddressMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.mapper; 2 | 3 | import com.yoke.poseidon.order.entity.Address; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-03-31 13 | */ 14 | public interface AddressMapper extends BaseMapper
{ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/service/AddressService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.service; 2 | 3 | import com.yoke.poseidon.order.entity.Address; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-03-31 13 | */ 14 | public interface AddressService extends IService
{ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/service/OrderItemService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.service; 2 | 3 | import com.yoke.poseidon.order.entity.OrderItem; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 订单商品关联表 服务类 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-02-03 13 | */ 14 | public interface OrderItemService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/mapper/ItemSkuMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.mapper; 2 | 3 | import com.yoke.poseidon.web.itemShow.entity.ItemSku; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-06-02 13 | */ 14 | public interface ItemSkuMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/web/AddressController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.web; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | import org.springframework.stereotype.Controller; 7 | 8 | /** 9 | *

10 | * 前端控制器 11 | *

12 | * 13 | * @author yoke 14 | * @since 2019-03-31 15 | */ 16 | @Controller 17 | @RequestMapping("/address") 18 | public class AddressController { 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/web/OrderItemController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.web; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | import org.springframework.stereotype.Controller; 7 | 8 | /** 9 | *

10 | * 订单商品关联表 前端控制器 11 | *

12 | * 13 | * @author yoke 14 | * @since 2019-02-03 15 | */ 16 | @Controller 17 | @RequestMapping("/orderItem") 18 | public class OrderItemController { 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/mapper/ItemAttributeValueMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.mapper; 2 | 3 | import com.yoke.poseidon.web.itemShow.entity.ItemAttributeValue; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-06-02 13 | */ 14 | public interface ItemAttributeValueMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/ItemAttributeValueService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.yoke.poseidon.web.itemShow.entity.ItemAttributeValue; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-06-02 13 | */ 14 | public interface ItemAttributeValueService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/mapper/ItemAttributeNameMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.mapper; 2 | 3 | import com.yoke.poseidon.web.itemShow.entity.ItemAttributeName; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 商品参数的名称 Mapper 接口 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-06-02 13 | */ 14 | public interface ItemAttributeNameMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/ItemAttributeNameService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.yoke.poseidon.web.itemShow.entity.ItemAttributeName; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 商品参数的名称 服务类 9 | *

10 | * 11 | * @author yoke 12 | * @since 2019-06-02 13 | */ 14 | public interface ItemAttributeNameService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/web/PanelContentController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.web; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | *

8 | * 前端控制器 9 | *

10 | * 11 | * @author ehereal 12 | * @since 2018-09-20 13 | */ 14 | @RestController 15 | @RequestMapping("/panelContent") 16 | public class PanelContentController { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | db: 2 | server: localhost 3 | port: 3306 4 | username: root 5 | password: 123456 6 | eureka: 7 | client: 8 | serviceUrl: 9 | defaultZone: http://localhost:8761/eureka/ 10 | spring: 11 | redis: 12 | host: www.test.com 13 | password: ${common.password} 14 | database: 0 15 | common: 16 | password: "FJEOIRFWQ132EW" 17 | # rabbitmq configuration 18 | item: 19 | exchange: item_exchange 20 | vary_key: item_vary.key 21 | -------------------------------------------------------------------------------- /psd-config/src/main/java/com/yoke/poseidon/config/SpringEurekaConfigApp.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.config; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @Author Yoke 8 | * @Date 2018/11/24 下午9:17 9 | */ 10 | @SpringBootApplication 11 | public class SpringEurekaConfigApp { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(SpringEurekaConfigApp.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/web/ItemAttributeNameController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.web; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | import org.springframework.stereotype.Controller; 7 | 8 | /** 9 | *

10 | * 商品参数的名称 前端控制器 11 | *

12 | * 13 | * @author yoke 14 | * @since 2019-06-02 15 | */ 16 | @Controller 17 | @RequestMapping("/itemAttributeName") 18 | public class ItemAttributeNameController { 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/web/ItemAttributeValueController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.web; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | import org.springframework.stereotype.Controller; 7 | 8 | /** 9 | *

10 | * 前端控制器 11 | *

12 | * 13 | * @author yoke 14 | * @since 2019-06-02 15 | */ 16 | @Controller 17 | @RequestMapping("/itemAttributeValue") 18 | public class ItemAttributeValueController { 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/config/JSONConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2019/01/29 下午2:55 10 | */ 11 | @Configuration 12 | public class JSONConfig { 13 | 14 | @Bean 15 | public ObjectMapper objectMapper() { 16 | return new ObjectMapper(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/config/JSONConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2019/01/29 下午2:52 10 | */ 11 | @Configuration 12 | public class JSONConfig { 13 | 14 | @Bean 15 | public ObjectMapper objectMapper() { 16 | return new ObjectMapper(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/service/ConvertService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.service; 2 | 3 | import com.yoke.poseidon.auth.dto.MemberDto; 4 | import com.yoke.poseidon.auth.entity.Member; 5 | import org.springframework.lang.NonNull; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @Author Yoke 11 | * @Date 2018/10/23 下午3:20 12 | */ 13 | public interface ConvertService { 14 | 15 | MemberDto convertMember(@NonNull Member member); 16 | 17 | List convertMember(@NonNull List members); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/service/MemberService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.auth.dto.MemberDto; 5 | import com.yoke.poseidon.auth.entity.Member; 6 | import org.springframework.lang.NonNull; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author yoke 14 | * @since 2018-11-25 15 | */ 16 | public interface MemberService extends IService { 17 | 18 | MemberDto getByUsername(@NonNull String username); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/web/member.http: -------------------------------------------------------------------------------- 1 | # For a quick start check out our HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection). 2 | # 3 | # Following HTTP Request Live Templates are available: 4 | # * 'gtrp' and 'gtr' create a GET request with or without query parameters; 5 | # * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body; 6 | # * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data); 7 | PATCH http://localhost:9000/member/1/1 8 | Accept: application/json 9 | 10 | ### 11 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/web/orderRequest.http: -------------------------------------------------------------------------------- 1 | # For a quick start check out our HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection). 2 | # 3 | # Following HTTP Request Live Templates are available: 4 | # * 'gtrp' and 'gtr' create a GET request with or without query parameters; 5 | # * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body; 6 | # * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data); 7 | GET http://localhost:9100/order/list/1/1/1/3 8 | Accept: application/json 9 | 10 | ### -------------------------------------------------------------------------------- /psd-gateway/src/main/java/com/yoke/poseidon/gateway/GatewayServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 6 | 7 | /** 8 | * @author ethereal 9 | * @since 2018-09-21 10:51 10 | */ 11 | @SpringBootApplication 12 | @EnableZuulProxy 13 | public class GatewayServiceApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(GatewayServiceApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/fallback/ItemFallback.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.fallback; 2 | 3 | import com.yoke.poseidon.elasticsearch.entity.EsItem; 4 | import com.yoke.poseidon.elasticsearch.feign.ItemFeign; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2019/01/28 下午8:32 13 | */ 14 | @Component 15 | public class ItemFallback implements ItemFeign { 16 | 17 | @Override 18 | public List fetch() { 19 | return Collections.emptyList(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/mapper/ItemCartMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yoke.poseidon.cart.cache.RedisCache; 5 | import com.yoke.poseidon.cart.entity.ItemCart; 6 | import org.apache.ibatis.annotations.CacheNamespace; 7 | 8 | /** 9 | *

10 | * 购物车 Mapper 接口 11 | *

12 | * 13 | * @author yoke 14 | * @since 2019-01-11 15 | */ 16 | //@CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 17 | public interface ItemCartMapper extends BaseMapper { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/PanelContentService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.web.itemShow.entity.PanelContent; 5 | import org.springframework.lang.NonNull; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * 服务类 12 | *

13 | * 14 | * @author ehereal 15 | * @since 2018-09-20 16 | */ 17 | public interface PanelContentService extends IService { 18 | 19 | List getItemIdByPanelId(@NonNull Integer panelId, Integer limit); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/service/ConvertService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.service; 2 | 3 | import com.yoke.poseidon.cart.dto.ItemCartDto; 4 | import com.yoke.poseidon.cart.entity.ItemCart; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @Author Yoke 10 | * @Date 2019/01/11 下午8:47 11 | */ 12 | public interface ConvertService { 13 | 14 | ItemCartDto convert(ItemCart itemCart); 15 | 16 | List convert(List itemCartList); 17 | 18 | ItemCart convertToBean(ItemCartDto itemCartDto); 19 | 20 | List convertToBean(List itemCartDtos); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /psd-web-member/src/main/resources/mapper/MemberMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/ItemSkuService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.web.itemShow.entity.ItemAttribute; 5 | import com.yoke.poseidon.web.itemShow.entity.ItemSku; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * 服务类 12 | *

13 | * 14 | * @author yoke 15 | * @since 2019-06-02 16 | */ 17 | public interface ItemSkuService extends IService { 18 | 19 | /** 20 | * 根据商品id获取用户各种参数信息 21 | */ 22 | List getItemInfo(String itemId); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /psd-web-member/out/production/resources/mapper/MemberMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/mapper/ItemAttributeNameMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | .gradle/ 3 | psd-config/out/ 4 | psd-config/src/test/ 5 | psd-discovery/out/ 6 | psd-discovery/src/test/ 7 | psd-gateway/src/test/ 8 | psd-generate/out/ 9 | psd-generate/src/test/ 10 | psd-web-auth/out/ 11 | psd-web-auth/src/test/resources/ 12 | psd-web-shop-cart/out/ 13 | psd-web-shop-cart/src/test/resources/ 14 | psd-web-view/out/ 15 | psd-web-view/src/test/resources/ 16 | .gitignore 17 | psd-web-order/out 18 | .idea 19 | psd-gateway/out 20 | psd-web-es/out 21 | build/ 22 | psd-web-es/src/test/resources/ 23 | psd-web-member/src/test/ 24 | psd-web-order/src/test/ 25 | psd-web-es/build/* 26 | psd-web-es/out/* -------------------------------------------------------------------------------- /psd-discovery/src/main/java/com/yoke/poseidon/gateway/discovery/EurekaServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway.discovery; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | /** 8 | * @author ethereal 9 | * @since 2018-09-20 22:57 10 | */ 11 | @SpringBootApplication 12 | @EnableEurekaServer 13 | public class EurekaServerApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(EurekaServerApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/serviceImpl/AddressServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.serviceImpl; 2 | 3 | import com.yoke.poseidon.order.entity.Address; 4 | import com.yoke.poseidon.order.mapper.AddressMapper; 5 | import com.yoke.poseidon.order.service.AddressService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author yoke 15 | * @since 2019-03-31 16 | */ 17 | @Service 18 | public class AddressServiceImpl extends ServiceImpl implements AddressService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/resources/mapper/MemberMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | select * 9 | from poseidon.db_member 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/feign/ItemFeign.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.feign; 2 | 3 | import com.yoke.poseidon.elasticsearch.entity.EsItem; 4 | import com.yoke.poseidon.elasticsearch.fallback.ItemFallback; 5 | import org.springframework.cloud.openfeign.FeignClient; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2019/01/16 下午9:02 13 | */ 14 | @FeignClient(value = "web-view-service:8080", fallback = ItemFallback.class) 15 | public interface ItemFeign { 16 | 17 | @GetMapping("/item") 18 | // 默认就是post,即使写的是get请求 19 | List fetch(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/serviceImpl/OrderItemServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.serviceImpl; 2 | 3 | import com.yoke.poseidon.order.entity.OrderItem; 4 | import com.yoke.poseidon.order.mapper.OrderItemMapper; 5 | import com.yoke.poseidon.order.service.OrderItemService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 订单商品关联表 服务实现类 12 | *

13 | * 14 | * @author yoke 15 | * @since 2019-02-03 16 | */ 17 | @Service 18 | public class OrderItemServiceImpl extends ServiceImpl implements OrderItemService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/mapper/ItemAttributeValueMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /psd-gateway/src/main/java/com/yoke/poseidon/gateway/config/CROSConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2018/12/18 上午9:12 10 | */ 11 | @Configuration 12 | public class CROSConfig implements WebMvcConfigurer { 13 | 14 | @Override 15 | public void addCorsMappings(CorsRegistry registry) { 16 | registry.addMapping("/**").allowedHeaders("*").allowedMethods("*") 17 | .allowedOrigins("*").exposedHeaders("cur", "Authorization"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/web/ESItem.http: -------------------------------------------------------------------------------- 1 | # For a quick start check out our HTTP Requests collection (Tools|HTTP Client|Open HTTP Requests Collection). 2 | # 3 | # Following HTTP Request Live Templates are available: 4 | # * 'gtrp' and 'gtr' create a GET request with or without query parameters; 5 | # * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body; 6 | # * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data); 7 | ### 8 | 9 | GET http://localhost:8900/es/recommend/1/10 10 | Content-Type: application/json 11 | 12 | 13 | ### 14 | POST http://localhost:8900/es/sync 15 | Content-Type: application/json 16 | 17 | ### 18 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/test/java/com/yoke/poseidon/cart/serviceImpl/ItemCartServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.serviceImpl; 2 | 3 | import com.yoke.poseidon.cart.service.ItemCartService; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | import org.springframework.test.context.junit4.SpringRunner; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2019/01/11 下午9:35 13 | */ 14 | @SpringBootTest 15 | @RunWith(SpringRunner.class) 16 | public class ItemCartServiceImplTest { 17 | 18 | @Autowired 19 | private ItemCartService itemCartService; 20 | 21 | @Test 22 | public void list() { 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /psd-gateway/src/main/java/com/yoke/poseidon/gateway/router/Router.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway.router; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | /** 6 | * @Author Yoke 7 | * @Date 2018/12/24 上午10:58 8 | */ 9 | public class Router { 10 | 11 | @Value("/view/**") 12 | private String web_view_service; 13 | 14 | @Value("/cart/**") 15 | private String web_shop_cart_service; 16 | 17 | @Value("/member/**") 18 | private String member_service; 19 | 20 | public String getWeb_view_service() { 21 | return web_view_service; 22 | } 23 | 24 | public String getWeb_shop_cart_service() { 25 | return web_shop_cart_service; 26 | } 27 | 28 | public String getMember_service() { 29 | return member_service; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/mapper/MemberMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yoke.poseidon.member.entity.Member; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.lang.NonNull; 7 | 8 | import javax.validation.constraints.NotNull; 9 | import java.math.BigDecimal; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author yoke 17 | * @since 2019-01-24 18 | */ 19 | // @CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 20 | public interface MemberMapper extends BaseMapper { 21 | 22 | Member selectByName(@NonNull @Param("username") String username); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/mapper/MemberMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yoke.poseidon.auth.cache.RedisCache; 5 | import com.yoke.poseidon.auth.entity.Member; 6 | import org.apache.ibatis.annotations.CacheNamespace; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.lang.NonNull; 9 | 10 | /** 11 | *

12 | * Mapper 接口 13 | *

14 | * 15 | * @author yoke 16 | * @since 2018-11-25 17 | */ 18 | @CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 19 | public interface MemberMapper extends BaseMapper { 20 | 21 | Member selectByUsername(@NonNull @Param("username") String username); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/serviceImpl/ItemAttributeNameServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.serviceImpl; 2 | 3 | import com.yoke.poseidon.web.itemShow.entity.ItemAttributeName; 4 | import com.yoke.poseidon.web.itemShow.mapper.ItemAttributeNameMapper; 5 | import com.yoke.poseidon.web.itemShow.service.ItemAttributeNameService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 商品参数的名称 服务实现类 12 | *

13 | * 14 | * @author yoke 15 | * @since 2019-06-02 16 | */ 17 | @Service 18 | public class ItemAttributeNameServiceImpl extends ServiceImpl implements ItemAttributeNameService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/serviceImpl/ItemAttributeValueServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.serviceImpl; 2 | 3 | import com.yoke.poseidon.web.itemShow.entity.ItemAttributeValue; 4 | import com.yoke.poseidon.web.itemShow.mapper.ItemAttributeValueMapper; 5 | import com.yoke.poseidon.web.itemShow.service.ItemAttributeValueService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author yoke 15 | * @since 2019-06-02 16 | */ 17 | @Service 18 | public class ItemAttributeValueServiceImpl extends ServiceImpl implements ItemAttributeValueService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/mapper/AddressMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/mapper/ItemSkuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/dao/ItemRepository.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.dao; 2 | 3 | import com.yoke.poseidon.elasticsearch.entity.EsItem; 4 | import org.springframework.data.domain.Page; 5 | import org.springframework.data.domain.Pageable; 6 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2018/12/13 上午9:46 13 | */ 14 | public interface ItemRepository extends ElasticsearchRepository { 15 | 16 | List findByName(String keyword); 17 | 18 | Page findByName(String name, Pageable page); 19 | 20 | EsItem findByItemId(String itemId); 21 | 22 | List findByItemIdIn(List itemIds); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/AuthApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | /** 10 | * @Author Yoke 11 | * @Date 2018/11/24 下午9:01 12 | */ 13 | @MapperScan(basePackages = "com.yoke.poseidon.auth.mapper") 14 | @SpringBootApplication 15 | public class AuthApplication { 16 | 17 | @Bean 18 | public ModelMapper modelMapper() { 19 | return new ModelMapper(); 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(AuthApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.transaction.annotation.EnableTransactionManagement; 8 | 9 | /** 10 | * @Author Yoke 11 | * @Date 2019/03/24 上午10:03 12 | */ 13 | @EnableTransactionManagement 14 | @Configuration 15 | @MapperScan("com.yoke.poseidon.order.mapper") 16 | public class MybatisPlusConfig { 17 | 18 | @Bean 19 | public PaginationInterceptor paginationInterceptor() { 20 | return new PaginationInterceptor(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/OrderApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | /** 10 | * @Author Yoke 11 | * @Date 2019/02/10 下午3:41 12 | */ 13 | @MapperScan(basePackages = "com.yoke.poseidon.order.mapper") 14 | @SpringBootApplication 15 | public class OrderApplication { 16 | 17 | @Bean 18 | public ModelMapper modelMapper() { 19 | return new ModelMapper(); 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(OrderApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/entity/ItemAttribute.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.entity; 2 | 3 | import java.io.Serializable; 4 | import java.math.BigDecimal; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class ItemAttribute implements Serializable { 9 | 10 | private List> attributes; 11 | private BigDecimal price; 12 | 13 | public List> getAttributes() { 14 | return attributes; 15 | } 16 | 17 | public void setAttributes(List> attributes) { 18 | this.attributes = attributes; 19 | } 20 | 21 | public BigDecimal getPrice() { 22 | return price; 23 | } 24 | 25 | public void setPrice(BigDecimal price) { 26 | this.price = price; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/ElasticSearchApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.openfeign.EnableFeignClients; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | /** 10 | * @Author Yoke 11 | * @Date 2018/12/07 上午9:28 12 | */ 13 | @EnableFeignClients 14 | @SpringBootApplication 15 | public class ElasticSearchApplication { 16 | 17 | @Bean 18 | public ModelMapper modelMapper() { 19 | return new ModelMapper(); 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(ElasticSearchApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/MemberApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | /** 10 | * @Author Yoke 11 | * @Date 2019/01/24 下午1:44 12 | */ 13 | @MapperScan(basePackages = "com.yoke.poseidon.member.mapper") 14 | @SpringBootApplication 15 | public class MemberApplication { 16 | 17 | @Bean 18 | public ModelMapper modelMapper() { 19 | return new ModelMapper(); 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(MemberApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /psd-web-auth/src/test/java/com/yoke/poseidon/auth/serviceImpl/MemberServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.serviceImpl; 2 | 3 | import com.yoke.poseidon.auth.service.MemberService; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | /** 12 | * @Author Yoke 13 | * @Date 2018/11/25 下午2:28 14 | */ 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest 17 | public class MemberServiceImplTest { 18 | 19 | @Autowired 20 | private MemberService memberService; 21 | 22 | @Test 23 | public void getByUsername() { 24 | Assert.assertNotNull(memberService.getByUsername("yoke")); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/ItemShowServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | /** 10 | * @author ethereal 11 | * @since 2018-09-23 20:20 12 | */ 13 | @MapperScan(basePackages = "com.yoke.poseidon.web.itemShow.mapper") 14 | @SpringBootApplication 15 | public class ItemShowServiceApplication { 16 | 17 | @Bean 18 | public ModelMapper modelMapper() { 19 | return new ModelMapper(); 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(ItemShowServiceApplication.class, args); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /psd-gateway/src/main/java/com/yoke/poseidon/gateway/web/GateWayController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway.web; 2 | 3 | import org.springframework.http.HttpEntity; 4 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 5 | import org.springframework.security.core.context.SecurityContextHolder; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * @Author Yoke 11 | * @Date 2019/01/11 下午8:01 12 | */ 13 | @RestController 14 | @RequestMapping("/") 15 | public class GateWayController { 16 | 17 | public String curUser(HttpEntity entity) { 18 | UsernamePasswordAuthenticationToken token = (UsernamePasswordAuthenticationToken) SecurityContextHolder 19 | .getContext().getAuthentication(); 20 | return (String) token.getPrincipal(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/ItemCartApplication.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2018/12/21 上午11:30 13 | */ 14 | @EnableFeignClients 15 | @SpringBootApplication 16 | @MapperScan(basePackages = "com.yoke.poseidon.cart.mapper") 17 | public class ItemCartApplication{ 18 | 19 | @Bean 20 | public ModelMapper modelMapper() { 21 | return new ModelMapper(); 22 | } 23 | 24 | public static void main(String[] args) { 25 | SpringApplication.run(ItemCartApplication.class, args); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/serviceImpl/ConvertServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.serviceImpl; 2 | 3 | import com.yoke.poseidon.member.dto.MemberDto; 4 | import com.yoke.poseidon.member.entity.Member; 5 | import com.yoke.poseidon.member.service.ConvertService; 6 | import org.modelmapper.ModelMapper; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2019/01/24 下午2:16 13 | */ 14 | @Service 15 | public class ConvertServiceImpl implements ConvertService { 16 | 17 | private final ModelMapper modelMapper; 18 | 19 | @Autowired 20 | public ConvertServiceImpl(ModelMapper modelMapper) { 21 | this.modelMapper = modelMapper; 22 | } 23 | 24 | @Override 25 | public MemberDto convert(Member member) { 26 | return modelMapper.map(member, MemberDto.class); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /psd-web-view/src/test/java/com/yoke/poseidon/web/itemShow/serviceImpl/ItemCatServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.serviceImpl; 2 | 3 | import com.yoke.poseidon.web.itemShow.service.ItemCatService; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | import org.springframework.test.context.junit4.SpringRunner; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2018/12/18 上午8:44 13 | */ 14 | @RunWith(SpringRunner.class) 15 | @SpringBootTest 16 | public class ItemCatServiceImplTest { 17 | 18 | @Autowired 19 | private ItemCatService itemCatService; 20 | 21 | @Test 22 | public void getByParentId() { 23 | } 24 | 25 | @Test 26 | public void getIdsByParentId() { 27 | } 28 | 29 | @Test 30 | public void getRootCat() { 31 | } 32 | 33 | @Test 34 | public void getByRemark() { 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/mapper/OrderItemMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/config/RabbitmqConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.config; 2 | 3 | import org.springframework.amqp.core.TopicExchange; 4 | import org.springframework.amqp.rabbit.connection.ConnectionFactory; 5 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2019/01/29 下午12:16 13 | */ 14 | @Configuration 15 | public class RabbitmqConfig { 16 | 17 | @Bean 18 | public TopicExchange itemExchange( 19 | @Value("${item.exchange}") final String exchangeName) { 20 | 21 | return new TopicExchange(exchangeName); 22 | } 23 | 24 | @Bean 25 | public RabbitTemplate rabbitTemplate(final ConnectionFactory connectionFactory) { 26 | return new RabbitTemplate(connectionFactory); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/service/MemberService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.member.dto.MemberDto; 5 | import com.yoke.poseidon.member.entity.Member; 6 | import org.springframework.lang.NonNull; 7 | 8 | import javax.validation.constraints.NotNull; 9 | import java.math.BigDecimal; 10 | 11 | /** 12 | *

13 | * 服务类 14 | *

15 | * 16 | * @author yoke 17 | * @since 2019-01-24 18 | */ 19 | public interface MemberService extends IService { 20 | 21 | MemberDto getByName(@NonNull String name); 22 | 23 | /** 24 | * 支付,扣除用户指定的金额 25 | * @param memberId 用户的id 26 | * @param pay 扣除的金额 27 | * @return 扣除金额是否成功 28 | */ 29 | 30 | boolean pay(@NotNull Long memberId, @NotNull BigDecimal payment); 31 | 32 | /** 33 | * 根据用户的id获取用户的个人信息 34 | * @param memberId 用户的id 35 | * @return 用户的个人信息 36 | */ 37 | MemberDto getById(@NotNull Long memberId); 38 | } 39 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/mapper/OrderItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.yoke.poseidon.order.dto.OrderItemDto; 7 | import com.yoke.poseidon.order.entity.OrderItem; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | import javax.validation.constraints.NotNull; 11 | import java.util.List; 12 | 13 | /** 14 | *

15 | * 订单商品关联表 Mapper 接口 16 | *

17 | * 18 | * @author yoke 19 | * @since 2019-02-10 20 | */ 21 | // @CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 22 | 23 | public interface OrderItemMapper extends BaseMapper { 24 | 25 | List selectByOrderId(@NotNull @Param("order_id") String orderId); 26 | 27 | IPage selectPageByOrderId(Page page, 28 | @Param("orderIds") List orderIds); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/ConvertService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.yoke.poseidon.web.itemShow.dto.ItemCatDto; 4 | import com.yoke.poseidon.web.itemShow.dto.ItemDto; 5 | import com.yoke.poseidon.web.itemShow.dto.PanelDto; 6 | import com.yoke.poseidon.web.itemShow.entity.Item; 7 | import com.yoke.poseidon.web.itemShow.entity.ItemCat; 8 | import com.yoke.poseidon.web.itemShow.entity.Panel; 9 | import org.springframework.lang.NonNull; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * @Author Yoke 15 | * @Date 2018/10/23 下午3:20 16 | */ 17 | public interface ConvertService { 18 | 19 | ItemDto convertItem(@NonNull Item item); 20 | 21 | List convertItem(@NonNull List items); 22 | 23 | ItemCatDto convertItemCat(@NonNull ItemCat itemCat); 24 | 25 | List convertItemCat(@NonNull List itemCats); 26 | 27 | PanelDto convertPanel(@NonNull Panel panel); 28 | 29 | List convertPanel(@NonNull List panels); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /psd-web-view/src/test/java/com/yoke/poseidon/web/itemShow/serviceImpl/PanelServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.serviceImpl; 2 | 3 | import com.yoke.poseidon.web.itemShow.dto.PanelDto; 4 | import com.yoke.poseidon.web.itemShow.service.PanelService; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * @Author Yoke 16 | * @Date 2018/12/21 上午9:28 17 | */ 18 | @RunWith(SpringRunner.class) 19 | @SpringBootTest 20 | public class PanelServiceImplTest { 21 | 22 | @Autowired 23 | private PanelService panelService; 24 | 25 | @Test 26 | public void getPanelByRemark() { 27 | } 28 | 29 | @Test 30 | public void getPanelByItemCatId() { 31 | List list = panelService.getPanelByItemCatId(1L); 32 | Assert.assertNotNull(list); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/service/ItemService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.service; 2 | 3 | import com.yoke.poseidon.elasticsearch.entity.EsItem; 4 | import org.springframework.data.domain.Page; 5 | import org.springframework.lang.NonNull; 6 | 7 | import java.math.BigDecimal; 8 | import java.util.List; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2018/12/13 上午11:11 13 | */ 14 | public interface ItemService { 15 | 16 | EsItem add(@NonNull EsItem esItem); 17 | 18 | void delete(@NonNull String itemId); 19 | 20 | EsItem update(@NonNull EsItem esItem); 21 | 22 | Page getByKey(String keyWord, int page, int limit); 23 | 24 | EsItem getById(String itemId); 25 | 26 | List getAll(); 27 | 28 | /** 29 | * 从商品展示服务同步数据 30 | */ 31 | List syncData(); 32 | 33 | /** 34 | * 商品推荐 35 | */ 36 | Page recommend(List itemIds, int page, int size); 37 | 38 | /** 39 | * 查询指定价格范围内的商品 40 | */ 41 | public Page queryPriceRange(BigDecimal price1, BigDecimal price2, int page, int size); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /psd-gateway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | eureka: 2 | client: 3 | serviceUrl: 4 | defaultZone: http://localhost:8761/eureka/ 5 | server: 6 | port: 8769 7 | ribbon: 8 | ReadTimeout: 60000 9 | ConnectTimeout: 60000 10 | zuul: 11 | ignored-services: "*" 12 | routes: 13 | web-item-service: 14 | path: /view/** 15 | service-id: web-view-service 16 | web-auth-service: 17 | path: /auth/** 18 | service-id: web-auth-service 19 | strip-prefix: false 20 | sensitive-headers: Cookie,Set-Cookie 21 | web-shop-cart-service: 22 | path: /cart/** 23 | service-id: web-shop-cart-service 24 | strip-prefix: false 25 | web-member-service: 26 | path: /member/** 27 | service-id: web-member-service 28 | strip-prefix: false 29 | web-order-service: 30 | path: /order/** 31 | service-id: web-order-service 32 | strip-prefix: false 33 | web-es-service: 34 | path: /es/** 35 | service-id: web-es-service 36 | strip-prefix: false 37 | 38 | 39 | spring: 40 | profiles: 41 | active: dev -------------------------------------------------------------------------------- /psd-gateway/out/production/resources/application.yml: -------------------------------------------------------------------------------- 1 | eureka: 2 | client: 3 | serviceUrl: 4 | defaultZone: http://localhost:8761/eureka/ 5 | server: 6 | port: 8769 7 | ribbon: 8 | ReadTimeout: 60000 9 | ConnectTimeout: 60000 10 | zuul: 11 | ignored-services: "*" 12 | routes: 13 | web-item-service: 14 | path: /view/** 15 | service-id: web-view-service 16 | web-auth-service: 17 | path: /auth/** 18 | service-id: web-auth-service 19 | strip-prefix: false 20 | sensitive-headers: Cookie,Set-Cookie 21 | web-shop-cart-service: 22 | path: /cart/** 23 | service-id: web-shop-cart-service 24 | strip-prefix: false 25 | web-member-service: 26 | path: /member/** 27 | service-id: web-member-service 28 | strip-prefix: false 29 | web-order-service: 30 | path: /order/** 31 | service-id: web-order-service 32 | strip-prefix: false 33 | web-es-service: 34 | path: /es/** 35 | service-id: web-es-service 36 | strip-prefix: false 37 | 38 | 39 | spring: 40 | profiles: 41 | active: dev -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/ItemService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.web.itemShow.dto.ItemDto; 5 | import com.yoke.poseidon.web.itemShow.entity.Item; 6 | import org.springframework.lang.NonNull; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 商品表 服务类 13 | *

14 | * 15 | * @author ehereal 16 | * @since 2018-09-20 17 | */ 18 | public interface ItemService extends IService { 19 | 20 | ItemDto getById(@NonNull String itemId, int intBlob); 21 | 22 | List getIdIn(@NonNull List itemIds, int intBlob); 23 | 24 | List getByCId(@NonNull Long cId, @NonNull Integer limit, int intBlob); 25 | 26 | List getByCIds(@NonNull List cIds, @NonNull Integer limit, 27 | int intBlob); 28 | 29 | List getByCatIds(@NonNull List itemCatIds, @NonNull Integer limit); 30 | 31 | /** 32 | * 得到所有的商品信息,目的是第一次elasticsearch同步 33 | */ 34 | List get(); 35 | 36 | void test(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/service/ConvertService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.service; 2 | 3 | import com.yoke.poseidon.order.dto.OrderDto; 4 | import com.yoke.poseidon.order.dto.OrderItemDto; 5 | import com.yoke.poseidon.order.entity.Order; 6 | import com.yoke.poseidon.order.entity.OrderItem; 7 | 8 | import javax.validation.constraints.NotNull; 9 | import java.util.List; 10 | 11 | /** 12 | * @Author Yoke 13 | * @Date 2019/02/10 下午2:51 14 | */ 15 | public interface ConvertService { 16 | 17 | OrderDto convertOrder(@NotNull Order order); 18 | 19 | List convertOrder(@NotNull List orders); 20 | 21 | Order convertOrderDto(@NotNull OrderDto orderDto); 22 | 23 | List convertOrderDto(@NotNull List orderDtoList); 24 | 25 | OrderItemDto convertOrderItem(@NotNull OrderItem orderItem); 26 | 27 | List convertOrderItem(@NotNull List orderItems); 28 | 29 | OrderItem convertOrderItemDto(@NotNull OrderItemDto orderItemDto); 30 | 31 | List convertOrderItemDto(@NotNull List orderItemDtoList); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/PanelService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.web.itemShow.dto.PanelDto; 5 | import com.yoke.poseidon.web.itemShow.entity.Panel; 6 | import org.springframework.lang.NonNull; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author ehereal 16 | * @since 2018-09-20 17 | */ 18 | public interface PanelService extends IService { 19 | 20 | List getPanelByRemark(@NonNull String remark, @NonNull Integer panelLimit, 21 | @NonNull Integer itemLimit); 22 | 23 | List getPanelByItemCatId(@NonNull Long itemCatId); 24 | 25 | List getPanelByItemCatId(@NonNull List itemCatIds); 26 | 27 | List getPanelWithItemsByItemCatId(@NonNull Long itemCatId, 28 | @NonNull Integer limit); 29 | 30 | List getPanelWithItemsByItemCatId(@NonNull List itemCatIds, 31 | @NonNull Integer itemLimit); 32 | 33 | PanelDto getPanelById(@NonNull Integer panelId); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/serviceImpl/PanelContentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.yoke.poseidon.web.itemShow.entity.PanelContent; 5 | import com.yoke.poseidon.web.itemShow.mapper.PanelContentMapper; 6 | import com.yoke.poseidon.web.itemShow.service.PanelContentService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.lang.NonNull; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | *

15 | * 服务实现类 16 | *

17 | * 18 | * @author ehereal 19 | * @since 2018-09-20 20 | */ 21 | @Service 22 | public class PanelContentServiceImpl extends ServiceImpl 23 | implements PanelContentService { 24 | 25 | @Autowired 26 | private PanelContentMapper panelContentMapper; 27 | 28 | @Override 29 | public List getItemIdByPanelId(@NonNull Integer panelId, Integer limit) { 30 | return panelContentMapper.selectItemIdsByPanelId(panelId, limit); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/serviceImpl/ConvertServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.serviceImpl; 2 | 3 | import com.yoke.poseidon.auth.dto.MemberDto; 4 | import com.yoke.poseidon.auth.entity.Member; 5 | import com.yoke.poseidon.auth.service.ConvertService; 6 | import org.modelmapper.ModelMapper; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.lang.NonNull; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | import java.util.stream.Collectors; 13 | 14 | /** 15 | * @Author Yoke 16 | * @Date 2018/11/25 下午2:21 17 | */ 18 | @Service 19 | public class ConvertServiceImpl implements ConvertService { 20 | 21 | @Autowired 22 | private ModelMapper modelMapper; 23 | 24 | @Override 25 | public MemberDto convertMember(@NonNull Member member) { 26 | return modelMapper.map(member, MemberDto.class); 27 | } 28 | 29 | @Override 30 | public List convertMember(@NonNull List members) { 31 | return members.stream().map(member -> modelMapper.map(member, MemberDto.class)) 32 | .collect(Collectors.toList()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /psd-config/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '2.0.5.RELEASE' 4 | } 5 | repositories { 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 10 | } 11 | } 12 | 13 | apply plugin: 'java' 14 | apply plugin: 'eclipse' 15 | apply plugin: 'org.springframework.boot' 16 | apply plugin: 'io.spring.dependency-management' 17 | 18 | group 'com.yoke.poseidon' 19 | version '1.0-SNAPSHOT' 20 | 21 | sourceCompatibility = 1.8 22 | 23 | repositories { 24 | mavenCentral() 25 | } 26 | bootJar { 27 | baseName = 'poseidon-eureka-config' 28 | version = '0.1.0' 29 | } 30 | ext { 31 | springCloudVersion = 'Finchley.SR1' 32 | } 33 | 34 | dependencies { 35 | compile("org.springframework.boot:spring-boot-starter-web") 36 | compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client') 37 | testCompile('org.springframework.boot:spring-boot-starter-test') 38 | } 39 | 40 | dependencyManagement { 41 | imports { 42 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/resources/mapper/ItemCartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/serviceImpl/MemberServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.yoke.poseidon.auth.dto.MemberDto; 5 | import com.yoke.poseidon.auth.entity.Member; 6 | import com.yoke.poseidon.auth.mapper.MemberMapper; 7 | import com.yoke.poseidon.auth.service.ConvertService; 8 | import com.yoke.poseidon.auth.service.MemberService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.lang.NonNull; 11 | import org.springframework.stereotype.Service; 12 | 13 | /** 14 | *

15 | * 服务实现类 16 | *

17 | * 18 | * @author yoke 19 | * @since 2018-11-25 20 | */ 21 | @Service 22 | public class MemberServiceImpl extends ServiceImpl 23 | implements MemberService { 24 | 25 | @Autowired 26 | private MemberMapper memberMapper; 27 | 28 | @Autowired 29 | private ConvertService convertService; 30 | 31 | @Override 32 | public MemberDto getByUsername(@NonNull String username) { 33 | Member member = memberMapper.selectByUsername(username); 34 | return convertService.convertMember(member); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/mapper/PanelContentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | select panel_content_id, pic_url, product_id, sort_order 8 | from poseidon.db_panel_content 9 | 10 | 11 | select * 12 | from poseidon.db_panel_content; 13 | 14 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/web/ItemSkuController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.web; 2 | 3 | import com.yoke.poseidon.web.itemShow.dto.Message; 4 | import com.yoke.poseidon.web.itemShow.entity.ItemAttribute; 5 | import com.yoke.poseidon.web.itemShow.service.ItemSkuService; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | *

17 | * 前端控制器 18 | *

19 | * 20 | * @author yoke 21 | * @since 2019-06-02 22 | */ 23 | @RestController 24 | @RequestMapping("/itemSku") 25 | public class ItemSkuController { 26 | 27 | private static final Logger LOGGER = LoggerFactory.getLogger(ItemSkuController.class); 28 | 29 | @Autowired 30 | private ItemSkuService itemSkuService; 31 | 32 | @GetMapping("/list") 33 | public Message list() { 34 | List itemAttributes = itemSkuService 35 | .getItemInfo("GROTIGJROTIGJROTI"); 36 | return Message.success(itemAttributes); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * @Author Yoke 15 | * @Date 2018/11/18 下午3:18 16 | */ 17 | @Configuration 18 | @EnableSwagger2 19 | public class SwaggerConfig { 20 | 21 | @Bean 22 | public Docket createRestApi() { 23 | return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() 24 | .apis(RequestHandlerSelectors.basePackage("com.yoke.poseidon.order.web")) 25 | .paths(PathSelectors.any()).build(); 26 | } 27 | 28 | private ApiInfo apiInfo() { 29 | return new ApiInfoBuilder().title("Poseidon Java 订单部分") 30 | .description("Poseidon Rest Api 文档").version("1.0").build(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * @Author Yoke 15 | * @Date 2018/11/18 下午3:18 16 | */ 17 | @Configuration 18 | @EnableSwagger2 19 | public class SwaggerConfig { 20 | 21 | @Bean 22 | public Docket createRestApi() { 23 | return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() 24 | .apis(RequestHandlerSelectors 25 | .basePackage("com.yoke.poseidon.cart.web")) 26 | .paths(PathSelectors.any()).build(); 27 | } 28 | 29 | private ApiInfo apiInfo() { 30 | return new ApiInfoBuilder().title("Poseidon Java版本购物车服务") 31 | .description("Poseidon Rest Api 文档").version("1.0").build(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * @Author Yoke 15 | * @Date 2018/11/18 下午3:18 16 | */ 17 | @Configuration 18 | @EnableSwagger2 19 | public class SwaggerConfig { 20 | 21 | @Bean 22 | public Docket createRestApi() { 23 | return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() 24 | .apis(RequestHandlerSelectors 25 | .basePackage("com.yoke.poseidon.member.web")) 26 | .paths(PathSelectors.any()).build(); 27 | } 28 | 29 | private ApiInfo apiInfo() { 30 | return new ApiInfoBuilder().title("Poseidon Java 商品展示部分") 31 | .description("Poseidon Rest Api 文档").version("1.0").build(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import springfox.documentation.builders.ApiInfoBuilder; 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * @Author Yoke 15 | * @Date 2018/11/18 下午3:18 16 | */ 17 | @Configuration 18 | @EnableSwagger2 19 | public class SwaggerConfig { 20 | 21 | @Bean 22 | public Docket createRestApi() { 23 | return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() 24 | .apis(RequestHandlerSelectors 25 | .basePackage("com.yoke.poseidon.web.itemShow.web")) 26 | .paths(PathSelectors.any()).build(); 27 | } 28 | 29 | private ApiInfo apiInfo() { 30 | return new ApiInfoBuilder().title("Poseidon Java 商品展示部分") 31 | .description("Poseidon Rest Api 文档").version("1.0").build(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/cache/ApplicationContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.cache; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ApplicationContextHolder implements ApplicationContextAware { 10 | 11 | private static ApplicationContext applicationContext; 12 | 13 | @Override 14 | public void setApplicationContext(ApplicationContext ctx) throws BeansException { 15 | applicationContext = ctx; 16 | } 17 | 18 | /** 19 | * Get application context from everywhere 20 | * @return 21 | */ 22 | public static ApplicationContext getApplicationContext() { 23 | return applicationContext; 24 | } 25 | 26 | /** 27 | * Get bean by class 28 | * @param clazz 29 | * @param 30 | * @return 31 | */ 32 | public static T getBean(Class clazz) { 33 | return applicationContext.getBean(clazz); 34 | } 35 | 36 | /** 37 | * Get bean by class name 38 | * @param name 39 | * @param 40 | * @return 41 | */ 42 | @SuppressWarnings("unchecked") 43 | public static T getBean(String name) { 44 | return (T) applicationContext.getBean(name); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/cache/ApplicationContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.cache; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ApplicationContextHolder implements ApplicationContextAware { 10 | 11 | private static ApplicationContext applicationContext; 12 | 13 | @Override 14 | public void setApplicationContext(ApplicationContext ctx) throws BeansException { 15 | applicationContext = ctx; 16 | } 17 | 18 | /** 19 | * Get application context from everywhere 20 | * @return 21 | */ 22 | public static ApplicationContext getApplicationContext() { 23 | return applicationContext; 24 | } 25 | 26 | /** 27 | * Get bean by class 28 | * @param clazz 29 | * @param 30 | * @return 31 | */ 32 | public static T getBean(Class clazz) { 33 | return applicationContext.getBean(clazz); 34 | } 35 | 36 | /** 37 | * Get bean by class name 38 | * @param name 39 | * @param 40 | * @return 41 | */ 42 | @SuppressWarnings("unchecked") 43 | public static T getBean(String name) { 44 | return (T) applicationContext.getBean(name); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/cache/ApplicationContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.cache; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ApplicationContextHolder implements ApplicationContextAware { 10 | 11 | private static ApplicationContext applicationContext; 12 | 13 | @Override 14 | public void setApplicationContext(ApplicationContext ctx) throws BeansException { 15 | applicationContext = ctx; 16 | } 17 | 18 | /** 19 | * Get application context from everywhere 20 | * @return 21 | */ 22 | public static ApplicationContext getApplicationContext() { 23 | return applicationContext; 24 | } 25 | 26 | /** 27 | * Get bean by class 28 | * @param clazz 29 | * @param 30 | * @return 31 | */ 32 | public static T getBean(Class clazz) { 33 | return applicationContext.getBean(clazz); 34 | } 35 | 36 | /** 37 | * Get bean by class name 38 | * @param name 39 | * @param 40 | * @return 41 | */ 42 | @SuppressWarnings("unchecked") 43 | public static T getBean(String name) { 44 | return (T) applicationContext.getBean(name); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/cache/ApplicationContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.cache; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ApplicationContextHolder implements ApplicationContextAware { 10 | 11 | private static ApplicationContext applicationContext; 12 | 13 | @Override 14 | public void setApplicationContext(ApplicationContext ctx) throws BeansException { 15 | applicationContext = ctx; 16 | } 17 | 18 | /** 19 | * Get application context from everywhere 20 | * @return 21 | */ 22 | public static ApplicationContext getApplicationContext() { 23 | return applicationContext; 24 | } 25 | 26 | /** 27 | * Get bean by class 28 | * @param clazz 29 | * @param 30 | * @return 31 | */ 32 | public static T getBean(Class clazz) { 33 | return applicationContext.getBean(clazz); 34 | } 35 | 36 | /** 37 | * Get bean by class name 38 | * @param name 39 | * @param 40 | * @return 41 | */ 42 | @SuppressWarnings("unchecked") 43 | public static T getBean(String name) { 44 | return (T) applicationContext.getBean(name); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/mapper/PanelContentMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yoke.poseidon.web.itemShow.cache.RedisCache; 5 | import com.yoke.poseidon.web.itemShow.entity.PanelContent; 6 | import org.apache.ibatis.annotations.CacheNamespace; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.lang.NonNull; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * Mapper 接口 15 | *

16 | * 17 | * @author ehereal 18 | * @since 2018-09-20 19 | */ 20 | //@CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 21 | public interface PanelContentMapper extends BaseMapper { 22 | 23 | /** 24 | * 根据版块id查询版块的内容信息 25 | * @param panelId 版块的id 26 | * @param sort 按照什么排序排序 27 | * @param limit 限制查询的条数 28 | * @return 查询得到的版块内容 29 | */ 30 | List selectByPanelId(@NonNull @Param("panelId") String panelId, 31 | @Param("sort") String sort, @Param("limit") Integer limit); 32 | 33 | /** 34 | * 根据版块id查询商品的id 35 | * @param panelId 版块的id 36 | * @param itemLimit 限制查询的条数 37 | * @return 查询得到的商品ids 38 | */ 39 | List selectItemIdsByPanelId(@Param("panelId") Integer panelId, 40 | @Param("limit") Integer itemLimit); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/mapper/PanelMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yoke.poseidon.web.itemShow.cache.RedisCache; 5 | import com.yoke.poseidon.web.itemShow.entity.Panel; 6 | import org.apache.ibatis.annotations.CacheNamespace; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.lang.NonNull; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * Mapper 接口 15 | *

16 | * 17 | * @author ehereal 18 | * @since 2018-09-20 19 | */ 20 | //@CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 21 | public interface PanelMapper extends BaseMapper { 22 | 23 | /** 24 | * 根据标签查询对应的版块信息 25 | * @param remark 标签名称 26 | * @param limit 限制的条数 27 | * @param sort 排序方式 28 | * @return 查询得到的版块信息 29 | */ 30 | List selectByRemark(@NonNull @Param("remark") String remark, 31 | @Param("sort") String sort, @Param("limit") Integer limit); 32 | 33 | /** 34 | * 根据商品分类id查找版块信息 35 | * @param itemCatId 商品分类的id 36 | * @return 查询得到的版块信息 37 | */ 38 | List selectByCatId(@NonNull @Param("item_cat_id") Long itemCatId); 39 | 40 | /** 41 | * 根据版块的id查找对应的板块信息 42 | */ 43 | Panel selectById(@NonNull @Param("panelId") Integer panelId); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/mapper/OrderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | select * 6 | from poseidon.db_order 7 | 8 | 9 | 13 | 22 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /psd-discovery/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '2.0.5.RELEASE' 4 | } 5 | repositories { 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}", 10 | 11 | ) 12 | } 13 | } 14 | 15 | apply plugin: 'java' 16 | apply plugin: 'eclipse' 17 | apply plugin: 'org.springframework.boot' 18 | apply plugin: 'io.spring.dependency-management' 19 | group 'com.yoke.poseidon' 20 | version '1.0-SNAPSHOT' 21 | 22 | sourceCompatibility = 1.8 23 | 24 | bootJar { 25 | baseName = 'poseidon-eureka-server' 26 | version = '0.1.0' 27 | } 28 | 29 | repositories { 30 | mavenCentral() 31 | } 32 | 33 | sourceCompatibility = 1.8 34 | 35 | targetCompatibility = 1.8 36 | 37 | ext { 38 | springCloudVersion = 'Finchley.SR1' 39 | } 40 | 41 | dependencies { 42 | compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-server') 43 | // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-hystrix 44 | compile('org.springframework.boot:spring-boot-starter-actuator') 45 | testCompile('org.springframework.boot:spring-boot-starter-test') 46 | } 47 | 48 | dependencyManagement { 49 | imports { 50 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /psd-web-member/out/production/resources/application.yml: -------------------------------------------------------------------------------- 1 | # SPRING PROFILES 2 | spring: 3 | # datasource 4 | datasource: 5 | url: jdbc:mysql://${db.server}:${db.port}/poseidon?useUnicode=true&characterEncoding=utf-8&useSSL=false 6 | username: ${db.username} 7 | password: ${db.password} 8 | type: com.alibaba.druid.pool.DruidDataSource 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | platform: mysql 11 | # mybatis plus 12 | profiles: 13 | active: dev 14 | mybatis-plus: 15 | mapper-locations: classpath:mapper/*Mapper.xml 16 | #实体扫描,多个package用逗号或者分号分隔 17 | typeAliasesPackage: com.yoke.poseidon.member.entity 18 | typeEnumsPackage: com.yoke.poseidon.member.entity 19 | global-config: 20 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 21 | id-type: 2 22 | #字段策略 0:"忽略判断",1:"非 NULL 判断",2:"非空判断" 23 | field-strategy: 2 24 | #驼峰下划线转换 25 | db-column-underline: true 26 | #刷新mapper 调试神器 27 | refresh-mapper: true 28 | #数据库大写下划线转换 29 | #capital-mode: true 30 | #逻辑删除配置(下面3个配置) 31 | logic-delete-value: 0 32 | logic-not-delete-value: 1 33 | # SQL 解析缓存,开启后多租户 @SqlParser 注解生效 34 | sql-parser-cache: true 35 | configuration: 36 | map-underscore-to-camel-case: true 37 | cache-enabled: true 38 | server: 39 | port: 9000 40 | logging: 41 | level: 42 | com.yoke.poseidon.member.mapper: debug 43 | -------------------------------------------------------------------------------- /psd-web-es/src/test/java/com/yoke/poseidon/elasticsearch/dao/CustomerRepositoryTest.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.dao; 2 | 3 | import com.yoke.poseidon.elasticsearch.entity.EsItem; 4 | import org.elasticsearch.index.query.QueryBuilders; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; 10 | import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; 11 | import org.springframework.data.elasticsearch.core.query.SearchQuery; 12 | import org.springframework.test.context.junit4.SpringRunner; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * @Author Yoke 18 | * @Date 2018/12/12 下午5:54 19 | */ 20 | @SpringBootTest 21 | @RunWith(SpringRunner.class) 22 | public class CustomerRepositoryTest { 23 | 24 | @Autowired 25 | private ItemRepository itemRepository; 26 | 27 | @Autowired 28 | private ElasticsearchTemplate elasticsearchTemplate; 29 | 30 | @Test 31 | public void test() { 32 | SearchQuery searchQuery = new NativeSearchQueryBuilder() 33 | .withQuery(QueryBuilders.fuzzyQuery("name", "yoke")).build(); 34 | List list = elasticsearchTemplate.queryForList(searchQuery, EsItem.class); 35 | list.forEach(System.out::println); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # SPRING PROFILES 2 | spring: 3 | # datasource 4 | datasource: 5 | url: jdbc:mysql://${db.server}:${db.port}/poseidon?useUnicode=true&characterEncoding=utf-8&useSSL=false 6 | username: ${db.username} 7 | password: ${db.password} 8 | type: com.alibaba.druid.pool.DruidDataSource 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | platform: mysql 11 | # mybatis plus 12 | profiles: 13 | active: dev 14 | 15 | mybatis-plus: 16 | mapper-locations: classpath:mapper/*Mapper.xml 17 | #实体扫描,多个package用逗号或者分号分隔 18 | typeAliasesPackage: com.yoke.poseidon.cart.entity 19 | typeEnumsPackage: com.yoke.poseidon.cart.entity 20 | global-config: 21 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 22 | id-type: 2 23 | #字段策略 0:"忽略判断",1:"非 NULL 判断",2:"非空判断" 24 | field-strategy: 2 25 | #驼峰下划线转换 26 | db-column-underline: true 27 | #刷新mapper 调试神器 28 | refresh-mapper: true 29 | #数据库大写下划线转换 30 | #capital-mode: true 31 | #逻辑删除配置(下面3个配置) 32 | logic-delete-value: 0 33 | logic-not-delete-value: 1 34 | # SQL 解析缓存,开启后多租户 @SqlParser 注解生效 35 | sql-parser-cache: true 36 | configuration: 37 | map-underscore-to-camel-case: true 38 | cache-enabled: true 39 | 40 | server: 41 | port: 8090 42 | logging: 43 | level: 44 | com.yoke.poseidon.cart.mapper: debug 45 | 46 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/web/ItemController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.web; 2 | 3 | import com.yoke.poseidon.elasticsearch.dto.Message; 4 | import com.yoke.poseidon.elasticsearch.entity.EsItem; 5 | import com.yoke.poseidon.elasticsearch.service.ItemService; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * @Author Yoke 12 | * @Date 2018/12/13 下午12:10 13 | */ 14 | @RestController 15 | @RequestMapping("/es") 16 | public class ItemController { 17 | 18 | private final ItemService itemService; 19 | 20 | public ItemController(ItemService itemService) { 21 | this.itemService = itemService; 22 | } 23 | 24 | @GetMapping("/search/{key}/{page}/{limit}") 25 | public Message searchByKey(@PathVariable("key") String key, 26 | @PathVariable("page") Integer page, @PathVariable("limit") Integer limit) { 27 | return Message.success(itemService.getByKey(key, page - 1, limit)); 28 | } 29 | 30 | @PostMapping("/recommend/{page}/{limit}") 31 | public Message recommend(@PathVariable Integer page, @PathVariable Integer limit, 32 | @RequestBody List itemIds) { 33 | return Message.success(itemService.recommend(itemIds, page - 1, limit)); 34 | } 35 | 36 | @PostMapping("/sync") 37 | public Message syncData() { 38 | List list = itemService.syncData(); 39 | return Message.success(list); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/cache/ApplicationContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.cache; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ApplicationContextHolder implements ApplicationContextAware { 10 | 11 | ApplicationContextHolder() { 12 | System.out.println("redis注册了"); 13 | } 14 | 15 | private static ApplicationContext applicationContext; 16 | 17 | @Override 18 | public void setApplicationContext(ApplicationContext ctx) throws BeansException { 19 | applicationContext = ctx; 20 | } 21 | 22 | /** 23 | * Get application context from everywhere 24 | * @return 25 | */ 26 | public static ApplicationContext getApplicationContext() { 27 | return applicationContext; 28 | } 29 | 30 | /** 31 | * Get bean by class 32 | * @param clazz 33 | * @param 34 | * @return 35 | */ 36 | public static T getBean(Class clazz) { 37 | return applicationContext.getBean(clazz); 38 | } 39 | 40 | /** 41 | * Get bean by class name 42 | * @param name 43 | * @param 44 | * @return 45 | */ 46 | @SuppressWarnings("unchecked") 47 | public static T getBean(String name) { 48 | return (T) applicationContext.getBean(name); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/service/ItemCatService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.web.itemShow.dto.ItemCatDto; 5 | import com.yoke.poseidon.web.itemShow.entity.ItemCat; 6 | import org.springframework.lang.NonNull; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author ehereal 16 | * @since 2018-09-20 17 | */ 18 | public interface ItemCatService extends IService { 19 | 20 | /** 21 | * 根据分类id查找子分类 22 | * @param pId 父分类id 23 | * @return 查询得到的子分类 24 | */ 25 | List getByParentId(@NonNull Long pId, Integer limit); 26 | 27 | /** 28 | * 根据父分类查找子分类的所有id 29 | */ 30 | List getIdsByParentId(@NonNull Long pId, Integer limit); 31 | 32 | /** 33 | * 查询得到根分类和商品数据 34 | */ 35 | List> getRootCat(Integer catLimit, Integer itemLimit); 36 | 37 | /** 38 | * 根据remark类型得到分类 39 | * @param remark remark的分类 40 | * @param limit 限制分类查询的条数 41 | * @return 查询得到的itemCat 42 | */ 43 | List getByRemark(@NonNull String remark, Integer limit); 44 | 45 | /** 46 | * 得到指定标签的分类和商品数据,用于首页展示 47 | */ 48 | List getItemCatWithItems(String remark, Integer catLimit, 49 | Integer itemLimit); 50 | 51 | /** 52 | * 根据父类id获取子分类的id 53 | */ 54 | List getChildCatIds(Long itemCatId); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.yoke.poseidon.order.dto.OrderDto; 7 | import com.yoke.poseidon.order.entity.Order; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | import javax.validation.constraints.NotNull; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | *

16 | * Mapper 接口 17 | *

18 | * 19 | * @author yoke 20 | * @since 2019-02-03 21 | */ 22 | // @CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 23 | 24 | public interface OrderMapper extends BaseMapper { 25 | 26 | /** 27 | * 根据买家id 28 | */ 29 | List selectByBuyerId(@NotNull @Param("buyer_id") Long buyerId); 30 | 31 | /** 32 | * 根据买家id获取指定状态的订单 33 | * @param page 当前页 34 | * @param buyerId 买家的id 35 | * @param status 订单的状态 36 | * @return 查询得到的订单 37 | */ 38 | IPage selectPageByBuyerId(Page page, @Param("buyer_id") Long buyerId, 39 | @Param("status") Integer status); 40 | 41 | List selectIdsByBuyerIdAndStatus(@NotNull @Param("buyer_id") Long buyerId, 42 | @NotNull @Param("status") Integer status); 43 | 44 | List> groupByStatus(@Param("buyer_id") Long buyer_id); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /psd-config/src/main/java/com/yoke/poseidon/config/jwt/JwtConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.config.jwt; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | /** 6 | * @Author Yoke 7 | * @Date 2018/11/24 下午8:19 8 | */ 9 | public class JwtConfig { 10 | 11 | @Value("${security.jwt.uri:/auth/**}") 12 | private String uri; 13 | 14 | @Value("${security.jwt.header:Authorization}") 15 | private String header; 16 | 17 | @Value("${security.jwt.prefix:Bearer }") 18 | private String prefix; 19 | 20 | @Value("${security.jwt.expiration:#{24*60*60}}") 21 | private int expiration; 22 | 23 | @Value("${security.jwt.secret:JwtSecretKey}") 24 | private String secret; 25 | 26 | public String getUri() { 27 | return uri; 28 | } 29 | 30 | public void setUri(String uri) { 31 | this.uri = uri; 32 | } 33 | 34 | public String getHeader() { 35 | return header; 36 | } 37 | 38 | public void setHeader(String header) { 39 | this.header = header; 40 | } 41 | 42 | public String getPrefix() { 43 | return prefix; 44 | } 45 | 46 | public void setPrefix(String prefix) { 47 | this.prefix = prefix; 48 | } 49 | 50 | public int getExpiration() { 51 | return expiration; 52 | } 53 | 54 | public void setExpiration(int expiration) { 55 | this.expiration = expiration; 56 | } 57 | 58 | public String getSecret() { 59 | return secret; 60 | } 61 | 62 | public void setSecret(String secret) { 63 | this.secret = secret; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/config/JwtConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | /** 6 | * @Author Yoke 7 | * @Date 2018/11/24 下午8:19 8 | */ 9 | public class JwtConfig { 10 | 11 | @Value("${security.jwt.uri:/auth/**}") 12 | private String uri; 13 | 14 | @Value("${security.jwt.header:Authorization}") 15 | private String header; 16 | 17 | @Value("${security.jwt.prefix:Bearer }") 18 | private String prefix; 19 | 20 | @Value("${security.jwt.expiration:#{24*60*60}}") 21 | private int expiration; 22 | 23 | @Value("${security.jwt.secret:JwtSecretKey}") 24 | private String secret; 25 | 26 | public String getUri() { 27 | return uri; 28 | } 29 | 30 | public void setUri(String uri) { 31 | this.uri = uri; 32 | } 33 | 34 | public String getHeader() { 35 | return header; 36 | } 37 | 38 | public void setHeader(String header) { 39 | this.header = header; 40 | } 41 | 42 | public String getPrefix() { 43 | return prefix; 44 | } 45 | 46 | public void setPrefix(String prefix) { 47 | this.prefix = prefix; 48 | } 49 | 50 | public int getExpiration() { 51 | return expiration; 52 | } 53 | 54 | public void setExpiration(int expiration) { 55 | this.expiration = expiration; 56 | } 57 | 58 | public String getSecret() { 59 | return secret; 60 | } 61 | 62 | public void setSecret(String secret) { 63 | this.secret = secret; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /psd-gateway/src/main/java/com/yoke/poseidon/gateway/config/JwtConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | /** 6 | * @Author Yoke 7 | * @Date 2018/11/24 下午8:19 8 | */ 9 | public class JwtConfig { 10 | 11 | @Value("${security.jwt.uri:/auth/**}") 12 | private String uri; 13 | 14 | @Value("${security.jwt.header:Authorization}") 15 | private String header; 16 | 17 | @Value("${security.jwt.prefix:Bearer }") 18 | private String prefix; 19 | 20 | @Value("${security.jwt.expiration:#{24*60*60}}") 21 | private int expiration; 22 | 23 | @Value("${security.jwt.secret:JwtSecretKey}") 24 | private String secret; 25 | 26 | public String getUri() { 27 | return uri; 28 | } 29 | 30 | public void setUri(String uri) { 31 | this.uri = uri; 32 | } 33 | 34 | public String getHeader() { 35 | return header; 36 | } 37 | 38 | public void setHeader(String header) { 39 | this.header = header; 40 | } 41 | 42 | public String getPrefix() { 43 | return prefix; 44 | } 45 | 46 | public void setPrefix(String prefix) { 47 | this.prefix = prefix; 48 | } 49 | 50 | public int getExpiration() { 51 | return expiration; 52 | } 53 | 54 | public void setExpiration(int expiration) { 55 | this.expiration = expiration; 56 | } 57 | 58 | public String getSecret() { 59 | return secret; 60 | } 61 | 62 | public void setSecret(String secret) { 63 | this.secret = secret; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/service/ItemCartService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.yoke.poseidon.cart.dto.ItemCartDto; 5 | import com.yoke.poseidon.cart.entity.ItemCart; 6 | import org.springframework.lang.NonNull; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | import javax.validation.constraints.NotNull; 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * 购物车 服务类 15 | *

16 | * 17 | * @author yoke 18 | * @since 2019-01-11 19 | */ 20 | public interface ItemCartService extends IService { 21 | 22 | /** 23 | * 查询购物中是否包含该商品,包含增加数量,无则添加 24 | */ 25 | @Transactional 26 | boolean add(@NonNull ItemCartDto itemCartDto); 27 | 28 | /** 29 | * 根据用户名称获取购物车信息 30 | */ 31 | List list(@NonNull String nickName); 32 | 33 | /** 34 | * 更新购物车中某个商品的数量 35 | */ 36 | boolean updateQuantity(@NonNull String nickName, @NonNull String itemId, 37 | @NonNull Integer quantity); 38 | 39 | /** 40 | * 更新购物车项的信息为已购买状态 41 | */ 42 | boolean submitOrder(@NotNull Long itemCartId); 43 | 44 | /** 45 | * 更新多个购物车条目为已购买状态 46 | */ 47 | boolean submitOrder(@NotNull List itemCartIds); 48 | 49 | /** 50 | * 清空购物车 51 | */ 52 | boolean clear(@NonNull String nickName); 53 | 54 | /** 55 | * 清空购物车中的某一种商品 56 | */ 57 | boolean delete(@NonNull String nickName, @NonNull String itemId); 58 | 59 | } 60 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/config/JwtConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.config; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | 5 | /** 6 | * @Author Yoke 7 | * @Date 2018/11/24 下午8:19 8 | */ 9 | public class JwtConfig { 10 | 11 | @Value("${security.jwt.uri:/auth/**}") 12 | private String uri; 13 | 14 | @Value("${security.jwt.header:Authorization}") 15 | private String header; 16 | 17 | @Value("${security.jwt.prefix:Bearer }") 18 | private String prefix; 19 | 20 | @Value("${security.jwt.expiration:#{24*60*60}}") 21 | private int expiration; 22 | 23 | @Value("${security.jwt.secret:JwtSecretKey}") 24 | private String secret; 25 | 26 | public String getUri() { 27 | return uri; 28 | } 29 | 30 | public void setUri(String uri) { 31 | this.uri = uri; 32 | } 33 | 34 | public String getHeader() { 35 | return header; 36 | } 37 | 38 | public void setHeader(String header) { 39 | this.header = header; 40 | } 41 | 42 | public String getPrefix() { 43 | return prefix; 44 | } 45 | 46 | public void setPrefix(String prefix) { 47 | this.prefix = prefix; 48 | } 49 | 50 | public int getExpiration() { 51 | return expiration; 52 | } 53 | 54 | public void setExpiration(int expiration) { 55 | this.expiration = expiration; 56 | } 57 | 58 | public String getSecret() { 59 | return secret; 60 | } 61 | 62 | public void setSecret(String secret) { 63 | this.secret = secret; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /psd-web-order/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # SPRING PROFILES 2 | spring: 3 | # datasource 4 | datasource: 5 | url: jdbc:mysql://${db.server}:${db.port}/poseidon?useUnicode=true&characterEncoding=utf-8&useSSL=false 6 | username: ${db.username} 7 | password: ${db.password} 8 | type: com.alibaba.druid.pool.DruidDataSource 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | platform: mysql 11 | profiles: 12 | active: dev 13 | redis: 14 | host: www.poseidon.com 15 | password: ${common.password} 16 | jackson: 17 | date-format: yyyy年MM月dd日 HH分ss秒 18 | mybatis-plus: 19 | mapper-locations: classpath:mapper/*Mapper.xml 20 | #实体扫描,多个package用逗号或者分号分隔 21 | typeAliasesPackage: com.yoke.poseidon.order.entity 22 | typeEnumsPackage: com.yoke.poseidon.order.entity 23 | global-config: 24 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 25 | id-type: 3 26 | #字段策略 0:"忽略判断",1:"非 NULL 判断",2:"非空判断" 27 | field-strategy: 2 28 | #驼峰下划线转换 29 | db-column-underline: true 30 | #刷新mapper 调试神器 31 | refresh-mapper: true 32 | #数据库大写下划线转换 33 | #capital-mode: true 34 | #逻辑删除配置(下面3个配置) 35 | logic-delete-value: 0 36 | logic-not-delete-value: 1 37 | # SQL 解析缓存,开启后多租户 @SqlParser 注解生效 38 | sql-parser-cache: true 39 | configuration: 40 | map-underscore-to-camel-case: true 41 | cache-enabled: true 42 | server: 43 | port: 9100 44 | logging: 45 | level: 46 | com.yoke.poseidon.order.mapper: debug -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | ribbon.ReadTimeout: 120000 2 | #请求连接的超时时间 3 | ribbon.ConnectTimeout: 30000 4 | # SPRING PROFILES 5 | spring: 6 | # datasource 7 | datasource: 8 | url: jdbc:mysql://${db.server}:${db.port}/poseidon?useUnicode=true&characterEncoding=utf-8&useSSL=false 9 | username: ${db.username} 10 | password: ${db.password} 11 | type: com.alibaba.druid.pool.DruidDataSource 12 | driver-class-name: com.mysql.cj.jdbc.Driver 13 | platform: mysql 14 | # mybatis plus 15 | profiles: 16 | active: dev 17 | mybatis-plus: 18 | mapper-locations: classpath:mapper/*Mapper.xml 19 | #实体扫描,多个package用逗号或者分号分隔 20 | typeAliasesPackage: com.yoke.poseidon.web.itemShow.entity 21 | typeEnumsPackage: com.yoke.poseidon.web.itemShow.entity 22 | global-config: 23 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 24 | id-type: 2 25 | #字段策略 0:"忽略判断",1:"非 NULL 判断",2:"非空判断" 26 | field-strategy: 2 27 | #驼峰下划线转换 28 | db-column-underline: true 29 | #刷新mapper 调试神器 30 | refresh-mapper: true 31 | #数据库大写下划线转换 32 | #capital-mode: true 33 | #逻辑删除配置(下面3个配置) 34 | logic-delete-value: 0 35 | logic-not-delete-value: 1 36 | # SQL 解析缓存,开启后多租户 @SqlParser 注解生效 37 | sql-parser-cache: true 38 | configuration: 39 | map-underscore-to-camel-case: true 40 | cache-enabled: true 41 | 42 | server: 43 | port: 8080 44 | logging: 45 | level: 46 | com.yoke.poseidon.web.itemShow.mapper: debug 47 | 48 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/serviceImpl/ConvertServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.serviceImpl; 2 | 3 | import com.yoke.poseidon.cart.dto.ItemCartDto; 4 | import com.yoke.poseidon.cart.entity.ItemCart; 5 | import com.yoke.poseidon.cart.service.ConvertService; 6 | import org.modelmapper.ModelMapper; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | import java.util.stream.Collectors; 12 | 13 | /** 14 | * @Author Yoke 15 | * @Date 2019/01/11 下午8:51 16 | */ 17 | @Service 18 | public class ConvertServiceImpl implements ConvertService { 19 | 20 | @Autowired 21 | private ModelMapper modelMapper; 22 | 23 | @Override 24 | public ItemCartDto convert(ItemCart itemCart) { 25 | return modelMapper.map(itemCart, ItemCartDto.class); 26 | } 27 | 28 | @Override 29 | public List convert(List itemCartList) { 30 | return itemCartList.stream() 31 | .map(itemCart -> modelMapper.map(itemCart, ItemCartDto.class)) 32 | .collect(Collectors.toList()); 33 | } 34 | 35 | @Override 36 | public ItemCart convertToBean(ItemCartDto itemCartDto) { 37 | return modelMapper.map(itemCartDto, ItemCart.class); 38 | } 39 | 40 | @Override 41 | public List convertToBean(List itemCartDtos) { 42 | return itemCartDtos.stream() 43 | .map(itemCartDto -> modelMapper.map(itemCartDto, ItemCart.class)) 44 | .collect(Collectors.toList()); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/dto/AddressDto.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.dto; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @Author Yoke 7 | * @Date 2019/03/31 上午11:33 8 | */ 9 | public class AddressDto implements Serializable { 10 | 11 | private static final long serialVersionUID = -5794470688982496395L; 12 | 13 | private Long addressId; 14 | 15 | private Integer isDefault; 16 | 17 | private String streetName; 18 | 19 | private String tel; 20 | 21 | private Long userId; 22 | 23 | private String userName; 24 | 25 | public Long getAddressId() { 26 | return addressId; 27 | } 28 | 29 | public void setAddressId(Long addressId) { 30 | this.addressId = addressId; 31 | } 32 | 33 | public Integer getIsDefault() { 34 | return isDefault; 35 | } 36 | 37 | public void setIsDefault(Integer isDefault) { 38 | this.isDefault = isDefault; 39 | } 40 | 41 | public String getStreetName() { 42 | return streetName; 43 | } 44 | 45 | public void setStreetName(String streetName) { 46 | this.streetName = streetName; 47 | } 48 | 49 | public String getTel() { 50 | return tel; 51 | } 52 | 53 | public void setTel(String tel) { 54 | this.tel = tel; 55 | } 56 | 57 | public Long getUserId() { 58 | return userId; 59 | } 60 | 61 | public void setUserId(Long userId) { 62 | this.userId = userId; 63 | } 64 | 65 | public String getUserName() { 66 | return userName; 67 | } 68 | 69 | public void setUserName(String userName) { 70 | this.userName = userName; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/event/EventDispatcher.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.event; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.yoke.poseidon.web.itemShow.dto.ItemDto; 6 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.stereotype.Component; 10 | 11 | /** 12 | * @Author Yoke 13 | * @Date 2019/01/29 下午12:24 14 | */ 15 | @Component 16 | public class EventDispatcher { 17 | 18 | private final RabbitTemplate rabbitTemplate; 19 | 20 | private final String itemExchange; 21 | 22 | private final String itemVaryKey; 23 | 24 | private final ObjectMapper objectMapper; 25 | 26 | @Autowired 27 | public EventDispatcher(RabbitTemplate rabbitTemplate, 28 | @Value("${item.exchange}") String itemExchange, 29 | @Value("${item.vary_key}") String itemVaryKey, ObjectMapper objectMapper) { 30 | this.rabbitTemplate = rabbitTemplate; 31 | this.itemExchange = itemExchange; 32 | this.itemVaryKey = itemVaryKey; 33 | this.objectMapper = objectMapper; 34 | } 35 | 36 | public void send(ItemDto itemDto) { 37 | try { 38 | rabbitTemplate.convertAndSend(itemExchange, itemVaryKey, 39 | objectMapper.writeValueAsString(itemDto)); 40 | } 41 | catch (JsonProcessingException e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /psd-web-member/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # SPRING PROFILES 2 | spring: 3 | # datasource 4 | datasource: 5 | url: jdbc:mysql://${db.server}:${db.port}/poseidon?useUnicode=true&characterEncoding=utf-8&useSSL=false 6 | username: ${db.username} 7 | password: ${db.password} 8 | type: com.alibaba.druid.pool.DruidDataSource 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | platform: mysql 11 | # mybatis plus 12 | mybatis-plus: 13 | mapper-locations: classpath:mapper/*Mapper.xml 14 | #实体扫描,多个package用逗号或者分号分隔 15 | typeAliasesPackage: com.yoke.poseidon.member.entity 16 | typeEnumsPackage: com.yoke.poseidon.member.entity 17 | global-config: 18 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 19 | id-type: 2 20 | #字段策略 0:"忽略判断",1:"非 NULL 判断",2:"非空判断" 21 | field-strategy: 2 22 | #驼峰下划线转换 23 | db-column-underline: true 24 | #刷新mapper 调试神器 25 | refresh-mapper: true 26 | #数据库大写下划线转换 27 | #capital-mode: true 28 | #逻辑删除配置(下面3个配置) 29 | logic-delete-value: 0 30 | logic-not-delete-value: 1 31 | # SQL 解析缓存,开启后多租户 @SqlParser 注解生效 32 | sql-parser-cache: true 33 | configuration: 34 | map-underscore-to-camel-case: true 35 | cache-enabled: true 36 | server: 37 | port: 9000 38 | logging: 39 | level: 40 | com.yoke.poseidon.member.mapper: debug 41 | db: 42 | server: localhost 43 | port: 3306 44 | username: root 45 | password: 123456 46 | eureka: 47 | client: 48 | serviceUrl: 49 | defaultZone: http://localhost:8761/eureka/ 50 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/serviceImpl/SecurityUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.serviceImpl; 2 | 3 | import com.yoke.poseidon.auth.entity.Member; 4 | import com.yoke.poseidon.auth.mapper.MemberMapper; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.core.userdetails.User; 7 | import org.springframework.security.core.userdetails.UserDetails; 8 | import org.springframework.security.core.userdetails.UserDetailsService; 9 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 10 | import org.springframework.security.crypto.factory.PasswordEncoderFactories; 11 | import org.springframework.security.crypto.password.PasswordEncoder; 12 | import org.springframework.stereotype.Service; 13 | 14 | /** 15 | * @Author Yoke 16 | * @Date 2018/11/25 下午5:18 17 | */ 18 | @Service 19 | public class SecurityUserDetailsService implements UserDetailsService { 20 | 21 | @Autowired 22 | private MemberMapper memberMapper; 23 | 24 | @Override 25 | public UserDetails loadUserByUsername(String username) 26 | throws UsernameNotFoundException { 27 | Member member = memberMapper.selectByUsername(username); 28 | if (member == null) { 29 | throw new UsernameNotFoundException("user not found"); 30 | } 31 | PasswordEncoder encoder = PasswordEncoderFactories 32 | .createDelegatingPasswordEncoder(); 33 | String password = encoder.encode(member.getPassword()); 34 | return User.withUsername(username).password(password).roles("").build(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.yoke.poseidon.order.dto.OrderDto; 6 | import com.yoke.poseidon.order.entity.Order; 7 | 8 | import javax.validation.constraints.NotNull; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | *

14 | * 服务类 15 | *

16 | * 17 | * @author yoke 18 | * @since 2019-02-03 19 | */ 20 | public interface OrderService extends IService { 21 | 22 | /** 23 | * 根据买家id获取订单信息 24 | */ 25 | List getByBuyerId(@NotNull Long buyerId, @NotNull Integer status); 26 | 27 | /** 28 | * 创建一个新订单 29 | */ 30 | OrderDto createOrder(@NotNull OrderDto orderDto); 31 | 32 | /** 33 | * 取消指定id的订单信息 34 | */ 35 | boolean cancelOrder(@NotNull String orderId); 36 | 37 | /** 38 | * 根据买家的id查询买家的订单,进行分页后的数据 39 | * @param buyerId 买家id 40 | * @param status 订单的状态 41 | * @param current 当前页数 42 | * @param size 每页显示的条数 43 | * @return 分页后的数据 44 | */ 45 | IPage getPageByBuyerId(Long buyerId, Integer status, long current, 46 | long size); 47 | 48 | /** 49 | * 修改订单的状态 50 | * @param orderId 订单的id号 51 | * @param status 0: 未支付,1:已支付,待收货,2是已收货 52 | * @return 修改订单状态是否成功 53 | */ 54 | boolean update(String orderId, Integer status); 55 | 56 | /** 57 | * 订单根据状态进行分类统计 58 | * @param buyerId 买家id 59 | * @return 统计得到的分类以及条数 60 | */ 61 | List> statisticStatus(Long buyerId); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /psd-gateway/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" 7 | classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE" 8 | } 9 | } 10 | 11 | apply plugin: 'org.springframework.boot' 12 | apply plugin: 'java' 13 | group 'com.yoke.poseidon.gateway' 14 | apply plugin: "io.spring.dependency-management" 15 | version '1.0-SNAPSHOT' 16 | repositories { 17 | mavenCentral() 18 | } 19 | 20 | group 'com.yoke.poseidon' 21 | version '1.0-SNAPSHOT' 22 | 23 | sourceCompatibility = 1.8 24 | 25 | repositories { 26 | mavenCentral() 27 | } 28 | bootJar { 29 | baseName = 'psd-gateway' 30 | version = '0.1.0' 31 | } 32 | dependencies { 33 | compile('org.springframework.cloud:spring-cloud-starter-netflix-zuul') 34 | compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client') 35 | compile("org.springframework.boot:spring-boot-starter-web") 36 | // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security 37 | compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.1.0.RELEASE' 38 | // https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt 39 | compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1' 40 | 41 | testCompile group: 'junit', name: 'junit', version: '4.12' 42 | } 43 | dependencyManagement { 44 | imports { 45 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 46 | } 47 | } -------------------------------------------------------------------------------- /psd-web-auth/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # SPRING PROFILES 2 | spring: 3 | # datasource 4 | datasource: 5 | url: jdbc:mysql://${db.server}:${db.port}/poseidon?useUnicode=true&characterEncoding=utf-8&useSSL=false 6 | username: ${db.username} 7 | password: ${db.password} 8 | type: com.alibaba.druid.pool.DruidDataSource 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | platform: mysql 11 | # mybatis plus 12 | profiles: 13 | active: dev 14 | 15 | mybatis-plus: 16 | mapper-locations: classpath:mapper/*Mapper.xml 17 | #实体扫描,多个package用逗号或者分号分隔 18 | typeAliasesPackage: com.yoke.poseidon.auth.entity 19 | typeEnumsPackage: com.yoke.poseidon.auth.entity 20 | global-config: 21 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 22 | id-type: 2 23 | #字段策略 0:"忽略判断",1:"非 NULL 判断",2:"非空判断" 24 | field-strategy: 2 25 | #驼峰下划线转换 26 | db-column-underline: true 27 | #刷新mapper 调试神器 28 | refresh-mapper: true 29 | #数据库大写下划线转换 30 | #capital-mode: true 31 | #逻辑删除配置(下面3个配置) 32 | logic-delete-value: 0 33 | logic-not-delete-value: 1 34 | # SQL 解析缓存,开启后多租户 @SqlParser 注解生效 35 | sql-parser-cache: true 36 | configuration: 37 | map-underscore-to-camel-case: true 38 | cache-enabled: true 39 | 40 | server: 41 | port: 9200 42 | logging: 43 | level: 44 | com.yoke.poseidon.auth.mapper: debug 45 | 46 | db: 47 | server: www.test.com 48 | port: 13306 49 | username: root 50 | password: 'FJEOIRFWQ132EW' 51 | eureka: 52 | client: 53 | serviceUrl: 54 | defaultZone: http://localhost:8761/eureka/ 55 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/entity/ItemAttributeName.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | *

11 | * 商品参数的名称 12 | *

13 | * 14 | * @author yoke 15 | * @since 2019-06-02 16 | */ 17 | @TableName("db_item_attribute_name") 18 | public class ItemAttributeName implements Serializable { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @TableId(value = "attribute_name_id", type = IdType.AUTO) 23 | private Long attributeNameId; 24 | 25 | /** 26 | * 参数名称 27 | */ 28 | private String title; 29 | 30 | private Long cId; 31 | 32 | 33 | public Long getAttributeNameId() { 34 | return attributeNameId; 35 | } 36 | 37 | public void setAttributeNameId(Long attributeNameId) { 38 | this.attributeNameId = attributeNameId; 39 | } 40 | 41 | public String getTitle() { 42 | return title; 43 | } 44 | 45 | public void setTitle(String title) { 46 | this.title = title; 47 | } 48 | 49 | public Long getcId() { 50 | return cId; 51 | } 52 | 53 | public void setcId(Long cId) { 54 | this.cId = cId; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return "ItemAttributeName{" + 60 | "attributeNameId=" + attributeNameId + 61 | ", title=" + title + 62 | ", cId=" + cId + 63 | "}"; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /psd-web-view/src/main/resources/mapper/PanelMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | select panel_id, 7 | limit_num, 8 | name, 9 | remark, 10 | sort_order, 11 | status, 12 | type, 13 | item_cat_id 14 | from poseidon.db_panel 15 | 16 | 17 | select * 18 | from poseidon.db_panel 19 | 20 | 35 | 39 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/mapper/ItemCatMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yoke.poseidon.web.itemShow.entity.ItemCat; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.lang.NonNull; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | *

12 | * Mapper 接口 13 | *

14 | * 15 | * @author ehereal 16 | * @since 2018-09-20 17 | */ 18 | // @CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 19 | public interface ItemCatMapper extends BaseMapper { 20 | 21 | // ItemCat selectById(@NonNull Long id); 22 | 23 | /** 24 | * 根据分类id查找子分类 25 | * @param pId 父分类id 26 | * @return 查询得到的子分类 27 | */ 28 | List selectByParentId(@NonNull @Param("pId") Long pId, 29 | @Param("sort") String sort, @Param("limit") Integer limit); 30 | 31 | /** 32 | * 根据父分类查找子分类的所有id 33 | */ 34 | List selectIdsByParentId(@NonNull @Param("pId") Long pId, 35 | @Param("sort") String sort, @Param("limit") Integer limit); 36 | 37 | /** 38 | * 查询得到根分类 39 | * @param sort 排序方式 40 | * @param limit 限制查询的条数 41 | * @return 查询得到的数据 42 | */ 43 | List selectRootCat(@Param("sort") String sort, 44 | @Param("limit") Integer limit); 45 | 46 | /** 47 | * 根据remark类型得到分类 48 | * @param remark 标记 49 | * @param sort 排序方式 50 | * @param limit 限制查询的条数 51 | * @return 查询得到的数据 52 | */ 53 | List selectByRemark(@NonNull @Param("remark") String remark, 54 | @Param("sort") String sort, @Param("limit") Integer limit); 55 | 56 | int update(@Param("itemCat") ItemCat itemCat); 57 | 58 | List selectChildIdsById(@NonNull @Param("parent_id") Long itemCatId); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/dto/PanelContentDto.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.dto; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @Author Yoke 7 | * @Date 2018/11/22 下午7:32 8 | */ 9 | public class PanelContentDto implements Serializable { 10 | 11 | private static final long serialVersionUID = -2008351554032341498L; 12 | 13 | private Integer panelContentId; 14 | 15 | private String panelId; 16 | 17 | private String picUrl; 18 | 19 | private String productId; 20 | 21 | private Integer sortOrder; 22 | 23 | public String getPanelId() { 24 | return panelId; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "PanelContentDto{" + "panelContentId=" + panelContentId + ", panelId='" 30 | + panelId + '\'' + ", picUrl='" + picUrl + '\'' + ", productId='" 31 | + productId + '\'' + ", sortOrder=" + sortOrder + '}'; 32 | } 33 | 34 | public void setPanelId(String panelId) { 35 | this.panelId = panelId; 36 | } 37 | 38 | public static long getSerialVersionUID() { 39 | return serialVersionUID; 40 | } 41 | 42 | public Integer getPanelContentId() { 43 | return panelContentId; 44 | } 45 | 46 | public void setPanelContentId(Integer panelContentId) { 47 | this.panelContentId = panelContentId; 48 | } 49 | 50 | public String getPicUrl() { 51 | return picUrl; 52 | } 53 | 54 | public void setPicUrl(String picUrl) { 55 | this.picUrl = picUrl; 56 | } 57 | 58 | public String getProductId() { 59 | return productId; 60 | } 61 | 62 | public void setProductId(String productId) { 63 | this.productId = productId; 64 | } 65 | 66 | public Integer getSortOrder() { 67 | return sortOrder; 68 | } 69 | 70 | public void setSortOrder(Integer sortOrder) { 71 | this.sortOrder = sortOrder; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/entity/ItemAttributeValue.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author yoke 15 | * @since 2019-06-02 16 | */ 17 | @TableName("db_item_attribute_value") 18 | public class ItemAttributeValue implements Serializable { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @TableId(value = "attribute_value_id", type = IdType.AUTO) 23 | private Long attributeValueId; 24 | 25 | /** 26 | * 关联商品参数表 27 | */ 28 | private Long attributeNameId; 29 | 30 | private String attributeValue; 31 | 32 | 33 | public Long getAttributeValueId() { 34 | return attributeValueId; 35 | } 36 | 37 | public void setAttributeValueId(Long attributeValueId) { 38 | this.attributeValueId = attributeValueId; 39 | } 40 | 41 | public Long getAttributeNameId() { 42 | return attributeNameId; 43 | } 44 | 45 | public void setAttributeNameId(Long attributeNameId) { 46 | this.attributeNameId = attributeNameId; 47 | } 48 | 49 | public String getAttributeValue() { 50 | return attributeValue; 51 | } 52 | 53 | public void setAttributeValue(String attributeValue) { 54 | this.attributeValue = attributeValue; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return "ItemAttributeValue{" + 60 | "attributeValueId=" + attributeValueId + 61 | ", attributeNameId=" + attributeNameId + 62 | ", attributeValue=" + attributeValue + 63 | "}"; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/dto/Message.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.dto; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2018/12/24 上午8:29 10 | */ 11 | public class Message implements Serializable { 12 | 13 | private static final long serialVersionUID = -3788526494940077434L; 14 | 15 | private int code; 16 | 17 | private String msg; 18 | 19 | private Object data; 20 | 21 | /** 22 | * 普通返回 23 | * @param data 获取的数据 24 | */ 25 | public static Message success(Object data) { 26 | return new Message(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), data); 27 | } 28 | 29 | public static Message success(String msg, Object data) { 30 | return new Message(HttpStatus.OK.value(), msg, data); 31 | } 32 | 33 | /** 34 | * 普通返回错误的数据 35 | */ 36 | public static Message failed() { 37 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), 38 | HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), null); 39 | } 40 | 41 | public static Message failed(String msg) { 42 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg, null); 43 | } 44 | 45 | public int getCode() { 46 | return code; 47 | } 48 | 49 | public void setCode(int code) { 50 | this.code = code; 51 | } 52 | 53 | public String getMsg() { 54 | return msg; 55 | } 56 | 57 | public void setMsg(String msg) { 58 | this.msg = msg; 59 | } 60 | 61 | public Object getData() { 62 | return data; 63 | } 64 | 65 | public void setData(Object data) { 66 | this.data = data; 67 | } 68 | 69 | private Message(int code, String msg, Object data) { 70 | this.code = code; 71 | this.msg = msg; 72 | this.data = data; 73 | } 74 | 75 | Message() { 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return "Message{" + "code=" + code + ", msg='" + msg + '\'' + ", data=" + data 81 | + '}'; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/dto/Message.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.dto; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2018/12/24 上午8:29 10 | */ 11 | public class Message implements Serializable { 12 | 13 | private static final long serialVersionUID = -3788526494940077434L; 14 | 15 | private int code; 16 | 17 | private String msg; 18 | 19 | private Object data; 20 | 21 | /** 22 | * 普通返回 23 | * @param data 获取的数据 24 | */ 25 | public static Message success(Object data) { 26 | return new Message(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), data); 27 | } 28 | 29 | public static Message success(String msg, Object data) { 30 | return new Message(HttpStatus.OK.value(), msg, data); 31 | } 32 | 33 | /** 34 | * 普通返回错误的数据 35 | */ 36 | public static Message failed() { 37 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), 38 | HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), null); 39 | } 40 | 41 | public static Message failed(String msg) { 42 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg, null); 43 | } 44 | 45 | public int getCode() { 46 | return code; 47 | } 48 | 49 | public void setCode(int code) { 50 | this.code = code; 51 | } 52 | 53 | public String getMsg() { 54 | return msg; 55 | } 56 | 57 | public void setMsg(String msg) { 58 | this.msg = msg; 59 | } 60 | 61 | public Object getData() { 62 | return data; 63 | } 64 | 65 | public void setData(Object data) { 66 | this.data = data; 67 | } 68 | 69 | public Message(int code, String msg, Object data) { 70 | this.code = code; 71 | this.msg = msg; 72 | this.data = data; 73 | } 74 | 75 | Message() { 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return "Message{" + "code=" + code + ", msg='" + msg + '\'' + ", data=" + data 81 | + '}'; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/dto/Message.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.dto; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2018/12/24 上午8:29 10 | */ 11 | public class Message implements Serializable { 12 | 13 | private static final long serialVersionUID = -3788526494940077434L; 14 | 15 | private int code; 16 | 17 | private String msg; 18 | 19 | private Object data; 20 | 21 | /** 22 | * 普通返回 23 | * @param data 获取的数据 24 | */ 25 | public static Message success(Object data) { 26 | return new Message(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), data); 27 | } 28 | 29 | public static Message success(String msg, Object data) { 30 | return new Message(HttpStatus.OK.value(), msg, data); 31 | } 32 | 33 | /** 34 | * 普通返回错误的数据 35 | */ 36 | public static Message failed() { 37 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), 38 | HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), null); 39 | } 40 | 41 | public static Message failed(String msg) { 42 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg, null); 43 | } 44 | 45 | public int getCode() { 46 | return code; 47 | } 48 | 49 | public void setCode(int code) { 50 | this.code = code; 51 | } 52 | 53 | public String getMsg() { 54 | return msg; 55 | } 56 | 57 | public void setMsg(String msg) { 58 | this.msg = msg; 59 | } 60 | 61 | public Object getData() { 62 | return data; 63 | } 64 | 65 | public void setData(Object data) { 66 | this.data = data; 67 | } 68 | 69 | private Message(int code, String msg, Object data) { 70 | this.code = code; 71 | this.msg = msg; 72 | this.data = data; 73 | } 74 | 75 | Message() { 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return "Message{" + "code=" + code + ", msg='" + msg + '\'' + ", data=" + data 81 | + '}'; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/mapper/ItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.yoke.poseidon.web.itemShow.cache.RedisCache; 5 | import com.yoke.poseidon.web.itemShow.entity.Item; 6 | import org.apache.ibatis.annotations.CacheNamespace; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.lang.NonNull; 9 | import org.springframework.lang.Nullable; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | *

15 | * 商品表 Mapper 接口 16 | *

17 | * 18 | * @author yoke 19 | * @since 2018-10-30 20 | */ 21 | //@CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class) 22 | public interface ItemMapper extends BaseMapper { 23 | 24 | Item select(@Param("itemId") String itemId, @Param("blob") boolean blob); 25 | 26 | /** 27 | * 根据一群ids查询得到相对应的商品 28 | * @param itemIds 商品ids 29 | * @param sort 排序方式,默认根据sort_order升序排列 30 | * @param blob 是否包含大字段信息 31 | * @return 查询得到的商品列表 32 | */ 33 | List selectIdIn(@NonNull @Param("ids") List itemIds, 34 | @Param("sort") String sort, @NonNull @Param("blob") boolean blob); 35 | 36 | /** 37 | * 根据商品id得到Item的部分信息,不包括BLOB 38 | * @param cId 商品 id 39 | * @param limit 显示的条数 40 | * @param sort 排序方式,默认根据sort_order排序 41 | * @param blob 是否包含大字段信息 42 | * @return 查询得到的商品列表 43 | */ 44 | List selectByCId(@NonNull @Param("cId") Long cId, @Param("limit") Integer limit, 45 | @Nullable @Param("sort") String sort, @Param("blob") boolean blob); 46 | 47 | /** 48 | * 根据分类ids查询出对应的Items部分信息 49 | * @param cIds 分类id集合 50 | * @param limit 显示的条数 51 | * @param sort 排序方式,默认根据sort_order排序 52 | * @param blob 是否包含大字段信息 53 | * @return 查询得出的商品集合 54 | */ 55 | List selectByCIds(@NonNull @Param("cIds") List cIds, 56 | @Param("limit") Integer limit, @Param("sort") String sort, 57 | @NonNull @Param("blob") boolean blob); 58 | 59 | } 60 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/serviceImpl/ItemSkuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.google.common.collect.Lists; 6 | import com.yoke.poseidon.web.itemShow.entity.ItemAttribute; 7 | import com.yoke.poseidon.web.itemShow.entity.ItemSku; 8 | import com.yoke.poseidon.web.itemShow.mapper.ItemSkuMapper; 9 | import com.yoke.poseidon.web.itemShow.service.ItemSkuService; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | import java.util.stream.Collectors; 16 | 17 | /** 18 | *

19 | * 服务实现类 20 | *

21 | * 22 | * @author yoke 23 | * @since 2019-06-02 24 | */ 25 | @Service 26 | public class ItemSkuServiceImpl extends ServiceImpl 27 | implements ItemSkuService { 28 | 29 | @Override 30 | public List getItemInfo(String itemId) { 31 | // ItemSku itemSku = itemSkuMapper.selectById(itemId); 32 | List itemSkuList = list( 33 | new QueryWrapper().eq("item_id", itemId)); 34 | return itemSkuList.stream().map(itemSku -> { 35 | ItemAttribute itemAttribute = new ItemAttribute(); 36 | String attributesStr = itemSku.getAttributes(); 37 | List attributesList = Lists.newArrayList(attributesStr.split(";")); 38 | List> list = attributesList.stream().map(attribute -> { 39 | Map map = new HashMap<>(); 40 | String[] properties = attribute.split(":"); 41 | map.put(Long.valueOf(properties[0]), Long.valueOf(properties[1])); 42 | return map; 43 | }).collect(Collectors.toList()); 44 | itemAttribute.setAttributes(list); 45 | itemAttribute.setPrice(itemSku.getPrice()); 46 | return itemAttribute; 47 | }).collect(Collectors.toList()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /psd-web-shop-cart/src/main/java/com/yoke/poseidon/cart/dto/Message.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.cart.dto; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2018/12/24 上午8:29 10 | */ 11 | public class Message implements Serializable { 12 | 13 | private static final long serialVersionUID = -3788526494940077434L; 14 | 15 | private int code; 16 | 17 | private String msg; 18 | 19 | private Object data; 20 | 21 | /** 22 | * 普通返回 23 | * @param data 获取的数据 24 | */ 25 | public static Message success(Object data) { 26 | return new Message(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), data); 27 | } 28 | 29 | public static Message success(String msg, Object data) { 30 | return new Message(HttpStatus.OK.value(), msg, data); 31 | } 32 | 33 | public static Message success() { 34 | return new Message(HttpStatus.OK.value(), HttpStatus.OK.getReasonPhrase(), null); 35 | } 36 | 37 | /** 38 | * 普通返回错误的数据 39 | */ 40 | public static Message failed() { 41 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), 42 | HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), null); 43 | } 44 | 45 | public static Message failed(String msg) { 46 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg, null); 47 | } 48 | 49 | public int getCode() { 50 | return code; 51 | } 52 | 53 | public void setCode(int code) { 54 | this.code = code; 55 | } 56 | 57 | public String getMsg() { 58 | return msg; 59 | } 60 | 61 | public void setMsg(String msg) { 62 | this.msg = msg; 63 | } 64 | 65 | public Object getData() { 66 | return data; 67 | } 68 | 69 | public void setData(Object data) { 70 | this.data = data; 71 | } 72 | 73 | private Message(int code, String msg, Object data) { 74 | this.code = code; 75 | this.msg = msg; 76 | this.data = data; 77 | } 78 | 79 | @Override 80 | public String toString() { 81 | return "Message{" + "code=" + code + ", msg='" + msg + '\'' + ", data=" + data 82 | + '}'; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/serviceImpl/MemberServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.yoke.poseidon.member.dto.MemberDto; 5 | import com.yoke.poseidon.member.entity.Member; 6 | import com.yoke.poseidon.member.mapper.MemberMapper; 7 | import com.yoke.poseidon.member.service.ConvertService; 8 | import com.yoke.poseidon.member.service.MemberService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.lang.NonNull; 11 | import org.springframework.stereotype.Service; 12 | 13 | import javax.validation.constraints.NotNull; 14 | import java.math.BigDecimal; 15 | 16 | /** 17 | *

18 | * 服务实现类 19 | *

20 | * 21 | * @author yoke 22 | * @since 2019-01-24 23 | */ 24 | @Service 25 | public class MemberServiceImpl extends ServiceImpl 26 | implements MemberService { 27 | 28 | private final ConvertService convertService; 29 | 30 | private final MemberMapper memberMapper; 31 | 32 | @Autowired 33 | public MemberServiceImpl(ConvertService convertService, MemberMapper memberMapper) { 34 | this.convertService = convertService; 35 | this.memberMapper = memberMapper; 36 | } 37 | 38 | @Override 39 | public MemberDto getByName(@NonNull String name) { 40 | Member member = memberMapper.selectByName(name); 41 | return convertService.convert(member); 42 | } 43 | 44 | @Override 45 | public boolean pay(@NotNull Long memberId, @NotNull BigDecimal payment) { 46 | Member member = memberMapper.selectById(memberId); 47 | BigDecimal balance = member.getBalance(); 48 | if (member.getBalance().compareTo(payment) > 0) { 49 | member.setBalance(balance.subtract(payment)); 50 | memberMapper.updateById(member); 51 | return true; 52 | } 53 | else { 54 | return false; 55 | } 56 | } 57 | 58 | @Override 59 | public MemberDto getById(@NotNull Long memberId) { 60 | Member member = memberMapper.selectById(memberId); 61 | return convertService.convert(member); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/dto/Message.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.dto; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @Author Yoke 9 | * @Date 2018/12/24 上午8:29 10 | */ 11 | public class Message implements Serializable { 12 | 13 | private static final long serialVersionUID = -3788526494940077434L; 14 | 15 | private int code; 16 | 17 | private String msg; 18 | 19 | private Object data; 20 | 21 | public static Message success() { 22 | return success(null); 23 | } 24 | 25 | /** 26 | * 普通返回 27 | * @param data 获取的数据 28 | */ 29 | public static Message success(Object data) { 30 | return success(HttpStatus.OK.getReasonPhrase(), data); 31 | } 32 | 33 | public static Message success(String msg, Object data) { 34 | return new Message(HttpStatus.OK.value(), msg, data); 35 | } 36 | 37 | /** 38 | * 普通返回错误的数据 39 | */ 40 | public static Message failed() { 41 | /* 42 | * return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), 43 | * HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), null); 44 | */ 45 | return failed(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()); 46 | } 47 | 48 | public static Message failed(String msg) { 49 | return new Message(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg, null); 50 | } 51 | 52 | public int getCode() { 53 | return code; 54 | } 55 | 56 | public void setCode(int code) { 57 | this.code = code; 58 | } 59 | 60 | public String getMsg() { 61 | return msg; 62 | } 63 | 64 | public void setMsg(String msg) { 65 | this.msg = msg; 66 | } 67 | 68 | public Object getData() { 69 | return data; 70 | } 71 | 72 | public void setData(Object data) { 73 | this.data = data; 74 | } 75 | 76 | private Message(int code, String msg, Object data) { 77 | this.code = code; 78 | this.msg = msg; 79 | this.data = data; 80 | } 81 | 82 | Message() { 83 | } 84 | 85 | @Override 86 | public String toString() { 87 | return "Message{" + "code=" + code + ", msg='" + msg + '\'' + ", data=" + data 88 | + '}'; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /psd-web-member/src/main/java/com/yoke/poseidon/member/web/MemberController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.member.web; 2 | 3 | import com.yoke.poseidon.member.dto.Message; 4 | import com.yoke.poseidon.member.service.MemberService; 5 | import io.swagger.annotations.Api; 6 | import io.swagger.annotations.ApiImplicitParam; 7 | import io.swagger.annotations.ApiImplicitParams; 8 | import io.swagger.annotations.ApiOperation; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import javax.validation.constraints.NotNull; 13 | import java.math.BigDecimal; 14 | 15 | /** 16 | *

17 | * 前端控制器 18 | *

19 | * 20 | * @author yoke 21 | * @since 2019-01-24 22 | */ 23 | @RestController 24 | @RequestMapping("/member") 25 | @Api(value = "用户操作") 26 | public class MemberController { 27 | 28 | private final MemberService memberService; 29 | 30 | @Autowired 31 | public MemberController(MemberService memberService) { 32 | this.memberService = memberService; 33 | } 34 | 35 | @GetMapping(path = "/{name}") 36 | @ApiOperation(value = "根据用户名查询用户的基本信息") 37 | @ApiImplicitParam(paramType = "query", dataType = "String", name = "name", 38 | value = "用户的当前名称") 39 | Message get(@PathVariable String name) { 40 | return Message.success(memberService.getByName(name)); 41 | } 42 | 43 | @PatchMapping("/pay/{memberId}/{payment}") 44 | @ApiOperation(value = "扣除指定用户相关金额") 45 | @ApiImplicitParams({ 46 | @ApiImplicitParam(paramType = "query", dataType = "Long", name = "memberId"), 47 | @ApiImplicitParam(paramType = "update", dataType = "BigDecimal", 48 | name = "payment") }) 49 | Message pay(@PathVariable Long memberId, @PathVariable BigDecimal payment) { 50 | if (memberService.pay(memberId, payment)) { 51 | return Message.success(memberService.getById(memberId)); 52 | } 53 | else { 54 | return Message.failed("您的钱不足"); 55 | } 56 | } 57 | 58 | @GetMapping("/memberId") 59 | @ApiOperation("根据用户id获取用户信息") 60 | Message getById(@NotNull @PathVariable Long memberId) { 61 | return Message.success(memberService.getById(memberId)); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /psd-web-es/build.gradle: -------------------------------------------------------------------------------- 1 | // the resources required by the gradle script itself 2 | buildscript { 3 | repositories { 4 | mavenCentral() 5 | } 6 | dependencies { 7 | classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" 8 | classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE" 9 | classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.6") 10 | } 11 | } 12 | plugins { 13 | id 'java' 14 | } 15 | 16 | group 'com.yoke.poseidon' 17 | version '1.0-SNAPSHOT' 18 | 19 | sourceCompatibility = 1.8 20 | 21 | repositories { 22 | mavenCentral() 23 | } 24 | 25 | 26 | apply plugin: 'org.springframework.boot' 27 | apply plugin: 'java' 28 | group 'com.yoke.poseidon.web' 29 | apply plugin: "io.spring.dependency-management" 30 | apply plugin: 'io.spring.javaformat' 31 | apply plugin: 'checkstyle' 32 | 33 | dependencies { 34 | 35 | // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-client 36 | compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-eureka-client' 37 | compile("org.springframework.boot:spring-boot-starter-web") 38 | // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign 39 | compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign' 40 | compile group: 'org.modelmapper', name: 'modelmapper', version: '2.3.0' 41 | // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-elasticsearch 42 | compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-elasticsearch', version: '2.1.1.RELEASE' 43 | compile("org.springframework.boot:spring-boot-starter-amqp") 44 | checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.6") 45 | 46 | testCompile("org.springframework.boot:spring-boot-starter-test") 47 | testCompile group: 'junit', name: 'junit', version: '4.12' 48 | } 49 | dependencyManagement { 50 | imports { 51 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 52 | } 53 | } -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/serviceImpl/ConvertServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.serviceImpl; 2 | 3 | import com.yoke.poseidon.web.itemShow.dto.PanelDto; 4 | import com.yoke.poseidon.web.itemShow.entity.Item; 5 | import com.yoke.poseidon.web.itemShow.entity.ItemCat; 6 | import com.yoke.poseidon.web.itemShow.entity.Panel; 7 | import com.yoke.poseidon.web.itemShow.dto.ItemCatDto; 8 | import com.yoke.poseidon.web.itemShow.dto.ItemDto; 9 | import com.yoke.poseidon.web.itemShow.service.ConvertService; 10 | import org.modelmapper.ModelMapper; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.lang.NonNull; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.List; 16 | import java.util.stream.Collectors; 17 | 18 | /** 19 | * @Author Yoke 20 | * @Date 2018/10/23 下午3:19 21 | */ 22 | 23 | @Service 24 | public class ConvertServiceImpl implements ConvertService { 25 | 26 | @Autowired 27 | private ModelMapper modelMapper; 28 | 29 | @Override 30 | public ItemDto convertItem(@NonNull Item item) { 31 | return modelMapper.map(item, ItemDto.class); 32 | } 33 | 34 | @Override 35 | public List convertItem(@NonNull List items) { 36 | return items.stream().map(item -> modelMapper.map(item, ItemDto.class)) 37 | .collect(Collectors.toList()); 38 | } 39 | 40 | @Override 41 | public ItemCatDto convertItemCat(@NonNull ItemCat itemCat) { 42 | return modelMapper.map(itemCat, ItemCatDto.class); 43 | } 44 | 45 | @Override 46 | public List convertItemCat(@NonNull List itemCats) { 47 | return itemCats.stream() 48 | .map(itemCat -> modelMapper.map(itemCat, ItemCatDto.class)) 49 | .collect(Collectors.toList()); 50 | } 51 | 52 | @Override 53 | public PanelDto convertPanel(@NonNull Panel panel) { 54 | return modelMapper.map(panel, PanelDto.class); 55 | } 56 | 57 | @Override 58 | public List convertPanel(@NonNull List panels) { 59 | return panels.stream().map(panel -> modelMapper.map(panel, PanelDto.class)) 60 | .collect(Collectors.toList()); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/entity/Address.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.annotation.IdType; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import java.io.Serializable; 7 | 8 | /** 9 | *

10 | * 11 | *

12 | * 13 | * @author yoke 14 | * @since 2019-03-31 15 | */ 16 | @TableName("db_address") 17 | public class Address implements Serializable { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | @TableId(value = "address_id", type = IdType.AUTO) 22 | private Long addressId; 23 | 24 | private Integer isDefault; 25 | 26 | private String streetName; 27 | 28 | private String tel; 29 | 30 | private Long userId; 31 | 32 | private String userName; 33 | 34 | 35 | public Long getAddressId() { 36 | return addressId; 37 | } 38 | 39 | public void setAddressId(Long addressId) { 40 | this.addressId = addressId; 41 | } 42 | 43 | public Integer getIsDefault() { 44 | return isDefault; 45 | } 46 | 47 | public void setIsDefault(Integer isDefault) { 48 | this.isDefault = isDefault; 49 | } 50 | 51 | public String getStreetName() { 52 | return streetName; 53 | } 54 | 55 | public void setStreetName(String streetName) { 56 | this.streetName = streetName; 57 | } 58 | 59 | public String getTel() { 60 | return tel; 61 | } 62 | 63 | public void setTel(String tel) { 64 | this.tel = tel; 65 | } 66 | 67 | public Long getUserId() { 68 | return userId; 69 | } 70 | 71 | public void setUserId(Long userId) { 72 | this.userId = userId; 73 | } 74 | 75 | public String getUserName() { 76 | return userName; 77 | } 78 | 79 | public void setUserName(String userName) { 80 | this.userName = userName; 81 | } 82 | 83 | @Override 84 | public String toString() { 85 | return "Address{" + 86 | "addressId=" + addressId + 87 | ", isDefault=" + isDefault + 88 | ", streetName=" + streetName + 89 | ", tel=" + tel + 90 | ", userId=" + userId + 91 | ", userName=" + userName + 92 | "}"; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/dto/PanelDto.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.dto; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import static com.google.common.collect.Lists.newArrayList; 7 | 8 | /** 9 | * @Author Yoke 10 | * @Date 2018/11/22 下午7:31 11 | */ 12 | public class PanelDto implements Serializable { 13 | 14 | private Integer panelId; 15 | 16 | private Integer limitNum; 17 | 18 | private String name; 19 | 20 | private String remark; 21 | 22 | private Integer sortOrder; 23 | 24 | private Integer status; 25 | 26 | private Integer type; 27 | 28 | private Long itemCatId; 29 | 30 | private List itemDtoList; 31 | 32 | public PanelDto() { 33 | itemDtoList = newArrayList(); 34 | } 35 | 36 | public Integer getPanelId() { 37 | return panelId; 38 | } 39 | 40 | public void setPanelId(Integer panelId) { 41 | this.panelId = panelId; 42 | } 43 | 44 | public Integer getLimitNum() { 45 | return limitNum; 46 | } 47 | 48 | public void setLimitNum(Integer limitNum) { 49 | this.limitNum = limitNum; 50 | } 51 | 52 | public String getName() { 53 | return name; 54 | } 55 | 56 | public void setName(String name) { 57 | this.name = name; 58 | } 59 | 60 | public String getRemark() { 61 | return remark; 62 | } 63 | 64 | public void setRemark(String remark) { 65 | this.remark = remark; 66 | } 67 | 68 | public Integer getSortOrder() { 69 | return sortOrder; 70 | } 71 | 72 | public void setSortOrder(Integer sortOrder) { 73 | this.sortOrder = sortOrder; 74 | } 75 | 76 | public Integer getStatus() { 77 | return status; 78 | } 79 | 80 | public void setStatus(Integer status) { 81 | this.status = status; 82 | } 83 | 84 | public Integer getType() { 85 | return type; 86 | } 87 | 88 | public void setType(Integer type) { 89 | this.type = type; 90 | } 91 | 92 | public List getItemDtoList() { 93 | return itemDtoList; 94 | } 95 | 96 | public void setItemDtoList(List itemDtoList) { 97 | this.itemDtoList = itemDtoList; 98 | } 99 | 100 | public Long getItemCatId() { 101 | return itemCatId; 102 | } 103 | 104 | public void setItemCatId(Long itemCatId) { 105 | this.itemCatId = itemCatId; 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/dto/OrderItemDto.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.dto; 2 | 3 | import java.io.Serializable; 4 | import java.math.BigDecimal; 5 | 6 | /** 7 | * @Author Yoke 8 | * @Date 2019/02/10 下午4:50 9 | */ 10 | public class OrderItemDto implements Serializable { 11 | 12 | private String id; 13 | 14 | private String itemId; 15 | 16 | private String orderId; 17 | 18 | /** 19 | * 商品购买的数量 20 | */ 21 | private Integer itemNum; 22 | 23 | /** 24 | * 商品单价 25 | */ 26 | private BigDecimal itemPrice; 27 | 28 | /** 29 | * 商品总金额 30 | */ 31 | private BigDecimal itemTotalPrice; 32 | 33 | private String itemName; 34 | 35 | private String itemImage; 36 | 37 | private String itemSellPoint; 38 | 39 | public String getItemImage() { 40 | return itemImage; 41 | } 42 | 43 | public void setItemImage(String itemImage) { 44 | this.itemImage = itemImage; 45 | } 46 | 47 | public String getId() { 48 | return id; 49 | } 50 | 51 | public void setId(String id) { 52 | this.id = id; 53 | } 54 | 55 | public String getItemId() { 56 | return itemId; 57 | } 58 | 59 | public void setItemId(String itemId) { 60 | this.itemId = itemId; 61 | } 62 | 63 | public String getOrderId() { 64 | return orderId; 65 | } 66 | 67 | public void setOrderId(String orderId) { 68 | this.orderId = orderId; 69 | } 70 | 71 | public Integer getItemNum() { 72 | return itemNum; 73 | } 74 | 75 | public void setItemNum(Integer itemNum) { 76 | this.itemNum = itemNum; 77 | } 78 | 79 | public BigDecimal getItemPrice() { 80 | return itemPrice; 81 | } 82 | 83 | public void setItemPrice(BigDecimal itemPrice) { 84 | this.itemPrice = itemPrice; 85 | } 86 | 87 | public BigDecimal getItemTotalPrice() { 88 | return itemTotalPrice; 89 | } 90 | 91 | public void setItemTotalPrice(BigDecimal itemTotalPrice) { 92 | this.itemTotalPrice = itemTotalPrice; 93 | } 94 | 95 | public String getItemName() { 96 | return itemName; 97 | } 98 | 99 | public void setItemName(String itemName) { 100 | this.itemName = itemName; 101 | } 102 | 103 | public String getItemSellPoint() { 104 | return itemSellPoint; 105 | } 106 | 107 | public void setItemSellPoint(String itemSellPoint) { 108 | this.itemSellPoint = itemSellPoint; 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /psd-generate/build.gradle: -------------------------------------------------------------------------------- 1 | // the resources required by the gradle script itself 2 | buildscript { 3 | repositories { 4 | mavenCentral() 5 | } 6 | dependencies { 7 | classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" 8 | classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE" 9 | classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.6") 10 | } 11 | } 12 | 13 | apply plugin: 'org.springframework.boot' 14 | apply plugin: 'java' 15 | group 'com.yoke.poseidon' 16 | apply plugin: "io.spring.dependency-management" 17 | apply plugin: 'io.spring.javaformat' 18 | apply plugin: 'checkstyle' 19 | 20 | ext { 21 | swaggerVersion = '2.9.2' 22 | } 23 | 24 | checkstyle { 25 | toolVersion = "8.11" 26 | } 27 | version '1.0-SNAPSHOT' 28 | repositories { 29 | mavenCentral() 30 | } 31 | 32 | bootJar { 33 | baseName = 'gs-spring-boot-docker' 34 | version = '0.1.0' 35 | } 36 | 37 | repositories { 38 | mavenCentral() 39 | } 40 | 41 | sourceCompatibility = 1.8 42 | targetCompatibility = 1.8 43 | 44 | dependencies { 45 | // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-client 46 | compile('mysql:mysql-connector-java:8.0.12') 47 | compile("org.springframework.boot:spring-boot-starter-web") 48 | // https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter 49 | compile("com.baomidou:mybatis-plus-boot-starter:${mybatisPlusVersion}") 50 | // https://mvnrepository.com/artifact/com.baomidou/mybatis-plus 51 | compile group: 'com.baomidou', name: 'mybatis-plus', version: "${mybatisPlusVersion}" 52 | // https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter 53 | compile group: 'com.alibaba', name: 'druid-spring-boot-starter', version: '1.1.10' 54 | // https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter 55 | compile group: 'org.mybatis.spring.boot', name: 'mybatis-spring-boot-starter', version: '1.3.2' 56 | // https://mvnrepository.com/artifact/org.apache.velocity/velocity-engine-core 57 | compile group: 'org.apache.velocity', name: 'velocity-engine-core', version: '2.0' 58 | 59 | checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.6") 60 | 61 | } 62 | 63 | dependencyManagement { 64 | imports { 65 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/entity/ItemSku.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.entity; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | import com.baomidou.mybatisplus.annotation.TableId; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | *

13 | * 14 | *

15 | * 16 | * @author yoke 17 | * @since 2019-06-02 18 | */ 19 | @TableName("db_item_sku") 20 | public class ItemSku implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | @TableId(value = "item_sku_id", type = IdType.AUTO) 25 | private Long itemSkuId; 26 | 27 | private String itemId; 28 | 29 | /** 30 | * 参数名:参数值这种形式 31 | */ 32 | private String attributes; 33 | 34 | private BigDecimal price; 35 | 36 | private BigDecimal cost; 37 | 38 | /** 39 | * 库存 40 | */ 41 | private Integer stock; 42 | 43 | 44 | public Long getItemSkuId() { 45 | return itemSkuId; 46 | } 47 | 48 | public void setItemSkuId(Long itemSkuId) { 49 | this.itemSkuId = itemSkuId; 50 | } 51 | 52 | public String getItemId() { 53 | return itemId; 54 | } 55 | 56 | public void setItemId(String itemId) { 57 | this.itemId = itemId; 58 | } 59 | 60 | public String getAttributes() { 61 | return attributes; 62 | } 63 | 64 | public void setAttributes(String attributes) { 65 | this.attributes = attributes; 66 | } 67 | 68 | public BigDecimal getPrice() { 69 | return price; 70 | } 71 | 72 | public void setPrice(BigDecimal price) { 73 | this.price = price; 74 | } 75 | 76 | public BigDecimal getCost() { 77 | return cost; 78 | } 79 | 80 | public void setCost(BigDecimal cost) { 81 | this.cost = cost; 82 | } 83 | 84 | public Integer getStock() { 85 | return stock; 86 | } 87 | 88 | public void setStock(Integer stock) { 89 | this.stock = stock; 90 | } 91 | 92 | @Override 93 | public String toString() { 94 | return "ItemSku{" + 95 | "itemSkuId=" + itemSkuId + 96 | ", itemId=" + itemId + 97 | ", attributes=" + attributes + 98 | ", price=" + price + 99 | ", cost=" + cost + 100 | ", stock=" + stock + 101 | "}"; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/serviceImpl/ConvertServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.serviceImpl; 2 | 3 | import com.yoke.poseidon.order.dto.OrderDto; 4 | import com.yoke.poseidon.order.dto.OrderItemDto; 5 | import com.yoke.poseidon.order.entity.Order; 6 | import com.yoke.poseidon.order.entity.OrderItem; 7 | import com.yoke.poseidon.order.service.ConvertService; 8 | import org.modelmapper.ModelMapper; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import javax.validation.constraints.NotNull; 13 | import java.util.List; 14 | import java.util.stream.Collectors; 15 | 16 | /** 17 | * @Author Yoke 18 | * @Date 2019/02/10 下午2:53 19 | */ 20 | @Service 21 | public class ConvertServiceImpl implements ConvertService { 22 | 23 | private final ModelMapper modelMapper; 24 | 25 | @Autowired 26 | public ConvertServiceImpl(ModelMapper modelMapper) { 27 | this.modelMapper = modelMapper; 28 | } 29 | 30 | @Override 31 | public OrderDto convertOrder(@NotNull Order order) { 32 | return modelMapper.map(order, OrderDto.class); 33 | } 34 | 35 | @Override 36 | public List convertOrder(@NotNull List orders) { 37 | return orders.stream().map(order -> modelMapper.map(order, OrderDto.class)) 38 | .collect(Collectors.toList()); 39 | } 40 | 41 | @Override 42 | public Order convertOrderDto(@NotNull OrderDto orderDto) { 43 | return modelMapper.map(orderDto, Order.class); 44 | } 45 | 46 | @Override 47 | public List convertOrderDto(@NotNull List orderDtoList) { 48 | return orderDtoList.stream() 49 | .map(orderDto -> modelMapper.map(orderDto, Order.class)) 50 | .collect(Collectors.toList()); 51 | } 52 | 53 | @Override 54 | public OrderItemDto convertOrderItem(@NotNull OrderItem orderItem) { 55 | return modelMapper.map(orderItem, OrderItemDto.class); 56 | } 57 | 58 | @Override 59 | public List convertOrderItem(@NotNull List orderItems) { 60 | return orderItems.stream() 61 | .map(orderItem -> modelMapper.map(orderItem, OrderItemDto.class)) 62 | .collect(Collectors.toList()); 63 | } 64 | 65 | @Override 66 | public OrderItem convertOrderItemDto(@NotNull OrderItemDto orderItemDto) { 67 | return modelMapper.map(orderItemDto, OrderItem.class); 68 | } 69 | 70 | @Override 71 | public List convertOrderItemDto( 72 | @NotNull List orderItemDtoList) { 73 | return orderItemDtoList.stream() 74 | .map(orderItemDto -> modelMapper.map(orderItemDto, OrderItem.class)) 75 | .collect(Collectors.toList()); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/entity/PanelContent.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | *

12 | * 13 | *

14 | * 15 | * @author yoke 16 | * @since 2018-11-22 17 | */ 18 | @TableName("db_panel_content") 19 | public class PanelContent implements Serializable { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | @TableId(value = "panel_content_id", type = IdType.AUTO) 24 | private Integer panelContentId; 25 | 26 | private LocalDateTime createDate; 27 | 28 | private Integer panelId; 29 | 30 | private String picUrl; 31 | 32 | private String productId; 33 | 34 | private Integer sortOrder; 35 | 36 | private LocalDateTime modifyDate; 37 | 38 | public Integer getPanelContentId() { 39 | return panelContentId; 40 | } 41 | 42 | public void setPanelContentId(Integer panelContentId) { 43 | this.panelContentId = panelContentId; 44 | } 45 | 46 | public Integer getPanelId() { 47 | return panelId; 48 | } 49 | 50 | public void setPanelId(Integer panelId) { 51 | this.panelId = panelId; 52 | } 53 | 54 | public String getPicUrl() { 55 | return picUrl; 56 | } 57 | 58 | public void setPicUrl(String picUrl) { 59 | this.picUrl = picUrl; 60 | } 61 | 62 | public String getProductId() { 63 | return productId; 64 | } 65 | 66 | public void setProductId(String productId) { 67 | this.productId = productId; 68 | } 69 | 70 | public Integer getSortOrder() { 71 | return sortOrder; 72 | } 73 | 74 | public void setSortOrder(Integer sortOrder) { 75 | this.sortOrder = sortOrder; 76 | } 77 | 78 | public LocalDateTime getCreateDate() { 79 | return createDate; 80 | } 81 | 82 | public void setCreateDate(LocalDateTime createDate) { 83 | this.createDate = createDate; 84 | } 85 | 86 | public LocalDateTime getModifyDate() { 87 | return modifyDate; 88 | } 89 | 90 | public void setModifyDate(LocalDateTime modifyDate) { 91 | this.modifyDate = modifyDate; 92 | } 93 | 94 | @Override 95 | public String toString() { 96 | return "PanelContent{" + "panelContentId=" + panelContentId + ", createDate=" 97 | + createDate + ", panelId=" + panelId + ", picUrl='" + picUrl + '\'' 98 | + ", productId='" + productId + '\'' + ", sortOrder=" + sortOrder 99 | + ", modifyDate=" + modifyDate + '}'; 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /psd-gateway/src/main/java/com/yoke/poseidon/gateway/config/SecurityTokenConfig.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway.config; 2 | 3 | import com.yoke.poseidon.gateway.filter.JwtTokenAuthenticationFilter; 4 | import com.yoke.poseidon.gateway.router.Router; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.http.HttpMethod; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 10 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 11 | import org.springframework.security.config.http.SessionCreationPolicy; 12 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 13 | import org.springframework.web.cors.CorsUtils; 14 | 15 | import javax.servlet.http.HttpServletResponse; 16 | 17 | /** 18 | * @Author Yoke 19 | * @Date 2018/11/24 下午8:16 20 | */ 21 | @EnableWebSecurity 22 | public class SecurityTokenConfig extends WebSecurityConfigurerAdapter { 23 | 24 | @Autowired 25 | private JwtConfig jwtConfig; 26 | 27 | @Autowired 28 | private Router router; 29 | 30 | @Override 31 | protected void configure(HttpSecurity http) throws Exception { 32 | http.csrf().disable().cors().and() 33 | // make sure we use stateless session; session won't be used to store 34 | // user's state. 35 | .sessionManagement() 36 | .sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() 37 | // handle an authorized attempts 38 | .exceptionHandling() 39 | .authenticationEntryPoint((req, rsp, e) -> rsp 40 | .sendError(HttpServletResponse.SC_UNAUTHORIZED)) 41 | .and() 42 | // Add a filter to validate the tokens with every request 43 | .addFilterAfter(new JwtTokenAuthenticationFilter(jwtConfig), 44 | UsernamePasswordAuthenticationFilter.class) 45 | // authorization requests config 46 | .authorizeRequests().requestMatchers(CorsUtils::isCorsRequest).permitAll() 47 | .antMatchers(HttpMethod.POST, jwtConfig.getUri()).permitAll() 48 | .antMatchers(HttpMethod.GET, router.getWeb_shop_cart_service(), 49 | router.getWeb_view_service(), router.getMember_service()) 50 | .permitAll() 51 | // required here) 52 | // .antMatchers("/view" + "/admin/**").hasRole("") 53 | // Any other request must be authenticated 54 | .anyRequest().authenticated(); 55 | } 56 | 57 | @Bean 58 | public JwtConfig jwtConfig() { 59 | return new JwtConfig(); 60 | } 61 | 62 | @Bean 63 | public Router router() { 64 | return new Router(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /psd-generate/src/main/java/com/yoke/poseidon/gateway/generate/CodeGeneration.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.gateway.generate; 2 | 3 | import com.baomidou.mybatisplus.annotation.DbType; 4 | import com.baomidou.mybatisplus.generator.AutoGenerator; 5 | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; 6 | import com.baomidou.mybatisplus.generator.config.GlobalConfig; 7 | import com.baomidou.mybatisplus.generator.config.PackageConfig; 8 | import com.baomidou.mybatisplus.generator.config.StrategyConfig; 9 | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; 10 | 11 | /** 12 | * @author ethereal 13 | * @since 2018-09-20 19:26 14 | */ 15 | public class CodeGeneration { 16 | 17 | public static void main(String[] args) { 18 | AutoGenerator mpg = new AutoGenerator(); 19 | // 全局配置 20 | GlobalConfig gc = new GlobalConfig(); 21 | gc.setOutputDir( 22 | "/media/code/program/java/poseidon/poseidon/psd-web-view/src/main/java"); 23 | gc.setFileOverride(true); 24 | gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false 25 | gc.setEnableCache(false);// XML 二级缓存 26 | gc.setBaseResultMap(true);// XML ResultMap 27 | gc.setBaseColumnList(false);// XML columList 28 | gc.setAuthor("yoke");// 作者 29 | 30 | // 自定义文件命名,注意 %s 会自动填充表实体属性! 31 | gc.setControllerName("%sController"); 32 | gc.setServiceName("%sService"); 33 | gc.setServiceImplName("%sServiceImpl"); 34 | gc.setMapperName("%sMapper"); 35 | gc.setXmlName("%sMapper"); 36 | mpg.setGlobalConfig(gc); 37 | 38 | // 数据源配置 39 | DataSourceConfig dsc = new DataSourceConfig(); 40 | dsc.setDbType(DbType.MYSQL); 41 | dsc.setDriverName("com.mysql.cj.jdbc.Driver"); 42 | dsc.setUsername("root"); 43 | dsc.setPassword("FJEOIRFWQ132EW"); 44 | dsc.setUrl( 45 | "jdbc:mysql://www.test.com:13306/poseidon?useUnicode=true&characterEncoding=utf-8&useSSL=false"); 46 | mpg.setDataSource(dsc); 47 | 48 | // 策略配置 49 | StrategyConfig strategy = new StrategyConfig(); 50 | strategy.setTablePrefix("db_");// 此处可以修改为您的表前缀 51 | strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略 52 | strategy.setInclude("db_item_attribute_name", "db_item_attribute_value", 53 | "db_item_sku"); 54 | strategy.setSuperServiceClass(null); 55 | strategy.setSuperServiceImplClass(null); 56 | strategy.setSuperMapperClass(null); 57 | mpg.setStrategy(strategy); 58 | 59 | // 包配置 60 | PackageConfig pc = new PackageConfig(); 61 | pc.setParent("com.yoke.poseidon.web.itemShow"); 62 | pc.setController("web"); 63 | pc.setService("service"); 64 | pc.setServiceImpl("serviceImpl"); 65 | pc.setMapper("mapper"); 66 | pc.setEntity("entity"); 67 | pc.setXml("mapper"); 68 | mpg.setPackageInfo(pc); 69 | // 执行生成 70 | mpg.execute(); 71 | 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | eureka-service: 5 | build: 6 | context: ./psd-discovery 7 | dockerfile: Dockerfile 8 | ports: 9 | - "8761:8761" 10 | gateway-service: 11 | build: 12 | context: ./psd-gateway 13 | dockerfile: Dockerfile 14 | ports: 15 | - "8769:8769" 16 | depends_on: 17 | - odrder-service 18 | - cart-service 19 | - view-service 20 | - eureka-service 21 | odrder-service: 22 | build: 23 | context: ./psd-web-order 24 | dockerfile: Dockerfile 25 | env_file: 26 | - config.env 27 | ports: 28 | - "9100:9100" 29 | depends_on: 30 | - eureka-service 31 | - mysql 32 | cart-service: 33 | build: 34 | context: ./psd-web-shop-cart 35 | dockerfile: Dockerfile 36 | env_file: 37 | - config.env 38 | ports: 39 | - "8090:8090" 40 | depends_on: 41 | - eureka-service 42 | - mysql 43 | view-service: 44 | build: 45 | context: ./psd-web-view 46 | dockerfile: Dockerfile 47 | env_file: 48 | - config.env 49 | ports: 50 | - "8080:8080" 51 | depends_on: 52 | - eureka-service 53 | - mysql 54 | mysql: 55 | image: mysql 56 | container_name: mysql-server 57 | env_file: 58 | - config.env 59 | volumes: 60 | - "/Users/yoke/mysqlDB:/var/lib/mysql" 61 | ports: 62 | - "3306:3306" 63 | elasticsearch: 64 | image: elasticsearch:6.8.5 65 | container_name: elasticsearch 66 | environment: 67 | - "cluster.name=elasticsearch" #设置集群名称为elasticsearch 68 | - "discovery.type=single-node" #以单一节点模式启动 69 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" #设置使用jvm内存大小 70 | volumes: 71 | - "$HOME/esData/data:/usr/share/elasticsearch/data" 72 | - "$HOME/esData/plugins:/usr/share/elasticsearch/plugins" 73 | ports: 74 | - "9200:9200" 75 | - "9300:9300" 76 | restart: always 77 | elasticsearch-head5: 78 | image: mobz/elasticsearch-head:5 79 | ports: 80 | - "9100:9100" 81 | kibana: 82 | image: kibana:6.4.0 83 | container_name: kibana 84 | links: 85 | - elasticsearch:es #可以用es这个域名访问elasticsearch服务 86 | depends_on: 87 | - elasticsearch #kibana在elasticsearch启动之后再启动 88 | environment: 89 | - "elasticsearch.hosts=http://es:9200" #设置访问elasticsearch的地址 90 | ports: 91 | - "5601:5601" 92 | logstash: 93 | image: logstash:6.4.0 94 | container_name: logstash 95 | depends_on: 96 | - elasticsearch #kibana在elasticsearch启动之后再启动 97 | links: 98 | - elasticsearch:es #可以用es这个域名访问elasticsearch服务 99 | ports: 100 | - "4560:4560" 101 | -------------------------------------------------------------------------------- /psd-web-es/src/main/java/com/yoke/poseidon/elasticsearch/dto/ItemDto.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.elasticsearch.dto; 2 | 3 | import java.io.Serializable; 4 | import java.math.BigDecimal; 5 | 6 | /** 7 | * @Author Yoke 8 | * @Date 2018/10/17 下午8:17 9 | */ 10 | public class ItemDto implements Serializable { 11 | 12 | private static final long serialVersionUID = -4001786119212330546L; 13 | 14 | private String itemId; 15 | 16 | private String name; 17 | 18 | private Long cId; 19 | 20 | private String itemCatName; 21 | 22 | private String sellPoint; 23 | 24 | private BigDecimal price; 25 | 26 | private Integer limitNum; 27 | 28 | private String image; 29 | 30 | private String remark; 31 | 32 | private String description; 33 | 34 | private Integer sortOrder; 35 | 36 | private Integer sale; 37 | 38 | public static long getSerialVersionUID() { 39 | return serialVersionUID; 40 | } 41 | 42 | public Integer getSale() { 43 | return sale; 44 | } 45 | 46 | public void setSale(Integer sale) { 47 | this.sale = sale; 48 | } 49 | 50 | public String getItemId() { 51 | return itemId; 52 | } 53 | 54 | public void setItemId(String itemId) { 55 | this.itemId = itemId; 56 | } 57 | 58 | public String getName() { 59 | return name; 60 | } 61 | 62 | public void setName(String name) { 63 | this.name = name; 64 | } 65 | 66 | public Long getcId() { 67 | return cId; 68 | } 69 | 70 | public void setcId(Long cId) { 71 | this.cId = cId; 72 | } 73 | 74 | public String getItemCatName() { 75 | return itemCatName; 76 | } 77 | 78 | public void setItemCatName(String itemCatName) { 79 | this.itemCatName = itemCatName; 80 | } 81 | 82 | public String getSellPoint() { 83 | return sellPoint; 84 | } 85 | 86 | public void setSellPoint(String sellPoint) { 87 | this.sellPoint = sellPoint; 88 | } 89 | 90 | public BigDecimal getPrice() { 91 | return price; 92 | } 93 | 94 | public void setPrice(BigDecimal price) { 95 | this.price = price; 96 | } 97 | 98 | public Integer getLimitNum() { 99 | return limitNum; 100 | } 101 | 102 | public void setLimitNum(Integer limitNum) { 103 | this.limitNum = limitNum; 104 | } 105 | 106 | public String getImage() { 107 | return image; 108 | } 109 | 110 | public void setImage(String image) { 111 | this.image = image; 112 | } 113 | 114 | public String getDescription() { 115 | return description; 116 | } 117 | 118 | public void setDescription(String description) { 119 | this.description = description; 120 | } 121 | 122 | public Integer getSortOrder() { 123 | return sortOrder; 124 | } 125 | 126 | public void setSortOrder(Integer sortOrder) { 127 | this.sortOrder = sortOrder; 128 | } 129 | 130 | public String getRemark() { 131 | return remark; 132 | } 133 | 134 | public void setRemark(String remark) { 135 | this.remark = remark; 136 | } 137 | 138 | } 139 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/web/ItemCatController.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.web; 2 | 3 | import com.yoke.poseidon.web.itemShow.dto.ItemCatDto; 4 | import com.yoke.poseidon.web.itemShow.dto.Message; 5 | import com.yoke.poseidon.web.itemShow.service.ItemCatService; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiImplicitParam; 8 | import io.swagger.annotations.ApiImplicitParams; 9 | import io.swagger.annotations.ApiOperation; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.http.MediaType; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.PathVariable; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RestController; 16 | 17 | import java.util.List; 18 | 19 | import static com.yoke.poseidon.web.itemShow.dto.Message.failed; 20 | import static com.yoke.poseidon.web.itemShow.dto.Message.success; 21 | 22 | /** 23 | *

24 | * 前端控制器 25 | *

26 | * 27 | * @author ehereal 28 | * @since 2018-09-20 29 | */ 30 | @RestController 31 | @RequestMapping("/itemCat") 32 | @Api(value = "商品分类") 33 | 34 | public class ItemCatController { 35 | 36 | private final ItemCatService itemCatService; 37 | 38 | @Autowired 39 | public ItemCatController(ItemCatService itemCatService) { 40 | this.itemCatService = itemCatService; 41 | } 42 | 43 | @ApiOperation(value = "得到首页左侧展示的根商品分类和相关的商品信息", response = ItemCatDto.class) 44 | @ApiImplicitParams({ 45 | @ApiImplicitParam(paramType = "query", dataType = "Integer", 46 | name = "catLimit", value = "商品分类的数量,推荐是20"), 47 | @ApiImplicitParam(paramType = "query", dataType = "Integer", 48 | name = "itemLimit", value = "商品的数量,推荐是12") }) 49 | 50 | @GetMapping(path = "/ro/{catLimit}/{itemLimit}", 51 | produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 52 | public Message rootCatWithItems(@PathVariable Integer catLimit, 53 | @PathVariable Integer itemLimit) { 54 | 55 | try { 56 | List> data = itemCatService.getRootCat(catLimit, itemLimit); 57 | return success(data); 58 | } 59 | catch (Exception e) { 60 | e.printStackTrace(); 61 | } 62 | return failed(); 63 | } 64 | 65 | @ApiOperation(value = "得到导航栏的展示信息", response = ItemCatDto.class) 66 | @ApiImplicitParams({ 67 | @ApiImplicitParam(paramType = "query", dataType = "Integer", 68 | name = "catLimit", value = "商品分类的数量,推荐是10"), 69 | @ApiImplicitParam(paramType = "query", dataType = "Integer", 70 | name = "itemLimit", value = "商品的数量,推荐是5") }) 71 | @GetMapping(path = "/nav/{catLimit}/{itemLimit}", 72 | produces = MediaType.APPLICATION_JSON_UTF8_VALUE) 73 | public Message navCatWithItems(@PathVariable Integer catLimit, 74 | @PathVariable Integer itemLimit) { 75 | return Message 76 | .success(itemCatService.getItemCatWithItems("nav", catLimit, itemLimit)); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /psd-web-auth/build.gradle: -------------------------------------------------------------------------------- 1 | // the resources required by the gradle script itself 2 | buildscript { 3 | repositories { 4 | mavenCentral() 5 | } 6 | dependencies { 7 | classpath "org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE" 8 | classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE" 9 | classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.6") 10 | } 11 | } 12 | 13 | apply plugin: 'org.springframework.boot' 14 | apply plugin: 'java' 15 | group 'com.yoke.poseidon.web' 16 | apply plugin: "io.spring.dependency-management" 17 | apply plugin: 'io.spring.javaformat' 18 | apply plugin: 'checkstyle' 19 | 20 | ext { 21 | swaggerVersion = '2.9.2' 22 | springBootVersion = '2.2.2.RELEASE' 23 | } 24 | 25 | checkstyle { 26 | toolVersion = "8.11" 27 | } 28 | version '1.0-SNAPSHOT' 29 | repositories { 30 | mavenCentral() 31 | } 32 | 33 | bootJar { 34 | baseName = 'gs-spring-boot-docker' 35 | version = '0.1.0' 36 | } 37 | 38 | repositories { 39 | mavenCentral() 40 | } 41 | 42 | sourceCompatibility = 1.8 43 | targetCompatibility = 1.8 44 | 45 | // show gradle build info 46 | springBoot { 47 | buildInfo() 48 | } 49 | 50 | dependencies { 51 | compile project(':psd-config') 52 | compile('mysql:mysql-connector-java:8.0.12') 53 | // https://mvnrepository.com/artifact/org.modelmapper/modelmapper 54 | compile group: 'org.modelmapper', name: 'modelmapper', version: '2.3.0' 55 | // https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-client 56 | compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-eureka-client' 57 | compile("org.springframework.boot:spring-boot-starter-web") 58 | compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1' 59 | // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security 60 | compile group: 'org.springframework.boot', name: 'spring-boot-starter-security' 61 | compile("org.springframework.boot:spring-boot-starter-test") 62 | compile 'org.springframework.boot:spring-boot-starter-actuator' 63 | // https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter 64 | compile group: 'com.alibaba', name: 'druid-spring-boot-starter', version: '1.1.10' 65 | compile('org.springframework.boot:spring-boot-starter-data-redis') 66 | compile("com.baomidou:mybatis-plus-boot-starter:${mybatisPlusVersion}") 67 | // https://mvnrepository.com/artifact/com.baomidou/mybatis-plus 68 | compile group: 'com.baomidou', name: 'mybatis-plus', version: "${mybatisPlusVersion}" 69 | 70 | compile group: 'org.mybatis.spring.boot', name: 'mybatis-spring-boot-starter', version: '1.3.2' 71 | testCompile("org.springframework.boot:spring-boot-starter-test") 72 | } 73 | 74 | dependencyManagement { 75 | imports { 76 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/dto/ItemCatDto.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | import static com.google.common.collect.Lists.newArrayList; 10 | 11 | /** 12 | * @Author Yoke 13 | * @Date 2018/10/17 下午9:56 14 | */ 15 | public class ItemCatDto implements Serializable { 16 | 17 | private static final long serialVersionUID = 3026371933152829463L; 18 | 19 | private Long itemCatId; 20 | 21 | private String icon; 22 | 23 | private Boolean isParent; 24 | 25 | private String name; 26 | 27 | private Long parentId; 28 | 29 | private String remark; 30 | 31 | private Integer sortOrder; 32 | 33 | private List childCats; 34 | 35 | private List items; 36 | 37 | public ItemCatDto() { 38 | childCats = newArrayList(); 39 | items = newArrayList(); 40 | } 41 | 42 | public Long getItemCatId() { 43 | return itemCatId; 44 | } 45 | 46 | public void setItemCatId(Long itemCatId) { 47 | this.itemCatId = itemCatId; 48 | } 49 | 50 | public String getIcon() { 51 | return icon; 52 | } 53 | 54 | public void setIcon(String icon) { 55 | this.icon = icon; 56 | } 57 | 58 | public Boolean getIsParent() { 59 | return isParent; 60 | } 61 | 62 | public void setIsParent(Boolean isParent) { 63 | this.isParent = isParent; 64 | } 65 | 66 | public String getName() { 67 | return name; 68 | } 69 | 70 | public void setName(String name) { 71 | this.name = name; 72 | } 73 | 74 | public Long getParentId() { 75 | return parentId; 76 | } 77 | 78 | public void setParentId(Long parentId) { 79 | this.parentId = parentId; 80 | } 81 | 82 | public String getRemark() { 83 | return remark; 84 | } 85 | 86 | public void setRemark(String remark) { 87 | this.remark = remark; 88 | } 89 | 90 | public Integer getSortOrder() { 91 | return sortOrder; 92 | } 93 | 94 | public void setSortOrder(Integer sortOrder) { 95 | this.sortOrder = sortOrder; 96 | } 97 | 98 | public static long getSerialVersionUID() { 99 | return serialVersionUID; 100 | } 101 | 102 | public List getChildCats() { 103 | return childCats; 104 | } 105 | 106 | public void setChildCats(List childCats) { 107 | this.childCats = childCats; 108 | } 109 | 110 | public List getItems() { 111 | return items; 112 | } 113 | 114 | public void setItems(List items) { 115 | this.items = items; 116 | } 117 | 118 | @Override 119 | public String toString() { 120 | return "ItemCatDto{" + "itemCatId=" + itemCatId + ", icon='" + icon + '\'' 121 | + ", isParent=" + isParent + ", name='" + name + '\'' + ", parentId=" 122 | + parentId + ", remark='" + remark + '\'' + ", sortOrder=" + sortOrder 123 | + ", childCats=" + childCats + ", items=" + items + '}'; 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /psd-web-order/src/main/java/com/yoke/poseidon/order/entity/OrderItem.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | 5 | import java.io.Serializable; 6 | import java.math.BigDecimal; 7 | 8 | /** 9 | *

10 | * 订单商品关联表 11 | *

12 | * 13 | * @author yoke 14 | * @since 2019-02-10 15 | */ 16 | @TableName("db_order_item") 17 | public class OrderItem implements Serializable { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | private String id; 22 | 23 | private String itemId; 24 | 25 | private String orderId; 26 | 27 | /** 28 | * 商品购买的数量 29 | */ 30 | private Integer itemNum; 31 | 32 | /** 33 | * 商品单价 34 | */ 35 | private BigDecimal itemPrice; 36 | 37 | /** 38 | * 商品总金额 39 | */ 40 | private BigDecimal itemTotalPrice; 41 | 42 | private String itemName; 43 | 44 | private String itemImage; 45 | 46 | private String itemSellPoint; 47 | 48 | public String getItemImage() { 49 | return itemImage; 50 | } 51 | 52 | public void setItemImage(String itemImage) { 53 | this.itemImage = itemImage; 54 | } 55 | 56 | public static long getSerialVersionUID() { 57 | return serialVersionUID; 58 | } 59 | 60 | public String getItemName() { 61 | return itemName; 62 | } 63 | 64 | public void setItemName(String itemName) { 65 | this.itemName = itemName; 66 | } 67 | 68 | public String getItemSellPoint() { 69 | return itemSellPoint; 70 | } 71 | 72 | public void setItemSellPoint(String itemSellPoint) { 73 | this.itemSellPoint = itemSellPoint; 74 | } 75 | 76 | public String getId() { 77 | return id; 78 | } 79 | 80 | public void setId(String id) { 81 | this.id = id; 82 | } 83 | 84 | public String getItemId() { 85 | return itemId; 86 | } 87 | 88 | public void setItemId(String itemId) { 89 | this.itemId = itemId; 90 | } 91 | 92 | public String getOrderId() { 93 | return orderId; 94 | } 95 | 96 | public void setOrderId(String orderId) { 97 | this.orderId = orderId; 98 | } 99 | 100 | public Integer getItemNum() { 101 | return itemNum; 102 | } 103 | 104 | public void setItemNum(Integer itemNum) { 105 | this.itemNum = itemNum; 106 | } 107 | 108 | public BigDecimal getItemPrice() { 109 | return itemPrice; 110 | } 111 | 112 | public void setItemPrice(BigDecimal itemPrice) { 113 | this.itemPrice = itemPrice; 114 | } 115 | 116 | public BigDecimal getItemTotalPrice() { 117 | return itemTotalPrice; 118 | } 119 | 120 | public void setItemTotalPrice(BigDecimal itemTotalPrice) { 121 | this.itemTotalPrice = itemTotalPrice; 122 | } 123 | 124 | @Override 125 | public String toString() { 126 | return "OrderItem{" + "id='" + id + '\'' + ", itemId='" + itemId + '\'' 127 | + ", orderId='" + orderId + '\'' + ", itemNum=" + itemNum + ", itemPrice=" 128 | + itemPrice + ", itemTotalPrice=" + itemTotalPrice + ", itemName='" 129 | + itemName + '\'' + ", itemImage='" + itemImage + '\'' 130 | + ", itemSellPoint='" + itemSellPoint + '\'' + '}'; 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /psd-web-auth/src/main/java/com/yoke/poseidon/auth/config/SecurityConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.auth.config; 2 | 3 | import com.yoke.poseidon.auth.filter.JwtUsernameAndPasswordAuthenticationFilter; 4 | import com.yoke.poseidon.auth.serviceImpl.SecurityUserDetailsService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.http.HttpMethod; 8 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 9 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 10 | import org.springframework.security.config.annotation.web.builders.WebSecurity; 11 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 12 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 13 | import org.springframework.security.config.http.SessionCreationPolicy; 14 | 15 | import javax.servlet.http.HttpServletResponse; 16 | 17 | /** 18 | * @Author Yoke 19 | * @Date 2018/11/25 下午2:54 20 | */ 21 | @EnableWebSecurity 22 | public class SecurityConfiguration extends WebSecurityConfigurerAdapter { 23 | 24 | @Autowired 25 | private SecurityUserDetailsService userDetailsService; 26 | 27 | @Autowired 28 | private JwtConfig jwtConfig; 29 | 30 | // 配置user-detail服务 31 | @Override 32 | protected void configure(AuthenticationManagerBuilder auth) throws Exception { 33 | auth.userDetailsService(userDetailsService); 34 | } 35 | 36 | // 配置Spring Security的Filter链 37 | @Override 38 | public void configure(WebSecurity web) throws Exception { 39 | super.configure(web); 40 | } 41 | 42 | // 通过重载,配置如何通过拦截器保护请求 43 | @Override 44 | protected void configure(HttpSecurity http) throws Exception { 45 | http.headers().frameOptions().sameOrigin().httpStrictTransportSecurity().disable() 46 | .and().csrf().disable() 47 | // make sure we use stateless session; session won't be used to store 48 | // user's state. 49 | .sessionManagement() 50 | .sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() 51 | // handle an authorized attempts 52 | .exceptionHandling() 53 | .authenticationEntryPoint((req, rsp, e) -> rsp 54 | .sendError(HttpServletResponse.SC_UNAUTHORIZED)) 55 | .and() 56 | // Add a filter to validate user credentials and add token in the response 57 | // header 58 | 59 | // What's the authenticationManager()? 60 | // An object provided by WebSecurityConfigurerAdapter, used to 61 | // authenticate the user passing user's credentials 62 | // The filter needs this auth manager to authenticate the user. 63 | .addFilter(new JwtUsernameAndPasswordAuthenticationFilter( 64 | authenticationManager(), jwtConfig)) 65 | .authorizeRequests() 66 | // allow all POST requests 67 | .antMatchers(HttpMethod.POST, jwtConfig.getUri()).permitAll() 68 | .antMatchers(HttpMethod.OPTIONS).permitAll() 69 | // any other requests must be authenticated 70 | .anyRequest().authenticated(); 71 | } 72 | 73 | @Bean 74 | public JwtConfig jwtConfig() { 75 | return new JwtConfig(); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /psd-web-view/src/main/java/com/yoke/poseidon/web/itemShow/entity/Panel.java: -------------------------------------------------------------------------------- 1 | package com.yoke.poseidon.web.itemShow.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | *

12 | * 13 | *

14 | * 15 | * @author yoke 16 | * @since 2018-11-22 17 | */ 18 | @TableName("db_panel") 19 | public class Panel implements Serializable { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | @TableId(value = "panel_id", type = IdType.AUTO) 24 | private Integer panelId; 25 | 26 | private LocalDateTime createDate; 27 | 28 | private Integer limitNum; 29 | 30 | private String name; 31 | 32 | private String remark; 33 | 34 | private Integer sortOrder; 35 | 36 | private Integer status; 37 | 38 | private Integer type; 39 | 40 | private LocalDateTime modifyDate; 41 | 42 | private Long itemCatId; 43 | 44 | public Integer getPanelId() { 45 | return panelId; 46 | } 47 | 48 | public void setPanelId(Integer panelId) { 49 | this.panelId = panelId; 50 | } 51 | 52 | public Integer getLimitNum() { 53 | return limitNum; 54 | } 55 | 56 | public void setLimitNum(Integer limitNum) { 57 | this.limitNum = limitNum; 58 | } 59 | 60 | public String getName() { 61 | return name; 62 | } 63 | 64 | public void setName(String name) { 65 | this.name = name; 66 | } 67 | 68 | public String getRemark() { 69 | return remark; 70 | } 71 | 72 | public void setRemark(String remark) { 73 | this.remark = remark; 74 | } 75 | 76 | public Integer getSortOrder() { 77 | return sortOrder; 78 | } 79 | 80 | public void setSortOrder(Integer sortOrder) { 81 | this.sortOrder = sortOrder; 82 | } 83 | 84 | public Integer getStatus() { 85 | return status; 86 | } 87 | 88 | public void setStatus(Integer status) { 89 | this.status = status; 90 | } 91 | 92 | public Integer getType() { 93 | return type; 94 | } 95 | 96 | public void setType(Integer type) { 97 | this.type = type; 98 | } 99 | 100 | public Long getItemCatId() { 101 | return itemCatId; 102 | } 103 | 104 | public void setItemCatId(Long itemCatId) { 105 | this.itemCatId = itemCatId; 106 | } 107 | 108 | public LocalDateTime getCreateDate() { 109 | return createDate; 110 | } 111 | 112 | public void setCreateDate(LocalDateTime createDate) { 113 | this.createDate = createDate; 114 | } 115 | 116 | public LocalDateTime getModifyDate() { 117 | return modifyDate; 118 | } 119 | 120 | public void setModifyDate(LocalDateTime modifyDate) { 121 | this.modifyDate = modifyDate; 122 | } 123 | 124 | @Override 125 | public String toString() { 126 | return "Panel{" + "panelId=" + panelId + ", createDate=" + createDate 127 | + ", limitNum=" + limitNum + ", name='" + name + '\'' + ", remark='" 128 | + remark + '\'' + ", sortOrder=" + sortOrder + ", status=" + status 129 | + ", type=" + type + ", modifyDate=" + modifyDate + ", itemCatId=" 130 | + itemCatId + '}'; 131 | } 132 | 133 | } 134 | --------------------------------------------------------------------------------