Browse Source

비행건수 계획서 없는데 완료 카운트 되는 현상 수정

pull/16/head
지대한 10 months ago
parent
commit
4e6ae1b998
  1. 2
      pav-server/src/main/java/com/palnet/biz/api/bas/laanc/service/BasLaancService.java
  2. 40
      pav-server/src/main/java/com/palnet/biz/api/main/dash/service/MainDashService.java

2
pav-server/src/main/java/com/palnet/biz/api/bas/laanc/service/BasLaancService.java

@ -216,7 +216,7 @@ public class BasLaancService {
corpRegYn = isCorpReg ? "Y" : "N"; corpRegYn = isCorpReg ? "Y" : "N";
} }
fltPlanBas.setCorpRegYn(corpRegYn); // 사업자유무 fltPlanBas.setCorpRegYn(corpRegYn); // 사업자유무
fltPlanBas.setServiceType("PAV-KAC"); fltPlanBas.setServiceType("F0002");
FltPlanBas rBasEntity = fltPlanBasRepository.save(fltPlanBas); FltPlanBas rBasEntity = fltPlanBasRepository.save(fltPlanBas);
Integer planSno = rBasEntity.getPlanSno(); Integer planSno = rBasEntity.getPlanSno();

40
pav-server/src/main/java/com/palnet/biz/api/main/dash/service/MainDashService.java

@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.Instant; import java.time.Instant;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -399,30 +400,31 @@ public class MainDashService {
return result; return result;
} }
public List<MainDashFlightNumStcsModel> dailyFlightNumOfStcs(){ public List<MainDashFlightNumStcsModel> dailyFlightNumOfStcs() {
// SUPER 권한일 경우와 KAC의 기관코드일 경우 전체적으로 모니터링 가능해야한다. 그외는 자신의 기관에 해당하는 데이터 볼 수 있어야 한다. // SUPER 권한일 경우와 KAC의 기관코드일 경우 전체적으로 모니터링 가능해야한다. 그외는 자신의 기관에 해당하는 데이터 볼 수 있어야 한다.
String userAuthByToken = token.getUserAuthByToken(); String userAuthByToken = token.getUserAuthByToken();
String cptAuthCodeByToken = token.getCptAuthCodeByToken(); String cptAuthCodeByToken = token.getCptAuthCodeByToken();
String serviceType = ""; String serviceType = "";
if(!"SUPER".equals(userAuthByToken) && !"KAC".equals(cptAuthCodeByToken)){ if (!"SUPER".equals(userAuthByToken) && !"KAC".equals(cptAuthCodeByToken)) {
serviceType = cptAuthCodeByToken; serviceType = cptAuthCodeByToken;
} }
// 1. 전일 , 금일, 명일(내일) // 1. 전일 , 금일, 명일(내일)
Instant yesterdayStart = Instant.now().minus(1, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS); // ZoneId zoneId = ZoneId.systemDefault();
Instant yesterdayEnd = Instant.now().truncatedTo(ChronoUnit.DAYS); ZoneId zoneId = ZoneId.of("Asia/Seoul");
Instant todayStart = Instant.now().truncatedTo(ChronoUnit.DAYS); Instant yesterdayStart = Instant.now().atZone(zoneId).minusDays(1).truncatedTo(ChronoUnit.DAYS).toInstant();
Instant todayEnd = Instant.now().plus(1, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS); Instant yesterdayEnd = Instant.now().atZone(zoneId).truncatedTo(ChronoUnit.DAYS).toInstant();
Instant tomorrowStart = Instant.now().plus(1, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS); Instant todayStart = Instant.now().atZone(zoneId).truncatedTo(ChronoUnit.DAYS).toInstant();
Instant tomorrowEnd = Instant.now().plus(2, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS); Instant todayEnd = Instant.now().atZone(zoneId).plusDays(1).truncatedTo(ChronoUnit.DAYS).toInstant();
Instant tomorrowEnd2 = Instant.now().plus(2, ChronoUnit.DAYS).minus(1, ChronoUnit.SECONDS); Instant tomorrowStart = Instant.now().atZone(zoneId).plusDays(1).truncatedTo(ChronoUnit.DAYS).toInstant();
Instant tomorrowEnd = Instant.now().atZone(zoneId).plusDays(2).truncatedTo(ChronoUnit.DAYS).toInstant();
// 2. 비행계획서 승인 항목 : 비행계획서 제출기준(승인된 건수로봐도 동일) // 2. 비행계획서 승인 항목 : 비행계획서 제출기준(승인된 건수로봐도 동일)
int yesterdayCount = 0; int yesterdayCount = 0;
int todayCount = 0; int todayCount = 0;
int tomorrowCount = 0; int tomorrowCount = 0;
if(serviceType != null && !serviceType.isEmpty()){ if (serviceType != null && !serviceType.isEmpty()) {
yesterdayCount = fltPlanBasRepository.countByAprvlYnAndSchFltStDtLessThanAndSchFltEndDtGreaterThanEqualAndServiceType("Y", yesterdayEnd, yesterdayStart, serviceType); yesterdayCount = fltPlanBasRepository.countByAprvlYnAndSchFltStDtLessThanAndSchFltEndDtGreaterThanEqualAndServiceType("Y", yesterdayEnd, yesterdayStart, serviceType);
todayCount = fltPlanBasRepository.countByAprvlYnAndSchFltStDtLessThanAndSchFltEndDtGreaterThanEqualAndServiceType("Y", todayEnd, todayStart, serviceType); todayCount = fltPlanBasRepository.countByAprvlYnAndSchFltStDtLessThanAndSchFltEndDtGreaterThanEqualAndServiceType("Y", todayEnd, todayStart, serviceType);
tomorrowCount = fltPlanBasRepository.countByAprvlYnAndSchFltStDtLessThanAndSchFltEndDtGreaterThanEqualAndServiceType("Y", tomorrowEnd, tomorrowStart, serviceType); tomorrowCount = fltPlanBasRepository.countByAprvlYnAndSchFltStDtLessThanAndSchFltEndDtGreaterThanEqualAndServiceType("Y", tomorrowEnd, tomorrowStart, serviceType);
@ -442,14 +444,14 @@ public class MainDashService {
// : fltPlanBasRepository.countByAprvlYnAndAprvlDtBetween("Y", tomorrowStart, tomorrowEnd) // : fltPlanBasRepository.countByAprvlYnAndAprvlDtBetween("Y", tomorrowStart, tomorrowEnd)
// 3. 비행 완료 항목 : 실제 비행이 완료된 건수 // 3. 비행 완료 항목 : 실제 비행이 완료된 건수
int yesterdayCompleteCount = query.completeFlight(yesterdayStart,yesterdayEnd,serviceType).size(); int yesterdayCompleteCount = query.completeFlight(yesterdayStart, yesterdayEnd, serviceType).size();
int todayCompleteCount = query.completeFlight(todayStart,todayEnd,serviceType).size(); int todayCompleteCount = query.completeFlight(todayStart, todayEnd, serviceType).size();
int tomorrowCompleteCount = query.completeFlight(tomorrowStart,tomorrowEnd,serviceType).size(); int tomorrowCompleteCount = query.completeFlight(tomorrowStart, tomorrowEnd, serviceType).size();
// 4. 미 비행 항목 : 비행계획서는 제출했으나,실제 비행안한 건수 // 4. 미 비행 항목 : 비행계획서는 제출했으나,실제 비행안한 건수
int yesterdayNotFlight = query.notFlight(yesterdayStart,yesterdayEnd, serviceType).size(); int yesterdayNotFlight = query.notFlight(yesterdayStart, yesterdayEnd, serviceType).size();
int todayNotFlight = query.notFlight(todayStart, todayEnd, serviceType).size(); int todayNotFlight = query.notFlight(todayStart, todayEnd, serviceType).size();
int tomorrowNotFlight = query.notFlight(tomorrowStart,tomorrowEnd, serviceType).size(); int tomorrowNotFlight = query.notFlight(tomorrowStart, tomorrowEnd, serviceType).size();
// 5. 비고 : 비행 완료 건수를 기준으로 상승 또는 하락폭 적용 // 5. 비고 : 비행 완료 건수를 기준으로 상승 또는 하락폭 적용
// ex) 오늘 기준 오늘은 어제의 비행 완료 건수를 비교해서 적용 // ex) 오늘 기준 오늘은 어제의 비행 완료 건수를 비교해서 적용
@ -457,13 +459,13 @@ public class MainDashService {
// 명일(내일)은 오늘 비행 완료 건수를 비교해서 적용 // 명일(내일)은 오늘 비행 완료 건수를 비교해서 적용
int yesterdayNote = yesterdayCompleteCount - query.completeFlight(yesterdayStart.minus(1, ChronoUnit.DAYS), yesterdayEnd.minus(1, ChronoUnit.DAYS), serviceType).size(); int yesterdayNote = yesterdayCompleteCount - query.completeFlight(yesterdayStart.minus(1, ChronoUnit.DAYS), yesterdayEnd.minus(1, ChronoUnit.DAYS), serviceType).size();
double yesterdayNotePercent = yesterdayCompleteCount != 0 ? ((double) yesterdayNote / yesterdayCompleteCount) * 100.0 : 0.0; double yesterdayNotePercent = yesterdayCompleteCount != 0 ? ((double) yesterdayNote / yesterdayCompleteCount) * 100.0 : 0.0;
double todayNotePercent = yesterdayCompleteCount != 0 ? ((double)(todayCompleteCount - yesterdayCompleteCount) / yesterdayCompleteCount) * 100.0 : 0.0; double todayNotePercent = yesterdayCompleteCount != 0 ? ((double) (todayCompleteCount - yesterdayCompleteCount) / yesterdayCompleteCount) * 100.0 : 0.0;
double tomorrowNotePercent = todayCompleteCount != 0 ? ((double) (tomorrowCompleteCount - todayCompleteCount) / todayCompleteCount) * 100.0 : 0.0; double tomorrowNotePercent = todayCompleteCount != 0 ? ((double) (tomorrowCompleteCount - todayCompleteCount) / todayCompleteCount) * 100.0 : 0.0;
List<MainDashFlightNumStcsModel> result = new ArrayList<>(); List<MainDashFlightNumStcsModel> result = new ArrayList<>();
result.add(createModel("yesterday", yesterdayCount,yesterdayCompleteCount,yesterdayNotFlight,yesterdayNotePercent)); result.add(createModel("yesterday", yesterdayCount, yesterdayCompleteCount, yesterdayNotFlight, yesterdayNotePercent));
result.add(createModel("today", todayCount,todayCompleteCount,todayNotFlight,todayNotePercent)); result.add(createModel("today", todayCount, todayCompleteCount, todayNotFlight, todayNotePercent));
result.add(createModel("tomorrow", tomorrowCount,tomorrowCompleteCount,tomorrowNotFlight,tomorrowNotePercent)); result.add(createModel("tomorrow", tomorrowCount, tomorrowCompleteCount, tomorrowNotFlight, tomorrowNotePercent));
return result; return result;
} }

Loading…
Cancel
Save