|
@@ -1,11 +1,14 @@
|
|
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.*;
|
|
|
|
|
|
import com.ruoyi.common.constant.Constants;
|
|
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.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.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.system.domain.BomanReservatConfigTime;
|
|
import com.ruoyi.system.domain.BomanReservatConfigTime;
|
|
@@ -221,11 +224,42 @@ 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)){
|
|
|
|
+ configValue = "0";
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isEmpty(configValue_1)){
|
|
|
|
+ configValue_1 = "0";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
|
- resultMap.put("scale" , "50%");
|
|
|
|
- resultMap.put("current" , 5);
|
|
|
|
- resultMap.put("total" , 10);
|
|
|
|
|
|
+ if(StringUtils.isEmpty(configValue) || "0".equals(configValue)){
|
|
|
|
+ resultMap.put("scale" , "0%");
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isEmpty(configValue_1) || "0".equals(configValue_1)){
|
|
|
|
+ resultMap.put("scale" , "0%");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ 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("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);
|
|
}
|
|
}
|
|
|
|
|