This commit is contained in:
Leo
2024-12-01 15:22:15 +08:00
parent 6ba281b7ed
commit 4ef5ae256b
4 changed files with 22 additions and 33 deletions

View File

@@ -1,6 +1,8 @@
package cn.van.business.controller.jd;
import cn.van.business.mq.MessageProducerService;
import cn.van.business.util.JDUtils;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@@ -20,8 +22,10 @@ public class OrderController {
public static String TOKEN = "cc0313";
@Resource
private JDUtils jdUtils;
@Resource
private MessageProducerService messageProducerService;
public boolean checkToken (String token){
public boolean checkToken(String token) {
return TOKEN.equals(token);
}
@@ -29,11 +33,17 @@ public class OrderController {
@ResponseBody
public String refreshHistory(String token) throws Exception {
if (checkToken(token)) {
jdUtils.fetchHistoricalOrders();
}
return "OK";
}
@RequestMapping("/mq")
@ResponseBody
public String mq() {
JSONObject jsonObject = new JSONObject();
messageProducerService.sendMessage(jsonObject);
return "OK";
}
}