jiazx0107@163.com
2023-06-19 5b44d1832e93be61b034b7e531f0c954a0018d74
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.ld.igds.protocol.inoutplug;
 
import com.alibaba.fastjson.JSONObject;
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;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
 
/**
 * 本地插件--出入库数据接收入口
 *
 * @author chen
 */
@Slf4j
@Controller
@RequestMapping("inout")
public class InoutPlugServer {
 
 
   @Autowired
   private InoutPlugAnalysis inoutPlugAnalysis;
 
    /**
     * 奥特威出入库系统数据对接
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/v1")
    public String inoutReceive(@RequestBody JSONObject request){
 
        log.info("出入库数据插件----->>>平台:报文信息={}", request);
 
        try{
 
            //异步处理,子线程解析事件
            final ExecutorService exec = Executors.newFixedThreadPool(1);
            Callable<String> call = new Callable<String>() {
                public String call() throws Exception {
 
                    //解析出入库数据
                    return inoutPlugAnalysis.analysisInout(request);
                }
            };
            exec.submit(call);
            exec.shutdown();
            return "SUCCESS";
 
        }catch (Exception e){
 
            log.error("----出入库数据解析失败,原因={}-----", e.getLocalizedMessage());
            return "SUCCESS";
        }
    }
 
}