Commit d4fece7a authored by 盖献康's avatar 盖献康

Merge branch 'dev' into 'master'

Dev - master 5.0

See merge request !283
parents a7603471 9cba1ab3
package com.ruoyi.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 检验报告PDF VO类
......
......@@ -19,7 +19,7 @@ public class QuantityStatisticsVO {
@ApiModelProperty("支持标准数量")
private Long standardQuantity;
@ApiModelProperty("测试用例数量")
@ApiModelProperty("测试用例数量科恩获取")
private Long numberUseCases;
@ApiModelProperty("任务数量")
......@@ -40,10 +40,10 @@ public class QuantityStatisticsVO {
@ApiModelProperty("零部件样品数量")
private Long numberComponentSamples;
@ApiModelProperty("测试方法数量")
@ApiModelProperty("测试方法数量科恩获取")
private Long numberMethods;
@ApiModelProperty("场景数量")
@ApiModelProperty("场景数量科恩获取")
private Long numberScenes;
@ApiModelProperty("已完成任务数量")
......
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel( description = "测试场景VO")
@Data
public class ScenarioVO {
private Long id;
private String name;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel( description = "测试方法(类型)VO")
@Data
public class TestTypeVO {
private Long id;
private String name;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel( description = "测试用例VO")
@Data
public class UseCaseVO {
private String id;
private String name;
// 测试场景
private String scenario;
// 测试方法
private String test_type;
/**
* 返回用例在矩阵中的坐标
* @return
*/
public String getCoordinates() {
return scenario + test_type;
}
}
......@@ -66,4 +66,5 @@ public interface TaskMapper extends BaseMapper<Task> {
List<UserNameResponse> findByRelation(@Param("relation") List<TaskUserRelation> relation);
List<UserNameResponse> findByFinishTaskList(@Param("taskList") List<Task> taskList);
}
......@@ -6,4 +6,6 @@ public interface MatrixService {
MatrixResponse getMatrix();
MatrixResponse getMatrixForUrl();
}
......@@ -22,4 +22,12 @@ public interface PdfTemplateManagementService {
* @throws Exception
*/
String generateRetentionFile(Long taskId) throws Exception;
/**
* 原始记录PDF下载
* @param taskId
* @return
*/
String generateOriginalRecord(Long taskId);
}
package com.ruoyi.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.domain.TestScenario;
import com.ruoyi.domain.TestType;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.domain.vo.MatrixColumnVO;
import com.ruoyi.domain.vo.MatrixRowVO;
import com.ruoyi.domain.vo.*;
import com.ruoyi.service.ITestScenarioService;
import com.ruoyi.service.ITestTypeService;
import com.ruoyi.service.MatrixService;
......@@ -13,8 +14,6 @@ import com.ruoyi.web.response.MatrixResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.format.TextStyle;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -47,6 +46,88 @@ public class MatrixServiceImpl implements MatrixService {
return response;
}
@Override
public MatrixResponse getMatrixForUrl() {
//以post形式请求接口
String result= HttpUtil.post("https://10.12.48.78:8090/DescribeScenarioTestTypeList","");
JSONObject jsonObject = JSONObject.parseObject(result);
// 获取测试场景列表
List<ScenarioVO> scenarioList = jsonObject.getList("scenario_list", ScenarioVO.class);
if (scenarioList != null && scenarioList.size() != 0 ) {
for (int i = 0; i < scenarioList.size(); i++) {
scenarioList.get(i).setId((long) i);
}
}
// 获取测试方法列表
List<TestTypeVO> testTypeList = jsonObject.getList("test_type_list", TestTypeVO.class);
if (testTypeList != null && testTypeList.size() != 0 ) {
for (int i = 0; i < testTypeList.size(); i++) {
testTypeList.get(i).setId((long) i);
}
}
String caseResult= HttpUtil.post("https://10.12.48.78:8090/DescribeCaseList","");
JSONObject object = JSONObject.parseObject(caseResult);
// 获取测试用例列表
List<UseCaseVO> caseList = object.getList("case_list", UseCaseVO.class);
MatrixResponse response = new MatrixResponse();
setHeaderName(response, testTypeList);
setRowsName(response, scenarioList, testTypeList, caseList);
return response;
}
private void setRowsName(MatrixResponse response, List<ScenarioVO> scenarioList, List<TestTypeVO> testTypeList, List<UseCaseVO> caseList) {
List<Map<String, Object>> rows = new ArrayList();
for(ScenarioVO scenario : scenarioList) {
Map<String, Object> row = new HashMap();
row.put("name", scenario.getName());
for(TestTypeVO type : testTypeList) {
String column = type.getName();
String columnId = String.valueOf(type.getId());
String coordinates = scenario.getName() + column;
String useCase = getUseCaseIdByCoordinatesName(caseList, coordinates);
row.put(columnId, useCase == null ? "" : useCase);
}
rows.add(row);
}
response.setRows(rows);
}
public String getUseCaseIdByCoordinatesName(List<UseCaseVO> caseList, String coordinates) {
for(UseCaseVO useCase : caseList) {
if(useCase.getCoordinates().equals(coordinates)) {
return useCase.getId();
}
}
return null;
}
private void setHeaderName(MatrixResponse response, List<TestTypeVO> testTypeList) {
List<MatrixColumnVO> columns = new ArrayList();
for(TestTypeVO type : testTypeList) {
MatrixColumnVO column = new MatrixColumnVO(String.valueOf(type.getId()),type.getName());
columns.add(column);
}
response.setHeader(columns);
}
private void setHeader(MatrixResponse response, List<TestType> types) {
List<MatrixColumnVO> columns = new ArrayList();
......
......@@ -158,7 +158,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
? Optional.of(pictureList.get(i))
: Optional.empty();
if (optionalElement.isPresent() && StrUtil.isNotEmpty(optionalElement.get())) {
Image image = Image.getInstance(new URL(minioEndpoint + optionalElement.get()));
Image image = Image.getInstance(new URL((minioEndpoint + optionalElement.get()).replace(" ", "%20")));
image.scaleAbsolute(100, 100);
cell.addElement(image);
} else {
......@@ -259,6 +259,39 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
return uploadMinio(outputStream, "企业留档文件-" + getReportName());
}
/**
* 原始记录PDF下载
* @param taskId
* @return
*/
@Override
public String generateOriginalRecord(Long taskId) {
return null;
}
public static class OriginalRecordHeaderFooter extends PdfPageEventHelper {
// 一页加载完成触发,写入页眉和页脚
@Override
public void onEndPage(PdfWriter writer, Document document) {
PdfPTable table = new PdfPTable(2);
try {
table.setTotalWidth(PageSize.A4.getWidth() - 80);
table.setWidths(new int[] { 40, 40 });
table.setLockedWidth(true);
table.getDefaultCell().setFixedHeight(-10);
table.getDefaultCell().setBorder(Rectangle.BOTTOM);
table.getDefaultCell().setBorderWidth(0.6f);
BaseFont font = BaseFont.createFont("/fonts/STSong.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
table.addCell(new Paragraph(headerText, new Font(font)));// 可以直接使用addCell(str),不过不能指定字体,中文无法显示
// 将页眉写到document中,位置可以指定,指定到下面就是页脚
table.writeSelectedRows(0, -1, 40, PageSize.A4.getHeight() - 20, writer.getDirectContent());
} catch (Exception de) {
throw new ExceptionConverter(de);
}
}
}
private static String headerText;
public static class MyHeaderFooter extends PdfPageEventHelper {
......
......@@ -85,12 +85,6 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
response.setCarReviewTask(carReviewTask);
Task task = taskMapper.getBySubtaskId(carReviewTask.getId());
if (task.getModelTestTaskId() != null) {
response.setTestScenarioList(testScenarioMapper.selectAll());
}
return response;
}
......
......@@ -239,12 +239,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
setCarProgress(carReviewTaskList,responses);
// 车型试验子任务列表
List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
setModelProgress(modelTestTaskList,responses);
// List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
// setModelProgress(modelTestTaskList,responses);
// 设置车型试验进度
setModelSchedule(responses);
// 任务是否有选择场景
List<TaskScenarioResponse> scenarioResponseList = taskMapper.findByTaskList(responses);
setTaskScenario(scenarioResponseList,responses);
// List<TaskScenarioResponse> scenarioResponseList = taskMapper.findByTaskList(responses);
// setTaskScenario(scenarioResponseList,responses);
for (TaskFindResponse response : responses) {
......@@ -390,8 +392,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
setCarProgress(carReviewTaskList,responses);
// 车型试验子任务列表
List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
setModelProgress(modelTestTaskList,responses);
// List<ModelTestTask> modelTestTaskList = modelTestTaskMapper.findByTaskList(responses);
// setModelProgress(modelTestTaskList,responses);
// 设置车型试验进度
setModelSchedule(responses);
for (TaskFindResponse response : responses) {
String[] taskList = response.getTaskList().split(",");
......@@ -762,6 +766,51 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
}
private void setModelSchedule(List<TaskFindResponse> responses) {
if (responses != null && responses.size() != 0) {
for (TaskFindResponse response : responses) {
if (response.getTestSchemeId() != null) {
// 获取任务的用例数量
Map<String, Object> map = new HashMap<>();
map.put("id", response.getTestSchemeId());
map.put("verbose", "BASIC");
//以post形式请求接口
String result= HttpUtil.post("https://10.12.48.78:8090/DescribeProjectTestResult", JSONObject.toJSONString(map));
JSONObject jsonObject = JSONObject.parseObject(result);
// 获取项目id
Integer useCaseNum = (Integer) jsonObject.get("case_count");
// 任务是否有选择用例
response.setTaskScenario(useCaseNum > 0);
// 任务用例结果数量
Long resultNum = testRecordsMapper.countResult(response.getTestSchemeId());
if (Objects.equals(response.getTestStatus(), ModelTestTask.TASK_STATUS_FINISH)) {
response.setTest(100.0);
} else if (Objects.equals(response.getTestStatus(), ModelTestTask.TASK_STATUS_SIGNED)) {
response.setTest(90.0);
} else if(resultNum == null) {
response.setTest(0.0);
} else {
BigDecimal num = new BigDecimal((resultNum / useCaseNum) * 90);
response.setTest(num.setScale(1,BigDecimal.ROUND_UP).doubleValue());
}
} else {
// 任务是否有选择用例
response.setTaskScenario(false);
}
}
}
}
private void setModelProgress(List<ModelTestTask> modelTestTaskList, List<TaskFindResponse> responses) {
if (modelTestTaskList != null && modelTestTaskList.size() != 0) {
......
......@@ -25,7 +25,7 @@ public class MatrixController {
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getInfo")
public R<MatrixResponse> getInfo() {
return R.ok(matrixService.getMatrix());
return R.ok(matrixService.getMatrixForUrl());
}
}
......@@ -100,6 +100,8 @@ public class PdfTemplateManagementController {
url = task.getModelTestUrl();
if (StrUtil.isBlank(url)) {
// TODO 生成车型
url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId());
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestTaskId, url));
}
break;
default:
......@@ -136,7 +138,8 @@ public class PdfTemplateManagementController {
break;
case 2:
// 更新
// TODO 更新车型
url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId());
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestTaskId, url));
break;
default:
break;
......
......@@ -19,6 +19,7 @@
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewEnterpriseArchive">
SELECT id, enterprise_name, file_name, version, publish_date, status, identify_number, storage, photo, task_id, create_by, create_time FROM t_review_enterprise_archive WHERE task_id = #{taskId}
</select>
......
......@@ -8,7 +8,6 @@
<select id="selectQuantityStatistics" resultType="com.ruoyi.domain.vo.QuantityStatisticsVO" parameterType="com.ruoyi.domain.vo.QuantityStatisticsVO">
SELECT
( SELECT count( id ) FROM t_standard ) AS standardQuantity,
( SELECT count( id ) FROM t_test_usecase ) AS numberUseCases,
( SELECT count( id ) FROM t_task WHERE task_status != 'TEMPORARILY' ) AS numberTasks,
( SELECT count( id ) FROM t_automobile_enterprise WHERE deleted = 0 ) AS numberCompanies,
(
......@@ -22,8 +21,6 @@
) AS numberInspectors,
( SELECT count( id ) FROM t_sample WHERE flag = '0' AND deleted = 0 ) AS numberVehicleSamples,
( SELECT count( id ) FROM t_sample WHERE flag = '1' AND deleted = 0 ) AS numberComponentSamples,
( SELECT count( id ) FROM t_test_scenario ) AS numberScenes,
( SELECT count( id ) FROM t_test_type ) AS numberMethods,
( SELECT count( id ) FROM t_task WHERE vehicle_information_url IS NOT NULL ) AS numberReports,
( SELECT count( id ) FROM t_task WHERE task_status = 'FINISH' ) AS completedTaskNumber,
( SELECT count( id ) FROM t_task WHERE task_status = 'NEW' OR task_status = 'PENDING' OR task_status = 'SIGNED') AS executeTasksNumber
......@@ -41,12 +38,14 @@
<select id="selectConfidentialityLevelStatistics" resultType="com.ruoyi.domain.vo.ConfidentialityLevelProportionVO">
SELECT
count( id ) AS value,
confidentiality_level AS name
count( id ) AS value,
confidentiality_level AS name
FROM
t_task
t_task
WHERE
confidentiality_level IS NOT NULL AND confidentiality_level != ''
GROUP BY
confidentiality_level
confidentiality_level
</select>
<select id="selectInspectionItemPassedNum" resultType="com.ruoyi.domain.vo.InspectionItemPassedNumVO">
......
......@@ -307,16 +307,16 @@
t.entrusted_unit_address AS clientAddress,
t.entrusted_unit_phone AS entrustedUnitTelephone,
t.entrusted_unit_code AS clientPostalCode,
GROUP_CONCAT(s.sample_name) AS sampleName,
SUBSTRING_INDEX(GROUP_CONCAT(s.sample_name), ',', 1) AS sampleName,
t.product_model AS typeSpecification,
DATE_FORMAT(t.task_begin_time, '%Y年%m月%d日') AS taskBeginTime,
DATE_FORMAT(t.task_end_time, '%Y年%m月%d日') AS taskEndTime,
concat(st.standard_no, ' ', st.name) AS inspectionBasis,
GROUP_CONCAT(distinct ae.enterprise_name) AS productionEnterprise,
GROUP_CONCAT(s.sample_sender) AS sampleSender,
GROUP_CONCAT(distinct DATE_FORMAT(s.delivery_date, '%Y-%m-%d')) AS sampleDeliveryDate,
count(s.id) AS sampleQuantity,
CONVERT(sum(s.number_of_samples), UNSIGNED) AS sampleSum,
SUBSTRING_INDEX(GROUP_CONCAT(distinct ae.enterprise_name), ',', 1) AS productionEnterprise,
SUBSTRING_INDEX(GROUP_CONCAT(s.sample_sender), ',', 1) AS sampleSender,
SUBSTRING_INDEX(GROUP_CONCAT(distinct DATE_FORMAT(s.delivery_date, '%Y-%m-%d')), ',', 1) AS sampleDeliveryDate,
sum(CASE WHEN s.flag = '0' THEN 1 ELSE 0 END) AS sampleQuantity,
CONVERT(sum(CASE WHEN s.flag = '0' THEN s.number_of_samples ELSE 0 END), UNSIGNED) AS sampleSum,
GROUP_CONCAT(distinct DATE_FORMAT(s.manufacture_date, '%Y-%m-%d')) AS sampleDeliveryDate,
t.product_model AS vehicleModel,
t.id AS taskNumber,
......
......@@ -6,16 +6,16 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://49.232.167.247:22030/vehicle-quality-review?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://49.232.167.247:22030/vehicle-quality-review?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sessionVariables=group_concat_max_len=3000
username: root
password: 1qaz@WSX
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
......@@ -39,7 +39,7 @@ spring:
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
......@@ -58,4 +58,4 @@ spring:
merge-sql: true
wall:
config:
multi-statement-allow: true
\ No newline at end of file
multi-statement-allow: true
......@@ -6,16 +6,16 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://${MYSQL_IP}:${MYSQL_PORT}/vehicle-quality-review?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://${MYSQL_IP}:${MYSQL_PORT}/vehicle-quality-review?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sessionVariables=group_concat_max_len=3000
username: ${MYSQL_USERNAME}
password: ${MYSQL_PASSWORD}
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
......@@ -39,7 +39,7 @@ spring:
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
......@@ -58,4 +58,4 @@ spring:
merge-sql: true
wall:
config:
multi-statement-allow: true
\ No newline at end of file
multi-statement-allow: true
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