赵冬冬 4 роки тому
батько
коміт
a76671e085

+ 1 - 0
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/ForestPortalApplication.java

@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.ComponentScan;
+import org.springframework.scheduling.annotation.EnableAsync;
 
 @SpringBootApplication
 @ComponentScan(basePackages = {"com.hwrj.cloud.portal","com.hwrj.cloud.security"})

+ 1 - 1
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/controller/WechatH5PayController.java

@@ -166,7 +166,6 @@ public class WechatH5PayController {
             if ("SUCCESS".equals(wxPayOrderNotifyResult.getResultCode())) {
                 isPayOk = true;
             }
-            log.info("解析数据:" + wxPayOrderNotifyResult.toString());
         } catch (WxPayException e) {
             e.printStackTrace();
         }
@@ -180,6 +179,7 @@ public class WechatH5PayController {
             String orderNum = wxPayOrderNotifyResult.getOutTradeNo();
             log.info("orderNum:" + orderNum);
             //将订单更新为支付
+            log.info("解析数据:" + wxPayOrderNotifyResult.toString());
             omsOrderPayService.update(orderNum);
             /**
              * 自己的业务

+ 26 - 13
forest-portal/portal-server/src/main/java/com/hwrj/cloud/portal/service/impl/OmsOrderPayServiceImpl.java

@@ -8,7 +8,9 @@ import com.hwrj.cloud.portal.model.UmsMember;
 import com.hwrj.cloud.portal.service.OmsOrderPayService;
 import com.hwrj.cloud.portal.service.UmsMemberService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Date;
 
@@ -38,20 +40,31 @@ public class OmsOrderPayServiceImpl implements OmsOrderPayService {
     }
 
     @Override
+    @Transactional
     public void update(String valueOf) {
+        long start=System.currentTimeMillis();
+
         OmsOrderPay omsOrderPay = omsOrderPayMapper.selectByPrimaryKey(valueOf);
-        omsOrderPay.setStatus(1);
-        omsOrderPay.setUpdateTime(new Date());
-        omsOrderPayMapper.updateByPrimaryKeySelective(omsOrderPay);
-        Long orderId = omsOrderPay.getOrderId();
-        OmsOrder order =new OmsOrder();
-        order.setId(orderId);
-        //设置为微信支付
-        order.setPayType(2);
-        //设置为待发货
-        order.setStatus(1);
-        //设置支付时间
-        order.setPaymentTime(new Date());
-        omsOrderMapper.updateByPrimaryKeySelective(order);
+        if(omsOrderPay.getStatus().intValue()!=1){
+            long onr=System.currentTimeMillis();
+            System.out.println("查询>>>>>>>>>>>>>>:"+(onr-start)/1000+":秒");
+            omsOrderPay.setStatus(1);
+            omsOrderPay.setUpdateTime(new Date());
+            omsOrderPayMapper.updateByPrimaryKeySelective(omsOrderPay);
+            long two=System.currentTimeMillis();
+            System.out.println("更新1>>>>>>>>>>>>>>:"+(two-onr)/1000+":秒");
+            Long orderId = omsOrderPay.getOrderId();
+            OmsOrder order =new OmsOrder();
+            order.setId(orderId);
+            //设置为微信支付
+            order.setPayType(2);
+            //设置为待发货
+            order.setStatus(1);
+            //设置支付时间
+            order.setPaymentTime(new Date());
+            omsOrderMapper.updateByPrimaryKeySelective(order);
+            long tree=System.currentTimeMillis();
+            System.out.println("更新2>>>>>>>>>>>>>>:"+(tree-two)/1000+":秒");
+        }
     }
 }