Răsfoiți Sursa

提交业绩报表显示日期数据太长折叠问题

hxl13994548489 2 ani în urmă
părinte
comite
fc12cc06ab

+ 40 - 0
src/main/java/com/ydtech/modules/admin/service/impl/AppReportServiceImpl.java

@@ -168,6 +168,9 @@ public class AppReportServiceImpl implements AppReportService {
                 list.add(new PremiumReportDto(str, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO));
             }
         }
+        //去除时间前面的数据
+        //短日期
+        dateStrs = getShortStrs(dateStrs, dateStr);
         return new PremiumReportAllDto(dateStr,jqPremium,syPremium,sumPremium,dateStrs,jqPremiumList,syPremiumList,sumPremiumList);
     }
     /**
@@ -201,9 +204,43 @@ public class AppReportServiceImpl implements AppReportService {
                 list.add(new EmployeeIncreaseReportDto(str,0));
             }
         }
+        //短日期
+        dateStrs = getShortStrs(dateStrs, dateStr);
         return new EmployeeIncreaseReportAllDto(dateStr,employeeIncreaseCount,dateStrs,employeeIncreaseList);
     }
 
+    private static List<String> getShortStrs(List<String> dateStrs, String dateStr) {
+        List<String> shortStrs=new ArrayList<>();
+        //去除时间前面的数据
+        for(String str: dateStrs) {
+            str = getStrBySize(str, dateStr);
+           shortStrs.add(str);
+        }
+        return shortStrs;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/17 20:03
+     *  @Description:
+     */
+    public static String   getStrBySize(String str, String dateStr){
+        String[] strs = dateStr.split("-");
+        int size=strs.length;
+        //月
+        if(size==2){
+            str = str.split("-")[1]+"-"+str.split("-")[2];
+
+        }else if(size==3){
+            //日
+            str = str.split(" ")[1];
+        }else{
+            //年
+            str = str.split("-")[1];
+        }
+        return str;
+    }
     /**
      *  @version
      *  @author: hxl
@@ -247,6 +284,9 @@ public class AppReportServiceImpl implements AppReportService {
                 list.add(new RevenueReportDto(str,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO));
             }
         }
+        //去除时间前面的数据
+        //短日期
+        dateStrs = getShortStrs(dateStrs, dateStr);
         return new RevenueReportAllDto(dateStr,haldingAmount,documentaryAmount,promotionAmount,dateStrs,haldingAmountList,documentaryAmountList,promotionAmountList);
     }
     /**