zhangxu
2022-12-06 46bedbc61c28f7c8c9a0e8740c87c78f0bf5a51d
部分退款记录日志喝节点记录
1个文件已修改
34 ■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
    }
}