From e0e5ecc842ce5af1a7c0229a923c0edd4aaac2f1 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 화, 08 2월 2022 16:45:30 +0900
Subject: [PATCH] 이슈 상세 검색 시 기간검색 가능

---
 src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java |  155 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 151 insertions(+), 4 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java b/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java
index 7b59d3b..a0b9fac 100644
--- a/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java
+++ b/src/main/java/kr/wisestone/owl/web/condition/IssueCondition.java
@@ -1,12 +1,12 @@
 package kr.wisestone.owl.web.condition;
 
 import com.google.common.collect.Lists;
-import kr.wisestone.owl.util.CommonUtil;
-import kr.wisestone.owl.util.ConvertUtil;
-import kr.wisestone.owl.util.DateUtil;
-import kr.wisestone.owl.util.MapUtil;
+import kr.wisestone.owl.util.*;
+import kr.wisestone.owl.vo.PageVo;
+import org.springframework.data.domain.Pageable;
 import org.springframework.util.StringUtils;
 
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -28,6 +28,8 @@
     private String endStartDate;
     private String beginCompleteDate;
     private String endCompleteDate;
+    private String beginDateRange;
+    private String endDateRange;
     private Integer page;
     private Integer pageSize;
     private Long loginUserId;
@@ -53,8 +55,21 @@
     private List<Long> statusIds = Lists.newArrayList();
     private List<Long> excludeIds = Lists.newArrayList();
     private List<Long> myDepartmentIds; // �궡媛� �냽�빐�엳�뒗 遺��꽌 ID
+    private Boolean hideDownIssue;
+    private Boolean hideCompleteIssue;
+    private Boolean isTree; // �듃由ш뎄議� 紐⑤뱶 �씪�븣
+    private Pageable relPageable;
+    private Pageable downPageable;
+    private Boolean allIssue; // �쟾泥댁씠�뒋 蹂댁뿬二쇨린
+    private Long issueTypeId;
+    private Boolean parentYN;   //�긽�쐞�씠�뒋留� 議고쉶 �쑀臾�
 
     public IssueCondition(){}
+
+    public IssueCondition(Long issueId, Long parentIssueId){
+        this.id = issueId;
+        this.parentIssueId = parentIssueId;
+    }
     //  ���떆蹂대뱶 �쐞湲곌�由� �쐞�젽�뿉�꽌 �궗�슜
     public IssueCondition(List<String> issueIds){
         this.issueIds = issueIds;
@@ -62,6 +77,20 @@
 
     public static IssueCondition make(Map<String, Object> conditions) {
         IssueCondition condition = ConvertUtil.convertMapToClass(conditions, IssueCondition.class);
+        Map<String, Object> pageContents = (Map<String, Object>) conditions.get("pageContent");
+        if (pageContents != null) {
+            PageVo downPageVo = new PageVo();
+            downPageVo.setPage(MapUtil.getInteger(pageContents, "downPage"));
+            downPageVo.setPageSize(MapUtil.getInteger(pageContents, "downPageSize"));
+
+            PageVo relPageVo = new PageVo();
+            relPageVo.setPage(MapUtil.getInteger(pageContents, "relPage"));
+            relPageVo.setPageSize(MapUtil.getInteger(pageContents, "relPageSize"));
+
+            PageUtil pageUtil = new PageUtil();
+            condition.setRelPageable(pageUtil.convertPageable(relPageVo));
+            condition.setDownPageable(pageUtil.convertPageable(downPageVo));
+        }
 
         if (!StringUtils.isEmpty(condition.getCombinationIssueNumber())) {
             if (condition.getCombinationIssueNumber().contains("-")) {
@@ -134,6 +163,18 @@
             condition.setEndCompleteDate(DateUtil.convertDateToStr(endCompleteDate, "yyyy-MM-dd"));
         }
 
+        if (StringUtils.hasText(MapUtil.getString(conditions, "dateRange"))) {
+            String dateRange = MapUtil.getString(conditions, "dateRange");
+            if (!StringUtils.isEmpty(dateRange)) {
+                List<String> date = Arrays.asList(dateRange.split("~"));
+
+                Date beginDateRange = DateUtil.convertStrToDate(date.get(0).trim(), "yy-MM-dd");
+                condition.setBeginDateRange(DateUtil.convertDateToStr(beginDateRange, "yyyy-MM-dd"));
+                Date endDateRange = DateUtil.convertStrToDate(date.get(1).trim(), "yy-MM-dd");
+                condition.setEndDateRange(DateUtil.convertDateToStr(endDateRange, "yyyy-MM-dd"));
+            }
+        }
+
         if (MapUtil.getLongs(conditions, "projectIds") != null) {
             condition.setProjectIds(MapUtil.getLongs(conditions, "projectIds"));
         }
@@ -144,6 +185,10 @@
 
         if (MapUtil.getLongs(conditions, "issueTypeIds") != null) {
             condition.setIssueTypeIds(MapUtil.getLongs(conditions, "issueTypeIds"));
+        }
+
+        if (MapUtil.getLong(conditions, "issueTypeId") != null) {
+            condition.setIssueTypeId(MapUtil.getLong(conditions, "issueTypeId"));
         }
 
         if (MapUtil.getLongs(conditions, "priorityIds") != null) {
@@ -172,6 +217,28 @@
 
         if (MapUtil.getLong(conditions, "issueId") != null) {
             condition.setId(MapUtil.getLong(conditions, "issueId"));
+        }
+
+        if (MapUtil.getBoolean(conditions, "hideDownIssue") != null) {
+            if(MapUtil.getBoolean(conditions, "isTree") != null && !MapUtil.getBoolean(conditions, "isTree")){
+                condition.setHideDownIssue(MapUtil.getBoolean(conditions, "hideDownIssue"));
+            }else if(MapUtil.getBoolean(conditions, "isTree")) {
+                condition.setHideDownIssue(false);
+            }
+        }
+
+        if (MapUtil.getBoolean(conditions, "hideCompleteIssue") != null) {
+            condition.setHideCompleteIssue(MapUtil.getBoolean(conditions, "hideCompleteIssue"));
+        }
+
+        if (MapUtil.getBoolean(conditions, "isTree") != null) {
+            condition.setTree(MapUtil.getBoolean(conditions, "isTree"));
+        } else {
+            condition.setTree(false);
+        }
+
+        if (MapUtil.getBoolean(conditions, "parentYN") != null && MapUtil.getBoolean(conditions, "parentYN")) {
+            condition.setParentYN(true);
         }
 
         return condition;
@@ -263,6 +330,22 @@
 
     public void setEndCompleteDate(String endCompleteDate) {
         this.endCompleteDate = endCompleteDate;
+    }
+
+    public String getBeginDateRange() {
+        return beginDateRange;
+    }
+
+    public void setBeginDateRange(String beginDateRange) {
+        this.beginDateRange = beginDateRange;
+    }
+
+    public String getEndDateRange() {
+        return endDateRange;
+    }
+
+    public void setEndDateRange(String endDateRange) {
+        this.endDateRange = endDateRange;
     }
 
     public Integer getPage() {
@@ -492,4 +575,68 @@
     public void setMyDepartmentIds(List<Long> myDepartmentIds) {
         this.myDepartmentIds = myDepartmentIds;
     }
+
+    public Boolean getHideDownIssue() {
+        return hideDownIssue;
+    }
+
+    public void setHideDownIssue(Boolean hideDownIssue) {
+        this.hideDownIssue = hideDownIssue;
+    }
+
+    public Boolean getHideCompleteIssue() {
+        return hideCompleteIssue;
+    }
+
+    public void setHideCompleteIssue(Boolean hideCompleteIssue) {
+        this.hideCompleteIssue = hideCompleteIssue;
+    }
+
+    public Boolean getTree() {
+        return isTree;
+    }
+
+    public void setTree(Boolean tree) {
+        isTree = tree;
+    }
+
+    public Pageable getRelPageable() {
+        return relPageable;
+    }
+
+    public void setRelPageable(Pageable relPageable) {
+        this.relPageable = relPageable;
+    }
+
+    public Pageable getDownPageable() {
+        return downPageable;
+    }
+
+    public void setDownPageable(Pageable downPageable) {
+        this.downPageable = downPageable;
+    }
+
+    public Boolean getAllIssue() {
+        return allIssue;
+    }
+
+    public void setAllIssue(Boolean allIssue) {
+        this.allIssue = allIssue;
+    }
+
+    public Long getIssueTypeId() {
+        return issueTypeId;
+    }
+
+    public void setIssueTypeId(Long issueTypeId) {
+        this.issueTypeId = issueTypeId;
+    }
+
+    public Boolean getParentYN() {
+        return parentYN;
+    }
+
+    public void setParentYN(Boolean parentYN) {
+        this.parentYN = parentYN;
+    }
 }

--
Gitblit v1.8.0