package com.energy.manage.service.controller.system;

import cn.hutool.core.io.FileUtil;
import com.alibaba.excel.EasyExcel;
import com.energy.manage.service.config.annotations.PassToken;
import com.energy.manage.service.domain.vo.excel.MinTestDataVo;
import com.energy.manage.service.service.kafka.producer.KafkaSendService;
import com.energy.manage.service.util.BatchDownloadUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;
import java.util.List;

/**
 * 测试kafka消息
 *
 * @author sy
 * @date 2021-10-18 13:32:05
 */
@Slf4j
@RestController
@RequestMapping("SysTestController")
@CrossOrigin
@Api(value = "SysTestController", tags = "测试Controller")
public class SysTestController {

    @Autowired
    private BatchDownloadUtil batchDownloadUtil;

//	@Autowired
//	private KafkaSendService kafkaSendService;
//
//	@GetMapping("/topic-abc-test")
//	public void abc() {
//		// 发送消息
//		kafkaSendService.sendMessage("abc", "abc kafka");
//	}
//
//
//	@GetMapping("/topic-test-test")
//	public void test() {
//		// 发送消息
//		kafkaSendService.sendMessage("test", "test kafka");
//	}
    @PassToken
    @GetMapping("minio-test-d")
	public void minioTestd() {
		// 发送消息
       String value =  batchDownloadUtil.backResourceAddress("wof085500002","WOF085500002-WOB00002/");
       System.out.println(value);
	}




//	@GetMapping("/test-execl")
//	public void testExecl() {
//
//		File file = new File("/Users/shiyue/Downloads/zn/F001_min.xlsx");
//		List<MinTestDataVo> list = EasyExcel.read(file).head(MinTestDataVo.class).sheet().doReadSync();
//		int i = 0;
////		list.stream().forEach(x -> {
////			log.info(x.getFengsu());
////		});
//
//		for(MinTestDataVo minTestDataVo : list){
//			log.info(minTestDataVo.getFengsu());
//			i++;
//		}
//		System.out.println(i);
//	}











}
