package com.fzzy.order.ordersx2023;
|
|
import com.fzzy.order.ordersx2023.data.OrderSxConstant;
|
import com.fzzy.order.ordersx2023.data.OrderSxReq;
|
import com.fzzy.order.ordersx2023.data.OrderSxResp;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
/**
|
* @Description 陕西省平台指令接收服务
|
* @Author CZT
|
* @Date 2024/4/23 11:11
|
*/
|
@Slf4j
|
@Controller
|
@RequestMapping("Acquisition")
|
public class OrderSxController {
|
|
@Autowired
|
private OrderSxManager orderSxManager;
|
/**
|
* 指令入口
|
* @param req
|
* @return
|
*/
|
@SuppressWarnings("unchecked")
|
@ResponseBody
|
@RequestMapping("")
|
public OrderSxResp order(@RequestBody OrderSxReq req){
|
log.debug("陕西省平台:接收的指令信息={}", req);
|
//判断参数
|
if(null == req){
|
//解析失败
|
log.error("陕西省平台:指令解析失败,收到的指令信息为空!");
|
return new OrderSxResp(OrderSxConstant.ORDER_SX_CODE_400);
|
}
|
|
//心跳指令,直接返回
|
if(OrderSxConstant.ORDER_SX_TYPE_0.equals(req.getType())){
|
log.info("陕西省平台:收到心跳指令,指令信息={}", req);
|
return new OrderSxResp(OrderSxConstant.ORDER_SX_CODE_200);
|
}
|
|
try {
|
|
//异步执行
|
orderSxManager.execute(req);
|
|
return new OrderSxResp(OrderSxConstant.ORDER_SX_CODE_200);
|
|
} catch (Exception e) {
|
log.error("陕西省平台:指令解析失败,指令信息={}", req);
|
return new OrderSxResp(OrderSxConstant.ORDER_SX_CODE_400);
|
}
|
|
}
|
}
|