Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fuzzBackEnd
Overview
Overview
Details
Activity
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
钱炳权
fuzzBackEnd
Commits
c91b88f6
Commit
c91b88f6
authored
Aug 22, 2024
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务删除功能完成
parent
805d86fb
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
13 deletions
+70
-13
MissionInfoController.java
...roll/controller/dataController/MissionInfoController.java
+1
-1
MissionInfo.java
.../java/com/example/fuzzControll/domain/po/MissionInfo.java
+5
-2
MissionInfoMapper.java
...va/com/example/fuzzControll/mapper/MissionInfoMapper.java
+1
-1
TestMapper.java
...main/java/com/example/fuzzControll/mapper/TestMapper.java
+1
-0
MissionInfoServiceImpl.java
...ple/fuzzControll/service/impl/MissionInfoServiceImpl.java
+20
-1
TestMissionServiceImpl.java
...ple/fuzzControll/service/impl/TestMissionServiceImpl.java
+2
-2
StringUtils.java
...com/example/fuzzControll/tools/component/StringUtils.java
+33
-2
MissionInfoMapper.xml
...tegration/src/main/resources/mapper/MissionInfoMapper.xml
+7
-4
No files found.
fuzzIntegration/src/main/java/com/example/fuzzControll/controller/dataController/MissionInfoController.java
View file @
c91b88f6
...
@@ -41,7 +41,7 @@ public class MissionInfoController {
...
@@ -41,7 +41,7 @@ public class MissionInfoController {
try
{
try
{
Boolean
flag
=
missionInfoService
.
delMissionInfoById
(
id
);
Boolean
flag
=
missionInfoService
.
delMissionInfoById
(
id
);
if
(
flag
)
{
if
(
flag
)
{
return
AjaxResult
.
success
();
return
AjaxResult
.
success
(
"任务删除成功!"
);
}
else
{
}
else
{
throw
new
RuntimeException
();
throw
new
RuntimeException
();
}
}
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/domain/po/MissionInfo.java
View file @
c91b88f6
...
@@ -16,21 +16,24 @@ public class MissionInfo {
...
@@ -16,21 +16,24 @@ public class MissionInfo {
private
int
state
;
private
int
state
;
private
Long
runTime
;
private
Long
runTime
;
private
String
stateName
;
private
String
stateName
;
private
int
fatherId
;
public
MissionInfo
()
{
public
MissionInfo
()
{
}
}
public
MissionInfo
(
int
tableId
,
Date
createTime
,
String
missionName
,
int
state
,
Long
runTime
)
{
public
MissionInfo
(
int
tableId
,
Date
createTime
,
String
missionName
,
int
state
,
Long
runTime
,
int
fatherId
)
{
this
.
tableId
=
tableId
;
this
.
tableId
=
tableId
;
this
.
createTime
=
createTime
;
this
.
createTime
=
createTime
;
this
.
missionName
=
missionName
;
this
.
missionName
=
missionName
;
this
.
state
=
state
;
this
.
state
=
state
;
this
.
runTime
=
runTime
;
this
.
runTime
=
runTime
;
this
.
fatherId
=
fatherId
;
}
}
public
MissionInfo
(
Date
createTime
,
String
missionName
,
Long
runTime
,
String
stateName
)
{
public
MissionInfo
(
Date
createTime
,
String
missionName
,
Long
runTime
,
String
stateName
,
int
fatherId
)
{
this
.
createTime
=
createTime
;
this
.
createTime
=
createTime
;
this
.
missionName
=
missionName
;
this
.
missionName
=
missionName
;
this
.
runTime
=
runTime
;
this
.
runTime
=
runTime
;
this
.
stateName
=
stateName
;
this
.
stateName
=
stateName
;
this
.
fatherId
=
fatherId
;
}
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/mapper/MissionInfoMapper.java
View file @
c91b88f6
...
@@ -10,7 +10,7 @@ import java.util.List;
...
@@ -10,7 +10,7 @@ import java.util.List;
@Component
(
"MissionInfoMapper"
)
@Component
(
"MissionInfoMapper"
)
public
interface
MissionInfoMapper
{
public
interface
MissionInfoMapper
{
MissionInfo
selectByMissionId
(
int
missionI
d
);
MissionInfo
selectByMissionId
(
int
i
d
);
/**
/**
* 查询任务信息列表
* 查询任务信息列表
*/
*/
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/mapper/TestMapper.java
View file @
c91b88f6
...
@@ -27,4 +27,5 @@ public interface TestMapper {
...
@@ -27,4 +27,5 @@ public interface TestMapper {
boolean
editTestName
(
String
testName
,
int
id
);
boolean
editTestName
(
String
testName
,
int
id
);
void
update
(
Test
test
);
void
update
(
Test
test
);
;
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/MissionInfoServiceImpl.java
View file @
c91b88f6
package
com
.
example
.
fuzzControll
.
service
.
impl
;
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.domain.po.MissionInfo
;
import
com.example.fuzzControll.domain.po.Test
;
import
com.example.fuzzControll.exception.mysqlException.MysqlException
;
import
com.example.fuzzControll.exception.mysqlException.MysqlException
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.mapper.MissionInfoMapper
;
import
com.example.fuzzControll.mapper.TestMapper
;
import
com.example.fuzzControll.service.MissionInfoService
;
import
com.example.fuzzControll.service.MissionInfoService
;
import
com.example.fuzzControll.tools.component.StringUtils
;
import
com.example.fuzzControll.tools.system.GlobalClass
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -13,16 +18,30 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -13,16 +18,30 @@ import org.springframework.transaction.annotation.Transactional;
public
class
MissionInfoServiceImpl
implements
MissionInfoService
{
public
class
MissionInfoServiceImpl
implements
MissionInfoService
{
@Autowired
@Autowired
MissionInfoMapper
missionInfoMapper
;
MissionInfoMapper
missionInfoMapper
;
@Autowired
TestMapper
testMapper
;
@Override
@Override
@Transactional
(
rollbackFor
=
MysqlException
.
class
)
@Transactional
(
rollbackFor
=
MysqlException
.
class
)
public
boolean
delMissionInfoById
(
int
id
)
{
public
boolean
delMissionInfoById
(
int
id
)
{
/*删除任务需要同步删除测试里面的字段数据*/
/*删除任务需要同步删除测试里面的字段数据*/
try
{
try
{
MissionInfo
missionInfo
=
GlobalClass
.
missionInfoMapper
.
selectByMissionId
(
id
);
if
(
missionInfo
==
null
){
log
.
error
(
"No mission id!"
);
throw
new
RuntimeException
();
}
missionInfoMapper
.
delMissionInfoById
(
id
);
missionInfoMapper
.
delMissionInfoById
(
id
);
int
testId
=
missionInfo
.
getFatherId
();
//给mission整一个fatherid
//给mission整一个fatherid
Test
test
=
testMapper
.
getTestById
(
testId
);
String
newMinssionIds
=
StringUtils
.
getArrayFormatStringAfterDelete
(
test
.
getMissionIds
(),
id
);
test
.
setMissionIds
(
newMinssionIds
);
testMapper
.
update
(
test
);
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
log
.
error
(
"Deleting mission info error:[{}]"
,
e
.
getMessage
());
throw
new
MysqlException
(
""
);
}
}
}
}
}
}
fuzzIntegration/src/main/java/com/example/fuzzControll/service/impl/TestMissionServiceImpl.java
View file @
c91b88f6
...
@@ -180,10 +180,10 @@ public class TestMissionServiceImpl implements TestMissionService {
...
@@ -180,10 +180,10 @@ public class TestMissionServiceImpl implements TestMissionService {
String
protocol
=
fuzzParams
.
getProtocol
();
String
protocol
=
fuzzParams
.
getProtocol
();
MissionInfo
missionInfo
;
MissionInfo
missionInfo
;
if
(
Arrays
.
asList
(
SystemRunningParams
.
AflnetProtocol
).
contains
(
protocol
))
{
if
(
Arrays
.
asList
(
SystemRunningParams
.
AflnetProtocol
).
contains
(
protocol
))
{
missionInfo
=
new
MissionInfo
(
TableClassEnum
.
AFLNET
.
getTableId
(),
new
Date
(),
protocol
,
MissionStateEnum
.
STARTING
.
getStateCode
(),
0L
);
missionInfo
=
new
MissionInfo
(
TableClassEnum
.
AFLNET
.
getTableId
(),
new
Date
(),
protocol
,
MissionStateEnum
.
STARTING
.
getStateCode
(),
0L
,
id
);
isAflnet
=
true
;
isAflnet
=
true
;
}
else
if
(
Arrays
.
asList
(
SystemRunningParams
.
KittyProtocol
).
contains
(
protocol
))
{
}
else
if
(
Arrays
.
asList
(
SystemRunningParams
.
KittyProtocol
).
contains
(
protocol
))
{
missionInfo
=
new
MissionInfo
(
TableClassEnum
.
KITTY_RESULT
.
getTableId
(),
new
Date
(),
protocol
,
MissionStateEnum
.
STARTING
.
getStateCode
(),
0L
);
missionInfo
=
new
MissionInfo
(
TableClassEnum
.
KITTY_RESULT
.
getTableId
(),
new
Date
(),
protocol
,
MissionStateEnum
.
STARTING
.
getStateCode
(),
0L
,
id
);
isAflnet
=
false
;
isAflnet
=
false
;
}
else
{
}
else
{
log
.
error
(
"Unknown protocol!"
);
log
.
error
(
"Unknown protocol!"
);
...
...
fuzzIntegration/src/main/java/com/example/fuzzControll/tools/component/StringUtils.java
View file @
c91b88f6
package
com
.
example
.
fuzzControll
.
tools
.
component
;
package
com
.
example
.
fuzzControll
.
tools
.
component
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
public
class
StringUtils
{
public
class
StringUtils
{
/**
/**
* 向[]格式字符转插入数据变成[a,b]
* 向[]格式字符转插入数据变成[a,b]
...
@@ -10,11 +17,35 @@ public class StringUtils {
...
@@ -10,11 +17,35 @@ public class StringUtils {
source
=
"[]"
;
source
=
"[]"
;
String
temp
=
source
.
replace
(
"]"
,
""
);
String
temp
=
source
.
replace
(
"]"
,
""
);
finalString
=
temp
+
insert
+
"]"
;
finalString
=
temp
+
insert
+
"]"
;
}
else
{
}
else
{
String
temp
=
source
.
replace
(
"]"
,
""
);
String
temp
=
source
.
replace
(
"]"
,
""
);
finalString
=
temp
+
","
+
insert
+
"]"
;
finalString
=
temp
+
","
+
insert
+
"]"
;
}
}
return
finalString
;
return
finalString
;
}
}
/**
* 给[a,b]格式字符删除指定id
*/
public
static
String
getArrayFormatStringAfterDelete
(
String
missionIds
,
int
id
)
{
/*取出id并提出删除的id*/
String
[]
ids
=
missionIds
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
split
(
","
);
if
(
Arrays
.
stream
(
ids
).
noneMatch
(
s
->
String
.
valueOf
(
id
).
equals
(
s
)))
{
log
.
error
(
"Data error!"
);
throw
new
RuntimeException
();
}
List
<
String
>
temp
=
Arrays
.
stream
(
ids
).
filter
(
s
->
!
String
.
valueOf
(
id
).
equals
(
s
)).
collect
(
Collectors
.
toList
());
String
newMissionIds
=
""
;
if
(
temp
.
size
()
==
0
)
{
newMissionIds
=
"[]"
;
}
else
{
newMissionIds
=
"["
+
temp
.
get
(
0
);
for
(
int
i
=
1
;
i
<
temp
.
size
();
i
++)
{
newMissionIds
=
newMissionIds
+
","
+
temp
.
get
(
i
);
}
newMissionIds
=
newMissionIds
+
"]"
;
}
return
newMissionIds
;
}
}
}
fuzzIntegration/src/main/resources/mapper/MissionInfoMapper.xml
View file @
c91b88f6
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<result
property=
"missionName"
column=
"missionName"
/>
<result
property=
"missionName"
column=
"missionName"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"runTime"
column=
"runTime"
/>
<result
property=
"runTime"
column=
"runTime"
/>
<result
property=
"fatherId"
column=
"fatherId"
/>
</resultMap>
</resultMap>
<resultMap
type=
"com.example.fuzzControll.domain.po.MissionInfo"
id=
"MissionInfoInVo"
>
<resultMap
type=
"com.example.fuzzControll.domain.po.MissionInfo"
id=
"MissionInfoInVo"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
...
@@ -18,16 +19,17 @@
...
@@ -18,16 +19,17 @@
<result
property=
"missionName"
column=
"missionName"
/>
<result
property=
"missionName"
column=
"missionName"
/>
<result
property=
"stateName"
column=
"state"
/>
<result
property=
"stateName"
column=
"state"
/>
<result
property=
"runTime"
column=
"runTime"
/>
<result
property=
"runTime"
column=
"runTime"
/>
<result
property=
"fatherId"
column=
"fatherId"
/>
</resultMap>
</resultMap>
<sql
id=
"selectMissionInfo"
>
<sql
id=
"selectMissionInfo"
>
select id,createTime,missionName ,state,runTime from missionInfo
select id,createTime,missionName ,state,runTime
,fatherId
from missionInfo
</sql>
</sql>
<sql
id=
"selectMissionInfoInDataBase"
>
<sql
id=
"selectMissionInfoInDataBase"
>
select id, tableId, createTime,missionName ,state,runTime from missionInfo
select id, tableId, createTime,missionName ,state,runTime
,fatherId
from missionInfo
</sql>
</sql>
<insert
id=
"insertMission"
>
<insert
id=
"insertMission"
>
insert into missionInfo( tableId, createTime, missionName, state, runTime)
insert into missionInfo( tableId, createTime, missionName, state, runTime
,fatherId
)
values ( #{tableId}, #{createTime}, #{missionName}, #{state}, #{runTime})
values ( #{tableId}, #{createTime}, #{missionName}, #{state}, #{runTime}
,#{fatherId}
)
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
SELECT LAST_INSERT_ID()
SELECT LAST_INSERT_ID()
</selectKey>
</selectKey>
...
@@ -41,6 +43,7 @@
...
@@ -41,6 +43,7 @@
<if
test=
"missionName != null and missionName != ''"
>
missionName = #{missionName},
</if>
<if
test=
"missionName != null and missionName != ''"
>
missionName = #{missionName},
</if>
<if
test=
"state != null"
>
state = #{state},
</if>
<if
test=
"state != null"
>
state = #{state},
</if>
<if
test=
"runTime != null "
>
runTime = #{runTime},
</if>
<if
test=
"runTime != null "
>
runTime = #{runTime},
</if>
<if
test=
"fatherId != null "
>
fatherId = #{fatherId},
</if>
</set>
</set>
where id = #{id}
where id = #{id}
</update>
</update>
...
...
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