コード例 #1
0
 public void deleteRentData() throws SQLModelException { // 执行AMS_RENT_INFO 表的新增操作
   try {
     GetMisHousInfoModel getMisHousInfoModel = (GetMisHousInfoModel) sqlProducer;
     SQLModel sqlModel = getMisHousInfoModel.doDeleteRentData();
     DBOperator.updateRecord(sqlModel, conn);
     prodMessage(CustMessageKey.ENABLE_SUCCESS);
     getMessage().addParameterValue("土地数据");
   } catch (DataHandleException ex) {
     prodMessage(CustMessageKey.ENABLE_FAILURE);
     getMessage().addParameterValue("土地数据");
     ex.printLog();
   }
 }
コード例 #2
0
 public void efficientData(String[] barcodes) { // 执行批量生效效操作
   //		EtsObjectDTO dtoPara = (EtsObjectDTO) dtoParameter;
   AmsHouseInfoDTO landDTO = (AmsHouseInfoDTO) dtoParameter;
   try {
     SQLModel sqlModel = modelProducer.UpdateBarsModel(barcodes);
     DBOperator.updateRecord(sqlModel, conn);
     prodMessage(CustMessageKey.ENABLE_SUCCESS);
     getMessage().addParameterValue("重置");
   } catch (DataHandleException ex) {
     prodMessage(CustMessageKey.ENABLE_FAILURE);
     getMessage().addParameterValue("重置");
     ex.printLog();
   }
 }
コード例 #3
0
ファイル: SfUserLogFilter.java プロジェクト: starMagic/CQEAM
 private void logStopData() {
   try {
     SfUserLogDTO logData = new SfUserLogDTO();
     logData.setUserId(-1);
     logData.setUserAccount(WorldConstant.USER_ACCOUNT);
     logData.setActionType("应用系统停止");
     logData.setClientIp("NOT_BY_CLIENT");
     logData.setReqUrl("there's no url requested");
     InetAddress localHost = InetAddress.getLocalHost();
     logData.setServer(localHost.getHostName());
     logData.setLogTime(CalendarUtil.getCurrCalendar());
     logData(null, logData);
   } catch (CalendarException ex) {
     ex.printLog();
   } catch (UnknownHostException ex) {
     Logger.logError(ex);
   } catch (DataHandleException ex) {
     ex.printLog();
   }
 }
コード例 #4
0
 /**
  * 功能:批量撤销工单批
  *
  * @param batchIds String[]
  * @param singleCancel boolean
  */
 public void cancelOrderBatchs(String[] batchIds, boolean singleCancel) {
   boolean operateResult = false;
   boolean autoCommit = true;
   EamDhCheckBatchDTO dto = (EamDhCheckBatchDTO) dtoParameter;
   try {
     EamDhCheckBatchModel modelProducer = (EamDhCheckBatchModel) sqlProducer;
     SQLModel sqlModel = modelProducer.getMulBatchCancelModel(batchIds);
     DBOperator.updateRecord(sqlModel, conn);
     EamDhCheckHeaderDAO headerDAO = new EamDhCheckHeaderDAO(userAccount, null, conn);
     headerDAO.cancelOrders(batchIds);
     setDTOParameter(dto);
     operateResult = true;
   } catch (DataHandleException ex) {
     ex.printLog();
   } finally {
     try {
       if (operateResult) {
         conn.commit();
         if (singleCancel) { // 详细信息页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_CANCEL_SUCCESS);
         } else { // 列表页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_MULCEL_SUCCESS);
         }
       } else {
         conn.rollback();
         if (singleCancel) { // 详细信息页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_CANCEL_FAILURE);
         } else { // 列表页面点击的撤销
           prodMessage(LvecMessageKeys.BATCH_MULCEL_FAILURE);
         }
         message.setIsError(true);
       }
       conn.setAutoCommit(autoCommit);
     } catch (SQLException ex) {
       Logger.logError(ex);
     }
   }
 }
コード例 #5
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(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);
     // 根据实际情况修改页面跳转代码。
   }
 }
コード例 #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(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);
      }
    }
  }
コード例 #7
0
ファイル: AmsYjItemServlet.java プロジェクト: starMagic/CQEAM
 /**
  * @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);
     // 根据实际情况修改页面跳转代码。
   }
 }
コード例 #8
0
ファイル: OrderApproveDAO.java プロジェクト: starMagic/CQEAM
  /**
   * 功能:审批单据,含调拨单,报废单,处置单,共享单
   *
   * @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;
  }
コード例 #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;
 }
コード例 #10
0
ファイル: SfUserLogFilter.java プロジェクト: starMagic/CQEAM
 /**
  * @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);
   }
 }
コード例 #11
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);
     }
   }
 }
コード例 #12
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);
     // 根据实际情况修改页面跳转代码。
   }
 }
コード例 #13
0
ファイル: SinoMsgService.java プロジェクト: starMagic/CQEAM
  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);
      }
    }
  }