Commit Graph

1095 Commits

Author SHA1 Message Date
hailin d4763ea5bf chore(planting-service): 更新合同PDF模板(修复红色文字)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 06:29:08 -08:00
hailin dfecdc06e9 chore(planting-service): 更新合同PDF模板
使用新的榴莲树认种权益协议_发布版_form.pdf替换原模板

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 06:15:49 -08:00
hailin ad5b153fa9 fix(pdf-generator): 签名按字段尺寸等比例缩放并居中
- 计算宽度和高度的缩放比例,取较小值确保签名完全在字段内
- 在字段内居中放置签名图片
- 符合行业标准:签名根据字段尺寸自适应缩放

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:56:38 -08:00
hailin 2e65a92e04 fix(planting-service): 签名图片按比例缩放到合适大小
- 目标宽度 150pt(约 5cm)
- 保持宽高比不变
- 避免签名图片过大

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:53:51 -08:00
hailin 6c017d2086 fix(planting-service): 签名图片保持原始尺寸放置
- 不再缩放签名图片适应按钮大小
- 直接在按钮位置绘制原始尺寸的签名
- 避免签名被压扁变形

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:53:22 -08:00
hailin 666be6ea60 fix(planting-service): 签名后查看合同返回已签名的PDF
- 修改 /tasks/:orderNo/pdf 接口,检查任务状态
- 如果已签名且有 signedPdfUrl,从 MinIO 下载已签名的 PDF
- 添加 downloadSignedPdf 方法到 MinioStorageService
- 在 ContractSigningTaskDto 中添加 signedPdfUrl 字段

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:48:22 -08:00
hailin 86103e4c4d fix(planting-service): 使用自定义外观流嵌入签名图片
- setImage 无法正确渲染签名到按钮字段
- 手动创建 XObject Form 外观流
- 计算图片缩放和居中位置
- 设置 widget 的 NormalAppearance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:35:58 -08:00
hailin bdeff3b372 fix(planting-service): 修复合同签名无法放到指定位置的问题
- 修改 generateSignedContractPdf 在同一个 PDFDocument 实例上完成填充和签名
- 移除 fillFormFields 中的 form.flatten(),保留签名字段供后续使用
- 最后统一扁平化所有表单字段,确保签名放到正确位置
- 控制器改用 generateSignedContractPdf 替代分两步调用

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:23:53 -08:00
hailin 09cc696efa Revert "fix(wallet-service): 社区权益按 targetId 分配到正确账户"
This reverts commit 43a0e5f5e1.
2025-12-26 04:52:01 -08:00
hailin 43a0e5f5e1 fix(wallet-service): 社区权益按 targetId 分配到正确账户
修复社区权益分配逻辑:
- 之前所有 COMMUNITY_RIGHT 都直接进入总部账户 S0000000001
- 现在根据 targetId 判断:
  - targetId 为 '1' 或 'S0000000001' → 进入总部社区账户
  - targetId 为用户账户(D开头)→ 进入该用户可结算余额

这样当用户获取社区授权且伞下认种达到10棵后,
社区权益会正确分配到该用户账户,而不是总部。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 04:49:10 -08:00
hailin 3f3309e62f debug: 添加流水明细 allocationType 调试日志
- 后端 wallet-service: getMyLedger 打印 payloadJson 和 allocationType
- 前端 wallet_service: 打印原始和解析后的流水数据
- 前端 ledger_detail_page: 打印加载的流水数据详情

用于排查权益类型(社区、省市团队/区域)不显示的问题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 04:35:46 -08:00
hailin 3d42c3602d fix(reward-service): 权益分配memo显示触发用户ID
所有权益类型的memo现在统一显示"来自用户xxx的认种"格式:
- 省团队权益:来自用户xxx的认种
- 省区域权益:来自用户xxx的认种
- 市团队权益:来自用户xxx的认种
- 市区域权益:来自用户xxx的认种
- 社区权益:来自用户xxx的认种

修改前只显示"xx权益已激活",现在与分享权益格式保持一致

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 04:18:35 -08:00
hailin f711d54eed chore(reward-service): 调整系统费用分配 - 成本费+80, 总部基础费-80 2025-12-26 04:07:41 -08:00
hailin 21a523518e feat(mobile-app): 最小提取金额从100改为5绿积分 2025-12-26 04:02:26 -08:00
hailin 1d6982c73e feat(planting-service): 合同签署超时时间从24小时改为1年 2025-12-26 03:58:56 -08:00
hailin 78d7e0e637 feat(mobile-app): 流水明细支持显示权益类型和详情
- 后端 wallet-service: getMyLedger API 返回 allocationType 字段
- 前端流水明细: 显示权益类型名称(分享权益、省/市区域权益等)
- 新增权益详情弹窗,点击权益记录可查看详细信息
- 兑换页面: "RMB/CNY提现" 改为 "提现"
- 我的团队: "暂无下级成员" 改为 "暂无团队成员"
- 自助申请授权: 隐藏团队链占用区域提示

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 03:57:35 -08:00
hailin f7e2f7f6f2 fix(wallet-service): 添加 WalletAccount 类型导入 2025-12-26 02:23:49 -08:00
hailin 726e3d0fcf fix(wallet-service): 修复区域权益分配时 targetId 为用户账户导致的 BigInt 转换错误
问题:allocateToRegionAccount 假设 targetId 总是纯数字格式的区域账户,
但实际上当权益分配给授权市/省公司用户时,targetId 是 D 开头的用户账户格式。

修复:判断 targetId 格式
- D 开头:用户账户,直接 findByAccountSequence
- 纯数字:区域账户,使用 getOrCreate

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 02:20:05 -08:00
hailin 9addd99710 fix(planting-service): 修正导入路径
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 01:50:37 -08:00
hailin 24a46521f3 fix(planting-service): 修复跨服务调用使用错误标识符导致的500错误
问题根源:
- getBalance 调用使用 userId.toString() (纯数字如 "14")
- wallet-service 按 accountSequence 查找钱包失败后尝试创建新钱包
- 但 userId 已存在,触发唯一约束冲突导致500错误

修复内容:
1. planting-application.service.ts:
   - createOrder: getBalance(userId.toString()) → getBalance(accountSequence)
   - payOrder: getBalance(userId.toString()) → getBalance(walletIdentifier)

2. payment-compensation.service.ts:
   - 注入 IPlantingOrderRepository 获取订单的 accountSequence
   - handleUnfreeze/handleRetryConfirm 添加 accountSequence 参数

3. wallet-service.client.ts:
   - ensureRegionAccounts 接口添加 provinceTeamAccount/cityTeamAccount 字段

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 01:48:22 -08:00
hailin aae4f1e360 fix(mobile-app): 遍历路由栈检测当前页面,修复push导航检测问题
之前只检查 currentConfiguration.uri.path,对于 push 导航的页面无法正确检测。
现在遍历整个 matches 路由栈,只要栈中有合同/KYC页面就跳过弹窗。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 00:14:24 -08:00
hailin 73f2b85ddf fix(mobile-app): 首次检查也加入路由判断,避免在KYC页面弹窗
_checkContractsAndKyc() 方法之前没有调用 _shouldSkipContractCheck(),
导致用户在合同/KYC页面时首次检查仍会弹窗。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 00:09:39 -08:00
hailin b40cd40eae fix(mobile-app): 使用 appRouterProvider 获取全局路由状态
改用 ref.read(appRouterProvider) 替代 GoRouter.of(context),
确保能正确获取到当前的全局路由路径。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 00:06:17 -08:00
hailin ce75e68d5e fix(mobile-app): 修复合同签署页面定时检查仍弹窗的问题
使用 GoRouter.of(context).routerDelegate.currentConfiguration 获取全局路由状态,
而不是 GoRouterState.of(context),因为后者只能获取 ShellRoute 内部的路由状态,
当用户在顶级路由(如 /contract-signing/:orderNo)时无法正确检测。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:38:55 -08:00
hailin 89a2700fc9 chore(authorization-service): 移除已执行完成的 OTP 修复任务
OTP 修复结果:
- 总计处理: 3 个未激活的社区授权
- 成功修复: 1 (D25122600004)
- 跳过: 2 (未达标)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:06:32 -08:00
hailin f2a59b81ee fix(authorization-service): 修复 OTP 编译错误,使用 findByStatus 方法
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:03:54 -08:00
hailin 16a6edaf15 feat(authorization-service): 添加社区权益激活一次性修复任务
问题:由于 planting-service 发送的 userId 是订单主键而非用户真实 ID,
导致部分已达标的社区权益未被自动激活。

修复:添加 BenefitActivationFixOTP 一次性任务,在服务启动时:
1. 查找所有状态为 AUTHORIZED 但 benefitActive=false 的社区授权
2. 检查每个社区的 subordinateTeamPlantingCount 是否 >= 10
3. 满足条件则激活权益

使用方式:
1. 部署此代码,服务启动后自动执行修复
2. 确认修复完成后,删除 OTP 文件并重新部署

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:00:38 -08:00
hailin 6e84e370ee fix(authorization-service): 使用 accountSequence 替代 userId 查询团队统计
问题:planting-service 发送的 PlantingOrderPaid 事件中的 userId 是
订单表的自增主键(如 15),而不是 referral-service 中的真实 user_id
(如 25122600006)。这导致 handleTreePlanted 方法查询团队统计时
返回 null,社区权益无法被自动激活。

修复:改用事件中的 accountSequence 字段查询团队统计,因为
accountSequence 是跨服务一致的用户标识。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 22:51:32 -08:00
hailin 148e197ea1 fix(mobile-app): 升级弹窗显示时跳过合同/KYC后台检查
- UpdateService 添加 isShowingUpdateDialog 状态
- home_shell_page 在升级、合同签署、KYC页面均跳过后台弹窗

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 22:12:12 -08:00
hailin 5ee12be00f fix(mobile-app): 用户在合同/KYC页面时跳过后台弹窗检查
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 22:08:35 -08:00
hailin 838fbce914 chore(mobile-app): 缩短合同检查定时器间隔至5-20秒
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 21:59:30 -08:00
hailin 6237a49153 feat(mobile-app): 账本明细-认种支付交易支持查看和下载合同
- 认种支付流水项添加点击事件和右侧箭头指示器
- 新增交易详情底部弹窗,显示交易金额、时间、订单号等信息
- 添加"查看合同"按钮,使用 flutter_pdfview 展示 PDF
- 添加"下载合同"按钮,通过 share_plus 分享/保存文件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 21:54:10 -08:00
hailin b63aa0737c feat(mobile-app): 添加后台定时检测未签署合同和KYC需求
- 添加 60-180 秒随机间隔的后台定时器
- 检测已KYC但未签署合同的用户,强制跳转签署页面
- 检测已付款但未完成KYC的用户,强制跳转实名认证页面
- 使用 PopScope 替代已弃用的 WillPopScope
- 防止重复弹窗的状态管理

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 21:23:22 -08:00
hailin f62a96f3f1 feat(planting): 已付款未KYC用户强制进入实名认证流程
后端 (planting-service):
- 添加 /contract-signing/kyc-requirement 接口检查用户是否需要KYC
- 检查已付款订单但无合同签署任务的情况

前端 (mobile-app):
- ContractCheckService 新增 checkAll() 综合检查方法
- HomeShellPage 综合检查待签署合同和KYC需求
- 需要KYC时弹出强制认证弹窗,不可关闭

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 21:14:53 -08:00
hailin dbeef0a80b chore(wallet-service): 移除已执行的OTP修复脚本 2025-12-25 20:55:08 -08:00
hailin c2ff11bd6d fix(wallet-service): 添加一次性修复脚本 D25122600004->D25122600006 转账
- 修复因并发修改导致的冻结余额不足问题
- 自动完成内部转账、记录流水、更新订单状态
- 幂等执行,可安全重启
- 部署成功后请删除 otp/ 目录和相关引用

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 20:50:39 -08:00
hailin 305bdf63af fix(wallet-service): 添加钱包乐观锁防止并发修改
- WalletAccount aggregate 添加 version 字段
- WalletAccountRepositoryImpl 使用 updateMany + version 检查实现乐观锁
- requestWithdrawal 添加重试机制处理乐观锁冲突

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 20:44:55 -08:00
hailin 1e15b820b4 fix(planting-service): 合同PDF显示完整手机号和身份证号
- 移除 PDF 生成时对手机号和身份证号的脱敏处理
- 表单字段模式和坐标定位模式都直接使用原始值
- 删除 maskIdCard() 和 maskPhone() 脱敏方法
- 签订合同需要显示完整信息

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 18:55:55 -08:00
hailin 285465827d fix(blockchain-service): 添加 --accept-data-loss 参数
prisma db push 需要此参数来接受精度变更

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 18:28:23 -08:00
hailin 1d817a5be2 fix(blockchain-service): 扩大充值金额字段精度
- amount 字段从 Decimal(36,18) 改为 Decimal(78,0) 支持超大金额
- amountFormatted 字段从 Decimal(20,8) 改为 Decimal(36,8)

修复问题:100亿 USDT 充值导致 numeric field overflow 错误

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 18:19:48 -08:00
hailin e95ac15605 fix(reward-service): 添加奖励分配幂等性检查
- distributeRewards 方法添加幂等性检查,防止同一订单重复分配奖励
- distributeRewardsForExpiredContract 方法同样添加幂等性检查
- 通过 findBySourceOrderNo 检查订单是否已分配过奖励

修复问题:recovery job 重复触发导致同一订单奖励被多次分配

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 10:42:01 -08:00
hailin 68a071cfaa fix(identity-service): 暂时恢复三要素身份验证
二要素 API (Id2MetaStandardVerify) 返回 440 无权限调用错误
暂时恢复使用三要素验证,保留二要素代码待开通权限后使用

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 10:12:20 -08:00
hailin 4ec4df14b5 feat(identity-service): KYC 改用二要素验证
- 默认使用阿里云 Id2MetaStandardVerify API(姓名+身份证号)
- 保留三要素验证方法 verifyIdCardThreeFactor 作为备用
- 二要素验证始终调用真实 API,不使用 mock
- 兼容 BizCode 数字和字符串类型

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 09:46:17 -08:00
hailin 7a1e789f4d fix(contract): 合同签署页面和模板优化
1. 合同模板:身份证号和联系方式显示完整信息,不再使用星号掩码
2. 签署页面:checkbox 默认不选中,用户阅读到底部后才可点击确认

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 09:31:39 -08:00
hailin fba91ec256 fix(referral-service): 添加 WalletServiceClient 初始化日志
方便排查 WALLET_SERVICE_URL 环境变量是否正确加载

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 09:22:47 -08:00
hailin 63ac0debf3 feat(planting-service): 添加合同签署后事件恢复定时任务
每2~5分钟随机间隔扫描已签署超过2分钟的合同
重新发布 contract.signed 事件,确保扣款确认和奖励分配完成

幂等性已由 wallet-service 保证

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 09:08:47 -08:00
hailin f9e2d8483c feat(wallet-service): allocateFunds 添加幂等性检查
防止重复分配奖励,通过检查流水表中的 orderId + accountSequence + allocationType 组合

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 09:05:44 -08:00
hailin bf7f4af88d fix(docker-compose): 添加 referral-service 的 WALLET_SERVICE_URL 配置
referral-service 需要调用 wallet-service 确认扣款,
但缺少环境变量配置导致使用默认 localhost:3002 无法访问

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 08:59:53 -08:00
hailin 484cc99636 fix(planting-service): 修复 identity-service 响应解析
identity-service 响应被 TransformInterceptor 包装为 { success, data }
需要从 response.data.data 获取实际用户信息

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 08:47:43 -08:00
hailin 48f4ed60a6 fix(planting-service): 修复 identity-service API 调用路径
添加 /api/v1 前缀以匹配 identity-service 的全局路由配置

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 08:39:45 -08:00