Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
21b6711e
提交
21b6711e
authored
3月 09, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mcj:更新git上传接口
上级
ce64c408
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
8 行删除
+6
-8
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+2
-2
GitLabUtil.java
src/main/java/com/zjty/inspect/utils/GitLabUtil.java
+4
-6
没有找到文件。
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
21b6711e
...
...
@@ -378,7 +378,7 @@ public class InspectController {
}
@PostMapping
(
"/uploads"
)
private
ResponseEntity
uploads
(
@RequestParam
(
value
=
"file"
)
MultipartFile
multfile
){
private
ResponseEntity
uploads
(
@RequestParam
(
value
=
"file"
)
MultipartFile
multfile
,
String
s
){
try
{
File
file
=
FileUtil
.
saveToLocal
(
multfile
);
String
name
=
file
.
getName
();
...
...
@@ -390,7 +390,7 @@ public class InspectController {
}
}
@PostMapping
(
"/gitdownload"
)
private
ResponseEntity
gitDownloads
(
String
gitAddress
){
private
ResponseEntity
gitDownloads
(
String
gitAddress
,
String
username
,
String
password
){
String
gitPath
=
GitLabUtil
.
downLoadProject
(
gitAddress
);
return
ResponseEntity
.
ok
(
gitPath
);
}
...
...
src/main/java/com/zjty/inspect/utils/GitLabUtil.java
浏览文件 @
21b6711e
...
...
@@ -3,6 +3,7 @@ package com.zjty.inspect.utils;
import
org.eclipse.jgit.api.CloneCommand
;
import
org.eclipse.jgit.api.Git
;
import
org.eclipse.jgit.api.errors.GitAPIException
;
import
org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
...
...
@@ -16,7 +17,7 @@ import java.time.LocalDate;
@Component
public
class
GitLabUtil
{
public
static
String
downLoadProject
(
String
path
)
{
public
static
String
downLoadProject
(
String
path
,
String
username
,
String
password
)
{
String
name1
=
LocalDate
.
now
().
toString
();
String
[]
split1
=
UUIDUtil
.
getUUID
().
split
(
"-"
);
//String REMOTE_URL = "https://git.yfzx.zjtys.com.cn:8888/912-system/monitor/adaptation-master.git";
...
...
@@ -25,7 +26,9 @@ public class GitLabUtil {
File
file
=
new
File
(
"./"
+
name1
+
"/"
+
split1
[
0
]+
"/"
);
file
.
mkdirs
();
cloneCommand
.
setDirectory
(
file
);
cloneCommand
.
setCredentialsProvider
(
new
UsernamePasswordCredentialsProvider
(
username
,
password
));
try
{
cloneCommand
.
call
();
}
catch
(
GitAPIException
e
)
{
e
.
printStackTrace
();
...
...
@@ -38,11 +41,6 @@ public class GitLabUtil {
return
file
.
getAbsolutePath
();
}
public
static
void
main
(
String
[]
args
)
{
String
hostsss
=
GitLabUtil
.
downLoadProject
(
"https://git.yfzx.zjtys.com.cn/912-system/monitor/inspect.git"
);
System
.
out
.
println
(
hostsss
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论