Răsfoiți Sursa

智享生活核心指标接口修改

ZhangManMan 2 ani în urmă
părinte
comite
7561b0dff3

+ 21 - 8
src/main/java/com/sky/ioc/service/Parking/impl/ParkingServiceImpl.java

@@ -12,7 +12,9 @@ import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
 import org.springframework.stereotype.Service;
 
+import java.text.DecimalFormat;
 import java.util.*;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.stream.Collector;
 import java.util.stream.Collectors;
 
@@ -30,17 +32,28 @@ public class ParkingServiceImpl implements ParkingService {
     public ReturnMsg getCoreIndicators(IocDateParam iocDateParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
-        objects.get(0).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int totalParking = random.nextInt(1000, 3000);
+        int dayParking = random.nextInt(1000,3000);
+        while (dayParking>totalParking){
+            dayParking  = random.nextInt(1000,3000);
+        }
+        int breakRuleParking = random.nextInt(10,50);
+        int unParking = totalParking - dayParking;
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
+        objects.get(0).put("value",totalParking);
+        objects.get(0).put("compare",compare);
 
-        objects.get(1).put("value",180);
-        objects.get(1).put("compare",0.4);
+        objects.get(1).put("value",dayParking);
+        objects.get(1).put("compare",compare);
 
-        objects.get(2).put("value",20);
-        objects.get(2).put("compare",-0.4);
+        objects.get(2).put("value",breakRuleParking);
+        objects.get(2).put("compare",-compare);
 
-        objects.get(3).put("value",40);
-        objects.get(3).put("compare",0.4);
+        objects.get(3).put("value",unParking);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("建议增加停车位180个");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);

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

@@ -14,6 +14,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * TODO
@@ -106,16 +107,22 @@ public class AssetServiceImpl implements AssetService {
     public ReturnMsg getAssetCoreIndicators() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",12000);
-        objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",2100);
-        objects.get(1).put("compare",0.4);
-
-        objects.get(2).put("value",21);
-        objects.get(2).put("compare",-0.4);
-
-        objects.get(3).put("value",12);
+        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);
+        float compare = (float) Math.random();
+        objects.get(0).put("value",yearAsset);
+        objects.get(0).put("compare",compare);
+
+        objects.get(1).put("value",totalAsset);
+        objects.get(1).put("compare",compare);
+
+        objects.get(2).put("value",personAsset);
+        objects.get(2).put("compare",compare);
+
+        objects.get(3).put("value",totalyear);
         indeicator.setWorthAttention("内容");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);

+ 36 - 17
src/main/java/com/sky/ioc/service/canteen/impl/RestaurantServiceImpl.java

@@ -11,8 +11,10 @@ import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
 import org.springframework.stereotype.Service;
 
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
 
 
 /**
@@ -49,17 +51,28 @@ public class RestaurantServiceImpl implements RestaurantService {
     public ReturnMsg getCoreIndicators(IocDateParam iocDateParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",400);
-        objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",2000);
-        objects.get(1).put("compare",0.4);
-
-        objects.get(2).put("value",18);
-        objects.get(2).put("compare",-0.4);
-
-        objects.get(3).put("value",18);
-        objects.get(3).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int totalPerson = random.nextInt(100, 3000);
+        int dayPerson = random.nextInt(150,500);
+        while (dayPerson>totalPerson){
+            dayPerson  = random.nextInt(150,500);
+        }
+        int price = random.nextInt(15,50);
+        int totalPrice = price*totalPerson;
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
+        objects.get(0).put("value",dayPerson);
+        objects.get(0).put("compare",compare);
+
+        objects.get(1).put("value",totalPerson);
+        objects.get(1).put("compare",compare);
+
+        objects.get(2).put("value",totalPrice);
+        objects.get(2).put("compare",-compare);
+
+        objects.get(3).put("value",price);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("员工偏爱川菜,建议增加");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -129,16 +142,22 @@ public class RestaurantServiceImpl implements RestaurantService {
     public ReturnMsg getRestaurantConsumption() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",1800);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int orderConut = random.nextInt(500, 3000);//订单数
+        int price = random.nextInt(10,50);//单价
+        int thirdPay = random.nextInt(1000,10000);//第三方支付
+        int totalPrice = orderConut*price;//总金额
+        while (thirdPay>totalPrice){
+            thirdPay = random.nextInt(1000,10000);//第三方支付
+        }
+        objects.get(0).put("value",totalPrice);
         objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",1800);
+        objects.get(1).put("value",orderConut);
         objects.get(1).put("compare",0.4);
-
-        objects.get(2).put("value",18);
+        objects.get(2).put("value",price);
         objects.get(2).put("compare",0.4);
 
-        objects.get(3).put("value",200);
+        objects.get(3).put("value",thirdPay);
         indeicator.setWorthAttention("提高合同额");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);

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

@@ -9,8 +9,10 @@ import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
 import org.springframework.stereotype.Service;
 
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * TODO
@@ -24,16 +26,25 @@ public class EnergyServiceImpl implements EnergyService {
     public ReturnMsg getElectricityCoreIndicators() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
-        objects.get(0).put("compare",0.4);
+        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);
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
 
-        objects.get(1).put("value",200);
-        objects.get(1).put("compare",0.4);
+        objects.get(0).put("value",totalElec);
+        objects.get(0).put("compare",compare);
 
-        objects.get(2).put("value",30);
+        objects.get(1).put("value",todayElec);
+        objects.get(1).put("compare",compare);
 
-        objects.get(3).put("value",80);
-        objects.get(3).put("compare",0.4);
+        objects.get(2).put("value",top);
+
+        objects.get(3).put("value",personElec);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("用电成本月增速5%,主为动力用电");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -62,16 +73,24 @@ public class EnergyServiceImpl implements EnergyService {
     public ReturnMsg getWaterCoreIndicators() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
-        objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",200);
-        objects.get(1).put("compare",0.4);
-
-        objects.get(2).put("value",30);
-
-        objects.get(3).put("value",20);
-        objects.get(3).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int todayWater = random.nextInt(25, 300);//今日
+        int personWater = random.nextInt(10,50);//人均
+        int top = random.nextInt(0,100);//同比上升
+        int totalWater = random.nextInt(500, 3000);
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
+        objects.get(0).put("value",totalWater);
+        objects.get(0).put("compare",compare);
+
+        objects.get(1).put("value",todayWater);
+        objects.get(1).put("compare",compare);
+
+        objects.get(2).put("value",top);
+
+        objects.get(3).put("value",personWater);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("用水量低于行业标准20%");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -97,15 +116,23 @@ public class EnergyServiceImpl implements EnergyService {
     public ReturnMsg getUseColdCoreIndicators() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
-        objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",30);
-
-        objects.get(2).put("value",80);
-
-        objects.get(3).put("value",10);
-        objects.get(3).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int percentCold = random.nextInt(10, 100);
+        int personCold = random.nextInt(10,50);
+        int top = random.nextInt(0,100);//同比上升
+        int totalCold = random.nextInt(500, 3000);
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
+        objects.get(0).put("value",totalCold);
+        objects.get(0).put("compare",compare);
+
+        objects.get(1).put("value",top);
+
+        objects.get(2).put("value",percentCold);
+
+        objects.get(3).put("value",personCold);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("本月用冷超过行业标准20%");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -123,15 +150,23 @@ public class EnergyServiceImpl implements EnergyService {
     public ReturnMsg getUseHeatCoreIndicators() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
-        objects.get(0).put("compare",0.4);
-
-        objects.get(1).put("value",30);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int percentHeat = random.nextInt(10, 100);
+        int personHeat = random.nextInt(10,50);
+        int top = random.nextInt(0,100);//同比上升
+        int totalHeat = random.nextInt(500, 3000);
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
+        objects.get(0).put("value",totalHeat);
+        objects.get(0).put("compare",compare);
+
+        objects.get(1).put("value",top);
 
         objects.get(2).put("value",10);
 
-        objects.get(3).put("value",10);
-        objects.get(3).put("compare",0.4);
+        objects.get(3).put("value",personHeat);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("本月用热将超过行业标准20%");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);

+ 19 - 7
src/main/java/com/sky/ioc/service/fitness/impl/HealthServiceImpl.java

@@ -11,8 +11,10 @@ import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
 import org.springframework.stereotype.Service;
 
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * TODO 健康小屋
@@ -27,15 +29,25 @@ public class HealthServiceImpl implements HealthService {
     public ReturnMsg getCoreIndicators(IocDateParam iocDateParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",100);
-        objects.get(0).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int totalPerson = random.nextInt(100, 300);
+        int healthPerson = random.nextInt(50,260);
+        while (healthPerson>totalPerson){
+            healthPerson  = random.nextInt(50,260);
+        }
+        int unHealthPerson = totalPerson - healthPerson;
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
+        objects.get(0).put("value",totalPerson);
+        objects.get(0).put("compare",compare);
 
-        objects.get(1).put("value",20);
-        objects.get(1).put("compare",0.4);
+        objects.get(1).put("value",healthPerson);
+        objects.get(1).put("compare",compare);
 
-        objects.get(2).put("value",21);
-        objects.get(2).put("compare",-0.4);
-        objects.get(3).put("value","高血压");
+        objects.get(2).put("value",unHealthPerson);
+        objects.get(2).put("compare",-compare);
+        objects.get(3).put("value","腰椎问题");
         indeicator.setWorthAttention("员工腰椎问题持续上升");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);

+ 38 - 15
src/main/java/com/sky/ioc/service/supermarket/impl/SupermarketServiceImpl.java

@@ -10,7 +10,9 @@ import com.sky.ioc.tool.GeneralMethod;
 import com.sky.ioc.tool.ReturnMsg;
 import org.springframework.stereotype.Service;
 
+import java.text.DecimalFormat;
 import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
 
 /**
  * TODO
@@ -25,17 +27,26 @@ public class SupermarketServiceImpl implements SupermarketService {
     public ReturnMsg getCoreIndicators(IocDateParam iocDateParam) {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",100);
-        objects.get(0).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int orderCount = random.nextInt(100, 3000);
+        int orderprice = random.nextInt(50,150);
+        int price = random.nextInt(1,20);
+        int totalPrice = orderprice*orderCount/10000;
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
 
-        objects.get(1).put("value",2100);
-        objects.get(1).put("compare",0.4);
+        objects.get(0).put("value",totalPrice);
+        objects.get(0).put("compare",compare);
 
-        objects.get(2).put("value",21);
-        objects.get(2).put("compare",-0.4);
+        objects.get(1).put("value",orderCount);
+        objects.get(1).put("compare",compare);
 
-        objects.get(3).put("value",1);
-        objects.get(3).put("compare",0.4);
+        objects.get(2).put("value",orderprice);
+        objects.get(2).put("compare",-compare);
+
+        objects.get(3).put("value",price);
+        objects.get(3).put("compare",compare);
         indeicator.setWorthAttention("本月盈利将达12万元");
         indeicator.setList(objects);
         return ReturnMsg.ok(indeicator);
@@ -66,16 +77,28 @@ public class SupermarketServiceImpl implements SupermarketService {
     public ReturnMsg getSupermarketCoreIndicators() {
         Indeicator indeicator = new Indeicator();
         List<JSONObject> objects = indeicator.getList();
-        objects.get(0).put("value",2000);
-        objects.get(0).put("compare",0.4);
+        ThreadLocalRandom random = ThreadLocalRandom.current();
+        int orderConut = random.nextInt(500, 3000);//订单数
+        int price = random.nextInt(10,50);//单价
+        int thirdPay = random.nextInt(1000,10000);//第三方支付
+        int totalPrice = orderConut*price;//总金额
+        while (thirdPay>totalPrice){
+            thirdPay = random.nextInt(1000,10000);//第三方支付
+        }
+        float compare = (float) Math.random();
+        DecimalFormat decimalFormat = new DecimalFormat("#.0");
+        compare = Float.parseFloat(decimalFormat.format(compare));
+
+        objects.get(0).put("value",totalPrice);
+        objects.get(0).put("compare",compare);
 
-        objects.get(1).put("value",1800);
-        objects.get(1).put("compare",0.4);
+        objects.get(1).put("value",orderConut);
+        objects.get(1).put("compare",compare);
 
-        objects.get(2).put("value",18);
-        objects.get(2).put("compare",0.4);
+        objects.get(2).put("value",price);
+        objects.get(2).put("compare",compare);
 
-        objects.get(3).put("value",200);
+        objects.get(3).put("value",thirdPay);
 
         indeicator.setWorthAttention("提高合同额");
         indeicator.setList(objects);