feat(自主填报): 新增驳回后重新提交接口

背景:填报记录被驳回后用户无法修改重提,只能重新走一遍新增流程。

不复用通用 PUT /yxe/yxe-self-report,原因是该接口无归属校验(任何登录
用户可改他人记录),且请求体带 status=1 会触发审核通过分支给用户加余额,
用户端直接复用等于暴露打款开关。因此单独新增 PUT /resubmit:

- 校验登录 + 已认证、记录归属当前用户、当前状态必须为已驳回
- status 与 rejectReason 由服务端写死(置 0、清空),忽略请求体传值
- reward 按新销量重算,与新增提交保持一致(最终金额仍由审核端确认)
- 不修改 activityTime:前端表单未采集该字段,避免被置空
This commit is contained in:
2026-10-11 17:05:05 +08:00
parent 28f3ea58fb
commit 9ff52cfe02
@@ -156,6 +156,60 @@ public class YxeSelfReportController extends BaseController {
return fail("修改失败"); return fail("修改失败");
} }
@ApiOperation("重新提交自主填报")
@PutMapping("/resubmit")
public ApiResult<?> resubmit(@RequestBody YxeSelfReport yxeSelfReport) {
User loginUser = getLoginUser();
if (loginUser == null) {
return fail("请先登录");
}
if (!Integer.valueOf(2).equals(loginUser.getAuthStatus())) {
return fail("请先完成认证");
}
if (yxeSelfReport == null || yxeSelfReport.getId() == null) {
return fail("缺少填报记录ID");
}
YxeSelfReport current = yxeSelfReportService.getById(yxeSelfReport.getId());
if (current == null) {
return fail("填报记录不存在");
}
// 只能重新提交自己的记录,避免复用通用修改接口改到他人数据
if (current.getUserId() == null || !current.getUserId().equals(loginUser.getUserId())) {
return fail("只能重新提交自己的填报记录");
}
// 仅驳回状态可重提,防止绕过审核直接改回待审核/已通过
if (!Integer.valueOf(2).equals(current.getStatus())) {
return fail("只有已驳回的填报记录可以重新提交");
}
YxeSelfReport update = new YxeSelfReport();
update.setId(current.getId());
update.setMerchantId(yxeSelfReport.getMerchantId());
update.setMerchantName(yxeSelfReport.getMerchantName());
update.setChainId(yxeSelfReport.getChainId());
update.setChainName(yxeSelfReport.getChainName());
update.setDate(yxeSelfReport.getDate());
update.setImage(yxeSelfReport.getImage());
update.setClockPhotos(yxeSelfReport.getClockPhotos());
update.setBoothPhotos(yxeSelfReport.getBoothPhotos());
update.setSalesGroups(yxeSelfReport.getSalesGroups());
update.setReceiptPhoto(yxeSelfReport.getReceiptPhoto());
update.setSummary(yxeSelfReport.getSummary());
update.setRating(yxeSelfReport.getRating());
update.setLat(yxeSelfReport.getLat());
update.setLng(yxeSelfReport.getLng());
update.setLocation(yxeSelfReport.getLocation());
// 奖金金额与新增提交保持一致:由销量小计算出,改动销量后需要同步更新,
// 否则审核端会按上一轮的金额通过(最终金额仍以审核端确认为准)
update.setReward(yxeSelfReport.getReward());
// 状态与驳回原因由服务端决定:回到待审核,并清掉上一轮的驳回原因
update.setStatus(0);
update.setRejectReason("");
if (yxeSelfReportService.updateById(update)) {
return success("重新提交成功");
}
return fail("重新提交失败");
}
@ApiOperation("删除自主填报") @ApiOperation("删除自主填报")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) { public ApiResult<?> remove(@PathVariable("id") Integer id) {