From 25945cec9a4d25ad09d7ccb73b1c42c11aa3e8a4 Mon Sep 17 00:00:00 2001 From: baizonghao <1719256278@qq.com> Date: 星期三, 22 三月 2023 16:57:21 +0800 Subject: [PATCH] 2222 --- src/main/java/com/example/jz/controller/WxAppController.java | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/example/jz/controller/WxAppController.java b/src/main/java/com/example/jz/controller/WxAppController.java index 207acea..c947455 100644 --- a/src/main/java/com/example/jz/controller/WxAppController.java +++ b/src/main/java/com/example/jz/controller/WxAppController.java @@ -246,10 +246,11 @@ public R addReport(@RequestBody ReportVXVO reportVXVO) { User user = userService.getOne(new QueryWrapper<User>().eq("id", reportVXVO.getUserId())); user.setRealName(reportVXVO.getRealName()); + user.setSex(reportVXVO.getSex()); user.setUserIdcard(reportVXVO.getUserIdCard()); user.setLocation(reportVXVO.getLocation()); - user.setSex(reportVXVO.getSex()); user.setWorkingLocation(reportVXVO.getWorkingLocation()); + userService.update(user, new LambdaQueryWrapper<User>().eq(User::getId, user.getId())); Report report = new Report(); BeanUtils.copyProperties(reportVXVO, report); @@ -260,6 +261,29 @@ report.setStatus(0); report.setReportMethod("鎵爜鎶ユ"); return R.ok(reportService.save(report)); + } + + @PutMapping ("/user/addReport") + public R addReport1(@RequestBody ReportVXVO reportVXVO) { + User user = userService.getOne(new QueryWrapper<User>().eq("id", reportVXVO.getUserId())); + user.setRealName(reportVXVO.getRealName()); + user.setSex(reportVXVO.getSex()); + user.setUserIdcard(reportVXVO.getUserIdCard()); + user.setLocation(reportVXVO.getLocation()); + user.setWorkingLocation(reportVXVO.getWorkingLocation()); + + userService.update(user, new LambdaQueryWrapper<User>().eq(User::getId, user.getId())); + Report report = new Report(); + BeanUtils.copyProperties(reportVXVO, report); + report.setAmountInvolved(reportVXVO.getAmountInvolved()); + report.setPic(user.getPic()); + report.setIsInGroup(0); + report.setCtime(new Date()); + report.setStatus(0); + report.setReportMethod("鎵爜鎶ユ"); + + reportService.update(report, new LambdaQueryWrapper<Report>().eq(Report::getId, report.getId())); + return R.ok("淇敼鎴愬姛"); } @PostMapping("/user/add") @@ -362,17 +386,25 @@ if (item.getUserId() != null) { Report report = reportService.getOne(new QueryWrapper<Report>().eq("id", item.getUserId())); User user = userService.getOne(new QueryWrapper<User>().eq("id", report.getUserId())); + if (Objects.isNull(user)) { + return; + } messageMap.put("id", user.getId()); messageMap.put("name", item.getReportName()); messageMap.put("mobile", user.getUserMobile()); messageMap.put("idcard", user.getUserIdcard()); + messageMap.put("sex", user.getSex()); messageMap.put("pic", user.getPic()); messageMap.put("role", 0); } else { messageMap.put("id", item.getCopId()); User user = userService.getOne(new QueryWrapper<User>().eq("id", item.getCopId())); + if (Objects.isNull(user)) { + return; + } messageMap.put("name", user.getRealName()); messageMap.put("mobile", user.getUserMobile()); + messageMap.put("sex", user.getSex()); messageMap.put("role", 1); } message.add(messageMap); @@ -552,6 +584,8 @@ ReportVo reportVo = new ReportVo(); BeanUtils.copyProperties(item, reportVo); User user = userDao.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, item.getUserId())); + Cause one = causeService.getOne(new LambdaQueryWrapper<Cause>().eq(Cause::getId, item.getCauseId())); + reportVo.setReportDescription(one.getName()); reportVo.setReporterName(user.getRealName()); reportVo.setMobile(user.getUserMobile()); reportVo.setIdcard(user.getUserIdcard()); -- Gitblit v1.8.0