| 
					
				 | 
			
			
				@@ -93,12 +93,11 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SkuService skuService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("getIsDistribution") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "获取是否在配送中") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public ResponseEntity<Boolean> getIsDistribution( String orderNumber){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResponseEntity<Boolean> getIsDistribution(String orderNumber) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Order order = orderService.getOrderByOrderNumber(orderNumber); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(ObjectUtil.isEmpty(order)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ObjectUtil.isEmpty(order)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new GlobalException("订单编号不存在,订单编号是否正确"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 已支付订单取消订单,已付款后需要相应处理物流状态 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -107,27 +106,17 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         orderDetailRequest.setOrigin_id(orderNumber); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             OrderStatusResponse orderStatusResponse = paoTuiApi.deliveryRoute(orderDetailRequest); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (ObjectUtil.isNotEmpty(orderStatusResponse.getInfo()) && orderStatusResponse.getInfo().size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(orderStatusResponse.getInfo().get(0).getStatus()==40){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ObjectUtil.isNotEmpty(orderStatusResponse.getInfo()) && orderStatusResponse.getInfo().size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (orderStatusResponse.getInfo().get(0).getStatus() == 40) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return ResponseEntity.ok(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return ResponseEntity.ok(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return ResponseEntity.ok(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @GetMapping("/queryOrderRefundById") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @ApiOperation(value = "查询申请退款单") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public ResponseEntity<OrderRefund> queryOrderRefundById(Long refundId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        OrderRefund orderRefund = orderRefundService.getById(refundId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (orderRefund == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new GlobalException("退款信息不存在..."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        orderRefund.setOrderRefundSkuList(orderRefundSkuMapper.selectList(new LambdaQueryWrapper<OrderRefundSku>().eq(OrderRefundSku::getOrderRefundId,refundId))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return ResponseEntity.ok(orderRefund); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("/applyAgain") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -135,10 +124,11 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResponseEntity<String> applyAgain(@Valid @RequestBody OrderRefundParam orderRefundParam) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("小程序(再次提交)申请退款参数:{}", JSONObject.toJSONString(orderRefundParam)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long refundId = orderRefundParam.getRefundId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CullenUtils.validateDataThrowException(refundId==null,"请输入旧退款订单ID..."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CullenUtils.validateDataThrowException(refundId == null, "请输入旧退款订单ID..."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<OrderRefundSku> orderRefundSkuList = orderRefundParam.getOrderRefundSkuList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CullenUtils.validateDataThrowException(orderRefundSkuList.isEmpty(),"退款商品不能为空..."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CullenUtils.validateDataThrowException(orderRefundSkuList.isEmpty(), "退款商品不能为空..."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String userId = SecurityUtils.getUser().getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 获取订单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Order order = orderService.getOrderByOrderNumberAndUserId(orderRefundParam.getOrderNumber(), userId, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!Objects.equals(order.getIsPayed(), 1)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -160,13 +150,14 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!orderRefundService.checkRefundDate(order)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new GlobalException("当前订单已确认收货超过" + Constant.MAX_FINALLY_REFUND_TIME + "天,无法退款"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (Objects.equals(order.getOrderType(), Constant.ORDER_TYPE_SCORE)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new GlobalException("积分商品,无法退款"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (Objects.equals(orderRefundParam.getRefundType(), RefundType.ALL.value()) && (!Objects.isNull(order.getRefundStatus()) && !Objects.equals(order.getRefundStatus(), RefundStatusEnum.DISAGREE.value()))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (Objects.equals(orderRefundParam.getRefundType(), RefundType.ALL.value()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                && (!Objects.isNull(order.getRefundStatus()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                && !Objects.equals(order.getRefundStatus(), RefundStatusEnum.DISAGREE.value()))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new GlobalException("该订单已有商品正在退款中,不能再进行整单退款"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 生成退款单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         OrderRefund newOrderRefund = new OrderRefund(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 获取所有正在进行中的退款订单 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -190,51 +181,6 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             newOrderRefund.setDistributionTotalAmount(orderService.sumTotalDistributionAmountByOrderItem(orderItemList)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 计算平台退款金额(退款时将这部分钱退回给平台,所以商家要扣除从平台这里获取的金额) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             newOrderRefund.setPlatformRefundAmount(order.getPlatformAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 部分物品退款 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            OrderItem orderItem = orderItemService.getOne(new LambdaQueryWrapper<OrderItem>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .eq(OrderItem::getOrderItemId, orderRefundParam.getOrderItemId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .eq(OrderItem::getOrderNumber, orderRefundParam.getOrderNumber())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (orderItem == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new GlobalException("该物品在订单中不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            boolean isCanRefund = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //  查看是否有支付金额和积分都为空的订单,有则抛出异常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (OrderItem item : orderItemList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (item.getActualTotal() <= 0.0 && item.getUseScore() <= 0.0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    isCanRefund = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (isCanRefund) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new GlobalException("该订单部分订单项支付金额和积分为0,无法使用部分退款!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (order.getPlatformAmount() > 0 && !Arith.isEquals(orderRefundParam.getRefundAmount(), orderItem.getActualTotal())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new GlobalException("该订单有使用平台优惠,无法使用部分退款!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 计算该订单项的分销金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            newOrderRefund.setDistributionTotalAmount(orderService.sumTotalDistributionAmountByOrderItem(Collections.singletonList(orderItem))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 计算平台退款金额(退款时将这部分钱退回给平台,所以商家要扣除从平台这里获取的金额) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            newOrderRefund.setPlatformRefundAmount(orderItem.getPlatformShareReduce()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 退款物品数量为null或者0时,则为退款全部数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (orderRefundParam.getGoodsNum() <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                orderRefundParam.setGoodsNum(orderItem.getProdCount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 判断退款数量是否溢出 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (orderRefundParam.getGoodsNum() > orderItem.getProdCount()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new GlobalException("退款物品数量已超出订单中的数量,不允许申请"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 判断退款金额是否超出订单金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            double refundSingleAmount = Arith.div(orderRefundParam.getRefundAmount(), orderRefundParam.getGoodsNum(), 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            double singleAmount = Arith.div(orderItem.getActualTotal(), orderItem.getProdCount(), 3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (refundSingleAmount > orderItem.getProductTotalAmount() || refundSingleAmount > singleAmount) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new GlobalException("退款金额已超出订单金额,无法申请"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newOrderRefund.setShopId(order.getShopId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -272,22 +218,52 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newOrderRefund.setReturnMoneySts(ReturnMoneyStsType.APPLY.value()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newOrderRefund.setApplyTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newOrderRefund.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        log.info( "申请退款申请,生成退款单信息{}", newOrderRefund); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        newOrderRefund.setFreightAmount(orderRefundParam.getFreightAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!orderRefundSkuList.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            orderRefundSkuList.forEach(c->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!orderRefundSkuList.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderRefundSkuList.forEach(c -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 c.setOrderRefundId(orderRefund.getRefundId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 orderRefundSkuMapper.insert(c); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //生成退款记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //生成申请退款记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderRefundRecord orderRefundRecord = new OrderRefundRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord.setOrderRefundId(orderRefund.getRefundId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord.setInstructions(newOrderRefund.getBuyerReason()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord.setAuditStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord.setSort(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecordMapper.insert(orderRefundRecord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //生成待商家审核记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OrderRefundRecord orderRefundRecord1 = new OrderRefundRecord(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord1.setOrderRefundId(orderRefund.getRefundId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord1.setInstructions("你的服务单已申请成功,待商家审核"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord1.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord1.setAuditStatus(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecord1.setSort(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundRecordMapper.insert(orderRefundRecord1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         orderRefundService.removeById(refundId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        orderRefundSkuMapper.delete(new LambdaQueryWrapper<OrderRefundSku>().eq(OrderRefundSku::getOrderRefundId,refundId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundSkuMapper.delete(new LambdaQueryWrapper<OrderRefundSku>().eq(OrderRefundSku::getOrderRefundId, refundId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //创建海博退款单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        log.info( "创建海博退款单,生成海博退款单信息{}", orderRefund); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        orderRefundService.createRefundOrder(orderRefund.getOrderNumber(),orderRefund.getRefundSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("创建海博退款单,生成海博退款单信息{}", orderRefund); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundService.createRefundOrder(orderRefund.getOrderNumber(), orderRefund.getRefundSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ResponseEntity.ok(newOrderRefund.getRefundSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -297,7 +273,7 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResponseEntity<String> apply(@Valid @RequestBody OrderRefundParam orderRefundParam) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("小程序申请退款参数:{}", JSONObject.toJSONString(orderRefundParam)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<OrderRefundSku> orderRefundSkuList = orderRefundParam.getOrderRefundSkuList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CullenUtils.validateDataThrowException(orderRefundSkuList.isEmpty(),"退款商品不能为空..."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CullenUtils.validateDataThrowException(orderRefundSkuList.isEmpty(), "退款商品不能为空..."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String userId = SecurityUtils.getUser().getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 获取订单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Order order = orderService.getOrderByOrderNumberAndUserId(orderRefundParam.getOrderNumber(), userId, true); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -392,19 +368,19 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         newOrderRefund.setFreightAmount(orderRefundParam.getFreightAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long orderPoints = order.getOffsetPoints() == null ? 0 : order.getOffsetPoints(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (orderPoints==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (orderPoints == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             newOrderRefund.setOffsetPoints(orderPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             double refundTotalPoints = orderRefundParam.getOrderRefundSkuList().stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     .mapToDouble(item -> item.getSkuPrice() * item.getProductCount()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .sum()*100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .sum() * 100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             long refundPoints = Math.round(refundTotalPoints); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             newOrderRefund.setOffsetPoints(Math.min(refundPoints, orderPoints)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         OrderRefund orderRefund = orderRefundService.applyRefund(newOrderRefund); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!orderRefundSkuList.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            orderRefundSkuList.forEach(c->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!orderRefundSkuList.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderRefundSkuList.forEach(c -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 c.setOrderRefundId(orderRefund.getRefundId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 orderRefundSkuMapper.insert(c); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -430,8 +406,8 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         orderRefundRecordMapper.insert(orderRefundRecord1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //创建海博退款单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        log.info( "创建海博退款单,生成海博退款单信息{}", orderRefund); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        orderRefundService.createRefundOrder(orderRefund.getOrderNumber(),orderRefund.getRefundSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("创建海博退款单,生成海博退款单信息{}", orderRefund); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundService.createRefundOrder(orderRefund.getOrderNumber(), orderRefund.getRefundSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        if(StringUtils.isNotEmpty(order.getQnhOrderId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //            //取消牵牛花订单 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -673,7 +649,7 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             order.setRefundStatus(RefundStatusEnum.DISAGREE.value()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderService.updateById(order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        orderRefundService.changeStatus(refundSn,40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        orderRefundService.changeStatus(refundSn, 40); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ResponseEntity.ok("撤销成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -723,10 +699,11 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 创建牵牛花订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param order 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public boolean createQNHOrder(Order order,String refundSn) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public boolean createQNHOrder(Order order, String refundSn) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 待添加创建牵牛花订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         OrderDto orderDto = new OrderDto(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -786,7 +763,7 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ArrayList<OrderDto.OrderDetails> orderDetails = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int weight = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<OrderItem> orderItems1 = orderItemService.getOrderItemsByOrderNumber(order.getOrderNumber()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (OrderItem orderItem:orderItems1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (OrderItem orderItem : orderItems1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             OrderDto.OrderDetails orderDetails1 = new OrderDto.OrderDetails(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Sku sku = skuService.getById(orderItem.getSkuId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderDetails1.setSkuId(sku.getPartyCode()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -795,8 +772,8 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderDetails1.setOrderItemId(orderItem.getOrderItemId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderDetails1.setName(orderItem.getProdName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderDetails1.setOriginalPrice(BigDecimal.valueOf(sku.getOriPrice())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            orderDetails1.setWeight((int)Math.round(sku.getWeight())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            weight+=orderDetails1.getWeight(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            orderDetails1.setWeight((int) Math.round(sku.getWeight())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            weight += orderDetails1.getWeight(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderDetails1.setSalePrice(BigDecimal.valueOf(sku.getPrice())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderDetails1.setQty(orderItem.getProdCount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderDetails1.setMoney(orderDetails1.getSalePrice().multiply(BigDecimal.valueOf(orderDetails1.getQty()))); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -805,7 +782,7 @@ public class OrderRefundController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         orderDto.setOrderDetails(orderDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         orderDto.setWeight(weight); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String added = qnhService.addOrder(orderDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(!StringUtils.isBlank(added)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!StringUtils.isBlank(added)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             order.setQnhOrderId(added); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             order.setQnhOrderStatus("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             orderService.updateById(order); 
			 |