From 710df8489c740910bda9a557d9a7fdc6cf39df41 Mon Sep 17 00:00:00 2001
From: yangbin <yangbin@qq.com>
Date: 星期四, 20 二月 2025 11:32:55 +0800
Subject: [PATCH] 大屏看板1

---
 lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml                                  |    4 +-
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java     |   22 +++++++++-
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml            |   54 ++++++++++++++-------------
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java         |    4 ++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java |    7 +++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java    |    3 +
 6 files changed, 62 insertions(+), 32 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml
index 1c7631d..85d615e 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml
@@ -3,67 +3,69 @@
 <mapper namespace="org.jeecg.modules.mdc.mapper.EquipmentStatisticalInfoMapper">
     <select id="findDataRankingForBigScreen" resultType="org.jeecg.modules.mdc.subcontrol.vo.LastWeekDataVo">
         SELECT
-        EQUIPMENT,
-        SUM( CLOSEDLONG ) CLOSEDLONG,
-        SUM( ERRORINGLONG ) ERRORINGLONG,
-        SUM( OPENINGLONG ) OPENINGLONG,
-        SUM( PROCESSINGLONG ) PROCESSINGLONG,
-        SUM( WAITINGLONG ) WAITINGLONG
+        equipment_id equipment,
+        SUM( open_long ) openlong,
+        SUM( close_long ) closelong,
+        SUM( wait_long ) waitlong,
+        SUM( process_long ) processingLong,
+        SUM( error_long ) errorlong
         FROM
-        EQUIPMENTSTATISTICALINFO
+        mdc_equipment_statistical_info
         <where>
             <if test="equipmentIdList != null and equipmentIdList.size() > 0">
-                AND EQUIPMENT IN
+                AND equipment_id IN
                 <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                     #{ id }
                 </foreach>
             </if>
-            AND THEDATE &gt;= #{ monday }
-            AND THEDATE &lt;= #{ saturday }
+            AND the_date &gt;= #{ monday }
+            AND the_date &lt;= #{ saturday }
         </where>
         GROUP BY
-        EQUIPMENT;
+        equipment_id;
     </select>
 
     <select id="findDataForBigScreen" resultType="org.jeecg.modules.mdc.subcontrol.vo.LastWeekDataVo">
         SELECT
-        THEDATE,
-        SUM( OPENINGLONG ) OPENINGLONG,
-        SUM(CLOSEDLONG) CLOSEDLONG,
-        SUM(PROCESSINGLONG) PROCESSINGLONG,
-        SUM(WAITINGLONG) WAITINGLONG
+        equipment_id equipment,
+        SUM( open_long ) openlong,
+        SUM( close_long ) closelong,
+        SUM( wait_long ) waitlong,
+        SUM( process_long ) processingLong,
+        SUM( error_long ) errorlong
         FROM
-        EQUIPMENTSTATISTICALINFO
+        mdc_equipment_statistical_info
         <where>
             <if test="equipmentIdList != null and equipmentIdList.size() > 0">
-                AND EQUIPMENT IN
+                AND equipment_id IN
                 <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                     #{ id }
                 </foreach>
             </if>
-            AND THEDATE &gt;= #{ monday }
-            AND THEDATE &lt;= #{ saturday }
+            AND the_date &gt;= #{ monday }
+            AND the_date &lt;= #{ saturday }
         </where>
         GROUP BY
-        THEDATE
+        the_date
         ORDER BY
-        THEDATE ASC;
+        the_date ASC;
     </select>
 
     <select id="findEquipmentId" resultType="java.lang.String">
         SELECT DISTINCT
-        EQUIPMENT
+        equipment_id equipment
         FROM
-        EQUIPMENTSTATISTICALINFO
+
+        mdc_equipment_statistical_info
         <where>
             <if test="equipmentIdList != null and equipmentIdList.size() > 0">
-                AND EQUIPMENT IN
+                AND equipment_id IN
                 <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                     #{ id }
                 </foreach>
             </if>
             <if test="date != null and date != ''">
-                AND THEDATE = #{ date }
+                AND the_date = #{ date }
             </if>
         </where>
     </select>
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
index 51473ea..dc9bc7b 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
@@ -17,4 +17,8 @@
      * @param dateTime
      */
     void runningAllEquipmentStatisticalProcess(String dateTime);
+
+
+    Long selectSize(String equipmentId, String monday, String saturday);
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java
index 7cfe0dc..650bd53 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java
@@ -36,6 +36,7 @@
     @Override
     public Long selectSize(String equipmentId, String monday, String saturday) {
         return this.baseMapper.selectCount(new LambdaQueryWrapper<EquipmentStatisticalInfo>().
-                eq(EquipmentStatisticalInfo::getEquipment, equipmentId).ge(EquipmentStatisticalInfo::getTheDate, monday).le(EquipmentStatisticalInfo::getTheDate, saturday));
+                eq(EquipmentStatisticalInfo::getEquipment, equipmentId).
+                ge(EquipmentStatisticalInfo::getTheDate, monday).le(EquipmentStatisticalInfo::getTheDate, saturday));
     }
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
index 5f89d3e..7d53189 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -75,6 +75,13 @@
         }
     }
 
+    @Override
+    public Long selectSize(String equipmentId, String monday, String saturday) {
+        return this.baseMapper.selectCount(new LambdaQueryWrapper<MdcEquipmentStatisticalInfo>().
+                eq(MdcEquipmentStatisticalInfo::getEquipmentId, equipmentId).
+                ge(MdcEquipmentStatisticalInfo::getTheDate, monday).le(MdcEquipmentStatisticalInfo::getTheDate, saturday));
+    }
+
     private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) {
         List<EquipmentStatisticalInfo> result = new ArrayList<>();
         list.forEach(item -> {
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java
index 5f94fd4..adefc97 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/subcontrol/service/impl/MdcBigScreenServiceImpl.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.mdc.subcontrol.service.impl;
 
 import org.apache.commons.lang.StringUtils;
+import org.checkerframework.checker.units.qual.A;
 import org.jeecg.modules.mdc.entity.EquipmentLog;
 import org.jeecg.modules.mdc.service.*;
 import org.jeecg.modules.mdc.subcontrol.service.MdcBigScreenService;
@@ -34,6 +35,8 @@
     private IEquipmentStatisticalInfoService equipmentStatisticalInfoService;
     @Autowired
     private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService;
+    @Autowired
+    private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService;
 
 
     @Resource
@@ -126,11 +129,17 @@
             List<LastWeekDataVo> lastWeekDataVos = equipmentStatisticalInfoService.findDataRankingForBigScreen(equipmentIdList, monday, saturday);
             if (!lastWeekDataVos.isEmpty()) {
                 for (LastWeekDataVo lastWeekDataVo : lastWeekDataVos) {
-                    Long size = equipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday);
-                    lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f", (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100))));
+                    Long size = mdcEquipmentStatisticalInfoService.selectSize(lastWeekDataVo.getEquipment(), monday, saturday);
+                    if (StringUtils.isNotEmpty(lastWeekDataVo.getProcessingLong()) && Float.parseFloat(lastWeekDataVo.getProcessingLong()) >0) {
+                        lastWeekDataVo.setUtilization(new BigDecimal(String.format("%.2f",
+                                (Float.parseFloat(lastWeekDataVo.getProcessingLong()) / (86400 * size) * 100))));
+                    } else {
+                        lastWeekDataVo.setUtilization(new BigDecimal(0));
+                    }
+
                 }
                 List<LastWeekDataVo> collect = lastWeekDataVos.stream().sorted(Comparator.comparing(LastWeekDataVo::getUtilization).reversed()).collect(Collectors.toList());
-                if (collect.size() > 3) {
+                if (collect.size() > 6) {
                     List<LastWeekDataVo> topList = collect.subList(0, 6);
                     for (LastWeekDataVo vo : topList) {
                         LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo();
@@ -138,6 +147,13 @@
                         rankingVo.setTopRate(vo.getUtilization().toString());
                         voList.add(rankingVo);
                     }
+                } else {
+                    for (LastWeekDataVo vo : collect) {
+                        LastWeekDataRankingVo rankingVo = new LastWeekDataRankingVo();
+                        rankingVo.setTopName(vo.getEquipment());
+                        rankingVo.setTopRate(vo.getUtilization().toString());
+                        voList.add(rankingVo);
+                    }
                 }
 
             }
diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml
index ccfdfe0..461ef15 100644
--- a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml
+++ b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml
@@ -126,7 +126,7 @@
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:sqlserver://192.168.124.118:1433;databasename=LXZN_TEST_COMMON
+          url: jdbc:sqlserver://192.168.1.118:1433;databasename=LXZN_HX_MDC_COMMON
           username: sa
           password: 123
           driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
@@ -135,7 +135,7 @@
     database: 0
     host: 127.0.0.1
     port: 6379
-    password: 123456
+    password:
 #mybatis plus 璁剧疆
 mybatis-plus:
   mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml

--
Gitblit v1.9.3