package com.kxs.system.biz.controller.admin;

import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.kxs.common.core.constant.SecurityConstants;
import com.kxs.common.core.util.R;
import com.kxs.common.security.annotation.Inner;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 登录控制器
 *
 * @author 没秃顶的码农
 * @date 2023/11/03
 */
@RestController
@AllArgsConstructor
@RequestMapping("/login")
@Tag(description = "login", name = "登录管理")
public class LoginController {

	private final RedisTemplate<String, Object> redisTemplate;

	private static final Integer DEFAULT_IMAGE_WIDTH = 100;

	private static final Integer DEFAULT_IMAGE_HEIGHT = 40;

	@GetMapping("/test")
	@Inner(value = false)
	 public R getCode(@RequestParam Map randomStr){
		return R.ok(randomStr);
	 }

	@PostMapping("/testPost")
	@Inner(value = false)
	 public R testPost(){

		return R.ok();
	 }

	 //批量预设职级
//	public static void main(String[] args) {
//		ExcelReader reader = ExcelUtil.getReader("/Users/mac/Desktop/刘耀辉申请保级名单.xlsx");
//		List<Map<String, Object>> readAll = reader.readAll();
//		for (Map<String, Object> map : readAll) {
//			String level = map.get("预设职级").toString();
//			String sql = "INSERT INTO `UserRankWhite` (Id, CreateDate, UpdateDate, `Rank`, UserId) VALUES ("+map.get("创客Id")+", NOW(), '2024/6/1 00:00:00', "+level.charAt(1)+", "+map.get("创客Id")+") ON DUPLICATE KEY UPDATE UpdateDate = '2024/6/1 00:00:00', `Rank` = "+level.charAt(1)+";";
//			System.out.println(sql);
//		}
//	}

}
