/**
  * 所有的Servlet都必须实现的方法。
  *
  * @param req HttpServletRequest
  * @param res HttpServletResponse
  * @throws ServletException
  * @throws IOException
  */
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) getUserAccount(req);
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(AmsAssetsCheckHeaderDTO.class.getName());
     AmsAssetsCheckHeaderDTO dto = (AmsAssetsCheckHeaderDTO) req2DTO.getDTO(req);
     String action = dto.getAct();
     conn = getDBConnection(req);
     AssetsOptProducer optProducer = new AssetsOptProducer(user, conn);
     String costOpt =
         optProducer.getCostCenterOption(dto.getOrganizationId(), dto.getCostCenterCode());
     dto.setCostCenterOpt(costOpt);
     if (action.equals("")) {
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.CHECK_RESULT_RPT_5;
     } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new CheckResultModelFive(user, dto);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.setCalPattern(LINE_PATTERN);
       pageDAO.setPageSize(22);
       pageDAO.produceWebData();
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.CHECK_RESULT_RPT_5;
     } else {
       message = getMessage(MsgKeyConstant.INVALID_REQ);
       message.setIsError(true);
       forwardURL = MessageConstant.MSG_PRC_SERVLET;
     }
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     if (!StrUtil.isEmpty(forwardURL)) {
       ServletForwarder forwarder = new ServletForwarder(req, res);
       forwarder.forwardView(forwardURL);
     }
   }
 }
 /**
  * 所有的Servlet都必须实现的方法。
  *
  * @param req HttpServletRequest
  * @param res HttpServletResponse
  * @throws javax.servlet.ServletException
  * @throws java.io.IOException
  */
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) getUserAccount(req);
     conn = getDBConnection(req);
     AssetsOptProducer optProducer = new AssetsOptProducer(user, conn);
     String deptOpt = optProducer.getAllDeptOption("");
     req.setAttribute(AssetsWebAttributes.DEPT_OPTIONS, deptOpt);
     String itemStatus = optProducer.getDictOption(AssetsDictConstant.ITEM_STATUS, "");
     req.setAttribute(AssetsWebAttributes.ITEM_STATUS_OPTIONS, itemStatus);
     String specialDepOpt = optProducer.getSpecialAsssetsDeptOption("");
     req.setAttribute("DEPT_OPTIONS2", specialDepOpt);
     String shareOption = optProducer.getDictOption("SHARE_STATUS", "");
     req.setAttribute("SHARE_OPTION", shareOption);
     String constructStatusOption = optProducer.getDictOption("CONSTRUCT_STATUS", "");
     req.setAttribute("CONSTRUCT_OPTION", constructStatusOption);
     forwardURL = "/newasset/itemVillageBottom.jsp";
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     ServletForwarder forwarder = new ServletForwarder(req, res);
     forwarder.forwardView(forwardURL);
   }
 }
示例#3
0
 /**
  * 所有的Servlet都必须实现的方法。
  *
  * @param req HttpServletRequest
  * @param res HttpServletResponse
  * @throws ServletException
  * @throws IOException
  * @todo Implement this com.sino.base.PubServlet method
  */
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) getUserAccount(req);
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(AmsAssetsCheckBatchDTO.class.getName());
     AmsAssetsCheckBatchDTO dto = (AmsAssetsCheckBatchDTO) req2DTO.getDTO(req);
     String action = dto.getAct();
     conn = getDBConnection(req);
     AssetsOptProducer optProducer = new AssetsOptProducer(user, conn);
     String opt = optProducer.getAllOu(dto.getOrganizationId());
     dto.setOrgOpt(opt);
     if (dto.getEndDate().getCalendarValue().equals("")) {
       dto.setEndDate(CalendarUtil.getCurrDate());
     }
     if (action.equals(AssetsActionConstant.EXPORT_ACTION)) {
       CheckReportDAO rptDAO = new CheckReportDAO(user, dto, conn);
       File file = rptDAO.exportCostData();
       WebFileDownload fileDown = new WebFileDownload(req, res);
       fileDown.setFilePath(file.getAbsolutePath());
       fileDown.download();
       file.delete();
     } else {
       message = getMessage(MsgKeyConstant.INVALID_REQ);
       message.setIsError(true);
       forwardURL = MessageConstant.MSG_PRC_SERVLET;
     }
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (WebFileDownException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DataTransException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (CalendarException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     if (!StrUtil.isEmpty(forwardURL)) {
       ServletForwarder forwarder = new ServletForwarder(req, res);
       forwarder.forwardView(forwardURL);
     }
   }
 }