package com.YuyeTech.TPlat.service.impl;

import com.YuyeTech.TPlat.dataobject.LevelHonor;
import com.YuyeTech.TPlat.dto.LevelConditionDTO;
import com.YuyeTech.TPlat.dto.LevelHonorDTO;
import com.YuyeTech.TPlat.repository.LevelConditionRepository;
import com.YuyeTech.TPlat.repository.LevelHonorRepository;
import com.YuyeTech.TPlat.service.LevelConditionService;
import com.YuyeTech.TPlat.service.LevelHonorService;
import com.YuyeTech.TPlat.utils.AliyunOSSUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;


/**
 * @author:slambb
 * @date:2021/8/7
 */
@Service
public class LevelHonorServiceImpl implements LevelHonorService {

    @Autowired
    private LevelHonorRepository levelHonorRepository;

    @Autowired
    private AliyunOSSUtil aliyunOSSUtil;

    @Override
    public LevelHonorDTO findByHonorType(Integer type) {
        LevelHonorDTO levelHonorDTO = levelHonorRepository.findByType(type).orElse(null);
        if (levelHonorDTO != null) {
            levelHonorDTO.setUrl(aliyunOSSUtil.addDomainName(levelHonorDTO.getUrl()));
        }
        return levelHonorDTO;
    }
}
