diff --git a/src/main/java/jty/expressdistributionsystem/DTO/RecordsListDTO.java b/src/main/java/jty/expressdistributionsystem/DTO/RecordsListDTO.java index f3ff67c..7ec24d7 100644 --- a/src/main/java/jty/expressdistributionsystem/DTO/RecordsListDTO.java +++ b/src/main/java/jty/expressdistributionsystem/DTO/RecordsListDTO.java @@ -1,8 +1,6 @@ package jty.expressdistributionsystem.DTO; -import jty.expressdistributionsystem.entity.Address; -import jty.expressdistributionsystem.entity.Goods; -import jty.expressdistributionsystem.entity.User; +import jty.expressdistributionsystem.entity.*; import lombok.Data; @Data @@ -14,4 +12,6 @@ public class RecordsListDTO { private User addressee; // 查看谁签收的 private User sendUser; // 查看谁发的 private User getUserId; // 查看发给谁的 + private Code code; // 快递取件码 + private Records record; // 查看是否被签收 } diff --git a/src/main/java/jty/expressdistributionsystem/controller/UserController.java b/src/main/java/jty/expressdistributionsystem/controller/UserController.java index 07bb504..b31e89b 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/UserController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/UserController.java @@ -11,6 +11,7 @@ import jty.expressdistributionsystem.utils.ClaimCodeUtil; import jty.expressdistributionsystem.utils.ExpressCodeUtil; import jty.expressdistributionsystem.utils.GetIdUtil; import jty.expressdistributionsystem.utils.SendMessageUtil; +import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -78,11 +79,13 @@ public class UserController { public Result> getFromMessage(@RequestParam Long id) { LambdaQueryWrapper messageLambdaQueryWrapper = new LambdaQueryWrapper<>(); messageLambdaQueryWrapper.eq(Message::getGetUserId, id); + messageLambdaQueryWrapper.orderByDesc(Message::getMark) + .orderByDesc(Message::getCreateTime); List list = messageService.list(messageLambdaQueryWrapper); return new Result<>(200, "", list); } - // 用户确认查看消息 + // 用户确认查看消息(finish) @PostMapping("/confirmMessage") public Result confirmMessage(@RequestParam Long id) { Message message = messageService.getById(id); @@ -91,6 +94,13 @@ public class UserController { return new Result<>(200, "消息查看成功", ""); } + // 用户删除聊天消息(finish) + @DeleteMapping("/deleteMsg") + public Result deleteMessage(@RequestParam Long id) { + messageService.removeById(id); + return new Result<>(200, "消息删除成功", ""); + } + // 用户新建快递地址(finish) @PostMapping("/addAddress") public Result addAddress(@RequestBody @Validated Address address) { @@ -115,7 +125,7 @@ public class UserController { return new Result<>(200, "", list); } - // 用户获取自己所有的快递记录 + // 用户获取自己所有的快递记录(finish) @GetMapping("/history") public Result> getHistory(@RequestParam int page, @RequestParam int pageSize) { if (page <= 0 || pageSize <= 0) { @@ -154,6 +164,9 @@ public class UserController { User courier = userService.getById(records.getExpressId()); Address addressFrom = addressService.getById(records.getAddressFrom()); Address addressTo = addressService.getById(records.getAddressId()); + LambdaQueryWrapper codeLambdaQueryWrapper = new LambdaQueryWrapper<>(); + codeLambdaQueryWrapper.eq(Code::getGoodsId, goods.getId()); + Code code = codeService.getOne(codeLambdaQueryWrapper); RecordsListDTO recordsListDTO = new RecordsListDTO(); recordsListDTO.setGoods(goods); recordsListDTO.setAddressFrom(addressFrom); @@ -162,6 +175,8 @@ public class UserController { recordsListDTO.setAddressee(addressee); recordsListDTO.setSendUser(sender); recordsListDTO.setGetUserId(recipient); + recordsListDTO.setCode(code); + recordsListDTO.setRecord(records); recordsListDTOList.add(recordsListDTO); } Page goodsDTOPage = new Page<>(page, pageSize, totalRecords); @@ -227,9 +242,9 @@ public class UserController { return new Result<>(200, "寄件成功", ""); } - // 用户收件 + // 用户收件(finish) @PostMapping("/addressee") - public Result addressee(@Validated @RequestBody @NotNull AddresseeDTO addresseeDTO) { + public Result addressee(@Validated @RequestBody AddresseeDTO addresseeDTO) { // 判断是不是自己的快递 Long goodsId = addresseeDTO.getGoodsId(); Goods goods = goodsService.getById(goodsId);