grs
yjxx 2 weeks ago
parent 90cfec7d93
commit 59db863195

@ -1,16 +1,28 @@
package jty.expressdistributionsystem.DTO; package jty.expressdistributionsystem.DTO;
import jty.expressdistributionsystem.entity.Address;
import jty.expressdistributionsystem.entity.Goods; import jty.expressdistributionsystem.entity.Goods;
import jty.expressdistributionsystem.entity.Records; import jty.expressdistributionsystem.entity.Records;
import jty.expressdistributionsystem.entity.User;
import lombok.Data; import lombok.Data;
@Data @Data
public class ExpressListDTO { public class ExpressListDTO {
private Records records; private Records records;
private Goods goods; 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.records = records;
this.goods = goods; this.goods = goods;
this.sender = sender;
this.recipient = recipient;
this.addressee = addressee;
this.courier = courier;
this.address = address;
} }
} }

@ -6,14 +6,10 @@ import jakarta.annotation.Resource;
import jty.expressdistributionsystem.DTO.ExpressListDTO; import jty.expressdistributionsystem.DTO.ExpressListDTO;
import jty.expressdistributionsystem.DTO.SendMessageDTO; import jty.expressdistributionsystem.DTO.SendMessageDTO;
import jty.expressdistributionsystem.entity.*; import jty.expressdistributionsystem.entity.*;
import jty.expressdistributionsystem.service.GoodsService; import jty.expressdistributionsystem.service.*;
import jty.expressdistributionsystem.service.MessageService;
import jty.expressdistributionsystem.service.RecordsService;
import jty.expressdistributionsystem.service.UserService;
import jty.expressdistributionsystem.utils.SendMessageUtil; import jty.expressdistributionsystem.utils.SendMessageUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.data.domain.PageImpl;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -35,6 +31,9 @@ public class AdminController {
@Resource @Resource
private GoodsService goodsService; private GoodsService goodsService;
@Resource
private AddressService addressService;
// 管理员查看用户或者快递员信息 // 管理员查看用户或者快递员信息
@GetMapping("/infoList") @GetMapping("/infoList")
public Result<Page<User>> getUserList(@RequestParam int page, @RequestParam int pageSize, @RequestParam int mark) { public Result<Page<User>> getUserList(@RequestParam int page, @RequestParam int pageSize, @RequestParam int mark) {
@ -99,7 +98,15 @@ public class AdminController {
List<Records> recordsList = recordsService.list(); List<Records> recordsList = recordsService.list();
for(Records records : recordsList) { for(Records records : recordsList) {
Goods goods = goodsService.getById(records.getGoodsId()); 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<ExpressListDTO> expressDTOPage = new Page<>(recordsPage.getCurrent(), recordsPage.getSize(), recordsPage.getTotal()); Page<ExpressListDTO> expressDTOPage = new Page<>(recordsPage.getCurrent(), recordsPage.getSize(), recordsPage.getTotal());
expressDTOPage.setRecords(expressListDTOList); expressDTOPage.setRecords(expressListDTOList);

Loading…
Cancel
Save