Browse Source

系统统计 月份

sunhh 2 năm trước cách đây
mục cha
commit
ea685cbb2e

+ 28 - 31
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -2468,13 +2468,16 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
             for (int i = 1; i <= 12; i++) {
                 boolean isYear = false;
                 for (Map<String, String> map : listMap) {
-                    if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
+                    String yy = String.valueOf(map.get("yy"));
+                    String yyNew = yy.replaceAll("^0*","");
+                    if (i == Integer.valueOf(yyNew)) {
                         isYear = true;
                     }
                 }
                 if (!isYear) {
                     Map<String, String> map1 = new HashMap<>();
-                    map1.put("yy", i + "");
+                    String yy = String.format("%02d", i);
+                    map1.put("yy", yy);
                     map1.put("countNum", 0 + "");
                     map1.put("evaluationSum", 0 + "");
                     mapList.add(map1);
@@ -2494,23 +2497,23 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
             Map<String, String> map12 = new HashMap<>();
             for (Map<String, String> map : mapList) {
                 String yy = String.valueOf(map.get("yy"));
-                if ("1".equals(yy)) {
+                if ("01".equals(yy)) {
                     map1.putAll(map);
-                } else if ("2".equals(yy)) {
+                } else if ("02".equals(yy)) {
                     map2.putAll(map);
-                } else if ("3".equals(yy)) {
+                } else if ("03".equals(yy)) {
                     map3.putAll(map);
-                } else if ("4".equals(yy)) {
+                } else if ("04".equals(yy)) {
                     map4.putAll(map);
-                } else if ("5".equals(yy)) {
+                } else if ("05".equals(yy)) {
                     map5.putAll(map);
-                } else if ("6".equals(yy)) {
+                } else if ("06".equals(yy)) {
                     map6.putAll(map);
-                } else if ("7".equals(yy)) {
+                } else if ("07".equals(yy)) {
                     map7.putAll(map);
-                } else if ("8".equals(yy)) {
+                } else if ("08".equals(yy)) {
                     map8.putAll(map);
-                } else if ("9".equals(yy)) {
+                } else if ("09".equals(yy)) {
                     map9.putAll(map);
                 } else if ("10".equals(yy)) {
                     map10.putAll(map);
@@ -2552,13 +2555,16 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
             for (int i = 1; i <= 12; i++) {
                 boolean isYear = false;
                 for (Map<String, String> map : listMapOldMonth) {
-                    if (i == Integer.parseInt(String.valueOf(map.get("yy")))) {
+                    String yy = String.valueOf(map.get("yy"));
+                    String yyNew = yy.replaceAll("^0*","");
+                    if (i == Integer.valueOf(yyNew)) {
                         isYear = true;
                     }
                 }
                 if (!isYear) {
                     Map<String, String> map111 = new HashMap<>();
-                    map111.put("yy", i + "");
+                    String yy = String.format("%02d", i);
+                    map111.put("yy", yy);
                     map111.put("countNum", 0 + "");
                     map111.put("evaluationSum", 0 + "");
                     mapListOld.add(map111);
@@ -2578,23 +2584,23 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
             Map<String, String> mapOld12 = new HashMap<>();
             for (Map<String, String> mapOld : mapListOld) {
                 String yy = String.valueOf(mapOld.get("yy"));
-                if ("1".equals(yy)) {
+                if ("01".equals(yy)) {
                     mapOld1.putAll(mapOld);
-                } else if ("2".equals(yy)) {
+                } else if ("02".equals(yy)) {
                     mapOld2.putAll(mapOld);
-                } else if ("3".equals(yy)) {
+                } else if ("03".equals(yy)) {
                     mapOld3.putAll(mapOld);
-                } else if ("4".equals(yy)) {
+                } else if ("04".equals(yy)) {
                     mapOld4.putAll(mapOld);
-                } else if ("5".equals(yy)) {
+                } else if ("05".equals(yy)) {
                     mapOld5.putAll(mapOld);
-                } else if ("6".equals(yy)) {
+                } else if ("06".equals(yy)) {
                     mapOld6.putAll(mapOld);
-                } else if ("7".equals(yy)) {
+                } else if ("07".equals(yy)) {
                     mapOld7.putAll(mapOld);
-                } else if ("8".equals(yy)) {
+                } else if ("08".equals(yy)) {
                     mapOld8.putAll(mapOld);
-                } else if ("9".equals(yy)) {
+                } else if ("09".equals(yy)) {
                     mapOld9.putAll(mapOld);
                 } else if ("10".equals(yy)) {
                     mapOld10.putAll(mapOld);
@@ -2940,15 +2946,6 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         return mapReturn;
     }
 
-    public static void main(String[] args) {
-        BigDecimal aa = new BigDecimal(14.00);
-        BigDecimal bb = new BigDecimal(0.00);
-        BigDecimal monthonmonthNum111 = (aa.subtract(bb)).divide(bb).multiply(new BigDecimal(100));
-        // BigDecimal monthonmonthNum1 = (aa.subtract(bb)).divide(bb).multiply(new BigDecimal(100));
-        // monthonmonthNum1 = (countNum11.subtract(countNumOld44)).divide(countNumOld44).multiply(new BigDecimal("100"));
-        System.out.println("计算结果:" + monthonmonthNum111);
-    }
-
     //查询不同状态下的项目数据
     public List<PmDemandResVo> getListByStatus(String projectStatus) {
         LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();