8f78e57c by 荆蔚杰

电子证照接口

1 parent 5fe3bd99
Showing 38 changed files with 360 additions and 62 deletions
......@@ -857,6 +857,87 @@
<version>2.2.11</version>
</dependency>
<!--电子证照-->
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>agent-boot</artifactId>
<version>1.0.20.0527</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/agent-boot-1.0.20.0527.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>ofd-utils-convert</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/ofd-utils-convert.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-agent-http</artifactId>
<version>1.4.191210</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-agent-http-1.4.191210.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-agent-wrapper</artifactId>
<version>1.6.191210</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-agent-wrapper-1.6.191210.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-api-base</artifactId>
<version>1.4.200512</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-api-base-1.4.200512.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-api-rpc-base</artifactId>
<version>1.8.201027</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-api-rpc-base-1.8.201027.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-local-rpc</artifactId>
<version>1.8.20.1027</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-local-rpc-1.8.20.1027.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-ofd-api-rpc</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-ofd-api-rpc-1.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-ofd-base</artifactId>
<version>1.3.18.0803</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-ofd-base-1.3.18.0803.jar</systemPath>
</dependency>
<dependency>
<groupId>com.thinkgem.jeesite</groupId>
<artifactId>suwell-packet-wrapper</artifactId>
<version>1.16.210414</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/suwell-packet-wrapper-1.16.210414.jar</systemPath>
</dependency>
</dependencies>
<build>
......
......@@ -22,6 +22,7 @@ public interface ElecLicenseInfoDao extends CrudDao<ElecLicenseInfo> {
/**
* 更新合同ID和状态
*
* @param waitForCreateContract
* @return
*/
......@@ -68,4 +69,6 @@ public interface ElecLicenseInfoDao extends CrudDao<ElecLicenseInfo> {
List<ElecLicenseInfo> selectZsbs(@Param("zsbs") String zsbs);
Integer updateJpgWjdzAndStatus(@Param("jpgPath") String jpgPath, @Param("bizId") String bizId);
}
......
package com.thinkgem.jeesite.modules.eci.entity;
import java.io.Serializable;
/**
* 模板参数
*/
public class BdcqzsTemplate implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 二维码
*/
private String ewm;
/**
* 登记时间
*/
private String djsj;
/**
* 不动产权证号
*/
private String bdcqzh;
/**
* 权利人
*/
private String qlr;
/**
* 共有情况
*/
private String gyqk;
/**
* 坐落
*/
private String zl;
/**
* 不动产单元号
*/
private String bdcdyh;
/**
* 权利类型
*/
private String qllx;
/**
* 权利性质
*/
private String qlxz;
/**
* 用途
*/
private String yt;
/**
* 面积
*/
private String mj;
/**
* 使用期限
*/
private String syqx;
/**
* 权力其他状况
*/
private String qlqtzk;
/**
* 附记
*/
private String fj;
public String getEwm() {
return ewm;
}
public void setEwm(String ewm) {
this.ewm = ewm;
}
public String getDjsj() {
return djsj;
}
public void setDjsj(String djsj) {
this.djsj = djsj;
}
public String getBdcqzh() {
return bdcqzh;
}
public void setBdcqzh(String bdcqzh) {
this.bdcqzh = bdcqzh;
}
public String getQlr() {
return qlr;
}
public void setQlr(String qlr) {
this.qlr = qlr;
}
public String getGyqk() {
return gyqk;
}
public void setGyqk(String gyqk) {
this.gyqk = gyqk;
}
public String getZl() {
return zl;
}
public void setZl(String zl) {
this.zl = zl;
}
public String getBdcdyh() {
return bdcdyh;
}
public void setBdcdyh(String bdcdyh) {
this.bdcdyh = bdcdyh;
}
public String getQllx() {
return qllx;
}
public void setQllx(String qllx) {
this.qllx = qllx;
}
public String getQlxz() {
return qlxz;
}
public void setQlxz(String qlxz) {
this.qlxz = qlxz;
}
public String getYt() {
return yt;
}
public void setYt(String yt) {
this.yt = yt;
}
public String getMj() {
return mj;
}
public void setMj(String mj) {
this.mj = mj;
}
public String getSyqx() {
return syqx;
}
public void setSyqx(String syqx) {
this.syqx = syqx;
}
public String getQlqtzk() {
return qlqtzk;
}
public void setQlqtzk(String qlqtzk) {
this.qlqtzk = qlqtzk;
}
public String getFj() {
return fj;
}
public void setFj(String fj) {
this.fj = fj;
}
}
......@@ -104,7 +104,7 @@ public class CreateContractRequest {
* 否
* 模板参数
*/
private List<T> documentParams;
private List<BdcqzsTemplate> documentParams;
/**
* 否
......@@ -280,11 +280,11 @@ public class CreateContractRequest {
this.signatories = signatories;
}
public List<T> getDocumentParams() {
public List<BdcqzsTemplate> getDocumentParams() {
return documentParams;
}
public void setDocumentParams(List<T> documentParams) {
public void setDocumentParams(List<BdcqzsTemplate> documentParams) {
this.documentParams = documentParams;
}
......
package com.thinkgem.jeesite.modules.eci.entity;
/**
* 模板参数
*/
public class DocumentParam {
private static final long serialVersionUID = 1L;
/**
* 是
* 模板参数名称
*/
private String name;
/**
* 是
* 模板参数值
*/
private String value;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
......@@ -25,7 +25,7 @@ public class ElecLicenseInfo {
/**
* 合同文档ID
*/
private Long documentId;
private String documentId;
/**
* 合同类型.1:不动产登记证明.2:不动产权证书.3:不动产查询证明
......@@ -116,11 +116,11 @@ public class ElecLicenseInfo {
this.documentParam = documentParam;
}
public Long getDocumentId() {
public String getDocumentId() {
return documentId;
}
public void setDocumentId(Long documentId) {
public void setDocumentId(String documentId) {
this.documentId = documentId;
}
......
......@@ -3,6 +3,7 @@ package com.thinkgem.jeesite.modules.eci.method;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.utils.JsonUtil;
import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao;
import com.thinkgem.jeesite.modules.eci.entity.BdcqzsTemplate;
import com.thinkgem.jeesite.modules.eci.entity.CreateContractRequest;
import com.thinkgem.jeesite.modules.eci.entity.CreateContractResponse;
import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo;
......@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -62,13 +64,17 @@ public class CreateContractRest {
request.setBizId(waitForCreateContract.getBizId());
// TODO: 2022/2/14/0014 获取模板参数json字符串,处理方式待定
// request.setDocumentParams(waitForCreateContract.getDocumentParam());
String bdcqzsTemplateStr = waitForCreateContract.getDocumentParam();
BdcqzsTemplate bdcqzsTemplate = JsonUtil.fromJson(bdcqzsTemplateStr, BdcqzsTemplate.class);
List<BdcqzsTemplate> templates = new ArrayList(){{
add(bdcqzsTemplate);
}};
request.setDocumentParams(templates);
//提交参数入库
String tjcs = JsonUtil.toJsonString(request);
logger.info("提交参数:" + tjcs);
waitForCreateContract.setTjcs(tjcs);
// licenseInfoDao.updateTjcs(waitForCreateContract);
try {
Map map = new HashMap();
......
......@@ -15,7 +15,7 @@ import java.util.List;
@Component
public class DownloadContractRest {
private static final String DOCUMENT_DOWNLOAD = "/document/download";
// private static final String DOCUMENT_DOWNLOAD = "/document/download";
@Autowired
ElecLicenseInfoDao licenseInfoDao;
......@@ -30,10 +30,10 @@ public class DownloadContractRest {
for (ElecLicenseInfo waitForDownload : waitForDownloads) {
String bizId = waitForDownload.getBizId();
Long documentId = waitForDownload.getDocumentId();
String url = Global.ECI_HOST + DOCUMENT_DOWNLOAD + "?documentId=" + documentId;
String documentId = waitForDownload.getDocumentId();
// String url = Global.ECI_HOST + DOCUMENT_DOWNLOAD + "?documentId=" + documentId;
String ofdPath = EciHttpUtil.download(url);
String ofdPath = EciHttpUtil.download(documentId);
if (ofdPath != null) {
//入库ofd文件地址
licenseInfoDao.updateOfdWjdz(bizId, ofdPath);
......
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.PackException;
import com.thinkgem.jeesite.modules.eci.dao.ElecLicenseInfoDao;
import com.thinkgem.jeesite.modules.eci.entity.ElecLicenseInfo;
import org.slf4j.Logger;
......@@ -7,6 +10,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
......@@ -17,6 +23,8 @@ public class OfdConvertRest {
private Logger logger = LoggerFactory.getLogger(OfdConvertRest.class);
HTTPAgent ha = new HTTPAgent("http://172.16.56.42:8090");
@Autowired
ElecLicenseInfoDao licenseInfoDao;
......@@ -25,8 +33,42 @@ public class OfdConvertRest {
List<ElecLicenseInfo> waitForConverts = licenseInfoDao.getWaitForConvert();
for (ElecLicenseInfo waitForConvert : waitForConverts) {
OutputStream out = null;
//转换后文件输出路径
try {
String bizId = waitForConvert.getBizId();
String ofdPath = waitForConvert.getOfdWjdz();
// TODO: 2022/2/16/0016 ofd文件转换
File ofdFile = new File(ofdPath);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd");
String dateDir = simpleDateFormat.format(new Date());
String documentId = waitForConvert.getDocumentId();
File tiffDir = new File("E:\\ECI\\TIFF" + dateDir + "\\");
if (!tiffDir.exists()) {
tiffDir.mkdirs();
}
File tiffFile = new File(tiffDir + documentId + ".tiff");
if (!tiffFile.exists()) {
tiffFile.createNewFile();
}
out = new FileOutputStream(tiffFile);
//输出格式。true输出格式为zip ;false输出格式为tiff
ha.OFDToImge(ofdFile, out, -1, false);
licenseInfoDao.updateJpgWjdzAndStatus(tiffFile.getAbsolutePath(), bizId);
} catch (PackException | ConvertException | IOException e) {
e.printStackTrace();
} finally {
try {
ha.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
......
......@@ -138,12 +138,13 @@ public class EciHttpUtil {
public static String download(String documentId) {
String url = Global.ECI_HOST + "/document/download" + "?documentId=" + documentId;
HttpGet httpGet = new HttpGet(url);
CloseableHttpClient client = HttpClientBuilder.create().build();
CloseableHttpResponse response = null;
OutputStream out = null;
InputStream in = null;
String path = null;
String absolutePath = null;
try {
httpGet.setHeader("Content-Type", "application/json;charset=utf-8");
//x-qys-signature生成方式:Md5(AppToken + AppSecret + timestamp),获取32位小写值
......@@ -159,12 +160,17 @@ public class EciHttpUtil {
if (length > 0) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dddd");
String dateDir = simpleDateFormat.format(new Date());
File file = new File("E:\\ECI\\" + dateDir + "\\" + documentId + ".ofd");
if (!file.exists()) {
file.createNewFile();
// File file = new File("E:\\ECI\\OFD\\" + dateDir + "\\" + documentId + ".ofd");
File savePath = new File("E:\\ECI\\OFD\\" + dateDir);
if (!savePath.exists()) {
savePath.mkdirs();
}
File filePath = new File(savePath + "\\" + documentId+".ofd");
if (!filePath.exists()){
filePath.createNewFile();
}
out = new FileOutputStream(file);
out = new FileOutputStream(filePath);
byte[] buffer = new byte[4096];
int readLength = 0;
while ((readLength = in.read(buffer)) != -1) {
......@@ -172,7 +178,7 @@ public class EciHttpUtil {
// System.arraycopy(buffer, 0, bytes, 0, readLength);
out.write(buffer, 0, readLength);
}
path = file.getAbsolutePath();
absolutePath = filePath.getAbsolutePath();
out.flush();
}
......@@ -188,7 +194,7 @@ public class EciHttpUtil {
e.printStackTrace();
}
}
return path;
return absolutePath;
}
}
......
......@@ -57,14 +57,18 @@
</update>
<insert id="insert">
INSERT INTO ELEC_LICENSE_INFO(
BIZ_ID,YWH,HTLX,ZSBS,DOCUMENT_PARAM
) VALUES (
#{bizId},
INSERT INTO ELEC_LICENSE_INFO(BIZ_ID, YWH, HTLX, ZSBS, DOCUMENT_PARAM)
VALUES (#{bizId},
#{ywh},
#{htlx},
#{zsbs},
#{documentParam}
)
#{documentParam})
</insert>
<update id="updateJpgWjdzAndStatus">
update ELEC_LICENSE_INFO
set JPG_WJDZ = #{jpgPath,jdbcType=VARCHAR},
SFZH = '1'
where BIZ_ID = #{bizId,jdbcType=VARCHAR}
</update>
</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