aa5624e9 by 荆蔚杰

电子证照ofd转换修改

1 parent b2a21756
......@@ -885,9 +885,9 @@
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-agent-wrapper</artifactId>
<version>1.6.191210</version>
<version>1.6.210610</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-agent-wrapper-1.6.191210.jar</systemPath>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-agent-wrapper-1.6.210610.jar</systemPath>
</dependency>
<dependency>
......
......@@ -2,7 +2,11 @@ package com.thinkgem.jeesite.modules.eci.method;
import com.suwell.ofd.custom.agent.ConvertException;
import com.suwell.ofd.custom.agent.HTTPAgent;
import com.suwell.ofd.custom.wrapper.Const;
import com.suwell.ofd.custom.wrapper.PackException;
import com.suwell.ofd.custom.wrapper.Packet;
import com.suwell.ofd.custom.wrapper.model.Common;
import com.suwell.ofd.custom.wrapper.model.ImageArgument;
import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao;
import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo;
import org.slf4j.Logger;
......@@ -33,33 +37,34 @@ public class OfdConvertRest {
List<ElecLicenseInfo> waitForConverts = licenseInfoDao.getWaitForConvert();
for (ElecLicenseInfo waitForConvert : waitForConverts) {
OutputStream out = null;
//转换后文件输出路径
try {
String documentId = waitForConvert.getDocumentId();
String bizId = waitForConvert.getBizId();
String ofdPath = waitForConvert.getOfdWjdz();
// TODO: 2022/2/16/0016 ofd文件转换
File ofdFile = new File(ofdPath);
Packet packet = new Packet(Const.PackType.IMAGE, Const.Target.IMAGE);
Common common = new Common(null, "ofd", -1, new FileInputStream(waitForConvert.getOfdWjdz()));
common.setArgument(new ImageArgument().setTargetFormat(ImageArgument.Type.jpg));
packet.file(common);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd");
String dateDir = simpleDateFormat.format(new Date());
String documentId = waitForConvert.getDocumentId();
File jpg = new File("E:\\ECI\\TIFF" + dateDir + "\\");
File tiffDir = new File("E:\\ECI\\TIFF" + dateDir + "\\");
if (!tiffDir.exists()) {
tiffDir.mkdirs();
if (!jpg.exists()) {
jpg.mkdirs();
}
File tiffFile = new File(tiffDir + documentId + ".tiff");
if (!tiffFile.exists()) {
tiffFile.createNewFile();
File jpgFile = new File(jpg + documentId + ".jpg");
if (!jpgFile.exists()) {
jpgFile.createNewFile();
}
out = new FileOutputStream(tiffFile);
//输出格式。true输出格式为zip ;false输出格式为tiff
ha.OFDToImge(ofdFile, out, -1, false);
licenseInfoDao.updateJpgWjdzAndStatus(tiffFile.getAbsolutePath(), bizId);
ha.convert(packet, new FileOutputStream(jpgFile));
licenseInfoDao.updateJpgWjdzAndStatus(jpgFile.getAbsolutePath(), bizId);
} catch (PackException | ConvertException | IOException e) {
e.printStackTrace();
} finally {
......