提交 90b1fa92 authored 作者: gongwenjie's avatar gongwenjie

合并分支 'gwj' 到 'master'

通知 查看合并请求 !122
流水线 #180 已失败 于阶段
...@@ -76,6 +76,9 @@ ...@@ -76,6 +76,9 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
......
...@@ -3,8 +3,10 @@ package com.zjty.tynotes.address; ...@@ -3,8 +3,10 @@ package com.zjty.tynotes.address;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication(scanBasePackages = { @SpringBootApplication
@ComponentScan(basePackages = {
"com.zjty.tynotes.redis", "com.zjty.tynotes.redis",
"com.zjty.tynotes.misc", "com.zjty.tynotes.misc",
"com.zjty.tynotes.search", "com.zjty.tynotes.search",
......
...@@ -14,12 +14,6 @@ ...@@ -14,12 +14,6 @@
<dependency> <dependency>
<groupId>com.zjty.tynotes</groupId> <groupId>com.zjty.tynotes</groupId>
<artifactId>notes-misc</artifactId> <artifactId>notes-misc</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-attendance</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
...@@ -47,23 +41,11 @@ ...@@ -47,23 +41,11 @@
<dependency> <dependency>
<groupId>com.zjty.tynotes</groupId> <groupId>com.zjty.tynotes</groupId>
<artifactId>notes-search</artifactId> <artifactId>notes-search</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-attendance</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.zjty.tynotes</groupId> <groupId>com.zjty.tynotes</groupId>
<artifactId>notes-redis</artifactId> <artifactId>notes-redis</artifactId>
<exclusions>
<exclusion>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-attendance</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
...@@ -103,19 +85,16 @@ ...@@ -103,19 +85,16 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <!--<configuration>-->
<executable>true</executable> <!--<executable>true</executable>-->
</configuration> <!--</configuration>-->
</plugin> </plugin>
<!--跳过测试插件--> <!--跳过测试插件-->
<plugin> <!--<plugin>-->
<groupId>org.apache.maven.plugins</groupId> <!--<groupId>org.apache.maven.plugins</groupId>-->
<artifactId>maven-surefire-plugin</artifactId> <!--<artifactId>maven-surefire-plugin</artifactId>-->
<version>2.20</version> <!--<version>2.20</version>-->
<configuration> <!--</plugin>-->
<skipTests>true</skipTests> <!--默认关掉单元测试 -->
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
...@@ -10,7 +10,6 @@ import org.springframework.context.annotation.ComponentScan; ...@@ -10,7 +10,6 @@ import org.springframework.context.annotation.ComponentScan;
"com.zjty.tynotes.pas", "com.zjty.tynotes.pas",
"com.zjty.tynotes.search", "com.zjty.tynotes.search",
"com.zjty.tynotes.attendance" "com.zjty.tynotes.attendance"
}) })
public class NotesAttendanceApplication { public class NotesAttendanceApplication {
......
...@@ -54,18 +54,19 @@ public class ExcelController { ...@@ -54,18 +54,19 @@ public class ExcelController {
@Autowired @Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder; private BCryptPasswordEncoder bCryptPasswordEncoder;
private String addressUrl = "C:\\Users\\gwj\\Desktop\\工作簿\\address.xls"; private String addressUrl = "C:/Users/gwj/Desktop/工作簿/address.xls";
@ApiOperation(value = "上传excel通讯录") @ApiOperation(value = "上传excel通讯录")
@PostMapping("/import") @PostMapping("/import")
public List<Address> upload(@RequestParam("file") MultipartFile multipartFile,HttpServletRequest request,HttpServletResponse response) throws Exception { public List<Address> upload(@RequestParam("file") MultipartFile multipartFile,HttpServletRequest request,HttpServletResponse response) throws Exception {
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setHeadRows(1); params.setHeadRows(4);
// params.setNeedVerfiy(true); // params.setNeedVerfiy(true);
params.setTitleRows(1); // params.setTitleRows(1);
List<Address> result = ExcelImportUtil.importExcel(multipartFile.getInputStream(), List<Address> result = ExcelImportUtil.importExcel(multipartFile.getInputStream(),
Address.class, params); Address.class, params);
List<User> users = new ArrayList<>(); List<User> users = new ArrayList<>();
System.out.println(result);
if(result!=null){ if(result!=null){
result.forEach(address -> { result.forEach(address -> {
User user = pasUserDao.findByUsername(address.getName()); User user = pasUserDao.findByUsername(address.getName());
...@@ -93,7 +94,7 @@ public class ExcelController { ...@@ -93,7 +94,7 @@ public class ExcelController {
@ApiOperation(value = "导出所有人的excel通讯录") @ApiOperation(value = "导出所有人的excel通讯录")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletRequest request, HttpServletResponse response) throws Exception { public void export(HttpServletRequest request, HttpServletResponse response){
//把要导出的信息放在map里面 //把要导出的信息放在map里面
List<Map<String, Object>> excelList = new ArrayList<>(); List<Map<String, Object>> excelList = new ArrayList<>();
//构建创建导出excel表格所需要的Workbook对象的map //构建创建导出excel表格所需要的Workbook对象的map
...@@ -101,14 +102,22 @@ public class ExcelController { ...@@ -101,14 +102,22 @@ public class ExcelController {
List<User> users = iUserService.findAll(); List<User> users = iUserService.findAll();
List<Address> addresses = new ArrayList<>(); List<Address> addresses = new ArrayList<>();
if(users!=null){ if(users!=null){
users.forEach(user -> { int i = 1;
addresses.add(new Address(user)); 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); Map<String, Object> map = new HashMap<>(8);
String FpName="用户通讯录"; String FpName="用户通讯录";
map.put("subFpName", 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("entity", Address.class);
map.put("data",addresses); map.put("data",addresses);
excelList.add(map); excelList.add(map);
...@@ -123,10 +132,9 @@ public class ExcelController { ...@@ -123,10 +132,9 @@ public class ExcelController {
public ResponseEntity download(HttpServletRequest request, HttpServletResponse response) throws Exception { public ResponseEntity download(HttpServletRequest request, HttpServletResponse response) throws Exception {
String filename="address.xls"; String filename="address.xls";
File file = new File(addressUrl); File file = new File(addressUrl);
System.out.println(addressUrl); // System.out.println(addressUrl);
System.out.println("存在??"); // System.out.println("存在??");
if(file.exists()){ //判断文件父目录是否存在 if(file.exists()){ //判断文件父目录是否存在
System.out.println("存在???");
response.setContentType("application/vnd.ms-excel;charset=UTF-8"); response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;fileName=" + java.net.URLEncoder.encode(filename,"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; ...@@ -19,35 +19,54 @@ import org.springframework.data.mongodb.core.mapping.Document;
@ApiModel(value = "通讯录", description = "通讯录说明") @ApiModel(value = "通讯录", description = "通讯录说明")
public class Address { public class Address {
@Excel(name = "序号")
@ApiModelProperty(value = "序号",example = "gwj")
private String id;
@Excel(name = "姓名") @Excel(name = "姓名")
@ApiModelProperty(value = "姓名",example = "gwj") @ApiModelProperty(value = "姓名",example = "gwj")
private String name; private String name;
@Excel(name = "职务") @Excel(name = "性别")
@ApiModelProperty(value = "职务",example = "后端程序员") @ApiModelProperty(value = "性别",example = "男")
private String duty; private String sex;
@Excel(name = "手机") @Excel(name = "手机")
@ApiModelProperty(value = "手机号",example = "13211111111") @ApiModelProperty(value = "手机号",example = "13211111111")
private String telphone; private String telphone;
@Excel(name = "邮箱") @Excel(name = "家庭住址")
@ApiModelProperty(value = "邮箱",example = "1@1.com") @ApiModelProperty(value = "家庭住址",example = "13211111111")
private String email; private String homeAddress;
@Excel(name = "手机虚拟号") @Excel(name = "身份证号码")
@ApiModelProperty(value = "短号",example = "666666") @ApiModelProperty(value = "身份证号码",example = "330122200011111111")
private String shortphone; private String idCard;
@Excel(name = "职务")
@ApiModelProperty(value = "职务",example = "后端程序员")
private String duty;
// @Excel(name = "手机虚拟号")
// @ApiModelProperty(value = "短号",example = "666666")
// private String shortphone;
@Excel(name = "工号") @Excel(name = "工号")
@ApiModelProperty(value = "工号",example = "1111111111111") @ApiModelProperty(value = "工号",example = "1111111111111")
private String workerNum; private String workerNum;
@ApiModelProperty(value = "邮箱",example = "hz")
private String email;
public Address(User user) { public Address(User user) {
this.homeAddress = user.getAddress();
this.idCard = user.getIdCard();
this.workerNum = user.getWorkerNum(); this.workerNum = user.getWorkerNum();
this.name = user.getUsername(); this.name = user.getUsername();
this.duty = user.getJobs(); this.duty = user.getJobs();
this.telphone = user.getPhone1(); this.telphone = user.getPhone1();
this.sex = user.getSex();
// this.shortphone = user.getPhone2(); // this.shortphone = user.getPhone2();
this.email = user.getEmail(); this.email = user.getEmail();
} }
......
...@@ -42,10 +42,12 @@ public class User implements UserDetails, Serializable { ...@@ -42,10 +42,12 @@ public class User implements UserDetails, Serializable {
@ApiModelProperty(value ="身份证",example = "48489498131566546") @ApiModelProperty(value ="身份证",example = "48489498131566546")
private String idCard; private String idCard;
@NotEmpty(message = "工号不可为空")
@ApiModelProperty(value = "工号",example = "11111111111111111") @ApiModelProperty(value = "工号",example = "11111111111111111")
private String workerNum; private String workerNum;
@ApiModelProperty(value = "性别",example = "男")
private String sex;
@NotEmpty(message = "地址不可为空") @NotEmpty(message = "地址不可为空")
@ApiModelProperty(value = "地址",example = "xx路xx楼xx号") @ApiModelProperty(value = "地址",example = "xx路xx楼xx号")
private String address; private String address;
...@@ -171,7 +173,7 @@ public class User implements UserDetails, Serializable { ...@@ -171,7 +173,7 @@ public class User implements UserDetails, Serializable {
this.jobs = address.getDuty(); this.jobs = address.getDuty();
this.phone2 = address.getTelphone(); this.phone2 = address.getTelphone();
// this.phone2 = address.getShortphone(); // this.phone2 = address.getShortphone();
this.email = address.getEmail(); // this.email = address.getEmail();
} }
} }
...@@ -10,6 +10,7 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory; ...@@ -10,6 +10,7 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
...@@ -28,8 +29,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -28,8 +29,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
"com.zjty.tynotes.misc", "com.zjty.tynotes.misc",
"com.zjty.tynotes.union", "com.zjty.tynotes.union",
"com.zjty.tynotes.log", "com.zjty.tynotes.log",
"com.zjty.tynotes.address" "com.zjty.tynotes.address",
// , "com.zjty.tynotes.attendance" "com.zjty.tynotes.attendance"
}) })
@EnableCaching @EnableCaching
@EnableScheduling @EnableScheduling
...@@ -46,21 +47,21 @@ public class UnionApplication ...@@ -46,21 +47,21 @@ public class UnionApplication
SpringApplication.run(UnionApplication.class, args); SpringApplication.run(UnionApplication.class, args);
} }
// 开始支持http // 开始支持http
@Bean // @Bean
public ServletWebServerFactory servletContainer() { // public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); // TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addAdditionalTomcatConnectors(createHTTPConnector()); // tomcat.addAdditionalTomcatConnectors(createHTTPConnector());
return tomcat; // return tomcat;
} // }
//
private Connector createHTTPConnector() { // private Connector createHTTPConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); // Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//同时启用http(8080)、https(8443)两个端口 // //同时启用http(8080)、https(8443)两个端口
connector.setScheme("http"); // connector.setScheme("http");
connector.setSecure(false); // connector.setSecure(false);
connector.setPort(8084); // connector.setPort(8084);
connector.setRedirectPort(8289); // connector.setRedirectPort(8289);
return connector; // return connector;
} // }
} }
...@@ -3,13 +3,13 @@ spring.application.name=workbook ...@@ -3,13 +3,13 @@ spring.application.name=workbook
## https端口号. ## https端口号.
server.port=8289 server.port=8289
# 证书的路径. # 证书的路径.
server.ssl.key-store=classpath:2586377_workbook.zjtys.com.cn.pfx #server.ssl.key-store=classpath:2586377_workbook.zjtys.com.cn.pfx
# 证书密码,请修改为您自己证书的密码. ## 证书密码,请修改为您自己证书的密码.
server.ssl.key-store-password=bMEPW9BG #server.ssl.key-store-password=bMEPW9BG
# 秘钥库类型 ## 秘钥库类型
server.ssl.keyStoreType=PKCS12 #server.ssl.keyStoreType=PKCS12
# 证书别名 ## 证书别名
server.ssl.keyAlias= alias #server.ssl.keyAlias= alias
#mongodb configuration #mongodb configuration
spring.data.mongodb.uri=mongodb://localhost:27017/notes5 spring.data.mongodb.uri=mongodb://localhost:27017/notes5
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论