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.service.vibration.VibrationService;
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.time.LocalDate;
import java.time.format.DateTimeFormatter;
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 VibrationService vibrationService;

    // 定义时间格式
    private final String dateTimeFormatter = "yyyyMMdd";

//	@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);
	}



    @PassToken
	@GetMapping("/vibrationData")
	public void vibrationData() {

//        vibrationService.extractSkfPointData();

        String yesterdayDate = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(dateTimeFormatter));


//        vibrationService.extracTwindGeneratorSkfPointData(yesterdayDate);

//        vibrationService.extracTwindGeneratorSkfMachinePart(yesterdayDate);

        vibrationService.extracTwindGeneratorSkfPointData(yesterdayDate);
	}











}
