管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-20 8d8e33f84d124ca16287451d65114c7e21857d76
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
package com.lf.server.controller.data;
 
import com.lf.server.annotation.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.ctrl.CountEntity;
import com.lf.server.entity.sys.ReportEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
import com.lf.server.service.all.UploadAttachService;
import com.lf.server.service.sys.ReportService;
import com.lf.server.service.sys.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * 数据统计
 * @author WWW
 */
@Api(tags = "数据管理\\数据统计")
@RestController
@RequestMapping("/dataCount")
public class DataCountController extends BaseController {
    @Resource
    ReportService reportService;
 
    @Resource
    TokenService tokenService;
 
    @Resource
    UploadAttachService uploadAttachService;
 
    @SysLog()
    @ApiOperation(value = "分页查询并返回记录数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "名称", dataType = "String", paramType = "query", example = ""),
            @ApiImplicitParam(name = "code", value = "编码", dataType = "String", paramType = "query", example = "countOperates"),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", paramType = "query", example = "10"),
            @ApiImplicitParam(name = "pageIndex", value = "分页数(从1开始)", dataType = "Integer", paramType = "query", example = "1")
    })
    @GetMapping(value = "/selectByPageAndCount")
    public ResponseMsg<List<ReportEntity>> selectByPageAndCount(String name, String code, Integer pageSize, Integer pageIndex) {
        try {
            if (pageSize < 1 || pageIndex < 1) {
                return fail("每页页数或分页数小于1", null);
            }
 
            int count = reportService.selectCount(name, code);
            if (count == 0) {
                return success(0, null);
            }
 
            List<ReportEntity> rs = reportService.selectByPage(name, code, pageSize, pageSize * (pageIndex - 1));
 
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询数据量统计")
    @GetMapping(value = "/selectCountSizes")
    public ResponseMsg<Object> selectCountSizes() {
        try {
            List<CountEntity> list = reportService.countSizes();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按文件类型统计")
    @GetMapping(value = "/countSizesByType")
    public ResponseMsg<Object> countSizesByType() {
        try {
            List<CountEntity> list = reportService.countSizesByType();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询服务调用量统计")
    @GetMapping(value = "/selectCountServices")
    public ResponseMsg<Object> selectCountServices() {
        try {
            List<CountEntity> list = reportService.countServices();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "查询用户流量统计")
    @GetMapping(value = "/selectCountOperates")
    public ResponseMsg<Object> selectCountOperates() {
        try {
            List<CountEntity> list = reportService.countOperates();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计数据")
    @GetMapping(value = "/countSizesByPrj")
    public ResponseMsg<Object> countSizesByPrj() {
        try {
            List<CountEntity> list = reportService.countSizesByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计钻孔数据")
    @GetMapping(value = "/countExplorationPoints")
    public ResponseMsg<Object> countExplorationPoints() {
        try {
            List<CountEntity> list = reportService.countExplorationPoints();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "下载报告")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "报告ID", dataType = "Integer", paramType = "query", example = "18")
    })
    @GetMapping(value = "/downloadReport")
    public void downloadReport(Integer id, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (null == id || id < 1) {
                return;
            }
 
            ReportEntity re = reportService.selectById(id);
            if (null == re || StringHelper.isEmpty(re.getGuid()) || StringHelper.isEmpty(re.getType()) || StringHelper.isEmpty(re.getCode())) {
                return;
            }
 
            UserEntity ue = tokenService.getCurrentUser(req);
 
            reportService.createReport(ue, re, res);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计数字高程模型面积")
    @GetMapping(value = "/countDemAreaByPrj")
    public ResponseMsg<Object> countDemAreaByPrj() {
        try {
            List<CountEntity> list = reportService.countDemAreaByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计三维地形模型面积")
    @GetMapping(value = "/countMptAreaByPrj")
    public ResponseMsg<Object> countMptAreaByPrj() {
        try {
            List<CountEntity> list = reportService.countMptAreaByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计倾斜摄影模型面积")
    @GetMapping(value = "/countOsgbAreaByPrj")
    public ResponseMsg<Object> countOsgbAreaByPrj() {
        try {
            List<CountEntity> list = reportService.countOsgbAreaByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计激光点云模型面积")
    @GetMapping(value = "/countLasAreaByPrj")
    public ResponseMsg<Object> countLasAreaByPrj() {
        try {
            List<CountEntity> list = reportService.countLasAreaByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计勘察工点个数")
    @GetMapping(value = "/countSurveyWorksiteByPrj")
    public ResponseMsg<Object> countSurveyWorksiteByPrj() {
        try {
            List<CountEntity> list = reportService.countSurveyWorksiteByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计勘察报告个数")
    @GetMapping(value = "/countExplorationReportByPrj")
    public ResponseMsg<Object> countExplorationReportByPrj() {
        try {
            List<CountEntity> list = reportService.countExplorationReportByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计崩塌个数")
    @GetMapping(value = "/countCollapseByPrj")
    public ResponseMsg<Object> countCollapseByPrj() {
        try {
            List<CountEntity> list = reportService.countCollapseByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计泥石流个数")
    @GetMapping(value = "/countDebrisFlowByPrj")
    public ResponseMsg<Object> countDebrisFlowByPrj() {
        try {
            List<CountEntity> list = reportService.countDebrisFlowByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计地面塌陷个数")
    @GetMapping(value = "/countGroundCollapseByPrj")
    public ResponseMsg<Object> countGroundCollapseByPrj() {
        try {
            List<CountEntity> list = reportService.countGroundCollapseByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计高陡边坡个数")
    @GetMapping(value = "/countHighSteepSlopeByPrj")
    public ResponseMsg<Object> countHighSteepSlopeByPrj() {
        try {
            List<CountEntity> list = reportService.countHighSteepSlopeByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计滑坡个数")
    @GetMapping(value = "/countLandSlideByPrj")
    public ResponseMsg<Object> countLandSlideByPrj() {
        try {
            List<CountEntity> list = reportService.countLandSlideByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计不稳定斜坡个数")
    @GetMapping(value = "/countUnstableSlopeByPrj")
    public ResponseMsg<Object> countUnstableSlopeByPrj() {
        try {
            List<CountEntity> list = reportService.countUnstableSlopeByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计水毁个数")
    @GetMapping(value = "/countWaterDamageByPrj")
    public ResponseMsg<Object> countWaterDamageByPrj() {
        try {
            List<CountEntity> list = reportService.countWaterDamageByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计数字线划图面积")
    @GetMapping(value = "/countDlgAreaByPrj")
    public ResponseMsg<Object> countDlgAreaByPrj() {
        try {
            List<CountEntity> list = reportService.countDlgAreaByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计数字正射影像图面积")
    @GetMapping(value = "/countDomAreaByPrj")
    public ResponseMsg<Object> countDomAreaByPrj() {
        try {
            List<CountEntity> list = reportService.countDomAreaByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计管线长度")
    @GetMapping(value = "/countLineLength")
    public ResponseMsg<Object> countLineLength() {
        try {
            List<CountEntity> list = reportService.countLineLength();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计勘探点个数")
    @GetMapping(value = "/countExplorationPointByPrj")
    public ResponseMsg<Object> countExplorationPointByPrj() {
        try {
            List<CountEntity> list = reportService.countExplorationPointByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计三维地质模型面积")
    @GetMapping(value = "/countGeoModelAreaByPrj")
    public ResponseMsg<Object> countGeoModelAreaByPrj() {
        try {
            List<CountEntity> list = reportService.countGeoModelAreaByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计地灾点个数")
    @GetMapping(value = "/countGeologicHazardByPrj")
    public ResponseMsg<Object> countGeologicHazardByPrj() {
        try {
            List<CountEntity> list = reportService.countGeologicHazardByPrj();
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
 
    @SysLog()
    @ApiOperation(value = "按项目统计各类数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", value = "项目编码", dataType = "String", paramType = "query", example = "0B")
    })
    @GetMapping(value = "/countVariousDataByPrj")
    public ResponseMsg<Object> countVariousDataByPrj(String code) {
        try {
            if (StringHelper.isEmpty(code)) {
                return fail("项目编码不能为空");
            }
 
            List<CountEntity> list = reportService.countVariousDataByPrj(code);
 
            return success(list);
        } catch (Exception ex) {
            return fail(ex, null);
        }
    }
}