liujunchi 3 vuotta sitten
vanhempi
commit
54f461084e

+ 5 - 3
cooleshow-mall/mall-mbg/src/main/java/com/yonge/cooleshow/mbg/mapper/UserOrderPaymentMapper.java

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.mbg.mapper;
 
 import com.yonge.cooleshow.mbg.model.UserOrderPayment;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -15,9 +16,10 @@ public interface UserOrderPaymentMapper {
     int updateByPrimaryKeySelective(UserOrderPayment userOrderPayment);
 
 
-    List<UserOrderPayment> selectByOrderNo(String orderSn);
+    List<UserOrderPayment> selectByOrderNo(@Param("orderSn") String orderSn);
 
-    UserOrderPayment selectByOrderNoAndStatus(String orderSn, String payChannel, String payStatus);
+    UserOrderPayment selectByOrderNoAndStatus(@Param("orderSn") String orderSn, @Param(
+            "payChannel") String payChannel, @Param("payStatus") String payStatus);
 
-    List<UserOrderPayment> selectByOrderNoAndStatusPaying(String orderSn);
+    UserOrderPayment selectByOrderNoAndStatusPaying(@Param("orderSn") String orderSn);
 }

+ 19 - 0
cooleshow-mall/mall-mbg/src/main/resources/config/mybatis/UserOrderPaymentMapper.xml

@@ -226,4 +226,23 @@
         <include refid="Base_Column_List" />
       from user_order_payment where trans_no_ = #{orderNo} limit 1
     </select>
+
+    <select id="selectByOrderNo" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from user_order_payment where order_no_ = #{orderSn}
+    </select>
+
+    <select id="selectByOrderNoAndStatusPaying" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from user_order_payment where order_no_ = #{orderSn} and status_ = 'paying'
+    </select>
+
+    <select id="selectByOrderNoAndStatus" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from user_order_payment where order_no_ = #{orderSn}
+        and status_ = #{payStatus} and pay_channel_ = #{payChannel}
+    </select>
 </mapper>

+ 2 - 4
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/UserOrderPaymentServiceImpl.java

@@ -65,11 +65,9 @@ public class UserOrderPaymentServiceImpl implements UserOrderPaymentService {
 
     @Override
     public void closePayment(String orderSn, String message) {
-        List<UserOrderPayment> userOrderPaymentList = userOrderPaymentMapper.selectByOrderNoAndStatusPaying(orderSn);
+        UserOrderPayment orderPayment = userOrderPaymentMapper.selectByOrderNoAndStatusPaying(orderSn);
 
-        if (CollectionUtils.isEmpty(userOrderPaymentList))
-            return;
-        for (UserOrderPayment orderPayment : userOrderPaymentList) {
+        if (orderPayment != null) {
             //更新付款单
             orderPayment.setStatus(PayStatusEnum.failed.getCode());
             orderPayment.setPayFailMsg(StringUtil.isEmpty(message) ? "交易取消" : message);