| | |
| | | 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.*; |
| | |
| | | } |
| | | |
| | | 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(); |
| | |
| | | |
| | | |
| | | //退款总记录 |
| | | |
| | | 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); |
| | |
| | | RefundRecordItem refundRecordItem=null; |
| | | RefundRecordMethod refundRecordMethod=null; |
| | | RefundRecordItemSource refundRecordItemSource=null; |
| | | |
| | | orderNodeBuilder.append("-处理退款方式"); |
| | | for (OrderPayMethodDto orderPayMethodDto : refundPayMethod) { |
| | | String payMethodNo = orderPayMethodDto.getPayMethodNo();//支付方式编码 |
| | | BigDecimal money = orderPayMethodDto.getMoney();//实退金额 |
| | |
| | | String type =null; |
| | | OrderItem orderItem =null; |
| | | OrderItemSon orderItemSon =null; |
| | | orderNodeBuilder.append("-处理退款详情"); |
| | | for (OrderItemRefundDto orderItemRefundDto : refundList) { |
| | | orderItemId = orderItemRefundDto.getOrderItemId();//orderItemId |
| | | refundNum = orderItemRefundDto.getRefundNum();//实退数 |
| | |
| | | |
| | | } |
| | | //处理优惠卷 |
| | | orderNodeBuilder.append("-处理退款优惠卷"); |
| | | CouponOrderDiscountLog couponOrderDiscountLog=null; |
| | | RefundRecordCoupon refundRecordCoupon=null; |
| | | for (OrderCouponRefunDto orderCouponRefunDto : couponList) { |
| | |
| | | |
| | | 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; |
| | | } |
| | | } |