package com.sw.mes.gateway.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/fallback")
public class FallbackController {

    @GetMapping
    public String fallback(){
        Map<String, Object> map = new HashMap<>();
        map.put("status", 101);
        map.put("message", "网关请求异常！");
        return JSONObject.toJSONString(map);
    }

    @PostMapping
    public String fallbackPost(){
        Map<String, Object> map = new HashMap<>();
        map.put("status", 101);
        map.put("message", "网关请求异常！");
        return JSONObject.toJSONString(map);
    }

    @RequestMapping("/wms")
    public String wmsFallback(){
        Map<String, Object> map = new HashMap<>();
        map.put("resultCode", 0);
        map.put("resultMsg", "网关请求异常！");
        return JSONObject.toJSONString(map);
    }

    @RequestMapping("/mes")
    public String mesFallback(){
        Map<String, Object> map = new HashMap<>();
        map.put("status", 101);
        map.put("message", "网关请求异常！");
        return JSONObject.toJSONString(map);
    }

}
