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
fca938a4
Commit
fca938a4
authored
Nov 25, 2022
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增提测说明和测试流程洗数据接口
parent
5b62110c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
128 additions
and
1 deletion
+128
-1
EffectController.java
...java/cn/qg/holmes/controller/effect/EffectController.java
+128
-1
No files found.
src/main/java/cn/qg/holmes/controller/effect/EffectController.java
View file @
fca938a4
...
@@ -2,9 +2,14 @@ package cn.qg.holmes.controller.effect;
...
@@ -2,9 +2,14 @@ package cn.qg.holmes.controller.effect;
import
cn.qg.holmes.common.JsonResult
;
import
cn.qg.holmes.common.JsonResult
;
import
cn.qg.holmes.entity.effect.ClearCache
;
import
cn.qg.holmes.entity.effect.ClearCache
;
import
cn.qg.holmes.entity.quality.DingRobot
;
import
cn.qg.holmes.entity.quality.SubmitTestInstruction
;
import
cn.qg.holmes.service.effect.ClearCacheService
;
import
cn.qg.holmes.service.effect.ClearCacheService
;
import
cn.qg.holmes.service.quality.DingRobotService
;
import
cn.qg.holmes.service.quality.SubmitTestInstructionService
;
import
cn.qg.holmes.utils.HttpClientUtils
;
import
cn.qg.holmes.utils.HttpClientUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -13,7 +18,7 @@ import org.springframework.web.bind.annotation.GetMapping;
...
@@ -13,7 +18,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.
Map
;
import
java.util.
*
;
@Slf4j
@Slf4j
@CrossOrigin
@CrossOrigin
...
@@ -24,6 +29,11 @@ public class EffectController {
...
@@ -24,6 +29,11 @@ public class EffectController {
@Autowired
@Autowired
ClearCacheService
clearCacheService
;
ClearCacheService
clearCacheService
;
@Autowired
DingRobotService
dingRobotService
;
@Autowired
SubmitTestInstructionService
submitTestInstructionService
;
/**
/**
* 获取清缓存实体列表
* 获取清缓存实体列表
* @return
* @return
...
@@ -53,4 +63,121 @@ public class EffectController {
...
@@ -53,4 +63,121 @@ public class EffectController {
String
result
=
HttpClientUtils
.
doGet
(
url
);
String
result
=
HttpClientUtils
.
doGet
(
url
);
return
JsonResult
.
buildSuccessResult
(
JSON
.
parseObject
(
result
,
Map
.
class
));
return
JsonResult
.
buildSuccessResult
(
JSON
.
parseObject
(
result
,
Map
.
class
));
}
}
@GetMapping
(
"/qa/transfer"
)
public
JsonResult
transferData
()
{
String
doraemonUrl
=
"https://doraemon.quantgroups.cn/qa/process/transfer"
;
List
<
DingRobot
>
dingRobotList
=
dingRobotService
.
list
();
for
(
DingRobot
dingRobot:
dingRobotList
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"projectName"
,
dingRobot
.
getProjectName
());
String
jiraKey
=
dingRobot
.
getJiraProjectKey
();
// 1-toc, 2-tob, 3-金融,4-大数据
int
bizLineId
;
switch
(
jiraKey
)
{
case
"YXM"
:
case
"GYL"
:
case
"DDMPT"
:
bizLineId
=
1
;
break
;
case
"SAAS"
:
bizLineId
=
2
;
break
;
case
"KA"
:
case
"ZF"
:
bizLineId
=
3
;
break
;
case
"BD"
:
case
"DATA"
:
bizLineId
=
4
;
break
;
default
:
bizLineId
=
1
;
break
;
}
jsonObject
.
put
(
"businessLineId"
,
bizLineId
);
jsonObject
.
put
(
"jiraKey"
,
jiraKey
);
jsonObject
.
put
(
"dingUrl"
,
dingRobot
.
getDingUrl
());
Integer
insId
=
dingRobot
.
getSubmitTestInstructionId
();
if
(
insId
!=
null
)
{
SubmitTestInstruction
testInstruction
=
submitTestInstructionService
.
getById
(
insId
);
if
(
testInstruction
!=
null
)
{
// 服务与分支
List
<
Map
<
String
,
String
>>
newMapList
=
new
ArrayList
<>();
String
serviceAndBranch
=
testInstruction
.
getServiceAndBranch
();
if
(!
StringUtils
.
isEmpty
(
serviceAndBranch
))
{
List
<
Map
<
String
,
String
>>
mapList
=
JSON
.
parseObject
(
serviceAndBranch
,
List
.
class
);
for
(
Map
<
String
,
String
>
map:
mapList
)
{
Map
<
String
,
String
>
newMap
=
new
HashMap
<>();
newMap
.
put
(
"serviceName"
,
map
.
get
(
"serviceName"
));
newMap
.
put
(
"branchName"
,
map
.
get
(
"branch"
));
newMap
.
put
(
"developer"
,
map
.
get
(
"developer"
));
newMapList
.
add
(
newMap
);
}
}
jsonObject
.
put
(
"serviceAndBranchList"
,
newMapList
);
// apollo
Map
<
String
,
Object
>
apolloMap
=
new
HashMap
<>();
String
apollo
=
testInstruction
.
getApollo
();
if
(!
StringUtils
.
isEmpty
(
apollo
))
{
List
<
Map
<
String
,
String
>>
oldApolloList
=
JSON
.
parseObject
(
apollo
,
List
.
class
);
for
(
Map
<
String
,
String
>
map:
oldApolloList
)
{
String
projectName
=
map
.
get
(
"projectName"
);
if
(
apolloMap
.
containsKey
(
projectName
))
{
List
<
Map
<
String
,
String
>>
alreadyList
=
(
List
<
Map
<
String
,
String
>>)
apolloMap
.
get
(
projectName
);
Map
<
String
,
String
>
tempMap
=
new
HashMap
<>();
tempMap
.
put
(
"key"
,
map
.
get
(
"key"
));
tempMap
.
put
(
"value"
,
map
.
get
(
"value"
));
alreadyList
.
add
(
tempMap
);
apolloMap
.
put
(
projectName
,
alreadyList
);
}
else
{
List
<
Map
<
String
,
String
>>
newList
=
new
ArrayList
<>();
Map
<
String
,
String
>
tempMap
=
new
HashMap
<>();
tempMap
.
put
(
"key"
,
map
.
get
(
"key"
));
tempMap
.
put
(
"value"
,
map
.
get
(
"value"
));
newList
.
add
(
tempMap
);
apolloMap
.
put
(
projectName
,
newList
);
}
}
}
jsonObject
.
put
(
"apolloUpdate"
,
apolloMap
);
// 数据库
StringBuilder
sb
=
new
StringBuilder
();
String
database
=
testInstruction
.
getDatabase
();
if
(!
StringUtils
.
isEmpty
(
database
))
{
List
<
Map
<
String
,
String
>>
dbList
=
JSON
.
parseObject
(
database
,
List
.
class
);
for
(
Map
<
String
,
String
>
map:
dbList
)
{
sb
.
append
(
map
.
get
(
"sql"
));
sb
.
append
(
"\n"
);
}
}
jsonObject
.
put
(
"databaseUpdate"
,
sb
.
toString
());
jsonObject
.
put
(
"prodDocument"
,
testInstruction
.
getRequirement
());
jsonObject
.
put
(
"interfaceDocument"
,
testInstruction
.
getApi
());
jsonObject
.
put
(
"remark"
,
testInstruction
.
getScope
());
}
}
jsonObject
.
put
(
"env"
,
dingRobot
.
getNamespace
());
jsonObject
.
put
(
"refuseNum"
,
dingRobot
.
getRepulseNum
());
// 项目状态
Integer
oldStatus
=
dingRobot
.
getStatus
();
if
(
oldStatus
==
1
)
{
jsonObject
.
put
(
"status"
,
1
);
}
else
if
(
oldStatus
==
2
)
{
jsonObject
.
put
(
"progress"
,
100
D
);
jsonObject
.
put
(
"status"
,
3
);
}
else
{
jsonObject
.
put
(
"progress"
,
100
D
);
jsonObject
.
put
(
"status"
,
3
);
}
jsonObject
.
put
(
"creator"
,
dingRobot
.
getCreator
());
String
response
=
HttpClientUtils
.
doPostJson
(
doraemonUrl
,
null
,
jsonObject
.
toJSONString
());
log
.
info
(
response
);
}
return
JsonResult
.
buildSuccessResult
(
"trasnfer成功"
);
}
}
}
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