Przeglądaj źródła

八项成本占比

丁治程 1 rok temu
rodzic
commit
d155dacc69

+ 3 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/entity/vo/ResultEightCost.java

@@ -18,6 +18,9 @@ public class ResultEightCost {
     /** 名字 */
     private String name;
 
+    /** 占比 (某项成本)/总成本 */
+    private BigDecimal proportion;
+
     /** 值 */
     private BigDecimal value;
 

+ 20 - 10
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexZcbServiceImpl.java

@@ -482,7 +482,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -516,7 +517,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -545,7 +547,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -589,7 +592,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -615,7 +619,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
 
                 for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
                     ResultEightCost resultEightCost = new ResultEightCost();
-                    resultEightCost.setName(entry.getKey()+"-0%");
+                    resultEightCost.setName(entry.getKey());
+                    resultEightCost.setProportion(BigDecimal.valueOf(0));
                     resultEightCost.setValue(entry.getValue());
                     resultList.add(resultEightCost);
                 }
@@ -652,7 +657,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -685,7 +691,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -714,7 +721,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -758,7 +766,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
                         BigDecimal divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
                         BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
                         ResultEightCost resultEightCost = new ResultEightCost();
-                        resultEightCost.setName(entry.getKey()+"-"+mul+"%");
+                        resultEightCost.setName(entry.getKey());
+                        resultEightCost.setProportion(mul);
                         resultEightCost.setValue(entry.getValue());
                         resultList.add(resultEightCost);
                     }
@@ -784,7 +793,8 @@ public class IndexZcbServiceImpl implements IndexZcbService {
 
                 for (Map.Entry<String, BigDecimal> entry : sortedMap.entrySet()) {
                     ResultEightCost resultEightCost = new ResultEightCost();
-                    resultEightCost.setName(entry.getKey()+"-0%");
+                    resultEightCost.setName(entry.getKey());
+                    resultEightCost.setProportion(BigDecimal.valueOf(0));
                     resultEightCost.setValue(entry.getValue());
                     resultList.add(resultEightCost);
                 }