From fb7bc35a49bac34373ee2ac93dc850d0b0f4444f Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期四, 09 五月 2024 15:48:13 +0800
Subject: [PATCH] 2024-5-9 绩效管理-班次后端开发调整月份完成

---
 framework/src/main/java/com/yuanchu/mom/service/impl/InformationNotificationServiceImpl.java   |   19 ++++++---
 performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java |   37 ++++++++++++++++--
 performance-server/src/main/java/com/yuanchu/mom/service/PerformanceShiftService.java          |    6 +-
 performance-server/src/main/java/com/yuanchu/mom/dto/PerformanceShiftMapDto.java               |    2 +
 4 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/framework/src/main/java/com/yuanchu/mom/service/impl/InformationNotificationServiceImpl.java b/framework/src/main/java/com/yuanchu/mom/service/impl/InformationNotificationServiceImpl.java
index c1d6b66..7572a05 100644
--- a/framework/src/main/java/com/yuanchu/mom/service/impl/InformationNotificationServiceImpl.java
+++ b/framework/src/main/java/com/yuanchu/mom/service/impl/InformationNotificationServiceImpl.java
@@ -51,13 +51,18 @@
 
     @Override
     public Boolean checkForUnreadData() {
-        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectInsOrderParameter");
-        List<InformationNotification> informationNotifications = baseMapper.selectList(
-                Wrappers.<InformationNotification>lambdaQuery()
-                        .eq(InformationNotification::getConsigneeId, map1.get("userId"))
-                        .eq(InformationNotification::getViewStatus, false)
-                        .last("limit 1"));
-        return !informationNotifications.isEmpty();
+        Map<String, Integer> map1 = null;
+        try {
+            map1 = getLook.selectPowerByMethodAndUserId("selectInsOrderParameter");
+            List<InformationNotification> informationNotifications = baseMapper.selectList(
+                    Wrappers.<InformationNotification>lambdaQuery()
+                            .eq(InformationNotification::getConsigneeId, map1.get("userId"))
+                            .eq(InformationNotification::getViewStatus, false)
+                            .last("limit 1"));
+            return !informationNotifications.isEmpty();
+        } catch (Exception e) {
+        }
+        return false;
     }
 
     @Override
diff --git a/performance-server/src/main/java/com/yuanchu/mom/dto/PerformanceShiftMapDto.java b/performance-server/src/main/java/com/yuanchu/mom/dto/PerformanceShiftMapDto.java
index 9b82bb4..6086e2f 100644
--- a/performance-server/src/main/java/com/yuanchu/mom/dto/PerformanceShiftMapDto.java
+++ b/performance-server/src/main/java/com/yuanchu/mom/dto/PerformanceShiftMapDto.java
@@ -20,4 +20,6 @@
 
     private Map<String, Object> sidebarAnnualAttendance = new HashMap<>();;
     private List<?> list = new ArrayList<>();
+
+    private List<Map<Object, Object>> headerList = new ArrayList<>();
 }
diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/PerformanceShiftService.java b/performance-server/src/main/java/com/yuanchu/mom/service/PerformanceShiftService.java
index af0682c..67ad72a 100644
--- a/performance-server/src/main/java/com/yuanchu/mom/service/PerformanceShiftService.java
+++ b/performance-server/src/main/java/com/yuanchu/mom/service/PerformanceShiftService.java
@@ -1,11 +1,11 @@
 package com.yuanchu.mom.service;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yuanchu.mom.dto.PerformanceShiftAddDto;
-import com.yuanchu.mom.dto.PerformanceShiftMapDto;
 import com.yuanchu.mom.pojo.PerformanceShift;
+
+import java.util.Map;
 
 /**
  * <p>
@@ -19,7 +19,7 @@
 
     void performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto);
 
-    IPage<PerformanceShiftMapDto> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory);
+    Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory);
 
     void performanceShiftUpdate(PerformanceShift performanceShift);
 }
diff --git a/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java b/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java
index b7d09b5..fd33f86 100644
--- a/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java
+++ b/performance-server/src/main/java/com/yuanchu/mom/service/impl/PerformanceShiftServiceImpl.java
@@ -91,7 +91,7 @@
     }
 
     @Override
-    public IPage<PerformanceShiftMapDto> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory) {
+    public Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory) {
         IPage<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftPage(page, time, userName, laboratory);
         List<Enums> shiftType = enumService.selectEnumByCategory("鐝绫诲瀷");
         List<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYearPage(time, userName, laboratory);
@@ -117,10 +117,7 @@
                 }
                 hashMap.put("id", shiftTimeAndShift[2]);
                 hashMap.put("shift", shiftTimeAndShift[1]);
-                DateTime parse = DateUtil.parse(shiftTimeAndShift[0]);
-                hashMap.put("weekly", DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1)));
                 hashMap.put("time", shiftTimeAndShift[0]);
-                hashMap.put("headerTime", getWeek(shiftTimeAndShift[0]));
                 map.add(hashMap);
             }
             int totalYearAttendance = 0;
@@ -145,7 +142,26 @@
             i.setList(map);
             i.setShiftTime(null);
         });
-        return mapIPage;
+        // 鑾峰彇header鏃堕棿
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        // 灏嗗瓧绗︿覆鏃堕棿杞崲涓� LocalDateTime 绫诲瀷鏃堕棿
+        LocalDateTime localDateTime = LocalDateTime.parse(time, formatters);
+        LocalDate firstDayOfMonth = localDateTime.toLocalDate().withDayOfMonth(1);
+        LocalDate lastDayOfMonth = localDateTime.toLocalDate().with(TemporalAdjusters.lastDayOfMonth());
+        List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay());
+        List<Object> list1 = new ArrayList<>();
+        for (LocalDateTime dateTime : localDateTimesBetween) {
+            Map<Object, Object> hashMap = new HashMap<>();
+            DateTime parse = DateUtil.parse(dateTime.format(formatter));
+            hashMap.put("weekly", DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1)));
+            hashMap.put("headerTime", getWeek(dateTime.format(formatters)));
+            list1.add(hashMap);
+        }
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("page", mapIPage);
+        resultMap.put("headerList", list1);
+        return resultMap;
     }
 
     @Override
@@ -155,6 +171,17 @@
                 .set(PerformanceShift::getShift, performanceShift.getShift()));
     }
 
+//    public static void main(String[] args) {
+//        String dateStr = "2023-09-15 12:30:45";
+//        LocalDateTime localDateTime = convertToLocalDateTime(dateStr);
+//        System.out.println(localDateTime);
+//    }
+//
+//    public static LocalDateTime convertToLocalDateTime(String dateStr) {
+//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+//        return LocalDateTime.parse(dateStr, formatter);
+//    }
+
     // 鑾峰彇涓や釜localDateTime鐨勬瘡涓�澶�
     public static List<LocalDateTime> getLocalDateTimesBetween(LocalDateTime start, LocalDateTime end) {
         List<LocalDateTime> localDateTimes = new ArrayList<>();

--
Gitblit v1.9.3