From 8ef3693f9a10ebdb2f54a61bd81a2c600c3d8813 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 24 Jun 2022 11:50:14 +0800 Subject: [PATCH] Merge branch 'master' of http://120.27.238.55:7000/r/farmer-cms --- src/main/java/com/xcong/farmer/cms/common/system/controller/LoginController.java | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/xcong/farmer/cms/common/system/controller/LoginController.java b/src/main/java/com/xcong/farmer/cms/common/system/controller/LoginController.java index 16d753a..cb41816 100644 --- a/src/main/java/com/xcong/farmer/cms/common/system/controller/LoginController.java +++ b/src/main/java/com/xcong/farmer/cms/common/system/controller/LoginController.java @@ -1,5 +1,6 @@ package com.xcong.farmer.cms.common.system.controller; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSONObject; import com.xcong.farmer.cms.common.contants.AppContants; @@ -8,19 +9,20 @@ import com.xcong.farmer.cms.common.system.dto.LoginDto; import com.xcong.farmer.cms.utils.RedisUtils; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; import org.jsoup.Jsoup; import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ClassPathResource; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.core.Authentication; +import org.springframework.util.FileCopyUtils; import org.springframework.util.ResourceUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; +import java.io.*; import java.util.HashMap; import java.util.Map; @@ -62,7 +64,14 @@ @GetMapping("/html") public Result html() throws IOException { - File file = ResourceUtils.getFile("classpath:static/index.html"); +// File file = ResourceUtils.getFile("classpath:static/index.html"); + + InputStream input = this.getClass().getClassLoader().getResourceAsStream("static/index.html"); + File file = new File("index.html"); + FileUtils.copyToFile(input, file); + +// ClassPathResource classPathResource = new ClassPathResource("static/index.html"); +// File file = classPathResource.getFile(); return Result.ok("", Jsoup.parse(file, "utf-8").html()); } } -- Gitblit v1.9.1