|
@@ -1,6 +1,14 @@
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
+import java.text.NumberFormat;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import com.ruoyi.common.constant.CacheConstants;
|
|
|
+import com.ruoyi.common.core.redis.RedisCache;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.ruoyi.system.mapper.UserNucleicTimeMapper;
|
|
@@ -19,6 +27,9 @@ public class UserNucleicTimeServiceImpl implements IUserNucleicTimeService
|
|
|
@Autowired
|
|
|
private UserNucleicTimeMapper userNucleicTimeMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
/**
|
|
|
* 查询导入人员核酸时间记录
|
|
|
*
|
|
@@ -90,4 +101,37 @@ public class UserNucleicTimeServiceImpl implements IUserNucleicTimeService
|
|
|
{
|
|
|
return userNucleicTimeMapper.deleteUserNucleicTimeById(id);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 10分钟执行一次刷新首页数据
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void getIndexData() {
|
|
|
+ //获取本月人数
|
|
|
+ int indexDataMonth = userNucleicTimeMapper.getIndexDataMonth(DateUtils.getNowDate());
|
|
|
+ //获取本周人数
|
|
|
+ int indexDataWeek = userNucleicTimeMapper.getIndexDataWeek(DateUtils.getNowDate());
|
|
|
+ //获取上周周人数
|
|
|
+ int indexDataLastWeek = userNucleicTimeMapper.getIndexDataLastWeek(DateUtils.getNowDate());
|
|
|
+
|
|
|
+ NumberFormat numberformat= NumberFormat.getPercentInstance();
|
|
|
+ numberformat.setMinimumFractionDigits(2);
|
|
|
+ String resultWeek = "0%";
|
|
|
+ String resultLastWeek = "0%";
|
|
|
+ int allCount = indexDataWeek + indexDataLastWeek;
|
|
|
+ if (indexDataWeek > 0 ){
|
|
|
+ resultWeek=numberformat.format((float)indexDataWeek/(float)allCount);
|
|
|
+ }
|
|
|
+ if (indexDataLastWeek > 0 ){
|
|
|
+ resultLastWeek=numberformat.format((float)indexDataLastWeek/(float)allCount);
|
|
|
+ }
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("indexDataMonth",indexDataMonth);
|
|
|
+ map.put("indexDataWeek",indexDataWeek);
|
|
|
+ map.put("indexDataLastWeek",indexDataLastWeek);
|
|
|
+ map.put("resultWeek",resultWeek);
|
|
|
+ map.put("resultLastWeek",resultLastWeek);
|
|
|
+ redisCache.setCacheMap(CacheConstants.INDEX_DATA,map);
|
|
|
+ }
|
|
|
}
|