|
|
@@ -50,10 +50,7 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.OutputStream;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -354,8 +351,28 @@ public class OrderController {
|
|
|
@GetMapping("/get")
|
|
|
public Result<SearchResult<OrderDonView>> list(){
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
+ List<Long> userIds = new ArrayList<>();
|
|
|
+ userIds.add(userId);
|
|
|
+ UserBindDetail userBindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
|
|
|
+ .eq(UserBindDetail::getUserId, userId).last("limit 1"));
|
|
|
+ if (userBindDetail == null) {
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ if (StrUtil.isEmpty(user.getOpenId()) && StrUtil.isNotEmpty(user.getLoginPhone())) {
|
|
|
+ userBindDetail = userBindDetailMapper.selectOne(Wrappers.lambdaQuery(UserBindDetail.class)
|
|
|
+ .eq(UserBindDetail::getPhone, user.getLoginPhone()).last("limit 1"));
|
|
|
+ if (userBindDetail != null) {
|
|
|
+ userIds.add(userBindDetail.getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ User otherUser = userMapper.selectOne(Wrappers.lambdaQuery(User.class)
|
|
|
+ .eq(User::getLoginPhone, userBindDetail.getPhone()).last("limit 1"));
|
|
|
+ if (otherUser != null) {
|
|
|
+ userIds.add(otherUser.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
SearchResult<OrderDonView> search = beanSearcher.search(OrderDonView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
- .field(OrderDonView::getUserId,userId)
|
|
|
+ .field(OrderDonView::getUserId, userIds).op(Operator.InList)
|
|
|
.orderBy(OrderDonView::getId).desc()
|
|
|
.build());
|
|
|
search.getDataList().forEach(data->{
|
|
|
@@ -384,13 +401,13 @@ public class OrderController {
|
|
|
* 获取订单详情
|
|
|
*/
|
|
|
@GetMapping("/get/{orderId}")
|
|
|
- public Result<OrderDonView> detail(@PathVariable Long orderId, Boolean isNoLogin) {
|
|
|
+ public Result<OrderDetailView> detail(@PathVariable Long orderId, Boolean isNoLogin) {
|
|
|
Long userId = null;
|
|
|
if (isNoLogin == null || !isNoLogin) {
|
|
|
userId = StpUserUtil.getLoginIdAsLong();
|
|
|
}
|
|
|
|
|
|
- OrderDonView detail = orderDonService.getDetail(orderId, userId);
|
|
|
+ OrderDetailView detail = orderDonService.getDetail(orderId, userId);
|
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(detail);
|
|
|
}
|