From 8e573ba179cfe7936bf777b4c2f5bd74aecc466b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 18 Oct 2021 11:31:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=B6=88=E5=A4=B1?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E9=BB=98=E8=AE=A430=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/utils/ExcelReaderUtil.java | 4 +-- .../service/message/SysMsgService.java | 27 +++++++++++++++++++ .../src/components/Notification/index.vue | 14 +++++++--- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java b/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java index 651df59217..2762d43880 100644 --- a/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java +++ b/backend/src/main/java/io/dataease/commons/utils/ExcelReaderUtil.java @@ -69,10 +69,10 @@ public class ExcelReaderUtil { } } - public static void main(String[] args) throws Exception { + /* public static void main(String[] args) throws Exception { String file ="修改日期为mm-dd-yyyy.xlsx"; ExcelReaderUtil.readExcel(file, new FileInputStream("/Users/taojinlong/Desktop/" + file)); - } + } */ } diff --git a/backend/src/main/java/io/dataease/service/message/SysMsgService.java b/backend/src/main/java/io/dataease/service/message/SysMsgService.java index 4344b0e247..5e587b1fb9 100644 --- a/backend/src/main/java/io/dataease/service/message/SysMsgService.java +++ b/backend/src/main/java/io/dataease/service/message/SysMsgService.java @@ -23,6 +23,7 @@ import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; + import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -30,6 +31,8 @@ import java.util.stream.Collectors; @Service public class SysMsgService { + private static final long overDays = 30; + @Resource private SysMsgMapper sysMsgMapper; @@ -67,6 +70,8 @@ public class SysMsgService { criteria.andStatusEqualTo(msgRequest.getStatus()); } + criteria.andCreateTimeGreaterThanOrEqualTo(overTime()); + example.setOrderByClause(orderClause); List sysMsgs = sysMsgMapper.selectByExample(example); return sysMsgs; @@ -100,6 +105,8 @@ public class SysMsgService { criteria.andStatusEqualTo(msgRequest.getStatus()); } + criteria.andCreateTimeGreaterThanOrEqualTo(overTime()); + example.setOrderByClause(orderClause); List msgGridDtos = extSysMsgMapper.queryGrid(example); return msgGridDtos; @@ -109,6 +116,7 @@ public class SysMsgService { SysMsgExample example = new SysMsgExample(); SysMsgExample.Criteria criteria = example.createCriteria(); criteria.andUserIdEqualTo(userId).andStatusEqualTo(false); + criteria.andCreateTimeGreaterThanOrEqualTo(overTime()); return sysMsgMapper.countByExample(example); } @@ -320,4 +328,23 @@ public class SysMsgService { sysMsgMapper.updateByExampleSelective(record, example); } + + public Long overTime() { + Long currentTime = System.currentTimeMillis(); + + long oneDayTime = 24 * 60 * 60 * 1000; + + long temp = overDays * oneDayTime; + + return currentTime - (currentTime + 8 * 60 * 60 * 1000) % oneDayTime - temp; + + } + + /* public static void main(String[] args) { + + Long overTime = overTime(); + System.out.println(overTime); + + } */ + } diff --git a/frontend/src/components/Notification/index.vue b/frontend/src/components/Notification/index.vue index c0a4675f2d..796ac96762 100644 --- a/frontend/src/components/Notification/index.vue +++ b/frontend/src/components/Notification/index.vue @@ -49,15 +49,18 @@
-
+ + + + +