Compare commits
No commits in common. "6f39ac218ee6a37d771bb48c205b2297a757ee3b" and "2ab3de21644534db2e306588a2e6c1b264aef1d7" have entirely different histories.
6f39ac218e
...
2ab3de2164
|
@ -22,8 +22,6 @@ import com.hzya.frame.mdm.mdmModuleDistributeTripartite.entity.MdmModuleDistribu
|
||||||
import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao;
|
import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao;
|
||||||
import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity;
|
import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity;
|
||||||
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
||||||
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDao;
|
|
||||||
import com.hzya.frame.seeyon.invoice.entity.InvoiceEntity;
|
|
||||||
import com.hzya.frame.sys.sysenum.SysEnum;
|
import com.hzya.frame.sys.sysenum.SysEnum;
|
||||||
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
||||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||||
|
@ -47,7 +45,6 @@ import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -81,8 +78,6 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
private IMdmModuleSendLogDao mdmModuleSendLogDao;
|
private IMdmModuleSendLogDao mdmModuleSendLogDao;
|
||||||
@Resource
|
@Resource
|
||||||
private IMdmModuleDistributeTripartiteDao mdmModuleDistributeTripartiteDao;
|
private IMdmModuleDistributeTripartiteDao mdmModuleDistributeTripartiteDao;
|
||||||
@Autowired
|
|
||||||
private IInvoiceDao invoiceDao;
|
|
||||||
@Value("${zt.url}")
|
@Value("${zt.url}")
|
||||||
private String url ;
|
private String url ;
|
||||||
|
|
||||||
|
@ -1122,8 +1117,6 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
logger.info("=========开始执行开票申请单申请新增数据下发脚本,第二次==============");
|
logger.info("=========开始执行开票申请单申请新增数据下发脚本,第二次==============");
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||||
logger.info("=====开票申请单申请数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
logger.info("=====开票申请单申请数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
|
||||||
//todo 更新OA开票结果
|
|
||||||
updateOAForm(jsonResultEntity,doObjects.get(i));
|
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
|
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
|
||||||
logger.info("=========开始执行开票申请单申请数据新增返回脚本==============");
|
logger.info("=========开始执行开票申请单申请数据新增返回脚本==============");
|
||||||
|
@ -1215,44 +1208,6 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新OA开票结果
|
|
||||||
* @param jsonResultEntity
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
private void updateOAForm(JsonResultEntity jsonResultEntity, JSONObject data) {
|
|
||||||
try {
|
|
||||||
logger.info("准备更新开票结果到OA单据返回参数:{},data_id:{}",JSONObject.toJSONString(jsonResultEntity),data.getString("data_id"));
|
|
||||||
if (null != jsonResultEntity && null != data && StrUtil.isNotEmpty(data.getString("data_id"))){
|
|
||||||
String data_id = data.getString("data_id");
|
|
||||||
String attrStr = (String) jsonResultEntity.getAttribute();
|
|
||||||
JSONObject attrObj = JSONObject.parseObject(attrStr);
|
|
||||||
JSONObject attribute = attrObj.getJSONObject("attribute");
|
|
||||||
if (null != attribute && !"0".equals(attribute.getString("code"))){
|
|
||||||
String message = attribute.getString("message");
|
|
||||||
InvoiceEntity invoiceEntity = new InvoiceEntity();
|
|
||||||
invoiceEntity.setId(data_id);
|
|
||||||
invoiceEntity.setResult_status(message);
|
|
||||||
invoiceDao.updateInvoiceResult(invoiceEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
logger.info("调用有度开票申请接口后更新OA表单开票结果出错:{}",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String resultStr = "{\"attribute\":\"{\\\"msg\\\":\\\"转发成功\\\",\\\"type\\\":null,\\\"flag\\\":true,\\\"status\\\":\\\"200\\\",\\\"attribute\\\":{\\\"result\\\":{\\\"businessNo\\\":\\\"KP202506170028\\\",\\\"applicationNumber\\\":\\\"LZ250617000004\\\",\\\"applicationId\\\":\\\"1384530530992742657\\\"},\\\"code\\\":\\\"0\\\",\\\"cause\\\":null,\\\"message\\\":\\\"成功\\\"}}\",\"flag\":true,\"msg\":\"转发成功\",\"status\":\"200\"}";
|
|
||||||
JsonResultEntity jsonResultEntity = JSON.parseObject(resultStr,JsonResultEntity.class);
|
|
||||||
JSONObject data = new JSONObject();
|
|
||||||
data.put("data_id","2076813022629089234");
|
|
||||||
InvoiceDistributePluginInitializer plugin = new InvoiceDistributePluginInitializer();
|
|
||||||
String attrStr = (String) jsonResultEntity.getAttribute();
|
|
||||||
JSONObject attrObj = JSONObject.parseObject(attrStr);
|
|
||||||
plugin.updateOAForm(jsonResultEntity,data);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String appId, String target_api,String apiID, String source_data, String option_type) throws Exception {
|
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String appId, String target_api,String apiID, String source_data, String option_type) throws Exception {
|
||||||
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
||||||
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
||||||
|
|
|
@ -41,34 +41,47 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
|
||||||
|
|
||||||
static class A88772 {
|
static class A88772 {
|
||||||
String execute(String jsonStr) {
|
String execute(String jsonStr) {
|
||||||
com.alibaba.fastjson.JSONObject resData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
|
|
||||||
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
|
||||||
if("200".equals(resData.getJSONObject("data").get("status"))){
|
com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject();
|
||||||
com.alibaba.fastjson.JSONObject reqData = resData.getJSONObject("data").getJSONObject("attribute");
|
com.alibaba.fastjson.JSONObject parent = new com.alibaba.fastjson.JSONObject();
|
||||||
if(null !=reqData){
|
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
|
||||||
if("0".equals(reqData.getString("code"))){
|
com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data");
|
||||||
com.alibaba.fastjson.JSONObject result=reqData.getJSONObject("result");
|
java.lang.String hour = cn.hutool.core.convert.Convert.toStr(cn.hutool.core.date.DateUtil.hour(new java.util.Date(),true));
|
||||||
if(null != result){
|
java.lang.String minute = cn.hutool.core.convert.Convert.toStr(cn.hutool.core.date.DateUtil.minute(new java.util.Date()));
|
||||||
java.lang.String applicationId= result.getString("applicationId");
|
parent.put("sourceFlowNumber", data.getString("source_flow_number")+"_"+hour+minute);
|
||||||
if(null != applicationId){
|
parent.put("documentNo", data.getString("document_no"));
|
||||||
returnObject.put("success","true");
|
parent.put("companyCode", data.getString("company_code"));
|
||||||
returnObject.put("tripartiteId",applicationId);
|
parent.put("fundType", data.getString("fund_type"));
|
||||||
}else{
|
parent.put("digest", data.getString("digest"));
|
||||||
returnObject.put("success","false");
|
parent.put("payAccountNum", data.getString("pay_account_num"));
|
||||||
}
|
parent.put("payAccountName", data.getString("pay_account_name"));
|
||||||
}else{
|
parent.put("recAccountNum", data.getString("rec_account_num"));
|
||||||
returnObject.put("success","false");
|
parent.put("recAccountName", data.getString("rec_account_name"));
|
||||||
}
|
parent.put("recBankCode", data.getString("rec_bank_code"));
|
||||||
}else{
|
parent.put("settleAccountType", data.getString("settle_account_type"));
|
||||||
returnObject.put("success","false");
|
parent.put("payChannel", data.getString("pay_channel"));
|
||||||
returnObject.put("message",reqData.getString("message"));
|
parent.put("currency", data.getString("currency"));
|
||||||
}
|
parent.put("transAmount", data.getString("trans_amount"));
|
||||||
}else{
|
parent.put("payDate", data.getString("pay_date"));
|
||||||
returnObject.put("success","false");
|
boolean fale=true;
|
||||||
|
if("false".equals(data.getString("to_public"))){
|
||||||
|
fale=false;
|
||||||
|
parent.put("toPublic",fale);
|
||||||
|
parent.put("recFinanceCode",data.getString("recFinanceCode"));
|
||||||
|
//如果银行编码不为空,则不用传联行号
|
||||||
|
if (null != data.getString("recFinanceCode")){
|
||||||
|
parent.put("recBankCode", null);
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
returnObject.put("success","false");
|
|
||||||
}
|
}
|
||||||
|
parent.put("toPublic",fale);
|
||||||
|
parent.put("purpose", data.getString("purpose"));
|
||||||
|
bodys.put("data",parent);
|
||||||
|
java.lang.String params = bodys.toJSONString();
|
||||||
|
//com.hzya.frame.seeyon.util.SM2Util sm2Util=new com.hzya.frame.seeyon.util.SM2Util();
|
||||||
|
//java.lang.String encrypt = sm2Util.encrypt(params, "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEDT3LdDBzrg61SQSMtESOySsffz05RR2ZZCCa9BKqQvm//jfs9ySmwjGf8HD9Vd+kPg5XwyQmPQIv1JNj2fWWhQ==");
|
||||||
|
//com.alibaba.fastjson.JSONObject zx = new com.alibaba.fastjson.JSONObject();
|
||||||
|
//zx.put("data",encrypt);
|
||||||
|
//returnObject.put("bodys",zx.toJSONString());
|
||||||
return returnObject.toJSONString();
|
return returnObject.toJSONString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.hzya.frame.seeyon.invoice.service.impl;
|
package com.hzya.frame.seeyon.invoice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.ZipUtil;
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
@ -237,11 +236,11 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
}
|
}
|
||||||
//获取xml文件到本地 并为xml取名,否则会报无法访问错误
|
//获取xml文件到本地 并为xml取名,否则会报无法访问错误
|
||||||
logger.info("========开始将xml文件保存到本地========");
|
logger.info("========开始将xml文件保存到本地========");
|
||||||
String xmlFileName = generateFileName(xmlUrl, "zip");
|
String xmlFileName = generateFileName(xmlUrl, "XML");
|
||||||
String xmlSavePath = invoiceXmlUrl + xmlFileName;
|
String xmlSavePath = invoiceXmlUrl + xmlFileName;
|
||||||
File fileXml = downloadXml(xmlUrl, xmlSavePath);
|
downloadPdf(xmlUrl, xmlSavePath);
|
||||||
logger.info("========xml文件保存到本地完成========");
|
logger.info("========xml文件保存到本地完成========");
|
||||||
//File fileXml = new File(xmlSavePath);
|
File fileXml = new File(xmlSavePath);
|
||||||
if(null !=fileXml){
|
if(null !=fileXml){
|
||||||
logger.info("========开始将xml文件上传OA========");
|
logger.info("========开始将xml文件上传OA========");
|
||||||
ManyfileUpload(fileXml, entity, sub_reference, att_reference, jsonObject);
|
ManyfileUpload(fileXml, entity, sub_reference, att_reference, jsonObject);
|
||||||
|
@ -463,20 +462,6 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载发票xml附件, 税务系统返回的xml文件是.zip压缩包
|
|
||||||
* @param xmlUrl
|
|
||||||
* @param savePath
|
|
||||||
*/
|
|
||||||
private File downloadXml(String xmlUrl,String savePath){
|
|
||||||
long size = HttpUtil.downloadFile(xmlUrl,savePath);
|
|
||||||
File xmlZipFile = new File(savePath);
|
|
||||||
// if (null != xmlZipFile && xmlZipFile.getName().endsWith(".zip")){
|
|
||||||
// File unzip = ZipUtil.unzip(xmlZipFile);
|
|
||||||
// return unzip;
|
|
||||||
// }
|
|
||||||
return xmlZipFile;
|
|
||||||
}
|
|
||||||
private static void trustAllCertificates(HttpsURLConnection conn) throws Exception {
|
private static void trustAllCertificates(HttpsURLConnection conn) throws Exception {
|
||||||
TrustManager[] trustAllCerts = new TrustManager[]{
|
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
new X509TrustManager() {
|
new X509TrustManager() {
|
||||||
|
|
Loading…
Reference in New Issue