From 46bedbc61c28f7c8c9a0e8740c87c78f0bf5a51d Mon Sep 17 00:00:00 2001
From: zhangxu <3%usVi4iXbVkhI1c>
Date: 星期二, 06 十二月 2022 11:14:35 +0800
Subject: [PATCH] 部分退款记录日志喝节点记录

---
 phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
index 77dfd79..0188aec 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
@@ -4,15 +4,14 @@
 import com.hx.common.service.CommonService;
 import com.hx.mybatisTool.SqlSentence;
 import com.hx.phiappt.common.ConsumePayConstants;
+import com.hx.phiappt.common.OrderLogConstants;
 import com.hx.phiappt.common.OrderTotalConstants;
 import com.hx.phiappt.common.RefundSoruceConstants;
 import com.hx.phiappt.model.BaseEntity;
 import com.hx.phiappt.model.PaymentMethod;
 import com.hx.phiappt.model.coupon.CouponNumber;
 import com.hx.phiappt.model.coupon.CouponOrderDiscountLog;
-import com.hx.phiappt.model.order.OrderItem;
-import com.hx.phiappt.model.order.OrderItemSon;
-import com.hx.phiappt.model.order.OrdersTotal;
+import com.hx.phiappt.model.order.*;
 import com.hx.phiappt.model.refund.*;
 import com.hx.phip.config.CustomParameter;
 import com.hx.phip.dao.mapper.*;
@@ -135,6 +134,13 @@
     }
 
     public Map<String,Object>  handlePartRefund(OrdersTotal ordersTotal,OrderRefundDto orderRefundDto){
+
+        //璁㈠崟鑺傜偣鏃ュ織
+        OrdersNodeLog ordersNodeLog = new OrdersNodeLog();
+        StringBuilder orderNodeBuilder = new StringBuilder();
+
+        orderNodeBuilder.append("寮�濮嬮儴鍒嗛��娆�");
+
         List<OrderPayMethodDto> refundPayMethod=orderRefundDto.getRefundPayMethod();
         List<OrderItemRefundDto> refundList=orderRefundDto.getRefundList();
         List<OrderCouponRefunDto> couponList=orderRefundDto.getCouponList();
@@ -150,7 +156,7 @@
 
 
         //閫�娆炬�昏褰�
-
+        orderNodeBuilder.append("-澶勭悊閫�娆炬�昏褰�");
         String totalCode = CreateNo.createTimeNo(systemParameterMapper, "R", 16, "yyyyMMddHHmmss");//鎬昏鍗曠紪鍙�
         RefundRecord refundRecord=new RefundRecord(totalCode,ordersTotal.getShopId(),ordersTotal.getShopName(),sumMoney, OrderTotalConstants.STATUS_REFUND_APPLY,0, RefundSoruceConstants.TYPE_SOURCE_ORDER,"phis閮ㄥ垎閫�娆�",ordersTotal.getId(),ordersTotal.getUserId());
         refundRecordService.insert(refundRecord);
@@ -161,7 +167,7 @@
         RefundRecordItem refundRecordItem=null;
         RefundRecordMethod refundRecordMethod=null;
         RefundRecordItemSource refundRecordItemSource=null;
-
+        orderNodeBuilder.append("-澶勭悊閫�娆炬柟寮�");
         for (OrderPayMethodDto orderPayMethodDto : refundPayMethod) {
             String payMethodNo = orderPayMethodDto.getPayMethodNo();//鏀粯鏂瑰紡缂栫爜
             BigDecimal money = orderPayMethodDto.getMoney();//瀹為��閲戦
@@ -187,6 +193,7 @@
         String type =null;
         OrderItem orderItem =null;
         OrderItemSon orderItemSon =null;
+        orderNodeBuilder.append("-澶勭悊閫�娆捐鎯�");
         for (OrderItemRefundDto orderItemRefundDto : refundList) {
             orderItemId = orderItemRefundDto.getOrderItemId();//orderItemId
             refundNum = orderItemRefundDto.getRefundNum();//瀹為��鏁�
@@ -248,6 +255,7 @@
 
         }
         //澶勭悊浼樻儬鍗�
+        orderNodeBuilder.append("-澶勭悊閫�娆句紭鎯犲嵎");
         CouponOrderDiscountLog couponOrderDiscountLog=null;
         RefundRecordCoupon refundRecordCoupon=null;
         for (OrderCouponRefunDto orderCouponRefunDto : couponList) {
@@ -263,12 +271,28 @@
 
         String operationId=operator.get("operatorId");
         String operatorName=operator.get("operatorName");
+
+        orderNodeBuilder.append("-澶勭悊閫�娆炬敮浠樻柟寮忥紝鐢ㄦ埛寰呮墽琛岄」鐩�");
         PartialRefundUtil.refundProcess(commonService, operationId, operatorName, refundRecord.getId(), customParameter,ordersTotal.getAppIdCode());
         //杩斿洖鏁版嵁
         Map<String,Object> data=new HashMap<>();
         data.put("refundRecordId",refundRecord.getId());
         data.put("refundRecordCode",refundRecord.getCode());
 
+
+        //璁板綍鎿嶄綔鏃ュ織
+        orderNodeBuilder.append("-璁板綍鎿嶄綔鏃ュ織");
+        StringBuffer stringBuffer=new StringBuffer("鎿嶄綔浜�:"+operator.get("operatorName")+",杩涜閮ㄥ垎閫�娆�");
+        OrderLog orderLog=new OrderLog(ordersTotal.getId(), OrderLogConstants.LOG_TYPE_REFUND,stringBuffer.toString()
+                ,operator.get("operatorName"),operator.get("operatorId"),OrderTotalConstants.STATUS_CANCEL);
+        commonService.insert(OrderLogMapper.class,orderLog);
+
+        orderNodeBuilder.append("-缁撴潫澶勭悊閫�娆�");
+        ordersNodeLog.setCommonType(OrdersNodeLog.TYPE_COMMON_ORDER_REFUND);
+        ordersNodeLog.setContent(orderNodeBuilder.toString());
+        ordersNodeLog.setOrderId(ordersTotal.getId());
+        commonService.insert(OrdersNodeLogMapper.class,ordersNodeLog);
+
         return data;
     }
 }

--
Gitblit v1.8.0