New file |
| | |
| | | package com.oying.modules.sh.service.impl; |
| | | |
| | | import com.oying.modules.sh.domain.OrderProductSnapshot; |
| | | import com.oying.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.modules.sh.service.OrderProductSnapshotService; |
| | | import com.oying.modules.sh.domain.dto.OrderProductSnapshotQueryCriteria; |
| | | import com.oying.modules.sh.mapper.OrderProductSnapshotMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @description 服务实现 |
| | | * @author lixin |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class OrderProductSnapshotServiceImpl extends ServiceImpl<OrderProductSnapshotMapper, OrderProductSnapshot> implements OrderProductSnapshotService { |
| | | |
| | | private final OrderProductSnapshotMapper orderProductSnapshotMapper; |
| | | |
| | | @Override |
| | | public PageResult<OrderProductSnapshot> queryAll(OrderProductSnapshotQueryCriteria criteria, Page<Object> page){ |
| | | return PageUtil.toPage(orderProductSnapshotMapper.findAll(criteria, page)); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderProductSnapshot> queryAll(OrderProductSnapshotQueryCriteria criteria){ |
| | | return orderProductSnapshotMapper.findAll(criteria); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderProductSnapshot> queryOrderProductSnapshot(String orderNum) { |
| | | return orderProductSnapshotMapper.queryOrderProductSnapshot(orderNum); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(OrderProductSnapshot resources) { |
| | | orderProductSnapshotMapper.insert(resources); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(OrderProductSnapshot resources) { |
| | | OrderProductSnapshot orderProductSnapshot = getById(resources.getSnapshotId()); |
| | | orderProductSnapshot.copy(resources); |
| | | orderProductSnapshotMapper.updateById(orderProductSnapshot); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteAll(List<Long> ids) { |
| | | orderProductSnapshotMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<OrderProductSnapshot> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (OrderProductSnapshot orderProductSnapshot : all) { |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("订单编号", orderProductSnapshot.getOrderNum()); |
| | | map.put("门店ID", orderProductSnapshot.getStoreId()); |
| | | map.put("商品ID", orderProductSnapshot.getProductId()); |
| | | map.put("商品编号", orderProductSnapshot.getProductCode()); |
| | | map.put("条形码", orderProductSnapshot.getProductBarcode()); |
| | | map.put("商品名称", orderProductSnapshot.getProductName()); |
| | | map.put("商品标题", orderProductSnapshot.getProductTitle()); |
| | | map.put("主图片", orderProductSnapshot.getProductMainImage()); |
| | | map.put("商品描述", orderProductSnapshot.getProductDescription()); |
| | | map.put("参数快照", orderProductSnapshot.getParamData()); |
| | | map.put("单价", orderProductSnapshot.getUnitPrice()); |
| | | map.put("数量", orderProductSnapshot.getDetailCount()); |
| | | map.put("原金额", orderProductSnapshot.getOriginalPrice()); |
| | | map.put("折扣价", orderProductSnapshot.getPaidPrice()); |
| | | map.put("实付金额", orderProductSnapshot.getActuallyPayPrice()); |
| | | map.put("状态", orderProductSnapshot.getPayState()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |