czt
2025-08-20 12c99c99ed89d1d11318d9b4c6c295d35e21b1e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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);
        }
 
    }
}