Example #1
0
  /**
   * 功能:修改数据。
   *
   * @return boolean
   */
  public boolean deleteNullData() throws DataHandleException {
    boolean operateResult = false;
    boolean autoCommit = false;
    boolean hasError = true;
    try {
      autoCommit = conn.getAutoCommit();
      conn.setAutoCommit(false);
      AmsHouseInfoDTO HLDTO = (AmsHouseInfoDTO) dtoParameter;
      AmsHouseInfoModel model = new AmsHouseInfoModel(userAccount, HLDTO);
      SQLModel sqlModel1 = model.deleteUsesInfo();
      DBOperator.updateRecord(sqlModel1, conn);

      String barcode = HLDTO.getBarcode();

      //            super.updateData();            //对表AMS_house_INFO进行修改操作

      GetMisHousInfoModel updateEII = new GetMisHousInfoModel(userAccount, HLDTO);
      SQLModel nullSqlModel = updateEII.updateNull(HLDTO.getBarcode());
      DBOperator.updateRecord(nullSqlModel, conn);

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

      // --------------对表 AMS_ITEM_FILES  进行修改操作   先删除再增加
      AmsItemFilesModel sqlModel = new AmsItemFilesModel(userAccount, null);
      DBOperator.updateRecord(sqlModel.getDeleteModel(barcode), conn);
      operateResult = true;
      conn.commit();
      hasError = false;
      prodMessage(MsgKeyConstant.UPDATE_DATA_SUCCESS);
      getMessage().addParameterValue("未处置信息");
    } catch (SQLException ex) {
      Logger.logError(ex);
      prodMessage(MsgKeyConstant.SQL_ERROR);
    } finally {
      try {
        if (hasError) {
          conn.rollback(); // 回滚
        }
        conn.setAutoCommit(autoCommit); // 恢复以前状态
      } catch (SQLException ex) {
        Logger.logError(ex);
        prodMessage(MsgKeyConstant.ROLL_BACK_ERROR);
      }
    }
    return operateResult;
  }
Example #2
0
  /**
   * 功能:修改数据。
   *
   * @return boolean
   */
  public boolean updateData(
      EtsItemInfoDTO itemInfoDTO, AmsItemFilesDTO fileDTO, String[] filePaths, DTOSet lineSet)
      throws DataHandleException {
    boolean operateResult = false;
    boolean autoCommit = false;
    boolean hasError = true;
    try {
      autoCommit = conn.getAutoCommit();
      conn.setAutoCommit(false);
      AmsHouseInfoDTO HLDTO = (AmsHouseInfoDTO) dtoParameter;
      AmsHouseInfoModel model = new AmsHouseInfoModel(userAccount, HLDTO);
      SQLModel sqlModel1 = model.deleteUsesInfo();
      DBOperator.updateRecord(sqlModel1, conn);

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

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

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

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

      //            if (landDTO.getIsRent().equals("Y")) {        //表 AMS_RENT_INFO (RENT_ID ) 修改
      // 先删除 再增加
      //                deleteRentData();
      //                creatRentData();
      //            } else {
      //                deleteRentData();          //对表  AMS_RENT_INFO 进行删除操作
      //            }
      saveUses(lineSet);
      // --------------对表 AMS_ITEM_FILES  进行修改操作   先删除再增加
      AmsItemFilesModel sqlModel = new AmsItemFilesModel(userAccount, fileDTO);
      DBOperator.updateRecord(sqlModel.getDeleteModel(barcode), conn);
      if (!StrUtil.isEmpty(filePaths)) {
        SeqProducer seq = new SeqProducer(conn);
        for (int i = 0; i < filePaths.length; i++) {
          fileDTO.setBarcode(barcode);
          String filedp[] = StrUtil.splitStr(filePaths[i], "$");
          fileDTO.setFileDesc(filedp[0]);
          fileDTO.setFilePath(filedp[1]);
          fileDTO.setSystemId(seq.getGUID());
          DBOperator.updateRecord(sqlModel.getCreateModel(), conn);
        }
      }
      operateResult = true;
      conn.commit();
      hasError = false;
      prodMessage(MsgKeyConstant.UPDATE_DATA_SUCCESS);
      getMessage().addParameterValue("未处置信息");
    } catch (SQLException ex) {
      Logger.logError(ex);
      prodMessage(MsgKeyConstant.SQL_ERROR);
      //        } catch (SQLModelException ex) {
      //            Logger.logError(ex);
      //            prodMessage(MsgKeyConstant.SQL_ERROR);
    } catch (QueryException e) {
      Logger.logError(e);
      //            prodMessage(MsgKeyConstant.SQL_ERROR);
    } finally {
      try {
        if (hasError) {
          conn.rollback(); // 回滚
        }
        conn.setAutoCommit(autoCommit); // 恢复以前状态
      } catch (SQLException ex) {
        Logger.logError(ex);
        prodMessage(MsgKeyConstant.ROLL_BACK_ERROR);
      }
    }
    return operateResult;
  }