From 910ca2f0f8594a1353f822d653c88a7924902217 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Mon, 28 Jun 2021 19:32:18 +0800 Subject: [PATCH] Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop --- gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java index 6f646d4..9859109 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java +++ b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java @@ -1,6 +1,9 @@ package com.xzx.gc.order.service; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.xzx.gc.common.constant.Constants; import com.xzx.gc.common.utils.IdUtils; import com.xzx.gc.entity.AddressInfo; @@ -13,6 +16,7 @@ import com.xzx.gc.order.mapper.JhyOrderItemsMapper; import com.xzx.gc.order.mapper.JhyOrderMapper; import com.xzx.gc.order.mapper.SysEnvironmentalInfoMapper; +import com.xzx.gc.order.vo.JhyOrderDetailsVo; import com.xzx.gc.order.vo.JhyOrderListVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -91,7 +95,27 @@ } } - public List<JhyOrderListVo> orderList(JhyOrderListDto orderListDto) { - return null; + public PageInfo<JhyOrderListVo> orderList(JhyOrderListDto orderListDto) { + PageHelper.startPage(orderListDto.getPageNo(), orderListDto.getPageSize()); + List<JhyOrderListVo> data = jhyOrderMapper.selectJhyOrderList(orderListDto); + return new PageInfo<>(data); + } + + public JhyOrderDetailsVo orderDetails(Long orderId, String userId) { + JhyOrder order = jhyOrderMapper.selectByPrimaryKey(orderId); + List<JhyOrderItems> items = jhyOrderItemsMapper.selectOrderItems(orderId); + + BigDecimal total = BigDecimal.ZERO; + for (JhyOrderItems item : items) { + total = total.add(StrUtil.isNotBlank(item.getScore()) ? new BigDecimal(item.getScore()) : BigDecimal.ZERO); + } + + JhyOrderDetailsVo detailsVo = new JhyOrderDetailsVo(); + BeanUtil.copyProperties(order, detailsVo); + + detailsVo.setAddress(order.getArea() + order.getAddress()); + detailsVo.setTotalPrice(total); + detailsVo.setItems(items); + return detailsVo; } } -- Gitblit v1.9.1