8f78e57c by 荆蔚杰

电子证照接口

1 parent 5fe3bd99
Showing 38 changed files with 284 additions and 67 deletions
...@@ -22,6 +22,7 @@ public interface ElecLicenseInfoDao extends CrudDao<ElecLicenseInfo> { ...@@ -22,6 +22,7 @@ public interface ElecLicenseInfoDao extends CrudDao<ElecLicenseInfo> {
22 22
23 /** 23 /**
24 * 更新合同ID和状态 24 * 更新合同ID和状态
25 *
25 * @param waitForCreateContract 26 * @param waitForCreateContract
26 * @return 27 * @return
27 */ 28 */
...@@ -68,4 +69,6 @@ public interface ElecLicenseInfoDao extends CrudDao<ElecLicenseInfo> { ...@@ -68,4 +69,6 @@ public interface ElecLicenseInfoDao extends CrudDao<ElecLicenseInfo> {
68 69
69 70
70 List<ElecLicenseInfo> selectZsbs(@Param("zsbs") String zsbs); 71 List<ElecLicenseInfo> selectZsbs(@Param("zsbs") String zsbs);
72
73 Integer updateJpgWjdzAndStatus(@Param("jpgPath") String jpgPath, @Param("bizId") String bizId);
71 } 74 }
......
1 package com.thinkgem.jeesite.modules.eci.entity;
2
3 import java.io.Serializable;
4
5 /**
6 * 模板参数
7 */
8 public class BdcqzsTemplate implements Serializable {
9
10 private static final long serialVersionUID = 1L;
11
12 /**
13 * 二维码
14 */
15 private String ewm;
16
17 /**
18 * 登记时间
19 */
20 private String djsj;
21
22 /**
23 * 不动产权证号
24 */
25 private String bdcqzh;
26
27 /**
28 * 权利人
29 */
30 private String qlr;
31
32 /**
33 * 共有情况
34 */
35 private String gyqk;
36
37 /**
38 * 坐落
39 */
40 private String zl;
41
42 /**
43 * 不动产单元号
44 */
45 private String bdcdyh;
46
47 /**
48 * 权利类型
49 */
50 private String qllx;
51
52 /**
53 * 权利性质
54 */
55 private String qlxz;
56
57 /**
58 * 用途
59 */
60 private String yt;
61
62 /**
63 * 面积
64 */
65 private String mj;
66
67 /**
68 * 使用期限
69 */
70 private String syqx;
71
72 /**
73 * 权力其他状况
74 */
75 private String qlqtzk;
76
77 /**
78 * 附记
79 */
80 private String fj;
81
82 public String getEwm() {
83 return ewm;
84 }
85
86 public void setEwm(String ewm) {
87 this.ewm = ewm;
88 }
89
90 public String getDjsj() {
91 return djsj;
92 }
93
94 public void setDjsj(String djsj) {
95 this.djsj = djsj;
96 }
97
98 public String getBdcqzh() {
99 return bdcqzh;
100 }
101
102 public void setBdcqzh(String bdcqzh) {
103 this.bdcqzh = bdcqzh;
104 }
105
106 public String getQlr() {
107 return qlr;
108 }
109
110 public void setQlr(String qlr) {
111 this.qlr = qlr;
112 }
113
114 public String getGyqk() {
115 return gyqk;
116 }
117
118 public void setGyqk(String gyqk) {
119 this.gyqk = gyqk;
120 }
121
122 public String getZl() {
123 return zl;
124 }
125
126 public void setZl(String zl) {
127 this.zl = zl;
128 }
129
130 public String getBdcdyh() {
131 return bdcdyh;
132 }
133
134 public void setBdcdyh(String bdcdyh) {
135 this.bdcdyh = bdcdyh;
136 }
137
138 public String getQllx() {
139 return qllx;
140 }
141
142 public void setQllx(String qllx) {
143 this.qllx = qllx;
144 }
145
146 public String getQlxz() {
147 return qlxz;
148 }
149
150 public void setQlxz(String qlxz) {
151 this.qlxz = qlxz;
152 }
153
154 public String getYt() {
155 return yt;
156 }
157
158 public void setYt(String yt) {
159 this.yt = yt;
160 }
161
162 public String getMj() {
163 return mj;
164 }
165
166 public void setMj(String mj) {
167 this.mj = mj;
168 }
169
170 public String getSyqx() {
171 return syqx;
172 }
173
174 public void setSyqx(String syqx) {
175 this.syqx = syqx;
176 }
177
178 public String getQlqtzk() {
179 return qlqtzk;
180 }
181
182 public void setQlqtzk(String qlqtzk) {
183 this.qlqtzk = qlqtzk;
184 }
185
186 public String getFj() {
187 return fj;
188 }
189
190 public void setFj(String fj) {
191 this.fj = fj;
192 }
193 }
...@@ -104,7 +104,7 @@ public class CreateContractRequest { ...@@ -104,7 +104,7 @@ public class CreateContractRequest {
104 * 否 104 * 否
105 * 模板参数 105 * 模板参数
106 */ 106 */
107 private List<T> documentParams; 107 private List<BdcqzsTemplate> documentParams;
108 108
109 /** 109 /**
110 * 否 110 * 否
...@@ -280,11 +280,11 @@ public class CreateContractRequest { ...@@ -280,11 +280,11 @@ public class CreateContractRequest {
280 this.signatories = signatories; 280 this.signatories = signatories;
281 } 281 }
282 282
283 public List<T> getDocumentParams() { 283 public List<BdcqzsTemplate> getDocumentParams() {
284 return documentParams; 284 return documentParams;
285 } 285 }
286 286
287 public void setDocumentParams(List<T> documentParams) { 287 public void setDocumentParams(List<BdcqzsTemplate> documentParams) {
288 this.documentParams = documentParams; 288 this.documentParams = documentParams;
289 } 289 }
290 290
......
1 package com.thinkgem.jeesite.modules.eci.entity;
2
3 /**
4 * 模板参数
5 */
6 public class DocumentParam {
7
8 private static final long serialVersionUID = 1L;
9
10 /**
11 * 是
12 * 模板参数名称
13 */
14 private String name;
15
16 /**
17 * 是
18 * 模板参数值
19 */
20 private String value;
21
22 public String getName() {
23 return name;
24 }
25
26 public void setName(String name) {
27 this.name = name;
28 }
29
30 public String getValue() {
31 return value;
32 }
33
34 public void setValue(String value) {
35 this.value = value;
36 }
37 }
...@@ -25,7 +25,7 @@ public class ElecLicenseInfo { ...@@ -25,7 +25,7 @@ public class ElecLicenseInfo {
25 /** 25 /**
26 * 合同文档ID 26 * 合同文档ID
27 */ 27 */
28 private Long documentId; 28 private String documentId;
29 29
30 /** 30 /**
31 * 合同类型.1:不动产登记证明.2:不动产权证书.3:不动产查询证明 31 * 合同类型.1:不动产登记证明.2:不动产权证书.3:不动产查询证明
...@@ -116,11 +116,11 @@ public class ElecLicenseInfo { ...@@ -116,11 +116,11 @@ public class ElecLicenseInfo {
116 this.documentParam = documentParam; 116 this.documentParam = documentParam;
117 } 117 }
118 118
119 public Long getDocumentId() { 119 public String getDocumentId() {
120 return documentId; 120 return documentId;
121 } 121 }
122 122
123 public void setDocumentId(Long documentId) { 123 public void setDocumentId(String documentId) {
124 this.documentId = documentId; 124 this.documentId = documentId;
125 } 125 }
126 126
......
...@@ -3,6 +3,7 @@ package com.thinkgem.jeesite.modules.eci.method; ...@@ -3,6 +3,7 @@ package com.thinkgem.jeesite.modules.eci.method;
3 import com.thinkgem.jeesite.common.config.Global; 3 import com.thinkgem.jeesite.common.config.Global;
4 import com.thinkgem.jeesite.common.utils.JsonUtil; 4 import com.thinkgem.jeesite.common.utils.JsonUtil;
5 import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao; 5 import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao;
6 import com.thinkgem.jeesite.modules.eci.entity.BdcqzsTemplate;
6 import com.thinkgem.jeesite.modules.eci.entity.CreateContractRequest; 7 import com.thinkgem.jeesite.modules.eci.entity.CreateContractRequest;
7 import com.thinkgem.jeesite.modules.eci.entity.CreateContractResponse; 8 import com.thinkgem.jeesite.modules.eci.entity.CreateContractResponse;
8 import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo; 9 import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo;
...@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
15 import org.springframework.transaction.annotation.Transactional; 16 import org.springframework.transaction.annotation.Transactional;
16 17
18 import java.util.ArrayList;
17 import java.util.HashMap; 19 import java.util.HashMap;
18 import java.util.List; 20 import java.util.List;
19 import java.util.Map; 21 import java.util.Map;
...@@ -62,13 +64,17 @@ public class CreateContractRest { ...@@ -62,13 +64,17 @@ public class CreateContractRest {
62 request.setBizId(waitForCreateContract.getBizId()); 64 request.setBizId(waitForCreateContract.getBizId());
63 65
64 // TODO: 2022/2/14/0014 获取模板参数json字符串,处理方式待定 66 // TODO: 2022/2/14/0014 获取模板参数json字符串,处理方式待定
65 // request.setDocumentParams(waitForCreateContract.getDocumentParam()); 67 String bdcqzsTemplateStr = waitForCreateContract.getDocumentParam();
68 BdcqzsTemplate bdcqzsTemplate = JsonUtil.fromJson(bdcqzsTemplateStr, BdcqzsTemplate.class);
69 List<BdcqzsTemplate> templates = new ArrayList(){{
70 add(bdcqzsTemplate);
71 }};
72 request.setDocumentParams(templates);
66 73
67 //提交参数入库 74 //提交参数入库
68 String tjcs = JsonUtil.toJsonString(request); 75 String tjcs = JsonUtil.toJsonString(request);
69 logger.info("提交参数:" + tjcs); 76 logger.info("提交参数:" + tjcs);
70 waitForCreateContract.setTjcs(tjcs); 77 waitForCreateContract.setTjcs(tjcs);
71 // licenseInfoDao.updateTjcs(waitForCreateContract);
72 78
73 try { 79 try {
74 Map map = new HashMap(); 80 Map map = new HashMap();
......
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
15 @Component 15 @Component
16 public class DownloadContractRest { 16 public class DownloadContractRest {
17 17
18 private static final String DOCUMENT_DOWNLOAD = "/document/download"; 18 // private static final String DOCUMENT_DOWNLOAD = "/document/download";
19 19
20 @Autowired 20 @Autowired
21 ElecLicenseInfoDao licenseInfoDao; 21 ElecLicenseInfoDao licenseInfoDao;
...@@ -30,10 +30,10 @@ public class DownloadContractRest { ...@@ -30,10 +30,10 @@ public class DownloadContractRest {
30 30
31 for (ElecLicenseInfo waitForDownload : waitForDownloads) { 31 for (ElecLicenseInfo waitForDownload : waitForDownloads) {
32 String bizId = waitForDownload.getBizId(); 32 String bizId = waitForDownload.getBizId();
33 Long documentId = waitForDownload.getDocumentId(); 33 String documentId = waitForDownload.getDocumentId();
34 String url = Global.ECI_HOST + DOCUMENT_DOWNLOAD + "?documentId=" + documentId; 34 // String url = Global.ECI_HOST + DOCUMENT_DOWNLOAD + "?documentId=" + documentId;
35 35
36 String ofdPath = EciHttpUtil.download(url); 36 String ofdPath = EciHttpUtil.download(documentId);
37 if (ofdPath != null) { 37 if (ofdPath != null) {
38 //入库ofd文件地址 38 //入库ofd文件地址
39 licenseInfoDao.updateOfdWjdz(bizId, ofdPath); 39 licenseInfoDao.updateOfdWjdz(bizId, ofdPath);
......
1 package com.thinkgem.jeesite.modules.eci.method; 1 package com.thinkgem.jeesite.modules.eci.method;
2 2
3 import com.suwell.ofd.custom.agent.ConvertException;
4 import com.suwell.ofd.custom.agent.HTTPAgent;
5 import com.suwell.ofd.custom.wrapper.PackException;
3 import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao; 6 import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao;
4 import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo; 7 import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo;
5 import org.slf4j.Logger; 8 import org.slf4j.Logger;
...@@ -7,6 +10,9 @@ import org.slf4j.LoggerFactory; ...@@ -7,6 +10,9 @@ import org.slf4j.LoggerFactory;
7 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
9 12
13 import java.io.*;
14 import java.text.SimpleDateFormat;
15 import java.util.Date;
10 import java.util.List; 16 import java.util.List;
11 17
12 /** 18 /**
...@@ -17,6 +23,8 @@ public class OfdConvertRest { ...@@ -17,6 +23,8 @@ public class OfdConvertRest {
17 23
18 private Logger logger = LoggerFactory.getLogger(OfdConvertRest.class); 24 private Logger logger = LoggerFactory.getLogger(OfdConvertRest.class);
19 25
26 HTTPAgent ha = new HTTPAgent("http://172.16.56.42:8090");
27
20 @Autowired 28 @Autowired
21 ElecLicenseInfoDao licenseInfoDao; 29 ElecLicenseInfoDao licenseInfoDao;
22 30
...@@ -25,8 +33,42 @@ public class OfdConvertRest { ...@@ -25,8 +33,42 @@ public class OfdConvertRest {
25 List<ElecLicenseInfo> waitForConverts = licenseInfoDao.getWaitForConvert(); 33 List<ElecLicenseInfo> waitForConverts = licenseInfoDao.getWaitForConvert();
26 34
27 for (ElecLicenseInfo waitForConvert : waitForConverts) { 35 for (ElecLicenseInfo waitForConvert : waitForConverts) {
28 String ofdPath = waitForConvert.getOfdWjdz(); 36 OutputStream out = null;
29 // TODO: 2022/2/16/0016 ofd文件转换 37
38 //转换后文件输出路径
39 try {
40 String bizId = waitForConvert.getBizId();
41 String ofdPath = waitForConvert.getOfdWjdz();
42 // TODO: 2022/2/16/0016 ofd文件转换
43 File ofdFile = new File(ofdPath);
44
45 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd");
46 String dateDir = simpleDateFormat.format(new Date());
47
48 String documentId = waitForConvert.getDocumentId();
49
50 File tiffDir = new File("E:\\ECI\\TIFF" + dateDir + "\\");
51 if (!tiffDir.exists()) {
52 tiffDir.mkdirs();
53 }
54 File tiffFile = new File(tiffDir + documentId + ".tiff");
55 if (!tiffFile.exists()) {
56 tiffFile.createNewFile();
57 }
58
59 out = new FileOutputStream(tiffFile);
60 //输出格式。true输出格式为zip ;false输出格式为tiff
61 ha.OFDToImge(ofdFile, out, -1, false);
62 licenseInfoDao.updateJpgWjdzAndStatus(tiffFile.getAbsolutePath(), bizId);
63 } catch (PackException | ConvertException | IOException e) {
64 e.printStackTrace();
65 } finally {
66 try {
67 ha.close();
68 } catch (IOException e) {
69 e.printStackTrace();
70 }
71 }
30 72
31 } 73 }
32 } 74 }
......
...@@ -138,12 +138,13 @@ public class EciHttpUtil { ...@@ -138,12 +138,13 @@ public class EciHttpUtil {
138 public static String download(String documentId) { 138 public static String download(String documentId) {
139 139
140 String url = Global.ECI_HOST + "/document/download" + "?documentId=" + documentId; 140 String url = Global.ECI_HOST + "/document/download" + "?documentId=" + documentId;
141
141 HttpGet httpGet = new HttpGet(url); 142 HttpGet httpGet = new HttpGet(url);
142 CloseableHttpClient client = HttpClientBuilder.create().build(); 143 CloseableHttpClient client = HttpClientBuilder.create().build();
143 CloseableHttpResponse response = null; 144 CloseableHttpResponse response = null;
144 OutputStream out = null; 145 OutputStream out = null;
145 InputStream in = null; 146 InputStream in = null;
146 String path = null; 147 String absolutePath = null;
147 try { 148 try {
148 httpGet.setHeader("Content-Type", "application/json;charset=utf-8"); 149 httpGet.setHeader("Content-Type", "application/json;charset=utf-8");
149 //x-qys-signature生成方式:Md5(AppToken + AppSecret + timestamp),获取32位小写值 150 //x-qys-signature生成方式:Md5(AppToken + AppSecret + timestamp),获取32位小写值
...@@ -159,12 +160,17 @@ public class EciHttpUtil { ...@@ -159,12 +160,17 @@ public class EciHttpUtil {
159 if (length > 0) { 160 if (length > 0) {
160 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd"); 161 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd");
161 String dateDir = simpleDateFormat.format(new Date()); 162 String dateDir = simpleDateFormat.format(new Date());
162 File file = new File("E:\\ECI\\" + dateDir + "\\" + documentId + ".ofd"); 163 // File file = new File("E:\\ECI\\OFD\\" + dateDir + "\\" + documentId + ".ofd");
163 if (!file.exists()) { 164 File savePath = new File("E:\\ECI\\OFD\\" + dateDir);
164 file.createNewFile(); 165 if (!savePath.exists()) {
166 savePath.mkdirs();
167 }
168 File filePath = new File(savePath + "\\" + documentId+".ofd");
169 if (!filePath.exists()){
170 filePath.createNewFile();
165 } 171 }
166 172
167 out = new FileOutputStream(file); 173 out = new FileOutputStream(filePath);
168 byte[] buffer = new byte[4096]; 174 byte[] buffer = new byte[4096];
169 int readLength = 0; 175 int readLength = 0;
170 while ((readLength = in.read(buffer)) != -1) { 176 while ((readLength = in.read(buffer)) != -1) {
...@@ -172,7 +178,7 @@ public class EciHttpUtil { ...@@ -172,7 +178,7 @@ public class EciHttpUtil {
172 // System.arraycopy(buffer, 0, bytes, 0, readLength); 178 // System.arraycopy(buffer, 0, bytes, 0, readLength);
173 out.write(buffer, 0, readLength); 179 out.write(buffer, 0, readLength);
174 } 180 }
175 path = file.getAbsolutePath(); 181 absolutePath = filePath.getAbsolutePath();
176 out.flush(); 182 out.flush();
177 } 183 }
178 184
...@@ -188,7 +194,7 @@ public class EciHttpUtil { ...@@ -188,7 +194,7 @@ public class EciHttpUtil {
188 e.printStackTrace(); 194 e.printStackTrace();
189 } 195 }
190 } 196 }
191 return path; 197 return absolutePath;
192 } 198 }
193 199
194 } 200 }
......
...@@ -57,14 +57,18 @@ ...@@ -57,14 +57,18 @@
57 </update> 57 </update>
58 58
59 <insert id="insert"> 59 <insert id="insert">
60 INSERT INTO ELEC_LICENSE_INFO( 60 INSERT INTO ELEC_LICENSE_INFO(BIZ_ID, YWH, HTLX, ZSBS, DOCUMENT_PARAM)
61 BIZ_ID,YWH,HTLX,ZSBS,DOCUMENT_PARAM 61 VALUES (#{bizId},
62 ) VALUES ( 62 #{ywh},
63 #{bizId}, 63 #{htlx},
64 #{ywh}, 64 #{zsbs},
65 #{htlx}, 65 #{documentParam})
66 #{zsbs},
67 #{documentParam}
68 )
69 </insert> 66 </insert>
67
68 <update id="updateJpgWjdzAndStatus">
69 update ELEC_LICENSE_INFO
70 set JPG_WJDZ = #{jpgPath,jdbcType=VARCHAR},
71 SFZH = '1'
72 where BIZ_ID = #{bizId,jdbcType=VARCHAR}
73 </update>
70 </mapper> 74 </mapper>
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type