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 | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/example/jz/controller/WxAppController.java b/src/main/java/com/example/jz/controller/WxAppController.java index 4b1bc9a..c947455 100644 --- a/src/main/java/com/example/jz/controller/WxAppController.java +++ b/src/main/java/com/example/jz/controller/WxAppController.java @@ -263,6 +263,29 @@ 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") public R addUser(@RequestBody User user) { user.setUserLasttime(new Date()); @@ -363,6 +386,9 @@ 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()); @@ -373,6 +399,9 @@ } 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()); @@ -555,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