Lius
2025-04-28 572466e8ebaa67f1809a97ecf912d30e8802fd98
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<>();