From 121b51fb1dd981d91e5b9665952c1d7d839080b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?qkr7828=28=EB=B0=95=EC=9E=AC=EC=9A=B0=29?= <박재우@DESKTOP-EF7ECBO> Date: Wed, 12 Oct 2022 10:20:58 +0900 Subject: [PATCH] Revert "." This reverts commit ec6b6408d52ac1c1bb98af0d13111025dcc803a0. --- .../anls/hstry/service/AnlsHstryService.java | 66 ++++--------------- .../group/service/BasGroupAprvService.java | 10 +-- 2 files changed, 18 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/palnet/biz/api/anls/hstry/service/AnlsHstryService.java b/src/main/java/com/palnet/biz/api/anls/hstry/service/AnlsHstryService.java index bbd7572..0742a67 100644 --- a/src/main/java/com/palnet/biz/api/anls/hstry/service/AnlsHstryService.java +++ b/src/main/java/com/palnet/biz/api/anls/hstry/service/AnlsHstryService.java @@ -2,8 +2,6 @@ package com.palnet.biz.api.anls.hstry.service; import java.util.ArrayList; import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.Optional; @@ -30,16 +28,12 @@ import com.palnet.biz.jpa.entity.ComArcrftBas; import com.palnet.biz.jpa.entity.ComIdntfBas; import com.palnet.biz.jpa.entity.CtrCntrlBas; import com.palnet.biz.jpa.entity.CtrCntrlHstryArea; -import com.palnet.biz.jpa.entity.FltPlanBas; -import com.palnet.biz.jpa.entity.FltPlanPilot; import com.palnet.biz.jpa.entity.PtyCstmrGroup; import com.palnet.biz.jpa.repository.com.ComArcrftBasRepository; import com.palnet.biz.jpa.repository.com.ComIdntBasRepository; import com.palnet.biz.jpa.repository.ctr.CtrCntrlBasRepository; import com.palnet.biz.jpa.repository.ctr.CtrCntrlHstryAreaRepository; import com.palnet.biz.jpa.repository.ctr.CtrCntrlQueryRepository; -import com.palnet.biz.jpa.repository.flt.FltPlanBasRepository; -import com.palnet.biz.jpa.repository.flt.FltPlanPilotRepository; import com.palnet.biz.jpa.repository.pty.PtyCstmrGroupRepository; import com.palnet.comn.code.ErrorCode; import com.palnet.comn.exception.CustomException; @@ -65,12 +59,6 @@ public class AnlsHstryService { @Autowired private CtrCntrlHstryAreaRepository ctrCntrlHstryAreaRepository; - @Autowired - private FltPlanBasRepository fltPlanBasRepository; - - @Autowired - private FltPlanPilotRepository fltPlanPilotRepository; - @Autowired private CtrCntrlQueryRepository query; @@ -78,58 +66,30 @@ public class AnlsHstryService { private JwtTokenUtil jwtTokenUtil; //비행이력현황 list - public ComnPagingRs list(AnlsHstryGroupModel rq){ + public ComnPagingRs list(AnlsHstryGroupModel rq){ Integer cstmrSno = jwtTokenUtil.getCstmrSnoByToken(); + List groupAuth = jwtTokenUtil.getGroupAuthByToken(); String appAuth = jwtTokenUtil.getUserAuthByToken(); - ListresultList = new ArrayList<>(); - - ComnPagingRs response = new ComnPagingRs<>(); + ComnPagingRs response = new ComnPagingRs<>(); Pageable pageable = PageRequest.of(rq.getPage()-1, rq.getRecord()); if("USER".equals(appAuth) || "ROLE_USER".equals(appAuth)) { - if("NORMAL".equals(rq.getGroupId())) { - List idntfList = comIdntBasRepository.findIdntfNumber(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 NORMAL인 ID인 경우 본인이 생성한 기체만 조회 */ - if (idntfList.size() > 0) { - for (ComIdntfBas list : idntfList) { - List results = query.cntrlBasNormalHstryList(rq, list.getIdntfNum()); - if (results.size() > 0) { - resultList.addAll(results); - } - } - } - List basResult = fltPlanBasRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 - NORMAL인 ID인 경우 cstmrSno로 비행계획서 조회 */ - for (FltPlanBas list : basResult) { - resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno())); - } - List pilotResult = fltPlanPilotRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도 - 모두 NORMAL인 ID인 경우 cstmrSno로 조종사 조회 */ - - for (FltPlanPilot list : pilotResult) { - resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno())); - } - - Comparator comparator = (o1, o2) -> { - if (DateUtils.diffSecond(o1.getCntrlStDt(), o2.getCntrlStDt()) < 0) { - return 1; - } else if(DateUtils.diffSecond(o1.getCntrlStDt(), o2.getCntrlStDt()) > 0) { - return -1; - } - return 0; - }; - Collections.sort(resultList, comparator); - - } - }else { - PageImpl result = query.listCntrlBasRs(rq, pageable); + + } + PageImpl result = query.listCntrlBasRs(rq, pageable); long total = query.countCntrlBasRs(rq, cstmrSno); long totalPage = total % rq.getRecord() > 0 ? (total/rq.getRecord()) + 1 : total/rq.getRecord(); response.setItems(result.getContent()); response.setTotal(total); - response.setTotalPage(totalPage); + response.setTotalPage(totalPage); + + + + + response.setPage(rq.getPage()); - } + return response; } diff --git a/src/main/java/com/palnet/biz/api/bas/group/service/BasGroupAprvService.java b/src/main/java/com/palnet/biz/api/bas/group/service/BasGroupAprvService.java index ad38caa..1a0d725 100644 --- a/src/main/java/com/palnet/biz/api/bas/group/service/BasGroupAprvService.java +++ b/src/main/java/com/palnet/biz/api/bas/group/service/BasGroupAprvService.java @@ -45,16 +45,16 @@ public class BasGroupAprvService { Pageable pageable = PageRequest.of(rq.getPage()-1, rq.getRecord()); - PageImpl result = query.aprvList(rq, pageable); + List result = query.aprvList(rq); long total = query.aprvCount(rq); long totalPage = total % rq.getRecord() > 0 ? (total/rq.getRecord()) + 1 : total/rq.getRecord(); - response.setItems(result.getContent()); - response.setTotal(total); - response.setPage(rq.getPage()); - response.setTotalPage(totalPage); +// response.setItems(result.getContent()); +// response.setTotal(total); +// response.setPage(rq.getPage()); +// response.setTotalPage(totalPage); return response;