diff --git a/mall-oms/oms-api/pom.xml b/mall-oms/oms-api/pom.xml
index c36313ae6..e8cc7ed43 100644
--- a/mall-oms/oms-api/pom.xml
+++ b/mall-oms/oms-api/pom.xml
@@ -24,6 +24,11 @@
io.github.openfeign
feign-okhttp
+
+ com.youlai
+ ums-api
+ ${youlai.version}
+
diff --git a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/bo/OrderBO.java b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/bo/OrderBO.java
index 0bbe32bc8..a4ab3526b 100644
--- a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/bo/OrderBO.java
+++ b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/bo/OrderBO.java
@@ -3,15 +3,20 @@ package com.youlai.mall.oms.bo;
import com.youlai.mall.oms.pojo.OmsOrder;
import com.youlai.mall.oms.pojo.OmsOrderItem;
+import com.youlai.mall.ums.dto.MemberInfoDTO;
import lombok.Data;
+import lombok.experimental.Accessors;
import java.util.List;
@Data
+@Accessors(chain = true)
public class OrderBO {
private OmsOrder order;
private List orderItems;
+ private MemberInfoDTO member;
+
}
diff --git a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrder.java b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrder.java
index 402ddc607..a1f418f32 100644
--- a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrder.java
+++ b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrder.java
@@ -31,28 +31,38 @@ public class OmsOrder extends BaseEntity {
private Long couponId;
+ private Long orderPrice;
+
private Long skuPrice;
private Long freightPrice;
private Long couponPrice;
- private Long orderPrice;
-
private Long integrationPrice;
- private Long payPrice;
-
private String payId;
+ private Long payPrice;
+
private Integer payChannel;
- private Date payTime;
+ private Date gmtPay;
private String logisticsChannel;
private String logisticsNo;
- private Date deliveryTime;
+ private Date gmtDelivery;
+
+ private Long refundAmount;
+
+ private Integer refundType;
+
+ private String refundNote;
+
+ private Date gmtRefund;
+
+ private Date gmtConfirm;
}
diff --git a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrderItem.java b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrderItem.java
index 36fdf4781..9e6570ba8 100644
--- a/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrderItem.java
+++ b/mall-oms/oms-api/src/main/java/com/youlai/mall/oms/pojo/OmsOrderItem.java
@@ -17,8 +17,6 @@ public class OmsOrderItem extends BaseEntity {
private Long orderId;
- private String orderSn;
-
private Long spuId;
private String spuName;
@@ -33,6 +31,6 @@ public class OmsOrderItem extends BaseEntity {
private Integer skuQuantity;
- private String pic;
+ private String skuPic;
}
diff --git a/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/api/MemberFeignService.java b/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/api/MemberFeignService.java
new file mode 100644
index 000000000..6c90e2607
--- /dev/null
+++ b/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/api/MemberFeignService.java
@@ -0,0 +1,27 @@
+package com.youlai.mall.ums.api;
+
+import com.youlai.common.core.result.Result;
+import com.youlai.mall.ums.dto.MemberInfoDTO;
+import com.youlai.mall.ums.pojo.UmsMember;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+@FeignClient("mall-ums")
+public interface MemberFeignService {
+
+ @PostMapping("/members")
+ Result add(@RequestBody UmsMember member);
+
+
+ /**
+ * 获取会员
+ * @param id
+ * @param queryMode 查询模式:1-认证会员 2-订单会员
+ * @return
+ */
+ @GetMapping("/members/{id}")
+ Result getMember(@PathVariable Object id, @RequestParam(value = "queryMode") Integer queryMode);
+
+}
+
+
diff --git a/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/api/UmsMemberFeignClient.java b/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/api/UmsMemberFeignClient.java
deleted file mode 100644
index 69e3dae79..000000000
--- a/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/api/UmsMemberFeignClient.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.youlai.mall.ums.api;
-
-import com.youlai.common.core.result.Result;
-import com.youlai.mall.ums.dto.MemberDTO;
-import com.youlai.mall.ums.pojo.UmsMember;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-
-@FeignClient("youlai-mall-ums")
-public interface UmsMemberFeignClient {
-
- @GetMapping("/members/member/{openid}")
- Result loadMemberByOpenid(@PathVariable String openid);
-
- @PostMapping("/members")
- Result add(@RequestBody UmsMember member);
-
-}
-
-
diff --git a/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/dto/MemberInfoDTO.java b/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/dto/MemberInfoDTO.java
new file mode 100644
index 000000000..504aabae5
--- /dev/null
+++ b/mall-ums/ums-api/src/main/java/com/youlai/mall/ums/dto/MemberInfoDTO.java
@@ -0,0 +1,13 @@
+package com.youlai.mall.ums.dto;
+
+import lombok.Data;
+
+@Data
+public class MemberInfoDTO {
+
+ private Long id;
+
+ private String nickname;
+
+ private String mobile;
+}
diff --git a/youlai-admin/admin-api/src/main/java/com/youlai/admin/api/AdminUserFeignClient.java b/youlai-admin/admin-api/src/main/java/com/youlai/admin/api/UserFeignService.java
similarity index 91%
rename from youlai-admin/admin-api/src/main/java/com/youlai/admin/api/AdminUserFeignClient.java
rename to youlai-admin/admin-api/src/main/java/com/youlai/admin/api/UserFeignService.java
index b6d1b285b..0562da0ed 100644
--- a/youlai-admin/admin-api/src/main/java/com/youlai/admin/api/AdminUserFeignClient.java
+++ b/youlai-admin/admin-api/src/main/java/com/youlai/admin/api/UserFeignService.java
@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@FeignClient("youlai-admin")
-public interface AdminUserFeignClient {
+public interface UserFeignService {
@GetMapping("/users/user/{username}")
Result loadUserByUsername(@PathVariable String username);
diff --git a/youlai-auth/src/main/java/com/youlai/auth/config/AuthorizationServerConfig.java b/youlai-auth/src/main/java/com/youlai/auth/config/AuthorizationServerConfig.java
index e128aa07f..6ce8cf454 100644
--- a/youlai-auth/src/main/java/com/youlai/auth/config/AuthorizationServerConfig.java
+++ b/youlai-auth/src/main/java/com/youlai/auth/config/AuthorizationServerConfig.java
@@ -109,7 +109,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE);
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Cache-Control", "no-cache");
- Result result = Result.custom(ResultCode.CLIENT_AUTHENTICATION_FAILED);
+ Result result = Result.failed(ResultCode.CLIENT_AUTHENTICATION_FAILED);
response.getWriter().print(JSONUtil.toJsonStr(result));
response.getWriter().flush();
};
diff --git a/youlai-auth/src/main/java/com/youlai/auth/controller/AuthController.java b/youlai-auth/src/main/java/com/youlai/auth/controller/AuthController.java
index d85c5dd3a..84df0b5a5 100644
--- a/youlai-auth/src/main/java/com/youlai/auth/controller/AuthController.java
+++ b/youlai-auth/src/main/java/com/youlai/auth/controller/AuthController.java
@@ -16,7 +16,7 @@ import com.youlai.common.core.result.ResultCode;
import com.youlai.common.web.exception.BizException;
import com.youlai.mall.ums.dto.MemberDTO;
import com.youlai.mall.ums.pojo.UmsMember;
-import com.youlai.mall.ums.api.UmsMemberFeignClient;
+import com.youlai.mall.ums.api.MemberFeignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -50,7 +50,7 @@ public class AuthController {
private TokenEndpoint tokenEndpoint;
private RedisTemplate redisTemplate;
private WxMaService wxService;
- private UmsMemberFeignClient umsMemberFeignClient;
+ private MemberFeignService memberFeignService;
private PasswordEncoder passwordEncoder;
private KeyPair keyPair;
@@ -122,13 +122,10 @@ public class AuthController {
String openid = session.getOpenid();
String sessionKey = session.getSessionKey();
- Result result = umsMemberFeignClient.loadMemberByOpenid(openid);
- if (!ResultCode.SUCCESS.getCode().equals(result.getCode())) {
- throw new BizException("获取会员信息失败");
- }
- MemberDTO memberDTO = result.getData();
+ Result result = memberFeignService.getMember(openid, 1);
+
String username;
- if (memberDTO == null) { // 微信授权登录 会员信息不存在时 注册会员
+ if (ResultCode.USER_NOT_EXIST.getCode().equals(result.getCode())) { // 微信授权登录 会员信息不存在时 注册会员
String encryptedData = parameters.get("encryptedData");
String iv = parameters.get("iv");
@@ -145,12 +142,13 @@ public class AuthController {
.setPassword(passwordEncoder.encode(openid).replace(AuthConstants.BCRYPT, Strings.EMPTY)) // 加密密码移除前缀加密方式 {bcrypt}
.setStatus(Constants.STATUS_NORMAL_VALUE);
- Result res = umsMemberFeignClient.add(member);
+ Result res = memberFeignService.add(member);
if (!ResultCode.SUCCESS.getCode().equals(res.getCode())) {
throw new BizException("注册会员失败");
}
username = openid;
} else {
+ MemberDTO memberDTO = result.getData();
username = memberDTO.getUsername();
}
diff --git a/youlai-auth/src/main/java/com/youlai/auth/exception/AuthExceptionHandler.java b/youlai-auth/src/main/java/com/youlai/auth/exception/AuthExceptionHandler.java
index abbd9bdd0..f6955e6f0 100644
--- a/youlai-auth/src/main/java/com/youlai/auth/exception/AuthExceptionHandler.java
+++ b/youlai-auth/src/main/java/com/youlai/auth/exception/AuthExceptionHandler.java
@@ -20,7 +20,7 @@ public class AuthExceptionHandler {
*/
@ExceptionHandler(InvalidGrantException.class)
public Result handleInvalidGrantException(InvalidGrantException e) {
- return Result.custom(ResultCode.USERNAME_OR_PASSWORD_ERROR);
+ return Result.failed(ResultCode.USERNAME_OR_PASSWORD_ERROR);
}
@@ -32,7 +32,7 @@ public class AuthExceptionHandler {
*/
@ExceptionHandler({InternalAuthenticationServiceException.class})
public Result handleInternalAuthenticationServiceException(InternalAuthenticationServiceException e) {
- return Result.error(e.getMessage());
+ return Result.failed(e.getMessage());
}
}
diff --git a/youlai-auth/src/main/java/com/youlai/auth/service/UserDetailsServiceImpl.java b/youlai-auth/src/main/java/com/youlai/auth/service/UserDetailsServiceImpl.java
index 7512e916c..8b54d1fb2 100644
--- a/youlai-auth/src/main/java/com/youlai/auth/service/UserDetailsServiceImpl.java
+++ b/youlai-auth/src/main/java/com/youlai/auth/service/UserDetailsServiceImpl.java
@@ -1,16 +1,15 @@
package com.youlai.auth.service;
import com.youlai.admin.dto.UserDTO;
-import com.youlai.admin.api.AdminUserFeignClient;
+import com.youlai.admin.api.UserFeignService;
import com.youlai.auth.domain.User;
import com.youlai.common.core.constant.AuthConstants;
import com.youlai.common.core.result.Result;
import com.youlai.common.core.result.ResultCode;
import com.youlai.mall.ums.dto.MemberDTO;
-import com.youlai.mall.ums.api.UmsMemberFeignClient;
+import com.youlai.mall.ums.api.MemberFeignService;
import lombok.AllArgsConstructor;
import org.springframework.security.authentication.AccountExpiredException;
-import org.springframework.security.authentication.CredentialsExpiredException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.LockedException;
import org.springframework.security.core.userdetails.UserDetails;
@@ -28,8 +27,8 @@ import javax.servlet.http.HttpServletRequest;
@AllArgsConstructor
public class UserDetailsServiceImpl implements UserDetailsService {
- private AdminUserFeignClient adminUserFeignClient;
- private UmsMemberFeignClient umsMemberFeignClient;
+ private UserFeignService userFeignService;
+ private MemberFeignService memberFeignService;
private HttpServletRequest request;
@Override
@@ -38,7 +37,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
User user = null;
switch (clientId) {
case AuthConstants.ADMIN_CLIENT_ID: // 后台用户
- Result userResult = adminUserFeignClient.loadUserByUsername(username);
+ Result userResult = userFeignService.loadUserByUsername(username);
if (userResult == null || !ResultCode.SUCCESS.getCode().equals(userResult.getCode())
|| userResult.getData() == null
) {
@@ -49,7 +48,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
user = new User(userDTO);
break;
case AuthConstants.WEAPP_CLIENT_ID: // 小程序会员
- Result memberResult = umsMemberFeignClient.loadMemberByOpenid(username);
+ Result memberResult = memberFeignService.getMember(username,2);
if (memberResult == null || !ResultCode.SUCCESS.getCode().equals(memberResult.getCode())
||memberResult.getData()==null) {
throw new UsernameNotFoundException("会员不存在");
diff --git a/youlai-common/common-core/src/main/java/com/youlai/common/core/result/Result.java b/youlai-common/common-core/src/main/java/com/youlai/common/core/result/Result.java
index c21b9caea..d74acf0f0 100644
--- a/youlai-common/common-core/src/main/java/com/youlai/common/core/result/Result.java
+++ b/youlai-common/common-core/src/main/java/com/youlai/common/core/result/Result.java
@@ -34,11 +34,11 @@ public class Result implements Serializable {
}
- public static Result error() {
+ public static Result failed() {
return result(ResultCode.SYSTEM_EXECUTION_ERROR.getCode(), ResultCode.SYSTEM_EXECUTION_ERROR.getMsg(), null);
}
- public static Result error(String msg) {
+ public static Result failed(String msg) {
return result(ResultCode.SYSTEM_EXECUTION_ERROR.getCode(), msg, null);
}
@@ -46,11 +46,11 @@ public class Result implements Serializable {
if (status) {
return success();
} else {
- return error();
+ return failed();
}
}
- public static Result custom(IResultCode resultCode) {
+ public static Result failed(IResultCode resultCode) {
return result(resultCode.getCode(), resultCode.getMsg(), null);
}
diff --git a/youlai-common/common-core/src/main/java/com/youlai/common/core/result/ResultCode.java b/youlai-common/common-core/src/main/java/com/youlai/common/core/result/ResultCode.java
index e42af4787..bda12bcf2 100644
--- a/youlai-common/common-core/src/main/java/com/youlai/common/core/result/ResultCode.java
+++ b/youlai-common/common-core/src/main/java/com/youlai/common/core/result/ResultCode.java
@@ -18,7 +18,7 @@ public enum ResultCode implements IResultCode, Serializable {
USER_ERROR("A0001","用户端错误"),
USER_LOGIN_ERROR("A0200","用户登录异常"),
- USER_ACCOUNT_NOT_EXIST("A0201","用户账户不存在"),
+ USER_NOT_EXIST("A0201","用户不存在"),
USER_ACCOUNT_LOCKED("A0202","用户账户被冻结"),
USER_ACCOUNT_INVALID("A0203","用户账户已作废"),
diff --git a/youlai-common/common-web/src/main/java/com/youlai/common/web/exception/GlobalExceptionHandler.java b/youlai-common/common-web/src/main/java/com/youlai/common/web/exception/GlobalExceptionHandler.java
index 4f05e6694..c1c8c1874 100644
--- a/youlai-common/common-web/src/main/java/com/youlai/common/web/exception/GlobalExceptionHandler.java
+++ b/youlai-common/common-web/src/main/java/com/youlai/common/web/exception/GlobalExceptionHandler.java
@@ -18,21 +18,21 @@ public class GlobalExceptionHandler {
@ExceptionHandler(IllegalArgumentException.class)
public Result handleIllegalArgumentException(IllegalArgumentException e) {
- return Result.error(e.getMessage());
+ return Result.failed(e.getMessage());
}
@ExceptionHandler(JsonProcessingException.class)
public Result handleJsonProcessingException(JsonProcessingException e) {
- return Result.error(e.getMessage());
+ return Result.failed(e.getMessage());
}
@ExceptionHandler(BizException.class)
public Result handleBizException(BizException e) {
if (e.getResultCode() != null) {
- return Result.custom(e.getResultCode());
+ return Result.failed(e.getResultCode());
}
- return Result.error(e.getMessage());
+ return Result.failed(e.getMessage());
}
}
diff --git a/youlai-gateway/src/main/java/com/youlai/gateway/config/ResourceServerConfig.java b/youlai-gateway/src/main/java/com/youlai/gateway/config/ResourceServerConfig.java
index d5dae739e..1dd17f12b 100644
--- a/youlai-gateway/src/main/java/com/youlai/gateway/config/ResourceServerConfig.java
+++ b/youlai-gateway/src/main/java/com/youlai/gateway/config/ResourceServerConfig.java
@@ -74,7 +74,7 @@ public class ResourceServerConfig {
response.getHeaders().set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
response.getHeaders().set("Access-Control-Allow-Origin", "*");
response.getHeaders().set("Cache-Control", "no-cache");
- String body = JSONUtil.toJsonStr(Result.custom(ResultCode.USER_ACCESS_UNAUTHORIZED));
+ String body = JSONUtil.toJsonStr(Result.failed(ResultCode.USER_ACCESS_UNAUTHORIZED));
DataBuffer buffer = response.bufferFactory().wrap(body.getBytes(Charset.forName("UTF-8")));
return response.writeWith(Mono.just(buffer))
.doOnError(error -> DataBufferUtils.release(buffer));
@@ -96,7 +96,7 @@ public class ResourceServerConfig {
response.getHeaders().set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
response.getHeaders().set("Access-Control-Allow-Origin", "*");
response.getHeaders().set("Cache-Control", "no-cache");
- String body = JSONUtil.toJsonStr(Result.custom(ResultCode.TOKEN_INVALID_OR_EXPIRED));
+ String body = JSONUtil.toJsonStr(Result.failed(ResultCode.TOKEN_INVALID_OR_EXPIRED));
DataBuffer buffer = response.bufferFactory().wrap(body.getBytes(Charset.forName("UTF-8")));
return response.writeWith(Mono.just(buffer))
.doOnError(error -> DataBufferUtils.release(buffer));
diff --git a/youlai-gateway/src/main/java/com/youlai/gateway/filter/AuthGlobalFilter.java b/youlai-gateway/src/main/java/com/youlai/gateway/filter/AuthGlobalFilter.java
index 6ee9caf72..80fbec56f 100644
--- a/youlai-gateway/src/main/java/com/youlai/gateway/filter/AuthGlobalFilter.java
+++ b/youlai-gateway/src/main/java/com/youlai/gateway/filter/AuthGlobalFilter.java
@@ -59,7 +59,7 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
response.getHeaders().set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
response.getHeaders().set("Access-Control-Allow-Origin", "*");
response.getHeaders().set("Cache-Control", "no-cache");
- String body = JSONUtil.toJsonStr(Result.custom(ResultCode.TOKEN_INVALID_OR_EXPIRED));
+ String body = JSONUtil.toJsonStr(Result.failed(ResultCode.TOKEN_INVALID_OR_EXPIRED));
DataBuffer buffer = response.bufferFactory().wrap(body.getBytes(Charset.forName("UTF-8")));
return response.writeWith(Mono.just(buffer));
}