统计美化
This commit is contained in:
@@ -1,49 +1,50 @@
|
||||
//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.model.ApiResponse;
|
||||
import cn.van.business.model.jd.ProductOrder;
|
||||
import cn.van.business.mq.MessageProducerService;
|
||||
import cn.van.business.repository.ProductOrderRepository;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @version 1.0
|
||||
* @create 2024/11/7 13:39
|
||||
* @description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/recordOrder")
|
||||
public class OrderController {
|
||||
|
||||
public static String TOKEN = "cc0313";
|
||||
@Autowired
|
||||
private JDUtil jdUtils;
|
||||
@Autowired
|
||||
private MessageProducerService messageProducerService;
|
||||
@Autowired
|
||||
private ProductOrderRepository productOrderRepository;
|
||||
|
||||
public boolean checkToken(String token) {
|
||||
return TOKEN.equals(token);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
@ResponseBody
|
||||
public ApiResponse<List<ProductOrder>> list(String token) throws Exception {
|
||||
try {
|
||||
List<ProductOrder> all = productOrderRepository.findAll();
|
||||
return ApiResponse.success(all);
|
||||
} catch (Exception e) {
|
||||
return (ApiResponse<List<ProductOrder>>) ApiResponse.error(500, "Server Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user