Commit 805d86fb by 钱炳权

任务删除未完成

parent 3786ab39
......@@ -2,10 +2,12 @@ package com.example.fuzzControll.controller.dataController;
import com.example.fuzzControll.mapper.MissionInfoMapper;
import com.example.fuzzControll.domain.vo.AjaxResult;
import com.example.fuzzControll.service.MissionInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
......@@ -16,7 +18,8 @@ import java.io.IOException;
public class MissionInfoController {
@Autowired
MissionInfoMapper missionInfoMapper;
@Autowired
MissionInfoService missionInfoService;
/**
* 查看任务信息
*/
......@@ -26,7 +29,25 @@ public class MissionInfoController {
return AjaxResult.success(missionInfoMapper.selectMissionInfoList());
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("SelectMissionInfoList error!");
return AjaxResult.error("任务获取失败!");
}
}
/**
* 跟据任务id删除任务
*/
@RequestMapping(value = "/delMissionInfo", method = RequestMethod.GET)
public AjaxResult delMissionInfoById(@RequestParam int id) {
try {
Boolean flag = missionInfoService.delMissionInfoById(id);
if (flag) {
return AjaxResult.success();
} else {
throw new RuntimeException();
}
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("任务删除失败!");
}
}
}
......@@ -19,4 +19,6 @@ public interface MissionInfoMapper {
boolean insertMission(MissionInfo missionInfo);
void updateMission(MissionInfo missionInfo);
Boolean delMissionInfoById(int id);
}
package com.example.fuzzControll.service;
public interface MissionInfoService {
boolean delMissionInfoById(int id);
}
package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.exception.mysqlException.MysqlException;
import com.example.fuzzControll.mapper.MissionInfoMapper;
import com.example.fuzzControll.service.MissionInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("MissionInfoService")
@Slf4j
public class MissionInfoServiceImpl implements MissionInfoService {
@Autowired
MissionInfoMapper missionInfoMapper;
@Override
@Transactional(rollbackFor = MysqlException.class)
public boolean delMissionInfoById(int id) {
/*删除任务需要同步删除测试里面的字段数据*/
try {
missionInfoMapper.delMissionInfoById(id);
//给mission整一个fatherid
return true;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
......@@ -273,7 +273,7 @@ public class TestMissionServiceImpl implements TestMissionService {
subThread.setUncaughtExceptionHandler(new MyExceptionHandler());
subThread.start();
// subThread.join();
Thread.sleep(1000 * 10);//暂停3s,让系统运行至指令完全运行 todo跟据系统运行设定时间
Thread.sleep(1000 * 7);//暂停3s,让系统运行至指令完全运行 todo跟据系统运行设定时间
if ("error".equals(SystemRunningParams.ThreadState.get(subThread))) {//使用join串行就无法停止
throw new Exception();
}
......
......@@ -44,6 +44,10 @@
</set>
where id = #{id}
</update>
<delete id="delMissionInfoById">
DELETE FROM missionInfo
WHERE id = #{id}
</delete>
<select id="selectByMissionId" resultMap="MissionInfoInVo">
<include refid="selectMissionInfoInDataBase"/>
where id = #{id}
......
......@@ -3,10 +3,7 @@ package com.example.fuzzbackendmaster.controller;
import com.example.fuzzbackendmaster.pojo.vo.AjaxResult;
import com.example.fuzzbackendmaster.service.FuzzIntegrationFileApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
......@@ -21,7 +18,14 @@ public class MissionInfoController {
* 查看任务信息
*/
@RequestMapping(value = "/getList", method = RequestMethod.GET)
public AjaxResult getMissionInfo() throws IOException {
public AjaxResult getMissionInfo() {
return fuzzIntegrationFileApi.selectMissionInfoList();
}
/**
* 删除任务
*/
@RequestMapping(value = "/delMissionInfo", method = RequestMethod.GET)
public AjaxResult delMissionInfoById(@RequestParam int id) {
return fuzzIntegrationFileApi.delMissionInfoById(id);
}
}
......@@ -16,7 +16,7 @@ public class TestMissionController {
@Autowired
FuzzIntegrationFileApi fuzzIntegrationFileApi;
/**
* 新建测试
* 启动测试
*/
@RequestMapping(value = "/startmission", method = RequestMethod.GET)
public AjaxResult getAll(@RequestParam int id) {
......
......@@ -188,4 +188,9 @@ public interface FuzzIntegrationFileApi {
*/
@RequestMapping(value = "/testmission/startmission", method = RequestMethod.GET)
AjaxResult startmission(@RequestParam int id);
/**
* 删除任务
*/
@RequestMapping(value = "/mission/delMissionInfo", method = RequestMethod.GET)
AjaxResult delMissionInfoById(@RequestParam int id);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment