diff --git a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java index 269753a..566a042 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java @@ -19,7 +19,6 @@ import org.mapstruct.factory.Mappers; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; diff --git a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java b/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java index c991539..8e1659d 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java @@ -1,9 +1,14 @@ package com.xit.biz.ctgy.controller; +import com.xit.biz.ctgy.dto.GnRecallScDto; +import com.xit.biz.ctgy.dto.MinInfoBoard680Dto; import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct; +import com.xit.biz.ctgy.entity.MinInfoBoard680; import com.xit.biz.ctgy.service.IResidentService; import com.xit.core.api.IRestResponse; import com.xit.core.api.RestResponse; +import com.xit.core.util.AssertUtils; +import com.xit.core.util.Checks; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; @@ -12,11 +17,14 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.mapstruct.factory.Mappers; import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.annotation.Nonnull; + @Tag(name = "ResidentController", description = "거주자의견진술 관리") @RestController @RequestMapping("/api/v1/ctgy/resident") @@ -41,6 +49,16 @@ public class ResidentController { return RestResponse.of(service.findResidentDatas(pageable)); } + @Operation(summary = "거주자 의견진술 자료 등록", description = "거주자 의견진술 자료 등록") + @PostMapping(value = "/data", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public ResponseEntity saveResidentData(@Nonnull GnRecallScDto dto) { + AssertUtils.isTrue(!Checks.isEmpty(dto), "등록할 거주자 의견진술 자료가 존재하지 않습니다."); + + service.saveResidentData(mapstruct.toEntity(dto), dto.getPicadFiles(), dto.getFrecadFiles(), dto.getContadFiles()); + return RestResponse.of(HttpStatus.OK); + // return RestResponse.of(HttpStatus.OK); + } + @Operation(summary = "거주자의견진술 상세" , description = "거주자의견진술 상세") @Parameters({ @Parameter(in = ParameterIn.PATH, name = "scCode", description = "의견진술번호", required = true, example = "3778"), diff --git a/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java b/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java index 398197e..3b3ca9b 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java @@ -5,6 +5,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.springframework.web.multipart.MultipartFile; @Schema(name = "GnRecallScDto", description = "") @Getter @@ -129,4 +130,14 @@ public class GnRecallScDto { @Schema(required = true, title = " ", example = " ", description = " ") private String scStateNm; + @Schema(required = false, title = "단속사진파일", example = " ", description = "단속사진파일") + private MultipartFile[] picadFiles; + + @Schema(required = false, title = "진술서파일", example = " ", description = "진술서파일") + private MultipartFile[] frecadFiles; + + @Schema(required = false, title = "첨부자료파일", example = " ", description = "첨부자료파일") + private MultipartFile[] contadFiles; + + } diff --git a/src/main/java/com/xit/biz/ctgy/service/IResidentService.java b/src/main/java/com/xit/biz/ctgy/service/IResidentService.java index 68d6cb5..d56d777 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentService.java @@ -4,6 +4,7 @@ import com.xit.biz.ctgy.dto.GnRecallScDto; import com.xit.biz.ctgy.entity.GnRecallSc; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Nonnull; import java.util.List; @@ -15,4 +16,6 @@ public interface IResidentService { GnRecallScDto findResident(final Long scCode); Page findAll(final GnRecallSc entity, Pageable pageable); + + void saveResidentData(GnRecallSc entity, MultipartFile[] picadFiles, MultipartFile[] frecadFiles, MultipartFile[] contadFiles); } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java index d70ebb7..d69fc85 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java @@ -6,12 +6,15 @@ import com.xit.biz.ctgy.repository.*; import com.xit.biz.ctgy.service.IResidentService; import com.xit.core.support.jpa.JpaUtil; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.*; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; @Service @RequiredArgsConstructor +@Slf4j public class ResidentService implements IResidentService { private final IResidentRepository repository; @@ -49,4 +52,9 @@ public class ResidentService implements IResidentService { // List userList = page.getContent(); return page; } + + @Override + public void saveResidentData(GnRecallSc entity, MultipartFile[] picadFiles, MultipartFile[] frecadFiles, MultipartFile[] contadFiles) { + log.debug("{}{}{}{}", entity, picadFiles, frecadFiles, contadFiles); + } }