Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 @Transactional
 public List<Integer> getAllNotApprovedVacationsIds() {
   return vacationDAO.getAllNotApprovedVacationsIds();
 }
Ejemplo n.º 3
0
 @Transactional
 public Boolean isDayVacation(Employee employee, Date date) {
   return vacationDAO.isDayVacation(employee, date);
 }
Ejemplo n.º 4
0
 @Transactional
 public void store(Vacation vacation) {
   vacationDAO.store(vacation);
 }
Ejemplo n.º 5
0
 public Vacation getVacationWithoutPlanned(Employee employee, Date date) {
   return vacationDAO.getVacationWithoutPlanned(employee, date);
 }
Ejemplo n.º 6
0
 public List<Vacation> findVacationsByType(
     Integer year, Integer month, Integer employeeId, DictionaryItem type) {
   return vacationDAO.findVacationsByType(year, month, employeeId, type);
 }
Ejemplo n.º 7
0
 public List<Vacation> findVacations(
     Integer employeeId, Date beginDate, Date endDate, DictionaryItem typeId) {
   return vacationDAO.findVacations(employeeId, beginDate, endDate, typeId);
 }
Ejemplo n.º 8
0
 public Integer getPlannedVacationsCountByPeriod(Employee employee, Date beginDate) {
   return vacationDAO.getVacationsCountByPeriod(employee, beginDate, false);
 }
Ejemplo n.º 9
0
 public List<Vacation> findVacationsNeedsApproval(Integer employeeId) {
   return vacationDAO.findVacationsNeedApproval(employeeId);
 }
Ejemplo n.º 10
0
 public Double getVacationsWorkdaysCount(Employee employee, Integer year, Integer month) {
   return (double) vacationDAO.getVacationsWorkdaysCount(employee, year, month);
 }
Ejemplo n.º 11
0
 public int getApprovedVacationsWorkdaysCount(
     Employee employee, Integer year, Integer month, boolean toCurrentDate) {
   return vacationDAO.getApprovedVacationsWorkdaysCount(
       employee, year, month, null, toCurrentDate);
 }
Ejemplo n.º 12
0
 /**
  * Удаляет планируемые отпуска уволенного сотрудника
  *
  * @param employee
  */
 public void deleteFiredVacations(Employee employee) {
   vacationDAO.deleteFiredVacations(employee);
 }
Ejemplo n.º 13
0
 @Transactional
 public void detach(Vacation vacation) {
   vacationDAO.detach(vacation);
 }
Ejemplo n.º 14
0
 @Transactional
 public void delete(Vacation vacation) {
   vacationDAO.delete(vacation);
 }
Ejemplo n.º 15
0
 @Transactional
 public Vacation tryFindVacation(Integer vacationId) {
   return vacationDAO.tryFindVacation(vacationId);
 }
Ejemplo n.º 16
0
 public long getIntersectVacationsCount(
     Integer employeeId, Timestamp fromDate, Timestamp toDate, DictionaryItem item) {
   return vacationDAO.getIntersectVacationsCount(employeeId, fromDate, toDate, item);
 }
Ejemplo n.º 17
0
 public Long getIntersectPlannedVacationsCount(
     Integer employeeId, Date fromDate, Date toDate, DictionaryItem item) {
   return vacationDAO.getIntersectPlannedVacationsCount(employeeId, fromDate, toDate, item);
 }
Ejemplo n.º 18
0
 public Integer findVacationsNeedsApprovalCount(Integer employeeId) {
   return vacationDAO.findVacationsNeedApproval(employeeId).size();
 }
Ejemplo n.º 19
0
 public Integer getFactVacationsCountByPeriod(Employee employee, Date beginDate) {
   return vacationDAO.getVacationsCountByPeriod(employee, beginDate, true);
 }
Ejemplo n.º 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);
  }
Ejemplo n.º 21
0
 public List<Vacation> findVacations(
     List<Employee> employees, Date beginDate, Date endDate, DictionaryItem typeId) {
   return vacationDAO.findVacations(employees, beginDate, endDate, typeId);
 }
Ejemplo n.º 22
0
 @Transactional
 public Boolean isDayVacationWithoutPlanned(Employee employee, Date date) {
   return vacationDAO.getVacationWithoutPlanned(employee, date) != null ? true : false;
 }