From e3b9cc6f8c579c92fc3fedec30e6ed670dba60d4 Mon Sep 17 00:00:00 2001 From: chenjiahe <763432473@qq.com> Date: 星期五, 11 八月 2023 18:54:18 +0800 Subject: [PATCH] 退款兼容退 --- phi_platform_common/src/main/java/com/hx/phip/tool/payment/ConsumeTool.java | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/phi_platform_common/src/main/java/com/hx/phip/tool/payment/ConsumeTool.java b/phi_platform_common/src/main/java/com/hx/phip/tool/payment/ConsumeTool.java index 11c14f9..7b77afe 100644 --- a/phi_platform_common/src/main/java/com/hx/phip/tool/payment/ConsumeTool.java +++ b/phi_platform_common/src/main/java/com/hx/phip/tool/payment/ConsumeTool.java @@ -1,21 +1,18 @@ package com.hx.phip.tool.payment; import com.hx.common.service.CommonService; -import com.hx.exception.TipsException; import com.hx.mybatisTool.SqlSentence; -import com.hx.phiappt.common.ConsumePayConstants; import com.hx.phiappt.dao.mapper.ConsumeNotifyMapper; import com.hx.phiappt.model.PaymentMethod; -import com.hx.phiappt.model.Shop; import com.hx.phiappt.model.consume.ConsumeNotify; import com.hx.phiappt.model.consume.ConsumePay; -import com.hx.phiappt.model.consume.RecordConsume; import com.hx.phip.dao.mapper.PaymentMethodMapper; -import com.hx.phip.vo.payment.ConsumePayVo; import com.hx.util.StringUtils; import java.math.BigDecimal; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /**娑堣垂璁板綍宸ュ叿 * @@ -152,6 +149,43 @@ return commonService.selectList(ConsumeNotifyMapper.class,sqlSentence); } + /**閫氳繃鏀粯鏂瑰紡缂栧彿鍜岄噾棰濊幏鍙栧埌鏀粯鍥炶皟淇℃伅锛岃幏鍙栧鏉★紝鍗囧簭鎺掑簭 + * @param orderId 鏀粯鍥炶皟淇℃伅鍏宠仈鏍囪瘑 + * @param paymentNo 鏀粯鏂瑰紡缂栧彿 + * @param payAmount 鏀粯閲戦 + * @param commonService 鏄犲皠 + * @return 鏀粯鍥炶皟淇℃伅 + */ + public static List<ConsumeNotify> selectList(String orderId,String paymentNo,BigDecimal payAmount, CommonService commonService){ + SqlSentence sqlSentence = new SqlSentence(); + Map<String,Object> values = new HashMap<>(); + StringBuilder stringBuilder = new StringBuilder(); + + values.put("orderId",orderId); + values.put("paymentNo",paymentNo); + stringBuilder.append("SELECT * FROM consume_notify WHERE isDel = 0 AND paymentNo = #{m.paymentNo} AND orderId = #{m.orderId}"); + if(payAmount != null){ + values.put("payAmount",payAmount); + stringBuilder.append(" AND payAmount = #{m.payAmount}"); + } + stringBuilder.append(" ORDER BY payAmount ASC"); + sqlSentence.sqlSentence(stringBuilder.toString(),values); + return commonService.selectList(ConsumeNotifyMapper.class,sqlSentence); + } + + /**鏇存柊鏀粯鍥炶皟鐨勯��娆鹃噾棰濅俊鎭�*/ + public static void updateRefundTotal(ConsumeNotify consumeNotify,BigDecimal refundTotal,int refundStatus,CommonService commonService){ + SqlSentence sqlSentence = new SqlSentence(); + Map<String,Object> values = new HashMap<>(); + + values.put("refundTotal",refundTotal); + values.put("id",consumeNotify.getId()); + values.put("refundStatus",refundStatus); + sqlSentence.sqlUpdate("refundTotal = refundTotal+#{m.refundTotal},refundStatus = #{m.refundStatus} WHERE id = #{m.id}",values); + commonService.updateWhere(ConsumeNotify.class,sqlSentence); + } + + /** * 鑾峰彇鏀粯鏂瑰紡 * @param numberNo 鏀粯缂栧彿 -- Gitblit v1.8.0