This commit is contained in:
wangjinlei
2023-11-03 17:03:42 +08:00
parent b683c29ad5
commit 5b71036241
10 changed files with 76 additions and 2 deletions

View File

@@ -127,6 +127,22 @@ public class BuyOrderController {
return R.ok().put("page",userOrderList);
}
/**
* 获取用户订单各个状态的数量
* @param map
* @return
*/
@RequestMapping("/getUserOrderStatusNum")
public R getUserOrderStatusNum(@RequestBody Map<String,Object> map){
Integer userId = Integer.valueOf(map.get("userId").toString());
List<BuyOrder> userOrderStatusNum = buyOrderService.getUserOrderStatusNum(userId);
Map<String, Integer> m = new HashMap<>();
for (BuyOrder b : userOrderStatusNum){
m.put(b.getOrderStatus().toString(),b.getStatusNum());
}
return R.ok().put("map",m);
}
/**
* 订单详情
*

View File

@@ -1,6 +1,7 @@
package com.peanut.modules.book.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.PointCategoryEntity;
@@ -50,6 +51,12 @@ public class PointController {
@RequestMapping("/delPointCategory")
public R delPointCategory(@RequestBody Map<String,Object> map){
Integer id = Integer.valueOf(map.get("pointCategoryId").toString());
LambdaQueryWrapper<PointEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PointEntity::getPointCategoryId,id);
List<PointEntity> list = pointService.list(wrapper);
if(list.size()>0){
return R.error("此分类下存在文章,请先清空文章后再尝试删除!");
}
pointCategoryService.removeById(id);
return R.ok();
}

View File

@@ -19,6 +19,6 @@ import java.util.List;
public interface BuyOrderDao extends BaseMapper<BuyOrder> {
List<BuyOrder> orderList(BuyOrderListRequestVo requestVo);
// Page<BuyOrder> testPage(Page<BuyOrder> page);
List<BuyOrder> orderStatusNum(Integer userId);
}

View File

@@ -6,4 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PointCategoryDao extends MPJBaseMapper<PointCategoryEntity> {
}

View File

@@ -36,6 +36,9 @@ public class BuyOrder implements Serializable {
*/
@TableField(exist = false)
private String userName;
@TableField(exist = false)
private Integer statusNum;
/**
* 收货人姓名
*/
@@ -178,5 +181,8 @@ public class BuyOrder implements Serializable {
@TableField(exist = false)
private MyUserEntity user;
@TableField(exist = false)
private List<ExpressOrder> expressList;
private int addressModified;
}

View File

@@ -43,4 +43,7 @@ public class PointEntity implements Serializable {
@TableLogic
private Integer delFlag;
@TableField(exist = false)
private String categoryString;
}

View File

@@ -55,6 +55,8 @@ public interface BuyOrderService extends IService<BuyOrder> {
Page<BuyOrder> getUserOrderList(UserOrderDto userOrderDto);
List<BuyOrder> getUserOrderStatusNum(Integer userId);
BuyOrderResponseVo orderDetail(String orderSn);
Map<String, Object> decomposeShipment(BuyOrderListRequestVo requestVo);

View File

@@ -398,7 +398,12 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
b.setProductList(buyOrderProducts);
b.setTimestamp(b.getCreateTime().getTime()/1000);
//获取包裹信息
// getOrderByOS()
List<Integer> collect = buyOrderProductService.list(new LambdaQueryWrapper<BuyOrderProduct>().eq(BuyOrderProduct::getOrderId, b.getOrderId()).gt(BuyOrderProduct::getExpressOrderId, 0))
.stream().map(BuyOrderProduct::getExpressOrderId).collect(Collectors.toList());
if(collect.size()>0){
List<ExpressOrder> expressOrders = expressOrderDao.selectList(new LambdaQueryWrapper<ExpressOrder>().in(ExpressOrder::getId, collect));
b.setExpressList(expressOrders);
}
}
return buyOrderPage;
@@ -522,6 +527,22 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
return setBuyOrderInfo(buyOrder);
}
@Override
public List<BuyOrder> getUserOrderStatusNum(Integer userId) {
List<BuyOrder> buyOrders = this.getBaseMapper().orderStatusNum(userId);
return buyOrders;
// LambdaQueryWrapper<BuyOrder> wrapper = new LambdaQueryWrapper<>();
// List<Integer> status = new ArrayList<>();
// status.add(0);
// status.add(1);
// status.add(2);
// status.add(3);
// wrapper.s
// wrapper.in(BuyOrder::getOrderStatus,status);
// wrapper.groupBy(BuyOrder::getOrderStatus);
// List<BuyOrder> list = list(wrapper);
}
/**
* 组装快递鸟专用我方订单号,应对同一订单号,他们生成的快递订单号是一个

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.modules.book.dao.PointCategoryDao;
import com.peanut.modules.book.dao.PointDao;
import com.peanut.modules.book.entity.PointCategoryEntity;
@@ -39,6 +40,10 @@ public class PointServiceImpl extends ServiceImpl<PointDao, PointEntity> impleme
Page<PointEntity> pointEntityPage = getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
for (PointEntity p : pointEntityPage.getRecords()){
p.setImageList(JSON.parseArray(p.getImages(),String.class));
PointCategoryEntity c_category = pointCategoryDao.selectById(p.getPointCategoryId());
System.out.println(c_category);
PointCategoryEntity f_category = pointCategoryDao.selectById(c_category.getPid());
p.setCategoryString(f_category.getTitle()+" > "+c_category.getTitle());
}
return pointEntityPage;
}

View File

@@ -69,6 +69,18 @@
and del_flag = 0
</select>
<select id="orderStatusNum" resultType="com.peanut.modules.book.entity.BuyOrder">
select *,count(*) as statusNum
from buy_order
where
user_id = #{userId}
and del_flag = 0
and order_status in (0,1,2,3)
group by
order_status
</select>
<select id="orderList" resultType="com.peanut.modules.book.entity.BuyOrder"
parameterType="com.peanut.modules.book.vo.request.BuyOrderListRequestVo" resultMap="buyOrderMap">
<!--