Пример #1
0
 public void addCellPhone(String cellPhone) {
   if (StrUtil.isEmpty(cellPhone)) {
     return;
   }
   if (StrUtil.isNumber(cellPhone) && cellPhone.length() <= 15 && cellPhone.length() >= 11) {
     cellPhones.add(cellPhone);
   }
 }
Пример #2
0
  /**
   * 功能:执行新增数据操作。
   *
   * @return SQLModel 返回数据插入用SQLModel
   */
  public SQLModel getDataCreateModel() {
    SQLModel sqlModel = new SQLModel();
    //            try {
    List sqlArgs = new ArrayList();
    AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
    String sqlStr =
        "INSERT INTO "
            + " ETS_ASSETS_ADD_H("
            + " HEAD_ID,"
            + " BILL_NO,"
            + " STATUS,"
            + " CREATE_USER,"
            + " CREATED_DATE,"
            + " SPEC_DEPT,"
            + " REMARK"
            + ") "
            + " VALUES (?, ?, ?, ?, GETDATE(), ?, ?)";

    sqlArgs.add(dto.getHeadId());
    sqlArgs.add(dto.getBillNo());
    sqlArgs.add(StrUtil.strToInt(dto.getStatus()));
    sqlArgs.add(userAccount.getUserId());
    sqlArgs.add(dto.getSpecialityDept());
    sqlArgs.add(dto.getRemark());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #3
0
 /**
  * init
  *
  * @param config FilterConfig
  * @throws ServletException
  */
 public void init(FilterConfig config) throws ServletException {
   String startLog = config.getInitParameter("startLog");
   if (!StrUtil.isEmpty(startLog)) {
     if (startLog.equalsIgnoreCase("TRUE")) {
       isStartLog = true;
     }
   }
 }
Пример #4
0
 public void setPageSize(String pageSize) {
   if (StrUtil.isInteger(pageSize)) {
     int tempPageSize = Integer.parseInt(pageSize);
     if (tempPageSize > 0) {
       this.pageSize = pageSize;
     }
   }
 }
Пример #5
0
  /**
   * 功能:新增管理资产查询。
   *
   * @return SQLModel 返回页面翻页查询SQLModel
   * @throws com.sino.base.exception.SQLModelException 发生日历异常时转化为该异常抛出
   */
  public SQLModel getPageQueryModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    try {
      List sqlArgs = new ArrayList();
      AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
      //             AssetsAddLDTO dtoL = (AssetsAddLDTO) dtoParameter;
      String sqlStr =
          "SELECT EAAH.HEAD_ID,\n"
              + "       EAAH.BILL_NO,\n"
              + " CASE WHEN EAAH.STATUS=0 THEN '未完成' ELSE '已完成' END STATUS,"
              + "       EAAH.CREATE_USER,\n"
              + "       EAAH.CREATED_DATE,\n"
              + "       EAAH.SPEC_DEPT,\n"
              + "       EAAL.BARCODE,\n"
              + "       EAAL.ITEM_CODE,\n"
              + "       ESI.ITEM_NAME,\n"
              + "       ESI.ITEM_SPEC,\n"
              + "       SU.USERNAME\n"
              + "FROM   ETS_ASSETS_ADD_H EAAH,\n"
              + "       ETS_ASSETS_ADD_L EAAL,\n"
              + "       ETS_SYSTEM_ITEM  ESI,\n"
              + "       SF_USER          SU\n"
              + "WHERE  EAAH.HEAD_ID = EAAL.HEAD_ID\n"
              + "       AND EAAL.ITEM_CODE = ESI.ITEM_CODE\n"
              + "       AND EAAH.CREATE_USER = SU.USER_ID\n"
              + "       AND SU.ORGANIZATION_ID = ?\n"
              + "       AND SU.USERNAME LIKE dbo.NVL(?, SU.USERNAME)\n"
              + "       AND ESI.ITEM_SPEC LIKE dbo.NVL(?, ESI.ITEM_SPEC)\n"
              + "       AND ESI.ITEM_NAME LIKE dbo.NVL(?, ESI.ITEM_NAME)\n"
              + "       AND EAAH.STATUS = ISNULL(?, EAAH.STATUS)\n"
              + "       AND (? = '' OR EAAH.CREATED_DATE >= ISNULL(?, EAAH.CREATED_DATE))\n"
              + "       AND (? = '' OR EAAH.CREATED_DATE <= ISNULL(?, EAAH.CREATED_DATE))\n"
              + "       AND EAAL.BARCODE LIKE dbo.NVL(?, EAAL.BARCODE)\n"
              + "ORDER  BY EAAH.BILL_NO,\n"
              + "          EAAL.BARCODE";
      sqlArgs.add(sfDto.getOrganizationId());
      sqlArgs.add(dto.getCreateUser());
      sqlArgs.add(dto.getItemSpec());
      sqlArgs.add(dto.getItemName());
      if ("".equals(dto.getStatus()) || null == dto.getStatus()) {
        sqlArgs.add(null);
      } else {
        sqlArgs.add(StrUtil.strToInt(dto.getStatus()));
      }
      sqlArgs.add(dto.getFromDate());
      sqlArgs.add(dto.getFromDate());
      sqlArgs.add(dto.getToDate());
      sqlArgs.add(dto.getToDate());
      sqlArgs.add(dto.getBarcod());

      sqlModel.setSqlStr(sqlStr);
      sqlModel.setArgs(sqlArgs);
    } catch (CalendarException ex) {
      ex.printLog();
      throw new SQLModelException(ex);
    }
    return sqlModel;
  }
Пример #6
0
 /**
  * 所有的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);
     }
   }
 }
 /**
  * 处理从ERP过来的这种格式“2011-08-15 00:00:00.000+08:00”时间
  *
  * @param date
  * @return
  */
 private String getHandleDateFromERP(String date) {
   if (StrUtil.isEmpty(date) || date.length() < 11) {
     return date;
   }
   date = date.replace("T", " ");
   int pos = date.indexOf("+");
   if (pos > -1) {
     date = date.substring(0, pos);
   }
   return date;
 }
  public void excute() {
    URL wsdlURL = SBFIFATDImportAssetRetirmentSrv.WSDL_LOCATION;

    SBFIFATDImportAssetRetirmentSrv ss = new SBFIFATDImportAssetRetirmentSrv(wsdlURL, SERVICE_NAME);
    SBFIFAImportAssetRetirmentSrv port = ss.getSBFIFAImportAssetRetirmentSrvPort();
    Client client = ClientProxy.getClient(port);
    HTTPConduit http = (HTTPConduit) client.getConduit();
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(1000000000); // 连接时间
    httpClientPolicy.setReceiveTimeout(1000000000); // 接收时间
    httpClientPolicy.setAllowChunking(false);
    http.setClient(httpClientPolicy);

    {
      System.out.println("Invoking process...");
      ImportAssetRetirmentSrvRequest _process_payload = null;
      _process_payload = new ImportAssetRetirmentSrvRequest();
      MsgHeader msgHeader = new MsgHeader();
      _process_payload.setMsgHeader(msgHeader);
      ImportAssetRetirmentSrvInputCollection collection =
          new ImportAssetRetirmentSrvInputCollection();

      if (srvInputItems != null) {
        for (int i = 0; i < srvInputItems.size(); i++) {
          ImportAssetRetirmentSrvInputItem inputItem = srvInputItems.get(i);
          collection.getImportAssetRetirmentSrvInputItem().add(inputItem);
        }
      }
      // 传递数据集到request中
      _process_payload.setImportAssetRetirmentSrvInputCollection(collection);

      ImportAssetRetirmentSrvResponse _process__return = port.process(_process_payload);
      System.out.println(
          "process.result="
              + _process__return.getErrorFlag()
              + "||"
              + _process__return.getErrorMessage());
      returnMessage.setErrorFlag(StrUtil.nullToString(_process__return.getErrorFlag()));
      returnMessage.setErrorMessage(_process__return.getErrorMessage());

      if (_process__return.getErrorFlag().equals("Y")) {
        responseItemList = _process__return.getResponseCollecion().getResponseItem();
        System.out.println("结果Y: " + responseItemList);
      } else {
        errorItemList = _process__return.getErrorCollection().getErrorItem();
        int s1 = errorItemList.size();
        for (int i = 0; i < s1; i++) {
          System.out.println("结果N: " + errorItemList.get(0).getERRORMESSAGE());
        }
      }
    }
  }
Пример #9
0
 /**
  * 功能:构造查询条件截至日期的最后一秒所的日历对象。免去应用中每个查询SQL自己构造截至日期
  *
  * @return SimpleCalendar
  */
 public SimpleCalendar getSQLToDate() {
   SimpleCalendar sqlEndCal = new SimpleCalendar();
   if (!StrUtil.isEmpty(toDate.toString())) {
     try {
       SimpleDate date = toDate.getSimpleDate();
       SimpleTime time = SimpleTime.getEndTime();
       sqlEndCal = new SimpleCalendar(date, time);
     } catch (TimeException ex) {
       ex.printLog();
     }
   }
   return sqlEndCal;
 }
Пример #10
0
  /**
   * 取头信息
   *
   * @throws QueryException
   */
  protected void prodHeader() throws QueryException {
    headerDAO.setDTOClassName(UrgentHeaderDTO.class.getName());
    headerDAO.setCalPattern(CalendarConstant.LINE_PATTERN);

    UrgentHeaderDTO tmpDTO = (UrgentHeaderDTO) headerDTO.clone();

    headerDTO = (UrgentHeaderDTO) headerDAO.getDataByPrimaryKey();
    // 当新建时候
    if (null == headerDTO || StrUtil.isEmpty(headerDTO.getTransId())) {
      headerDTO = new UrgentHeaderDTO();
      headerDTO = initHeaderData(headerDTO);
    }
    headerDTO.setSf_task_attribute3(tmpDTO.getSf_task_attribute3());

    leaseDTO.setHeaderDTO(headerDTO);
  }
Пример #11
0
 /**
  * 保存头
  *
  * @throws DataHandleException
  * @throws SQLException
  */
 public void saveHeader() throws DataHandleException, SQLException {
   if (headerDTO.getTransNo().equals(AssetsWebAttributes.ORDER_AUTO_PROD)) {
     if (StrUtil.isEmpty(headerDTO.getTransId())) {
       SeqProducer seqProducer = new SeqProducer(conn);
       String transId = seqProducer.getGUID();
       headerDTO.setTransId(transId);
     }
     String companyCode = userAccount.getCompanyCode(); // 还是采用该方法,以下考虑周子君认为没必要
     String transType = headerDTO.getTransType();
     OrderNumGenerator numberProducer = new OrderNumGenerator(conn, companyCode, transType);
     headerDTO.setTransNo(numberProducer.getOrderNum());
     headerDAO.createHeader(headerDTO);
   } else {
     headerDAO.updateHeader(headerDTO);
   }
 }
Пример #12
0
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   String act = req.getParameter("act");
   act = StrUtil.nullToString(act);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
     AmsAssetsInfoDTO dtoParameter = null;
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(AmsAssetsInfoDTO.class.getName());
     dtoParameter = (AmsAssetsInfoDTO) req2DTO.getDTO(req);
     conn = getDBConnection(req);
     AmsPractInfoDAO practDAO = new AmsPractInfoDAO(user, dtoParameter, conn);
     if (act.equals("")) {
       req.setAttribute(WebAttrConstant.ETS_PRACTINFO_DTO, dtoParameter);
       forwardURL = URLDefineList.PRACT_PAGE;
     } else if (act.equals(WebActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new AmsPractInfoModel(user, dtoParameter);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.produceWebData();
       req.setAttribute(WebAttrConstant.ETS_PRACTINFO_DTO, dtoParameter);
       forwardURL = URLDefineList.PRACT_PAGE;
     }
   } catch (PoolException e) {
     e.printLog();
     message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException e) {
     e.printLog();
     message = getMessage(MsgKeyConstant.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException e) {
     e.printLog();
     message = getMessage(MsgKeyConstant.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } finally {
     DBManager.closeDBConnection(conn);
     setHandleMessage(req, message);
     ServletForwarder forwarder = new ServletForwarder(req, res);
     forwarder.forwardView(forwardURL);
   }
 }
  public void excute() {
    URL wsdlURL = SBFIFATransAssetDeprecationSrv_Service.WSDL_LOCATION;

    SBFIFATransAssetDeprecationSrv_Service ss =
        new SBFIFATransAssetDeprecationSrv_Service(wsdlURL, SERVICE_NAME);
    com.sino.soa.mis.eip.fi.fa.sb_fi_fa_transassetdeprecationsrv.SBFIFATransAssetDeprecationSrv
        port = ss.getSBFIFATransAssetDeprecationSrvPort();

    Client client = ClientProxy.getClient(port);
    HTTPConduit http = (HTTPConduit) client.getConduit();
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();

    httpClientPolicy.setConnectionTimeout(5400000); // 连接时间
    httpClientPolicy.setReceiveTimeout(5400000); // 接收时间
    httpClientPolicy.setAllowChunking(false);
    http.setClient(httpClientPolicy);

    {
      System.out.println("SB_FI_FA_TransAssetDeprecationSrv Invoking process...");
      SBFIFATransAssetDeprecationSrvProcessRequest _process_payload = null;

      _process_payload = new SBFIFATransAssetDeprecationSrvProcessRequest();
      _process_payload.setENVCODE(envCode);
      _process_payload.setPERIODNAME(periodName);
      long s = System.currentTimeMillis();
      com.sino.soa.mis.eip.fi.fa.sb_fi_fa_transassetdeprecationsrv
              .SBFIFATransAssetDeprecationSrvProcessResponse
          _process__return = port.process(_process_payload);
      srvMessage.setErrorFlag(StrUtil.nullToString(_process__return.getERRORFLAG()));
      srvMessage.setErrorMessage(_process__return.getERRORMESSAGE());
      System.out.println(
          "process.result="
              + _process__return.getINSTANCEID()
              + "||"
              + _process__return.getERRORFLAG()
              + "||"
              + _process__return.getERRORMESSAGE());
      System.out.println("耗时" + (System.currentTimeMillis() - s) + "毫秒");
    }
  }
Пример #14
0
  /**
   * 功能:框架自动生成备件事务头表(EAM) ETS_ASSETS_ADD_H数据更新SQLModel,请根据实际需要修改。
   *
   * @return SQLModel 返回数据更新用SQLModel
   */
  public SQLModel getDataUpdateModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    List sqlArgs = new ArrayList();
    AssetsAddDTO dto = (AssetsAddDTO) dtoParameter;
    String sqlStr =
        "UPDATE ETS_ASSETS_ADD_H"
            + " SET"
            + "     STATUS = ?, "
            + "     SPEC_DEPT = ?, "
            + "     REMARK = ? "
            + " WHERE"
            + "     HEAD_ID = ?";
    //            try {
    sqlArgs.add(StrUtil.strToInt(dto.getStatus()));
    sqlArgs.add(dto.getSpecialityDept());
    sqlArgs.add(dto.getRemark());
    sqlArgs.add(dto.getHeadId());

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);
    return sqlModel;
  }
Пример #15
0
 /**
  * 将流程中保存的单据ID设置进DTO
  *
  * @param dtoParameter
  * @return
  */
 protected UrgentHeaderDTO setFlowIdToDTO(UrgentHeaderDTO dtoParameter) {
   if (StrUtil.isEmpty(dtoParameter.getTransId())) {
     dtoParameter.setTransId(StrUtil.nullToString(dtoParameter.getApp_dataID()));
   }
   return dtoParameter;
 }
Пример #16
0
 /**
  * @param req HttpServletRequest
  * @param res HttpServletResponse
  * @throws ServletException
  * @throws IOException
  */
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   //               String MATCH_MODE_SPARE = "0";        备件确认
   //               String MATCH_MODE_SPARE_RET = "1";    撤销备件关系
   //               String MATCH_MODE_PRJMTL = "2";       工程物资确认
   //               String MATCH_MODE_PRJMTL_RET = "3";   撤销工程物资匹配关系
   //               String MATCH_MODE_OTHER = "4";        设备屏蔽
   //               String MATCH_MODE_0THER_RET = "5";    撤销设备屏蔽
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   String action = req.getParameter("act");
   action = StrUtil.nullToString(action);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
     TfEtsItemMatchRecDTO dtoParameter = null;
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(TfEtsItemMatchRecDTO.class.getName());
     dtoParameter = (TfEtsItemMatchRecDTO) req2DTO.getDTO(req);
     conn = getDBConnection(req);
     TfEtsItemMatchRecDAO etsItemMatchRecDAO = new TfEtsItemMatchRecDAO(user, dtoParameter, conn);
     String matchType = dtoParameter.getMatchType();
     ServletConfigDTO configDTO = getServletConfig(req);
     if (action.equals("")) {
       if (matchType.equals(WebAttrConstant.MATHC_MODE_CHANGED_ASSETS_RET)) { // 撤消资产匹配关系操作
         forwardURL = URLDefineList.TF_UNYOKE_PAGE + "?matchType=" + matchType;
       } else {
         forwardURL = URLDefineList.TF_FINANCE_PROP_SET_PAGE + "?matchType=" + matchType;
       }
     } else if (action.equals(WebActionConstant.QUERY_ACTION)) {
       if (matchType.equals(WebAttrConstant.MATHC_MODE_CHANGED_ASSETS_RET)) {
         BaseSQLProducer sqlProducer = new TfEtsItemMatchRecModel(user, dtoParameter);
         PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
         pageDAO.setServletConfig(configDTO);
         CheckBoxProp checkProp = new CheckBoxProp("subCheck");
         checkProp.addDbField("SYSTEM_ID");
         checkProp.addDbField("ASSET_ID");
         pageDAO.setWebCheckProp(checkProp);
         pageDAO.produceWebData();
         forwardURL =
             URLDefineList.TF_UNYOKE_PAGE
                 + "?matchType="
                 + matchType
                 + "&unyokeFlag="
                 + dtoParameter.getUnyokeFlag();
       } else {
         BaseSQLProducer sqlProducer = new TfEtsItemMatchRecModel(user, dtoParameter);
         PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
         pageDAO.produceWebData();
         forwardURL = URLDefineList.TF_FINANCE_PROP_SET_PAGE + "?matchType=" + matchType;
       }
     } else if (action.equals(AMSActionConstant.MATCH_ACTION)) {
       DTOSet dtos = getDTOs(req, matchType);
       if (matchType.equals(WebAttrConstant.MATHC_MODE_CHANGED_ASSETS_RET)) {
         dtos = getCheckedAssets(req, matchType);
         etsItemMatchRecDAO.delDTOs(dtos);
         forwardURL = URLDefineList.TF_UNYOKE_PAGE + "?matchType=" + matchType;
       }
       // 2009.3.31修改su
       //                else if(matchType.equals(WebAttrConstant.MATCH_MODE_RENT)) {//租赁资产确认
       //                    String [] systemIds=req.getParameterValues("systemId");
       //                    etsItemMatchRecDAO.confirmRentAssets(systemIds);
       //                    forwardURL = URLDefineList.FINANCE_PROP_SET_PAGE + "?matchType=" +
       // matchType;
       //                }
       //                else if(matchType.equals(WebAttrConstant.MATCH_MODE_DG)) {//代管资产确认
       //                    String [] systemIds=req.getParameterValues("systemId");
       //                    etsItemMatchRecDAO.confirmDGAssets(systemIds);
       //                    forwardURL = URLDefineList.FINANCE_PROP_SET_PAGE + "?matchType=" +
       // matchType;
       //                }
       //                else if(matchType.equals(WebAttrConstant.MATCH_MODE_LC)) {//低值易耗资产确认
       //                    String [] systemIds=req.getParameterValues("systemId");
       //                    etsItemMatchRecDAO.confirmLCAssets(systemIds);
       //                    forwardURL = URLDefineList.FINANCE_PROP_SET_PAGE + "?matchType=" +
       // matchType;
       //                }
       //                else if(matchType.equals(WebAttrConstant.MATCH_MODE_CT)) {//村通资产确认
       //                    String [] systemIds=req.getParameterValues("systemId");
       //                    etsItemMatchRecDAO.confirmCTAssets(systemIds);
       //                    forwardURL = URLDefineList.FINANCE_PROP_SET_PAGE + "?matchType=" +
       // matchType;
       //                }
       else {
         etsItemMatchRecDAO.saveDTOs(dtos);
         if (matchType.equals(WebAttrConstant.MATCH_MODE_PRJMTL)
             || matchType.equals(WebAttrConstant.MATCH_MODE_PRJMTL_RET)) {
           DTOSet dtoes = this.getSystemIds(req);
           etsItemMatchRecDAO.getDistributePrj(dtoParameter.getPrjId(), dtoes);
         }
         forwardURL =
             URLDefineList.TF_FINANCE_PROP_SET_SERVLET
                 + "?act="
                 + WebActionConstant.QUERY_ACTION
                 + "&matchType="
                 + matchType;
       }
     } else {
       message = getMessage(MsgKeyConstant.INVALID_REQ);
       message.setIsError(true);
       forwardURL = MessageConstant.MSG_PRC_SERVLET;
     }
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DataHandleException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (StrException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (UploadException ex) {
     // 请根据实际情况处理消息
     forwardURL = "保持界面录入的数据,返回到原页面,并显示上面给出的消息";
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     DBManager.closeDBConnection(conn);
     setHandleMessage(req, message);
     ServletForwarder forwarder = new ServletForwarder(req, res);
     forwarder.forwardView(forwardURL);
     // 根据实际情况修改页面跳转代码。
   }
 }
  /**
   * 功能:构造翻页查询SQL
   *
   * @return SQLModel
   * @throws SQLModelException
   */
  public SQLModel getPageQueryModel() throws SQLModelException {
    SQLModel sqlModel = new SQLModel();
    EtsFaAssetsDTO dto = (EtsFaAssetsDTO) dtoParameter;
    List sqlArgs = new ArrayList();
    String sqlStr =
        "SELECT EOCM.COMPANY, "
            + "   AMD1.DEPT_NAME RESPONSIBILITY_DEPT,"
            + "	EII.BARCODE,"
            + "	ESI.ITEM_NAME,"
            + "	ESI.ITEM_SPEC,"
            + "	AME.USER_NAME,"
            + "	AMD2.DEPT_NAME,"
            + "	EII.CONTENT_CODE,"
            + "	EII.CONTENT_NAME,"
            + "	EO.WORKORDER_OBJECT_CODE,"
            + "	EO.WORKORDER_OBJECT_NAME"
            + " FROM ETS_ITEM_INFO      EII,"
            + "	ETS_SYSTEM_ITEM	   ESI,"
            + "	AMS_MIS_DEPT       AMD1,"
            + "	AMS_MIS_DEPT       AMD2,"
            + "	AMS_MIS_EMPLOYEE   AME,"
            + "	ETS_OU_CITY_MAP    EOCM,"
            + "	AMS_OBJECT_ADDRESS AOA,"
            + "	ETS_OBJECT         EO,"
            + "	ETS_FLEX_VALUE_SET EFVS,"
            + "	ETS_FLEX_VALUES    EFV"
            + " WHERE ESI.ITEM_CODE = EII.ITEM_CODE	"
            + "	AND (EO.DISABLE_DATE = '' OR EO.DISABLE_DATE IS NULL)"
            +
            //					    "	AND (EII.DISABLE_DATE = '' OR EII.ITEM_STATUS = 'DISCARDED')" +
            "	AND EFVS.FLEX_VALUE_SET_ID = EFV.FLEX_VALUE_SET_ID "
            + "	AND EFVS.CODE = 'OBJECT_CATEGORY' "
            + "	AND EO.OBJECT_CATEGORY = EFV.CODE ";
    if (dto.getUserName().equals("")) {
      sqlStr += "   AND EII.RESPONSIBILITY_USER *= AME.EMPLOYEE_ID";
    } else {
      sqlStr += "   AND EII.RESPONSIBILITY_USER = AME.EMPLOYEE_ID";
    }

    sqlStr += "	AND EII.RESPONSIBILITY_DEPT *= AMD1.DEPT_CODE";
    sqlStr +=
        "	AND AME.DEPT_CODE *= AMD2.DEPT_CODE"
            + "	AND EII.ORGANIZATION_ID *= EOCM.ORGANIZATION_ID"
            + "	AND EII.ADDRESS_ID = AOA.ADDRESS_ID"
            + "	AND AOA.OBJECT_NO = EO.WORKORDER_OBJECT_NO"
            + "	AND EII.ITEM_STATUS <> 'DISCARDED'"
            + "	AND NOT EXISTS"
            + "			(SELECT 1"
            + "			   FROM (SELECT EII.BARCODE"
            + "					   FROM ETS_ITEM_INFO    EII,"
            + "							AMS_MIS_EMPLOYEE AME,"
            + "							AMS_MIS_DEPT     AMD"
            + "			  		  WHERE EII.RESPONSIBILITY_USER = AME.EMPLOYEE_ID"
            + "						AND EII.RESPONSIBILITY_DEPT = AMD.DEPT_CODE"
            + "						AND AME.DEPT_CODE = AMD.DEPT_CODE) TMP"
            + "			  WHERE EII.BARCODE = TMP.BARCODE)";
    if (dto.getOrganizationId() != -1) {
      sqlStr += "	AND EII.ORGANIZATION_ID = ? ";
      sqlArgs.add(dto.getOrganizationId());
    }
    if (!dto.getResponsibilityDept().equals("")) {
      sqlStr += "	AND AMD1.DEPT_CODE = ? ";
      sqlArgs.add(dto.getResponsibilityDept());
    }
    if (!dto.getUserName().equals("")) {
      sqlStr += "	AND AME.USER_NAME LIKE ? ";
      sqlArgs.add(dto.getUserName());
    }
    if (StrUtil.isNotEmpty(dto.getAddressId())) {
      sqlStr += "	AND EII.ADDRESS_ID = ? ";
      sqlArgs.add(dto.getAddressId());
    }
    if (!dto.getContentCode().equals("")) {
      sqlStr += "	AND EII.CONTENT_CODE = ? ";
      sqlArgs.add(dto.getContentCode());
    }
    if (!dto.getItemName().equals("")) {
      sqlStr += "	AND ESI.ITEM_NAME LIKE ? ";
      sqlArgs.add(dto.getItemName());
    }
    sqlStr += " ORDER BY EII.SYSTEMID";

    sqlModel.setSqlStr(sqlStr);
    sqlModel.setArgs(sqlArgs);

    return sqlModel;
  }
Пример #18
0
 /**
  * @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) SessionUtil.getUserAccount(req);
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(AmsYjItemDTO.class.getName());
     AmsYjItemDTO dtoParameter = (AmsYjItemDTO) req2DTO.getDTO(req);
     String action = dtoParameter.getAct();
     conn = getDBConnection(req);
     AmsYjItemDAO amsYjItemDAO = new AmsYjItemDAO(user, dtoParameter, conn);
     if (action.equals("")) {
       forwardURL = "/yj/yjItemSearch.jsp";
     } else if (action.equals(WebActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new AmsYjItemModel(user, dtoParameter);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.produceWebData();
       forwardURL = "/yj/yjItemSearch.jsp";
     } else if (action.equals(WebActionConstant.NEW_ACTION)) {
       AmsYjItemDTO amsYjItem = new AmsYjItemDTO();
       req.setAttribute("AMS_YJ_ITEM", amsYjItem);
       forwardURL = "/yj/yjItemDetail.jsp";
     } else if (action.equals(WebActionConstant.DETAIL_ACTION)) {
       amsYjItemDAO.setDTOClassName(AmsYjItemDTO.class.getName());
       AmsYjItemDTO amsYjItem = (AmsYjItemDTO) amsYjItemDAO.getDataByPrimaryKey();
       if (amsYjItem == null) {
         amsYjItem = new AmsYjItemDTO();
         message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
         message.setIsError(true);
       }
       req.setAttribute("AMS_YJ_ITEM", amsYjItem);
       forwardURL = "/yj/yjItemDetail.jsp";
     } else if (action.equals(WebActionConstant.CREATE_ACTION)) {
       boolean isNew = StrUtil.isEmpty(dtoParameter.getItemCode());
       YjManagerUtil yjUtil = new YjManagerUtil(user, conn);
       if (isNew) {
         dtoParameter.setItemCode(String.valueOf(yjUtil.getYjManagerMax("AMS_YJ_ITEM_SEQ")));
       }
       amsYjItemDAO.createData();
       forwardURL =
           "/servlet/com.sino.ams.yj.servlet.AmsYjItemServlet?act="
               + WebActionConstant.QUERY_ACTION
               + "&itemCode="
               + dtoParameter.getItemCode();
     } else if (action.equals(WebActionConstant.UPDATE_ACTION)) {
       amsYjItemDAO.updateData();
       forwardURL =
           "/servlet/com.sino.ams.yj.servlet.AmsYjItemServlet?act="
               + WebActionConstant.QUERY_ACTION
               + "&itemCode="
               + dtoParameter.getItemCode();
     } else if (action.equals(WebActionConstant.DELETE_ACTION)) { // 失效
       amsYjItemDAO.deleteData();
       forwardURL =
           "/servlet/com.sino.ams.yj.servlet.AmsYjItemServlet?act="
               + WebActionConstant.QUERY_ACTION;
     } else if (action.equals(AMSActionConstant.INURE_ACTION)) { // 生效
       String amsYjItem = "";
       amsYjItemDAO.enableItem(amsYjItem);
       forwardURL =
           "/servlet/com.sino.ams.yj.servlet.AmsYjItemServlet?act="
               + WebActionConstant.QUERY_ACTION;
     } else if (action.equals(WebActionConstant.EXPORT_ACTION)) { // 导出到Excel
       File file = amsYjItemDAO.exportFile();
       WebFileDownload fileDown = new WebFileDownload(req, res);
       fileDown.setFilePath(file.getAbsolutePath());
       fileDown.download();
       file.delete();
     } else if (action.equals("verifyItemName")) {
       String itemName = req.getParameter("itemName");
       boolean success = amsYjItemDAO.doVerify(itemName);
       PrintWriter out = res.getWriter();
       if (success) {
         out.print("Y");
       }
       out.flush();
       out.close();
     } else {
       message = getMessage(MsgKeyConstant.INVALID_REQ);
       message.setIsError(true);
       forwardURL = MessageConstant.MSG_PRC_SERVLET;
     }
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(MsgKeyConstant.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DataHandleException ex) {
     ex.printLog();
     // 请根据实际情况处理消息
     forwardURL = "保持界面录入的数据,返回到原页面,并显示上面给出的消息";
   } catch (WebFileDownException e) {
     e
         .printStackTrace(); // To change body of catch statement use File | Settings | File
                             // Templates.
   } finally {
     DBManager.closeDBConnection(conn);
     setHandleMessage(req, message);
     ServletForwarder forwarder = new ServletForwarder(req, res);
     forwarder.forwardView(forwardURL);
     // 根据实际情况修改页面跳转代码。
   }
 }
Пример #19
0
  /**
   * 得到查询所有的MODEL
   *
   * @return
   */
  public SQLModel getPageQueryModel() throws SQLModelException {
    String fromDate = "";
    String toDate = "";
    //        String orgId = "";

    int orgId = SyBaseSQLUtil.NULL_INT_VALUE;

    boolean hasSqlProduced = false;
    SQLModel sqlModel = new SQLModel();

    final String CONDITION_SQL = "{CONDITION_SQL}";
    try {
      SitusStatisticsDTO Situsdto = (SitusStatisticsDTO) dtoParameter;
      orgId = Situsdto.getOrganizationId();
      List strArg = new ArrayList();
      String strSql = "";
      String tmpASqlStr =
          " SELECT\n" // 按时完成工单
              + " SU.USERNAME,\n"
              + " COUNT(EW.SYSTEMID) COUNT1\n"
              + " FROM \n"
              + " ETS_WORKORDER  EW,\n"
              + " SF_USER SU\n"
              + " WHERE\n"
              + " CONVERT(VARCHAR,EW.IMPLEMENT_BY) *= CONVERT(VARCHAR,SU.USER_ID) AND\n"
              + " EW.UPLOAD_DATE <= dbo.AWP_GET_DEADLINE_DATE(EW.START_DATE,EW.IMPLEMENT_DAYS) AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) > "
              + DictConstant.WORKORDER_STATUS_NEW
              + " AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) < "
              + DictConstant.WORKORDER_STATUS_CANCELE
              + "\n"
              + " "
              + CONDITION_SQL
              + "\n"
              + " GROUP BY\n"
              + " SU.USERNAME\n";

      String tmpBSqlStr =
          " SELECT\n " // 超时完成工单
              + " SU.USERNAME,\n"
              + " COUNT(EW.SYSTEMID) COUNT2\n"
              + " FROM \n"
              + " ETS_WORKORDER  EW,\n"
              + " SF_USER SU\n"
              + " WHERE\n"
              + " CONVERT(VARCHAR,EW.IMPLEMENT_BY) *= CONVERT(VARCHAR,SU.USER_ID) AND\n"
              + " EW.UPLOAD_DATE > dbo.AWP_GET_DEADLINE_DATE(EW.START_DATE,EW.IMPLEMENT_DAYS) AND\n"
              + "  CONVERT(INT,EW.WORKORDER_FLAG) > "
              + DictConstant.WORKORDER_STATUS_NEW
              + " AND\n"
              + "  CONVERT(INT,EW.WORKORDER_FLAG) < "
              + DictConstant.WORKORDER_STATUS_CANCELE
              + "\n"
              + " "
              + CONDITION_SQL
              + "\n"
              + " GROUP BY\n"
              + " SU.USERNAME\n";

      String tmpCSqlStr =
          " SELECT\n" // 超时未完成工单
              + " SU.USERNAME,\n"
              + " COUNT(EW.SYSTEMID) COUNT3\n"
              + " FROM \n"
              + " ETS_WORKORDER  EW,\n"
              + " SF_USER SU\n"
              + " WHERE\n"
              + " CONVERT(VARCHAR,EW.IMPLEMENT_BY) *= CONVERT(VARCHAR,SU.USER_ID) AND\n"
              + " EW.UPLOAD_DATE "
              + SyBaseSQLUtil.isNullNoParam()
              + "  AND\n"
              + " dbo.AWP_GET_DEADLINE_DATE(EW.START_DATE,EW.IMPLEMENT_DAYS) < GETDATE() AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) > "
              + DictConstant.WORKORDER_STATUS_NEW
              + " AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) < "
              + DictConstant.WORKORDER_STATUS_CANCELE
              + "\n"
              + " "
              + CONDITION_SQL
              + "\n"
              + " GROUP BY\n"
              + " SU.USERNAME\n";

      String tmpDSqlStr =
          " SELECT\n" // 总工单数
              + " SU.USERNAME,\n"
              + " COUNT(EW.SYSTEMID) TOTAL_COUNT\n"
              + " FROM \n"
              + " ETS_WORKORDER  EW,\n"
              + " SF_USER SU\n"
              + " WHERE\n"
              + " CONVERT(VARCHAR,EW.IMPLEMENT_BY) *= CONVERT(VARCHAR,SU.USER_ID) AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) > "
              + DictConstant.WORKORDER_STATUS_NEW
              + " AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) < "
              + DictConstant.WORKORDER_STATUS_CANCELE
              + "\n"
              + " "
              + CONDITION_SQL
              + "\n"
              + " GROUP BY SU.USERNAME \n";

      String tmpESqlStr =
          " SELECT\n" // 正常处理中工单
              + " SU.USERNAME,\n"
              + " COUNT(EW.SYSTEMID) COUNT4\n"
              + " FROM \n"
              + " ETS_WORKORDER  EW,\n"
              + " SF_USER SU\n"
              + " WHERE\n"
              + " CONVERT(VARCHAR,EW.IMPLEMENT_BY) *= CONVERT(VARCHAR,SU.USER_ID) AND\n"
              + " ( ?='' OR EW.UPLOAD_DATE LIKE ?  )AND\n"
              + " dbo.AWP_GET_DEADLINE_DATE(EW.START_DATE,EW.IMPLEMENT_DAYS) >= GETDATE() AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) > "
              + DictConstant.WORKORDER_STATUS_NEW
              + " AND\n"
              + " CONVERT(INT,EW.WORKORDER_FLAG) < "
              + DictConstant.WORKORDER_STATUS_CANCELE
              + "\n"
              + " "
              + CONDITION_SQL
              + "\n"
              + " GROUP BY\n"
              + " SU.USERNAME\n";
      strArg.add("");
      strArg.add("");
      String sqlCondit = "";
      if (!StrUtil.isEmpty(Situsdto.getFromDate())) {
        sqlCondit += " AND EW.DISTRIBUTE_DATE >=  '" + Situsdto.getFromDate() + "'\n";
      }
      if (!StrUtil.isEmpty(Situsdto.getToDate())) {
        sqlCondit +=
            " AND dateadd(day,-1,EW.DISTRIBUTE_DATE) <= '" + Situsdto.getFromDate() + "'\n";
      }
      if (orgId == SyBaseSQLUtil.NULL_INT_VALUE) {
        sqlCondit += " AND 1<>1\n";
      } else if (orgId > 0) {
        sqlCondit += " AND CONVERT(VARCHAR,EW.ORGANIZATION_ID) =' " + orgId + "'\n";
      }
      String sqlStr =
          "SELECT\n"
              + " TMP_D.USERNAME,\n"
              + " dbo.NVL(TMP_A.COUNT1, 0) IN_TIME_COUNT,\n"
              + " dbo.NVL(TMP_B.COUNT2, 0) OVER_TIME_COUNT1,\n"
              + " dbo.NVL(TMP_C.COUNT3, 0) OVER_TIME_COUNT2,"
              + " dbo.NVL(TMP_E.COUNT4, 0) NORMAL_PROCESS_COUNT,"
              + " CONVERT(VARCHAR,ROUND((dbo.NVL(TMP_A.COUNT1, 0)/TMP_D.TOTAL_COUNT),2)*100)||'%' RATE\n"
              + " FROM\n "
              + " ("
              + tmpASqlStr
              + ") TMP_A,\n"
              + " ("
              + tmpBSqlStr
              + ") TMP_B,\n"
              + " ("
              + tmpCSqlStr
              + ") TMP_C,\n"
              + " ("
              + tmpDSqlStr
              + ") TMP_D,\n"
              + " ("
              + tmpESqlStr
              + ") TMP_E\n"
              + " WHERE\n"
              + " TMP_D.USERNAME *= TMP_A.USERNAME AND\n"
              + " TMP_D.USERNAME *= TMP_B.USERNAME AND\n"
              + " TMP_D.USERNAME *= TMP_C.USERNAME AND\n"
              + " TMP_D.USERNAME *= TMP_E.USERNAME\n";
      sqlStr = StrUtil.replaceStr(sqlStr, CONDITION_SQL, sqlCondit);
      hasSqlProduced = true;
      sqlModel.setSqlStr(sqlStr);
      sqlModel.setArgs(strArg);
    } catch (CalendarException ex) {
      ex.printLog();
      throw new SQLModelException(ex);
    }
    return sqlModel;
  }
Пример #20
0
  public void performTask(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    String forwardURL = "";
    Message message = SessionUtil.getMessage(req);
    Connection conn = null;
    try {
      conn = getDBConnection(req);
      SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
      Request2DTO req2DTO = new Request2DTO();
      req2DTO.setDTOClassName(AmsAssetsCJYCDTO.class.getName());
      AmsAssetsCJYCDTO dtoParameter = (AmsAssetsCJYCDTO) req2DTO.getDTO(req);
      AmsAssetsQJCJYCDAO dao = new AmsAssetsQJCJYCDAO(user, dtoParameter, conn);
      ServletConfigDTO sevletConfig = SessionUtil.getServletConfigDTO(req);
      dtoParameter.setFaCategory1(SinoConfig.getFaCat1Mis());
      dtoParameter.setFaCategory2(SinoConfig.getFaCat2Mis());
      dtoParameter.setFaCategory3(SinoConfig.getFaCat3Mis());

      String action = req.getParameter("act");
      action = StrUtil.nullToString(action);
      OptionProducer op = new OptionProducer(user, conn);
      int organizationId = StrUtil.strToInt(dtoParameter.getBookTypeCode());
      String companySelect = op.getAllOrganization(organizationId, true);
      req.setAttribute("OU", companySelect);
      String monthOption = op.getFromMonthOption(dtoParameter.getFromMonth());
      String tomonthOption = op.getFromMonthOption(dtoParameter.getToMonth());
      String bookTypeCode = dtoParameter.getBookTypeCode();
      String bookSelect = op.getAllBookTypeName(bookTypeCode, true);
      String catSegment1 = dtoParameter.getCatSegment1();
      String catSegment1Servlet = op.getUseField(catSegment1, true);
      req.setAttribute("CATSEGMENT1", catSegment1Servlet);
      req.setAttribute("BOOK_TYPE_CODE", bookSelect);
      req.setAttribute("FROM_MONTH_OPTION", monthOption);
      req.setAttribute("TO_MONTH_OPTION", tomonthOption);
      req.setAttribute("AMSBJTRANSNOHDTO", dtoParameter);
      if (action.equals("")) {
        forwardURL = "/newasset/assetsQJCJYC.jsp";
      } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
        BaseSQLProducer sqlProducer = new AmsAssetsQJCJYCModel(user, dtoParameter);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setCalPattern(LINE_PATTERN);
        pageDAO.setCountPages(false);
        pageDAO.produceWebData();
        req.setAttribute("AMSBJTRANSNOHDTO", dtoParameter);
        forwardURL = "/newasset/assetsQJCJYC.jsp";
      } else if (action.equals(AssetsActionConstant.EXPORT_ACTION)) {
        File file = dao.exportFile();
        WebFileDownload fileDown = new WebFileDownload(req, res);
        fileDown.setFilePath(file.getAbsolutePath());
        fileDown.download();
        file.delete();
      }
    } 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(MsgKeyConstant.QUERY_ERROR);
      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 (WebFileDownException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.COMMON_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DataTransException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.COMMON_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      ServletForwarder forwarder = new ServletForwarder(req, res);
      forwarder.forwardView(forwardURL);
    }
  }
Пример #21
0
  public void performTask(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    String forwardURL = "";
    Message message = SessionUtil.getMessage(req);
    String action = req.getParameter("act");
    action = StrUtil.nullToString(action);
    Connection conn = null;
    try {
      SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
      EamSyschronizeDTO dtoParameter = null; // 声明DTO
      Request2DTO req2DTO = new Request2DTO();
      req2DTO.setDTOClassName(EamSyschronizeDTO.class.getName());
      dtoParameter = (EamSyschronizeDTO) req2DTO.getDTO(req);
      conn = getDBConnection(req);
      TransStatusDAO eamNewLocusDAO = new TransStatusDAO(user, dtoParameter, conn);
      ServletConfigDTO servletConfig = getServletConfig(req);
      if (action.equals("")) {
        forwardURL = URLDefineList.TRANS_QUERY;
      } else if (action.equals(WebActionConstant.QUERY_ACTION)) { // 查询操作
        BaseSQLProducer sqlProducer = new TransStatusQueryModel(user, dtoParameter);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setServletConfig(servletConfig);
        pageDAO.setCalPattern(LINE_PATTERN);
        pageDAO.produceWebData();
        req.setAttribute(WebAttrConstant.SYSCHRONIZE_DTO, dtoParameter);
        forwardURL = URLDefineList.TRANS_QUERY;
      } else if (action.equals(WebActionConstant.EXPORT_ACTION)) { // 导出Excel
        File file = eamNewLocusDAO.getExportFile();
        WebFileDownload fileDown = new WebFileDownload(req, res);
        fileDown.setFilePath(file.getAbsolutePath());
        fileDown.download();
        file.delete();
      } else if (action.equals(WebActionConstant.DETAIL_ACTION)) {
        eamNewLocusDAO.setDTOClassName(EamSyschronizeDTO.class.getName());
        String batchId = req.getParameter("id");
        dtoParameter.setBatchId(batchId);
        eamNewLocusDAO.setCalPattern(CalendarConstant.LINE_PATTERN);
        //   EamSyschronizeDTO dto = (EamSyschronizeDTO)eamNewLocusDAO.getDataByForeignKey(
        // batchId);
        //    if(dto == null){
        //	dto = new EamSyschronizeDTO();
        //		message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
        //		message.setIsError(true);
        //	   	}  else{
        //                      dto = new EamSyschronizeDTO();
        //                    EamSyschronizeDTO orderDTO = new EamSyschronizeDTO();
        //                    orderDTO.setBatchId(dtoParameter.getBatchId());
        //                    TransStatusDAO orderDAO = new TransStatusDAO(user, orderDTO, conn);
        //                    orderDAO.setDTOClassName(EamSyschronizeDTO.class.getName());
        //                    orderDAO.setCalPattern(LINE_PATTERN);
        DTOSet orders = (DTOSet) eamNewLocusDAO.getDataByForeignKey(batchId);
        req.setAttribute("DTOSET", orders);
        //   }
        //  req.setAttribute(WebAttrConstant.SYSCHRONIZE_DTO, dto);
        forwardURL = "/synchronize/StatusDetail.jsp";
      } else if (action.equals("show")) {
        eamNewLocusDAO.setCalPattern(CalendarConstant.LINE_PATTERN);
        String logId = req.getParameter("logId");
        RowSet rs = eamNewLocusDAO.getLog(logId);
        req.setAttribute("DATA", rs);
        forwardURL = "/synchronize/logInfo.jsp";
      }

    } catch (PoolPassivateException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DTOException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.DTO_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (QueryException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.QUERY_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (WebFileDownException e) {
      e.printLog();
    } catch (DataTransException e) {
      e.printLog();
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      ServletForwarder forwarder = new ServletForwarder(req, res);
      forwarder.forwardView(forwardURL);
      // 根据实际情况修改页面跳转代码。
    }
  }
Пример #22
0
 /**
  * 功能:插入租赁土地资产(EAM)表“AMS_LAND_INFO”数据。
  *
  * @return boolean
  */
 public boolean createData(EtsItemInfoDTO itemInfoDTO, String[] filePaths)
     throws DataHandleException {
   boolean operateResult = false;
   boolean autoCommit = false;
   boolean hasError = true;
   try {
     autoCommit = conn.getAutoCommit();
     conn.setAutoCommit(false);
     AmsHouseInfoDTO landDTO = (AmsHouseInfoDTO) dtoParameter;
     String barcode = landDTO.getBarcode();
     itemInfoDTO.setItemCode(landDTO.getItemCode()); // 分类编码
     itemInfoDTO.setBarcode(landDTO.getBarcode()); // 获得Barcode
     EtsItemInfoDAO itemInfoDAO = new EtsItemInfoDAO(userAccount, itemInfoDTO, conn);
     boolean hasBarcode = hasBarcode(landDTO.getBarcode());
     if (hasBarcode) { // 如果在表ETS_ITEM_INFO存在Barcode即对其进行修改,否则进行插入操作
       itemInfoDAO.updateAttribute1(
           landDTO.getBarcode()); // 跟据Barcode对表ETS_ITEM_INFO进行修改操作,即对 ‘ATTRIBUTE1’的值改为"RENT"  改用
       // Barcode
     } else {
       itemInfoDAO.createData(); // 对表 ETS_ITEM_INFO 进行插入操作
     }
     super.createData(); // 对表 AMS_LAND_INFO 进行插入操作
     if (landDTO
         .getIsRent()
         .equals("Y")) { // 判断表  AMS_LAND_INFO 中的字段 ‘IS_RENT’的值 ;1,若=‘Y’对表 AMS_RENT_INFO 进行插入操作
       creatRentData(); // 插入表AMS_RENT_INFO字段 barcode 对其主键 RENT_ID 自动生成
     }
     // ---对表AMS_ITEM_FILES进行操作
     if (!StrUtil.isEmpty(filePaths)) {
       for (int i = 0; i < filePaths.length; i++) {
         AmsItemFilesDTO fileDTO = new AmsItemFilesDTO();
         fileDTO.setBarcode(barcode);
         String filedp[] = StrUtil.splitStr(filePaths[i], "$");
         fileDTO.setFileDesc(filedp[0]);
         fileDTO.setFilePath(filedp[1]);
         AmsItemFilesDAO amsItemFilesDAO = new AmsItemFilesDAO(userAccount, fileDTO, conn);
         amsItemFilesDAO.setDTOClassName(AmsItemFilesDTO.class.getName());
         amsItemFilesDAO.createData();
       }
     }
     operateResult = true;
     conn.commit();
     hasError = false;
     prodMessage(MsgKeyConstant.CREATE_DATA_SUCCESS);
     getMessage().addParameterValue("土地数据");
   } catch (SQLException ex) {
     Logger.logError(ex);
     prodMessage(MsgKeyConstant.SQL_ERROR);
   } catch (SQLModelException ex) {
     Logger.logError(ex);
     prodMessage(MsgKeyConstant.SQL_ERROR);
   } catch (QueryException ex) {
     Logger.logError(ex);
     prodMessage(MsgKeyConstant.SQL_ERROR);
     try {
       if (hasError) {
         conn.rollback(); // 回滚
       }
       conn.setAutoCommit(autoCommit); // 恢复以前状态
     } catch (SQLException e) {
       Logger.logError(e);
       prodMessage(MsgKeyConstant.ROLL_BACK_ERROR);
     }
   }
   return operateResult;
 }
Пример #23
0
 /**
  * 提交工单
  *
  * @param dtoSet
  * @return
  * @throws QueryException
  * @throws DataHandleException
  */
 private boolean importEAMhouse(DTOSet dtoSet) throws DataHandleException {
   boolean operatorResult = false;
   try {
     if (dtoSet != null && dtoSet.getSize() > 0) {
       EtsFaAssetsDTO faDTO = null;
       EtsItemInfoDTO itemDTO = null;
       AmsHouseInfoDTO houseDTO = null;
       SystemItemHouse systemItemUtil = new SystemItemHouse();
       for (int i = 0; i < dtoSet.getSize(); i++) {
         faDTO = (EtsFaAssetsDTO) dtoSet.getDTO(i);
         itemDTO = new EtsItemInfoDTO();
         itemDTO.setBarcode(faDTO.getTagNumber());
         itemDTO.setItemName(faDTO.getAssetsDescription());
         itemDTO.setItemSpec(faDTO.getModelNumber());
         itemDTO.setItemQty(StrUtil.nullToString(faDTO.getCurrentUnits()));
         itemDTO.setStartDate(faDTO.getDatePlacedInService().toString());
         itemDTO.setItemCategory("HOUSE");
         itemDTO.setAssetId(faDTO.getAssetId());
         itemDTO.setOrganizationId(faDTO.getOrganizationId());
         itemDTO.setFinanceProp("ASSETS");
         itemDTO = systemItemUtil.checkSysItem(conn, itemDTO);
         appendProjIdData(itemDTO, faDTO);
         appendUserData(itemDTO, faDTO);
         appendAddressData(itemDTO, faDTO);
         if (StrUtil.isEmpty(itemDTO.getAddressId())) {
           addAddressData(faDTO);
           appendAddressData(itemDTO, faDTO);
         }
         if (StrUtil.isEmpty(itemDTO.getAddressId())) {
           continue;
         }
         houseDTO = new AmsHouseInfoDTO();
         houseDTO.setBarcode(faDTO.getTagNumber());
         houseDTO.setHouseAddress(faDTO.getAssetsLocation());
         houseDTO.setHremark("house信息导入");
         itemDTO.setSystemId(getNextSystemId());
         itemDTO.setRemark("house信息导入");
         if (!isExist(faDTO)) {
           insertEtsItemInfo(itemDTO); // IN  ams_item_info
         }
         insertHouesInfo(houseDTO); // IN ams_house_info
         matchData(itemDTO, faDTO); // 进行匹配操作
       }
     }
     operatorResult = true;
   } catch (DataHandleException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   } catch (SQLException ex) {
     Logger.logError(ex);
     throw new DataHandleException(ex);
   } catch (ContainerException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   } catch (QueryException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   } catch (CalendarException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   }
   return operatorResult;
 }
Пример #24
0
  /**
   * 功能:修改数据。
   *
   * @return boolean
   */
  public boolean updateData(
      EtsItemInfoDTO itemInfoDTO, AmsItemFilesDTO fileDTO, String[] filePaths, DTOSet lineSet)
      throws DataHandleException {
    boolean operateResult = false;
    boolean autoCommit = false;
    boolean hasError = true;
    try {
      autoCommit = conn.getAutoCommit();
      conn.setAutoCommit(false);
      AmsHouseInfoDTO HLDTO = (AmsHouseInfoDTO) dtoParameter;
      AmsHouseInfoModel model = new AmsHouseInfoModel(userAccount, HLDTO);
      SQLModel sqlModel1 = model.deleteUsesInfo();
      DBOperator.updateRecord(sqlModel1, conn);

      String barcode = HLDTO.getBarcode();
      super.updateData(); // 对表AMS_house_INFO进行修改操作

      itemInfoDTO.setBarcode(HLDTO.getBarcode()); // 标签号
      itemInfoDTO.setItemCode(HLDTO.getItemCode()); // 分类编码
      itemInfoDTO.setSystemid(HLDTO.getSystemId()); //  根据SYSTEMID进行修改;

      if (!HLDTO.getTemp().equals("Y")) {
        GetMisHousInfoModel updateEII = new GetMisHousInfoModel(userAccount, HLDTO);
        SQLModel eiiSqlModel = updateEII.getEiiData(HLDTO.getBarcode());
        DBOperator.updateRecord(eiiSqlModel, conn);
      }

      //            EtsItemInfoDAO itemInfoDAO = new EtsItemInfoDAO(userAccount,itemInfoDTO,conn);
      //            itemInfoDAO.updateData();              //对表ETS_ITEM_INFO进行修改操作

      //            if (landDTO.getIsRent().equals("Y")) {        //表 AMS_RENT_INFO (RENT_ID ) 修改
      // 先删除 再增加
      //                deleteRentData();
      //                creatRentData();
      //            } else {
      //                deleteRentData();          //对表  AMS_RENT_INFO 进行删除操作
      //            }
      saveUses(lineSet);
      // --------------对表 AMS_ITEM_FILES  进行修改操作   先删除再增加
      AmsItemFilesModel sqlModel = new AmsItemFilesModel(userAccount, fileDTO);
      DBOperator.updateRecord(sqlModel.getDeleteModel(barcode), conn);
      if (!StrUtil.isEmpty(filePaths)) {
        SeqProducer seq = new SeqProducer(conn);
        for (int i = 0; i < filePaths.length; i++) {
          fileDTO.setBarcode(barcode);
          String filedp[] = StrUtil.splitStr(filePaths[i], "$");
          fileDTO.setFileDesc(filedp[0]);
          fileDTO.setFilePath(filedp[1]);
          fileDTO.setSystemId(seq.getGUID());
          DBOperator.updateRecord(sqlModel.getCreateModel(), conn);
        }
      }
      operateResult = true;
      conn.commit();
      hasError = false;
      prodMessage(MsgKeyConstant.UPDATE_DATA_SUCCESS);
      getMessage().addParameterValue("未处置信息");
    } catch (SQLException ex) {
      Logger.logError(ex);
      prodMessage(MsgKeyConstant.SQL_ERROR);
      //        } catch (SQLModelException ex) {
      //            Logger.logError(ex);
      //            prodMessage(MsgKeyConstant.SQL_ERROR);
    } catch (QueryException e) {
      Logger.logError(e);
      //            prodMessage(MsgKeyConstant.SQL_ERROR);
    } finally {
      try {
        if (hasError) {
          conn.rollback(); // 回滚
        }
        conn.setAutoCommit(autoCommit); // 恢复以前状态
      } catch (SQLException ex) {
        Logger.logError(ex);
        prodMessage(MsgKeyConstant.ROLL_BACK_ERROR);
      }
    }
    return operateResult;
  }
Пример #25
0
 /**
  * @param request ServletRequest
  * @param res ServletResponse
  * @param chain FilterChain
  * @throws IOException
  * @throws ServletException
  */
 public void doFilter(ServletRequest request, ServletResponse res, FilterChain chain)
     throws IOException, ServletException {
   try {
     HttpServletRequest req = (HttpServletRequest) request;
     if (isStartLog && !req.getRemoteAddr().equals("127.0.0.1")) {
       SfUserDTO userAccount = (SfUserDTO) SessionUtil.getUserAccount(req);
       String reqUrl = req.getRequestURI();
       if (userAccount != null) {
         if (reqUrl.indexOf(".jsp") > -1 || reqUrl.indexOf("/servlet") > -1) {
           String action = "查询";
           String queryStr = req.getQueryString();
           String[] paras = StrUtil.splitStr(queryStr, "&");
           if (paras != null && paras.length > 0) {
             int index = -1;
             String singlePara = "";
             String paraName = "";
             for (int i = 0; i < paras.length; i++) {
               singlePara = paras[i];
               if (singlePara == null) {
                 continue;
               }
               index = singlePara.indexOf("=");
               if (index != -1) {
                 paraName = singlePara.substring(0, index);
                 if (paraName.equals("act")) {
                   action = singlePara.substring(index + 1);
                   break;
                 }
               }
             }
           }
           if (!StrUtil.isEmpty(queryStr)) {
             reqUrl = reqUrl + "?" + queryStr;
           }
           FilterConfigDTO filterConfigDTO = SessionUtil.getFilterConfigDTO(req);
           if (reqUrl.equals(filterConfigDTO.getLoginSuccessURL())) {
             action = "登录";
           }
           if (reqUrl.equals(filterConfigDTO.getLogOutServlet())) {
             action = "注销";
           }
           SfUserLogDTO logData = new SfUserLogDTO();
           logData.setUserId(userAccount.getUserId());
           logData.setUserAccount(userAccount.getLoginName());
           logData.setActionType(action);
           logData.setClientIp(req.getRemoteAddr());
           logData.setReqUrl(reqUrl);
           logData.setServer(req.getServerName());
           logData.setLogTime(CalendarUtil.getCurrCalendar());
           logData(userAccount, logData);
         }
       }
     }
     if (chain != null) {
       chain.doFilter(req, res);
     }
   } catch (DataHandleException ex) {
     ex.printLog();
     throw new ServletException(ex);
   } catch (CalendarException ex) {
     ex.printLog();
     throw new ServletException(ex);
   }
 }
Пример #26
0
  public void performTask(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    String forwardURL = "";
    Message message = SessionUtil.getMessage(req);
    String action = StrUtil.nullToString(req.getParameter("act"));
    Connection conn = null;
    try {
      SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
      AmsItemAllocateHDTO dtoParameter = null;
      Request2DTO req2DTO = new Request2DTO();
      req2DTO.setDTOClassName(AmsItemAllocateHDTO.class.getName());
      dtoParameter = (AmsItemAllocateHDTO) req2DTO.getDTO(req);
      conn = getDBConnection(req);
      OptionProducer optProducer = new OptionProducer(user, conn);
      if (action.equals("")) {
        String orderStatus =
            optProducer.getDictOption("SPARE_ORDER_STATUS", dtoParameter.getTransStatus());
        req.setAttribute(WebAttrConstant.TRANS_STATUS, orderStatus);
        String invOption = optProducer.getInvOption(dtoParameter.getFromObjectNo());
        req.setAttribute(WebAttrConstant.INV_OPTION, invOption);
        forwardURL = "/nm/spare2/bjdbdy.jsp";
      } else if (action.equals(WebActionConstant.QUERY_ACTION)) {
        BaseSQLProducer sqlProducer = new BjdbdyModel(user, dtoParameter);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setCalPattern(CalendarConstant.LINE_PATTERN);
        pageDAO.produceWebData();
        String orderStatus =
            optProducer.getDictOption("SPARE_ORDER_STATUS", dtoParameter.getTransStatus());
        req.setAttribute(WebAttrConstant.TRANS_STATUS, orderStatus);
        String invOption = optProducer.getInvOption(dtoParameter.getFromObjectNo());
        req.setAttribute(WebAttrConstant.INV_OPTION, invOption);
        forwardURL = "/nm/spare2/bjdbdy.jsp";
      } else if (action.equals(WebActionConstant.DETAIL_ACTION)) {
        BjswjyckDAO itemTransHDAO = new BjswjyckDAO(user, dtoParameter, conn);
        itemTransHDAO.setDTOClassName(AmsItemAllocateHDTO.class.getName());
        AmsItemAllocateHDTO amsItemTransH =
            (AmsItemAllocateHDTO) itemTransHDAO.getDataByPrimaryKey();
        if (amsItemTransH == null) {
          amsItemTransH = new AmsItemAllocateHDTO();
          message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
          message.setIsError(true);
        }
        req.setAttribute("AIT_HEADER", amsItemTransH);
        String freightDate = req.getParameter("freightDate");
        WebPageView wpv = new WebPageView(req, conn);
        wpv.setPrintProp(true);
        BaseSQLProducer sqlProducer = new BjswjyckModel(user, dtoParameter);
        wpv.produceWebData(sqlProducer.getDataByForeignKeyModel(dtoParameter.getTransId()));

        forwardURL = "/nm/spare2/bjdbdyDetail.jsp";
      } else {
        message = getMessage(MsgKeyConstant.INVALID_REQ);
        message.setIsError(true);
        forwardURL = MessageConstant.MSG_PRC_SERVLET;
      }
    } catch (PoolPassivateException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
      message.setIsError(true);
      message.setNeedBack(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DTOException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.DTO_ERROR);
      message.setIsError(true);
      message.setNeedBack(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (QueryException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.QUERY_ERROR);
      message.setIsError(true);
      message.setNeedBack(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (SQLModelException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      ServletForwarder forwarder = new ServletForwarder(req, res);
      forwarder.forwardView(forwardURL);
    }
  }
Пример #27
0
 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(AmsVendorInfoDTO.class.getName());
     AmsVendorInfoDTO dto = (AmsVendorInfoDTO) req2DTO.getDTO(req);
     String action = dto.getAct();
     conn = getDBConnection(req);
     SpareVendorDAO rptDAO = new SpareVendorDAO(user, dto, conn);
     if (action.equals("")) {
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.SPARE_VENDOR_QUERY;
     } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new SpareVendorModel(user, dto);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.setCalPattern(LINE_PATTERN);
       pageDAO.produceWebData();
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.SPARE_VENDOR_QUERY;
     } else if (action.equals(WebActionConstant.NEW_ACTION)) {
       String VendorId = rptDAO.getVendorId();
       dto.setVendorId(VendorId);
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.SPARE_VENDOR_INFO;
     } else if (action.equals(WebActionConstant.CREATE_ACTION)) {
       rptDAO.setServletConfig(getServletConfig(req));
       rptDAO.createData();
       message = rptDAO.getMessage();
       forwardURL = AssetsURLList.SPARE_VENDOR_SERVLET;
     } else if (action.equals(WebActionConstant.UPDATE_ACTION)) {
       rptDAO.setServletConfig(getServletConfig(req));
       rptDAO.updateData();
       message = rptDAO.getMessage();
       forwardURL = AssetsURLList.SPARE_VENDOR_SERVLET;
     } else if (action.equals(AssetsActionConstant.DETAIL_ACTION)) {
       rptDAO.setDTOClassName(AmsVendorInfoDTO.class.getName());
       AmsVendorInfoDTO ridDto = (AmsVendorInfoDTO) rptDAO.getDataByPrimaryKey();
       if (ridDto == null) {
         dto = new AmsVendorInfoDTO();
         message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
         message.setIsError(true);
       }
       req.setAttribute(QueryConstant.QUERY_DTO, ridDto);
       forwardURL = AssetsURLList.SPARE_VENDOR_INFO;
     } else if (action.equals(WebActionConstant.DELETE_ACTION)) {
       rptDAO.deleteData();
       message = rptDAO.getMessage();
       forwardURL = AssetsURLList.SPARE_VENDOR_SERVLET;
     } else if (action.equals("verifyworkNo")) {
       String vendorName = req.getParameter("vendorName");
       boolean success = rptDAO.doVerify(vendorName);
       PrintWriter out = res.getWriter();
       if (success) {
         out.print("Y");
       }
       out.flush();
       out.close();
     } 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 (DataHandleException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (SQLModelException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (ContainerException e) {
     e.printStackTrace();
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     if (!StrUtil.isEmpty(forwardURL)) {
       ServletForwarder forwarder = new ServletForwarder(req, res);
       forwarder.forwardView(forwardURL);
     }
   }
 }
 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);
     NewAssetsReportDeptDAO rptDAO = new NewAssetsReportDeptDAO(user, dto, conn);
     if (action.equals("")) {
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.NEW_FA_REPORT_DEPT;
     } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new NewAssetsReportDeptModel(user, dto);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.setPageSize(23);
       pageDAO.setCalPattern(LINE_PATTERN);
       pageDAO.produceWebData();
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.NEW_FA_REPORT_DEPT;
     } else if (action.equals(AssetsActionConstant.EXPORT_ACTION)) {
       File file = rptDAO.getExportFile();
       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;
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     if (!StrUtil.isEmpty(forwardURL)) {
       ServletForwarder forwarder = new ServletForwarder(req, res);
       forwarder.forwardView(forwardURL);
     }
   }
 }
Пример #29
0
 public void setCreationDate(String creationDate) throws CalendarException {
   if (!StrUtil.isEmpty(creationDate)) {
     SimpleCalendar cal = new SimpleCalendar(creationDate);
     this.creationDate = cal.getSQLTimestamp();
   }
 }
Пример #30
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);
     }
   }
 }