Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
holmes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
holmes
Commits
fe7e4057
Commit
fe7e4057
authored
Sep 18, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增状态字段,dingrobot创建人从token获取
parent
a283706a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
PipelineController.java
...va/cn/qg/holmes/controller/gitlab/PipelineController.java
+41
-1
DingRobot.java
src/main/java/cn/qg/holmes/entity/jira/DingRobot.java
+19
-0
No files found.
src/main/java/cn/qg/holmes/controller/gitlab/PipelineController.java
View file @
fe7e4057
...
...
@@ -2,9 +2,11 @@ package cn.qg.holmes.controller.gitlab;
import
cn.qg.holmes.common.JsonResult
;
import
cn.qg.holmes.config.annotation.RequiresPermissions
;
import
cn.qg.holmes.entity.auth.UserInfoVo
;
import
cn.qg.holmes.entity.gitlab.DingRobotPipelineVo
;
import
cn.qg.holmes.entity.gitlab.Pipeline
;
import
cn.qg.holmes.entity.jira.DingRobot
;
import
cn.qg.holmes.service.auth.TokenService
;
import
cn.qg.holmes.service.gitlab.PipelineService
;
import
cn.qg.holmes.service.jira.DingRobotService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -35,6 +37,12 @@ public class PipelineController {
@Autowired
DingRobotService
dingRobotService
;
@Autowired
HttpServletRequest
servletRequest
;
@Autowired
TokenService
tokenService
;
/**
* gitlab webhook
* @param request
...
...
@@ -57,7 +65,7 @@ public class PipelineController {
}
@GetMapping
(
"/list"
)
public
JsonResult
getDingRobotAndPipelineList
(
String
jiraProjectKey
,
String
projectName
,
String
namespace
,
public
JsonResult
getDingRobotAndPipelineList
(
String
jiraProjectKey
,
String
projectName
,
String
namespace
,
Integer
status
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
)
{
IPage
<
DingRobot
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
...
...
@@ -71,6 +79,9 @@ public class PipelineController {
if
(!
StringUtils
.
isEmpty
(
namespace
))
{
dingRobotQueryWrapper
.
eq
(
"namespace"
,
namespace
);
}
if
(
status
!=
null
)
{
dingRobotQueryWrapper
.
eq
(
"status"
,
status
);
}
dingRobotQueryWrapper
.
orderByDesc
(
"id"
);
IPage
<
DingRobot
>
projectRobotIPage
=
dingRobotService
.
page
(
page
,
dingRobotQueryWrapper
);
List
<
DingRobot
>
dingRobotList
=
projectRobotIPage
.
getRecords
();
...
...
@@ -99,6 +110,10 @@ public class PipelineController {
public
JsonResult
addRobotAndPipeline
(
@RequestBody
DingRobotPipelineVo
dingRobotPipelineVo
)
{
try
{
DingRobot
dingRobot
=
dingRobotPipelineVo
.
getDingRobot
();
// 设置创建人
String
token
=
servletRequest
.
getHeader
(
"token"
);
UserInfoVo
userInfoVo
=
tokenService
.
getUserInfoFromCache
(
token
);
dingRobot
.
setCreator
(
userInfoVo
.
getChineseName
());
String
projectName
=
dingRobot
.
getProjectName
();
String
jiraProjectKey
=
dingRobot
.
getJiraProjectKey
();
QueryWrapper
<
DingRobot
>
dingRobotQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -205,4 +220,29 @@ public class PipelineController {
}
}
/**
* 更新状态
* @param dingRobotId 机器人id
* @param status 状态,1-进行中,2-已完成
* @return
*/
@RequiresPermissions
(
"qa:process:finish"
)
@PostMapping
(
"/finish"
)
public
JsonResult
finishPipeline
(
@RequestParam
Integer
dingRobotId
,
@RequestParam
Integer
status
)
{
try
{
DingRobot
dingRobot
=
dingRobotService
.
getById
(
dingRobotId
);
if
(
dingRobot
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"该测试流程不存在!"
,
false
);
}
// 设置状态为已完成
dingRobot
.
setStatus
(
status
);
if
(!
dingRobotService
.
updateById
(
dingRobot
))
{
return
JsonResult
.
buildErrorStateResult
(
"更新状态失败!"
,
false
);
}
return
JsonResult
.
buildSuccessResult
(
"更新状态成功"
,
true
);
}
catch
(
Exception
e
)
{
return
JsonResult
.
buildErrorStateResult
(
"删除失败"
,
false
);
}
}
}
src/main/java/cn/qg/holmes/entity/jira/DingRobot.java
View file @
fe7e4057
...
...
@@ -13,11 +13,30 @@ import java.util.Date;
public
class
DingRobot
{
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 项目名称,与提BUG时【】里的内容进行匹配
*/
private
String
projectName
;
/**
* jira项目关键字
*/
private
String
jiraProjectKey
;
/**
* 钉钉机器人webhook
*/
private
String
dingUrl
;
/**
* 创建人
*/
private
String
creator
;
/**
* 环境
*/
private
String
namespace
;
/**
* 1-进行中,2-已完成
*/
private
Integer
status
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment