管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-11 35a5eec0d176b550fb0d7c5a0a5421b66f3b26c4
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package com.lf.server.service.sys;
 
import com.lf.server.entity.ctrl.CountEntity;
import com.lf.server.entity.sys.ReportEntity;
import com.lf.server.helper.FileHelper;
import com.lf.server.helper.StringHelper;
import com.lf.server.helper.WordHelper;
import com.lf.server.mapper.sys.ReportMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * 报告模板
 * @author WWW
 */
@Service
public class ReportService implements ReportMapper {
    @Autowired
    ReportMapper reportMapper;
 
    @Override
    public Integer selectCount(String name) {
        name = StringHelper.getLikeStr(name);
 
        return reportMapper.selectCount(name);
    }
 
    @Override
    public List<ReportEntity> selectByPage(String name, Integer limit, Integer offset) {
        name = StringHelper.getLikeStr(name);
 
        return reportMapper.selectByPage(name, limit, offset);
    }
 
    @Override
    public List<ReportEntity> selectAll() {
        return reportMapper.selectAll();
    }
 
    @Override
    public ReportEntity selectById(int id) {
        return reportMapper.selectById(id);
    }
 
    @Override
    public Integer insert(ReportEntity entity) {
        return reportMapper.insert(entity);
    }
 
    @Override
    public Integer inserts(List<ReportEntity> list) {
        return reportMapper.inserts(list);
    }
 
    @Override
    public Integer delete(int id) {
        return reportMapper.delete(id);
    }
 
    @Override
    public Integer deletes(List<Integer> ids) {
        return reportMapper.deletes(ids);
    }
 
    @Override
    public Integer update(ReportEntity entity) {
        return reportMapper.update(entity);
    }
 
    @Override
    public Integer updates(List<ReportEntity> list) {
        return reportMapper.updates(list);
    }
 
    @Override
    public List<CountEntity> countSizes() {
        return reportMapper.countSizes();
    }
 
    @Override
    public List<CountEntity> countServices() {
        return reportMapper.countServices();
    }
 
    @Override
    public List<CountEntity> countOperates() {
        return reportMapper.countOperates();
    }
 
    /**
     * 创建 用户流量统计 Word
     */
    public void createCountOperatesWord() {
        List<CountEntity> list = countOperates();
        if (null == list || list.isEmpty()) {
            return;
        }
 
        int rows = 1;
        String inputFile = "D:\\LF\\用户流量统计.docx";
        String outPutFile = "D:\\LF\\用户流量统计_new.docx";
 
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getM2(), ce.getCount().toString()};
            addList.add(strs);
        }
 
        WordHelper.generateWord(inputFile, outPutFile, null, addList);
    }
 
    /**
     * 创建 服务调用量统计 Word
     */
    public void createCountServicesWord() {
        List<CountEntity> list = countServices();
        if (null == list || list.isEmpty()) {
            return;
        }
 
        int rows = 1;
        String inputFile = "D:\\LF\\服务调用量统计.docx";
        String outPutFile = "D:\\LF\\服务调用量统计_new.docx";
 
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getCount().toString()};
            addList.add(strs);
        }
 
        WordHelper.generateWord(inputFile, outPutFile, null, addList);
    }
 
    /**
     * 创建 数据量统计 Word
     */
    public void createCountSizesWord() {
        List<CountEntity> list = countSizes();
        if (null == list || list.isEmpty()) {
            return;
        }
 
        int rows = 1;
        String inputFile = "D:\\LF\\数据量统计.docx";
        String outPutFile = "D:\\LF\\数据量统计_new.docx";
 
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            String[] strs = new String[]{"" + rows++, ce.getM1(), FileHelper.getSizes(ce.getSizes())};
            addList.add(strs);
        }
 
        WordHelper.generateWord(inputFile, outPutFile, null, addList);
    }
}