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业务层处理
|
*
|
* @author Yi
|
* @date 2023-12-22
|
*/
|
@Service
|
public class RmRepairRecordServiceImpl implements IRmRepairRecordService
|
{
|
@Autowired
|
private RmRepairRecordMapper rmRepairRecordMapper;
|
|
@Resource
|
private DaParamCollectionMapper daParamCollectionMapper;
|
@Resource
|
private DaPassingStationCollectionMapper daPassingStationCollectionMapper;
|
|
/**
|
* 查询返修记录
|
*
|
* @param id 返修记录主键
|
* @return 返修记录
|
*/
|
@Override
|
public RmRepairRecord selectRmRepairRecordById(Long id)
|
{
|
return rmRepairRecordMapper.selectRmRepairRecordById(id);
|
}
|
|
/**
|
* 查询返修记录列表
|
*
|
* @param rmRepairRecord 返修记录
|
* @return 返修记录
|
*/
|
@Override
|
public List<RmRepairRecord> selectRmRepairRecordList(RmRepairRecord rmRepairRecord)
|
{
|
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;
|
}
|
|
/**
|
* 新增返修记录
|
*
|
* @param rmRepairRecord 返修记录
|
* @return 结果
|
*/
|
@Override
|
public int insertRmRepairRecord(RmRepairRecord rmRepairRecord)
|
{
|
rmRepairRecord.setCreateTime(DateUtils.getNowDate());
|
return rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord);
|
}
|
|
/**
|
* 修改返修记录
|
*
|
* @param rmRepairRecord 返修记录
|
* @return 结果
|
*/
|
@Override
|
public int updateRmRepairRecord(RmRepairRecord rmRepairRecord)
|
{
|
rmRepairRecord.setUpdateTime(DateUtils.getNowDate());
|
return rmRepairRecordMapper.updateRmRepairRecord(rmRepairRecord);
|
}
|
|
/**
|
* 批量删除返修记录
|
*
|
* @param ids 需要删除的返修记录主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteRmRepairRecordByIds(Long[] ids)
|
{
|
return rmRepairRecordMapper.deleteRmRepairRecordByIds(ids);
|
}
|
|
/**
|
* 删除返修记录信息
|
*
|
* @param id 返修记录主键
|
* @return 结果
|
*/
|
@Override
|
public int deleteRmRepairRecordById(Long id)
|
{
|
return rmRepairRecordMapper.deleteRmRepairRecordById(id);
|
}
|
}
|