Commit a859bbfb authored by 高滢's avatar 高滢
parents 79bcfb8d 13cc92c6
......@@ -74,6 +74,12 @@ public class ReviewSceneChangeTask {
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("检验标准id")
private String inspectStandardId;
@ApiModelProperty("检验标准名称")
private String inspectStandardName;
/**
* 章节
*/
......
......@@ -155,6 +155,15 @@ public class Task {
@ApiModelProperty("选择的项目")
private String taskList;
@ApiModelProperty("整车信息安全检验报告模板")
private String retentionUrl;
@ApiModelProperty("企业留档文件存储地址")
private String vehicleInformationUrl;
@ApiModelProperty("车型试验原始记录模板")
private String modelTestUrl;
@ApiModelProperty("指向待执行节点的指针[0、1、2]")
private int pointer;
......
......@@ -17,8 +17,9 @@ public interface PdfTemplateManagementService {
/**
* 企业留档文件PDF下载
* @param taskId
* @return
* @throws Exception
*/
String generateRetentionFile() throws Exception;
String generateRetentionFile(Long taskId) throws Exception;
}
......@@ -6,10 +6,13 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.PdfBaseWriter;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.vo.PhotoStorageVO;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.service.PdfTemplateManagementService;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import io.minio.MinioClient;
import io.minio.ObjectWriteArgs;
import io.minio.PutObjectArgs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -43,6 +46,9 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
@Value("${minio.secretKey}")
private String secretKey;
@Autowired
private ReviewEnterpriseArchiveService reviewEnterpriseArchiveService;
/**
* 检验报告PDF下载
* @param response
......@@ -109,10 +115,12 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
/**
* 企业留档文件PDF下载
* @param taskId
* @return
* @throws Exception
*/
@Override
public String generateRetentionFile() throws Exception {
public String generateRetentionFile(Long taskId) throws Exception {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// 新建
PdfBaseWriter document = new PdfBaseWriter(outputStream);
......@@ -141,26 +149,23 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
List<String> list = Arrays.asList("文件名称", "文件目录", "标准章节", "标准要求", "审查要点");
float[] columnWidths = {20, 20, 20, 70, 70};
PdfPTable table = document.createWithHeaderTable(list, columnWidths);
document.writeCell("A文件", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("B文件", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("C文件", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("车辆制造商应具备车辆全生命周期的汽车信息安全管理体系", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("E文件",Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("F文件", Element.ALIGN_LEFT,1, 2, table);
document.writeCell("1.1", Element.ALIGN_LEFT,1, 1, table);
document.writeCell("5.1", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("要求1", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("要点1", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("1.2", Element.ALIGN_LEFT,1, 1, table);
document.writeCell("5.2", Element.ALIGN_LEFT, 1, 1, table);
document.writeCell("要求2", Element.ALIGN_LEFT,1, 1, table);
document.writeCell("要点2", Element.ALIGN_LEFT,1, 1, table);
// 查询数据
List<ReviewEnterpriseArchiveViewVO> viewList = reviewEnterpriseArchiveService.view(taskId);
for (ReviewEnterpriseArchiveViewVO view : viewList) {
document.writeCell(view.getFileName(), Element.ALIGN_LEFT, 1, view.getItems().size(), table);
view.getItems().forEach(item -> {
document.writeCell(item.getCatalogue(), Element.ALIGN_LEFT, 1, 1, table);
document.writeCell(item.getChapter(), Element.ALIGN_LEFT, 1, 1, table);
document.writeCell(item.getStandard(), Element.ALIGN_LEFT, 1, 1, table);
document.writeCell(item.getKeyPoint(), Element.ALIGN_LEFT, 1, 1, table);
});
}
document.addContent(table);
// 关闭
document.close();
// 上传到Minio
return uploadMinio(outputStream, "企业留档文件");
return uploadMinio(outputStream, "企业留档文件" + "_" + taskId);
}
/**
......
package com.ruoyi.web;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.domain.Task;
import com.ruoyi.service.PdfTemplateManagementService;
import com.ruoyi.service.TaskService;
import com.ruoyi.web.request.PdfFileRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
......@@ -20,6 +25,9 @@ import javax.servlet.http.HttpServletResponse;
@RequestMapping("/pdf")
public class PdfTemplateManagementController {
@Autowired
private TaskService taskService;
@Autowired
private PdfTemplateManagementService pdfTemplateManagementService;
......@@ -42,15 +50,15 @@ public class PdfTemplateManagementController {
/**
* 企业留档文件PDF下载
* @param response
* @param request
*/
@Anonymous
@ApiOperation("企业留档文件PDF下载")
@GetMapping(value = "/retentionFile", produces = "application/json")
public R<String> downloadRetentionFile() {
@PostMapping("/retentionFile")
public R<String> downloadRetentionFile(@Validated @RequestBody PdfFileRequest request) {
try {
// demo-模板
String url = pdfTemplateManagementService.generateRetentionFile();
String url = pdfTemplateManagementService.generateRetentionFile(request.getTaskId());
return R.ok(url);
} catch (Exception e) {
e.printStackTrace();
......@@ -58,4 +66,82 @@ public class PdfTemplateManagementController {
}
}
/**
* 下载PDF通用(三个PDF)
* @param request
* @return
*/
@Anonymous
@ApiOperation("下载PDF通用")
@PostMapping("/download")
public R<String> downloadPdf(@Validated @RequestBody PdfFileRequest request) {
// 根据taskId、pdf类型判断库里存不存在minio地址
String url = "";
Task task = taskService.getOne(new QueryWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()));
try {
switch (request.getType()) {
case 0:
url = task.getVehicleInformationUrl();
if (StrUtil.isBlank(url)) {
// TODO 生成整车
}
break;
case 1:
url = task.getRetentionUrl();
if (StrUtil.isBlank(url)) {
// 根据任务ID新生成
url = pdfTemplateManagementService.generateRetentionFile(request.getTaskId());
// 更改
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getRetentionUrl, url));
}
break;
case 2:
url = task.getModelTestUrl();
if (StrUtil.isBlank(url)) {
// TODO 生成车型
}
break;
default:
break;
}
} catch (Exception e) {
e.printStackTrace();
return R.fail();
}
return R.ok(url);
}
/**
* 更新PDF通用
* @param request
*/
@Anonymous
@ApiOperation("更新PDF通用")
@PostMapping("/update")
public R<String> updatePdf(@Validated @RequestBody PdfFileRequest request) {
String url = "";
try {
switch (request.getType()) {
case 0:
// TODO 更新整车
break;
case 1:
// 根据任务ID新生成
url = pdfTemplateManagementService.generateRetentionFile(request.getTaskId());
// 更改
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getRetentionUrl, url));
break;
case 2:
// 更新
// TODO 更新车型
break;
default:
break;
}
} catch (Exception e) {
e.printStackTrace();
return R.fail();
}
return R.ok(url);
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* PDF文件请求DTO
* @author gxk
*/
@Data
@Builder
@ApiModel
@NoArgsConstructor
@AllArgsConstructor
public class PdfFileRequest {
@ApiModelProperty("任务ID")
@NotNull(message = "任务ID不能为空")
private Long taskId;
@ApiModelProperty("PDF类型(0-整车、1-企业留档、2-车型)")
@NotNull(message = "PDF类型不能为空")
private Integer type;
}
......@@ -12,7 +12,7 @@ public class ReviewSceneChangeTaskFindCreateRequest extends PageDomain {
@ApiModelProperty("评审类型")
private String operationSort;
@ApiModelProperty("条款分类[system(体系审查)、car(车型审查)]")
@ApiModelProperty("标准要求分类[system(体系审查)、car(车型审查)]")
private String type;
@ApiModelProperty("关键词")
......@@ -20,4 +20,8 @@ public class ReviewSceneChangeTaskFindCreateRequest extends PageDomain {
@ApiModelProperty("评审状态")
private String taskStatus;
@ApiModelProperty("检验标准")
private Long inspectStandardId;
}
......@@ -17,4 +17,7 @@ public class ReviewSceneChangeTaskFindFinishRequest extends PageDomain {
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("检验标准")
private Long inspectStandardId;
}
......@@ -17,4 +17,7 @@ public class ReviewSceneChangeTaskFindPendingRequest extends PageDomain {
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("检验标准")
private Long inspectStandardId;
}
......@@ -22,6 +22,12 @@ public class ReviewSceneChangeTaskResponse {
@ApiModelProperty("任务编号")
private String taskNo;
@ApiModelProperty("检验标准id")
private String inspectStandardId;
@ApiModelProperty("检验标准名称")
private String inspectStandardName;
/**
* 章节
*/
......
......@@ -51,7 +51,7 @@
and status = #{status}
</if>
<if test="identifyNumber != null and identifyNumber != ''">
and identify_number = #{identifyNumber}
and identify_number like concat('%',#{identifyNumber},'%')
</if>
</where>
</select>
......@@ -77,7 +77,7 @@
and status = #{status}
</if>
<if test="identifyNumber != null and identifyNumber != ''">
and identify_number = #{identifyNumber}
and identify_number like concat('%',#{identifyNumber},'%')
</if>
</where>
</select>
......
......@@ -22,6 +22,8 @@
<result property="taskResult" column="task_result" jdbcType="VARCHAR"/>
<result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/>
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
<result property="inspectStandardId" column="inspect_standard_id" jdbcType="BIGINT"/>
<result property="inspectStandardName" column="inspect_standard_name" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="ResponseResultMap" type="com.ruoyi.web.response.ReviewSceneChangeTaskResponse">
......@@ -43,6 +45,8 @@
<result property="taskBeginTime" column="task_begin_time" jdbcType="TIMESTAMP"/>
<result property="taskEndTime" column="task_end_time" jdbcType="TIMESTAMP"/>
<result property="decision" column="decision" jdbcType="VARCHAR"/>
<result property="inspectStandardId" column="inspect_standard_id" jdbcType="BIGINT"/>
<result property="inspectStandardName" column="inspect_standard_name" jdbcType="VARCHAR"/>
</resultMap>
<select id="findLastChangeByTaskId" resultType="com.ruoyi.domain.ReviewSceneChangeTask">
......@@ -65,7 +69,9 @@
<if test="request.keyword != null and request.keyword != ''">
and (sct.old_text like concat('%',#{request.keyword},'%') || sct.new_text like concat('%',#{request.keyword},'%'))
</if>
order by sct.task_begin_time desc
<if test="request.inspectStandardId != null and request.inspectStandardId != ''">
and inspect_standard_id = #{request.inspectStandardId}
</if>
</select>
<select id="findFinishListByUserId" resultType="com.ruoyi.web.response.ReviewSceneChangeTaskResponse">
......@@ -81,7 +87,9 @@
<if test="request.keyword != null and request.keyword != ''">
and (sct.old_text like concat('%',#{request.keyword},'%') || sct.new_text like concat('%',#{request.keyword},'%'))
</if>
order by sct.task_begin_time desc
<if test="request.inspectStandardId != null and request.inspectStandardId != ''">
and inspect_standard_id = #{request.inspectStandardId}
</if>
</select>
<select id="findCreateListByUserId" resultType="com.ruoyi.domain.ReviewSceneChangeTask">
......@@ -99,7 +107,9 @@
<if test="request.taskStatus != null and request.taskStatus != ''">
and task_status = #{request.taskStatus}
</if>
order by task_begin_time desc
<if test="request.inspectStandardId != null and request.inspectStandardId != ''">
and inspect_standard_id = #{request.inspectStandardId}
</if>
</select>
</mapper>
......@@ -102,13 +102,13 @@
and t.standard_id = #{standardId}
</if>
<if test="taskNo != null and taskNo != ''">
and t.task_no = #{taskNo}
and t.task_no like concat('%',#{taskNo},'%')
</if>
<if test="taskName != null and taskName != ''">
and t.task_name like concat('%',#{taskName},'%')
</if>
<if test="productModel != null and productModel != ''">
and t.product_model = #{productModel}
and t.product_model like concat('%',#{productModel},'%')
</if>
<if test="inspectionItem != null and inspectionItem != ''">
AND(
......@@ -133,13 +133,13 @@
and t.standard_id = #{standardId}
</if>
<if test="taskNo != null and taskNo != ''">
and t.task_no = #{taskNo}
and t.task_no like concat('%',#{taskNo},'%')
</if>
<if test="taskName != null and taskName != ''">
and t.task_name like concat('%',#{taskName},'%')
</if>
<if test="productModel != null and productModel != ''">
and t.product_model = #{productModel}
and t.product_model like concat('%',#{productModel},'%')
</if>
<if test="inspectionItem != null and inspectionItem != ''">
AND (
......@@ -183,13 +183,13 @@
and t.standard_id = #{request.standardId}
</if>
<if test="request.taskNo != null and request.taskNo != ''">
and t.task_no = #{request.taskNo}
and t.task_no like concat('%',#{request.taskNo},'%')
</if>
<if test="request.taskName != null and request.taskName != ''">
and t.task_name like concat('%',#{request.taskName},'%')
</if>
<if test="request.productModel != null and request.productModel != ''">
and t.product_model = #{request.productModel}
and t.product_model like concat('%',#{request.productModel},'%')
</if>
<if test="request.inspectionItem != null and request.inspectionItem != ''">
AND (
......@@ -220,13 +220,13 @@
and t.standard_id = #{standardId}
</if>
<if test="request.taskNo != null and request.taskNo != ''">
and t.task_no = #{taskNo}
and t.task_no like concat('%',#{request.taskNo},'%')
</if>
<if test="request.taskName != null and request.taskName != ''">
and t.task_name like concat('%',#{taskName},'%')
and t.task_name like concat('%',#{request.taskName},'%')
</if>
<if test="request.productModel != null and request.productModel != ''">
and t.product_model = #{productModel}
and t.product_model like concat('%',#{request.productModel},'%')
</if>
<if test="request.inspectionItem != null and request.inspectionItem != ''">
AND (
......
......@@ -141,7 +141,7 @@ xss:
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
urlPatterns: /*
minio:
url: ${MINIO_URL}
......
......@@ -143,7 +143,7 @@ xss:
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
urlPatterns: /*
minio:
url: http://49.232.167.247:22038
......
......@@ -89,16 +89,16 @@
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<logger name="com.ruoyi" level="debug" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<root level="debug">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<root level="debug">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
<appender-ref ref="console"/>
......@@ -106,8 +106,9 @@
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<logger name="sys-user" level="debug">
<appender-ref ref="sys-user"/>
<appender-ref ref="console" />
</logger>
......
......@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage").permitAll()
.antMatchers("/login", "/register", "/captchaImage", "/prod-api/captchaImage").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/websocket/**", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
......
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