diff --git a/src/main/java/jty/expressdistributionsystem/controller/UserController.java b/src/main/java/jty/expressdistributionsystem/controller/UserController.java index f85a720..6ee55b8 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/UserController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/UserController.java @@ -161,6 +161,10 @@ public class UserController { if (address == null) { return new Result<>(404, "地址不存在", null); } + // 如果寄件和收件是一个地方,禁止 + if(goodsDTO.getAddressFrom().equals(goodsDTO.getAddressTo())) { + return new Result<>(400, "寄件和收件不能是同一个地方", null); + } // 生成快递码 String expressCode = ExpressCodeUtil.getExpressCode(goodsDTO.getCompany()); // 生成取件码