From 59db8631951af1a98f5314c1276fe6d9591bb582 Mon Sep 17 00:00:00 2001 From: yjxx <1055683039@qq.com> Date: Wed, 6 Nov 2024 15:13:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/ExpressListDTO.java | 14 +++++++++++++- .../controller/AdminController.java | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java b/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java index 5994afb..d9205f6 100644 --- a/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java +++ b/src/main/java/jty/expressdistributionsystem/DTO/ExpressListDTO.java @@ -1,16 +1,28 @@ package jty.expressdistributionsystem.DTO; +import jty.expressdistributionsystem.entity.Address; import jty.expressdistributionsystem.entity.Goods; import jty.expressdistributionsystem.entity.Records; +import jty.expressdistributionsystem.entity.User; import lombok.Data; @Data public class ExpressListDTO { private Records records; private Goods goods; + private User sender; // 寄件人 + private User recipient; // 收件人 + private User addressee; // 签收者 + private User courier; // 派送的快递员 + private Address address; // 送到哪里 - public ExpressListDTO(Records records, Goods goods) { + public ExpressListDTO(Records records, Goods goods, User sender, User recipient, User addressee, User courier, Address address) { this.records = records; this.goods = goods; + this.sender = sender; + this.recipient = recipient; + this.addressee = addressee; + this.courier = courier; + this.address = address; } } diff --git a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java index 1706092..c7f08f7 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java @@ -6,14 +6,10 @@ import jakarta.annotation.Resource; import jty.expressdistributionsystem.DTO.ExpressListDTO; import jty.expressdistributionsystem.DTO.SendMessageDTO; import jty.expressdistributionsystem.entity.*; -import jty.expressdistributionsystem.service.GoodsService; -import jty.expressdistributionsystem.service.MessageService; -import jty.expressdistributionsystem.service.RecordsService; -import jty.expressdistributionsystem.service.UserService; +import jty.expressdistributionsystem.service.*; import jty.expressdistributionsystem.utils.SendMessageUtil; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; -import org.springframework.data.domain.PageImpl; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; @@ -35,6 +31,9 @@ public class AdminController { @Resource private GoodsService goodsService; + @Resource + private AddressService addressService; + // 管理员查看用户或者快递员信息 @GetMapping("/infoList") public Result> getUserList(@RequestParam int page, @RequestParam int pageSize, @RequestParam int mark) { @@ -99,7 +98,15 @@ public class AdminController { List recordsList = recordsService.list(); for(Records records : recordsList) { Goods goods = goodsService.getById(records.getGoodsId()); - expressListDTOList.add(new ExpressListDTO(records, goods)); + // 查询寄件人、收件人、签收者、快递员信息 + User sender = userService.getById(records.getSendUserId()); + User recipient = userService.getById(records.getGetUserId()); + User addressee = userService.getById(records.getAddresseeId()); + User courier = userService.getById(records.getExpressId()); + // 查询地址信息 + Address address = addressService.getById(records.getAddressId()); + ExpressListDTO expressListDTO = new ExpressListDTO(records, goods, sender, recipient, addressee, courier, address); + expressListDTOList.add(expressListDTO); } Page expressDTOPage = new Page<>(recordsPage.getCurrent(), recordsPage.getSize(), recordsPage.getTotal()); expressDTOPage.setRecords(expressListDTOList);