将 user-web-app 合并到 shop-web-app 中,简化项目数量

This commit is contained in:
YunaiV 2020-11-29 21:24:10 +08:00
parent 9345166422
commit 0285bf50fb
25 changed files with 55 additions and 257 deletions

View File

@ -17,7 +17,6 @@
<module>common</module>
<module>mall-dependencies</module>
<module>user-service-project</module>
<module>user-web-app</module>
<module>system-service-project</module>
<module>pay-service-project</module>
<module>management-web-app</module>

View File

@ -1,17 +1,17 @@
### /passport/login-by-sms 成功
POST {{user-api-base-url}}/passport/login-by-sms
POST {{shop-api-base-url}}/passport/login-by-sms
Content-Type: application/x-www-form-urlencoded
mobile=15601691300&code=9999
### /passport/send-sms-code 成功
POST {{user-api-base-url}}/passport/send-sms-code
POST {{shop-api-base-url}}/passport/send-sms-code
Content-Type: application/x-www-form-urlencoded
mobile=15601691300&scene=1
### /passport/refresh-token
POST {{user-api-base-url}}/passport/refresh-token
POST {{shop-api-base-url}}/passport/refresh-token
Content-Type: application/x-www-form-urlencoded
refreshToken=77abd74e84e34cfc8aba9625317a14a3

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.userweb.controller.passport;
package cn.iocoder.mall.shopweb.controller.user;
import cn.iocoder.common.framework.util.HttpUtil;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.userweb.controller.passport.vo.PassportLoginBySmsReqVO;
import cn.iocoder.mall.userweb.controller.passport.vo.UserPassportSendSmsRespVO;
import cn.iocoder.mall.userweb.controller.passport.vo.PassportAccessTokenRespVO;
import cn.iocoder.mall.userweb.manager.passport.PassportManager;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportAccessTokenRespVO;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportLoginBySmsReqVO;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportSendSmsRespVO;
import cn.iocoder.mall.shopweb.service.user.PassportManager;
import cn.iocoder.security.annotations.RequiresNone;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -38,7 +38,7 @@ public class PassportController {
@PostMapping("/send-sms-code")
@ApiOperation("发送手机验证码")
@RequiresNone
public CommonResult<Boolean> sendSmsCode(UserPassportSendSmsRespVO sendSmsCodeDTO,
public CommonResult<Boolean> sendSmsCode(PassportSendSmsRespVO sendSmsCodeDTO,
HttpServletRequest request) {
passportManager.sendSmsCode(sendSmsCodeDTO, HttpUtil.getIp(request));
// 返回成功

View File

@ -1,5 +1,5 @@
### /user-address/get-default 成功
GET {{user-api-base-url}}/user-address/get-default
GET {{shop-api-base-url}}/user-address/get-default
Authorization: Bearer {{user-access-token}}
###

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.userweb.controller.address;
package cn.iocoder.mall.shopweb.controller.user;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressCreateReqVO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressRespVO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressUpdateReqVO;
import cn.iocoder.mall.userweb.manager.address.UserAddressManager;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressCreateReqVO;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressRespVO;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressUpdateReqVO;
import cn.iocoder.mall.shopweb.service.user.UserAddressManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -1,9 +1,9 @@
package cn.iocoder.mall.userweb.controller.user;
package cn.iocoder.mall.shopweb.controller.user;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder;
import cn.iocoder.mall.userweb.controller.user.vo.UserRespVO;
import cn.iocoder.mall.userweb.manager.user.UserManager;
import cn.iocoder.mall.shopweb.controller.user.vo.user.UserRespVO;
import cn.iocoder.mall.shopweb.service.user.UserManager;
import cn.iocoder.security.annotations.RequiresAuthenticate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.userweb.controller.address.vo;
package cn.iocoder.mall.shopweb.controller.user.vo.address;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.userservice.enums.address.UserAddressType;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.userweb.controller.address.vo;
package cn.iocoder.mall.shopweb.controller.user.vo.address;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.userweb.controller.address.vo;
package cn.iocoder.mall.shopweb.controller.user.vo.address;
import cn.iocoder.common.framework.validator.InEnum;
import cn.iocoder.mall.userservice.enums.address.UserAddressType;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.userweb.controller.passport.vo;
package cn.iocoder.mall.shopweb.controller.user.vo.passport;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.userweb.controller.passport.vo;
package cn.iocoder.mall.shopweb.controller.user.vo.passport;
import cn.iocoder.common.framework.validator.Mobile;
import io.swagger.annotations.ApiModel;

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.userweb.controller.passport.vo;
package cn.iocoder.mall.shopweb.controller.user.vo.passport;
import cn.iocoder.common.framework.validator.Mobile;
import io.swagger.annotations.ApiModel;
@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull;
@ApiModel("发送手机验证码 Response VO")
@Data
@Accessors(chain = true)
public class UserPassportSendSmsRespVO {
public class PassportSendSmsRespVO {
@ApiModelProperty(value = "手机号", example = "15601691234")
@Mobile

View File

@ -1,4 +1,4 @@
package cn.iocoder.mall.userweb.controller.user.vo;
package cn.iocoder.mall.shopweb.controller.user.vo.user;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,12 +1,12 @@
package cn.iocoder.mall.userweb.convert.passport;
package cn.iocoder.mall.shopweb.convert.user;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportAccessTokenRespVO;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportLoginBySmsReqVO;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportSendSmsRespVO;
import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO;
import cn.iocoder.mall.userservice.rpc.sms.dto.UserSendSmsCodeReqDTO;
import cn.iocoder.mall.userservice.rpc.sms.dto.UserVerifySmsCodeReqDTO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserCreateReqDTO;
import cn.iocoder.mall.userweb.controller.passport.vo.PassportLoginBySmsReqVO;
import cn.iocoder.mall.userweb.controller.passport.vo.UserPassportSendSmsRespVO;
import cn.iocoder.mall.userweb.controller.passport.vo.PassportAccessTokenRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@ -18,7 +18,7 @@ public interface PassportConvert {
UserVerifySmsCodeReqDTO convert(PassportLoginBySmsReqVO bean);
UserCreateReqDTO convert02(PassportLoginBySmsReqVO bean);
UserSendSmsCodeReqDTO convert(UserPassportSendSmsRespVO bean);
UserSendSmsCodeReqDTO convert(PassportSendSmsRespVO bean);
PassportAccessTokenRespVO convert(OAuth2AccessTokenRespDTO bean);

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.userweb.convert.address;
package cn.iocoder.mall.shopweb.convert.user;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressCreateReqVO;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressRespVO;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressUpdateReqVO;
import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressCreateReqDTO;
import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressRespDTO;
import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressUpdateReqDTO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressCreateReqVO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressRespVO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressUpdateReqVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@ -1,7 +1,7 @@
package cn.iocoder.mall.userweb.convert.user;
package cn.iocoder.mall.shopweb.convert.user;
import cn.iocoder.mall.shopweb.controller.user.vo.user.UserRespVO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO;
import cn.iocoder.mall.userweb.controller.user.vo.UserRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@ -1,7 +1,11 @@
package cn.iocoder.mall.userweb.manager.passport;
package cn.iocoder.mall.shopweb.service.user;
import cn.iocoder.common.framework.enums.UserTypeEnum;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportAccessTokenRespVO;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportLoginBySmsReqVO;
import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportSendSmsRespVO;
import cn.iocoder.mall.shopweb.convert.user.PassportConvert;
import cn.iocoder.mall.systemservice.rpc.oauth.OAuth2Rpc;
import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO;
import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO;
@ -10,10 +14,6 @@ import cn.iocoder.mall.userservice.enums.sms.UserSmsSceneEnum;
import cn.iocoder.mall.userservice.rpc.sms.UserSmsCodeRpc;
import cn.iocoder.mall.userservice.rpc.user.UserRpc;
import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO;
import cn.iocoder.mall.userweb.controller.passport.vo.PassportAccessTokenRespVO;
import cn.iocoder.mall.userweb.controller.passport.vo.PassportLoginBySmsReqVO;
import cn.iocoder.mall.userweb.controller.passport.vo.UserPassportSendSmsRespVO;
import cn.iocoder.mall.userweb.convert.passport.PassportConvert;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
@ -45,7 +45,7 @@ public class PassportManager {
return PassportConvert.INSTANCE.convert(createAccessTokenResult.getData());
}
public void sendSmsCode(UserPassportSendSmsRespVO sendSmsCodeDTO, String ip) {
public void sendSmsCode(PassportSendSmsRespVO sendSmsCodeDTO, String ip) {
CommonResult<Boolean> sendSmsCodeResult = userSmsCodeRpc.sendSmsCode(
PassportConvert.INSTANCE.convert(sendSmsCodeDTO).setIp(ip));
sendSmsCodeResult.checkError();

View File

@ -1,15 +1,15 @@
package cn.iocoder.mall.userweb.manager.address;
package cn.iocoder.mall.shopweb.service.user;
import cn.iocoder.common.framework.exception.GlobalException;
import cn.iocoder.common.framework.util.CollectionUtils;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressCreateReqVO;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressRespVO;
import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressUpdateReqVO;
import cn.iocoder.mall.shopweb.convert.user.UserAddressConvert;
import cn.iocoder.mall.userservice.enums.address.UserAddressType;
import cn.iocoder.mall.userservice.rpc.address.UserAddressRpc;
import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressRespDTO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressCreateReqVO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressRespVO;
import cn.iocoder.mall.userweb.controller.address.vo.UserAddressUpdateReqVO;
import cn.iocoder.mall.userweb.convert.address.UserAddressConvert;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

View File

@ -1,11 +1,11 @@
package cn.iocoder.mall.userweb.manager.user;
package cn.iocoder.mall.shopweb.service.user;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.shopweb.controller.user.vo.user.UserRespVO;
import cn.iocoder.mall.shopweb.convert.user.UserConvert;
import cn.iocoder.mall.userservice.rpc.user.UserRpc;
import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO;
import cn.iocoder.mall.userweb.controller.user.vo.UserRespVO;
import cn.iocoder.mall.userweb.convert.user.UserConvert;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

View File

@ -57,6 +57,10 @@ dubbo:
version: 1.0.0
PayTransactionRpc:
version: 1.0.0
UserSmsCodeRpc:
version: 1.0.0
UserAddressRpc:
version: 1.0.0
# Swagger 配置项
swagger:

View File

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>onemall</artifactId>
<groupId>cn.iocoder.mall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>user-web-app</artifactId>
<dependencyManagement>
<dependencies>
<!-- onemall 基础 bom 文件 -->
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-dependencies</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot-starter-security-user</artifactId>
</dependency>
<!-- RPC 相关 -->
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot-starter-dubbo</artifactId>
</dependency>
<dependency>
<!-- 用户服务 -->
<groupId>cn.iocoder.mall</groupId>
<artifactId>user-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<!-- 商品服务 -->
<groupId>cn.iocoder.mall</groupId>
<artifactId>product-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<!-- 系统服务 -->
<groupId>cn.iocoder.mall</groupId>
<artifactId>system-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- Registry 和 Config 相关 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
</dependency>
</dependencies>
<build>
<!-- 设置构建的 jar 包名 -->
<finalName>${project.artifactId}</finalName>
<!-- 使用 spring-boot-maven-plugin 插件打包 -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,13 +0,0 @@
package cn.iocoder.mall.userweb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class UserWebApplication {
public static void main(String[] args) {
SpringApplication.run(UserWebApplication.class, args);
}
}

View File

@ -1,15 +0,0 @@
spring:
# Spring Cloud 配置项
cloud:
nacos:
# Spring Cloud Nacos Discovery 配置项
discovery:
server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
namespace: dev # Nacos 命名空间
# Dubbo 配置项
dubbo:
# Dubbo 注册中心
registry:
# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址

View File

@ -1,15 +0,0 @@
spring:
# Spring Cloud 配置项
cloud:
nacos:
# Spring Cloud Nacos Discovery 配置项
discovery:
server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
namespace: dev # Nacos 命名空间
# Dubbo 配置项
dubbo:
# Dubbo 注册中心
registry:
# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址

View File

@ -1,52 +0,0 @@
# 服务器的配置项
server:
port: 18082
servlet:
context-path: /user-api/
spring:
# Application 的配置项
application:
name: user-web
# Profile 的配置项
profiles:
active: local
# SpringMVC 配置项
mvc:
throw-exception-if-no-handler-found: true # 匹配不到路径时,抛出 NoHandlerFoundException 异常
static-path-pattern: /doc.html # 静态资源的路径
# Dubbo 配置项
dubbo:
# Spring Cloud Alibaba Dubbo 专属配置
cloud:
subscribed-services: 'user-service,system-service' # 设置订阅的应用列表,默认为 * 订阅所有应用
# Dubbo 服务消费者的配置
consumer:
timeout: 10000
validation: true # 开启 Consumer 的参数校验
check: false # 本地启动,不进行校验,不一定会使用到未启动的服务,嘿嘿~
UserSmsCodeRpc:
version: 1.0.0
UserRpc:
version: 1.0.0
OAuth2Rpc:
version: 1.0.0
SystemAccessLogRpc:
version: 1.0.0
SystemExceptionLogRpc:
version: 1.0.0
UserAddressRpc:
version: 1.0.0
# Swagger 配置项
swagger:
title: 用户中心
description: 提供用户注册、登陆、信息等等 API
version: 1.0.0
base-package: cn.iocoder.mall.userweb.controller
# Actuator 监控配置项
management:
server.port: 38086 # 独立端口,避免被暴露出去
endpoints.web.exposure.include: '*' # 暴露所有监控端点