package com.engine.htsc.bulletintoberead.web;

import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ServiceUtil;
import com.engine.htsc.bulletintoberead.service.BulletinToBeReadService;
import com.engine.htsc.bulletintoberead.service.impl.BulletinToBeReadServiceImpl;
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 BulletinToBeReadController {

    private BulletinToBeReadService getService() {
        return ServiceUtil.getService(BulletinToBeReadServiceImpl.class);
    }

    @POST
    @Path("/getbulletintobereadlist")
    @Produces({MediaType.TEXT_PLAIN})
    public String getBulletinToBeReadList(@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().getBulletinToBeReadList(params);
        bb.writeLog("传给前端的值是："+ JSONObject.toJSONString(needShow));
        return JSONObject.toJSONString(needShow);
    }
}
