# ===============================================
# Reconciliation Service Kubernetes/异构部署配置
# 对账管理服务配置文件
# ===============================================

# 服务基本信息
service:
  name: reconciliation-service
  version: 1.0.0
  port: 8018
  description: "ERP对账管理服务 - 账单核对、差异处理"

# 数据库配置
database:
  host: "111.229.80.149"
  port: 3306
  name: "erp_db"
  username: "root"
  password: "nihao588+"
  params:
    useUnicode: true
    characterEncoding: utf8
    useSSL: false
    serverTimezone: "Asia/Shanghai"
    allowPublicKeyRetrieval: true
  pool:
    initial-size: 5
    min-idle: 5
    max-active: 20
    max-wait: 60000
    time-between-eviction-runs-millis: 60000
    min-evictable-idle-time-millis: 300000

# Redis配置（如果需要缓存）
redis:
  host: "111.229.80.149"
  port: 6379
  password: "Y(@r5tGk9$Lp2"
  database: 0
  timeout: 3000
  pool:
    max-active: 20
    max-idle: 10
    min-idle: 5
    max-wait: -1

# Nacos服务注册与配置
nacos:
  server-addr: "127.0.0.1:8848"
  namespace: "public"
  group: "DEFAULT_GROUP"
  cluster: "DEFAULT"

# 定时对账配置
reconciliation:
  task:
    core-pool-size: 5
    max-pool-size: 10
    queue-capacity: 100
  reconciliation:
    batch-size: 100
  # Cron表达式配置
  cron:
    daily: "0 0 2 * * ?"    # 每日凌晨2点执行日对账
    weekly: "0 0 3 * * MON"  # 每周一凌晨3点执行周对账
    monthly: "0 0 4 1 * ?"  # 每月1号凌晨4点执行月对账

# Feign客户端配置
feign:
  client:
    config:
      default:
        connect-timeout: 5000
        read-timeout: 10000
        logger-level: basic
  compression:
    request:
      enabled: true
    response:
      enabled: true

# 日志配置
logging:
  level:
    root: INFO
    com.erp.reconciliation: DEBUG
  pattern:
    console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
    file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
  file:
    name: logs/reconciliation-service.log
    max-size: 100MB
    max-history: 30

# Actuator监控配置
management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      show-details: always
  metrics:
    tags:
      application: ${spring.application.name}

# JVM调优参数
jvm:
  heap:
    initial: 256m
    maximum: 512m
  gc:
    collector: G1GC
  options:
    - "-XX:+UseG1GC"
    - "-XX:+HeapDumpOnOutOfMemoryError"
    - "-XX:HeapDumpPath=logs/heapdump.hprof"
    - "-Dfile.encoding=UTF-8"
    - "-Dsun.jnu.encoding=UTF-8"
