From 69a2440e9060c709ca6a05aed6de6ed0fe6e77eb Mon Sep 17 00:00:00 2001 From: basssy Date: Mon, 9 Sep 2024 17:02:35 +0900 Subject: [PATCH 1/4] =?UTF-8?q?QSP=20=EA=B3=B5=ED=86=B5=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EB=8F=99=EA=B8=B0=ED=99=94=20post=20->=20put=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/interplug/qcast/biz/commCode/CommCodeController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/interplug/qcast/biz/commCode/CommCodeController.java b/src/main/java/com/interplug/qcast/biz/commCode/CommCodeController.java index 6d5db955..dd8b7414 100644 --- a/src/main/java/com/interplug/qcast/biz/commCode/CommCodeController.java +++ b/src/main/java/com/interplug/qcast/biz/commCode/CommCodeController.java @@ -1,7 +1,7 @@ package com.interplug.qcast.biz.commCode; import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; @@ -22,7 +22,7 @@ public class CommCodeController { private final CommCodeService commCodeService; @Operation(description = "공통코드 COMM_H, COMM_L 정보를 등록/수정 한다.(동기화)") - @PostMapping("/qc-comm-yn-update") + @PutMapping("/qc-comm-yn-update") @ResponseStatus(HttpStatus.OK) public CommCodeResponse setQcCommCdYn(@RequestBody CommCodeRequest codeReq) { CommCodeResponse codeResponse = new CommCodeResponse(); From 500a3b6cf53c3c7cc56b67ab512866af9a41404e Mon Sep 17 00:00:00 2001 From: "LAPTOP-L3VE7KK2\\USER" Date: Mon, 9 Sep 2024 17:34:08 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20API=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 + .../qcast/biz/object/ObjectController.java | 66 +++ .../qcast/biz/object/ObjectMapper.java | 46 ++ .../qcast/biz/object/ObjectService.java | 326 ++++++++++++++ .../qcast/biz/object/dto/ObjectRequest.java | 60 +++ .../qcast/biz/object/dto/ObjectResponse.java | 52 +++ .../qcast/biz/object/dto/PlanRequest.java | 40 ++ .../qcast/biz/object/dto/PlanResponse.java | 40 ++ src/main/resources/config/application-dev.yml | 6 + .../resources/config/application-local.yml | 6 + src/main/resources/config/application-prd.yml | 6 + .../resources/mappers/object/objectMapper.xml | 396 ++++++++++++++++++ 12 files changed, 1050 insertions(+) create mode 100644 src/main/java/com/interplug/qcast/biz/object/ObjectController.java create mode 100644 src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java create mode 100644 src/main/java/com/interplug/qcast/biz/object/ObjectService.java create mode 100644 src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java create mode 100644 src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java create mode 100644 src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java create mode 100644 src/main/java/com/interplug/qcast/biz/object/dto/PlanResponse.java create mode 100644 src/main/resources/mappers/object/objectMapper.xml diff --git a/pom.xml b/pom.xml index 14fe9968..e52bdcc4 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,12 @@ jackson-databind 2.16.1 + + + org.ini4j + ini4j + 0.5.4 + diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectController.java b/src/main/java/com/interplug/qcast/biz/object/ObjectController.java new file mode 100644 index 00000000..034ed544 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectController.java @@ -0,0 +1,66 @@ +package com.interplug.qcast.biz.object; + +import com.interplug.qcast.biz.object.dto.ObjectRequest; +import com.interplug.qcast.biz.object.dto.ObjectResponse; +import com.interplug.qcast.biz.object.dto.PlanRequest; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Slf4j +@RestController +@RequestMapping("/api/object") +@RequiredArgsConstructor +public class ObjectController { + // @Autowired private ObjectService objectService; + private final ObjectService objectService; + + @GetMapping("/v1.0/object") + @ResponseStatus(HttpStatus.OK) + public List selectObjectList(ObjectRequest objectRequest) throws Exception { + return objectService.selectObjectList(objectRequest); + } + + @GetMapping("/v1.0/object/{objectNo}/{planNo}") + @ResponseStatus(HttpStatus.OK) + public ObjectResponse selectObjectDetail(@PathVariable String objectNo, @PathVariable String planNo) throws Exception { + return objectService.selectObjectDetail(objectNo, planNo); + } + + @PostMapping("/v1.0/object") + @ResponseStatus(HttpStatus.CREATED) + public ObjectResponse insertObject(@RequestBody ObjectRequest objectRequest) throws Exception { + return objectService.insertObject(objectRequest); + } + + @PutMapping("/v1.0/object") + @ResponseStatus(HttpStatus.CREATED) + public void updateObject(@RequestBody ObjectRequest objectRequest) throws Exception { + int reust = objectService.updateObject(objectRequest); + } + + @DeleteMapping("/v1.0/object/{objectNo}") + @ResponseStatus(HttpStatus.NO_CONTENT) + public void deleteObject(@PathVariable String objectNo) throws Exception { + objectService.deleteObject(objectNo); + } + + @PostMapping("/v1.0/object/plan") + @ResponseStatus(HttpStatus.CREATED) + public void insertPlan(@RequestBody PlanRequest planRequest) throws Exception { + objectService.insertPlan(planRequest); + } + + @DeleteMapping("/v1.0/object/plan/{objectNo}/{planNo}") + @ResponseStatus(HttpStatus.NO_CONTENT) + public void deletePlan(@PathVariable String objectNo, @PathVariable String planNo) throws Exception { + PlanRequest planRequest = new PlanRequest(); + planRequest.setObjectNo(objectNo); + planRequest.setPlanNo(planNo); + + objectService.deletePlan(planRequest); + } +} diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java b/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java new file mode 100644 index 00000000..934f7f2d --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java @@ -0,0 +1,46 @@ +package com.interplug.qcast.biz.object; + +import com.interplug.qcast.biz.object.dto.ObjectRequest; +import com.interplug.qcast.biz.object.dto.ObjectResponse; +import com.interplug.qcast.biz.object.dto.PlanRequest; +import com.interplug.qcast.biz.object.dto.PlanResponse; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +interface ObjectMapper { + + // 물건정보 목록 조회 + public List selectObjectList(ObjectRequest objectRequest); + + // 물건정보 상세 확인 + public ObjectResponse selectObjectDetail(String objectNo); + + // 물건번호 조회 + public String selectObjectNo(ObjectRequest objectRequest); + + // 물건정보 PLAN 목록 조회 + public List selectPlanList(PlanRequest planRequest); + + // 물건번호 등록 + public int insertObjectNo(ObjectRequest objectRequest); + + // 물건정보 등록 + public int insertObject(ObjectRequest objectRequest); + + // 물건정보 수정 + public int updateObject(ObjectRequest objectRequest); + + // 물건정보 삭제 + public int deleteObject(ObjectRequest objectRequest); + + // 물건정보 > 배송정보 수정 + public int updateObjectDelivery(ObjectRequest objectRequest); + + // 플랜정보 등록 + public int insertPlan(PlanRequest planRequest); + + // 플랜정보 삭제(물리 삭제) + public int deletePlan(PlanRequest planRequest); +} diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java new file mode 100644 index 00000000..721296dd --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java @@ -0,0 +1,326 @@ +package com.interplug.qcast.biz.object; + +import com.interplug.qcast.QCastApplication; +import com.interplug.qcast.biz.object.dto.ObjectRequest; +import com.interplug.qcast.biz.object.dto.ObjectResponse; +import com.interplug.qcast.biz.object.dto.PlanRequest; +import com.interplug.qcast.biz.object.dto.PlanResponse; +import io.micrometer.common.util.StringUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.ini4j.Wini; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Slf4j +@Service +@RequiredArgsConstructor +public class ObjectService { + private final ObjectMapper objectMapper; + private final QCastApplication qCastApplication; + + @Value("${file.ini.root.path}") + private String baseDirPath; + @Value("${file.ini.base.filename}") + private String baseFileName; + + public List selectObjectList(ObjectRequest objectRequest) throws Exception { + return objectMapper.selectObjectList(objectRequest); + } + + public ObjectResponse selectObjectDetail(String objectNo, String planNo) throws Exception { + ObjectResponse objectResponse = new ObjectResponse(); + + // object 상세 정보 조회 + objectResponse = objectMapper.selectObjectDetail(objectNo); + // 선택한 플랜번호 셋팅 + objectResponse.setPlanNo(planNo); + + if (objectResponse != null) { + // ini 파일 읽어 Response 객체 담기 + this.objectFileInfo(objectResponse); + } + + return objectResponse; + } + + public ObjectResponse insertObject(ObjectRequest objectRequest) throws Exception { + int result = 0; + + // 물건번호 등록/조회 + result += objectMapper.insertObjectNo(objectRequest); + String objectNo = objectMapper.selectObjectNo(objectRequest); + objectRequest.setObjectNo(objectNo); + + // 물건정보 등록 + objectRequest.setAddress(objectRequest.getPrefName() + ((!StringUtils.isEmpty(objectRequest.getAddress())) ? objectRequest.getAddress() : "")); + objectRequest.setAddresseeCompanyName(objectRequest.getObjectName() + ' ' + objectRequest.getObjectNameOmit()); + objectRequest.setAddresseeCompanyNameOmit(objectRequest.getObjectNameOmit()); + objectRequest.setContentsPath(baseDirPath + "\\\\" + objectRequest.getObjectNo()); + result += objectMapper.insertObject(objectRequest); + result += objectMapper.updateObjectDelivery(objectRequest); + + // 디폴트 Plan 등록 + PlanRequest planRequest = new PlanRequest(); + planRequest.setObjectNo(objectNo); + planRequest.setRoofKindId("0"); + planRequest.setCharger(objectRequest.getReceiveUser()); + planRequest.setStatus("1"); + planRequest.setDelFlg("0"); + planRequest.setNorthArrangement("0"); + planRequest.setDiffRoofEnabled("0"); + planRequest.setUserId(objectRequest.getUserId()); + result += objectMapper.insertPlan(planRequest); + + // ini 파일 생성 + objectRequest.setPlanNo(planRequest.getPlanNo()); + this.objectFileSave(objectRequest); + + // 결과 데이터 리턴 + ObjectResponse objectResponse = new ObjectResponse(); + objectResponse.setObjectNo(objectNo); + objectResponse.setPlanNo(planRequest.getPlanNo()); + + return objectResponse; + } + + public int updateObject(ObjectRequest objectRequest) throws Exception { + int result = 0; + + // 물건정보 수정 + objectRequest.setAddress(objectRequest.getPrefName() + ((!StringUtils.isEmpty(objectRequest.getAddress())) ? objectRequest.getAddress() : "")); + objectRequest.setAddresseeCompanyName(objectRequest.getObjectName() + ' ' + objectRequest.getObjectNameOmit()); + objectRequest.setAddresseeCompanyNameOmit(objectRequest.getObjectNameOmit()); + objectRequest.setContentsPath(baseDirPath + "\\\\" + objectRequest.getObjectNo()); + result += objectMapper.updateObject(objectRequest); + + // Plan 목록 조회 + PlanRequest planRequest = new PlanRequest(); + planRequest.setObjectNo(objectRequest.getObjectNo()); + List planList = objectMapper.selectPlanList(planRequest); + + for (PlanResponse planResponse : planList) { + objectRequest.setPlanNo(planResponse.getPlanNo()); + + // ini 파일 수정 + this.objectFileSave(objectRequest); + } + + return result; + } + + public int deleteObject(String objectNo) throws Exception { + int result = 0; + + // 물건정보 삭제 + ObjectRequest objectRequest = new ObjectRequest(); + objectRequest.setObjectNo(objectNo); + result = objectMapper.deleteObject(objectRequest); + + return result; + } + + public void objectFileSave(ObjectRequest objectRequest) throws Exception { + + try { + // Dir 및 파일 체크하여 없으면 생성해 준다. (물건번호/플랜번호/파일명) + String dirPath = baseDirPath + File.separator + objectRequest.getObjectNo() + File.separator + objectRequest.getPlanNo(); + File file = new File(dirPath); + if (!file.exists()) { + file.mkdirs(); + } + file = new File(dirPath + File.separator + baseFileName); + if (!file.exists()) { + FileWriter fw = new FileWriter(file); + fw.close(); + } + + // ini4j 라이브러리 이용하여 파일 읽기 + FileInputStream input = new FileInputStream(file); + Wini iniFile = new Wini(new InputStreamReader(input, "MS932")); + + // [物件情報] 영역 코드명 + String groupKey = "物件情報"; + // 판매점명 + objectFileSetting(iniFile, groupKey, "作成者", objectRequest.getSaleStoreName()); + // 경칭 + objectFileSetting(iniFile, groupKey, "敬称", objectRequest.getObjectNameOmit()); + // 후라가나 + objectFileSetting(iniFile, groupKey, "フリガナ", objectRequest.getObjectNameKana()); + // 안건명 + objectFileSetting(iniFile, groupKey, "邸名", objectRequest.getObjectName()); + // 담당자 + objectFileSetting(iniFile, groupKey, "担当者", objectRequest.getReceiveUser()); + // 우편번호 + if (StringUtils.isEmpty(objectRequest.getZipNo())) { + objectRequest.setZipNo("0"); + } + objectFileSetting(iniFile, groupKey, "郵便番号", objectRequest.getZipNo()); + // 도도부현 + objectFileSetting(iniFile, groupKey, "都道府県", objectRequest.getPrefName()); + // 주소 + objectFileSetting(iniFile, groupKey, "住所", objectRequest.getAddress()); + // 발전시뮬레이션 지역 + objectFileSetting(iniFile, groupKey, "地域", objectRequest.getPowerSimArea()); + // 판매오더 예상코드명 + objectFileSetting(iniFile, groupKey, "受注見込", objectRequest.getWorkName()); + // 부동산 분류 코드명 (0/1) + objectFileSetting(iniFile, groupKey, "物件区分", objectRequest.getObjectStatusName()); + // 메모 + objectFileSetting(iniFile, groupKey, "メモ", objectRequest.getRemarks()); + // 설치높이 + objectFileSetting(iniFile, groupKey, "高さ", objectRequest.getInstallHeight()); + // 기준풍속 + objectFileSetting(iniFile, groupKey, "基準風速", objectRequest.getWindSpeed()); + // 수직적설량 + objectFileSetting(iniFile, groupKey, "積雪", objectRequest.getSnowCover()); + // 면조도구분 (III ㆍIV/II) + objectFileSetting(iniFile, groupKey, "面粗度", objectRequest.getSurfaceType()); + // 전력계약 (0/1) + objectFileSetting(iniFile, groupKey, "電力契約", objectRequest.getPowerConTerms()); + // 염해지역 아이템 사용여부 (0/1) + objectFileSetting(iniFile, groupKey, "塩害地域", objectRequest.getSaltAreaChk()); + // 한랭지 대책여부 (0/1) + objectFileSetting(iniFile, groupKey, "寒冷地域", objectRequest.getColdAreaChk()); + // 판매오더 예상코드 + objectFileSetting(iniFile, groupKey, "受注見込コード", objectRequest.getWorkNo()); + // 부동산 분류 코드 + objectFileSetting(iniFile, groupKey, "物件区分コード", objectRequest.getObjectStatusId()); + // 도도부현 코드 + objectFileSetting(iniFile, groupKey, "都道府県コード", objectRequest.getPrefId()); + // 물건번호 + objectFileSetting(iniFile, groupKey, "物件コード", objectRequest.getObjectNo()); + + // 최종 일본어 형식으로 저장 + iniFile.store(new OutputStreamWriter(new FileOutputStream(dirPath + File.separator + baseFileName), "MS932")); + + } catch (Exception e) { + log.error(e.getMessage()); + throw new RuntimeException(e.getMessage()); + } + } + + public void objectFileInfo(ObjectResponse objectResponse) throws Exception { + + try { + String filePath = baseDirPath + File.separator + objectResponse.getObjectNo() + File.separator + objectResponse.getPlanNo() + File.separator + baseFileName; + System.out.println(filePath); + File file = new File(filePath); + + if (file.exists()) { + FileInputStream input = new FileInputStream(file); + Wini iniFile = new Wini(new InputStreamReader(input, "MS932")); + + // [物件情報] 영역 코드명 + String groupKey = "物件情報"; + // 발전시뮬레이션 지역 + if (!StringUtils.isEmpty(iniFile.get(groupKey, "地域"))) { + objectResponse.setPowerSimArea(iniFile.get(groupKey, "地域")); + } + // 주소 + if (!StringUtils.isEmpty(iniFile.get(groupKey, "住所"))) { + objectResponse.setAddress(iniFile.get(groupKey, "住所")); + } + // 설치높이 + if (!StringUtils.isEmpty(iniFile.get(groupKey, "高さ"))) { + objectResponse.setInstallHeight(iniFile.get(groupKey, "高さ")); + } + // 기준풍속 + if (!StringUtils.isEmpty(iniFile.get(groupKey, "基準風速"))) { + objectResponse.setWindSpeed(iniFile.get(groupKey, "基準風速")); + } + // 수직적설량 + if (!StringUtils.isEmpty(iniFile.get(groupKey, "積雪"))) { + objectResponse.setSnowCover(iniFile.get(groupKey, "積雪")); + } + // 면조도구분 (III ㆍIV/II) + if (!StringUtils.isEmpty(iniFile.get(groupKey, "面粗度"))) { + objectResponse.setSurfaceType(iniFile.get(groupKey, "面粗度")); + } + // 전력계약 (0/1) + if (!StringUtils.isEmpty(iniFile.get(groupKey, "電力契約"))) { + objectResponse.setPowerConTerms(iniFile.get(groupKey, "電力契約")); + } + // 염해지역 아이템 사용여부 (0/1) + if (!StringUtils.isEmpty(iniFile.get(groupKey, "塩害地域"))) { + objectResponse.setSaltAreaChk(iniFile.get(groupKey, "塩害地域")); + } + // 한랭지 대책여부 (0/1) + if (!StringUtils.isEmpty(iniFile.get(groupKey, "寒冷地域"))) { + objectResponse.setColdAreaChk(iniFile.get(groupKey, "寒冷地域")); + } + } + + } catch (Exception e) { + log.error(e.getMessage()); + throw new RuntimeException(e.getMessage()); + } + } + + public void objectFileSetting(Wini wini, String groupOptName, String optName, String val) throws Exception { + if (wini.get(groupOptName, optName) != null) { + wini.remove(groupOptName, optName); + } + if (!StringUtils.isEmpty(val)) { + wini.put(groupOptName, optName, val); + } + } + + public String insertPlan(PlanRequest planRequest) throws Exception { + // 추가 Plan 등록 + planRequest.setRoofKindId("0"); + planRequest.setStatus("1"); + planRequest.setDelFlg("0"); + planRequest.setNorthArrangement("0"); + planRequest.setDiffRoofEnabled("0"); + + objectMapper.insertPlan(planRequest); + + try { + String dirPath = baseDirPath + File.separator + planRequest.getObjectNo(); + File file = new File(dirPath + File.separator + planRequest.getPlanNo()); + if (!file.exists()) { + file.mkdirs(); + } + + // ini 파일 복사 + File orgFile = new File(dirPath + File.separator + "1" + File.separator + baseFileName); + File copyFile = new File(dirPath + File.separator + planRequest.getPlanNo() + File.separator + baseFileName); + + Files.copy(orgFile.toPath(), copyFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + + } catch (Exception e) { + log.error(e.getMessage()); + throw new RuntimeException(e.getMessage()); + } + + return planRequest.getPlanNo(); + } + + public void deletePlan(PlanRequest planRequest) throws Exception { + // Plan 삭제 + objectMapper.deletePlan(planRequest); + + try { + SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyyMMddHHmmss"); + Date time = new Date(); + String delTime = dateFormat.format(time); + + String dirPath = baseDirPath + File.separator + planRequest.getObjectNo(); + File file = new File(dirPath + File.separator + planRequest.getPlanNo()); + if (file.exists()) { + file.renameTo(new File (dirPath + File.separator + planRequest.getPlanNo() + "_" + delTime)); + } + } catch (Exception e) { + log.error(e.getMessage()); + throw new RuntimeException(e.getMessage()); + } + } +} diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java new file mode 100644 index 00000000..011cd182 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java @@ -0,0 +1,60 @@ +package com.interplug.qcast.biz.object.dto; + +import lombok.Data; + +@Data +public class ObjectRequest { + // 물건정보 ini 파일 설정 순서에 맞쳐 셋팅 + private String saleStoreName; + private String objectNameOmit; + private String objectNameKana; + private String objectName; + private String receiveUser; + private String zipNo; + private String prefName; + private String address; + private String powerSimArea; + private String workName; + private String objectStatusName; + private String remarks; + private String installHeight; + private String windSpeed; + private String snowCover; + private String surfaceType; + private String powerConTerms; + private String saltAreaChk; + private String coldAreaChk; + private String workNo; + private String objectStatusId; + private String prefId; + private String objectNo; + + // 그외 물건정보 + private String saleStoreId; + private String addresseeCompanyName; + private String addresseeCompanyNameOmit; + private String contentsPath; + private String delFlg; + private String userId; + + // 플랜정보 + private String planNo; + + // 검색정보 + private String schObjectNo; + private String schSaleStoreId; + private String schAddress; + private String schObjectName; + private String schSaleStoreName; + private String schSpecDateYn; + private String schReceiveUser; + private String schDispCompanyName; + + private String schDateType; + private String schFromDt; + private String schToDt; + + // 페이징정보 + private String startRow; + private String endRow; +} diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java new file mode 100644 index 00000000..615abf98 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java @@ -0,0 +1,52 @@ +package com.interplug.qcast.biz.object.dto; + +import lombok.Getter; +import lombok.Setter; + +//@Data +@Getter +@Setter +public class ObjectResponse { + // 물건정보 + private String objectNo; + private String saleStoreId; + private String saleStoreName; + private String workNo; + private String objectStatusId; + private String objectName; + private String objectNameOmit; + private String objectNameKana; + private String zipNo; + private String prefId; + private String address; + private String remarks; + private String sameObjectInfo; + private String receiveCompanyName; + private String receiveUser; + private String contentsPath; + private String specDate; + private String dispCompanyName; + + private String createDatetime; + private String createUserName; + private String lastEditDatetime; + private String lastEditUserName; + + // ini 설정정보 + private String powerSimArea; + private String windSpeed; + private String snowCover; + private String surfaceType; + private String installHeight; + private String powerConTerms; + private String coldAreaChk; + private String saltAreaChk; + + // 플랜정보 + private String planNo; + private String planTotCnt; + + // 페이징 정보 + private Integer rowNumber; + private Integer totCnt; +} diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java b/src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java new file mode 100644 index 00000000..37edc3eb --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java @@ -0,0 +1,40 @@ +package com.interplug.qcast.biz.object.dto; + +import lombok.Data; + +@Data +public class PlanRequest { + private String objectNo; + private String planNo; + private String constructSpecification; + private String setupHeight; + private String weatherPoint; + private String roofKindId; + private String slope; + private String roofMaterialClassId; + private String roofMaterialId; + private String supportMethodId; + private String moduleModel; + private String charger; + private String estimateValidityTerm; + private String decisionPlan; + private String number; + private String capacity; + private String snowfall; + private String standardWindSpeedCheck; + private String optionCover; + private String hanwfaFlg; + private String standKindId; + private String standardWindSpeedId; + private String supportMeaker; + private String consumptionTaxId; + private String status; + private String userId; + private String delFlg; + private String pcTypeNo; + private String northArrangement; + private String roofMaterialIdMulti; + private String supportMethodIdMulti; + private String supportMeakerMulti; + private String diffRoofEnabled; +} diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/PlanResponse.java b/src/main/java/com/interplug/qcast/biz/object/dto/PlanResponse.java new file mode 100644 index 00000000..592788ff --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/object/dto/PlanResponse.java @@ -0,0 +1,40 @@ +package com.interplug.qcast.biz.object.dto; + +import lombok.Data; + +@Data +public class PlanResponse { + private String objectNo; + private String planNo; + private String constructSpecification; + private String setupHeight; + private String weatherPoint; + private String roofKindId; + private String slope; + private String roofMaterialClassId; + private String roofMaterialId; + private String supportMethodId; + private String moduleModel; + private String charger; + private String estimateValidityTerm; + private String decisionPlan; + private String number; + private String capacity; + private String snowfall; + private String standardWindSpeedCheck; + private String optionCover; + private String hanwfaFlg; + private String standKindId; + private String standardWindSpeedId; + private String supportMeaker; + private String consumptionTaxId; + private String status; + private String userId; + private String delFlg; + private String pcTypeNo; + private String northArrangement; + private String roofMaterialIdMulti; + private String supportMethodIdMulti; + private String supportMeakerMulti; + private String diffRoofEnabled; +} diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index af17ad8f..ddd3a94d 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -26,3 +26,9 @@ spring: #QSP qsp: url: http://172.23.4.129:8120 + +#File +file: + root.path: "C:\\" + ini.root.path: "C:\\NewEstimate" + ini.base.filename: "料金シミュレーション.ini" \ No newline at end of file diff --git a/src/main/resources/config/application-local.yml b/src/main/resources/config/application-local.yml index 5b7d4bf9..672d31a7 100644 --- a/src/main/resources/config/application-local.yml +++ b/src/main/resources/config/application-local.yml @@ -26,3 +26,9 @@ spring: #QSP qsp: url: http://localhost:8120 + +#File +file: + root.path: "C:\\" + ini.root.path: "C:\\NewEstimate" + ini.base.filename: "料金シミュレーション.ini" \ No newline at end of file diff --git a/src/main/resources/config/application-prd.yml b/src/main/resources/config/application-prd.yml index f1edf21a..d804964d 100644 --- a/src/main/resources/config/application-prd.yml +++ b/src/main/resources/config/application-prd.yml @@ -26,3 +26,9 @@ spring: #QSP qsp: url: http://jp.qsalesplatform.com + +#File +file: + root.path: "C:\\" + ini.root.path: "\\10.31.0.21\NewEstimate" + ini.base.filename: "料金シミュレーション.ini" \ No newline at end of file diff --git a/src/main/resources/mappers/object/objectMapper.xml b/src/main/resources/mappers/object/objectMapper.xml new file mode 100644 index 00000000..9e84c9ad --- /dev/null +++ b/src/main/resources/mappers/object/objectMapper.xml @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + /* sqlid : com.interplug.qcast.biz.object.insertObjectNo */ + INSERT INTO T_OBJECT_NO + ( + SALE_STORE_ID + , YEAR + , MONTH + , DAY + , NO + ) + SELECT + #{saleStoreId} + , RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR), 2) + , RIGHT('0' + CAST(MONTH(GETDATE()) AS VARCHAR), 2) + , RIGHT('0' + CAST(DAY(GETDATE()) AS VARCHAR), 2) + , ISNULL(MAX(NO), 0) + 1 FROM T_OBJECT_NO WHERE SALE_STORE_ID = #{saleStoreId} AND YEAR = RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR), 2) AND MONTH = RIGHT('0' + CAST(MONTH(GETDATE()) AS VARCHAR), 2) AND DAY = RIGHT('0' + CAST(DAY(GETDATE()) AS VARCHAR), 2) + + + + /* sqlid : com.interplug.qcast.biz.object.insertObject */ + INSERT INTO T_OBJECT + ( + OBJECT_NO + , SALE_STORE_ID + , OBJECT_STATUS_ID + , OBJECT_NAME + , OBJECT_NAME_OMIT + , OBJECT_NAME_KANA + , ZIP_NO + , PREF_ID + , ADDRESS + , ADDRESSEE_COMPANY_NAME + , ADDRESSEE_COMPANY_NAME_OMIT + , REMARKS + , SAME_OBJECT_INFO + , RECEIVE_USER + , DELIVERY_HOPE_DATE + , CONSTRUCT_SCHEDULED_DATE + , CAR_KIND_CD + , TRACK_KAIND + , TRACK_10T_DELIVERY + , TRACK_WEIGHT + , TRACK_TIME_SPECIFY + , FORKLIFT + , HOUSE_CLASS_CD + , FIRST_STORE_CHARGER + , CONTENTS_PATH + , DEL_FLG + , LAST_EDIT_DATETIME + , LAST_EDIT_USER + , EDIT_AGENCY + , NORTH_ARRANGEMENT + ) VALUES ( + #{objectNo} + , #{saleStoreId} + , #{objectStatusId} + , #{objectName} + , #{objectNameOmit} + , #{objectNameKana} + , #{zipNo} + , #{prefId} + , #{address} + , #{addresseeCompanyName} + , #{addresseeCompanyNameOmit} + , #{remarks} + , '1' + , #{receiveUser} + , GETDATE() + , GETDATE() + , '0' + , '4' + , '1' + , '10' + , '0' + , '1' + , '0' + , #{receiveUser} + , #{contentsPath} + , '0' + , GETDATE() + , #{userId} + , '0' + , '0' + ) + + + + /* sqlid : com.interplug.qcast.biz.object.updateObject */ + UPDATE T_OBJECT + SET + OBJECT_STATUS_ID = #{objectStatusId} + , OBJECT_NAME = #{objectName} + , OBJECT_NAME_OMIT = #{objectNameOmit} + , OBJECT_NAME_KANA = #{objectNameKana} + , ZIP_NO = #{zipNo} + , PREF_ID = #{prefId} + , ADDRESS = #{address} + , ADDRESSEE_COMPANY_NAME = #{addresseeCompanyName} + , ADDRESSEE_COMPANY_NAME_OMIT = #{addresseeCompanyNameOmit} + , REMARKS = #{remarks} + , RECEIVE_USER = #{receiveUser} + , LAST_EDIT_DATETIME = GETDATE() + , LAST_EDIT_USER = #{userId} + WHERE OBJECT_NO = #{objectNo} + + + + /* sqlid : com.interplug.qcast.biz.object.updateObjectDelivery */ + UPDATE A SET + A.RECEIVE_COMPANY_NAME = B.DISP_COMPANY_NAME + , A.DELIVERY_ZIP_NO = B.DISP_ZIP_NO + , A.DELIVERY_TARGET = B.DISP_ADDRESS + , A.DELIVERY_TEL = B.DISP_TEL + FROM T_OBJECT AS A + INNER JOIN M_SALES_STORE AS B + ON A.SALE_STORE_ID = B.SALE_STORE_ID + WHERE A.OBJECT_NO = #{objectNo} + + + + /* sqlid : com.interplug.qcast.biz.object.deleteObject */ + UPDATE T_OBJECT + SET + DEL_FLG = '1' + , LAST_EDIT_DATETIME = GETDATE() + , LAST_EDIT_USER = #{userId} + WHERE OBJECT_NO = #{objectNo} + + + + /* sqlid : com.interplug.qcast.biz.object.insertPlan*/ + + SELECT CAST(ISNULL(MAX(PLAN_NO), 0) + 1 AS NVARCHAR) FROM T_PLAN WHERE OBJECT_NO = #{objectNo} + + + INSERT INTO T_PLAN + ( + OBJECT_NO + , PLAN_NO + , CONSTRUCT_SPECIFICATION + , SETUP_HEIGHT + , WEATHER_POINT + , ROOF_KIND_ID + , SLOPE + , ROOF_MATERIAL_CLASS_ID + , ROOF_MATERIAL_ID + , SUPPORT_METHOD_ID + , MODULE_MODEL + , CHARGER + , ESTIMATE_VALIDITY_TERM + , DECISION_PLAN + , NUMBER + , CAPACITY + , SNOWFALL + , STANDARD_WIND_SPEED_CHECK + , OPTION_COVER + , HANWFA_FLG + , STAND_KIND_ID + , STANDARD_WIND_SPEED_ID + , SUPPORT_MEAKER + , CONSUMPTION_TAX_ID + , STATUS + , LAST_EDIT_DATETIME + , LAST_EDIT_USER + , DEL_FLG + , PC_TYPE_NO + , NORTH_ARRANGEMENT + , ROOF_MATERIAL_ID_MULTI + , SUPPORT_METHOD_ID_MULTI + , SUPPORT_MEAKER_MULTI + , DIFF_ROOF_ENABLED + ) VALUES ( + #{objectNo} + , #{planNo} + , #{constructSpecification} + , #{setupHeight} + , #{weatherPoint} + , #{roofKindId} + , #{slope} + , #{roofMaterialClassId} + , #{roofMaterialId} + , #{supportMethodId} + , #{moduleModel} + , (SELECT RECEIVE_USER FROM T_OBJECT WHERE OBJECT_NO = #{objectNo}) + , #{estimateValidityTerm} + , CASE WHEN #{planNo} = '1' THEN '1' ELSE '0' END + , #{number} + , #{capacity} + , #{snowfall} + , #{standardWindSpeedCheck} + , #{optionCover} + , #{hanwfaFlg} + , #{standKindId} + , #{standardWindSpeedId} + , #{supportMeaker} + , #{consumptionTaxId} + , #{status} + , GETDATE() + , #{userId} + , #{delFlg} + , #{pcTypeNo} + , #{northArrangement} + , #{roofMaterialIdMulti} + , #{supportMethodIdMulti} + , #{supportMeakerMulti} + , #{diffRoofEnabled} + ) + + + + /* sqlid : com.interplug.qcast.biz.object.deletePlan */ + DELETE FROM T_PLAN + WHERE OBJECT_NO = #{objectNo} + AND PLAN_NO = #{planNo} + + + \ No newline at end of file From 6383a075dad7be6dc1ee51b333220756057fb53a Mon Sep 17 00:00:00 2001 From: "LAPTOP-L3VE7KK2\\USER" Date: Mon, 9 Sep 2024 17:39:49 +0900 Subject: [PATCH 3/4] =?UTF-8?q?application=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/config/application-dev.yml | 6 +++--- src/main/resources/config/application-local.yml | 6 +++--- src/main/resources/config/application-prd.yml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index ddd3a94d..1333ae56 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -29,6 +29,6 @@ qsp: #File file: - root.path: "C:\\" - ini.root.path: "C:\\NewEstimate" - ini.base.filename: "料金シミュレーション.ini" \ No newline at end of file + root.path: C:\\ + ini.root.path: C:\\NewEstimate + ini.base.filename: 料金シミュレーション.ini \ No newline at end of file diff --git a/src/main/resources/config/application-local.yml b/src/main/resources/config/application-local.yml index 672d31a7..c1c62b35 100644 --- a/src/main/resources/config/application-local.yml +++ b/src/main/resources/config/application-local.yml @@ -29,6 +29,6 @@ qsp: #File file: - root.path: "C:\\" - ini.root.path: "C:\\NewEstimate" - ini.base.filename: "料金シミュレーション.ini" \ No newline at end of file + root.path: C:\\ + ini.root.path: C:\\NewEstimate + ini.base.filename: 料金シミュレーション.ini \ No newline at end of file diff --git a/src/main/resources/config/application-prd.yml b/src/main/resources/config/application-prd.yml index d804964d..774caf0b 100644 --- a/src/main/resources/config/application-prd.yml +++ b/src/main/resources/config/application-prd.yml @@ -29,6 +29,6 @@ qsp: #File file: - root.path: "C:\\" - ini.root.path: "\\10.31.0.21\NewEstimate" - ini.base.filename: "料金シミュレーション.ini" \ No newline at end of file + root.path: C:\\ + ini.root.path: \\10.31.0.21\NewEstimate + ini.base.filename: 料金シミュレーション.ini \ No newline at end of file From c0c564de4f79693630c244db888bee38f645e551 Mon Sep 17 00:00:00 2001 From: "LAPTOP-L3VE7KK2\\USER" Date: Mon, 9 Sep 2024 17:55:36 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Swagger=20=EC=A3=BC=EC=84=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qcast/biz/object/ObjectController.java | 16 +++++++++++++--- .../qcast/biz/object/ObjectService.java | 6 +++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectController.java b/src/main/java/com/interplug/qcast/biz/object/ObjectController.java index 034ed544..61df884e 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectController.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectController.java @@ -3,6 +3,8 @@ package com.interplug.qcast.biz.object; import com.interplug.qcast.biz.object.dto.ObjectRequest; import com.interplug.qcast.biz.object.dto.ObjectResponse; import com.interplug.qcast.biz.object.dto.PlanRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; @@ -14,46 +16,54 @@ import java.util.List; @RestController @RequestMapping("/api/object") @RequiredArgsConstructor +@Tag(name = "ObjectController", description = "물건정보 관련 API") public class ObjectController { // @Autowired private ObjectService objectService; private final ObjectService objectService; + @Operation(description = "물건정보 목록을 조회한다.") @GetMapping("/v1.0/object") @ResponseStatus(HttpStatus.OK) public List selectObjectList(ObjectRequest objectRequest) throws Exception { return objectService.selectObjectList(objectRequest); } - @GetMapping("/v1.0/object/{objectNo}/{planNo}") + @Operation(description = "물건정보 상세를 조회한다.") + @GetMapping("/v1.0/object/{objectNo}") @ResponseStatus(HttpStatus.OK) - public ObjectResponse selectObjectDetail(@PathVariable String objectNo, @PathVariable String planNo) throws Exception { - return objectService.selectObjectDetail(objectNo, planNo); + public ObjectResponse selectObjectDetail(@PathVariable String objectNo) throws Exception { + return objectService.selectObjectDetail(objectNo); } + @Operation(description = "물건정보을 저장한다.") @PostMapping("/v1.0/object") @ResponseStatus(HttpStatus.CREATED) public ObjectResponse insertObject(@RequestBody ObjectRequest objectRequest) throws Exception { return objectService.insertObject(objectRequest); } + @Operation(description = "물건정보을 수정한다.") @PutMapping("/v1.0/object") @ResponseStatus(HttpStatus.CREATED) public void updateObject(@RequestBody ObjectRequest objectRequest) throws Exception { int reust = objectService.updateObject(objectRequest); } + @Operation(description = "물건정보을 삭제한다.") @DeleteMapping("/v1.0/object/{objectNo}") @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteObject(@PathVariable String objectNo) throws Exception { objectService.deleteObject(objectNo); } + @Operation(description = "물건정보의 플랜정보를 추가한다.") @PostMapping("/v1.0/object/plan") @ResponseStatus(HttpStatus.CREATED) public void insertPlan(@RequestBody PlanRequest planRequest) throws Exception { objectService.insertPlan(planRequest); } + @Operation(description = "물건정보의 플랜정보를 삭제한다.") @DeleteMapping("/v1.0/object/plan/{objectNo}/{planNo}") @ResponseStatus(HttpStatus.NO_CONTENT) public void deletePlan(@PathVariable String objectNo, @PathVariable String planNo) throws Exception { diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java index 721296dd..5c7cb7f5 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java @@ -35,13 +35,13 @@ public class ObjectService { return objectMapper.selectObjectList(objectRequest); } - public ObjectResponse selectObjectDetail(String objectNo, String planNo) throws Exception { + public ObjectResponse selectObjectDetail(String objectNo) throws Exception { ObjectResponse objectResponse = new ObjectResponse(); // object 상세 정보 조회 objectResponse = objectMapper.selectObjectDetail(objectNo); - // 선택한 플랜번호 셋팅 - objectResponse.setPlanNo(planNo); + // 기본 플랜번호 셋팅 + objectResponse.setPlanNo("1"); if (objectResponse != null) { // ini 파일 읽어 Response 객체 담기