Commit e01a85ed97dfff090fa5e79f2d10933a154c6b38

Authored by fengliang
1 parent b8b53e1d

update:增加运输费

etrade-order/src/main/java/com/diligrp/etrade/order/domain/OrderCreateDto.java
1 1 package com.diligrp.etrade.order.domain;
2 2  
  3 +import com.diligrp.etrade.order.util.NumberTransform;
3 4 import com.diligrp.etrade.shop.domain.response.ShopVo;
4 5 import jakarta.validation.Valid;
5 6 import jakarta.validation.constraints.Min;
... ... @@ -143,6 +144,9 @@ public class OrderCreateDto{
143 144 @Valid
144 145 private OrderDeliveryDto delivery;
145 146  
  147 + /** 配送费用 */
  148 + private BigDecimal transportFee = NumberTransform.ZERO;
  149 +
146 150 public Integer getAchieveType() {
147 151 return achieveType;
148 152 }
... ... @@ -438,4 +442,12 @@ public class OrderCreateDto{
438 442 public void setDelivery(OrderDeliveryDto delivery) {
439 443 this.delivery = delivery;
440 444 }
  445 +
  446 + public BigDecimal getTransportFee() {
  447 + return transportFee;
  448 + }
  449 +
  450 + public void setTransportFee(BigDecimal transportFee) {
  451 + this.transportFee = transportFee;
  452 + }
441 453 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/model/Order.java
... ... @@ -279,6 +279,9 @@ public class Order {
279 279 /** 订单配送状态 */
280 280 private Integer achieveState;
281 281  
  282 + /** 运费 */
  283 + private Long transportFee;
  284 +
282 285 public Integer getAchieveType() {
283 286 return achieveType;
284 287 }
... ... @@ -734,4 +737,12 @@ public class Order {
734 737 public void setRelationId(Long relationId) {
735 738 this.relationId = relationId;
736 739 }
  740 +
  741 + public Long getTransportFee() {
  742 + return transportFee;
  743 + }
  744 +
  745 + public void setTransportFee(Long transportFee) {
  746 + this.transportFee = transportFee;
  747 + }
737 748 }
738 749 \ No newline at end of file
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/model/OrderPayment.java
... ... @@ -87,6 +87,11 @@ public class OrderPayment {
87 87 */
88 88 private Long relationId;
89 89  
  90 + /**
  91 + * 运费
  92 + */
  93 + private Long transportFee;
  94 +
90 95 public Long getTotleSellerFee() {
91 96 return totleSellerFee;
92 97 }
... ... @@ -344,4 +349,12 @@ public class OrderPayment {
344 349 public void setRelationId(Long relationId) {
345 350 this.relationId = relationId;
346 351 }
  352 +
  353 + public Long getTransportFee() {
  354 + return transportFee;
  355 + }
  356 +
  357 + public void setTransportFee(Long transportFee) {
  358 + this.transportFee = transportFee;
  359 + }
347 360 }
348 361 \ No newline at end of file
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderGoodsServiceImpl.java
... ... @@ -185,7 +185,10 @@ public class OrderGoodsServiceImpl implements OrderGoodsService {
185 185 waitCouponAmount = waitCouponAmount.subtract(couponAmount);
186 186 }
187 187 }
188   -
  188 + //配送情况增加计算运费
  189 + if(buyerOrderDto.getAchieveType().equals(OrderAchieveType.SELLER_DELIVERY.getCodeInteger())){
  190 + allmount.add(buyerOrderDto.getTransportFee());
  191 + }
189 192 //效验库存
190 193 for(Long key:validateStockMap.keySet()){
191 194 ProductCheckDto productDtotemp = validateStockMap.get(key);
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderPaymenServiceImpl.java
... ... @@ -394,6 +394,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService {
394 394 }else{
395 395 orderPayment = new OrderPayment();
396 396 }
  397 + orderPayment.setTransportFee(order.getTransportFee());
397 398 orderPayment.setMarketId(order.getMarketId());
398 399 orderPayment.setOrderId(order.getId());
399 400 orderPayment.setOrderCode(order.getCode());
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
... ... @@ -1135,6 +1135,9 @@ public class OrderServiceImpl implements OrderService {
1135 1135 order.setTotleAmount(buyerOrderDto.getTotleAmount().multiply(new BigDecimal(100)).longValue());
1136 1136 order.setTotleDiscount(buyerOrderDto.getTotleDiscount().multiply(new BigDecimal(100)).longValue());
1137 1137 order.setTotleWeight(buyerOrderDto.getTotleWeight().multiply(new BigDecimal(500)).longValue());
  1138 + if(buyerOrderDto.getAchieveType().equals(OrderAchieveType.SELLER_DELIVERY.getCodeInteger())&&buyerOrderDto.getTransportFee()!=null){
  1139 + order.setTransportFee(buyerOrderDto.getTransportFee().multiply(new BigDecimal(100)).longValue());
  1140 + }
1138 1141 order.setTotlePaidAmount(0L);
1139 1142 order.setTotlePayAmount(buyerOrderDto.getTotlePayAmount().multiply(new BigDecimal(100)).longValue());
1140 1143 order.setPayState(OrderPayState.WAIT_PAY.getCodeInteger());
... ...