Commit 7c7da2b1 by jianan

fix(转介人门户): 月结单明细改用出账单据锚点链,修复明细全空

salary 表不存关联 ID,唯一锚点是月份;旧口径按
fortune.reconciliation_year_month == salary.month 匹配,但对账月与
出账月可错位(生产实例:202610 薪资单 ↔ 2026-09 对账月),导致
已推送月结单详情明细全空。

改为单据链:salary.month ↔ fortune_account.fortune_account_date
落同月(与薪资单生成校验 checkIsBilling 同口径,status=2 已出账)
→ fortune.fortune_account_biz_id(出账时回写)。
parent 08989319
......@@ -442,10 +442,25 @@ public class ReferrerPortalServiceImpl implements IReferrerPortalService {
if (StringUtils.length(salaryMonth) < 6) {
return new ArrayList<>();
}
String reconciliationMonth = salaryMonth.substring(0, 4) + "-" + salaryMonth.substring(4, 6);
// 单据锚点链:salary.month(yyyyMM) ↔ fortune_account.fortune_account_date 落同月
// (与薪资单生成校验 checkIsBilling 同口径),fortune.fortune_account_biz_id 出账时回写指向出账头。
// fortune.reconciliation_year_month 是佣金对账月,可与出账月错位
// (生产实例:202610 薪资单 ↔ 2026-09 对账月),不能作锚。
List<FortuneAccount> accounts = fortuneAccountService.queryList(
brokerBizId, salaryMonth, FortuneAccountStatusEnum.SENT.getItemValue());
if (accounts == null || accounts.isEmpty()) {
return new ArrayList<>();
}
List<String> accountBizIds = accounts.stream()
.map(FortuneAccount::getFortuneAccountBizId)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toList());
if (accountBizIds.isEmpty()) {
return new ArrayList<>();
}
List<Fortune> fortunes = fortuneService.lambdaQuery()
.eq(Fortune::getBrokerBizId, brokerBizId)
.eq(Fortune::getReconciliationYearMonth, reconciliationMonth)
.in(Fortune::getFortuneAccountBizId, accountBizIds)
.eq(Fortune::getStatus, "2")
.in(Fortune::getIsPart, 0, 1)
.orderByAsc(Fortune::getId)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment