春风项目四线(合箱线、总装线)
wujian
2024-04-28 0e3cac8d5d9603cdd5ff8935e4054f0018a35ed9
jcdm-main/src/main/java/com/jcdm/main/rm/repairRecord/service/impl/RmRepairRecordServiceImpl.java
@@ -1,12 +1,25 @@
package com.jcdm.main.rm.repairRecord.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import com.jcdm.common.utils.DateUtils;
import com.jcdm.main.bs.orderScheduling.common.Constants;
import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper;
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper;
import com.jcdm.main.rm.repairData.domain.RmRepairData;
import com.jcdm.main.rm.repairRecord.vo.RmRepairDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper;
import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService;
import javax.annotation.Resource;
/**
 * 返修记录Service业务层处理
@@ -19,6 +32,11 @@
{
    @Autowired
    private RmRepairRecordMapper rmRepairRecordMapper;
    @Resource
    private DaParamCollectionMapper daParamCollectionMapper;
    @Resource
    private DaPassingStationCollectionMapper daPassingStationCollectionMapper;
    /**
     * 查询返修记录
@@ -44,6 +62,36 @@
        return rmRepairRecordMapper.selectRmRepairRecordList(rmRepairRecord);
    }
    @Override
    public RmRepairDataVO getRepairReportList(RmRepairRecord rmRepairRecord) {
        RmRepairDataVO vo = new RmRepairDataVO();
        //主表数据
        List<RmRepairRecord> mainList = rmRepairRecordMapper.selectRmRepairRecordList(rmRepairRecord);
        vo.setMainList(mainList);
        List<String> engineNoList = mainList.stream().map(RmRepairRecord::getBoxCode).distinct().collect(Collectors.toList());
        List<DaParamCollection> allChildList = new ArrayList<>();
        List<DaPassingStationCollection> collect5 = new ArrayList<>();
        if (CollUtil.isNotEmpty(engineNoList)){
            allChildList = daParamCollectionMapper.getListBySfcCode(engineNoList);
            collect5 = daPassingStationCollectionMapper.getListBySfcCode(engineNoList);
        }
        if (CollUtil.isNotEmpty(allChildList)){
            allChildList = allChildList.stream().filter(x -> Constants.IS_REPAIR.equals(x.getRepairFlag())).collect(Collectors.toList());
            //拿到所有子数据
            List<DaParamCollection> collect1 = allChildList.stream().filter(x -> Constants.DATA1.equals(x.getType())).collect(Collectors.toList());
            List<DaParamCollection> collect2 = allChildList.stream().filter(x -> Constants.DATA2.equals(x.getType())).collect(Collectors.toList());
            List<DaParamCollection> collect3 = allChildList.stream().filter(x -> Constants.DATA3.equals(x.getType())).collect(Collectors.toList());
            List<DaParamCollection> collect4 = allChildList.stream().filter(x -> Constants.DATA4.equals(x.getType())).collect(Collectors.toList());
            vo.setList1(collect1);
            vo.setList2(collect2);
            vo.setList3(collect3);
            vo.setList4(collect4);
        }
        collect5 = collect5.stream().filter(x -> Constants.IS_REPAIR.equals(x.getRepairFlag())).collect(Collectors.toList());
        vo.setList5(collect5);
        return vo;
    }
    /**
     * 新增返修记录
     *