Пример #1
0
  public String pumpingStationAddSubmit() {
    Authority auth =
        checkAuthority(buildResource(Modules.s_pumpingStation_model, Operation.s_operation_add));
    if (auth != null) {
      return auth.getName();
    }
    try {
      if (m_uploadFile.getFile() != null) {
        int documentId =
            m_documentService.insertDocument(Modules.s_pumpingStation_model, m_uploadFile);
        m_pumpingStation.setDocumentId(documentId);
      }
      m_schedule.setType(getActionModule());
      int scheduleId = m_scheduleService.insertSchedule(m_schedule);
      m_pumpingStation.setScheduleId(scheduleId);

      int id = m_pumpingStationService.insertPumpingStation(m_pumpingStation);
      if (id > 0) {
        Log log =
            createLog(Modules.s_pumpingStation_model, Operation.s_operation_add, m_pumpingStation);

        m_logService.insertLog(log);
        return SUCCESS;
      } else {
        return ERROR;
      }
    } catch (Exception e) {
      m_logger.error(e.getMessage(), e);
      return ERROR;
    }
  }
Пример #2
0
  public String pumpingStationUpdateSubmit() {
    Authority auth =
        checkAuthority(buildResource(Modules.s_pumpingStation_model, Operation.s_operation_update));
    if (auth != null) {
      return auth.getName();
    }
    try {
      if (m_uploadFile.getFile() != null) {
        int documentId = m_pumpingStation.getDocumentId();
        if (documentId > 0) {
          Document document = m_documentService.findByPK(documentId);
          m_documentService.updateDocument(Modules.s_pumpingStation_model, m_uploadFile, document);
        } else {
          documentId =
              m_documentService.insertDocument(Modules.s_pumpingStation_model, m_uploadFile);
          m_pumpingStation.setDocumentId(documentId);
        }
      }
      m_scheduleService.updateSchedule(m_schedule);
      int count = m_pumpingStationService.updatePumpingStation(m_pumpingStation);
      if (count > 0) {
        Log log =
            createLog(
                Modules.s_pumpingStation_model, Operation.s_operation_update, m_pumpingStation);

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