grs
yjxx 2 weeks ago
parent 42b288d23c
commit 754d59c9b4

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

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

Loading…
Cancel
Save