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
bca2cb7e
Commit
bca2cb7e
authored
Nov 25, 2022
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改qa_process洗数据
parent
d56d16c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
77 deletions
+79
-77
EffectController.java
...java/cn/qg/holmes/controller/effect/EffectController.java
+79
-77
No files found.
src/main/java/cn/qg/holmes/controller/effect/EffectController.java
View file @
bca2cb7e
...
...
@@ -75,11 +75,12 @@ public class EffectController {
@GetMapping
(
"/qa/transfer"
)
public
JsonResult
transferData
()
{
String
doraemonUrl
=
"https://doraemon.quantgroups.cn/qa/process/transfer"
;
List
<
DingRobot
>
dingRobotList
=
dingRobotService
.
list
();
for
(
DingRobot
dingRobot:
dingRobotList
)
{
// String doraemonUrl = "http://localhost:8086/qa/process/transfer";
List
<
SubmitTestInstruction
>
submitTestInstructionList
=
submitTestInstructionService
.
list
();
for
(
SubmitTestInstruction
submitTestInstruction:
submitTestInstructionList
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"projectName"
,
dingRobot
.
getProjectName
());
String
jiraKey
=
dingRobot
.
getJiraProjectKey
();
jsonObject
.
put
(
"projectName"
,
submitTestInstruction
.
getProjectName
());
String
jiraKey
=
submitTestInstruction
.
getJiraProjectKey
();
// 1-toc, 2-tob, 3-金融,4-大数据
int
bizLineId
;
switch
(
jiraKey
)
{
...
...
@@ -105,83 +106,84 @@ public class EffectController {
}
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"
);
}
// 服务与分支
List
<
Map
<
String
,
String
>>
newMapList
=
new
ArrayList
<>();
String
serviceAndBranch
=
submitTestInstruction
.
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
=
submitTestInstruction
.
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
(
"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
(
"apolloUpdate"
,
apolloMap
);
// 数据库
StringBuilder
sb
=
new
StringBuilder
();
String
database
=
submitTestInstruction
.
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"
,
submitTestInstruction
.
getRequirement
());
jsonObject
.
put
(
"interfaceDocument"
,
submitTestInstruction
.
getApi
());
jsonObject
.
put
(
"remark"
,
submitTestInstruction
.
getScope
());
jsonObject
.
put
(
"status"
,
1
);
QueryWrapper
<
DingRobot
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"submit_test_instruction_id"
,
submitTestInstruction
.
getId
());
DingRobot
dingRobot
=
dingRobotService
.
getOne
(
queryWrapper
);
if
(
dingRobot
!=
null
)
{
jsonObject
.
put
(
"dingUrl"
,
dingRobot
.
getDingUrl
());
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
());
}
jsonObject
.
put
(
"creator"
,
dingRobot
.
getCreator
());
String
response
=
HttpClientUtils
.
doPostJson
(
doraemonUrl
,
null
,
jsonObject
.
toJSONString
());
log
.
info
(
response
);
...
...
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