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

    try {
      if (m_uploadFile.getFile() != null) {
        int documentId = m_documentService.insertDocument(Modules.s_flueSheet_model, m_uploadFile);
        m_flueSheet.setDocumentId(documentId);
      }
      m_schedule.setType(getActionModule());
      int scheduleId = m_scheduleService.insertSchedule(m_schedule);
      m_flueSheet.setScheduleId(scheduleId);

      int id = m_flueSheetService.insertFlueSheet(m_flueSheet);
      if (id > 0) {
        Log log = createLog(Modules.s_flueSheet_model, Operation.s_operation_add, 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 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;
    }
  }