Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
153b3fcb
提交
153b3fcb
authored
5月 26, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
通知
上级
ec693f65
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
91 行增加
和
78 行删除
+91
-78
pom.xml
notes-address/pom.xml
+3
-0
NotesAddressApplication.java
...ava/com/zjty/tynotes/address/NotesAddressApplication.java
+3
-1
pom.xml
notes-attendance/pom.xml
+8
-29
NotesAttendanceApplication.java
...m/zjty/tynotes/attendance/NotesAttendanceApplication.java
+0
-1
ExcelController.java
...java/com/zjty/tynotes/pas/controller/ExcelController.java
+19
-11
Address.java
...as/src/main/java/com/zjty/tynotes/pas/entity/Address.java
+28
-9
User.java
...s-pas/src/main/java/com/zjty/tynotes/pas/entity/User.java
+4
-2
UnionApplication.java
...rc/main/java/com/zjty/tynotes/union/UnionApplication.java
+19
-18
application.properties
notes-union/src/main/resources/application.properties
+7
-7
没有找到文件。
notes-address/pom.xml
浏览文件 @
153b3fcb
...
...
@@ -76,6 +76,9 @@
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<skip>
true
</skip>
</configuration>
</plugin>
</plugins>
</build>
...
...
notes-address/src/main/java/com/zjty/tynotes/address/NotesAddressApplication.java
浏览文件 @
153b3fcb
...
...
@@ -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"
,
...
...
notes-attendance/pom.xml
浏览文件 @
153b3fcb
...
...
@@ -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>
notes-attendance/src/main/java/com/zjty/tynotes/attendance/NotesAttendanceApplication.java
浏览文件 @
153b3fcb
...
...
@@ -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
{
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/controller/ExcelController.java
浏览文件 @
153b3fcb
...
...
@@ -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"
));
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/entity/Address.java
浏览文件 @
153b3fcb
...
...
@@ -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
();
}
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/entity/User.java
浏览文件 @
153b3fcb
...
...
@@ -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();
}
}
notes-union/src/main/java/com/zjty/tynotes/union/UnionApplication.java
浏览文件 @
153b3fcb
...
...
@@ -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;
//
}
}
notes-union/src/main/resources/application.properties
浏览文件 @
153b3fcb
...
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论