提交 153b3fcb authored 作者: gongwenjie's avatar gongwenjie

通知

上级 ec693f65
......@@ -76,6 +76,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -3,8 +3,10 @@ package com.zjty.tynotes.address;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication(scanBasePackages = {
@SpringBootApplication
@ComponentScan(basePackages = {
"com.zjty.tynotes.redis",
"com.zjty.tynotes.misc",
"com.zjty.tynotes.search",
......
......@@ -14,12 +14,6 @@
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-misc</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-attendance</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......@@ -47,23 +41,11 @@
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-search</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-attendance</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-redis</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-attendance</artifactId>
</exclusion>
</exclusions>
</dependency>
......@@ -103,19 +85,16 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
<!--<configuration>-->
<!--<executable>true</executable>-->
<!--</configuration>-->
</plugin>
<!--跳过测试插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<skipTests>true</skipTests> <!--默认关掉单元测试 -->
</configuration>
</plugin>
<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-surefire-plugin</artifactId>-->
<!--<version>2.20</version>-->
<!--</plugin>-->
</plugins>
</build>
</project>
......@@ -10,7 +10,6 @@ import org.springframework.context.annotation.ComponentScan;
"com.zjty.tynotes.pas",
"com.zjty.tynotes.search",
"com.zjty.tynotes.attendance"
})
public class NotesAttendanceApplication {
......
......@@ -54,18 +54,19 @@ public class ExcelController {
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
private String addressUrl = "C:\\Users\\gwj\\Desktop\\工作簿\\address.xls";
private String addressUrl = "C:/Users/gwj/Desktop/工作簿/address.xls";
@ApiOperation(value = "上传excel通讯录")
@PostMapping("/import")
public List<Address> upload(@RequestParam("file") MultipartFile multipartFile,HttpServletRequest request,HttpServletResponse response) throws Exception {
ImportParams params = new ImportParams();
params.setHeadRows(1);
params.setHeadRows(4);
// params.setNeedVerfiy(true);
params.setTitleRows(1);
// params.setTitleRows(1);
List<Address> result = ExcelImportUtil.importExcel(multipartFile.getInputStream(),
Address.class, params);
List<User> users = new ArrayList<>();
System.out.println(result);
if(result!=null){
result.forEach(address -> {
User user = pasUserDao.findByUsername(address.getName());
......@@ -93,7 +94,7 @@ public class ExcelController {
@ApiOperation(value = "导出所有人的excel通讯录")
@PostMapping("/export")
public void export(HttpServletRequest request, HttpServletResponse response) throws Exception {
public void export(HttpServletRequest request, HttpServletResponse response){
//把要导出的信息放在map里面
List<Map<String, Object>> excelList = new ArrayList<>();
//构建创建导出excel表格所需要的Workbook对象的map
......@@ -101,14 +102,22 @@ public class ExcelController {
List<User> users = iUserService.findAll();
List<Address> addresses = new ArrayList<>();
if(users!=null){
users.forEach(user -> {
addresses.add(new Address(user));
});
int i = 1;
for (User user : users) {
if(!user.getUsername().equals("HR")){
Address address = new Address(user);
address.setId(i+"");
addresses.add(address);
i++;
}
}
}
Map<String, Object> map = new HashMap<>(8);
String FpName="用户通讯录";
map.put("subFpName", FpName);
map.put("title", new ExportParams(FpName,FpName));
ExportParams exportParams = new ExportParams(FpName, FpName);
// exportParams.setAddIndex(true);
map.put("title", exportParams);
map.put("entity", Address.class);
map.put("data",addresses);
excelList.add(map);
......@@ -123,10 +132,9 @@ public class ExcelController {
public ResponseEntity download(HttpServletRequest request, HttpServletResponse response) throws Exception {
String filename="address.xls";
File file = new File(addressUrl);
System.out.println(addressUrl);
System.out.println("存在??");
// System.out.println(addressUrl);
// System.out.println("存在??");
if(file.exists()){ //判断文件父目录是否存在
System.out.println("存在???");
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;fileName=" + java.net.URLEncoder.encode(filename,"UTF-8"));
......
......@@ -19,35 +19,54 @@ import org.springframework.data.mongodb.core.mapping.Document;
@ApiModel(value = "通讯录", description = "通讯录说明")
public class Address {
@Excel(name = "序号")
@ApiModelProperty(value = "序号",example = "gwj")
private String id;
@Excel(name = "姓名")
@ApiModelProperty(value = "姓名",example = "gwj")
private String name;
@Excel(name = "职务")
@ApiModelProperty(value = "职务",example = "后端程序员")
private String duty;
@Excel(name = "性别")
@ApiModelProperty(value = "性别",example = "男")
private String sex;
@Excel(name = "手机")
@ApiModelProperty(value = "手机号",example = "13211111111")
private String telphone;
@Excel(name = "邮箱")
@ApiModelProperty(value = "邮箱",example = "1@1.com")
private String email;
@Excel(name = "家庭住址")
@ApiModelProperty(value = "家庭住址",example = "13211111111")
private String homeAddress;
@Excel(name = "手机虚拟号")
@ApiModelProperty(value = "短号",example = "666666")
private String shortphone;
@Excel(name = "身份证号码")
@ApiModelProperty(value = "身份证号码",example = "330122200011111111")
private String idCard;
@Excel(name = "职务")
@ApiModelProperty(value = "职务",example = "后端程序员")
private String duty;
// @Excel(name = "手机虚拟号")
// @ApiModelProperty(value = "短号",example = "666666")
// private String shortphone;
@Excel(name = "工号")
@ApiModelProperty(value = "工号",example = "1111111111111")
private String workerNum;
@ApiModelProperty(value = "邮箱",example = "hz")
private String email;
public Address(User user) {
this.homeAddress = user.getAddress();
this.idCard = user.getIdCard();
this.workerNum = user.getWorkerNum();
this.name = user.getUsername();
this.duty = user.getJobs();
this.telphone = user.getPhone1();
this.sex = user.getSex();
// this.shortphone = user.getPhone2();
this.email = user.getEmail();
}
......
......@@ -42,10 +42,12 @@ public class User implements UserDetails, Serializable {
@ApiModelProperty(value ="身份证",example = "48489498131566546")
private String idCard;
@NotEmpty(message = "工号不可为空")
@ApiModelProperty(value = "工号",example = "11111111111111111")
private String workerNum;
@ApiModelProperty(value = "性别",example = "男")
private String sex;
@NotEmpty(message = "地址不可为空")
@ApiModelProperty(value = "地址",example = "xx路xx楼xx号")
private String address;
......@@ -171,7 +173,7 @@ public class User implements UserDetails, Serializable {
this.jobs = address.getDuty();
this.phone2 = address.getTelphone();
// this.phone2 = address.getShortphone();
this.email = address.getEmail();
// this.email = address.getEmail();
}
}
......@@ -10,6 +10,7 @@ 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;
......@@ -28,8 +29,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
"com.zjty.tynotes.misc",
"com.zjty.tynotes.union",
"com.zjty.tynotes.log",
"com.zjty.tynotes.address"
// , "com.zjty.tynotes.attendance"
"com.zjty.tynotes.address",
"com.zjty.tynotes.attendance"
})
@EnableCaching
@EnableScheduling
......@@ -46,21 +47,21 @@ 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;
// }
}
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论