Files
dingding-oa-server/README.md
2026-05-27 14:12:10 +08:00

3.3 KiB
Raw Blame History

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

定时脚本

sudo crontab -l 0 */6 * * * curl http://localhost:3000/api/dingding/corn >> /var/log/cron_dingding.log 2>&1 每六个小时执行一次脚本将数据注入到数据库

通用Excel导入接口

项目提供了一个通用的Excel数据导入接口可以用于向不同的数据表导入数据。

接口地址

POST /api/utils/genericImport?table=<tableName>

支持的表名

  • project (项目立项数据)
  • purchase_contract_order_management (采购合同订单管理数据)
  • purchase_contract_execution_maintenance (采购合同履约数据)
  • expense_reimbursement (费用报销数据)
  • actual_payment (实际支付数据)

使用方法

发送POST请求到上述接口地址将Excel文件作为请求体上传同时在查询参数中指定要导入的表名。

示例使用curl

# 导入项目立项数据
curl -X POST -F "file=@project_data.xlsx" "http://localhost:3000/api/utils/genericImport?table=project"

# 导入采购合同订单管理数据
curl -X POST -F "file=@purchase_contract_order.xlsx" "http://localhost:3000/api/utils/genericImport?table=purchase_contract_order_management"

Excel文件格式要求

Excel文件应包含与目标数据表对应的列第一行为列标题。其中必须包含"数据id"列作为唯一标识。

注意事项

  1. 接口在插入数据前会查询数据库中已存在的记录自动过滤掉重复的数据基于数据id字段只插入新数据
  2. 导入完成后会返回具体插入的新数据条数
  3. 导入过程中如遇到错误会返回500状态码及错误信息
  4. 请确保Excel文件格式正确列名与模板一致

金融数据计算库

https://mikemcl.github.io/bignumber.js/ https://www.npmjs.com/package/bignumber.js 用例 1浮点数精度误差最常见问题 用例 2大整数精度丢失 用例 3toFixed()方法的舍入异常