开票成功提交流程

This commit is contained in:
xiangerlin 2025-07-15 18:48:14 +08:00
parent 43ab21749e
commit 3c0433b336
1 changed files with 43 additions and 27 deletions

View File

@ -252,6 +252,23 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
saveTaskLivingDetails(entity.getSerial_number(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), true, "QueryInvoiceResultPluginInitializer"); 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{ }else{
logger.info("=======开始将开票结果回写OA======"); logger.info("=======开始将开票结果回写OA======");
String resultStatus = InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));//开票结果 String resultStatus = InvoiceState.invoiceStateGetValue(jsonResult.getString("resultStatus"));//开票结果
@ -263,35 +280,34 @@ public class InvoiceServiceImpl extends BaseService<InvoiceEntity, String> imple
saveTaskLivingDetails(entity.getSerial_number(), entity.getBusiness_no(), jsonObject.toJSONString(), resultJson.toJSONString(), false, "QueryInvoiceResultPluginInitializer"); 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 { }else {
//开票失败流程回退 暂时先不回退 还不稳定等稳定了再说 try {
//查询待办退回流程用这里只处理退回的情况如果要处理提交要等开票成功后才能提交 String message = attribute.getString("message");
ApplyInvoiceEntity applyInvoice = new ApplyInvoiceEntity(); if (StrUtil.isEmpty(message)){
applyInvoice.setId(entity.getSerial_number()); message = "申请单开具异常";
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); entity.setResult_status("申请单开具异常");
// applyInvoiceService.process(stepBack,"8000590006","ZZZH"); 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);
} }
} }
} }