Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
adaptation-master
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
adaptation-master
Commits
5ebe36dc
提交
5ebe36dc
authored
12月 19, 2019
作者:
czq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
czq
接口bug修改
上级
fc81d2d8
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
91 行增加
和
21 行删除
+91
-21
AdaptationController.java
...tationmaster/adaptor/controller/AdaptationController.java
+16
-16
AdaptRequest.java
...om/zjty/adaptationmaster/adaptor/entity/AdaptRequest.java
+24
-0
Project.java
...ava/com/zjty/adaptationmaster/adaptor/entity/Project.java
+9
-0
Rule.java
...n/java/com/zjty/adaptationmaster/adaptor/entity/Rule.java
+2
-2
DependencyServiceImpl.java
...ionmaster/adaptor/service/Impl/DependencyServiceImpl.java
+1
-1
RuleServiceImpl.java
...daptationmaster/adaptor/service/Impl/RuleServiceImpl.java
+5
-2
MyWebConfig.java
...in/java/com/zjty/adaptationmaster/config/MyWebConfig.java
+34
-0
没有找到文件。
src/main/java/com/zjty/adaptationmaster/adaptor/controller/AdaptationController.java
浏览文件 @
5ebe36dc
package
com
.
zjty
.
adaptationmaster
.
adaptor
.
controller
;
package
com
.
zjty
.
adaptationmaster
.
adaptor
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.zjty.adaptationmaster.adaptor.entity.AdaptRequest
;
import
com.zjty.adaptationmaster.adaptor.entity.Project
;
import
com.zjty.adaptationmaster.adaptor.entity.Project
;
import
com.zjty.adaptationmaster.adaptor.entity.Rule
;
import
com.zjty.adaptationmaster.adaptor.entity.Rule
;
import
com.zjty.adaptationmaster.adaptor.service.AdaptationService
;
import
com.zjty.adaptationmaster.adaptor.service.AdaptationService
;
import
com.zjty.adaptationmaster.base.response.ServerResponse
;
import
com.zjty.adaptationmaster.base.response.ServerResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.UUID
;
@Controller
@
Rest
Controller
@RequestMapping
(
"/adapt"
)
@RequestMapping
(
"/adapt"
)
public
class
AdaptationController
{
public
class
AdaptationController
{
@GetMapping
(
"/getUUID"
)
@GetMapping
(
"/getUUID"
)
...
@@ -24,27 +24,27 @@ public class AdaptationController {
...
@@ -24,27 +24,27 @@ public class AdaptationController {
@Autowired
@Autowired
private
AdaptationService
adaptationService
;
private
AdaptationService
adaptationService
;
@PostMapping
(
"/adapt"
)
@PostMapping
(
"/adapt"
)
public
ServerResponse
adapt
(
Project
project
,
List
<
Rule
>
ruleList
,
String
uuid
)
throws
IOException
{
public
ServerResponse
adapt
(
@RequestBody
AdaptRequest
adaptRequest
)
throws
IOException
{
return
adaptationService
.
adapt
(
project
,
ruleList
,
uuid
);
return
adaptationService
.
adapt
(
adaptRequest
.
getProject
(),
adaptRequest
.
getRuleList
(),
adaptRequest
.
getUuid
()
);
}
}
@PostMapping
(
"/compile"
)
@PostMapping
(
"/compile"
)
public
ServerResponse
compile
(
Project
project
,
String
uuid
){
public
ServerResponse
compile
(
@RequestBody
AdaptRequest
adaptRequest
){
return
adaptationService
.
compile
(
project
,
uuid
);
return
adaptationService
.
compile
(
adaptRequest
.
getProject
(),
adaptRequest
.
getUuid
()
);
}
}
@PostMapping
(
"/deploy"
)
@PostMapping
(
"/deploy"
)
public
ServerResponse
deploy
(
Project
project
,
String
uuid
){
public
ServerResponse
deploy
(
@RequestBody
AdaptRequest
adaptRequest
){
return
adaptationService
.
deploy
(
project
,
uuid
);
return
adaptationService
.
deploy
(
adaptRequest
.
getProject
(),
adaptRequest
.
getUuid
()
);
}
}
@PostMapping
(
"/startInApusic"
)
@PostMapping
(
"/startInApusic"
)
public
ServerResponse
startInApusic
(
Project
project
,
String
uuid
){
public
ServerResponse
startInApusic
(
@RequestBody
AdaptRequest
adaptRequest
){
return
adaptationService
.
start
(
project
,
uuid
);
return
adaptationService
.
start
(
adaptRequest
.
getProject
(),
adaptRequest
.
getUuid
()
);
}
}
@PostMapping
(
"/stopInApusic"
)
@PostMapping
(
"/stopInApusic"
)
public
ServerResponse
stopInApusic
(
Project
project
,
String
uuid
){
public
ServerResponse
stopInApusic
(
@RequestBody
AdaptRequest
adaptRequest
){
return
adaptationService
.
stop
(
project
,
uuid
);
return
adaptationService
.
stop
(
adaptRequest
.
getProject
(),
adaptRequest
.
getUuid
()
);
}
}
@PostMapping
(
"/unzipProject"
)
@PostMapping
(
"/unzipProject"
)
public
ServerResponse
unZipProject
(
String
path
,
Project
projec
t
){
public
ServerResponse
unZipProject
(
@RequestBody
AdaptRequest
adaptReques
t
){
return
adaptationService
.
unZipProject
(
path
,
project
);
return
adaptationService
.
unZipProject
(
adaptRequest
.
getPath
(),
adaptRequest
.
getProject
()
);
}
}
}
}
src/main/java/com/zjty/adaptationmaster/adaptor/entity/AdaptRequest.java
0 → 100644
浏览文件 @
5ebe36dc
package
com
.
zjty
.
adaptationmaster
.
adaptor
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
java.util.List
;
/**
* <h4>Description : adaptation-master</h4>
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2019-12-19 11:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
AdaptRequest
{
private
Project
project
;
private
List
<
Rule
>
ruleList
;
private
String
uuid
;
private
String
path
;
}
src/main/java/com/zjty/adaptationmaster/adaptor/entity/Project.java
浏览文件 @
5ebe36dc
...
@@ -22,24 +22,33 @@ public class Project {
...
@@ -22,24 +22,33 @@ public class Project {
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
private
Integer
id
;
@Column
(
unique
=
true
)
@Column
(
unique
=
true
)
private
String
projectName
;
//项目名称
private
String
projectName
;
//项目名称
private
String
codeUrl
;
//当前源码源码路径
private
String
codeUrl
;
//当前源码源码路径
private
Integer
status
=
1
;
//状态(0:删除 1:未删除)
private
Integer
status
=
1
;
//状态(0:删除 1:未删除)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
startTime
=
new
Date
();
//开始时间
private
Date
startTime
=
new
Date
();
//开始时间
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
updateTime
;
//更新时间
private
Date
updateTime
;
//更新时间
@OneToMany
(
mappedBy
=
"project"
,
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
EAGER
)
@OneToMany
(
mappedBy
=
"project"
,
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
EAGER
)
private
List
<
Rule
>
rules
;
//自定义的规则
private
List
<
Rule
>
rules
;
//自定义的规则
@ManyToMany
@ManyToMany
@JoinTable
(
name
=
"project_ruleSet"
,
@JoinTable
(
name
=
"project_ruleSet"
,
joinColumns
=
@JoinColumn
(
name
=
"p_id"
,
referencedColumnName
=
"id"
),
joinColumns
=
@JoinColumn
(
name
=
"p_id"
,
referencedColumnName
=
"id"
),
inverseJoinColumns
=
@JoinColumn
(
name
=
"r_id"
,
referencedColumnName
=
"id"
))
inverseJoinColumns
=
@JoinColumn
(
name
=
"r_id"
,
referencedColumnName
=
"id"
))
private
List
<
RuleSet
>
ruleSets
;
//规则集
private
List
<
RuleSet
>
ruleSets
;
//规则集
private
boolean
compileSuccess
=
false
;
private
boolean
compileSuccess
=
false
;
@OneToOne
@OneToOne
private
Report
report
;
private
Report
report
;
private
boolean
deploySuccess
=
false
;
private
boolean
deploySuccess
=
false
;
}
}
src/main/java/com/zjty/adaptationmaster/adaptor/entity/Rule.java
浏览文件 @
5ebe36dc
...
@@ -42,11 +42,11 @@ public class Rule {
...
@@ -42,11 +42,11 @@ public class Rule {
private
String
replacing
;
//更改方式 全文替换/正则替换
private
String
replacing
;
//更改方式 全文替换/正则替换
public
enum
MatchType
{
public
enum
MatchType
{
PATH
,
NAME
,
SUFFIX
PATH
,
NAME
,
SUFFIX
,
GLOB
}
}
public
enum
TextMatch
{
public
enum
TextMatch
{
AREA
AREA
,
CONTENT
}
}
public
enum
DealWay
{
public
enum
DealWay
{
...
...
src/main/java/com/zjty/adaptationmaster/adaptor/service/Impl/DependencyServiceImpl.java
浏览文件 @
5ebe36dc
...
@@ -43,7 +43,7 @@ public class DependencyServiceImpl implements DependencyService {
...
@@ -43,7 +43,7 @@ public class DependencyServiceImpl implements DependencyService {
//依赖名称
//依赖名称
String
originalFilename
=
dependencyFile
.
getOriginalFilename
();
String
originalFilename
=
dependencyFile
.
getOriginalFilename
();
assert
originalFilename
!=
null
;
assert
originalFilename
!=
null
;
dependency
.
setDependencyUrl
(
Const
.
UPLOAD_LOCATION
+
originalFilename
);
dependency
.
setDependencyUrl
(
"/uploads/"
+
originalFilename
);
dependency
.
setStartTime
(
new
Date
());
dependency
.
setStartTime
(
new
Date
());
try
{
try
{
InputStream
inputStream
=
dependencyFile
.
getInputStream
();
InputStream
inputStream
=
dependencyFile
.
getInputStream
();
...
...
src/main/java/com/zjty/adaptationmaster/adaptor/service/Impl/RuleServiceImpl.java
浏览文件 @
5ebe36dc
...
@@ -44,6 +44,7 @@ public class RuleServiceImpl implements RuleService{
...
@@ -44,6 +44,7 @@ public class RuleServiceImpl implements RuleService{
@Override
@Override
public
ServerResponse
addRuleSet
(
RuleSet
ruleSet
)
{
public
ServerResponse
addRuleSet
(
RuleSet
ruleSet
)
{
List
<
Rule
>
ruleList
=
ruleSet
.
getRuleList
();
List
<
Rule
>
ruleList
=
ruleSet
.
getRuleList
();
if
(
ruleList
!=
null
)
ruleList
.
forEach
(
rule
->
rule
.
setRuleSet
(
ruleSet
));
ruleList
.
forEach
(
rule
->
rule
.
setRuleSet
(
ruleSet
));
RuleSet
save
=
ruleSetDao
.
save
(
ruleSet
);
RuleSet
save
=
ruleSetDao
.
save
(
ruleSet
);
return
ServerResponse
.
success
(
filter
(
save
));
return
ServerResponse
.
success
(
filter
(
save
));
...
@@ -99,8 +100,10 @@ public class RuleServiceImpl implements RuleService{
...
@@ -99,8 +100,10 @@ public class RuleServiceImpl implements RuleService{
private
RuleSet
filter
(
RuleSet
ruleSet
){
private
RuleSet
filter
(
RuleSet
ruleSet
){
List
<
Rule
>
rules
=
ruleSet
.
getRuleList
();
List
<
Rule
>
rules
=
ruleSet
.
getRuleList
();
List
<
Rule
>
collect
=
rules
.
stream
().
filter
(
rule
->
rule
.
getStatus
()
!=
0
).
collect
(
toList
());
if
(
rules
!=
null
){
ruleSet
.
setRuleList
(
collect
);
List
<
Rule
>
collect
=
rules
.
stream
().
filter
(
rule
->
rule
.
getStatus
()
!=
0
).
collect
(
toList
());
ruleSet
.
setRuleList
(
collect
);
}
return
ruleSet
;
return
ruleSet
;
}
}
}
}
src/main/java/com/zjty/adaptationmaster/config/MyWebConfig.java
0 → 100644
浏览文件 @
5ebe36dc
package
com
.
zjty
.
adaptationmaster
.
config
;
import
com.zjty.adaptationmaster.base.enums.Const
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.CorsRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
java.io.File
;
/**
* <h4>Description : businessservice</h4>
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2018/4/19 13:29
*/
@Configuration
public
class
MyWebConfig
extends
WebMvcConfigurerAdapter
{
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
File
file1
=
new
File
(
Const
.
UPLOAD_LOCATION
);
//如果文件夹不存在则创建
if
(!
file1
.
exists
())
{
file1
.
mkdirs
();
}
else
{
System
.
out
.
println
(
"//目录存在"
);
}
// registry.addResourceHandler("/src/main/resources/**").addResourceLocations("classpath:/resources/uploads/");
registry
.
addResourceHandler
(
"/uploads/**"
).
addResourceLocations
(
"file:"
+
Const
.
UPLOAD_LOCATION
);
super
.
addResourceHandlers
(
registry
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论