This commit is contained in:
Leo
2025-03-02 16:25:53 +08:00
parent d8e97e7e2b
commit 31a5178d9c
13 changed files with 158 additions and 125 deletions

View File

@@ -1,49 +1,49 @@
package cn.van.business.controller.jd;
import cn.van.business.mq.MessageProducerService;
import cn.van.business.util.JDUtil;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Leo
* @version 1.0
* @create 2024/11/7 13:39
* @description
*/
@RestController
@RequestMapping("/order")
public class OrderController {
public static String TOKEN = "cc0313";
@Autowired
private JDUtil jdUtils;
@Autowired
private MessageProducerService messageProducerService;
public boolean checkToken(String token) {
return TOKEN.equals(token);
}
@RequestMapping("/refreshHistory")
@ResponseBody
public String refreshHistory(String token) throws Exception {
if (checkToken(token)) {
jdUtils.fetchHistoricalOrders3090();
}
return "OK";
}
@RequestMapping("/mq")
@ResponseBody
public String mq() {
JSONObject jsonObject = new JSONObject();
messageProducerService.sendMessage(jsonObject);
return "OK";
}
}
//package cn.van.business.controller.jd;
//
//import cn.van.business.mq.MessageProducerService;
//import cn.van.business.util.JDUtil;
//import com.alibaba.fastjson2.JSONObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.bind.annotation.RestController;
//
//
///**
// * @author Leo
// * @version 1.0
// * @create 2024/11/7 13:39
// * @description
// */
//@RestController
//@RequestMapping("/order")
//public class OrderController {
//
// public static String TOKEN = "cc0313";
// @Autowired
// private JDUtil jdUtils;
// @Autowired
// private MessageProducerService messageProducerService;
//
// public boolean checkToken(String token) {
// return TOKEN.equals(token);
// }
//
// @RequestMapping("/refreshHistory")
// @ResponseBody
// public String refreshHistory(String token) throws Exception {
// if (checkToken(token)) {
// jdUtils.fetchHistoricalOrders3090();
// }
// return "OK";
// }
//
// @RequestMapping("/mq")
// @ResponseBody
// public String mq() {
// JSONObject jsonObject = new JSONObject();
// messageProducerService.sendMessage(jsonObject);
// return "OK";
// }
//
//}