Browse Source

Revert "비행이력 현황 필터 수정"

This reverts commit 5169eb5ba5.
Test
qkr7828(박재우) 2 years ago
parent
commit
66ec05ecf9
  1. 72
      src/main/java/com/palnet/biz/api/anls/hstry/service/AnlsHstryService.java
  2. 1
      src/main/java/com/palnet/biz/jpa/repository/ctr/CtrCntrlQueryRepository.java

72
src/main/java/com/palnet/biz/api/anls/hstry/service/AnlsHstryService.java

@ -80,8 +80,6 @@ public class AnlsHstryService {
//비행이력현황 list //비행이력현황 list
public ComnPagingRs<AnlsHstryModel> list(AnlsHstryGroupModel rq){ public ComnPagingRs<AnlsHstryModel> list(AnlsHstryGroupModel rq){
Integer cstmrSno = jwtTokenUtil.getCstmrSnoByToken(); Integer cstmrSno = jwtTokenUtil.getCstmrSnoByToken();
List<JwtGroupModel> groupAuthList = jwtTokenUtil.getGroupAuthByToken();
String groupAuth = null;
String appAuth = jwtTokenUtil.getUserAuthByToken(); String appAuth = jwtTokenUtil.getUserAuthByToken();
List<AnlsHstryModel>resultList = new ArrayList<>(); List<AnlsHstryModel>resultList = new ArrayList<>();
@ -89,53 +87,40 @@ public class AnlsHstryService {
Pageable pageable = PageRequest.of(rq.getPage()-1, rq.getRecord()); Pageable pageable = PageRequest.of(rq.getPage()-1, rq.getRecord());
if("USER".equals(appAuth) || "ROLE_USER".equals(appAuth)) { if("USER".equals(appAuth) || "ROLE_USER".equals(appAuth)) {
for(JwtGroupModel list : groupAuthList) { if("NORMAL".equals(rq.getGroupId())) {
if(list.getGroupId().equals(rq.getGroupId())) { List<ComIdntfBas> idntfList = comIdntBasRepository.findIdntfNumber(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 NORMAL인 ID인 경우 본인이 생성한 기체만 조회 */
groupAuth = list.getGroupAuthCd(); if (idntfList.size() > 0) {
} for (ComIdntfBas list : idntfList) {
} List<AnlsHstryModel> results = query.cntrlBasNormalHstryList(rq, list.getIdntfNum());
if("NORMAL".equals(groupAuth)) { if (results.size() > 0) {
List<ComIdntfBas> idntfList = comIdntBasRepository.findIdntfNumber(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 NORMAL인 ID인 경우 본인이 생성한 기체만 조회 */ resultList.addAll(results);
if (idntfList.size() > 0) {
for (ComIdntfBas list : idntfList) {
List<AnlsHstryModel> results = query.cntrlBasNormalHstryList(rq, list.getIdntfNum());
if (results.size() > 0) {
resultList.addAll(results);
}
} }
} }
List<FltPlanBas> basResult = fltPlanBasRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 }
NORMAL인 ID인 경우 cstmrSno로 비행계획서 조회 */ List<FltPlanBas> basResult = fltPlanBasRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두
for (FltPlanBas list : basResult) { NORMAL인 ID인 경우 cstmrSno로 비행계획서 조회 */
resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno())); for (FltPlanBas list : basResult) {
} resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno()));
List<FltPlanPilot> pilotResult = fltPlanPilotRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도 }
모두 NORMAL인 ID인 경우 cstmrSno로 조종사 조회 */ List<FltPlanPilot> pilotResult = fltPlanPilotRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도
모두 NORMAL인 ID인 경우 cstmrSno로 조종사 조회 */
for (FltPlanPilot list : pilotResult) { for (FltPlanPilot list : pilotResult) {
resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno())); resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno()));
}
Comparator<AnlsHstryModel> 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);
Comparator<AnlsHstryModel> 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);
long totalPage = resultList.size() % rq.getRecord() > 0 ? (resultList.size()/rq.getRecord()) + 1 : resultList.size()/rq.getRecord();
PageImpl<AnlsHstryModel> result = new PageImpl<>(resultList, pageable, resultList.size());
response.setItems(result.getContent());
response.setTotal(resultList.size());
response.setTotalPage(totalPage);
response.setPage(rq.getPage());
return response;
}
} }
}else {
PageImpl<AnlsHstryModel> result = query.listCntrlBasRs(rq, pageable); PageImpl<AnlsHstryModel> result = query.listCntrlBasRs(rq, pageable);
long total = query.countCntrlBasRs(rq, cstmrSno); long total = query.countCntrlBasRs(rq, cstmrSno);
@ -144,6 +129,7 @@ public class AnlsHstryService {
response.setTotal(total); response.setTotal(total);
response.setTotalPage(totalPage); response.setTotalPage(totalPage);
response.setPage(rq.getPage()); response.setPage(rq.getPage());
}
return response; return response;
} }

1
src/main/java/com/palnet/biz/jpa/repository/ctr/CtrCntrlQueryRepository.java

@ -263,6 +263,7 @@ public List<AnlsHstryModel> cntrlBasNormalHstryList(AnlsHstryGroupModel rq, Stri
BooleanBuilder builder = new BooleanBuilder(); BooleanBuilder builder = new BooleanBuilder();
log.debug("Params ===> " +rq.toString());
Calendar end = Calendar.getInstance(); Calendar end = Calendar.getInstance();
end.setTime(DateUtils.stringToDate(rq.getEndDate())); end.setTime(DateUtils.stringToDate(rq.getEndDate()));
end.add(Calendar.DATE, 1); end.add(Calendar.DATE, 1);

Loading…
Cancel
Save