Ejemplo n.º 1
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);
     }
   }
 }
Ejemplo n.º 2
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);
   }
 }
Ejemplo n.º 3
0
 /**
  * 功能:记录设备最新一次交易情况:例如报废,其他的视具体需要而定 需要同步到MIS的时候调用该方法。
  *
  * @param orderType String
  * @param isExist String
  * @throws DataHandleException
  */
 private void recordChkLog(String orderType, String isExist) throws DataHandleException {
   try {
     FreeFlowDTO dto = (FreeFlowDTO) dtoParameter;
     AmsAssetsTransLineDTO line = new AmsAssetsTransLineDTO();
     line.setTransId(dto.getTransId());
     AmsAssetsTransLineDAO lineDAO = new AmsAssetsTransLineDAO(userAccount, line, conn);
     lineDAO.setDTOClassName(AmsAssetsTransLineDTO.class.getName());
     DTOSet dtos = (DTOSet) lineDAO.getDataByForeignKey("transId");
     if (dtos != null && !dtos.isEmpty()) {
       int lineCount = dtos.getSize();
       String orderUrl = "";
       AmsAssetsChkLogDTO chkLogDTO = null;
       AmsAssetsChkLogDAO chkLogDAO = new AmsAssetsChkLogDAO(userAccount, null, conn);
       for (int i = 0; i < lineCount; i++) {
         line = (AmsAssetsTransLineDTO) dtos.getDTO(i);
         chkLogDTO = new AmsAssetsChkLogDTO();
         chkLogDTO.setBarcode(line.getBarcode());
         chkLogDTO.setLastChkNo(line.getTransNo());
         chkLogDTO.setHeaderId(line.getTransId());
         chkLogDTO.setResponsibilityUser(line.getResponsibilityUser());
         chkLogDTO.setResponsibilityDept(line.getDeptCode());
         chkLogDTO.setAddressId(line.getAddressId());
         chkLogDTO.setOrganizationId(userAccount.getOrganizationId());
         chkLogDTO.setCreatedBy(userAccount.getUserId());
         chkLogDTO.setOrderType(orderType);
         chkLogDTO.setIsExist(isExist);
         orderUrl = URLDefineList.FREE_FLOW_SERVLET;
         orderUrl += "?act=" + AssetsActionConstant.DETAIL_ACTION;
         orderUrl += "&transId=" + line.getTransId();
         chkLogDTO.setOrderDtlUrl(orderUrl);
         chkLogDAO.setDTOParameter(chkLogDTO);
         chkLogDAO.saveCheckLogData();
       }
     }
   } catch (QueryException ex) {
     ex.printLog();
     throw new DataHandleException(ex);
   }
 }
Ejemplo n.º 4
0
 /**
  * 功能:导入mis的房屋和土地的信息
  *
  * @return boolean
  */
 public boolean getMisInfo() throws DataHandleException {
   boolean operateResult = false;
   boolean autoCommit = false;
   try {
     autoCommit = conn.getAutoCommit();
     conn.setAutoCommit(false);
     SQLModel sqlModel = modelProducer.getPageQueryModel();
     GridQuery sq = new GridQuery(sqlModel, conn);
     sq.setDTOClassName(EtsFaAssetsDTO.class.getName());
     sq.setPageSize(2000);
     sq.executeQuery();
     while (sq.nextPage()) {
       DTOSet dtos = sq.getDTOSet();
       importEAMhouse(dtos);
     }
     operateResult = true;
   } catch (SQLException ex) {
     Logger.logError(ex);
   } catch (QueryException ex) {
     ex.printLog();
   } finally {
     try {
       if (operateResult) {
         conn.commit();
         prodMessage(AssetsMessageKeys.READ_HOUSE_SUCCESS);
       } else {
         conn.rollback(); // 回滚
         prodMessage(AssetsMessageKeys.READ_HOUSE_FAILURE);
       }
       message.setIsError(!operateResult);
       conn.setAutoCommit(autoCommit); // 恢复以前状态
     } catch (SQLException ex) {
       Logger.logError(ex);
       prodMessage(AssetsMessageKeys.ROLL_BACK_ERROR);
     }
   }
   return operateResult;
 }
Ejemplo n.º 5
0
 /**
  * 所有的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);
   }
 }
Ejemplo n.º 6
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);
     // 根据实际情况修改页面跳转代码。
   }
 }
Ejemplo n.º 7
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);
    }
  }
Ejemplo n.º 8
0
  /**
   * 功能:审批单据,含调拨单,报废单,处置单,共享单
   *
   * @param flowDTO FlowDTO
   * @param orderLines 更改调拨单行的折旧费用账户(2008-12-01 17:37)
   * @return boolean
   */
  public boolean approveOrder(FlowDTO flowDTO, DTOSet orderLines) {
    boolean operateResult = false;
    boolean autoCommit = true;
    boolean needMsg = true;
    String flowCode = "";
    try {
      if (canApprove()) {
        autoCommit = conn.getAutoCommit();
        conn.setAutoCommit(false);
        FreeFlowDTO dto = (FreeFlowDTO) dtoParameter;
        flowCode = dto.getFlowCode();
        flowDTO.setProcName(dto.getProcdureName());
        flowDTO.setActivity(flowCode);
        flowDTO.setApplyId(dto.getTransId());
        flowDTO.setSessionUserId(userAccount.getUserId());
        flowDTO.setSessionUserName(userAccount.getUsername());
        flowDTO.setApplyNo(dto.getTransNo());
        FlowAction flowProcessor = new FlowAction(conn, flowDTO);
        boolean flow2End = flowProcessor.isFlowToEnd();
        dto.setFlow2End(flow2End);
        setDTOParameter(dto);
        if (flowCode.equals(FlowConstant.FLOW_CODE_NEXT)) {
          if (flow2End) {
            dto.setTransStatus(AssetsDictConstant.COMPLETED);
          } else {
            dto.setTransStatus(AssetsDictConstant.IN_PROCESS);
          }
          flowProcessor.flow();
        } else {
          dto.setTransStatus(AssetsDictConstant.REJECTED);
          flowProcessor.reject2Begin();
        }
        setDTOParameter(dto);
        OrderApproveModel modelProducer = (OrderApproveModel) sqlProducer;
        SQLModel sqlModel = modelProducer.getOrderApproveModel();
        DBOperator.updateRecord(sqlModel, conn);

        String provinceCode = servletConfig.getProvinceCode();
        if (provinceCode.equals(AssetsDictConstant.PROVINCE_CODE_JIN)
            && flowCode.equals(FlowConstant.FLOW_CODE_NEXT)) { // 仅山西需要该功能。
          if (dto.getTransferType().equals("BTW_COMP")) {
            AmsAssetsTransLineDAO lineDAO = new AmsAssetsTransLineDAO(userAccount, null, conn);
            lineDAO.uodateAccount(orderLines);
          }
        }
        if (flow2End && flowCode.equals(FlowConstant.FLOW_CODE_NEXT)) {
          sqlModel = modelProducer.getLineStatusUpdateModel(); // 更新资产单据行数据状态为已审批
          DBOperator.updateRecord(sqlModel, conn);
          if (dto.getTransType().equals(AssetsDictConstant.ASS_DIS)) { // 报废
            sqlModel = modelProducer.getAssetsDiscardModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
            if (provinceCode.equals(AssetsDictConstant.PROVINCE_CODE_SX)) { // 山西省报废要同步
              recordChkLog(AssetsDictConstant.ASS_DIS, AssetsDictConstant.STATUS_NO);
            }
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_CLR)) { // 处置
            sqlModel = modelProducer.getAssetsClearModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_FREE)) { // 闲置
            sqlModel = modelProducer.getAssetsFreeModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_SUB)) { // 减值
            sqlModel = modelProducer.getAssetsSubModel();
            DBOperator.updateRecord(sqlModel, conn);
            deleteReserveAssets();
          } else if (dto.getTransType().equals(AssetsDictConstant.ASS_SHARE)) { // 共享
            sqlModel = modelProducer.getAssetsShareModel();
            DBOperator.updateRecord(sqlModel, conn);
          }
        }
        operateResult = true;
      } else {
        prodMessage(AssetsMessageKeys.APPROVE_INVALID);
        message.setIsError(!operateResult);
        needMsg = false;
      }
    } catch (DataHandleException ex) {
      ex.printLog();
    } catch (SQLException ex) {
      Logger.logError(ex);
    } catch (ContainerException ex) {
      ex.printLog();
    } catch (QueryException ex) {
      ex.printLog();
    } finally {
      try {
        if (!operateResult) {
          conn.rollback();
        } else {
          conn.commit();
        }
        conn.setAutoCommit(autoCommit);
        if (needMsg) {
          processMessage(operateResult, flowCode);
        }
      } catch (SQLException ex1) {
        Logger.logError(ex1);
      }
    }
    return operateResult;
  }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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);
      // 根据实际情况修改页面跳转代码。
    }
  }
Ejemplo n.º 11
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);
     }
   }
 }
Ejemplo n.º 12
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);
     }
   }
 }
Ejemplo n.º 13
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);
    }
  }
Ejemplo n.º 14
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);
     // 根据实际情况修改页面跳转代码。
   }
 }
Ejemplo n.º 15
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(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);
     }
   }
 }
Ejemplo n.º 16
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(EamDhCheckLineDTO.class.getName());
      EamDhCheckLineDTO dto = (EamDhCheckLineDTO) req2DTO.getDTO(req);
      String action = dto.getAct();
      conn = getDBConnection(req);
      if (action.equals("")) {
        req.setAttribute(QueryConstant.QUERY_DTO, dto);
        forwardURL = LvecURLs.INS_CONFIRM_PAGE;
      } else if (action.equals(DzyhActionConstant.QUERY_ACTION)) {
        BaseSQLProducer sqlProducer = new OrderLineConfirmModel(user, dto);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setDTOClassName(EamDhCheckLineDTO.class.getName());
        pageDAO.setCalPattern(LINE_PATTERN);

        CheckBoxProp checkProp = new CheckBoxProp("subCheck");
        checkProp.addDbField("HEADER_ID");
        checkProp.addDbField("BARCODE");
        checkProp.addDbField("CATALOG_VALUE_ID");
        checkProp.addDbField("RESPONSIBILITY_USER");
        checkProp.addDbField("RESPONSIBILITY_DEPT");
        checkProp.addDbField("ORDER_NO");

        pageDAO.setWebCheckProp(checkProp);
        pageDAO.produceWebData();

        req.setAttribute(QueryConstant.QUERY_DTO, dto);
        forwardURL = LvecURLs.INS_CONFIRM_PAGE;
      } else if (action.equals(DzyhActionConstant.CONFIRM_ACTION)) { // 确认
        if (user.getEmployeeNumber().equals("")) {
          message = getMessage(LvecMessageKeys.NO_EMPLOYEE_NUMBER);
          message.setIsError(true);
          message.setNeedBack(true);
          forwardURL = MessageConstant.MSG_PRC_SERVLET;
        } else {
          RequestParser parser = new RequestParser();
          CheckBoxProp checkProp = new CheckBoxProp("subCheck");
          checkProp.setIgnoreOtherField(true);
          parser.setCheckBoxProp(checkProp);
          parser.transData(req);

          req2DTO.setIgnoreFields(EamCheckTaskDTO.class);
          req2DTO.addIgnoreField("itemName");
          //					req2DTO.addIgnoreField("orderNo");

          DTOSet orderLines = req2DTO.getDTOSet(parser);
          InstruConfirmDAO confirmDAO = new InstruConfirmDAO(user, dto, conn);

          confirmDAO.ConfirmInstrument(orderLines);
          message = confirmDAO.getMessage();
          forwardURL = LvecURLs.INS_CONFIRM_SERVLET;
          forwardURL += "?act=" + DzyhActionConstant.QUERY_ACTION;
        }
      } 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 (UploadException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.COMMON_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 (DataHandleException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.SQL_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      if (!forwardURL.equals("")) {
        ServletForwarder forwarder = new ServletForwarder(req, res);
        forwarder.forwardView(forwardURL);
      }
    }
  }
 /**
  * @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(AmsAssetsSamplingLineDTO.class.getName());
     AmsAssetsSamplingLineDTO dtoParameter = (AmsAssetsSamplingLineDTO) req2DTO.getDTO(req);
     String action = dtoParameter.getAct();
     conn = getDBConnection(req);
     AmsAssetsSamplingLineDAO amsAssetsSamplingLineDAO =
         new AmsAssetsSamplingLineDAO(user, dtoParameter, conn);
     if (action.equals("")) {
       forwardURL =
           "com.sino.ams.sampling.servlet.AmsAssetsSamplingLineServlet的翻页查询JSP页面,一般在类似于URLDefineList的常量接口中定义";
     } else if (action.equals(WebActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new AmsAssetsSamplingLineModel(user, dtoParameter);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.produceWebData();
       forwardURL =
           "com.sino.ams.sampling.servlet.AmsAssetsSamplingLineServlet的翻页查询JSP页面,一般在类似于URLDefineList的常量接口中定义";
     } else if (action.equals(WebActionConstant.NEW_ACTION)) {
       AmsAssetsSamplingLineDTO amsAssetsSamplingLine =
           (AmsAssetsSamplingLineDTO) req.getAttribute("获取因为失败而保持的数据,请根据实际情况修改");
       if (amsAssetsSamplingLine == null) {
         amsAssetsSamplingLine =
             dtoParameter; // 表示没有因失败而保持的数据,则产生默认的对象数据,数据由com.sino.ams.sampling.dto.AmsAssetsSamplingLineDTO的构造函数确定
       }
       req.setAttribute("详细数据属性,请根据实际情况修改", amsAssetsSamplingLine);
       forwardURL =
           "com.sino.ams.sampling.servlet.AmsAssetsSamplingLineServlet详细数据JSP页面,一般在类似于URLDefineList的常量接口中定义";
     } else if (action.equals(WebActionConstant.DETAIL_ACTION)) {
       amsAssetsSamplingLineDAO.setDTOClassName(AmsAssetsSamplingLineDTO.class.getName());
       AmsAssetsSamplingLineDTO amsAssetsSamplingLine =
           (AmsAssetsSamplingLineDTO) amsAssetsSamplingLineDAO.getDataByPrimaryKey();
       if (amsAssetsSamplingLine == null) {
         amsAssetsSamplingLine = new AmsAssetsSamplingLineDTO();
         message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
         message.setIsError(true);
       }
       req.setAttribute("详细数据属性,请根据实际情况修改", amsAssetsSamplingLine);
       forwardURL =
           "com.sino.ams.sampling.servlet.AmsAssetsSamplingLineServlet详细数据JSP页面,一般在类似于URLDefineList的常量接口中定义";
     } else if (action.equals(WebActionConstant.CREATE_ACTION)) {
       amsAssetsSamplingLineDAO.createData();
       forwardURL =
           "可再次执行com.sino.ams.sampling.servlet.AmsAssetsSamplingLineServlet的QUERY_ACTION,请根据实际情况确定";
     } else if (action.equals(WebActionConstant.UPDATE_ACTION)) {
       amsAssetsSamplingLineDAO.updateData();
       forwardURL =
           "可再次执行com.sino.ams.sampling.servlet.AmsAssetsSamplingLineServlet的QUERY_ACTION,请根据实际情况确定";
     } else if (action.equals(WebActionConstant.DELETE_ACTION)) {
       amsAssetsSamplingLineDAO.deleteData();
       forwardURL =
           "可再次执行com.sino.ams.sampling.servlet.AmsAssetsSamplingLineServlet的QUERY_ACTION,请根据实际情况确定";
     } 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 = "保持界面录入的数据,返回到原页面,并显示上面给出的消息";
   } finally {
     DBManager.closeDBConnection(conn);
     setHandleMessage(req, message);
     ServletForwarder forwarder = new ServletForwarder(req, res);
     forwarder.forwardView(forwardURL);
     // 根据实际情况修改页面跳转代码。
   }
 }
Ejemplo n.º 18
0
  public void run() {
    Connection conn = null;
    DTOSet messages = null;
    SfMsgDefineDTO message = null;
    int msgCount = 0;
    DTOSet sendInfos = null;
    SfMsgSendInfoDTO sendDTO = null;
    String cellPhone = "";

    boolean needSend = false;
    System.out.println("启动消息服务...");
    while (true) {
      try {
        sleep(300000);

        AmsEmailSend send = new AmsEmailSend();
        send.sendEmail();

        conn = DBManager.getDBConnection();
        msgProcessService.finishMessages(conn); // 更新已经处理过的消息的状态。

        messages = msgProcessService.getNeedSendMessages(conn);
        if (messages == null || messages.isEmpty()) {
          continue;
        }
        msgCount = messages.getSize();
        for (int i = 0; i < msgCount; i++) {
          message = (SfMsgDefineDTO) messages.getDTO(i);
          sendInfos = msgProcessService.getMsgSendInfos(conn, message);
          if (sendInfos == null || sendInfos.isEmpty()) {
            continue;
          }
          sendService.setMessage(message.getMsgContent());
          for (int j = 0; j < sendInfos.getSize(); j++) {
            sendDTO = (SfMsgSendInfoDTO) sendInfos.getDTO(j);
            cellPhone = sendDTO.getMsgCellPhone();

            needSend = msgProcessService.needSend(conn, sendDTO);

            if (needSend) { // 需要发送
              sendService.addPhoneNum(cellPhone);
              if (sendService.getPhoneCount() >= sendService.getMaxPhoneNum()) {
                sendService.sendMessage();
                sendService.clearPhoneList();
              }
            }
            if (needSend) {
              msgProcessService.processSendLog(conn, sendDTO, cellPhone);
            }
          }
          if (sendService.getPhoneCount() > 0) {
            sendService.sendMessage();
            sendService.clearPhoneList();
          }
        }
      } catch (PoolException ex) {
        ex.printLog();
      } catch (InterruptedException ex) {
        Logger.logError(ex);
      } catch (QueryException ex) {
        ex.printLog();
      } catch (DataHandleException ex) {
        ex.printLog();
      } catch (OutOfBoundsException ex) {
        Logger.logError(ex);
      } catch (NoSuchProviderException e) {
        Logger.logError(e);
      } finally {
        DBManager.closeDBConnection(conn);
      }
    }
  }