From 3c0433b3365da59c267694a15555931b5d856119 Mon Sep 17 00:00:00 2001 From: xiangerlin <251481237@qq.com> Date: Tue, 15 Jul 2025 18:48:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E7=A5=A8=E6=88=90=E5=8A=9F=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/InvoiceServiceImpl.java | 70 ++++++++++++------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/fw-oa/src/main/java/com/hzya/frame/seeyon/invoice/service/impl/InvoiceServiceImpl.java b/fw-oa/src/main/java/com/hzya/frame/seeyon/invoice/service/impl/InvoiceServiceImpl.java index 903842b9..c0de42fd 100644 --- a/fw-oa/src/main/java/com/hzya/frame/seeyon/invoice/service/impl/InvoiceServiceImpl.java +++ b/fw-oa/src/main/java/com/hzya/frame/seeyon/invoice/service/impl/InvoiceServiceImpl.java @@ -252,6 +252,23 @@ public class InvoiceServiceImpl extends BaseService imple saveTaskLivingDetails(entity.getSerial_number(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), true, "QueryInvoiceResultPluginInitializer"); } } + //开票成功,提交流程 + if (StrUtil.isNotEmpty(entity.getSerial_number()) && InvoiceState.one.getType().equals(jsonResult.getString("resultStatus"))){ + try { + logger.info("开票成功,准备提交流程"); + ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity(); + applyInvoice.setId(entity.getSerial_number()); + applyInvoice.setDataSourceCode("HT-OA"); + ApplyInvoiceEntity applyInvoiceEntity = applyInvoiceService.queryAffair(applyInvoice); + if (null != applyInvoiceEntity){ + String finish = applyInvoiceService.finishValueOf(applyInvoiceEntity.getWorkitem_id(), InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"))); + applyInvoiceService.process(finish,"8000590007","ZZZH"); + } + }catch (Exception e){ + logger.error("开票成功,流程提交报错:{}}",e); + } + } + }else{ logger.info("=======开始将开票结果回写OA======"); String resultStatus = InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));//开票结果 @@ -263,35 +280,34 @@ public class InvoiceServiceImpl extends BaseService imple saveTaskLivingDetails(entity.getSerial_number(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false, "QueryInvoiceResultPluginInitializer"); } } - //开票成功,提交流程 - if (StrUtil.isNotEmpty(entity.getSerial_number())){ - try { - ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity(); - applyInvoice.setId(entity.getSerial_number()); - applyInvoice.setDataSourceCode("HT-OA"); - ApplyInvoiceEntity applyInvoiceEntity = applyInvoiceService.queryAffair(applyInvoice); - if (null != applyInvoiceEntity){ - String finish = applyInvoiceService.finishValueOf(applyInvoiceEntity.getWorkitem_id(), InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"))); - applyInvoiceService.process(finish,"8000590007","ZZZH"); - } - }catch (Exception e){ - logger.error("开票成功,流程提交报错:{}}",e); - } - } }else { - //开票失败,流程回退 暂时先不回退 还不稳定,等稳定了再说 - //查询待办,退回流程用,这里只处理退回的情况,如果要处理提交,要等开票成功后才能提交, - ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity(); - applyInvoice.setId(entity.getSerial_number()); - applyInvoice.setDataSourceCode("HT-OA"); - ApplyInvoiceEntity applyInvoiceEntity = applyInvoiceService.queryAffair(applyInvoice); - if (null != applyInvoiceEntity){ - String resultMsg = attribute.getString("resultMsg"); - if (StrUtil.isEmpty(resultMsg)){ - resultMsg = "开票失败"; + try { + String message = attribute.getString("message"); + if (StrUtil.isEmpty(message)){ + message = "申请单开具异常"; } - // String stepBack = applyInvoiceService.stepBackValueOf(applyInvoiceEntity.getWorkitem_id(), resultMsg); - // applyInvoiceService.process(stepBack,"8000590006","ZZZH"); + entity.setResult_status("申请单开具异常"); + entity.setFailure_reason(message); + entity.setId(entity.getSerial_number()); + if (StrUtil.isNotEmpty(entity.getId())){ + invoiceDao.updateInvoiceResult(entity); + } + //开票失败,流程回退 暂时先不回退 还不稳定,等稳定了再说 + //查询待办,退回流程用,这里只处理退回的情况,如果要处理提交,要等开票成功后才能提交, + ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity(); + applyInvoice.setId(entity.getSerial_number()); + applyInvoice.setDataSourceCode("HT-OA"); + ApplyInvoiceEntity applyInvoiceEntity = applyInvoiceService.queryAffair(applyInvoice); + if (null != applyInvoiceEntity){ + String resultMsg = attribute.getString("resultMsg"); + if (StrUtil.isEmpty(resultMsg)){ + resultMsg = "开票失败"; + } + // String stepBack = applyInvoiceService.stepBackValueOf(applyInvoiceEntity.getWorkitem_id(), resultMsg); + // applyInvoiceService.process(stepBack,"8000590006","ZZZH"); + } + }catch(Exception e){ + logger.error("查询杭泰开票申请结果出错:{}",e); } } }