Search in sources :

Example 1 with WorkDay

use of com.gwc.workday.entity.WorkDay in project workday by peer44.

the class WorkDayService method findAllHolidays.

public List<WorkDay> findAllHolidays() {
    Sort sort = new Sort(Sort.Direction.ASC, "date");
    List<WorkDay> workDays = workDayDao.findAll(sort);
    return workDays;
}
Also used : Sort(org.springframework.data.domain.Sort) WorkDay(com.gwc.workday.entity.WorkDay)

Example 2 with WorkDay

use of com.gwc.workday.entity.WorkDay in project workday by peer44.

the class HolidayController method init.

@ApiOperation(value = "加载节假日")
@GetMapping(value = "holiday/init")
@ResponseBody
public List<EventVO> init() {
    List<WorkDay> workDays = workDayService.findAllHolidays();
    List<EventVO> events = new ArrayList<>();
    if (!CollectionUtils.isEmpty(workDays)) {
        workDays.forEach(workDay -> {
            EventVO event = new EventVO(workDay.getDate());
            events.add(event);
        });
    }
    return events;
}
Also used : ArrayList(java.util.ArrayList) WorkDay(com.gwc.workday.entity.WorkDay) EventVO(com.gwc.workday.vo.EventVO) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiOperation(io.swagger.annotations.ApiOperation) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with WorkDay

use of com.gwc.workday.entity.WorkDay in project workday by peer44.

the class WorkDayService method save.

public WorkDay save(String date) {
    List<WorkDay> workDayList = workDayDao.findByDate(date);
    WorkDay workDay = new WorkDay();
    workDay.setDate(date);
    workDay.setIsWorkDay(false);
    if (!CollectionUtils.isEmpty(workDayList)) {
        workDay.setId(workDayList.get(0).getId());
    }
    return workDayDao.save(workDay);
}
Also used : WorkDay(com.gwc.workday.entity.WorkDay)

Example 4 with WorkDay

use of com.gwc.workday.entity.WorkDay in project workday by peer44.

the class WorkDayService method findByYear.

public List<WorkDay> findByYear(String year) {
    Sort sort = new Sort(Sort.Direction.ASC, "date");
    List<WorkDay> workDays = workDayDao.findByDateGreaterThanEqual(year + "-01-01", sort);
    return workDays;
}
Also used : Sort(org.springframework.data.domain.Sort) WorkDay(com.gwc.workday.entity.WorkDay)

Example 5 with WorkDay

use of com.gwc.workday.entity.WorkDay in project workday by peer44.

the class WorkDayService method delete.

public void delete(String date) {
    List<WorkDay> workDayList = workDayDao.findByDate(date);
    WorkDay workDay = new WorkDay();
    workDay.setDate(date);
    workDay.setIsWorkDay(false);
    if (!CollectionUtils.isEmpty(workDayList)) {
        workDay.setId(workDayList.get(0).getId());
    }
    workDayDao.delete(workDay);
}
Also used : WorkDay(com.gwc.workday.entity.WorkDay)

Aggregations

WorkDay (com.gwc.workday.entity.WorkDay)5 Sort (org.springframework.data.domain.Sort)2 EventVO (com.gwc.workday.vo.EventVO)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ArrayList (java.util.ArrayList)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1