package cn.iocoder.yudao.module.mes.service.trace.integrity; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.mes.controller.admin.trace.integrity.vo.MesTraceIntegrityRecordPageReqVO; import cn.iocoder.yudao.module.mes.controller.admin.trace.integrity.vo.MesTraceIntegrityVerifyRespVO; import cn.iocoder.yudao.module.mes.dal.dataobject.trace.consumer.MesTraceConsumerScanEventDO; import cn.iocoder.yudao.module.mes.dal.dataobject.trace.integrity.MesTraceIntegrityRecordDO; /** * 数据完整性 Service 接口 *
* 在批次创建、销售出库、消费者扫码等关键事件发生时,对不可变核心字段生成 SHA-256 摘要并存储;
* 提供重算比对能力,供管理端发现事后篡改。摘要生成失败不得阻断业务主流程。
*
* @author 超级管理员
*/
public interface MesTraceIntegrityService {
/**
* 生成并保存批次完整性摘要(code|itemId|lineCode|produceDate|planQuantity)
*
* @param batchId 批次编号
*/
void recordBatchIntegrity(Long batchId);
/**
* 生成并保存销售出库完整性摘要(code|clientId|salesDate|明细袋码/托盘码id列表)
*
* @param salesId 销售出库单编号
*/
void recordSalesIntegrity(Long salesId);
/**
* 生成并保存消费者扫码事件完整性摘要(normalizedCode|sourceType|province|city|success|eventTime)
*
* @param event 消费者扫码事件
*/
void recordScanIntegrity(MesTraceConsumerScanEventDO event);
/**
* 校验数据完整性:重算当前数据摘要,与存储摘要比对
*
* @param bizType 业务类型:BATCH / SALES / SCAN
* @param bizId 业务记录编号
* @return 校验结果
*/
MesTraceIntegrityVerifyRespVO verify(String bizType, Long bizId);
/**
* 获得数据完整性记录分页
*
* @param reqVO 查询条件
* @return 记录分页
*/
PageResult