发票修改

This commit is contained in:
lvleigang 2025-06-04 16:23:20 +08:00
parent ab93c6ca91
commit 32c21bdcb4
2 changed files with 51 additions and 15 deletions

View File

@ -9,8 +9,8 @@ import com.hzya.frame.web.entity.BaseEntity;
public class IncomeInvoiceEntity extends BaseEntity {
//发票字段
private Integer dataId;
private Integer formmainId;
private String dataId;
private String formmainId;
private String field0127;
private String field0128;
private String field0129;
@ -28,6 +28,7 @@ public class IncomeInvoiceEntity extends BaseEntity {
private String iufoVer;
public String getAloneId() {
return aloneId;
}
@ -68,19 +69,19 @@ public class IncomeInvoiceEntity extends BaseEntity {
this.iufoVer = iufoVer;
}
public Integer getDataId() {
public String getDataId() {
return dataId;
}
public void setDataId(Integer dataId) {
public void setDataId(String dataId) {
this.dataId = dataId;
}
public Integer getFormmainId() {
public String getFormmainId() {
return formmainId;
}
public void setFormmainId(Integer formmainId) {
public void setFormmainId(String formmainId) {
this.formmainId = formmainId;
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.plugin.incomeInvoiceData.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
@ -40,7 +41,11 @@ import com.hzya.frame.basedao.service.impl.BaseService;
import org.springframework.core.task.TaskExecutor;
import javax.annotation.Resource;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@ -49,6 +54,8 @@ import java.io.InputStream;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -183,15 +190,17 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
saveData.put("kpr",content.getString("kpr"));
saveData.put("skr",content.getString("skr"));
saveData.put("fhr",content.getString("fhr"));
saveData.put("url",content.getString("pdfUrl"));
saveData.put("ofdurl",content.getString("ofdUrl"));
saveData.put("xmlurl",content.getString("xmlUrl"));
saveData.put("url",jsonObject.getString("pdfUrl"));
saveData.put("ofdurl",jsonObject.getString("ofdUrl"));
saveData.put("xmlurl",jsonObject.getString("xmlUrl"));
//saveData.put("url",content.getOrDefault("url","http://prd-cabinet-1257122416.cos.ap-shanghai.myqcloud.com/recv-open-input-1313818348185971712-1362629996254053632.pdf"));
//saveData.put("ofdurl",content.getOrDefault("ofdUrl","http://prd-cabinet-1257122416.cos.ap-shanghai.myqcloud.com/recv-open-input-1313818348185971712-1362629996254053632.pdf"));
//saveData.put("xmlurl",content.getOrDefault("xmlUrl","http://prd-cabinet-1257122416.cos.ap-shanghai.myqcloud.com/recv-open-input-1313818348185971712-1362630000427386112.xml"));
saveData.put("htbh",content.getString("documentNumber"));
saveData.put("htbh",jsonObject.getString("documentNumber"));
//if(saveData.getString("htbh") == null || "".equals(saveData.getString("htbh"))){
// continue;
//}
JSONArray detaildata = content.getJSONArray("items");
if(detaildata != null && detaildata.size() > 0){
for (int i1 = 0; i1 < detaildata.size(); i1++) {
@ -239,6 +248,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
controlsLogEntity.setOrg_id("0");
controlsLogEntity.setRemark("插件新增");
controlsLogDaoimpl.saveControlsLog(saveData.getString("id"), "数智中台", "800004", jsonObject.toJSONString(), "接口新增", "数智中台", "mdm_fp_option_log", "1");
}
}
return BaseResult.getSuccessMessageEntity("处理成功");
@ -525,13 +535,38 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
tempFile.deleteOnExit();
return fileUrl;
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
logger.error(e.getMessage());
}
return null;
}
public byte[] downloadFileBytes(String fileUrl) throws IOException {
public byte[] downloadFileBytes(String fileUrl) throws Exception {
// 创建信任所有证书的TrustManager
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
}
}
};
// 安装信任管理器
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// 创建允许所有主机名的验证器
HostnameVerifier allHostsValid = (hostname, session) -> true;
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
URL url = new URL(fileUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
@ -637,7 +672,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
}
if(mxlist == null || mxlist.size() == 0){
incomeInvoiceEntity.setDataId(1);
incomeInvoiceEntity.setDataId(String.valueOf(UUIDLong.longUUID()));
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
}
}