xin
2025-06-11 413747acee91a63265907a1af09600d7e9712963
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.oying.modules.sh.service.impl;
 
import com.oying.modules.sh.domain.OrderReturnProductSnapshot;
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.OrderReturnProductSnapshotService;
import com.oying.modules.sh.domain.dto.OrderReturnProductSnapshotQueryCriteria;
import com.oying.modules.sh.mapper.OrderReturnProductSnapshotMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.oying.utils.PageUtil;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import com.oying.utils.PageResult;
 
/**
* @description 服务实现
* @author lixin
* @date 2025-06-11
**/
@Service
@RequiredArgsConstructor
public class OrderReturnProductSnapshotServiceImpl extends ServiceImpl<OrderReturnProductSnapshotMapper, OrderReturnProductSnapshot> implements OrderReturnProductSnapshotService {
 
    private final OrderReturnProductSnapshotMapper orderReturnProductSnapshotMapper;
 
    @Override
    public PageResult<OrderReturnProductSnapshot> queryAll(OrderReturnProductSnapshotQueryCriteria criteria, Page<Object> page){
        return PageUtil.toPage(orderReturnProductSnapshotMapper.findAll(criteria, page));
    }
 
    @Override
    public List<OrderReturnProductSnapshot> queryAll(OrderReturnProductSnapshotQueryCriteria criteria){
        return orderReturnProductSnapshotMapper.findAll(criteria);
    }
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void create(OrderReturnProductSnapshot resources) {
        orderReturnProductSnapshotMapper.insert(resources);
    }
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(OrderReturnProductSnapshot resources) {
        OrderReturnProductSnapshot orderReturnProductSnapshot = getById(resources.getSnapshotId());
        orderReturnProductSnapshot.copy(resources);
        orderReturnProductSnapshotMapper.updateById(orderReturnProductSnapshot);
    }
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteAll(List<Long> ids) {
        orderReturnProductSnapshotMapper.deleteBatchIds(ids);
    }
 
    @Override
    public void download(List<OrderReturnProductSnapshot> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (OrderReturnProductSnapshot orderReturnProductSnapshot : all) {
            Map<String, Object> map = new LinkedHashMap<>();
            map.put("退单号", orderReturnProductSnapshot.getReturnNum());
            map.put("门店ID", orderReturnProductSnapshot.getStoreId());
            map.put("商品ID", orderReturnProductSnapshot.getProductId());
            map.put("商品编号", orderReturnProductSnapshot.getProductCode());
            map.put("条形码", orderReturnProductSnapshot.getProductBarcode());
            map.put("商品名称", orderReturnProductSnapshot.getProductName());
            map.put("商品标题", orderReturnProductSnapshot.getProductTitle());
            map.put("主图片", orderReturnProductSnapshot.getProductMainImage());
            map.put("商品描述", orderReturnProductSnapshot.getProductDescription());
            map.put("参数快照 ", orderReturnProductSnapshot.getParamData());
            map.put("单价", orderReturnProductSnapshot.getUnitPrice());
            map.put("数量", orderReturnProductSnapshot.getDetailCount());
            map.put("原金额", orderReturnProductSnapshot.getOriginalPrice());
            map.put("折扣价", orderReturnProductSnapshot.getPaidPrice());
            map.put("实付金额", orderReturnProductSnapshot.getActuallyPayPrice());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
}