git查看用户

This commit is contained in:
Paidax
2026-03-20 15:09:35 +08:00
parent ad326ec240
commit c5fbf8576c
39 changed files with 2924 additions and 609 deletions
@@ -0,0 +1,51 @@
package com.budwk.app.web.controllers;
import org.apache.commons.io.IOUtils;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
/**
* @Author: 1V
* @DateTime: 2020/12/3 8:50
* @Description: TODO
*/
@At("/platform/basics")
@IocBean
@Ok("json")
public class BasicsController {
private static final Log log = Logs.get();
private final String TEMPLATE_PATH = "templates";
/**
* 下载模板文件
*
* @param filePath
* @param fileName
* @param response
*/
@At
public void downloadTemplate(String filePath, String fileName, HttpServletResponse response) throws IOException {
try {
response.setHeader("Content-Disposition", "attachment;filename="
.concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
if (filePath.startsWith("/")) {
filePath = filePath.substring(1);
}
InputStream fin = Thread.currentThread().getContextClassLoader().getResourceAsStream(TEMPLATE_PATH + "/" + filePath);
IOUtils.copy(fin, response.getOutputStream());
} catch (Exception e) {
log.error(e);
}
}
}