package com.engine.htsc.lhclbx.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.lhclbx.service.LhclDataRecoverService;
import com.engine.htsc.lhclbx.service.LhclDataRecoverServiceImpl;
import com.engine.htsc.zbclbx.service.lcIsGledService;
import com.engine.htsc.zbclbx.service.lcIsGledServiceImpl;
import oracle.jdbc.proxy.annotation.Post;
import weaver.general.BaseBean;
import weaver.general.Util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;

public class LhclDataRecover {
    private LhclDataRecoverService getService(){
        return ServiceUtil.getService(LhclDataRecoverServiceImpl.class);
    }

    @Post
    @Path("/datarecover")
    @Produces({MediaType.APPLICATION_JSON})
    public String DataRecover(@Context HttpServletRequest request, @Context HttpServletResponse response){
        BaseBean bb = new BaseBean();
        bb.writeLog("====================DataRecover check in =======================");
        Map<String,Object> result = new HashMap<>();
        String requestids = Util.null2String(request.getParameter("requestids"));
        bb.writeLog("============获取的requestids参数为："+requestids);
        if("".equals(requestids)){
            result.put("code","500");
            result.put("message","requestids参数为空");
        }else {
            Map<String,Object> params = new HashMap<>();
            params.put("requestids",requestids);
            result = getService().dataRecover(params);
            result.put("code","200");
            result.put("message","success");
        }
        return JSONObject.toJSONString(result);
    }
}
