Compare commits

..

No commits in common. 'feature/ldra' and 'master' have entirely different histories.

  1. 41
      src/main/java/com/palnet/biz/api/acnt/crtfyhp/controller/AcntCrtfyhpController.java
  2. 25
      src/main/java/com/palnet/biz/api/acnt/cstmr/controller/AcntCstmrController.java
  3. 2
      src/main/java/com/palnet/biz/api/acnt/cstmr/service/AcntCstmrService.java
  4. 17
      src/main/java/com/palnet/biz/api/acnt/jwt/controller/JwtAuthenticationController.java
  5. 3
      src/main/java/com/palnet/biz/api/acnt/jwt/service/JwtService.java
  6. 6
      src/main/java/com/palnet/biz/api/acnt/terms/controller/AcntTermsController.java
  7. 16
      src/main/java/com/palnet/biz/api/anls/hstry/controller/AnlsHstryController.java
  8. 21
      src/main/java/com/palnet/biz/api/anls/smlt/controller/AnlsSmltController.java
  9. 35
      src/main/java/com/palnet/biz/api/bas/dron/controller/BasDronController.java
  10. 5
      src/main/java/com/palnet/biz/api/bas/dron/service/BasDronService.java
  11. 112
      src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java
  12. 47
      src/main/java/com/palnet/biz/api/bas/flight/service/BasFlightService.java
  13. 9
      src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupAprvController.java
  14. 40
      src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupController.java
  15. 12
      src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupJoinController.java
  16. 12
      src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupUserController.java
  17. 17
      src/main/java/com/palnet/biz/api/bas/group/service/BasGroupService.java
  18. 48
      src/main/java/com/palnet/biz/api/ctr/cntrl/controller/CtrCntrlController.java
  19. 11
      src/main/java/com/palnet/biz/api/ctr/cntrl/service/CtrCntrlService.java
  20. 23
      src/main/java/com/palnet/biz/api/main/dash/controller/MainDashController.java
  21. 2
      src/main/java/com/palnet/biz/config/SwaggerConfig.java
  22. 116
      src/main/java/com/palnet/comn/encrptn/kisa/KISA_SEED_CBC.java
  23. 39
      src/main/java/com/palnet/comn/encrptn/kisa/KISA_SHA256.java
  24. 9
      src/main/java/com/palnet/comn/utils/EncryptUtils.java
  25. 11
      src/main/java/com/palnet/comn/utils/HttpUtils.java
  26. 20
      src/main/java/com/palnet/comn/utils/LocationUtils.java
  27. 20
      src/main/java/com/palnet/server/command/TempUtils.java
  28. 4
      src/main/java/com/palnet/server/task/ctr/service/CtrCntrlTaskService.java
  29. 2
      src/main/resources/application.properties

41
src/main/java/com/palnet/biz/api/acnt/crtfyhp/controller/AcntCrtfyhpController.java

@ -3,7 +3,6 @@ package com.palnet.biz.api.acnt.crtfyhp.controller;
import java.util.HashMap;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@ -35,7 +34,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/acnt/crtfyhp", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(tags = {"Mobile Phone Authentication API"} , value = "AcntCrtfyhpController")
@Tag(name = "휴대폰 인증 관리", description = "회원 휴대폰 인증 관련 API")
public class AcntCrtfyhpController {
@Autowired
@ -46,7 +45,8 @@ public class AcntCrtfyhpController {
@GetMapping(value = "/register/send")
@ApiImplicitParam(name = "hnpo",value = "hnpo", dataTypeClass = String.class)
@Tag(name = "휴대폰 인증 관리", description = "회원 휴대폰 인증 관련 API")
@ApiImplicitParam(name = "hnpo",value = "휴대폰번호", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> send(String hpno) {
@ -87,9 +87,10 @@ public class AcntCrtfyhpController {
@GetMapping(value = "/register/confirm")
@Tag(name = "휴대폰 인증 관리", description = "회원 휴대폰 인증 관련 API")
@ApiImplicitParams({
@ApiImplicitParam(name = "hpno",value = "hpno", dataTypeClass = String.class),
@ApiImplicitParam(name = "crtfyNo",value = "crtfyNo", dataTypeClass = String.class)
@ApiImplicitParam(name = "hpno",value = "휴대폰번호", dataTypeClass = String.class),
@ApiImplicitParam(name = "crtfyNo",value = "인증일련번호", dataTypeClass = String.class)
})
public ResponseEntity<? extends BasicResponse> confirm(String hpno , String crtfyNo) {
@ -121,10 +122,11 @@ public class AcntCrtfyhpController {
//아이디 찾기 시 인증번호 발송 로직
@GetMapping(value = "/find/sendForId")
@ApiOperation(value = "Find Id and Send crftyNo")
@ApiOperation(value = "아이디 찾기 시 인증번호 발송")
@Tag(name = "휴대폰 인증 관리", description = "회원 휴대폰 인증 관련 API")
@ApiImplicitParams({
@ApiImplicitParam(name = "memberName", value = "memberName", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno", value = "hpno", dataTypeClass = String.class)
@ApiImplicitParam(name = "memberName", value = "회원 이름", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno", value = "휴대폰 번호", dataTypeClass = String.class)
})
public ResponseEntity<? extends BasicResponse> sendForId(String memberName, String hpno) {
Map<String, Object> resultMap = new HashMap<String, Object>();
@ -152,10 +154,11 @@ public class AcntCrtfyhpController {
//아이디 찾기
@GetMapping(value = "/find/findUserId")
@ApiOperation(value = "Find Member Id")
@ApiOperation(value = "회원 아이디 찾기")
@Tag(name = "휴대폰 인증 관리", description = "회원 휴대폰 인증 관련 API")
@ApiImplicitParams({
@ApiImplicitParam(name = "memberName",value = "memberName", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno",value = "hpno", dataTypeClass = String.class)
@ApiImplicitParam(name = "memberName",value = "회원이름", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno",value = "휴대폰번호", dataTypeClass = String.class)
})
public ResponseEntity<? extends BasicResponse> findUserId(String memberName, String hpno) {
Map<String, Object> resultMap = new HashMap<String, Object>();
@ -185,10 +188,11 @@ public class AcntCrtfyhpController {
//비밀번호 찾기 시 인증번호 발송 로직
@GetMapping(value = "/find/sendForPw")
@ApiOperation(value = "Find PW and Send crtfyNo")
@ApiOperation(value = "비밀번호 찾기 시 인증번호 발송")
@Tag(name = "휴대폰 인증 관리", description = "회원 휴대폰 인증 관련 API")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId",value = "userId", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno",value = "hpno", dataTypeClass = String.class)
@ApiImplicitParam(name = "userId",value = "사용자ID", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno",value = "휴대폰번호", dataTypeClass = String.class)
})
public ResponseEntity<? extends BasicResponse> sendForPw(String userId, String hpno) {
Map<String, Object> resultMap = new HashMap<String, Object>();
@ -217,11 +221,12 @@ public class AcntCrtfyhpController {
@GetMapping(value = "/find/updatePw")
@ApiOperation(value = "Find PW and UPDATE PW")
@ApiOperation(value = "비밀번호 찾기 및 업데이트")
@Tag(name = "휴대폰 인증 관리", description = "회원 휴대폰 인증 관련 API")
@ApiImplicitParams({
@ApiImplicitParam(name = "userID",value = "userID", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno",value = "hpno", dataTypeClass = String.class),
@ApiImplicitParam(name = "newPw",value = "newPw", dataTypeClass = String.class)
@ApiImplicitParam(name = "userID",value = "사용자ID", dataTypeClass = String.class),
@ApiImplicitParam(name = "hpno",value = "휴대폰번호", dataTypeClass = String.class),
@ApiImplicitParam(name = "newPw",value = "새로운 비밀번호", dataTypeClass = String.class)
})
public ResponseEntity<? extends BasicResponse> updatePw(String userId, String hpno, String newPw) throws Exception {
Map<String, Object> resultMap = new HashMap<String, Object>();

25
src/main/java/com/palnet/biz/api/acnt/cstmr/controller/AcntCstmrController.java

@ -11,7 +11,6 @@ import com.palnet.biz.api.acnt.cstmr.model.AcntCstmrEmModel;
import com.palnet.biz.api.acnt.cstmr.model.AcntCstmrGroupModel;
import com.palnet.biz.api.acnt.cstmr.model.AcntCstmrPwModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Parameter;
@ -51,14 +50,15 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/acnt/cstmr", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(tags = {"Member Management API"}, value = "AcntCstmrController")
@Tag(name = "회원관리", description = "회원 관련 API")
public class AcntCstmrController {
@Autowired
private final AcntCstmrService service;
@PostMapping(value = "/register")
@ApiOperation(value = "Join User")
@ApiOperation(value = "회원 가입")
@Tag(name = "회원관리", description = "회원 관련 API")
public ResponseEntity<? extends BasicResponse> register(@RequestBody AcntCstmrRqModel rq) {
AcntCstmrRsModel result;
@ -79,8 +79,9 @@ public class AcntCstmrController {
}
@GetMapping(value = "/profile/{cstmrSno}")
@ApiOperation(value = "User Info")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "회원 정보")
@Tag(name = "회원관리", description = "회원 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> mypage(@PathVariable Integer cstmrSno){
List<AnctCstmerRlModel> result = null;
@ -99,7 +100,8 @@ public class AcntCstmrController {
}
@PostMapping(value = "/profile/pswdupdate")
@ApiOperation(value = "Password Update")
@ApiOperation(value = "회원 패스워드 변경")
@Tag(name = "회원관리", description = "회원 관련 API")
public ResponseEntity<? extends BasicResponse> passwordupdate(@RequestBody AcntCstmrPwModel rq){
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -121,7 +123,8 @@ public class AcntCstmrController {
}
@PostMapping(value = "/profile/pwcheck")
@ApiOperation(value = "Member Check Existing PW")
@ApiOperation(value = "회원 기존 패스워드 확인")
@Tag(name = "회원관리", description = "회원 관련 API")
public ResponseEntity<? extends BasicResponse> extendpsw(@RequestBody Map<String,String> userPswdMap){
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -143,7 +146,8 @@ public class AcntCstmrController {
}
@PutMapping(value = "/profile/update")
@ApiOperation(value = "Member Info update EMAIL,HPNO")
@ApiOperation(value = "회원 정보 변경 (이메일,핸드폰)")
@Tag(name = "회원관리", description = "회원 관련 API")
public ResponseEntity<? extends BasicResponse> updateEmail(@RequestBody AcntCstmrEmModel rq){
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -167,8 +171,9 @@ public class AcntCstmrController {
}
@PostMapping(value = "/profile/delete/{cstmrSno}")
@ApiOperation(value = "Member Delete")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "회원 탈퇴")
@Tag(name = "회원관리", description = "회원 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> userDelete(@PathVariable Integer cstmrSno){
Map<String, Object> resultMap = new HashMap<String, Object>();
try {

2
src/main/java/com/palnet/biz/api/acnt/cstmr/service/AcntCstmrService.java

@ -244,7 +244,7 @@ public class AcntCstmrService {
// 4. RQ의 암호화한 패스워드와 DB에서 조회한 유저의 패스워드랑 비교
if(!userPswd.equals(userEntity.getUserPswd())) {
log.info("USERPSWD PW : {}, DB PW : {}", userPswd, userEntity.getUserPswd());
log.info("USERPSWD 비밀번호 : {}, DB 비밀번호 : {}", userPswd, userEntity.getUserPswd());
// 4.e 일치하지 않으면 예외처리 (패스워드 불일치)
throw new CustomException(ErrorCode.FAIL); // 임시,, 수정해야함

17
src/main/java/com/palnet/biz/api/acnt/jwt/controller/JwtAuthenticationController.java

@ -3,7 +3,6 @@ package com.palnet.biz.api.acnt.jwt.controller;
import java.util.HashMap;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@ -45,7 +44,7 @@ import lombok.extern.log4j.Log4j2;
@RequiredArgsConstructor
@Log4j2
@RequestMapping(value = "/api/acnt/jwt", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(tags = {"JWT API"},value = "JwtAuthenticationController")
@Tag(name = "JWT 토큰 이용", description = "JWT 토큰 관련 API")
public class JwtAuthenticationController {
@Autowired
@ -59,7 +58,8 @@ public class JwtAuthenticationController {
private JwtService service;
@PostMapping(value = "/login")
@ApiOperation(value = "login")
@ApiOperation(value = "로그인")
@Tag(name = "JWT 토큰 이용", description = "JWT 토큰 관련 API")
public ResponseEntity<? extends BasicResponse> createAuthenticationToken(@RequestBody JwtRqModel authenticationRequest) throws Exception {
Map<String , Object> resultMap = service.loginProcess(authenticationRequest);
@ -82,8 +82,9 @@ public class JwtAuthenticationController {
}
@GetMapping(value = "/profile/{cstmrSno}")
@ApiOperation(value = "login user Info")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "로그인한 회원의 정보")
@Tag(name = "JWT 토큰 이용", description = "JWT 토큰 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> proflie(@PathVariable Integer cstmrSno) throws Exception{
JwtProfileRsModel result = service.profile(cstmrSno);
@ -96,6 +97,7 @@ public class JwtAuthenticationController {
@PostMapping(value = "/refresh")
@Tag(name = "JWT 토큰 이용", description = "JWT 토큰 관련 API")
// public ResponseEntity<? extends BasicResponse> refresh(@RequestParam("cstmrSno") int cstmrSno , @RequestParam("refreshToken") String refreshToken) throws Exception{
public ResponseEntity<? extends BasicResponse> refresh(@RequestBody Map body) throws Exception{
@ -123,8 +125,9 @@ public class JwtAuthenticationController {
}
@GetMapping(value = "/logout/{cstmrSno}")
@ApiOperation(value = "logout user Info")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "로그아웃 한 회원의 정보")
@Tag(name = "JWT 토큰 이용", description = "JWT 토큰 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> logout(@PathVariable Integer cstmrSno) throws Exception{
// if(cstmrSno == null || !(body.get("cstmrSno") instanceof Integer)) {

3
src/main/java/com/palnet/biz/api/acnt/jwt/service/JwtService.java

@ -187,8 +187,7 @@ public class JwtService {
Optional<PtyCstmrBas> optional = ptyCstmrBasRepository.findById(cstmrSno);
if (!optional.isPresent()) {
// throw new CustomException(ErrorCode.DATA_NOTFIND);
log.error("NO DATA FOUND");
throw new CustomException(ErrorCode.DATA_NOTFIND);
}
PtyCstmrBas entity = optional.get();

6
src/main/java/com/palnet/biz/api/acnt/terms/controller/AcntTermsController.java

@ -2,7 +2,6 @@ package com.palnet.biz.api.acnt.terms.controller;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,7 +37,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/acnt/terms", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "AcntTermsController", tags = {"Terms Basic API"})
@Tag(name = "약관 기본", description = "약관 관련 API")
public class AcntTermsController {
@Autowired
@ -47,7 +46,8 @@ public class AcntTermsController {
@GetMapping(value = "/list")
@ApiOperation(value = "Terms Info")
@Tag(name = "약관 기본", description = "약관 관련 API")
@ApiOperation(value = "약관 기본 정보")
public ResponseEntity<? extends BasicResponse> list(AcntTermsRqModel rq) {
List<AcntTermsRsModel> result = null;

16
src/main/java/com/palnet/biz/api/anls/hstry/controller/AnlsHstryController.java

@ -3,7 +3,6 @@ package com.palnet.biz.api.anls.hstry.controller;
import java.util.List;
import com.palnet.biz.api.comn.model.ComnPagingRs;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -35,7 +34,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/anls/hstry", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "AnlsHstryController",tags = {"Flight History Status API"})
@Tag(name = "비행 이력 현황", description = "비행 이력 현황 관련 API")
public class AnlsHstryController {
@Autowired
@ -43,7 +42,8 @@ public class AnlsHstryController {
@GetMapping(value = "/list")
@ApiOperation(value = "Flight Status List")
@ApiOperation(value = "비행 현황 목록 출력")
@Tag(name = "비행 이력 현황", description = "비행 이력 현황 관련 API")
public ResponseEntity<? extends BasicResponse> list(AnlsHstryGroupModel rq) {
List<AnlsHstryModel> rs = null;
ComnPagingRs<AnlsHstryModel> response;
@ -68,8 +68,9 @@ public class AnlsHstryController {
}
@GetMapping(value = "/detail/{id}")
@ApiOperation(value = "Flight Status Detail")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "비행 현황 상세")
@Tag(name = "비행 이력 현황", description = "비행 이력 현황 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> detail(@PathVariable String id) {
AnlsHstryModel result = null;
@ -88,8 +89,9 @@ public class AnlsHstryController {
@GetMapping(value = "/log/{id}")
@ApiOperation(value = "Flight History Log")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "비행 이력 데이터")
@Tag(name = "비행 이력 현황", description = "비행 이력 현황 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> log(@PathVariable String id) {
List<AnlsHstryDetailModel> result = null;
try {

21
src/main/java/com/palnet/biz/api/anls/smlt/controller/AnlsSmltController.java

@ -2,7 +2,6 @@ package com.palnet.biz.api.anls.smlt.controller;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@ -36,7 +35,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/anls/smlt", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "AnlsSmltController",tags = {"Flight History Simulation API"})
@Tag(name = "비행 시뮬레이션", description = "비행 이력 시뮬레이션 관련 API")
public class AnlsSmltController {
@Autowired
@ -48,7 +47,8 @@ public class AnlsSmltController {
* @return
*/
@GetMapping(value = "/list")
@ApiOperation(value = "Flight status List")
@ApiOperation(value = "비행 현황 목록")
@Tag(name = "비행 시뮬레이션", description = "비행 이력 시뮬레이션 관련 API")
public ResponseEntity<? extends BasicResponse> list(AnlsHstryRqModel rq) {
ComnPagingRs<AnlsHstryModel> result = null;
@ -82,8 +82,9 @@ public class AnlsSmltController {
* @return
*/
@GetMapping(value = "/hist/{id}")
@ApiOperation(value = "Flight History")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "비행 이력 데이터 조회")
@Tag(name = "비행 시뮬레이션", description = "비행 이력 시뮬레이션 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> histList(@PathVariable String id) {
List<AnlsHstryDetailModel> result = null;
@ -108,8 +109,9 @@ public class AnlsSmltController {
* @return
*/
@GetMapping(value = "/stcs/{id}")
@ApiOperation(value = "Query Statistical data")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "통계 데이터 조회")
@Tag(name = "비행 시뮬레이션", description = "비행 이력 시뮬레이션 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> stcsList(@PathVariable String id) {
List<AnlsSmltStcsModel> result = null;
@ -134,8 +136,9 @@ public class AnlsSmltController {
* @return
*/
@GetMapping(value = "/detail/{id}")
@ApiOperation(value = "Flight Detail")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "비행 상세정보 조회")
@Tag(name = "비행 시뮬레이션", description = "비행 이력 시뮬레이션 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> detail(@PathVariable String id) {
AnlsSmltDetailModel result = null;

35
src/main/java/com/palnet/biz/api/bas/dron/controller/BasDronController.java

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -41,7 +40,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/bas/dron", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "BasDronController",tags = {"Drone Information API"})
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
public class BasDronController {
@Autowired
@ -54,7 +53,8 @@ public class BasDronController {
* @return
*/
@GetMapping(value = "/list")
@ApiOperation(value = "Drone List")
@ApiOperation(value = "드론 목록 조회")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
public ResponseEntity<? extends BasicResponse> list(BasDronRqModel rq) {
ComnPagingRs<BasDronModel> result = null;
@ -85,8 +85,9 @@ public class BasDronController {
* @return
*/
@GetMapping(value = "/idntf/list/{id}")
@ApiOperation(value = "Idntf List")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = Integer.class)
@ApiOperation(value = "식별정보 조회")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
@ApiImplicitParam(name = "id",value = "기체일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> mylist(@PathVariable Integer id) {
List<BasIdntfModel> result = null;
@ -117,8 +118,9 @@ public class BasDronController {
* @return
*/
@GetMapping(value = "/detail/{id}")
@ApiOperation(value = "Drone Detail")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = Integer.class)
@ApiOperation(value = "드론 상세 조회")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
@ApiImplicitParam(name = "id",value = "기체일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> detail(@PathVariable Integer id) {
BasDronModel result = null;
@ -148,7 +150,8 @@ public class BasDronController {
* @return
*/
@PostMapping(value = "/create")
@ApiOperation(value = "Create Drone Info")
@ApiOperation(value = "드론정보 생성")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
public ResponseEntity<? extends BasicResponse> create(@RequestBody BasDronModel rq) {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -177,7 +180,8 @@ public class BasDronController {
* @return
*/
@PostMapping(value = "/idntf/create")
@ApiOperation(value = "Create Idntf")
@ApiOperation(value = "식별장치 생성")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
public ResponseEntity<? extends BasicResponse> createIdntf(@RequestBody BasIdntfRqModel rq) {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -208,7 +212,8 @@ public class BasDronController {
* @return
*/
@PutMapping(value = "/update")
@ApiOperation(value = "Update Drone Info")
@ApiOperation(value = "드론정보 수정")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
public ResponseEntity<? extends BasicResponse> update(@RequestBody BasDronModel rq) {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -239,8 +244,9 @@ public class BasDronController {
* @return
*/
@DeleteMapping(value = "/delete/{id}")
@ApiOperation(value = "Delete Drone Info")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = Integer.class)
@ApiOperation(value = "드론정보 삭제")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
@ApiImplicitParam(name = "id",value = "기체일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> delete(@PathVariable Integer id) {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -272,8 +278,9 @@ public class BasDronController {
* @return
*/
@DeleteMapping(value = "/idntf/delete/{id}")
@ApiOperation(value = "Delete Idntf")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "식별장치 삭제")
@Tag(name = "드론 컨트롤러", description = "드론 관련 API")
@ApiImplicitParam(name = "id",value = "식별번호", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> deleteIdntf(@PathVariable String id) {
Map<String , Object> resultMap = new HashMap<String,Object>();

5
src/main/java/com/palnet/biz/api/bas/dron/service/BasDronService.java

@ -272,7 +272,7 @@ public class BasDronService {
if(!query.isNotPrdctNum(rq.getPrdctNum() , rq.getArcrftSno())) {
throw new CustomException(ErrorCode.DATA_DUPLICATE);
}
//1. 기체 정보 수정
ComArcrftBas comArcrftBas = this.updateComArcrftBas(rq);
if(comArcrftBas == null) {
@ -325,8 +325,7 @@ public class BasDronService {
Optional<ComArcrftBas> optional = comArcrftBasRepository.findById(model.getArcrftSno());
if (!optional.isPresent()) {
// throw new CustomException(ErrorCode.DATA_NOTFIND);
log.error("NO DATA FOUND.");
throw new CustomException(ErrorCode.DATA_NOTFIND);
}
ComArcrftBas entity = optional.get();

112
src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java

@ -10,7 +10,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@ -58,7 +57,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping(value = "/api/bas/flight", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "BasFlightController",tags = {"Flight Plan API"})
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public class BasFlightController {
private final BasFlightService basFlightService;
@ -75,6 +74,7 @@ public class BasFlightController {
}
@GetMapping("/area")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<Object> findAirSpace() throws IOException, ParseException {
// 1. file read
Resource resource = new ClassPathResource("air/airgeo.json");
@ -99,9 +99,10 @@ public class BasFlightController {
// 비행계획서 조회
@GetMapping(value = "/plan/list")
@ApiOperation(value = "Flight Plan List")
@ApiOperation(value = "비행계획서 조회")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> findPlanList(BasFlightPlanListRq rq) {
ComnPagingRs<BasFlightPlanModel> result = null;
ComnPagingRs<BasFlightPlanModel> result = null;
// System.out.println(rq);
try {
result = basFlightService.listPlan(rq);
@ -116,8 +117,9 @@ public class BasFlightController {
// 비행계획서 상세 조회
@GetMapping(value = "/plan/detail/{planSno}")
@ApiOperation(value = "Flight Plan Detail")
@ApiImplicitParam(name = "planSno",value = "planSno", dataTypeClass = Integer.class)
@ApiOperation(value = "비행계획서 상세 조회")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
@ApiImplicitParam(name = "planSno",value = "비행계획서일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> detailPlan(@PathVariable("planSno") Integer planSno) {
BasFlightPlanModel result = null;
try {
@ -133,7 +135,8 @@ public class BasFlightController {
// 비행계획서 등록
@PostMapping(value = "/plan/create")
@ApiOperation(value = "Create Flight Plan")
@ApiOperation(value = "비행계획서 등록")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> createPlan(@RequestBody BasFlightPlanModel rq) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -159,7 +162,8 @@ public class BasFlightController {
// 비행계획서 수정
@PutMapping(value = "/plan/update")
@ApiOperation(value = "Update Flight Plan")
@ApiOperation(value = "비행계획서 수정")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> updatePlan(@RequestBody BasFlightPlanModel rq) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -183,8 +187,9 @@ public class BasFlightController {
// 비행계획서 삭제
@DeleteMapping(value = "/plan/delete/{planSno}")
@ApiOperation(value = "Delete Flight Plan")
@ApiImplicitParam(name = "planSno",value = "planSno", dataTypeClass = Integer.class)
@ApiOperation(value = "비행계획서 삭제")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
@ApiImplicitParam(name = "planSno",value = "비행계획서일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> deletePlan(@PathVariable("planSno") Integer planSno) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -207,8 +212,9 @@ public class BasFlightController {
// 그룹 조종사 조회
@GetMapping(value = "/plan/pilot/{groupId}")
@ApiOperation(value = "Group Pilot List")
@ApiImplicitParam(name = "groupId",value = "groupId", dataTypeClass = String.class)
@ApiOperation(value = "그룹의 조종사 조회")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
@ApiImplicitParam(name = "groupId",value = "그룹ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> findPilot(@PathVariable("groupId") String groupId) {
List<BasFlightPlanPilotModel> result = null;
try {
@ -225,8 +231,9 @@ public class BasFlightController {
}
// 그룹 기체 조회
@GetMapping(value = "/plan/arcrft/{groupId}")
@ApiOperation(value = "Group Arcrft")
@ApiImplicitParam(name = "groupId",value = "groupId", dataTypeClass = String.class)
@ApiOperation(value = "그룹의 기체 조회")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
@ApiImplicitParam(name = "groupId",value = "그룹ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> findArcrft(@PathVariable("groupId") String groupId) {
List<BasFlightPlanArcrftModel> result = null;
try {
@ -243,7 +250,8 @@ public class BasFlightController {
// 비행 구역 버퍼 존 생성
@PostMapping("/plan/area/buffer")
@ApiOperation(value = "Flight area buffer Create")
@ApiOperation(value = "비행 구역 버퍼 존 생성")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> findBuffer(@RequestBody List<BasFlightPlanAreaModel> rq) {
List<BasFlightPlanAreaModel> rs = null;
try {
@ -258,26 +266,28 @@ public class BasFlightController {
}
@GetMapping("/plan/api/weather")
@ApiOperation(value = "Flight Plan Weather")
@ApiOperation(value = "비행계획서 날씨")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> restApiGetWeather(BasFlightWeatherModel rq){
JSONObject jsonObject = null;
try {
jsonObject = basFlightService.getWeather(rq);
} catch (Exception e) {
log.error("IGNORE : {}", e);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(new ErrorResponse("Server Error", "-1"));
}
JSONObject jsonObject = null;
try {
jsonObject = basFlightService.getWeather(rq);
} catch (Exception e) {
log.error("IGNORE : {}", e);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(new ErrorResponse("Server Error", "-1"));
}
return ResponseEntity.ok().body(new SuccessResponse<>(jsonObject));
}
// 비행계획서 리스트(승인)
@GetMapping(value = "/aprv/list")
@ApiOperation(value = "Flight Plan Aprv List")
@ApiOperation(value = "비행계획서 리스트(승인)")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> findAprvList(BasFlightPlanListRq rq) {
ComnPagingRs<BasFlightPlanModel> result = null;
ComnPagingRs<BasFlightPlanModel> result = null;
try {
result = basFlightService.aprvList(rq);
} catch (Exception e) {
@ -290,7 +300,8 @@ public class BasFlightController {
}
// 비행계획서 승인/미승인
@PutMapping(value = "/aprv/proc")
@ApiOperation(value = "Flight Plan aprv/proc")
@ApiOperation(value = "비행 계획서 승인/미승인")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> updateAprvProc(@RequestBody BasFlightAprovRq rq) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -313,6 +324,7 @@ public class BasFlightController {
}
@PostMapping("/airspace/contains")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> checkAirspaceContains(@RequestBody List<BasFlightPlanAreaModel> rq) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
@ -328,31 +340,33 @@ public class BasFlightController {
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap));
}
//지역 검색
@GetMapping("/plan/area/search")
@ApiOperation(value = "Search area")
public ResponseEntity<? extends BasicResponse> searchArea(String query) throws ParseException{
String text = null;
try {
text = URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Search Encoding Fail", e);
}
String apiURL = env.getProperty("api.naver.search-url") + "?query=" + text + "&display=5";
Map<String, String> requestHeaders = new HashMap<>();
requestHeaders.put("X-Naver-Client-Id", env.getProperty("api.naver.client-id"));
requestHeaders.put("X-Naver-Client-Secret", env.getProperty("api.naver.client-secret-key"));
String responseBody = basFlightService.searchArea(apiURL, requestHeaders);
JSONParser parser = new JSONParser();
Object obj = parser.parse(responseBody);
return ResponseEntity.ok().body(new SuccessResponse<>(obj));
}
@ApiOperation(value = "지역 검색")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> searchArea(String query) throws ParseException {
String text = null;
try {
text = URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("검색어 인코딩 실패", e);
}
String apiURL = env.getProperty("api.naver.search-url") + "?query=" + text + "&display=5";
Map<String, String> requestHeaders = new HashMap<>();
requestHeaders.put("X-Naver-Client-Id", env.getProperty("api.naver.client-id"));
requestHeaders.put("X-Naver-Client-Secret", env.getProperty("api.naver.client-secret-key"));
String responseBody = basFlightService.searchArea(apiURL, requestHeaders);
JSONParser parser = new JSONParser();
Object obj = parser.parse(responseBody);
return ResponseEntity.ok().body(new SuccessResponse<>(obj));
}
@GetMapping("/schedule")
@Tag(name = "비행계획서", description = "비행계획서 관련 API")
public ResponseEntity<? extends BasicResponse> findSchedule(@RequestParam("searchDate") String searchDate) {
List<BasFlightScheduleRs> response;

47
src/main/java/com/palnet/biz/api/bas/flight/service/BasFlightService.java

@ -15,7 +15,6 @@ import java.util.stream.Collectors;
import javax.xml.bind.JAXBException;
import com.jcraft.jsch.IO;
import org.apache.commons.lang3.StringUtils;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@ -83,7 +82,6 @@ public class BasFlightService {
@Value("${weather.api.key}")
private String weatherKey;
private final FltPlanBasRepository fltPlanBasRepository;
private final FltPlanArcrftRepository fltPlanArcrftRepository;
private final FltPlanAreaRepository fltPlanAreaRepository;
@ -202,7 +200,7 @@ public class BasFlightService {
return rs;
}
public void planValid(BasFlightPlanModel rq){
public void planValid(BasFlightPlanModel rq) {
boolean isEqualsFltElev = false;
List<BasFlightPlanAreaModel> rqAreaList = rq.getAreaList();
String rqFltElev = rqAreaList.get(0).getFltElev();
@ -310,14 +308,10 @@ public class BasFlightService {
// 비행계획서 등록
@Transactional
public void createPlan(BasFlightPlanModel rq) throws IOException, JAXBException{
public void createPlan(BasFlightPlanModel rq) throws IOException, JAXBException {
try {
// 비행계획서 유효성 검사.
this.planValid(rq);
}catch (RuntimeException e) {
throw new CustomException(ErrorCode.FAIL);
}
// 비행계획서 유효성 검사.
this.planValid(rq);
// 비행계획서
String userId = jwtTokenUtil.getUserIdByToken();
@ -394,13 +388,10 @@ public class BasFlightService {
// 비행계획서 수정
@Transactional
public boolean updatePlan(BasFlightPlanModel rq) throws IOException, JAXBException{
try {
// 비행계획서 유효성 검사.
this.planValid(rq);
}catch (RuntimeException e) {
throw new CustomException(ErrorCode.FAIL);
}
public boolean updatePlan(BasFlightPlanModel rq) throws IOException, JAXBException {
// 비행계획서 유효성 검사.
this.planValid(rq);
if (rq != null && rq.getPlanSno() != null) {
String userId = jwtTokenUtil.getUserIdByToken();
@ -686,36 +677,37 @@ public class BasFlightService {
return readBody(con.getErrorStream());
}
} catch (IOException e) {
throw new RuntimeException("API Request and Response Fail", e);
throw new RuntimeException("API 요청과 응답 실패", e);
} finally {
con.disconnect();
}
}
public HttpURLConnection connect(String apiUrl){
public HttpURLConnection connect(String apiUrl) {
try {
URL url = new URL(apiUrl);
return (HttpURLConnection)url.openConnection();
} catch (MalformedURLException e) {
throw new RuntimeException("Invalid API URL. : " + apiUrl, e);
throw new RuntimeException("API URL이 잘못되었습니다. : " + apiUrl, e);
} catch (IOException e) {
throw new RuntimeException("Connection Fail. : " + apiUrl, e);
throw new RuntimeException("연결이 실패했습니다. : " + apiUrl, e);
}
}
public String readBody(InputStream body) throws IOException{
public String readBody(InputStream body) {
InputStreamReader streamReader = new InputStreamReader(body);
try(BufferedReader lineReader = new BufferedReader(streamReader)) {
StringBuilder responseBody = new StringBuilder();
String line = lineReader.readLine();
while (line != null) {
String line;
while ((line = lineReader.readLine()) != null) {
responseBody.append(line);
line = lineReader.readLine();
}
return responseBody.toString();
} catch (IOException e) {
throw new RuntimeException("API 응답을 읽는데 실패했습니다.", e);
}
}
@ -747,11 +739,10 @@ public class BasFlightService {
rd = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
}
StringBuilder sb = new StringBuilder();
String line = rd.readLine();
String line;
while (line != null) {
while ((line = rd.readLine()) != null) {
sb.append(line);
line = rd.readLine();
}
CtrTrnsLctnModel weatherResult = ctrTrnsLctnService.convertLatlonToAddress(rq.getNx2(),rq.getNy2());

9
src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupAprvController.java

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -34,7 +33,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/bas/group/aprv", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "BasGroupAprvController", tags = {"Group Approval API"})
@Tag(name = "그룹 승인 컨트롤러", description = "그룹 가입 승인 관련 API")
public class BasGroupAprvController {
@Autowired
@ -46,7 +45,8 @@ public class BasGroupAprvController {
* @return
*/
@GetMapping(value = "/list")
@ApiOperation(value = "Aprov List")
@ApiOperation(value = "승인요청 조회")
@Tag(name = "그룹 승인 컨트롤러", description = "그룹 가입 승인 관련 API")
public ResponseEntity<? extends BasicResponse> list(BasGroupAprvRqModel rq) {
ComnPagingRs<BasGroupAprvModel> result = null;
// log.debug(">>>>" + rq.toString());
@ -76,7 +76,8 @@ public class BasGroupAprvController {
* @return
*/
@PutMapping(value = "/update")
@ApiOperation(value = "Update Aprov / cancellAprov")
@ApiOperation(value = "승인처리 / 승인취소 처리")
@Tag(name = "그룹 승인 컨트롤러", description = "그룹 가입 승인 관련 API")
public ResponseEntity<? extends BasicResponse> update(@RequestBody BasGroupAprvModel rq) {
Map<String , Object> resultMap = new HashMap<String,Object>();

40
src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupController.java

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -39,14 +38,15 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/bas/group", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "BasGroupController", tags = {"Group API"})
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
public class BasGroupController {
@Autowired
private final BasGroupService service;
@GetMapping(value = "/createid")
@ApiOperation(value = "Create Group ID")
@ApiOperation(value = "그룹코드 생성")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
public ResponseEntity<? extends BasicResponse> createid() {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -71,8 +71,9 @@ public class BasGroupController {
* @return
*/
@GetMapping(value = "/mylist")
@ApiOperation(value = "My Group List")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "나의 그룹 목록 조회")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> mylist(Integer cstmrSno) {
List<BasGroupModel> result = null;
@ -104,8 +105,9 @@ public class BasGroupController {
* @return
*/
@GetMapping(value = "/joinlist")
@ApiOperation(value = "My Group - Join Groups List")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "나의 그룹 - 참여 그룹 목록 조회")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> joinList(Integer cstmrSno) {
List<BasGroupJoinModel> result = null;
@ -136,8 +138,9 @@ public class BasGroupController {
* @return
*/
@GetMapping(value = "/grouplist")
@ApiOperation(value = "Group List")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "그룹 목록 조회")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> grouplist(Integer cstmrSno) {
List<BasGroupJoinModel> result = null;
@ -168,7 +171,8 @@ public class BasGroupController {
* @return
*/
@GetMapping(value = "/list")
@ApiOperation(value = "All Group List")
@ApiOperation(value = "전체 그룹 목록 조회")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
public ResponseEntity<? extends BasicResponse> list(BasGroupRqModel rq) {
List<BasGroupModel> result = null;
@ -192,8 +196,9 @@ public class BasGroupController {
* @return
*/
@GetMapping(value = "/detail/{id}")
@ApiOperation(value = "Group Detail")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "그룹 상세 조회")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
@ApiImplicitParam(name = "id",value = "그룹ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> detail(@PathVariable String id) {
BasGroupModel result = null;
@ -217,7 +222,8 @@ public class BasGroupController {
* @throws Exception
*/
@PostMapping(value = "/create")
@ApiOperation(value = "Create Group")
@ApiOperation(value = "그룹 생성")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
public ResponseEntity<? extends BasicResponse> create(@RequestBody BasGroupModel rq) throws Exception {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -243,7 +249,8 @@ public class BasGroupController {
* @throws Exception
*/
@PutMapping(value = "/update")
@ApiOperation(value = "Update Group")
@ApiOperation(value = "그룹 수정")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
public ResponseEntity<? extends BasicResponse> update(@RequestBody BasGroupModel rq) throws Exception {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -275,8 +282,9 @@ public class BasGroupController {
* @return
*/
@DeleteMapping(value = "/delete/{id}")
@ApiOperation(value = "Delete Group")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "그룹 삭제")
@Tag(name = "그룹 컨트롤러", description = "그룹 관련 API")
@ApiImplicitParam(name = "id",value = "그룹ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> delete(@PathVariable String id) {
Map<String , Object> resultMap = new HashMap<String,Object>();

12
src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupJoinController.java

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
@ -34,7 +33,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/bas/group/join", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "BasGroupJoinController", tags = {"Join Group API"})
@Tag(name = "그룹 참여 컨트롤러", description = "그룹 참여 관련 API")
public class BasGroupJoinController {
@Autowired
@ -42,7 +41,8 @@ public class BasGroupJoinController {
@GetMapping(value = "/list")
@ApiOperation(value = "Join Group List")
@ApiOperation(value = "참여한 그룹 목록 조회")
@Tag(name = "그룹 참여 컨트롤러", description = "그룹 참여 관련 API")
public ResponseEntity<? extends BasicResponse> list(BasGroupJoinRqModel rq) {
List<BasGroupJoinModel> result = null;
@ -67,7 +67,8 @@ public class BasGroupJoinController {
@PostMapping(value = "/create")
@ApiOperation(value = "Group Request to Join")
@ApiOperation(value = "그룹 가입 요청")
@Tag(name = "그룹 참여 컨트롤러", description = "그룹 참여 관련 API")
public ResponseEntity<? extends BasicResponse> create(@RequestBody BasGroupJoinModel rq) {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -87,7 +88,8 @@ public class BasGroupJoinController {
}
@PutMapping(value = "/update")
@ApiOperation(value = "Group Join Aprov/NoAprov")
@ApiOperation(value = "그룹 가입 승인/미승인")
@Tag(name = "그룹 참여 컨트롤러", description = "그룹 참여 관련 API")
public ResponseEntity<? extends BasicResponse> update(@RequestBody BasGroupJoinModel rq) {
Map<String , Object> resultMap = new HashMap<String,Object>();

12
src/main/java/com/palnet/biz/api/bas/group/controller/BasGroupUserController.java

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -35,7 +34,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/bas/group/user", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "BasGroupUserController", tags = {"User Group API"})
@Tag(name = "그룹 사용자 컨트롤러", description = "그룹 사용자 관련 API")
public class BasGroupUserController {
@Autowired
@ -43,7 +42,8 @@ public class BasGroupUserController {
@GetMapping(value = "/list")
@ApiOperation(value = "Group User List")
@ApiOperation(value = "그룹 사용자 조회")
@Tag(name = "그룹 사용자 컨트롤러", description = "그룹 사용자 관련 API")
public ResponseEntity<? extends BasicResponse> list(BasGroupUserListModel rq) {
ComnPagingRs<BasGroupUserModel> result = null;
@ -68,7 +68,8 @@ public class BasGroupUserController {
@PutMapping(value = "/update")
@ApiOperation(value = "Group User Auth Update")
@ApiOperation(value = "그룹 사용자 권한 수정")
@Tag(name = "그룹 사용자 컨트롤러", description = "그룹 사용자 관련 API")
public ResponseEntity<? extends BasicResponse> update(@RequestBody BasGroupUserModel rq) {
Map<String , Object> resultMap = new HashMap<String,Object>();
@ -88,7 +89,8 @@ public class BasGroupUserController {
}
@PutMapping(value = "/delegate")
@ApiOperation(value = "MASTER Auth Delegate")
@ApiOperation(value = "MASTER 권한 위임")
@Tag(name = "그룹 사용자 컨트롤러", description = "그룹 사용자 관련 API")
public ResponseEntity<? extends BasicResponse> delegate(@RequestBody List<BasGroupUserModel> rq) {
Map<String, Object> resultMap = new HashMap<String, Object>();

17
src/main/java/com/palnet/biz/api/bas/group/service/BasGroupService.java

@ -43,14 +43,17 @@ public class BasGroupService {
public String createid() {
String groupId;
do {
String groupId = "";
while(true) {
groupId = UUID.randomUUID().toString().replaceAll("-", "").toUpperCase().substring(0, 6);
} while (ptyGroupBasRepository.findById(groupId).isPresent());
Optional<PtyGroupBas> optional = ptyGroupBasRepository.findById(groupId);
if(!optional.isPresent()) {
break;
}
}
return groupId;
}

48
src/main/java/com/palnet/biz/api/ctr/cntrl/controller/CtrCntrlController.java

@ -13,7 +13,6 @@ import java.util.*;
import com.palnet.biz.api.ctr.cntrl.model.*;
import com.palnet.biz.scheduler.ctr.model.CtrTrnsLctnModel;
import com.palnet.biz.scheduler.ctr.service.CtrTrnsLctnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -38,7 +37,7 @@ import lombok.extern.log4j.Log4j2;
@Log4j2
@RestController
@RequestMapping(value = "/api/ctr/cntrl", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "CtrCntrlController", tags = {"Drone Control System API"})
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
public class CtrCntrlController {
private final CtrCntrlService service;
@ -54,8 +53,9 @@ public class CtrCntrlController {
* @return
*/
@GetMapping(value = "/history/{id}")
@ApiOperation(value = "TODO Drone Control Histroy")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "TODO 드론 관제 이력 목록 (Socket 분리 전)")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> historyList(@PathVariable String id) {
List<GPHistoryModel> result = null;
@ -78,8 +78,9 @@ public class CtrCntrlController {
* @return
*/
@GetMapping(value = "/detail/{id}")
@ApiOperation(value = "TODO Drone Control Detail")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "TODO 드론 관제 상세 정보")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> detail(@PathVariable String id) {
CtrCntrlDtlModel result = null;
@ -102,8 +103,9 @@ public class CtrCntrlController {
* @return
*/
@GetMapping(value = "/history/list/{id}")
@ApiOperation(value = "TODO Drone Control 'Real-Time' History List")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "TODO 드론 관제 '실시간' 이력 목록")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> history(@PathVariable String id) {
List<GPHistoryModel> history;
@ -118,7 +120,8 @@ public class CtrCntrlController {
}
@GetMapping("/api/weather")
@ApiOperation(value = "Drone Control Weather")
@ApiOperation(value = "드론 관제 날씨")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
public ResponseEntity<? extends BasicResponse> restApiGetWeather(CtrCntrlWeatherModel rq) throws IOException, ParseException {
JSONObject jsonObject = null;
try {
@ -137,8 +140,9 @@ public class CtrCntrlController {
* @return
*/
@GetMapping("/group")
@ApiOperation(value = "TODO Flight Control User Auth Info")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "TODO 비행 관제 사용자 권한 정보")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> findGroupAuthInfo(int cstmrSno) {
List<CtrCntrlGroupArcrftModel> list;
@ -160,8 +164,9 @@ public class CtrCntrlController {
* @return
*/
@GetMapping("/flight_plan/{idntfNum}")
@ApiOperation(value = "TODO Flight Control User Plan Info")
@ApiImplicitParam(name = "idtfNum",value = "idtfNum", dataTypeClass = String.class)
@ApiOperation(value = "TODO 비행 관제 사용자 비행 계획서 정보")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
@ApiImplicitParam(name = "idtfNum",value = "식별번호", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> findFlightPlan(@PathVariable("idntfNum") String idntfNum) {
List<BasFlightPlanModel> list;
@ -183,8 +188,9 @@ public class CtrCntrlController {
* @return
*/
@GetMapping(value = "/warn/detail/{id}")
@ApiOperation(value = "TODO Drone Fly Start and Alarm List")
@ApiImplicitParam(name = "id",value = "id", dataTypeClass = String.class)
@ApiOperation(value = "TODO 드론 운행 시작 후 알람 목록")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
@ApiImplicitParam(name = "id",value = "관제ID", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> warnDetail(@PathVariable String id){
List<CtrCntrlWarnLogModel> warnLog;
@ -205,7 +211,8 @@ public class CtrCntrlController {
* @return
*/
@PostMapping(value = "/arcrft/warn/list")
@ApiOperation(value = "TODO Arcrft Warn List")
@ApiOperation(value = "TODO 기체 별 최신 비정상 로그 및 비정상 로그 전체 개수")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
public ResponseEntity<? extends BasicResponse> arcrftWarnList(@RequestBody CtrCntrlArcrftWarnRqModel rq){
// public ResponseEntity<? extends BasicResponse> arcrftWarnList(@RequestParam("id") String id){
List<CtrCntrlArcrftWarnModel> arcrftWarnList;
@ -228,7 +235,8 @@ public class CtrCntrlController {
* @return
*/
@PostMapping("/contains")
@ApiOperation(value = "TODO Flight Control area Anomaly Check")
@ApiOperation(value = "TODO 비행 관제 구역 비정상 상황 체크")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
public ResponseEntity<? extends BasicResponse> checkPlanContains(@RequestBody CtrCntrlPlanContainsRq rq) {
CtrCntrlPlanContainsRs rs;
@ -250,7 +258,8 @@ public class CtrCntrlController {
* @return
*/
@GetMapping("/id/{id}")
@ApiOperation(value = "TODO RealTime Control Id Issue")
@ApiOperation(value = "TODO 실시간 Control ID 발급")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
public ResponseEntity<? extends BasicResponse> getId(@PathVariable String id) {
Map<String, String> result;
try {
@ -272,7 +281,8 @@ public class CtrCntrlController {
* @return
*/
@GetMapping("/warn/{id}/{lat}/{lon}")
@ApiOperation(value = "TODO Flight Control Aircraft Warring Check")
@ApiOperation(value = "TODO 비행 관제 기체의 비정상 상황 확인")
@Tag(name = "드론 관제 시스템", description = "드론 관제 관련 API")
public ResponseEntity<? extends BasicResponse> checkWarring(@PathVariable String id,
@PathVariable Double lat,
@PathVariable Double lon) {

11
src/main/java/com/palnet/biz/api/ctr/cntrl/service/CtrCntrlService.java

@ -93,7 +93,6 @@ public class CtrCntrlService {
@Value("${weather.api.key}")
private String weatherKey;
private final CtrCntrlQueryRepository query;
private final CtrCntrlBasRepository cntrlBasRepository;
private final CtrCntrlHstryRepository cntrlHstryRepository;
@ -724,10 +723,9 @@ public class CtrCntrlService {
rd = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
}
StringBuilder sb = new StringBuilder();
String line = rd.readLine();
while (line != null) {
String line;
while ((line = rd.readLine()) != null) {
sb.append(line);
line = rd.readLine();
}
CtrTrnsLctnModel weatherResult = ctrTrnsLctnService.convertLatlonToAddress(rq.getNx(),rq.getNy());
log.info("weatherResult >>>> : {}", weatherResult);
@ -761,7 +759,6 @@ public class CtrCntrlService {
double OLAT = 38.0; // 기준점 위도(degree)
double XO = 43; // 기준점 X좌표(GRID)
double YO = 136; // 기1준점 Y좌표(GRID)
Double epslion = 0.0;
//
// LCC DFS 좌표변환 ( code : "TO_GRID"(위경도->좌표, lat_X:위도, lng_Y:경도), "TO_GPS"(좌표->위경도, lat_X:x, lng_Y:y) )
@ -808,10 +805,10 @@ public class CtrCntrlService {
double alat = Math.pow((re * sf / ra), (1.0 / sn));
alat = 2.0 * Math.atan(alat) - Math.PI * 0.5;
if (Math.abs(xn) <= epslion) {
if (Math.abs(xn) <= 0.0) {
theta = 0.0;
} else {
if (Math.abs(yn) <= epslion) {
if (Math.abs(yn) <= 0.0) {
theta = Math.PI * 0.5;
if (xn < 0.0) {
theta = -theta;

23
src/main/java/com/palnet/biz/api/main/dash/controller/MainDashController.java

@ -3,7 +3,6 @@ package com.palnet.biz.api.main.dash.controller;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -38,7 +37,7 @@ import lombok.extern.log4j.Log4j2;
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/main/dash", produces = {MediaType.APPLICATION_JSON_VALUE})
@Api(value = "MainDashController", tags = {"Main page API"})
@Tag(name = "메인화면 컨트롤러", description = "메인화면 관련 API")
public class MainDashController {
@Autowired
@ -49,8 +48,9 @@ public class MainDashController {
* @return
*/
@GetMapping(value = "/stcs/day")
@ApiOperation(value = "Daily Flight Count Statistics")
@ApiImplicitParam(name = "yyyymm",value = "day", dataTypeClass = String.class)
@ApiOperation(value = "일 별 비행횟수 통계")
@Tag(name = "메인화면 컨트롤러", description = "메인화면 관련 API")
@ApiImplicitParam(name = "yyyymm",value = "날짜", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> stcsDay(String yyyymm) {
List<MainDashStcsModel> result = null;
@ -83,8 +83,9 @@ public class MainDashController {
* @return
*/
@GetMapping(value = "/stcs/area")
@ApiOperation(value = "TOP5 Flight Count Stat")
@ApiImplicitParam(name = "yyyymm",value = "day", dataTypeClass = String.class)
@ApiOperation(value = "TOP5 지역 별 비행횟수 통계")
@Tag(name = "메인화면 컨트롤러", description = "메인화면 관련 API")
@ApiImplicitParam(name = "yyyymm",value = "날짜", dataTypeClass = String.class)
public ResponseEntity<? extends BasicResponse> stcsArea(String yyyymm) {
List<MainDashStcsModel> result = null;
@ -114,8 +115,9 @@ public class MainDashController {
* @return
*/
@GetMapping(value = "/group/list")
@ApiOperation(value = "Group Info have User Created")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "본인이 생성한 그룹 정보")
@Tag(name = "메인화면 컨트롤러", description = "메인화면 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> groupList(Integer cstmrSno) {
List<Map> result = null;
@ -140,8 +142,9 @@ public class MainDashController {
@GetMapping(value = "/arcrft/list")
@ApiOperation(value = "Arcrft List")
@ApiImplicitParam(name = "cstmrSno",value = "cstmrSno", dataTypeClass = Integer.class)
@ApiOperation(value = "기체 정보 리스트")
@Tag(name = "메인화면 컨트롤러", description = "메인화면 관련 API")
@ApiImplicitParam(name = "cstmrSno",value = "고객일련번호", dataTypeClass = Integer.class)
public ResponseEntity<? extends BasicResponse> arcrftList(Integer cstmrSno) {
List<MainDashListModel> result = null;

2
src/main/java/com/palnet/biz/config/SwaggerConfig.java

@ -3,7 +3,6 @@ package com.palnet.biz.config;
import io.swagger.v3.oas.models.parameters.Parameter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
@ -24,7 +23,6 @@ import java.util.List;
@Configuration
//@EnableSwagger2
@EnableWebMvc
public class SwaggerConfig {

116
src/main/java/com/palnet/comn/encrptn/kisa/KISA_SEED_CBC.java

@ -164,10 +164,8 @@ public class KISA_SEED_CBC {
// R0, R1 : right input values at each round
// K : round keys at each round
private static final void SeedRound(int[] T, int LR[], int L0, int L1, int R0, int R1, int[] K, int K_offset) {
int offset = K_offset + 0;
int offset1 = K_offset + 1;
T[0] = LR[R0] ^ K[offset];
T[1] = LR[R1] ^ K[offset1];
T[0] = LR[R0] ^ K[K_offset+0];
T[1] = LR[R1] ^ K[K_offset+1];
T[1] ^= T[0];
T[1] = SS0[GetB0(T[1])&0x0ff] ^ SS1[GetB1(T[1])&0x0ff] ^
SS2[GetB2(T[1])&0x0ff] ^ SS3[GetB3(T[1])&0x0ff];
@ -374,18 +372,12 @@ public class KISA_SEED_CBC {
if(ENDIAN != Common.BIG_ENDIAN) {
for(i=0;i<inLen;i++)
{
int temp = in[i / 4];
int shift = (i % 4) * 8;
data[i] = (byte) (temp >> shift);
// data[i] = (byte)(in[i/4] >> ((i%4)*8));
data[i] = (byte)(in[i/4] >> ((i%4)*8));
}
} else {
for(i=0;i<inLen;i++)
{
int temp = in[i / 4];
int shift = (3 - (i % 4)) * 8;
data[i] = (byte) (temp >> shift);
// data[i] = (byte)(in[i/4] >> ((3-(i%4))*8));
data[i] = (byte)(in[i/4] >> ((3-(i%4))*8));
}
}
@ -406,9 +398,7 @@ public class KISA_SEED_CBC {
K = pInfo.seed_key.key_data; // Pointer of round keys
pInfo.encrypt = enc.value; //
Common.memcpy(pInfo.ivec, pbszIV, 16, ENDIAN);
pInfo.buffer_length = 0;
// pInfo.last_block_flag = pInfo.buffer_length = 0;
pInfo.last_block_flag = pInfo.buffer_length;
pInfo.last_block_flag = pInfo.buffer_length = 0;
// Set up input values for Key Schedule
ABCD[ABCD_A] = Common.byte_to_int(pbszUserKey, 0*4, ENDIAN);
@ -746,23 +736,11 @@ public class KISA_SEED_CBC {
public KISA_SEED_INFO() {
encrypt = 0;
ivec[3] = 0;
ivec[2] = ivec[3];
ivec[1] = ivec[2];
ivec[0] = ivec[1];
// ivec[0] = ivec[1] = ivec[2] = ivec[3] = 0;
ivec[0] = ivec[1] = ivec[2] = ivec[3] = 0;
seed_key.init();
cbc_buffer[3] = 0;
cbc_buffer[2] = cbc_buffer[3];
cbc_buffer[1] = cbc_buffer[2];
cbc_buffer[0] = cbc_buffer[1];
// cbc_buffer[0] = cbc_buffer[1] = cbc_buffer[2] = cbc_buffer[3] = 0;
cbc_buffer[0] = cbc_buffer[1] = cbc_buffer[2] = cbc_buffer[3] = 0;
buffer_length = 0;
cbc_last_block[3] = 0;
cbc_last_block[2] = cbc_last_block[3];
cbc_last_block[1] = cbc_last_block[2];
cbc_last_block[0] = cbc_last_block[1];
// cbc_last_block[0] = cbc_last_block[1] = cbc_last_block[2] = cbc_last_block[3] = 0;
cbc_last_block[0] = cbc_last_block[1] = cbc_last_block[2] = cbc_last_block[3] = 0;
last_block_flag = 0;
}
@ -822,21 +800,13 @@ public class KISA_SEED_CBC {
int mask_value = 0x0ff << shift_value;
int mask_value2 = ~mask_value;
int value2 = (value&0x0ff) << shift_value;
int dstValue = dst[b_offset / 4];
dstValue = (dstValue & mask_value2) | (value2 & mask_value);
dst[b_offset / 4] = dstValue;
// dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
} else {
int shift_value = (b_offset%4)*8;
int mask_value = 0x0ff << shift_value;
int mask_value2 = ~mask_value;
int value2 = (value&0x0ff) << shift_value;
int dstValue = dst[b_offset / 4];
dstValue = (dstValue & mask_value2) | (value2 & mask_value);
dst[b_offset / 4] = dstValue;
// dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
}
}
@ -844,18 +814,12 @@ public class KISA_SEED_CBC {
if(ENDIAN == BIG_ENDIAN) {
int shift_value = (3-b_offset%4)*8;
int mask_value = 0x0ff << shift_value;
int mask_value2 = src[b_offset/4];
int value2 = mask_value2 & mask_value;
int value = value2 >> shift_value;
// int value = (src[b_offset/4] & mask_value) >> shift_value;
int value = (src[b_offset/4] & mask_value) >> shift_value;
return (byte)value;
} else {
int shift_value = (b_offset%4)*8;
int mask_value = 0x0ff << shift_value;
int mask_value2 = src[b_offset/4];
int value2 = mask_value2 & mask_value;
int value = value2 >> shift_value;
// int value = (src[b_offset/4] & mask_value) >> shift_value;
int value = (src[b_offset/4] & mask_value) >> shift_value;
return (byte)value;
}
@ -872,13 +836,10 @@ public class KISA_SEED_CBC {
}
public static void byte_to_int(int[] dst, int dst_offset, byte[] src, int src_offset, int ENDIAN) {
int offset1 = src_offset + 1;
int offset2 = src_offset + 2;
int offset3 = src_offset + 3;
if(ENDIAN == BIG_ENDIAN) {
dst[dst_offset] = ((0x0ff&src[src_offset]) << 24) | ((0x0ff&src[offset1]) << 16) | ((0x0ff&src[offset2]) << 8) | ((0x0ff&src[offset3]));
dst[dst_offset] = ((0x0ff&src[src_offset]) << 24) | ((0x0ff&src[src_offset+1]) << 16) | ((0x0ff&src[src_offset+2]) << 8) | ((0x0ff&src[src_offset+3]));
} else {
dst[dst_offset] = ((0x0ff&src[src_offset])) | ((0x0ff&src[offset1]) << 8) | ((0x0ff&src[offset2]) << 16) | ((0x0ff&src[offset3]) << 24);
dst[dst_offset] = ((0x0ff&src[src_offset])) | ((0x0ff&src[src_offset+1]) << 8) | ((0x0ff&src[src_offset+2]) << 16) | ((0x0ff&src[src_offset+3]) << 24);
}
}
@ -926,8 +887,7 @@ public class KISA_SEED_CBC {
if(n >= 32)
return 0;
int v = x >> n;
int shift = n - 1;
int v_mask = ~(0x80000000 >> shift);
int v_mask = ~(0x80000000 >> (n-1));
return v & v_mask;
}
@ -980,9 +940,7 @@ public class KISA_SEED_CBC {
K = pInfo.seed_key.key_data; // Pointer of round keys
pInfo.encrypt = enc.value; //
Common.memcpy(pInfo.ivec, pbszIV, 16, ENDIAN);
pInfo.buffer_length = 0;
// pInfo.last_block_flag = pInfo.buffer_length = 0;
pInfo.last_block_flag = pInfo.buffer_length;
pInfo.last_block_flag = pInfo.buffer_length = 0;
// Set up input values for Key Schedule
ABCD[ABCD_A] = Common.byte_to_int(pbszUserKey, 0*4, ENDIAN);
@ -1084,10 +1042,10 @@ public class KISA_SEED_CBC {
// byte[] defaultCipherText = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData, 0, PLAINTEXT_LENGTH);
//
//
// byte[] PPPPP = SEED_CBC_Decrypt(pbUserKey, bszIV, defaultCipherText, 0, CIPHERTEXT_LENGTH);
byte[] defaultCipherText = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData, 0, PLAINTEXT_LENGTH);
byte[] PPPPP = SEED_CBC_Decrypt(pbUserKey, bszIV, defaultCipherText, 0, CIPHERTEXT_LENGTH);
//System.out.print("\nIV\t\t\t\t: ");
@ -1106,9 +1064,9 @@ public class KISA_SEED_CBC {
//System.out.print("\n\n");
// byte[] Cipher1 = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData1,0, 2);
//
// byte[] Plain1 = SEED_CBC_Decrypt(pbUserKey, bszIV, Cipher1, 0, 16);
byte[] Cipher1 = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData1,0, 2);
byte[] Plain1 = SEED_CBC_Decrypt(pbUserKey, bszIV, Cipher1, 0, 16);
//System.out.print("IV\t\t\t\t: ");
//for (int i=0; i<16; i++)
@ -1126,9 +1084,9 @@ public class KISA_SEED_CBC {
//System.out.print("\n\n");
// byte[] Cipher2 = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData2,0, 16);
//
// byte[] Plain2 = SEED_CBC_Decrypt(pbUserKey, bszIV, Cipher2, 0, 32);
byte[] Cipher2 = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData2,0, 16);
byte[] Plain2 = SEED_CBC_Decrypt(pbUserKey, bszIV, Cipher2, 0, 32);
//System.out.print("IV\t\t\t\t: ");
//for (int i=0; i<16; i++)
@ -1148,9 +1106,9 @@ public class KISA_SEED_CBC {
// byte[] Cipher3 = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData3, 0, 18);
//
// byte[] Plain3 = SEED_CBC_Decrypt(pbUserKey, bszIV, Cipher3, 0, 32);
byte[] Cipher3 = SEED_CBC_Encrypt(pbUserKey, bszIV, pbData3, 0, 18);
byte[] Plain3 = SEED_CBC_Decrypt(pbUserKey, bszIV, Cipher3, 0, 32);
// System.out.print("IV\t\t\t\t: ");
// for (int i=0; i<16; i++)
@ -1232,7 +1190,7 @@ public class KISA_SEED_CBC {
int[] outbuf = new int[process_blockLeng/4];
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; j += process_blockLeng)
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; )
{
System.arraycopy(pbData, j, newpbszPlainText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszPlainText, process_blockLeng);
@ -1317,7 +1275,7 @@ public class KISA_SEED_CBC {
byte []pbszPlainText = new byte[nCipherTextLen];
for(j=0; j<nCipherTextLen - process_blockLeng; j+= process_blockLeng)
for(j=0; j<nCipherTextLen - process_blockLeng; )
{
System.arraycopy(message, j, newpbszCipherText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszCipherText, process_blockLeng);
@ -1419,7 +1377,7 @@ public class KISA_SEED_CBC {
outbuf = new int[process_blockLeng/4];
pbszPlainText = new byte[process_blockLeng];
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; j+= process_blockLeng)
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; )
{
System.arraycopy(pbData1, j, newpbszPlainText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszPlainText, process_blockLeng);
@ -1508,7 +1466,7 @@ public class KISA_SEED_CBC {
pbszPlainText = new byte[nCipherTextLen];
for(j=0; j<nCipherTextLen - process_blockLeng; j+= process_blockLeng)
for(j=0; j<nCipherTextLen - process_blockLeng; )
{
System.arraycopy(message, j, newpbszCipherText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszCipherText, process_blockLeng);
@ -1595,7 +1553,7 @@ public class KISA_SEED_CBC {
outbuf = new int[process_blockLeng/4];
pbszPlainText = new byte[process_blockLeng];
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; j+= process_blockLeng)
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; )
{
System.arraycopy(pbData2, j, newpbszPlainText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszPlainText, process_blockLeng);
@ -1683,7 +1641,7 @@ public class KISA_SEED_CBC {
pbszPlainText = new byte[nCipherTextLen];
for(j=0; j<nCipherTextLen - process_blockLeng; j+= process_blockLeng)
for(j=0; j<nCipherTextLen - process_blockLeng; )
{
System.arraycopy(message, j, newpbszCipherText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszCipherText, process_blockLeng);
@ -1772,7 +1730,7 @@ public class KISA_SEED_CBC {
outbuf = new int[process_blockLeng/4];
pbszPlainText = new byte[process_blockLeng];
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; j+= process_blockLeng)
for(j=0; j<PLAINTEXT_LENGTH-process_blockLeng; )
{
System.arraycopy(pbData3, j, newpbszPlainText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszPlainText, process_blockLeng);
@ -1861,7 +1819,7 @@ public class KISA_SEED_CBC {
pbszPlainText = new byte[nCipherTextLen];
for(j=0; j<nCipherTextLen - process_blockLeng; j+= process_blockLeng)
for(j=0; j<nCipherTextLen - process_blockLeng; )
{
System.arraycopy(message, j, newpbszCipherText, 0, process_blockLeng);
data = chartoint32_for_SEED_CBC(newpbszCipherText, process_blockLeng);

39
src/main/java/com/palnet/comn/encrptn/kisa/KISA_SHA256.java

@ -136,9 +136,7 @@ public class KISA_SHA256 {
Info.uChainVar[6] = 0x1f83d9ab;
Info.uChainVar[7] = 0x5be0cd19;
Info.uLowLength = 0;
Info.uHighLength = Info.uLowLength;
// Info.uHighLength = Info.uLowLength = 0;
Info.uHighLength = Info.uLowLength = 0;
}
/**
@ -150,8 +148,7 @@ public class KISA_SHA256 {
public static void SHA256_Process( SHA256_INFO Info, byte[] pszMessage, int uDataLen ) {
int pszMessage_offset;
Info.uLowLength += (uDataLen <<3);
if(Info.uLowLength < 0) {
if((Info.uLowLength += (uDataLen << 3)) < 0) {
Info.uHighLength++;
}
@ -272,21 +269,13 @@ public class KISA_SHA256 {
int mask_value = 0x0ff << shift_value;
int mask_value2 = ~mask_value;
int value2 = (value&0x0ff) << shift_value;
int dstValue = dst[b_offset / 4];
dstValue = (dstValue & mask_value2) | (value2 & mask_value);
dst[b_offset / 4] = dstValue;
// dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
} else {
int shift_value = (b_offset%4)*8;
int mask_value = 0x0ff << shift_value;
int mask_value2 = ~mask_value;
int value2 = (value&0x0ff) << shift_value;
int dstValue = dst[b_offset / 4];
dstValue = (dstValue & mask_value2) | (value2 & mask_value);
dst[b_offset / 4] = dstValue;
// dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
dst[b_offset/4] = (dst[b_offset/4] & mask_value2) | (value2 & mask_value);
}
}
@ -294,18 +283,12 @@ public class KISA_SHA256 {
if(ENDIAN == BIG_ENDIAN) {
int shift_value = (3-b_offset%4)*8;
int mask_value = 0x0ff << shift_value;
int mask_value2 = src[b_offset/4];
int value2 = mask_value2 & mask_value;
int value = value2 >> shift_value;
// int value = (src[b_offset/4] & mask_value) >> shift_value;
int value = (src[b_offset/4] & mask_value) >> shift_value;
return (byte)value;
} else {
int shift_value = (b_offset%4)*8;
int mask_value = 0x0ff << shift_value;
int mask_value2 = src[b_offset/4];
int value2 = mask_value2 & mask_value;
int value = value2 >> shift_value;
// int value = (src[b_offset/4] & mask_value) >> shift_value;
int value = (src[b_offset/4] & mask_value) >> shift_value;
return (byte)value;
}
@ -322,13 +305,10 @@ public class KISA_SHA256 {
}
public static void byte_to_int(int[] dst, int dst_offset, byte[] src, int src_offset, int ENDIAN) {
int offset1 = src_offset + 1;
int offset2 = src_offset + 2;
int offset3 = src_offset + 3;
if(ENDIAN == BIG_ENDIAN) {
dst[dst_offset] = ((0x0ff&src[src_offset]) << 24) | ((0x0ff&src[offset1]) << 16) | ((0x0ff&src[offset2]) << 8) | ((0x0ff&src[offset3]));
dst[dst_offset] = ((0x0ff&src[src_offset]) << 24) | ((0x0ff&src[src_offset+1]) << 16) | ((0x0ff&src[src_offset+2]) << 8) | ((0x0ff&src[src_offset+3]));
} else {
dst[dst_offset] = ((0x0ff&src[src_offset])) | ((0x0ff&src[offset1]) << 8) | ((0x0ff&src[offset2]) << 16) | ((0x0ff&src[offset3]) << 24);
dst[dst_offset] = ((0x0ff&src[src_offset])) | ((0x0ff&src[src_offset+1]) << 8) | ((0x0ff&src[src_offset+2]) << 16) | ((0x0ff&src[src_offset+3]) << 24);
}
}
@ -376,8 +356,7 @@ public class KISA_SHA256 {
if(n >= 32)
return 0;
int v = x >> n;
int shift = n - 1;
int v_mask = ~(0x80000000 >> shift);
int v_mask = ~(0x80000000 >> (n-1));
return v & v_mask;
}

9
src/main/java/com/palnet/comn/utils/EncryptUtils.java

@ -40,25 +40,24 @@ public class EncryptUtils {
/* (1) 시작 시간 측정 */
long startTimeLong = getCurrentTimeLong();
/*test*///
System.out.println( "startTimeLong : " + startTimeLong );
/*test*/// System.out.println( "startTimeLong : " + startTimeLong );
/*************************************
* 암호화
*************************************/
String encryptData = encrypt(plainText);
System.out.println("encrypt:" + encryptData);
// System.out.println("encrypt:" + encryptData);
/*************************************
* 복호화
*************************************/
plainText = decrypt(encryptData);
System.out.println("decrypt:" + plainText);
// System.out.println("decrypt:" + plainText);
String sha256 = sha256Encrypt(plainText);
System.out.println("sha256:" + sha256);
// System.out.println("sha256:" + sha256);

11
src/main/java/com/palnet/comn/utils/HttpUtils.java

@ -57,10 +57,10 @@ public class HttpUtils {
response.setHeader ("Content-Length", ""+file.length() );
outStream = response.getOutputStream();
byte b[] = new byte[(int)file.length()];
int leng = inputStream.read(b);
while(leng > 0 ){
int leng = 0;
while( (leng = inputStream.read(b)) > 0 ){
outStream.write(b,0,leng);
leng = inputStream.read(b);
}
} catch (Exception e) {
@ -182,10 +182,9 @@ public class HttpUtils {
if (respCd == HttpStatus.SC_OK) {
br = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream()));
String readLine = br.readLine();
while (readLine != null) {
String readLine;
while (((readLine = br.readLine()) != null)) {
log.info(readLine);
readLine = br.readLine();
}
} else {
log.error("respCd: {}", respCd);

20
src/main/java/com/palnet/comn/utils/LocationUtils.java

@ -47,16 +47,16 @@ public class LocationUtils {
public static void main(String[] args) {
// 마일(Mile) 단위
// double distanceMile =
// distance(37.504198, 127.047967, 37.501025, 127.037701, "");
//
// // 미터(Meter) 단위
// double distanceMeter =
// distance(37.504198, 127.047967, 37.501025, 127.037701, "meter");
//
// // 킬로미터(Kilo Meter) 단위
// double distanceKiloMeter =
// distance(37.504198, 127.047967, 37.501025, 127.037701, "kilometer");
double distanceMile =
distance(37.504198, 127.047967, 37.501025, 127.037701, "");
// 미터(Meter) 단위
double distanceMeter =
distance(37.504198, 127.047967, 37.501025, 127.037701, "meter");
// 킬로미터(Kilo Meter) 단위
double distanceKiloMeter =
distance(37.504198, 127.047967, 37.501025, 127.037701, "kilometer");
// System.out.println(distanceMile) ;
// System.out.println(distanceMeter) ;

20
src/main/java/com/palnet/server/command/TempUtils.java

@ -29,41 +29,31 @@ public class TempUtils{
// 일산화탄소
prev = SensorModel.preCo;
SensorModel.preCo = SensorModel.co;
SensorModel.co = gradualDoubleData(SensorModel.co, prev, 0.1, 0.0, 20.0);
// result = SensorModel.co = gradualDoubleData(SensorModel.co, prev, 0.1, 0.0, 20.0);
result = SensorModel.co;
result = SensorModel.co = gradualDoubleData(SensorModel.co, prev, 0.1, 0.0, 20.0);
break;
case "so2":
// 아황산가스
prev = SensorModel.preSo2;
SensorModel.preSo2 = SensorModel.so2;
SensorModel.so2 = gradualDoubleData(SensorModel.so2, prev, 0.005, 0.0, 0.2);
// result = SensorModel.so2 = gradualDoubleData(SensorModel.so2, prev, 0.005, 0.0, 0.2);
result = SensorModel.so2;
result = SensorModel.so2 = gradualDoubleData(SensorModel.so2, prev, 0.005, 0.0, 0.2);
break;
case "no2":
// 이산화질소
prev = SensorModel.preNo2;
SensorModel.preNo2 = SensorModel.no2;
SensorModel.no2 = gradualDoubleData(SensorModel.no2, prev, 0.003, 0.0, 0.3);
// result = SensorModel.no2 = gradualDoubleData(SensorModel.no2, prev, 0.003, 0.0, 0.3);
result = SensorModel.no2;
result = SensorModel.no2 = gradualDoubleData(SensorModel.no2, prev, 0.003, 0.0, 0.3);
break;
case "o3":
// 오존
prev = SensorModel.preO3;
SensorModel.preO3 = SensorModel.o3;
SensorModel.o3 = gradualDoubleData(SensorModel.o3, prev, 1.0, 0.0, 175.0);
// result = SensorModel.o3 = gradualDoubleData(SensorModel.o3, prev, 1.0, 0.0, 175.0);
result = SensorModel.o3;
result = SensorModel.o3 = gradualDoubleData(SensorModel.o3, prev, 1.0, 0.0, 175.0);
break;
case "dust":
// 미세먼지
prev = SensorModel.preDust;
SensorModel.preDust = SensorModel.dust;
SensorModel.dust = gradualDoubleData(SensorModel.dust, prev, 1.1, 0.0, 175.0);
// result = SensorModel.dust = gradualDoubleData(SensorModel.dust, prev, 1.1, 0.0, 175.0);
result = SensorModel.dust;
result = SensorModel.dust = gradualDoubleData(SensorModel.dust, prev, 1.1, 0.0, 175.0);
break;
default:
result = (Math.round((new Random()).nextDouble() * 100000)) / 100.0;

4
src/main/java/com/palnet/server/task/ctr/service/CtrCntrlTaskService.java

@ -20,8 +20,8 @@ import com.palnet.comn.model.GPModel;
@Service
public class CtrCntrlTaskService {
// GPCollection cic = new GPCollection();
// GPDatabaseCollection gpdc = new GPDatabaseCollection();
GPCollection cic = new GPCollection();
GPDatabaseCollection gpdc = new GPDatabaseCollection();

2
src/main/resources/application.properties

@ -14,7 +14,7 @@ naver.api.url=https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc
spring.jwt.secret=jwtsecretkey
spring.jwt.prefix=palnet
### Weather key ####
## Weather key ####
weather.api.url = http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst
weather.api.key = =r6RMUsk3Vtama7D6uq7MiWV9dTC9MwfIIr4%2F45y0uVNw6BaYbgpKmL%2BLUDFVTfIYUmEe4K%2FaniEjdV9mg5t82Q%3D%3D

Loading…
Cancel
Save