|
|
|
|
@ -1,16 +1,18 @@
|
|
|
|
|
package com.biutag.outeradmin.controller; |
|
|
|
|
|
|
|
|
|
import com.biutag.core.AjaxResult; |
|
|
|
|
import com.biutag.outeradmin.model.vo.HolidayVo; |
|
|
|
|
import com.biutag.outeradmin.entity.Holiday; |
|
|
|
|
import com.biutag.outeradmin.dto.HolidayDTO; |
|
|
|
|
import com.biutag.outeradmin.mapper.HolidayMapper; |
|
|
|
|
import com.biutag.outeradmin.service.HolidayService; |
|
|
|
|
import com.biutag.util.StringUtils; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@RestController |
|
|
|
|
@ -18,42 +20,59 @@ import java.util.Map;
|
|
|
|
|
@RequestMapping("/outer/holiday") |
|
|
|
|
public class HolidayController { |
|
|
|
|
private final HolidayService holidayService; |
|
|
|
|
private final HolidayMapper holidayMapper; |
|
|
|
|
|
|
|
|
|
@RequestMapping("/getholiday") |
|
|
|
|
@ApiOperation("查询节假日") |
|
|
|
|
public AjaxResult getlist(@RequestParam("search") String search) throws Exception { |
|
|
|
|
// @RequestMapping("/getholiday")
|
|
|
|
|
// @ApiOperation("查询节假日")
|
|
|
|
|
// public AjaxResult getlist(@RequestParam("search") String search) throws Exception {
|
|
|
|
|
//
|
|
|
|
|
// //判断年份
|
|
|
|
|
// LocalDateTime currentDate = LocalDateTime.now();
|
|
|
|
|
// int currentyear = currentDate.getYear();
|
|
|
|
|
// if (Integer.parseInt(search) != currentyear) {
|
|
|
|
|
// return AjaxResult.success();
|
|
|
|
|
// }
|
|
|
|
|
// Map<String, List<HolidayVo>> map = holidayService.showholiday();
|
|
|
|
|
// return AjaxResult.success(map);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// @PostMapping("/saveholiday")
|
|
|
|
|
// @ApiOperation("节假日")
|
|
|
|
|
// public AjaxResult setlist(@RequestBody String search) throws Exception {
|
|
|
|
|
// LocalDateTime currentDate = LocalDateTime.now();
|
|
|
|
|
// int currentyear = currentDate.getYear();
|
|
|
|
|
// if (Integer.parseInt(search) != currentyear) {
|
|
|
|
|
// return AjaxResult.success();
|
|
|
|
|
// }
|
|
|
|
|
// holidayService.saveholiday(search);
|
|
|
|
|
// return AjaxResult.success();
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//判断年份
|
|
|
|
|
LocalDateTime currentDate = LocalDateTime.now(); |
|
|
|
|
int currentyear = currentDate.getYear(); |
|
|
|
|
if (Integer.parseInt(search) != currentyear) { |
|
|
|
|
return AjaxResult.success(); |
|
|
|
|
} |
|
|
|
|
Map<String, List<HolidayVo>> map = holidayService.showholiday(); |
|
|
|
|
return AjaxResult.success(map); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/saveholiday") |
|
|
|
|
@ApiOperation("节假日") |
|
|
|
|
public AjaxResult setlist(@RequestBody String search) throws Exception { |
|
|
|
|
LocalDateTime currentDate = LocalDateTime.now(); |
|
|
|
|
int currentyear = currentDate.getYear(); |
|
|
|
|
if (Integer.parseInt(search) != currentyear) { |
|
|
|
|
return AjaxResult.success(); |
|
|
|
|
} |
|
|
|
|
holidayService.saveholiday(search); |
|
|
|
|
return AjaxResult.success(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/showholiday") |
|
|
|
|
@RequestMapping("/show-holiday") |
|
|
|
|
@ApiOperation("进入页面显示节假日") |
|
|
|
|
public AjaxResult getlist() throws Exception { |
|
|
|
|
Map<String, List<HolidayVo>> map = holidayService.showholiday(); |
|
|
|
|
return AjaxResult.success(map); |
|
|
|
|
public List<HolidayDTO> getlist() throws Exception { |
|
|
|
|
List<Holiday> holidayList = holidayService.list(); |
|
|
|
|
List<HolidayDTO> result = new ArrayList<>(); |
|
|
|
|
for (Holiday holiday : holidayList) { |
|
|
|
|
if (holiday.getHolidayFlag().equals("Y")) { |
|
|
|
|
HolidayDTO holidayDTO = new HolidayDTO(); |
|
|
|
|
holidayDTO.setHolidayFlag(holiday.getHolidayFlag()); |
|
|
|
|
holidayDTO.setDetail(holiday.getDetail()); |
|
|
|
|
holidayDTO.setDate(holiday.getDate()); |
|
|
|
|
result.add(holidayDTO); |
|
|
|
|
} else if (holiday.getHolidayFlag().equals("N") && StringUtils.isNotEmpty(holiday.getDetail())) { |
|
|
|
|
HolidayDTO holidayDTO = new HolidayDTO(); |
|
|
|
|
holidayDTO.setHolidayFlag(holiday.getHolidayFlag()); |
|
|
|
|
holidayDTO.setDetail(holiday.getDetail()); |
|
|
|
|
holidayDTO.setDate(holiday.getDate()); |
|
|
|
|
result.add(holidayDTO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|