From 76e33153821c2c983e1587ce0848aa0aea21a67b Mon Sep 17 00:00:00 2001 From: laishajiang <12977614+laishajiang@user.noreply.gitee.com> Date: Mon, 4 Mar 2024 20:09:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=82=E5=81=87=E6=97=A5=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/HolidayController.java | 75 +++++++++---------- .../biutag/lan/service/HolidayService.java | 12 +++ .../com/biutag/lan/vo/system/HolidayVo.java | 10 +++ 3 files changed, 56 insertions(+), 41 deletions(-) create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/service/HolidayService.java create mode 100644 mailbox-lan/src/main/java/com/biutag/lan/vo/system/HolidayVo.java diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/HolidayController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/HolidayController.java index b995890..ce9d6cf 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/HolidayController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/HolidayController.java @@ -1,6 +1,9 @@ package com.biutag.lan.controller.system; +import com.alibaba.fastjson2.JSON; +import com.biutag.entity.system.Holiday; import com.biutag.lan.aop.Log; +import com.biutag.lan.service.HolidayService; import com.biutag.lan.service.IHolidayService; import com.biutag.lan.validate.commons.IdValidate; import com.biutag.lan.validate.system.HolidayCreateValidate; @@ -11,58 +14,48 @@ import com.biutag.lan.vo.system.HolidayListedVo; import com.biutag.lan.vo.system.HolidayDetailVo; import com.biutag.core.AjaxResult; import com.biutag.core.PageResult; +import com.biutag.lan.vo.system.HolidayVo; +import com.biutag.mapper.system.HolidayMapper; +import com.biutag.util.StringUtils; import com.biutag.validator.annotation.IDMust; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import jakarta.annotation.Resource; +import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +@RequiredArgsConstructor @RestController @RequestMapping("api/holiday") @Api(tags = "节假日管理") public class HolidayController { - - @Resource - IHolidayService iHolidayService; - - @GetMapping("/list") - @ApiOperation(value="节假日列表") - public AjaxResult> list(@Validated PageValidate pageValidate, - @Validated HolidaySearchValidate searchValidate) { - PageResult list = iHolidayService.list(pageValidate, searchValidate); - return AjaxResult.success(list); - } - - @GetMapping("/detail") - @ApiOperation(value="节假日详情") - public AjaxResult detail(@Validated @IDMust() @RequestParam("id") Integer id) { - HolidayDetailVo detail = iHolidayService.detail(id); - return AjaxResult.success(detail); - } - - @Log(title = "节假日新增") - @PostMapping("/add") - @ApiOperation(value="节假日新增") - public AjaxResult add(@Validated @RequestBody HolidayCreateValidate createValidate) { - iHolidayService.add(createValidate); - return AjaxResult.success(); - } - - @Log(title = "节假日编辑") - @PostMapping("/edit") - @ApiOperation(value="节假日编辑") - public AjaxResult edit(@Validated @RequestBody HolidayUpdateValidate updateValidate) { - iHolidayService.edit(updateValidate); - return AjaxResult.success(); - } - - @Log(title = "节假日删除") - @PostMapping("/del") - @ApiOperation(value="节假日删除") - public AjaxResult del(@Validated @RequestBody IdValidate idValidate) { - iHolidayService.del(idValidate.getId()); - return AjaxResult.success(); + private final HolidayService holidayService; + private final HolidayMapper holidayMapper; + @RequestMapping("/show-holiday") + @ApiOperation("进入页面显示节假日") + public List getlist() { + List holidayList = holidayService.list(); + List result = new ArrayList<>(); + for (Holiday holiday : holidayList) { + if (holiday.getHolidayFlag().equals("Y")) { + HolidayVo HolidayVo = new HolidayVo(); + HolidayVo.setHolidayFlag(holiday.getHolidayFlag()); + HolidayVo.setDetail(holiday.getDetail()); + HolidayVo.setDate(holiday.getDate()); + result.add(HolidayVo); + } else if (holiday.getHolidayFlag().equals("N") && StringUtils.isNotEmpty(holiday.getDetail())) { + HolidayVo HolidayVo = new HolidayVo(); + HolidayVo.setHolidayFlag(holiday.getHolidayFlag()); + HolidayVo.setDetail(holiday.getDetail()); + HolidayVo.setDate(holiday.getDate()); + result.add(HolidayVo); + } + } + return result; } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/HolidayService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/HolidayService.java new file mode 100644 index 0000000..8f2a147 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/HolidayService.java @@ -0,0 +1,12 @@ +package com.biutag.lan.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import com.biutag.entity.system.Holiday; + +import com.biutag.mapper.system.HolidayMapper; +import org.springframework.stereotype.Service; + +@Service +public class HolidayService extends ServiceImpl { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/vo/system/HolidayVo.java b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/HolidayVo.java new file mode 100644 index 0000000..2b486c3 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/vo/system/HolidayVo.java @@ -0,0 +1,10 @@ +package com.biutag.lan.vo.system; + +import lombok.Data; + +@Data +public class HolidayVo { + private String date; + private String holidayFlag; + private String detail; +}