|
@@ -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);
|