-- ==========================================
-- Energy 模块 Mock 数据
-- 执行方式: 用数据库工具连接 47.103.115.36:3306 直接执行
-- 脚本会自动切换数据库
-- ==========================================

-- ==========================================
-- 第一部分: 在 oneos_asset 中插入关联 mock 数据
-- （如果已有真实数据，请跳过此部分，并修改下方 energy 数据中的 ID）
-- ==========================================
USE `oneos_asset`;

-- 3 个加氢站（停车场）
INSERT INTO `asset_parking` (`id`, `name`, `address`, `capacity`, `parked_amount`, `tenant_id`, `deleted`, `creator`, `create_time`, `updater`, `update_time`)
VALUES
(1001, '上海松江加氢站', '上海市松江区新桥镇莘砖公路368号', 50, 0, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(1002, '上海嘉定加氢站', '上海市嘉定区安亭镇墨玉南路888号', 30, 0, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(1003, '江苏昆山加氢站', '江苏省昆山市千灯镇石浦路199号', 40, 0, 0, b'0', 'admin', NOW(), 'admin', NOW())
ON DUPLICATE KEY UPDATE `name` = VALUES(`name`);

-- 3 个客户
INSERT INTO `asset_customer` (`id`, `customer_name`, `customer_code`, `coop_status`, `province`, `city`, `contact`, `contact_mobile`, `tenant_id`, `deleted`, `creator`, `create_time`, `updater`, `update_time`)
VALUES
(2001, '上海绿能物流有限公司', 'CUST-2026-001', '合作中', '上海', '上海', '张经理', '13800001001', 0, b'0', 'admin', NOW(), 'admin', NOW()),
(2002, '江苏氢动力运输有限公司', 'CUST-2026-002', '合作中', '江苏', '苏州', '李经理', '13800001002', 0, b'0', 'admin', NOW(), 'admin', NOW()),
(2003, '浙江新能源科技有限公司', 'CUST-2026-003', '合作中', '浙江', '杭州', '王经理', '13800001003', 0, b'0', 'admin', NOW(), 'admin', NOW())
ON DUPLICATE KEY UPDATE `customer_name` = VALUES(`customer_name`);

-- 6 辆车
INSERT INTO `asset_vehicle_base` (`id`, `vin`, `plate_no`, `vehicle_no`, `color`, `year`, `tenant_id`, `deleted`, `creator`, `create_time`, `updater`, `update_time`)
VALUES
(3001, 'LVBV1234567890001', '沪A12345', 'VH-001', '白色', '2025', 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3002, 'LVBV1234567890002', '沪B67890', 'VH-002', '蓝色', '2025', 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3003, 'LVBV1234567890003', '苏A11111', 'VH-003', '白色', '2024', 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3004, 'LVBV1234567890004', '苏B22222', 'VH-004', '绿色', '2024', 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3005, 'LVBV1234567890005', '浙A33333', 'VH-005', '白色', '2025', 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3006, 'LVBV1234567890006', '浙B44444', 'VH-006', '银色', '2025', 0, b'0', 'admin', NOW(), 'admin', NOW())
ON DUPLICATE KEY UPDATE `plate_no` = VALUES(`plate_no`);

-- 车辆业务关联
INSERT INTO `asset_vehicle_business` (`id`, `vehicle_id`, `customer_id`, `tenant_id`, `deleted`, `creator`, `create_time`, `updater`, `update_time`)
VALUES
(3001, 3001, 2001, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3002, 3002, 2001, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3003, 3003, 2002, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3004, 3004, 2002, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3005, 3005, 2003, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(3006, 3006, 2003, 0, b'0', 'admin', NOW(), 'admin', NOW())
ON DUPLICATE KEY UPDATE `customer_id` = VALUES(`customer_id`);

-- 3 个合同
INSERT INTO `asset_contract` (`id`, `contract_code`, `contract_type`, `project_name`, `start_date`, `end_date`, `payment_method`, `payment_cycle`, `signing_company`, `delivery_province`, `delivery_city`, `delivery_location`, `customer_id`, `customer_name`, `approval_status`, `contract_status`, `tenant_id`, `deleted`, `creator`, `create_time`, `updater`, `update_time`)
VALUES
(4001, 'HT-2026-001', 2, '绿能物流氢能车辆租赁项目', '2026-01-01', '2026-12-31', '预充值', '按次', '上海氢能科技有限公司', '上海', '上海', '上海市松江区', 2001, '上海绿能物流有限公司', 2, 2, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(4002, 'HT-2026-002', 2, '氢动力城配物流项目', '2026-01-01', '2026-12-31', '月结算', '月结', '上海氢能科技有限公司', '江苏', '苏州', '江苏省苏州市昆山市', 2002, '江苏氢动力运输有限公司', 2, 2, 0, b'0', 'admin', NOW(), 'admin', NOW()),
(4003, 'HT-2026-003', 2, '新能源冷链运输项目', '2026-02-01', '2027-01-31', '预充值', '按次', '上海氢能科技有限公司', '浙江', '杭州', '浙江省杭州市西湖区', 2003, '浙江新能源科技有限公司', 2, 2, 0, b'0', 'admin', NOW(), 'admin', NOW())
ON DUPLICATE KEY UPDATE `project_name` = VALUES(`project_name`);


-- ==========================================
-- 第二部分: Energy 模块 mock 数据
-- ==========================================
USE `oneos_energy`;

-- ----------------------------
-- 1. 加氢站配置（3 站）
-- ----------------------------
INSERT INTO `energy_station_config` (`id`, `station_id`, `auto_deduct`, `cooperation_type`, `auto_match`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
(1, 1001, 1, 0, 1, '松江站，自动扣款+自动匹配', 'admin', NOW(), 'admin', NOW(), b'0', 0),
(2, 1002, 1, 0, 1, '嘉定站，自动扣款+自动匹配', 'admin', NOW(), 'admin', NOW(), b'0', 0),
(3, 1003, 0, 1, 0, '昆山站，非合作站，手动匹配', 'admin', NOW(), 'admin', NOW(), b'0', 0);

-- ----------------------------
-- 2. 加氢站客户价格（6 条）
-- ----------------------------
INSERT INTO `energy_station_price` (`id`, `station_id`, `customer_id`, `cost_price`, `customer_price`, `effective_date`, `expiry_date`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
-- 松江站价格
(1, 1001, 2001, 28.00, 35.00, '2026-01-01', NULL, 0, 'admin', NOW(), 'admin', NOW(), b'0', 0),
(2, 1001, 2002, 28.00, 34.00, '2026-01-01', NULL, 0, 'admin', NOW(), 'admin', NOW(), b'0', 0),
-- 嘉定站价格
(3, 1002, 2001, 27.50, 35.00, '2026-01-01', NULL, 0, 'admin', NOW(), 'admin', NOW(), b'0', 0),
(4, 1002, 2002, 27.50, 33.50, '2026-01-01', NULL, 0, 'admin', NOW(), 'admin', NOW(), b'0', 0),
-- 昆山站价格
(5, 1003, 2003, 29.00, 36.00, '2026-02-01', NULL, 0, 'admin', NOW(), 'admin', NOW(), b'0', 0),
-- 已失效的旧价格
(6, 1001, 2001, 26.00, 33.00, '2025-06-01', '2025-12-31', 1, 'admin', NOW(), 'admin', NOW(), b'0', 0);

-- ----------------------------
-- 3. 加氢原始记录（20 条，覆盖多种状态）
-- ----------------------------
INSERT INTO `energy_hydrogen_record` (`id`, `station_id`, `plate_number`, `hydrogen_date`, `hydrogen_quantity`, `unit_price`, `amount`, `mileage`, `source_type`, `match_status`, `vehicle_id`, `customer_id`, `upload_batch_no`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
-- 已匹配记录（松江站，客户2001）
( 1, 1001, '沪A12345', '2026-03-01', 12.50, 35.00, 437.50, 15230.00, 1, 1, 3001, 2001, 'IMP20260305001A', 'admin', '2026-03-05 10:00:00', 'admin', '2026-03-05 10:00:00', b'0', 0),
( 2, 1001, '沪A12345', '2026-03-03', 15.00, 35.00, 525.00, 15580.00, 1, 1, 3001, 2001, 'IMP20260305001A', 'admin', '2026-03-05 10:00:00', 'admin', '2026-03-05 10:00:00', b'0', 0),
( 3, 1001, '沪B67890', '2026-03-02', 10.80, 35.00, 378.00, 8920.00,  1, 1, 3002, 2001, 'IMP20260305001A', 'admin', '2026-03-05 10:00:00', 'admin', '2026-03-05 10:00:00', b'0', 0),
( 4, 1001, '沪B67890', '2026-03-05', 13.20, 35.00, 462.00, 9200.00,  1, 1, 3002, 2001, 'IMP20260305001A', 'admin', '2026-03-05 10:00:00', 'admin', '2026-03-05 10:00:00', b'0', 0),
-- 已匹配记录（嘉定站，客户2002）
( 5, 1002, '苏A11111', '2026-03-01', 18.00, 33.50, 603.00, 22100.00, 1, 1, 3003, 2002, 'IMP20260306002B', 'admin', '2026-03-06 09:00:00', 'admin', '2026-03-06 09:00:00', b'0', 0),
( 6, 1002, '苏A11111', '2026-03-04', 16.50, 33.50, 552.75, 22450.00, 1, 1, 3003, 2002, 'IMP20260306002B', 'admin', '2026-03-06 09:00:00', 'admin', '2026-03-06 09:00:00', b'0', 0),
( 7, 1002, '苏B22222', '2026-03-02', 20.00, 33.50, 670.00, 18600.00, 1, 1, 3004, 2002, 'IMP20260306002B', 'admin', '2026-03-06 09:00:00', 'admin', '2026-03-06 09:00:00', b'0', 0),
( 8, 1002, '苏B22222', '2026-03-06', 14.80, 33.50, 495.80, 19010.00, 1, 1, 3004, 2002, 'IMP20260306002B', 'admin', '2026-03-06 09:00:00', 'admin', '2026-03-06 09:00:00', b'0', 0),
-- 已匹配记录（昆山站，客户2003）
( 9, 1003, '浙A33333', '2026-03-03', 22.00, 36.00, 792.00, 31200.00, 1, 1, 3005, 2003, 'IMP20260307003C', 'admin', '2026-03-07 14:00:00', 'admin', '2026-03-07 14:00:00', b'0', 0),
(10, 1003, '浙A33333', '2026-03-07', 19.50, 36.00, 702.00, 31800.00, 1, 1, 3005, 2003, 'IMP20260307003C', 'admin', '2026-03-07 14:00:00', 'admin', '2026-03-07 14:00:00', b'0', 0),
(11, 1003, '浙B44444', '2026-03-05', 17.00, 36.00, 612.00, 27500.00, 1, 1, 3006, 2003, 'IMP20260307003C', 'admin', '2026-03-07 14:00:00', 'admin', '2026-03-07 14:00:00', b'0', 0),
-- 未匹配记录（车牌在系统中不存在）
(12, 1001, '沪C99999', '2026-03-08', 11.00, 35.00, 385.00, NULL, 1, 0, NULL, NULL, 'IMP20260310004D', 'admin', '2026-03-10 11:00:00', 'admin', '2026-03-10 11:00:00', b'0', 0),
(13, 1001, '沪D88888', '2026-03-08', 9.50,  35.00, 332.50, NULL, 1, 0, NULL, NULL, 'IMP20260310004D', 'admin', '2026-03-10 11:00:00', 'admin', '2026-03-10 11:00:00', b'0', 0),
(14, 1002, '苏C77777', '2026-03-09', 14.00, 33.50, 469.00, NULL, 1, 0, NULL, NULL, 'IMP20260310004D', 'admin', '2026-03-10 11:00:00', 'admin', '2026-03-10 11:00:00', b'0', 0),
-- 无法匹配记录
(15, 1003, '京A00001', '2026-03-10', 8.00,  36.00, 288.00, NULL, 1, 2, NULL, NULL, 'IMP20260311005E', 'admin', '2026-03-11 09:00:00', 'admin', '2026-03-11 09:00:00', b'0', 0),
-- 手动录入（source_type=2）
(16, 1001, '沪A12345', '2026-03-10', 14.00, 35.00, 490.00, 16100.00, 2, 1, 3001, 2001, NULL, 'admin', '2026-03-10 16:00:00', 'admin', '2026-03-10 16:00:00', b'0', 0),
(17, 1002, '苏A11111', '2026-03-10', 17.50, 33.50, 586.25, 23100.00, 2, 1, 3003, 2002, NULL, 'admin', '2026-03-10 16:30:00', 'admin', '2026-03-10 16:30:00', b'0', 0),
-- 最新批次（未处理）
(18, 1001, '沪A12345', '2026-03-12', 11.80, 35.00, 413.00, 16500.00, 1, 1, 3001, 2001, 'IMP20260313006F', 'admin', '2026-03-13 10:00:00', 'admin', '2026-03-13 10:00:00', b'0', 0),
(19, 1001, '沪B67890', '2026-03-13', 16.00, 35.00, 560.00, 9800.00,  1, 1, 3002, 2001, 'IMP20260313006F', 'admin', '2026-03-13 10:00:00', 'admin', '2026-03-13 10:00:00', b'0', 0),
(20, 1002, '苏B22222', '2026-03-14', 13.00, 33.50, 435.50, 19500.00, 1, 1, 3004, 2002, 'IMP20260314007G', 'admin', '2026-03-14 08:00:00', 'admin', '2026-03-14 08:00:00', b'0', 0);

-- ----------------------------
-- 4. 加氢明细（15 条，对应已匹配的记录，覆盖不同审核/扣款/结算状态）
-- ----------------------------
INSERT INTO `energy_hydrogen_detail` (`id`, `record_id`, `station_id`, `vehicle_id`, `plate_number`, `hydrogen_date`, `hydrogen_quantity`, `cost_price`, `cost_amount`, `customer_price`, `customer_amount`, `contract_id`, `customer_id`, `project_name`, `cost_bearer`, `pay_method`, `audit_status`, `audit_remark`, `deduction_status`, `settlement_status`, `bill_id`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
-- 客户2001 明细（预充值，已审核+已扣款+已结算，关联账单1）
(1, 1, 1001, 3001, '沪A12345', '2026-03-01', 12.50, 28.00, 350.00, 35.00, 437.50, 4001, 2001, '绿能物流氢能车辆租赁项目', 1, 1, 1, '审核通过', 1, 1, 1, NULL, 'admin', '2026-03-05 10:30:00', 'admin', '2026-03-08 10:00:00', b'0', 0),
(2, 2, 1001, 3001, '沪A12345', '2026-03-03', 15.00, 28.00, 420.00, 35.00, 525.00, 4001, 2001, '绿能物流氢能车辆租赁项目', 1, 1, 1, '审核通过', 1, 1, 1, NULL, 'admin', '2026-03-05 10:30:00', 'admin', '2026-03-08 10:00:00', b'0', 0),
(3, 3, 1001, 3002, '沪B67890', '2026-03-02', 10.80, 28.00, 302.40, 35.00, 378.00, 4001, 2001, '绿能物流氢能车辆租赁项目', 1, 1, 1, '审核通过', 1, 1, 1, NULL, 'admin', '2026-03-05 10:30:00', 'admin', '2026-03-08 10:00:00', b'0', 0),
(4, 4, 1001, 3002, '沪B67890', '2026-03-05', 13.20, 28.00, 369.60, 35.00, 462.00, 4001, 2001, '绿能物流氢能车辆租赁项目', 1, 1, 1, '审核通过', 1, 1, 1, NULL, 'admin', '2026-03-05 10:30:00', 'admin', '2026-03-08 10:00:00', b'0', 0),

-- 客户2002 明细（月结算，已审核+未扣款+未结算，关联账单2）
(5, 5, 1002, 3003, '苏A11111', '2026-03-01', 18.00, 27.50, 495.00, 33.50, 603.00, 4002, 2002, '氢动力城配物流项目', 1, 2, 1, '审核通过', 0, 0, 2, NULL, 'admin', '2026-03-06 09:30:00', 'admin', '2026-03-09 09:00:00', b'0', 0),
(6, 6, 1002, 3003, '苏A11111', '2026-03-04', 16.50, 27.50, 453.75, 33.50, 552.75, 4002, 2002, '氢动力城配物流项目', 1, 2, 1, '审核通过', 0, 0, 2, NULL, 'admin', '2026-03-06 09:30:00', 'admin', '2026-03-09 09:00:00', b'0', 0),
(7, 7, 1002, 3004, '苏B22222', '2026-03-02', 20.00, 27.50, 550.00, 33.50, 670.00, 4002, 2002, '氢动力城配物流项目', 1, 2, 1, '审核通过', 0, 0, 2, NULL, 'admin', '2026-03-06 09:30:00', 'admin', '2026-03-09 09:00:00', b'0', 0),
(8, 8, 1002, 3004, '苏B22222', '2026-03-06', 14.80, 27.50, 407.00, 33.50, 495.80, 4002, 2002, '氢动力城配物流项目', 1, 2, 1, '审核通过', 0, 0, 2, NULL, 'admin', '2026-03-06 09:30:00', 'admin', '2026-03-09 09:00:00', b'0', 0),

-- 客户2003 明细（预充值，待审核，无账单）
( 9,  9, 1003, 3005, '浙A33333', '2026-03-03', 22.00, 29.00, 638.00, 36.00, 792.00, 4003, 2003, '新能源冷链运输项目', 1, 1, 0, NULL, 0, 0, NULL, NULL, 'admin', '2026-03-07 14:30:00', 'admin', '2026-03-07 14:30:00', b'0', 0),
(10, 10, 1003, 3005, '浙A33333', '2026-03-07', 19.50, 29.00, 565.50, 36.00, 702.00, 4003, 2003, '新能源冷链运输项目', 1, 1, 0, NULL, 0, 0, NULL, NULL, 'admin', '2026-03-07 14:30:00', 'admin', '2026-03-07 14:30:00', b'0', 0),
(11, 11, 1003, 3006, '浙B44444', '2026-03-05', 17.00, 29.00, 493.00, 36.00, 612.00, 4003, 2003, '新能源冷链运输项目', 1, 1, 0, NULL, 0, 0, NULL, NULL, 'admin', '2026-03-07 14:30:00', 'admin', '2026-03-07 14:30:00', b'0', 0),

-- 客户2001 最新明细（已审核，未结算，无账单 — 可用于生成新账单测试）
(12, 16, 1001, 3001, '沪A12345', '2026-03-10', 14.00, 28.00, 392.00, 35.00, 490.00, 4001, 2001, '绿能物流氢能车辆租赁项目', 1, 1, 1, '审核通过', 1, 0, NULL, NULL, 'admin', '2026-03-10 16:30:00', 'admin', '2026-03-11 10:00:00', b'0', 0),
(13, 18, 1001, 3001, '沪A12345', '2026-03-12', 11.80, 28.00, 330.40, 35.00, 413.00, 4001, 2001, '绿能物流氢能车辆租赁项目', 1, 1, 1, '审核通过', 1, 0, NULL, NULL, 'admin', '2026-03-13 10:30:00', 'admin', '2026-03-14 10:00:00', b'0', 0),
(14, 19, 1001, 3002, '沪B67890', '2026-03-13', 16.00, 28.00, 448.00, 35.00, 560.00, 4001, 2001, '绿能物流氢能车辆租赁项目', 1, 1, 1, '审核通过', 1, 0, NULL, NULL, 'admin', '2026-03-13 10:30:00', 'admin', '2026-03-14 10:00:00', b'0', 0),

-- 客户2002 已审核驳回明细
(15, 17, 1002, 3003, '苏A11111', '2026-03-10', 17.50, 27.50, 481.25, 33.50, 586.25, 4002, 2002, '氢动力城配物流项目', 1, 2, 2, '金额异常，请核实', 0, 0, NULL, '驳回后待重新审核', 'admin', '2026-03-10 17:00:00', 'admin', '2026-03-11 15:00:00', b'0', 0);

-- ----------------------------
-- 5. 能源账单（3 条，覆盖不同状态）
-- ----------------------------
INSERT INTO `energy_bill` (`id`, `bill_code`, `energy_type`, `customer_id`, `customer_name`, `contract_id`, `station_id`, `station_name`, `cooperation_type`, `bill_period_start`, `bill_period_end`, `receivable_amount`, `actual_amount`, `adjustment_amount`, `paid_amount`, `total_quantity`, `detail_count`, `status`, `audit_status`, `submit_status`, `payment_status`, `auditor_id`, `audit_time`, `audit_remark`, `generate_time`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
-- 账单1: 客户2001，已生成+已审核+已支付（完结状态）
(1, 'EB20260308140000A1B2', 0, 2001, '上海绿能物流有限公司', 4001, 1001, '上海松江加氢站', 1,
 '2026-03-01', '2026-03-07', 1802.50, 1802.50, 0.00, 1802.50, 51.50, 4, 1, 1, 1, 2,
 1, '2026-03-09 10:00:00', '审核通过，金额核对无误', '2026-03-08 14:00:00',
 'admin', '2026-03-08 14:00:00', 'admin', '2026-03-10 10:00:00', b'0', 0),

-- 账单2: 客户2002，已生成+待审核（月结算）
(2, 'EB20260309100000C3D4', 0, 2002, '江苏氢动力运输有限公司', 4002, 1002, '上海嘉定加氢站', 2,
 '2026-03-01', '2026-03-07', 2321.55, 2221.55, -100.00, 0.00, 69.30, 4, 1, 0, 0, 0,
 NULL, NULL, NULL, '2026-03-09 10:00:00',
 'admin', '2026-03-09 10:00:00', 'admin', '2026-03-09 10:00:00', b'0', 0),

-- 账单3: 客户2001 草稿（还没提交审核）
(3, 'EB20260314120000E5F6', 0, 2001, '上海绿能物流有限公司', 4001, 1001, '上海松江加氢站', 1,
 '2026-03-08', '2026-03-14', 1463.00, 1463.00, 0.00, 0.00, 41.80, 3, 0, 0, 0, 0,
 NULL, NULL, NULL, '2026-03-14 12:00:00',
 'admin', '2026-03-14 12:00:00', 'admin', '2026-03-14 12:00:00', b'0', 0);

-- ----------------------------
-- 6. 账单调整记录（2 条，关联账单2）
-- ----------------------------
INSERT INTO `energy_bill_adjustment` (`id`, `bill_id`, `detail_id`, `adjustment_type`, `amount`, `reason`, `attachment_urls`, `operator_id`, `operate_time`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
(1, 2, 8, 2, 80.00, '3月6日苏B22222加氢量数据偏高，与站点核对后减少80元', NULL, 1, '2026-03-10 11:00:00', 'admin', '2026-03-10 11:00:00', 'admin', '2026-03-10 11:00:00', b'0', 0),
(2, 2, NULL, 2, 20.00, '整单优惠减免20元', NULL, 1, '2026-03-10 11:30:00', 'admin', '2026-03-10 11:30:00', 'admin', '2026-03-10 11:30:00', b'0', 0);

-- ----------------------------
-- 7. 客户能源账户（3 个客户）
-- ----------------------------
INSERT INTO `energy_account` (`id`, `customer_id`, `balance`, `init_balance`, `accumulated_recharge`, `accumulated_hydrogen`, `accumulated_electric`, `accumulated_consume`, `reminder_threshold`, `account_status`, `last_recharge_date`, `version`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
-- 客户2001: 预充值模式，余额正常
(1, 2001, 47197.50, 0.00, 50000.00, 2802.50, 0.00, 2802.50, 5000.00, 0, '2026-03-01', 5,
 'admin', '2026-01-15 10:00:00', 'admin', '2026-03-14 12:00:00', b'0', 0),
-- 客户2002: 月结算模式，余额为零（月结不需要预充）
(2, 2002, 0.00, 0.00, 0.00, 2321.55, 0.00, 2321.55, NULL, 0, NULL, 2,
 'admin', '2026-01-15 10:00:00', 'admin', '2026-03-09 10:00:00', b'0', 0),
-- 客户2003: 预充值模式，余额预警
(3, 2003, 3894.00, 0.00, 6000.00, 2106.00, 0.00, 2106.00, 5000.00, 1, '2026-02-20', 3,
 'admin', '2026-02-01 10:00:00', 'admin', '2026-03-07 15:00:00', b'0', 0);

-- ----------------------------
-- 8. 项目账户（3 个项目，对应3个合同）
-- ----------------------------
INSERT INTO `energy_project_account` (`id`, `account_id`, `contract_id`, `project_name`, `project_balance`, `project_remit_amount`, `project_hydrogen_amount`, `project_electric_amount`, `project_consume_amount`, `reminder_threshold`, `account_status`, `version`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
(1, 1, 4001, '绿能物流氢能车辆租赁项目', 47197.50, 50000.00, 2802.50, 0.00, 2802.50, 5000.00, 0, 5,
 'admin', '2026-01-15 10:00:00', 'admin', '2026-03-14 12:00:00', b'0', 0),
(2, 2, 4002, '氢动力城配物流项目', 0.00, 0.00, 2321.55, 0.00, 2321.55, NULL, 0, 2,
 'admin', '2026-01-15 10:00:00', 'admin', '2026-03-09 10:00:00', b'0', 0),
(3, 3, 4003, '新能源冷链运输项目', 3894.00, 6000.00, 2106.00, 0.00, 2106.00, 5000.00, 1, 3,
 'admin', '2026-02-01 10:00:00', 'admin', '2026-03-07 15:00:00', b'0', 0);

-- ----------------------------
-- 9. 账户流水（12 条，覆盖充值/扣款场景）
-- ----------------------------
INSERT INTO `energy_account_flow` (`id`, `account_id`, `project_account_id`, `flow_type`, `amount`, `balance_before`, `balance_after`, `project_balance_before`, `project_balance_after`, `biz_type`, `biz_id`, `biz_code`, `remark`, `operator_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`)
VALUES
-- 客户2001 流水
(1, 1, 1, 1, 50000.00, 0.00, 50000.00, 0.00, 50000.00, 3, NULL, NULL, '首次充值', 1, 'admin', '2026-03-01 10:00:00', 'admin', '2026-03-01 10:00:00', b'0', 0),
(2, 1, 1, 2, -437.50, 50000.00, 49562.50, 50000.00, 49562.50, 1, 1, NULL, '沪A12345 2026-03-01 加氢扣款', NULL, 'admin', '2026-03-05 11:00:00', 'admin', '2026-03-05 11:00:00', b'0', 0),
(3, 1, 1, 2, -525.00, 49562.50, 49037.50, 49562.50, 49037.50, 1, 2, NULL, '沪A12345 2026-03-03 加氢扣款', NULL, 'admin', '2026-03-05 11:01:00', 'admin', '2026-03-05 11:01:00', b'0', 0),
(4, 1, 1, 2, -378.00, 49037.50, 48659.50, 49037.50, 48659.50, 1, 3, NULL, '沪B67890 2026-03-02 加氢扣款', NULL, 'admin', '2026-03-05 11:02:00', 'admin', '2026-03-05 11:02:00', b'0', 0),
(5, 1, 1, 2, -462.00, 48659.50, 48197.50, 48659.50, 48197.50, 1, 4, NULL, '沪B67890 2026-03-05 加氢扣款', NULL, 'admin', '2026-03-05 11:03:00', 'admin', '2026-03-05 11:03:00', b'0', 0),
(6, 1, 1, 2, -490.00, 48197.50, 47707.50, 48197.50, 47707.50, 1, 12, NULL, '沪A12345 2026-03-10 加氢扣款', NULL, 'admin', '2026-03-11 10:00:00', 'admin', '2026-03-11 10:00:00', b'0', 0),
(7, 1, 1, 2, -413.00, 47707.50, 47294.50, 47707.50, 47294.50, 1, 13, NULL, '沪A12345 2026-03-12 加氢扣款', NULL, 'admin', '2026-03-14 10:00:00', 'admin', '2026-03-14 10:00:00', b'0', 0),
(8, 1, 1, 2, -97.00, 47294.50, 47197.50, 47294.50, 47197.50, 1, 14, NULL, '沪B67890 2026-03-13 加氢扣款（部分）', NULL, 'admin', '2026-03-14 10:01:00', 'admin', '2026-03-14 10:01:00', b'0', 0),

-- 客户2003 流水
( 9, 3, 3, 1, 6000.00, 0.00, 6000.00, 0.00, 6000.00, 3, NULL, NULL, '首次充值', 1, 'admin', '2026-02-20 10:00:00', 'admin', '2026-02-20 10:00:00', b'0', 0),
(10, 3, 3, 2, -792.00, 6000.00, 5208.00, 6000.00, 5208.00, 1, 9, NULL, '浙A33333 2026-03-03 加氢扣款', NULL, 'admin', '2026-03-07 15:00:00', 'admin', '2026-03-07 15:00:00', b'0', 0),
(11, 3, 3, 2, -702.00, 5208.00, 4506.00, 5208.00, 4506.00, 1, 10, NULL, '浙A33333 2026-03-07 加氢扣款', NULL, 'admin', '2026-03-07 15:01:00', 'admin', '2026-03-07 15:01:00', b'0', 0),
(12, 3, 3, 2, -612.00, 4506.00, 3894.00, 4506.00, 3894.00, 1, 11, NULL, '浙B44444 2026-03-05 加氢扣款', NULL, 'admin', '2026-03-07 15:02:00', 'admin', '2026-03-07 15:02:00', b'0', 0);
