{
  "name": "销售数据生成处理",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 3 * * *"
            }
          ]
        }
      },
      "id": "schedule-trigger",
      "name": "每日凌晨3点执行",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [250, 300]
    },
    {
      "parameters": {
        "resource": "command",
        "operation": "execute",
        "command": "source venv/bin/activate && python app/core/data_flow/sales_data_generator.py --update-mode append --count 50",
        "cwd": "/opt/dataops-platform"
      },
      "id": "execute-python-script",
      "name": "执行销售数据生成",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [500, 300],
      "credentials": {
        "sshPassword": {
          "id": "pYTwwuyC15caQe6y",
          "name": "SSH Password account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "condition-success",
              "leftValue": "={{ $json.code }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "check-result",
      "name": "检查执行结果",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [750, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "result-success",
              "name": "status",
              "value": "success",
              "type": "string"
            },
            {
              "id": "result-message",
              "name": "message",
              "value": "销售数据生成成功",
              "type": "string"
            },
            {
              "id": "result-output",
              "name": "output",
              "value": "={{ $json.stdout }}",
              "type": "string"
            },
            {
              "id": "result-time",
              "name": "executionTime",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "success-output",
      "name": "成功响应",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1000, 200]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "error-status",
              "name": "status",
              "value": "error",
              "type": "string"
            },
            {
              "id": "error-message",
              "name": "message",
              "value": "销售数据生成失败",
              "type": "string"
            },
            {
              "id": "error-output",
              "name": "error",
              "value": "={{ $json.stderr }}",
              "type": "string"
            },
            {
              "id": "error-code",
              "name": "exitCode",
              "value": "={{ $json.code }}",
              "type": "number"
            },
            {
              "id": "error-time",
              "name": "executionTime",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "error-output",
      "name": "失败响应",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1000, 400]
    }
  ],
  "connections": {
    "每日凌晨3点执行": {
      "main": [
        [
          {
            "node": "执行销售数据生成",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "执行销售数据生成": {
      "main": [
        [
          {
            "node": "检查执行结果",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "检查执行结果": {
      "main": [
        [
          {
            "node": "成功响应",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "失败响应",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true
  },
  "meta": {
    "templateCredsSetupCompleted": true,
    "description": "销售数据（test_sales_data）测试数据生成工作流。每日凌晨3点自动执行，生成50条测试销售数据，使用追加模式。"
  }
}

