Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
6a1ea083
提交
6a1ea083
authored
4月 09, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'lj-project' of git.yfzx.zjtys.com.cn:912-system/monitor/inspect
上级
70b00552
630816a5
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
60 行增加
和
20 行删除
+60
-20
pom.xml
pom.xml
+15
-0
AopIntercept.java
src/main/java/com/zjty/inspect/aop/AopIntercept.java
+23
-12
LoginInterceptor.java
src/main/java/com/zjty/inspect/config/LoginInterceptor.java
+2
-2
MvcConfig.java
src/main/java/com/zjty/inspect/config/MvcConfig.java
+4
-0
ConfigController.java
...in/java/com/zjty/inspect/controller/ConfigController.java
+2
-0
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+3
-2
RuleController.java
...main/java/com/zjty/inspect/controller/RuleController.java
+6
-1
TechnologyController.java
...ava/com/zjty/inspect/controller/TechnologyController.java
+2
-0
ExcelUtil.java
src/main/java/com/zjty/inspect/utils/ExcelUtil.java
+3
-3
没有找到文件。
pom.xml
浏览文件 @
6a1ea083
...
@@ -105,7 +105,22 @@
...
@@ -105,7 +105,22 @@
<artifactId>
zip4j
</artifactId>
<artifactId>
zip4j
</artifactId>
<version>
1.3.2
</version>
<version>
1.3.2
</version>
</dependency>
</dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-base
</artifactId>
<version>
3.2.0
</version>
</dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-web
</artifactId>
<version>
3.2.0
</version>
</dependency>
<dependency>
<groupId>
cn.afterturn
</groupId>
<artifactId>
easypoi-annotation
</artifactId>
<version>
3.2.0
</version>
</dependency>
<!--解压rar压缩-->
<!--解压rar压缩-->
<dependency>
<dependency>
<groupId>
com.github.junrar
</groupId>
<groupId>
com.github.junrar
</groupId>
...
...
src/main/java/com/zjty/inspect/aop/AopIntercept.java
浏览文件 @
6a1ea083
...
@@ -11,7 +11,11 @@ import org.aspectj.lang.annotation.Pointcut;
...
@@ -11,7 +11,11 @@ import org.aspectj.lang.annotation.Pointcut;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,17 +42,24 @@ public class AopIntercept {
...
@@ -38,17 +42,24 @@ public class AopIntercept {
@Around
(
"doPointCut()"
)
@Around
(
"doPointCut()"
)
public
Object
aroundMethod
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
public
Object
aroundMethod
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
long
startMillis
=
System
.
currentTimeMillis
();
AuthAnnotation
authAnnotation
=
((
MethodSignature
)
joinPoint
.
getSignature
()).
getMethod
().
getAnnotation
(
AuthAnnotation
.
class
);
Object
proceed
=
joinPoint
.
proceed
();
String
[]
code
=
authAnnotation
.
code
();
long
endMillis
=
System
.
currentTimeMillis
();
List
<
String
>
authorityCode
=
user
.
getAuthorityCode
();
for
(
String
s
:
code
)
{
long
time
=
(
endMillis
-
startMillis
);
if
(
authorityCode
.
contains
(
s
))
{
log
.
info
(
"评估总耗时{}毫秒"
,
time
);
long
startMillis
=
System
.
currentTimeMillis
();
log
.
info
(
"PersonAspect2 ==> before method : {}"
,
joinPoint
.
getSignature
().
getName
());
Object
proceed
=
joinPoint
.
proceed
();
log
.
info
(
"注解的类型名称为{}"
,
joinPoint
.
getSignature
().
getDeclaringTypeName
());
long
endMillis
=
System
.
currentTimeMillis
();
log
.
info
(
"方法修饰符个数为{}"
,
joinPoint
.
getSignature
().
getModifiers
());
long
time
=
(
endMillis
-
startMillis
);
log
.
info
(
"方法名称为{}"
,
joinPoint
.
getSignature
().
getName
());
log
.
info
(
"评估总耗时{}毫秒"
,
time
);
log
.
info
(
"方法参数{}"
,
joinPoint
.
getArgs
());
log
.
info
(
"PersonAspect2 ==> before method : {}"
,
joinPoint
.
getSignature
().
getName
());
return
proceed
;
log
.
info
(
"注解的类型名称为{}"
,
joinPoint
.
getSignature
().
getDeclaringTypeName
());
log
.
info
(
"方法修饰符个数为{}"
,
joinPoint
.
getSignature
().
getModifiers
());
log
.
info
(
"方法名称为{}"
,
joinPoint
.
getSignature
().
getName
());
log
.
info
(
"方法参数{}"
,
joinPoint
.
getArgs
());
return
proceed
;
}
}
return
ResponseEntity
.
status
(
403
).
build
();
}
}
}
}
src/main/java/com/zjty/inspect/config/LoginInterceptor.java
浏览文件 @
6a1ea083
...
@@ -10,6 +10,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
...
@@ -10,6 +10,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Objects
;
/**
/**
* @author Mcj
* @author Mcj
...
@@ -28,9 +29,8 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -28,9 +29,8 @@ public class LoginInterceptor implements HandlerInterceptor {
String
sessionId
=
request
.
getHeader
(
"sessionId"
);
String
sessionId
=
request
.
getHeader
(
"sessionId"
);
String
url
=
"http://120.55.57.35:12345/user/getLogin/"
+
sessionId
;
String
url
=
"http://120.55.57.35:12345/user/getLogin/"
+
sessionId
;
ServerResponse
user
=
restTemplate
.
getForObject
(
url
,
ServerResponse
.
class
);
ServerResponse
user
=
restTemplate
.
getForObject
(
url
,
ServerResponse
.
class
);
if
(
user
==
null
){
if
(
Objects
.
requireNonNull
(
user
).
getData
()
==
null
){
//不符合条件的给出提示信息,并转发到登录页面
//不符合条件的给出提示信息,并转发到登录页面
request
.
setAttribute
(
"msg"
,
"您还没有登录,请先登录!"
);
response
.
setStatus
(
403
);
response
.
setStatus
(
403
);
return
false
;
return
false
;
}
}
...
...
src/main/java/com/zjty/inspect/config/MvcConfig.java
浏览文件 @
6a1ea083
...
@@ -23,6 +23,10 @@ public class MvcConfig extends WebMvcConfigurationSupport {
...
@@ -23,6 +23,10 @@ public class MvcConfig extends WebMvcConfigurationSupport {
// 多个拦截器组成一个拦截器链
// 多个拦截器组成一个拦截器链
// addPathPatterns 用于添加拦截规则,/**表示拦截所有请求
// addPathPatterns 用于添加拦截规则,/**表示拦截所有请求
// excludePathPatterns 用户排除拦截
// excludePathPatterns 用户排除拦截
registry
.
addInterceptor
(
loginInterceptor
)
.
addPathPatterns
(
"/**"
)
.
excludePathPatterns
(
"/swagger-resources/**"
,
"/webjars/**"
,
"/v2/**"
,
"/swagger-ui.html/**"
);
;
super
.
addInterceptors
(
registry
);
super
.
addInterceptors
(
registry
);
}
}
@Override
@Override
...
...
src/main/java/com/zjty/inspect/controller/ConfigController.java
浏览文件 @
6a1ea083
package
com
.
zjty
.
inspect
.
controller
;
package
com
.
zjty
.
inspect
.
controller
;
import
com.zjty.inspect.aop.AuthAnnotation
;
import
com.zjty.inspect.entity.Config
;
import
com.zjty.inspect.entity.Config
;
import
com.zjty.inspect.entity.RuleQo
;
import
com.zjty.inspect.entity.RuleQo
;
import
com.zjty.inspect.service.ConfigService
;
import
com.zjty.inspect.service.ConfigService
;
...
@@ -38,6 +39,7 @@ public class ConfigController {
...
@@ -38,6 +39,7 @@ public class ConfigController {
*/
*/
@PostMapping
(
"/updates"
)
@PostMapping
(
"/updates"
)
@ApiOperation
(
"根据id修改参数,需要传id和value"
)
@ApiOperation
(
"根据id修改参数,需要传id和value"
)
@AuthAnnotation
(
code
=
{
"1300"
})
public
ResponseEntity
update
(
@RequestBody
List
<
Config
>
configs
){
public
ResponseEntity
update
(
@RequestBody
List
<
Config
>
configs
){
configService
.
updateConfig
(
configs
);
configService
.
updateConfig
(
configs
);
return
ResponseEntity
.
ok
(
200
);
return
ResponseEntity
.
ok
(
200
);
...
...
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
6a1ea083
package
com
.
zjty
.
inspect
.
controller
;
package
com
.
zjty
.
inspect
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.zjty.inspect.aop.AuthAnnotation
;
import
com.zjty.inspect.dao.ConfigParamDao
;
import
com.zjty.inspect.dao.ConfigParamDao
;
import
com.zjty.inspect.dao.TechnologyDao
;
import
com.zjty.inspect.dao.TechnologyDao
;
import
com.zjty.inspect.entity.*
;
import
com.zjty.inspect.entity.*
;
...
@@ -380,7 +381,7 @@ public class InspectController {
...
@@ -380,7 +381,7 @@ public class InspectController {
}
}
@PostMapping
(
"/uploads"
)
@PostMapping
(
"/uploads"
)
private
ResponseEntity
uploads
(
@RequestParam
(
value
=
"file"
)
MultipartFile
multfile
,
String
s
)
{
private
ResponseEntity
uploads
(
@RequestParam
(
value
=
"file"
)
MultipartFile
multfile
)
{
try
{
try
{
File
file
=
FileUtil
.
saveToLocal
(
multfile
);
File
file
=
FileUtil
.
saveToLocal
(
multfile
);
String
name
=
file
.
getName
();
String
name
=
file
.
getName
();
...
@@ -388,7 +389,7 @@ public class InspectController {
...
@@ -388,7 +389,7 @@ public class InspectController {
return
ResponseEntity
.
ok
(
new
com
.
zjty
.
inspect
.
entity
.
File
(
name
,
path
));
return
ResponseEntity
.
ok
(
new
com
.
zjty
.
inspect
.
entity
.
File
(
name
,
path
));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
ResponseEntity
.
ok
(
"上传失败"
);
return
ResponseEntity
.
status
(
500
).
build
(
);
}
}
}
}
...
...
src/main/java/com/zjty/inspect/controller/RuleController.java
浏览文件 @
6a1ea083
...
@@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
...
@@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -21,7 +22,7 @@ import java.util.Map;
...
@@ -21,7 +22,7 @@ import java.util.Map;
* @author Mcj
* @author Mcj
* @date 2020-02-26 14:42
* @date 2020-02-26 14:42
*/
*/
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/rule"
)
@RequestMapping
(
"/rule"
)
@Api
(
value
=
"规则页面管理接口"
,
description
=
"规则页面管理接口,提供页面的增、删、改、查"
)
@Api
(
value
=
"规则页面管理接口"
,
description
=
"规则页面管理接口,提供页面的增、删、改、查"
)
...
@@ -38,6 +39,7 @@ public class RuleController {
...
@@ -38,6 +39,7 @@ public class RuleController {
*/
*/
@PostMapping
@PostMapping
@ApiOperation
(
"新增规则"
)
@ApiOperation
(
"新增规则"
)
@AuthAnnotation
(
code
=
{
"1200"
,
"1400"
})
public
ResponseEntity
rule
(
@RequestBody
Rule
rule
){
public
ResponseEntity
rule
(
@RequestBody
Rule
rule
){
Rule
rule1
=
ruleService
.
addRulePlus
(
rule
);
Rule
rule1
=
ruleService
.
addRulePlus
(
rule
);
if
(
rule1
!=
null
){
if
(
rule1
!=
null
){
...
@@ -52,6 +54,7 @@ public class RuleController {
...
@@ -52,6 +54,7 @@ public class RuleController {
*/
*/
@PostMapping
(
value
=
"/update"
)
@PostMapping
(
value
=
"/update"
)
@ApiOperation
(
"修改规则"
)
@ApiOperation
(
"修改规则"
)
@AuthAnnotation
(
code
=
{
"1200"
,
"1400"
})
public
ResponseEntity
update
(
@RequestBody
Rule
rule
){
public
ResponseEntity
update
(
@RequestBody
Rule
rule
){
ruleService
.
upRulePlus
(
rule
);
ruleService
.
upRulePlus
(
rule
);
return
ResponseEntity
.
ok
(
200
);
return
ResponseEntity
.
ok
(
200
);
...
@@ -63,6 +66,7 @@ public class RuleController {
...
@@ -63,6 +66,7 @@ public class RuleController {
*/
*/
@ApiOperation
(
"根据数据封装删除规则"
)
@ApiOperation
(
"根据数据封装删除规则"
)
@DeleteMapping
@DeleteMapping
@AuthAnnotation
(
code
=
{
"1200"
,
"1400"
})
public
ResponseEntity
deleteByQo
(
@RequestBody
String
id
){
public
ResponseEntity
deleteByQo
(
@RequestBody
String
id
){
ruleService
.
deleteRulePlus
(
id
);
ruleService
.
deleteRulePlus
(
id
);
return
ResponseEntity
.
ok
(
200
);
return
ResponseEntity
.
ok
(
200
);
...
@@ -99,6 +103,7 @@ public class RuleController {
...
@@ -99,6 +103,7 @@ public class RuleController {
}
}
@PostMapping
(
"/importRules"
)
@PostMapping
(
"/importRules"
)
@ApiOperation
(
"导入所有规则"
)
@ApiOperation
(
"导入所有规则"
)
@AuthAnnotation
(
code
=
{
"1200"
})
public
ResponseEntity
importRules
(
@RequestParam
(
"file"
)
MultipartFile
file
){
public
ResponseEntity
importRules
(
@RequestParam
(
"file"
)
MultipartFile
file
){
ruleService
.
importRules
(
file
);
ruleService
.
importRules
(
file
);
return
null
;
return
null
;
...
...
src/main/java/com/zjty/inspect/controller/TechnologyController.java
浏览文件 @
6a1ea083
...
@@ -60,6 +60,7 @@ public class TechnologyController {
...
@@ -60,6 +60,7 @@ public class TechnologyController {
*/
*/
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
@ApiOperation
(
"新添加关键技术"
)
@ApiOperation
(
"新添加关键技术"
)
@AuthAnnotation
(
code
=
{
"1100"
})
public
ResponseEntity
addTechnologies
(
@RequestBody
Technology
technology
){
public
ResponseEntity
addTechnologies
(
@RequestBody
Technology
technology
){
technologyService
.
add
(
technology
);
technologyService
.
add
(
technology
);
return
ResponseEntity
.
ok
(
200
);
return
ResponseEntity
.
ok
(
200
);
...
@@ -67,6 +68,7 @@ public class TechnologyController {
...
@@ -67,6 +68,7 @@ public class TechnologyController {
}
}
@PostMapping
(
value
=
"/{id}"
)
@PostMapping
(
value
=
"/{id}"
)
@ApiOperation
(
"修改关键技术"
)
@ApiOperation
(
"修改关键技术"
)
@AuthAnnotation
(
code
=
{
"1100"
})
public
ResponseEntity
update
(
@RequestBody
Technology
technology
,
@PathVariable
String
id
){
public
ResponseEntity
update
(
@RequestBody
Technology
technology
,
@PathVariable
String
id
){
technology
.
setId
(
id
);
technology
.
setId
(
id
);
technologyService
.
update
(
technology
);
technologyService
.
update
(
technology
);
...
...
src/main/java/com/zjty/inspect/utils/ExcelUtil.java
浏览文件 @
6a1ea083
...
@@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -33,9 +34,8 @@ public class ExcelUtil {
...
@@ -33,9 +34,8 @@ public class ExcelUtil {
public
static
Reform
parseExcel
(
MultipartFile
f1
)
{
public
static
Reform
parseExcel
(
MultipartFile
f1
)
{
try
{
try
{
File
f
=
new
File
(
"/Users/mcj/文章/工作文档/调研表.xlsx"
);
InputStream
fileInputStream
=
f1
.
getInputStream
();
FileInputStream
fileInputStream
=
new
FileInputStream
(
f
);
String
[]
split
=
Objects
.
requireNonNull
(
f1
.
getOriginalFilename
()).
split
(
"\\."
);
String
[]
split
=
Objects
.
requireNonNull
(
f
.
getName
()).
split
(
"\\."
);
if
(
xlsx
.
equals
(
split
[
1
]))
{
if
(
xlsx
.
equals
(
split
[
1
]))
{
XSSFWorkbook
xwb
=
new
XSSFWorkbook
(
fileInputStream
);
XSSFWorkbook
xwb
=
new
XSSFWorkbook
(
fileInputStream
);
//3、得到Excel工作表对象
//3、得到Excel工作表对象
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论