Lius
2 天以前 396d07038eba53b8438e65f9ce0e6139a017e478
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java
@@ -7,20 +7,18 @@
import org.jeecg.modules.mdc.dto.MdcDowntimeDto;
import org.jeecg.modules.mdc.entity.MdcDowntime;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration;
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.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
@@ -78,22 +76,25 @@
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean saveDowntime(MdcDowntime mdcDowntime) {
        boolean result = false;
        String[] equipmentIds = mdcDowntime.getEquipmentIds().split(",");
        List<String> dateList = mdcDowntime.getDateList();
        List<MdcDowntime> mdcDowntimeList = new ArrayList<>();
        for (String equipmentId : equipmentIds) {
            for (String date : dateList) {
//                this.baseMapper.delete(new LambdaQueryWrapper<MdcDowntime>().eq(MdcDowntime::getTheDate, date).eq(MdcDowntime::getEquipmentId, equipmentId));
            MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(equipmentId);
            MdcDowntime downtime = new MdcDowntime();
            BeanUtils.copyProperties(mdcDowntime, downtime);
            downtime.setEquipmentId(mdcEquipment.getEquipmentId());
            downtime.setEquipmentName(mdcEquipment.getEquipmentName());
            boolean b = super.save(downtime);
            if (b) {
                result = true;
                downtime.setTheDate(date);
                mdcDowntimeList.add(downtime);
            }
        }
        return result;
        this.saveBatch(mdcDowntimeList);
        return true;
    }
    private List<String> getEquipmentIds(String userId, MdcDowntimeVo mdcDowntimeVo) {