所有get请求参数修改及其新增用户中心订单小标统计
This commit is contained in:
1 parent
050d9d57dd
commit
f85aeb1b9e
6 files changed
+69
-14
No files matched your search
+15
-2
@@ -23,6 +23,9 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
//import wiki.xsx.core.handler.StringHandler;
|
//import wiki.xsx.core.handler.StringHandler;
|
||||||
//import wiki.xsx.core.util.RedisUtil;
|
//import wiki.xsx.core.util.RedisUtil;
|
||||||
|
|
||||||
@@ -53,13 +56,19 @@ public class UserController {
|
|||||||
User user = userOperator.getUser();
|
User user = userOperator.getUser();
|
||||||
StoreMember member = memberService.getById(user.getId());
|
StoreMember member = memberService.getById(user.getId());
|
||||||
MemberDTO memberDTO = memberMapper.toDto(member);
|
MemberDTO memberDTO = memberMapper.toDto(member);
|
||||||
|
Map<String,Integer> mapCount = orderService.countInfo(user.getId());
|
||||||
|
memberDTO.setCountInfo(mapCount);
|
||||||
return R.success(memberDTO);
|
return R.success(memberDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/shop/user-my-address")
|
@GetMapping(value = "/shop/user-my-address")
|
||||||
@ApiOperation(value = "我的地址列表",notes = "我的地址列表")
|
@ApiOperation(value = "我的地址列表",notes = "我的地址列表")
|
||||||
public R addressList(@Validated @RequestBody PageVO pageVO){
|
public R addressList(@RequestParam(value = "page",defaultValue = "0") int page,
|
||||||
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
int userId = userOperator.getUser().getId();
|
int userId = userOperator.getUser().getId();
|
||||||
|
PageVO pageVO = new PageVO();
|
||||||
|
pageVO.setPage(page);
|
||||||
|
pageVO.setLimit(limit);
|
||||||
return R.success(addressService.getList(pageVO,userId));
|
return R.success(addressService.getList(pageVO,userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,8 +106,12 @@ public class UserController {
|
|||||||
|
|
||||||
@GetMapping(value = "/shop/user-my-collects")
|
@GetMapping(value = "/shop/user-my-collects")
|
||||||
@ApiOperation(value = "我的收藏列表",notes = "我的收藏列表")
|
@ApiOperation(value = "我的收藏列表",notes = "我的收藏列表")
|
||||||
public R myCollect(@Validated @RequestBody PageVO pageVO){
|
public R myCollect(@RequestParam(value = "page",defaultValue = "0") int page,
|
||||||
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
int userId = userOperator.getUser().getId();
|
int userId = userOperator.getUser().getId();
|
||||||
|
PageVO pageVO = new PageVO();
|
||||||
|
pageVO.setPage(page);
|
||||||
|
pageVO.setLimit(limit);
|
||||||
return R.success(goodsMapper.toDto(goodsService
|
return R.success(goodsMapper.toDto(goodsService
|
||||||
.collectGoods(pageVO.getPage(),pageVO.getLimit(),userId)));
|
.collectGoods(pageVO.getPage(),pageVO.getLimit(),userId)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -74,6 +75,8 @@ public class MemberDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
private Map<String,Integer> countInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,9 +64,10 @@ public class IndexController {
|
|||||||
|
|
||||||
@GetMapping("/shop/news-lists")
|
@GetMapping("/shop/news-lists")
|
||||||
@ApiOperation(value = "新闻列表",notes = "新闻列表")
|
@ApiOperation(value = "新闻列表",notes = "新闻列表")
|
||||||
public R news(@Validated @RequestBody PageVO pageVO){
|
public R news(@RequestParam(value = "page",defaultValue = "0") int page,
|
||||||
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
|
|
||||||
List<NewsDTO> newsList = newsService.getList(pageVO.getPage(),pageVO.getLimit());
|
List<NewsDTO> newsList = newsService.getList(page,limit);
|
||||||
|
|
||||||
return R.success(newsList);
|
return R.success(newsList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,15 +44,15 @@ public class MallController {
|
|||||||
|
|
||||||
@GetMapping("/shop/mall-lists")
|
@GetMapping("/shop/mall-lists")
|
||||||
@ApiOperation(value = "商品分类模块列表",notes = "商品分类模块列表")
|
@ApiOperation(value = "商品分类模块列表",notes = "商品分类模块列表")
|
||||||
public R lists(@Validated @RequestBody PageVO pageVO){
|
public R lists(@RequestParam(value = "page",defaultValue = "0") int page,
|
||||||
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
int userId = userOperator.getUser().getId();
|
int userId = userOperator.getUser().getId();
|
||||||
List<CateDTO> goodsCates = cateService.getList();
|
List<CateDTO> goodsCates = cateService.getList();
|
||||||
List<GoodsDTO> recommedGoods = goodsService.getList(0,
|
List<GoodsDTO> recommedGoods = goodsService.getList(0,
|
||||||
pageVO.getPage(),pageVO.getLimit(),userId,"",1);
|
page,limit,userId,"",1);
|
||||||
List<GoodsDTO> newGoods = goodsService.getList(0,pageVO.getPage(),
|
List<GoodsDTO> newGoods = goodsService.getList(0,page,limit,userId,"",2);
|
||||||
pageVO.getLimit(),userId,"",2);
|
|
||||||
|
|
||||||
List<GoodsDTO> collectGoods = goodsMapper.toDto(goodsService.collectGoods(pageVO.getPage(),pageVO.getLimit(),userId));
|
List<GoodsDTO> collectGoods = goodsMapper.toDto(goodsService.collectGoods(page,limit,userId));
|
||||||
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("goodsCates",goodsCates);
|
map.put("goodsCates",goodsCates);
|
||||||
@@ -149,9 +149,13 @@ public class MallController {
|
|||||||
|
|
||||||
@GetMapping("/shop/mall-cart-list")
|
@GetMapping("/shop/mall-cart-list")
|
||||||
@ApiOperation(value = "获取购物车列表",notes = "获取购物车列表")
|
@ApiOperation(value = "获取购物车列表",notes = "获取购物车列表")
|
||||||
public R cartList(@Validated @RequestBody PageVO pageVO){
|
public R cartList(@RequestParam(value = "page",defaultValue = "0") int page,
|
||||||
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
int userId = userOperator.getUser().getId();
|
int userId = userOperator.getUser().getId();
|
||||||
//goodsService.cartList(pageVO,userId);
|
//goodsService.cartList(pageVO,userId);
|
||||||
|
PageVO pageVO = new PageVO();
|
||||||
|
pageVO.setPage(page);
|
||||||
|
pageVO.setLimit(limit);
|
||||||
return R.success(goodsService.cartList(pageVO,userId));
|
return R.success(goodsService.cartList(pageVO,userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.ruoyi.app.modular.shop.service.vo.PageVO;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public interface IOrderService extends IService<StoreOrder> {
|
public interface IOrderService extends IService<StoreOrder> {
|
||||||
@@ -32,4 +33,6 @@ public interface IOrderService extends IService<StoreOrder> {
|
|||||||
|
|
||||||
public List<StorePointsMoneyLog> pointsMoneyLogs(int type, int userId, int page,int limit);
|
public List<StorePointsMoneyLog> pointsMoneyLogs(int type, int userId, int page,int limit);
|
||||||
|
|
||||||
|
public Map<String,Integer> countInfo(int userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
+35
-4
@@ -32,10 +32,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -418,4 +415,38 @@ public class OrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOrder>
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> countInfo(int userId) {
|
||||||
|
QueryWrapper<StoreOrder> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("deleted",0).eq("user_id",userId).eq("pay_status",0);
|
||||||
|
int unpayCount = count(wrapper);
|
||||||
|
|
||||||
|
QueryWrapper<StoreOrder> wrapper1 = new QueryWrapper<>();
|
||||||
|
wrapper1.eq("deleted",0).eq("user_id",userId)
|
||||||
|
.eq("pay_status",1).eq("shipping_status",0);
|
||||||
|
int undeliverCount = count(wrapper1);
|
||||||
|
|
||||||
|
QueryWrapper<StoreOrder> wrapper2 = new QueryWrapper<>();
|
||||||
|
wrapper2.eq("deleted",0).eq("user_id",userId)
|
||||||
|
.eq("shipping_status",1).eq("order_status",0);
|
||||||
|
int deliveringCount = count(wrapper2);
|
||||||
|
|
||||||
|
QueryWrapper<StoreOrder> wrapper3 = new QueryWrapper<>();
|
||||||
|
wrapper3.eq("deleted",0).eq("user_id",userId)
|
||||||
|
.eq("shipping_status",1).eq("order_status",1);
|
||||||
|
int unevalCount = count(wrapper3);
|
||||||
|
|
||||||
|
QueryWrapper<StoreOrder> wrapper4 = new QueryWrapper<>();
|
||||||
|
wrapper4.eq("deleted",0).eq("user_id",userId).gt("shipping_status",1);
|
||||||
|
int returnCount = count(wrapper4);
|
||||||
|
|
||||||
|
Map<String,Integer> map = new HashMap<>();
|
||||||
|
map.put("unpayCount",unpayCount);
|
||||||
|
map.put("undeliverCount",undeliverCount);
|
||||||
|
map.put("deliveringCount",deliveringCount);
|
||||||
|
map.put("unevalCount",unevalCount);
|
||||||
|
map.put("returnCount",returnCount);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user