Commit 0e645039 by 梁辉

新增签章字段

parent e89bd907
......@@ -99,6 +99,7 @@
<!-- 打包 -->
<build>
<finalName>reptiles</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
......
......@@ -2,6 +2,7 @@ package me.zhengjie.modules.system.domain.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
......@@ -10,6 +11,7 @@ import javax.validation.constraints.NotNull;
/**
* 部门Vo
*/
@TableName("sys_dept")
@Data
public class DeptVo {
......
......@@ -72,4 +72,6 @@ public class SysUserVo {
@ApiModelProperty(value = "站点名称",hidden = false)
private String siteName;
@ApiModelProperty("签名章名称")
private String snSignature;
}
......@@ -2,6 +2,7 @@ package me.zhengjie.modules.system.domain.vo.report;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.modules.system.domain.vo.DeptVo;
import me.zhengjie.modules.system.domain.vo.SysUserVo;
/**
......@@ -11,6 +12,9 @@ import me.zhengjie.modules.system.domain.vo.SysUserVo;
@Data
public class CarSignatureReqVo {
@ApiModelProperty("签章部门vo")
private DeptVo deptVo;
@ApiModelProperty("检测报告vo")
private ReportPdfVo reportPdfVo;
......
......@@ -2,10 +2,12 @@ package me.zhengjie.modules.system.repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.modules.system.domain.vo.report.ReportPdfVo;
import org.springframework.stereotype.Repository;
/**
* 检测报告PDF存放信息 mapper
* @author Lander
*/
@Repository
public interface ReportPdfMapper extends BaseMapper<ReportPdfVo> {
}
......@@ -134,13 +134,14 @@ public class ReportService {
ReportPdfVo reportPdfVo = reportPdfMapper.selectById(reportPdfId);
AssertUtil.isNotNull(reportPdfVo,"不存在该报告详情,请刷新页面后重试");
//先清除掉未签章的pdf文件(省点空间)
FileUtil.del(reportPdfVo.getPath());
DeptVo deptVo = deptMapper.selectById(sysUserVo.getDeptId());
AssertUtil.isNotNull(deptVo,"当前用户部门信息不存在");
//开始签章
CarSignatureReqVo carSignatureReqVo = new CarSignatureReqVo();
carSignatureReqVo.setReportPdfVo(reportPdfVo);
carSignatureReqVo.setSysUserVo(sysUserVo);
carSignatureReqVo.setDeptVo(deptVo);
//reportPdfVo = signatureUtil.electronicGM(reportPdfVo, sysUserVo);
HttpEntity<CarSignatureReqVo> httpEntity = new HttpEntity<>(carSignatureReqVo);
ResponseEntity<ResultVo> responseEntity = this.restTemplate.exchange(
......@@ -148,7 +149,7 @@ public class ReportService {
HttpMethod.POST,
httpEntity,
ResultVo.class);
AssertUtil.isTrue(responseEntity.getStatusCode() == HttpStatus.OK && responseEntity.getBody().getData()!=null,"签章失败!请重试");
AssertUtil.isTrue(responseEntity.getStatusCode() == HttpStatus.OK && responseEntity.getBody().getData()!=null,responseEntity.getBody().getErrMsg());
//更新数据库的报告详情
ReportPdfVo reportPdfVos = JSONUtil.toBean(JSONUtil.toJsonPrettyStr(responseEntity.getBody().getData()), ReportPdfVo.class);
......
......@@ -362,6 +362,15 @@ public class CarReportUtil {
//登录环保
WebDriver driver = null;
try {
//把检测报告编号作为该报告文件的文件名
String fileName = detailsReqVo.getReportNum();
//如果已经下载有检测报告则直接return
String reportHtmlPath = getReportPath(fileName,".html");
if(FileUtil.isNotEmpty(FileUtil.file(fileName))){
return getReportPath(fileName,".pdf");
}
//登录环保
driver = loginEp(username, password,null);
......@@ -434,15 +443,13 @@ public class CarReportUtil {
Document parse1 = Jsoup.parse(reportHtml);
//把检测报告编号作为该报告文件的文件名
String fileName = detailsReqVo.getReportNum();
String imgSrc = parse1.getElementById("qrImg").attr("src");
Object[] cookies = reportDriver.manage().getCookies().toArray();
byte[] respBytes = HttpUtil.createGet(imgSrc).header("Cookie", cookies[0].toString() + ";" + cookies[1].toString() + ";" + cookies[2].toString()).execute().bodyBytes();
FileUtil.writeBytes(respBytes, getReportPath(fileName,".png"));
//下载保存html检测报告
String reportHtmlPath = getReportPath(fileName,".html");
//将二维码转换成base64流 踩坑: 不转base64的话,转PDF后,图片显示不出来
BASE64Encoder encoder = new BASE64Encoder();
......
......@@ -4,9 +4,9 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:eladmin}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:car-reptiles}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: ${DB_USER:root}
password: ${DB_PWD:123456}
password: ${DB_PWD:root}
# 初始连接数
initial-size: 5
# 最小连接数
......
......@@ -18,7 +18,7 @@
</modules>
<name>环保车检系统 后台管理</name>
<url>http://auauz.net</url>
<url></url>
<parent>
<groupId>org.springframework.boot</groupId>
......@@ -209,6 +209,7 @@
</dependencies>
<build>
<finalName>reptiles</finalName>
<plugins>
<!-- 打包时跳过测试 -->
<plugin>
......
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