package edu.neusoft.project.util.Thread;

import edu.neusoft.project.model.service.SongService;
import edu.neusoft.project.util.GetMusic.GetSongFromNetease;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.concurrent.Callable;

public class GetMusicFromNeteaseThreadAndIns implements Callable<Integer> {

    private SongService songService = new SongService();

    private int  songid;

    public GetMusicFromNeteaseThreadAndIns(int songid) {
        this.songid = songid;
    }


    @Override
    public Integer call() throws Exception {
        System.out.println(new Date()+Thread.currentThread().getName()+"------Thread On");
        //to fun()
        int ret=0;
        ret = songService.insSong(songid,GetSongFromNetease.getMusicName(songid),GetSongFromNetease.getMusician(songid),GetSongFromNetease.getCommentCount(songid));

//        songid
//        GetSongFromNetease.getMusician(songid)
//        GetSongFromNetease.getMusicName(songid)
//        GetSongFromNetease.getCommentCount(songid)

        System.out.println(new Date()+Thread.currentThread().getName()+"------Thread Off");
        return ret;
    }
//    public void ind(int songid){
//        songService.insSong(songid,GetSongFromNetease.getMusicName(songid),GetSongFromNetease.getMusician(songid),GetSongFromNetease.getCommentCount(songid));
//
//    }

}
