feat: mpower 적용

dev
minuk926 2 years ago
parent a9dc20a197
commit 15dd7c64b6

@ -0,0 +1,165 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.service.ICtgyFileService;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
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.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
import org.springframework.http.*;
import org.springframework.lang.NonNull;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
@Tag(name = "CtgyFileMgtController", description = "공지사항 / 게시판 관리")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/ctgy/file")
public class CtgyFileMgtController {
private final Environment env;
@Value("${file.cmm.upload.root:c:/data/file/upload}")
private String rootPath;
@Value("${file.cmm.upload.path:/kangnamSIM/simUpFile/}")
private String uploadPath;
@Value("${file.cmm.upload.url}")
private String serviceUrl;
private final ICtgyFileService service;
@Operation(summary = "파일 조회", description = "등록된 파일 조회")
@GetMapping("/{id}")
public ResponseEntity<? extends IRestResponse> findFiles(@PathVariable("inCode") @NonNull final Long inCode) {
AssertUtils.isTrue(!Checks.isEmpty(inCode), "대상 게시글[inCode]을 선택해 주세요.");
return RestResponse.of(service.findFiles(inCode));
}
@Operation(summary = "공지사항 저장", description = "공지사항 저장")
@PostMapping(value = "/pboard", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<? extends IRestResponse> savePublicBoardFiles(@Nonnull MinInfoBoard680Dto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "파일 정보가 존재하지 않습니다.");
return RestResponse.of(service.saveFiles(dto));
}
@Operation(summary = "공지사항 삭제", description = "공지사항 삭제")
@PostMapping(value = "/pboard/{inCode}")
public ResponseEntity<? extends IRestResponse> removePublicBoardFile(@PathVariable @Nonnull final Long inCode) {
AssertUtils.isTrue(!Checks.isEmpty(inCode), "공지 사항이 선택되지 않았습니다.");
service.removePublicBoardFile(inCode);
return RestResponse.of(HttpStatus.OK);
}
@GetMapping("/download/{inCode}")
public void download2(@PathVariable Long inCode, HttpServletResponse response) {
MinInfoBoard680 entity = service.findFiles(inCode);
String absFile = "";
if (Arrays.asList(env.getActiveProfiles()).contains("prod"))
absFile = entity.getInFileurl() + File.separator + entity.getInFilename();
else
absFile = rootPath + entity.getInFileurl().split(serviceUrl)[1] + File.separator + entity.getInFilename();
Path path = Paths.get(absFile);
String contentType = null;
try {
contentType = Files.probeContentType(path);
} catch (IOException e) {
throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
}
File file = new File(absFile);
byte[] fileByte = new byte[0];
try {
fileByte = FileUtils.readFileToByteArray(file);
} catch (IOException e) {
throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
}
response.setContentType(contentType);
response.setHeader(HttpHeaders.CONTENT_TYPE, contentType);
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(entity.getInFilename(), StandardCharsets.UTF_8) + "\";");
//response.setHeader(HttpHeaders.CONTENT_ENCODING, "binary");
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getInFilesize()));
try {
response.getOutputStream().write(fileByte);
response.getOutputStream().flush();
response.getOutputStream().close();
} catch (IOException e) {
throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
}
}
@GetMapping("/download2/{inCode}")
public ResponseEntity<Resource> download(@PathVariable Long inCode, HttpServletResponse response) {
MinInfoBoard680 entity = service.findFiles(inCode);
String absFile = "";
if (Arrays.asList(env.getActiveProfiles()).contains("prod"))
absFile = entity.getInFileurl() + File.separator + entity.getInFilename();
else
absFile = rootPath + entity.getInFileurl().split(serviceUrl)[1] + File.separator + entity.getInFilename();
Path path = Paths.get(absFile);
String contentType = null;
try {
contentType = Files.probeContentType(path);
} catch (IOException e) {
throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
}
// File file = new File(absFile);
// try {
// byte[] fileByte = FileUtils.readFileToByteArray(file);
// } catch (IOException e) {
// throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
// }
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, contentType);
headers.setContentDisposition(ContentDisposition.builder("attachment")
.filename(entity.getInFilename(), StandardCharsets.UTF_8)
//.filename(URLEncoder.encode(entity.getInFilename(), StandardCharsets.UTF_8))
.build());
headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getInFilesize()));
Resource resource = null;
try {
resource = new InputStreamResource(Files.newInputStream(path));
} catch (IOException e) {
throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
}
return new ResponseEntity<>(resource, headers, HttpStatus.OK);
}
}

@ -0,0 +1,91 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.dto.struct.MinUserinfoMapstruct;
import com.xit.biz.ctgy.service.IMinUserService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
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.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@Tag(name = "MinUserController", description = "사용자 관리")
@RestController
@RequestMapping("/api/v2/ctgy/user")
@Validated
@RequiredArgsConstructor
public class MinUserController {
private final IMinUserService service;
private final MinUserinfoMapstruct mapstruct = Mappers.getMapper(MinUserinfoMapstruct.class);
// TODO :: 파라메터 정의 필요
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "사용자 목록 조회" , description = "사용자 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "userid", description = "사용자ID", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "name", description = "이름", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "team", description = "팀", required = false, example = "001"),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findMinUsers(
@Parameter(hidden = true)
final MinUserinfoDto minUserinfoDto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findMinUsers(mapstruct.toEntity(minUserinfoDto), pageable));
}
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
@GetMapping("/info")
@Secured(policy = SecurityPolicy.TOKEN)
@Transactional(readOnly = true)
public ResponseEntity<? extends IRestResponse> getMinUser() {
return RestResponse.of(service.findMinUser());
}
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
@GetMapping("/{userid}")
//@Transactional(readOnly = true)
public ResponseEntity<? extends IRestResponse> getMinUser(@PathVariable final String userid) {
return RestResponse.of(service.findMinUserByUserid(userid));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "사용자 정보 저장" , description = "사용자 정보 저장")
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveMinUser(
@Valid
final MinUserinfoDto minUserinfoDto) {
service.saveMinUser(minUserinfoDto);
return RestResponse.of(HttpStatus.OK);
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "사용자 삭제" , description = "사용자 삭제")
@PutMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> removeMinUser(
@Valid
final MinUserinfoDto minUserinfoDto) {
service.removeMinUser(minUserinfoDto);
return RestResponse.of(HttpStatus.OK);
}
}

@ -0,0 +1,164 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.auth.service.IAuthMinService;
import com.xit.biz.ctgy.dto.LoginMinRequestDto;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import com.xit.core.oauth2.api.dto.TokenRequestDto;
import com.xit.core.oauth2.oauth.JwtTokenProvider;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
@Tag(name = "OAuth2MinController", description = "인증 관리")
@RestController
@RequestMapping("/api/v2/ctgy/account")
@Validated
@RequiredArgsConstructor
public class OAuth2MinController {
private final IAuthMinService authMinService;
/**
* <pre>
* (Redis ) (Access + Refresh) return
*
* 1. Login ID, PW UsernamePasswordAuthenticationToken
* 2. AuthenticationManager authenticate , Authentication(ID ) return
* AuthenticationManager -->
* authenticate
* Builder UserDetails
* 3. JWT
* 4. Refresh : : Redis
* 5. (Access + Refresh) return
* </pre>
* @see AuthenticationManagerBuilder
* @see JwtTokenProvider
*
* @param loginRequestDto LoginMinRequestDto
* @param request HttpServletRequest
* @param response HttpServletResponse
* @param session Session
* @return ResponseEntity
*/
@Operation(summary = "login" , description = "login")
@PostMapping("/login")
@Transactional
public ResponseEntity<? extends IRestResponse> login(
@Valid
@RequestBody
final LoginMinRequestDto loginRequestDto,
HttpServletRequest request,
HttpServletResponse response,
HttpSession session
) {
return RestResponse.of(
authMinService.login(
loginRequestDto,
request,
response,
session
)
);
}
/**
* <pre>
* JWT token
* access token - header, refresh - TokenRequestDto
*
* 1. access token ErrorCode.NOT_EXPIRED_TOKEN_YET
* 2. refresh token refresh token
* 3. 2 refresh token null
* </pre>
*
* @param tokenRequestDto TokenRequestDto
* @param request HttpServletRequest
* @return ResponseEntity IRestResponse
*/
@Operation(summary = "token 재발급 요청(header & DTO 사용)" , description = "token 재발급 :: accessToken - header, refreshToken - dto")
@Parameter(in = ParameterIn.QUERY, name = "refreshToken", description = "refresh token", required = true, example = " ")
@PostMapping("/jwt/reissue")
public ResponseEntity<? extends IRestResponse> reissueFromHeader(
@Parameter(hidden = true)
@NotNull
@RequestBody
final TokenRequestDto tokenRequestDto,
HttpServletRequest request) {
return RestResponse.of(authMinService.reissue(tokenRequestDto, request, null));
}
/**
* <pre>
* JWT token
* access token - header, refresh - cookie
*
* 1. access token ErrorCode.NOT_EXPIRED_TOKEN_YET
* 2. refresh token refresh token
* 3. 2 refresh token null
* </pre>
*
* @param request HttpServletRequest
* @param response HttpServletResponse
* @return ResponseEntity IRestResponse
*/
@Operation(summary = "token 재발급(header & cookie 사용)" , description = "토큰 재발급 :: accessToken - header, refreshToken - cookie")
//@Parameter(in = ParameterIn.HEADER, name = "Authorization", description = "access token", required = true, example = " ")
//@Parameter(in = ParameterIn.COOKIE, name = "refreshToken", description = "refresh token", required = true, example = " ")
@PostMapping("/jwt/reissue/cookie")
public ResponseEntity<? extends IRestResponse> reissueFromCookie(HttpServletRequest request, HttpServletResponse response) {
return RestResponse.of(authMinService.reissue(null, request, response));
}
/**
* <pre>
* JWT token
* access token - TokenRequestDto, refresh - TokenRequestDto
*
* 1. access token ErrorCode.NOT_EXPIRED_TOKEN_YET
* 2. refresh token refresh token
* 3. 2 refresh token null
* </pre>
*
* @param tokenRequestDto TokenRequestDto
* @return ResponseEntity IRestResponse
*/
@Operation(summary = "token 재발급(DTO 사용)" , description = "token 재발급 :: accessToken - dto, refreshToken - dto")
@PostMapping("/jwt/reissue/dto")
public ResponseEntity<? extends IRestResponse> reissueFromParam(
@NotNull
@RequestBody
final TokenRequestDto tokenRequestDto) {
return RestResponse.of(authMinService.reissue(tokenRequestDto, null, null));
}
@Operation(summary = "토큰 체크" , description = "access token 체크")
@PostMapping("/jwt/validate")
public ResponseEntity<? extends IRestResponse> validate(@RequestParam final String accessToken, @RequestParam boolean isExceptionThrow) {
return RestResponse.of(authMinService.validationToken(accessToken, isExceptionThrow));
}
@Operation(summary = "토큰 정보 확인" , description = "토큰 정보 확인")
@PostMapping("/jwt/info")
public ResponseEntity<? extends IRestResponse> findAccessTokenInfo(@RequestParam final String accessToken) {
return RestResponse.of(authMinService.findAccessTokenInfo(accessToken));
}
}

@ -0,0 +1,146 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto;
import com.xit.biz.ctgy.dto.struct.JudgeListMapstruct;
import com.xit.biz.ctgy.dto.struct.MinSimsa680Mapstruct;
import com.xit.biz.ctgy.service.IParkingService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
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;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.web.bind.annotation.*;
import javax.validation.Valid;
@Tag(name = "ParkingController", description = "주정차 의견진술 관리")
@RestController
@RequiredArgsConstructor
@Slf4j
@RequestMapping("/api/v2/ctgy/parking")
public class ParkingController {
private final IParkingService service;
private final MinSimsa680Mapstruct mapstruct = Mappers.getMapper(MinSimsa680Mapstruct.class);
private final JudgeListMapstruct groupMapstruct = Mappers.getMapper(JudgeListMapstruct.class);
//---------------------------------------------------------------------------------
// 관리자
//---------------------------------------------------------------------------------
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "주정차 의견진술 심의 목록" , description = "주정차 의견진술 심의 목록")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msYear", description = "심사년도", required = true, example = "2021"),
@Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findParkings(
@Valid
@Parameter(hidden = true)
final JudgeListDto dto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findParkings(dto, pageable));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "주정차 의견진술 심의 결과" , description = "주정차 의견진술 심의 결과")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-01-04"),
@Parameter(in = ParameterIn.QUERY, name = "msEdate", description = "심사종료일", required = true, example = "2021-01-05"),
@Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = false, example = "3"),
@Parameter(in = ParameterIn.QUERY, name = "msuTeam", description = "팀코드", required = true, example = "002")
})
@GetMapping(value="/result", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findParkingResults(
@Valid
@Parameter(hidden = true)
final JudgeListDto dto) {
return RestResponse.of(service.findParkingResults(dto));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "주정차 의견진술 심의대상 조회" , description = "주정차 의견진술 심의대상 조회")
@GetMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE)
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "rcIrTransfer", description = "전송상태(미접수-1,접수-2)", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "rcSeq1", description = "접수번호-시작", required = true, example = "2022200801"),
@Parameter(in = ParameterIn.QUERY, name = "rcSeq2", description = "접수번호-종료", required = true, example = "2022200899"),
})
public ResponseEntity<? extends IRestResponse> findParkingJudgeTargets(@Parameter(hidden = true) final ParkingTargetDto dto){
return RestResponse.of(service.findParkingJudgeTargets(dto));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "주정차 의견진술 심의대상 등록" , description = "주정차 의견진술 심의대상 등록")
@PostMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveParkinJudgeTargets(
@Valid
@RequestBody
final ParkingTargetDto dto) {
service.saveParkingJudgeTargets(dto);
return RestResponse.of(HttpStatus.OK);
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "주정차 의견진술 심의 자료 삭제" , description = "주정차 의견진술 심의 자료 삭제")
@PostMapping(value="/remove", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> removeParkinJudge(
@Valid
@RequestBody
final ParkingTargetDto dto) {
service.removeParkingJudge(dto);
return RestResponse.of(HttpStatus.OK);
}
//---------------------------------------------------------------------------------
// 심사자
//---------------------------------------------------------------------------------
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "심사자별 주정차 의견진술 심의목록 조회" , description = "심사자별 주정차 의견진술 심의목록 조회")
@GetMapping(value = "/judge", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findByUserJudges() {
return RestResponse.of(service.findByUserJudges());
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "주정차 의견진술 심의 결과 저장" , description = "주정차 의견진술 심의 결과 저장")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msuCode", description = "심사코드", required = true, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "msuResult", description = "심사결과코드", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "msuReason", description = "심사사유", required = true, example = " ")
})
@PostMapping(value="/judge", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveJudgeResult(
@Valid
@RequestBody
@Parameter(hidden = true)
final JudgeListDto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 조건이 입력되지 않았습니다.");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuCode()), "심사코드 값은 필수입니다(PK)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuResult()), "심사결과는 필수입니다(1-수용,2-미수용)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuReason()), "심의사유는 필수입니다");
service.saveJudgeResult(dto);
return RestResponse.of(HttpStatus.OK);
}
}

@ -0,0 +1,71 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.dto.struct.MinInfoBoard680Mapstruct;
import com.xit.biz.ctgy.service.IPublicBoardService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
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.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Tag(name = "PublicBoardController", description = "공지사항 관리")
@RestController
@RequestMapping("/api/v2/ctgy/pboard")
@Validated
@RequiredArgsConstructor
public class PublicBoardController {
private final IPublicBoardService service;
private final MinInfoBoard680Mapstruct mapstruct = Mappers.getMapper(MinInfoBoard680Mapstruct.class);
// TODO :: 파라메터 정의 필요
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "공지사항 목록 조회" , description = "공지사항 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "inTitle", description = "제목", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "inName", description = "이름", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findAll(
@Parameter(hidden = true)
final MinInfoBoard680Dto dto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findAll(mapstruct.toEntity(dto), pageable));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "공지사항상세" , description = "공지사항상세")
@Parameters({
@Parameter(in = ParameterIn.PATH, name = "inCode", description = "공지사항번호", required = true, example = "18"),
})
@GetMapping(value = "/{inCode}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findByInCode(@PathVariable final Long inCode) {
return RestResponse.of(service.findByInCode(inCode));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "공지사항 조회수 증가" , description = "공지사항 조회수 증가")
@Parameters({
@Parameter(in = ParameterIn.PATH, name = "inCode", description = "공지사항번호", required = true, example = "18"),
})
@PutMapping(value = "/hit/{inCode}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> modifyByInCode(@PathVariable final Long inCode) {
return RestResponse.of(service.modifyByInCode(inCode));
}
}

@ -0,0 +1,223 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeStdDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct;
import com.xit.biz.ctgy.service.IResidentAndDisabledService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
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;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
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;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
* /
* : scDatagb = "1"
* : scDatagb = "2"
*/
@Tag(name = "ResidentAndDisabledController", description = "거주자/장애인 의견진술 관리")
@RestController
@RequestMapping("/api/v2/ctgy")
@Validated
@RequiredArgsConstructor
public class ResidentAndDisabledController {
private final IResidentAndDisabledService service;
private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class);
//---------------------------------------------------------------------------------
// 관리자
//---------------------------------------------------------------------------------
// TODO :: 파라메터 정의 필요
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견지술자료 목록 조회" , description = "거주자/장애인 의견진술자료 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "scDatagb", description = "데이타구분", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(value="/admin/data", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findJudgeDatas(
@NotNull final String scDatagb,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findJudgeDatas(scDatagb, pageable)); }
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견진술 자료 등록", description = "거주자/장애인 의견진술 자료 등록")
@PostMapping(value = "/admin/data", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<? extends IRestResponse> saveJudgeData(@Nonnull GnRecallScDto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "등록할 거주자 의견진술 자료가 없습니다");
AssertUtils.isTrue(!Checks.isEmpty(dto.getScDatagb()), "데이타구분 값은 필수입니다(1-거주자,2-장애인)");
service.saveJudgeData(dto);
return RestResponse.of(HttpStatus.OK);
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견진술 자료 상세" , description = "거주자/장애인 의견진술 자료 상세")
@Parameters({
@Parameter(in = ParameterIn.PATH, name = "scCode", description = "의견진술번호", required = true, example = "3778"),
})
@GetMapping(value = "/admin/data/{scCode}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findJudgeData(@PathVariable final Long scCode) {
return RestResponse.of(service.findJudgeData(scCode));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견진술 자료 삭제" , description = "거주자/장애인 의견진술 자료 삭제")
@PostMapping(value="/admin/data/remove", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> removeJudgeData(final Long scCode) {
service.removeJudgeData(scCode);
return RestResponse.of(HttpStatus.OK);
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견진술 심의대상 조회" , description = "거주자/장애인 의견진술 심의대상 조회")
@GetMapping(value="/admin/target", produces = MediaType.APPLICATION_JSON_VALUE)
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "scDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "scTransfer", description = "전송상태(미접수-1,접수-2)", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "scSeq1", description = "접수번호-시작", required = true, example = "2022000001"),
@Parameter(in = ParameterIn.QUERY, name = "scSeq2", description = "접수번호-종료", required = true, example = "2022999999"),
})
public ResponseEntity<? extends IRestResponse> findResidentJudgeTargets(@Parameter(hidden = true) final JudgeTargetDto dto){
AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 검색 조건이 입력되지 않았습니다.");
AssertUtils.isTrue(!Checks.isEmpty(dto.getScDatagb()), "데이타구분 값은 필수입니다(1-거주자,2-장애인)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getScTransfer()), "전송상태를 선택하지 않았습니다(1-미전송,2-전송)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getScSeq1()), "조회할 접수번호(시작)가 입력되지 않았습니다");
AssertUtils.isTrue(!Checks.isEmpty(dto.getScSeq2()), "조회할 접수번호(종료)가 입력되지 않았습니다");
return RestResponse.of(service.findJudgeTargets(dto));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/징애인 의견진술 심의대상 등록" , description = "거주자/장애인 의견진술 심의대상 등록")
@PostMapping(value="/admin/target", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveJudgeTargets(
@Valid
@RequestBody
final JudgeTargetDto dto) {
service.saveJudgeTargets(dto);
//service.saveParkingSimsaJudgeTargets(dto);
return RestResponse.of(HttpStatus.OK);
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견진술 심의목록 조회" , description = "거주자/장애인 의견진술 심의목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "scDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "scYear", description = "심사년도", required = true, example = "2021"),
@Parameter(in = ParameterIn.QUERY, name = "scChasu", description = "차수", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(value = "/admin", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findJudges(
@Valid
@Parameter(hidden = true)
final JudgeListDto dto,
@Parameter(hidden = true)
final Pageable pageable) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 검색 조건이 입력되지 않았습니다.");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsDatagb()), "데이타구분 값은 필수입니다(1-거주자,2-장애인)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsYear()), "심사년도를 선택하셔야 합니다");
return RestResponse.of(service.findJudges(dto, pageable));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견진술 심의 결과 목록" , description = "거주자/장애인 의견진술 심의 결과 목록")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-09-10"),
@Parameter(in = ParameterIn.QUERY, name = "msEdate", description = "심사종료일", required = true, example = "2021-09-11"),
@Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = true, example = "12"),
@Parameter(in = ParameterIn.QUERY, name = "msuTeam", description = "팀코드", required = false, example = "003")
})
@GetMapping(value="/admin/result", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findJudgeResults(
@Valid
@Parameter(hidden = true)
final JudgeListDto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 검색 조건이 입력되지 않았습니다.");
return RestResponse.of(service.findJudgeResults(dto));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "관리자 심사기준 적용 심사 처리" , description = "관리자 심사기준 적용 심사 처리")
@PostMapping(value="/admin/judge", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveJudgeStds(
@Valid
@RequestBody
final JudgeStdDto dto) {
service.saveJudgeStds(dto);
return RestResponse.of(HttpStatus.OK);
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "dashboard" , description = "dashboard")
@GetMapping(value="/dashboard", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> getDashboard() {
return RestResponse.of(service.findDashboard());
}
//---------------------------------------------------------------------------------
// 심사자
//---------------------------------------------------------------------------------
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "심사자별 거주자/장애인 의견진술 심의목록 조회" , description = "심사자별 거주자/장애인 의견진술 심의목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1")
})
@GetMapping(value = "/judge", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findByUserJudges(
@Valid
@Parameter(hidden = true)
final JudgeListDto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 검색 조건이 입력되지 않았습니다.");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsDatagb()), "데이타구분 값은 필수입니다(1-거주자,2-장애인)");
return RestResponse.of(service.findByUserJudges(dto));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "거주자/장애인 의견진술 심의 결과 저장" , description = "거주자/장애인 의견진술 심의 결과 저장")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msuCode", description = "심사코드", required = true, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "msuResult", description = "심사결과코드", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "msuReason", description = "심사사유", required = true, example = " ")
})
@PostMapping(value="/judge", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveJudgeResult(
@Valid
@RequestBody
@Parameter(hidden = true)
final JudgeListDto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 조건이 입력되지 않았습니다.");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuCode()), "심사코드 값은 필수입니다(PK)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuResult()), "심사결과는 필수입니다(1-수용,2-미수용)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuReason()), "심의사유는 필수입니다");
service.saveJudgeResult(dto);
return RestResponse.of(HttpStatus.OK);
}
}

@ -10,7 +10,7 @@ import java.util.List;
public interface IBoardService {
List<BoardDto> findAll(final BoardDto dto, Pageable pageable);
Page<BoardDto> findAll(final BoardDto dto, Pageable pageable);
// Page<MinCivBoard680> findAll2(final MinCivBoard680 entity, Pageable pageable);
//

@ -0,0 +1,19 @@
package com.xit.biz.ctgy.v2.service;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import javax.annotation.Nonnull;
import java.util.List;
/**
* @author Lim, Jong Uk (minuk926)
* @since 2021-07-16
*/
public interface ICtgyFileService {
MinInfoBoard680 findFiles(Long inCode);
// List<MinInfoBoard680> saveFiles(@Nonnull MinInfoBoard680Dto dto);
//
// void removePublicBoardFile(Long inCode);
}

@ -0,0 +1,19 @@
package com.xit.biz.ctgy.v2.service;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface IMinUserService {
Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable);
// MinUserinfo findMinUser();
//
// MinUserinfo findMinUserByUserid(final String userId);
//
// void saveMinUser(MinUserinfoDto dto);
//
// void removeMinUser(MinUserinfoDto dto);
}

@ -0,0 +1,37 @@
package com.xit.biz.ctgy.v2.service;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
public interface IParkingService {
Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable);
// /**
// * 주정차 의견진술 심의 결과 목록
// * @param dto JudgeListDto
// * @return Map
// */
// Map<String,Object> findParkingResults(final JudgeListDto dto);
//
// List<ParkingTargetDto> findParkingJudgeTargets(final ParkingTargetDto dto) ;
//
// // Page<MinSimsa680> findAll(final MinSimsa680 minSimsa680, Pageable pageable);
//
// void saveParkingJudgeTargets(ParkingTargetDto dto);
//
// void removeParkingJudge(final ParkingTargetDto dto);
//
// //---------------------------------------------------------------------------------
// // 심사자
// //---------------------------------------------------------------------------------
// List<JudgeListDto> findByUserJudges();
//
// void saveJudgeResult(JudgeListDto dto);
}

@ -0,0 +1,13 @@
package com.xit.biz.ctgy.v2.service;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface IPublicBoardService {
Page<MinInfoBoard680> findAll(final MinInfoBoard680 entity, Pageable pageable);
// MinInfoBoard680 findByInCode(final Long inCode);
//
// int modifyByInCode(Long inCode);
}

@ -0,0 +1,92 @@
package com.xit.biz.ctgy.v2.service;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeStdDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* /
* : scDatagb = "1"
* : scDatagb = "2"
*/
public interface IResidentAndDisabledService {
//---------------------------------------------------------------------------------
// 관리자
//---------------------------------------------------------------------------------
/**
* /
* @param pageable Pageable
* @return Page<GnRecallScDto>
*/
Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable);
//
// /**
// * 거주자 / 장애인 심의자료 정보 조회
// * @param scCode Long
// * @return GnRecallScDto
// */
// GnRecallScDto findJudgeData(final Long scCode);
//
// //Page<GnRecallSc> findAll(final GnRecallSc entity, Pageable pageable);
//
// // 심의자료 저장
//
// /**
// * 거주자 / 장애인 심의자료 저장
// * @param entity GnRecallScDto
// */
// void saveJudgeData(GnRecallScDto entity);
//
// void removeJudgeData(Long scCode);
//
// /**
// * 거주자 / 장애인 의견진술 심의 목록 조회
// * @param dto JudgeListDto
// * @param pageable Pageable
// * @return Page<JudgeListDto>
// */
// Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable);
//
// /**
// * 거주자 / 장애인 의견진술 심의 결과 목록
// * @param dto JudgeListDto
// * @return Map
// */
// Map<String,Object> findJudgeResults(final JudgeListDto dto);
// Map<String,Object> findJudgeResults2(final JudgeListDto dto);
//
// /**
// * 거주자 / 장애인 심의대상 목록 조회
// * @param dto JufgeTargetDto
// * @return List<JudgeTargetDto>
// */
// List<JudgeTargetDto> findJudgeTargets(final JudgeTargetDto dto) ;
//
// /**
// * 거주자 / 장애인 심의대상 목록 저장
// * @param dto JudgeTargetDto
// */
// void saveJudgeTargets(JudgeTargetDto dto);
//
// void removeJudge(final JudgeListDto dto);
//
// void saveJudgeStds(final JudgeStdDto dto);
//
// Map<String,Object> findDashboard();
//
// //---------------------------------------------------------------------------------
// // 심사자
// //---------------------------------------------------------------------------------
// List<JudgeListDto> findByUserJudges(JudgeListDto dto);
//
// void saveJudgeResult(JudgeListDto dto);
}

@ -28,15 +28,13 @@ import org.apache.ibatis.session.SqlSessionFactory;
import org.dom4j.DocumentException;
import org.mapstruct.factory.Mappers;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.*;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -51,26 +49,30 @@ public class BoardService implements IBoardService {
@Transactional(readOnly = true)
public List<BoardDto> findAll(final BoardDto dto, Pageable pageable) {
//String sql = DBUtils.getXmlSql("sql/board2-mapper", "selectBoardList");
//String sql = DBUtils.getMybatisSql(sqlSessionTemplate, "board.selectBoardList", dto);
public Page<BoardDto> findAll(final BoardDto dto, Pageable pageable) {
String cntSql = getSql("selectBoardListCnt", dto, pageable);
String listSql = getSql("selectBoardList", dto, pageable);
MpowerUtils listQuery = new MpowerUtils();
listQuery.setFeilds("ciCode, ciName, ciContentno, ciTitle, ciContents, ciNalja, ciStep, ciRevel, ciRef, ciHit, ciPass, ciId");
listQuery.setQuery(listSql);
String sql = QueryGenerator.createNamedQuery("board", "selectBoardList")
Map<String,Object> map = listQuery.getPagingMap(BoardDto.class, cntSql);
if(Long.parseLong(map.get("totalCount").toString()) <= 0)
return new PageImpl<>(new ArrayList<>(), pageable, 0);
else
return new PageImpl<>((List<BoardDto>)map.get("list"), pageable, Long.parseLong(map.get("totalCount").toString()));
}
private String getSql(String sqlId, BoardDto dto, Pageable pageable){
return QueryGenerator.createNamedQuery("board", sqlId)
.setParameter("ciTitle", dto.getCiTitle())
.setParameter("ciName", dto.getCiName())
.setParameter("ciContents", dto.getCiContents())
.setParameter("page", pageable.getPageNumber())
.setParameter("size", pageable.getPageSize())
.getQueryString();
System.out.println(sql);
MpowerUtils sendXml = new MpowerUtils();
sendXml.setFeilds("ciCode, ciName, ciContentno, ciTitle, ciContents, ciNalja, ciStep, ciRevel, ciRef, ciHit, ciPass, ciId");
sendXml.setQuery(sql);
return sendXml.selectCustomQuery(BoardDto.class);
//return DBUtils.convertToValueObjects(sendXml.selectCustomQuery(), BoardDto.class);
}
// @Transactional(readOnly = true)
// public Page<MinCivBoard680> findAll2(final MinCivBoard680 entity, Pageable pageable) {
// pageable = JpaUtil.getPagingInfo(pageable);

@ -0,0 +1,177 @@
package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.v2.service.ICtgyFileService;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.util.AssertUtils;
import com.xit.core.util.Checks;
import io.jsonwebtoken.lang.Assert;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mapstruct.factory.Mappers;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Slf4j
@Service
@RequiredArgsConstructor
public class CtgyFileService implements ICtgyFileService {
@Value("${file.cmm.upload.root:c:/data/file/upload}")
private String rootPath;
@Value("${file.cmm.upload.path:/kangnamSIM/simUpFile/}")
private String uploadPath;
@Value("${file.cmm.upload.url}")
private String serviceUrl;
@Value("${file.cmm.upload.allow.ext:}")
private String allowExt;
@Value("${file.cmm.upload.max.size:1024}")
private long maxSize;
@Override
public MinInfoBoard680 findFiles(Long inCode) {
Assert.notNull(inCode, "대상 게시글[inCode]을 선택해 주세요.");
return null;
// return repository.findById(inCode).orElse(null);
}
//
// /**
// * 파일 등록
// * 신규등록시는 CmmFileMst.fileMstId가 null, 변경시 not null
// * 변경시 동일한 파일 이름이 존재하면 DB 및 해당 파일 삭제후 신규로 생성
// *
// * @param dto MinInfoBoard680Dto
// * @return CmmFileMst
// */
// @Override
// @Transactional
// public List<MinInfoBoard680> saveFiles(@Nonnull MinInfoBoard680Dto dto) {
// List<MinInfoBoard680> entityList = new ArrayList<>();
// MultipartFile[] files = dto.getFiles();
// String makePath = "";
//
// if(files != null && files.length > 0){
// //makePath = File.separator + DateUtil.getToday("");
//
// // 파일 경로 : upload root 제외
// String urlPath = this.uploadPath + makePath;
// // 물리적인 파일 저장 위치
// String fileUploadPath = this.rootPath + urlPath;
// File file = new File(fileUploadPath);
// if(!file.exists()) file.mkdirs();
//
// for(MultipartFile mf : files) {
// if (!mf.isEmpty()) {
// String orgFileName = "";
// try {
// orgFileName = StringUtils.cleanPath(Objects.requireNonNull(mf.getOriginalFilename()));
// MinInfoBoard680 savedEntity = null;
//
// // 파일 저장 && 전송
// if(Checks.isEmpty(dto.getInCode())) {
// dto.setInCode(repository.getInCodeByInBgubun());
// dto.setInContentno(dto.getInCode());
// dto.setInFilename(orgFileName);
// dto.setInFilesize(mf.getSize());
// dto.setInFileurl(serviceUrl + urlPath);
// savedEntity = mapstruct.toEntity(dto); //MinInfoBoard680.builder().build();
// }else {
// savedEntity = repository.findById(dto.getInCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));
// savedEntity.setInFilename(orgFileName);
// savedEntity.setInFilesize(mf.getSize());
// savedEntity.setInFileurl(serviceUrl + urlPath);
// setEntity(savedEntity, dto);
// }
// repository.save(savedEntity);
//
// entityList.add(savedEntity);
// mf.transferTo(new File(fileUploadPath + File.separator + orgFileName));
//
// // inputStream을 가져와
// // copyOfLocation (저장위치)로 파일을 쓴다.
// // copy의 옵션은 기존에 존재하면 REPLACE(대체한다), 오버라이딩 한다
// //Files.copy(multipartFile.getInputStream(), copyOfLocation, StandardCopyOption.REPLACE_EXISTING);
//
// } catch (IOException e) {
// String errMsg = String.format("File Upload Error :: %s", orgFileName);
// //TODO : 에러처리
// //return RestError.of(String.format("File Upload Error :: %s", orgFileName));
// AssertUtils.isTrue(false, String.format("File Upload Error :: %s", orgFileName));
// }
// }
// }
// }else{
// MinInfoBoard680 savedEntity = null;
// if(Checks.isEmpty(dto.getInCode())) {
// dto.setInCode(repository.getInCodeByInBgubun());
// dto.setInContentno(dto.getInCode());
// savedEntity = mapstruct.toEntity(dto);
// }else {
// savedEntity = repository.findById(dto.getInCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));
// setEntity(savedEntity, dto);
// }
// repository.save(savedEntity);
// //JpaUtil.saveIfNullId(dto.getInCode(), repository, savedEntity);
// }
// return entityList;
// }
//
// @Override
// @Transactional
// public void removePublicBoardFile(Long inCode) {
//
// MinInfoBoard680 savedEntity = repository.findById(inCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));
// repository.delete(savedEntity);
//
// // 정보 삭제후 파일 삭제 : 에러 발생시 skip
// if(Checks.isNotEmpty(savedEntity.getInFilename())){
// String absFile = rootPath + savedEntity.getInFileurl().split(serviceUrl)[1]+File.separator + savedEntity.getInFilename();
// try {
// File file = new File(absFile);
// if (Checks.isNotEmpty(file) && file.exists()) file.delete();
// }catch(Exception e){
// //
// }
// }
//
// }
//
// private void setEntity(MinInfoBoard680 savedEntity, MinInfoBoard680Dto dto){
// savedEntity.setInDept(dto.getInDept());
// savedEntity.setInTitle(dto.getInTitle());
// savedEntity.setInContents(dto.getInContents());
// }
}
/*
// File.seperator 는 OS종속적이다.
// Spring에서 제공하는 cleanPath()를 통해서 ../ 내부 점들에 대해서 사용을 억제한다
Path copyOfLocation = Paths.get(uploadDir + File.separator + StringUtils.cleanPath(multipartFile.getOriginalFilename()));
try {
// inputStream을 가져와서
// copyOfLocation (저장위치)로 파일을 쓴다.
// copy의 옵션은 기존에 존재하면 REPLACE(대체한다), 오버라이딩 한다
Files.copy(multipartFile.getInputStream(), copyOfLocation, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
throw new FileStorageException("Could not store file : " + multipartFile.getOriginalFilename());
}
*/

@ -0,0 +1,67 @@
package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.v2.service.IMinUserService;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.oauth2.utils.HeaderUtil;
import lombok.AllArgsConstructor;
import org.mapstruct.factory.Mappers;
import org.springframework.data.domain.*;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
@AllArgsConstructor
@Service
public class MinUserService implements IMinUserService {
private final PasswordEncoder passwordEncoder;
@Transactional//(readOnly = true)
public Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable) {
Sort sort = Sort.by(Sort.Direction.ASC, "team", "name");
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), sort);
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
.withMatcher("userid", contains())
.withMatcher("name", contains());
Example<MinUserinfo> example = Example.of(minUserinfo, exampleMatcher);
return null;
// Page<MinUserinfo> page = repository.findAll(example, pageable);
// return page;
}
// @Override
// @Transactional(readOnly = true)
// public MinUserinfo findMinUser() {
// //cmmUserRepos
// //return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId());
// return repository.findMinUserinfoByUserid(HeaderUtil.getUserId());
// }
//
// @Override
// @Transactional(readOnly = true)
// public MinUserinfo findMinUserByUserid(final String userid) {
// return repository.findMinUserinfoByUserid(userid);
// }
//
// @Override
// @Transactional
// public void saveMinUser(MinUserinfoDto dto) {
// if("Y".equals(dto.getNewYn()) && repository.findByUserid(dto.getUserid()).isPresent()) throw new CustomBaseException(ErrorCode.MEMBER_EXISTS);
// dto.setPasswd(passwordEncoder.encode(dto.getPasswd()));
// repository.save(mapstruct.toEntity(dto));
// }
//
// @Override
// @Transactional
// public void removeMinUser(MinUserinfoDto dto) {
// MinUserinfo entity = repository.findByUserid(dto.getUserid()).orElseThrow(()-> new CustomBaseException(ErrorCode.USER_NOT_FOUND));
// entity.setIsenable("0");
// repository.save(entity);
// }
}

@ -0,0 +1,183 @@
package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto;
import com.xit.biz.ctgy.entity.MinSimsaUser680;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.entity.Tf680Recall;
import com.xit.biz.ctgy.v2.service.IParkingService;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.support.jpa.JpaUtil;
import com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
public class ParkingService implements IParkingService {
@Override
@Transactional(readOnly = true)
public Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable) {
return null;
// return repository.findParkings(dto, pageable);
}
// @Override
// public Map<String,Object> findParkingResults(JudgeListDto dto) {
// Map<String, Object> resultMap = new HashMap<>();
//
// // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두
//// Map<String, Object> teamMap = mapper.selectTotParkingJudgeResultGroupByTeamAndChasu(dto);
//// if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//// List<Map<String, Object>> totJudgeUserList = mapper.selectTotParkingJudgeResultGroupByUser(dto);
//// totJudgeUserList.add(teamMap);
//
// List<Map<String, Object>> teamList = mapper.selectParkingJudgeTeamGroupByChasuAndTeamList(dto);
// if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//
// // 차수별 심사자별 심사결과 합산
// dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam")));
// List<Map<String, Object>> totJudgeUserList = mapper.selectTotParkingJudgeResultGroupByUser(dto);
// totJudgeUserList.add(teamList.get(0));
//
// // 심사대상 차량 목록
// List<Map<String,Object>> judgeCarList = mapper.selectParkingJurgeResultGroupByCarnum(dto);
//
// // 차량별 심사자 심사결과 목록
// Map<String, Object> paramMap = new HashMap<>();
// paramMap.put("msDatagb", dto.getMsDatagb());
// paramMap.put("msChasu", dto.getMsChasu());
// paramMap.put("msSdate", dto.getMsSdate());
// paramMap.put("msEdate", dto.getMsEdate());
// paramMap.put("msuTeam", dto.getMsuTeam());
// paramMap.put("seqList", judgeCarList.stream().map(m -> m.get("msSeq")).collect(Collectors.toList()));
// paramMap.put("carnumList", judgeCarList.stream().map(m -> m.get("msCarnum")).collect(Collectors.toList()));
//
// List<Map<String,Object>> jurgeUserList = mapper.selectParkingJudgeResultList(paramMap);
//// List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
//// paramMap.put("msSeq", m.get("msSeq"));
//// paramMap.put("msCarnum", m.get("msCarnum"));
//// m.put("simsa", mapper.selectParkingJudgeResultList(paramMap));
//// }).collect(Collectors.toList());
//
// resultMap.put("teamList", teamList);
// // 차수별 심사자별 심사결과 합산
// resultMap.put("totJudgeUserData", totJudgeUserList);
// // 심사대상 차량 목록
// resultMap.put("judgeCarData", judgeCarList);
// // 차량별 심사자 심사결과 목록
// resultMap.put("judgeUserData", jurgeUserList);
//
// return resultMap;
// }
//
// @Override
// @Transactional(readOnly = true)
// public List<ParkingTargetDto> findParkingJudgeTargets(ParkingTargetDto dto) {
// return repository.findParkingJudgeTargets(dto);
// }
//
// @Override
// @Transactional
// public void saveParkingJudgeTargets(ParkingTargetDto dto) {
// boolean isFirst = true;
//
// for(Long rcCode : dto.getRcCodes()) {
//
// //---------------------------------------------------------
// // 심사대상 등록
// //---------------------------------------------------------
// dto.setRcCode(rcCode);
//
// if (isFirst) {
// dto.setMsYear(dto.getMsSdate().toString().substring(0, 4));
// dto.setMsResult("0");
// isFirst = false;
// }
// if(mapper.insertParkingJudgeTargetIntoSelect(dto) == 0) throw new CustomBaseException(String.format("처리된 데이타가 있습니다[ %s ]", dto.getMmOcarno()));
//
// //---------------------------------------------------------
// // 등록한 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수
// //---------------------------------------------------------
// Tf680Recall recallEntity = recallRepository.findById(dto.getRcCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND));
// recallEntity.setRcIrTransfer(CtgyConstants.Judge.TRANSFER_ACCEPT.getCode());
// JpaUtil.saveIfNullId(recallEntity.getRcCode(), recallRepository, recallEntity);
//
// //---------------------------------------------------------
// // 심사자 등록
// //---------------------------------------------------------
// List<MinUserinfo> userinfoList = userRepository.findAllByTeamAndIsenableAndAccesstype(
// dto.getMsuTeam(),
// CtgyConstants.UserInfo.ISENABLED_USE.getCode(),
// CtgyConstants.UserInfo.ACCESSTYPE_SIMSA.getCode());
//
// List<MinSimsaUser680> simsaUserList = userinfoList.stream().map(u ->
// MinSimsaUser680.builder()
// .msuMaincode(rcCode)
// .msuUserid(u.getUserid())
// .msuResult(CtgyConstants.SimsaUserInfo.MSU_RESULT_NONE.getCode())
// //.msuReaso
// // n()
// .msuTeam(dto.getMsuTeam())
// //.msuIndate()
// .build()
// ).collect(Collectors.toList());
// parkingJudgeUserRepository.saveAll(simsaUserList);
// }
// }
//
//
// /**
// * 심사자료 삭제
// * 1. 삭제 대상 조회 : min_simsa680 테이블 : ms_chasu, ms_sdate, ms_edate 조건으로 ms_maincode 삭제 대상 조회
// * 2. 심사자 삭제 : min_simsa_user680 테이블 : msu_maincode = ms_maincode
// * 3. 단속데이타 정보 변경 : tf680_recall 테이블 : rc_ir_transfer = '1', rc_code = ms_maincode
// * 4. 심사자료 삭제 : min_simsa680 테이블 ms_maincode = ms_maincode
// * @param dto ParkingTargetDto
// */
// @Override
// @Transactional
// public void removeParkingJudge(final ParkingTargetDto dto) {
//
// List<Long> msMaincodes = repository.findAllMsMaincode(dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate());
//
// msMaincodes.forEach(msMaincode -> {
// parkingJudgeUserRepository.deleteByMsuMaincode(msMaincode);
// // 전송상태 -> 미접수(1), 심의결과 -> 심의전(0)
// recallRepository.updateRcIrTransferAndRcState(msMaincode);
// repository.deleteById(msMaincode);
// });
// }
//
// //---------------------------------------------------------------------------------
// // 심사자
// //---------------------------------------------------------------------------------
// @Override
// @Transactional(readOnly = true)
// public List<JudgeListDto> findByUserJudges() {
// return repository.findByUserJudges();
// }
//
// @Override
// @Transactional
// public void saveJudgeResult(JudgeListDto dto){
// parkingJudgeUserRepository.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(),
// dto.getMsuResult(),
// dto.getMsuReason(),
// LocalDate.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
// }
}

@ -0,0 +1,45 @@
package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.v2.service.IPublicBoardService;
import com.xit.core.support.jpa.JpaUtil;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
@Service
@AllArgsConstructor
public class PublicBoardService implements IPublicBoardService {
@Override
@Transactional(readOnly = true)
public Page<MinInfoBoard680> findAll(final MinInfoBoard680 entity, Pageable pageable) {
// Sort sort = Sort.by(Sort.Direction.DESC, "inCode");
pageable = JpaUtil.getPagingInfo(pageable);
// pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("inCode").descending())
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
.withMatcher("inTitle", contains())
.withMatcher("inName", contains());
Example<MinInfoBoard680> example = Example.of(entity, exampleMatcher);
return null;
// Page<MinInfoBoard680> page = repository.findAll(
// example,
// PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("inCode").descending()));
// return page;
}
// @Override
// @Transactional(readOnly = true)
// public MinInfoBoard680 findByInCode(final Long inCode) {
// return repository.findByInCode(inCode);
// }
//
// @Override
// @Transactional
// public int modifyByInCode(Long inCode) {
// return repository.updateInHitForMinInfoBoard680(inCode);
// }
}

@ -0,0 +1,390 @@
package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.cmm.service.ICmmFileService;
import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeStdDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.entity.GnRecallSc;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.entity.MinSimsaUser680Sc;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.mapper.IParkingMapper;
import com.xit.biz.ctgy.service.IPublicBoardService;
import com.xit.biz.ctgy.v2.service.IResidentAndDisabledService;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.support.jpa.JpaUtil;
import com.xit.core.util.Checks;
import com.xit.core.util.DateUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mapstruct.factory.Mappers;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.persistence.EntityManager;
import javax.validation.constraints.NotNull;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Slf4j
public class ResidentAndDisabledService implements IResidentAndDisabledService {
@Value("${file.cmm.upload.root:c:/data/file/upload}")
private String rootPath;
@Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}")
private String[] uploadPath;
private final ICmmFileService fileService;
private final IPublicBoardService pBoardService;
private final IParkingMapper parkingMapper;
private final EntityManager entityManager;
//---------------------------------------------------------------------------------
// 관리자
//---------------------------------------------------------------------------------
@Override
@Transactional(readOnly = true)
public Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) {
// Sort sort = Sort.by(Sort.Direction.DESC, "inCode");
pageable = JpaUtil.getPagingInfo(pageable);
return null;
// return gnReacallRepository.findJudgeDatas(
// scDatagb,
// PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending()));
}
// @Override
// @Transactional(readOnly = true)
// public GnRecallScDto findJudgeData(final Long scCode) {
// return gnReacallRepository.findJudgeData(scCode);
// }
//
// @Override
// @Transactional
// public void saveJudgeData(GnRecallScDto dto) {
// boolean isNew = Checks.isEmpty(dto.getScCode()) || dto.getScCode() == 0L;
//
// if(dto.getPicadFiles() != null) {
// if(!isNew) changeFileUpload(dto, dto.getPicadFiles());
// else setFileInfoAndFileUpload(dto, dto.getPicadFiles(), "setScPicad");
// }
//
// if(dto.getFrecadFiles() != null) {
// if(!isNew) changeFileUpload(dto, dto.getFrecadFiles());
// else setFileInfoAndFileUpload(dto, dto.getFrecadFiles(), "setScFrecad");
// }
//
// if(dto.getContadFiles() != null) {
// if(!isNew) changeFileUpload(dto, dto.getContadFiles());
// else setFileInfoAndFileUpload(dto, dto.getContadFiles(), "setScContad");
// }
//
// GnRecallSc entity = null;
// // 신규
// if (isNew) {
// // 접수번호 채번 : 년도 + seq 10자리
// dto.setScSeq(gnReacallRepository.getGnRecallScMaxScSeq(String.valueOf(DateUtil.getCurrentYear()), CtgyConstants.Judge.DATAGB_RESIDENT.getCode()));
// entity = mapstruct.toEntity(dto);
// }else{
// entity = mapstruct.toEntity(dto);
// }
// gnReacallRepository.save(entity);
//
// }
//
//
// @Override
// @Transactional
// public void removeJudgeData(final Long scCode){
// gnReacallRepository.deleteById(scCode);
// }
//
// @Override
// @Transactional(readOnly = true)
// public List<JudgeTargetDto> findJudgeTargets(JudgeTargetDto dto) {
// return gnReacallRepository.findJudgeTargets(dto);
// }
//
// @Override
// @Transactional
// public void saveJudgeTargets(JudgeTargetDto dto) {
// boolean isFirst = true;
//
// for(Long scCode : dto.getScCodes()) {
//
// //---------------------------------------------------------
// // 심사대상 등록
// //---------------------------------------------------------
// dto.setScCode(scCode);
//
// if (isFirst) {
// dto.setMsYear(dto.getMsSdate().toString().substring(0, 4));
// dto.setMsResult("0");
// isFirst = false;
// }
// if(residentAndDisabledMapper.insertJudgeTargetIntoSelect(dto) == 0) throw new CustomBaseException(String.format("처리된 데이타가 있습니다[ %s ]", dto.getScCarnum()));
//
// //---------------------------------------------------------
// // 등록한 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수, 심의결과 : 접수 -> 심사중
// //---------------------------------------------------------
// GnRecallSc entity = gnReacallRepository.findById(dto.getScCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND));
// entity.setScTransfer(CtgyConstants.Judge.TRANSFER_ACCEPT.getCode());
// // entity.setScState(CtgyConstants.Judge.DATA_STATE_JUDGE.getCode());
// //JpaUtil.saveIfNullId(dto.getScCode(), repository, entity);
// gnReacallRepository.save(entity);
//
// //---------------------------------------------------------
// // 심사자 등록
// //---------------------------------------------------------
// List<MinUserinfo> userinfoList = userRepository.findAllByTeamAndIsenableAndAccesstype(
// dto.getMsuTeam(),
// CtgyConstants.UserInfo.ISENABLED_USE.getCode(),
// CtgyConstants.UserInfo.ACCESSTYPE_SIMSA.getCode());
//
// List<MinSimsaUser680Sc> simsaUserList = userinfoList.stream().map(u ->
// MinSimsaUser680Sc.builder()
// .msuMaincode(scCode)
// .msuUserid(u.getUserid())
// .msuResult(CtgyConstants.SimsaUserInfo.MSU_RESULT_NONE.getCode())
// //.msuReason()
// .msuTeam(dto.getMsuTeam())
// //.msuIndate()
// .build()
// ).collect(Collectors.toList());
// judgeUserRepository.saveAll(simsaUserList);
// }
// }
//
// @Override
// @Transactional(readOnly = true)
// public Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable) {
//
// pageable = JpaUtil.getPagingInfo(pageable);
// return gnReacallRepository.findJudges(dto, pageable);
// }
//
// @Override
// @Transactional(readOnly = true)
// public Map<String,Object> findJudgeResults(JudgeListDto dto) {
// Map<String, Object> resultMap = new HashMap<>();
//
// // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두
//// Map<String, Object> teamMap = residentAndDisabledMapper.selectTotJudgeResultGroupByTeamAndChasu(dto);
//// if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//// List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
//// totJudgeUserList.add(teamMap);
//
// List<Map<String, Object>> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto);
// if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//
// // 차수별 심사자별 심사결과 합산
// dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam")));
// List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
// totJudgeUserList.add(teamList.get(0));
//
// // 심사대상 차량 목록
// List<Map<String,Object>> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto);
//
// // 차량별 심사자 심사결과 목록
// Map<String, Object> paramMap = new HashMap<>();
// paramMap.put("msDatagb", dto.getMsDatagb());
// paramMap.put("msChasu", dto.getMsChasu());
// paramMap.put("msSdate", dto.getMsSdate());
// paramMap.put("msEdate", dto.getMsEdate());
// paramMap.put("msuTeam", dto.getMsuTeam());
//
// paramMap.put("seqList", judgeCarList.stream().map(m -> m.get("msSeq")).collect(Collectors.toList()));
// paramMap.put("carnumList", judgeCarList.stream().map(m -> m.get("msCarnum")).collect(Collectors.toList()));
// List<Map<String,Object>> jurgeUserList = residentAndDisabledMapper.selectJudgeResultList(paramMap);
//
//// List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
//// paramMap.put("msSeq", m.get("msSeq"));
//// paramMap.put("msCarnum", m.get("msCarnum"));
//// m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap));
//// }).collect(Collectors.toList());
//
//
// resultMap.put("teamList", teamList);
// // 차수별 심사자별 심사결과 합산
// resultMap.put("totJudgeUserData", totJudgeUserList);
// // 심사대상 차량 목록
// resultMap.put("judgeCarData", judgeCarList);
// // 차량별 심사자 심사결과 목록
// resultMap.put("judgeUserData", jurgeUserList);
// return resultMap;
// }
//
// @Override
// @Transactional(readOnly = true)
// public Map<String,Object> findJudgeResults2(JudgeListDto dto) {
// Map<String, Object> resultMap = new HashMap<>();
//
// // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두
//// Map<String, Object> teamMap = residentAndDisabledMapper.selectTotJudgeResultGroupByTeamAndChasu(dto);
//// if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//// List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
//// totJudgeUserList.add(teamMap);
//
// List<Map<String, Object>> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto);
// if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//
// // 차수별 심사자별 심사결과 합산
// dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam")));
// List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
// totJudgeUserList.add(teamList.get(0));
//
// // 심사대상 차량 목록
// List<Map<String,Object>> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto);
//
// // 차량별 심사자 심사결과 목록
// Map<String, Object> paramMap = new HashMap<>();
// paramMap.put("msDatagb", dto.getMsDatagb());
// paramMap.put("msChasu", dto.getMsChasu());
// paramMap.put("msSdate", dto.getMsSdate());
// paramMap.put("msEdate", dto.getMsEdate());
// paramMap.put("msuTeam", dto.getMsuTeam());
//
// paramMap.put("seqList", judgeCarList.stream().map(m -> m.get("msSeq")).collect(Collectors.toList()));
// paramMap.put("carnumList", judgeCarList.stream().map(m -> m.get("msCarnum")).collect(Collectors.toList()));
// List<Map<String,Object>> jurgeUserList = residentAndDisabledMapper.selectJudgeResultList(paramMap);
//
//// List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
//// paramMap.put("msSeq", m.get("msSeq"));
//// paramMap.put("msCarnum", m.get("msCarnum"));
//// m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap));
//// }).collect(Collectors.toList());
//
//
// resultMap.put("teamList", teamList);
// // 차수별 심사자별 심사결과 합산
// resultMap.put("totJudgeUserData", totJudgeUserList);
// // 심사대상 차량 목록
// resultMap.put("judgeCarData", judgeCarList);
// // 차량별 심사자 심사결과 목록
// resultMap.put("judgeUserData", jurgeUserList);
// return resultMap;
// }
//
// /**
// * 심사자료 삭제
// * 1. 삭제 대상 조회 : min_simsa680_sc 테이블 : ms_datagb, ms_chasu, ms_sdate, ms_edate 조건으로 ms_maincode 삭제 대상 조회
// * 2. 심사자 삭제 : min_simsa_user680_sc 테이블 : msu_maincode = ms_maincode
// * 3. 단속데이타 정보 변경 : gn_recall_sc 테이블 : sc_transfer = '1', sc_state = '1', sc_code = ms_maincode
// * 4. 심사자료 삭제 : min_simsa680_sc 테이블 ms_maincode = ms_maincode
// * @param dto ParkingTargetDto
// */
// @Override
// @Transactional
// public void removeJudge(final JudgeListDto dto) {
//
// List<Long> msMaincodes = judgeRepository.findAllMsMaincode(dto.getMsDatagb(), dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate());
//
// msMaincodes.forEach(msMaincode -> {
// //List<MinSimsaUser680Sc> judgeUsers = judgeUserRepository.findByMsuMaincode()
// judgeUserRepository.deleteByMsuMaincode(msMaincode);
// // 전송상태 -> 미접수(1), 심의결과 -> 접수(1)
// gnReacallRepository.updateScTransferAndScState(dto.getMsDatagb(), msMaincode);
// judgeRepository.deleteById(msMaincode);
// });
// }
//
// @Override
// @Transactional
// public void saveJudgeStds(final JudgeStdDto dto) {
// int stdCnt = dto.getJudgeStdCnt();
//
// dto.getJudgeDataKeys().forEach(map -> {
// int cnt = 0;
// Long msMaincode = Long.valueOf(map.get("msMaincode").toString());
// String msSeq = map.get("msSeq").toString();
//
// // 미부과
// String msResult = CtgyConstants.Judge.RESULT_JUDGE_NON_IMPOSE.getCode();
// // 주정차 심사
// if (Checks.isEmpty(dto.getDataGb())) {
// cnt = parkingRepository.getJudgeStdCnt(msMaincode);
// if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode();
//
// parkingRepository.updateMsResult(msMaincode, msSeq, msResult);
//
// // 거주자 장애인 심사
// } else {
// cnt = gnReacallRepository.getJudgeStdCnt(msMaincode);
// if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode();
//
// judgeRepository.updateMsResult(msMaincode, msSeq, msResult);
// }
// });
// }
//
// @Transactional(readOnly = true)
// public Map<String,Object> findDashboard(){
// Map<String, Object> resultMap = new HashMap<>();
// resultMap.put("pBoardList", pBoardService.findAll(MinInfoBoard680.builder().build(), PageRequest.of(0, 7)));
// resultMap.put("parkJudgeList", parkingMapper.selectDashboardJudgeList());
// resultMap.put("residentJudgeList", residentAndDisabledMapper.selectDashboardJudgeList(CtgyConstants.Judge.DATAGB_RESIDENT.getCode()));
// resultMap.put("disabledJudgeList", residentAndDisabledMapper.selectDashboardJudgeList(CtgyConstants.Judge.DATAGB_DISABLED.getCode()));
//
// return resultMap;
// }
//
// private void setFileInfoAndFileUpload(GnRecallScDto dto, MultipartFile[] mfs, String setMethodName) {
// String makePath = fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]);
// //makePath = makePath + File.separator;
//
// for(int idx = 0; idx < mfs.length; idx++){
// MultipartFile mf = mfs[idx];
// try {
// Method method = GnRecallScDto.class.getMethod(setMethodName + (idx+1), String.class);
// method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename()));
// //method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename()));
// } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
// e.printStackTrace();
// }
// }
// }
//
// private void changeFileUpload(GnRecallScDto dto, MultipartFile[] mfs) {
// fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]);
// }
//
//
// //---------------------------------------------------------------------------------
// // 심사자
// //---------------------------------------------------------------------------------
// @Override
// @Transactional(readOnly = true)
// public List<JudgeListDto> findByUserJudges(JudgeListDto dto) {
// return gnReacallRepository.findByUserJudges(dto);
// }
//
// @Override
// @Transactional
// public void saveJudgeResult(JudgeListDto dto){
// judgeUserRepository.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(),
// dto.getMsuResult(),
// dto.getMsuReason(),
// LocalDate.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
// }
}

@ -20,10 +20,10 @@ public class RefreshTokenDao {
//String sql = DBUtils.getXmlSql(sqlXmlFile, "selectRefreshToken");
//sql = sql.replaceFirst(":userId", key);
MpowerUtils sendXml = new MpowerUtils();
sendXml.setFeilds("key, value");
sendXml.setQuery(sql);
return Optional.ofNullable(sendXml.selectCustomQuery(RefreshToken.class).get(0));
MpowerUtils selectQuery = new MpowerUtils();
selectQuery.setFeilds("key, value");
selectQuery.setQuery(sql);
return Optional.ofNullable(selectQuery.getListObject(RefreshToken.class).get(0));
}
public void save(RefreshToken refreshToken){
@ -37,7 +37,7 @@ public class RefreshTokenDao {
.getQueryString();
MpowerUtils sendXml = new MpowerUtils();
MpowerUtils saveQuery = new MpowerUtils();
//sendXml.setFeilds("key, value");
//sendXml.setQuery(sql);
//return Optional.ofNullable(sendXml.selectCustomQuery(RefreshToken.class).get(0));
@ -54,7 +54,7 @@ public class RefreshTokenDao {
.getQueryString();
MpowerUtils sendXml = new MpowerUtils();
MpowerUtils updateQuery = new MpowerUtils();
//sendXml.setFeilds("key, value");
//sendXml.setQuery(sql);
//return Optional.ofNullable(sendXml.selectCustomQuery(RefreshToken.class).get(0));

@ -33,7 +33,7 @@ public class MpowerUtils {
static int port = 9999;
static String query = "";
static ArrayList<String> feilds = new ArrayList<String>();
static String feild = "";
//static String feild = "";
static String tmpFeilds = "";
static Boolean RowNum = false;
static String tableNm = "";
@ -142,7 +142,7 @@ public class MpowerUtils {
Params = "";
psFinalFarams = "";
recordCountPerPage = 10;
feild = "";
//feild = "";
}
@ -267,11 +267,11 @@ public class MpowerUtils {
}
String finalQuery = "";
String Cquery = beforeXml + "select count(*) from " + tableNm +" "+ WhereStr +afterXml;
if(!"".equals(feild) && feild != null){
finalQuery = query;
}else{
// if(!"".equals(feild) && feild != null){
// finalQuery = query;
// }else{
finalQuery = "select " + fileList +" from " + tableNm +" "+ WhereStr;
}
//}
if(RowNum == true){
feilds = new ArrayList<String>();
this.setFeilds("RN, "+tmpFeilds);
@ -314,12 +314,7 @@ public class MpowerUtils {
if(!chpoint)
{
for(int j=0;j<size;j++){
if(!"".equals(feild) && feild != null){
m.put("cbContent", rs.getString(feilds.get(j).toString()));
}else{
m.put(feilds.get(j),rs.getString(feilds.get(j).toString()));
}
m.put(feilds.get(j),rs.getString(feilds.get(j).toString()));
}
mList.add(m);
}
@ -346,26 +341,10 @@ public class MpowerUtils {
* @ SELECT
* @return
*/
public List<Map<String,Object>> selectCustomQuery() {
//EgovMap mListMap = new EgovMap();
Map<String,Object> mListMap = new HashMap<>();
//배열로 넘어온 필드를 String 오브젝트로 변형
String fileList = "";
for(int cnt = 0;cnt<feilds.size();cnt++){
if(cnt==0){
fileList += feilds.get(cnt);
}else{
fileList += "," + feilds.get(cnt);
}
}
query = beforeXml+query+afterXml;
//logger.debug("=====================================================Select Query==================================================");
//logger.debug(query);
log.debug("query\n"+query);
//List<EgovMap> mList = new ArrayList<EgovMap>();
public List<Map<String,Object>> getListMap() {
List<Map<String,Object>> mList = new ArrayList<>();
int mListCount = 0;
query = beforeXml+query+afterXml;
try {
mpower = new Client(hostip,port);
mpower.setCryptEnable(false);
@ -374,29 +353,21 @@ public class MpowerUtils {
mpower.Request();
String result = mpower.getString("result", 0, 0);
// System.out.println("#######message = "+mpower.getMessage());
// System.out.println("#######message charset = "+CommUtil.detectCharset(mpower.getMessage().getBytes()));
// System.out.println("#######message = "+new String(mpower.getMessage().getBytes(), CommUtil.detectCharset(mpower.getMessage().getBytes())));
int row;
if (result.equals("true")){
row = mpower.getMaxRow("list1");
if(row>0){
for(int i=0;i<row;i++){
Map<String,Object> m = new HashMap<>();
if(!"".equals(feild) && feild != null){
m.put("cbContent", mpower.getString("list1", i, 4));
}else{
for(int j=0;j<feilds.size();j++){
m.put(feilds.get(j), mpower.getString("list1", i, j));
}
for(int j=0;j<feilds.size();j++){
m.put(feilds.get(j), mpower.getString("list1", i, j));
}
mList.add(m);
}
}
}
mpower.disconnect();
//logger.debug("===============================================================================================================");
} catch (Exception e) {
e.printStackTrace();
} finally{
@ -405,26 +376,78 @@ public class MpowerUtils {
return mList;
}
public <T> List<T> selectCustomQuery(Class<T> type) {
public <T> List<T> getListObject(Class<T> type) {
List<T> list = new ArrayList<>();
String fileList = "";
for(int cnt = 0;cnt<feilds.size();cnt++){
if(cnt==0){
fileList += feilds.get(cnt);
}else{
fileList += "," + feilds.get(cnt);
query = beforeXml+query+afterXml;
try {
mpower = new Client(hostip,port);
mpower.setCryptEnable(false);
mpower.getConnection("MPowerXmlToQuery.xmlQuery1");
mpower.setInput("SQLXML", query);
mpower.Request();
String result = mpower.getString("result", 0, 0);
int row;
if (result.equals("true")){
row = mpower.getMaxRow("list1");
if(row>0){
for(int i=0;i<row;i++){
T instance = null;
try {
instance = type.getConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
Field[] clsFields = type.getDeclaredFields();
for(int j=0;j<feilds.size();j++){
for (Field fd : clsFields) {
fd.setAccessible(true);
if (feilds.get(j).equals(fd.getName())) {
if(fd.getType() == Integer.class) fd.set(instance, Integer.parseInt(mpower.getString("list1", i, j)));
else if(fd.getType() == Long.class) fd.set(instance, Long.parseLong(mpower.getString("list1", i, j)));
else fd.set(instance, mpower.getString("list1", i, j));
break;
}
}
}
list.add(instance);
}
}
}
mpower.disconnect();
} catch (Exception e) {
e.printStackTrace();
} finally{
clearValidation();
}
query = beforeXml+query+afterXml;
//logger.debug("=====================================================Select Query==================================================");
//logger.debug(query);
return list;
}
log.debug("query\n"+query);
//List<EgovMap> mList = new ArrayList<EgovMap>();
public <T> Map<String, Object> getPagingMap(Class<T> type, String cntQuery) {
Map<String, Object> rtnMap = new HashMap<>();
List<T> list = new ArrayList<>();
String cntSql = beforeXml + cntQuery +afterXml;
long totalCnt = 0L;
try{
mpower = new Client(hostip,port);
mpower.getConnection("MPowerXmlToQuery.xmlQuery1");
mpower.setInput("SQLXML", cntSql);
mpower.Request();
int mListCount = 0;
totalCnt = Long.parseLong(mpower.getString("list1", 0, 0));
rtnMap.put("totalCount", totalCnt);
mpower.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
if(totalCnt <= 0) return rtnMap;
query = beforeXml+query+afterXml;
try {
mpower = new Client(hostip,port);
mpower.setCryptEnable(false);
@ -438,52 +461,41 @@ public class MpowerUtils {
row = mpower.getMaxRow("list1");
if(row>0){
for(int i=0;i<row;i++){
//Map<String,Object> m = new HashMap<>();
T instance = null;
try {
instance = type.getConstructor().newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
if(!"".equals(feild) && feild != null){
//m.put("cbContent", mpower.getString("list1", i, 4));
continue;
}else{
Field[] clsFields = type.getDeclaredFields();
for(int j=0;j<feilds.size();j++){
for (Field fd : clsFields) {
fd.setAccessible(true);
if (feilds.get(j).equals(fd.getName())) {
if(fd.getType() == Integer.class) fd.set(instance, Integer.parseInt(mpower.getString("list1", i, j)));
else if(fd.getType() == Long.class) fd.set(instance, Long.parseLong(mpower.getString("list1", i, j)));
else fd.set(instance, mpower.getString("list1", i, j));
break;
}
Field[] clsFields = type.getDeclaredFields();
for(int j=0;j<feilds.size();j++){
for (Field fd : clsFields) {
fd.setAccessible(true);
if (feilds.get(j).equals(fd.getName())) {
if(fd.getType() == Integer.class) fd.set(instance, Integer.parseInt(mpower.getString("list1", i, j)));
else if(fd.getType() == Long.class) fd.set(instance, Long.parseLong(mpower.getString("list1", i, j)));
else fd.set(instance, mpower.getString("list1", i, j));
break;
}
}
}
list.add(instance);
}
rtnMap.put("list", list);
}
}
mpower.disconnect();
//logger.debug("===============================================================================================================");
} catch (Exception e) {
e.printStackTrace();
} finally{
clearValidation();
}
return list;
return rtnMap;
}
public void setFeilds(String string) {
String[] m = string.split(",");
for(int i=0;i<m.length;i++){

@ -2,37 +2,59 @@
<entity-mappings namespace="board">
<native-query id="selectBoardList">
/* board-mapper|selectBoardList|julim */
SELECT MCB.ci_code,
MU.name,
MCB.ci_contentno,
MCB.ci_title,
MCB.ci_contents,
MCB.ci_nalja,
MCB.ci_step,
MCB.ci_revel,
MCB.ci_ref,
MCB.ci_hit,
MCB.ci_pass,
MCB.ci_id
FROM min_civ_board680 MCB
LEFT OUTER JOIN min_userinfo MU
ON MCB.ci_id = MU.userid
<where>
<if test="ciTitle != null and ciTitle != ''">
AND INSTR(MCB.ci_title, #{ciTitle}) &gt; 0
</if>
<if test="ciName != null and ciName != ''">
AND MCB.ci_name like #{ciName}||'%'
</if>
<if test="ciContents != null and ciContents != ''">
AND INSTR(MCB.ci_contents, #{ciContents}) &gt; 0
</if>
</where>
ORDER BY MCB.ci_ref DESC,
MCB.ci_step ASC,
MCB.ci_code DESC
SELECT ci_code,
name,
ci_contentno,
ci_title,
ci_contents,
ci_nalja,
ci_step,
ci_revel,
ci_ref,
ci_hit,
ci_pass,
ci_id,
ROWNUM AS rn
FROM (
SELECT ROWNUM AS rn,
MCB.*,
MU.name
FROM min_civ_board680 MCB
LEFT OUTER JOIN min_userinfo MU
ON MCB.ci_id = MU.userid
<where>
<if test="ciTitle != null and ciTitle != ''">
AND INSTR(MCB.ci_title, #{ciTitle}) &gt; 0
</if>
<if test="ciName != null and ciName != ''">
AND MCB.ci_name like #{ciName}||'%'
</if>
<if test="ciContents != null and ciContents != ''">
AND INSTR(MCB.ci_contents, #{ciContents}) &gt; 0
</if>
</where>
ORDER BY MCB.ci_ref DESC, MCB.ci_step ASC, MCB.ci_code DESC
)
WHERE rn BETWEEN (#{page} * #{size} + 1) AND (#{page} + 1) * #{size}
</native-query>
<native-query id="selectBoardListCnt">
/* board-mapper|selectBoardListCnt|julim */
SELECT count(MCB.ci_code) AS totalCount
FROM min_civ_board680 MCB
LEFT OUTER JOIN min_userinfo MU
ON MCB.ci_id = MU.userid
<where>
<if test="ciTitle != null and ciTitle != ''">
AND INSTR(MCB.ci_title, #{ciTitle}) &gt; 0
</if>
<if test="ciName != null and ciName != ''">
AND MCB.ci_name like #{ciName}||'%'
</if>
<if test="ciContents != null and ciContents != ''">
AND INSTR(MCB.ci_contents, #{ciContents}) &gt; 0
</if>
</where>
</native-query>
</entity-mappings>
Loading…
Cancel
Save