From d3382cda09e752635a1a2913f50d22c99ab7a829 Mon Sep 17 00:00:00 2001 From: yjxx <1055683039@qq.com> Date: Mon, 11 Nov 2024 16:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=9F=E8=83=BD=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=9F=A5=E8=AF=A2=E5=BF=AB=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AdminController.java | 10 ++++---- .../controller/CommonController.java | 6 ++--- .../controller/UserController.java | 24 ++++++++++++++++++- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java index 2d1b019..ea969cd 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java @@ -37,7 +37,7 @@ public class AdminController { @Resource private AddressService addressService; - // 管理员查看用户或者快递员信息 + // 管理员查看用户或者快递员信息(finish) @GetMapping("/infoList") public Result> getUserList(@RequestParam int page, @RequestParam int pageSize, @RequestParam int mark) { if (page <= 0 || pageSize <= 0) { @@ -55,7 +55,7 @@ public class AdminController { return new Result<>(200, "", pageInfo); } - // 拉黑删除快递员或者用户 + // 拉黑删除快递员或者用户(finish) @DeleteMapping("/delete/{id}") public Result delete(@PathVariable Long id, @RequestParam @NotNull String operation) { User user = userService.getById(id); @@ -77,7 +77,7 @@ public class AdminController { return new Result<>(200, "操作成功", ""); } - // 管理员发送消息 + // 管理员发送消息(finish) @PostMapping("/sendMessage") public Result sendMessage(@RequestBody @Validated SendMessageDTO sendMessageDTO) { Message message = SendMessageUtil.sendMessage(sendMessageDTO); @@ -85,7 +85,7 @@ public class AdminController { return new Result<>(200, "发送成功", ""); } - // 获取正在留言的人的所有聊天记录 + // 获取正在留言的人的所有聊天记录(finish) @GetMapping("/allMessage") public Result>> getAllMessage(@RequestParam Long toId) { Long meId = GetIdUtil.getId(); @@ -103,7 +103,7 @@ public class AdminController { return new Result<>(200, "", list); } - // 管理员获取所有快递信息 + // 管理员获取所有快递信息(finish) @GetMapping("/express") public Result> getAllExpress(@RequestParam int page, @RequestParam int pageSize) { Page recordsPage = new Page<>(page, pageSize); diff --git a/src/main/java/jty/expressdistributionsystem/controller/CommonController.java b/src/main/java/jty/expressdistributionsystem/controller/CommonController.java index 1ff7f94..824b167 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/CommonController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/CommonController.java @@ -37,7 +37,7 @@ public class CommonController { @Resource private StringRedisTemplate stringRedisTemplate; - // 注册 + // 注册(finish) @PostMapping("/register") public Result register(@RequestBody @Validated @NotNull User user) { // 查找用户是否存在 @@ -58,7 +58,7 @@ public class CommonController { return new Result<>(200, "注册成功", ""); } - // 通过账号登录 + // 通过账号登录(finish) @PostMapping("/loginByAccount") public Result login(@RequestBody @Validated @NotNull UserLoginByAccountDTO userLoginByAccountDTO) { // 查询用户是否存在 @@ -147,7 +147,7 @@ public class CommonController { return new Result<>(200, "密码修改成功, 请重新登陆", ""); } - // 获取个人信息 + // 获取个人信息(finish) @GetMapping("/info") public Result getInfo() { Long id = GetIdUtil.getId(); diff --git a/src/main/java/jty/expressdistributionsystem/controller/UserController.java b/src/main/java/jty/expressdistributionsystem/controller/UserController.java index 24fac8f..0446a9e 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/UserController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/UserController.java @@ -19,6 +19,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Objects; @RestController @RequestMapping("/user") @@ -232,7 +233,7 @@ public class UserController { QueryWrapper recordsQueryWrapper = new QueryWrapper<>(); recordsQueryWrapper.eq("goods_id", goods.getId()); Records records = recordsService.getOne(recordsQueryWrapper); - if(records.getMark() == 1) { + if (records.getMark() == 1) { return new Result<>(500, "快递已被签收", ""); } records.setMark(1); @@ -240,4 +241,25 @@ public class UserController { recordsService.updateById(records); return new Result<>(200, "代取成功", ""); } + + // 用户查询快递 + @GetMapping("/query") + public Result queryGoods(@RequestParam Long queryCode, @RequestParam Long queryId) { + Long id = GetIdUtil.getId(); + LambdaQueryWrapper goodsLambdaQueryWrapper = new LambdaQueryWrapper<>(); + if (Objects.equals(id, queryId)) { + goodsLambdaQueryWrapper.eq(Goods::getExpressCode, queryCode); + Goods goods = goodsService.getOne(goodsLambdaQueryWrapper); + return new Result<>(200, "查询成功", goods); + } else { + goodsLambdaQueryWrapper.eq(Goods::getExpressCode, queryCode) + .eq(Goods::getGetUserId, queryId); + Goods goods = goodsService.getOne(goodsLambdaQueryWrapper); + if (goods == null) { + return new Result<>(404, "请输入正确的快递单号, 或您不是快递的收件人或者邮寄人", null); + } else { + return new Result<>(200, "查询成功", goods); + } + } + } }