# 端口
server:
  port: 9200
# 多环境配置
spring:
  profiles:
    active: dev
#    active: glt
#    active: prod

  application:
    name: server

  # 允许循环引用（临时解决方案）
  main:
    allow-circular-references: true

  # 修复 Springfox 与 Spring Boot 2.6+ 兼容性问题
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

  # json时间格式设置
  jackson:
    time-zone: GMT+8
    date-format: yyyy-MM-dd HH:mm:ss
    serialization:
      write-dates-as-timestamps: false
    deserialization:
      fail-on-unknown-properties: false
    # 确保启用Java 8时间支持
    modules:
      - com.fasterxml.jackson.datatype.jsr310.JavaTimeModule

  # 连接池配置
  datasource:
    druid:
      initial-size: 5
      min-idle: 5
      max-active: 20
      max-wait: 30000
      time-between-eviction-runs-millis: 60000
      min-evictable-idle-time-millis: 300000
      test-while-idle: true
      test-on-borrow: true
      test-on-return: false
      remove-abandoned: true
      remove-abandoned-timeout: 1800
      #pool-prepared-statements: false
      #max-pool-prepared-statement-per-connection-size: 20
      filters: stat, wall
      validation-query: SELECT 'x'
      aop-patterns: com.gxwebsoft.*.*.service.*
      stat-view-servlet:
        url-pattern: /druid/*
        reset-enable: true
        login-username: admin
        login-password: admin

  # 设置上传文件大小
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB

  # 邮件服务器配置
  mail:
    host: smtp.qq.com
    username: 170083662@qq.com
    password: mnfokualhfaucaie
    default-encoding: UTF-8
    properties:
      mail:
        smtp:
          auth: true
          socketFactory:
            class: javax.net.ssl.SSLSocketFactory
            port: 465

# Mybatis-plus配置
mybatis-plus:
  mapper-locations: classpath*:com/gxwebsoft/**/*Mapper.xml
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: true
  global-config:
    banner: false
    # SqlRunner.db().xxx 需要开启该开关，否则会报：
    # Mapped Statements collection does not contain value for com.baomidou.mybatisplus.core.mapper.SqlRunner.Delete
    enable-sql-runner: true
    db-config:
      id-type: auto
      logic-delete-value: 1
      logic-not-delete-value: 0

# 框架配置
config:
  open-office-home: C:/OpenOffice4/
  swagger-base-package: com.gxwebsoft
  swagger-title: 网宿软件 API文档
  swagger-description: websoft - 基于java spring、vue3、antd构建的前后端分离快速开发框架
  swagger-version: 2.0
  token-key: WLgNsWJ8rPjRtnjzX/Gx2RGS80Kwnm/ZeLbvIL+NrBs=
  # 主服务器
  server-url: https://server.websoft.top/api
  # 文件服务器
  file-server: https://file.websoft.top
  # 其他
  api-url: https://server.websoft.top/api
  upload-path: /Users/gxwebsoft/Documents/uploads
  local-upload-path: /Users/gxwebsoft/Documents/uploads

  # 阿里云OSS云存储
  endpoint: https://oss-cn-shenzhen.aliyuncs.com
  accessKeyId: LTAI4GKGZ9Z2Z8JZ77c3GNZP
  accessKeySecret: BiDkpS7UXj72HWwDWaFZxiXjNFBNCM
  bucketName: oss-gxwebsoft
  bucketDomain: https://oss.wsdns.cn
  aliyunDomain: https://oss-gxwebsoft.oss-cn-shenzhen.aliyuncs.com

# 商城订单配置
shop:
  order:
    # 测试账号配置
    test-account:
      enabled: true  # 禁用测试账号功能
      phone-numbers:
        - "19163679581"  # 改为其他测试手机号
      test-pay-amount: 0.01

    # 租户特殊规则配置
    #    tenant-rules:
    #      - tenant-id: 10324
    #        tenant-name: "百色中学"
    #        min-amount: 10
    #        min-amount-message: "捐款金额最低不能少于10元，感谢您的爱心捐赠^_^"
    #        enabled: true

    # 默认配置
    default-config:
      default-title: "订单名称"
      default-comments: "暂无"
      min-order-amount: 0
      order-timeout-minutes: 30

    # 订单自动取消配置
    auto-cancel:
      # 是否启用自动取消功能
      enabled: true
      # 默认超时时间（分钟）
      default-timeout-minutes: 30
      # 定时任务检查间隔（分钟）
      check-interval-minutes: 1
      # 批量处理大小
      batch-size: 100
      # 定时任务执行时间（cron表达式）
      # 生产环境：每5分钟执行一次
      cron: "0 */5 * * * ?"

        # 租户特殊配置
        #      tenant-configs:
        #        - tenant-id: 10324
        #          tenant-name: "百色中学"
        #          timeout-minutes: 120  # 捐款订单给更长的支付时间
        #          enabled: true
        # 可以添加更多租户配置
        # - tenant-id: 10550
        #   tenant-name: "其他租户"
        #   timeout-minutes: 15
      #   enabled: true

# 证书配置
certificate:
  # 证书加载模式: CLASSPATH, FILESYSTEM, VOLUME
  load-mode: CLASSPATH
  # Docker挂载卷证书路径
  cert-root-path: /app/certs
  # 开发环境证书路径前缀
  dev-cert-path: dev

  # 微信支付证书配置
  wechat-pay:
    dev:
      api-v3-key: "0kF5OlPr482EZwtn9zGufUcqa7ovgxRL"
      private-key-file: "apiclient_key.pem"
      apiclient-cert-file: "apiclient_cert.pem"
      wechatpay-cert-file: "wechatpay_cert.pem"
    prod-base-path: "/file"
    cert-dir: "wechat"

  # 支付宝证书配置
  alipay:
    cert-dir: "alipay"
    app-private-key-file: "app_private_key.pem"
    app-cert-public-key-file: "appCertPublicKey.crt"
    alipay-cert-public-key-file: "alipayCertPublicKey.crt"
    alipay-root-cert-file: "alipayRootCert.crt"

# 启用 SpringDoc OpenAPI
springdoc:
  api-docs:
    enabled: true
  swagger-ui:
    enabled: true

# AI 模块（Ollama）
ai:
  ollama:
    base-url: https://ai-api.websoft.top
    fallback-url: http://47.119.165.234:11434
    chat-model: qwen3.5:cloud
    embed-model: qwen3-embedding:4b
    connect-timeout-ms: 10000
    read-timeout-ms: 300000
    write-timeout-ms: 60000
    max-concurrency: 4
    rag-max-candidates: 2000
    rag-top-k: 5
    rag-chunk-size: 800
    rag-chunk-overlap: 120

# LED - 排班接口（业务中台）对接配置
led:
  bme:
    base-url: ${LED_BME_BASE_URL:http://16.1.4.201:7979}
    appid: ${LED_BME_APPID:BQ73n58Lf}
    secret-key: ${LED_BME_SECRET_KEY:jk720-DCPnGq@5t8}
    mechanism-id: ${LED_BME_MECHANISM_ID:10001}
    default-ext-user-id: ${LED_BME_DEFAULT_EXT_USER_ID:txzhyy}
    default-hospital-id: ${LED_BME_DEFAULT_HOSPITAL_ID:}
    timeout-ms: ${LED_BME_TIMEOUT_MS:10000}

# 启用 Knife4j
knife4j:
  enable: true

# 优惠券配置
coupon:
  # 过期处理定时任务配置
  expire:
    # 定时任务执行时间（cron表达式）
    # 生产环境：每天凌晨2点执行
    # 开发环境：每10分钟执行一次
    cron: "0 0 2 * * ?"
    # 开发环境可以设置为: "0 */10 * * * ?"

  # 状态管理配置
  status:
    # 是否启用自动状态更新
    auto-update: true
    # 批量处理大小
    batch-size: 1000

# 支付配置
payment:
  # 开发环境配置
  dev:
    # 开发环境回调地址（本地调试用）
    notify-url: "https://glt-dev-api.websoft.top/api/shop/shop-order/notify"
    # 开发环境是否启用环境感知
    environment-aware: true

  # 生产环境配置
  prod:
    # 生产环境回调地址
    notify-url: "https://cms-api.websoft.top/api/shop/shop-order/notify"
    # 生产环境是否启用环境感知
    environment-aware: false
