refactor: 패키지 변경 적용

dev
minuk926 3 years ago
parent d0881b869d
commit a936f4833d

@ -1,6 +1,6 @@
package com.xit.biz.ctgy.auth;
import com.xit.biz.ctgy.repository.IMinUserinfoRepository;
import com.xit.biz.ctgy.repository.IMinUserRepository;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@ -17,7 +17,7 @@ public class MinPasswordEncoder implements PasswordEncoder {
@Setter
private String userid;
private final IMinUserinfoRepository repository;
private final IMinUserRepository repository;
// public MinPasswordEncoder(IMinUserinfoRepository repository) {
// this.repository = repository;

@ -4,7 +4,7 @@ import com.xit.biz.cmm.entity.CmmUser;
import com.xit.biz.ctgy.auth.service.IAuthMinService;
import com.xit.biz.ctgy.dto.LoginMinRequestDto;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.repository.IMinUserinfoRepository;
import com.xit.biz.ctgy.repository.IMinUserRepository;
import com.xit.core.constant.ErrorCode;
import com.xit.core.constant.XitConstants;
import com.xit.core.exception.TokenAuthException;
@ -18,7 +18,6 @@ import com.xit.core.oauth2.utils.CookieUtil;
import com.xit.core.oauth2.utils.HeaderUtil;
import com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor;
import org.hibernate.Hibernate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -50,7 +49,7 @@ public class AuthMinService implements IAuthMinService {
private final AppProperties appProperties;
private final AuthenticationManager authenticationManager;
private final IMinUserinfoRepository userRepository;
private final IMinUserRepository userRepository;
private final JwtTokenProvider jwtTokenProvider;
private final RefreshTokenRepository refreshTokenRepository;

@ -2,7 +2,7 @@ package com.xit.biz.ctgy.auth.service.impl;
import com.xit.biz.ctgy.auth.UserMinPrincipal;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.repository.IMinUserinfoRepository;
import com.xit.biz.ctgy.repository.IMinUserRepository;
import com.xit.core.oauth2.oauth.entity.ProviderType;
import com.xit.core.oauth2.oauth.info.AbstractOAuth2UserInfo;
import com.xit.core.oauth2.oauth.info.OAuth2UserInfoFactory;
@ -21,7 +21,7 @@ import java.util.Optional;
@RequiredArgsConstructor
public class CustomMinOAuth2UserService extends DefaultOAuth2UserService {
private final IMinUserinfoRepository userRepository;
private final IMinUserRepository userRepository;
@Override
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {

@ -2,7 +2,7 @@ package com.xit.biz.ctgy.auth.service.impl;
import com.xit.biz.ctgy.auth.UserMinPrincipal;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.repository.IMinUserinfoRepository;
import com.xit.biz.ctgy.repository.IMinUserRepository;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import lombok.RequiredArgsConstructor;
@ -15,7 +15,7 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class CustomMinUserDetailsService implements UserDetailsService {
private final IMinUserinfoRepository userRepository;
private final IMinUserRepository userRepository;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

@ -1,52 +0,0 @@
package com.xit.biz.ctgy.controller;
import com.xit.biz.ctgy.dto.MinCivBoard680Dto;
import com.xit.biz.ctgy.dto.struct.MinCivBoard680Mapstruct;
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
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.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "MinCivBoard680Controller", description = "게시글 관리")
@RestController
@RequestMapping("/api/v1/ctgy/board")
@Validated
@RequiredArgsConstructor
public class MinCivBoard680Controller {
private final IMinCivBoard680Service service;
private final MinCivBoard680Mapstruct mapstruct = Mappers.getMapper(MinCivBoard680Mapstruct.class);
// TODO :: 파라메터 정의 필요
@Operation(summary = "게시글 목록 조회" , description = "게시글 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "ciTitle", description = "제목", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "ciName", 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> findMinCivBoard680s(
@Parameter(hidden = true)
final MinCivBoard680Dto dto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findAll(mapstruct.toEntity(dto), pageable));
}
}

@ -1,68 +0,0 @@
package com.xit.biz.ctgy.controller;
import com.xit.biz.ctgy.dto.MinCivBoard680Dto;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.dto.struct.MinCivBoard680Mapstruct;
import com.xit.biz.ctgy.dto.struct.MinUserinfoMapstruct;
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
import com.xit.biz.ctgy.service.IMinUserinfoService;
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.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "MinUserinfoController", description = "사용자 관리")
@RestController
@RequestMapping("/api/v1/ctgy/user")
@Validated
@RequiredArgsConstructor
public class MinUserinfoController {
private final IMinUserinfoService service;
private final MinUserinfoMapstruct mapstruct = Mappers.getMapper(MinUserinfoMapstruct.class);
// TODO :: 파라메터 정의 필요
@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 = "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> findMinUserinfos(
@Parameter(hidden = true)
@ModelAttribute("minUserinfoDto")
final MinUserinfoDto minUserinfoDto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findMinUserinfos(mapstruct.toEntity(minUserinfoDto), pageable));
}
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
@GetMapping("/info")
@Secured(policy = SecurityPolicy.TOKEN)
@Transactional(readOnly = true)
public ResponseEntity<? extends IRestResponse> getUserInfo() {
return RestResponse.of(service.findMyUserWithoutAuthorities());
}
}

@ -2,7 +2,7 @@ package com.xit.biz.ctgy.controller;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.dto.struct.MinInfoBoard680Mapstruct;
import com.xit.biz.ctgy.service.IMinInfoBoard680Service;
import com.xit.biz.ctgy.service.IPublicBoardService;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import io.swagger.v3.oas.annotations.Operation;
@ -25,9 +25,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/v1/ctgy/pboard")
@Validated
@RequiredArgsConstructor
public class MinInfoBoard680Controller {
public class PublicBoardController {
private final IMinInfoBoard680Service service;
private final IPublicBoardService service;
private final MinInfoBoard680Mapstruct mapstruct = Mappers.getMapper(MinInfoBoard680Mapstruct.class);

@ -7,5 +7,5 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface IMinCivBoard680Repository extends JpaRepository<MinCivBoard680, Long> {
public interface IBoardRepository extends JpaRepository<MinCivBoard680, Long> {
}

@ -1,23 +0,0 @@
package com.xit.biz.ctgy.repository;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.core.oauth2.utils.SecurityUtil;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
public interface IMinUserinfoRepository extends JpaRepository<MinUserinfo, String> {
Optional<MinUserinfo> findByUserid(String userid);
@Query(value = "SELECT TRAFFIC.ECL_ENCRYPT(?1) AS passwd FROM DUAL C", nativeQuery = true)
//@Query(value = "SELECT ECL_ENCRYPT(?1) AS passwd", nativeQuery = true)
String queryGetPasswdEncode(@Param("passwd") String passwd);
@Query(value = "SELECT ECL_DECRYPT(MU.passwd) AS passwd FROM min_userinfo MU WHERE MU.userid = ?1", nativeQuery = true)
String queryGetPasswd(@Param("userid") String userid);
MinUserinfo findMinUserinfoByUserid(String userid);
}

@ -3,5 +3,5 @@ package com.xit.biz.ctgy.repository;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import org.springframework.data.jpa.repository.JpaRepository;
public interface IMinInfoBoard680Repository extends JpaRepository<MinInfoBoard680, Long> {
public interface IPublicBoardRepository extends JpaRepository<MinInfoBoard680, Long> {
}

@ -1,11 +0,0 @@
package com.xit.biz.ctgy.service;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.core.support.jpa.IJpaOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface IMinCivBoard680Service {
Page<MinCivBoard680> findAll(MinCivBoard680 minCivBoard680, Pageable pageable);
}

@ -1,15 +0,0 @@
package com.xit.biz.ctgy.service;
import com.xit.biz.cmm.entity.CmmUser;
import com.xit.biz.ctgy.entity.MinUserinfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.Optional;
public interface IMinUserinfoService {
Page<MinUserinfo> findMinUserinfos(MinUserinfo minUserinfo, Pageable pageable);
MinUserinfo findMyUserWithoutAuthorities();
}

@ -4,7 +4,7 @@ import com.xit.biz.ctgy.entity.MinInfoBoard680;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface IMinInfoBoard680Service {
public interface IPublicBoardService {
Page<MinInfoBoard680> findAll(MinInfoBoard680 entity, Pageable pageable);
}

@ -1,9 +1,8 @@
package com.xit.biz.ctgy.service.impl;
import com.xit.biz.cmm.entity.CmmUser;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.biz.ctgy.repository.IMinCivBoard680Repository;
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
import com.xit.biz.ctgy.repository.IBoardRepository;
import com.xit.biz.ctgy.service.IBoardService;
import com.xit.core.support.jpa.JpaUtil;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Example;
@ -17,9 +16,9 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc
@Service
@AllArgsConstructor
public class MinCivBoard680Service implements IMinCivBoard680Service {
public class BoardService implements IBoardService {
private final IMinCivBoard680Repository repository;
private final IBoardRepository repository;
@Transactional(readOnly = true)
public Page<MinCivBoard680> findAll(MinCivBoard680 entity, Pageable pageable) {

@ -1,50 +0,0 @@
package com.xit.biz.ctgy.service.impl;
import com.xit.biz.cmm.entity.CmmUser;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.repository.IMinUserinfoRepository;
import com.xit.biz.ctgy.service.IMinUserinfoService;
import com.xit.core.oauth2.utils.HeaderUtil;
import com.xit.core.oauth2.utils.SecurityUtil;
import com.xit.core.support.jpa.JpaUtil;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
@Service
public class MinUserinfoService implements IMinUserinfoService {
private final IMinUserinfoRepository repository;
public MinUserinfoService(IMinUserinfoRepository repository) {
this.repository = repository;
}
@Transactional//(readOnly = true)
public Page<MinUserinfo> findMinUserinfos(MinUserinfo minUserinfo, Pageable pageable) {
//Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
pageable = JpaUtil.getPagingInfo(pageable);
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
.withMatcher("userid", contains())
.withMatcher("name", contains());
Example<MinUserinfo> example = Example.of(minUserinfo, exampleMatcher);
Page<MinUserinfo> page = repository.findAll(example, pageable);
// List<CmmUser> userList = page.getContent();
return page;
}
@Override
@Transactional(readOnly = true)
public MinUserinfo findMyUserWithoutAuthorities() {
//cmmUserRepos
//return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId());
return repository.findMinUserinfoByUserid(HeaderUtil.getUserId());
}
}

@ -1,11 +1,8 @@
package com.xit.biz.ctgy.service.impl;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.repository.IMinCivBoard680Repository;
import com.xit.biz.ctgy.repository.IMinInfoBoard680Repository;
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
import com.xit.biz.ctgy.service.IMinInfoBoard680Service;
import com.xit.biz.ctgy.repository.IPublicBoardRepository;
import com.xit.biz.ctgy.service.IPublicBoardService;
import com.xit.core.support.jpa.JpaUtil;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Example;
@ -19,9 +16,9 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc
@Service
@AllArgsConstructor
public class MinInfoBoard680Service implements IMinInfoBoard680Service {
public class PublicBoardService implements IPublicBoardService {
private final IMinInfoBoard680Repository repository;
private final IPublicBoardRepository repository;
@Transactional(readOnly = true)
public Page<MinInfoBoard680> findAll(MinInfoBoard680 entity, Pageable pageable) {

@ -3,7 +3,7 @@ package com.xit.core.config;
import com.xit.biz.ctgy.auth.MinPasswordEncoder;
import com.xit.biz.ctgy.auth.service.impl.CustomMinOAuth2UserService;
import com.xit.biz.ctgy.auth.service.impl.CustomMinUserDetailsService;
import com.xit.biz.ctgy.repository.IMinUserinfoRepository;
import com.xit.biz.ctgy.repository.IMinUserRepository;
import com.xit.core.oauth2.api.repository.RefreshTokenRepository;
import com.xit.core.oauth2.config.properties.AppProperties;
import com.xit.core.oauth2.config.properties.CorsProperties;
@ -26,7 +26,6 @@ import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsUtils;
@ -107,7 +106,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final TokenAccessDeniedHandler tokenAccessDeniedHandler;
private final RefreshTokenRepository refreshTokenRepository;
private final IMinUserinfoRepository minUserinfoRepository;
private final IMinUserRepository minUserRepository;
/**
* 1. configure( WebSecurity) :
@ -243,7 +242,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
* */
@Bean
public MinPasswordEncoder passwordEncoder() {
return new MinPasswordEncoder(minUserinfoRepository);
return new MinPasswordEncoder(minUserRepository);
}
/*

Loading…
Cancel
Save