grs
yjxx 1 week ago
parent 42b288d23c
commit 754d59c9b4

@ -18,13 +18,16 @@ public class GoodsDTO {
@NotBlank(message = "快递名称不能为空")
private String name;
@NotBlank(message = "快递重量不能为空")
/**
* 使 @NotBlank
* NotBlank
*/
@ValidQuality
private Double quality;
@NotBlank(message = "发货地不能为空")
private String addressFrom;
@NotBlank(message = "运送地址不能为空")
@NotBlank(message = "收件地址不能为空")
private String addressTo;
}

@ -162,6 +162,7 @@ public class UserController {
if (address == null) {
return new Result<>(404, "地址不存在", null);
}
addressLambdaQueryWrapper.clear();
// 如果寄件和收件是一个地方,禁止
if (goodsDTO.getAddressFrom().equals(goodsDTO.getAddressTo())) {
return new Result<>(400, "寄件和收件不能是同一个地方", null);
@ -178,7 +179,11 @@ public class UserController {
goods.setQuality(goodsDTO.getQuality());
goodsService.save(goods);
// 存进历史记录
// 寄件方位置
addressLambdaQueryWrapper.eq(Address::getAddress, goodsDTO.getAddressFrom());
Address addressFrom = addressService.getOne(addressLambdaQueryWrapper);
Records records = new Records();
records.setAddressFrom(addressFrom.getId());
records.setSendUserId(GetIdUtil.getId());
records.setGetUserId(getUser.getId());
records.setAddressId(address.getId());

Loading…
Cancel
Save