Kaynağa Gözat

保留2位小数

chenendian 3 ay önce
ebeveyn
işleme
4a0bfcac43

+ 7 - 5
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/StorageController.java

@@ -97,8 +97,8 @@ public class StorageController extends BaseController {
                 storageRate.setCompleteRate(78 + (int) (Math.random() * 10));
                 storageRate.setPlanProjectCount(15 + (int) (Math.random() * 5));
                 storageRate.setCompleteProjectCount(11 + (int) (Math.random() * 5));
-                storageRate.setPlanArea(788.6f + (float) (Math.random() * 100));
-                storageRate.setCompleteArea(548.2f + (float) (Math.random() * 100));
+                storageRate.setPlanArea((float) (Math.round((788.6f + (float) (Math.random() * 100)) * 100) / 100.0));
+                storageRate.setCompleteArea((float) (Math.round((548.2f + (float) (Math.random() * 100)) * 100) / 100.0));
                 storageRate.setGdUnit("亩");
                 storageRate.setEstimatedCost(1254.6f);
                 storageRate.setExpenditureCost(1000.3f);
@@ -119,17 +119,19 @@ public class StorageController extends BaseController {
 
                 // --------------供应方式----------------------
                 ProjectSupplyRes projectSupply1 = new ProjectSupplyRes();
-                projectSupply1.setGdArea(263.12f + (float) (Math.random() * 100));
+                projectSupply1.setGdArea((float) (Math.round((263.12f + (float) (Math.random() * 100)) * 100) / 100.0));
                 projectSupply1.setGdType("征用");
                 projectSupply1.setGdUnit("亩");
 
                 ProjectSupplyRes projectSupply2 = new ProjectSupplyRes();
-                projectSupply2.setGdArea(220.12f + (float) (Math.random() * 100));
+
+
+                projectSupply2.setGdArea((float) (Math.round((220.12f + (float) (Math.random() * 100)) * 100) / 100.0));
                 projectSupply2.setGdType("收回");
                 projectSupply2.setGdUnit("亩");
 
                 ProjectSupplyRes projectSupply3 = new ProjectSupplyRes();
-                projectSupply3.setGdArea(190.12f + (float) (Math.random() * 100));
+                projectSupply3.setGdArea((float) (Math.round((190.12f + (float) (Math.random() * 100)) * 100) / 100.0));
                 projectSupply3.setGdType("收购");
                 projectSupply3.setGdUnit("亩");