feat: HCS开票收票数据层与零埋点接线(实体合规字段组/收票合同补录字段/审批与金蝶开票回写置待同步)

This commit is contained in:
刘泉佳
2026-09-27 23:51:07 +08:00
parent d6561dda17
commit 165c22c2d7
5 changed files with 54 additions and 0 deletions
@@ -179,4 +179,14 @@ public class InvoiceApplication extends TenantEntity {
* 作废原因,驳回时记录驳回原因
*/
private String voidReason;
/** 合规系统单据ID(fdId) */
private String hcsFdId;
/** 合规同步状态:unsynced 待同步 / synced 已同步 / failed 同步失败 */
private String hcsSyncStatus;
/** 合规推送失败重试次数 */
private Integer hcsRetryCount;
/** 合规最近同步时间 */
private LocalDateTime hcsSyncTime;
/** 合规最近同步结果信息/失败原因 */
private String hcsSyncMsg;
}
@@ -176,4 +176,18 @@ public class InvoiceReceipt extends TenantEntity {
* 作废原因
*/
private String voidReason;
/** 合规系统单据ID(fdId) */
private String hcsFdId;
/** 合规同步状态:unsynced 待同步 / synced 已同步 / failed 同步失败 */
private String hcsSyncStatus;
/** 合规推送失败重试次数 */
private Integer hcsRetryCount;
/** 合规最近同步时间 */
private LocalDateTime hcsSyncTime;
/** 合规最近同步结果信息/失败原因 */
private String hcsSyncMsg;
/** 合规推送合同ID(应付结算回溯不到时人工补录,D13) */
private Long hcsContractId;
/** 合规推送合同编号(应付结算回溯不到时人工补录,D13) */
private String hcsContractNo;
}
@@ -52,6 +52,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiOpenApiResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPageVO;
import org.springblade.thirdparty.bfi.service.IBfiService;
import org.springblade.transport.config.BfiProperties;
import org.springblade.transport.constant.HcsSyncConstant;
import org.springblade.transport.constant.KingdeeBfiConstant;
import org.springblade.transport.constant.TransportBusiConstant;
import org.springblade.transport.mapper.ContractManageMapper;
@@ -886,6 +887,8 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
invoiceWritten += inserted;
// 查到发票:开票申请单推进开票完成(终态)
application.setKingdeeStatus(KingdeeBfiConstant.KINGDEE_STATUS_INVOICED);
// HCS 开票登记待更新:扫描任务凭 hcs_fd_id 走 C111-3 回填票据日期(D12)
application.setHcsSyncStatus(HcsSyncConstant.HCS_STATUS_UNSYNCED);
toUpdateApplications.add(application);
invoicedCount++;
log.info("金蝶开票结果回写:开票申请[{}]状态推进为invoiced,本次写入发票{}张", application.getApplicationNo(), inserted);
@@ -1239,6 +1242,10 @@ public class InvoiceApplicationServiceImpl extends BaseServiceImpl<InvoiceApplic
InvoiceApplication entity = existing(id);
if (!from.equals(entity.getApprovalStatus())) throw new ServiceException("当前状态不允许此操作");
entity.setApprovalStatus(to);
if (TransportBusiConstant.APPROVED.equals(to)) {
// HCS 推送零埋点:审批通过仅置待同步状态,扫描任务据此推开票登记(ADR-0001/D12)
entity.setHcsSyncStatus(HcsSyncConstant.HCS_STATUS_UNSYNCED);
}
entity.setCurrentNode(node);
entity.setCurrentProcessor(AuthUtil.getUserName());
updateById(entity);
@@ -44,6 +44,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiInvoicePoolVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPageVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiReceivedInvoiceVO;
import org.springblade.thirdparty.bfi.service.IBfiService;
import org.springblade.transport.constant.HcsSyncConstant;
import org.springblade.transport.constant.KingdeeBfiConstant;
import org.springblade.transport.constant.TransportBusiConstant;
import org.springblade.transport.mapper.CustomerArchiveMapper;
@@ -1413,6 +1414,10 @@ public class InvoiceReceiptServiceImpl extends BaseServiceImpl<InvoiceReceiptMap
String actionName, String reason) {
String fromStatus = entity.getApprovalStatus();
entity.setApprovalStatus(toStatus);
if (TransportBusiConstant.APPROVED.equals(toStatus)) {
// HCS 推送零埋点:审批通过仅置待同步状态,扫描任务据此推收票单(ADR-0001)
entity.setHcsSyncStatus(HcsSyncConstant.HCS_STATUS_UNSYNCED);
}
entity.setCurrentNode(actionName);
entity.setCurrentProcessor(AuthUtil.getUserName());
updateById(entity);
@@ -0,0 +1,18 @@
-- 桂物合同合规系统(HCS)接入:收票单合同补录字段(设计文档 §4,P4,D13)。
-- blade_invoice_receipt 追加合同补录字段:应付结算链路回溯不到时页面人工补录。
-- 通过 information_schema 判断字段是否存在,可重复执行。
SET @db_name = DATABASE();
SET @sql = IF(
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = @db_name AND table_name = 'blade_invoice_receipt' AND column_name = 'hcs_contract_id'),
'SELECT 1',
'ALTER TABLE blade_invoice_receipt ADD COLUMN hcs_contract_id bigint DEFAULT NULL COMMENT ''合规推送合同ID(应付结算回溯不到时人工补录)'''
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
SET @sql = IF(
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = @db_name AND table_name = 'blade_invoice_receipt' AND column_name = 'hcs_contract_no'),
'SELECT 1',
'ALTER TABLE blade_invoice_receipt ADD COLUMN hcs_contract_no varchar(64) DEFAULT NULL COMMENT ''合规推送合同编号(应付结算回溯不到时人工补录)'''
);
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;