From 9bc028e89ffea64f2d210125ab13c84dd9e9d1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A3=B4=E6=B5=A9=E5=AE=87?= <617594538@qq.com> Date: Thu, 11 Apr 2024 16:20:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/blog/admin/PxAdminController.java | 16 ++++++++++++++++ .../mapper/PxCommemorationDayMapper.xml | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java index 58cba8e..ce25295 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java @@ -12,7 +12,9 @@ import com.pnkx.domain.vo.PxCardRecordVo; import com.pnkx.service.*; import com.pnkx.system.domain.SysNotice; import com.pnkx.system.domain.SysNoticeRead; +import com.pnkx.system.service.ISysConfigService; import com.pnkx.system.service.ISysNoticeService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -51,6 +53,10 @@ public class PxAdminController extends BaseController { private ISysNoticeService noticeService; @Resource private IPxCommemorationDayService pxCommemorationDayService; + @Resource + private IPxMenstruationRecordService pxMenstruationRecordService; + @Resource + private ISysConfigService configService; /** * 全文检索 */ @@ -146,6 +152,16 @@ public class PxAdminController extends BaseController { // 纪念日 List commemorationDayList = pxCommemorationDayService.getCommemorationDayList(null); result.put("commemoration", commemorationDayList); + + // 姨妈助手 + List pxMenstruationRecords = pxMenstruationRecordService.selectMenstruationRecordList(null); + result.put("menstruation", pxMenstruationRecords); + // 姨妈助手设置 + JSONObject menstruationAssistantSetting = new JSONObject(); + menstruationAssistantSetting.put("cycle", configService.selectConfigByKey("ymzq")); + menstruationAssistantSetting.put("duration", configService.selectConfigByKey("ymsc")); + menstruationAssistantSetting.put("state", configService.selectConfigByKey("ymdqzt")); + result.put("menstruationAssistantSetting", menstruationAssistantSetting); return AjaxResult.success(result); } } diff --git a/pnkx-life/src/main/resources/mapper/PxCommemorationDayMapper.xml b/pnkx-life/src/main/resources/mapper/PxCommemorationDayMapper.xml index f368274..3aafd53 100644 --- a/pnkx-life/src/main/resources/mapper/PxCommemorationDayMapper.xml +++ b/pnkx-life/src/main/resources/mapper/PxCommemorationDayMapper.xml @@ -50,12 +50,12 @@ icon, date, `repeat`, order_num, del_flag, version, create_by, create_time, update_by, update_time, remark from px_commemoration_day where - ( `repeat` = 1 AND TIMESTAMPDIFF( DAY, now(), CONCAT( LEFT ( now(), 4 ), RIGHT ( date, 15 ))) < 5 - AND TIMESTAMPDIFF( DAY, now(), CONCAT( LEFT ( now(), 4 ), RIGHT ( date, 15 ))) > 0 + ( `repeat` = 1 AND TIMESTAMPDIFF( DAY, now(), CONCAT( LEFT ( now(), 4 ), RIGHT ( date, 15 ))) < 30 + AND TIMESTAMPDIFF( DAY, now(), CONCAT( LEFT ( now(), 4 ), RIGHT ( date, 15 ))) > -1 ) OR ( `repeat` = 0 - AND TIMESTAMPDIFF( DAY, now(), date ) < 5 AND TIMESTAMPDIFF( DAY, now(), date ) > 0) + AND TIMESTAMPDIFF( DAY, now(), date ) < 30 AND TIMESTAMPDIFF( DAY, now(), date ) > -1) and del_flag = '0'