cuilei
2025-06-11 cd00884c3db8fa6808b3b5949ab1a2b1459d6bdc
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java
@@ -4,10 +4,13 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.board.vo.EquDowntimeInfo;
import org.jeecg.modules.mdc.dto.MdcDowntimeDto;
import org.jeecg.modules.mdc.entity.MdcDowntime;
import org.jeecg.modules.mdc.mapper.MdcDowntimeMapper;
import org.jeecg.modules.mdc.service.IMdcDowntimeService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.vo.MdcDowntimeVo;
import org.springframework.stereotype.Service;
@@ -38,7 +41,7 @@
     * @return
     */
    @Override
    public IPage<MdcDowntime> pageList(String userId, Page<MdcDowntime> page, MdcDowntimeVo mdcDowntimeVo, HttpServletRequest req) {
    public IPage<MdcDowntimeDto> pageList(String userId, Page<MdcDowntimeDto> page, MdcDowntimeVo mdcDowntimeVo, HttpServletRequest req) {
        // 获取设备ID列表
        List<String> equipmentIds = getEquipmentIds(userId, mdcDowntimeVo);
@@ -54,6 +57,23 @@
        return this.baseMapper.pageList(page, mdcDowntimeVo);
    }
    @Override
    public Integer findPlanTimeDuration(String equipmentId, String validDate, String closeType) {
        int result = 0;
        List<MdcDowntime> mdcDowntimeList = this.baseMapper.findPlanTimeDuration(equipmentId, validDate, closeType);
        if (mdcDowntimeList != null && !mdcDowntimeList.isEmpty()) {
            for (MdcDowntime mdcDowntime : mdcDowntimeList) {
                result = DateUtils.differentMinutes(mdcDowntime.getStartDate(), mdcDowntime.getEndDate()) + result;
            }
        }
        return result;
    }
    @Override
    public List<EquDowntimeInfo> equDowntimeStatistics(List<String> equipmentIdList, String start, String end) {
        return this.baseMapper.equDowntimeStatistics(equipmentIdList, start, end);
    }
    private List<String> getEquipmentIds(String userId, MdcDowntimeVo mdcDowntimeVo) {
        if (StringUtils.isNotEmpty(mdcDowntimeVo.getEquipmentId())) {
            return Collections.singletonList(mdcDowntimeVo.getEquipmentId());