| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |