From 6701732c08bb8e5a20c5d7c2deb69c760344013d Mon Sep 17 00:00:00 2001
From: lius <Lius2225@163.com>
Date: 星期一, 31 七月 2023 15:40:06 +0800
Subject: [PATCH] 对比分析接口

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java               |   44 ++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java                             |   29 ++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java                              |   27 +++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java          |    9 +
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java                             |   33 ++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java                            |   20 ++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java                                |   21 +++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java |  107 +++++++++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java    |   11 +
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java            |   11 +
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java                  |   27 +++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java                      |   21 +++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml         |   27 +++
 13 files changed, 387 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java
index b597903..0e2413e 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java
@@ -7,6 +7,7 @@
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.mdc.dto.ComparativeAnalysisDto;
 import org.jeecg.modules.mdc.service.MdcEfficiencyReportService;
 import org.jeecg.modules.mdc.vo.*;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -68,4 +69,14 @@
         return Result.OK(result);
     }
 
+    @AutoLog(value = "璁惧鏁堢巼鎶ヨ〃-瀵规瘮鍒嗘瀽")
+    @ApiOperation(value = "璁惧鏁堢巼鎶ヨ〃-瀵规瘮鍒嗘瀽", notes = "璁惧鏁堢巼鎶ヨ〃-瀵规瘮鍒嗘瀽")
+    @GetMapping("/comparativeAnalysis")
+    public Result comparativeAnalysis(ComparativeAnalysisQueryVo vo) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+        ComparativeAnalysisDto result = mdcEfficiencyReportService.comparativeAnalysis(userId, vo);
+        return Result.OK(result);
+    }
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java
new file mode 100644
index 0000000..5317e7d
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java
@@ -0,0 +1,27 @@
+package org.jeecg.modules.mdc.dto;
+
+import javafx.scene.chart.PieChart;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author: LiuS
+ * @create: 2023-07-31 10:06
+ */
+@Data
+public class ComparativeAnalysisDto {
+
+    /**
+     * 鍥惧舰椤甸潰鏁版嵁
+     */
+    private List<GraphicsDto> graphics;
+    /**
+     * 浠〃椤甸潰鏁版嵁
+     */
+    private MeterDto meters;
+    /**
+     * 楗煎浘椤甸潰鏁版嵁
+     */
+    private PieChartDto pieCharts;
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java
new file mode 100644
index 0000000..696d8f3
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java
@@ -0,0 +1,33 @@
+package org.jeecg.modules.mdc.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author: LiuS
+ * @create: 2023-07-31 10:09
+ */
+@Data
+public class GraphicsDto {
+    /**
+     * 璁惧缂栫爜
+     */
+    private String equipmentId;
+    /**
+     * 鍒╃敤鐜�
+     */
+    private BigDecimal utilizationRate;
+    /**
+     * 寮�鏈虹巼
+     */
+    private BigDecimal openRate;
+    /**
+     * 寮�鏈烘椂闀�
+     */
+    private BigDecimal openLong;
+    /**
+     * 鍏虫満鏃堕暱
+     */
+    private BigDecimal closeLong;
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java
new file mode 100644
index 0000000..c96fb72
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java
@@ -0,0 +1,20 @@
+package org.jeecg.modules.mdc.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author: LiuS
+ * @create: 2023-07-31 14:08
+ */
+@Data
+public class MdcComAnaDto {
+
+    private String equipmentId;
+    private BigDecimal openLong;
+    private BigDecimal closeLong;
+    private BigDecimal waitLong;
+    private BigDecimal processLong;
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java
new file mode 100644
index 0000000..6f39ab4
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java
@@ -0,0 +1,21 @@
+package org.jeecg.modules.mdc.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author: LiuS
+ * @create: 2023-07-31 10:12
+ */
+@Data
+public class MeterDto {
+    /**
+     * 鍓嶄簲鎺掕
+     */
+    private List<UtilizationRateDto> tops;
+    /**
+     * 鍚庝簲鎺掕
+     */
+    private List<UtilizationRateDto> lasts;
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java
new file mode 100644
index 0000000..605809d
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java
@@ -0,0 +1,29 @@
+package org.jeecg.modules.mdc.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author: LiuS
+ * @create: 2023-07-31 10:16
+ */
+@Data
+public class PieChartDto {
+    /**
+     * 寮�鏈虹巼
+     */
+    private BigDecimal openRate;
+    /**
+     * 鍏虫満鐜�
+     */
+    private BigDecimal closeRate;
+    /**
+     * 鍔犲伐鐜�
+     */
+    private BigDecimal processRate;
+    /**
+     * 寰呮満鐜�
+     */
+    private BigDecimal waitRate;
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java
new file mode 100644
index 0000000..150fdf8
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java
@@ -0,0 +1,21 @@
+package org.jeecg.modules.mdc.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author: LiuS
+ * @create: 2023-07-31 10:13
+ */
+@Data
+public class UtilizationRateDto {
+    /**
+     * 璁惧缂栫爜
+     */
+    private String equipmentId;
+    /**
+     * 鍒╃敤鐜�
+     */
+    private BigDecimal utilizationRate;
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java
index f041ad2..95064b3 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java
@@ -1,8 +1,11 @@
 package org.jeecg.modules.mdc.mapper;
 
 import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.mdc.dto.MdcComAnaDto;
 import org.jeecg.modules.mdc.dto.MdcEfficiencyDto;
+import org.jeecg.modules.mdc.dto.MdcEfficiencyResultDto;
 import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo;
+import org.jeecg.modules.mdc.vo.ComparativeAnalysisQueryVo;
 import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo;
 import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo;
 
@@ -37,4 +40,12 @@
      * @return
      */
     List<MdcEquipmentStatisticalShiftInfo> efficiencyShiftSumList(@Param("vo") MdcEfficiencyReportShiftQueryVo vo);
+
+    /**
+     * 鏌ヨ鍘熷鏁版嵁
+     *
+     * @param vo
+     * @return
+     */
+    List<MdcComAnaDto> comparativeAnalysis(@Param("vo") ComparativeAnalysisQueryVo vo);
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
index 9c855df..c7b0eb8 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -111,4 +111,31 @@
         ORDER BY
             t1.the_date
     </select>
+
+    <!--鏌ヨ鍘熷鏁版嵁-->
+    <select id="comparativeAnalysis" resultType="org.jeecg.modules.mdc.dto.MdcComAnaDto">
+        SELECT
+            mesi.equipment_id equipmentId,
+            SUM ( mesi.open_long ) openLong,
+            SUM ( mesi.close_long ) closeLong,
+            SUM ( mesi.wait_long ) waitLong,
+            SUM ( mesi.process_long ) processLong
+        FROM
+            mdc_equipment_statistical_info mesi
+            LEFT JOIN mdc_equipment me ON mesi.equipment_id = me.equipment_id
+        <where>
+            <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 ">
+                AND mesi.equipment_id IN
+                <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
+                    #{ id }
+                </foreach>
+            </if>
+            <if test="vo.driveType != null and vo.driveType != null">
+                AND me.drive_type = #{ vo.driveType }
+            </if>
+            AND mesi.the_date BETWEEN #{ vo.startTime } AND #{ vo.endTime }
+        </where>
+        GROUP BY
+            mesi.equipment_id
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
index 3c3f982..b584468 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
@@ -1,5 +1,6 @@
 package org.jeecg.modules.mdc.service;
 
+import org.jeecg.modules.mdc.dto.ComparativeAnalysisDto;
 import org.jeecg.modules.mdc.vo.*;
 
 /**
@@ -44,4 +45,12 @@
      */
     StatisticalAnalysisVo dayStatisticalRate(String userId, MdcEfficiencyReportQueryVo vo);
 
+    /**
+     * 瀵规瘮鍒嗘瀽
+     *
+     * @param userId
+     * @param vo
+     * @return
+     */
+    ComparativeAnalysisDto comparativeAnalysis(String userId, ComparativeAnalysisQueryVo vo);
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
index 2fca558..e09c92c 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -1,7 +1,9 @@
 package org.jeecg.modules.mdc.service.impl;
 
+import com.alipay.api.domain.NewsfeedMediaGiftInfo;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.commons.lang3.StringUtils;
+import org.checkerframework.checker.units.qual.A;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.mdc.dto.*;
@@ -24,6 +26,11 @@
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -758,6 +765,106 @@
         return result;
     }
 
+    /**
+     * 瀵规瘮鍒嗘瀽
+     */
+    @Override
+    public ComparativeAnalysisDto comparativeAnalysis(String userId, ComparativeAnalysisQueryVo vo) {
+        ComparativeAnalysisDto result = new ComparativeAnalysisDto();
+        List<String> equipmentIds = new ArrayList<>();
+        if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) {
+            if ("2".equals(vo.getTypeTree())) {
+                // 閮ㄩ棬灞傜骇
+                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId());
+            } else {
+                // 浜х嚎灞傜骇
+                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId());
+            }
+        } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) {
+            // 鍗曞彴璁惧淇℃伅
+            vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId()));
+        } else {
+            // 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭�
+            if ("2".equals(vo.getTypeTree())) {
+                // 閮ㄩ棬灞傜骇
+                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
+            } else {
+                // 浜х嚎灞傜骇
+                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
+            }
+        }
+        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
+            vo.setEquipmentIdList(equipmentIds);
+        }
+        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
+            return result;
+        }
+
+        // 鏌ヨ鍘熷鏁版嵁
+        List<MdcComAnaDto> resultDtos = mdcEfficiencyReportMapper.comparativeAnalysis(vo);
+        if (resultDtos != null && !resultDtos.isEmpty()) {
+            // 缁勮鍥惧舰鍜屼华琛ㄦ暟鎹�
+            List<GraphicsDto> graphicsDtos = new ArrayList<>();
+            // 鑾峰彇澶╂暟
+            long days = ChronoUnit.DAYS.between(LocalDate.parse(vo.getStartTime(), DateTimeFormatter.ofPattern("yyyyMMdd")), LocalDate.parse(vo.getEndTime(), DateTimeFormatter.ofPattern("yyyyMMdd"))) + 1;
+            BigDecimal time = new BigDecimal("24").multiply(new BigDecimal(days));
+            for (MdcComAnaDto mdcComAnaDto : resultDtos) {
+                GraphicsDto graphicsDto = new GraphicsDto();
+                graphicsDto.setEquipmentId(mdcComAnaDto.getEquipmentId());
+                graphicsDto.setCloseLong(mdcComAnaDto.getCloseLong());
+                graphicsDto.setOpenLong(mdcComAnaDto.getOpenLong());
+                // 24灏忔椂鍒╃敤鐜� = 鍔犲伐鏃堕棿/24
+                graphicsDto.setUtilizationRate(mdcComAnaDto.getProcessLong().divide(time, 6, BigDecimal.ROUND_HALF_UP));
+                // 寮�鏈虹巼 = 寮�鏈烘椂闂� / 24
+                graphicsDto.setOpenRate(mdcComAnaDto.getOpenLong().divide(time, 6, BigDecimal.ROUND_HALF_UP));
+                graphicsDtos.add(graphicsDto);
+            }
+            result.setGraphics(graphicsDtos);
+
+            List<UtilizationRateDto> tops = new ArrayList<>();
+            List<UtilizationRateDto> lasts = new ArrayList<>();
+            graphicsDtos.stream().sorted(Comparator.comparing(GraphicsDto::getUtilizationRate)).limit(5).forEach(graphicsDto -> {
+                UtilizationRateDto utilizationRateDto = new UtilizationRateDto();
+                utilizationRateDto.setEquipmentId(graphicsDto.getEquipmentId());
+                utilizationRateDto.setUtilizationRate(graphicsDto.getUtilizationRate());
+                lasts.add(utilizationRateDto);
+            });
+            graphicsDtos.stream().sorted(Comparator.comparing(GraphicsDto::getUtilizationRate).reversed()).limit(5).forEach(graphicsDto -> {
+                UtilizationRateDto utilizationRateDto = new UtilizationRateDto();
+                utilizationRateDto.setEquipmentId(graphicsDto.getEquipmentId());
+                utilizationRateDto.setUtilizationRate(graphicsDto.getUtilizationRate());
+                tops.add(utilizationRateDto);
+            });
+            MeterDto meterDto = new MeterDto();
+            meterDto.setTops(tops);
+            meterDto.setLasts(lasts);
+            result.setMeters(meterDto);
+            // 缁勮楗煎浘鏁版嵁
+            PieChartDto pieChartDto = new PieChartDto();
+            BigDecimal openLong = new BigDecimal("0");
+            BigDecimal closeLong = new BigDecimal("0");
+            BigDecimal waitLong = new BigDecimal("0");
+            BigDecimal processLong = new BigDecimal("0");
+            for (MdcComAnaDto resultDto : resultDtos) {
+                openLong = openLong.add(resultDto.getOpenLong());
+                closeLong = closeLong.add(resultDto.getCloseLong());
+                waitLong = waitLong.add(resultDto.getWaitLong());
+                processLong = processLong.add(resultDto.getProcessLong());
+            }
+            // 寮�鏈虹巼 = 寮�鏈烘椂闀� / (24 脳 澶╂暟 脳 涓暟)
+            pieChartDto.setOpenRate(openLong.divide(time.multiply(new BigDecimal(resultDtos.size())), 6, BigDecimal.ROUND_HALF_UP));
+            // 鍏虫満鐜� = 1 - 寮�鏈虹巼
+            pieChartDto.setCloseRate(new BigDecimal("1").subtract(pieChartDto.getOpenRate()));
+            // 鍔犲伐鐜� = 鍔犲伐鏃堕棿 / (24 脳 澶╂暟 脳 涓暟)
+            pieChartDto.setProcessRate(processLong.divide(time.multiply(new BigDecimal(resultDtos.size())), 6, BigDecimal.ROUND_HALF_UP));
+            // 寰呮満鐜� = 寮�鏈虹巼 - 鍔犲伐鐜�
+            pieChartDto.setWaitRate(pieChartDto.getOpenRate().subtract(pieChartDto.getProcessRate()));
+            result.setPieCharts(pieChartDto);
+        }
+
+        return result;
+    }
+
     private StatisticalAnalysisVo efficiencyStatisticalRate(List<MdcEfficiencyDto> efficiencyList) {
         StatisticalAnalysisVo vo = new StatisticalAnalysisVo();
         for (MdcEfficiencyDto mdcEfficiencyDto : efficiencyList) {
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java
index 5aa4da8..401b6ce 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java
@@ -1,6 +1,8 @@
 package org.jeecg.modules.mdc.util;
 
 
+import io.swagger.models.auth.In;
+
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.ParseException;
@@ -1011,4 +1013,29 @@
         dateList.forEach(localDate -> result.add(Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())));
         return result;
     }
+
+    /**
+     * @param smallDate
+     * @param bigDate
+     * @desc 鑾峰彇涓や釜鏃ユ湡涔嬮棿鐨勫ぉ鏁�
+     */
+    public static Integer getDaysBetween(String smallDate, String bigDate) throws ParseException {
+        // 鏃ユ湡鏍煎紡
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        // 鑾峰彇涓や釜鏃ユ湡鐨勬椂闂存埑
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(sdf.parse(smallDate));
+        long smallTime = cal.getTimeInMillis();
+        cal.setTime(sdf.parse(bigDate));
+        long bigTime = cal.getTimeInMillis();
+        // 鐩稿樊鐨勬棩鏈�
+        long days = (bigTime - smallTime) / (1000 * 3600 * 24);
+        // long杞琲nt 瀛樺湪婧㈠嚭鎯呭喌  鏍规嵁涓氬姟鎯呭喌缂栬緫catch涓繑鍥炲��
+        try {
+            return Integer.parseInt(String.valueOf(days));
+        } catch (NumberFormatException e) {
+            e.printStackTrace();
+            return 0;
+        }
+    }
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java
new file mode 100644
index 0000000..09cbd35
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java
@@ -0,0 +1,44 @@
+package org.jeecg.modules.mdc.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author: LiuS
+ * @create: 2023-07-31 09:51
+ */
+@Data
+public class ComparativeAnalysisQueryVo {
+
+    /**
+     * 璁惧绫诲瀷
+     */
+    private String driveType;
+
+    /**
+     * 寮�濮嬫椂闂�  ->  20220101
+     */
+    private String startTime;
+    /**
+     * 缁撴潫鏃堕棿  ->  20220101
+     */
+    private String endTime;
+    /**
+     * 鏍戠被鍨�    ->  1:杞﹂棿灞傜骇   2:閮ㄩ棬灞傜骇
+     */
+    private String typeTree;
+    /**
+     * 灞傜骇ID
+     */
+    private String parentId;
+    /**
+     * 璁惧Id
+     */
+    private String equipmentId;
+
+    /**
+     * 璁惧ids
+     */
+    private List<String> equipmentIdList;
+}

--
Gitblit v1.9.3