From 63880904ec802b461089d7a7d0f36db7f0ca881d Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期二, 26 十二月 2023 11:14:46 +0800
Subject: [PATCH] mdc报警分析bug修复,加工工件算法更新

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/ProcessCountServiceImpl.java |  280 ++++++++++++++++++++------------------------------------
 1 files changed, 100 insertions(+), 180 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/ProcessCountServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/ProcessCountServiceImpl.java
index 745a902..021968f 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/ProcessCountServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/ProcessCountServiceImpl.java
@@ -1,26 +1,27 @@
 package org.jeecg.modules.mdc.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
 import org.jeecg.modules.mdc.dto.MdcProcessCountDto;
-import org.jeecg.modules.mdc.entity.*;
+import org.jeecg.modules.mdc.entity.MdcDeviceCalendar;
+import org.jeecg.modules.mdc.entity.MdcEquipment;
+import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection;
+import org.jeecg.modules.mdc.entity.MdcProcessCount;
 import org.jeecg.modules.mdc.mapper.MdcProcessCountMapper;
 import org.jeecg.modules.mdc.service.*;
 import org.jeecg.modules.mdc.util.DateUtils;
 import org.jeecg.modules.mdc.util.TimeFieldUtils;
+import org.jeecg.modules.mdc.vo.MdcDateVo;
 import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo;
 import org.jeecg.modules.mdc.vo.MdcProcessCountVo;
-import org.jeecg.modules.mdc.vo.MdcShiftDateVo;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -52,13 +53,15 @@
     @Transactional(rollbackFor = {Exception.class})
     public void runningProcessCount() {
         // 鑾峰彇鎵�鏈夎澶�
-        //List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2240074"));
+        //List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140198"));
         List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list();
         List<MdcProcessCount> result = new ArrayList<>();
         for (MdcEquipment mdcEquipment : mdcEquipmentList) {
-            List<MdcProcessCount> mdcProcessCountList = processCount(mdcEquipment);
-            if (mdcProcessCountList != null && !mdcProcessCountList.isEmpty()) {
-                result.addAll(mdcProcessCountList);
+            if ("FANUC".equals(mdcEquipment.getDriveType())) {
+                List<MdcProcessCount> mdcProcessCountList = processCount(mdcEquipment);
+                if (mdcProcessCountList != null && !mdcProcessCountList.isEmpty()) {
+                    result.addAll(mdcProcessCountList);
+                }
             }
         }
         if (!result.isEmpty()) {
@@ -114,7 +117,6 @@
         Date initDate = null;
         //鍙栨渶鍚庣殑缁熻鏁版嵁
         MdcProcessCount lastData = this.baseMapper.getLastData(mdcEquipment.getEquipmentId());
-        Boolean flag = true;
         if (lastData != null) {
             initDate = DateUtils.toDate(lastData.getTheDate(), DateUtils.STRDATE);
             initDate = DateUtils.plusTime(initDate, 1);
@@ -146,84 +148,62 @@
         for (String stringDate : stringDates) {
             if (listMap.containsKey(stringDate)) {
                 List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = listMap.get(stringDate);
-                for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) {
-                    // 澶勭悊鐝埗鐝鏃堕棿
-                    List<MdcShiftDateVo> datesListByMdcDeviceCalendarVo = this.getDatesListByMdcDeviceCalendarVo(mdcDeviceCalendarVo);
-                    if (datesListByMdcDeviceCalendarVo == null || datesListByMdcDeviceCalendarVo.isEmpty()) {
-                        break;
-                    }
-                    for (MdcShiftDateVo mdcShiftDateVo : datesListByMdcDeviceCalendarVo) {
-                        Date startDate = null;
-                        //澶勭悊鏁版嵁
-                        //List<MdcProcessCount> result = new ArrayList<>();
-                        // 鏌ヨ鐝鍐呰澶囪繍琛岀姸鎬佹椂闂存
-                        List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.selectRunningData(mdcEquipment.getEquipmentId(), mdcShiftDateVo.getStartDate(), mdcShiftDateVo.getEndDate());
-                        if (equipmentRunningSectionList != null && !equipmentRunningSectionList.isEmpty()) {
-                            // 鏃堕棿淇
-                            equipmentRunningSectionList.get(0).setStartTime(mdcShiftDateVo.getStartDate());
-                            if (equipmentRunningSectionList.size() > 1) {
-                                equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).setEndTime(mdcShiftDateVo.getEndDate());
-                            } else {
-                                equipmentRunningSectionList.get(0).setEndTime(mdcShiftDateVo.getEndDate());
-                            }
-                            if (!"FANUC".equals(mdcEquipment.getDriveType())) {
-                                MdcEquipmentOverFlag equipmentOverFlag = mdcEquipmentOverFlagService.getOne(new LambdaQueryWrapper<MdcEquipmentOverFlag>().eq(MdcEquipmentOverFlag::getDriveType, mdcEquipment.getDriveType()));
-                                if (equipmentOverFlag == null) {
-                                    return null;
-                                }
-                            }
+                // 澶勭悊鐝埗鐝鏃堕棿
+                MdcDateVo mdcDateVo = this.handleDeviceCalendar(mdcDeviceCalendarVos);
+                // 鏌ユ壘璁惧鍗曡〃杩愯鏁版嵁
+                List<Map<String, Object>> mdcEquipmentDtoList = equipmentWorkLineService.findRunningData(mdcEquipment.getSaveTableName(), mdcDateVo.getStartTime(), mdcDateVo.getEndTime());
+                if (mdcEquipmentDtoList == null || mdcEquipmentDtoList.isEmpty()) {
+                    continue;
+                }
+                Map<String, Object> firstMap = new HashMap<>(mdcEquipmentDtoList.get(0));
+                Map<String, Object> mdcEquipmentDtoMap = mdcEquipmentDtoList.get(0);
+                for (int i = 1; i < mdcEquipmentDtoList.size(); i++) {
+                    String productCount1 = mdcEquipmentDtoList.get(i).get("ProductCount").toString();
+                    if (!mdcEquipmentDtoMap.get("ProductCount").equals(productCount1)) {
+                        Date start;
+                        Date end;
+                        String sequenceNumber;
+                        if (firstMap.get("ProductCount").toString().equals(mdcEquipmentDtoList.get(i - 1).get("ProductCount").toString())) {
+                            //缁撴潫鏃堕棿
+                            end = DateUtils.toDate(mdcEquipmentDtoList.get(i - 1).get("CollectTime").toString(), DateUtils.STR_DATE_TIME);
+                            //鏍规嵁productCount鍊兼煡璇㈠紑濮嬫椂闂�
+                            String productCount = mdcEquipmentDtoList.get(i - 1).get("ProductCount").toString();
+                            MdcEquipmentDto mdcEquipmentDto = equipmentWorkLineService.findProductCountStartTime(mdcEquipment.getSaveTableName(), productCount);
+                            start = mdcEquipmentDto.getCollectTime();
+                            //绋嬪簭鍙�
+                            sequenceNumber = mdcEquipmentDtoList.get(i - 1).get("Sequencenumber").toString();
+                        } else {
+                            start = DateUtils.toDate(mdcEquipmentDtoMap.get("CollectTime").toString(), DateUtils.STR_DATE_TIME);
+                            end = DateUtils.toDate(mdcEquipmentDtoList.get(i - 1).get("CollectTime").toString(), DateUtils.STR_DATE_TIME);
+                            sequenceNumber = mdcEquipmentDtoList.get(i - 1).get("Sequencenumber").toString();
+                        }
+                        mdcEquipmentDtoMap.put("ProductCount", mdcEquipmentDtoList.get(i).get("ProductCount").toString());
+                        mdcEquipmentDtoMap.put("CollectTime", mdcEquipmentDtoList.get(i).get("CollectTime").toString());
 
-                            for (int j = 0; j < equipmentRunningSectionList.size(); j++) {
-                                MdcEquipmentRunningSection mdcEquipmentRunningSection = equipmentRunningSectionList.get(j);
-                                // 鏌ユ壘璁惧鍗曡〃杩愯鏁版嵁
-                                List<Map<String, Object>> mdcEquipmentDtoList = equipmentWorkLineService.findRunningData(mdcEquipment.getSaveTableName(), mdcEquipmentRunningSection.getStartTime(), mdcEquipmentRunningSection.getEndTime());
-                                if (mdcEquipmentDtoList == null || mdcEquipmentDtoList.isEmpty()) {
-                                    continue;
+                        List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.selectRunningData(mdcEquipment.getEquipmentId(), start, end);
+                        if (equipmentRunningSectionList != null && !equipmentRunningSectionList.isEmpty()) {
+                            //鏃堕棿淇
+                            if (equipmentRunningSectionList.get(0).getStartTime().before(start)) {
+                                equipmentRunningSectionList.get(0).setStartTime(start);
+                            }
+                            if (equipmentRunningSectionList.size() > 1) {
+                                if (equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).getEndTime().after(end)) {
+                                    equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).setEndTime(end);
                                 }
-                                MdcProcessCount mdcProcessCount = new MdcProcessCount();
-                                mdcProcessCount.setEquipmentId(mdcEquipment.getEquipmentId());
-                                mdcProcessCount.setEquipmentName(mdcEquipment.getEquipmentName());
-                                mdcProcessCount.setTheDate(mdcShiftDateVo.getDay());
-                                if (lastData != null && flag) {
-                                    mdcProcessCount.setStartTime(lastData.getEndTime());
-                                    startDate = mdcProcessCount.getStartTime();
-                                    flag = false;
-                                } else if (startDate == null) {
-                                    mdcProcessCount.setStartTime(mdcEquipmentRunningSection.getStartTime());
-                                    startDate = mdcProcessCount.getStartTime();
-                                } else {
-                                    mdcProcessCount.setStartTime(startDate);
-                                }
-                                if ("FANUC".equals(mdcEquipment.getDriveType())) {
-                                    try {
-                                        // 娉曞叞鍏嬭澶囨牴鎹甈roductCount瀛楁鍒ゆ柇
-                                        String productCount = mdcEquipmentDtoList.get(0).get("ProductCount").toString();
-                                        for (int i = 0; i < mdcEquipmentDtoList.size(); i++) {
-                                            if (!productCount.equals(mdcEquipmentDtoList.get(i).get("ProductCount").toString())) {
-                                                productCount = mdcEquipmentDtoList.get(i).get("ProductCount").toString();
-                                                if (mdcEquipmentDtoList.get(i - 1).get("CollectTime") != null) {
-                                                    mdcProcessCount.setEndTime(DateUtils.toDate(mdcEquipmentDtoList.get(i - 1).get("CollectTime").toString(), DateUtils.STR_DATE_TIME));
-                                                    mdcProcessCount.setDuration(TimeFieldUtils.duration(mdcProcessCount.getStartTime(), mdcProcessCount.getEndTime()));
-                                                    mdcProcessCount.setSequenceNumber(mdcEquipmentDtoList.get(i - 1).get("Sequencenumber").toString());
-                                                    resultList.add(mdcProcessCount);
-                                                    if (TimeFieldUtils.duration(mdcProcessCount.getEndTime(), mdcEquipmentRunningSection.getEndTime()) > 60) {
-                                                        //mdcProcessCount.setStartTime(mdcProcessCount.getEndTime());
-                                                        startDate = mdcProcessCount.getEndTime();
-                                                    } else if (j + 1 < equipmentRunningSectionList.size()) {
-                                                        //mdcProcessCount.setStartTime(equipmentRunningSectionList.get(j + 1).getStartTime());
-                                                        startDate = equipmentRunningSectionList.get(j + 1).getStartTime();
-                                                    } else {
-                                                        startDate = null;
-                                                    }
-                                                }
-                                            }
-                                        }
-                                    } catch (Exception e) {
-                                        log.error("璁$畻鍔犲伐宸ヤ欢绠楁硶澶辫触锛佽澶囩紪鍙凤細" + mdcEquipment.getEquipmentId(), e);
-                                        //System.out.println("璁$畻鍔犲伐宸ヤ欢绠楁硶澶辫触锛佽澶囩紪鍙凤細" + mdcEquipment.getEquipmentId());
-                                    }
+                            } else {
+                                if (equipmentRunningSectionList.get(0).getEndTime().after(end)) {
+                                    equipmentRunningSectionList.get(0).setEndTime(end);
                                 }
                             }
+                            //璁$畻鍔犲伐鏃堕暱
+                            long duration = this.handleProcessDuration(equipmentRunningSectionList);
+                            MdcProcessCount mdcProcessCount = new MdcProcessCount();
+                            mdcProcessCount.setEquipmentId(mdcEquipment.getEquipmentId());
+                            mdcProcessCount.setEquipmentName(mdcEquipment.getEquipmentName());
+                            mdcProcessCount.setSequenceNumber(sequenceNumber);
+                            mdcProcessCount.setDuration(duration);
+                            mdcProcessCount.setTheDate(stringDate);
+                            resultList.add(mdcProcessCount);
                         }
                     }
                 }
@@ -232,107 +212,47 @@
         return resultList;
     }
 
+    /**
+     * 璁$畻鍔犲伐宸ヤ欢鏃堕暱
+     * @param equipmentRunningSectionList
+     * @return
+     */
+    private long handleProcessDuration(List<MdcEquipmentRunningSection> equipmentRunningSectionList) {
+        long result = 0;
+        for (MdcEquipmentRunningSection mdcEquipmentRunningSection : equipmentRunningSectionList) {
+            result += TimeFieldUtils.duration(mdcEquipmentRunningSection.getStartTime(), mdcEquipmentRunningSection.getEndTime());
+        }
+        return result;
+    }
 
-    private List<MdcShiftDateVo> getDatesListByMdcDeviceCalendarVo(MdcDeviceCalendarVo temp) {
-        List<MdcShiftDateVo> result = new ArrayList<>();
-        String startDateStr = temp.getStartDate();
-        String endDateStr = temp.getEndDate();
-        String sleepStartDateStr = temp.getSleepStartDate();
-        String sleepEndDateStr = temp.getSleepEndDate();
-        String effectiveDateStr = temp.getEffectiveDate();
-        String overtimeStartTime = temp.getOvertimeStartTime();
-        String overtimeEndTime = temp.getOvertimeEndTime();
-        String eff = DateUtils.format(DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE), DateUtils.STR_DATE);
-        try {
-            Date effectiveDate = new SimpleDateFormat("yyyyMMdd").parse(effectiveDateStr);
-            long startDate = getLongDate(effectiveDate, startDateStr, "false");
-            long endDate = getLongDate(effectiveDate, endDateStr, temp.getIsDaySpan());
-            //澶勭悊鏈�鍚庣殑鏃堕棿闂 鏄惁瓒呰繃褰撳墠鏃堕棿 濡傛灉瓒呰繃涓嶅垪鍏ヨ绠� BUG
-            Date endTime = null;
-            if ("true".equals(temp.getIsDaySpan())) {
-                Date day = DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE);
-                day = DateUtils.plusTime(day, 1);
-                String dayTime = DateUtils.format(day, DateUtils.STR_DATE);
-                endTime = DateUtils.toDate(dayTime + " " + temp.getEndDate(), DateUtils.STR_DATE_TIME_SMALL);
-            } else {
-                Date day = DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE);
-                String dayTime = DateUtils.format(day, DateUtils.STR_DATE);
-                endTime = DateUtils.toDate(dayTime + " " + temp.getEndDate(), DateUtils.STR_DATE_TIME_SMALL);
+    private MdcDateVo handleDeviceCalendar(List<MdcDeviceCalendarVo> mdcDeviceCalendarVos) {
+        MdcDateVo result = new MdcDateVo();
+        List<Date> dateList = new ArrayList<>();
+        for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) {
+            String startDateStr = mdcDeviceCalendarVo.getStartDate();
+            String endDateStr = mdcDeviceCalendarVo.getEndDate();
+            String overtimeEndTime = mdcDeviceCalendarVo.getOvertimeEndTime();
+            String effectiveDateStr = DateUtils.format(DateUtils.toDate(mdcDeviceCalendarVo.getEffectiveDate(), DateUtils.STRDATE), DateUtils.STR_DATE);
+            Date start = DateUtils.getFormatDate(effectiveDateStr + " " + startDateStr, DateUtils.STR_DATE_TIME_SMALL);
+            dateList.add(start);
+            Date end = DateUtils.getFormatDate(effectiveDateStr + " " + endDateStr, DateUtils.STR_DATE_TIME_SMALL);
+            if ("true".equals(mdcDeviceCalendarVo.getIsDaySpan())) {
+                end = DateUtils.addDays(end, 1);
             }
-            if (endTime.getTime() > DateUtils.getNow().getTime()) {
-                return null;
-            }
-            if (StringUtils.isNotEmpty(sleepStartDateStr)) {
-                long sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, "false");
-                long sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, "false");
-                Date start1 = DateUtils.getFormatDate(eff + " " + startDateStr, DateUtils.STR_DATE_TIME_SMALL);
-                Date end1 = DateUtils.getFormatDate(eff + " " + sleepStartDateStr, DateUtils.STR_DATE_TIME_SMALL);
-                Date start2 = DateUtils.getFormatDate(eff + " " + sleepEndDateStr, DateUtils.STR_DATE_TIME_SMALL);
-                Date end2 = DateUtils.getFormatDate(eff + " " + endDateStr, DateUtils.STR_DATE_TIME_SMALL);
-                if ("true".equals(temp.getIsDaySpan())) {
-                    //璺ㄥぉ 鍒ゆ柇鐝寮�濮嬫椂闂村拰缁撴潫鏃堕棿鏄惁璺ㄥぉ
-                    if (startDateStr.compareTo(endDateStr) < 0) {
-                        //鐝寮�濮嬫椂闂村拰缁撴潫鏃堕棿閮借法澶�
-                        startDate = getLongDate(effectiveDate, startDateStr, temp.getIsDaySpan());
-                        start1 = DateUtils.addDays(start1, 1);
-                        end2 = DateUtils.addDays(end2, 1);
-                        //鐝寮�濮嬫椂闂村拰缁撴潫鏃堕棿閮借法澶� 浼戞伅寮�濮嬫椂闂村拰缁撴潫鏃堕棿涔熶竴瀹氳法澶�
-                        sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, temp.getIsDaySpan());
-                        end1 = DateUtils.addDays(end1, 1);
-                        sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan());
-                        start2 = DateUtils.addDays(start2, 1);
-                    } else {
-                        //鐝寮�濮嬫椂闂翠笉璺ㄥぉ锛� 缁撴潫鏃堕棿璺ㄥぉ
-                        end2 = DateUtils.addDays(end2, 1);
-                        //鍒ゆ柇浼戞伅寮�濮嬫椂闂存槸鍚﹁法澶�
-                        if (startDateStr.compareTo(sleepStartDateStr) > 0) {
-                            //寮�濮嬩紤鎭椂闂磋法澶╋紝 缁撴潫浼戞伅鏃堕棿涔熶竴瀹氳法澶�
-                            sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, temp.getIsDaySpan());
-                            end1 = DateUtils.addDays(end1, 1);
-                            sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan());
-                            start2 = DateUtils.addDays(start2, 1);
-                        } else {
-                            //浼戞伅寮�濮嬫椂闂翠笉璺ㄥぉ, 鍒ゆ柇浼戞伅缁撴潫鏃堕棿鏄惁璺ㄥぉ
-                            if (sleepStartDateStr.compareTo(sleepEndDateStr) > 0) {
-                                //浼戞伅缁撴潫鏃堕棿璺ㄥぉ
-                                sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan());
-                                start2 = DateUtils.addDays(start2, 1);
-                            }
-                        }
-                    }
-
-                }
-                MdcShiftDateVo dates1 = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, sleepStartDate, effectiveDateStr, endTime, start1, end1);
-                result.add(dates1);
-                MdcShiftDateVo dates2 = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), sleepEndDate, endDate, effectiveDateStr, endTime, start2, end2);
-                result.add(dates2);
-            } else {
-                /*鑾峰彇鐝鐨勫紑濮嬫椂闂寸粨鏉熸椂闂�*/
-                Date start = DateUtils.getFormatDate(eff + " " + startDateStr, DateUtils.STR_DATE_TIME_SMALL);
-                Date end = DateUtils.getFormatDate(eff + " " + endDateStr, DateUtils.STR_DATE_TIME_SMALL);
-                if ("true".equals(temp.getIsDaySpan())) {
-                    if (startDateStr.compareTo(endDateStr) < 0) {
-                        startDate = getLongDate(effectiveDate, startDateStr, temp.getIsDaySpan());
-                        start = DateUtils.addDays(start, 1);
-                    }
-                    end = DateUtils.addDays(end, 1);
-                }
-                MdcShiftDateVo dates = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, endDate, effectiveDateStr, endTime, start, end);
-                result.add(dates);
-            }
+            dateList.add(end);
             // 澶勭悊鍔犵彮鏃堕棿
-            if (StringUtils.isNotEmpty(overtimeStartTime)) {
-                Date start = DateUtils.getFormatDate(eff + " " + overtimeStartTime, DateUtils.STR_DATE_TIME_SMALL);
-                Date end = DateUtils.getFormatDate(eff + " " + overtimeEndTime, DateUtils.STR_DATE_TIME_SMALL);
-                if ("true".equals(temp.getIsDaySpan())) {
-                    start = DateUtils.addDays(start, 1);
-                    end = DateUtils.addDays(end, 1);
+            if (StringUtils.isNotEmpty(overtimeEndTime)) {
+                Date overtimeEnd = DateUtils.getFormatDate(effectiveDateStr + " " + overtimeEndTime, DateUtils.STR_DATE_TIME_SMALL);
+                if ("true".equals(mdcDeviceCalendarVo.getIsDaySpan())) {
+                    overtimeEnd = DateUtils.addDays(overtimeEnd, 1);
                 }
-                MdcShiftDateVo dates = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, endDate, effectiveDateStr, endTime, start, end);
-                result.add(dates);
+                dateList.add(overtimeEnd);
             }
-        } catch (ParseException e) {
-            e.printStackTrace();
+        }
+        if (!dateList.isEmpty()) {
+            dateList.sort(Date::compareTo);
+            result.setStartTime(dateList.get(0));
+            result.setEndTime(dateList.get(dateList.size() - 1));
         }
         return result;
     }

--
Gitblit v1.9.3