소스 검색

fixed 统计

zero 1 년 전
부모
커밋
0ef175a3d3
1개의 변경된 파일36개의 추가작업 그리고 52개의 파일을 삭제
  1. 36 52
      src/main/java/cn/cslg/pas/service/business/es/EsCountService.java

+ 36 - 52
src/main/java/cn/cslg/pas/service/business/es/EsCountService.java

@@ -111,43 +111,6 @@ public class EsCountService {
         return esCountDTO;
     }
 
-    public String getDateFormat(String field,String value) {
-        String condition = "";
-        if (value.contains("Q") || value.contains("H") || value.length() == 9) {
-            String year = value.substring(0, value.indexOf("-"));
-            int nextYear = Integer.parseInt(year) + 1;
-            String start = "";
-            String end = "";
-            if (value.contains("Q1")) {
-                start = year + "-01";
-                end = year + "-04";
-            } else if (value.contains("Q2")) {
-                start = year + "-04";
-                end = year + "-07";
-            } else if (value.contains("Q3")) {
-                start = year + "-07";
-                end = year + "-10";
-            } else if (value.contains("Q4")) {
-                start = year + "-10";
-                end = nextYear + "-01";
-            } else if (value.contains("H1")) {
-                start = year + "-01";
-                end = year + "-07";
-            } else if (value.contains("H2")) {
-                start = year + "-07";
-                end = nextYear + "-01";
-            } else if (value.length() == 9) {
-                start = year;
-                end = value.substring(value.indexOf("-") + 1);
-            }
-            condition = field + ">=" + start + " " + "AND" + " " + field + "<" + end;
-        } else {
-            condition = field + " = " + value;
-        }
-
-        return condition;
-    }
-
     public void getReturnData(String searchCondition,String condition, List<EsCustomFieldValueDTO> customFields, Integer taskId,
                               Integer projectId, List<EsCountVO> countVOS, List<EsCountDetailDTO> detailDTOS,
                               EsCountDTO esCountDTO, String firstName, Map<String, List<EsCountDetailDTO>> map) throws Exception {
@@ -160,21 +123,6 @@ public class EsCountService {
             }
         }
 
-//        if (countVOS.size() == 1) {
-//            EsCountVO countVO = countVOS.get(0);
-//            String field = countVO.getField();
-//            String valueOne = countVO.getValueOne();
-//            String valueTwo = countVO.getValueTwo();
-//            if (StringUtils.isNotEmpty(valueOne) && StringUtils.isEmpty(valueTwo)) {
-//                String filterCondition = field + " = " + valueOne;
-//                if (searchCondition != null && !"".equals(searchCondition.trim())) {
-//                    searchCondition = filterCondition + " AND " + searchCondition;
-//                } else {
-//                    searchCondition = filterCondition;
-//                }
-//            }
-//        }
-
         if (!CollectionUtils.isEmpty(customFields)) {
             searchCondition = esService.parseCustomField(customFields,projectId,taskId);
         }
@@ -1207,4 +1155,40 @@ public class EsCountService {
         }
     }
 
+    public String getDateFormat(String field,String value) {
+        String condition = "";
+        if (value.contains("Q") || value.contains("H") || value.length() == 9) {
+            String year = value.substring(0, value.indexOf("-"));
+            int nextYear = Integer.parseInt(year) + 1;
+            String start = "";
+            String end = "";
+            if (value.contains("Q1")) {
+                start = year + "-01";
+                end = year + "-04";
+            } else if (value.contains("Q2")) {
+                start = year + "-04";
+                end = year + "-07";
+            } else if (value.contains("Q3")) {
+                start = year + "-07";
+                end = year + "-10";
+            } else if (value.contains("Q4")) {
+                start = year + "-10";
+                end = nextYear + "-01";
+            } else if (value.contains("H1")) {
+                start = year + "-01";
+                end = year + "-07";
+            } else if (value.contains("H2")) {
+                start = year + "-07";
+                end = nextYear + "-01";
+            } else if (value.length() == 9) {
+                start = year;
+                end = value.substring(value.indexOf("-") + 1);
+            }
+            condition = field + ">=" + start + " " + "AND" + " " + field + "<" + end;
+        } else {
+            condition = field + " = " + value;
+        }
+
+        return condition;
+    }
 }