中信下发和有度开票结果查询
This commit is contained in:
parent
8ab88a9acb
commit
915317d4c7
|
@ -1092,26 +1092,6 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
/* logger.info("=========正常开票申请单申请数据新增开始执行登录接口==============");
|
|
||||||
//找到登陆接口
|
|
||||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
|
||||||
if (null == loginApi) {
|
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String rzquerys = getQuery(loginApi,null,null);
|
|
||||||
Map<String, String> headersa = new HashMap<>();
|
|
||||||
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
|
|
||||||
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
|
|
||||||
headersa.put("appId", sysApplicationEntity.getAppId().toString());
|
|
||||||
headersa.put("apiCode", loginApi.getApiCode().toString());
|
|
||||||
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
|
||||||
String rzbodys = getBodys(loginApi,null,null);
|
|
||||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
|
||||||
if (!rzjsonResultEntity.isFlag()) {
|
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
JSONObject jsonObject=new JSONObject();
|
JSONObject jsonObject=new JSONObject();
|
||||||
jsonObject.put("accessKey","6X3B526P5HqE6ums");
|
jsonObject.put("accessKey","6X3B526P5HqE6ums");
|
||||||
jsonObject.put("accessSecret","34e5fc32ac894a2ba2ade8c3852c7a0a");
|
jsonObject.put("accessSecret","34e5fc32ac894a2ba2ade8c3852c7a0a");
|
||||||
|
@ -1168,11 +1148,27 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
|
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
|
||||||
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
|
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
|
||||||
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
|
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
|
||||||
|
//修改下发状态
|
||||||
|
logger.info("===开票申请单申请正常下发时候完毕更新新增状态为1=======");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "Y");
|
||||||
|
updateMap.put("addStatus", "1");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("开票申请单申请下发新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
|
logger.error("开票申请单申请下发新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
//修改下发状态
|
||||||
|
logger.info("===开票申请单申请正常下发时候完毕更新新增状态为2=======");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "Y");
|
||||||
|
updateMap.put("addStatus", "2");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1186,12 +1182,20 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||||
objects.get(i).put("sendsanfzt123",false);
|
objects.get(i).put("sendsanfzt123",false);
|
||||||
logger.info("========开票申请单申请数据新增下发完成,日志保存为失败============");
|
logger.info("========开票申请单申请数据新增下发完成,日志保存为失败============");
|
||||||
|
//修改下发状态
|
||||||
|
logger.info("===开票申请单申请正常下发时候完毕更新新增状态为2=======");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "Y");
|
||||||
|
updateMap.put("addStatus", "2");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//所有下发发送完成,修改数据状态
|
/* //所有下发发送完成,修改数据状态
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
if(objects.get(i).getBoolean("sendsanfzt123")){
|
if(objects.get(i).getBoolean("sendsanfzt123")){
|
||||||
Map<String, Object> updateMap = new HashMap<>();
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
@ -1201,7 +1205,7 @@ public class InvoiceDistributePluginInitializer extends PluginBaseEntity {
|
||||||
updateMap.put("id", objects.get(i).getString("id"));
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
mdmModuleDao.updateMdmSTs(updateMap);
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|
|
@ -826,7 +826,7 @@ public class ZxBankDistributePluginInitializer extends PluginBaseEntity {
|
||||||
/** body */
|
/** body */
|
||||||
String bodys = doObjects.get(i).toJSONString();
|
String bodys = doObjects.get(i).toJSONString();
|
||||||
if(scriptEntity != null && scriptEntity.getId() != null ){
|
if(scriptEntity != null && scriptEntity.getId() != null ){
|
||||||
logger.info("=========开始执行正常主数据修改下发脚本,第一次==============");
|
logger.info("=========开始执行正常中信司库付款单修改下发脚本,第一次==============");
|
||||||
groovy.put("code",scriptEntity.getScriptCode());
|
groovy.put("code",scriptEntity.getScriptCode());
|
||||||
groovy.put("className",scriptEntity.getClassName());
|
groovy.put("className",scriptEntity.getClassName());
|
||||||
groovy.put("name",scriptEntity.getScriptName());
|
groovy.put("name",scriptEntity.getScriptName());
|
||||||
|
@ -854,7 +854,7 @@ public class ZxBankDistributePluginInitializer extends PluginBaseEntity {
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
logger.info("=========正常主数据修改开始执行登录接口==============");
|
logger.info("=========正常中信司库付款单修改开始执行登录接口==============");
|
||||||
//找到登陆接口
|
//找到登陆接口
|
||||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
if (null == loginApi) {
|
if (null == loginApi) {
|
||||||
|
@ -875,28 +875,42 @@ public class ZxBankDistributePluginInitializer extends PluginBaseEntity {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
logger.info("=======主数据正常修改下发登录返回数据:{}========",attritube.toJSONString());
|
logger.info("=======中信司库付款单正常修改下发登录返回数据:{}========",attritube.toJSONString());
|
||||||
querys = getQuery(apiEntity,querys,attritube);
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
headers = getHeaders(apiEntity,headers,attritube);
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
bodys = getBodys(apiEntity,bodys,attritube);
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
}
|
}
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
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());
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
//保存日志
|
//保存日志
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
|
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
|
||||||
|
//修改下发状态
|
||||||
|
logger.info("===中信司库付款单正常下发时候完毕更新新增状态为1=======");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "F");
|
||||||
|
updateMap.put("updateStatus", "1");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
continue;
|
continue;
|
||||||
}else {
|
}else {
|
||||||
//保存日志
|
//保存日志
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
|
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "F");
|
||||||
|
updateMap.put("updateStatus", "2");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//所有下发发送完成,修改数据状态
|
/*//所有下发发送完成,修改数据状态
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
Map<String, Object> updateMap = new HashMap<>();
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
updateMap.put("tableName",mainDb);
|
updateMap.put("tableName",mainDb);
|
||||||
|
@ -904,7 +918,7 @@ public class ZxBankDistributePluginInitializer extends PluginBaseEntity {
|
||||||
updateMap.put("updateStatus", "1");
|
updateMap.put("updateStatus", "1");
|
||||||
updateMap.put("id", objects.get(i).getString("id"));
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
mdmModuleDao.updateMdmSTs(updateMap);
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1083,19 +1097,19 @@ public class ZxBankDistributePluginInitializer extends PluginBaseEntity {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
logger.info("=======主数据正常新增下发登录返回数据:{}========",attritube.toJSONString());
|
logger.info("=======中信司库付款单数据正常新增下发登录返回数据:{}========",attritube.toJSONString());
|
||||||
querys = getQuery(apiEntity,querys,attritube);
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
headers = getHeaders(apiEntity,headers,attritube);
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
bodys = getBodys(apiEntity,bodys,attritube);
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
}
|
}
|
||||||
|
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
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());
|
||||||
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("=========开始执行中信司库付款单新增返回脚本==============");
|
||||||
JSONObject backScriptJson = new JSONObject();
|
JSONObject backScriptJson = new JSONObject();
|
||||||
backScriptJson.put("data", jsonResultEntity.getAttribute());
|
backScriptJson.put("data", jsonResultEntity.getAttribute());
|
||||||
groovy.put("code", scriptEntity.getScriptCode()+"back");
|
groovy.put("code", scriptEntity.getScriptCode()+"back");
|
||||||
|
@ -1124,30 +1138,54 @@ public class ZxBankDistributePluginInitializer extends PluginBaseEntity {
|
||||||
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
|
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
|
||||||
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
|
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
|
||||||
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
|
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
|
||||||
|
//修改下发状态
|
||||||
|
logger.info("===中信司库付款单正常下发时候完毕更新新增状态为1=======");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "Y");
|
||||||
|
updateMap.put("addStatus", "1");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
|
logger.error("中信司库付款单新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
//修改下发状态
|
||||||
|
logger.info("===中信司库付款单正常下发时候完毕更新新增状态为2=======");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "Y");
|
||||||
|
updateMap.put("addStatus", "2");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//保存日志
|
//保存日志
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||||
objects.get(i).put("sendsanfzt123",true);
|
objects.get(i).put("sendsanfzt123",true);
|
||||||
logger.info("========主数据新增下发完成,日志保存为成功============");
|
logger.info("========中信司库付款单新增下发完成,日志保存为成功============");
|
||||||
continue;
|
continue;
|
||||||
}else {
|
}else {
|
||||||
//保存日志
|
//保存日志
|
||||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败:"+jsonResultEntity.getAttribute(),mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
|
||||||
objects.get(i).put("sendsanfzt123",false);
|
objects.get(i).put("sendsanfzt123",false);
|
||||||
logger.info("========主数据新增下发完成,日志保存为失败============");
|
logger.info("========中信司库付款单新增下发完成,日志保存为失败============");
|
||||||
|
//修改下发状态
|
||||||
|
logger.info("===中信司库付款单正常下发时候完毕更新新增状态为2=======");
|
||||||
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
updateMap.put("tableName",mainDb);
|
||||||
|
//updateMap.put("dataStatus", "Y");
|
||||||
|
updateMap.put("addStatus", "2");
|
||||||
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//所有下发发送完成,修改数据状态
|
/* //所有下发发送完成,修改数据状态
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
if(objects.get(i).getBoolean("sendsanfzt123")){
|
if(objects.get(i).getBoolean("sendsanfzt123")){
|
||||||
Map<String, Object> updateMap = new HashMap<>();
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
|
@ -1157,7 +1195,7 @@ public class ZxBankDistributePluginInitializer extends PluginBaseEntity {
|
||||||
updateMap.put("id", objects.get(i).getString("id"));
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
mdmModuleDao.updateMdmSTs(updateMap);
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|
|
@ -3,10 +3,21 @@ package com.hzya.frame.seeyon.dao;
|
||||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
import com.hzya.frame.seeyon.entity.CtpFileEntity;
|
import com.hzya.frame.seeyon.entity.CtpFileEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description seeyon 附件对象
|
* @Description seeyon 附件对象
|
||||||
* @Author xiangerlin
|
* @Author xiangerlin
|
||||||
* @Date 2024/6/17 15:21
|
* @Date 2024/6/17 15:21
|
||||||
**/
|
**/
|
||||||
public interface ICtpFileDao extends IBaseDao<CtpFileEntity,String> {
|
public interface ICtpFileDao extends IBaseDao<CtpFileEntity,String> {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 根据附件id查询附加信息
|
||||||
|
* @Param
|
||||||
|
* @Return
|
||||||
|
* @Author hecan
|
||||||
|
* @Date 2025-04-27 18:03
|
||||||
|
* **/
|
||||||
|
List<CtpFileEntity> queryCtpFileById(CtpFileEntity ctpFileEntity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package com.hzya.frame.seeyon.dao.impl;
|
package com.hzya.frame.seeyon.dao.impl;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao;
|
|
||||||
import com.hzya.frame.seeyon.dao.ICtpFileDao;
|
import com.hzya.frame.seeyon.dao.ICtpFileDao;
|
||||||
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
|
|
||||||
import com.hzya.frame.seeyon.entity.CtpFileEntity;
|
import com.hzya.frame.seeyon.entity.CtpFileEntity;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description
|
* @Description
|
||||||
* @Author xiangerlin
|
* @Author xiangerlin
|
||||||
|
@ -14,4 +15,9 @@ import org.springframework.stereotype.Repository;
|
||||||
**/
|
**/
|
||||||
@Repository()
|
@Repository()
|
||||||
public class CtpFileDaoImpl extends MybatisGenericDao<CtpFileEntity,String> implements ICtpFileDao {
|
public class CtpFileDaoImpl extends MybatisGenericDao<CtpFileEntity,String> implements ICtpFileDao {
|
||||||
|
@DS("#ctpFileEntity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public List<CtpFileEntity> queryCtpFileById(CtpFileEntity ctpFileEntity) {
|
||||||
|
return (List<CtpFileEntity>) super.selectList("queryCtpFileById",ctpFileEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hzya.frame.seeyon.entity.CtpFileEntity">
|
<mapper namespace="com.hzya.frame.seeyon.dao.impl.CtpFileDaoImpl">
|
||||||
<resultMap id="get-CtpFileEntity-result" type="com.hzya.frame.seeyon.entity.CtpFileEntity">
|
<resultMap id="get-CtpFileEntity-result" type="com.hzya.frame.seeyon.entity.CtpFileEntity">
|
||||||
<!--主键 -->
|
<!--主键 -->
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
@ -45,5 +45,17 @@
|
||||||
</trim>
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询 采用==查询 -->
|
||||||
|
<select id="queryCtpFileById" resultMap="get-CtpFileEntity-result" parameterType="com.hzya.frame.seeyon.entity.CtpFileEntity">
|
||||||
|
select
|
||||||
|
<include refid="CtpFileEntity_sql"/>
|
||||||
|
from
|
||||||
|
ctp_file
|
||||||
|
<trim prefix="where" prefixOverrides="and">
|
||||||
|
<if test="id != null and id != ''">id = #{id}</if>
|
||||||
|
<if test="filename != null and filename != ''">and filename = #{filename}</if>
|
||||||
|
</trim>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
|
|
||||||
<!--通过主键修改方法-->
|
<!--通过主键修改方法-->
|
||||||
<update id="updateInvoiceUrl" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
|
<update id="updateInvoiceUrl" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
|
||||||
update ${tabName} set ${url_field} =#{url} where id=#{id}
|
update formmain_0331 set ${url_field} =#{url} where id=#{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!--通过主键修改方法-->
|
<!--通过主键修改方法-->
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
<!--通过主键修改方法-->
|
<!--通过主键修改方法-->
|
||||||
<update id="updateInvoiceResult" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
|
<update id="updateInvoiceResult" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
|
||||||
update ${tabName} set
|
update formmain_0331 set
|
||||||
<trim suffix="" suffixOverrides=",">
|
<trim suffix="" suffixOverrides=",">
|
||||||
<if test="input_result_status != null and input_result_status != ''"> ${input_result_status_filed} = #{input_result_status},</if>
|
<if test="input_result_status != null and input_result_status != ''"> ${input_result_status_filed} = #{input_result_status},</if>
|
||||||
<if test="invoice_code != null and invoice_code != ''"> ${invoice_code_field} = #{invoice_code},</if>
|
<if test="invoice_code != null and invoice_code != ''"> ${invoice_code_field} = #{invoice_code},</if>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
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.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
@ -8,7 +10,9 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
||||||
import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl;
|
import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl;
|
||||||
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
|
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
|
||||||
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao;
|
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao;
|
||||||
|
import com.hzya.frame.seeyon.dao.ICtpFileDao;
|
||||||
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
|
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
|
||||||
|
import com.hzya.frame.seeyon.entity.CtpFileEntity;
|
||||||
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDao;
|
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDao;
|
||||||
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDetailsDao;
|
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDetailsDao;
|
||||||
import com.hzya.frame.seeyon.invoice.entity.InvoiceEntity;
|
import com.hzya.frame.seeyon.invoice.entity.InvoiceEntity;
|
||||||
|
@ -31,11 +35,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service(value = "InvoiceServiceImpl")
|
@Service(value = "InvoiceServiceImpl")
|
||||||
|
@ -54,6 +63,9 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
private ComparisonServiceImpl comparisonServiceimpl;
|
private ComparisonServiceImpl comparisonServiceimpl;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICtpAttachmentDao ctpAttachmentDao;
|
private ICtpAttachmentDao ctpAttachmentDao;
|
||||||
|
@Autowired
|
||||||
|
private ICtpFileDao ctpFileDao;
|
||||||
|
|
||||||
|
|
||||||
@Value("${zt.url}")
|
@Value("${zt.url}")
|
||||||
private String url;
|
private String url;
|
||||||
|
@ -152,84 +164,82 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
return BaseResult.getSuccessMessageEntity("查询成功");
|
return BaseResult.getSuccessMessageEntity("查询成功");
|
||||||
}
|
}
|
||||||
for (InvoiceEntity entity : invoiceEntities) {
|
for (InvoiceEntity entity : invoiceEntities) {
|
||||||
long timestamp = System.currentTimeMillis();
|
entity.setDataSourceCode("HT-OA");
|
||||||
Map<String, Object> parametersMap = new HashMap<>();
|
JSONObject jsonObject = new JSONObject();
|
||||||
parametersMap.put("accessKey","6X3B526P5HqE6ums");
|
jsonObject.put("serialNumber", entity.getSerial_number());
|
||||||
parametersMap.put("timestamp",timestamp);
|
//发送数据
|
||||||
String sign = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
|
String result = HttpRequest.post(url).
|
||||||
JSONObject jsonObject=new JSONObject();
|
header("appId", "800060").
|
||||||
jsonObject.put("serialNumber",entity.getId());
|
header("apiCode", "8000600003").
|
||||||
jsonObject.put("accessKey","6X3B526P5HqE6ums");
|
header("publicKey", "ZJYAmRjjYEDgqw4UXWHZNicYclErG0hsrwKQcHukPlP0K1pCe7eDIk+3zDUT+v578prj").
|
||||||
jsonObject.put("sign",sign);
|
header("secretKey", "D6AHU3PL8UsNfK6A8I6mL4X1ma2NXckX/vM7AOzI/jmzJf+R1aY06Q6SBz7Y7drHj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
||||||
jsonObject.put("timestamp",timestamp);
|
body(jsonObject.toJSONString()).
|
||||||
logger.info("=======调用杭泰税务查询申请单详情的请求参数为:{}=======",jsonObject.toJSONString());
|
execute().
|
||||||
//发送数据
|
body();
|
||||||
String result = HttpRequest.post(url).
|
logger.info("=====调用杭泰税务查询申请单详情的返回参数为:{}===========", result);
|
||||||
header("appId", "800060").
|
JSONObject resultJson = JSONObject.parseObject(result);
|
||||||
header("apiCode", "8000600003").
|
if (!resultJson.getBoolean("flag")) {
|
||||||
header("publicKey", "ZJYAmRjjYEDgqw4UXWHZNicYclErG0hsrwKQcHukPlP0K1pCe7eDIk+3zDUT+v578prj").
|
saveTaskLivingDetails(entity.getId(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false, "");
|
||||||
header("secretKey", "D6AHU3PL8UsNfK6A8I6mL4X1ma2NXckX/vM7AOzI/jmzJf+R1aY06Q6SBz7Y7drHj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=").
|
} else {
|
||||||
body(jsonObject.toJSONString()).
|
JSONObject attribute = resultJson.getJSONObject("attribute");
|
||||||
execute().
|
if ("0".equals(attribute.getString("code"))) {
|
||||||
body();
|
JSONObject jsonResult = JSONObject.parseObject(attribute.getString("result"));
|
||||||
logger.info("=====调用杭泰税务查询申请单详情的返回参数为:{}===========",result);
|
if (null != jsonResult && jsonResult.getString("serialNumber").equals(entity.getSerial_number())) {
|
||||||
JSONObject resultJson = JSONObject.parseObject(result);
|
JSONArray jsonArray = jsonResult.getJSONArray("invoiceInfoVOList");
|
||||||
if (!resultJson.getBoolean("flag")) {
|
if (CollectionUtils.isNotEmpty(jsonArray)) {
|
||||||
saveTaskLivingDetails(entity.getId(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false,"");
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
} else {
|
//表单的附件字段=ctpAttachment的Sub_reference,表单的Summary_id=ctpAttachment的att_reference
|
||||||
JSONObject attribute = resultJson.getJSONObject("attribute");
|
String sub_reference = String.valueOf(UUIDLong.longUUID());
|
||||||
if("0".equals(attribute.getString("code"))){
|
String att_reference = entity.getSummaryId();//Summary_id
|
||||||
JSONObject jsonResult=JSONObject.parseObject(attribute.getString("result"));
|
JSONObject invoiceInfo = jsonArray.getJSONObject(i);
|
||||||
if(null !=jsonResult){
|
String invoiceCode = invoiceInfo.getString("invoiceCode");//发票代码
|
||||||
JSONArray jsonArray = jsonResult.getJSONArray("invoiceInfoVOList");
|
String invoiceNumber = invoiceInfo.getString("invoiceNumber");//发票号码
|
||||||
if(CollectionUtils.isNotEmpty(jsonArray)){
|
String resultStatus = InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));//开票结果
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
entity.setInvoice_code(invoiceCode);
|
||||||
//表单的附件字段=ctpAttachment的Sub_reference,表单的Summary_id=ctpAttachment的att_reference
|
entity.setInvoice_number(invoiceNumber);
|
||||||
String sub_reference = String.valueOf(UUIDLong.longUUID());
|
entity.setResult_status(resultStatus);
|
||||||
String att_reference = entity.getSummaryId();//Summary_id
|
entity.setId(entity.getSerial_number());
|
||||||
JSONObject invoiceInfo = jsonArray.getJSONObject(i);
|
//将开票结果,发票号码,发票代码,回写OA
|
||||||
String invoiceCode = invoiceInfo.getString("invoiceCode");//发票代码
|
logger.info("=======开始将开票结果,发票号码,发票代码,回写OA======");
|
||||||
String invoiceNumber = invoiceInfo.getString("invoiceNumber");//发票号码
|
invoiceDao.updateInvoiceResult(entity);
|
||||||
String resultStatus = InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));//开票结果
|
logger.info("=======将开票结果,发票号码,发票代码,回写OA完毕======");
|
||||||
entity.setInvoice_code(invoiceCode);
|
if (null != invoiceInfo.getString("url") || null != invoiceInfo.getString("ofdUrl")) {
|
||||||
entity.setInvoice_number(invoiceNumber);
|
String pdfUrl = invoiceInfo.getString("url");//pdf文件
|
||||||
entity.setResult_status(resultStatus);
|
String ofdUrl = invoiceInfo.getString("ofdUrl");//ofd文件
|
||||||
//将开票结果,发票号码,发票代码,回写OA
|
String xmlUrl = invoiceInfo.getString("xmlUrl");//xml文件
|
||||||
invoiceDao.updateInvoiceResult(entity);
|
//获取pdf文件到本地 并为pdf取名,否则会报无法访问错误
|
||||||
if (null != invoiceInfo.getString("url") || null != invoiceInfo.getString("ofdUrl")) {
|
logger.info("========开始将pdf文件保存到本地========");
|
||||||
String pdfUrl = invoiceInfo.getString("url");//pdf文件
|
String pdfFileName = generateFileName(pdfUrl, "PDF");
|
||||||
String ofdUrl = invoiceInfo.getString("ofdUrl");//ofd文件
|
String pdfSavePath = invoicePdfUrl + pdfFileName;
|
||||||
String xmlUrl = invoiceInfo.getString("xmlUrl");//xml文件
|
downloadPdf(pdfUrl, pdfSavePath);
|
||||||
//获取pdf文件到本地 并为pdf取名,否则会报无法访问错误
|
logger.info("========pdf文件保存到本地完成========");
|
||||||
logger.info("========开始将pdf文件保存到本地========");
|
File filePdf = new File(pdfSavePath);
|
||||||
String pdfFileName = generateFileName(pdfUrl, "pdf");
|
if(null !=filePdf){
|
||||||
String pdfSavePath = invoicePdfUrl + pdfFileName;
|
logger.info("========开始将pdf文件上传OA========");
|
||||||
downloadPdf(pdfUrl, pdfSavePath);
|
ManyfileUpload(filePdf, entity, sub_reference, att_reference, jsonObject);
|
||||||
logger.info("========pdf文件保存到本地完成========");
|
logger.info("========pdf文件上传OA完成========");
|
||||||
File filePdf = new File(pdfSavePath);
|
}
|
||||||
logger.info("========开始将pdf文件上传OA========");
|
//获取ofd文件到本地
|
||||||
ManyfileUpload(filePdf, entity, sub_reference, att_reference, jsonObject);
|
logger.info("========开始将ofd文件保存到本地========");
|
||||||
logger.info("========pdf文件上传OA完成========");
|
String ofdFileName = generateFileName(ofdUrl, "OFD");
|
||||||
//获取ofd文件到本地
|
String ofdSavePath = invoiceOfdUrl + ofdFileName;
|
||||||
logger.info("========开始将ofd文件保存到本地========");
|
downloadPdf(ofdUrl, ofdSavePath);
|
||||||
String ofdFileName = generateFileName(ofdUrl, "ofd");
|
logger.info("========ofd文件保存到本地完成========");
|
||||||
String ofdSavePath = ofdUrl + ofdFileName;
|
File fileOfd = new File(ofdSavePath);
|
||||||
downloadPdf(ofdUrl, ofdSavePath);
|
if(null !=fileOfd){
|
||||||
logger.info("========ofd文件保存到本地完成========");
|
logger.info("========开始将ofd文件上传OA========");
|
||||||
File fileOfd = new File(ofdSavePath);
|
ManyfileUpload(fileOfd, entity, sub_reference, att_reference, jsonObject);
|
||||||
logger.info("========开始将ofd文件上传OA========");
|
logger.info("========ofd文件上传OA完成========");
|
||||||
ManyfileUpload(fileOfd, entity, sub_reference, att_reference, jsonObject);
|
}
|
||||||
logger.info("========ofd文件上传OA完成========");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("======查询杭泰税务申请单详情失败====",e.getMessage());
|
logger.info("======查询杭泰税务申请单详情失败:{}====",e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -248,17 +258,9 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
return BaseResult.getSuccessMessageEntity("查询成功");
|
return BaseResult.getSuccessMessageEntity("查询成功");
|
||||||
}
|
}
|
||||||
for (InvoiceEntity entity : invoiceEntities) {
|
for (InvoiceEntity entity : invoiceEntities) {
|
||||||
long timestamp = System.currentTimeMillis();
|
entity.setDataSourceCode("HT-OA");
|
||||||
Map<String, Object> parametersMap = new HashMap<>();
|
|
||||||
parametersMap.put("accessKey","6X3B526P5HqE6ums");
|
|
||||||
parametersMap.put("timestamp",timestamp);
|
|
||||||
String sign = YzfSignUtil.signRequest(parametersMap,"34e5fc32ac894a2ba2ade8c3852c7a0a");
|
|
||||||
JSONObject jsonObject=new JSONObject();
|
JSONObject jsonObject=new JSONObject();
|
||||||
jsonObject.put("serialNumber",entity.getId());
|
jsonObject.put("serialNumber",entity.getId());
|
||||||
jsonObject.put("accessKey","6X3B526P5HqE6ums");
|
|
||||||
jsonObject.put("sign",sign);
|
|
||||||
jsonObject.put("timestamp",timestamp);
|
|
||||||
logger.info("=======调用杭泰税务查询发票批量录入结果的请求参数为:{}=======",jsonObject.toJSONString());
|
|
||||||
//发送数据
|
//发送数据
|
||||||
String result = HttpRequest.post(url).
|
String result = HttpRequest.post(url).
|
||||||
header("appId", "800060").
|
header("appId", "800060").
|
||||||
|
@ -293,61 +295,125 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("======查询杭泰税务发票批量录入结果失败====",e.getMessage());
|
logger.info("======查询杭泰税务发票批量录入结果失败:{}====",e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ManyfileUpload(File file,InvoiceEntity entity,String sub_reference,String att_reference,JSONObject jsonObject){
|
private void ManyfileUpload(File file,InvoiceEntity entity,String sub_reference,String att_reference,JSONObject jsonObject){
|
||||||
JSONObject jsonObjectOfd = OARestUtil.fileUpload(file,"8000590003","8000590001");
|
logger.info("=======文件名称为:{}=====",file.getName());
|
||||||
if (jsonObjectOfd.getString("fileUrl") != null) {
|
if(null !=file) {
|
||||||
entity.setUrl(sub_reference);
|
JSONObject jsonObjectOfd = fileUploadPdfAndOfd(file);
|
||||||
entity.setDataSourceCode("HT-OA");
|
if (jsonObjectOfd.getString("fileUrl") != null) {
|
||||||
invoiceDao.updateInvoiceUrl(entity);
|
entity.setUrl(sub_reference);
|
||||||
//根据附件id查询附件业务数据
|
entity.setDataSourceCode("HT-OA");
|
||||||
String file_url = jsonObjectOfd.getString("fileUrl");
|
logger.info("===========查询开票详情开始将附件id更新OA==========");
|
||||||
CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity();
|
invoiceDao.updateInvoiceUrl(entity);
|
||||||
ctpAttachmentEntity.setFile_url(file_url);
|
logger.info("===========查询开票详情将附件id更新OA完毕==========");
|
||||||
ctpAttachmentEntity.setSub_reference(sub_reference);
|
//根据附件id查询附件信息
|
||||||
ctpAttachmentEntity.setAtt_reference(att_reference);
|
CtpFileEntity ctpFileEntity=new CtpFileEntity();
|
||||||
ctpAttachmentEntity.setDataSourceCode("HT-OA");
|
ctpFileEntity.setId(jsonObjectOfd.getString("fileUrl"));
|
||||||
List<CtpAttachmentEntity> ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity);
|
ctpFileEntity.setDataSourceCode("HT-OA");
|
||||||
//如果没有查询到数据,就新增附件业务,否则更新
|
List<CtpFileEntity> query = ctpFileDao.queryCtpFileById(ctpFileEntity);
|
||||||
if (ctpAttachmentEntities.size() == 0) {
|
if(CollectionUtils.isNotEmpty(query)) {
|
||||||
String category = jsonObject.getString("category");
|
CtpFileEntity ctpFile = query.get(0);
|
||||||
String type = jsonObject.getString("type");
|
//根据附件id查询附件业务数据
|
||||||
String filename = jsonObject.getString("filename");
|
String file_url = jsonObjectOfd.getString("fileUrl");
|
||||||
String mime_type = jsonObject.getString("mimeType");
|
CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity();
|
||||||
String attachment_size = jsonObject.getString("size");
|
ctpAttachmentEntity.setFile_url(file_url);
|
||||||
String id = String.valueOf(UUIDLong.longUUID());
|
ctpAttachmentEntity.setSub_reference(sub_reference);
|
||||||
ctpAttachmentEntity.setCategory(category);
|
ctpAttachmentEntity.setAtt_reference(att_reference);
|
||||||
ctpAttachmentEntity.setFilename(filename);
|
ctpAttachmentEntity.setDataSourceCode("HT-OA");
|
||||||
ctpAttachmentEntity.setType(type);
|
List<CtpAttachmentEntity> ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity);
|
||||||
ctpAttachmentEntity.setMime_type(mime_type);
|
//如果没有查询到数据,就新增附件业务,否则更新
|
||||||
ctpAttachmentEntity.setAttachment_size(attachment_size);
|
if (ctpAttachmentEntities.size() == 0) {
|
||||||
ctpAttachmentEntity.setId(id);
|
String category =ctpFile.getCategory();
|
||||||
ctpAttachmentEntity.setCategory("66");
|
String type =ctpFile.getType();
|
||||||
ctpAttachmentEntity.setCreatedate(new Date());
|
String filename =ctpFile.getFilename();
|
||||||
ctpAttachmentEntity.setDataSourceCode("HT-OA");
|
String mime_type =ctpFile.getMime_type();
|
||||||
ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity);
|
String attachment_size =ctpFile.getFile_size();
|
||||||
} else {
|
String id = String.valueOf(UUIDLong.longUUID());
|
||||||
if (ctpAttachmentEntities.size() > 1) {
|
ctpAttachmentEntity.setCategory(category);
|
||||||
throw new BaseSystemException("OA附件业务表中查到多条记录");
|
ctpAttachmentEntity.setFilename(filename);
|
||||||
|
ctpAttachmentEntity.setType(type);
|
||||||
|
ctpAttachmentEntity.setMime_type(mime_type);
|
||||||
|
ctpAttachmentEntity.setAttachment_size(attachment_size);
|
||||||
|
ctpAttachmentEntity.setId(id);
|
||||||
|
ctpAttachmentEntity.setCategory("66");
|
||||||
|
ctpAttachmentEntity.setCreatedate(new Date());
|
||||||
|
ctpAttachmentEntity.setDataSourceCode("HT-OA");
|
||||||
|
ctpAttachmentDao.saveCtpAttachment(ctpAttachmentEntity);
|
||||||
|
} else {
|
||||||
|
if (ctpAttachmentEntities.size() > 1) {
|
||||||
|
throw new BaseSystemException("OA附件业务表中查到多条记录");
|
||||||
|
}
|
||||||
|
//更新数据到OA附件业务表中
|
||||||
|
ctpAttachmentDao.updateCtpAttachment(ctpAttachmentEntity);
|
||||||
|
}
|
||||||
|
logger.info("=====电子回单执行完毕=======");
|
||||||
|
}else{
|
||||||
|
logger.info("========根据附件id:{}没有查询到附件信息======",jsonObjectOfd.getString("fileUrl"));
|
||||||
}
|
}
|
||||||
//更新数据到OA附件业务表中
|
|
||||||
ctpAttachmentDao.updateCtpAttachment(ctpAttachmentEntity);
|
|
||||||
}
|
}
|
||||||
logger.info("=====电子回单执行完毕=======");
|
file.delete();
|
||||||
|
}else{
|
||||||
|
logger.info("==========本地没有文件==============");
|
||||||
}
|
}
|
||||||
file.delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JSONObject fileUploadPdfAndOfd(File file) {
|
||||||
|
if (null != file) {
|
||||||
|
try {
|
||||||
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("file", file);
|
||||||
|
String url = "/seeyon/rest/attachment?token=@token@";//如果后面加上applicationCategory=1&extensions=&firstSave=true,附件业务自动生成一条记录
|
||||||
|
url = url.replaceAll("@token@", getToken());
|
||||||
|
String result = HttpUtil.post("http://60.204.152.210" + url, paramMap);
|
||||||
|
if (StrUtil.isNotBlank(result)) {
|
||||||
|
logger.info("附件上传结果"+result);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
String atts = jsonObject.get("atts").toString();
|
||||||
|
if (StrUtil.isNotEmpty(atts)) {
|
||||||
|
JSONArray jsonArray = JSONArray.parseArray(atts);
|
||||||
|
JSONObject res = (JSONObject) jsonArray.get(0);
|
||||||
|
String fileUrl = res.getString("fileUrl");
|
||||||
|
logger.info("附件id:" + fileUrl);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("附件上传失败"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getToken() {
|
||||||
|
//获取oatoken
|
||||||
|
HashMap<String, String> hashMap = new HashMap<>();
|
||||||
|
hashMap.put("userName", "hzyaRest");
|
||||||
|
hashMap.put("password", "a5ce21b8-91db-4cec-b3e3-3e44719655fd");
|
||||||
|
hashMap.put("loginName","bdmanager");
|
||||||
|
String result = HttpUtil.post("http://60.204.152.210" + "/seeyon/rest/token", JSON.toJSONString(hashMap));
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
if (null != jsonObject) {
|
||||||
|
logger.info(result);
|
||||||
|
logger.info("======token:{}======" + jsonObject.getString("id"));
|
||||||
|
return jsonObject.getString("id");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void downloadPdf(String pdfUrl, String savePath) {
|
private void downloadPdf(String pdfUrl, String savePath) {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(pdfUrl);
|
URL url = new URL(pdfUrl);
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
connection.setRequestMethod("Post");
|
// 处理 HTTPS 证书(测试环境忽略验证,生产环境需移除)
|
||||||
|
if (pdfUrl.startsWith("https")) {
|
||||||
|
trustAllCertificates((HttpsURLConnection) connection);
|
||||||
|
}
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
InputStream inputStream = connection.getInputStream();
|
InputStream inputStream = connection.getInputStream();
|
||||||
|
@ -371,6 +437,20 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void trustAllCertificates(HttpsURLConnection conn) throws Exception {
|
||||||
|
TrustManager[] trustAllCerts = new TrustManager[]{
|
||||||
|
new X509TrustManager() {
|
||||||
|
@Override public void checkClientTrusted(X509Certificate[] chain, String authType) {}
|
||||||
|
@Override public void checkServerTrusted(X509Certificate[] chain, String authType) {}
|
||||||
|
@Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||||
|
conn.setSSLSocketFactory(sslContext.getSocketFactory());
|
||||||
|
conn.setHostnameVerifier((hostname, session) -> true); // 忽略主机名验证
|
||||||
|
}
|
||||||
|
|
||||||
private String generateFileName(String url, String extension) {
|
private String generateFileName(String url, String extension) {
|
||||||
// 这里简单根据 URL 的参数生成文件名,你可以根据实际需求调整
|
// 这里简单根据 URL 的参数生成文件名,你可以根据实际需求调整
|
||||||
String[] parts = url.split("&");
|
String[] parts = url.split("&");
|
||||||
|
|
Loading…
Reference in New Issue