czt
2026-01-21 a8296ef06369452e9151624b6ac4e7cb12a394e3
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.fzzy.igds.api.v1;
 
import com.fzzy.igds.api.v1.data.ApiV1Req;
import com.fzzy.igds.api.v1.data.ApiV1Resp;
import com.fzzy.igds.api.v1.service.*;
import com.fzzy.igds.api.v1.util.ApiV1Constant;
import com.fzzy.igds.constant.Constant;
import com.fzzy.igds.domain.GatewaySer;
import com.fzzy.igds.service.GatewaySerService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import javax.annotation.Resource;
 
/**
 * @Description 监管接口解析入口
 * @Author CZT
 * @Date 2026/1/7 10:25
 */
@Slf4j
@Controller
@RequestMapping("api/igdss/v1")
public class ApiV1Controller {
 
    @Resource
    private GatewaySerService gatewaySerService;
    @Resource
    private ApiV1Service3010 apiV1Service3010;
    @Resource
    private ApiV1Service3020 apiV1Service3020;
    @Resource
    private ApiV1Service3021 apiV1Service3021;
    @Resource
    private ApiV1Service3022 apiV1Service3022;
    @Resource
    private ApiV1Service3030 apiV1Service3030;
    @Resource
    private ApiV1Service3031 apiV1Service3031;
    @Resource
    private ApiV1Service3032 apiV1Service3032;
 
 
    @PostMapping
    @ResponseBody
    public ApiV1Resp<Object> gateway(@RequestBody ApiV1Req<Object> req) {
 
        log.debug("质押监管接口V1,收到库区网关信息={}", req);
        try {
 
            //参数校验
            if (req == null) {
                return ApiV1Resp.error("参数有误!", req);
            }
 
            //校验接口编码和网关SN
            if (StringUtils.isEmpty(req.getFunctionId()) || StringUtils.isEmpty(req.getSn())) {
                return ApiV1Resp.error("参数有误!", req);
            }
 
            //校验网关是否存在
            GatewaySer gatewaySer = gatewaySerService.getCacheSerById(null, req.getSn());
            if (null == gatewaySer) {
                return ApiV1Resp.error("当前网关<SN=" + req.getSn() + ">暂未添加,请核查!", req);
            }
 
            //异步更新网关状态
            gatewaySerService.updateStatus(gatewaySer, Constant.YN_Y, ApiV1Constant.API_FUNCTION_3010.equals(req.getFunctionId()));
 
            //解析
            String functionId = req.getFunctionId();
            switch (functionId) {
                case ApiV1Constant.API_FUNCTION_3010:
                    return apiV1Service3010.analysis(req, gatewaySer);
                case ApiV1Constant.API_FUNCTION_3020:
                    return apiV1Service3020.analysis(req, gatewaySer);
                case ApiV1Constant.API_FUNCTION_3021:
                    return apiV1Service3021.analysis(req, gatewaySer);
                case ApiV1Constant.API_FUNCTION_3022:
                    return apiV1Service3022.analysis(req, gatewaySer);
                case ApiV1Constant.API_FUNCTION_3030:
                    return apiV1Service3030.analysis(req, gatewaySer);
                case ApiV1Constant.API_FUNCTION_3031:
                    return apiV1Service3031.analysis(req, gatewaySer);
                case ApiV1Constant.API_FUNCTION_3032:
                    return apiV1Service3032.analysis(req, gatewaySer);
            }
 
            return ApiV1Resp.error("接口编码<" + functionId + ">不存在,请核查!", req);
 
        } catch (Exception e) {
 
            log.info("质押监管接口V1,接口解析异常={}", e.toString());
 
            return ApiV1Resp.error("解析异常!", req);
        }
 
    }
 
}