This commit is contained in:
Cauchy
2023-10-18 16:59:07 +08:00
parent c90ecfb7ce
commit f1b072d6c3
3 changed files with 60 additions and 0 deletions

View File

@@ -199,6 +199,15 @@ public class BuyOrderController {
return R.ok().put("result", expressFee);
}
/**
* 列表
*/
@RequestMapping("/getMyOrderList")
public R getMyOrderList(@RequestParam Map<String, Object> params) {
PageUtils page = buyOrderService.queryPage1(params);
return R.ok().put("page", page);
}
/**
* 修改

View File

@@ -19,6 +19,8 @@ public interface BuyOrderService extends IService<BuyOrder> {
PageUtils queryPage(Map<String, Object> params) throws Exception;
PageUtils queryPage1(Map<String, Object> params);
//更新订单状态
void updateOrderStatus(Integer userId, String orderSn, String type);
@@ -35,4 +37,6 @@ public interface BuyOrderService extends IService<BuyOrder> {
* @param buyOrderDetailId 订单详情 ID 列表
*/
void createSplitPackageOrder(String expressCompanyCode, List<Integer> buyOrderDetailId);
}

View File

@@ -14,6 +14,7 @@ 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 org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +44,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
@Autowired
CountyService countyService;
@Autowired
ShopProductService shopProductService;
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
@@ -96,6 +100,49 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
return new PageUtils(page);
}
@Override
public PageUtils queryPage1(Map<String, Object> params) {
String orderStatus = (String) params.get("orderStatus");
if (orderStatus.equals("9")) {
orderStatus = null;
}
String userId = (String) params.get("userId");
IPage<BuyOrder> page = this.page(
new Query<BuyOrder>().getPage(params),
new QueryWrapper<BuyOrder>()
.eq("user_id", userId)
.eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus)
.orderByDesc("create_time")
);
List<BuyOrder> records = page.getRecords();
for (BuyOrder buyOrderEntity : records) {
Integer orderId = buyOrderEntity.getOrderId();
buyOrderEntity.setTimestamp(buyOrderEntity.getCreateTime().getTime() / 1000);
List<BuyOrderDetail> entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
.eq("order_id", orderId));
if (entities != null) {
for (BuyOrderDetail entity : entities) {
Integer productId = entity.getProductId();
ShopProductEntity shopPro = shopProductService.getById(productId);
if (shopPro != null) {
String productImages = shopPro.getProductImages();
entity.setImage(productImages);
}
}
}
buyOrderEntity.setProducts(entities);
}
return new PageUtils(page);
}
@Override
public void updateOrderStatus(Integer userId, String orderSn, String type) {