Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java into dev1/user_model
This commit is contained in:
@@ -10,8 +10,10 @@ import com.peanut.config.Constants;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.vo.request.BuyOrderListRequestVo;
|
||||
import com.peanut.modules.book.vo.request.ProductRequestVo;
|
||||
import com.peanut.modules.book.vo.request.ProductTransportVo;
|
||||
import com.peanut.modules.book.vo.response.BuyOrderListResponseVo;
|
||||
import com.peanut.modules.book.vo.response.ExpressQueryResponseVo;
|
||||
import com.peanut.modules.book.vo.ShippingAddressRequestVo;
|
||||
import com.peanut.modules.book.vo.UserAddressVo;
|
||||
@@ -91,6 +93,18 @@ public class BuyOrderController {
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*
|
||||
* @param requestVo request value object
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping(path = "orderList", method = RequestMethod.POST)
|
||||
public R orderList(@RequestBody BuyOrderListRequestVo requestVo) {
|
||||
List<BuyOrderListResponseVo> response = buyOrderService.orderList(requestVo);
|
||||
return R.ok().put("result", response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单
|
||||
*
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.peanut.modules.book.dao;
|
||||
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.vo.request.BuyOrderListRequestVo;
|
||||
import com.peanut.modules.book.vo.response.BuyOrderListResponseVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,7 +17,6 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface BuyOrderDao extends BaseMapper<BuyOrder> {
|
||||
|
||||
public List<BuyOrder> queryListByOrderIds(Integer[] ids);
|
||||
List<BuyOrder> orderList(BuyOrderListRequestVo requestVo);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.entity.BuyOrderProduct;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BuyOrderProductDao extends BaseMapper<BuyOrderProduct> {
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description: 订单-商品
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/19
|
||||
*/
|
||||
@Data
|
||||
@TableName("buy_order_product")
|
||||
public class BuyOrderProduct {
|
||||
/**
|
||||
* 主键 ID
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 订单 ID
|
||||
*/
|
||||
private int orderId;
|
||||
/**
|
||||
* 商品 ID
|
||||
*/
|
||||
private int productId;
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private int quantity;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal realPrice;
|
||||
/**
|
||||
* 快递订单 ID
|
||||
*/
|
||||
private int express_order_id;
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private int delFlag;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.BuyOrderProduct;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface BuyOrderProductService extends IService<BuyOrderProduct> {
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
import com.peanut.modules.book.vo.UserOrderVo;
|
||||
import com.peanut.modules.book.vo.request.BuyOrderListRequestVo;
|
||||
import com.peanut.modules.book.vo.response.BuyOrderListResponseVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -31,6 +33,8 @@ public interface BuyOrderService extends IService<BuyOrder> {
|
||||
// 查询所有订单是否有可合并
|
||||
Page checkOrder(Map<String, Object> params);
|
||||
|
||||
List<BuyOrderListResponseVo> orderList(BuyOrderListRequestVo requestVo);
|
||||
|
||||
/**
|
||||
* 订单拆分发货
|
||||
*
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.book.dao.BuyOrderProductDao;
|
||||
import com.peanut.modules.book.entity.BuyOrderProduct;
|
||||
import com.peanut.modules.book.service.BuyOrderProductService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 订单-商品 Service 实现类
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/19
|
||||
*/
|
||||
@Service
|
||||
public class BuyOrderProductServiceImpl extends ServiceImpl<BuyOrderProductDao, BuyOrderProduct> implements BuyOrderProductService {
|
||||
}
|
||||
@@ -15,6 +15,9 @@ import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.entity.ExpressCommodity;
|
||||
import com.peanut.modules.book.vo.ExpressOrderResponseVo;
|
||||
import com.peanut.modules.book.vo.UserOrderVo;
|
||||
import com.peanut.modules.book.vo.request.BuyOrderListRequestVo;
|
||||
import com.peanut.modules.book.vo.response.BuyOrderListResponseVo;
|
||||
import com.peanut.modules.book.vo.response.ConsigneeVo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -48,6 +51,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
@Autowired
|
||||
ShopProductService shopProductService;
|
||||
|
||||
@Autowired
|
||||
private BuyOrderDao buyOrderDao;
|
||||
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
|
||||
|
||||
@@ -86,8 +92,6 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
List<BuyOrder> records = page.getRecords();
|
||||
for (BuyOrder record : records) {
|
||||
Integer userId = record.getUserId();
|
||||
@@ -286,6 +290,33 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
return rntPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BuyOrderListResponseVo> orderList(BuyOrderListRequestVo requestVo) {
|
||||
List<BuyOrder> buyOrderList = buyOrderDao.orderList(requestVo);
|
||||
List<BuyOrderListResponseVo> result = new ArrayList<>();
|
||||
for (BuyOrder buyOrder : buyOrderList) {
|
||||
BuyOrderListResponseVo responseVo = new BuyOrderListResponseVo();
|
||||
responseVo.setOrderSn(buyOrder.getOrderSn());
|
||||
responseVo.setOrderStatus(buyOrder.getOrderStatus());
|
||||
responseVo.setRemark(buyOrder.getRemark());
|
||||
responseVo.setPaymentDate(buyOrder.getPaymentDate());
|
||||
responseVo.setPaymentMethod(buyOrder.getPaymentMethod());
|
||||
ConsigneeVo consigneeVo = new ConsigneeVo();
|
||||
consigneeVo.setConsigneeName(buyOrder.getShippingUser());
|
||||
consigneeVo.setConsigneeMobile(buyOrder.getUserPhone());
|
||||
consigneeVo.setProvince(buyOrder.getProvince());
|
||||
consigneeVo.setCity(buyOrder.getCity());
|
||||
consigneeVo.setCounty(buyOrder.getDistrict());
|
||||
consigneeVo.setAddress(buyOrder.getAddress());
|
||||
responseVo.setConsignee(consigneeVo);
|
||||
// responseVo.setExpressList();
|
||||
// responseVo.setGoodsList();
|
||||
requestVo.setIndex((requestVo.getIndex() - 1) * requestVo.getPageSize());
|
||||
result.add(responseVo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delivery(String expressCompanyCode, List<Integer> buyOrderDetailId) {
|
||||
QueryWrapper<BuyOrderDetail> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
@@ -35,4 +35,8 @@ public class BuyOrderListRequestVo {
|
||||
* 订单状态
|
||||
*/
|
||||
private Integer orderStatus;
|
||||
/**
|
||||
* 数据起始位置
|
||||
*/
|
||||
private Integer index;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.peanut.modules.book.vo.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 订单列表相应 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/19
|
||||
*/
|
||||
@Data
|
||||
public class BuyOrderListResponseVo {
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderSn;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private String paymentMethod;
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
private String orderStatus;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
private Date paymentDate;
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
private List<GoodsResponseVo> goodsList;
|
||||
/**
|
||||
* 快递列表
|
||||
*/
|
||||
private List<ExpressResponseVo> expressList;
|
||||
/**
|
||||
* 收货人信息
|
||||
*/
|
||||
private ConsigneeVo consignee;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.peanut.modules.book.vo.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 收货人 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/19
|
||||
*/
|
||||
@Data
|
||||
public class ConsigneeVo {
|
||||
/**
|
||||
* 收货人姓名
|
||||
*/
|
||||
private String consigneeName;
|
||||
/**
|
||||
* 收货人电话
|
||||
*/
|
||||
private String consigneeMobile;
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 区县
|
||||
*/
|
||||
private String county;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.peanut.modules.book.vo.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 物流响应 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/19
|
||||
*/
|
||||
@Data
|
||||
public class ExpressResponseVo {
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
private String expressOrderSn;
|
||||
/**
|
||||
* 快递公司
|
||||
*/
|
||||
private String expressCompany;
|
||||
/**
|
||||
* 快递面单
|
||||
*/
|
||||
private String printTemplate;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.peanut.modules.book.vo.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description: 商品信息 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/19
|
||||
*/
|
||||
@Data
|
||||
public class GoodsResponseVo {
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String productName;
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
private String productImage;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
}
|
||||
@@ -67,7 +67,28 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
and del_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="orderList" resultType="com.peanut.modules.book.entity.BuyOrder"
|
||||
parameterType="com.peanut.modules.book.vo.request.BuyOrderListRequestVo">
|
||||
select order_sn, province, city, district, user_phone, address, payment_method, order_status, remark
|
||||
from buy_order
|
||||
<where>
|
||||
<if test="orderStatus != null">
|
||||
and order_status = #{orderStatus}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="searchKeyWord != null">
|
||||
and order_sn like %#{searchKeyWord}%
|
||||
</if>
|
||||
|
||||
</where>
|
||||
limit #{index},#{pageSize}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user