From 3992e02eef7130333d15133d7ef57bba3c0b58c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A3=B4=E6=B5=A9=E5=AE=87?= <617594538@qq.com> Date: Mon, 13 May 2024 18:20:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=85=E5=8A=9E=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/pnkx/framework/aspectj/LogAspect.java | 3 ++- .../com/pnkx/service/impl/PxToDoServiceImpl.java | 15 +++++++++++++++ .../src/main/resources/mapper/PxToDoMapper.xml | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pnkx-framework/src/main/java/com/pnkx/framework/aspectj/LogAspect.java b/pnkx-framework/src/main/java/com/pnkx/framework/aspectj/LogAspect.java index 080bedb..0baf983 100644 --- a/pnkx-framework/src/main/java/com/pnkx/framework/aspectj/LogAspect.java +++ b/pnkx-framework/src/main/java/com/pnkx/framework/aspectj/LogAspect.java @@ -141,8 +141,9 @@ public class LogAspect { * 获取请求的参数,放到log中 * * @param operLog 操作日志 + * @throws Exception 异常 */ - private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) { + private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception { String requestMethod = operLog.getRequestMethod(); if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) { String params = argsArrayToString(joinPoint.getArgs()); diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxToDoServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxToDoServiceImpl.java index 2cd1d4a..1e39014 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxToDoServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxToDoServiceImpl.java @@ -7,6 +7,8 @@ import com.pnkx.service.IPxToDoService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; @@ -41,6 +43,19 @@ public class PxToDoServiceImpl implements IPxToDoService { */ @Override public List selectPxToDoList(PxToDo pxToDo) { + if (pxToDo.getParams().containsKey("date")) { + String date = pxToDo.getParams().get("date").toString(); + // 创建一个日期时间格式化对象 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + // 解析字符串到LocalDateTime对象 + LocalDateTime dateTime = LocalDateTime.parse(date, formatter); + // 加一个月 + LocalDateTime plusMonth = dateTime.plusMonths(1); + pxToDo.getParams().put("endDate", plusMonth.format(formatter)); + // 减一个月 + LocalDateTime minusMonth = dateTime.minusMonths(1); + pxToDo.getParams().put("startDate", minusMonth.format(formatter)); + } return pxToDoMapper.selectPxToDoList(pxToDo); } diff --git a/pnkx-life/src/main/resources/mapper/PxToDoMapper.xml b/pnkx-life/src/main/resources/mapper/PxToDoMapper.xml index a43933f..8e68a1d 100644 --- a/pnkx-life/src/main/resources/mapper/PxToDoMapper.xml +++ b/pnkx-life/src/main/resources/mapper/PxToDoMapper.xml @@ -55,6 +55,11 @@ and version = #{version} and finish_by = #{finishBy} and finish_time = #{finishTime} + + and ( + plan_start_time <= #{params.endDate} AND plan_end_time >= #{params.startDate} + ) + order by finish_time desc