package com.engine.htsc.bumphtoberead.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.htsc.bumphtoberead.service.BumphToBeReadService;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.bumphtoberead.service.impl.BumphToBeReadServiceImpl;
import weaver.general.BaseBean;
import weaver.general.Util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
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.List;
import java.util.Map;

public class BumphToBeReadController {

    private BumphToBeReadService getService() {
        return ServiceUtil.getService(BumphToBeReadServiceImpl.class);
    }

    @POST
    @Path("/getbumphtobereadlist")
    @Produces({MediaType.TEXT_PLAIN})
    public String getBumphToBeReadList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        Map<String,Object> needShow;
        BaseBean bb = new BaseBean();
        String workCode = Util.null2String(request.getParameter("workCode"));
        Map<String, Object> params = new HashMap<>();
        params.put("workCode", workCode);
        needShow = getService().getBumphToBeReadList(params);
        bb.writeLog("传给前端的值是："+ JSONObject.toJSONString(needShow));
        return JSONObject.toJSONString(needShow);
    }
}
