/** * 发布 * @preserve */ public ActionForward declare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (log.isDebugEnabled()) { log.debug("Entering 'declare' method"); } SatTaxguide satTaxguide = new SatTaxguide(); satTaxguide.setBigtype(request.getParameter("itemType")); String[] arryCID; List list = new Vector(); arryCID = request.getParameterValues("checks"); if (arryCID == null) { return mapping.findForward("deletesuccess"); } for (int i = 0; i < arryCID.length; i++) { list.add(arryCID[i].trim()); } SatTaxguideManager mgr = (SatTaxguideManager) getBean("satTaxguideManager"); mgr.declare(list, SatUtils.PUB_STATE_VALID); //生成html文件 satTaxguide.setDispaly(SatUtils.PUB_STATE_VALID); List templist = mgr.getListqt(satTaxguide); for(int i=0; i< templist.size(); i++) { SatTaxguide dtemp = new SatTaxguide(); dtemp = (SatTaxguide)templist.get(i); String templatePath = getServlet().getServletContext().getRealPath(SatUtils.TEMPLATEPATH)+"\\"; String templateName = "taxguide.ftl"; String realpath = getServlet().getServletContext().getRealPath(SatUtils.SAT_TAXGUIDE_HTMLPATH)+"\\"; String strTemplate = FileReaderUtil.readFile( templatePath+templateName ); //转化为UTF-8 //dtemp.setItemname(dtemp.getItemname().getBytes("GBK").toString()); //dtemp.setContents(changeCharset(dtemp.getContents())); //dtemp.setFilename(changeCharset(dtemp.getFilename())); if(dtemp.getFilename() == null || dtemp.getFilename().length() == 0) { dtemp.setFilename(""); } if(dtemp.getFilename() != null && dtemp.getFilename().length() > 0) { dtemp.setFilename("附件:" + dtemp.getFilename()); } PublishUtil.writeContent( dtemp, realpath , dtemp.getHtmlpath(), strTemplate); } // 查询 SatTaxguide temp = new SatTaxguide(); temp.setBigtype(satTaxguide.getBigtype()); request.setAttribute("itemType", temp.getBigtype()); request.setAttribute("guidelist", mgr.getList(temp)); request.setAttribute("PUB_STATE_VALID", SatUtils.PUB_STATE_VALID); request.setAttribute("PUB_STATE_INVALID", SatUtils.PUB_STATE_INVALID); return mapping.findForward("list"); }