Переглянути джерело

Merge remote-tracking branch 'origin/master'

liuhaotian 2 роки тому
батько
коміт
e3499c99f5

+ 30 - 10
src/main/java/com/sky/ioc/service/personnel/impl/PersonnelServiceImpl.java

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
 
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * TODO  人员
@@ -27,16 +28,24 @@ public class PersonnelServiceImpl implements PersonnelService {
     public ReturnMsg personnelInfoCount() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int enterCount = random.nextInt(1000, 3000);
+        int outCount = random.nextInt(50, 150);
+        int enterBeforeNineCount = random.nextInt(1000, 3000);
+        while (enterBeforeNineCount>enterCount){
+            enterBeforeNineCount = random.nextInt(1000, 3000);
+        }
+        int inCount = enterCount-outCount;
+        objects.get(0).put("value",enterCount);
         objects.get(0).put("compare",0.4);
 
-        objects.get(1).put("value",20);
+        objects.get(1).put("value",outCount);
         objects.get(1).put("compare",0.4);
 
-        objects.get(2).put("value",1800);
+        objects.get(2).put("value",enterBeforeNineCount);
         objects.get(2).put("compare",0.4);
 
-        objects.get(3).put("value",100);
+        objects.get(3).put("value",inCount);
         objects.get(3).put("compare",-0.4);
         indeicator.setWorthAttention("本周上班时间持续延后");
         indeicator.setList(objects);
@@ -64,17 +73,28 @@ public class PersonnelServiceImpl implements PersonnelService {
     public ReturnMsg getSecurityCoreIndicators(IocDateParam iocDateParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int enterCount = random.nextInt(1000, 3000);
+        int orderCount = random.nextInt(50, 300);
+        int inCount = random.nextInt(1000, 3000);
+        while (inCount>enterCount){
+            inCount = random.nextInt(1000, 3000);
+        }
+        int arrivedCount = random.nextInt(50, 300);
+        while (arrivedCount>orderCount){
+            arrivedCount = random.nextInt(1000, 3000);
+        }
+        objects.get(0).put("value",enterCount);
         objects.get(0).put("compare",0.4);
 
-        objects.get(1).put("value",5000);
+        objects.get(1).put("value",inCount);
         objects.get(1).put("compare",0.4);
 
-        objects.get(2).put("value",200);
-        objects.get(2).put("compare",60);
+        objects.get(2).put("value",orderCount);
+        objects.get(2).put("compare",0.4);
 
-        objects.get(3).put("value",20);
-        objects.get(3).put("compare",0.4);
+        objects.get(3).put("value",arrivedCount);
+        objects.get(3).put("compare",-0.4);
         indeicator.setWorthAttention("防控疫情,缩减访客预约");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);