From 53bc276bdc4aaefc2a2ecadc472f2c2f18e93490 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期三, 26 十一月 2025 16:53:57 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java |  103 +++++++++++++++++++++++++++++++++------------------
 1 files changed, 67 insertions(+), 36 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
index 9049abc..85c1798 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
@@ -26,6 +26,9 @@
 import java.sql.Date;
 import java.sql.SQLOutput;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.function.Function;
@@ -332,29 +335,47 @@
 //        return map;
 //    }
 
-    private static String to080000(String s) {
-        if (s == null || s.isEmpty()) return null;
-        String v = s.trim();
-        // 鍙繚鐣欐棩鏈熼儴鍒嗭紙鍓�10浣� yyyy-MM-dd锛�
-        String datePart = v.length() >= 10 ? v.substring(0, 10) : v;
-        return datePart + " 08:00:00";
+
+    private static final DateTimeFormatter DATE_TIME_FMT =
+            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+    private String toReportTime(String dateStr, String reportTime) {
+        if (dateStr == null || dateStr.isEmpty()) {
+            return null;
+        }
+
+        // 鍙繚鐣� yyyy-MM-dd锛岄槻姝㈠墠绔紶瀹屾暣鏃堕棿瀵艰嚧 parse 寮傚父
+        String onlyDate = dateStr.length() > 10 ? dateStr.substring(0, 10) : dateStr;
+
+
+        String[] parts = reportTime.split(":");
+        int hour   = Integer.parseInt(parts[0]);
+        int minute = parts.length > 1 ? Integer.parseInt(parts[1]) : 0;
+        int second = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
+
+        LocalDate date = LocalDate.parse(onlyDate);
+        LocalTime time = LocalTime.of(hour, minute, second);
+
+        return LocalDateTime.of(date, time).format(DATE_TIME_FMT);
     }
     //璺ㄥ伐搴忔鐮�
     public Map<String, Object> crossProcessBreakingSv(Integer pageNum, Integer pageSize,
                                                       List<String> selectDate,
+                                                      String reportTime,
                                                       CrossProcessBreakingDTO crossProcessBreakingDTO) {
         Integer offset = (pageNum - 1) * pageSize;
 
-        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
-        String startDate = to080000(LocalDate.now().minusDays(15).toString());
-        String endDate   = to080000(LocalDate.now().toString());
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
 
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
         if (selectDate != null && selectDate.size() == 2) {
             if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
-                startDate = to080000(selectDate.get(0));
+                startDate = toReportTime(selectDate.get(0), reportTime);
             }
             if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
-                endDate = to080000(selectDate.get(1));
+                endDate = toReportTime(selectDate.get(1), reportTime);
             }
         }
 
@@ -363,7 +384,6 @@
         // 浣跨敤寮傛绾跨▼姹�
         String finalEndDate = endDate;
         String finalStartDate = startDate;
-        System.out.println(finalEndDate+"==="+finalStartDate);
         CompletableFuture<List<CrossProcessBreakingDTO>> dataFuture = asyncExecutor.runAsync(() ->
                 reportMapper.getProcessBreaking(offset, pageSize, finalStartDate, finalEndDate, crossProcessBreakingDTO));
 
@@ -392,19 +412,21 @@
     //闈炶法宸ュ簭娆$牬
     public Map<String, Object> notCrossProcessBreakingSv(Integer pageNum, Integer pageSize,
                                                       List<String> selectDate,
+                                                      String reportTime,
                                                       CrossProcessBreakingDTO crossProcessBreakingDTO) {
         Integer offset = (pageNum - 1) * pageSize;
 
-        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
-        String startDate = to080000(LocalDate.now().minusDays(15).toString());
-        String endDate   = to080000(LocalDate.now().toString());
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
 
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
         if (selectDate != null && selectDate.size() == 2) {
             if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
-                startDate = to080000(selectDate.get(0));
+                startDate = toReportTime(selectDate.get(0), reportTime);
             }
             if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
-                endDate = to080000(selectDate.get(1));
+                endDate = toReportTime(selectDate.get(1), reportTime);
             }
         }
 
@@ -601,25 +623,31 @@
 
     public Map<String, Object> selectDamageReportSv(Integer pageNum, Integer pageSize,
                                                     List<String> selectDate,
+                                                    String reportTime,
                                                     DamageReportDTO damageReportDTO) {
-        Integer offset = (pageNum - 1) * pageSize;
-        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶�
-        String startDate = to080000(LocalDate.now().minusDays(15).toString());
-        String endDate   = to080000(LocalDate.now().toString());
 
+        Integer offset = (pageNum - 1) * pageSize;
+
+
+        // 榛樿鏃堕棿鑼冨洿锛氳繃鍘� 15 澶╋紙鏃ユ湡 + reportTime锛�
+        String startDate = toReportTime(LocalDate.now().minusDays(15).toString(), reportTime);
+        String endDate   = toReportTime(LocalDate.now().toString(), reportTime);
+
+        // 濡傛灉鍓嶇浼犱簡鏃堕棿锛屽氨鐢ㄥ墠绔棩鏈� + reportTime
         if (selectDate != null && selectDate.size() == 2) {
             if (selectDate.get(0) != null && !selectDate.get(0).isEmpty()) {
-                startDate = to080000(selectDate.get(0));
+                startDate = toReportTime(selectDate.get(0), reportTime);
             }
             if (selectDate.get(1) != null && !selectDate.get(1).isEmpty()) {
-                endDate = to080000(selectDate.get(1));
+                endDate = toReportTime(selectDate.get(1), reportTime);
             }
         }
-        Map<String, Object> result = new HashMap<>();
-        String finalEndDate = endDate;
-        String finalStartDate = startDate;
-        // 寮傛浠诲姟瀹氫箟
 
+        Map<String, Object> result = new HashMap<>();
+        String finalStartDate = startDate;
+        String finalEndDate = endDate;
+
+        // 寮傛浠诲姟瀹氫箟
         CompletableFuture<List<DamageReportDTO>> dataFuture = asyncExecutor.runAsync(() ->
                 reportMapper.selectDamageReportMp(offset, pageSize, finalStartDate, finalEndDate, damageReportDTO));
 
@@ -629,7 +657,7 @@
         CompletableFuture<Map<String, Float>> footSumFuture = asyncExecutor.runAsync(() ->
                 reportMapper.damageReportFootSum(finalStartDate, finalEndDate, damageReportDTO));
 
-        //绛夊緟鍏ㄩ儴浠诲姟瀹屾垚
+        // 绛夊緟鍏ㄩ儴浠诲姟瀹屾垚
         CompletableFuture.allOf(dataFuture, totalFuture, footSumFuture).join();
 
         try {
@@ -640,6 +668,8 @@
             e.printStackTrace();
             throw new RuntimeException("骞惰鏌ヨ寮傚父锛�" + e.getMessage(), e);
         }
+
+        // 鍥炰紶鍓嶇鐨勬椂闂达紙鐜板湪鏄甫鏃跺垎绉掔殑锛�
         List<String> list = new ArrayList<>();
         list.add(startDate);
         list.add(endDate);
@@ -647,6 +677,7 @@
 
         return result;
     }
+
 
     public Map<String, Object> splittingDetailsOutsideSv(String orderId, Report report) {
         Map<String, Object> map = new HashMap<>();
@@ -972,14 +1003,14 @@
         }
         String inputVal= (String) dates.get("inputVal");
         String project= (String) dates.get("project");
-        String terminationVals= (String) dates.get("terminationVals");
-        if ("null".equals(inputVal)) {
+        String terminationVals= dates.get("terminationVals").toString();;
+        if (inputVal==null) {
             inputVal = "";
         }
-        if ("null".equals(project)) {
+        if (project==null) {
             project = "";
         }
-        if ("null".equals(terminationVals)) {
+        if (terminationVals==null) {
             terminationVals = "";
         }
         List<WorkInProgressDTO> dataList1  =reportMapper.exportWorkInProgressMp(process,inputVal,project,terminationVals);
@@ -1243,14 +1274,14 @@
         }
         String inputVal= (String) dates.get("inputVal");
         String project= (String) dates.get("project");
-        String terminationVals= (String) dates.get("terminationVals");
-        if ("null".equals(inputVal)) {
+        String terminationVals= dates.get("terminationVals").toString();;
+        if (inputVal==null) {
             inputVal = "";
         }
-        if ("null".equals(project)) {
+        if (project==null) {
             project = "";
         }
-        if ("null".equals(terminationVals)) {
+        if (terminationVals==null) {
             terminationVals = "";
         }
 

--
Gitblit v1.8.0