```mermaid
---
title: 0.资产导入流程
---
flowchart TD
    Start((开始))
    --> Login[使用平台管理员或平台运营账号登录]

    Login --> HasPermission{是否有资产导入权限?}
    HasPermission -->|否| NoPermission[无权限，流程终止]
    HasPermission -->|是| EnterImportPage[进入资产导入页面]

    EnterImportPage --> SelectType{选择导入类型}
    SelectType -->|IoT卡导入| IotImport[进入 IoT卡导入]
    SelectType -->|设备导入| DeviceImport[进入 设备导入]

    subgraph PrepareAndSubmitFlow[准备文件与提交任务]
        IotImport --> DownloadTemplate[下载最新导入模板]
        DeviceImport --> DownloadTemplate

        DownloadTemplate --> FillExcel[按模板填写 Excel 数据]
        FillExcel --> FileReady{文件格式与内容是否合规?}
        FileReady -->|否| FixExcel[修正文件后重新检查]
        FixExcel --> FillExcel

        FileReady -->|是| UploadExcel[上传导入文件]
        UploadExcel --> SubmitTask[提交导入任务]
        SubmitTask --> TaskCreated[导入任务创建成功]
    end

    subgraph TaskProcessFlow[任务处理与结果查看]
        TaskCreated --> OpenTaskList[进入导入任务列表]
        OpenTaskList --> CheckStatus{任务状态}

        CheckStatus -->|待处理/处理中| WaitAndRefresh[等待处理并刷新列表]
        WaitAndRefresh --> OpenTaskList

        CheckStatus -->|失败| OpenTaskDetail[查看任务详情]
        CheckStatus -->|已完成| OpenTaskDetail

        OpenTaskDetail --> CheckResult[查看成功数/跳过数/失败数<br/>设备导入同时查看警告记录]
        CheckResult --> NeedRetry{是否需要修正后重导?}

        NeedRetry -->|是| FixSourceData[修正源数据后重新导入]
        FixSourceData --> UploadExcel
        NeedRetry -->|否| GoVerifyAssets[进入资产数据验收]
    end

    subgraph VerifyFlow[导入结果验收]
        GoVerifyAssets --> VerifyType{验收类型}

        VerifyType -->|IoT卡| VerifyIot[在 IoT卡列表核对<br/>ICCID/接入号/虚拟号/批次信息]
        VerifyType -->|设备| VerifyDevice[在 设备列表核对<br/>设备虚拟号/设备信息/卡绑定关系]

        VerifyIot --> VerifyPass{验收是否通过?}
        VerifyDevice --> VerifyPass

        VerifyPass -->|否| BackToRetry[返回修正数据后重导]
        BackToRetry --> FixSourceData
        VerifyPass -->|是| End([流程结束])
    end

    %% ==================== 样式美化 ====================
    style Start fill:#90EE90,stroke:#2E7D32,stroke-width:2px
    style End fill:#FF9999,stroke:#C62828,stroke-width:2px
    style NoPermission fill:#FFCDD2,stroke:#D32F2F
    style FixExcel fill:#FFCCBC,stroke:#E64A19
    style FixSourceData fill:#FFCCBC,stroke:#E64A19
    style BackToRetry fill:#FFCCBC,stroke:#E64A19

    classDef decision fill:#FFF3E0,stroke:#F57C00,stroke-width:2px
    class HasPermission,SelectType,FileReady,CheckStatus,NeedRetry,VerifyType,VerifyPass decision
```
