【新增】 方案绑定软件环境简单,一个方案一个检测,不冲突

This commit is contained in:
dlaren
2025-08-06 22:53:32 +08:00
parent db4d3b1010
commit eaff0da233
5 changed files with 50 additions and 24 deletions

View File

@@ -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<List<AppCheckDO>> getAppCheckList(){
public CommonResult<List<AppCheckDO>> getAppCheckList(@PathVariable("taskId") String taskId){
// 使用传入的IP进行ping查看是否存在连接并返回信号的强度
return success(appCheckService.getAppList());
return success(appCheckService.getAppList(taskId));
}
@PostMapping("/insertAppCheck")
public CommonResult<Boolean> insertAppCheck(@RequestBody AppCheckDO appCheckDOS){
// 使用传入的IP进行ping查看是否存在连接并返回信号的强度
return success(appCheckService.insertAppCheck(appCheckDOS));
}
@GetMapping("/delete/{id}")
@PermitAll
@TenantIgnore
@Operation(summary = "查看学生端需要检测的APP列表", description = "查看学生端需要检测的APP列表")
public CommonResult<Boolean> delete(@PathVariable("id") String id){
// 使用传入的IP进行ping查看是否存在连接并返回信号的强度
return success(appCheckService.deleteAppCheck(id));
}
}

View File

@@ -29,4 +29,6 @@ public class AppCheckDO {
*/
private String appName;
private String taskId;
}

View File

@@ -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<AppCheckDO> {
default List<AppCheckDO> selectList(String taskId) {
return selectList(new LambdaQueryWrapperX<AppCheckDO>()
.likeIfPresent(AppCheckDO::getTaskId, taskId));
}
}

View File

@@ -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<AppCheckDO> getAppList();
List<AppCheckDO> getAppList(String taskId);
/**
* 新增环境检测
*/
boolean insertAppCheck(AppCheckDO appCheckDOS);
/**
* 删除环境检测
*/
boolean deleteAppCheck(String id);
}

View File

@@ -20,8 +20,21 @@ public class AppCheckServiceImpl implements AppCheckService {
AppCheckMapper appCheckMapper;
@Override
public List<AppCheckDO> getAppList() {
List<AppCheckDO> appList = appCheckMapper.selectList();
return appList;
public List<AppCheckDO> 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;
}
}