Compare commits
No commits in common. "2ab3de21644534db2e306588a2e6c1b264aef1d7" and "76333a0ef614664d020dab2e6c78d51dc517c47b" have entirely different histories.
2ab3de2164
...
76333a0ef6
|
@ -9,8 +9,8 @@ import com.hzya.frame.web.entity.BaseEntity;
|
||||||
public class IncomeInvoiceEntity extends BaseEntity {
|
public class IncomeInvoiceEntity extends BaseEntity {
|
||||||
|
|
||||||
//发票字段
|
//发票字段
|
||||||
private String dataId;
|
private Integer dataId;
|
||||||
private String formmainId;
|
private Integer formmainId;
|
||||||
private String field0127;
|
private String field0127;
|
||||||
private String field0128;
|
private String field0128;
|
||||||
private String field0129;
|
private String field0129;
|
||||||
|
@ -28,7 +28,6 @@ public class IncomeInvoiceEntity extends BaseEntity {
|
||||||
private String iufoVer;
|
private String iufoVer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getAloneId() {
|
public String getAloneId() {
|
||||||
return aloneId;
|
return aloneId;
|
||||||
}
|
}
|
||||||
|
@ -69,19 +68,19 @@ public class IncomeInvoiceEntity extends BaseEntity {
|
||||||
this.iufoVer = iufoVer;
|
this.iufoVer = iufoVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataId() {
|
public Integer getDataId() {
|
||||||
return dataId;
|
return dataId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataId(String dataId) {
|
public void setDataId(Integer dataId) {
|
||||||
this.dataId = dataId;
|
this.dataId = dataId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFormmainId() {
|
public Integer getFormmainId() {
|
||||||
return formmainId;
|
return formmainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFormmainId(String formmainId) {
|
public void setFormmainId(Integer formmainId) {
|
||||||
this.formmainId = formmainId;
|
this.formmainId = formmainId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,6 @@
|
||||||
from formson_0702
|
from formson_0702
|
||||||
<trim prefix="where" prefixOverrides="and">
|
<trim prefix="where" prefixOverrides="and">
|
||||||
<if test="field0128 != null and field0128 != ''"> and field0128 = #{field0128} </if>
|
<if test="field0128 != null and field0128 != ''"> and field0128 = #{field0128} </if>
|
||||||
<if test="formmainId != null and formmainId != ''"> and formmain_id = #{formmainId} </if>
|
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.hzya.frame.plugin.incomeInvoiceData.service.impl;
|
package com.hzya.frame.plugin.incomeInvoiceData.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
@ -41,24 +40,15 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
import org.springframework.core.task.TaskExecutor;
|
import org.springframework.core.task.TaskExecutor;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.net.ssl.HostnameVerifier;
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.TrustManager;
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.security.cert.CertificateException;
|
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -68,8 +58,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author makejava
|
* @author makejava
|
||||||
|
@ -195,17 +183,15 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
saveData.put("kpr",content.getString("kpr"));
|
saveData.put("kpr",content.getString("kpr"));
|
||||||
saveData.put("skr",content.getString("skr"));
|
saveData.put("skr",content.getString("skr"));
|
||||||
saveData.put("fhr",content.getString("fhr"));
|
saveData.put("fhr",content.getString("fhr"));
|
||||||
saveData.put("url",jsonObject.getString("pdfUrl"));
|
saveData.put("url",content.getString("pdfUrl"));
|
||||||
saveData.put("ofdurl",jsonObject.getString("ofdUrl"));
|
saveData.put("ofdurl",content.getString("ofdUrl"));
|
||||||
saveData.put("xmlurl",jsonObject.getString("xmlUrl"));
|
saveData.put("xmlurl",content.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("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("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("xmlurl",content.getOrDefault("xmlUrl","http://prd-cabinet-1257122416.cos.ap-shanghai.myqcloud.com/recv-open-input-1313818348185971712-1362630000427386112.xml"));
|
||||||
saveData.put("htbh",jsonObject.getString("documentNumber"));
|
saveData.put("htbh",content.getString("documentNumber"));
|
||||||
//if(saveData.getString("htbh") == null || "".equals(saveData.getString("htbh"))){
|
|
||||||
// continue;
|
|
||||||
//}
|
|
||||||
JSONArray detaildata = content.getJSONArray("items");
|
JSONArray detaildata = content.getJSONArray("items");
|
||||||
if(detaildata != null && detaildata.size() > 0){
|
if(detaildata != null && detaildata.size() > 0){
|
||||||
for (int i1 = 0; i1 < detaildata.size(); i1++) {
|
for (int i1 = 0; i1 < detaildata.size(); i1++) {
|
||||||
|
@ -253,7 +239,6 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
controlsLogEntity.setOrg_id("0");
|
controlsLogEntity.setOrg_id("0");
|
||||||
controlsLogEntity.setRemark("插件新增");
|
controlsLogEntity.setRemark("插件新增");
|
||||||
controlsLogDaoimpl.saveControlsLog(saveData.getString("id"), "数智中台", "800004", jsonObject.toJSONString(), "接口新增", "数智中台", "mdm_fp_option_log", "1");
|
controlsLogDaoimpl.saveControlsLog(saveData.getString("id"), "数智中台", "800004", jsonObject.toJSONString(), "接口新增", "数智中台", "mdm_fp_option_log", "1");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("处理成功");
|
return BaseResult.getSuccessMessageEntity("处理成功");
|
||||||
|
@ -520,60 +505,10 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String sendFileUpload(String fileurl) {
|
private String sendFileUpload(String url,String filename) {
|
||||||
try {
|
try {
|
||||||
// 获取文件字节数据
|
// 获取文件字节数据
|
||||||
byte[] fileBytes = null;
|
byte[] fileBytes = downloadFileBytes(url);
|
||||||
String filename = null;
|
|
||||||
|
|
||||||
// 创建信任所有证书的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");
|
|
||||||
// 从响应头获取Content-Disposition
|
|
||||||
String contentDisposition = connection.getHeaderField("Content-Disposition");
|
|
||||||
// 尝试从Content-Disposition中提取文件名
|
|
||||||
if (contentDisposition != null) {
|
|
||||||
filename = extractFileNameFromContentDisposition(contentDisposition);
|
|
||||||
}else {
|
|
||||||
// 提取结果为 "recv-open-input-1364609961183034880-1377757054294396417.ofd"
|
|
||||||
filename = fileurl.substring(fileurl.lastIndexOf("/") + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
try (InputStream inputStream = connection.getInputStream();
|
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
|
||||||
byte[] buffer = new byte[4096];
|
|
||||||
int bytesRead;
|
|
||||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
|
||||||
outputStream.write(buffer, 0, bytesRead);
|
|
||||||
}
|
|
||||||
fileBytes = outputStream.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (fileBytes != null) {
|
if (fileBytes != null) {
|
||||||
// 模拟一个文件
|
// 模拟一个文件
|
||||||
File tempFile = new File(filename);
|
File tempFile = new File(filename);
|
||||||
|
@ -587,53 +522,19 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
fileUrl = data.getString("fileUrl");
|
fileUrl = data.getString("fileUrl");
|
||||||
}
|
}
|
||||||
// 操作完成后删除临时文件
|
// 操作完成后删除临时文件
|
||||||
boolean asd = tempFile.delete();
|
tempFile.deleteOnExit();
|
||||||
return fileUrl;
|
return fileUrl;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] downloadFileBytes(String fileUrl) throws Exception {
|
public byte[] downloadFileBytes(String fileUrl) throws IOException {
|
||||||
|
|
||||||
// 创建信任所有证书的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);
|
URL url = new URL(fileUrl);
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
// 从响应头获取Content-Disposition
|
|
||||||
String contentDisposition = connection.getHeaderField("Content-Disposition");
|
|
||||||
String fileName = null;
|
|
||||||
// 尝试从Content-Disposition中提取文件名
|
|
||||||
if (contentDisposition != null) {
|
|
||||||
fileName = extractFileNameFromContentDisposition(contentDisposition);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try (InputStream inputStream = connection.getInputStream();
|
try (InputStream inputStream = connection.getInputStream();
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
||||||
byte[] buffer = new byte[4096];
|
byte[] buffer = new byte[4096];
|
||||||
|
@ -644,22 +545,6 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private String extractFileNameFromContentDisposition(String contentDisposition) {
|
|
||||||
// 处理Content-Disposition头中的filename
|
|
||||||
try {
|
|
||||||
Pattern pattern = Pattern.compile("fileName=\"?([^\"]+)\"?");
|
|
||||||
Matcher matcher = pattern.matcher(contentDisposition);
|
|
||||||
if (matcher.find()) {
|
|
||||||
String filename = matcher.group(1);
|
|
||||||
String a = URLDecoder.decode(filename, "UTF-8");
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* seeyon流程事件监听后置方法,绑定修改文件
|
* seeyon流程事件监听后置方法,绑定修改文件
|
||||||
|
@ -669,156 +554,97 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setDataCallBack(SysMessageManageLogEntity entity) throws Exception {
|
public void setDataCallBack(SysMessageManageLogEntity entity) throws Exception {
|
||||||
logger.error("999999发送后返回");
|
|
||||||
try {
|
try {
|
||||||
JSONObject datas = JSONObject.parseObject(entity.getSourceData());
|
JSONObject datas = JSONObject.parseObject(entity.getSourceData());
|
||||||
logger.error("999999发送后返回data:"+datas.toJSONString());
|
|
||||||
|
|
||||||
String bodys = datas.getString("body");
|
String bodys = datas.getString("body");
|
||||||
logger.error("999999发送后返回bodys:"+bodys);
|
|
||||||
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(bodys);
|
JSONObject jsonObject = JSONObject.parseObject(bodys);
|
||||||
logger.error("999999发送后返回jsonObject:"+jsonObject.toJSONString());
|
|
||||||
|
|
||||||
String urlData = null;
|
String urlData = null;
|
||||||
String ofdurlData = null;
|
String ofdurlData = null;
|
||||||
String xmlurlData = null;
|
String xmlurlData = null;
|
||||||
logger.error("999999发送后返回url");
|
|
||||||
|
|
||||||
if(jsonObject.getString("url") != null){
|
if(jsonObject.getString("url") != null){
|
||||||
urlData = sendFileUpload(jsonObject.getString("url"));
|
urlData = sendFileUpload(jsonObject.getString("url"),jsonObject.getString("fphm")+"url");
|
||||||
}
|
}
|
||||||
logger.error("999999发送后返回ofdurl");
|
|
||||||
|
|
||||||
if(jsonObject.getString("ofdurl") != null){
|
if(jsonObject.getString("ofdurl") != null){
|
||||||
ofdurlData = sendFileUpload(jsonObject.getString("ofdurl"));
|
ofdurlData = sendFileUpload(jsonObject.getString("ofdurl"),jsonObject.getString("fphm")+"ofdurl");
|
||||||
}
|
}
|
||||||
logger.error("999999发送后返回xmlurl");
|
|
||||||
|
|
||||||
if(jsonObject.getString("xmlurl") != null){
|
if(jsonObject.getString("xmlurl") != null){
|
||||||
xmlurlData = sendFileUpload(jsonObject.getString("xmlurl"));
|
xmlurlData = sendFileUpload(jsonObject.getString("xmlurl"),jsonObject.getString("fphm")+"xmlurl");
|
||||||
}
|
}
|
||||||
logger.error("999999发送后返回fphm");
|
//urlData = "7908556313791579509";
|
||||||
|
//ofdurlData = "7908556313791579509";
|
||||||
|
//xmlurlData = "7908556313791579509";
|
||||||
if(jsonObject.getString("fphm") != null){
|
if(jsonObject.getString("fphm") != null){
|
||||||
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
||||||
incomeInvoiceEntity.setDataSourceCode("HT-OA");
|
incomeInvoiceEntity.setDataSourceCode("HT-OA");
|
||||||
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
||||||
|
incomeInvoiceEntity.setField0130(urlData);//发票文件
|
||||||
|
incomeInvoiceEntity.setField0138(ofdurlData);//发票文件
|
||||||
|
incomeInvoiceEntity.setField0139(xmlurlData);//发票文件
|
||||||
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaFp(incomeInvoiceEntity);
|
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaFp(incomeInvoiceEntity);
|
||||||
logger.error("999999查询formmain_0705"+list.size() );
|
|
||||||
|
|
||||||
if(list != null && list.size() == 1){
|
if(list != null && list.size() == 1){
|
||||||
incomeInvoiceEntity.setDataId(list.get(0).getDataId());
|
incomeInvoiceEntity.setDataId(list.get(0).getDataId());
|
||||||
logger.error("999999保存关联表url"+list.get(0).getDataId());
|
|
||||||
|
|
||||||
if(urlData != null){
|
if(urlData != null){
|
||||||
//保存关联表
|
//保存关联表
|
||||||
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
||||||
incomeInvoiceEntity.setField0130(urluuid);//发票文件
|
|
||||||
ctpAttachmentService.saveAttachment(urlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
ctpAttachmentService.saveAttachment(urlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
||||||
}
|
}
|
||||||
logger.error("999999保存关联表ofdurlData"+list.get(0).getDataId());
|
|
||||||
|
|
||||||
if(ofdurlData != null){
|
if(ofdurlData != null){
|
||||||
//保存关联表
|
//保存关联表
|
||||||
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
||||||
incomeInvoiceEntity.setField0138(urluuid);//发票文件
|
|
||||||
ctpAttachmentService.saveAttachment(ofdurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
ctpAttachmentService.saveAttachment(ofdurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
||||||
}
|
}
|
||||||
logger.error("999999保存关联表xmlurlData"+list.get(0).getDataId());
|
|
||||||
|
|
||||||
if(xmlurlData != null){
|
if(xmlurlData != null){
|
||||||
//保存关联表
|
//保存关联表
|
||||||
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
||||||
incomeInvoiceEntity.setField0139(urluuid);//发票文件
|
|
||||||
ctpAttachmentService.saveAttachment(xmlurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
ctpAttachmentService.saveAttachment(xmlurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
||||||
}
|
}
|
||||||
logger.error("999999修改发票开始");
|
|
||||||
|
|
||||||
incomeInvoiceDao.updateFP(incomeInvoiceEntity);
|
incomeInvoiceDao.updateFP(incomeInvoiceEntity);
|
||||||
logger.error("999999修改发票结束");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//修改明细表
|
//修改明细表
|
||||||
logger.error("999999修改合同开始");
|
|
||||||
|
|
||||||
if(jsonObject.getString("htbh") != null){
|
if(jsonObject.getString("htbh") != null){
|
||||||
logger.error("999999修改合同开始1");
|
|
||||||
|
|
||||||
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
IncomeInvoiceEntity incomeInvoiceEntity = new IncomeInvoiceEntity();
|
||||||
incomeInvoiceEntity.setDataSourceCode("HT-OA");
|
incomeInvoiceEntity.setDataSourceCode("HT-OA");
|
||||||
incomeInvoiceEntity.setField0003(jsonObject.getString("htbh"));//合同号
|
incomeInvoiceEntity.setField0003(jsonObject.getString("htbh"));//合同号
|
||||||
incomeInvoiceEntity.setField0127(jsonObject.getString("fpdm"));//发票代码
|
incomeInvoiceEntity.setField0127(jsonObject.getString("fpdm"));//发票代码
|
||||||
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
incomeInvoiceEntity.setField0128(jsonObject.getString("fphm"));//发票号码
|
||||||
incomeInvoiceEntity.setField0129(jsonObject.getString("jshj"));//发票总额
|
incomeInvoiceEntity.setField0129(jsonObject.getString("jshj"));//发票总额
|
||||||
|
incomeInvoiceEntity.setField0130(urlData);//发票文件
|
||||||
logger.error("999999查询合同明细");
|
incomeInvoiceEntity.setField0138(ofdurlData);//发票文件
|
||||||
|
incomeInvoiceEntity.setField0139(xmlurlData);//发票文件
|
||||||
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaZb(incomeInvoiceEntity);
|
List<IncomeInvoiceEntity> list = incomeInvoiceDao.queryOaZb(incomeInvoiceEntity);
|
||||||
logger.error("999999查询合同明细"+list.size());
|
|
||||||
|
|
||||||
if(list != null && list.size() == 1){
|
if(list != null && list.size() == 1){
|
||||||
incomeInvoiceEntity.setFormmainId(list.get(0).getDataId());
|
incomeInvoiceEntity.setFormmainId(list.get(0).getDataId());
|
||||||
//logger.error("999999保存合同附件"+list.get(0).getDataId());
|
if(urlData != null){
|
||||||
//
|
//保存关联表
|
||||||
//if(urlData != null){
|
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
||||||
// //保存关联表
|
ctpAttachmentService.saveAttachment(urlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
||||||
// String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
}
|
||||||
//incomeInvoiceEntity.setField0130(urluuid);//发票文件
|
if(ofdurlData != null){
|
||||||
|
//保存关联表
|
||||||
// ctpAttachmentService.saveAttachment(urlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
||||||
//}
|
ctpAttachmentService.saveAttachment(ofdurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
||||||
//logger.error("999999保存合同附件ofdurlData"+list.get(0).getDataId());
|
}
|
||||||
//
|
if(xmlurlData != null){
|
||||||
//if(ofdurlData != null){
|
//保存关联表
|
||||||
// //保存关联表
|
String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
||||||
// String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
ctpAttachmentService.saveAttachment(xmlurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
||||||
|
}
|
||||||
//incomeInvoiceEntity.setField0138(urluuid);//发票文件
|
|
||||||
|
|
||||||
// ctpAttachmentService.saveAttachment(ofdurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
|
||||||
//}
|
|
||||||
//logger.error("999999保存合同附件xmlurlData"+list.get(0).getDataId());
|
|
||||||
//
|
|
||||||
//if(xmlurlData != null){
|
|
||||||
// //保存关联表
|
|
||||||
// String urluuid = String.valueOf(UUID.randomUUID().getLeastSignificantBits());
|
|
||||||
//incomeInvoiceEntity.setField0138(urluuid);//发票文件
|
|
||||||
|
|
||||||
// ctpAttachmentService.saveAttachment(xmlurlData,list.get(0).getDataId().toString(),urluuid,incomeInvoiceEntity.getDataSourceCode());
|
|
||||||
//}
|
|
||||||
logger.error("999999查询合同明细"+list.get(0).getDataId());
|
|
||||||
|
|
||||||
List<IncomeInvoiceEntity> mxlist = incomeInvoiceDao.queryOaMx(incomeInvoiceEntity);
|
List<IncomeInvoiceEntity> mxlist = incomeInvoiceDao.queryOaMx(incomeInvoiceEntity);
|
||||||
|
|
||||||
logger.error("999999查询合同明细结果"+mxlist.size());
|
|
||||||
|
|
||||||
if(mxlist != null && mxlist.size() == 1){
|
if(mxlist != null && mxlist.size() == 1){
|
||||||
logger.error("999999修改合同明细结果"+mxlist.get(0).getDataId());
|
|
||||||
|
|
||||||
incomeInvoiceEntity.setDataId(mxlist.get(0).getDataId());
|
incomeInvoiceEntity.setDataId(mxlist.get(0).getDataId());
|
||||||
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
|
incomeInvoiceDao.updateMx(incomeInvoiceEntity);
|
||||||
logger.error("999999修改合同明细结果完成");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(mxlist == null || mxlist.size() == 0){
|
if(mxlist == null || mxlist.size() == 0){
|
||||||
|
incomeInvoiceEntity.setDataId(1);
|
||||||
incomeInvoiceEntity.setDataId(String.valueOf(UUIDLong.longUUID()));
|
|
||||||
logger.error("999999保存合同明细结果"+incomeInvoiceEntity.getDataId());
|
|
||||||
|
|
||||||
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
|
incomeInvoiceDao.saveMx(incomeInvoiceEntity);
|
||||||
logger.error("999999保存合同明细结果完成");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.error("999999结束");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("999999"+e.getMessage());
|
logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,7 +769,7 @@ public class IncomeInvoiceServiceImpl extends BaseService<IncomeInvoiceEntity, S
|
||||||
stringBuffer.append("</value>").append("</column>");
|
stringBuffer.append("</value>").append("</column>");
|
||||||
|
|
||||||
stringBuffer.append("<column name=\"合同编号\">").append("<value>");
|
stringBuffer.append("<column name=\"合同编号\">").append("<value>");
|
||||||
stringBuffer.append(jsonObject.getString("htbh") != null?"<![CDATA["+jsonObject.getString("htbh")+"]]>":"");
|
stringBuffer.append(jsonObject.getString("htbm") != null?"<![CDATA["+jsonObject.getString("htbm")+"]]>":"");
|
||||||
stringBuffer.append("</value>").append("</column>");
|
stringBuffer.append("</value>").append("</column>");
|
||||||
|
|
||||||
stringBuffer.append("<column name=\"发票文件1\">").append("<value>");
|
stringBuffer.append("<column name=\"发票文件1\">").append("<value>");
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
@ -225,13 +224,4 @@ public class EntranceController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/option1")
|
|
||||||
@ResponseBody
|
|
||||||
public JsonResultEntity option1(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
|
||||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
|
||||||
String queryString = request.getQueryString();
|
|
||||||
|
|
||||||
return BaseResult.getSuccessMessageEntity("成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
|
||||||
public interface ICtpAttachmentService extends IBaseService<CtpAttachmentEntity, String> {
|
public interface ICtpAttachmentService extends IBaseService<CtpAttachmentEntity, String> {
|
||||||
/**
|
/**
|
||||||
* 保存附件关系表
|
* 保存附件关系表
|
||||||
* @param fileUrl ctp_file id fileUrl
|
* @param fileUrl ctp_file id
|
||||||
* @param col_summary_id col_summary id oa表单id
|
* @param col_summary_id col_summary id
|
||||||
* @param sub_reference 随机uuid
|
* @param sub_reference 随机uuid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class CtpAttachmentServiceImpl extends BaseService<CtpAttachmentEntity, S
|
||||||
ctpAttachmentEntity.setFile_url(ctpFile.getId());//ctp_file表的id
|
ctpAttachmentEntity.setFile_url(ctpFile.getId());//ctp_file表的id
|
||||||
ctpAttachmentEntity.setAtt_reference(col_summary_id);//业务表单的id
|
ctpAttachmentEntity.setAtt_reference(col_summary_id);//业务表单的id
|
||||||
ctpAttachmentEntity.setSub_reference(sub_reference);//这个字段要保存到业务表附件到字段上
|
ctpAttachmentEntity.setSub_reference(sub_reference);//这个字段要保存到业务表附件到字段上
|
||||||
ctpAttachmentEntity.setCategory("66");//这里写66 才可以显示图片
|
ctpAttachmentEntity.setCategory(ctpFile.getCategory());//这里写66 才可以显示图片
|
||||||
ctpAttachmentEntity.setFilename(ctpFile.getFilename());
|
ctpAttachmentEntity.setFilename(ctpFile.getFilename());
|
||||||
ctpAttachmentEntity.setType(ctpFile.getType());
|
ctpAttachmentEntity.setType(ctpFile.getType());
|
||||||
ctpAttachmentEntity.setMime_type(ctpFile.getMime_type());
|
ctpAttachmentEntity.setMime_type(ctpFile.getMime_type());
|
||||||
|
|
Loading…
Reference in New Issue