order list order detail print template template list

This commit is contained in:
Cauchy
2023-10-20 14:14:20 +08:00
parent a1b70c8d4f
commit 62ea0482a3
13 changed files with 222 additions and 105 deletions

View File

@@ -13,7 +13,7 @@ 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.BuyOrderResponseVo;
import com.peanut.modules.book.vo.response.ExpressQueryResponseVo;
import com.peanut.modules.book.vo.ShippingAddressRequestVo;
import com.peanut.modules.book.vo.UserAddressVo;
@@ -80,18 +80,6 @@ public class BuyOrderController {
@Autowired
private SysConfigService sysConfigService;
/**
* 订单列表
*
* @param params
* @return
* @throws Exception
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params) throws Exception {
PageUtils page = buyOrderService.list(params);
return R.ok().put("page", page);
}
/**
* 订单列表
@@ -101,8 +89,14 @@ public class BuyOrderController {
*/
@RequestMapping(path = "/orderList", method = RequestMethod.POST)
public R orderList(@RequestBody BuyOrderListRequestVo requestVo) {
List<BuyOrderListResponseVo> response = buyOrderService.orderList(requestVo);
return R.ok().put("result", response);
PageUtils page = buyOrderService.orderList(requestVo);
return R.ok().put("result", page);
}
@RequestMapping(path = "/orderDetail", method = RequestMethod.GET)
public R orderDetail(@RequestParam("orderSn") String orderSn) {
BuyOrderResponseVo buyOrderResponseVo = buyOrderService.orderDetail(orderSn);
return R.ok().put("result", buyOrderResponseVo);
}
/**

View File

@@ -1,12 +1,23 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BuyOrder;
import com.peanut.modules.book.entity.BuyOrderProduct;
import com.peanut.modules.book.entity.ExpressOrder;
import com.peanut.modules.book.service.BuyOrderProductService;
import com.peanut.modules.book.service.BuyOrderService;
import com.peanut.modules.book.service.ExpressCompanyService;
import com.peanut.modules.book.service.ExpressOrderService;
import com.peanut.modules.book.vo.ExpressCompanyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
@@ -18,22 +29,61 @@ import java.util.List;
@RequestMapping("/express")
public class ExpressController {
private final ExpressCompanyService expressCompanyService;
@Autowired
private ExpressCompanyService expressCompanyService;
@Autowired
private BuyOrderService buyOrderService;
@Autowired
private BuyOrderProductService buyOrderProductService;
@Autowired
private ExpressOrderService expressOrderService;
/**
* 获取快递公司列表
*
* @return R
*/
@RequestMapping(path = "/getExpressCompanyList")
@RequestMapping(path = "/getExpressCompanyList", method = RequestMethod.GET)
public R getExpressCompanyList() {
List<ExpressCompanyVo> expressCompanyList = expressCompanyService.getExpressCompanyList();
return R.ok().put("result", expressCompanyList);
}
@Autowired
ExpressController(ExpressCompanyService expressCompanyService) {
this.expressCompanyService = expressCompanyService;
/**
* 获取快递面单列表
*
* @return
*/
@RequestMapping(path = "/getPrintTemplateList", method = RequestMethod.GET)
public R getPrintTemplate(String orderSn) {
QueryWrapper<BuyOrder> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_sn", orderSn);
BuyOrder buyOrder = buyOrderService.getOne(queryWrapper);
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
buyOrderProductQueryWrapper.eq("order_id", buyOrder.getOrderId());
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.list(buyOrderProductQueryWrapper);
List<Integer> expressOrderIdList = new ArrayList<>();
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
expressOrderIdList.add(buyOrderProduct.getExpressOrderId());
}
QueryWrapper<ExpressOrder> expressOrderQueryWrapper = new QueryWrapper<>();
expressOrderQueryWrapper.in("id", expressOrderIdList);
expressOrderQueryWrapper.select("print_template");
List<ExpressOrder> expressOrderList = expressOrderService.list(expressOrderQueryWrapper);
List<String> result = new ArrayList<>();
for (ExpressOrder expressOrder : expressOrderList) {
result.add(expressOrder.getPrintTemplate());
}
return R.ok().put("result", result);
}
@RequestMapping(value = "/printTemplate", method = RequestMethod.GET)
public R printTemplate(@RequestParam("expressOrderId") Integer expressOrderId) {
UpdateWrapper<ExpressOrder> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("template_printed", 1);
updateWrapper.eq("id", expressOrderId);
expressOrderService.update(updateWrapper);
return R.ok();
}
}