grs
yjxx 1 week ago
parent 7101d6b7d2
commit 0abbaab6f8

@ -1,8 +1,6 @@
package jty.expressdistributionsystem.DTO; package jty.expressdistributionsystem.DTO;
import jty.expressdistributionsystem.entity.Address; import jty.expressdistributionsystem.entity.*;
import jty.expressdistributionsystem.entity.Goods;
import jty.expressdistributionsystem.entity.User;
import lombok.Data; import lombok.Data;
@Data @Data
@ -14,4 +12,6 @@ public class RecordsListDTO {
private User addressee; // 查看谁签收的 private User addressee; // 查看谁签收的
private User sendUser; // 查看谁发的 private User sendUser; // 查看谁发的
private User getUserId; // 查看发给谁的 private User getUserId; // 查看发给谁的
private Code code; // 快递取件码
private Records record; // 查看是否被签收
} }

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

Loading…
Cancel
Save