Compare commits

..

No commits in common. "6f39ac218ee6a37d771bb48c205b2297a757ee3b" and "2ab3de21644534db2e306588a2e6c1b264aef1d7" have entirely different histories.

3 changed files with 41 additions and 88 deletions

View File

@ -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.entity.MdmModuleSendLogEntity;
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.sysnew.application.api.dao.ISysApplicationApiDao;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.Resource;
@ -81,8 +78,6 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
private IMdmModuleSendLogDao mdmModuleSendLogDao;
@Resource
private IMdmModuleDistributeTripartiteDao mdmModuleDistributeTripartiteDao;
@Autowired
private IInvoiceDao invoiceDao;
@Value("${zt.url}")
private String url ;
@ -1122,8 +1117,6 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
logger.info("=========开始执行开票申请单申请新增数据下发脚本,第二次==============");
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
logger.info("=====开票申请单申请数据新增下发返回结果为:{}",JSONObject.parseObject(jsonResultEntity.getAttribute().toString()).toJSONString());
//todo 更新OA开票结果
updateOAForm(jsonResultEntity,doObjects.get(i));
if(jsonResultEntity.isFlag()){
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
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 {
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");

View File

@ -41,34 +41,47 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
static class A88772 {
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();
if("200".equals(resData.getJSONObject("data").get("status"))){
com.alibaba.fastjson.JSONObject reqData = resData.getJSONObject("data").getJSONObject("attribute");
if(null !=reqData){
if("0".equals(reqData.getString("code"))){
com.alibaba.fastjson.JSONObject result=reqData.getJSONObject("result");
if(null != result){
java.lang.String applicationId= result.getString("applicationId");
if(null != applicationId){
returnObject.put("success","true");
returnObject.put("tripartiteId",applicationId);
}else{
returnObject.put("success","false");
}
}else{
returnObject.put("success","false");
}
}else{
returnObject.put("success","false");
returnObject.put("message",reqData.getString("message"));
}
}else{
returnObject.put("success","false");
com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject parent = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data");
java.lang.String hour = cn.hutool.core.convert.Convert.toStr(cn.hutool.core.date.DateUtil.hour(new java.util.Date(),true));
java.lang.String minute = cn.hutool.core.convert.Convert.toStr(cn.hutool.core.date.DateUtil.minute(new java.util.Date()));
parent.put("sourceFlowNumber", data.getString("source_flow_number")+"_"+hour+minute);
parent.put("documentNo", data.getString("document_no"));
parent.put("companyCode", data.getString("company_code"));
parent.put("fundType", data.getString("fund_type"));
parent.put("digest", data.getString("digest"));
parent.put("payAccountNum", data.getString("pay_account_num"));
parent.put("payAccountName", data.getString("pay_account_name"));
parent.put("recAccountNum", data.getString("rec_account_num"));
parent.put("recAccountName", data.getString("rec_account_name"));
parent.put("recBankCode", data.getString("rec_bank_code"));
parent.put("settleAccountType", data.getString("settle_account_type"));
parent.put("payChannel", data.getString("pay_channel"));
parent.put("currency", data.getString("currency"));
parent.put("transAmount", data.getString("trans_amount"));
parent.put("payDate", data.getString("pay_date"));
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();
}
}

View File

@ -1,7 +1,6 @@
package com.hzya.frame.seeyon.invoice.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
@ -237,11 +236,11 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
}
//获取xml文件到本地 并为xml取名否则会报无法访问错误
logger.info("========开始将xml文件保存到本地========");
String xmlFileName = generateFileName(xmlUrl, "zip");
String xmlFileName = generateFileName(xmlUrl, "XML");
String xmlSavePath = invoiceXmlUrl + xmlFileName;
File fileXml = downloadXml(xmlUrl, xmlSavePath);
downloadPdf(xmlUrl, xmlSavePath);
logger.info("========xml文件保存到本地完成========");
//File fileXml = new File(xmlSavePath);
File fileXml = new File(xmlSavePath);
if(null !=fileXml){
logger.info("========开始将xml文件上传OA========");
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 {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {