Administrator
2023-06-19 49588f5a462ae7425e7eb030438a35fd80c246fa
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package com.gk.firework.Service.ServiceImpl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.firework.Domain.HistoryStock;
import com.gk.firework.Domain.UserInfo;
import com.gk.firework.Mapper.HistoryStockMapper;
import com.gk.firework.Service.HistoryStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
 
@Service("historyStockService")
public class HistoryStockServiceImpl extends ServiceImpl<HistoryStockMapper, HistoryStock> implements HistoryStockService {
 
    @Autowired
    private HistoryStockMapper historyStockMapper;
 
 
    /**
    * @Description: 历史一天库存持久化
    * @date 2022/2/8 14:52
    */
    @Override
    public void hisStockPersisting() {
        historyStockMapper.insertDayHistoryStock();
    }
 
    @Override
    public IPage selectHistoryStock(Page<Map> page, Map<String, Object> filter, UserInfo user) {
 
        Map<String, Object> params = new HashMap<>();
        params.put("specificDate", filter.get("specificDate"));
        params.put("province", filter.get("province"));
        params.put("city", filter.get("city"));
        params.put("district", filter.get("district"));
        params.put("enterprisename", filter.get("enterprisename"));
        params.put("safetysupervision", filter.get("safetysupervision"));
        List<Map> res = historyStockMapper.selectPages(page, params);
        List<Map> result = new ArrayList<>(res);
        if (result.size() > 0) {
            Map totalRow = historyStockMapper.selectDayHistoryStockTotal(params);
            result.add(totalRow);
        }
        return page.setRecords(result);
    }
 
    @Override
    public IPage selectCityStock(Page<Map> page, Map<String, Object> filter, UserInfo user) {
 
        Map<String, Object> params = new HashMap<>();
        params.put("province", "新疆维吾尔自治区");
        params.put("city", filter.get("city"));
        params.put("district", filter.get("district"));
        params.put("specificDate", filter.get("specificDate"));
        params.put("safetysupervision", filter.get("safetysupervision"));
        params.put("enterprisename", filter.get("enterprisename"));
        List<Map> res = historyStockMapper.selectCityStock(page, params);
        List<Map> result = new ArrayList<>(res);
        if (result.size() > 0) {
            Map totalRow = historyStockMapper.selectAllCityStock(params);
            result.add(totalRow);
        }
        return page.setRecords(result);
    }
 
    @Override
    public IPage selectHistoryCityStock(Page<Map> page, Map<String, Object> filter, UserInfo user) {
 
        Map<String, Object> params = new HashMap<>();
        params.put("specificDate", filter.get("specificDate"));
        params.put("province", "新疆维吾尔自治区");
        params.put("city", filter.get("city"));
        params.put("district", filter.get("district"));
        params.put("safetysupervision", filter.get("safetysupervision"));
        params.put("enterprisename", filter.get("enterprisename"));
        List<Map> res = historyStockMapper.selectHistoryCityStock(page, params);
        List<Map> result = new ArrayList<>(res);
        if (result.size() > 0) {
            Map totalRow = historyStockMapper.selectDayHistoryStockTotal(params);
            result.add(totalRow);
        }
        return page.setRecords(result);
    }
 
    @Override
    public List<Map> selectExportHistoryStock(Map<String, Object> filter, UserInfo user) {
 
        Map<String, Object> params = new HashMap<>();
        params.put("specificDate", filter.get("specificDate"));
        params.put("province", filter.get("province"));
        params.put("city", filter.get("city"));
        params.put("district", filter.get("district"));
        params.put("enterprisename", filter.get("enterprisename"));
        params.put("safetysupervision", filter.get("safetysupervision"));
        List<Map> res = historyStockMapper.selectPages(params);
        List<Map> result = new ArrayList<>(res);
        if (result.size() > 0) {
            Map totalRow = historyStockMapper.selectDayHistoryStockTotal(params);
            result.add(totalRow);
        }
        return result;
    }
 
 
}