Browse Source

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

This reverts commit 66ec05ecf9.
Test
qkr7828(박재우) 2 years ago
parent
commit
f3d86af4e0
  1. 78
      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

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

@ -80,6 +80,8 @@ 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<>();
@ -87,40 +89,53 @@ 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)) {
if("NORMAL".equals(rq.getGroupId())) { for(JwtGroupModel list : groupAuthList) {
List<ComIdntfBas> idntfList = comIdntBasRepository.findIdntfNumber(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 NORMAL인 ID인 경우 본인이 생성한 기체만 조회 */ if(list.getGroupId().equals(rq.getGroupId())) {
if (idntfList.size() > 0) { groupAuth = list.getGroupAuthCd();
for (ComIdntfBas list : idntfList) { }
List<AnlsHstryModel> results = query.cntrlBasNormalHstryList(rq, list.getIdntfNum()); }
if (results.size() > 0) { if("NORMAL".equals(groupAuth)) {
resultList.addAll(results); List<ComIdntfBas> idntfList = comIdntBasRepository.findIdntfNumber(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 NORMAL인 ID인 경우 본인이 생성한 기체만 조회 */
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 권한도 모두
List<FltPlanBas> basResult = fltPlanBasRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도 모두 NORMAL인 ID인 경우 cstmrSno로 비행계획서 조회 */
NORMAL인 ID인 경우 cstmrSno로 비행계획서 조회 */ for (FltPlanBas list : basResult) {
for (FltPlanBas list : basResult) { resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno()));
resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno()));
}
List<FltPlanPilot> pilotResult = fltPlanPilotRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도
모두 NORMAL인 ID인 경우 cstmrSno로 조종사 조회 */
for (FltPlanPilot list : pilotResult) {
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; List<FltPlanPilot> pilotResult = fltPlanPilotRepository.findByPlanSno(cstmrSno); /* App 권한이 유저이면서 group 권한도
}; 모두 NORMAL인 ID인 경우 cstmrSno로 조종사 조회 */
Collections.sort(resultList, comparator);
for (FltPlanPilot list : pilotResult) {
} resultList.addAll(query.cntrlBasNormalPlanHstryList(rq, list.getPlanSno()));
}else { }
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;
}
}
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);
@ -129,7 +144,6 @@ 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,7 +263,6 @@ 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