郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
package com.gkhy.safePlatform.doublePrevention.service.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkhy.safePlatform.account.rpc.apimodel.AccountAuthService;
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.UserRPCRespDTO;
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.enums.E;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.exception.AusinessException;
import com.gkhy.safePlatform.commons.exception.BusinessException;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.doublePrevention.entity.*;
import com.gkhy.safePlatform.doublePrevention.entity.dto.report.req.*;
import com.gkhy.safePlatform.doublePrevention.entity.dto.report.resp.*;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventReportConfigLogQueryReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventReportConfigUpdateReqDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.resp.PreventReportConfigLogQueryRespDTO;
import com.gkhy.safePlatform.doublePrevention.entity.dto.resp.PreventReportConfigQueryRespDTO;
import com.gkhy.safePlatform.doublePrevention.repository.param.PreventReportConfigUpdateParams;
import com.gkhy.safePlatform.doublePrevention.service.ReportService;
import com.gkhy.safePlatform.doublePrevention.service.baseService.*;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
@Service
public class ReportServiceImpl implements ReportService {
 
    @DubboReference(check = false)
    private AccountAuthService accountAuthService;
 
    @Autowired
    private PreventReportConfigService preventReportConfigService;
    @Autowired
    private PreventReportConfigLogService preventReportConfigLogService;
    @Autowired
    private PreventReportRiskAnaUnitService riskAnaUnitService;
    @Autowired
    private PreventReportRiskEventService eventService;
    @Autowired
    private PreventReportRiskControlMeasureService measureService;
    @Autowired
    private PreventReportCheckTaskFromWorkService taskFromWorkService;
    @Autowired
    private PreventReportCheckRecordFromTaskService taskService;
    @Autowired
    private PreventReportDangerInfoService dangerInfoService;
 
    /**
     * 数据上报配置-查询
     */
    @Override
    public ResultVO<PreventReportConfig> getReportConfig(Long userId) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
 
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(userId);
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        //查询配置
        List<PreventReportConfig> configList= preventReportConfigService.ListReportConfigs();
        //封装DTO
        List<PreventReportConfigQueryRespDTO> respDTO = BeanCopyUtils.copyBeanList(configList, PreventReportConfigQueryRespDTO.class);
        //封装返回数据
        resultVO.setCount(respDTO.size());
        resultVO.setData(respDTO);
 
        return resultVO;
    }
 
    /**
     * 数据上报配置-修改
     */
    @Transactional
    @Override
    public ResultVO<PreventReportConfig> updateReportConfig(Long userId, PreventReportConfigUpdateReqDTO updateReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("修改成功");
 
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(userId);
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        //封装修改参数
        PreventReportConfigUpdateParams updateParams = BeanCopyUtils.copyBean(updateReqDTO, PreventReportConfigUpdateParams.class);
        updateParams.setGmtModitify(new Date());
        updateParams.setLastEditUserName(userById.getRealName());
        //按照id查询配置,并保存历史记录
        String updateInfo = null;
        if (step ==1){
            PreventReportConfig oldReportConfigById = preventReportConfigService.getReportConfigById(updateReqDTO.getId());
            if (oldReportConfigById.getReportState().equals(updateReqDTO.getReportState())
                    && oldReportConfigById.getReportType().equals(updateReqDTO.getReportType()) ){
                throw new AusinessException(E.DATA_PARAM_CHECK_INVALID, "与当前配置相同,无需修改");
            }
            //取出数据,存入log表
            PreventReportConfigLog preventReportConfigLog = new PreventReportConfigLog();
            //封装log表参数
            preventReportConfigLog.setReportState(oldReportConfigById.getReportState());
            preventReportConfigLog.setReportType(oldReportConfigById.getReportType());
            preventReportConfigLog.setReportData(oldReportConfigById.getReportData());
            preventReportConfigLog.setReportDataName(oldReportConfigById.getReportDataName());
            preventReportConfigLog.setLastEditUserName(oldReportConfigById.getLastEditUserName());
            preventReportConfigLog.setGmtModitify(oldReportConfigById.getGmtModitify());
            //插入数据进log表
            int i = preventReportConfigLogService.insertOldReportConfig(preventReportConfigLog);
            if (i < 1){
                throw new AusinessException(E.UPDATE_FAIL, "历史记录保存失败");
            }
            step = 2;
        }
        //修改配置信息
        if (step == 2){
            int result = preventReportConfigService.updateReportConfig(updateParams);
            if (result < 1){
                throw new AusinessException(E.UPDATE_FAIL, "修改配置失败");
            }
            resultVO.setCount(result);
        }
 
        return resultVO;
    }
 
    /**
     * 数据上报配置历史记录-查询
     */
    @Override
    public ResultVO<PreventReportConfigLog> getReportConfigLogPage(Long userId, PreventReportConfigLogQueryReqDTO queryReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
 
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(userId);
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
 
        //获取到所有符合条件任务
        IPage<PreventReportConfigLog> page =
                preventReportConfigLogService.getReportConfigLogPage(new Page<>(queryReqDTO.getPageIndex(), queryReqDTO.getPageSize()), queryReqDTO);
        //获取返回前端对象集合,封装DTO数据
        List<PreventReportConfigLogQueryRespDTO> list = new ArrayList<>();
        for (PreventReportConfigLog record : page.getRecords()) {
            PreventReportConfigLogQueryRespDTO respDTO = BeanCopyUtils.copyBean(record, PreventReportConfigLogQueryRespDTO.class);
            respDTO.setPageIndex((int) page.getCurrent());
            respDTO.setPageSize((int) page.getSize());
            list.add(respDTO);
        }
        resultVO.setCount((int) page.getTotal());
        resultVO.setData(list);
 
        return resultVO;
    }
 
 
    /**
     * 上报数据-风险分析单元-分页查询
     */
    @Override
    public ResultVO<PreventReportRiskAnaUnit> getReportRiskUnitPage(ContextCacheUser currentUser, PreReportRiskUnitQueryReqDTO queryReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
        Integer pageIndex = queryReqDTO.getPageIndex();
        Integer pageSize = queryReqDTO.getPageSize();
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(currentUser.getUid());
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        List<PreReportRiskUnitQueryRespDTO> list = new ArrayList<>();
        //分页查询
        IPage<PreventReportRiskAnaUnit> page = riskAnaUnitService.getReportRiskUnitPage(new Page<>(pageIndex, pageSize), queryReqDTO);
        for (PreventReportRiskAnaUnit record : page.getRecords()) {
            PreReportRiskUnitQueryRespDTO respDTO = BeanCopyUtils.copyBean(record, PreReportRiskUnitQueryRespDTO.class);
            respDTO.setPageIndex((int) page.getCurrent());
            respDTO.setPageSize((int) page.getSize());
            list.add(respDTO);
        }
        resultVO.setCount((int) page.getTotal());
        resultVO.setData(list);
        return resultVO;
    }
 
    /**
     * 上报数据-事件-分页查询
     */
    @Override
    public ResultVO<PreventReportRiskEvent> getReportEventPage(ContextCacheUser currentUser, PreReportRiskEventQueryReqDTO queryReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
        Integer pageIndex = queryReqDTO.getPageIndex();
        Integer pageSize = queryReqDTO.getPageSize();
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(currentUser.getUid());
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        List<PreReportRiskEventQueryRespDTO> list = new ArrayList<>();
        //分页查询
        IPage<PreventReportRiskEvent> page = eventService.getReportRiskEventPage(new Page<>(pageIndex, pageSize), queryReqDTO);
        for (PreventReportRiskEvent record : page.getRecords()) {
            PreReportRiskEventQueryRespDTO respDTO = BeanCopyUtils.copyBean(record, PreReportRiskEventQueryRespDTO.class);
            respDTO.setPageIndex((int) page.getCurrent());
            respDTO.setPageSize((int) page.getSize());
            list.add(respDTO);
        }
        resultVO.setCount((int) page.getTotal());
        resultVO.setData(list);
        return resultVO;
    }
 
    /**
     * 上报数据-管控措施-分页查询
     */
    @Override
    public ResultVO<PreventReportRiskControlMeasure> getReportMeasurePage(ContextCacheUser currentUser, PreventReportRiskControlMeasureReqDTO queryReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
        Integer pageIndex = queryReqDTO.getPageIndex();
        Integer pageSize = queryReqDTO.getPageSize();
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(currentUser.getUid());
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        List<PreventReportRiskControlMeasureRespDTO> list = new ArrayList<>();
        //分页查询
        IPage<PreventReportRiskControlMeasure> page = measureService.getReportMeasurePage(new Page<>(pageIndex, pageSize), queryReqDTO);
        for (PreventReportRiskControlMeasure record : page.getRecords()) {
            PreventReportRiskControlMeasureRespDTO respDTO = BeanCopyUtils.copyBean(record, PreventReportRiskControlMeasureRespDTO.class);
            respDTO.setPageIndex((int) page.getCurrent());
            respDTO.setPageSize((int) page.getSize());
            list.add(respDTO);
        }
        resultVO.setCount((int) page.getTotal());
        resultVO.setData(list);
        return resultVO;
    }
 
    /**
     * 上报数据-任务配置-分页查询
     */
    @Override
    public ResultVO<PreventReportCheckTaskFromWork> getReportTaskFromWorkPage(ContextCacheUser currentUser, PreventReportCheckTaskFromWorkReqDTO queryReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
        Integer pageIndex = queryReqDTO.getPageIndex();
        Integer pageSize = queryReqDTO.getPageSize();
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(currentUser.getUid());
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        List<PreventReportCheckTaskFromWorkRespDTO> list = new ArrayList<>();
        //分页查询
        IPage<PreventReportCheckTaskFromWork> page = taskFromWorkService.getReportTaskFromWorkPage(new Page<>(pageIndex, pageSize), queryReqDTO);
        for (PreventReportCheckTaskFromWork record : page.getRecords()) {
            PreventReportCheckTaskFromWorkRespDTO respDTO = BeanCopyUtils.copyBean(record, PreventReportCheckTaskFromWorkRespDTO.class);
            respDTO.setPageIndex((int) page.getCurrent());
            respDTO.setPageSize((int) page.getSize());
            list.add(respDTO);
        }
        resultVO.setCount((int) page.getTotal());
        resultVO.setData(list);
        return resultVO;
    }
 
    /**
     * 上报数据-任务记录-分页查询
     */
    @Override
    public ResultVO<PreventReportCheckRecordFromTask> getRecordFromTaskPage(ContextCacheUser currentUser, PreventReportCheckRecordFromTaskReqDTO queryReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
        Integer pageIndex = queryReqDTO.getPageIndex();
        Integer pageSize = queryReqDTO.getPageSize();
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(currentUser.getUid());
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        List<PreventReportCheckRecordFromTaskRespDTO> list = new ArrayList<>();
        //分页查询
        IPage<PreventReportCheckRecordFromTask> page = taskService.getReportTaskFromWorkPage(new Page<>(pageIndex, pageSize), queryReqDTO);
        for (PreventReportCheckRecordFromTask record : page.getRecords()) {
            PreventReportCheckRecordFromTaskRespDTO respDTO = BeanCopyUtils.copyBean(record, PreventReportCheckRecordFromTaskRespDTO.class);
            respDTO.setPageIndex((int) page.getCurrent());
            respDTO.setPageSize((int) page.getSize());
            list.add(respDTO);
        }
        resultVO.setCount((int) page.getTotal());
        resultVO.setData(list);
        return resultVO;
    }
 
    /**
     * 上报数据-隐患信息-分页查询
     */
    @Override
    public ResultVO<PreventReportDangerInfo> getReportDangerInfoPage(ContextCacheUser currentUser, PreventReportDangerInfoReqDTO queryReqDTO) {
 
        ResultVO resultVO = new ResultVO<>();
        resultVO.setCode("200");
        resultVO.setMsg("查询成功");
        Integer pageIndex = queryReqDTO.getPageIndex();
        Integer pageSize = queryReqDTO.getPageSize();
        int step = 1;
        //获取用户信息,校验
        ResultVO<UserRPCRespDTO> rpcResult = accountAuthService.getUserById(currentUser.getUid());
        if (rpcResult == null) {
            throw new BusinessException(ResultCodes.RPC_RESULT_NULL);
        }
        if (!ResultCodes.OK.getCode().equals(rpcResult.getCode())) {
            throw new BusinessException(rpcResult.getCode(), rpcResult.getMsg());
        }
        if (rpcResult.getData() == null) {
            throw new BusinessException(ResultCodes.RPC_DATA_NULL);
        }
        if (!(rpcResult.getData() instanceof UserRPCRespDTO)) {
            throw new BusinessException(ResultCodes.RPC_DATA_TYPE_NOT_MATCH);
        }
        UserRPCRespDTO userById = (UserRPCRespDTO)rpcResult.getData();
        if (ObjectUtils.isEmpty(userById)) {
            throw new BusinessException(ResultCodes.CLIENT_IDENTITY_CHECK_ERROR);
        }
        List<PreventReportDangerInfoRespDTO> list = new ArrayList<>();
        //分页查询
        IPage<PreventReportDangerInfo> page = dangerInfoService.getReportDangerInfoPage(new Page<>(pageIndex, pageSize), queryReqDTO);
        for (PreventReportDangerInfo record : page.getRecords()) {
            PreventReportDangerInfoRespDTO respDTO = BeanCopyUtils.copyBean(record, PreventReportDangerInfoRespDTO.class);
            respDTO.setPageIndex((int) page.getCurrent());
            respDTO.setPageSize((int) page.getSize());
            list.add(respDTO);
        }
        resultVO.setCount((int) page.getTotal());
        resultVO.setData(list);
        return resultVO;
    }
}