Commit 2a8263fa authored by 盖献康's avatar 盖献康

Merge branch 'dev' into 'master'

Dev - master 6.0

See merge request !292
parents d4fece7a d50b63b3
...@@ -61,6 +61,16 @@ ...@@ -61,6 +61,16 @@
<artifactId>itext-asian</artifactId> <artifactId>itext-asian</artifactId>
<version>5.2.0</version> <version>5.2.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.itextpdf.tool</groupId>
<artifactId>xmlworker</artifactId>
<version>5.5.13</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.24</version>
</dependency>
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId> <artifactId>ruoyi-framework</artifactId>
...@@ -70,6 +80,23 @@ ...@@ -70,6 +80,23 @@
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.1</version> <version>4.5.1</version>
</dependency> </dependency>
<!-- markdown->h5 -->
<dependency>
<groupId>com.atlassian.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>0.15.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<!-- iText 7 pdfHTML -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>4.0.5</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -61,4 +61,10 @@ public interface SampleManagementMapper extends BaseMapper<Sample> { ...@@ -61,4 +61,10 @@ public interface SampleManagementMapper extends BaseMapper<Sample> {
List<Sample> findByIdList(@Param("relationList") List<TaskSampleRelation> relationList,@Param("id") Long id); List<Sample> findByIdList(@Param("relationList") List<TaskSampleRelation> relationList,@Param("id") Long id);
/**
* 通过总任务ID获取与之有关的样品的车型第一个
* @param id
* @return
*/
Sample selectSampleByTaskId(@Param("id") Long id);
} }
...@@ -13,4 +13,11 @@ public interface TestRecordsMapper extends BaseMapper<TestRecords> { ...@@ -13,4 +13,11 @@ public interface TestRecordsMapper extends BaseMapper<TestRecords> {
List<TestRecords> findByTaskId(@Param("id") String id); List<TestRecords> findByTaskId(@Param("id") String id);
Long countResult(@Param("projectId") String projectId); Long countResult(@Param("projectId") String projectId);
/**
* 通过总任务ID查询List
* @param id
* @return
*/
List<TestRecords> selectListByGeneralTaskId(@Param("id") Long id);
} }
...@@ -2,6 +2,7 @@ package com.ruoyi.service; ...@@ -2,6 +2,7 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.TestType; import com.ruoyi.domain.TestType;
import com.ruoyi.domain.vo.TestTypeVO;
import com.ruoyi.web.request.TestTypeRequest; import com.ruoyi.web.request.TestTypeRequest;
import java.util.List; import java.util.List;
...@@ -15,4 +16,10 @@ public interface ITestTypeService extends IService<TestType> { ...@@ -15,4 +16,10 @@ public interface ITestTypeService extends IService<TestType> {
* @return 测试类型库集合 * @return 测试类型库集合
*/ */
public List<TestType> selectTestTypeList(TestTypeRequest testTypeRequest); public List<TestType> selectTestTypeList(TestTypeRequest testTypeRequest);
/**
* 从科恩获取所有测试方法
* @return
*/
List<String> getTestTypeList();
} }
...@@ -27,7 +27,8 @@ public interface PdfTemplateManagementService { ...@@ -27,7 +27,8 @@ public interface PdfTemplateManagementService {
* 原始记录PDF下载 * 原始记录PDF下载
* @param taskId * @param taskId
* @return * @return
* @throws Exception
*/ */
String generateOriginalRecord(Long taskId); String generateOriginalRecord(Long taskId) throws Exception;
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.ModelTestTask; import com.ruoyi.domain.ModelTestTask;
import com.ruoyi.mapper.ModelTestTaskMapper; import com.ruoyi.mapper.ModelTestTaskMapper;
import com.ruoyi.service.StrategyModelTestTask; import com.ruoyi.service.StrategyModelTestTask;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.web.response.ModelTestResponse; import com.ruoyi.web.response.ModelTestResponse;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -14,7 +18,9 @@ import org.springframework.stereotype.Service; ...@@ -14,7 +18,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@Service @Service
@Transactional @Transactional
...@@ -32,6 +38,11 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init ...@@ -32,6 +38,11 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
@Autowired @Autowired
private StrategyModelTestTaskNew strategyModelTestTaskNew; private StrategyModelTestTaskNew strategyModelTestTaskNew;
@Autowired
private TestUseCaseService testUseCaseService;
private static String url = "https://10.12.48.78:8090/DescribeProjectTestResult";
@Override @Override
public ModelTestResponse doView(ModelTestTask modelTestTask) { public ModelTestResponse doView(ModelTestTask modelTestTask) {
ModelTestResponse response = strategyModelTestTaskNew.getTestScheme(modelTestTask); ModelTestResponse response = strategyModelTestTaskNew.getTestScheme(modelTestTask);
...@@ -45,13 +56,32 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init ...@@ -45,13 +56,32 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
@Override @Override
public void doConfirmTest(ModelTestTask modelTestTask) { public void doConfirmTest(ModelTestTask modelTestTask) {
// 进行中的任务, 点击确认后, 状态改为待签字 // 查看当前任务-用例完成情况
HashMap<String, Object> map = new HashMap<>();
map.put("id", modelTestTask.getTestSchemeId());
map.put("verbose", "BASIC");
JSONObject jsonObject = testUseCaseService.callThirdPartyInterface(url, map);
Integer sumCount = (Integer) jsonObject.get("case_count");
AtomicReference<Integer> currentCount = new AtomicReference<>(0);
List<CaseStatistics> caseStatisticsList = jsonObject.getList("case_statistics", CaseStatistics.class);
if (CollUtil.isNotEmpty(caseStatisticsList)) {
caseStatisticsList.forEach(obj -> {
if (CaseStatistics.CASE_STATUS_FAILED.equals(obj.status) || CaseStatistics.CASE_STATUS_PASSED.equals(obj.status)) {
currentCount.updateAndGet(v -> v + obj.getCount());
}
});
}
Integer integer = currentCount.get();
System.out.println(integer);
// 进行中的任务, 点击返回后, 判断当前用例完成程度, 用例都完成后状态改为待签字
if (sumCount.equals(currentCount.get())) {
modelTestTaskMapper.update(new ModelTestTask(), modelTestTaskMapper.update(new ModelTestTask(),
new LambdaUpdateWrapper<ModelTestTask>() new LambdaUpdateWrapper<ModelTestTask>()
.set(ModelTestTask::getTaskEndTime, new Date()) .set(ModelTestTask::getTaskEndTime, new Date())
.set(ModelTestTask::getTaskStatus, ModelTestTask.TASK_STATUS_SIGNED) .set(ModelTestTask::getTaskStatus, ModelTestTask.TASK_STATUS_SIGNED)
.eq(ModelTestTask::getId, modelTestTask.getId())); .eq(ModelTestTask::getId, modelTestTask.getId()));
} }
}
@Override @Override
public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl) { public void doSubmitTest(ModelTestTask modelTestTask, List<String> imagesUrl) {
...@@ -62,4 +92,32 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init ...@@ -62,4 +92,32 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
strategyModelTestTaskContext.putResource(ModelTestTask.TASK_STATUS_PENDING, applicationContext.getBean(this.getClass())); strategyModelTestTaskContext.putResource(ModelTestTask.TASK_STATUS_PENDING, applicationContext.getBean(this.getClass()));
} }
/**
* 接参DTO
*/
@Data
public class CaseStatistics {
/**
* 通过
*/
private static final String CASE_STATUS_PASSED = "PASSED";
/**
* 失败
*/
private static final String CASE_STATUS_FAILED = "FAILED";
/**
* 数量
*/
private Integer count;
/**
* 状态
*/
private String status;
}
} }
...@@ -7,10 +7,8 @@ import com.alibaba.fastjson2.JSONObject; ...@@ -7,10 +7,8 @@ import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.DataStatisticsUtils; import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
...@@ -798,7 +796,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -798,7 +796,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} else if(resultNum == null) { } else if(resultNum == null) {
response.setTest(0.0); response.setTest(0.0);
} else { } else {
BigDecimal num = new BigDecimal((resultNum / useCaseNum) * 90); BigDecimal num = new BigDecimal((1.0 * resultNum / useCaseNum) * 90);
response.setTest(num.setScale(1,BigDecimal.ROUND_UP).doubleValue()); response.setTest(num.setScale(1,BigDecimal.ROUND_UP).doubleValue());
} }
......
...@@ -9,6 +9,11 @@ import com.ruoyi.domain.vo.CaseResultVO; ...@@ -9,6 +9,11 @@ import com.ruoyi.domain.vo.CaseResultVO;
import com.ruoyi.domain.vo.StepResultVO; import com.ruoyi.domain.vo.StepResultVO;
import com.ruoyi.mapper.TestRecordsMapper; import com.ruoyi.mapper.TestRecordsMapper;
import com.ruoyi.service.TestRecordsService; import com.ruoyi.service.TestRecordsService;
import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Entities;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -88,6 +93,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -88,6 +93,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
List<String> stepList = new ArrayList<>(); List<String> stepList = new ArrayList<>();
List<String> testDetailsList = new ArrayList<>(); List<String> testDetailsList = new ArrayList<>();
int index = 1; // 序号从1开始 int index = 1; // 序号从1开始
String testDetailsVO = "";
for (StepResultVO stepResultVO :stepResultVOS) { for (StepResultVO stepResultVO :stepResultVOS) {
// 测试方法 // 测试方法
String stepName = stepResultVO.getName(); String stepName = stepResultVO.getName();
...@@ -100,10 +106,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -100,10 +106,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情 // 测试详情
String testDetails = stepResultVO.getDescription(); String testDetails = stepResultVO.getDescription();
testDetailsList.add(testDetails); if (testDetails != null) {
convertMarkdownToHtml(testDetails);
} }
testDetailsVO += testDetails + "`";
}
testDetailsVO = testDetailsVO.substring(0, testDetailsVO.length() - 1);
testRecords.setTestMethod(StringUtils.join(stepList,"`")); testRecords.setTestMethod(StringUtils.join(stepList,"`"));
testRecords.setTestDetails(StringUtils.join(testDetailsList,"\n")); testRecords.setTestDetails(testDetailsVO);
} }
list.add(testRecords); list.add(testRecords);
...@@ -161,6 +171,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -161,6 +171,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
List<String> stepList = new ArrayList<>(); List<String> stepList = new ArrayList<>();
List<String> testDetailsList = new ArrayList<>(); List<String> testDetailsList = new ArrayList<>();
int index = 1; // 序号从1开始 int index = 1; // 序号从1开始
String testDetailsVO = "";
for (StepResultVO stepResultVO :stepResultVOS) { for (StepResultVO stepResultVO :stepResultVOS) {
// 测试方法 // 测试方法
String stepName = stepResultVO.getName(); String stepName = stepResultVO.getName();
...@@ -173,10 +184,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -173,10 +184,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情 // 测试详情
String testDetails = stepResultVO.getDescription(); String testDetails = stepResultVO.getDescription();
testDetailsList.add(testDetails); if (testDetails != null) {
convertMarkdownToHtml(testDetails);
}
testDetailsVO += testDetails + "`";
} }
testDetailsVO = testDetailsVO.substring(0, testDetailsVO.length() - 1);
testRecords.setTestMethod(StringUtils.join(stepList,"`")); testRecords.setTestMethod(StringUtils.join(stepList,"`"));
testRecords.setTestDetails(StringUtils.join(testDetailsList,"\n")); testRecords.setTestDetails(testDetailsVO);
} }
list.add(testRecords); list.add(testRecords);
...@@ -189,6 +204,25 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -189,6 +204,25 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
} }
} }
public static String convertMarkdownToHtml(String markdownContent) {
// 创建 Markdown 解析器
Parser parser = Parser.builder().build();
// 解析 Markdown
Node document = parser.parse(markdownContent);
// 创建 HTML 渲染器
HtmlRenderer renderer = HtmlRenderer.builder().build();
// 渲染 HTML
org.jsoup.nodes.Document doc = Jsoup.parse(renderer.render(document).replaceAll("\\\\n", "<br>"));
// jsoup标准化标签,生成闭合标签
doc.outputSettings().syntax(org.jsoup.nodes.Document.OutputSettings.Syntax.xml);
doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml);
return doc.html();
}
@Override @Override
public List<TestRecords> findByTaskId(String id) { public List<TestRecords> findByTaskId(String id) {
return testRecordsMapper.findByTaskId(id); return testRecordsMapper.findByTaskId(id);
......
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.TestType; import com.ruoyi.domain.TestType;
...@@ -8,11 +10,13 @@ import com.ruoyi.mapper.TestTypeMapper; ...@@ -8,11 +10,13 @@ import com.ruoyi.mapper.TestTypeMapper;
import com.ruoyi.service.ITestTypeService; import com.ruoyi.service.ITestTypeService;
import com.ruoyi.web.request.TestTypeRequest; import com.ruoyi.web.request.TestTypeRequest;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
@Transactional @Transactional
...@@ -34,4 +38,23 @@ public class TestTypeServiceImpl extends ServiceImpl<TestTypeMapper, TestType> i ...@@ -34,4 +38,23 @@ public class TestTypeServiceImpl extends ServiceImpl<TestTypeMapper, TestType> i
} }
return testTypeMapper.selectTestTypeList(testTypeRequest); return testTypeMapper.selectTestTypeList(testTypeRequest);
} }
@Override
public List<String> getTestTypeList() {
//以post形式请求接口
String result= HttpUtil.post("https://10.12.48.78:8090/DescribeScenarioTestTypeList","");
JSONObject jsonObject = JSONObject.parseObject(result);
return jsonObject.getList("test_type_list", TypeVO.class)
.stream()
.map(TypeVO::getName)
.collect(Collectors.toList());
}
@Data
public static class TypeVO {
private String name;
}
} }
...@@ -101,7 +101,7 @@ public class PdfTemplateManagementController { ...@@ -101,7 +101,7 @@ public class PdfTemplateManagementController {
if (StrUtil.isBlank(url)) { if (StrUtil.isBlank(url)) {
// TODO 生成车型 // TODO 生成车型
url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId()); url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId());
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestTaskId, url)); taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestUrl, url));
} }
break; break;
default: default:
...@@ -139,7 +139,7 @@ public class PdfTemplateManagementController { ...@@ -139,7 +139,7 @@ public class PdfTemplateManagementController {
case 2: case 2:
// 更新 // 更新
url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId()); url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId());
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestTaskId, url)); taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestUrl, url));
break; break;
default: default:
break; break;
......
...@@ -4,6 +4,7 @@ import com.ruoyi.common.core.controller.BaseController; ...@@ -4,6 +4,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.TestType; import com.ruoyi.domain.TestType;
import com.ruoyi.domain.vo.TestTypeVO;
import com.ruoyi.service.ITestTypeService; import com.ruoyi.service.ITestTypeService;
import com.ruoyi.web.request.TestTypeRequest; import com.ruoyi.web.request.TestTypeRequest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -51,4 +52,13 @@ public class TestTypeController extends BaseController { ...@@ -51,4 +52,13 @@ public class TestTypeController extends BaseController {
return R.ok(testTypeService.selectTestTypeList(testTypeRequest)); return R.ok(testTypeService.selectTestTypeList(testTypeRequest));
} }
// 从科恩获取所有测试方法
@ApiOperation("查询所有测试方法(科恩)")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getTestTypeList")
public R<List<String>> getTestTypeList(){
return R.ok(testTypeService.getTestTypeList());
}
} }
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "TestUserCaseListRequest", description = "查询测试用例")
public class TestUserCaseListRequest extends PageDomain {
@ApiModelProperty("测试场景")
private String testScenario;
@ApiModelProperty("测试方法")
private String testType;
@ApiModelProperty("用例编号或者名称关键字")
private String searchKeywords;
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "TestUserCaseListResponse", description = "查询测试用例")
@Data
public class TestUserCaseListResponse {
@ApiModelProperty("测试场景")
private String testScenario;
@ApiModelProperty("测试方法")
private String testType;
@ApiModelProperty("用例编号")
private String useCaseNo;
@ApiModelProperty("用例名称")
private String useCaseName;
@ApiModelProperty("对应输入")
private String input;
@ApiModelProperty("用例描述")
private String description;
}
...@@ -184,4 +184,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -184,4 +184,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
ORDER BY ts.id ORDER BY ts.id
</select> </select>
<select id="selectSampleByTaskId" parameterType="java.lang.Long" resultType="com.ruoyi.domain.Sample">
select
s.sample_name,
s.manufacturing_enterprise,
s.sample_number,
s.number_of_samples,
s.trademark,
s.remark
from
t_sample s
left join t_task_sample_relation ts on s.id = ts.sample_id
left join t_task t on ts.task_id = t.id
where
t.id = #{id}
and s.deleted = 0
and ts.flag = '0'
order by s.id
limit 1;
</select>
</mapper> </mapper>
...@@ -29,5 +29,23 @@ ...@@ -29,5 +29,23 @@
GROUP BY project_id GROUP BY project_id
</select> </select>
<select id="selectListByGeneralTaskId" parameterType="java.lang.Long" resultType="com.ruoyi.domain.TestRecords">
select
tr.usecase,
tr.usecase_id,
tr.test_time,
tr.description,
tr.risk_level,
tr.test_method,
tr.test_result,
tr.remediation,
tr.test_details
from
t_test_records tr
left join t_task t on tr.task_id = t.model_test_task_id
where
t.id = #{id}
</select>
</mapper> </mapper>
...@@ -320,7 +320,7 @@ public class PdfBaseWriter extends Document{ ...@@ -320,7 +320,7 @@ public class PdfBaseWriter extends Document{
* @param fitHeight 高度自适应 * @param fitHeight 高度自适应
* @return 单元格 {@link PdfPCell} * @return 单元格 {@link PdfPCell}
*/ */
public PdfPCell newPdfPCellOfImage(int colspan, int rowspan, Image image, float fitWidth, float fitHeight) { public PdfPCell newPdfPCellOfImage(int colspan, int rowspan, Image image, float fitWidth, float fitHeight, PdfPTable table) {
PdfPCell cell = new PdfPCell(); PdfPCell cell = new PdfPCell();
cell.setUseAscender(Boolean.TRUE); cell.setUseAscender(Boolean.TRUE);
cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
...@@ -330,7 +330,9 @@ public class PdfBaseWriter extends Document{ ...@@ -330,7 +330,9 @@ public class PdfBaseWriter extends Document{
cell.setColspan(colspan); cell.setColspan(colspan);
cell.setRowspan(rowspan); cell.setRowspan(rowspan);
image.scaleToFit(fitWidth, fitHeight); image.scaleToFit(fitWidth, fitHeight);
image.setAlignment(Image.ALIGN_CENTER);
cell.addElement(image); cell.addElement(image);
table.addCell(cell);
return cell; return cell;
} }
......
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