Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
王飞
vehicle-quality-review
Commits
5b98a187
Commit
5b98a187
authored
Mar 20, 2024
by
wdy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车型试验原始记录
parent
06891ae3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
205 additions
and
0 deletions
+205
-0
TestRecords.java
...ty-review/src/main/java/com/ruoyi/domain/TestRecords.java
+52
-0
TestRecordsMapper.java
...iew/src/main/java/com/ruoyi/mapper/TestRecordsMapper.java
+9
-0
TestRecordsService.java
...w/src/main/java/com/ruoyi/service/TestRecordsService.java
+7
-0
TestRecordsServiceImpl.java
...n/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
+115
-0
TestRecordsMapper.xml
...ty-review/src/main/resources/mapper/TestRecordsMapper.xml
+22
-0
No files found.
quality-review/src/main/java/com/ruoyi/domain/TestRecords.java
0 → 100644
View file @
5b98a187
package
com
.
ruoyi
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@ApiModel
@TableName
(
value
=
"t_test_records"
)
@Data
public
class
TestRecords
{
@ApiModelProperty
(
"主键"
)
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
)
private
Long
id
;
@ApiModelProperty
(
"关联项目id"
)
private
String
taskId
;
@ApiModelProperty
(
"用例名称"
)
private
String
usecase
;
@ApiModelProperty
(
"用例id"
)
private
String
usecaseId
;
@ApiModelProperty
(
"测试时间"
)
private
Date
testTime
;
@ApiModelProperty
(
"用例简述"
)
private
String
description
;
@ApiModelProperty
(
"风险等级"
)
private
String
riskLevel
;
@ApiModelProperty
(
"测试方法"
)
private
String
testMethod
;
@ApiModelProperty
(
"测试结果"
)
private
String
testResult
;
@ApiModelProperty
(
"测试结果描述"
)
private
String
testResultDescription
;
@ApiModelProperty
(
"漏洞危害"
)
private
String
loophole
;
}
quality-review/src/main/java/com/ruoyi/mapper/TestRecordsMapper.java
0 → 100644
View file @
5b98a187
package
com
.
ruoyi
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ruoyi.domain.TestRecords
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
TestRecordsMapper
extends
BaseMapper
<
TestRecords
>
{
}
quality-review/src/main/java/com/ruoyi/service/TestRecordsService.java
0 → 100644
View file @
5b98a187
package
com
.
ruoyi
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.domain.TestRecords
;
public
interface
TestRecordsService
extends
IService
<
TestRecords
>
{
}
quality-review/src/main/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
0 → 100644
View file @
5b98a187
package
com
.
ruoyi
.
service
.
impl
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.domain.TestRecords
;
import
com.ruoyi.mapper.TestRecordsMapper
;
import
com.ruoyi.service.TestRecordsService
;
import
okhttp3.Request
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.*
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URLEncoder
;
@Transactional
@Service
public
class
TestRecordsServiceImpl
extends
ServiceImpl
<
TestRecordsMapper
,
TestRecords
>
implements
TestRecordsService
{
public
void
getValue
()
throws
IOException
{
JSONObject
jsonObject
=
getInverseParamByUrl
(
"http://10.12.48.78:8090/DescribeProjectTestResult"
);
}
// public static void main(String[] args) throws IOException {
// JSONObject jsonObject = getInverseParamByUrl("http://10.12.48.78:8090/DescribeProjectTestResult");
//
// System.out.println("jsonObject = " + jsonObject);
// }
/**
* 通过API获取反参
* @param apiUrl
* @return
* @throws IOException
*/
public
static
JSONObject
getInverseParamByUrl
(
String
apiUrl
)
throws
IOException
{
// 调用请求
URL
url
=
new
URL
(
apiUrl
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setRequestMethod
(
"GET"
);
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
StringBuilder
response
=
new
StringBuilder
();
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
response
.
append
(
line
);
}
reader
.
close
();
// 解析成JSON对象
String
jsonResponseString
=
response
.
toString
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
jsonResponseString
);
return
jsonObject
;
}
public
static
void
main
(
String
[]
args
)
throws
UnsupportedEncodingException
{
// 创建一个Request对象
// Request request = new Request();
// request.setParam1("project_items;1");
// request.setParam2("ALL");
//
// // 将Request对象转换为JSON字符串
// Gson gson = new GsonBuilder().create();
// String jsonRequest = gson.toJson(request);
try
{
String
apiUrl
=
"http://10.12.48.78:8090/DescribeProjectTestResult"
;
// 第三方URL
String
param1
=
"project_items;1"
;
String
param2
=
"ALL"
;
String
postData
=
String
.
format
(
"param1=%s¶m2=%s"
,
URLEncoder
.
encode
(
param1
,
"UTF-8"
),
URLEncoder
.
encode
(
param2
,
"UTF-8"
));
URL
url
=
new
URL
(
apiUrl
);
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
conn
.
setRequestMethod
(
"POST"
);
conn
.
setDoOutput
(
true
);
// 设置请求体
DataOutputStream
outputStream
=
new
DataOutputStream
(
conn
.
getOutputStream
());
outputStream
.
writeBytes
(
postData
);
outputStream
.
flush
();
outputStream
.
close
();
int
responseCode
=
conn
.
getResponseCode
();
if
(
responseCode
==
HttpURLConnection
.
HTTP_OK
)
{
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
()));
String
inputLine
;
StringBuilder
response
=
new
StringBuilder
();
while
((
inputLine
=
in
.
readLine
())
!=
null
)
{
response
.
append
(
inputLine
);
}
in
.
close
();
String
responseBody
=
response
.
toString
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
responseBody
);
System
.
out
.
println
(
"Response body: "
+
responseBody
);
System
.
out
.
println
(
"jsonObject = "
+
jsonObject
);
}
else
{
System
.
out
.
println
(
"Request failed. Response code: "
+
responseCode
);
}
conn
.
disconnect
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
quality-review/src/main/resources/mapper/TestRecordsMapper.xml
0 → 100644
View file @
5b98a187
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.mapper.TestRecordsMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.ruoyi.domain.TestRecords"
>
<id
property=
"id"
column=
"id"
jdbcType=
"BIGINT"
/>
<result
property=
"taskId"
column=
"task_id"
jdbcType=
"VARCHAR"
/>
<result
property=
"usecase"
column=
"usecase"
jdbcType=
"VARCHAR"
/>
<result
property=
"usecaseId"
column=
"usecase_id"
jdbcType=
"VARCHAR"
/>
<result
property=
"testTime"
column=
"test_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"description"
column=
"description"
jdbcType=
"VARCHAR"
/>
<result
property=
"riskLevel"
column=
"risk_level"
jdbcType=
"VARCHAR"
/>
<result
property=
"testMethod"
column=
"test_method"
jdbcType=
"VARCHAR"
/>
<result
property=
"testResult"
column=
"test_result"
jdbcType=
"VARCHAR"
/>
<result
property=
"testResultDescription"
column=
"test_result_description"
jdbcType=
"VARCHAR"
/>
<result
property=
"loophole"
column=
"loophole"
jdbcType=
"VARCHAR"
/>
</resultMap>
</mapper>
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