From 2c24f787f28e85af3a7f89e4277063e9a2523909 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 09 一月 2025 17:25:33 +0800
Subject: [PATCH] 两网融合部分

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
index 749ce8d..d1ec752 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
@@ -3,7 +3,9 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.DictModel;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.mdc.dto.EquipmentMachingDto;
 import org.jeecg.modules.mdc.dto.MdcAlarmListDto;
 import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto;
@@ -15,9 +17,13 @@
 import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo;
 import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo;
 import org.jeecg.modules.system.service.ISysDictService;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.servlet.ModelAndView;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -99,17 +105,6 @@
                         }
                     }
                 }
-//                Set<TmpEquipmentAlarm> set = entity.getTmpEquipmentAlarmSet();
-//                if (entity.getStatus() == 22 && set != null && !set.isEmpty()) {
-//                    Iterator<TmpEquipmentAlarm> iterator = entity.getTmpEquipmentAlarmSet().iterator();
-//                    //鑾峰彇鎶ヨ缂栧彿鐩稿悓鐨勬姤璀︿俊鎭�
-//                    while (iterator.hasNext()) {
-//                        TmpEquipmentAlarm next = iterator.next();
-//                        if (StringUtils.isNotBlank(next.getAlarmNo()) && next.getAlarmNo().equals(entity.getStatus())) {
-//                            dto.setAlarmContent(next.getAlarmContent());
-//                        }
-//                    }
-//                }
                 dtos.add(dto);
             }
         }
@@ -136,7 +131,7 @@
             if (!a.getStatus().equals(b.getStatus()) && a.getEndTime().equals(b.getStartTime())) {
                 result.add(dtos.get(dtos.size() - 1));
             }
-        } else if (dtos.size() == 1){
+        } else if (dtos.size() == 1) {
             result.addAll(dtos);
         }
 
@@ -570,6 +565,7 @@
 
     /**
      * 鏁版嵁鍚屾澶勭悊
+     *
      * @param list
      * @param errorList
      */
@@ -740,6 +736,22 @@
         return this.baseMapper.getDataList(equipmentId, date);
     }
 
+    /**
+     * 瀵煎嚭
+     */
+    @Override
+    public ModelAndView exportXls(MdcEquipmentRunningSectionVo equipmentRunningSectionVo) {
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<MdcEquipmentRunningSectionDto> mdcEquipmentRunningSectionDtos = this.logList(equipmentRunningSectionVo);
+        // 瀵煎嚭鏂囦欢鍚嶇О
+        mv.addObject(NormalExcelConstants.FILE_NAME, "璁惧鏃ュ織");
+        mv.addObject(NormalExcelConstants.CLASS, MdcEquipmentRunningSectionDto.class);
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("璁惧鏃ュ織鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "璁惧鏃ュ織"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, mdcEquipmentRunningSectionDtos);
+        return mv;
+    }
+
     private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) {
         Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>();
         List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>();

--
Gitblit v1.9.3