회원가입, 회원정보수정, 회원탈퇴, 패스워드초기화, 상태수정, 역할 추가, 역할 삭제, 회원목록 추가
This commit is contained in:
@@ -10,30 +10,18 @@ import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFoldersDto;
|
|||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
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.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@Tag(name = "영상 관리", description = "영상 관리 API")
|
@Tag(name = "영상 관리", description = "영상 관리 API")
|
||||||
@@ -59,69 +47,57 @@ public class MapSheetMngApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/folder-list")
|
@PostMapping("/folder-list")
|
||||||
public ApiResponseDto<List<FileDto.FolderDto>> getDir(
|
public ApiResponseDto<List<FileDto.FolderDto>> getDir(@RequestBody SrchFoldersDto srchDto) {
|
||||||
@RequestBody SrchFoldersDto srchDto
|
|
||||||
) {
|
|
||||||
return ApiResponseDto.createOK(mapSheetMngService.getFolderAll(srchDto));
|
return ApiResponseDto.createOK(mapSheetMngService.getFolderAll(srchDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "파일목록 조회", description = "파일목록 조회")
|
@Operation(summary = "파일목록 조회", description = "파일목록 조회")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
responseCode = "200",
|
responseCode = "200",
|
||||||
description = "조회 성공",
|
description = "조회 성공",
|
||||||
content =
|
content =
|
||||||
@Content(
|
@Content(
|
||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/file-list")
|
@PostMapping("/file-list")
|
||||||
public ApiResponseDto<FilesDto> getFiles(
|
public ApiResponseDto<FilesDto> getFiles(@RequestBody SrchFilesDto srchDto) {
|
||||||
@RequestBody SrchFilesDto srchDto
|
|
||||||
) {
|
|
||||||
|
|
||||||
return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto));
|
return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 오류데이터 목록 조회
|
* 오류데이터 목록 조회
|
||||||
|
*
|
||||||
* @param searchReq
|
* @param searchReq
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/error-list")
|
@PostMapping("/error-list")
|
||||||
public ApiResponseDto<Page<MapSheetMngDto.ErrorDataDto>> findMapSheetErrorList(
|
public ApiResponseDto<Page<MapSheetMngDto.ErrorDataDto>> findMapSheetErrorList(
|
||||||
@RequestBody
|
@RequestBody @Valid MapSheetMngDto.searchReq searchReq) {
|
||||||
@Valid
|
|
||||||
MapSheetMngDto.searchReq searchReq
|
|
||||||
){
|
|
||||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq));
|
return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "영상관리목록 조회", description = "영상관리목록 조회")
|
@Operation(summary = "영상관리목록 조회", description = "영상관리목록 조회")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
responseCode = "200",
|
responseCode = "200",
|
||||||
description = "조회 성공",
|
description = "조회 성공",
|
||||||
content =
|
content =
|
||||||
@Content(
|
@Content(
|
||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/mng-list")
|
@PostMapping("/mng-list")
|
||||||
public ApiResponseDto<Page<MapSheetMngDto.MngDto>> findMapSheetMngList(
|
public ApiResponseDto<Page<MapSheetMngDto.MngDto>> findMapSheetMngList(
|
||||||
@RequestBody
|
@RequestBody @Valid MapSheetMngDto.searchReq searchReq) {
|
||||||
@Valid
|
|
||||||
MapSheetMngDto.searchReq searchReq
|
|
||||||
){
|
|
||||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList(searchReq));
|
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList(searchReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,27 +62,25 @@ public class MapSheetMngDto {
|
|||||||
private DataState dataState;
|
private DataState dataState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Schema(name = "MngDto", description = "영상관리 검색 리턴")
|
@Schema(name = "MngDto", description = "영상관리 검색 리턴")
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public static class MngDto{
|
public static class MngDto {
|
||||||
private int rowNum;
|
private int rowNum;
|
||||||
private int mngYyyy;
|
private int mngYyyy;
|
||||||
private String mngState;
|
private String mngState;
|
||||||
private String syncState;
|
private String syncState;
|
||||||
private String mngStateDttm;
|
private String mngStateDttm;
|
||||||
private String syncStateDttm;
|
private String syncStateDttm;
|
||||||
//private int sheetCnt;
|
// private int sheetCnt;
|
||||||
//private int exceptCnt;
|
// private int exceptCnt;
|
||||||
private String mngPath;
|
private String mngPath;
|
||||||
private String createdDttm;
|
private String createdDttm;
|
||||||
private Long createdUid;
|
private Long createdUid;
|
||||||
private String updatedDttm;
|
private String updatedDttm;
|
||||||
private Long updatedUid;
|
private Long updatedUid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ public class MapSheetMngService {
|
|||||||
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);
|
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq) {
|
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
||||||
|
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||||
return mapSheetMngCoreService.findMapSheetMngList(searchReq);
|
return mapSheetMngCoreService.findMapSheetMngList(searchReq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
@Tag(name = "회원정보 관리자 관리", description = "회원정보 관리자 관리 API")
|
@Tag(name = "회원정보 관리자 관리", description = "회원정보 관리자 관리 API")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/admin")
|
@RequestMapping("/api/admin/members")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AdminApiController {
|
public class AdminApiController {
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ public class AdminApiController {
|
|||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/members/join")
|
@PostMapping("/join")
|
||||||
public ApiResponseDto<Long> saveMember(
|
public ApiResponseDto<Long> saveMember(
|
||||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||||
description = "회원가입",
|
description = "회원가입",
|
||||||
@@ -55,7 +56,7 @@ public class AdminApiController {
|
|||||||
return ApiResponseDto.createOK(adminService.saveMember(addReq));
|
return ApiResponseDto.createOK(adminService.saveMember(addReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "역할 저장", description = "역할 저장")
|
@Operation(summary = "역할 추가", description = "uuid 기준으로 역할 추가")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
@@ -85,7 +86,7 @@ public class AdminApiController {
|
|||||||
return ApiResponseDto.createOK(rolesDto.getUuid());
|
return ApiResponseDto.createOK(rolesDto.getUuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "역할 삭제", description = "역할 삭제")
|
@Operation(summary = "역할 삭제", description = "uuid 기준으로 역할 삭제")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
@@ -114,4 +115,74 @@ public class AdminApiController {
|
|||||||
adminService.deleteRoles(rolesDto);
|
adminService.deleteRoles(rolesDto);
|
||||||
return ApiResponseDto.createOK(rolesDto.getUuid());
|
return ApiResponseDto.createOK(rolesDto.getUuid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "상태 수정", description = "상태 수정")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "상태 수정",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = UUID.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping("/status/update")
|
||||||
|
public ApiResponseDto<UUID> updateStatus(
|
||||||
|
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||||
|
description = "상태 수정",
|
||||||
|
required = true,
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = MembersDto.StatusDto.class)))
|
||||||
|
@RequestBody
|
||||||
|
@Valid
|
||||||
|
MembersDto.StatusDto statusDto) {
|
||||||
|
adminService.updateStatus(statusDto);
|
||||||
|
return ApiResponseDto.createOK(statusDto.getUuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "회원 탈퇴", description = "회원 탈퇴")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "회원 탈퇴",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = UUID.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping("/delete-account")
|
||||||
|
public ApiResponseDto<UUID> deleteAccount(MembersDto.StatusDto statusDto) {
|
||||||
|
adminService.deleteAccount(statusDto);
|
||||||
|
return ApiResponseDto.createOK(statusDto.getUuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "패스워드 초기화", description = "패스워드 초기화")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "패스워드 초기화",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = Long.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping("/{memberId}/password")
|
||||||
|
public ApiResponseDto<Long> resetPassword(@PathVariable Long memberId) {
|
||||||
|
adminService.resetPassword(memberId);
|
||||||
|
return ApiResponseDto.createOK(memberId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -42,4 +44,25 @@ public class MembersApiController {
|
|||||||
public ApiResponseDto<Page<Basic>> getMemberList(@RequestBody MembersDto.SearchReq searchReq) {
|
public ApiResponseDto<Page<Basic>> getMemberList(@RequestBody MembersDto.SearchReq searchReq) {
|
||||||
return ApiResponseDto.ok(membersService.findByMembers(searchReq));
|
return ApiResponseDto.ok(membersService.findByMembers(searchReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "회원정보 수정", description = "회원정보 수정")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "201",
|
||||||
|
description = "회원정보 수정",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = UUID.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping("/{uuid}")
|
||||||
|
public ApiResponseDto<UUID> updateMember(
|
||||||
|
@PathVariable UUID uuid, @RequestBody MembersDto.UpdateReq updateReq) {
|
||||||
|
membersService.updateMember(uuid, updateReq);
|
||||||
|
return ApiResponseDto.createOK(uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,9 +99,7 @@ public class MembersDto {
|
|||||||
@Size(min = 2, max = 100)
|
@Size(min = 2, max = 100)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "패스워드", example = "")
|
@Schema(hidden = true)
|
||||||
@NotBlank
|
|
||||||
@Size(max = 255)
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Schema(description = "이메일", example = "gildong@daum.net")
|
@Schema(description = "이메일", example = "gildong@daum.net")
|
||||||
@@ -116,12 +114,42 @@ public class MembersDto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public static class UpdateReq {
|
||||||
|
|
||||||
|
@Schema(description = "사번, 패스워드 변경시 필수 값", example = "11111")
|
||||||
|
@Size(max = 50)
|
||||||
|
private String employeeNo;
|
||||||
|
|
||||||
|
@Schema(description = "이름", example = "홍길동")
|
||||||
|
@Size(min = 2, max = 100)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "패스워드", example = "")
|
||||||
|
@Size(max = 255)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Schema(description = "이메일", example = "gildong@daum.net")
|
||||||
|
@Size(max = 100)
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public UpdateReq(String employeeNo, String name, String password, String email) {
|
||||||
|
this.employeeNo = employeeNo;
|
||||||
|
this.name = name;
|
||||||
|
this.password = password;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public static class RolesDto {
|
public static class RolesDto {
|
||||||
|
|
||||||
|
@Schema(description = "UUID", example = "4e89e487-c828-4a34-a7fc-0d5b0e3b53b5")
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
|
|
||||||
|
@Schema(description = "역할 ROLE_ADMIN, ROLE_LABELER, ROLE_REVIEWER", example = "ROLE_ADMIN")
|
||||||
@EnumValid(enumClass = RoleType.class)
|
@EnumValid(enumClass = RoleType.class)
|
||||||
private String roleName;
|
private String roleName;
|
||||||
|
|
||||||
@@ -130,4 +158,19 @@ public class MembersDto {
|
|||||||
this.roleName = roleName;
|
this.roleName = roleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class StatusDto {
|
||||||
|
|
||||||
|
@Schema(description = "UUID", example = "4e89e487-c828-4a34-a7fc-0d5b0e3b53b5")
|
||||||
|
@NotBlank
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
|
@Schema(description = "변경할 상태값 ACTIVE, INACTIVE, ARCHIVED", example = "ACTIVE")
|
||||||
|
@NotBlank
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
|||||||
import com.kamco.cd.kamcoback.postgres.core.MembersCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.MembersCoreService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.mindrot.jbcrypt.BCrypt;
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -15,6 +16,9 @@ public class AdminService {
|
|||||||
|
|
||||||
private final MembersCoreService membersCoreService;
|
private final MembersCoreService membersCoreService;
|
||||||
|
|
||||||
|
@Value("${member.init_password}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 회원가입
|
* 회원가입
|
||||||
*
|
*
|
||||||
@@ -23,11 +27,11 @@ public class AdminService {
|
|||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public Long saveMember(MembersDto.AddReq addReq) {
|
public Long saveMember(MembersDto.AddReq addReq) {
|
||||||
// salt 생성
|
// salt 생성, 사번이 salt
|
||||||
String salt = BCryptSaltGenerator.generateSaltWithEmployeeNo(addReq.getEmployeeNo());
|
String salt = BCryptSaltGenerator.generateSaltWithEmployeeNo(addReq.getEmployeeNo().trim());
|
||||||
|
|
||||||
// 패스워드 암호화
|
// 패스워드 암호화, 초기 패스워드 고정
|
||||||
String hashedPassword = BCrypt.hashpw(addReq.getPassword(), salt);
|
String hashedPassword = BCrypt.hashpw(password, salt);
|
||||||
addReq.setPassword(hashedPassword);
|
addReq.setPassword(hashedPassword);
|
||||||
return membersCoreService.saveMembers(addReq);
|
return membersCoreService.saveMembers(addReq);
|
||||||
}
|
}
|
||||||
@@ -50,4 +54,31 @@ public class AdminService {
|
|||||||
public void deleteRoles(MembersDto.RolesDto rolesDto) {
|
public void deleteRoles(MembersDto.RolesDto rolesDto) {
|
||||||
membersCoreService.deleteRoles(rolesDto);
|
membersCoreService.deleteRoles(rolesDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 역할 수정
|
||||||
|
*
|
||||||
|
* @param statusDto
|
||||||
|
*/
|
||||||
|
public void updateStatus(MembersDto.StatusDto statusDto) {
|
||||||
|
membersCoreService.updateStatus(statusDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 회원 탈퇴
|
||||||
|
*
|
||||||
|
* @param statusDto
|
||||||
|
*/
|
||||||
|
public void deleteAccount(MembersDto.StatusDto statusDto) {
|
||||||
|
membersCoreService.deleteAccount(statusDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 패스워드 초기화
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void resetPassword(Long id) {
|
||||||
|
membersCoreService.resetPassword(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
package com.kamco.cd.kamcoback.members.service;
|
package com.kamco.cd.kamcoback.members.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.config.BCryptSaltGenerator;
|
||||||
import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
||||||
import com.kamco.cd.kamcoback.members.dto.MembersDto.Basic;
|
import com.kamco.cd.kamcoback.members.dto.MembersDto.Basic;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.MembersCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.MembersCoreService;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -24,4 +29,30 @@ public class MembersService {
|
|||||||
public Page<Basic> findByMembers(MembersDto.SearchReq searchReq) {
|
public Page<Basic> findByMembers(MembersDto.SearchReq searchReq) {
|
||||||
return membersCoreService.findByMembers(searchReq);
|
return membersCoreService.findByMembers(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 회원정보 수정
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @param updateReq
|
||||||
|
*/
|
||||||
|
public void updateMember(UUID uuid, MembersDto.UpdateReq updateReq) {
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(updateReq.getPassword())) {
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(updateReq.getEmployeeNo())) {
|
||||||
|
throw new HttpMessageNotReadableException("패스워드 변경시 사번은 필수 값입니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// salt 생성, 사번이 salt
|
||||||
|
String salt =
|
||||||
|
BCryptSaltGenerator.generateSaltWithEmployeeNo(updateReq.getEmployeeNo().trim());
|
||||||
|
|
||||||
|
// 패스워드 암호화, 초기 패스워드 고정
|
||||||
|
String hashedPassword = BCrypt.hashpw(updateReq.getPassword(), salt);
|
||||||
|
updateReq.setPassword(hashedPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
membersCoreService.updateMembers(uuid, updateReq);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ public class MapSheetMngCoreService {
|
|||||||
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq) {
|
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
||||||
|
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||||
return mapSheetMngRepository.findMapSheetMngList(searchReq);
|
return mapSheetMngRepository.findMapSheetMngList(searchReq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.config.BCryptSaltGenerator;
|
||||||
import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
||||||
import com.kamco.cd.kamcoback.members.exception.MemberException;
|
import com.kamco.cd.kamcoback.members.exception.MemberException;
|
||||||
import com.kamco.cd.kamcoback.members.exception.MemberException.MemberNotFoundException;
|
import com.kamco.cd.kamcoback.members.exception.MemberException.MemberNotFoundException;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MemberArchivedEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MemberEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MemberEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntityId;
|
import com.kamco.cd.kamcoback.postgres.entity.MemberRoleEntityId;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.members.MembersArchivedRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.members.MembersRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.members.MembersRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.members.MembersRoleRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.members.MembersRoleRepository;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -19,6 +25,10 @@ public class MembersCoreService {
|
|||||||
|
|
||||||
private final MembersRepository membersRepository;
|
private final MembersRepository membersRepository;
|
||||||
private final MembersRoleRepository memberRoleRepository;
|
private final MembersRoleRepository memberRoleRepository;
|
||||||
|
private final MembersArchivedRepository memberArchivedRepository;
|
||||||
|
|
||||||
|
@Value("${member.init_password}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 회원가입
|
* 회원가입
|
||||||
@@ -46,6 +56,32 @@ public class MembersCoreService {
|
|||||||
return membersRepository.save(memberEntity).getId();
|
return membersRepository.save(memberEntity).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 회원정보 수정
|
||||||
|
*
|
||||||
|
* @param uuid
|
||||||
|
* @param updateReq
|
||||||
|
*/
|
||||||
|
public void updateMembers(UUID uuid, MembersDto.UpdateReq updateReq) {
|
||||||
|
MemberEntity memberEntity =
|
||||||
|
membersRepository.findByUUID(uuid).orElseThrow(() -> new MemberNotFoundException());
|
||||||
|
|
||||||
|
if (updateReq.getEmployeeNo() != null && !memberEntity.getEmployeeNo().isEmpty()) {
|
||||||
|
memberEntity.setEmployeeNo(updateReq.getEmployeeNo());
|
||||||
|
}
|
||||||
|
if (updateReq.getName() != null && !updateReq.getName().isEmpty()) {
|
||||||
|
memberEntity.setName(updateReq.getName());
|
||||||
|
}
|
||||||
|
if (updateReq.getPassword() != null && !updateReq.getPassword().isEmpty()) {
|
||||||
|
memberEntity.setPassword(updateReq.getPassword());
|
||||||
|
}
|
||||||
|
if (updateReq.getEmail() != null && !updateReq.getEmail().isEmpty()) {
|
||||||
|
memberEntity.setEmail(updateReq.getEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
membersRepository.save(memberEntity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 역할 추가
|
* 역할 추가
|
||||||
*
|
*
|
||||||
@@ -96,6 +132,74 @@ public class MembersCoreService {
|
|||||||
memberRoleRepository.delete(memberRoleEntity);
|
memberRoleRepository.delete(memberRoleEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 상태 수정
|
||||||
|
*
|
||||||
|
* @param statusDto
|
||||||
|
*/
|
||||||
|
public void updateStatus(MembersDto.StatusDto statusDto) {
|
||||||
|
MemberEntity memberEntity =
|
||||||
|
membersRepository
|
||||||
|
.findByUUID(statusDto.getUuid())
|
||||||
|
.orElseThrow(() -> new MemberNotFoundException());
|
||||||
|
|
||||||
|
memberEntity.setStatus(statusDto.getStatus());
|
||||||
|
memberEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
|
membersRepository.save(memberEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 회원 탈퇴
|
||||||
|
*
|
||||||
|
* @param statusDto
|
||||||
|
*/
|
||||||
|
public void deleteAccount(MembersDto.StatusDto statusDto) {
|
||||||
|
MemberEntity memberEntity =
|
||||||
|
membersRepository
|
||||||
|
.findByUUID(statusDto.getUuid())
|
||||||
|
.orElseThrow(() -> new MemberNotFoundException());
|
||||||
|
|
||||||
|
MemberArchivedEntity memberArchivedEntity = new MemberArchivedEntity();
|
||||||
|
memberArchivedEntity.setUuid(memberEntity.getUuid());
|
||||||
|
memberArchivedEntity.setId(memberEntity.getId());
|
||||||
|
memberArchivedEntity.setEmployeeNo(memberEntity.getEmployeeNo());
|
||||||
|
memberArchivedEntity.setName(memberEntity.getName());
|
||||||
|
memberArchivedEntity.setPassword(memberEntity.getPassword());
|
||||||
|
memberArchivedEntity.setEmail(memberEntity.getEmail());
|
||||||
|
memberArchivedEntity.setStatus(memberEntity.getStatus());
|
||||||
|
memberArchivedEntity.setCreatedDttm(memberEntity.getCreatedDttm());
|
||||||
|
memberArchivedEntity.setArchivedDttm(ZonedDateTime.now());
|
||||||
|
memberArchivedRepository.save(memberArchivedEntity);
|
||||||
|
|
||||||
|
memberEntity.setStatus("ARCHIVED");
|
||||||
|
memberEntity.setName("**********");
|
||||||
|
memberEntity.setEmployeeNo("**********");
|
||||||
|
memberEntity.setPassword("**********");
|
||||||
|
memberEntity.setEmail("**********");
|
||||||
|
memberEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
|
membersRepository.save(memberEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 패스워드 초기화
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public void resetPassword(Long id) {
|
||||||
|
MemberEntity memberEntity =
|
||||||
|
membersRepository.findById(id).orElseThrow(() -> new MemberNotFoundException());
|
||||||
|
|
||||||
|
String salt =
|
||||||
|
BCryptSaltGenerator.generateSaltWithEmployeeNo(memberEntity.getEmployeeNo().trim());
|
||||||
|
// 패스워드 암호화, 초기 패스워드 고정
|
||||||
|
String hashedPassword = BCrypt.hashpw(password, salt);
|
||||||
|
|
||||||
|
memberEntity.setPassword(hashedPassword);
|
||||||
|
memberEntity.setStatus("INACTIVE");
|
||||||
|
memberEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||||
|
membersRepository.save(memberEntity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 회원목록 조회
|
* 회원목록 조회
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -50,5 +50,4 @@ public class MapSheetMngEntity {
|
|||||||
@ColumnDefault("'NULL::character varying'")
|
@ColumnDefault("'NULL::character varying'")
|
||||||
@Column(name = "mng_path")
|
@Column(name = "mng_path")
|
||||||
private String mngPath;
|
private String mngPath;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import jakarta.persistence.Id;
|
|||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -20,11 +20,10 @@ public class MemberArchivedEntity {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "uuid", nullable = false)
|
@Column(name = "uuid", nullable = false)
|
||||||
private UUID id;
|
private UUID uuid;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "id", nullable = false)
|
@Column(name = "id", nullable = false)
|
||||||
private Long id1;
|
private Long id;
|
||||||
|
|
||||||
@Size(max = 50)
|
@Size(max = 50)
|
||||||
@Column(name = "employee_no", length = 50)
|
@Column(name = "employee_no", length = 50)
|
||||||
@@ -51,10 +50,10 @@ public class MemberArchivedEntity {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(name = "created_dttm", nullable = false)
|
@Column(name = "created_dttm", nullable = false)
|
||||||
private OffsetDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ColumnDefault("now()")
|
@ColumnDefault("now()")
|
||||||
@Column(name = "archived_dttm", nullable = false)
|
@Column(name = "archived_dttm", nullable = false)
|
||||||
private OffsetDateTime archivedDttm;
|
private ZonedDateTime archivedDttm;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ public class MemberEntity {
|
|||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@Size(max = 20)
|
@Size(max = 20)
|
||||||
@ColumnDefault("'ACTIVE'")
|
@ColumnDefault("'INACTIVE'")
|
||||||
@Column(name = "status", length = 20)
|
@Column(name = "status", length = 20)
|
||||||
private String status = "ACTIVE";
|
private String status = "INACTIVE";
|
||||||
|
|
||||||
@Column(name = "created_dttm", nullable = false, insertable = false)
|
@Column(name = "created_dttm", nullable = false, insertable = false)
|
||||||
private ZonedDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import jakarta.validation.Valid;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
public interface MapSheetMngRepositoryCustom {
|
public interface MapSheetMngRepositoryCustom {
|
||||||
Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(MapSheetMngDto.@Valid searchReq searchReq);
|
Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||||
|
MapSheetMngDto.@Valid searchReq searchReq);
|
||||||
|
|
||||||
Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq);
|
Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx50kEntity.mapInkx50kEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngEntity.mapSheetMngEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity.mapSheetMngHstEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.members.dto.RoleType;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Expression;
|
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
@@ -12,23 +15,16 @@ import com.querydsl.core.types.dsl.NumberExpression;
|
|||||||
import com.querydsl.core.types.dsl.StringExpression;
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jdk.jfr.Experimental;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity.mapSheetMngHstEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngEntity.mapSheetMngEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx50kEntity.mapInkx50kEntity;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements MapSheetMngRepositoryCustom {
|
implements MapSheetMngRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
@@ -39,101 +35,112 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(MapSheetMngDto.@Valid searchReq searchReq) {
|
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||||
|
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||||
|
|
||||||
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
|
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
|
||||||
List<MapSheetMngDto.ErrorDataDto> foundContent = queryFactory
|
List<MapSheetMngDto.ErrorDataDto> foundContent =
|
||||||
.select(
|
queryFactory
|
||||||
Projections.constructor(
|
.select(
|
||||||
MapSheetMngDto.ErrorDataDto.class,
|
Projections.constructor(
|
||||||
mapSheetMngHstEntity.hstUid,
|
MapSheetMngDto.ErrorDataDto.class,
|
||||||
rowNum(),
|
mapSheetMngHstEntity.hstUid,
|
||||||
Expressions.stringTemplate("concat({0}, {1})", mapSheetMngHstEntity.mapSheetName, mapInkx50kEntity.mapidcdNo),
|
rowNum(),
|
||||||
Expressions.stringTemplate("concat({0}, substring({1}, {2}, {3}))", mapSheetMngHstEntity.mapSheetName, mapSheetMngHstEntity.mapSheetNum, 6, 8),
|
Expressions.stringTemplate(
|
||||||
mapSheetMngHstEntity.mapSheetCodeSrc,
|
"concat({0}, {1})",
|
||||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", mapSheetMngHstEntity.createdDate),
|
mapSheetMngHstEntity.mapSheetName, mapInkx50kEntity.mapidcdNo),
|
||||||
mapSheetMngHstEntity.dataState
|
Expressions.stringTemplate(
|
||||||
)
|
"concat({0}, substring({1}, {2}, {3}))",
|
||||||
)
|
mapSheetMngHstEntity.mapSheetName, mapSheetMngHstEntity.mapSheetNum, 6, 8),
|
||||||
.from(mapSheetMngHstEntity)
|
mapSheetMngHstEntity.mapSheetCodeSrc,
|
||||||
.innerJoin(mapInkx5kEntity)
|
Expressions.stringTemplate(
|
||||||
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
|
"to_char({0}, 'YYYY-MM-DD')", mapSheetMngHstEntity.createdDate),
|
||||||
.leftJoin(mapInkx50kEntity)
|
mapSheetMngHstEntity.dataState))
|
||||||
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
|
.from(mapSheetMngHstEntity)
|
||||||
.where(
|
.innerJoin(mapInkx5kEntity)
|
||||||
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
|
||||||
mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), //오류만 검색
|
.leftJoin(mapInkx50kEntity)
|
||||||
mapSheetErrorSearchValue(searchReq)
|
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
|
||||||
)
|
.where(
|
||||||
.offset(pageable.getOffset())
|
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
||||||
.limit(pageable.getPageSize())
|
mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
|
||||||
.orderBy(mapSheetMngHstEntity.createdDate.desc())
|
mapSheetErrorSearchValue(searchReq))
|
||||||
.fetch();
|
.offset(pageable.getOffset())
|
||||||
|
.limit(pageable.getPageSize())
|
||||||
|
.orderBy(mapSheetMngHstEntity.createdDate.desc())
|
||||||
|
.fetch();
|
||||||
|
|
||||||
Long countQuery = queryFactory
|
Long countQuery =
|
||||||
.select(mapSheetMngHstEntity.hstUid.count())
|
queryFactory
|
||||||
.from(mapSheetMngHstEntity)
|
.select(mapSheetMngHstEntity.hstUid.count())
|
||||||
.innerJoin(mapInkx5kEntity)
|
.from(mapSheetMngHstEntity)
|
||||||
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
|
.innerJoin(mapInkx5kEntity)
|
||||||
.leftJoin(mapInkx50kEntity)
|
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
|
||||||
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
|
.leftJoin(mapInkx50kEntity)
|
||||||
.where(
|
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
|
||||||
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
.where(
|
||||||
mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), //오류만 검색
|
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
||||||
mapSheetErrorSearchValue(searchReq)
|
mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
|
||||||
)
|
mapSheetErrorSearchValue(searchReq))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq) {
|
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
||||||
|
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||||
|
|
||||||
Pageable pageable = searchReq.toPageable();
|
Pageable pageable = searchReq.toPageable();
|
||||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||||
|
|
||||||
if (searchReq.getMngYyyy() != null ) {
|
if (searchReq.getMngYyyy() != null) {
|
||||||
whereBuilder.and(mapSheetMngEntity.id.eq(searchReq.getMngYyyy()));
|
whereBuilder.and(mapSheetMngEntity.id.eq(searchReq.getMngYyyy()));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MapSheetMngDto.MngDto> foundContent = queryFactory
|
List<MapSheetMngDto.MngDto> foundContent =
|
||||||
.select(
|
queryFactory
|
||||||
Projections.constructor(
|
.select(
|
||||||
MapSheetMngDto.MngDto.class,
|
Projections.constructor(
|
||||||
Expressions.numberTemplate(Integer.class, "row_number() over(order by {0} desc)", mapSheetMngEntity.createdDttm),
|
MapSheetMngDto.MngDto.class,
|
||||||
mapSheetMngEntity.id,
|
Expressions.numberTemplate(
|
||||||
mapSheetMngEntity.mngState,
|
Integer.class,
|
||||||
mapSheetMngEntity.syncState,
|
"row_number() over(order by {0} desc)",
|
||||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.mngStateDttm),
|
mapSheetMngEntity.createdDttm),
|
||||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.syncStateDttm),
|
mapSheetMngEntity.id,
|
||||||
mapSheetMngEntity.mngPath,
|
mapSheetMngEntity.mngState,
|
||||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.createdDttm),
|
mapSheetMngEntity.syncState,
|
||||||
mapSheetMngEntity.createdUid,
|
Expressions.stringTemplate(
|
||||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.updatedDttm),
|
"to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.mngStateDttm),
|
||||||
mapSheetMngEntity.updatedUid
|
Expressions.stringTemplate(
|
||||||
|
"to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.syncStateDttm),
|
||||||
|
mapSheetMngEntity.mngPath,
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.createdDttm),
|
||||||
|
mapSheetMngEntity.createdUid,
|
||||||
|
Expressions.stringTemplate(
|
||||||
|
"to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.updatedDttm),
|
||||||
|
mapSheetMngEntity.updatedUid))
|
||||||
|
.from(mapSheetMngEntity)
|
||||||
|
.where(whereBuilder)
|
||||||
|
.offset(pageable.getOffset())
|
||||||
|
.limit(pageable.getPageSize())
|
||||||
|
.orderBy(mapSheetMngEntity.createdDttm.desc())
|
||||||
|
.fetch();
|
||||||
|
|
||||||
)
|
Long countQuery =
|
||||||
)
|
queryFactory
|
||||||
.from(mapSheetMngEntity)
|
.select(mapSheetMngEntity.id.count())
|
||||||
.where(whereBuilder)
|
.from(mapSheetMngEntity)
|
||||||
.offset(pageable.getOffset())
|
.where(whereBuilder)
|
||||||
.limit(pageable.getPageSize())
|
.fetchOne();
|
||||||
.orderBy(mapSheetMngEntity.createdDttm.desc())
|
|
||||||
.fetch();
|
|
||||||
|
|
||||||
Long countQuery = queryFactory
|
|
||||||
.select(mapSheetMngEntity.id.count())
|
|
||||||
.from(mapSheetMngEntity)
|
|
||||||
.where(whereBuilder)
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NumberExpression<Integer> rowNum(){
|
private NumberExpression<Integer> rowNum() {
|
||||||
return Expressions.numberTemplate(Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate);
|
return Expressions.numberTemplate(
|
||||||
|
Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BooleanExpression mapSheetErrorSearchValue(MapSheetMngDto.searchReq searchReq) {
|
private BooleanExpression mapSheetErrorSearchValue(MapSheetMngDto.searchReq searchReq) {
|
||||||
@@ -142,10 +149,11 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 검색어 1개 값이 도엽명 or 도엽번호 like 검색
|
// 검색어 1개 값이 도엽명 or 도엽번호 like 검색
|
||||||
return Expressions.booleanTemplate("{0} like '%" + searchReq.getSearchValue() + "%'", mapSheetMngHstEntity.mapSheetName)
|
return Expressions.booleanTemplate(
|
||||||
.or(Expressions.booleanTemplate("{0} like '%" + searchReq.getSearchValue() + "%'", mapSheetMngHstEntity.mapSheetNum));
|
"{0} like '%" + searchReq.getSearchValue() + "%'", mapSheetMngHstEntity.mapSheetName)
|
||||||
|
.or(
|
||||||
|
Expressions.booleanTemplate(
|
||||||
|
"{0} like '%" + searchReq.getSearchValue() + "%'",
|
||||||
|
mapSheetMngHstEntity.mapSheetNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.members;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MemberArchivedEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface MembersArchivedRepository
|
||||||
|
extends JpaRepository<MemberArchivedEntity, Long>, MembersArchivedRepositoryCustom {}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.members;
|
||||||
|
|
||||||
|
public interface MembersArchivedRepositoryCustom {}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.members;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class MembersArchivedRepositoryImpl implements MembersArchivedRepositoryCustom {}
|
||||||
@@ -34,3 +34,6 @@ spring:
|
|||||||
host: 192.168.2.109
|
host: 192.168.2.109
|
||||||
port: 6379
|
port: 6379
|
||||||
password: kamco
|
password: kamco
|
||||||
|
|
||||||
|
member:
|
||||||
|
init_password: kamco1234!
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ spring:
|
|||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
||||||
|
#url: jdbc:postgresql://localhost:5432/kamco_cds
|
||||||
username: kamco_cds
|
username: kamco_cds
|
||||||
password: kamco_cds_Q!W@E#R$
|
password: kamco_cds_Q!W@E#R$
|
||||||
hikari:
|
hikari:
|
||||||
@@ -28,3 +29,6 @@ spring:
|
|||||||
port: 6379
|
port: 6379
|
||||||
password: kamco
|
password: kamco
|
||||||
|
|
||||||
|
member:
|
||||||
|
init_password: kamco1234!
|
||||||
|
|
||||||
|
|||||||
@@ -21,4 +21,7 @@ spring:
|
|||||||
minimum-idle: 10
|
minimum-idle: 10
|
||||||
maximum-pool-size: 20
|
maximum-pool-size: 20
|
||||||
|
|
||||||
|
member:
|
||||||
|
init_password: kamco1234!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user