package com.gkhy.safePlatform.equipment.service.baseService.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.equipment.entity.MaterialDeliveryRecordDO; import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsBO; import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO; import com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsInfo; import com.gkhy.safePlatform.equipment.enums.MaterialRevertStatusEnum; import com.gkhy.safePlatform.equipment.excepiton.EquipmentException; import com.gkhy.safePlatform.equipment.repository.MaterialReceiveRecordsInfoRepository; import com.gkhy.safePlatform.equipment.service.baseService.MaterialReceiveRecordsInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import java.util.List; @Service public class MaterialReceiveRecordsInfoServiceImpl extends ServiceImpl implements MaterialReceiveRecordsInfoService { @Autowired private MaterialReceiveRecordsInfoRepository repository; @Override public MaterialDeliveryRecordDO getRecordBySmdId(Long smdId) { if(null == smdId){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } return repository.getRecordBySmdId(smdId,MaterialRevertStatusEnum.REVERT_NO.getCode()); } @Override public List getNoReturnRecordByReceiveBaseId(Long receiveBaseId) { if(null == receiveBaseId){ throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } List recordsInfos = repository.selectList(new LambdaQueryWrapper() .eq(MaterialReceiveRecordsInfo::getReceiveBaseId, receiveBaseId) .eq(MaterialReceiveRecordsInfo::getRevertStatus, MaterialRevertStatusEnum.REVERT_NO.getCode())); return recordsInfos; } @Override public List getNoReturnRecordByIds(List idList) { if (CollectionUtils.isEmpty(idList)) { throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } List records = repository.getNoReturnRecordByIds(idList, MaterialRevertStatusEnum.REVERT_NO.getCode()); return records; } @Override public List listByReceiveBaseIds(List idList) { if (CollectionUtils.isEmpty(idList)) { throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } List receiveRecordsInfoList = repository.selectList(new LambdaQueryWrapper() .in(MaterialReceiveRecordsInfo::getReceiveBaseId, idList)); return receiveRecordsInfoList; } @Override public List getReceiveRecordsByReceiveUids(MaterialReceiveRecordsBO bo) { if (CollectionUtils.isEmpty(bo.getReceiveUids()) || CollectionUtils.isEmpty(bo.getSmallClassifyIds())) { throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } return repository.getReceiveRecordsByReceiveUids(bo); } @Override public List listByReceiveBaseId(Long id) { if (ObjectUtils.isEmpty(id)) { throw new EquipmentException(ResultCodes.CLIENT_PARAM_NULL); } List receiveRecordsInfoList = repository.selectList(new LambdaQueryWrapper() .eq(MaterialReceiveRecordsInfo::getReceiveBaseId, id)); return receiveRecordsInfoList; } }