3 小时以前 b29d86d9ed34fd890eb14cb7a75f6ae4f7148865
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 接口
 * <p>
 * 在批次创建、销售出库、消费者扫码等关键事件发生时,对不可变核心字段生成 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<MesTraceIntegrityRecordDO> getIntegrityPage(MesTraceIntegrityRecordPageReqVO reqVO);
 
}