Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
f4b91a89
提交
f4b91a89
authored
3月 16, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mcj:代码结构优化,新增http异常处理
上级
b90b187d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
38 行增加
和
26 行删除
+38
-26
ExceptionHandlerConfig.java
.../java/com/zjty/inspect/config/ExceptionHandlerConfig.java
+30
-0
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+1
-4
InspectParameter.java
src/main/java/com/zjty/inspect/entity/InspectParameter.java
+1
-1
Language.java
src/main/java/com/zjty/inspect/enums/Language.java
+2
-19
Inspector.java
src/main/java/com/zjty/inspect/inspect/Inspector.java
+0
-0
InspectService.java
src/main/java/com/zjty/inspect/service/InspectService.java
+2
-1
InspectServiceImpl.java
...ava/com/zjty/inspect/service/impl/InspectServiceImpl.java
+2
-1
没有找到文件。
src/main/java/com/zjty/inspect/config/ExceptionHandlerConfig.java
0 → 100644
浏览文件 @
f4b91a89
package
com
.
zjty
.
inspect
.
config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
/**
* @author Mcj
* @date 2020-03-16 10:33
*/
@ControllerAdvice
@Slf4j
public
class
ExceptionHandlerConfig
{
@ExceptionHandler
(
value
=
HttpMessageNotReadableException
.
class
)
public
ResponseEntity
defaultErrorHandler
(
Exception
e
)
{
log
.
error
(
"异常{}"
,
e
);
return
ResponseEntity
.
badRequest
().
build
();
}
@ExceptionHandler
(
value
=
IOException
.
class
)
public
ResponseEntity
defaultIOHandler
(
Exception
e
)
{
log
.
error
(
"IO异常{}"
,
e
);
return
ResponseEntity
.
status
(
500
).
build
();
}
}
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
f4b91a89
...
...
@@ -45,9 +45,6 @@ public class InspectController {
@Autowired
private
TechnologyService
technologyService
;
@Autowired
private
ParameterService
parameterService
;
@Autowired
private
ReportService
reportService
;
...
...
@@ -135,7 +132,7 @@ public class InspectController {
}
@PostMapping
(
"/rapidAssessment"
)
public
ResponseEntity
rapidAssessment
(
@RequestBody
Reform
reform
){
public
ResponseEntity
rapidAssessment
(
@RequestBody
Reform
reform
)
throws
IOException
{
//输入参数
String
in
=
JSON
.
toJSONString
(
reform
);
Evaluation
evaluation
=
new
Evaluation
();
...
...
src/main/java/com/zjty/inspect/entity/InspectParameter.java
浏览文件 @
f4b91a89
...
...
@@ -35,7 +35,7 @@ public class InspectParameter {
private
Double
proportion
;
/**
*
年
利率
* 利率
*/
private
Double
moneyRate
;
...
...
src/main/java/com/zjty/inspect/enums/Language.java
浏览文件 @
f4b91a89
...
...
@@ -13,30 +13,18 @@ public enum Language {
*/
JAVA
(
"java"
,
1
),
VUE
(
"js"
,
2
),
PYTHON
(
"python"
,
3
),
ASP
(
"asp"
,
4
),
/**
* js
*/
JAVASCRIPT
(
"js"
,
5
),
/**
* go
*/
GO
(
"go"
,
6
),
/**
* html
*/
HTML
(
"html"
,
7
),
C
井
(
"c#"
,
8
),
C
(
"c++"
,
9
),
UNKNOW
(
"unknowun"
,
10
);
...
...
@@ -56,9 +44,4 @@ public enum Language {
public
Integer
getStatus
()
{
return
status
;
}
public
static
void
main
(
String
[]
args
)
{
Language
language
=
Language
.
valueOf
(
"VUE"
);
System
.
out
.
println
(
language
.
name
);
}
}
src/main/java/com/zjty/inspect/inspect/Inspector.java
浏览文件 @
f4b91a89
差异被折叠。
点击展开。
src/main/java/com/zjty/inspect/service/InspectService.java
浏览文件 @
f4b91a89
...
...
@@ -4,6 +4,7 @@ import com.zjty.inspect.entity.InspectParameter;
import
com.zjty.inspect.entity.Report
;
import
com.zjty.inspect.entity.ReportVo
;
import
java.io.IOException
;
import
java.util.Map
;
public
interface
InspectService
{
...
...
@@ -12,7 +13,7 @@ public interface InspectService {
* @param inspectParameter
* @return
*/
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
);
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
)
throws
IOException
;
String
generateHtml
(
String
templateContent
,
Map
model
);
...
...
src/main/java/com/zjty/inspect/service/impl/InspectServiceImpl.java
浏览文件 @
f4b91a89
...
...
@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.ui.freemarker.FreeMarkerTemplateUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -45,7 +46,7 @@ public class InspectServiceImpl implements InspectService {
@Transactional
@Override
public
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
)
{
public
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
)
throws
IOException
{
//统计文件后缀数量
Map
<
String
,
Language
>
suffixLanguageMapping
=
new
HashMap
<>();
suffixLanguageMapping
.
put
(
"java"
,
Language
.
JAVA
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论