├── .idea ├── compiler.xml ├── encodings.xml ├── misc.xml └── workspace.xml ├── README.MD ├── cart-service ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── hmall │ │ └── cart │ │ ├── CartApplication.java │ │ ├── config │ │ └── CartProPerties.java │ │ ├── controller │ │ └── CartController.java │ │ ├── domain │ │ ├── dto │ │ │ └── CartFormDTO.java │ │ ├── po │ │ │ └── Cart.java │ │ └── vo │ │ │ └── CartVO.java │ │ ├── mapper │ │ └── CartMapper.java │ │ └── service │ │ ├── ICartService.java │ │ └── impl │ │ └── CartServiceImpl.java │ └── resources │ ├── application-dev.yaml │ ├── application-local.yaml │ ├── application.yaml │ └── bootstrap.yaml ├── hm-api ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── hmall │ └── api │ ├── client │ ├── CartClient.java │ ├── ItemClient.java │ ├── PayClient.java │ ├── TradeClient.java │ ├── UserClient.java │ └── fallback │ │ ├── ItemClientFallbackFactory.java │ │ └── PayClientFallback.java │ ├── config │ └── DefaultFeignConfig.java │ └── dto │ ├── ItemDTO.java │ ├── OrderDetailDTO.java │ └── PayOrderDTO.java ├── hm-common ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── hmall │ │ └── common │ │ ├── advice │ │ └── CommonExceptionAdvice.java │ │ ├── config │ │ ├── JsonConfig.java │ │ ├── MqConfig.java │ │ ├── MvcConfig.java │ │ └── MyBatisConfig.java │ │ ├── domain │ │ ├── PageDTO.java │ │ ├── PageQuery.java │ │ └── R.java │ │ ├── exception │ │ ├── BadRequestException.java │ │ ├── BizIllegalException.java │ │ ├── CommonException.java │ │ ├── DbException.java │ │ ├── ForbiddenException.java │ │ └── UnauthorizedException.java │ │ ├── interceptors │ │ └── UserInfoInterceotor.java │ │ └── utils │ │ ├── BeanUtils.java │ │ ├── CollUtils.java │ │ ├── Convert.java │ │ ├── CookieBuilder.java │ │ ├── UserContext.java │ │ └── WebUtils.java │ └── resources │ └── META-INF │ └── spring.factories ├── hm-gateway ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── hmall │ │ └── gateway │ │ ├── GatewayApplication.java │ │ ├── config │ │ ├── AuthProperties.java │ │ ├── JwtProperties.java │ │ └── SecurityConfig.java │ │ ├── filters │ │ ├── AuthGlobalFilter.java │ │ └── MyGlobalFilter.java │ │ ├── routers │ │ └── DynamicRouteLoader.java │ │ └── util │ │ └── JwtTool.java │ └── resources │ ├── application.yml │ ├── bootstrap.yaml │ └── hmall.jks ├── hm-service ├── Dockerfile ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── hmall │ │ │ ├── HMallApplication.java │ │ │ ├── config │ │ │ ├── AuthProperties.java │ │ │ ├── JwtProperties.java │ │ │ ├── MvcConfig.java │ │ │ └── SecurityConfig.java │ │ │ ├── controller │ │ │ ├── AddressController.java │ │ │ ├── CartController.java │ │ │ ├── HelloController.java │ │ │ ├── ItemController.java │ │ │ ├── OrderController.java │ │ │ ├── PayController.java │ │ │ ├── SearchController.java │ │ │ └── UserController.java │ │ │ ├── domain │ │ │ ├── dto │ │ │ │ ├── AddressDTO.java │ │ │ │ ├── CartFormDTO.java │ │ │ │ ├── ItemDTO.java │ │ │ │ ├── LoginFormDTO.java │ │ │ │ ├── OrderDetailDTO.java │ │ │ │ ├── OrderFormDTO.java │ │ │ │ ├── PayApplyDTO.java │ │ │ │ └── PayOrderFormDTO.java │ │ │ ├── po │ │ │ │ ├── Address.java │ │ │ │ ├── Cart.java │ │ │ │ ├── Item.java │ │ │ │ ├── Order.java │ │ │ │ ├── OrderDetail.java │ │ │ │ ├── OrderLogistics.java │ │ │ │ ├── PayOrder.java │ │ │ │ └── User.java │ │ │ ├── query │ │ │ │ └── ItemPageQuery.java │ │ │ └── vo │ │ │ │ ├── CartVO.java │ │ │ │ ├── OrderVO.java │ │ │ │ ├── PayOrderVO.java │ │ │ │ └── UserLoginVO.java │ │ │ ├── enums │ │ │ ├── PayChannel.java │ │ │ ├── PayStatus.java │ │ │ ├── PayType.java │ │ │ └── UserStatus.java │ │ │ ├── interceptor │ │ │ └── LoginInterceptor.java │ │ │ ├── mapper │ │ │ ├── AddressMapper.java │ │ │ ├── CartMapper.java │ │ │ ├── ItemMapper.java │ │ │ ├── OrderDetailMapper.java │ │ │ ├── OrderLogisticsMapper.java │ │ │ ├── OrderMapper.java │ │ │ ├── PayOrderMapper.java │ │ │ └── UserMapper.java │ │ │ ├── service │ │ │ ├── IAddressService.java │ │ │ ├── ICartService.java │ │ │ ├── IItemService.java │ │ │ ├── IOrderDetailService.java │ │ │ ├── IOrderLogisticsService.java │ │ │ ├── IOrderService.java │ │ │ ├── IPayOrderService.java │ │ │ ├── IUserService.java │ │ │ └── impl │ │ │ │ ├── AddressServiceImpl.java │ │ │ │ ├── CartServiceImpl.java │ │ │ │ ├── ItemServiceImpl.java │ │ │ │ ├── OrderDetailServiceImpl.java │ │ │ │ ├── OrderLogisticsServiceImpl.java │ │ │ │ ├── OrderServiceImpl.java │ │ │ │ ├── PayOrderServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ └── utils │ │ │ └── JwtTool.java │ └── resources │ │ ├── application-dev.yaml │ │ ├── application-local.yaml │ │ ├── application.yaml │ │ ├── hmall.jks │ │ └── mapper │ │ ├── CartMapper.xml │ │ ├── ItemMapper.xml │ │ ├── OrderDetailMapper.xml │ │ ├── OrderLogisticsMapper.xml │ │ ├── OrderMapper.xml │ │ ├── PayOrderMapper.xml │ │ ├── TradeClient.xml │ │ └── UserMapper.xml │ └── test │ └── java │ └── com │ └── hmall │ └── service │ └── impl │ ├── HutoolTest.java │ └── ItemServiceImplTest.java ├── hmall-nginx ├── conf │ ├── fastcgi.conf │ ├── fastcgi_params │ ├── koi-utf │ ├── koi-win │ ├── mime.types │ ├── nginx.conf │ ├── scgi_params │ ├── uwsgi_params │ └── win-utf ├── contrib │ ├── README │ ├── geo2nginx.pl │ ├── unicode2nginx │ │ ├── koi-utf │ │ ├── unicode-to-nginx.pl │ │ └── win-utf │ └── vim │ │ ├── ftdetect │ │ └── nginx.vim │ │ ├── ftplugin │ │ └── nginx.vim │ │ ├── indent │ │ └── nginx.vim │ │ └── syntax │ │ └── nginx.vim ├── docs │ ├── CHANGES │ ├── CHANGES.ru │ ├── LICENSE │ ├── OpenSSL.LICENSE │ ├── PCRE.LICENCE │ ├── README │ └── zlib.LICENSE ├── html │ ├── 50x.html │ ├── hm-refresh-admin │ │ ├── .idea │ │ │ ├── .gitignore │ │ │ ├── dictionaries │ │ │ ├── encodings.xml │ │ │ ├── hm-refresh-admin.iml │ │ │ ├── misc.xml │ │ │ └── modules.xml │ │ ├── css │ │ │ ├── element.css │ │ │ ├── fonts │ │ │ │ ├── element-icons.ttf │ │ │ │ └── element-icons.woff │ │ │ ├── index.css │ │ │ ├── login.css │ │ │ └── main.css │ │ ├── favicon.ico │ │ ├── images │ │ │ ├── 1.png │ │ │ ├── bgc.jpg │ │ │ ├── full-logo.png │ │ │ ├── login_center_bg.png │ │ │ ├── logo.png │ │ │ ├── logo1.png │ │ │ ├── ts.png │ │ │ ├── tt.png │ │ │ └── ys.png │ │ ├── index.html │ │ ├── js │ │ │ ├── axios.min.js │ │ │ ├── common.js │ │ │ ├── echarts.js │ │ │ ├── element.js │ │ │ ├── pages │ │ │ │ ├── auth │ │ │ │ │ ├── menu.js │ │ │ │ │ ├── role.js │ │ │ │ │ └── user.js │ │ │ │ ├── banner.js │ │ │ │ ├── class │ │ │ │ │ └── student.js │ │ │ │ ├── goods │ │ │ │ │ ├── category.js │ │ │ │ │ └── list.js │ │ │ │ ├── index.js │ │ │ │ └── menu.js │ │ │ ├── view-router.js │ │ │ └── vue.js │ │ └── login.html │ ├── hmall-admin │ │ ├── .idea │ │ │ ├── .gitignore │ │ │ ├── dictionaries │ │ │ ├── encodings.xml │ │ │ ├── hm-mall-admin.iml │ │ │ ├── misc.xml │ │ │ └── modules.xml │ │ ├── css │ │ │ ├── element.css │ │ │ ├── fonts │ │ │ │ ├── element-icons.ttf │ │ │ │ └── element-icons.woff │ │ │ └── main.css │ │ ├── favicon.ico │ │ ├── items.html │ │ ├── js │ │ │ ├── axios.min.js │ │ │ ├── element.js │ │ │ └── vue.js │ │ └── users.html │ ├── hmall-portal │ │ ├── .idea │ │ │ ├── .gitignore │ │ │ ├── dictionaries │ │ │ ├── encodings.xml │ │ │ ├── hm-mall-portal.iml │ │ │ ├── misc.xml │ │ │ └── modules.xml │ │ ├── cart.html │ │ ├── css │ │ │ ├── banner.css │ │ │ ├── carts.css │ │ │ ├── index.css │ │ │ ├── orderInfo.css │ │ │ ├── pages-cart.css │ │ │ ├── pages-getOrderInfo.css │ │ │ ├── pages-index.css │ │ │ ├── pages-login.css │ │ │ ├── pages-paysuccess.css │ │ │ ├── pages-weixinpay.css │ │ │ ├── pay.css │ │ │ ├── webbase.css │ │ │ └── webbase2.css │ │ ├── favicon.ico │ │ ├── img │ │ │ ├── 57b51ea9Nb862ca5e.png │ │ │ ├── account.png │ │ │ ├── ad.jpg │ │ │ ├── ad.png │ │ │ ├── ad1.png │ │ │ ├── ad2.png │ │ │ ├── ali.png │ │ │ ├── banner1.jpg │ │ │ ├── banner1.png │ │ │ ├── banner2.jpg │ │ │ ├── banner3.jpg │ │ │ ├── banner3x.jpg │ │ │ ├── banner4.jpg │ │ │ ├── barrow.png │ │ │ ├── brand01.png │ │ │ ├── brand02.png │ │ │ ├── brand03.png │ │ │ ├── brand04.png │ │ │ ├── brand05.png │ │ │ ├── brand06.png │ │ │ ├── brand07.png │ │ │ ├── brand08.png │ │ │ ├── brand09.png │ │ │ ├── brand10.png │ │ │ ├── brand11.png │ │ │ ├── brand12.png │ │ │ ├── brand13.png │ │ │ ├── brand_03.png │ │ │ ├── brand_05.png │ │ │ ├── brand_07.png │ │ │ ├── brand_09.png │ │ │ ├── brand_11.png │ │ │ ├── brand_13.png │ │ │ ├── brand_15.png │ │ │ ├── brand_17.png │ │ │ ├── brand_19.png │ │ │ ├── brand_21.png │ │ │ ├── cartPanelViewIcons.png │ │ │ ├── choosed.png │ │ │ ├── clock.png │ │ │ ├── delete.png │ │ │ ├── duihuan.png │ │ │ ├── erweima.png │ │ │ ├── floor-1-1.png │ │ │ ├── floor-1-2.png │ │ │ ├── floor-1-3.png │ │ │ ├── floor-1-4.png │ │ │ ├── floor-1-5.png │ │ │ ├── floor-1-6.png │ │ │ ├── floor-1-b01.png │ │ │ ├── floor-1-b02.png │ │ │ ├── floor-1-b03.png │ │ │ ├── goods.png │ │ │ ├── heima.png │ │ │ ├── icon-red.png │ │ │ ├── icon.png │ │ │ ├── icons.png │ │ │ ├── interest01.png │ │ │ ├── interest02.png │ │ │ ├── interest03.png │ │ │ ├── interest04.png │ │ │ ├── interest05.png │ │ │ ├── interest06.png │ │ │ ├── like1.png │ │ │ ├── like2.png │ │ │ ├── like3.png │ │ │ ├── like4.png │ │ │ ├── like_01.png │ │ │ ├── like_02.png │ │ │ ├── like_03.png │ │ │ ├── like_04.png │ │ │ ├── like_05.png │ │ │ ├── like_06.png │ │ │ ├── linker.png │ │ │ ├── lock.png │ │ │ ├── loginbg.png │ │ │ ├── logo.png │ │ │ ├── mod-list.png │ │ │ ├── phone-bg.png │ │ │ ├── photo.png │ │ │ ├── qq.png │ │ │ ├── quan.png │ │ │ ├── right.png │ │ │ ├── sina.png │ │ │ ├── today01.png │ │ │ ├── today02.png │ │ │ ├── today03.png │ │ │ ├── today04.png │ │ │ ├── weixin.png │ │ │ ├── wx_cz.jpg │ │ │ └── zoom.png │ │ ├── index.html │ │ ├── js │ │ │ ├── axios.min.js │ │ │ ├── common.js │ │ │ ├── copyright.js │ │ │ ├── foot.js │ │ │ ├── qrcode.min.js │ │ │ ├── top.js │ │ │ └── vue.js │ │ ├── login.html │ │ ├── order-confirm.html │ │ ├── pay.html │ │ ├── paysuccess.html │ │ └── search.html │ ├── index.html │ └── verification.html ├── logs │ ├── access.log │ ├── error.log │ └── nginx.pid └── nginx.exe ├── image ├── BaseMapper.png ├── MybatisPlus.png ├── docker.png ├── docker命令.png ├── nacos.png ├── rabbitmq.png ├── seata1.png ├── seata2.png ├── seata3.png ├── springcloud.png ├── 倒排索引.png ├── 单体架构.png ├── 微服务.png ├── 架构图.png ├── 流控规则.png ├── 线程隔离.png ├── 线程隔离1.png ├── 线程隔离2.png ├── 线程隔离3.png ├── 网关.png ├── 网关登录校验.png ├── 网关过滤器.png └── 请求限流.png ├── item-service ├── logs │ └── item-service │ │ └── spring.log ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── hmall │ │ │ └── item │ │ │ ├── ItemApplication.java │ │ │ ├── controller │ │ │ ├── ItemController.java │ │ │ └── SearchController.java │ │ │ ├── domain │ │ │ ├── dto │ │ │ │ ├── ItemDTO.java │ │ │ │ └── OrderDetailDTO.java │ │ │ ├── po │ │ │ │ ├── Item.java │ │ │ │ └── ItemDoc.java │ │ │ └── query │ │ │ │ └── ItemPageQuery.java │ │ │ ├── mapper │ │ │ └── ItemMapper.java │ │ │ └── service │ │ │ ├── IItemService.java │ │ │ └── impl │ │ │ └── ItemServiceImpl.java │ └── resources │ │ ├── application-dev.yaml │ │ ├── application-local.yaml │ │ ├── application.yaml │ │ └── bootstrap.yaml │ └── test │ └── java │ └── com │ └── hmall │ └── item │ └── es │ └── ElasticDocumentTest.java ├── pay-service ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── hmall │ │ └── pay │ │ ├── PayApplication.java │ │ ├── controller │ │ └── PayController.java │ │ ├── domain │ │ ├── dto │ │ │ ├── PayApplyDTO.java │ │ │ └── PayOrderFormDTO.java │ │ ├── po │ │ │ └── PayOrder.java │ │ └── vo │ │ │ └── PayOrderVO.java │ │ ├── enums │ │ ├── PayChannel.java │ │ ├── PayStatus.java │ │ └── PayType.java │ │ ├── mapper │ │ └── PayOrderMapper.java │ │ └── service │ │ ├── IPayOrderService.java │ │ └── impl │ │ └── PayOrderServiceImpl.java │ └── resources │ ├── application-dev.yaml │ ├── application-local.yaml │ └── application.yaml ├── pom.xml ├── sentinel-dashboard.jar ├── sentinel-dashboard命令.txt ├── trade-service ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── hmall │ │ └── trade │ │ ├── TradeApplication.java │ │ ├── constants │ │ └── MQConstants.java │ │ ├── controller │ │ └── OrderController.java │ │ ├── domain │ │ ├── dto │ │ │ └── OrderFormDTO.java │ │ ├── po │ │ │ ├── Order.java │ │ │ ├── OrderDetail.java │ │ │ └── OrderLogistics.java │ │ └── vo │ │ │ └── OrderVO.java │ │ ├── listener │ │ ├── OrderDelayMessageListener.java │ │ └── PayStatusListener.java │ │ ├── mapper │ │ ├── OrderDetailMapper.java │ │ ├── OrderLogisticsMapper.java │ │ └── OrderMapper.java │ │ └── service │ │ ├── IOrderDetailService.java │ │ ├── IOrderLogisticsService.java │ │ ├── IOrderService.java │ │ └── impl │ │ ├── OrderDetailServiceImpl.java │ │ ├── OrderLogisticsServiceImpl.java │ │ └── OrderServiceImpl.java │ └── resources │ ├── application-dev.yaml │ ├── application-local.yaml │ ├── application.yaml │ └── bootstrap.yaml └── user-service ├── pom.xml └── src └── main ├── java └── com │ └── hmall │ └── user │ ├── UserApplication.java │ ├── config │ ├── JwtProperties.java │ └── SecurityConfig.java │ ├── controller │ ├── AddressController.java │ └── UserController.java │ ├── domain │ ├── dto │ │ ├── AddressDTO.java │ │ └── LoginFormDTO.java │ ├── po │ │ ├── Address.java │ │ └── User.java │ └── vo │ │ └── UserLoginVO.java │ ├── enums │ └── UserStatus.java │ ├── mapper │ ├── AddressMapper.java │ └── UserMapper.java │ ├── service │ ├── IAddressService.java │ ├── IUserService.java │ └── impl │ │ ├── AddressServiceImpl.java │ │ └── UserServiceImpl.java │ └── util │ └── JwtTool.java └── resources ├── application-dev.yaml ├── application-local.yaml ├── application.yaml └── hmall.jks /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /cart-service/src/main/java/com/hmall/cart/CartApplication.java: -------------------------------------------------------------------------------- 1 | package com.hmall.cart; 2 | 3 | import com.hmall.api.config.DefaultFeignConfig; 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 | import org.springframework.web.client.RestTemplate; 10 | 11 | @EnableFeignClients(basePackages = "com.hmall.api.client", defaultConfiguration = DefaultFeignConfig.class) 12 | @MapperScan("com.hmall.cart.mapper") 13 | @SpringBootApplication 14 | public class CartApplication { 15 | public static void main(String[] args) { 16 | SpringApplication.run(CartApplication.class, args); 17 | } 18 | 19 | @Bean 20 | public RestTemplate restTemplate(){ 21 | return new RestTemplate(); 22 | } 23 | } -------------------------------------------------------------------------------- /cart-service/src/main/java/com/hmall/cart/config/CartProPerties.java: -------------------------------------------------------------------------------- 1 | package com.hmall.cart.config; 2 | 3 | 4 | import lombok.Data; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Data 9 | @Component 10 | @ConfigurationProperties(prefix = "hm.cart") 11 | public class CartProPerties { 12 | private Integer maxItems; 13 | } 14 | -------------------------------------------------------------------------------- /cart-service/src/main/java/com/hmall/cart/domain/dto/CartFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.cart.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "新增购物车商品表单实体") 9 | public class CartFormDTO { 10 | @ApiModelProperty("商品id") 11 | private Long itemId; 12 | @ApiModelProperty("商品标题") 13 | private String name; 14 | @ApiModelProperty("商品动态属性键值集") 15 | private String spec; 16 | @ApiModelProperty("价格,单位:分") 17 | private Integer price; 18 | @ApiModelProperty("商品图片") 19 | private String image; 20 | } 21 | -------------------------------------------------------------------------------- /cart-service/src/main/java/com/hmall/cart/domain/po/Cart.java: -------------------------------------------------------------------------------- 1 | package com.hmall.cart.domain.po; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | import java.time.LocalDateTime; 12 | 13 | /** 14 | *

15 | * 订单详情表 16 | *

17 | * 18 | * @author 虎哥 19 | * @since 2023-05-05 20 | */ 21 | @Data 22 | @EqualsAndHashCode(callSuper = false) 23 | @Accessors(chain = true) 24 | @TableName("cart") 25 | public class Cart implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | /** 30 | * 购物车条目id 31 | */ 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Long id; 34 | 35 | /** 36 | * 用户id 37 | */ 38 | private Long userId; 39 | 40 | /** 41 | * sku商品id 42 | */ 43 | private Long itemId; 44 | 45 | /** 46 | * 购买数量 47 | */ 48 | private Integer num; 49 | 50 | /** 51 | * 商品标题 52 | */ 53 | private String name; 54 | 55 | /** 56 | * 商品动态属性键值集 57 | */ 58 | private String spec; 59 | 60 | /** 61 | * 价格,单位:分 62 | */ 63 | private Integer price; 64 | 65 | /** 66 | * 商品图片 67 | */ 68 | private String image; 69 | 70 | /** 71 | * 创建时间 72 | */ 73 | private LocalDateTime createTime; 74 | 75 | /** 76 | * 更新时间 77 | */ 78 | private LocalDateTime updateTime; 79 | 80 | 81 | } 82 | -------------------------------------------------------------------------------- /cart-service/src/main/java/com/hmall/cart/domain/vo/CartVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.cart.domain.vo; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | *

11 | * 订单详情表 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | @Data 18 | @ApiModel(description = "购物车VO实体") 19 | public class CartVO { 20 | @ApiModelProperty("购物车条目id ") 21 | private Long id; 22 | @ApiModelProperty("sku商品id") 23 | private Long itemId; 24 | @ApiModelProperty("购买数量") 25 | private Integer num; 26 | @ApiModelProperty("商品标题") 27 | private String name; 28 | @ApiModelProperty("商品动态属性键值集") 29 | private String spec; 30 | @ApiModelProperty("价格,单位:分") 31 | private Integer price; 32 | @ApiModelProperty("商品最新价格") 33 | private Integer newPrice; 34 | @ApiModelProperty("商品最新状态") 35 | private Integer status = 1; 36 | @ApiModelProperty("商品最新库存") 37 | private Integer stock = 10; 38 | @ApiModelProperty("商品图片") 39 | private String image; 40 | @ApiModelProperty("创建时间") 41 | private LocalDateTime createTime; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /cart-service/src/main/java/com/hmall/cart/mapper/CartMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.cart.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.cart.domain.po.Cart; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | /** 9 | *

10 | * 订单详情表 Mapper 接口 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface CartMapper extends BaseMapper { 17 | 18 | @Update("UPDATE cart SET num = num + 1 WHERE user_id = #{userId} AND item_id = #{itemId}") 19 | void updateNum(@Param("itemId") Long itemId, @Param("userId") Long userId); 20 | } 21 | -------------------------------------------------------------------------------- /cart-service/src/main/java/com/hmall/cart/service/ICartService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.cart.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.cart.domain.dto.CartFormDTO; 5 | import com.hmall.cart.domain.po.Cart; 6 | import com.hmall.cart.domain.vo.CartVO; 7 | 8 | import java.util.Collection; 9 | import java.util.List; 10 | 11 | /** 12 | *

13 | * 订单详情表 服务类 14 | *

15 | * 16 | * @author 虎哥 17 | * @since 2023-05-05 18 | */ 19 | public interface ICartService extends IService { 20 | 21 | void addItem2Cart(CartFormDTO cartFormDTO); 22 | 23 | List queryMyCarts(); 24 | 25 | void removeByItemIds(Collection itemIds); 26 | } 27 | -------------------------------------------------------------------------------- /cart-service/src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" 4 | pw: "***" -------------------------------------------------------------------------------- /cart-service/src/main/resources/application-local.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" # 修改为你自己的虚拟机IP地址 4 | pw: "***" # 修改为docker中的MySQL密码 -------------------------------------------------------------------------------- /cart-service/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | feign: 4 | okhttp: 5 | enabled: true # 开启OKHttp功能 6 | sentinel: 7 | enabled: true # 开启feign对sentinel的支持 8 | hm: 9 | db: 10 | database: hm-cart 11 | swagger: 12 | title: "黑马商场购物车服务接口文档" 13 | package: com.hmall.cart.controller 14 | spring: 15 | cloud: 16 | sentinel: 17 | transport: 18 | dashboard: localhost:8090 19 | http-method-specify: true -------------------------------------------------------------------------------- /cart-service/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: cart-service #微服务名称 4 | profiles: 5 | active: dev 6 | cloud: 7 | nacos: 8 | server-addr: "*******" # IP+端口号 9 | config: 10 | file-extension: yaml 11 | shared-configs: 12 | - data-id: shared-jdbc.yaml 13 | - data-id: shared-log.yaml 14 | - data-id: shared-swagger.yaml 15 | - data-id: shared-seata.yaml 16 | 17 | -------------------------------------------------------------------------------- /hm-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.heima 8 | hmall 9 | 1.0.0 10 | 11 | 12 | com.shy 13 | hm-api 14 | 15 | 16 | 17 17 | 17 18 | UTF-8 19 | 20 | 21 | 22 | 23 | 24 | com.heima 25 | hm-common 26 | 1.0.0 27 | 28 | 29 | 30 | org.springframework.cloud 31 | spring-cloud-starter-openfeign 32 | 33 | 34 | 35 | org.springframework.cloud 36 | spring-cloud-starter-loadbalancer 37 | 38 | 39 | io.swagger 40 | swagger-annotations 41 | 1.6.6 42 | compile 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/client/CartClient.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.client; 2 | 3 | import org.springframework.cloud.openfeign.FeignClient; 4 | import org.springframework.web.bind.annotation.DeleteMapping; 5 | import org.springframework.web.bind.annotation.RequestParam; 6 | import java.util.Collection; 7 | 8 | 9 | @FeignClient(value = "cart-service") 10 | public interface CartClient { 11 | 12 | @DeleteMapping("/carts") 13 | void deleteCartItemByIds(@RequestParam("ids") Collection ids); 14 | } 15 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/client/ItemClient.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.client; 2 | 3 | 4 | import com.hmall.api.client.fallback.ItemClientFallbackFactory; 5 | import com.hmall.api.dto.ItemDTO; 6 | import com.hmall.api.dto.OrderDetailDTO; 7 | import io.swagger.annotations.ApiOperation; 8 | import org.springframework.cloud.openfeign.FeignClient; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.PutMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | 14 | import java.util.Collection; 15 | import java.util.List; 16 | 17 | @FeignClient(value = "item-service", fallbackFactory = ItemClientFallbackFactory.class) 18 | public interface ItemClient { 19 | 20 | @GetMapping("/items") 21 | List queryItemByIds(@RequestParam("ids") Collection ids); 22 | 23 | @PutMapping("items/stock/deduct") 24 | void deductStock(@RequestBody Collection items); 25 | } 26 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/client/PayClient.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.client; 2 | 3 | import com.hmall.api.client.fallback.PayClientFallback; 4 | import com.hmall.api.dto.PayOrderDTO; 5 | import org.springframework.cloud.openfeign.FeignClient; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | 9 | @FeignClient(value = "pay-service", fallbackFactory = PayClientFallback.class) 10 | public interface PayClient { 11 | /** 12 | * 根据交易订单id查询支付单 13 | * @param id 业务订单id 14 | * @return 支付单信息 15 | */ 16 | @GetMapping("/pay-orders/biz/{id}") 17 | PayOrderDTO queryPayOrderByBizOrderNo(@PathVariable("id") Long id); 18 | } -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/client/TradeClient.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.client; 2 | 3 | 4 | import io.swagger.annotations.ApiImplicitParam; 5 | import io.swagger.annotations.ApiOperation; 6 | import org.springframework.cloud.openfeign.FeignClient; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.PutMapping; 9 | 10 | @FeignClient(value = "trade-service") 11 | public interface TradeClient { 12 | 13 | @PutMapping("/orders/{orderId}") 14 | void markOrderPaySuccess(@PathVariable("orderId") Long orderId); 15 | } 16 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/client/UserClient.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.client; 2 | 3 | import io.swagger.annotations.ApiImplicitParam; 4 | import io.swagger.annotations.ApiImplicitParams; 5 | import io.swagger.annotations.ApiOperation; 6 | import org.springframework.cloud.openfeign.FeignClient; 7 | import org.springframework.web.bind.annotation.PutMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | 10 | @FeignClient(value = "user-service") 11 | public interface UserClient { 12 | 13 | @PutMapping("/users/money/deduct") 14 | void deductMoney(@RequestParam("pw") String pw, @RequestParam("amount") Integer amount); 15 | } 16 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/client/fallback/ItemClientFallbackFactory.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.client.fallback; 2 | 3 | import com.hmall.api.client.ItemClient; 4 | import com.hmall.api.dto.ItemDTO; 5 | import com.hmall.api.dto.OrderDetailDTO; 6 | import com.hmall.common.exception.BizIllegalException; 7 | import com.hmall.common.utils.CollUtils; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.cloud.openfeign.FallbackFactory; 10 | 11 | import java.util.Collection; 12 | import java.util.List; 13 | 14 | @Slf4j 15 | public class ItemClientFallbackFactory implements FallbackFactory { 16 | 17 | @Override 18 | public ItemClient create(Throwable cause) { 19 | return new ItemClient() { 20 | @Override 21 | public List queryItemByIds(Collection ids) { 22 | log.error("远程调用ItemClient#queryItemByIds方法出现异常,参数:{}", ids, cause); 23 | // 查询购物车允许失败,查询失败,返回空集合 24 | return CollUtils.emptyList(); 25 | } 26 | 27 | @Override 28 | public void deductStock(Collection items) { 29 | // 库存扣减业务需要触发事务回滚,查询失败,抛出异常 30 | throw new RuntimeException(cause); 31 | } 32 | }; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/client/fallback/PayClientFallback.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.client.fallback; 2 | 3 | import com.hmall.api.client.PayClient; 4 | import com.hmall.api.dto.PayOrderDTO; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.cloud.openfeign.FallbackFactory; 7 | 8 | @Slf4j 9 | public class PayClientFallback implements FallbackFactory { 10 | @Override 11 | public PayClient create(Throwable cause) { 12 | return new PayClient() { 13 | @Override 14 | public PayOrderDTO queryPayOrderByBizOrderNo(Long id) { 15 | return null; 16 | } 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/config/DefaultFeignConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.config; 2 | 3 | import com.hmall.api.client.fallback.ItemClientFallbackFactory; 4 | import com.hmall.common.utils.UserContext; 5 | import feign.Logger; 6 | import feign.RequestInterceptor; 7 | import feign.RequestTemplate; 8 | import org.springframework.context.annotation.Bean; 9 | 10 | public class DefaultFeignConfig { 11 | 12 | @Bean 13 | public Logger.Level feignLoggerLevel(){ 14 | return Logger.Level.FULL; 15 | } 16 | 17 | @Bean 18 | public RequestInterceptor userInfoRequestInterceptor(){ 19 | return new RequestInterceptor() { 20 | @Override 21 | public void apply(RequestTemplate template) { 22 | Long userId = UserContext.getUser(); 23 | if (userId != null){ 24 | template.header("user-info", userId.toString()); 25 | } 26 | } 27 | }; 28 | } 29 | 30 | @Bean 31 | public ItemClientFallbackFactory itemClientFallbackFactory(){ 32 | return new ItemClientFallbackFactory(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/dto/ItemDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "商品实体") 9 | public class ItemDTO { 10 | @ApiModelProperty("商品id") 11 | private Long id; 12 | @ApiModelProperty("SKU名称") 13 | private String name; 14 | @ApiModelProperty("价格(分)") 15 | private Integer price; 16 | @ApiModelProperty("库存数量") 17 | private Integer stock; 18 | @ApiModelProperty("商品图片") 19 | private String image; 20 | @ApiModelProperty("类目名称") 21 | private String category; 22 | @ApiModelProperty("品牌名称") 23 | private String brand; 24 | @ApiModelProperty("规格") 25 | private String spec; 26 | @ApiModelProperty("销量") 27 | private Integer sold; 28 | @ApiModelProperty("评论数") 29 | private Integer commentCount; 30 | @ApiModelProperty("是否是推广广告,true/false") 31 | private Boolean isAD; 32 | @ApiModelProperty("商品状态 1-正常,2-下架,3-删除") 33 | private Integer status; 34 | } 35 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/dto/OrderDetailDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | @ApiModel(description = "订单明细条目") 9 | @Data 10 | @Accessors(chain = true) 11 | public class OrderDetailDTO { 12 | @ApiModelProperty("商品id") 13 | private Long itemId; 14 | @ApiModelProperty("商品购买数量") 15 | private Integer num; 16 | } 17 | -------------------------------------------------------------------------------- /hm-api/src/main/java/com/hmall/api/dto/PayOrderDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.api.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | *

11 | * 支付订单 12 | *

13 | */ 14 | @Data 15 | @ApiModel(description = "支付单数据传输实体") 16 | public class PayOrderDTO { 17 | @ApiModelProperty("id") 18 | private Long id; 19 | @ApiModelProperty("业务订单号") 20 | private Long bizOrderNo; 21 | @ApiModelProperty("支付单号") 22 | private Long payOrderNo; 23 | @ApiModelProperty("支付用户id") 24 | private Long bizUserId; 25 | @ApiModelProperty("支付渠道编码") 26 | private String payChannelCode; 27 | @ApiModelProperty("支付金额,单位分") 28 | private Integer amount; 29 | @ApiModelProperty("付类型,1:h5,2:小程序,3:公众号,4:扫码,5:余额支付") 30 | private Integer payType; 31 | @ApiModelProperty("付状态,0:待提交,1:待支付,2:支付超时或取消,3:支付成功") 32 | private Integer status; 33 | @ApiModelProperty("拓展字段,用于传递不同渠道单独处理的字段") 34 | private String expandJson; 35 | @ApiModelProperty("第三方返回业务码") 36 | private String resultCode; 37 | @ApiModelProperty("第三方返回提示信息") 38 | private String resultMsg; 39 | @ApiModelProperty("支付成功时间") 40 | private LocalDateTime paySuccessTime; 41 | @ApiModelProperty("支付超时时间") 42 | private LocalDateTime payOverTime; 43 | @ApiModelProperty("支付二维码链接") 44 | private String qrCodeUrl; 45 | @ApiModelProperty("创建时间") 46 | private LocalDateTime createTime; 47 | @ApiModelProperty("更新时间") 48 | private LocalDateTime updateTime; 49 | } -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/config/JsonConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 6 | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | import java.math.BigInteger; 11 | 12 | @Configuration 13 | @ConditionalOnClass(ObjectMapper.class) 14 | public class JsonConfig { 15 | @Bean 16 | public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { 17 | return jacksonObjectMapperBuilder -> { 18 | // long -> string 19 | jacksonObjectMapperBuilder.serializerByType(Long.class, ToStringSerializer.instance); 20 | jacksonObjectMapperBuilder.serializerByType(BigInteger.class, ToStringSerializer.instance); 21 | }; 22 | } 23 | } -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/config/MqConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.config; 2 | 3 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 4 | import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; 5 | import org.springframework.amqp.support.converter.MessageConverter; 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | @Configuration 11 | @ConditionalOnClass(RabbitTemplate.class) 12 | public class MqConfig { 13 | 14 | @Bean 15 | public MessageConverter messageConverter(){ 16 | return new Jackson2JsonMessageConverter(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/config/MvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.config; 2 | 3 | import com.hmall.common.interceptors.UserInfoInterceotor; 4 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 5 | import org.springframework.context.annotation.Conditional; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.web.servlet.DispatcherServlet; 8 | import org.springframework.web.servlet.HandlerInterceptor; 9 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 10 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 11 | 12 | @Configuration 13 | @ConditionalOnClass(DispatcherServlet.class) 14 | public class MvcConfig implements WebMvcConfigurer { 15 | 16 | @Override 17 | public void addInterceptors(InterceptorRegistry registry) { 18 | registry.addInterceptor(new UserInfoInterceotor()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/config/MyBatisConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.config; 2 | 3 | import com.baomidou.mybatisplus.annotation.DbType; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 6 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | @Configuration 13 | @ConditionalOnClass({MybatisPlusInterceptor.class, BaseMapper.class}) 14 | public class MyBatisConfig { 15 | @Bean 16 | @ConditionalOnMissingBean 17 | public MybatisPlusInterceptor mybatisPlusInterceptor() { 18 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); 19 | // 1.分页拦截器 20 | PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL); 21 | paginationInnerInterceptor.setMaxLimit(1000L); 22 | interceptor.addInnerInterceptor(paginationInnerInterceptor); 23 | return interceptor; 24 | } 25 | } -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/domain/R.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.domain; 2 | 3 | import com.hmall.common.exception.CommonException; 4 | import lombok.Data; 5 | 6 | 7 | @Data 8 | public class R { 9 | private int code; 10 | private String msg; 11 | private T data; 12 | 13 | public static R ok() { 14 | return ok(null); 15 | } 16 | 17 | public static R ok(T data) { 18 | return new R<>(200, "OK", data); 19 | } 20 | 21 | public static R error(String msg) { 22 | return new R<>(500, msg, null); 23 | } 24 | 25 | public static R error(int code, String msg) { 26 | return new R<>(code, msg, null); 27 | } 28 | 29 | public static R error(CommonException e) { 30 | return new R<>(e.getCode(), e.getMessage(), null); 31 | } 32 | 33 | public R() { 34 | } 35 | 36 | public R(int code, String msg, T data) { 37 | this.code = code; 38 | this.msg = msg; 39 | this.data = data; 40 | } 41 | 42 | public boolean success(){ 43 | return code == 200; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/exception/BadRequestException.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.exception; 2 | 3 | public class BadRequestException extends CommonException{ 4 | 5 | public BadRequestException(String message) { 6 | super(message, 400); 7 | } 8 | 9 | public BadRequestException(String message, Throwable cause) { 10 | super(message, cause, 400); 11 | } 12 | 13 | public BadRequestException(Throwable cause) { 14 | super(cause, 400); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/exception/BizIllegalException.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.exception; 2 | 3 | public class BizIllegalException extends CommonException{ 4 | 5 | public BizIllegalException(String message) { 6 | super(message, 500); 7 | } 8 | 9 | public BizIllegalException(String message, Throwable cause) { 10 | super(message, cause, 500); 11 | } 12 | 13 | public BizIllegalException(Throwable cause) { 14 | super(cause, 500); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/exception/CommonException.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.exception; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public class CommonException extends RuntimeException{ 7 | private int code; 8 | 9 | public CommonException(String message, int code) { 10 | super(message); 11 | this.code = code; 12 | } 13 | 14 | public CommonException(String message, Throwable cause, int code) { 15 | super(message, cause); 16 | this.code = code; 17 | } 18 | 19 | public CommonException(Throwable cause, int code) { 20 | super(cause); 21 | this.code = code; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/exception/DbException.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.exception; 2 | 3 | public class DbException extends CommonException{ 4 | 5 | public DbException(String message) { 6 | super(message, 500); 7 | } 8 | 9 | public DbException(String message, Throwable cause) { 10 | super(message, cause, 500); 11 | } 12 | 13 | public DbException(Throwable cause) { 14 | super(cause, 500); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/exception/ForbiddenException.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.exception; 2 | 3 | public class ForbiddenException extends CommonException{ 4 | 5 | public ForbiddenException(String message) { 6 | super(message, 403); 7 | } 8 | 9 | public ForbiddenException(String message, Throwable cause) { 10 | super(message, cause, 403); 11 | } 12 | 13 | public ForbiddenException(Throwable cause) { 14 | super(cause, 403); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/exception/UnauthorizedException.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.exception; 2 | 3 | public class UnauthorizedException extends CommonException{ 4 | 5 | public UnauthorizedException(String message) { 6 | super(message, 401); 7 | } 8 | 9 | public UnauthorizedException(String message, Throwable cause) { 10 | super(message, cause, 401); 11 | } 12 | 13 | public UnauthorizedException(Throwable cause) { 14 | super(cause, 401); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/interceptors/UserInfoInterceotor.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.interceptors; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import com.hmall.common.utils.UserContext; 5 | import org.springframework.web.servlet.HandlerInterceptor; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | public class UserInfoInterceotor implements HandlerInterceptor { 11 | 12 | @Override 13 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 14 | String userInfo = request.getHeader("user-info"); 15 | 16 | if (StrUtil.isNotBlank(userInfo)){ 17 | UserContext.setUser(Long.valueOf(userInfo)); 18 | } 19 | 20 | return true; 21 | } 22 | 23 | 24 | @Override 25 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 26 | UserContext.removeUser(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/utils/Convert.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.utils; 2 | 3 | /** 4 | * 对原对象进行计算,设置到目标对象中 5 | **/ 6 | public interface Convert{ 7 | void convert(R origin, T target); 8 | } -------------------------------------------------------------------------------- /hm-common/src/main/java/com/hmall/common/utils/UserContext.java: -------------------------------------------------------------------------------- 1 | package com.hmall.common.utils; 2 | 3 | public class UserContext { 4 | private static final ThreadLocal tl = new ThreadLocal<>(); 5 | 6 | /** 7 | * 保存当前登录用户信息到ThreadLocal 8 | * @param userId 用户id 9 | */ 10 | public static void setUser(Long userId) { 11 | tl.set(userId); 12 | } 13 | 14 | /** 15 | * 获取当前登录用户信息 16 | * @return 用户id 17 | */ 18 | public static Long getUser() { 19 | return tl.get(); 20 | } 21 | 22 | /** 23 | * 移除当前登录用户信息 24 | */ 25 | public static void removeUser(){ 26 | tl.remove(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /hm-common/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.hmall.common.config.MyBatisConfig,\ 3 | com.hmall.common.config.MvcConfig,\ 4 | com.hmall.common.config.MqConfig,\ 5 | com.hmall.common.config.JsonConfig -------------------------------------------------------------------------------- /hm-gateway/src/main/java/com/hmall/gateway/GatewayApplication.java: -------------------------------------------------------------------------------- 1 | package com.hmall.gateway; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | 7 | @SpringBootApplication 8 | public class GatewayApplication { 9 | public static void main(String[] args) { 10 | SpringApplication.run(GatewayApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /hm-gateway/src/main/java/com/hmall/gateway/config/AuthProperties.java: -------------------------------------------------------------------------------- 1 | package com.hmall.gateway.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @Component 11 | @ConfigurationProperties(prefix = "hm.auth") 12 | public class AuthProperties { 13 | private List includePaths; 14 | private List excludePaths; 15 | } 16 | -------------------------------------------------------------------------------- /hm-gateway/src/main/java/com/hmall/gateway/config/JwtProperties.java: -------------------------------------------------------------------------------- 1 | package com.hmall.gateway.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.core.io.Resource; 6 | 7 | import java.time.Duration; 8 | 9 | @Data 10 | @ConfigurationProperties(prefix = "hm.jwt") 11 | public class JwtProperties { 12 | private Resource location; 13 | private String password; 14 | private String alias; 15 | private Duration tokenTTL = Duration.ofMinutes(10); 16 | } 17 | -------------------------------------------------------------------------------- /hm-gateway/src/main/java/com/hmall/gateway/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.gateway.config; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 7 | import org.springframework.security.crypto.password.PasswordEncoder; 8 | import org.springframework.security.rsa.crypto.KeyStoreKeyFactory; 9 | 10 | import java.security.KeyPair; 11 | 12 | @Configuration 13 | @EnableConfigurationProperties(JwtProperties.class) 14 | public class SecurityConfig { 15 | 16 | @Bean 17 | public PasswordEncoder passwordEncoder(){ 18 | return new BCryptPasswordEncoder(); 19 | } 20 | 21 | @Bean 22 | public KeyPair keyPair(JwtProperties properties){ 23 | // 获取秘钥工厂 24 | KeyStoreKeyFactory keyStoreKeyFactory = 25 | new KeyStoreKeyFactory( 26 | properties.getLocation(), 27 | properties.getPassword().toCharArray()); 28 | //读取钥匙对 29 | return keyStoreKeyFactory.getKeyPair( 30 | properties.getAlias(), 31 | properties.getPassword().toCharArray()); 32 | } 33 | } -------------------------------------------------------------------------------- /hm-gateway/src/main/java/com/hmall/gateway/filters/MyGlobalFilter.java: -------------------------------------------------------------------------------- 1 | package com.hmall.gateway.filters; 2 | 3 | import org.springframework.cloud.gateway.filter.GatewayFilterChain; 4 | import org.springframework.cloud.gateway.filter.GlobalFilter; 5 | import org.springframework.core.Ordered; 6 | import org.springframework.core.annotation.Order; 7 | import org.springframework.http.HttpHeaders; 8 | import org.springframework.http.server.reactive.ServerHttpRequest; 9 | import org.springframework.web.server.ServerWebExchange; 10 | import reactor.core.publisher.Mono; 11 | 12 | public class MyGlobalFilter implements GlobalFilter, Ordered { 13 | 14 | @Override 15 | public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { 16 | ServerHttpRequest request = exchange.getRequest(); 17 | HttpHeaders headers = request.getHeaders(); 18 | System.out.println("headers = " + headers); 19 | return chain.filter(exchange); 20 | } 21 | 22 | @Override 23 | public int getOrder() { 24 | return 0; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /hm-gateway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | hm: 4 | jwt: 5 | location: classpath:hmall.jks 6 | alias: "***" 7 | password: "***" 8 | tokenTTL: 30m 9 | auth: 10 | excludePaths: 11 | - /search/** 12 | - /users/login 13 | - /items/** 14 | - /hi -------------------------------------------------------------------------------- /hm-gateway/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: gateway #微服务名称 4 | profiles: 5 | active: dev 6 | cloud: 7 | nacos: 8 | server-addr: "***" # ip+端口 9 | config: 10 | file-extension: yaml 11 | shared-configs: 12 | - data-id: shared-log.yaml 13 | -------------------------------------------------------------------------------- /hm-gateway/src/main/resources/hmall.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hm-gateway/src/main/resources/hmall.jks -------------------------------------------------------------------------------- /hm-service/Dockerfile: -------------------------------------------------------------------------------- 1 | # 基础镜像 2 | FROM openjdk:11.0-jre-buster 3 | # 设定时区 4 | ENV TZ=Asia/Shanghai 5 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone 6 | # 拷贝jar包 7 | COPY hm-service.jar /app.jar 8 | # 入口 9 | ENTRYPOINT ["java", "-jar", "/app.jar"] -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/HMallApplication.java: -------------------------------------------------------------------------------- 1 | package com.hmall; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @MapperScan("com.hmall.mapper") 8 | @SpringBootApplication 9 | public class HMallApplication { 10 | public static void main(String[] args) { 11 | SpringApplication.run(HMallApplication.class, args); 12 | } 13 | } -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/config/AuthProperties.java: -------------------------------------------------------------------------------- 1 | package com.hmall.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.util.List; 7 | 8 | @Data 9 | @ConfigurationProperties(prefix = "hm.auth") 10 | public class AuthProperties { 11 | private List includePaths; 12 | private List excludePaths; 13 | } 14 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/config/JwtProperties.java: -------------------------------------------------------------------------------- 1 | package com.hmall.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.core.io.Resource; 6 | 7 | import java.time.Duration; 8 | 9 | @Data 10 | @ConfigurationProperties(prefix = "hm.jwt") 11 | public class JwtProperties { 12 | private Resource location; 13 | private String password; 14 | private String alias; 15 | private Duration tokenTTL = Duration.ofMinutes(10); 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.config; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 7 | import org.springframework.security.crypto.password.PasswordEncoder; 8 | import org.springframework.security.rsa.crypto.KeyStoreKeyFactory; 9 | 10 | import java.security.KeyPair; 11 | 12 | @Configuration 13 | @EnableConfigurationProperties(JwtProperties.class) 14 | public class SecurityConfig { 15 | 16 | @Bean 17 | public PasswordEncoder passwordEncoder(){ 18 | return new BCryptPasswordEncoder(); 19 | } 20 | 21 | @Bean 22 | public KeyPair keyPair(JwtProperties properties){ 23 | // 获取秘钥工厂 24 | KeyStoreKeyFactory keyStoreKeyFactory = 25 | new KeyStoreKeyFactory( 26 | properties.getLocation(), 27 | properties.getPassword().toCharArray()); 28 | //读取钥匙对 29 | return keyStoreKeyFactory.getKeyPair( 30 | properties.getAlias(), 31 | properties.getPassword().toCharArray()); 32 | } 33 | } -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.hmall.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.concurrent.atomic.AtomicInteger; 11 | 12 | @RestController 13 | @RequestMapping("hi") 14 | public class HelloController { 15 | 16 | private final Map countMap = new HashMap<>(); 17 | 18 | @GetMapping 19 | public String hello(HttpServletRequest request) throws InterruptedException { 20 | Thread.sleep(300); 21 | String ip = request.getRemoteAddr(); 22 | AtomicInteger ai = countMap.get(ip); 23 | if (ai == null) { 24 | ai = new AtomicInteger(0); 25 | countMap.put(ip, ai); 26 | } 27 | return String.format("
欢迎访问黑马商城, 这是您第%d次访问
", ai.incrementAndGet()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.hmall.controller; 2 | 3 | import com.hmall.common.utils.BeanUtils; 4 | import com.hmall.domain.dto.OrderFormDTO; 5 | import com.hmall.domain.vo.OrderVO; 6 | import com.hmall.service.IOrderService; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiImplicitParam; 9 | import io.swagger.annotations.ApiOperation; 10 | import lombok.RequiredArgsConstructor; 11 | import org.apache.ibatis.annotations.Param; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | @Api(tags = "订单管理接口") 15 | @RestController 16 | @RequestMapping("/orders") 17 | @RequiredArgsConstructor 18 | public class OrderController { 19 | private final IOrderService orderService; 20 | 21 | @ApiOperation("根据id查询订单") 22 | @GetMapping("{id}") 23 | public OrderVO queryOrderById(@Param ("订单id")@PathVariable("id") Long orderId) { 24 | return BeanUtils.copyBean(orderService.getById(orderId), OrderVO.class); 25 | } 26 | 27 | @ApiOperation("创建订单") 28 | @PostMapping 29 | public Long createOrder(@RequestBody OrderFormDTO orderFormDTO){ 30 | return orderService.createOrder(orderFormDTO); 31 | } 32 | 33 | @ApiOperation("标记订单已支付") 34 | @ApiImplicitParam(name = "orderId", value = "订单id", paramType = "path") 35 | @PutMapping("/{orderId}") 36 | public void markOrderPaySuccess(@PathVariable("orderId") Long orderId) { 37 | orderService.markOrderPaySuccess(orderId); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/controller/PayController.java: -------------------------------------------------------------------------------- 1 | package com.hmall.controller; 2 | 3 | import com.hmall.common.exception.BizIllegalException; 4 | import com.hmall.domain.dto.PayApplyDTO; 5 | import com.hmall.domain.dto.PayOrderFormDTO; 6 | import com.hmall.enums.PayType; 7 | import com.hmall.service.IPayOrderService; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiImplicitParam; 10 | import io.swagger.annotations.ApiOperation; 11 | import lombok.RequiredArgsConstructor; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | @Api(tags = "支付相关接口") 15 | @RestController 16 | @RequestMapping("pay-orders") 17 | @RequiredArgsConstructor 18 | public class PayController { 19 | 20 | private final IPayOrderService payOrderService; 21 | 22 | @ApiOperation("生成支付单") 23 | @PostMapping 24 | public String applyPayOrder(@RequestBody PayApplyDTO applyDTO){ 25 | if(!PayType.BALANCE.equalsValue(applyDTO.getPayType())){ 26 | // 目前只支持余额支付 27 | throw new BizIllegalException("抱歉,目前只支持余额支付"); 28 | } 29 | return payOrderService.applyPayOrder(applyDTO); 30 | } 31 | 32 | @ApiOperation("尝试基于用户余额支付") 33 | @ApiImplicitParam(value = "支付单id", name = "id") 34 | @PostMapping("{id}") 35 | public void tryPayOrderByBalance(@PathVariable("id") Long id, @RequestBody PayOrderFormDTO payOrderFormDTO){ 36 | payOrderFormDTO.setId(id); 37 | payOrderService.tryPayOrderByBalance(payOrderFormDTO); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/controller/SearchController.java: -------------------------------------------------------------------------------- 1 | package com.hmall.controller; 2 | 3 | 4 | import cn.hutool.core.util.StrUtil; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.hmall.common.domain.PageDTO; 7 | import com.hmall.domain.dto.ItemDTO; 8 | import com.hmall.domain.po.Item; 9 | import com.hmall.domain.query.ItemPageQuery; 10 | import com.hmall.service.IItemService; 11 | import io.swagger.annotations.Api; 12 | import io.swagger.annotations.ApiOperation; 13 | import lombok.RequiredArgsConstructor; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.RequestMapping; 16 | import org.springframework.web.bind.annotation.RestController; 17 | 18 | @Api(tags = "搜索相关接口") 19 | @RestController 20 | @RequestMapping("/search") 21 | @RequiredArgsConstructor 22 | public class SearchController { 23 | 24 | private final IItemService itemService; 25 | 26 | @ApiOperation("搜索商品") 27 | @GetMapping("/list") 28 | public PageDTO search(ItemPageQuery query) { 29 | // 分页查询 30 | Page result = itemService.lambdaQuery() 31 | .like(StrUtil.isNotBlank(query.getKey()), Item::getName, query.getKey()) 32 | .eq(StrUtil.isNotBlank(query.getBrand()), Item::getBrand, query.getBrand()) 33 | .eq(StrUtil.isNotBlank(query.getCategory()), Item::getCategory, query.getCategory()) 34 | .eq(Item::getStatus, 1) 35 | .between(query.getMaxPrice() != null, Item::getPrice, query.getMinPrice(), query.getMaxPrice()) 36 | .page(query.toMpPage("update_time", false)); 37 | // 封装并返回 38 | return PageDTO.of(result, ItemDTO.class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.hmall.controller; 2 | 3 | import com.hmall.domain.dto.LoginFormDTO; 4 | import com.hmall.domain.vo.UserLoginVO; 5 | import com.hmall.service.IUserService; 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 lombok.RequiredArgsConstructor; 11 | import org.springframework.validation.annotation.Validated; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | @Api(tags = "用户相关接口") 15 | @RestController 16 | @RequestMapping("/users") 17 | @RequiredArgsConstructor 18 | public class UserController { 19 | 20 | private final IUserService userService; 21 | 22 | @ApiOperation("用户登录接口") 23 | @PostMapping("login") 24 | public UserLoginVO login(@RequestBody @Validated LoginFormDTO loginFormDTO){ 25 | return userService.login(loginFormDTO); 26 | } 27 | 28 | @ApiOperation("扣减余额") 29 | @ApiImplicitParams({ 30 | @ApiImplicitParam(name = "pw", value = "支付密码"), 31 | @ApiImplicitParam(name = "amount", value = "支付金额") 32 | }) 33 | @PutMapping("/money/deduct") 34 | public void deductMoney(@RequestParam("pw") String pw,@RequestParam("amount") Integer amount){ 35 | userService.deductMoney(pw, amount); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/AddressDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "收货地址实体") 9 | public class AddressDTO { 10 | @ApiModelProperty("id") 11 | private Long id; 12 | @ApiModelProperty("省") 13 | private String province; 14 | @ApiModelProperty("市") 15 | private String city; 16 | @ApiModelProperty("县/区") 17 | private String town; 18 | @ApiModelProperty("手机") 19 | private String mobile; 20 | @ApiModelProperty("详细地址") 21 | private String street; 22 | @ApiModelProperty("联系人") 23 | private String contact; 24 | @ApiModelProperty("是否是默认 1默认 0否") 25 | private Integer isDefault; 26 | @ApiModelProperty("备注") 27 | private String notes; 28 | } 29 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/CartFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "新增购物车商品表单实体") 9 | public class CartFormDTO { 10 | @ApiModelProperty("商品id") 11 | private Long itemId; 12 | @ApiModelProperty("商品标题") 13 | private String name; 14 | @ApiModelProperty("商品动态属性键值集") 15 | private String spec; 16 | @ApiModelProperty("价格,单位:分") 17 | private Integer price; 18 | @ApiModelProperty("商品图片") 19 | private String image; 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/ItemDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "商品实体") 9 | public class ItemDTO { 10 | @ApiModelProperty("商品id") 11 | private Long id; 12 | @ApiModelProperty("SKU名称") 13 | private String name; 14 | @ApiModelProperty("价格(分)") 15 | private Integer price; 16 | @ApiModelProperty("库存数量") 17 | private Integer stock; 18 | @ApiModelProperty("商品图片") 19 | private String image; 20 | @ApiModelProperty("类目名称") 21 | private String category; 22 | @ApiModelProperty("品牌名称") 23 | private String brand; 24 | @ApiModelProperty("规格") 25 | private String spec; 26 | @ApiModelProperty("销量") 27 | private Integer sold; 28 | @ApiModelProperty("评论数") 29 | private Integer commentCount; 30 | @ApiModelProperty("是否是推广广告,true/false") 31 | private Boolean isAD; 32 | @ApiModelProperty("商品状态 1-正常,2-下架,3-删除") 33 | private Integer status; 34 | } 35 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/LoginFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | 9 | @Data 10 | @ApiModel(description = "登录表单实体") 11 | public class LoginFormDTO { 12 | @ApiModelProperty(value = "用户名", required = true) 13 | @NotNull(message = "用户名不能为空") 14 | private String username; 15 | @NotNull(message = "密码不能为空") 16 | @ApiModelProperty(value = "用户名", required = true) 17 | private String password; 18 | @ApiModelProperty(value = "是否记住我", required = false) 19 | private Boolean rememberMe = false; 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/OrderDetailDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | @ApiModel(description = "订单明细条目") 9 | @Data 10 | @Accessors(chain = true) 11 | public class OrderDetailDTO { 12 | @ApiModelProperty("商品id") 13 | private Long itemId; 14 | @ApiModelProperty("商品购买数量") 15 | private Integer num; 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/OrderFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @ApiModel(description = "交易下单表单实体") 11 | public class OrderFormDTO { 12 | @ApiModelProperty("收货地址id") 13 | private Long addressId; 14 | @ApiModelProperty("支付类型") 15 | private Integer paymentType; 16 | @ApiModelProperty("下单商品列表") 17 | private List details; 18 | } 19 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/PayApplyDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotNull; 10 | 11 | @Data 12 | @Builder 13 | @ApiModel(description = "支付下单表单实体") 14 | public class PayApplyDTO { 15 | @ApiModelProperty("业务订单id不能为空") 16 | @NotNull(message = "业务订单id不能为空") 17 | private Long bizOrderNo; 18 | @ApiModelProperty("支付金额必须为正数") 19 | @Min(value = 1, message = "支付金额必须为正数") 20 | private Integer amount; 21 | @ApiModelProperty("支付渠道编码不能为空") 22 | @NotNull(message = "支付渠道编码不能为空") 23 | private String payChannelCode; 24 | @ApiModelProperty("支付方式不能为空") 25 | @NotNull(message = "支付方式不能为空") 26 | private Integer payType; 27 | @ApiModelProperty("订单中的商品信息不能为空") 28 | @NotNull(message = "订单中的商品信息不能为空") 29 | private String orderInfo; 30 | } -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/dto/PayOrderFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | 8 | import javax.validation.constraints.NotNull; 9 | 10 | @Data 11 | @Builder 12 | @ApiModel(description = "支付确认表单实体") 13 | public class PayOrderFormDTO { 14 | @ApiModelProperty("支付订单id不能为空") 15 | @NotNull(message = "支付订单id不能为空") 16 | private Long id; 17 | @ApiModelProperty("支付密码") 18 | @NotNull(message = "支付密码") 19 | private String pw; 20 | } -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/po/Address.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.po; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author 虎哥 18 | * @since 2023-05-05 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("address") 24 | public class Address implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Long id; 30 | 31 | /** 32 | * 用户ID 33 | */ 34 | private Long userId; 35 | 36 | /** 37 | * 省 38 | */ 39 | private String province; 40 | 41 | /** 42 | * 市 43 | */ 44 | private String city; 45 | 46 | /** 47 | * 县/区 48 | */ 49 | private String town; 50 | 51 | /** 52 | * 手机 53 | */ 54 | private String mobile; 55 | 56 | /** 57 | * 详细地址 58 | */ 59 | private String street; 60 | 61 | /** 62 | * 联系人 63 | */ 64 | private String contact; 65 | 66 | /** 67 | * 是否是默认 1默认 0否 68 | */ 69 | private Integer isDefault; 70 | 71 | /** 72 | * 备注 73 | */ 74 | private String notes; 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/po/Cart.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.po; 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.time.LocalDateTime; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | *

14 | * 订单详情表 15 | *

16 | * 17 | * @author 虎哥 18 | * @since 2023-05-05 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("cart") 24 | public class Cart implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | /** 29 | * 购物车条目id 30 | */ 31 | @TableId(value = "id", type = IdType.AUTO) 32 | private Long id; 33 | 34 | /** 35 | * 用户id 36 | */ 37 | private Long userId; 38 | 39 | /** 40 | * sku商品id 41 | */ 42 | private Long itemId; 43 | 44 | /** 45 | * 购买数量 46 | */ 47 | private Integer num; 48 | 49 | /** 50 | * 商品标题 51 | */ 52 | private String name; 53 | 54 | /** 55 | * 商品动态属性键值集 56 | */ 57 | private String spec; 58 | 59 | /** 60 | * 价格,单位:分 61 | */ 62 | private Integer price; 63 | 64 | /** 65 | * 商品图片 66 | */ 67 | private String image; 68 | 69 | /** 70 | * 创建时间 71 | */ 72 | private LocalDateTime createTime; 73 | 74 | /** 75 | * 更新时间 76 | */ 77 | private LocalDateTime updateTime; 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/po/OrderDetail.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.po; 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.time.LocalDateTime; 7 | import java.io.Serializable; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | /** 13 | *

14 | * 订单详情表 15 | *

16 | * 17 | * @author 虎哥 18 | * @since 2023-05-05 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("order_detail") 24 | public class OrderDetail implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | /** 29 | * 订单详情id 30 | */ 31 | @TableId(value = "id", type = IdType.AUTO) 32 | private Long id; 33 | 34 | /** 35 | * 订单id 36 | */ 37 | private Long orderId; 38 | 39 | /** 40 | * sku商品id 41 | */ 42 | private Long itemId; 43 | 44 | /** 45 | * 购买数量 46 | */ 47 | private Integer num; 48 | 49 | /** 50 | * 商品标题 51 | */ 52 | private String name; 53 | 54 | /** 55 | * 商品动态属性键值集 56 | */ 57 | private String spec; 58 | 59 | /** 60 | * 价格,单位:分 61 | */ 62 | private Integer price; 63 | 64 | /** 65 | * 商品图片 66 | */ 67 | private String image; 68 | 69 | /** 70 | * 创建时间 71 | */ 72 | private LocalDateTime createTime; 73 | 74 | /** 75 | * 更新时间 76 | */ 77 | private LocalDateTime updateTime; 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/po/User.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.po; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.hmall.enums.UserStatus; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.experimental.Accessors; 10 | 11 | import java.io.Serializable; 12 | import java.time.LocalDateTime; 13 | 14 | /** 15 | *

16 | * 用户表 17 | *

18 | * 19 | * @author 虎哥 20 | * @since 2023-05-05 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @Accessors(chain = true) 25 | @TableName("user") 26 | public class User implements Serializable { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | @TableId(value = "id", type = IdType.AUTO) 31 | private Long id; 32 | 33 | /** 34 | * 用户名 35 | */ 36 | private String username; 37 | 38 | /** 39 | * 密码,加密存储 40 | */ 41 | private String password; 42 | 43 | /** 44 | * 注册手机号 45 | */ 46 | private String phone; 47 | 48 | /** 49 | * 创建时间 50 | */ 51 | private LocalDateTime createTime; 52 | 53 | private LocalDateTime updateTime; 54 | 55 | /** 56 | * 使用状态(1正常 2冻结) 57 | */ 58 | private UserStatus status; 59 | 60 | /** 61 | * 账户余额 62 | */ 63 | private Integer balance; 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/query/ItemPageQuery.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.query; 2 | 3 | import com.hmall.common.domain.PageQuery; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | @EqualsAndHashCode(callSuper = true) 10 | @Data 11 | @ApiModel(description = "商品分页查询条件") 12 | public class ItemPageQuery extends PageQuery { 13 | @ApiModelProperty("搜索关键字") 14 | private String key; 15 | @ApiModelProperty("商品分类") 16 | private String category; 17 | @ApiModelProperty("商品品牌") 18 | private String brand; 19 | @ApiModelProperty("价格最小值") 20 | private Integer minPrice; 21 | @ApiModelProperty("价格最大值") 22 | private Integer maxPrice; 23 | } 24 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/vo/CartVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.vo; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | *

11 | * 订单详情表 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | @Data 18 | @ApiModel(description = "购物车VO实体") 19 | public class CartVO { 20 | @ApiModelProperty("购物车条目id ") 21 | private Long id; 22 | @ApiModelProperty("sku商品id") 23 | private Long itemId; 24 | @ApiModelProperty("购买数量") 25 | private Integer num; 26 | @ApiModelProperty("商品标题") 27 | private String name; 28 | @ApiModelProperty("商品动态属性键值集") 29 | private String spec; 30 | @ApiModelProperty("价格,单位:分") 31 | private Integer price; 32 | @ApiModelProperty("商品最新价格") 33 | private Integer newPrice; 34 | @ApiModelProperty("商品最新状态") 35 | private Integer status = 1; 36 | @ApiModelProperty("商品最新库存") 37 | private Integer stock = 10; 38 | @ApiModelProperty("商品图片") 39 | private String image; 40 | @ApiModelProperty("创建时间") 41 | private LocalDateTime createTime; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/vo/OrderVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.vo; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @ApiModel(description = "订单页面VO") 11 | public class OrderVO { 12 | @ApiModelProperty("订单id") 13 | private Long id; 14 | @ApiModelProperty("总金额,单位为分") 15 | private Integer totalFee; 16 | @ApiModelProperty("支付类型,1、支付宝,2、微信,3、扣减余额") 17 | private Integer paymentType; 18 | @ApiModelProperty("用户id") 19 | private Long userId; 20 | @ApiModelProperty("订单的状态,1、未付款 2、已付款,未发货 3、已发货,未确认 4、确认收货,交易成功 5、交易取消,订单关闭 6、交易结束,已评价") 21 | private Integer status; 22 | @ApiModelProperty("创建时间") 23 | private LocalDateTime createTime; 24 | @ApiModelProperty("支付时间") 25 | private LocalDateTime payTime; 26 | @ApiModelProperty("发货时间") 27 | private LocalDateTime consignTime; 28 | @ApiModelProperty("交易完成时间") 29 | private LocalDateTime endTime; 30 | @ApiModelProperty("交易关闭时间") 31 | private LocalDateTime closeTime; 32 | @ApiModelProperty("评价时间") 33 | private LocalDateTime commentTime; 34 | } 35 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/vo/PayOrderVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.vo; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | *

11 | * 支付订单 12 | *

13 | */ 14 | @Data 15 | @ApiModel(description = "支付单vo实体") 16 | public class PayOrderVO { 17 | @ApiModelProperty("id") 18 | private Long id; 19 | @ApiModelProperty("业务订单号") 20 | private Long bizOrderNo; 21 | @ApiModelProperty("支付单号") 22 | private Long payOrderNo; 23 | @ApiModelProperty("支付用户id") 24 | private Long bizUserId; 25 | @ApiModelProperty("支付渠道编码") 26 | private String payChannelCode; 27 | @ApiModelProperty("支付金额,单位分") 28 | private Integer amount; 29 | @ApiModelProperty("付类型,1:h5,2:小程序,3:公众号,4:扫码,5:余额支付") 30 | private Integer payType; 31 | @ApiModelProperty("付状态,0:待提交,1:待支付,2:支付超时或取消,3:支付成功") 32 | private Integer status; 33 | @ApiModelProperty("拓展字段,用于传递不同渠道单独处理的字段") 34 | private String expandJson; 35 | @ApiModelProperty("第三方返回业务码") 36 | private String resultCode; 37 | @ApiModelProperty("第三方返回提示信息") 38 | private String resultMsg; 39 | @ApiModelProperty("支付成功时间") 40 | private LocalDateTime paySuccessTime; 41 | @ApiModelProperty("支付超时时间") 42 | private LocalDateTime payOverTime; 43 | @ApiModelProperty("支付二维码链接") 44 | private String qrCodeUrl; 45 | @ApiModelProperty("创建时间") 46 | private LocalDateTime createTime; 47 | @ApiModelProperty("更新时间") 48 | private LocalDateTime updateTime; 49 | } 50 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/domain/vo/UserLoginVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class UserLoginVO { 7 | private String token; 8 | private Long userId; 9 | private String username; 10 | private Integer balance; 11 | } 12 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/enums/PayChannel.java: -------------------------------------------------------------------------------- 1 | package com.hmall.enums; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import lombok.Getter; 5 | 6 | @Getter 7 | public enum PayChannel { 8 | wxPay("微信支付"), 9 | aliPay("支付宝支付"), 10 | balance("余额支付"), 11 | ; 12 | 13 | private final String desc; 14 | 15 | PayChannel(String desc) { 16 | this.desc = desc; 17 | } 18 | 19 | public static String desc(String value){ 20 | if (StrUtil.isBlank(value)) { 21 | return ""; 22 | } 23 | return PayChannel.valueOf(value).getDesc(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/enums/PayStatus.java: -------------------------------------------------------------------------------- 1 | package com.hmall.enums; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum PayStatus { 7 | NOT_COMMIT(0, "未提交"), 8 | WAIT_BUYER_PAY(1, "待支付"), 9 | TRADE_CLOSED(2, "已关闭"), 10 | TRADE_SUCCESS(3, "支付成功"), 11 | TRADE_FINISHED(3, "支付成功"), 12 | ; 13 | private final int value; 14 | private final String desc; 15 | 16 | PayStatus(int value, String desc) { 17 | this.value = value; 18 | this.desc = desc; 19 | } 20 | 21 | public boolean equalsValue(Integer value){ 22 | if (value == null) { 23 | return false; 24 | } 25 | return getValue() == value; 26 | } 27 | } -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/enums/PayType.java: -------------------------------------------------------------------------------- 1 | package com.hmall.enums; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum PayType{ 7 | JSAPI(1, "网页支付JS"), 8 | MINI_APP(2, "小程序支付"), 9 | APP(3, "APP支付"), 10 | NATIVE(4, "扫码支付"), 11 | BALANCE(5, "余额支付"), 12 | ; 13 | private final int value; 14 | private final String desc; 15 | 16 | PayType(int value, String desc) { 17 | this.value = value; 18 | this.desc = desc; 19 | } 20 | 21 | public boolean equalsValue(Integer value){ 22 | if (value == null) { 23 | return false; 24 | } 25 | return getValue() == value; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/enums/UserStatus.java: -------------------------------------------------------------------------------- 1 | package com.hmall.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | import com.hmall.common.exception.BadRequestException; 5 | import lombok.Getter; 6 | 7 | @Getter 8 | public enum UserStatus { 9 | FROZEN(0, "禁止使用"), 10 | NORMAL(1, "已激活"), 11 | ; 12 | @EnumValue 13 | int value; 14 | String desc; 15 | 16 | UserStatus(Integer value, String desc) { 17 | this.value = value; 18 | this.desc = desc; 19 | } 20 | 21 | public static UserStatus of(int value) { 22 | if (value == 0) { 23 | return FROZEN; 24 | } 25 | if (value == 1) { 26 | return NORMAL; 27 | } 28 | throw new BadRequestException("账户状态错误"); 29 | } 30 | } -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.hmall.interceptor; 2 | 3 | import com.hmall.common.utils.UserContext; 4 | import com.hmall.utils.JwtTool; 5 | import lombok.RequiredArgsConstructor; 6 | import org.springframework.web.servlet.HandlerInterceptor; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | @RequiredArgsConstructor 12 | public class LoginInterceptor implements HandlerInterceptor { 13 | 14 | private final JwtTool jwtTool; 15 | 16 | @Override 17 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 18 | // 1.获取请求头中的 token 19 | String token = request.getHeader("authorization"); 20 | // 2.校验token 21 | Long userId = jwtTool.parseToken(token); 22 | // 3.存入上下文 23 | UserContext.setUser(userId); 24 | // 4.放行 25 | return true; 26 | } 27 | 28 | @Override 29 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 30 | // 清理用户 31 | UserContext.removeUser(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/AddressMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.hmall.domain.po.Address; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface AddressMapper extends BaseMapper
{ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/CartMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.hmall.domain.po.Cart; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | /** 9 | *

10 | * 订单详情表 Mapper 接口 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface CartMapper extends BaseMapper { 17 | 18 | @Update("UPDATE cart SET num = num + 1 WHERE user_id = #{userId} AND item_id = #{itemId}") 19 | void updateNum(@Param("itemId") Long itemId, @Param("userId") Long userId); 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/ItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.domain.dto.OrderDetailDTO; 5 | import com.hmall.domain.po.Item; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | /** 9 | *

10 | * 商品表 Mapper 接口 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface ItemMapper extends BaseMapper { 17 | 18 | @Update("UPDATE item SET stock = stock - #{num} WHERE id = #{itemId}") 19 | void updateStock(OrderDetailDTO orderDetail); 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/OrderDetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.hmall.domain.po.OrderDetail; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 订单详情表 Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface OrderDetailMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/OrderLogisticsMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.hmall.domain.po.OrderLogistics; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface OrderLogisticsMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.hmall.domain.po.Order; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface OrderMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/PayOrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.hmall.domain.po.PayOrder; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 支付订单 Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-16 13 | */ 14 | public interface PayOrderMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.domain.po.User; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | /** 9 | *

10 | * 用户表 Mapper 接口 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface UserMapper extends BaseMapper { 17 | @Update("update user set balance = balance - ${totalFee} where id = #{userId}") 18 | void updateMoney(@Param("userId") Long userId, @Param("totalFee") Integer totalFee); 19 | } 20 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/IAddressService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.hmall.domain.po.Address; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface IAddressService extends IService
{ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/ICartService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.domain.dto.CartFormDTO; 5 | import com.hmall.domain.po.Cart; 6 | import com.hmall.domain.vo.CartVO; 7 | 8 | import java.util.Collection; 9 | import java.util.List; 10 | 11 | /** 12 | *

13 | * 订单详情表 服务类 14 | *

15 | * 16 | * @author 虎哥 17 | * @since 2023-05-05 18 | */ 19 | public interface ICartService extends IService { 20 | 21 | void addItem2Cart(CartFormDTO cartFormDTO); 22 | 23 | List queryMyCarts(); 24 | 25 | void removeByItemIds(Collection itemIds); 26 | } 27 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/IItemService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.hmall.domain.dto.ItemDTO; 4 | import com.hmall.domain.dto.OrderDetailDTO; 5 | import com.hmall.domain.po.Item; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | 8 | import java.util.Collection; 9 | import java.util.List; 10 | 11 | /** 12 | *

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

15 | * 16 | * @author 虎哥 17 | * @since 2023-05-05 18 | */ 19 | public interface IItemService extends IService { 20 | 21 | void deductStock(List items); 22 | 23 | List queryItemByIds(Collection ids); 24 | } 25 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/IOrderDetailService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.hmall.domain.po.OrderDetail; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 订单详情表 服务类 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface IOrderDetailService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/IOrderLogisticsService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.hmall.domain.po.OrderLogistics; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface IOrderLogisticsService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/IOrderService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.hmall.domain.dto.OrderFormDTO; 4 | import com.hmall.domain.po.Order; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author 虎哥 13 | * @since 2023-05-05 14 | */ 15 | public interface IOrderService extends IService { 16 | 17 | Long createOrder(OrderFormDTO orderFormDTO); 18 | 19 | void markOrderPaySuccess(Long orderId); 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/IPayOrderService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.hmall.domain.dto.PayApplyDTO; 4 | import com.hmall.domain.dto.PayOrderFormDTO; 5 | import com.hmall.domain.po.PayOrder; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | 8 | /** 9 | *

10 | * 支付订单 服务类 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-16 15 | */ 16 | public interface IPayOrderService extends IService { 17 | 18 | String applyPayOrder(PayApplyDTO applyDTO); 19 | 20 | void tryPayOrderByBalance(PayOrderFormDTO payOrderFormDTO); 21 | } 22 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.domain.dto.LoginFormDTO; 5 | import com.hmall.domain.po.User; 6 | import com.hmall.domain.vo.UserLoginVO; 7 | 8 | /** 9 | *

10 | * 用户表 服务类 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface IUserService extends IService { 17 | 18 | UserLoginVO login(LoginFormDTO loginFormDTO); 19 | 20 | void deductMoney(String pw, Integer totalFee); 21 | } 22 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/impl/AddressServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service.impl; 2 | 3 | import com.hmall.domain.po.Address; 4 | import com.hmall.mapper.AddressMapper; 5 | import com.hmall.service.IAddressService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | @Service 18 | public class AddressServiceImpl extends ServiceImpl implements IAddressService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/impl/ItemServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.hmall.common.exception.BizIllegalException; 5 | import com.hmall.common.utils.BeanUtils; 6 | import com.hmall.domain.dto.ItemDTO; 7 | import com.hmall.domain.dto.OrderDetailDTO; 8 | import com.hmall.domain.po.Item; 9 | import com.hmall.mapper.ItemMapper; 10 | import com.hmall.service.IItemService; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.Collection; 14 | import java.util.List; 15 | 16 | /** 17 | *

18 | * 商品表 服务实现类 19 | *

20 | * 21 | * @author 虎哥 22 | */ 23 | @Service 24 | public class ItemServiceImpl extends ServiceImpl implements IItemService { 25 | 26 | @Override 27 | public void deductStock(List items) { 28 | String sqlStatement = "com.hmall.mapper.ItemMapper.updateStock"; 29 | boolean r = false; 30 | try { 31 | r = executeBatch(items, (sqlSession, entity) -> sqlSession.update(sqlStatement, entity)); 32 | } catch (Exception e) { 33 | throw new BizIllegalException("更新库存异常,可能是库存不足!", e); 34 | } 35 | if (!r) { 36 | throw new BizIllegalException("库存不足!"); 37 | } 38 | } 39 | 40 | @Override 41 | public List queryItemByIds(Collection ids) { 42 | return BeanUtils.copyList(listByIds(ids), ItemDTO.class); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/impl/OrderDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service.impl; 2 | 3 | import com.hmall.domain.po.OrderDetail; 4 | import com.hmall.mapper.OrderDetailMapper; 5 | import com.hmall.service.IOrderDetailService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 订单详情表 服务实现类 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | @Service 18 | public class OrderDetailServiceImpl extends ServiceImpl implements IOrderDetailService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/java/com/hmall/service/impl/OrderLogisticsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service.impl; 2 | 3 | import com.hmall.domain.po.OrderLogistics; 4 | import com.hmall.mapper.OrderLogisticsMapper; 5 | import com.hmall.service.IOrderLogisticsService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | @Service 18 | public class OrderLogisticsServiceImpl extends ServiceImpl implements IOrderLogisticsService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" 4 | pw: "***" -------------------------------------------------------------------------------- /hm-service/src/main/resources/application-local.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" # 修改为你自己的虚拟机IP地址 4 | pw: "***" # 修改为docker中的MySQL密码 -------------------------------------------------------------------------------- /hm-service/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | spring: 4 | application: 5 | name: hm-service 6 | profiles: 7 | active: dev 8 | datasource: 9 | url: jdbc:mysql://${hm.db.host}:3306/"***"?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai 10 | driver-class-name: com.mysql.cj.jdbc.Driver 11 | username: "***" 12 | password: ${hm.db.pw} 13 | mybatis-plus: 14 | configuration: 15 | default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler 16 | global-config: 17 | db-config: 18 | update-strategy: not_null 19 | id-type: auto 20 | logging: 21 | level: 22 | com.hmall: debug 23 | pattern: 24 | dateformat: HH:mm:ss:SSS 25 | file: 26 | path: "logs/${spring.application.name}" 27 | knife4j: 28 | enable: true 29 | openapi: 30 | title: 黑马商城接口文档 31 | description: "黑马商城接口文档" 32 | email: zhanghuyi@itcast.cn 33 | concat: 虎哥 34 | url: https://www.itcast.cn 35 | version: v1.0.0 36 | group: 37 | default: 38 | group-name: default 39 | api-rule: package 40 | api-rule-resources: 41 | - com.hmall.controller 42 | hm: 43 | jwt: 44 | location: classpath:hmall.jks 45 | alias: "***" 46 | password: "***" 47 | tokenTTL: 30m 48 | auth: 49 | excludePaths: 50 | - /search/** 51 | - /users/login 52 | - /items/** 53 | - /hi 54 | # keytool -genkeypair -alias hmall -keyalg RSA -keypass hmall123 -keystore hmall.jks -storepass hmall123 -------------------------------------------------------------------------------- /hm-service/src/main/resources/hmall.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hm-service/src/main/resources/hmall.jks -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/CartMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/ItemMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/OrderDetailMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/OrderLogisticsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/OrderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/PayOrderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/TradeClient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hm-service/src/test/java/com/hmall/service/impl/HutoolTest.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service.impl; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.junit.jupiter.api.Test; 8 | 9 | public class HutoolTest { 10 | 11 | @Test 12 | void name() { 13 | User jack = User.of(1L, "jack"); 14 | User2 u2 = new User2(); 15 | BeanUtil.copyProperties(jack, u2); 16 | System.out.println("user2 = " + u2); 17 | } 18 | 19 | @Data 20 | @NoArgsConstructor 21 | @AllArgsConstructor(staticName = "of") 22 | static class User { 23 | Long id; 24 | String name; 25 | } 26 | 27 | @Data 28 | static class User2 { 29 | String id; 30 | String name; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /hm-service/src/test/java/com/hmall/service/impl/ItemServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.hmall.service.impl; 2 | 3 | import com.hmall.domain.dto.OrderDetailDTO; 4 | import com.hmall.service.IItemService; 5 | import com.hmall.utils.JwtTool; 6 | import org.junit.jupiter.api.Test; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.test.context.SpringBootTest; 9 | 10 | import java.time.Duration; 11 | import java.util.List; 12 | 13 | @SpringBootTest 14 | class ItemServiceImplTest { 15 | 16 | @Autowired 17 | protected IItemService itemService; 18 | 19 | @Autowired 20 | private JwtTool jwtTool; 21 | 22 | @Test 23 | void testJwt() { 24 | String token = jwtTool.createToken(1L, Duration.ofMinutes(30)); 25 | System.out.println("token = " + token); 26 | } 27 | 28 | @Test 29 | void deductStock() { 30 | List items = List.of( 31 | new OrderDetailDTO().setItemId(317578L).setNum(1), 32 | new OrderDetailDTO().setItemId(317580L).setNum(1) 33 | ); 34 | itemService.deductStock(items); 35 | } 36 | } -------------------------------------------------------------------------------- /hmall-nginx/conf/fastcgi.conf: -------------------------------------------------------------------------------- 1 | 2 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 3 | fastcgi_param QUERY_STRING $query_string; 4 | fastcgi_param REQUEST_METHOD $request_method; 5 | fastcgi_param CONTENT_TYPE $content_type; 6 | fastcgi_param CONTENT_LENGTH $content_length; 7 | 8 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 9 | fastcgi_param REQUEST_URI $request_uri; 10 | fastcgi_param DOCUMENT_URI $document_uri; 11 | fastcgi_param DOCUMENT_ROOT $document_root; 12 | fastcgi_param SERVER_PROTOCOL $server_protocol; 13 | fastcgi_param REQUEST_SCHEME $scheme; 14 | fastcgi_param HTTPS $https if_not_empty; 15 | 16 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 17 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 18 | 19 | fastcgi_param REMOTE_ADDR $remote_addr; 20 | fastcgi_param REMOTE_PORT $remote_port; 21 | fastcgi_param SERVER_ADDR $server_addr; 22 | fastcgi_param SERVER_PORT $server_port; 23 | fastcgi_param SERVER_NAME $server_name; 24 | 25 | # PHP only, required if PHP was built with --enable-force-cgi-redirect 26 | fastcgi_param REDIRECT_STATUS 200; 27 | -------------------------------------------------------------------------------- /hmall-nginx/conf/fastcgi_params: -------------------------------------------------------------------------------- 1 | 2 | fastcgi_param QUERY_STRING $query_string; 3 | fastcgi_param REQUEST_METHOD $request_method; 4 | fastcgi_param CONTENT_TYPE $content_type; 5 | fastcgi_param CONTENT_LENGTH $content_length; 6 | 7 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 8 | fastcgi_param REQUEST_URI $request_uri; 9 | fastcgi_param DOCUMENT_URI $document_uri; 10 | fastcgi_param DOCUMENT_ROOT $document_root; 11 | fastcgi_param SERVER_PROTOCOL $server_protocol; 12 | fastcgi_param REQUEST_SCHEME $scheme; 13 | fastcgi_param HTTPS $https if_not_empty; 14 | 15 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; 16 | fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 17 | 18 | fastcgi_param REMOTE_ADDR $remote_addr; 19 | fastcgi_param REMOTE_PORT $remote_port; 20 | fastcgi_param SERVER_ADDR $server_addr; 21 | fastcgi_param SERVER_PORT $server_port; 22 | fastcgi_param SERVER_NAME $server_name; 23 | 24 | # PHP only, required if PHP was built with --enable-force-cgi-redirect 25 | fastcgi_param REDIRECT_STATUS 200; 26 | -------------------------------------------------------------------------------- /hmall-nginx/conf/scgi_params: -------------------------------------------------------------------------------- 1 | 2 | scgi_param REQUEST_METHOD $request_method; 3 | scgi_param REQUEST_URI $request_uri; 4 | scgi_param QUERY_STRING $query_string; 5 | scgi_param CONTENT_TYPE $content_type; 6 | 7 | scgi_param DOCUMENT_URI $document_uri; 8 | scgi_param DOCUMENT_ROOT $document_root; 9 | scgi_param SCGI 1; 10 | scgi_param SERVER_PROTOCOL $server_protocol; 11 | scgi_param REQUEST_SCHEME $scheme; 12 | scgi_param HTTPS $https if_not_empty; 13 | 14 | scgi_param REMOTE_ADDR $remote_addr; 15 | scgi_param REMOTE_PORT $remote_port; 16 | scgi_param SERVER_PORT $server_port; 17 | scgi_param SERVER_NAME $server_name; 18 | -------------------------------------------------------------------------------- /hmall-nginx/conf/uwsgi_params: -------------------------------------------------------------------------------- 1 | 2 | uwsgi_param QUERY_STRING $query_string; 3 | uwsgi_param REQUEST_METHOD $request_method; 4 | uwsgi_param CONTENT_TYPE $content_type; 5 | uwsgi_param CONTENT_LENGTH $content_length; 6 | 7 | uwsgi_param REQUEST_URI $request_uri; 8 | uwsgi_param PATH_INFO $document_uri; 9 | uwsgi_param DOCUMENT_ROOT $document_root; 10 | uwsgi_param SERVER_PROTOCOL $server_protocol; 11 | uwsgi_param REQUEST_SCHEME $scheme; 12 | uwsgi_param HTTPS $https if_not_empty; 13 | 14 | uwsgi_param REMOTE_ADDR $remote_addr; 15 | uwsgi_param REMOTE_PORT $remote_port; 16 | uwsgi_param SERVER_PORT $server_port; 17 | uwsgi_param SERVER_NAME $server_name; 18 | -------------------------------------------------------------------------------- /hmall-nginx/contrib/README: -------------------------------------------------------------------------------- 1 | 2 | geo2nginx.pl by Andrei Nigmatulin 3 | 4 | The perl script to convert CSV geoip database ( free download 5 | at http://www.maxmind.com/app/geoip_country ) to format, suitable 6 | for use by the ngx_http_geo_module. 7 | 8 | 9 | unicode2nginx by Maxim Dounin 10 | 11 | The perl script to convert unicode mappings ( available 12 | at http://www.unicode.org/Public/MAPPINGS/ ) to the nginx 13 | configuration file format. 14 | Two generated full maps for windows-1251 and koi8-r. 15 | 16 | 17 | vim by Evan Miller 18 | 19 | Syntax highlighting of nginx configuration for vim, to be 20 | placed into ~/.vim/. 21 | 22 | -------------------------------------------------------------------------------- /hmall-nginx/contrib/geo2nginx.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # (c) Andrei Nigmatulin, 2005 4 | # 5 | # this script provided "as is", without any warranties. use it at your own risk. 6 | # 7 | # special thanx to Andrew Sitnikov for perl port 8 | # 9 | # this script converts CSV geoip database (free download at http://www.maxmind.com/app/geoip_country) 10 | # to format, suitable for use with nginx_http_geo module (http://sysoev.ru/nginx) 11 | # 12 | # for example, line with ip range 13 | # 14 | # "62.16.68.0","62.16.127.255","1041253376","1041268735","RU","Russian Federation" 15 | # 16 | # will be converted to four subnetworks: 17 | # 18 | # 62.16.68.0/22 RU; 19 | # 62.16.72.0/21 RU; 20 | # 62.16.80.0/20 RU; 21 | # 62.16.96.0/19 RU; 22 | 23 | 24 | use warnings; 25 | use strict; 26 | 27 | while( ){ 28 | if (/"[^"]+","[^"]+","([^"]+)","([^"]+)","([^"]+)"/){ 29 | print_subnets($1, $2, $3); 30 | } 31 | } 32 | 33 | sub print_subnets { 34 | my ($a1, $a2, $c) = @_; 35 | my $l; 36 | while ($a1 <= $a2) { 37 | for ($l = 0; ($a1 & (1 << $l)) == 0 && ($a1 + ((1 << ($l + 1)) - 1)) <= $a2; $l++){}; 38 | print long2ip($a1) . "/" . (32 - $l) . " " . $c . ";\n"; 39 | $a1 += (1 << $l); 40 | } 41 | } 42 | 43 | sub long2ip { 44 | my $ip = shift; 45 | 46 | my $str = 0; 47 | 48 | $str = ($ip & 255); 49 | 50 | $ip >>= 8; 51 | $str = ($ip & 255).".$str"; 52 | 53 | $ip >>= 8; 54 | $str = ($ip & 255).".$str"; 55 | 56 | $ip >>= 8; 57 | $str = ($ip & 255).".$str"; 58 | } 59 | -------------------------------------------------------------------------------- /hmall-nginx/contrib/unicode2nginx/unicode-to-nginx.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # Convert unicode mappings to nginx configuration file format. 4 | 5 | # You may find useful mappings in various places, including 6 | # unicode.org official site: 7 | # 8 | # http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT 9 | # http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT 10 | 11 | # Needs perl 5.6 or later. 12 | 13 | # Written by Maxim Dounin, mdounin@mdounin.ru 14 | 15 | ############################################################################### 16 | 17 | require 5.006; 18 | 19 | while (<>) { 20 | # Skip comments and empty lines 21 | 22 | next if /^#/; 23 | next if /^\s*$/; 24 | chomp; 25 | 26 | # Convert mappings 27 | 28 | if (/^\s*0x(..)\s*0x(....)\s*(#.*)/) { 29 | # Mapping "#" 30 | my $cs_code = $1; 31 | my $un_code = $2; 32 | my $un_name = $3; 33 | 34 | # Produce UTF-8 sequence from character code; 35 | 36 | my $un_utf8 = join('', 37 | map { sprintf("%02X", $_) } 38 | unpack("U0C*", pack("U", hex($un_code))) 39 | ); 40 | 41 | print " $cs_code $un_utf8 ; $un_name\n"; 42 | 43 | } else { 44 | warn "Unrecognized line: '$_'"; 45 | } 46 | } 47 | 48 | ############################################################################### 49 | -------------------------------------------------------------------------------- /hmall-nginx/contrib/vim/ftdetect/nginx.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile *.nginx set ft=nginx 2 | au BufRead,BufNewFile */etc/nginx/* set ft=nginx 3 | au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx 4 | au BufRead,BufNewFile nginx.conf set ft=nginx 5 | -------------------------------------------------------------------------------- /hmall-nginx/contrib/vim/ftplugin/nginx.vim: -------------------------------------------------------------------------------- 1 | setlocal commentstring=#\ %s 2 | -------------------------------------------------------------------------------- /hmall-nginx/contrib/vim/indent/nginx.vim: -------------------------------------------------------------------------------- 1 | if exists("b:did_indent") 2 | finish 3 | endif 4 | let b:did_indent = 1 5 | 6 | setlocal indentexpr= 7 | 8 | " cindent actually works for nginx' simple file structure 9 | setlocal cindent 10 | " Just make sure that the comments are not reset as defs would be. 11 | setlocal cinkeys-=0# 12 | -------------------------------------------------------------------------------- /hmall-nginx/docs/LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 Igor Sysoev 3 | * Copyright (C) 2011-2019 Nginx, Inc. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | * SUCH DAMAGE. 26 | */ 27 | -------------------------------------------------------------------------------- /hmall-nginx/docs/README: -------------------------------------------------------------------------------- 1 | 2 | Documentation is available at http://nginx.org 3 | 4 | -------------------------------------------------------------------------------- /hmall-nginx/docs/zlib.LICENSE: -------------------------------------------------------------------------------- 1 | (C) 1995-2017 Jean-loup Gailly and Mark Adler 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | Jean-loup Gailly Mark Adler 20 | jloup@gzip.org madler@alumni.caltech.edu 21 | -------------------------------------------------------------------------------- /hmall-nginx/html/50x.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Error 5 | 12 | 13 | 14 |

An error occurred.

15 |

Sorry, the page you are looking for is currently unavailable.
16 | Please try again later.

17 |

If you are the system administrator of this resource then you should check 18 | the error log for details.

19 |

Faithfully yours, nginx.

20 | 21 | 22 | -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /../../../../../../:\lesson\rj19357\code\hm-refresh-admin\.idea/dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/.idea/dictionaries: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/.idea/hm-refresh-admin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/css/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/css/fonts/element-icons.ttf -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/css/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/css/fonts/element-icons.woff -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/css/login.css: -------------------------------------------------------------------------------- 1 | 2 | .login-form-layout { 3 | position: absolute; 4 | left: 0; 5 | right: 0; 6 | width: 360px; 7 | margin: 140px auto; 8 | } 9 | 10 | .login-title { 11 | text-align: center; 12 | color: #555; 13 | } 14 | 15 | .login-center-layout { 16 | background: #9c0404; 17 | width: auto; 18 | height: auto; 19 | max-width: 100%; 20 | max-height: 100%; 21 | margin-top: 200px; 22 | } 23 | 24 | .logo { 25 | width: 50px; 26 | } -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/css/main.css: -------------------------------------------------------------------------------- 1 | html,body{ 2 | height: 100%; 3 | margin: 0; 4 | font-size: 14px; 5 | font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif; 6 | } 7 | #app { 8 | height: 100%; 9 | flex-direction: row; 10 | justify-content: space-between; 11 | display: flex; 12 | display: -webkit-flex; 13 | } 14 | .banner{ 15 | display: flex; 16 | flex-direction: row; 17 | justify-content: space-between; 18 | box-shadow: 1px 1px 3px #888888; 19 | margin-bottom: 2px; 20 | padding: 10px 20px; 21 | align-items: center; 22 | color: #494747 23 | } 24 | .banner .icon{ 25 | width: 2%; 26 | } 27 | .banner .title{ 28 | width: 85%; 29 | font: 20px sans-serif; 30 | } 31 | .mini-box { 32 | width: 20px; 33 | } 34 | .menus{ 35 | width: 15%; 36 | } 37 | .blocks{ 38 | width: 90%; 39 | height: 100%; 40 | } 41 | .btn-add { 42 | float: right; 43 | } -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/favicon.ico -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/1.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/bgc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/bgc.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/full-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/full-logo.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/login_center_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/login_center_bg.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/logo.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/logo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/logo1.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/ts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/ts.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/tt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/tt.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/images/ys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hm-refresh-admin/images/ys.png -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/js/pages/class/student.js: -------------------------------------------------------------------------------- 1 | // 定义组件 2 | const ClassStudent = Vue.extend({ 3 | template: ` 4 |
5 | 8 | 12 | 13 | 17 | 18 | 21 | 22 | 23 |
24 | `, 25 | data(){ 26 | return { 27 | tableData: [{ 28 | date: '2016-05-02', 29 | name: '王小虎', 30 | address: '上海市普陀区金沙江路 1518 弄' 31 | }, { 32 | date: '2016-05-04', 33 | name: '王小虎', 34 | address: '上海市普陀区金沙江路 1517 弄' 35 | }, { 36 | date: '2016-05-01', 37 | name: '王小虎', 38 | address: '上海市普陀区金沙江路 1519 弄' 39 | }, { 40 | date: '2016-05-03', 41 | name: '王小虎', 42 | address: '上海市普陀区金沙江路 1516 弄' 43 | }] 44 | } 45 | }, 46 | methods:{ 47 | 48 | } 49 | }); -------------------------------------------------------------------------------- /hmall-nginx/html/hm-refresh-admin/js/pages/goods/category.js: -------------------------------------------------------------------------------- 1 | // 定义组件 2 | const GoodsCategory = Vue.extend({ 3 | template: ` 4 |

hello, 商品分类

5 | `, 6 | data(){ 7 | return { 8 | 9 | } 10 | }, 11 | methods:{ 12 | 13 | } 14 | }); -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /../../../../:\code\hm-mall-admin\.idea/dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/.idea/dictionaries: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/.idea/hm-mall-admin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/css/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-admin/css/fonts/element-icons.ttf -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/css/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-admin/css/fonts/element-icons.woff -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/css/main.css: -------------------------------------------------------------------------------- 1 | #app { 2 | width: 80%; 3 | margin: auto; 4 | padding: 10px; 5 | text-align: center; 6 | } 7 | .el-dialog{ 8 | padding: 0 20px; 9 | } 10 | .add-btn{ 11 | width: 100%; 12 | display: flex; 13 | display: -webkit-flex; /* Safari */ 14 | justify-content: space-between; 15 | padding: 10px; 16 | } -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-admin/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-admin/favicon.ico -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /../../../../:\code\hm-mall-portal\.idea/dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/.idea/dictionaries: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/.idea/hm-mall-portal.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/css/banner.css: -------------------------------------------------------------------------------- 1 | #toggle-button{ 2 | display: none; 3 | } 4 | .button-label{ 5 | position: relative; 6 | display: inline-block; 7 | width: 68px; 8 | background-color: #ccc; 9 | border: #ccc; 10 | border-radius: 30px; 11 | cursor: pointer; 12 | box-shadow:inset 0 0 3px 1px rgba(0, 0, 0, 0.4); 13 | } 14 | .circle{ 15 | position: absolute; 16 | top: 0; 17 | left: 0; 18 | width: 20px; 19 | height: 20px; 20 | border-radius: 50%; 21 | background-color: #fff; 22 | box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.5); 23 | } 24 | .button-label .text { 25 | line-height: 20px; 26 | font-size: 12px; 27 | 28 | /* 29 | 用来阻止页面文字被选中,出现蓝色 30 | 可以将下面两行代码注释掉来查看区别 31 | */ 32 | -webkit-user-select: none; 33 | user-select: none; 34 | } 35 | .on { 36 | color: #fff; 37 | display: none; 38 | text-indent: 0; 39 | } 40 | .off { 41 | color: #fff; 42 | display: inline-block; 43 | text-indent: 0; 44 | } 45 | .button-label .circle{ 46 | left: 0; 47 | transition: all 0.3s;/*transition过度,时间为0.3秒*/ 48 | } 49 | 50 | /* 51 | 以下是checked被选中后,紧跟checked标签后面label的样式。 52 | 例如:div+p 选择所有紧接着
元素之后的

元素 53 | */ 54 | #toggle-button:checked + label.button-label .circle{ 55 | left: 49px; 56 | } 57 | #toggle-button:checked + label.button-label .on{ 58 | display: inline-block; 59 | } 60 | #toggle-button:checked + label.button-label .off{ 61 | display: none; 62 | } 63 | #toggle-button:checked + label.button-label{ 64 | background-color: #FF8800; 65 | } 66 | 67 | 68 | .banner{ 69 | width: 100%; 70 | display: flex; 71 | justify-content: space-between; 72 | padding-top: 10px; 73 | } 74 | 75 | .logo{ 76 | width: 150px; 77 | } -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/css/carts.css: -------------------------------------------------------------------------------- 1 | .container{ 2 | width: 100%; 3 | height: 500px; 4 | background-color: #fff; 5 | /*border-bottom: #fff 3px solid;*/ 6 | box-shadow: 0 1px 3px rgba(0,0,0,.1); 7 | } 8 | .tab-wrapper{ 9 | position: relative; 10 | width: 100%; 11 | height: 60px; 12 | border-bottom: #a4a3a3 3px solid; 13 | /*background-color: #df3033;*/ 14 | } 15 | .tab-wrapper .tab-radio{ 16 | display: none; 17 | } 18 | .tab-handler{ 19 | position: relative; 20 | z-index: 2; 21 | display: block; 22 | float: left; 23 | height: 60px; 24 | padding: 0 40px; 25 | color: #717181; 26 | font-size: 16px; 27 | line-height: 60px; 28 | /*transition: .3s;*/ 29 | transform: scale(.9); 30 | } 31 | .tab-selected{ 32 | color: #717181; 33 | border-bottom: #df3033 3px solid; 34 | background-color: #fff0f0; 35 | transform: scale(1); 36 | } 37 | .tab-wrapper .tab-content{ 38 | position: absolute; 39 | top: 60px; 40 | left: 0; 41 | padding: 0 30px; 42 | color: #999; 43 | font-size: 14px; 44 | line-height: 1.618em; 45 | background-color: #fff; 46 | transition: transform .5s, opacity .7s; 47 | transform: translateY(20px); 48 | } -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/css/orderInfo.css: -------------------------------------------------------------------------------- 1 | 2 | .num { 3 | line-height: 20px; 4 | width: 60px; 5 | text-align: right; 6 | } 7 | .num span { 8 | font-size: 18px; 9 | line-height: 20px; 10 | width: 20px; 11 | } 12 | .num-btn { 13 | font-size: 16px; 14 | line-height: 20px; 15 | width: 30px; 16 | text-align: center; 17 | } -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/css/pages-paysuccess.css: -------------------------------------------------------------------------------- 1 | .top { 2 | background-color: #f1f1f1 3 | } 4 | .paysuccess { 5 | padding: 25px; 6 | margin: 20px 0; 7 | border: 1px solid #ddd; 8 | font-family: "微软雅黑" 9 | } 10 | 11 | .paysuccess .success { 12 | width: 500px; 13 | margin: 0 auto 14 | } 15 | 16 | .success h3 { 17 | margin: 20px 0; 18 | font-weight: 700; 19 | font-size: 20px 20 | } 21 | 22 | .success .paydetail { 23 | margin-left: 66px; 24 | font-size: 15px 25 | } 26 | 27 | .paydetail p { 28 | line-height: 26px 29 | } 30 | 31 | p.button { 32 | margin: 30px 0 33 | } 34 | 35 | .paydetail .sui-btn.btn-xlarge { 36 | font-size: 18px 37 | } -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/css/pay.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/css/pay.css -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/favicon.ico -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/57b51ea9Nb862ca5e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/57b51ea9Nb862ca5e.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/account.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/ad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/ad.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/ad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/ad.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/ad1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/ad1.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/ad2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/ad2.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/ali.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/ali.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/banner1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/banner1.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/banner1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/banner1.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/banner2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/banner2.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/banner3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/banner3.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/banner3x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/banner3x.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/banner4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/banner4.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/barrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/barrow.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand01.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand02.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand03.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand04.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand05.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand06.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand07.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand08.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand09.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand10.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand11.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand12.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand13.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_03.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_05.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_07.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_09.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_11.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_13.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_15.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_17.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_19.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/brand_21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/brand_21.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/cartPanelViewIcons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/cartPanelViewIcons.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/choosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/choosed.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/clock.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/delete.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/duihuan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/duihuan.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/erweima.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/erweima.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-1.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-2.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-3.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-4.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-5.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-6.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-b01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-b01.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-b02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-b02.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/floor-1-b03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/floor-1-b03.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/goods.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/goods.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/heima.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/heima.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/icon-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/icon-red.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/icon.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/icons.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/interest01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/interest01.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/interest02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/interest02.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/interest03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/interest03.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/interest04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/interest04.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/interest05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/interest05.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/interest06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/interest06.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like1.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like2.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like3.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like4.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like_01.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like_02.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like_03.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like_04.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like_05.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/like_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/like_06.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/linker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/linker.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/lock.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/loginbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/loginbg.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/logo.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/mod-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/mod-list.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/phone-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/phone-bg.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/photo.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/qq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/qq.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/quan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/quan.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/right.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/sina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/sina.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/today01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/today01.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/today02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/today02.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/today03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/today03.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/today04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/today04.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/weixin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/weixin.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/wx_cz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/wx_cz.jpg -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/img/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/html/hmall-portal/img/zoom.png -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/js/copyright.js: -------------------------------------------------------------------------------- 1 | const copyright = { 2 | template: ` 3 |

19 | `, 20 | name: "copyright", 21 | data() { 22 | return {} 23 | } 24 | }; 25 | Vue.component("copyright", copyright); -------------------------------------------------------------------------------- /hmall-nginx/html/hmall-portal/js/top.js: -------------------------------------------------------------------------------- 1 | const topApp = { 2 | template:` 3 |
4 |
5 |
6 | 17 |
    18 |
  • 首页
  • 19 |
  • 20 |
  • 我的购物车
  • 21 |
  • 22 |
  • 我的黑马
  • 23 |
  • 24 |
  • 黑马会员
  • 25 |
  • 26 |
  • 企业采购
  • 27 |
  • 28 |
  • 关注黑马
  • 29 |
  • 30 |
  • 客户服务
  • 31 |
  • 32 |
  • 网站导航
  • 33 |
34 |
35 |
36 |
37 | `, 38 | data(){ 39 | return { 40 | user: null, 41 | util 42 | } 43 | }, 44 | mounted(){ 45 | this.user = this.util.store.get("user-info") 46 | }, 47 | methods:{ 48 | 49 | }, 50 | } 51 | 52 | Vue.component("top", topApp); -------------------------------------------------------------------------------- /hmall-nginx/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to nginx! 5 | 12 | 13 | 14 |

Welcome to nginx!

15 |

If you see this page, the nginx web server is successfully installed and 16 | working. Further configuration is required.

17 | 18 |

For online documentation and support please refer to 19 | nginx.org.
20 | Commercial support is available at 21 | nginx.com.

22 | 23 |

Thank you for using nginx.

24 | 25 | 26 | -------------------------------------------------------------------------------- /hmall-nginx/html/verification.html: -------------------------------------------------------------------------------- 1 | verify_4b483cef1cb19be9933a96c1e63377cb -------------------------------------------------------------------------------- /hmall-nginx/logs/error.log: -------------------------------------------------------------------------------- 1 | 2024/05/12 19:12:50 [error] 23972#3904: *28 CreateFile() "E:\Java\hmall\hmall-nginx/html/hmall-portal/login" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /login HTTP/1.1", host: "localhost:18080" 2 | 2024/05/14 20:00:56 [error] 5140#16956: *1 CreateFile() "E:\Java\hmall\hmall-nginx/html/hmall-portal/items/page" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: localhost, request: "GET /items/page HTTP/1.1", host: "localhost:18080" 3 | 2024/05/19 12:49:47 [error] 22212#8536: *1 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /api/search/list?key=&pageNo=1&pageSize=20&sortBy=&isAsc=false HTTP/1.1", upstream: "http://[::1]:8080/search/list?key=&pageNo=1&pageSize=20&sortBy=&isAsc=false", host: "localhost:18080", referrer: "http://localhost:18080/search.html" 4 | -------------------------------------------------------------------------------- /hmall-nginx/logs/nginx.pid: -------------------------------------------------------------------------------- 1 | 21160 2 | -------------------------------------------------------------------------------- /hmall-nginx/nginx.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/hmall-nginx/nginx.exe -------------------------------------------------------------------------------- /image/BaseMapper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/BaseMapper.png -------------------------------------------------------------------------------- /image/MybatisPlus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/MybatisPlus.png -------------------------------------------------------------------------------- /image/docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/docker.png -------------------------------------------------------------------------------- /image/docker命令.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/docker命令.png -------------------------------------------------------------------------------- /image/nacos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/nacos.png -------------------------------------------------------------------------------- /image/rabbitmq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/rabbitmq.png -------------------------------------------------------------------------------- /image/seata1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/seata1.png -------------------------------------------------------------------------------- /image/seata2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/seata2.png -------------------------------------------------------------------------------- /image/seata3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/seata3.png -------------------------------------------------------------------------------- /image/springcloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/springcloud.png -------------------------------------------------------------------------------- /image/倒排索引.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/倒排索引.png -------------------------------------------------------------------------------- /image/单体架构.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/单体架构.png -------------------------------------------------------------------------------- /image/微服务.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/微服务.png -------------------------------------------------------------------------------- /image/架构图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/架构图.png -------------------------------------------------------------------------------- /image/流控规则.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/流控规则.png -------------------------------------------------------------------------------- /image/线程隔离.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/线程隔离.png -------------------------------------------------------------------------------- /image/线程隔离1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/线程隔离1.png -------------------------------------------------------------------------------- /image/线程隔离2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/线程隔离2.png -------------------------------------------------------------------------------- /image/线程隔离3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/线程隔离3.png -------------------------------------------------------------------------------- /image/网关.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/网关.png -------------------------------------------------------------------------------- /image/网关登录校验.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/网关登录校验.png -------------------------------------------------------------------------------- /image/网关过滤器.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/网关过滤器.png -------------------------------------------------------------------------------- /image/请求限流.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/image/请求限流.png -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/ItemApplication.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @MapperScan("com.hmall.item.mapper") 8 | @SpringBootApplication 9 | public class ItemApplication { 10 | public static void main(String[] args) { 11 | SpringApplication.run(ItemApplication.class, args); 12 | } 13 | } -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/domain/dto/ItemDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "商品实体") 9 | public class ItemDTO { 10 | @ApiModelProperty("商品id") 11 | private Long id; 12 | @ApiModelProperty("SKU名称") 13 | private String name; 14 | @ApiModelProperty("价格(分)") 15 | private Integer price; 16 | @ApiModelProperty("库存数量") 17 | private Integer stock; 18 | @ApiModelProperty("商品图片") 19 | private String image; 20 | @ApiModelProperty("类目名称") 21 | private String category; 22 | @ApiModelProperty("品牌名称") 23 | private String brand; 24 | @ApiModelProperty("规格") 25 | private String spec; 26 | @ApiModelProperty("销量") 27 | private Integer sold; 28 | @ApiModelProperty("评论数") 29 | private Integer commentCount; 30 | @ApiModelProperty("是否是推广广告,true/false") 31 | private Boolean isAD; 32 | @ApiModelProperty("商品状态 1-正常,2-下架,3-删除") 33 | private Integer status; 34 | } 35 | -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/domain/dto/OrderDetailDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | @ApiModel(description = "订单明细条目") 9 | @Data 10 | @Accessors(chain = true) 11 | public class OrderDetailDTO { 12 | @ApiModelProperty("商品id") 13 | private Long itemId; 14 | @ApiModelProperty("商品购买数量") 15 | private Integer num; 16 | } 17 | -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/domain/po/ItemDoc.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item.domain.po; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @ApiModel(description = "索引库实体") 11 | public class ItemDoc{ 12 | 13 | @ApiModelProperty("商品id") 14 | private String id; 15 | 16 | @ApiModelProperty("商品名称") 17 | private String name; 18 | 19 | @ApiModelProperty("价格(分)") 20 | private Integer price; 21 | 22 | @ApiModelProperty("商品图片") 23 | private String image; 24 | 25 | @ApiModelProperty("类目名称") 26 | private String category; 27 | 28 | @ApiModelProperty("品牌名称") 29 | private String brand; 30 | 31 | @ApiModelProperty("销量") 32 | private Integer sold; 33 | 34 | @ApiModelProperty("评论数") 35 | private Integer commentCount; 36 | 37 | @ApiModelProperty("是否是推广广告,true/false") 38 | private Boolean isAD; 39 | 40 | @ApiModelProperty("更新时间") 41 | private LocalDateTime updateTime; 42 | } -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/domain/query/ItemPageQuery.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item.domain.query; 2 | 3 | import com.hmall.common.domain.PageQuery; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | @EqualsAndHashCode(callSuper = true) 10 | @Data 11 | @ApiModel(description = "商品分页查询条件") 12 | public class ItemPageQuery extends PageQuery { 13 | @ApiModelProperty("搜索关键字") 14 | private String key; 15 | @ApiModelProperty("商品分类") 16 | private String category; 17 | @ApiModelProperty("商品品牌") 18 | private String brand; 19 | @ApiModelProperty("价格最小值") 20 | private Integer minPrice; 21 | @ApiModelProperty("价格最大值") 22 | private Integer maxPrice; 23 | } 24 | -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/mapper/ItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.item.domain.dto.OrderDetailDTO; 5 | import com.hmall.item.domain.po.Item; 6 | import org.apache.ibatis.annotations.Update; 7 | 8 | /** 9 | *

10 | * 商品表 Mapper 接口 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface ItemMapper extends BaseMapper { 17 | 18 | @Update("UPDATE item SET stock = stock - #{num} WHERE id = #{itemId}") 19 | void updateStock(OrderDetailDTO orderDetail); 20 | } 21 | -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/service/IItemService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.item.domain.dto.ItemDTO; 5 | import com.hmall.item.domain.dto.OrderDetailDTO; 6 | import com.hmall.item.domain.po.Item; 7 | import java.util.Collection; 8 | import java.util.List; 9 | 10 | /** 11 | *

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

14 | * 15 | * @author 虎哥 16 | * @since 2023-05-05 17 | */ 18 | public interface IItemService extends IService { 19 | 20 | void deductStock(List items); 21 | 22 | List queryItemByIds(Collection ids); 23 | } 24 | -------------------------------------------------------------------------------- /item-service/src/main/java/com/hmall/item/service/impl/ItemServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.item.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.hmall.common.exception.BizIllegalException; 5 | import com.hmall.common.utils.BeanUtils; 6 | import com.hmall.item.domain.dto.ItemDTO; 7 | import com.hmall.item.domain.dto.OrderDetailDTO; 8 | import com.hmall.item.domain.po.Item; 9 | import com.hmall.item.mapper.ItemMapper; 10 | import com.hmall.item.service.IItemService; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import java.util.Collection; 15 | import java.util.List; 16 | 17 | /** 18 | *

19 | * 商品表 服务实现类 20 | *

21 | * 22 | * @author 虎哥 23 | */ 24 | @Service 25 | public class ItemServiceImpl extends ServiceImpl implements IItemService { 26 | 27 | @Override 28 | @Transactional 29 | public void deductStock(List items) { 30 | String sqlStatement = "com.hmall.item.mapper.ItemMapper.updateStock"; 31 | boolean r = false; 32 | try { 33 | r = executeBatch(items, (sqlSession, entity) -> sqlSession.update(sqlStatement, entity)); 34 | } catch (Exception e) { 35 | throw new BizIllegalException("更新库存异常,可能是库存不足!", e); 36 | } 37 | if (!r) { 38 | throw new BizIllegalException("库存不足!"); 39 | } 40 | } 41 | 42 | @Override 43 | public List queryItemByIds(Collection ids) { 44 | return BeanUtils.copyList(listByIds(ids), ItemDTO.class); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /item-service/src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" 4 | pw: "***" -------------------------------------------------------------------------------- /item-service/src/main/resources/application-local.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" # 修改为你自己的虚拟机IP地址 4 | pw: "***" # 修改为docker中的MySQL密码 -------------------------------------------------------------------------------- /item-service/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | hm: 4 | db: 5 | database: hm-item 6 | swagger: 7 | title: "黑马商场商品服务接口文档" 8 | package: com.hmall.item.controller 9 | 10 | -------------------------------------------------------------------------------- /item-service/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: item-service #微服务名称 4 | profiles: 5 | active: dev 6 | cloud: 7 | nacos: 8 | server-addr: "***" 9 | config: 10 | file-extension: yaml 11 | shared-configs: 12 | - data-id: shared-jdbc.yaml 13 | - data-id: shared-log.yaml 14 | - data-id: shared-swagger.yaml 15 | - data-id: shared-seata.yaml 16 | 17 | -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/PayApplication.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay; 2 | 3 | import com.hmall.api.config.DefaultFeignConfig; 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 | import org.springframework.web.client.RestTemplate; 10 | 11 | @EnableFeignClients(basePackages = "com.hmall.api.client", defaultConfiguration = DefaultFeignConfig.class) 12 | @MapperScan("com.hmall.pay.mapper") 13 | @SpringBootApplication 14 | public class PayApplication { 15 | public static void main(String[] args) { 16 | SpringApplication.run(PayApplication.class, args); 17 | } 18 | 19 | @Bean 20 | public RestTemplate restTemplate(){ 21 | return new RestTemplate(); 22 | } 23 | } -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/domain/dto/PayApplyDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | 8 | import javax.validation.constraints.Min; 9 | import javax.validation.constraints.NotNull; 10 | 11 | @Data 12 | @Builder 13 | @ApiModel(description = "支付下单表单实体") 14 | public class PayApplyDTO { 15 | @ApiModelProperty("业务订单id不能为空") 16 | @NotNull(message = "业务订单id不能为空") 17 | private Long bizOrderNo; 18 | @ApiModelProperty("支付金额必须为正数") 19 | @Min(value = 1, message = "支付金额必须为正数") 20 | private Integer amount; 21 | @ApiModelProperty("支付渠道编码不能为空") 22 | @NotNull(message = "支付渠道编码不能为空") 23 | private String payChannelCode; 24 | @ApiModelProperty("支付方式不能为空") 25 | @NotNull(message = "支付方式不能为空") 26 | private Integer payType; 27 | @ApiModelProperty("订单中的商品信息不能为空") 28 | @NotNull(message = "订单中的商品信息不能为空") 29 | private String orderInfo; 30 | } -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/domain/dto/PayOrderFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | 8 | import javax.validation.constraints.NotNull; 9 | 10 | @Data 11 | @Builder 12 | @ApiModel(description = "支付确认表单实体") 13 | public class PayOrderFormDTO { 14 | @ApiModelProperty("支付订单id不能为空") 15 | @NotNull(message = "支付订单id不能为空") 16 | private Long id; 17 | @ApiModelProperty("支付密码") 18 | @NotNull(message = "支付密码") 19 | private String pw; 20 | } -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/domain/vo/PayOrderVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.domain.vo; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | *

11 | * 支付订单 12 | *

13 | */ 14 | @Data 15 | @ApiModel(description = "支付单vo实体") 16 | public class PayOrderVO { 17 | @ApiModelProperty("id") 18 | private Long id; 19 | @ApiModelProperty("业务订单号") 20 | private Long bizOrderNo; 21 | @ApiModelProperty("支付单号") 22 | private Long payOrderNo; 23 | @ApiModelProperty("支付用户id") 24 | private Long bizUserId; 25 | @ApiModelProperty("支付渠道编码") 26 | private String payChannelCode; 27 | @ApiModelProperty("支付金额,单位分") 28 | private Integer amount; 29 | @ApiModelProperty("付类型,1:h5,2:小程序,3:公众号,4:扫码,5:余额支付") 30 | private Integer payType; 31 | @ApiModelProperty("付状态,0:待提交,1:待支付,2:支付超时或取消,3:支付成功") 32 | private Integer status; 33 | @ApiModelProperty("拓展字段,用于传递不同渠道单独处理的字段") 34 | private String expandJson; 35 | @ApiModelProperty("第三方返回业务码") 36 | private String resultCode; 37 | @ApiModelProperty("第三方返回提示信息") 38 | private String resultMsg; 39 | @ApiModelProperty("支付成功时间") 40 | private LocalDateTime paySuccessTime; 41 | @ApiModelProperty("支付超时时间") 42 | private LocalDateTime payOverTime; 43 | @ApiModelProperty("支付二维码链接") 44 | private String qrCodeUrl; 45 | @ApiModelProperty("创建时间") 46 | private LocalDateTime createTime; 47 | @ApiModelProperty("更新时间") 48 | private LocalDateTime updateTime; 49 | } 50 | -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/enums/PayChannel.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.enums; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import lombok.Getter; 5 | 6 | @Getter 7 | public enum PayChannel { 8 | wxPay("微信支付"), 9 | aliPay("支付宝支付"), 10 | balance("余额支付"), 11 | ; 12 | 13 | private final String desc; 14 | 15 | PayChannel(String desc) { 16 | this.desc = desc; 17 | } 18 | 19 | public static String desc(String value){ 20 | if (StrUtil.isBlank(value)) { 21 | return ""; 22 | } 23 | return PayChannel.valueOf(value).getDesc(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/enums/PayStatus.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.enums; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum PayStatus { 7 | NOT_COMMIT(0, "未提交"), 8 | WAIT_BUYER_PAY(1, "待支付"), 9 | TRADE_CLOSED(2, "已关闭"), 10 | TRADE_SUCCESS(3, "支付成功"), 11 | TRADE_FINISHED(3, "支付成功"), 12 | ; 13 | private final int value; 14 | private final String desc; 15 | 16 | PayStatus(int value, String desc) { 17 | this.value = value; 18 | this.desc = desc; 19 | } 20 | 21 | public boolean equalsValue(Integer value){ 22 | if (value == null) { 23 | return false; 24 | } 25 | return getValue() == value; 26 | } 27 | } -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/enums/PayType.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.enums; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum PayType{ 7 | JSAPI(1, "网页支付JS"), 8 | MINI_APP(2, "小程序支付"), 9 | APP(3, "APP支付"), 10 | NATIVE(4, "扫码支付"), 11 | BALANCE(5, "余额支付"), 12 | ; 13 | private final int value; 14 | private final String desc; 15 | 16 | PayType(int value, String desc) { 17 | this.value = value; 18 | this.desc = desc; 19 | } 20 | 21 | public boolean equalsValue(Integer value){ 22 | if (value == null) { 23 | return false; 24 | } 25 | return getValue() == value; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/mapper/PayOrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.pay.domain.po.PayOrder; 5 | 6 | 7 | /** 8 | *

9 | * 支付订单 Mapper 接口 10 | *

11 | * 12 | * @author 虎哥 13 | * @since 2023-05-16 14 | */ 15 | public interface PayOrderMapper extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /pay-service/src/main/java/com/hmall/pay/service/IPayOrderService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.pay.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.pay.domain.dto.PayApplyDTO; 5 | import com.hmall.pay.domain.dto.PayOrderFormDTO; 6 | import com.hmall.pay.domain.po.PayOrder; 7 | 8 | 9 | /** 10 | *

11 | * 支付订单 服务类 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-16 16 | */ 17 | public interface IPayOrderService extends IService { 18 | 19 | String applyPayOrder(PayApplyDTO applyDTO); 20 | 21 | void tryPayOrderByBalance(PayOrderFormDTO payOrderFormDTO); 22 | } 23 | -------------------------------------------------------------------------------- /pay-service/src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" 4 | pw: "***" -------------------------------------------------------------------------------- /pay-service/src/main/resources/application-local.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" # 修改为你自己的虚拟机IP地址 4 | pw: "***" # 修改为docker中的MySQL密码 -------------------------------------------------------------------------------- /pay-service/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8086 3 | spring: 4 | application: 5 | name: pay-service #微服务名称 6 | profiles: 7 | active: dev 8 | datasource: 9 | url: jdbc:mysql://${hm.db.host}:3306/"***"?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai 10 | driver-class-name: com.mysql.cj.jdbc.Driver 11 | username: "***" 12 | password: ${hm.db.pw} 13 | cloud: 14 | nacos: 15 | server-addr: "***" 16 | rabbitmq: 17 | host: "***" # 你的虚拟机IP 18 | port: 5672 # 端口 19 | virtual-host: "***" # 虚拟主机 20 | username: "***" # 用户名 21 | password: "***" # 密码 22 | mybatis-plus: 23 | configuration: 24 | default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler 25 | global-config: 26 | db-config: 27 | update-strategy: not_null 28 | id-type: auto 29 | logging: 30 | level: 31 | com.hmall: debug 32 | pattern: 33 | dateformat: HH:mm:ss:SSS 34 | file: 35 | path: "logs/${spring.application.name}" 36 | knife4j: 37 | enable: true 38 | openapi: 39 | title: 黑马商城支付服务接口文档 40 | description: "黑马商城支付服务接口文档" 41 | email: zhanghuyi@itcast.cn 42 | concat: 虎哥 43 | url: https://www.itcast.cn 44 | version: v1.0.0 45 | group: 46 | default: 47 | group-name: default 48 | api-rule: package 49 | api-rule-resources: 50 | - com.hmall.pay.controller 51 | feign: 52 | okhttp: 53 | enabled: true # 开启OKHttp功能 -------------------------------------------------------------------------------- /sentinel-dashboard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/sentinel-dashboard.jar -------------------------------------------------------------------------------- /sentinel-dashboard命令.txt: -------------------------------------------------------------------------------- 1 | 在sentinel-dashboard.jar目录下输入cmd,然后输入以下命令: 2 | java -Dserver.port=8090 -Dcsp.sentinel.dashboard.server=localhost:8090 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/TradeApplication.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade; 2 | 3 | import com.hmall.api.config.DefaultFeignConfig; 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 | import org.springframework.web.client.RestTemplate; 10 | 11 | @EnableFeignClients(basePackages = "com.hmall.api.client", defaultConfiguration = DefaultFeignConfig.class) 12 | @MapperScan("com.hmall.trade.mapper") 13 | @SpringBootApplication 14 | public class TradeApplication { 15 | public static void main(String[] args) { 16 | SpringApplication.run(TradeApplication.class, args); 17 | } 18 | 19 | @Bean 20 | public RestTemplate restTemplate(){ 21 | return new RestTemplate(); 22 | } 23 | } -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/constants/MQConstants.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.constants; 2 | 3 | public interface MQConstants { 4 | String DELAY_EXCHANGE_NAME = "trade.delay.direct"; 5 | String DELAY_ORDER_QUEUE_NAME = "trade.delay.order.queue"; 6 | String DELAY_ORDER_KEY = "delay.order.query"; 7 | } 8 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.controller; 2 | 3 | import com.hmall.common.utils.BeanUtils; 4 | 5 | import com.hmall.trade.domain.dto.OrderFormDTO; 6 | import com.hmall.trade.domain.vo.OrderVO; 7 | import com.hmall.trade.service.IOrderService; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiImplicitParam; 10 | import io.swagger.annotations.ApiOperation; 11 | import lombok.RequiredArgsConstructor; 12 | import org.apache.ibatis.annotations.Param; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | @Api(tags = "订单管理接口") 16 | @RestController 17 | @RequestMapping("/orders") 18 | @RequiredArgsConstructor 19 | public class OrderController { 20 | private final IOrderService orderService; 21 | 22 | @ApiOperation("根据id查询订单") 23 | @GetMapping("{id}") 24 | public OrderVO queryOrderById(@Param ("订单id")@PathVariable("id") Long orderId) { 25 | return BeanUtils.copyBean(orderService.getById(orderId), OrderVO.class); 26 | } 27 | 28 | @ApiOperation("创建订单") 29 | @PostMapping 30 | public Long createOrder(@RequestBody OrderFormDTO orderFormDTO){ 31 | return orderService.createOrder(orderFormDTO); 32 | } 33 | 34 | @ApiOperation("标记订单已支付") 35 | @ApiImplicitParam(name = "orderId", value = "订单id", paramType = "path") 36 | @PutMapping("/{orderId}") 37 | public void markOrderPaySuccess(@PathVariable("orderId") Long orderId) { 38 | orderService.markOrderPaySuccess(orderId); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/domain/dto/OrderFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.domain.dto; 2 | 3 | import com.hmall.api.dto.OrderDetailDTO; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.util.List; 9 | 10 | @Data 11 | @ApiModel(description = "交易下单表单实体") 12 | public class OrderFormDTO { 13 | @ApiModelProperty("收货地址id") 14 | private Long addressId; 15 | @ApiModelProperty("支付类型") 16 | private Integer paymentType; 17 | @ApiModelProperty("下单商品列表") 18 | private List details; 19 | } 20 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/domain/po/OrderDetail.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.domain.po; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | import java.time.LocalDateTime; 12 | 13 | /** 14 | *

15 | * 订单详情表 16 | *

17 | * 18 | * @author 虎哥 19 | * @since 2023-05-05 20 | */ 21 | @Data 22 | @EqualsAndHashCode(callSuper = false) 23 | @Accessors(chain = true) 24 | @TableName("order_detail") 25 | public class OrderDetail implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | /** 30 | * 订单详情id 31 | */ 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Long id; 34 | 35 | /** 36 | * 订单id 37 | */ 38 | private Long orderId; 39 | 40 | /** 41 | * sku商品id 42 | */ 43 | private Long itemId; 44 | 45 | /** 46 | * 购买数量 47 | */ 48 | private Integer num; 49 | 50 | /** 51 | * 商品标题 52 | */ 53 | private String name; 54 | 55 | /** 56 | * 商品动态属性键值集 57 | */ 58 | private String spec; 59 | 60 | /** 61 | * 价格,单位:分 62 | */ 63 | private Integer price; 64 | 65 | /** 66 | * 商品图片 67 | */ 68 | private String image; 69 | 70 | /** 71 | * 创建时间 72 | */ 73 | private LocalDateTime createTime; 74 | 75 | /** 76 | * 更新时间 77 | */ 78 | private LocalDateTime updateTime; 79 | 80 | 81 | } 82 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/domain/vo/OrderVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.domain.vo; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @ApiModel(description = "订单页面VO") 11 | public class OrderVO { 12 | @ApiModelProperty("订单id") 13 | private Long id; 14 | @ApiModelProperty("总金额,单位为分") 15 | private Integer totalFee; 16 | @ApiModelProperty("支付类型,1、支付宝,2、微信,3、扣减余额") 17 | private Integer paymentType; 18 | @ApiModelProperty("用户id") 19 | private Long userId; 20 | @ApiModelProperty("订单的状态,1、未付款 2、已付款,未发货 3、已发货,未确认 4、确认收货,交易成功 5、交易取消,订单关闭 6、交易结束,已评价") 21 | private Integer status; 22 | @ApiModelProperty("创建时间") 23 | private LocalDateTime createTime; 24 | @ApiModelProperty("支付时间") 25 | private LocalDateTime payTime; 26 | @ApiModelProperty("发货时间") 27 | private LocalDateTime consignTime; 28 | @ApiModelProperty("交易完成时间") 29 | private LocalDateTime endTime; 30 | @ApiModelProperty("交易关闭时间") 31 | private LocalDateTime closeTime; 32 | @ApiModelProperty("评价时间") 33 | private LocalDateTime commentTime; 34 | } 35 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/listener/PayStatusListener.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.listener; 2 | 3 | import com.hmall.trade.service.IOrderService; 4 | import lombok.RequiredArgsConstructor; 5 | import org.springframework.amqp.rabbit.annotation.Exchange; 6 | import org.springframework.amqp.rabbit.annotation.Queue; 7 | import org.springframework.amqp.rabbit.annotation.QueueBinding; 8 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 9 | import org.springframework.stereotype.Component; 10 | 11 | @Component 12 | @RequiredArgsConstructor 13 | public class PayStatusListener { 14 | 15 | private final IOrderService orderService; 16 | 17 | @RabbitListener(bindings = @QueueBinding( 18 | value = @Queue(name = "trade.pay.success.queue", durable = "true"), 19 | exchange = @Exchange(name = "pay.direct"), 20 | key = "pay.success" 21 | )) 22 | public void listenPaySuccess(Long orderId){ 23 | orderService.markOrderPaySuccess(orderId); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/mapper/OrderDetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.trade.domain.po.OrderDetail; 5 | 6 | /** 7 | *

8 | * 订单详情表 Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface OrderDetailMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/mapper/OrderLogisticsMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.trade.domain.po.OrderLogistics; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface OrderLogisticsMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.trade.domain.po.Order; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface OrderMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/service/IOrderDetailService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.trade.domain.po.OrderDetail; 5 | 6 | /** 7 | *

8 | * 订单详情表 服务类 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface IOrderDetailService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/service/IOrderLogisticsService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.trade.domain.po.OrderLogistics; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author 虎哥 12 | * @since 2023-05-05 13 | */ 14 | public interface IOrderLogisticsService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/service/IOrderService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.trade.domain.dto.OrderFormDTO; 5 | import com.hmall.trade.domain.po.Order; 6 | 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface IOrderService extends IService { 17 | 18 | Long createOrder(OrderFormDTO orderFormDTO); 19 | 20 | void markOrderPaySuccess(Long orderId); 21 | 22 | void cancelOrder(Long orderId); 23 | } 24 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/service/impl/OrderDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.hmall.trade.domain.po.OrderDetail; 5 | import com.hmall.trade.mapper.OrderDetailMapper; 6 | import com.hmall.trade.service.IOrderDetailService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 订单详情表 服务实现类 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | @Service 18 | public class OrderDetailServiceImpl extends ServiceImpl implements IOrderDetailService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /trade-service/src/main/java/com/hmall/trade/service/impl/OrderLogisticsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.trade.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.hmall.trade.domain.po.OrderLogistics; 5 | import com.hmall.trade.mapper.OrderLogisticsMapper; 6 | import com.hmall.trade.service.IOrderLogisticsService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | @Service 18 | public class OrderLogisticsServiceImpl extends ServiceImpl implements IOrderLogisticsService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /trade-service/src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" 4 | pw: "***" -------------------------------------------------------------------------------- /trade-service/src/main/resources/application-local.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" # 修改为你自己的虚拟机IP地址 4 | pw: "***" # 修改为docker中的MySQL密码 -------------------------------------------------------------------------------- /trade-service/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8085 3 | hm: 4 | db: 5 | database: hm-trade 6 | swagger: 7 | title: "黑马商场交易服务接口文档" 8 | package: com.hmall.trade.controller 9 | spring: 10 | rabbitmq: 11 | host: "***" # 你的虚拟机IP 12 | port: 5672 # 端口 13 | virtual-host: "***" # 虚拟主机 14 | username: "***" # 用户名 15 | password: "***" # 密码 -------------------------------------------------------------------------------- /trade-service/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: trade-service #微服务名称 4 | profiles: 5 | active: dev 6 | cloud: 7 | nacos: 8 | server-addr: "***" 9 | config: 10 | file-extension: yaml 11 | shared-configs: 12 | - data-id: shared-jdbc.yaml 13 | - data-id: shared-log.yaml 14 | - data-id: shared-swagger.yaml 15 | - data-id: shared-seata.yaml 16 | 17 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/UserApplication.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user; 2 | 3 | 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | 8 | @MapperScan("com.hmall.user.mapper") 9 | @SpringBootApplication 10 | public class UserApplication { 11 | public static void main(String[] args) { 12 | SpringApplication.run(UserApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/config/JwtProperties.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.core.io.Resource; 6 | 7 | import java.time.Duration; 8 | 9 | @Data 10 | @ConfigurationProperties(prefix = "hm.jwt") 11 | public class JwtProperties { 12 | private Resource location; 13 | private String password; 14 | private String alias; 15 | private Duration tokenTTL = Duration.ofMinutes(10); 16 | } 17 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.config; 2 | 3 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 7 | import org.springframework.security.crypto.password.PasswordEncoder; 8 | import org.springframework.security.rsa.crypto.KeyStoreKeyFactory; 9 | 10 | 11 | import java.security.KeyPair; 12 | 13 | @Configuration 14 | @EnableConfigurationProperties(JwtProperties.class) 15 | public class SecurityConfig { 16 | 17 | @Bean 18 | public PasswordEncoder passwordEncoder(){ 19 | return new BCryptPasswordEncoder(); 20 | } 21 | 22 | @Bean 23 | public KeyPair keyPair(JwtProperties properties){ 24 | // 获取秘钥工厂 25 | KeyStoreKeyFactory keyStoreKeyFactory = 26 | new KeyStoreKeyFactory( 27 | properties.getLocation(), 28 | properties.getPassword().toCharArray()); 29 | //读取钥匙对 30 | return keyStoreKeyFactory.getKeyPair( 31 | properties.getAlias(), 32 | properties.getPassword().toCharArray()); 33 | } 34 | } -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.controller; 2 | 3 | 4 | import com.hmall.user.domain.dto.LoginFormDTO; 5 | import com.hmall.user.domain.vo.UserLoginVO; 6 | import com.hmall.user.service.IUserService; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiImplicitParam; 9 | import io.swagger.annotations.ApiImplicitParams; 10 | import io.swagger.annotations.ApiOperation; 11 | import lombok.RequiredArgsConstructor; 12 | import org.springframework.validation.annotation.Validated; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | @Api(tags = "用户相关接口") 16 | @RestController 17 | @RequestMapping("/users") 18 | @RequiredArgsConstructor 19 | public class UserController { 20 | 21 | private final IUserService userService; 22 | 23 | @ApiOperation("用户登录接口") 24 | @PostMapping("login") 25 | public UserLoginVO login(@RequestBody @Validated LoginFormDTO loginFormDTO){ 26 | return userService.login(loginFormDTO); 27 | } 28 | 29 | @ApiOperation("扣减余额") 30 | @ApiImplicitParams({ 31 | @ApiImplicitParam(name = "pw", value = "支付密码"), 32 | @ApiImplicitParam(name = "amount", value = "支付金额") 33 | }) 34 | @PutMapping("/money/deduct") 35 | public void deductMoney(@RequestParam("pw") String pw,@RequestParam("amount") Integer amount){ 36 | userService.deductMoney(pw, amount); 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/domain/dto/AddressDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "收货地址实体") 9 | public class AddressDTO { 10 | @ApiModelProperty("id") 11 | private Long id; 12 | @ApiModelProperty("省") 13 | private String province; 14 | @ApiModelProperty("市") 15 | private String city; 16 | @ApiModelProperty("县/区") 17 | private String town; 18 | @ApiModelProperty("手机") 19 | private String mobile; 20 | @ApiModelProperty("详细地址") 21 | private String street; 22 | @ApiModelProperty("联系人") 23 | private String contact; 24 | @ApiModelProperty("是否是默认 1默认 0否") 25 | private Integer isDefault; 26 | @ApiModelProperty("备注") 27 | private String notes; 28 | } 29 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/domain/dto/LoginFormDTO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.domain.dto; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import javax.validation.constraints.NotNull; 8 | 9 | @Data 10 | @ApiModel(description = "登录表单实体") 11 | public class LoginFormDTO { 12 | @ApiModelProperty(value = "用户名", required = true) 13 | @NotNull(message = "用户名不能为空") 14 | private String username; 15 | @NotNull(message = "密码不能为空") 16 | @ApiModelProperty(value = "用户名", required = true) 17 | private String password; 18 | @ApiModelProperty(value = "是否记住我", required = false) 19 | private Boolean rememberMe = false; 20 | } 21 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/domain/po/Address.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.domain.po; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | *

14 | * 15 | *

16 | * 17 | * @author 虎哥 18 | * @since 2023-05-05 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("address") 24 | public class Address implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | @TableId(value = "id", type = IdType.AUTO) 29 | private Long id; 30 | 31 | /** 32 | * 用户ID 33 | */ 34 | private Long userId; 35 | 36 | /** 37 | * 省 38 | */ 39 | private String province; 40 | 41 | /** 42 | * 市 43 | */ 44 | private String city; 45 | 46 | /** 47 | * 县/区 48 | */ 49 | private String town; 50 | 51 | /** 52 | * 手机 53 | */ 54 | private String mobile; 55 | 56 | /** 57 | * 详细地址 58 | */ 59 | private String street; 60 | 61 | /** 62 | * 联系人 63 | */ 64 | private String contact; 65 | 66 | /** 67 | * 是否是默认 1默认 0否 68 | */ 69 | private Integer isDefault; 70 | 71 | /** 72 | * 备注 73 | */ 74 | private String notes; 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/domain/po/User.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.domain.po; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.hmall.user.enums.UserStatus; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.experimental.Accessors; 10 | 11 | import java.io.Serializable; 12 | import java.time.LocalDateTime; 13 | 14 | /** 15 | *

16 | * 用户表 17 | *

18 | * 19 | * @author 虎哥 20 | * @since 2023-05-05 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = false) 24 | @Accessors(chain = true) 25 | @TableName("user") 26 | public class User implements Serializable { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | @TableId(value = "id", type = IdType.AUTO) 31 | private Long id; 32 | 33 | /** 34 | * 用户名 35 | */ 36 | private String username; 37 | 38 | /** 39 | * 密码,加密存储 40 | */ 41 | private String password; 42 | 43 | /** 44 | * 注册手机号 45 | */ 46 | private String phone; 47 | 48 | /** 49 | * 创建时间 50 | */ 51 | private LocalDateTime createTime; 52 | 53 | private LocalDateTime updateTime; 54 | 55 | /** 56 | * 使用状态(1正常 2冻结) 57 | */ 58 | private UserStatus status; 59 | 60 | /** 61 | * 账户余额 62 | */ 63 | private Integer balance; 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/domain/vo/UserLoginVO.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.domain.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class UserLoginVO { 7 | private String token; 8 | private Long userId; 9 | private String username; 10 | private Integer balance; 11 | } 12 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/enums/UserStatus.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | import com.hmall.common.exception.BadRequestException; 5 | import lombok.Getter; 6 | 7 | @Getter 8 | public enum UserStatus { 9 | FROZEN(0, "禁止使用"), 10 | NORMAL(1, "已激活"), 11 | ; 12 | @EnumValue 13 | int value; 14 | String desc; 15 | 16 | UserStatus(Integer value, String desc) { 17 | this.value = value; 18 | this.desc = desc; 19 | } 20 | 21 | public static UserStatus of(int value) { 22 | if (value == 0) { 23 | return FROZEN; 24 | } 25 | if (value == 1) { 26 | return NORMAL; 27 | } 28 | throw new BadRequestException("账户状态错误"); 29 | } 30 | } -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/mapper/AddressMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.hmall.user.domain.po.Address; 5 | 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author 虎哥 13 | * @since 2023-05-05 14 | */ 15 | public interface AddressMapper extends BaseMapper
{ 16 | 17 | } 18 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | 5 | import com.hmall.user.domain.po.User; 6 | import org.apache.ibatis.annotations.Param; 7 | import org.apache.ibatis.annotations.Update; 8 | 9 | /** 10 | *

11 | * 用户表 Mapper 接口 12 | *

13 | * 14 | * @author 虎哥 15 | * @since 2023-05-05 16 | */ 17 | public interface UserMapper extends BaseMapper { 18 | @Update("update user set balance = balance - ${totalFee} where id = #{userId}") 19 | void updateMoney(@Param("userId") Long userId, @Param("totalFee") Integer totalFee); 20 | } 21 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/service/IAddressService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.user.domain.po.Address; 5 | 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author 虎哥 13 | * @since 2023-05-05 14 | */ 15 | public interface IAddressService extends IService
{ 16 | 17 | } 18 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.hmall.user.domain.dto.LoginFormDTO; 5 | import com.hmall.user.domain.po.User; 6 | import com.hmall.user.domain.vo.UserLoginVO; 7 | 8 | /** 9 | *

10 | * 用户表 服务类 11 | *

12 | * 13 | * @author 虎哥 14 | * @since 2023-05-05 15 | */ 16 | public interface IUserService extends IService { 17 | 18 | UserLoginVO login(LoginFormDTO loginFormDTO); 19 | 20 | void deductMoney(String pw, Integer totalFee); 21 | } 22 | -------------------------------------------------------------------------------- /user-service/src/main/java/com/hmall/user/service/impl/AddressServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.hmall.user.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | 5 | import com.hmall.user.domain.po.Address; 6 | import com.hmall.user.mapper.AddressMapper; 7 | import com.hmall.user.service.IAddressService; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

12 | * 服务实现类 13 | *

14 | * 15 | * @author 虎哥 16 | * @since 2023-05-05 17 | */ 18 | @Service 19 | public class AddressServiceImpl extends ServiceImpl implements IAddressService { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /user-service/src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" 4 | pw: "***" -------------------------------------------------------------------------------- /user-service/src/main/resources/application-local.yaml: -------------------------------------------------------------------------------- 1 | hm: 2 | db: 3 | host: "***" # 修改为你自己的虚拟机IP地址 4 | pw: "***" # 修改为docker中的MySQL密码 -------------------------------------------------------------------------------- /user-service/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8084 3 | spring: 4 | application: 5 | name: user-service 6 | profiles: 7 | active: dev 8 | datasource: 9 | url: jdbc:mysql://${hm.db.host}:3306/"***"?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai 10 | driver-class-name: com.mysql.cj.jdbc.Driver 11 | username: "***" 12 | password: ${hm.db.pw} 13 | cloud: 14 | nacos: 15 | server-addr: "***" # nacos地址 16 | mybatis-plus: 17 | configuration: 18 | default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler 19 | global-config: 20 | db-config: 21 | update-strategy: not_null 22 | id-type: auto 23 | logging: 24 | level: 25 | com.hmall: debug 26 | pattern: 27 | dateformat: HH:mm:ss:SSS 28 | file: 29 | path: "logs/${spring.application.name}" 30 | knife4j: 31 | enable: true 32 | openapi: 33 | title: 黑马商城用户服务接口文档 34 | description: "黑马商城用户服务接口文档" 35 | email: zhanghuyi@itcast.cn 36 | concat: 虎哥 37 | url: https://www.itcast.cn 38 | version: v1.0.0 39 | group: 40 | default: 41 | group-name: default 42 | api-rule: package 43 | api-rule-resources: 44 | - com.hmall.user.controller 45 | hm: 46 | jwt: 47 | location: classpath:hmall.jks 48 | alias: "***" 49 | password: "***" 50 | tokenTTL: 30m 51 | 52 | # keytool -genkeypair -alias hmall -keyalg RSA -keypass hmall123 -keystore hmall.jks -storepass hmall123 -------------------------------------------------------------------------------- /user-service/src/main/resources/hmall.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fangshuiyun/hmall/000e66b3b94ef0761ea6db60d692793cb9d0269c/user-service/src/main/resources/hmall.jks --------------------------------------------------------------------------------