From 65434ac45c8cd200ef794a35a69b4d0af5ed038c Mon Sep 17 00:00:00 2001 From: wangruxin Date: Thu, 10 Apr 2025 19:30:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../site/mapper/BsSgcBasicDeviceInformationMapper.java | 9 +++++---- .../site/service/BsSgcEquipmentMonitoringService.java | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/jwtech-system/src/main/java/com/kms/site/mapper/BsSgcBasicDeviceInformationMapper.java b/jwtech-system/src/main/java/com/kms/site/mapper/BsSgcBasicDeviceInformationMapper.java index 5c3ff711..b1905bf7 100644 --- a/jwtech-system/src/main/java/com/kms/site/mapper/BsSgcBasicDeviceInformationMapper.java +++ b/jwtech-system/src/main/java/com/kms/site/mapper/BsSgcBasicDeviceInformationMapper.java @@ -18,13 +18,14 @@ import java.util.List; @Repository public interface BsSgcBasicDeviceInformationMapper extends BaseMapper { - @Select("SELECT model,count(*) total,\n" + + @Select("SELECT name as model,count(*) total,\n" + "SUM(CASE WHEN is_overweight = 'Y' THEN 1 ELSE 0 END) AS non_overweight_count\n" + - " from bs_sgc_basic_device_information where pro_no = #{proNo} GROUP BY model") + " from bs_sgc_basic_device_information where pro_no = #{proNo} GROUP BY name") List statisticsOfOverweightEquipment(@Param("proNo") String proNo); - @Select("SELECT model,SUM(CASE WHEN status = '2' THEN 1 ELSE 0 END) AS no_normal_count,\n" + + @Select("SELECT name as model,SUM(CASE WHEN status = '2' THEN 1 ELSE 0 END) AS no_normal_count,\n" + "SUM(CASE WHEN status = '1' THEN 1 ELSE 0 END) AS normal_count\n" + - " from bs_sgc_basic_device_information where pro_no = #{proNo} GROUP BY model") + " from bs_sgc_basic_device_information where pro_no = #{proNo} GROUP BY name") List statisticsOfNormal(@Param("proNo") String proNo); + } diff --git a/jwtech-system/src/main/java/com/kms/site/service/BsSgcEquipmentMonitoringService.java b/jwtech-system/src/main/java/com/kms/site/service/BsSgcEquipmentMonitoringService.java index d2521780..1070bf9c 100644 --- a/jwtech-system/src/main/java/com/kms/site/service/BsSgcEquipmentMonitoringService.java +++ b/jwtech-system/src/main/java/com/kms/site/service/BsSgcEquipmentMonitoringService.java @@ -11,6 +11,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; +import java.time.temporal.TemporalAdjusters; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -31,12 +32,14 @@ public class BsSgcEquipmentMonitoringService extends BaseService getMaterialOutputStatistics(String proNo, String timeType) { LocalDateTime start = null; - LocalDateTime now = LocalDate.now().atStartOfDay(); + LocalDateTime now = null; if(timeType.equals("1")){ //年 start = LocalDate.now().withDayOfYear(1).atStartOfDay(); - timeType = "M"; + now = LocalDate.now().with(TemporalAdjusters.lastDayOfYear()).atTime(LocalTime.MAX); + timeType = "m"; }else if(timeType.equals("2")){ //月 start = LocalDate.now().withDayOfMonth(1).atStartOfDay(); + now = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).atTime(LocalTime.MAX); timeType = "d"; }else if(timeType.equals("3")){ //日 LocalDate today = LocalDate.now();