diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/app/AppCheckController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/app/AppCheckController.java index 5a94c8a1..7da2dc49 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/app/AppCheckController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/app/AppCheckController.java @@ -1,22 +1,14 @@ package pc.exam.pp.module.exam.controller.admin.app; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import jakarta.annotation.security.PermitAll; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import pc.exam.pp.framework.common.pojo.CommonResult; import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; import pc.exam.pp.module.exam.dal.dataobject.app.AppCheckDO; import pc.exam.pp.module.exam.service.app.AppCheckService; -import pc.exam.pp.module.exam.service.authorize.AuthorizeService; - -import java.net.SocketException; -import java.net.UnknownHostException; import java.util.List; import static pc.exam.pp.framework.common.pojo.CommonResult.success; @@ -34,14 +26,27 @@ public class AppCheckController { @Resource AppCheckService appCheckService; - @GetMapping("/getAppCheckList") + @GetMapping("/getAppCheckList/{taskId}") @PermitAll @TenantIgnore @Operation(summary = "查看学生端需要检测的APP列表", description = "查看学生端需要检测的APP列表") - public CommonResult> getAppCheckList(){ + public CommonResult> getAppCheckList(@PathVariable("taskId") String taskId){ // 使用传入的IP,进行ping,查看是否存在连接,并返回信号的强度 - return success(appCheckService.getAppList()); + return success(appCheckService.getAppList(taskId)); } + @PostMapping("/insertAppCheck") + public CommonResult insertAppCheck(@RequestBody AppCheckDO appCheckDOS){ + // 使用传入的IP,进行ping,查看是否存在连接,并返回信号的强度 + return success(appCheckService.insertAppCheck(appCheckDOS)); + } + @GetMapping("/delete/{id}") + @PermitAll + @TenantIgnore + @Operation(summary = "查看学生端需要检测的APP列表", description = "查看学生端需要检测的APP列表") + public CommonResult delete(@PathVariable("id") String id){ + // 使用传入的IP,进行ping,查看是否存在连接,并返回信号的强度 + return success(appCheckService.deleteAppCheck(id)); + } } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/app/AppCheckDO.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/app/AppCheckDO.java index 4f9bf3df..44882388 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/app/AppCheckDO.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/app/AppCheckDO.java @@ -29,4 +29,6 @@ public class AppCheckDO { */ private String appName; + private String taskId; + } \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/app/AppCheckMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/app/AppCheckMapper.java index 5365f612..705cfd75 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/app/AppCheckMapper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/app/AppCheckMapper.java @@ -1,15 +1,9 @@ package pc.exam.pp.module.exam.dal.mysql.app; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX; -import pc.exam.pp.module.exam.controller.admin.classs.vo.ClassDoReturnVO; -import pc.exam.pp.module.exam.controller.admin.classs.vo.ClassNameReturnVO; -import pc.exam.pp.module.exam.controller.admin.classs.vo.ClassPageReqVO; import pc.exam.pp.module.exam.dal.dataobject.app.AppCheckDO; -import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO; import java.util.List; @@ -21,4 +15,8 @@ import java.util.List; @Mapper public interface AppCheckMapper extends BaseMapperX { + default List selectList(String taskId) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(AppCheckDO::getTaskId, taskId)); + } } \ No newline at end of file diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckService.java index 5f2701a0..1f0876c7 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckService.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckService.java @@ -3,8 +3,6 @@ package pc.exam.pp.module.exam.service.app; import pc.exam.pp.module.exam.dal.dataobject.app.AppCheckDO; -import java.net.SocketException; -import java.net.UnknownHostException; import java.util.List; /** @@ -19,5 +17,15 @@ public interface AppCheckService { * 获取哪些APP是需要查询得 * @return App检测表 */ - List getAppList(); + List getAppList(String taskId); + + /** + * 新增环境检测 + */ + boolean insertAppCheck(AppCheckDO appCheckDOS); + + /** + * 删除环境检测 + */ + boolean deleteAppCheck(String id); } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckServiceImpl.java index 7bd5c046..633da212 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/app/AppCheckServiceImpl.java @@ -20,8 +20,21 @@ public class AppCheckServiceImpl implements AppCheckService { AppCheckMapper appCheckMapper; @Override - public List getAppList() { - List appList = appCheckMapper.selectList(); - return appList; + public List getAppList(String taskId) { + return appCheckMapper.selectList(taskId); } + + @Override + public boolean insertAppCheck(AppCheckDO appCheckDOS) { + appCheckMapper.insert(appCheckDOS); + return true; + } + + @Override + public boolean deleteAppCheck(String id) { + appCheckMapper.deleteById(id); + return true; + } + + }