税务开票申请和查询开票结果
This commit is contained in:
parent
75bb5f87ad
commit
adf2c70d74
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,58 @@
|
||||||
|
package com.hzya.frame.plugin.ht.plugin;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.plugin.zxBank.plugin.ZxBankResultPluginInitializer;
|
||||||
|
import com.hzya.frame.seeyon.invoice.service.impl.InvoiceServiceImpl;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
public class QueryInvoiceResultPluginInitializer extends PluginBaseEntity {
|
||||||
|
Logger logger = LoggerFactory.getLogger(ZxBankResultPluginInitializer.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InvoiceServiceImpl invoiceService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginId() {
|
||||||
|
return "QueryInvoiceResultPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "查询开票申请详情插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "QueryInvoiceResultPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginType() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||||
|
try {
|
||||||
|
logger.info("======开始执行查询税务开票申请详情返回结果========");
|
||||||
|
return invoiceService.queryInvoiceResult(requestJson);
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("======执行查询税务开票申请详情返回结果失败:{}========",e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||||
<beans default-autowire="byName">
|
<beans default-autowire="byName">
|
||||||
<bean name="deliveryOrderPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.MakeInvoicePluginInitializer" />
|
<bean name="MakeInvoicePluginInitializer" class="com.hzya.frame.plugin.ht.plugin.MakeInvoicePluginInitializer" />
|
||||||
|
<bean name="InvoiceDistributePluginInitializer" class="com.hzya.frame.plugin.ht.plugin.InvoiceDistributePluginInitializer" />
|
||||||
|
<bean name="QueryInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInvoiceResultPluginInitializer" />
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -29,4 +29,34 @@ public interface IInvoiceDao extends IBaseDao<InvoiceEntity,String> {
|
||||||
* @Date 2025-04-07 14:05
|
* @Date 2025-04-07 14:05
|
||||||
* **/
|
* **/
|
||||||
List<InvoiceEntity> queryInvoiceResult(InvoiceEntity entity);
|
List<InvoiceEntity> queryInvoiceResult(InvoiceEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 更新推送标识
|
||||||
|
* @Param
|
||||||
|
* @Return
|
||||||
|
* @Author hecan
|
||||||
|
* @Date 2025-04-15 15:37
|
||||||
|
* **/
|
||||||
|
Integer updateInvoicePush(InvoiceEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 更新pdf和ofd附件到OA
|
||||||
|
* @Param
|
||||||
|
* @Return
|
||||||
|
* @Author hecan
|
||||||
|
* @Date 2025-04-14 10:27
|
||||||
|
* **/
|
||||||
|
Integer updateInvoiceUrl(InvoiceEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 更新发票代码,发票号码以及开票结果
|
||||||
|
* @Param
|
||||||
|
* @Return
|
||||||
|
* @Author hecan
|
||||||
|
* @Date 2025-04-14 16:35
|
||||||
|
* **/
|
||||||
|
Integer updateInvoiceResult(InvoiceEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,22 @@ public class InvoiceDaoImpl extends MybatisGenericDao<InvoiceEntity,String> impl
|
||||||
public List<InvoiceEntity> queryInvoiceResult(InvoiceEntity entity) {
|
public List<InvoiceEntity> queryInvoiceResult(InvoiceEntity entity) {
|
||||||
return (List<InvoiceEntity>) super.selectList("queryInvoiceResult",entity);
|
return (List<InvoiceEntity>) super.selectList("queryInvoiceResult",entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public Integer updateInvoicePush(InvoiceEntity entity) {
|
||||||
|
return super.update("updateInvoicePush",entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public Integer updateInvoiceUrl(InvoiceEntity entity) {
|
||||||
|
return super.update("updateInvoiceUrl",entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DS("#entity.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public Integer updateInvoiceResult(InvoiceEntity entity) {
|
||||||
|
return super.update("updateInvoiceResult",entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,16 @@ public class InvoiceEntity extends BaseEntity {
|
||||||
private String url;// 发票文件
|
private String url;// 发票文件
|
||||||
private String result_status;// 开票结果
|
private String result_status;// 开票结果
|
||||||
|
|
||||||
|
private String summaryId;//
|
||||||
|
|
||||||
|
public String getSummaryId() {
|
||||||
|
return summaryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSummaryId(String summaryId) {
|
||||||
|
this.summaryId = summaryId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPush_status_filed() {
|
public String getPush_status_filed() {
|
||||||
return push_status_filed;
|
return push_status_filed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,27 @@
|
||||||
from v_hzya_invoice where push_status is not null and url is null and (result_status is null or result_status='申请单处理中')
|
from v_hzya_invoice where push_status is not null and url is null and (result_status is null or result_status='申请单处理中')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--通过主键修改方法-->
|
||||||
|
<update id="updateInvoiceUrl" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
|
||||||
|
update ${tabName} set ${url_field} =#{url} where id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键修改方法-->
|
||||||
|
<update id="updateInvoicePush" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
|
||||||
|
update formmain_0331 set field0206 =#{push_status} where id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键修改方法-->
|
||||||
|
<update id="updateInvoiceResult" parameterType = "com.hzya.frame.seeyon.invoice.entity.InvoiceEntity" >
|
||||||
|
update ${tabName} set
|
||||||
|
<trim suffix="" suffixOverrides=",">
|
||||||
|
<if test="invoiceCode != null and invoiceCode != ''"> invoice_code_field = #{invoiceCode},</if>
|
||||||
|
<if test="invoiceNumber != null and invoiceNumber != ''"> invoice_number_field = #{invoiceNumber},</if>
|
||||||
|
<if test="resultStatus != null and resultStatus != ''"> result_status_field = #{resultStatus},</if>
|
||||||
|
</trim>
|
||||||
|
where id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -7,19 +7,24 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
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.entity.CtpAttachmentEntity;
|
||||||
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;
|
||||||
import com.hzya.frame.seeyon.invoice.entity.InvoiceState;
|
import com.hzya.frame.seeyon.invoice.entity.InvoiceState;
|
||||||
import com.hzya.frame.seeyon.invoice.service.IInvoiceService;
|
import com.hzya.frame.seeyon.invoice.service.IInvoiceService;
|
||||||
|
import com.hzya.frame.seeyon.util.OARestUtil;
|
||||||
import com.hzya.frame.seeyon.util.YzfSignUtil;
|
import com.hzya.frame.seeyon.util.YzfSignUtil;
|
||||||
import com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity;
|
import com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity;
|
||||||
import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl;
|
import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl;
|
||||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||||
|
import com.hzya.frame.uuid.UUIDLong;
|
||||||
import com.hzya.frame.uuid.UUIDUtils;
|
import com.hzya.frame.uuid.UUIDUtils;
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
@ -46,6 +51,8 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ComparisonServiceImpl comparisonServiceimpl;
|
private ComparisonServiceImpl comparisonServiceimpl;
|
||||||
|
@Autowired
|
||||||
|
private ICtpAttachmentDao ctpAttachmentDao;
|
||||||
|
|
||||||
@Value("${zt.url}")
|
@Value("${zt.url}")
|
||||||
private String url;
|
private String url;
|
||||||
|
@ -89,6 +96,37 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
//将查询出来的数据进行组装,调用通用方法新增或者更新
|
//将查询出来的数据进行组装,调用通用方法新增或者更新
|
||||||
if (null != listAll && listAll.size() > 0) {
|
if (null != listAll && listAll.size() > 0) {
|
||||||
object = ParametricDocument(listAll, mdmCode, tableName);
|
object = ParametricDocument(listAll, mdmCode, tableName);
|
||||||
|
if (CollectionUtils.isNotEmpty(object)) {
|
||||||
|
for (Object obj : object) {
|
||||||
|
//更新单据视图推送标识,不再抽取
|
||||||
|
JSONObject attributeResult = (JSONObject) JSON.toJSON(obj);
|
||||||
|
if (attributeResult.getString("status").equals("200")) {
|
||||||
|
String resultString = attributeResult.getString("list");
|
||||||
|
if ("10049".equals(mdmCode)) {
|
||||||
|
JSONArray jsonArray = JSONArray.parseArray(resultString);
|
||||||
|
if (CollectionUtils.isNotEmpty(jsonArray)) {
|
||||||
|
for (Object o : jsonArray) {
|
||||||
|
JSONObject attributeArray = (JSONObject) JSON.toJSON(o);
|
||||||
|
String cmpApply = attributeArray.getString(tableName);
|
||||||
|
JSONObject jsonObjectCmpApply = JSONObject.parseObject(cmpApply);
|
||||||
|
String id = jsonObjectCmpApply.getString("data_id");//主表id
|
||||||
|
String vdef1 = jsonObjectCmpApply.getString("business_no");//主表id
|
||||||
|
logger.info("=====开始根据单据id:{},单据号:{},更新表:formmain_0331的推送标识", id, vdef1);
|
||||||
|
InvoiceEntity invoiceEntity = new InvoiceEntity();
|
||||||
|
invoiceEntity.setPush_status("1");
|
||||||
|
invoiceEntity.setId(id);
|
||||||
|
invoiceEntity.setDataSourceCode(mdmModuleSourceEntity.getDataSourceCode());
|
||||||
|
invoiceDao.updateInvoicePush(invoiceEntity);
|
||||||
|
//保存业务数据日志
|
||||||
|
saveTaskLivingDetails(id, jsonObjectCmpApply.getString("business_no"), listAll.get(0).toString(), object.toString(), true,"MakeInvoicePluginInitializer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
saveTaskLivingDetails(JSONObject.parseObject(listAll.get(0).getString("mdm_invoice_application")).getString("data_id"), JSONObject.parseObject(listAll.get(0).getString("mdm_invoice_application")).getString("business_no"), listAll.get(0).toString(), JSON.parseObject(JSON.toJSONString(object)).getString("msg"), false,"MakeInvoicePluginInitializer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("三维单据视图数据没有需要同步中台的数据");
|
logger.info("三维单据视图数据没有需要同步中台的数据");
|
||||||
}
|
}
|
||||||
|
@ -145,27 +183,43 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
JSONArray jsonArray = jsonResult.getJSONArray("invoiceInfoVOList");
|
JSONArray jsonArray = jsonResult.getJSONArray("invoiceInfoVOList");
|
||||||
if(CollectionUtils.isNotEmpty(jsonArray)){
|
if(CollectionUtils.isNotEmpty(jsonArray)){
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
//表单的附件字段=ctpAttachment的Sub_reference,表单的Summary_id=ctpAttachment的att_reference
|
||||||
|
String sub_reference = String.valueOf(UUIDLong.longUUID());
|
||||||
|
String att_reference = entity.getSummaryId();//Summary_id
|
||||||
JSONObject invoiceInfo = jsonArray.getJSONObject(i);
|
JSONObject invoiceInfo = jsonArray.getJSONObject(i);
|
||||||
String invoiceCode = invoiceInfo.getString("invoiceCode");//发票代码
|
String invoiceCode = invoiceInfo.getString("invoiceCode");//发票代码
|
||||||
String invoiceNumber = invoiceInfo.getString("invoiceNumber");//发票号码
|
String invoiceNumber = invoiceInfo.getString("invoiceNumber");//发票号码
|
||||||
String resultStatus = InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));//开票结果
|
String resultStatus = InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));//开票结果
|
||||||
String pdfUrl = invoiceInfo.getString("url");//pdf文件
|
entity.setInvoice_code(invoiceCode);
|
||||||
String ofdUrl = invoiceInfo.getString("ofdUrl");//ofd文件
|
entity.setInvoice_number(invoiceNumber);
|
||||||
String xmlUrl = invoiceInfo.getString("xmlUrl");//xml文件
|
entity.setResult_status(resultStatus);
|
||||||
//获取pdf文件到本地 并为pdf取名,否则会报无法访问错误
|
//将开票结果,发票号码,发票代码,回写OA
|
||||||
logger.info("========开始将pdf文件保存到本地========");
|
invoiceDao.updateInvoiceResult(entity);
|
||||||
String pdfFileName = generateFileName(pdfUrl,"pdf");
|
if (null != invoiceInfo.getString("url") || null != invoiceInfo.getString("ofdUrl")) {
|
||||||
String pdfSavePath=invoicePdfUrl+pdfFileName;
|
String pdfUrl = invoiceInfo.getString("url");//pdf文件
|
||||||
downloadPdf(pdfUrl,pdfSavePath);
|
String ofdUrl = invoiceInfo.getString("ofdUrl");//ofd文件
|
||||||
logger.info("========pdf文件保存到本地完成========");
|
String xmlUrl = invoiceInfo.getString("xmlUrl");//xml文件
|
||||||
File filePdf=new File(pdfSavePath);
|
//获取pdf文件到本地 并为pdf取名,否则会报无法访问错误
|
||||||
//获取ofd文件到本地
|
logger.info("========开始将pdf文件保存到本地========");
|
||||||
logger.info("========开始将ofd文件保存到本地========");
|
String pdfFileName = generateFileName(pdfUrl, "pdf");
|
||||||
String ofdFileName = generateFileName(ofdUrl, "ofd");
|
String pdfSavePath = invoicePdfUrl + pdfFileName;
|
||||||
String ofdSavePath = ofdUrl + ofdFileName;
|
downloadPdf(pdfUrl, pdfSavePath);
|
||||||
downloadPdf(ofdUrl,ofdSavePath);
|
logger.info("========pdf文件保存到本地完成========");
|
||||||
logger.info("========ofd文件保存到本地完成========");
|
File filePdf = new File(pdfSavePath);
|
||||||
File fileOfd=new File(ofdSavePath);
|
logger.info("========开始将pdf文件上传OA========");
|
||||||
|
ManyfileUpload(filePdf, entity, sub_reference, att_reference, jsonObject);
|
||||||
|
logger.info("========pdf文件上传OA完成========");
|
||||||
|
//获取ofd文件到本地
|
||||||
|
logger.info("========开始将ofd文件保存到本地========");
|
||||||
|
String ofdFileName = generateFileName(ofdUrl, "ofd");
|
||||||
|
String ofdSavePath = ofdUrl + ofdFileName;
|
||||||
|
downloadPdf(ofdUrl, ofdSavePath);
|
||||||
|
logger.info("========ofd文件保存到本地完成========");
|
||||||
|
File fileOfd = new File(ofdSavePath);
|
||||||
|
logger.info("========开始将ofd文件上传OA========");
|
||||||
|
ManyfileUpload(fileOfd, entity, sub_reference, att_reference, jsonObject);
|
||||||
|
logger.info("========ofd文件上传OA完成========");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,6 +234,50 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ManyfileUpload(File file,InvoiceEntity entity,String sub_reference,String att_reference,JSONObject jsonObject){
|
||||||
|
JSONObject jsonObjectOfd = OARestUtil.fileUpload(file,"8000590003","8000590001");
|
||||||
|
if (jsonObjectOfd.getString("fileUrl") != null) {
|
||||||
|
entity.setUrl(sub_reference);
|
||||||
|
entity.setDataSourceCode("HT-OA");
|
||||||
|
invoiceDao.updateInvoiceUrl(entity);
|
||||||
|
//根据附件id查询附件业务数据
|
||||||
|
String file_url = jsonObjectOfd.getString("fileUrl");
|
||||||
|
CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity();
|
||||||
|
ctpAttachmentEntity.setFile_url(file_url);
|
||||||
|
ctpAttachmentEntity.setSub_reference(sub_reference);
|
||||||
|
ctpAttachmentEntity.setAtt_reference(att_reference);
|
||||||
|
ctpAttachmentEntity.setDataSourceCode("HT-OA");
|
||||||
|
List<CtpAttachmentEntity> ctpAttachmentEntities = ctpAttachmentDao.queryCtpAttachment(ctpAttachmentEntity);
|
||||||
|
//如果没有查询到数据,就新增附件业务,否则更新
|
||||||
|
if (ctpAttachmentEntities.size() == 0) {
|
||||||
|
String category = jsonObject.getString("category");
|
||||||
|
String type = jsonObject.getString("type");
|
||||||
|
String filename = jsonObject.getString("filename");
|
||||||
|
String mime_type = jsonObject.getString("mimeType");
|
||||||
|
String attachment_size = jsonObject.getString("size");
|
||||||
|
String id = String.valueOf(UUIDLong.longUUID());
|
||||||
|
ctpAttachmentEntity.setCategory(category);
|
||||||
|
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("=====电子回单执行完毕=======");
|
||||||
|
}
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -26,9 +26,9 @@ import java.util.List;
|
||||||
* @Date 2024/6/17 15:49
|
* @Date 2024/6/17 15:49
|
||||||
**/
|
**/
|
||||||
@Component
|
@Component
|
||||||
public class OARestUtil {
|
public class OARestUtil {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysApplicationApiService sysApplicationApiService;
|
private static ISysApplicationApiService sysApplicationApiService;
|
||||||
static Logger logger = LoggerFactory.getLogger(OARestUtil.class);
|
static Logger logger = LoggerFactory.getLogger(OARestUtil.class);
|
||||||
|
|
||||||
private OARestUtil() {
|
private OARestUtil() {
|
||||||
|
@ -41,14 +41,14 @@ public class OARestUtil {
|
||||||
* @param api_code 接口编码
|
* @param api_code 接口编码
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSONObject fileUpload(File file,String api_code) {
|
public static JSONObject fileUpload(File file,String api_code_upload,String api_code_token) {
|
||||||
if (StrUtil.isNotEmpty(api_code)){
|
if (StrUtil.isNotEmpty(api_code_upload)){
|
||||||
//1、查询附件上传api接口信息
|
//1、查询附件上传api接口信息
|
||||||
SysApplicationApiEntity sysApp = getByCode(api_code);
|
SysApplicationApiEntity sysApp = getByCode(api_code_upload);
|
||||||
if (null != sysApp){
|
if (null != sysApp){
|
||||||
String app_url = sysApp.getAppUrl();
|
String app_url = sysApp.getAppUrl();
|
||||||
String url = app_url+"/seeyon/rest/attachment?token=@token@";
|
String url = app_url+"/seeyon/rest/attachment?token=@token@";
|
||||||
String token = getToken(null,"8000240000");
|
String token = getToken(null,api_code_token);
|
||||||
url = url.replaceAll("@token@",token);
|
url = url.replaceAll("@token@",token);
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
paramMap.put("file", file);
|
paramMap.put("file", file);
|
||||||
|
@ -147,7 +147,7 @@ public class OARestUtil {
|
||||||
* @param api_code
|
* @param api_code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getToken(String login_name,String api_code){
|
public static String getToken(String login_name,String api_code){
|
||||||
if (StrUtil.isNotEmpty(api_code)){
|
if (StrUtil.isNotEmpty(api_code)){
|
||||||
SysApplicationApiEntity sysApp = getByCode(api_code);
|
SysApplicationApiEntity sysApp = getByCode(api_code);
|
||||||
return getToken(login_name,sysApp);
|
return getToken(login_name,sysApp);
|
||||||
|
@ -162,7 +162,7 @@ public class OARestUtil {
|
||||||
* @param sysApp 应用信息
|
* @param sysApp 应用信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getToken(String login_name,SysApplicationApiEntity sysApp){
|
public static String getToken(String login_name,SysApplicationApiEntity sysApp){
|
||||||
if (null != sysApp){
|
if (null != sysApp){
|
||||||
HashMap<String, String> hashMap = new HashMap<>();
|
HashMap<String, String> hashMap = new HashMap<>();
|
||||||
String app_url = StrUtil.removeSuffix(sysApp.getAppUrl(), "/");
|
String app_url = StrUtil.removeSuffix(sysApp.getAppUrl(), "/");
|
||||||
|
@ -190,7 +190,7 @@ public class OARestUtil {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
private SysApplicationApiEntity getByCode(String api_code){
|
private static SysApplicationApiEntity getByCode(String api_code){
|
||||||
if (StrUtil.isNotEmpty(api_code)){
|
if (StrUtil.isNotEmpty(api_code)){
|
||||||
SysApplicationApiEntity sysApp = new SysApplicationApiEntity();
|
SysApplicationApiEntity sysApp = new SysApplicationApiEntity();
|
||||||
sysApp.setApiCode(Long.valueOf(api_code));
|
sysApp.setApiCode(Long.valueOf(api_code));
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("三维单据视图数据没有需要同步中台的数据");
|
logger.info("杭泰付款单没有需要同步中信的数据");
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("杭泰付款单同步失败:{}",e.getMessage());
|
logger.info("杭泰付款单同步失败:{}",e.getMessage());
|
||||||
|
@ -301,8 +301,8 @@ public class ZxBankServiceImpl extends BaseService<ZxBankEntity, String> impleme
|
||||||
logger.info("====调用中信电子回单下载得请求参数密文为:{}=======",objectData.toJSONString());
|
logger.info("====调用中信电子回单下载得请求参数密文为:{}=======",objectData.toJSONString());
|
||||||
//因为电子回单下载返回的只有文件流,所以无法在中台上注册接口,只能代码中调用第三方接口
|
//因为电子回单下载返回的只有文件流,所以无法在中台上注册接口,只能代码中调用第三方接口
|
||||||
//将文件流的zip下载到文件夹中,之后解压该文件夹,得到pdf文件,上传OA
|
//将文件流的zip下载到文件夹中,之后解压该文件夹,得到pdf文件,上传OA
|
||||||
String downloadFolder ="D:\\yongansystem\\pdf\\";
|
String downloadFolder ="D:\\yongansystem\\zxbank\\pdf\\";
|
||||||
String destinationFolder ="D:\\yongansystem\\pdf\\";
|
String destinationFolder ="D:\\yongansystem\\zxbank\\pdf\\";
|
||||||
|
|
||||||
URL url = new URL("http://202.108.57.65:11370/access/treasury/hangtai/bill/down");
|
URL url = new URL("http://202.108.57.65:11370/access/treasury/hangtai/bill/down");
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
|
|
Loading…
Reference in New Issue