|
@@ -1,5 +1,7 @@
|
|
package com.ruoyi.system.service.impl;
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.text.DecimalFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -8,6 +10,7 @@ import com.ruoyi.common.constant.Constants;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
|
+import com.ruoyi.common.core.text.Convert;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.SendSmsUtils;
|
|
import com.ruoyi.common.utils.SendSmsUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
@@ -219,20 +222,20 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
|
|
@Override
|
|
@Override
|
|
public AjaxResult indexStatistics(BomanReservat bomanReservat) {
|
|
public AjaxResult indexStatistics(BomanReservat bomanReservat) {
|
|
Map<String, Object> map = new HashMap<>(4);
|
|
Map<String, Object> map = new HashMap<>(4);
|
|
- map.put("canGuan", 0);
|
|
|
|
- map.put("yuYue", 0);
|
|
|
|
- map.put("todayYuYue", 0);
|
|
|
|
- map.put("todayCanGuan", 0);
|
|
|
|
|
|
+ map.put("canGuan" , 0);
|
|
|
|
+ map.put("yuYue" , 0);
|
|
|
|
+ map.put("todayYuYue" , 0);
|
|
|
|
+ map.put("todayCanGuan" , 0);
|
|
List<BomanReservat> bomanReservats = bomanReservatMapper.selectBomanReservatList(bomanReservat);
|
|
List<BomanReservat> bomanReservats = bomanReservatMapper.selectBomanReservatList(bomanReservat);
|
|
if (bomanReservats != null && bomanReservats.size() > 0) {
|
|
if (bomanReservats != null && bomanReservats.size() > 0) {
|
|
//来访数
|
|
//来访数
|
|
long canGuan = bomanReservats.stream().filter(s -> "2".equals(s.getVisitStatus())).count();
|
|
long canGuan = bomanReservats.stream().filter(s -> "2".equals(s.getVisitStatus())).count();
|
|
long todayYuYue = bomanReservats.stream().filter(s -> DateUtils.getDate().equals(s.getVisitDate())).count();
|
|
long todayYuYue = bomanReservats.stream().filter(s -> DateUtils.getDate().equals(s.getVisitDate())).count();
|
|
long todayCanGuan = bomanReservats.stream().filter(s -> DateUtils.getDate().equals(s.getVisitDate())).filter(s -> "2".equals(s.getVisitStatus())).count();
|
|
long todayCanGuan = bomanReservats.stream().filter(s -> DateUtils.getDate().equals(s.getVisitDate())).filter(s -> "2".equals(s.getVisitStatus())).count();
|
|
- map.put("canGuan", canGuan);
|
|
|
|
- map.put("yuYue", bomanReservats.size());
|
|
|
|
- map.put("todayYuYue", todayYuYue);
|
|
|
|
- map.put("todayCanGuan", todayCanGuan);
|
|
|
|
|
|
+ map.put("canGuan" , canGuan);
|
|
|
|
+ map.put("yuYue" , bomanReservats.size());
|
|
|
|
+ map.put("todayYuYue" , todayYuYue);
|
|
|
|
+ map.put("todayCanGuan" , todayCanGuan);
|
|
}
|
|
}
|
|
return AjaxResult.success(map);
|
|
return AjaxResult.success(map);
|
|
}
|
|
}
|
|
@@ -257,11 +260,37 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
|
|
@Override
|
|
@Override
|
|
public AjaxResult realTime() {
|
|
public AjaxResult realTime() {
|
|
// todo
|
|
// todo
|
|
|
|
+
|
|
|
|
+ String configKey = "lyssllsj";
|
|
|
|
+ String configKey_1 = "lyssllsj_1";
|
|
|
|
+ String configValue = Convert.toStr(redisCache.getCacheObject(configKey));
|
|
|
|
+ String configValue_1 = Convert.toStr(redisCache.getCacheObject(configKey_1));
|
|
|
|
+ if(StringUtils.isEmpty(configValue) || "0".equals(configValue)){
|
|
|
|
+ configValue = "0";
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isEmpty(configValue_1) || "0".equals(configValue_1)){
|
|
|
|
+ configValue_1 = "0";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ resultMap.put("scale" , "0%");
|
|
|
|
+
|
|
|
|
+ if(!"0".equals(configValue) && !"0".equals(configValue_1)){
|
|
|
|
+ BigDecimal num1 = new BigDecimal("configValue");
|
|
|
|
+ BigDecimal num2 = new BigDecimal("configValue_1");
|
|
|
|
+ double result = Double.parseDouble(((num1.divide(num2)).setScale(2,BigDecimal.ROUND_HALF_UP)).toString());
|
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0%"); // 创建DecimalFormat对象并设置格式化模式为"0%"
|
|
|
|
+ String percentage = decimalFormat.format((result * 100)); // 使用DecimalFormat对象进行格式化操作
|
|
|
|
+ resultMap.put("scale" , percentage);
|
|
|
|
+ }
|
|
|
|
|
|
- resultMap.put("scale", "50%");
|
|
|
|
- resultMap.put("current", 5);
|
|
|
|
- resultMap.put("total", 10);
|
|
|
|
|
|
+ //今天比昨天新增多少人
|
|
|
|
+ resultMap.put("addNum" , Long.parseLong(configValue)-Long.parseLong(configValue_1));
|
|
|
|
+ //昨天人数
|
|
|
|
+ resultMap.put("current" , configValue_1);
|
|
|
|
+ //今天人数
|
|
|
|
+ resultMap.put("total" , configValue);
|
|
return AjaxResult.success(resultMap);
|
|
return AjaxResult.success(resultMap);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -281,18 +310,18 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
|
|
long todayYy = 0;
|
|
long todayYy = 0;
|
|
for (BomanReservat bomanReservat : bomanReservatYearList) {
|
|
for (BomanReservat bomanReservat : bomanReservatYearList) {
|
|
yearYy = yearYy + Long.parseLong(bomanReservat.getVisitNum());
|
|
yearYy = yearYy + Long.parseLong(bomanReservat.getVisitNum());
|
|
- if (bomanReservat.getVisitDate().contains(time.substring(0, time.lastIndexOf("-")))) {
|
|
|
|
|
|
+ if(bomanReservat.getVisitDate().contains(time.substring(0,time.lastIndexOf("-")))){
|
|
monthYy = monthYy + Long.parseLong(bomanReservat.getVisitNum());
|
|
monthYy = monthYy + Long.parseLong(bomanReservat.getVisitNum());
|
|
}
|
|
}
|
|
if (bomanReservat.getVisitDate().equals(time)) {
|
|
if (bomanReservat.getVisitDate().equals(time)) {
|
|
todayYy = todayYy + Long.parseLong(bomanReservat.getVisitNum());
|
|
todayYy = todayYy + Long.parseLong(bomanReservat.getVisitNum());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- map.put("yearYy", yearYy);
|
|
|
|
- map.put("monthYy", monthYy);
|
|
|
|
- map.put("todayYy", todayYy);
|
|
|
|
|
|
+ map.put("yearYy" , yearYy);
|
|
|
|
+ map.put("monthYy" , monthYy);
|
|
|
|
+ map.put("todayYy" , todayYy);
|
|
//todo 今日参观人数
|
|
//todo 今日参观人数
|
|
- map.put("todayVisit", 10);
|
|
|
|
|
|
+ map.put("todayVisit" , 10);
|
|
|
|
|
|
Map<String, Object> sevenMap = new HashMap<>();
|
|
Map<String, Object> sevenMap = new HashMap<>();
|
|
//获取近7天的数组
|
|
//获取近7天的数组
|
|
@@ -327,12 +356,12 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
|
|
td = 0L;
|
|
td = 0L;
|
|
}
|
|
}
|
|
|
|
|
|
- sevenMap.put("date", sevenDate);
|
|
|
|
- sevenMap.put("zrs", zrsList);
|
|
|
|
- sevenMap.put("sk", skList);
|
|
|
|
- sevenMap.put("td", tdList);
|
|
|
|
|
|
+ sevenMap.put("date" , sevenDate);
|
|
|
|
+ sevenMap.put("zrs" , zrsList);
|
|
|
|
+ sevenMap.put("sk" , skList);
|
|
|
|
+ sevenMap.put("td" , tdList);
|
|
|
|
|
|
- map.put("sevenMap", sevenMap);
|
|
|
|
|
|
+ map.put("sevenMap" , sevenMap);
|
|
return AjaxResult.success(map);
|
|
return AjaxResult.success(map);
|
|
}
|
|
}
|
|
|
|
|