Commit 1b31e29f0f9d37dedc3a7cbf01d419f01889220a

Authored by shaofan
1 parent 97a8d0f6

Add support for capturing sender and receiver location coordinates in DTOs and V…

…O, and handle location data in order creation logic.
sl-express-ms-oms-domain/src/main/java/com/sl/ms/oms/dto/MailingSaveDTO.java
... ... @@ -14,8 +14,12 @@ import java.time.LocalDateTime;
14 14 public class MailingSaveDTO {
15 15 @ApiModelProperty("发件方地址簿id")
16 16 private Long sendAddress;
  17 + @ApiModelProperty("发件方地址经纬度")
  18 + private String sendLocation;
17 19 @ApiModelProperty("收件方地址簿id")
18 20 private Long receiptAddress;
  21 + @ApiModelProperty("收件方地址经纬度")
  22 + private String receiptLocation;
19 23 @ApiModelProperty("取件时间")
20 24 private LocalDateTime pickUpTime;
21 25 @ApiModelProperty("取件方式")
... ...
sl-express-ms-oms-service/src/main/java/com/sl/ms/oms/service/impl/OrderServiceImpl.java
... ... @@ -85,6 +85,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
85 85  
86 86 /**
87 87 * 下单
  88 + *
88 89 * @param mailingSaveDTO 下单信息
89 90 * @return 下单成功信息
90 91 * @throws SLException
... ... @@ -101,6 +102,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
101 102  
102 103 // 订单位置
103 104 OrderLocationEntity orderLocation = buildOrderLocation(order);
  105 + if (StrUtil.isNotEmpty(mailingSaveDTO.getSendLocation())) {
  106 + orderLocation.setSendLocation(mailingSaveDTO.getSendLocation());
  107 + }
  108 + if (StrUtil.isNotEmpty(mailingSaveDTO.getReceiptLocation())) {
  109 + orderLocation.setReceiveLocation(mailingSaveDTO.getReceiptLocation());
  110 + }
104 111 log.info("订单位置为:{}", orderLocation);
105 112  
106 113 // 计算运费
... ... @@ -132,7 +139,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
132 139  
133 140 /**
134 141 * 获取订单地址信息
135   - * @param sendAddressId 发送地址ID
  142 + *
  143 + * @param sendAddressId 发送地址ID
136 144 * @param receiptAddressId 接收地址ID
137 145 * @return
138 146 */
... ... @@ -152,6 +160,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
152 160  
153 161 /**
154 162 * 预估总价
  163 + *
155 164 * @param mailingSaveDTO 下单信息
156 165 * @return 运费预估信息
157 166 */
... ... @@ -170,8 +179,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
170 179  
171 180 /**
172 181 * 运费计算
  182 + *
173 183 * @param mailingSaveDTO 下单信息
174   - * @param senderCityId 发送城市ID
  184 + * @param senderCityId 发送城市ID
175 185 * @param receiverCityId 接收城市ID
176 186 * @return 计算结果
177 187 */
... ... @@ -196,7 +206,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
196 206  
197 207 /**
198 208 * 补充数据
199   - * @param order 订单
  209 + *
  210 + * @param order 订单
200 211 * @param orderLocation 订单位置
201 212 */
202 213 private void appendOtherInfo(OrderEntity order, OrderLocationEntity orderLocation) {
... ... @@ -234,7 +245,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
234 245 * 构建订单
235 246 *
236 247 * @param mailingSaveDTO 下单信息
237   - * @param sendAddress 发送地址
  248 + * @param sendAddress 发送地址
238 249 * @param receiptAddress 接收地址
239 250 * @return
240 251 */
... ... @@ -310,6 +321,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
310 321  
311 322 /**
312 323 * 合并地址
  324 + *
313 325 * @param entity 订单
314 326 * @return 地址
315 327 */
... ... @@ -326,6 +338,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
326 338  
327 339 /**
328 340 * 合并地址
  341 + *
329 342 * @param orderDTO 订单
330 343 * @return 地址
331 344 */
... ... @@ -341,6 +354,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
341 354  
342 355 /**
343 356 * 合并地址
  357 + *
344 358 * @return 地址
345 359 */
346 360 private StringBuilder areaAddress(Long province, Long city, Long county) {
... ... @@ -378,7 +392,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
378 392 cargoEntity.setWeight(mailingSaveDTO.getTotalWeight());
379 393  
380 394 // 体积
381   - BigDecimal volume = ObjectUtil.isEmpty(mailingSaveDTO.getTotalVolume()) ? new BigDecimal("0.0001") : mailingSaveDTO.getTotalVolume().divide(new BigDecimal("1000000.00"));
  395 + BigDecimal volume = ObjectUtil.isEmpty(mailingSaveDTO.getTotalVolume()) ? new BigDecimal("0.0001") : mailingSaveDTO.getTotalVolume().divide(new BigDecimal("1000000.00"));
382 396 cargoEntity.setTotalVolume(volume);
383 397 cargoEntity.setVolume(volume);
384 398 return cargoEntity;
... ... @@ -422,7 +436,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
422 436 /**
423 437 * 取件
424 438 *
425   - * @param orderEntity 订单
  439 + * @param orderEntity 订单
426 440 * @param orderLocation 位置
427 441 */
428 442 private void noticeOrderStatusChange(OrderEntity orderEntity, OrderLocationEntity orderLocation) {
... ...
sl-express-ms-web-customer/src/main/java/com/sl/ms/web/customer/vo/oms/MailingSaveVO.java
... ... @@ -12,9 +12,15 @@ public class MailingSaveVO {
12 12 @ApiModelProperty("发件方地址簿id")
13 13 private Long sendAddress;
14 14  
  15 + @ApiModelProperty("发件方地址经纬度")
  16 + private String sendLocation;
  17 +
15 18 @ApiModelProperty("收件方地址簿id")
16 19 private Long receiptAddress;
17 20  
  21 + @ApiModelProperty("收件方地址经纬度")
  22 + private String receiptLocation;
  23 +
18 24 @ApiModelProperty("取件时间")
19 25 private String pickUpTime;
20 26  
... ...