liujie
2026-01-24 3474825ce00fe0949dcbc1baff294f52d426ccbd
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
package com.ruoyi.system.service.impl;
 
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.mapper.DeviceUsageMapper;
import com.ruoyi.system.model.DeviceUsage;
import com.ruoyi.system.model.Record;
import com.ruoyi.system.query.*;
import com.ruoyi.system.service.DeviceUsageService;
import com.ruoyi.system.vo.*;
import com.ruoyi.system.vo.DeviceCountVo;
import com.ruoyi.system.vo.DeviceListVo;
import org.springframework.stereotype.Service;
 
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author administrator
 * @since 2026-01-13
 */
@Service
public class DeviceUsageServiceImpl extends ServiceImpl<DeviceUsageMapper, DeviceUsage> implements DeviceUsageService {
 
    @Override
    public List<String> getDeviceUsageList(Integer id) {
        return this.baseMapper.getDeviceUsageList(id);
    }
 
    @Override
    public List<DeviceListVo> getDeviceList(Page<DeviceListVo> page, DeviceListQuery query) {
        List<DeviceListVo> deviceList = this.baseMapper.getDeviceList(page, query);
        for (DeviceListVo deviceListVo : deviceList) {
            LocalDateTime checkTime = deviceListVo.getCheckTime();
            // 判断checkTime是否是本月的时间
            if (checkTime != null && YearMonth.from(checkTime).equals(YearMonth.now())) {
                deviceListVo.setCheckResult("已检查");
            }else {
                deviceListVo.setCheckResult("未检查");
            }
        }
        return deviceList;
    }
 
    @Override
    public List<DeviceCountVo> getProjectDeviceCount(Integer id) {
        return this.baseMapper.getProjectDeviceCount(id);
    }
 
    @Override
    public List<EntrustProjectVo> projectList( Page<EntrustProjectVo> page,EntrustListQuery query) {
        Integer pageNum = query.getPageNum();
        Integer pageSize = query.getPageSize();
        List<EntrustProjectVo> deviceList = this.baseMapper.projectList(page,query);
        for (EntrustProjectVo deviceListVo : deviceList) {
            LocalDateTime checkTime = deviceListVo.getCheckTime();
            // 判断checkTime是否是本月的时间
            if (checkTime != null && YearMonth.from(checkTime).equals(YearMonth.now())) {
                deviceListVo.setCheckResult("已检查");
            }else {
                deviceListVo.setCheckResult("未检查");
            }
        }
        return deviceList;
    }
 
    @Override
    public List<EntrustProjectReportVo> projectReport(Page<EntrustProjectReportVo> page, ProjectReportListQuery query) {
        List<EntrustProjectReportVo> entrustProjectReportVoList = this.baseMapper.projectReport(page,query);
        return entrustProjectReportVoList;
    }
 
    @Override
    public List<EntrustDeviceListVo> deviceList(Page<EntrustDeviceListVo> page, EntrustDeviceListQuery query) {
        List<EntrustDeviceListVo> deviceList = this.baseMapper.deviceList(page, query);
        for (EntrustDeviceListVo deviceListVo : deviceList) {
            LocalDateTime checkTime = deviceListVo.getCheckTime();
            // 判断checkTime是否是本月的时间
            if (checkTime != null && YearMonth.from(checkTime).equals(YearMonth.now())) {
                deviceListVo.setCheckResult("已检查");
            }else {
                deviceListVo.setCheckResult("未检查");
            }
        }
        return deviceList;
    }
 
    @Override
    public List<ErrorListVo> errorList(Page<ErrorListVo> page, ErrorListQuery query) {
        List<ErrorListVo> errorList = this.baseMapper.errorList(page, query);
        return errorList;
    }
 
    @Override
    public List<ErrorListVo> deviceErrorList(Page<ErrorListVo> page, ErrorListQuery query) {
        List<ErrorListVo> errorList = this.baseMapper.deviceErrorList(page, query);
        return errorList;    }
 
    @Override
    public List<ErrorListVo> safetyErrorList(Page<ErrorListVo> page, ErrorListQuery query) {
        List<ErrorListVo> errorList = this.baseMapper.safetyErrorList(page, query);
        return errorList;    }
 
 
}