提交 9a4c1ac0 authored 作者: gongwenjie's avatar gongwenjie

合并分支 'gwj' 到 'master'

Gwj 查看合并请求 !125
流水线 #183 已取消 于阶段
......@@ -9,17 +9,16 @@ import com.zjty.tynotes.misc.config.AutoDocument;
import com.zjty.tynotes.misc.utils.ExcelUtil;
import com.zjty.tynotes.pas.dao.PasUserDao;
import com.zjty.tynotes.pas.entity.Address;
import com.zjty.tynotes.pas.entity.Department;
import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.RequestEntity;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -33,7 +32,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.springframework.http.ResponseEntity.ok;
......@@ -54,7 +52,7 @@ public class ExcelController {
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
private String addressUrl = "C:/Users/gwj/Desktop/工作簿/address.xls";
private String addressUrl = "address.xls";
@ApiOperation(value = "上传excel通讯录")
@PostMapping("/import")
......@@ -130,8 +128,9 @@ public class ExcelController {
@ApiOperation(value = "下载通讯录模板")
@PostMapping("/download")
public ResponseEntity download(HttpServletRequest request, HttpServletResponse response) throws Exception {
String filename="address.xls";
File file = new File(addressUrl);
String filename= "address.xls";
File file = ResourceUtils.getFile("classpath:address.xls");
// File file = new File("src/main/resources/address.xls");
// System.out.println(addressUrl);
// System.out.println("存在??");
if(file.exists()){ //判断文件父目录是否存在
......@@ -167,4 +166,16 @@ public class ExcelController {
}
return ok("下载失败");
}
// public static void main(String[] args) {
// File file = new File("a.txt");
// if(!file.exists()){
// try {
// file.createNewFile();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
}
......@@ -11,7 +11,6 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
......@@ -48,25 +47,22 @@ public class UnionApplication
SpringApplication.run(UnionApplication.class, args);
}
// 开始支持http
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addAdditionalTomcatConnectors(createHTTPConnector());
return tomcat;
}
private Connector createHTTPConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//同时启用http(8080)、https(8443)两个端口
connector.setScheme("http");
connector.setSecure(false);
connector.setPort(8084);
connector.setRedirectPort(8289);
return connector;
}
// @Bean
// public ServletWebServerFactory servletContainer() {
// TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
// tomcat.addAdditionalTomcatConnectors(createHTTPConnector());
// return tomcat;
// }
//
// private Connector createHTTPConnector() {
// Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
// //同时启用http(8080)、https(8443)两个端口
// connector.setScheme("http");
// connector.setSecure(false);
// connector.setPort(8084);
// connector.setRedirectPort(8289);
// return connector;
// }
@Autowired
private AttendanceDetailsDao attendanceDetailsDao;
}
......@@ -3,13 +3,13 @@ spring.application.name=workbook
## https端口号.
server.port=8289
# 证书的路径.
server.ssl.key-store=classpath:2586377_workbook.zjtys.com.cn.pfx
# 证书密码,请修改为您自己证书的密码.
server.ssl.key-store-password=bMEPW9BG
# 秘钥库类型
server.ssl.keyStoreType=PKCS12
# 证书别名
server.ssl.keyAlias= alias
#server.ssl.key-store=classpath:2586377_workbook.zjtys.com.cn.pfx
## 证书密码,请修改为您自己证书的密码.
#server.ssl.key-store-password=bMEPW9BG
## 秘钥库类型
#server.ssl.keyStoreType=PKCS12
## 证书别名
#server.ssl.keyAlias= alias
#mongodb configuration
spring.data.mongodb.uri=mongodb://localhost:27017/notes5
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论