Browse Source

设备有关积木报表新增根据分厂、各线、设备名称过滤数据

lingpeng.li 5 months ago
parent
commit
9f31d1ec2a

+ 2 - 2
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/controller/FpgLeanModelController.java

@@ -254,9 +254,9 @@ public class FpgLeanModelController extends JeecgController<FpgLeanModel, IFpgLe
 
     @ApiOperation(value = "总用电量报表", notes = "总用电量报表")
     @GetMapping(value = "/totalElectricityConsumptionReport")
-    public JSONObject totalElectricityConsumptionReport() {
+    public JSONObject totalElectricityConsumptionReport(ExportQueryDTO queryDTO) {
 
-        JSONObject result = fpgLeanModelService.totalElectricityConsumptionReport();
+        JSONObject result = fpgLeanModelService.totalElectricityConsumptionReport(queryDTO);
 
         return result;
     }

+ 3 - 0
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/entity/ElectricityControlReport.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.fpgLeanModel.entity;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
 
@@ -16,6 +17,8 @@ public class ElectricityControlReport {
 
     @ApiModelProperty(value = "设备名称")
     private String deviceTitle;
+    @ApiModelProperty(value = "设备编码")
+    private String deviceCode;
     @ApiModelProperty(value = "区域名称")
     private String regionTitle;
     @ApiModelProperty(value = "各线名称")

+ 6 - 0
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/entity/ExportQueryDTO.java

@@ -15,4 +15,10 @@ public class ExportQueryDTO {
 
     private String year;
 
+    private String deviceTitle;
+
+    private String regionTitle;
+
+    private String deviceTypeName;
+
 }

+ 5 - 1
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/entity/ModelReportFormResult.java

@@ -9,6 +9,9 @@ import java.math.BigDecimal;
 public class ModelReportFormResult {
     @ApiModelProperty(value = "设备名称")
     private String deviceTitle;
+
+    @ApiModelProperty(value = "设备编码")
+    private String deviceCode;
     /**
      * 采集点ID
      */
@@ -155,8 +158,9 @@ public class ModelReportFormResult {
     private String companyName;
 
 
-    public ModelReportFormResult(String deviceTitle, String devicePointId, String deviceRegionId, String deviceInformationId, BigDecimal ingTime, BigDecimal selectricCurrent, BigDecimal power, BigDecimal topsPower, BigDecimal peaksPower, BigDecimal flatPower, BigDecimal valleysPower, BigDecimal topsIngTime, BigDecimal peaksIngTime, BigDecimal flatIngTime, BigDecimal valleysIngTime, BigDecimal topsSelectricCurrent, BigDecimal peaksSelectricCurrent, BigDecimal flatSelectricCurrent, BigDecimal valleysSelectricCurrent, BigDecimal topsProportion, BigDecimal peaksProportion, BigDecimal flatProportion, BigDecimal valleysProportion, Integer proportion, String dates, String createTime, String regionName, String deviceTypeName,String companyName) {
+    public ModelReportFormResult(String deviceTitle, String deviceCode, String devicePointId, String deviceRegionId, String deviceInformationId, BigDecimal ingTime, BigDecimal selectricCurrent, BigDecimal power, BigDecimal topsPower, BigDecimal peaksPower, BigDecimal flatPower, BigDecimal valleysPower, BigDecimal topsIngTime, BigDecimal peaksIngTime, BigDecimal flatIngTime, BigDecimal valleysIngTime, BigDecimal topsSelectricCurrent, BigDecimal peaksSelectricCurrent, BigDecimal flatSelectricCurrent, BigDecimal valleysSelectricCurrent, BigDecimal topsProportion, BigDecimal peaksProportion, BigDecimal flatProportion, BigDecimal valleysProportion, Integer proportion, String dates, String createTime, String regionName, String deviceTypeName, String companyName) {
         this.deviceTitle = deviceTitle;
+        this.deviceCode = deviceCode;
         this.devicePointId = devicePointId;
         this.deviceRegionId = deviceRegionId;
         this.deviceInformationId = deviceInformationId;

+ 1 - 1
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/service/IFpgLeanModelService.java

@@ -23,7 +23,7 @@ public interface IFpgLeanModelService extends IService<FpgLeanModel> {
 
     JSONObject queryFpgPowerDataByLeanModelCode(String leanModelCode);
 
-    JSONObject totalElectricityConsumptionReport();
+    JSONObject totalElectricityConsumptionReport(ExportQueryDTO queryDTO);
 
     JSONObject electricityControl(ExportQueryDTO queryDTO);
 

+ 171 - 15
zgztBus/jeecg-module-lesm/src/main/java/org/jeecg/modules/fpgLeanModel/service/impl/FpgLeanModelServiceImpl.java

@@ -212,7 +212,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                     if (a != null) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
-                        return new ModelReportFormResult(a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                        return new ModelReportFormResult(a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -309,12 +309,44 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
     }
 
     @Override
-    public JSONObject totalElectricityConsumptionReport() {
+    public JSONObject totalElectricityConsumptionReport(ExportQueryDTO queryDTO) {
 
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
+        List<String> deviceCollect = new ArrayList<>();
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTitle())) {
+            LambdaQueryWrapper<DeviceInformation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.like(DeviceInformation::getDeviceTitle, queryDTO.getDeviceTitle());
+            List<DeviceInformation> informationList = deviceInformationMapper.selectList(lambdaQueryWrapper);
+
+            deviceCollect = informationList.stream().map(DeviceInformation::getId).collect(Collectors.toList());
+        }
+
+
+        String regionId = null;
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getRegionTitle())) {
+            LambdaQueryWrapper<DeviceRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            regionLambdaQueryWrapper.eq(DeviceRegion::getRegionTitle, queryDTO.getRegionTitle());
+            DeviceRegion deviceRegion = deviceRegionMapper.selectOne(regionLambdaQueryWrapper);
+            if (oConvertUtils.isNotEmpty(deviceRegion)) {
+                regionId = deviceRegion.getId();
+            }
+        }
+
+
         JSONObject result = new JSONObject();
         Query query = new Query();
+        // 添加过滤条件:根据区域名称去过滤
+        if (oConvertUtils.isNotEmpty(regionId)) {
+            query.addCriteria(Criteria.where("deviceRegionId").is(regionId));
+        }
+
+        // 添加过滤条件:根据设备名称去过滤
+        if (!CollectionUtils.isEmpty(deviceCollect)) {
+            query.addCriteria(Criteria.where("deviceInformationId").in(deviceCollect));
+        }
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
         List<DeviceStatiscsModelMongodb> fpgStatiscsModelDataList = mongoTemplate.find(query, DeviceStatiscsModelMongodb.class, "total_day_powerproportioncurrent");
 
@@ -365,7 +397,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                     if (a != null) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
-                        return new ModelReportFormResult(a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                        return new ModelReportFormResult(a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -434,6 +466,13 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                 modelDataResults.add(modelDataResult);
             }
         }
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTypeName())) {
+            modelDataResults = modelDataResults.stream()
+                    .filter(report -> report.getDeviceTypeName().contains(queryDTO.getDeviceTypeName()))
+                    .collect(Collectors.toList());
+        }
+
         jsonResult = JSON.parseArray(JSON.toJSONString(modelDataResults));
 
         log.info("{}{}", "积木报表导出总数:", jsonResult.size());
@@ -448,6 +487,28 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
+        List<String> deviceCollect = new ArrayList<>();
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTitle())) {
+            LambdaQueryWrapper<DeviceInformation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.like(DeviceInformation::getDeviceTitle, queryDTO.getDeviceTitle());
+            List<DeviceInformation> informationList = deviceInformationMapper.selectList(lambdaQueryWrapper);
+
+            deviceCollect = informationList.stream().map(DeviceInformation::getId).collect(Collectors.toList());
+        }
+
+
+        String regionId = null;
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getRegionTitle())) {
+            LambdaQueryWrapper<DeviceRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            regionLambdaQueryWrapper.eq(DeviceRegion::getRegionTitle, queryDTO.getRegionTitle());
+            DeviceRegion deviceRegion = deviceRegionMapper.selectOne(regionLambdaQueryWrapper);
+            if (oConvertUtils.isNotEmpty(deviceRegion)) {
+                regionId = deviceRegion.getId();
+            }
+        }
+
         JSONObject result = new JSONObject();
         Query query = new Query();
         // 根据 queryDTO 中的 month 字段动态设置日期范围过滤
@@ -465,6 +526,16 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
             endDate = startDate.plusMonths(1); // 下个月的第一天
         }
 
+        // 添加过滤条件:根据区域名称去过滤
+        if (oConvertUtils.isNotEmpty(regionId)) {
+            query.addCriteria(Criteria.where("deviceRegionId").is(regionId));
+        }
+
+        // 添加过滤条件:根据设备名称去过滤
+        if (!CollectionUtils.isEmpty(deviceCollect)) {
+            query.addCriteria(Criteria.where("deviceInformationId").in(deviceCollect));
+        }
+
         // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
         query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
 
@@ -519,7 +590,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                     if (a != null) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
-                        return new ModelReportFormResult(a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                        return new ModelReportFormResult(a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -538,6 +609,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
 
             // 先获取公共属性值,避免在循环内多次重复获取
             String deviceTitle = modelReportFormResult.getDeviceTitle();
+            String deviceCode = modelReportFormResult.getDeviceCode();
             String deviceRegionId = modelReportFormResult.getDeviceRegionId();
             String deviceInformationId = modelReportFormResult.getDeviceInformationId();
             String createTime = modelReportFormResult.getDates();
@@ -652,6 +724,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                 String formattedDate = date.getYear() + "年" + date.getMonthValue() + "月";
 
                 modelDataResult.setDeviceTitle(deviceTitle);
+                modelDataResult.setDeviceCode(deviceCode);
                 modelDataResult.setDeviceRegionId(deviceRegionId);
                 modelDataResult.setDeviceInformationId(deviceInformationId);
                 modelDataResult.setCreateTime(createTime);
@@ -781,6 +854,12 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
             finalResult.addAll(groupedData);
         }
 
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTypeName())) {
+            finalResult = finalResult.stream()
+                    .filter(report -> report.getDeviceTypeName().contains(queryDTO.getDeviceTypeName()))
+                    .collect(Collectors.toList());
+        }
+
 
         jsonResult = JSON.parseArray(JSON.toJSONString(finalResult));
 
@@ -794,6 +873,28 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
+        List<String> deviceCollect = new ArrayList<>();
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTitle())) {
+            LambdaQueryWrapper<DeviceInformation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.like(DeviceInformation::getDeviceTitle, queryDTO.getDeviceTitle());
+            List<DeviceInformation> informationList = deviceInformationMapper.selectList(lambdaQueryWrapper);
+
+            deviceCollect = informationList.stream().map(DeviceInformation::getId).collect(Collectors.toList());
+        }
+
+
+        String regionId = null;
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getRegionTitle())) {
+            LambdaQueryWrapper<DeviceRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            regionLambdaQueryWrapper.eq(DeviceRegion::getRegionTitle, queryDTO.getRegionTitle());
+            DeviceRegion deviceRegion = deviceRegionMapper.selectOne(regionLambdaQueryWrapper);
+            if (oConvertUtils.isNotEmpty(deviceRegion)) {
+                regionId = deviceRegion.getId();
+            }
+        }
+
         JSONObject result = new JSONObject();
         Query query = new Query();
 
@@ -811,6 +912,16 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
             endDate = startDate.plusMonths(1); // 下个月的第一天
         }
 
+        // 添加过滤条件:根据区域名称去过滤
+        if (oConvertUtils.isNotEmpty(regionId)) {
+            query.addCriteria(Criteria.where("deviceRegionId").is(regionId));
+        }
+
+        // 添加过滤条件:根据设备名称去过滤
+        if (!CollectionUtils.isEmpty(deviceCollect)) {
+            query.addCriteria(Criteria.where("deviceInformationId").in(deviceCollect));
+        }
+
         // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
         query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
 
@@ -865,7 +976,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                     if (a != null) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
-                        return new ModelReportFormResult(a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                        return new ModelReportFormResult(a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -882,6 +993,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
 
             // 先获取公共属性值,避免在循环内多次重复获取
             String deviceTitle = modelReportFormResult.getDeviceTitle();
+            String deviceCode = modelReportFormResult.getDeviceCode();
             String deviceRegionId = modelReportFormResult.getDeviceRegionId();
             String deviceInformationId = modelReportFormResult.getDeviceInformationId();
             String createTime = modelReportFormResult.getDates();
@@ -928,6 +1040,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                 String formattedDate = date.getYear() + "年" + date.getMonthValue() + "月";
 
                 modelDataResult.setDeviceTitle(deviceTitle);
+                modelDataResult.setDeviceCode(deviceCode);
                 modelDataResult.setDeviceRegionId(deviceRegionId);
                 modelDataResult.setDeviceInformationId(deviceInformationId);
                 modelDataResult.setCreateTime(createTime);
@@ -1077,6 +1190,12 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
 
         });
 
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTypeName())) {
+            finalResult = finalResult.stream()
+                    .filter(report -> report.getDeviceTypeName().contains(queryDTO.getDeviceTypeName()))
+                    .collect(Collectors.toList());
+        }
+
         jsonResult = JSON.parseArray(JSON.toJSONString(finalResult));
 
         log.info("{}{}", "积木报表导出总数:", jsonResult.size());
@@ -1591,6 +1710,28 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
         // 定义日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 
+        List<String> deviceCollect = new ArrayList<>();
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTitle())) {
+            LambdaQueryWrapper<DeviceInformation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.like(DeviceInformation::getDeviceTitle, queryDTO.getDeviceTitle());
+            List<DeviceInformation> informationList = deviceInformationMapper.selectList(lambdaQueryWrapper);
+
+            deviceCollect = informationList.stream().map(DeviceInformation::getId).collect(Collectors.toList());
+        }
+
+
+        String regionId = null;
+
+        if (oConvertUtils.isNotEmpty(queryDTO.getRegionTitle())) {
+            LambdaQueryWrapper<DeviceRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            regionLambdaQueryWrapper.eq(DeviceRegion::getRegionTitle, queryDTO.getRegionTitle());
+            DeviceRegion deviceRegion = deviceRegionMapper.selectOne(regionLambdaQueryWrapper);
+            if (oConvertUtils.isNotEmpty(deviceRegion)) {
+                regionId = deviceRegion.getId();
+            }
+        }
+
         JSONObject result = new JSONObject();
         Query query = new Query();
         query.with(Sort.by(Sort.Direction.ASC, "createTime"));
@@ -1611,6 +1752,16 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
             endDate = startDate.plusYears(1); // 下一年的第一天
         }
 
+        // 添加过滤条件:根据区域名称去过滤
+        if (oConvertUtils.isNotEmpty(regionId)) {
+            query.addCriteria(Criteria.where("deviceRegionId").is(regionId));
+        }
+
+        // 添加过滤条件:根据设备名称去过滤
+        if (!CollectionUtils.isEmpty(deviceCollect)) {
+            query.addCriteria(Criteria.where("deviceInformationId").in(deviceCollect));
+        }
+
         // 添加过滤条件:dates 字段在 startDate 和 endDate 之间
         query.addCriteria(Criteria.where("dates").gte(startDate.format(formatter)).lt(endDate.format(formatter)));
 
@@ -1663,7 +1814,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                     if (a != null) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
-                        return new ModelReportFormResult(a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                        return new ModelReportFormResult(a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -1763,6 +1914,11 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
             }
         });
 
+        if (oConvertUtils.isNotEmpty(queryDTO.getDeviceTypeName())) {
+            modelDataResults = modelDataResults.stream()
+                    .filter(report -> report.getDeviceTypeName().contains(queryDTO.getDeviceTypeName()))
+                    .collect(Collectors.toList());
+        }
 
         JSONArray jsonResult = new JSONArray();
         jsonResult = JSON.parseArray(JSON.toJSONString(modelDataResults));
@@ -2342,7 +2498,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                     if (a != null) {
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
-                        return new ModelReportFormResult(a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                        return new ModelReportFormResult(a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -2738,7 +2894,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -2910,7 +3066,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -3053,7 +3209,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -3170,7 +3326,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                deviceInfo.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                deviceInfo.getDeviceTitle(), deviceInfo.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -3302,7 +3458,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -3429,7 +3585,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -3570,7 +3726,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),
@@ -3710,7 +3866,7 @@ public class FpgLeanModelServiceImpl extends ServiceImpl<FpgLeanModelMapper, Fpg
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                         String dateString = sdf.format(b.getCreateTime());
                         return new ModelReportFormResult(
-                                a.getDeviceTitle(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
+                                a.getDeviceTitle(), a.getDeviceCode(), b.getDevicePointId(), b.getDeviceRegionId(), b.getDeviceInformationId(),
                                 b.getIngTime(), b.getSelectricCurrent(), b.getPower(), b.getTopsPower(), b.getPeaksPower(), b.getFlatPower(), b.getValleysPower(),
                                 b.getTopsIngTime(), b.getPeaksIngTime(), b.getFlatIngTime(), b.getValleysIngTime(),
                                 b.getTopsSelectricCurrent(), b.getPeaksSelectricCurrent(), b.getFlatSelectricCurrent(), b.getValleysSelectricCurrent(),