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
cbe4a1e7
Commit
cbe4a1e7
authored
May 25, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增bug池里bug持续时间统计接口
parent
45ebcbe8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
JiraController.java
...ain/java/cn/qg/holmes/controller/jira/JiraController.java
+35
-0
No files found.
src/main/java/cn/qg/holmes/controller/jira/JiraController.java
View file @
cbe4a1e7
package
cn
.
qg
.
holmes
.
controller
.
jira
;
package
cn
.
qg
.
holmes
.
controller
.
jira
;
import
cn.qg.holmes.common.JsonResult
;
import
cn.qg.holmes.common.JsonResult
;
import
cn.qg.holmes.entity.jira.JiraBugPool
;
import
cn.qg.holmes.entity.jira.SendScheduleVo
;
import
cn.qg.holmes.entity.jira.SendScheduleVo
;
import
cn.qg.holmes.service.jira.JiraBugPoolService
;
import
cn.qg.holmes.service.jira.JiraIssueService
;
import
cn.qg.holmes.service.jira.JiraIssueService
;
import
cn.qg.holmes.utils.DingdingUtils
;
import
cn.qg.holmes.utils.DingdingUtils
;
import
com.atlassian.jira.rest.client.api.domain.Issue
;
import
com.atlassian.jira.rest.client.api.domain.Issue
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -23,6 +26,9 @@ public class JiraController {
...
@@ -23,6 +26,9 @@ public class JiraController {
@Autowired
@Autowired
JiraIssueService
jiraIssueService
;
JiraIssueService
jiraIssueService
;
@Autowired
JiraBugPoolService
jiraBugPoolService
;
@GetMapping
(
"/report/project"
)
@GetMapping
(
"/report/project"
)
public
void
sendReportToDingdingGroup
(
String
project
,
String
webhook
)
throws
Exception
{
public
void
sendReportToDingdingGroup
(
String
project
,
String
webhook
)
throws
Exception
{
Iterable
<
Issue
>
issues
=
jiraIssueService
.
getUnsolvedIssueListByProject
(
project
);
Iterable
<
Issue
>
issues
=
jiraIssueService
.
getUnsolvedIssueListByProject
(
project
);
...
@@ -66,4 +72,33 @@ public class JiraController {
...
@@ -66,4 +72,33 @@ public class JiraController {
}
}
return
JsonResult
.
buildSuccessResult
(
result
);
return
JsonResult
.
buildSuccessResult
(
result
);
}
}
@GetMapping
(
"/bug/pool/caculate"
)
public
JsonResult
bugPoolCaculateFixTime
()
throws
Exception
{
QueryWrapper
<
JiraBugPool
>
jiraBugPoolQueryWrapper
=
new
QueryWrapper
<>();
jiraBugPoolQueryWrapper
.
eq
(
"enable"
,
1
);
List
<
JiraBugPool
>
jiraBugPoolList
=
jiraBugPoolService
.
list
(
jiraBugPoolQueryWrapper
);
List
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
for
(
JiraBugPool
jiraBugPool
:
jiraBugPoolList
)
{
Issue
issue
=
jiraIssueService
.
getJiraIssueByKey
(
jiraBugPool
.
getKey
());
String
resolveResult
=
issue
.
getStatus
().
getName
();
DateTime
startDate
=
issue
.
getCreationDate
();
DateTime
endDate
;
// 如果已解决或已关闭,仅修改状态
if
(
resolveResult
.
equals
(
"已解决"
)
||
resolveResult
.
equals
(
"关闭"
))
{
// jiraBugPool.setEnable(0);
// 更新状态
// jiraBugPoolService.saveOrUpdate(jiraBugPool);
endDate
=
DateTime
.
parse
(
issue
.
getFieldByName
(
"已解决"
).
getValue
().
toString
());
}
else
{
endDate
=
issue
.
getUpdateDate
();
}
int
duration
=
jiraIssueService
.
calculateBugFixTime
(
startDate
,
endDate
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"title"
,
issue
.
getSummary
());
map
.
put
(
"解决时长"
,
duration
);
mapList
.
add
(
map
);
}
return
JsonResult
.
buildSuccessResult
(
mapList
);
}
}
}
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