Example #1
0
 public List<Vacation> findVacationsByTypesAndStatuses(
     Integer year,
     Integer month,
     Integer employeeId,
     List<DictionaryItem> types,
     List<DictionaryItem> statuses) {
   return vacationDAO.findVacationsByTypesAndStatuses(year, month, employeeId, types, statuses);
 }
Example #2
0
 @Transactional
 public List<Integer> getAllNotApprovedVacationsIds() {
   return vacationDAO.getAllNotApprovedVacationsIds();
 }
Example #3
0
 @Transactional
 public Boolean isDayVacation(Employee employee, Date date) {
   return vacationDAO.isDayVacation(employee, date);
 }
Example #4
0
 @Transactional
 public void store(Vacation vacation) {
   vacationDAO.store(vacation);
 }
Example #5
0
 public Vacation getVacationWithoutPlanned(Employee employee, Date date) {
   return vacationDAO.getVacationWithoutPlanned(employee, date);
 }
Example #6
0
 public List<Vacation> findVacationsByType(
     Integer year, Integer month, Integer employeeId, DictionaryItem type) {
   return vacationDAO.findVacationsByType(year, month, employeeId, type);
 }
Example #7
0
 public List<Vacation> findVacations(
     Integer employeeId, Date beginDate, Date endDate, DictionaryItem typeId) {
   return vacationDAO.findVacations(employeeId, beginDate, endDate, typeId);
 }
Example #8
0
 public Integer getPlannedVacationsCountByPeriod(Employee employee, Date beginDate) {
   return vacationDAO.getVacationsCountByPeriod(employee, beginDate, false);
 }
Example #9
0
 public List<Vacation> findVacationsNeedsApproval(Integer employeeId) {
   return vacationDAO.findVacationsNeedApproval(employeeId);
 }
Example #10
0
 public Double getVacationsWorkdaysCount(Employee employee, Integer year, Integer month) {
   return (double) vacationDAO.getVacationsWorkdaysCount(employee, year, month);
 }
Example #11
0
 public int getApprovedVacationsWorkdaysCount(
     Employee employee, Integer year, Integer month, boolean toCurrentDate) {
   return vacationDAO.getApprovedVacationsWorkdaysCount(
       employee, year, month, null, toCurrentDate);
 }
Example #12
0
 /**
  * Удаляет планируемые отпуска уволенного сотрудника
  *
  * @param employee
  */
 public void deleteFiredVacations(Employee employee) {
   vacationDAO.deleteFiredVacations(employee);
 }
Example #13
0
 @Transactional
 public void detach(Vacation vacation) {
   vacationDAO.detach(vacation);
 }
Example #14
0
 @Transactional
 public void delete(Vacation vacation) {
   vacationDAO.delete(vacation);
 }
Example #15
0
 @Transactional
 public Vacation tryFindVacation(Integer vacationId) {
   return vacationDAO.tryFindVacation(vacationId);
 }
Example #16
0
 public long getIntersectVacationsCount(
     Integer employeeId, Timestamp fromDate, Timestamp toDate, DictionaryItem item) {
   return vacationDAO.getIntersectVacationsCount(employeeId, fromDate, toDate, item);
 }
Example #17
0
 public Long getIntersectPlannedVacationsCount(
     Integer employeeId, Date fromDate, Date toDate, DictionaryItem item) {
   return vacationDAO.getIntersectPlannedVacationsCount(employeeId, fromDate, toDate, item);
 }
Example #18
0
 public Integer findVacationsNeedsApprovalCount(Integer employeeId) {
   return vacationDAO.findVacationsNeedApproval(employeeId).size();
 }
Example #19
0
 public Integer getFactVacationsCountByPeriod(Employee employee, Date beginDate) {
   return vacationDAO.getVacationsCountByPeriod(employee, beginDate, true);
 }
Example #20
0
  public void createAndMailVacation(
      CreateVacationForm createVacationForm,
      Employee employee,
      Employee curEmployee,
      boolean isApprovedVacation)
      throws VacationApprovalServiceException {

    final Vacation vacation = new Vacation();

    vacation.setCreationDate(new Date());
    vacation.setBeginDate(DateTimeUtil.stringToTimestamp(createVacationForm.getCalFromDate()));
    vacation.setEndDate(DateTimeUtil.stringToTimestamp(createVacationForm.getCalToDate()));
    vacation.setComment(createVacationForm.getComment().trim());
    vacation.setType(dictionaryItemService.find(createVacationForm.getVacationType()));
    vacation.setAuthor(curEmployee);
    vacation.setEmployee(employee);
    vacation.setRemind(false);

    vacation.setStatus(
        dictionaryItemService.find(
            isApprovedVacation
                ? VacationStatusEnum.APPROVED.getId()
                : VacationStatusEnum.APPROVEMENT_WITH_PM.getId()));

    TransactionStatus transactionStatus = null;

    try {
      transactionStatus = getNewTransaction();

      store(vacation);

      boolean isPlannedVacation =
          vacation.getType().getId().equals(VacationTypesEnum.PLANNED.getId());

      if (isPlannedVacation) {
        vacationApprovalProcessService.sendNoticeForPlannedVacaton(vacation);
      } else {
        List<Vacation> plannedVacations =
            vacationDAO.getPlannedVacationsByBeginAndEndDates(
                employee, vacation.getBeginDate(), vacation.getEndDate());
        for (Vacation plannedVacation : plannedVacations) {
          delete(plannedVacation);
        }
        if (needsToBeApproved(vacation)) {
          vacationApprovalProcessService.sendVacationApproveRequestMessages(
              vacation); // рассылаем письма о согласовании отпуска
        } else {
          vacationApprovalProcessService.sendBackDateVacationApproved(vacation);
        }
      }
      commit(transactionStatus);
    } catch (VacationApprovalServiceException e) {
      if (transactionStatus != null) {
        rollback(transactionStatus);
        logger.error("Transaction rollbacked. Error saving vacation: {} ", e);
      } else {
        logger.error("TransactionStatus is null.");
      }
    }
    sendMailService.performVacationCreateMailing(vacation);
  }
Example #21
0
 public List<Vacation> findVacations(
     List<Employee> employees, Date beginDate, Date endDate, DictionaryItem typeId) {
   return vacationDAO.findVacations(employees, beginDate, endDate, typeId);
 }
Example #22
0
 @Transactional
 public Boolean isDayVacationWithoutPlanned(Employee employee, Date date) {
   return vacationDAO.getVacationWithoutPlanned(employee, date) != null ? true : false;
 }