feat: ASW-131 job 详情接口开发
This commit is contained in:
@@ -8,6 +8,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.geedge.asw.module.app.entity.PackageEntity;
|
import net.geedge.asw.module.app.entity.PackageEntity;
|
||||||
import net.geedge.asw.module.environment.entity.EnvironmentEntity;
|
import net.geedge.asw.module.environment.entity.EnvironmentEntity;
|
||||||
|
import net.geedge.asw.module.sys.entity.SysUserEntity;
|
||||||
|
import net.geedge.asw.module.workspace.entity.WorkspaceEntity;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("job")
|
@TableName("job")
|
||||||
@@ -45,4 +47,13 @@ public class JobEntity {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private PlaybookEntity playbook;
|
private PlaybookEntity playbook;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private PcapEntity pcap;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private SysUserEntity createUser;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private WorkspaceEntity workspace;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -15,10 +15,16 @@ import net.geedge.asw.module.environment.entity.EnvironmentEntity;
|
|||||||
import net.geedge.asw.module.environment.service.IEnvironmentService;
|
import net.geedge.asw.module.environment.service.IEnvironmentService;
|
||||||
import net.geedge.asw.module.runner.dao.JobDao;
|
import net.geedge.asw.module.runner.dao.JobDao;
|
||||||
import net.geedge.asw.module.runner.entity.JobEntity;
|
import net.geedge.asw.module.runner.entity.JobEntity;
|
||||||
|
import net.geedge.asw.module.runner.entity.PcapEntity;
|
||||||
import net.geedge.asw.module.runner.entity.PlaybookEntity;
|
import net.geedge.asw.module.runner.entity.PlaybookEntity;
|
||||||
import net.geedge.asw.module.runner.service.IJobService;
|
import net.geedge.asw.module.runner.service.IJobService;
|
||||||
|
import net.geedge.asw.module.runner.service.IPcapService;
|
||||||
import net.geedge.asw.module.runner.service.IPlaybookService;
|
import net.geedge.asw.module.runner.service.IPlaybookService;
|
||||||
import net.geedge.asw.module.runner.util.RunnerConstant;
|
import net.geedge.asw.module.runner.util.RunnerConstant;
|
||||||
|
import net.geedge.asw.module.sys.entity.SysUserEntity;
|
||||||
|
import net.geedge.asw.module.sys.service.ISysUserService;
|
||||||
|
import net.geedge.asw.module.workspace.entity.WorkspaceEntity;
|
||||||
|
import net.geedge.asw.module.workspace.service.IWorkspaceService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
|
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -44,6 +50,15 @@ public class JobServiceImpl extends ServiceImpl<JobDao, JobEntity> implements IJ
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPackageService packageService;
|
private IPackageService packageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPcapService pcapService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWorkspaceService workspaceService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rootPath/result/{jobId}
|
* rootPath/result/{jobId}
|
||||||
@@ -69,6 +84,17 @@ public class JobServiceImpl extends ServiceImpl<JobDao, JobEntity> implements IJ
|
|||||||
PackageEntity pkg = packageService.getById(job.getPackageId());
|
PackageEntity pkg = packageService.getById(job.getPackageId());
|
||||||
job.setPkg(pkg);
|
job.setPkg(pkg);
|
||||||
|
|
||||||
|
if (T.StrUtil.isNotEmpty(job.getPcapId())){
|
||||||
|
PcapEntity pcap = pcapService.getById(job.getPcapId());
|
||||||
|
job.setPcap(pcap);
|
||||||
|
}
|
||||||
|
|
||||||
|
SysUserEntity createUser = userService.getById(job.getCreateUserId());
|
||||||
|
job.setCreateUser(createUser);
|
||||||
|
|
||||||
|
WorkspaceEntity workspace = workspaceService.getById(job.getWorkspaceId());
|
||||||
|
job.setWorkspace(workspace);
|
||||||
|
|
||||||
if (-1 == job.getStartTimestamp()) {
|
if (-1 == job.getStartTimestamp()) {
|
||||||
job.setStartTimestamp(null);
|
job.setStartTimestamp(null);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user