diff --git a/src/main/java/com/gxwebsoft/yxe/controller/YxeSelfReportController.java b/src/main/java/com/gxwebsoft/yxe/controller/YxeSelfReportController.java index 6cfcbfe..757af1d 100644 --- a/src/main/java/com/gxwebsoft/yxe/controller/YxeSelfReportController.java +++ b/src/main/java/com/gxwebsoft/yxe/controller/YxeSelfReportController.java @@ -156,6 +156,60 @@ public class YxeSelfReportController extends BaseController { 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("删除自主填报") @DeleteMapping("/{id}") public ApiResult remove(@PathVariable("id") Integer id) {