电子证照ofd转换修改
Showing
3 changed files
with
22 additions
and
17 deletions
| ... | @@ -885,9 +885,9 @@ | ... | @@ -885,9 +885,9 @@ |
| 885 | <dependency> | 885 | <dependency> |
| 886 | <groupId>com.thinkgem.jeesite</groupId> | 886 | <groupId>com.thinkgem.jeesite</groupId> |
| 887 | <artifactId>suwell-agent-wrapper</artifactId> | 887 | <artifactId>suwell-agent-wrapper</artifactId> |
| 888 | <version>1.6.191210</version> | 888 | <version>1.6.210610</version> |
| 889 | <scope>system</scope> | 889 | <scope>system</scope> |
| 890 | <systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-agent-wrapper-1.6.191210.jar</systemPath> | 890 | <systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-agent-wrapper-1.6.210610.jar</systemPath> |
| 891 | </dependency> | 891 | </dependency> |
| 892 | 892 | ||
| 893 | <dependency> | 893 | <dependency> | ... | ... |
| ... | @@ -2,7 +2,11 @@ package com.thinkgem.jeesite.modules.eci.method; | ... | @@ -2,7 +2,11 @@ package com.thinkgem.jeesite.modules.eci.method; |
| 2 | 2 | ||
| 3 | import com.suwell.ofd.custom.agent.ConvertException; | 3 | import com.suwell.ofd.custom.agent.ConvertException; |
| 4 | import com.suwell.ofd.custom.agent.HTTPAgent; | 4 | import com.suwell.ofd.custom.agent.HTTPAgent; |
| 5 | import com.suwell.ofd.custom.wrapper.Const; | ||
| 5 | import com.suwell.ofd.custom.wrapper.PackException; | 6 | import com.suwell.ofd.custom.wrapper.PackException; |
| 7 | import com.suwell.ofd.custom.wrapper.Packet; | ||
| 8 | import com.suwell.ofd.custom.wrapper.model.Common; | ||
| 9 | import com.suwell.ofd.custom.wrapper.model.ImageArgument; | ||
| 6 | import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao; | 10 | import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao; |
| 7 | import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo; | 11 | import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo; |
| 8 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| ... | @@ -33,33 +37,34 @@ public class OfdConvertRest { | ... | @@ -33,33 +37,34 @@ public class OfdConvertRest { |
| 33 | List<ElecLicenseInfo> waitForConverts = licenseInfoDao.getWaitForConvert(); | 37 | List<ElecLicenseInfo> waitForConverts = licenseInfoDao.getWaitForConvert(); |
| 34 | 38 | ||
| 35 | for (ElecLicenseInfo waitForConvert : waitForConverts) { | 39 | for (ElecLicenseInfo waitForConvert : waitForConverts) { |
| 36 | OutputStream out = null; | ||
| 37 | 40 | ||
| 38 | //转换后文件输出路径 | 41 | //转换后文件输出路径 |
| 39 | try { | 42 | try { |
| 43 | |||
| 44 | String documentId = waitForConvert.getDocumentId(); | ||
| 40 | String bizId = waitForConvert.getBizId(); | 45 | String bizId = waitForConvert.getBizId(); |
| 41 | String ofdPath = waitForConvert.getOfdWjdz(); | 46 | |
| 42 | // TODO: 2022/2/16/0016 ofd文件转换 | 47 | Packet packet = new Packet(Const.PackType.IMAGE, Const.Target.IMAGE); |
| 43 | File ofdFile = new File(ofdPath); | 48 | Common common = new Common(null, "ofd", -1, new FileInputStream(waitForConvert.getOfdWjdz())); |
| 49 | common.setArgument(new ImageArgument().setTargetFormat(ImageArgument.Type.jpg)); | ||
| 50 | packet.file(common); | ||
| 44 | 51 | ||
| 45 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd"); | 52 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd"); |
| 46 | String dateDir = simpleDateFormat.format(new Date()); | 53 | String dateDir = simpleDateFormat.format(new Date()); |
| 47 | 54 | ||
| 48 | String documentId = waitForConvert.getDocumentId(); | 55 | File jpg = new File("E:\\ECI\\TIFF" + dateDir + "\\"); |
| 49 | 56 | ||
| 50 | File tiffDir = new File("E:\\ECI\\TIFF" + dateDir + "\\"); | 57 | if (!jpg.exists()) { |
| 51 | if (!tiffDir.exists()) { | 58 | jpg.mkdirs(); |
| 52 | tiffDir.mkdirs(); | ||
| 53 | } | 59 | } |
| 54 | File tiffFile = new File(tiffDir + documentId + ".tiff"); | 60 | File jpgFile = new File(jpg + documentId + ".jpg"); |
| 55 | if (!tiffFile.exists()) { | 61 | if (!jpgFile.exists()) { |
| 56 | tiffFile.createNewFile(); | 62 | jpgFile.createNewFile(); |
| 57 | } | 63 | } |
| 58 | 64 | ||
| 59 | out = new FileOutputStream(tiffFile); | 65 | ha.convert(packet, new FileOutputStream(jpgFile)); |
| 60 | //输出格式。true输出格式为zip ;false输出格式为tiff | 66 | |
| 61 | ha.OFDToImge(ofdFile, out, -1, false); | 67 | licenseInfoDao.updateJpgWjdzAndStatus(jpgFile.getAbsolutePath(), bizId); |
| 62 | licenseInfoDao.updateJpgWjdzAndStatus(tiffFile.getAbsolutePath(), bizId); | ||
| 63 | } catch (PackException | ConvertException | IOException e) { | 68 | } catch (PackException | ConvertException | IOException e) { |
| 64 | e.printStackTrace(); | 69 | e.printStackTrace(); |
| 65 | } finally { | 70 | } finally { | ... | ... |
No preview for this file type
-
Please register or sign in to post a comment