Example #1
0
  public String flueSheetUpdateSubmit() {
    Authority auth =
        checkAuthority(buildResource(Modules.s_flueSheet_model, Operation.s_operation_update));
    if (auth != null) {
      return auth.getName();
    }

    try {
      if (m_uploadFile.getFile() != null) {
        int documentId = m_flueSheet.getDocumentId();
        if (documentId > 0) {
          Document document = m_documentService.findByPK(documentId);
          m_documentService.updateDocument(Modules.s_flueSheet_model, m_uploadFile, document);
        } else {
          documentId = m_documentService.insertDocument(Modules.s_flueSheet_model, m_uploadFile);
          m_flueSheet.setDocumentId(documentId);
        }
      }
      m_scheduleService.updateSchedule(m_schedule);
      int count = m_flueSheetService.updateFlueSheet(m_flueSheet);
      if (count > 0) {
        Log log = createLog(Modules.s_flueSheet_model, Operation.s_operation_update, m_flueSheet);

        m_logService.insertLog(log);
        return SUCCESS;
      } else {
        return ERROR;
      }
    } catch (Exception e) {
      m_logger.error(e.getMessage(), e);
      return ERROR;
    }
  }
Example #2
0
  public String flueSheetList() {
    Authority auth =
        checkAuthority(buildResource(Modules.s_flueSheet_model, Operation.s_operation_delete));
    if (auth != null) {
      return auth.getName();
    }
    try {
      if (m_tunnelId == 0) {
        m_tunnelId = m_tunnelService.queryDefaultTunnelId();
      }
      m_tunnels = m_tunnelService.queryAllTunnels();
      m_tunnelSections =
          m_tunnelSectionService.queryLimitedTunnelSectionsByTunnelId(
              m_tunnelId, 0, Integer.MAX_VALUE);

      m_totalSize = m_flueSheetService.querySizeByTunnelAndSection(m_tunnelId, m_tunnelSectionId);
      m_totalPages = computeTotalPages(m_totalSize);
      int start = (m_index - 1) * SIZE;
      if (start < 0) {
        start = 0;
      }
      m_flueSheets =
          m_flueSheetService.queryLimitedFlueSheets(m_tunnelId, m_tunnelSectionId, start, SIZE);
      for (FlueSheet flueSheet : m_flueSheets) {
        flueSheet.setTunnel(m_tunnelService.findByPK(flueSheet.getTunnelId()));
        int scheduleId = flueSheet.getScheduleId();
        if (scheduleId > 0) {
          Schedule schedule = m_scheduleService.findByPK(scheduleId);
          if (schedule != null) {
            flueSheet.setSchedule(schedule);
            schedule.setConstructionUnit(
                m_constructionUnitService.findByPK(schedule.getConstructionUnitId()));
          }
        }
        if (flueSheet.getDocumentId() > 0) {
          flueSheet.setDocument(m_documentService.findByPK(flueSheet.getDocumentId()));
        }
      }
      return SUCCESS;
    } catch (Exception e) {
      m_logger.error(e.getMessage(), e);
      return ERROR;
    }
  }
Example #3
0
  public String flueSheetUpdate() {
    try {
      m_flueSheet = m_flueSheetService.findByPK(m_flueSheetId);
      m_tunnels = m_tunnelService.queryAllTunnels();
      m_tunnelSections =
          m_tunnelSectionService.queryLimitedTunnelSectionsByTunnelId(
              m_flueSheet.getTunnelId(), 0, Integer.MAX_VALUE);
      m_schedule = m_scheduleService.findByPK(m_flueSheet.getScheduleId());
      m_constructionUnits = m_constructionUnitService.queryAllConstructionUnits();
      int documentId = m_flueSheet.getDocumentId();

      if (documentId > 0) {
        m_flueSheet.setDocument(m_documentService.findByPK(m_flueSheet.getDocumentId()));
      }
      if (m_flueSheet != null) {
        return SUCCESS;
      } else {
        return ERROR;
      }
    } catch (Exception e) {
      m_logger.error(e.getMessage(), e);
      return ERROR;
    }
  }
Example #4
0
  public String flueSheetDelete() {
    Authority auth =
        checkAuthority(buildResource(Modules.s_flueSheet_model, Operation.s_operation_delete));
    if (auth != null) {
      return auth.getName();
    }
    try {
      m_flueSheet = m_flueSheetService.findByPK(m_flueSheetId);
      m_documentService.deleteDocument(m_flueSheet.getDocumentId());
      m_scheduleService.deleteSchedule(m_flueSheet.getScheduleId());
      int count = m_flueSheetService.deleteFlueSheet(m_flueSheetId);
      if (count > 0) {
        Log log = createLog(Modules.s_flueSheet_model, Operation.s_operation_delete, m_flueSheetId);

        m_logService.insertLog(log);
        return SUCCESS;
      } else {
        return ERROR;
      }
    } catch (Exception e) {
      m_logger.error(e.getMessage(), e);
      return ERROR;
    }
  }