|
|
|
@ -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<List<Message>> getFromMessage(@RequestParam Long id) {
|
|
|
|
|
LambdaQueryWrapper<Message> messageLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
messageLambdaQueryWrapper.eq(Message::getGetUserId, id);
|
|
|
|
|
messageLambdaQueryWrapper.orderByDesc(Message::getMark)
|
|
|
|
|
.orderByDesc(Message::getCreateTime);
|
|
|
|
|
List<Message> list = messageService.list(messageLambdaQueryWrapper);
|
|
|
|
|
return new Result<>(200, "", list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户确认查看消息
|
|
|
|
|
// 用户确认查看消息(finish)
|
|
|
|
|
@PostMapping("/confirmMessage")
|
|
|
|
|
public Result<String> 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<String> deleteMessage(@RequestParam Long id) {
|
|
|
|
|
messageService.removeById(id);
|
|
|
|
|
return new Result<>(200, "消息删除成功", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户新建快递地址(finish)
|
|
|
|
|
@PostMapping("/addAddress")
|
|
|
|
|
public Result<String> addAddress(@RequestBody @Validated Address address) {
|
|
|
|
@ -115,7 +125,7 @@ public class UserController {
|
|
|
|
|
return new Result<>(200, "", list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户获取自己所有的快递记录
|
|
|
|
|
// 用户获取自己所有的快递记录(finish)
|
|
|
|
|
@GetMapping("/history")
|
|
|
|
|
public Result<Page<RecordsListDTO>> 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<Code> 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<RecordsListDTO> goodsDTOPage = new Page<>(page, pageSize, totalRecords);
|
|
|
|
@ -227,9 +242,9 @@ public class UserController {
|
|
|
|
|
return new Result<>(200, "寄件成功", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户收件
|
|
|
|
|
// 用户收件(finish)
|
|
|
|
|
@PostMapping("/addressee")
|
|
|
|
|
public Result<String> addressee(@Validated @RequestBody @NotNull AddresseeDTO addresseeDTO) {
|
|
|
|
|
public Result<String> addressee(@Validated @RequestBody AddresseeDTO addresseeDTO) {
|
|
|
|
|
// 判断是不是自己的快递
|
|
|
|
|
Long goodsId = addresseeDTO.getGoodsId();
|
|
|
|
|
Goods goods = goodsService.getById(goodsId);
|
|
|
|
|