Merge pull request #971 from dataease/pr@dev@feat_msg_overtime

feat: 增加消失超时默认30天
This commit is contained in:
fit2cloud-chenyw 2021-10-18 11:32:35 +08:00 committed by GitHub
commit df2e1f0800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 5 deletions

View File

@ -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));
}
} */
}

View File

@ -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<SysMsg> sysMsgs = sysMsgMapper.selectByExample(example);
return sysMsgs;
@ -100,6 +105,8 @@ public class SysMsgService {
criteria.andStatusEqualTo(msgRequest.getStatus());
}
criteria.andCreateTimeGreaterThanOrEqualTo(overTime());
example.setOrderByClause(orderClause);
List<MsgGridDto> 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);
} */
}

View File

@ -49,15 +49,18 @@
</div>
</div>
<div slot="reference">
<div>
<el-badge :value="count || paginationConfig.total" :hidden="!count && !paginationConfig.total" :max="99" class="item">
<svg-icon class-name="notification" icon-class="notification" />
</el-badge>
<!-- <div>
<svg-icon
class-name="notification"
icon-class="notification"
/>
<span v-if="count || paginationConfig.total" class="msg-number">{{ count || paginationConfig.total }}</span>
</div>
</div>
</el-popover>
</div> -->
</div></el-popover>
</template>
<script>
@ -275,4 +278,9 @@ export default {
background-color: #171422;
}
}
.item {
margin-top: 0px;
margin-right: 5px;
}
</style>