浏览代码

fix: 模拟支付回调调整

Joburgess 4 年之前
父节点
当前提交
77e1bd8fb6
共有 1 个文件被更改,包括 12 次插入3 次删除
  1. 12 3
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

+ 12 - 3
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.student.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.huifu.adapay.Adapay;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
@@ -27,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.util.DigestUtils;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -82,6 +84,10 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
 
+
+    @Value("${spring.profiles.active:dev}")
+    private String profiles;
+
     @PostMapping("/notify")
     public Msg notify(@ModelAttribute Msg msg) throws Exception {
         logger.info(msg.toString());
@@ -290,8 +296,11 @@ public class StudentOrderController extends BaseController {
 
     //    @Scheduled(cron = "0/30 * * * * ?")
     @GetMapping("/setSuccessStatus")
-    public void setSuccessStatus() throws Exception {
-        List<StudentPaymentOrder> payingOrders = studentPaymentOrderService.findOrdersByStatus(DealStatusEnum.ING, "YQPAY");
+    public HttpResponseResult setSuccessStatus() throws Exception {
+        if (!profiles.equals("dev")) {
+            return failed("非法操作");
+        }
+        List<StudentPaymentOrder> payingOrders = studentPaymentOrderService.findOrdersByStatus(DealStatusEnum.ING, "ADAPAY");
 
         String[] statusArr = {"0", "1", "7"};
         for (StudentPaymentOrder payingOrder : payingOrders) {
@@ -313,7 +322,7 @@ public class StudentOrderController extends BaseController {
                 }
             }
         }
-
+        return succeed();
     }
 
     @GetMapping("/getOrderStatus")