|
@@ -92,7 +92,6 @@ public class OrderRefundController {
|
|
@Autowired
|
|
@Autowired
|
|
private SkuService skuService;
|
|
private SkuService skuService;
|
|
|
|
|
|
-
|
|
|
|
@GetMapping("getIsDistribution")
|
|
@GetMapping("getIsDistribution")
|
|
@ApiOperation(value = "获取是否在配送中")
|
|
@ApiOperation(value = "获取是否在配送中")
|
|
public ResponseEntity<Boolean> getIsDistribution( String orderNumber){
|
|
public ResponseEntity<Boolean> getIsDistribution( String orderNumber){
|
|
@@ -389,7 +388,18 @@ public class OrderRefundController {
|
|
newOrderRefund.setApplyTime(new Date());
|
|
newOrderRefund.setApplyTime(new Date());
|
|
newOrderRefund.setUpdateTime(new Date());
|
|
newOrderRefund.setUpdateTime(new Date());
|
|
newOrderRefund.setFreightAmount(orderRefundParam.getFreightAmount());
|
|
newOrderRefund.setFreightAmount(orderRefundParam.getFreightAmount());
|
|
- newOrderRefund.setOffsetPoints(order.getOffsetPoints()==null?0:order.getOffsetPoints());
|
|
|
|
|
|
+
|
|
|
|
+ long orderPoints = order.getOffsetPoints() == null ? 0 : order.getOffsetPoints();
|
|
|
|
+ if (orderPoints==0){
|
|
|
|
+ newOrderRefund.setOffsetPoints(orderPoints);
|
|
|
|
+ }else {
|
|
|
|
+ double refundTotalPoints = orderRefundParam.getOrderRefundSkuList().stream()
|
|
|
|
+ .mapToDouble(item -> item.getSkuPrice() * item.getProductCount())
|
|
|
|
+ .sum()*100;
|
|
|
|
+ long refundPoints = Math.round(refundTotalPoints);
|
|
|
|
+ newOrderRefund.setOffsetPoints(Math.min(refundPoints, orderPoints));
|
|
|
|
+ }
|
|
|
|
+
|
|
OrderRefund orderRefund = orderRefundService.applyRefund(newOrderRefund);
|
|
OrderRefund orderRefund = orderRefundService.applyRefund(newOrderRefund);
|
|
if (!orderRefundSkuList.isEmpty()){
|
|
if (!orderRefundSkuList.isEmpty()){
|
|
orderRefundSkuList.forEach(c->{
|
|
orderRefundSkuList.forEach(c->{
|