更新 2026-04-18 21:11

This commit is contained in:
MaDaLei 2026-04-18 21:11:20 +08:00
parent e3b95b45b7
commit 7ac2b27a83
2 changed files with 5 additions and 3 deletions

View File

@ -54,6 +54,7 @@ public class ReportLeadController {
data.put("remindDate", lead.getRemindDate() == null ? null : lead.getRemindDate().toString()); data.put("remindDate", lead.getRemindDate() == null ? null : lead.getRemindDate().toString());
data.put("unsubscribeToken", lead.getUnsubscribeToken()); data.put("unsubscribeToken", lead.getUnsubscribeToken());
data.put("wechatBound", outcome.wechatBound()); data.put("wechatBound", outcome.wechatBound());
data.put("repeatSubmit", outcome.repeatSubmit());
return Map.of("code", 200, "data", data); return Map.of("code", 200, "data", data);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return Map.of("code", 400, "message", e.getMessage()); return Map.of("code", 400, "message", e.getMessage());

View File

@ -31,8 +31,8 @@ public class ReportLeadService {
private final UserService userService; private final UserService userService;
private final WechatMiniProgramService wechatMiniProgramService; private final WechatMiniProgramService wechatMiniProgramService;
/** 留资提交结果:记录 + 是否已将微信 openid 绑定到宠主账号S3→S4 */ /** 留资提交结果:记录 + 是否已将微信 openid 绑定到宠主账号S3→S4+ 是否同报告同手机号再次提交(幂等更新) */
public record LeadSubmitOutcome(ReportLead lead, boolean wechatBound) {} public record LeadSubmitOutcome(ReportLead lead, boolean wechatBound, boolean repeatSubmit) {}
/** 当服务类型不在已配置表中时使用的兜底间隔(天) */ /** 当服务类型不在已配置表中时使用的兜底间隔(天) */
private static final int FALLBACK_MIN = 28; private static final int FALLBACK_MIN = 28;
@ -127,6 +127,7 @@ public class ReportLeadService {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
ReportLead lead = reportLeadMapper.findFirstByReportIdAndPhone(report.getId(), phone).orElse(null); ReportLead lead = reportLeadMapper.findFirstByReportIdAndPhone(report.getId(), phone).orElse(null);
boolean repeatSubmit = lead != null;
if (lead == null) { if (lead == null) {
lead = new ReportLead(); lead = new ReportLead();
lead.setReportId(report.getId()); lead.setReportId(report.getId());
@ -180,7 +181,7 @@ public class ReportLeadService {
} }
} }
return new LeadSubmitOutcome(lead, wechatBound); return new LeadSubmitOutcome(lead, wechatBound, repeatSubmit);
} }
/** 退订:按 unsubscribeToken 找记录并置状态 */ /** 退订:按 unsubscribeToken 找记录并置状态 */