Эх сурвалжийг харах

智能看板核心数据合理化修改

ZhangManMan 2 жил өмнө
parent
commit
7f6b1a38c7

+ 4 - 4
src/main/java/com/sky/ioc/service/assets/impl/AssetServiceImpl.java

@@ -117,10 +117,10 @@ public class AssetServiceImpl implements AssetService {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
         ThreadLocalRandom random = ThreadLocalRandom.current();
-        int yearAsset = random.nextInt(100, 1000);//今日
-        int  personAsset= random.nextInt(10,50);//人均
-        int totalyear = random.nextInt(1,10);
-        int totalAsset = random.nextInt(500, 3000);
+        int yearAsset = random.nextInt(8000, 10000);//年度
+        int  personAsset= random.nextInt(50,100);//人均
+        int totalyear = random.nextInt(2,8);
+        int totalAsset = random.nextInt(150000, 300000);
         float compare = (float) Math.random();
         DecimalFormat decimalFormat = new DecimalFormat("#.0");
         compare = Float.parseFloat(decimalFormat.format(compare));

+ 11 - 3
src/main/java/com/sky/ioc/service/canteen/impl/RestaurantServiceImpl.java

@@ -11,6 +11,9 @@ import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ThreadLocalRandom;
@@ -154,13 +157,18 @@ public class RestaurantServiceImpl implements RestaurantService {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
         ThreadLocalRandom random = ThreadLocalRandom.current();
-        int orderConut = random.nextInt(500, 3000);//订单数
-        int price = random.nextInt(10,50);//单价
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        int orderConut = random.nextInt(800, 2000);//订单数
+        int price = random.nextInt(10,30);//单价
         int thirdPay = random.nextInt(1000,10000);//第三方支付
         int totalPrice = orderConut*price;//总金额
         while (thirdPay>totalPrice){
             thirdPay = random.nextInt(1000,10000);//第三方支付
         }
+        BigDecimal bigDecimal2 = new BigDecimal(thirdPay);
+        double thirdPay2 = (bigDecimal2.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP).doubleValue()*6);
+        double compare = random.nextDouble(-1, 1);
+        compare = Double.parseDouble(decimalFormat.format(compare));
         objects.get(0).put("value",totalPrice);
         objects.get(0).put("compare",0.4);
         objects.get(1).put("value",orderConut);
@@ -168,7 +176,7 @@ public class RestaurantServiceImpl implements RestaurantService {
         objects.get(2).put("value",price);
         objects.get(2).put("compare",0.4);
 
-        objects.get(3).put("value",thirdPay);
+        objects.get(3).put("value",thirdPay2);
         indeicator.setWorthAttention("提高合同额");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);

+ 4 - 4
src/main/java/com/sky/ioc/service/energy/impl/EnergyServiceImpl.java

@@ -27,10 +27,10 @@ public class EnergyServiceImpl implements EnergyService {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
         ThreadLocalRandom random = ThreadLocalRandom.current();
-        int todayElec = random.nextInt(25, 300);//今日用电
-        int personElec = random.nextInt(10,50);//人均
-        int top = random.nextInt(0,100);//同比上升
-        int totalElec = random.nextInt(500, 3000);
+        int todayElec = random.nextInt(8000, 11000);//今日用电
+        int personElec = random.nextInt(120,250);//人均
+        int top = random.nextInt(0,20);//同比上升
+        int totalElec = random.nextInt(100000, 300000);
         float compare = (float) Math.random();
         DecimalFormat decimalFormat = new DecimalFormat("#.0");
         compare = Float.parseFloat(decimalFormat.format(compare));

+ 11 - 8
src/main/java/com/sky/ioc/service/personnel/impl/PersonnelServiceImpl.java

@@ -29,24 +29,27 @@ public class PersonnelServiceImpl implements PersonnelService {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
         ThreadLocalRandom random = ThreadLocalRandom.current();
-        int enterCount = random.nextInt(1000, 3000);
-        int outCount = random.nextInt(50, 150);
-        int enterBeforeNineCount = random.nextInt(1000, 3000);
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        int enterCount = random.nextInt(1600, 2300);
+        int outCount = random.nextInt(500, 800);
+        int enterBeforeNineCount = random.nextInt(800, 1500);
         while (enterBeforeNineCount>enterCount){
-            enterBeforeNineCount = random.nextInt(1000, 3000);
+            enterBeforeNineCount = random.nextInt(800, 1500);
         }
         int inCount = enterCount-outCount;
+        double compare = random.nextDouble(-1, 1);
+        compare = Double.parseDouble(decimalFormat.format(compare));
         objects.get(0).put("value",enterCount);
-        objects.get(0).put("compare",0.4);
+        objects.get(0).put("compare",compare);
 
         objects.get(1).put("value",outCount);
-        objects.get(1).put("compare",0.4);
+        objects.get(1).put("compare",compare);
 
         objects.get(2).put("value",enterBeforeNineCount);
-        objects.get(2).put("compare",0.4);
+        objects.get(2).put("compare",compare);
 
         objects.get(3).put("value",inCount);
-        objects.get(3).put("compare",-0.4);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("本周上班时间持续延后");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);

+ 4 - 0
src/main/java/com/sky/ioc/service/supermarket/impl/SupermarketServiceImpl.java

@@ -183,6 +183,10 @@ public class SupermarketServiceImpl implements SupermarketService {
         ThreadLocalRandom random = ThreadLocalRandom.current();
         Double thirdPay = supermarketOrderMapper.getThirdTotalPriceByCompanyIdAndDeptId();
         thirdPay = thirdPay == null ? 0 : Double.valueOf(decimalFormat.format(thirdPay));
+        if(thirdPay>0){
+            BigDecimal bigDecimal2 = new BigDecimal(thirdPay);
+            thirdPay =  bigDecimal2.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP).doubleValue()*6;
+        }
         double compare = random.nextDouble(-1, 1);
         compare = Double.parseDouble(decimalFormat.format(compare));