Explorar el Código

Merge branch 'master' of hyq/kmall-pt into master

黄亚琴 hace 6 años
padre
commit
6c6f4bda2a

+ 2 - 1
kmall-api/src/main/java/com/kmall/api/contants/Dict.java

@@ -334,11 +334,12 @@ public class Dict {
     }
 
     /**
-     * 订单状态: 0 订单创建成功等待付款, 101 订单已取消, 102 订单已删除,201 订单已付款,等待发货,300 订单已发货, 301 用户确认收货,400 维权申请中
+     * 订单状态: 0 订单创建成功等待付款,100订单付款中, 101 订单已取消, 102 订单已删除,201 订单已付款,等待发货,300 订单已发货, 301 用户确认收货,400 维权申请中
      * 401 没有发货,退款 402 已收货,退款退货
      */
     public enum orderStatus {
         item_0("0", "订单创建成功等待付款"),
+        item_100("100", "订单付款中"),
         item_101("101", "订单已取消"),
         item_102("102", "订单已删除"),
         item_201("201", "订单已付款"),

+ 3 - 0
kmall-api/src/main/java/com/kmall/api/entity/OrderVo.java

@@ -597,6 +597,9 @@ public class OrderVo implements Serializable {
                 case 0:
                     order_status_text = "未付款";
                     break;
+                case 100:
+                    order_status_text = "付款中";
+                    break;
                 case 201:
                     order_status_text = "等待发货";
                     break;

+ 5 - 5
kmall-api/src/main/java/com/kmall/api/service/ApiPayService.java

@@ -77,7 +77,8 @@ public class ApiPayService {
         for (OrderVo orderInfo: orderVoList) {
             // 业务处理
             orderInfo.setPay_id(prepay_id);
-            orderInfo.setPay_status(1); // 付款中
+            orderInfo.setPay_status(Integer.parseInt(Dict.payStatus.item_1.getItem())); // 付款中
+            orderInfo.setOrder_status(Integer.parseInt(Dict.orderStatus.item_100.getItem()));
             orderService.update(orderInfo);
 
             Map map = new HashMap();
@@ -135,9 +136,8 @@ public class ApiPayService {
                     mallOrderExceptionRecord.setCreateTime(new Date());
                     mallOrderExceptionRecordMapper.save(mallOrderExceptionRecord);//支付订单异常记录
                 }
-                if(Dict.orderStatus.item_0.getItem().equalsIgnoreCase(orderInfo.getOrder_status()+"")
-                        && (Dict.payStatus.item_0.getItem().equalsIgnoreCase(orderInfo.getPay_status()+"") || Dict.payStatus.item_1.getItem().equalsIgnoreCase(orderInfo.getPay_status()+""))
-                        ){
+                if(Dict.orderStatus.item_100.getItem().equalsIgnoreCase(orderInfo.getOrder_status()+"")
+                        && Dict.payStatus.item_1.getItem().equalsIgnoreCase(orderInfo.getPay_status()+"")){
 
                     OrderProcessRecordEntity processRecordEntity = orderProcessRecordMapper.queryObjectByOrderSn(orderInfo.getOrder_sn());
                     if(processRecordEntity != null){
@@ -153,7 +153,7 @@ public class ApiPayService {
                     orderInfo.setPayTransactionId(transaction_id);
                     orderInfo.setPay_status(Integer.parseInt(Dict.payStatus.item_2.getItem()));
                     orderInfo.setPay_time(timeEnd);//微信下单完成时间
-                    if (orderInfo.getOrder_status() == 0) {
+                    if (orderInfo.getOrder_status() == Integer.parseInt(Dict.orderStatus.item_100.getItem())) {
                         orderInfo.setOrder_status(Integer.parseInt(Dict.orderStatus.item_201.getItem()));
                     }
                     orderService.update(orderInfo);

+ 18 - 0
kmall-common/src/main/java/com/kmall/common/utils/wechat/WechatRefundApiResult.java

@@ -30,6 +30,24 @@ public class WechatRefundApiResult {
 	private String refund_account;//退款资金来源
 	private String refund_recv_accout;//退款入账账户
 	private String success_time;//退款成功时间
+	/**
+	 * SUCCESS—支付成功
+	 REFUND—转入退款
+	 NOTPAY—未支付
+	 CLOSED—已关闭
+	 REVOKED—已撤销(刷卡支付)
+	 USERPAYING--用户支付中
+	 PAYERROR--支付失败(其他原因,如银行返回失败)
+	 */
+	private String trade_state;//交易状态
+
+	public String getTrade_state() {
+		return trade_state;
+	}
+
+	public void setTrade_state(String trade_state) {
+		this.trade_state = trade_state;
+	}
 
 	public String getRefund_account() {
 		return refund_account;

+ 1 - 1
kmall-schedule/src/main/java/com/kmall/schedule/service/QzOrderService.java

@@ -278,7 +278,7 @@ public class QzOrderService {
                 String orderId = MapUtils.getString("order_id", map);
                 WechatRefundApiResult result = WechatUtil.wxOrderQuery(out_trade_no);
                 if (result.getReturn_code().equalsIgnoreCase("SUCCESS")) {
-                    if(result.getResult_code().equalsIgnoreCase("SUCCESS")) {
+                    if(result.getResult_code().equalsIgnoreCase("SUCCESS") && result.getTrade_state().equalsIgnoreCase("SUCCESS")) {
                         Date successTime = DateUtils.convertStringToDate(result.getTime_end(),DateUtils.DATE_TIME_PATTERN_YYYY_MM_DD_HH_MM_SS);
 
                         Map orderRaram = new HashMap();

+ 3 - 2
kmall-schedule/src/main/resources/mybatis/mapper/QzOrderMapper.xml

@@ -28,7 +28,7 @@
         AND c.store_id = a.store_id
         WHERE 1 = 1
         AND a.add_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -15 MINUTE)
-        AND a.order_status = 0 and a.order_type = 1
+        AND a.order_status in (0,100) and a.order_type = 1
     </select>
     <update id="unpayPastUpdate">
         UPDATE mall_order a
@@ -56,7 +56,8 @@
 
     <select id="queryPayingOrderList" resultType="map">
 		select a.pay_transaction_id,a.order_sn,a.order_status,a.pay_status,a.id 'order_id',a.merch_order_sn
-        from mall_order a where (a.order_status = '201' and a.pay_status not in (0,3,4)) and (a.pay_transaction_id = '' or a.pay_transaction_id is null or a.pay_time is null or a.pay_time = '')
+        from mall_order a where (a.order_status in ('100','201') and a.pay_status in (1,2))
+        and (a.pay_transaction_id = '' or a.pay_transaction_id is null or a.pay_time is null or a.pay_time = '')
     </select>
 
 

+ 3 - 3
wx-mall/pages/catalog/catalog.wxml

@@ -111,7 +111,7 @@
       <view class="cate-item">
         <view wx:if="{{goodsList != null && goodsList.length == 0}}" class="item-text">未找到相关商品</view>
         <view class="item" wx:for="{{goodsList}}" wx:for-index="index" wx:for-item="item" wx:key="{{item.id}}">
-          <navigator url="/pages/goods/goods?id='+{{item.id}}">
+          <navigator url="/pages/goods/goods?id={{item.id}}">
             <view class="left">
               <image class="img" wx:if="{{item.list_pic_url}}" src="{{item.list_pic_url}}"></image>
             </view>
@@ -120,14 +120,14 @@
           <view class="right">
             <view class="text">
 
-          <navigator url="/pages/goods/goods?id='+{{item.id}}">
+          <navigator url="/pages/goods/goods?id={{item.id}}">
             <text class="name" bindtap="bindtapGoodsDetail" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.name?item.name:""}}</text>
             <text class="desc" bindtap="bindtapGoodsDetail" data-item-id="{{filterDiscount != 2?item.id:item.group_id}}">{{item.goods_brief?item.goods_brief:""}}</text>
           </navigator>
 
 
           <view class="goods-do">
-            <navigator url="/pages/goods/goods?id='+{{item.id}}">
+            <navigator url="/pages/goods/goods?id={{item.id}}">
               <text class="price">{{item.retail_price?"¥"+item.retail_price:"¥0"}}</text>
               <text class="org-price line-through">{{item.market_price?"¥"+item.market_price:""}}</text>
             </navigator>

+ 1 - 1
wx-mall/pages/goods/goods.wxml

@@ -101,7 +101,7 @@
     </view>-->
     <view class="comments" bindtap="hideSwitchAttrPop">
       <view class="h">
-        <navigator url='{{comment.count > 0?"../comment/comment?valueId={{goods.id}}&typeId=0":""}}'>
+        <navigator url='{{comment.count > 0?"../comment/comment?valueId="+goods.id+"&typeId=0":""}}'>
           <text class="t">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
           <text class="i">查看全部</text>
         </navigator>