feat: mpower 반영 완료

dev
minuk926 2 years ago
parent 48a4721073
commit ce45d9ddd7

@ -102,11 +102,11 @@ public class AuthMinService implements IAuthMinService {
infoMap.put(XitConstants.JwtToken.TOKEN_USER_NAME.getCode(), user.getName());
infoMap.put(XitConstants.JwtToken.TOKEN_USER_MAIL.getCode(), user.getEmail());
RefreshToken savedRefreshToken = refreshTokenDao.findByKey(authentication.getName())
.orElse(null);
RefreshToken savedRefreshToken = refreshTokenDao.findByKey(authentication.getName());
// 저장된 refresh token not exists
if (Checks.isNull(savedRefreshToken) || Checks.isNull(savedRefreshToken.getValue()) || "".equals(savedRefreshToken.getValue().trim())) {
//if (Checks.isNull(savedRefreshToken) || Checks.isNull(savedRefreshToken.getValue()) || "".equals(savedRefreshToken.getValue().trim())) {
if (Checks.isEmpty(savedRefreshToken)) {
// 없는 경우 새로 등록
tokenDto = jwtTokenProvider.generateTokenDto(authentication, infoMap);
refreshTokenDao.save(
@ -119,10 +119,12 @@ public class AuthMinService implements IAuthMinService {
// 저장된 토큰이 있다
} else {
//Checks.isNull(savedRefreshToken.getValue()) || "".equals(savedRefreshToken.getValue().trim()
// 만료되지 않은 refresh token
if(!jwtTokenProvider.isExpiredToken(savedRefreshToken.getValue())) {
if(Checks.isNotEmpty(savedRefreshToken.getValue()) && !jwtTokenProvider.isExpiredToken(savedRefreshToken.getValue())) {
// refresh token 잔여기간 기준 도달여부 check
// 잔여기간에 도달된 경우 갱신
Date now = new Date();
long validTime = jwtTokenProvider.parseClaims(savedRefreshToken.getValue()).getExpiration().getTime() - now.getTime();
@ -137,15 +139,8 @@ public class AuthMinService implements IAuthMinService {
tokenDto = TokenDto.builder()
.grantType(XitConstants.JwtToken.GRANT_TYPE.getCode())
.accessToken(jwtTokenProvider.generateJwtAccessToken(authentication, infoMap))
.refreshToken("") //savedRefreshToken.getValue())
.refreshToken(savedRefreshToken.getValue())
.build();
refreshTokenDao.update(
RefreshToken.builder()
.key(loginRequestDto.getUserid())
.value(tokenDto.getRefreshToken())
.build()
);
}
// refresh token 만료
@ -253,8 +248,7 @@ public class AuthMinService implements IAuthMinService {
jwtTokenProvider.validateTokenExcludeExpired(sRefreshToken, true, true);
// userId refresh token 으로 DB 확인
RefreshToken savedRefreshToken = refreshTokenDao.findByKey(authentication.getName())
.orElse(null);
RefreshToken savedRefreshToken = refreshTokenDao.findByKey(authentication.getName());
if (Checks.isEmpty(savedRefreshToken)) throw new TokenAuthException(ErrorCode.NOT_EXISTS_SAVED_REFRESH_TOKEN);
if (!Objects.equals(Objects.requireNonNull(savedRefreshToken).getValue(), sRefreshToken)) {

@ -7,6 +7,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
@Schema(name = "MinUserinfoDto", description = "사용자 DTO")
@ -68,4 +70,11 @@ public class MinUserinfoDto implements Serializable {
public int hashCode() {
return Objects.hash(userid);
}
public void setSaveInit(){
LocalDateTime localDateTime = LocalDateTime.now();
this.regdate = LocalDate.parse(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
this.isenable = "1";
this.gu = "680";
}
}

@ -46,8 +46,7 @@ public class MinUserController {
final MinUserinfoDto minUserinfoDto,
@Parameter(hidden = true)
final Pageable pageable) {
return null;
//return RestResponse.of(service.findMinUsers(mapstruct.toEntity(minUserinfoDto), pageable));
return RestResponse.of(service.findMinUsers(minUserinfoDto, pageable));
}
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")

@ -23,6 +23,6 @@ public class CmmCodeDao extends BaseMpowerDaoSupport {
.setParameter("codeMcd", codeMcd)
.getQueryString();
return selectList(ComboCodeDto.class, sql, "code, value");
return selectComboCodeList(sql);
}
}

@ -96,11 +96,12 @@ public class ParkingDao extends BaseMpowerDaoSupport {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudegStdCount")
.setParameter("msMaincode", msMaincode)
.getQueryString();
return Integer.parseInt(selectOneColumn(sql));
String cnt = selectOneColumn(sql);
return cnt == null? 0: Integer.parseInt(cnt);
}
public void updateMsResult(@NotNull final Long msMaincode, @NotNull final String msSeq, @NotNull final String msResult) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudegStdCount")
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateJudegResult")
.setParameter("msMaincode", msMaincode)
.setParameter("msSeq", msSeq)
.setParameter("msResult", msResult)
@ -115,13 +116,13 @@ public class ParkingDao extends BaseMpowerDaoSupport {
.setParameter("rcSeq2", dto.getRcSeq2())
.setParameter("rcIrTransfer", dto.getRcIrTransfer())
.getQueryString();
final String fieldStrs = "mmCode, rcCode, rcSeq, mmOcarno, mmNcarno, rcName, rcContDoc, rcIngb, rcDate, scContDocNm, scIngbNm";
final String fieldStrs = "mmCode, rcCode, rcSeq, mmOcarno, mmNcarno, rcName, rcContDoc, rcIngb, rcDate, rcContDocNm, rcIngbNm";
return selectList(ParkingTargetDto.class, sql, fieldStrs);
}
public int insertJudgeTargetIntoSelect(@NotNull final ParkingTargetDto dto) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "insertJudgeTargetIntoSelect")
.setParameter("scCode", dto.getRcCode())
.setParameter("rcCode", dto.getRcCode())
.setParameter("msYear", dto.getMsYear())
.setParameter("msChasu", dto.getMsChasu())
.setParameter("msSdate", dto.getMsSdate())
@ -148,8 +149,8 @@ public class ParkingDao extends BaseMpowerDaoSupport {
public void saveJudgeUsers(@NotNull final List<MinSimsaUser680> list) {
for(MinSimsaUser680 vo : list) {
insert(
QueryGenerator.createNamedQuery(NAME_SPACE, "updateTransfer")
.setParameter("msuCode", vo.getMsuCode())
QueryGenerator.createNamedQuery(NAME_SPACE, "insertJudgeUser")
.setParameter("msuMaincode", vo.getMsuMaincode())
.setParameter("msuResult", vo.getMsuResult())
.setParameter("msuTeam", vo.getMsuTeam())
.setParameter("msuUserid", vo.getMsuUserid())

@ -1,7 +1,5 @@
package com.xit.biz.ctgy.v2.repository;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Projections;
import com.xit.biz.ctgy.dto.DashboardJudgeListDto;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
@ -19,10 +17,6 @@ import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc;
import static com.xit.biz.ctgy.entity.QMinSimsa680Sc.minSimsa680Sc;
import static com.xit.biz.ctgy.entity.QMinSimsaUser680Sc.minSimsaUser680Sc;
@Repository
public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
private static final String NAME_SPACE = "residentAndDisabled";
@ -48,7 +42,7 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
.setParameter("scCode", scCode)
.getQueryString();
final String fieldStrs = "scCode, scSeq, scCarnum, scDong, scName, scContDoc, scIngb, scDatagb, scCdate, scState, " +
"scWdate, scJbtime, scPos, scTransfer, scAnswer, scZipcode1, scZipcode2, scJuso, scBunji, " +
"scWdate, scJbtime, scPos, scTransfer, scAnswer, zipcode1, zipcode2, scJuso, scBunji, " +
"scFrecad1, scFrecad2, scFrecad3, scFrecad4, scPicad1, scPicad2, scPicad3, scPicad4, " +
"scContad1, scContad2, scContad3, scContad4, scContad5, scContad6, scContad7, scContad8, " +
"scContDocNm, scIngbNm, scTransferNm, scStateNm";
@ -76,17 +70,19 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
public Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable) {
final String cntSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeListCnt")
.setParameter("msDatagb", dto.getMsDatagb())
.setParameter("msYear", dto.getMsYear())
.setParameter("msChasu", dto.getMsChasu())
.getQueryString();
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeList")
.setParameter("msDatagb", dto.getMsDatagb())
.setParameter("msYear", dto.getMsYear())
.setParameter("msChasu", dto.getMsChasu())
.setParameter("page", pageable.getPageNumber())
.setParameter("size", pageable.getPageSize())
.getQueryString();
final String fieldStrs = "msYear, msChasu, msSdate, msStartsi, msEdate, msCdate, msClosesi, cnt";
final String fieldStrs = "msYear, msChasu, msSdate, msStartsi, msEdate, msCdate, msClosesi, msDatagb, cnt";
return selectList(JudgeListDto.class, listSql, cntSql, fieldStrs, pageable);
}
@ -105,7 +101,7 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
}
public List<Map<String, Object>> selectJudgeResultGroupByCarnum(@NotNull final JudgeListDto dto) {
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectParkingJurgeResultGroupByCarnum")
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJurgeResultGroupByCarnum")
.setParameter("msuTeam", dto.getMsuTeam())
.setParameter("msDatagb", dto.getMsDatagb())
.setParameter("msChasu", dto.getMsChasu())
@ -117,8 +113,8 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
return selectMapList(listSql, fieldsStrs);
}
public List<Map<String, Object>> selectTotJudgeResultGroupByUser(@NotNull final JudgeListDto dto) {
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectTotParkingJudgeResultGroupByUser")
public List<Map<String, Object>> findTotJudgeResultGroupByUser(@NotNull final JudgeListDto dto) {
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectTotJudgeResultGroupByUser")
.setParameter("msuTeam", dto.getMsuTeam())
.setParameter("msDatagb", dto.getMsDatagb())
.setParameter("msChasu", dto.getMsChasu())
@ -130,8 +126,8 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
return selectMapList(listSql, fieldStrs);
}
public List<Map<String, Object>> selectJudgeResultList(@NotNull final Map<String, Object> paramMap) {
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectParkingJudgeResultList")
public List<Map<String, Object>> findJudgeResultList(@NotNull final Map<String, Object> paramMap) {
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeResultList")
.setParameter("msDatagb", (String)paramMap.get("msDatagb"))
.setParameter("msuTeam", (String)paramMap.get("msuTeam"))
.setParameter("msChasu", (Long)paramMap.get("msChasu"))
@ -150,11 +146,12 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudegStdCount")
.setParameter("msMaincode", msMaincode)
.getQueryString();
return Integer.parseInt(selectOneColumn(sql));
String cnt = selectOneColumn(sql);
return cnt == null? 0: Integer.parseInt(cnt);
}
public void updateMsResult(@NotNull final Long msMaincode, @NotNull final String msSeq, @NotNull final String msResult) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudegStdCount")
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateJudegResult")
.setParameter("msMaincode", msMaincode)
.setParameter("msSeq", msSeq)
.setParameter("msResult", msResult)
@ -170,7 +167,7 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
.setParameter("scSeq2", dto.getScSeq2())
.setParameter("scTransfer", dto.getScTransfer())
.getQueryString();
final String fieldStrs = "scCode, scSeq, scCarno, scName, scContDoc, scIngb, scCdate, scContDocNm, scIngbNm";
final String fieldStrs = "scCode, scSeq, scCarnum, scName, scContDoc, scIngb, scCdate, scContDocNm, scIngbNm";
return selectList(JudgeTargetDto.class, sql, fieldStrs);
}
@ -203,8 +200,8 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
public void saveJudgeUsers(@NotNull final List<MinSimsaUser680Sc> list) {
for(MinSimsaUser680Sc vo : list) {
insert(
QueryGenerator.createNamedQuery(NAME_SPACE, "updateTransfer")
.setParameter("msuCode", vo.getMsuCode())
QueryGenerator.createNamedQuery(NAME_SPACE, "insertJudgeUser")
.setParameter("msuMaincode", vo.getMsuMaincode())
.setParameter("msuResult", vo.getMsuResult())
.setParameter("msuTeam", vo.getMsuTeam())
.setParameter("msuUserid", vo.getMsuUserid())
@ -250,7 +247,7 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
return QueryGenerator.createNamedQuery(NAME_SPACE, sqlId)
.setParameter("curYear", curYear)
.setParameter("scCode", dto.getScCode())
.setParameter("scCarNum", dto.getScCarnum())
.setParameter("scCarnum", dto.getScCarnum())
.setParameter("scDong", dto.getScDong())
.setParameter("scName", dto.getScName())
.setParameter("scContDoc", dto.getScContDoc())
@ -260,8 +257,8 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
.setParameter("scWdate", dto.getScWdate())
.setParameter("scJbtime", dto.getScJbtime())
.setParameter("scPos", dto.getScPos())
.setParameter("scZipcode1", dto.getZipcode1())
.setParameter("scZipcode2", dto.getZipcode2())
.setParameter("zipcode1", dto.getZipcode1())
.setParameter("zipcode2", dto.getZipcode2())
.setParameter("scJuso", dto.getScJuso())
.setParameter("scBunji", dto.getScBunji())
.setParameter("scFrecad1", dto.getScFrecad1())
@ -286,11 +283,15 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
public List<DashboardJudgeListDto> findDashboardJudgeList(@NotNull final String msDatagb) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectDashboardJudgeList")
.setParameter("msDatagb", msDatagb)
.getQueryString();
final String fieldStrs = "msEdate, msuTeam, name, jcnt, tcnt";
return selectList(DashboardJudgeListDto.class, sql, fieldStrs);
}
public List<JudgeListDto> findByUserJudges(@NotNull final JudgeListDto dto) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectByUserJudgeList")
.setParameter("msDatagb", dto.getMsDatagb())

@ -1,11 +1,14 @@
package com.xit.biz.ctgy.v2.repository;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinSimsaUser680Sc;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.core.config.database.BaseMpowerDaoSupport;
import com.xit.core.support.sql.parser.QueryGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
@ -59,4 +62,61 @@ public class UserDao extends BaseMpowerDaoSupport {
}
public Page<MinUserinfoDto> findMinUserList(@NotNull final MinUserinfoDto dto, @NotNull final Pageable pageable) {
final String cntSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectMinUserinfoListCnt")
.setParameter("userid", dto.getUserid())
.setParameter("name", dto.getName())
.setParameter("team", dto.getTeam())
.getQueryString();
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectMinUserinfoList")
.setParameter("userid", dto.getUserid())
.setParameter("name", dto.getName())
.setParameter("team", dto.getTeam())
.setParameter("page", pageable.getPageNumber())
.setParameter("size", pageable.getPageSize())
.getQueryString();
final String fieldStrs = "userid, accesstype, email, gu, isenable, mphone, name, passwd, regdate, regnum, team";
return selectList(MinUserinfoDto.class, listSql, cntSql, fieldStrs, pageable);
}
public void insertMinUserinfo(@NotNull final MinUserinfoDto dto) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "insertMinUserinfo")
.setParameter("userid", dto.getUserid())
.setParameter("accesstype", dto.getAccesstype())
.setParameter("email", dto.getEmail())
.setParameter("isenable", dto.getIsenable())
.setParameter("mphone", dto.getMphone())
.setParameter("name", dto.getName())
.setParameter("passwd", dto.getPasswd())
.setParameter("regdate", dto.getRegdate())
.setParameter("team", dto.getTeam())
.setParameter("gu", dto.getGu())
.getQueryString();
insert(sql);
}
public void updateMinUserinfo(MinUserinfoDto dto) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateMinUserinfo")
.setParameter("userid", dto.getUserid())
.setParameter("accesstype", dto.getAccesstype())
.setParameter("email", dto.getEmail())
.setParameter("mphone", dto.getMphone())
.setParameter("name", dto.getName())
.setParameter("passwd", dto.getPasswd())
.setParameter("team", dto.getTeam())
.getQueryString();
update(sql);
}
public void removeMinUserinfo(@NotNull final MinUserinfoDto dto) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateMinUserinfoIsenable")
.setParameter("userid", dto.getUserid())
.setParameter("isenable", dto.getIsenable())
.getQueryString();
update(sql);
}
}

@ -7,7 +7,7 @@ import org.springframework.data.domain.Pageable;
public interface IMinUserService {
Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable);
Page<MinUserinfoDto> findMinUsers(final MinUserinfoDto dto, Pageable pageable);
MinUserinfoDto findMinUser();

@ -7,6 +7,7 @@ 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 com.xit.core.util.Checks;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.*;
import org.springframework.security.crypto.password.PasswordEncoder;
@ -22,49 +23,46 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc
public class MinUserService implements IMinUserService {
private final PasswordEncoder passwordEncoder;
private final UserDao minUserinfoDao;
private final UserDao userDao;
@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;
@Transactional(readOnly = true)
public Page<MinUserinfoDto> findMinUsers(final MinUserinfoDto dto, Pageable pageable) {
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize());
return userDao.findMinUserList(dto, pageable);
}
@Override
@Transactional(readOnly = true)
public MinUserinfoDto findMinUser() {
//cmmUserRepos
//return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId());
return minUserinfoDao.findByUserid(HeaderUtil.getUserId()).orElse(null);
return userDao.findByUserid(HeaderUtil.getUserId()).orElse(null);
}
@Override
@Transactional(readOnly = true)
public MinUserinfoDto findMinUserByUserid(final String userid) {
return minUserinfoDao.findByUserid(userid).orElse(null);
return userDao.findByUserid(userid).orElse(null);
}
@Override
@Transactional
public void saveMinUser(MinUserinfoDto dto) {
if("Y".equals(dto.getNewYn()) && minUserinfoDao.findByUserid(dto.getUserid()).isPresent()) throw new CustomBaseException(ErrorCode.MEMBER_EXISTS);
Optional<MinUserinfoDto> opUser = userDao.findByUserid(dto.getUserid());
dto.setPasswd(passwordEncoder.encode(dto.getPasswd()));
// minUserinfoDao.save(dto);
if("Y".equals(dto.getNewYn())){
if(opUser.isPresent() && !Checks.isEmpty(opUser.get().getUserid())) throw new CustomBaseException(ErrorCode.MEMBER_EXISTS);
dto.setSaveInit();
userDao.insertMinUserinfo(dto);
}else{
// 비밀번호가 다른 경우
//if(!savedDto.get().getPasswd().equals(encPasswd)) dto.setPasswd(encPasswd);
userDao.updateMinUserinfo(dto);
}
}
@Override
@Transactional
public void removeMinUser(MinUserinfoDto dto) {
MinUserinfoDto savedDto = minUserinfoDao.findByUserid(dto.getUserid()).orElseThrow(()-> new CustomBaseException(ErrorCode.USER_NOT_FOUND));
savedDto.setIsenable("0");
// minUserinfoDao.save(savedDto);
dto.setIsenable("0");
userDao.removeMinUserinfo(dto);
}
}

@ -190,7 +190,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
// 차수별 심사자별 심사결과 합산
dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam")));
List<Map<String, Object>> totJudgeUserList = residentAndDisabledDao.selectTotJudgeResultGroupByUser(dto);
List<Map<String, Object>> totJudgeUserList = residentAndDisabledDao.findTotJudgeResultGroupByUser(dto);
totJudgeUserList.add(teamList.get(0));
// 심사대상 차량 목록
@ -206,7 +206,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
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 = residentAndDisabledDao.selectJudgeResultList(paramMap);
List<Map<String,Object>> jurgeUserList = residentAndDisabledDao.findJudgeResultList(paramMap);
// List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
// paramMap.put("msSeq", m.get("msSeq"));

@ -1,10 +1,9 @@
package com.xit.core.config.database;
import com.plf.client.Client;
import com.xit.biz.cmm.dto.ComboCodeDto;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.exception.MpowerException;
import com.xit.core.util.DBUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@ -36,9 +35,10 @@ public abstract class BaseMpowerDaoSupport {
Objects.requireNonNull(sql, "SQL cannot be null");
T instance = null;
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
client.Request();
String result = client.getString("result", 0, 0);
@ -47,10 +47,15 @@ public abstract class BaseMpowerDaoSupport {
if (result.equals("true")){
row = client.getMaxRow("list1");
if(row > 1) throw new MpowerException("조회된 데이타가 단일행이 아닙니다");
if(row == 0) return null;
instance = getT(type, getFeilds(fields), 0, client);
}else{
throw new MpowerException("SQL 오류::"+result);
}
return instance;
}catch (MpowerException e){
throw e;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
@ -66,9 +71,10 @@ public abstract class BaseMpowerDaoSupport {
public String selectOneColumn(String sql){
Objects.requireNonNull(sql, "SQL cannot be null");
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
client.Request();
String result = client.getString("result", 0, 0);
@ -77,13 +83,17 @@ public abstract class BaseMpowerDaoSupport {
if (result.equals("true")){
row = client.getMaxRow("list1");
if(row > 1) throw new MpowerException("조회된 데이타가 단일행이 아닙니다");
if(row == 0) return null;
String value = client.getString("list1", 0, 0);
if(" ".equals(value)) value = "";
return value;
}else{
throw new MpowerException("SQL 오류::"+result);
}
return null;
}catch (MpowerException e){
throw e;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
@ -95,9 +105,10 @@ public abstract class BaseMpowerDaoSupport {
Objects.requireNonNull(sql, "SQL cannot be null");
List<Long> list = new ArrayList<>();
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
client.Request();
String result = client.getString("result", 0, 0);
@ -113,9 +124,13 @@ public abstract class BaseMpowerDaoSupport {
list.add(Long.valueOf(client.getString("list1", i, 0)));
}
}
}else{
throw new MpowerException("SQL 오류::"+result);
}
return list;
}catch (MpowerException e){
throw e;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
@ -128,9 +143,10 @@ public abstract class BaseMpowerDaoSupport {
Objects.requireNonNull(sql, "SQL cannot be null");
List<T> list = new ArrayList<>();
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
client.Request();
String result = client.getString("result", 0, 0);
@ -148,6 +164,8 @@ public abstract class BaseMpowerDaoSupport {
}
}
}
}else{
throw new MpowerException("SQL 오류::"+result);
}
return list;
@ -166,14 +184,17 @@ public abstract class BaseMpowerDaoSupport {
Objects.requireNonNull(listSql, "SQL cannot be null");
long totalCnt = 0L;
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", cntQuery));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", cntQuery));
client.Request();
totalCnt = Long.parseLong(client.getString("list1", 0, 0));
if(totalCnt <= 0) return new PageImpl<>(new ArrayList<>(), pageable, 0);
}catch (MpowerException e){
throw e;
}catch (Exception e){
log.error(e.getLocalizedMessage());
throw new MpowerException(ErrorCode.MPOWER_ERROR);
@ -200,9 +221,10 @@ public abstract class BaseMpowerDaoSupport {
Objects.requireNonNull(sql, "SQL cannot be null");
Map<String,Object> map = null;
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
client.Request();
String result = client.getString("result", 0, 0);
@ -216,9 +238,13 @@ public abstract class BaseMpowerDaoSupport {
for (int j = 0; j < fields.size(); j++) {
map.put(fields.get(j), client.getString("list1", 0, j));
}
}else{
throw new MpowerException("SQL 오류::"+result);
}
return map;
}catch (MpowerException e){
throw e;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
@ -230,9 +256,10 @@ public abstract class BaseMpowerDaoSupport {
Objects.requireNonNull(sql, "SQL cannot be null");
List<Map<String,Object>> list = new ArrayList<>();
Client client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
client.Request();
String result = client.getString("result", 0, 0);
@ -249,9 +276,13 @@ public abstract class BaseMpowerDaoSupport {
}
list.add(map);
}
}else{
throw new MpowerException("SQL 오류::"+result);
}
return list;
}catch (MpowerException e){
throw e;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
@ -259,6 +290,45 @@ public abstract class BaseMpowerDaoSupport {
}
}
/**
* GET
* code
*/
public List<ComboCodeDto> selectComboCodeList(String sql){
Objects.requireNonNull(sql, "SQL cannot be null");
List<ComboCodeDto> list = new ArrayList<>();
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml("select", sql));
client.Request();
String result = client.getString("result", 0, 0);
int row;
if (result.equals("true")){
row = client.getMaxRow("list1");
if(row>0) {
for (int i = 0; i < row; i++) {
list.add(new ComboCodeDto(client.getString("list1", i, 0), client.getString("list1", i, 1)));
}
}
}else{
throw new MpowerException("SQL 오류::"+result);
}
return list;
}catch (MpowerException e){
throw e;
} catch (Exception e) {
log.error(e.getLocalizedMessage());
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
disConnection(client);
}
}
private String getQueryXml(String syntax, String sql){
log.info(sql);
return String.format(
@ -294,17 +364,23 @@ public abstract class BaseMpowerDaoSupport {
private int dmlQuery(String sql, String syntax) {
Objects.requireNonNull(sql, "SQL cannot be null");
Client client = getConnection();
client.setInput("SQLXML", getQueryXml(syntax, sql));
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getQueryXml(syntax, sql));
client.Request();
String result = client.getString("result", 0, 0);
if (result.equals("true")){
System.out.println("<<<<<<<<<<<<===========#$#$#$$##$#$$#$#$$$$$$$====>>>>>>>>>");
}else{
throw new MpowerException("SQL 오류::"+result);
}
return 1;
}catch (MpowerException e){
throw e;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
@ -371,3 +447,53 @@ public abstract class BaseMpowerDaoSupport {
return list;
}
}
/*
//첨부파일 터널링 서버로 복사
public void fnFileUpload(String tmpFileLocation,String realRcRilenm){
String fph = tunullingFile; //터널링에 복사되는 파일경로
try{
Client mp = new Client("127.0.0.1", 2500);
mp.getConnection("XitFile.XitUpload");
mp.setInput("dir",tunullingFile);
mp.setInput("upfile1",tmpFileLocation+realRcRilenm,true);
mp.Request();
}catch(Exception e){
e.printStackTrace();
}
//logger.debug(fph);
}
//터널링에서 웹서버로 첨부파일 복사
public static void fnDownFile(String fileName,String sessionId){
String serviceName = "XitFile.XitDownload";
String fph = MpowerUtil.class.getResource("").getPath();
fph = fph.replace("WEB-INF/classes/xit/cmmn/utill/", "vioPhoto/"+sessionId+"/"); //웹서버 저장 위치
String fphs = fph.substring(0,1);
if(fphs.equals("/")){
fph = fph.substring(1);
}
String tmpTunullingFile = tunullingFile; //터널링에 저장된 단속사진 경로
try{
Client mp = new Client("127.0.0.1", 2500);
mp.getConnection("XitFile.XitDownload");
mp.setInput("dnfile1",tmpTunullingFile+ fileName); //터널링에 실질 존재하는 경로,파일명
mp.Request();
String result = mp.getString("result", 0, 0);
if (result.equals("true")){
mp.getFileName("imageA");
mp.savefile("imageA", fph);
}
}catch(Exception e){
e.printStackTrace();
}
//logger.debug("웹서버 저장되는 첨부파일 위치:"+fph);
System.out.println("웹서버 저장되는 첨부파일 위치:"+fph);
}
*/

@ -9,11 +9,11 @@ import java.util.Optional;
@Repository
public class RefreshTokenDao extends BaseMpowerDaoSupport {
public Optional<RefreshToken> findByKey(String key){
public RefreshToken findByKey(String key){
String sql = QueryGenerator.createNamedQuery("refreshToken", "selectRefreshToken")
.setParameter("key", key)
.getQueryString();
return Optional.ofNullable(selectOne(RefreshToken.class, sql, "key, value"));
return selectOne(RefreshToken.class, sql, "key, value");
}
public void save(RefreshToken refreshToken){

@ -83,7 +83,7 @@ public class OAuth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS
// DB 저장
//RefreshToken savedRefreshToken = refreshTokenRepository.findByKey(userInfo.getId()).orElse(null);
RefreshToken savedRefreshToken = refreshTokenDao.findByKey(userInfo.getId()).orElse(null);
RefreshToken savedRefreshToken = refreshTokenDao.findByKey(userInfo.getId());
if (savedRefreshToken != null) {
//userRefreshToken(refreshToken);
savedRefreshToken.setValue(refreshToken);

@ -79,6 +79,7 @@
FROM min_simsa680_sc MSS
, msu680_sc_view MSV
WHERE MSS.ms_maincode = MSV.msu_maincode
AND MSS.ms_datagb = #{msDatagb}
<if test='msuTeam != null and msuTeam != ""'>
AND MSV.msu_team = #{msuTeam}
</if>

@ -2,8 +2,8 @@
<entity-mappings namespace="cmmCode">
<native-query id="selectComboCodes">
/* refreshToken-mapper|selectComboCodes|julim */
SELECT code_cd as code,
/* cmmCode-mapper|selectComboCodes|julim */
SELECT code_cd as code
, code_nm as value
FROM tb_cmm_code_s
WHERE code_grp_id = #{codeGrpId}

@ -30,6 +30,123 @@
WHERE userid = #{userid}
</native-query>
<native-query id="selectAllByTeamAndIsenableAndAccesstype">
/* minuserinfo-mapper|selectAllByTeamAndIsenableAndAccesstype|julim */
SELECT userid
, accesstype
, email
, gu
, isenable
, mphone
, passwd
, regdate
, regnum
, team
FROM min_userinfo
WHERE team = #{team}
AND isenable = #{isenable}
AND accesstype = #{accesstype}
</native-query>
<native-query id="selectMinUserinfoList">
/* minuserinfo-mapper|selectMinUserinfoList|julim */
SELECT userid
, accesstype
, email
, gu
, isenable
, mphone
, name
, passwd
, regdate
, regnum
, team
FROM (
SELECT R.*, ROWNUM rn
FROM (
SELECT *
FROM min_userinfo
<where>
<if test="userid != null and userid != ''">
AND userid LIKE #{userid}||'%'
</if>
<if test="name != null and name != ''">
AND name LIKE #{name}||'%'
</if>
<if test="team != null and team != ''">
AND team = #{team}
</if>
</where>
ORDER BY team, name
) R
WHERE ROWNUM &lt;= (#{page} + 1) * #{size}
)
WHERE rn &gt; #{page} * #{size}
AND ROWNUM &lt;= #{size}
</native-query>
<native-query id="selectMinUserinfoListCnt">
/* minuserinfo-mapper|selectMinUserinfoListCnt|julim */
SELECT count(userid) as totalCount
FROM min_userinfo
<where>
<if test="userid != null and userid != ''">
AND userid LIKE #{userid}||'%'
</if>
<if test="name != null and name != ''">
AND name LIKE #{name}||'%'
</if>
<if test="team != null and team != ''">
AND team = #{team}
</if>
</where>
</native-query>
<native-query id="insertMinUserinfo">
/* minuserinfo-mapper|insertMinUserinfo|julim */
INSERT
INTO min_userinfo (
userid
, accesstype
, email
, gu
, isenable
, mphone
, name
, passwd
, regdate
, team
) VALUES (
#{userid}
, #{accesstype}
, #{email}
, #{gu}
, #{isenable}
, #{mphone}
, #{name}
, #{passwd}
, #{regdate}
, #{team}
)
</native-query>
<native-query id="updateMinUserinfo">
/* minuserinfo-mapper|updateMinUserinfo|julim */
UPDATE min_userinfo
SET passwd = #{passwd}
, accesstype = #{accesstype}
, team = #{team}
, name = #{name}
, mphone = #{mphone}
, email = #{email}
WHERE userid= #{userid}
</native-query>
<native-query id="updateMinUserinfoIsenable">
/* minuserinfo-mapper|updateMinUserinfoIsenable|julim */
UPDATE min_userinfo
SET isenable = #{isenable}
WHERE userid= #{userid}
</native-query>
</entity-mappings>

@ -145,8 +145,8 @@
msu_team,
msu_userid
) VALUES (
#{msuMaincode},
min_simsa_user680_seq.NEXTVAL,
#{msuCode},
#{msuResult},
#{msuTeam},
#{msuUserid}
@ -155,7 +155,7 @@
<native-query id="selectTotParkingJudgeResultGroupByTeamAndChasu">
/* parking-mapper|selectTotParkingJudgeResultGroupByTeamAndChasu|julim */
SELECT MS.msu_team AS msuTeam
SELECT MV.msu_team AS msuTeam
, NVL(SUM(DECODE(MS.ms_result, '2', 1, 0)), 0) bu
, 0 as seo
, NVL(SUM(DECODE(MS.ms_result, '1', 1, 0)), 0) mibu
@ -171,6 +171,7 @@
AND MS.ms_sdate = #{msSdate}
AND MS.ms_edate = #{msEdate}
GROUP BY MV.msu_team, MS.ms_chasu
ORDER BY MV.msu_team
</native-query>
<native-query id="selectParkingJudgeTeamGroupByChasuAndTeamList">
@ -273,7 +274,7 @@
/* parking-mapper|selectJudegStdCount|julim */
SELECT count(msu_code)
FROM min_simsa_user680
WHERE ms_maincode = #{msuMaincode}
WHERE msu_maincode = #{msMaincode}
AND msu_result= '2'
</native-query>

@ -15,7 +15,7 @@
INTO refresh_token (
key,
value
) VALUE (
) VALUES (
#{key},
#{value}
)

@ -28,12 +28,12 @@
AND code_mcd = 'RC_INGB') as scIngbNm,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRS.GRS.sc_state = code_cd
WHERE GRS.sc_state = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'SC_STATE') as scStateNm
FROM gn_recall_sc GRS
WHERE GRS.GRS.sc_code in (
WHERE GRS.sc_code in (
SELECT sc_code
FROM (
SELECT R.sc_code, ROWNUM rn
@ -75,8 +75,8 @@
GRS.sc_pos,
GRS.sc_transfer,
GRS.sc_answer,
GRS.sc_zipcode1,
GRS.sc_zipcode2,
GRS.zipcode1,
GRS.zipcode2,
GRS.sc_juso,
GRS.sc_bunji,
GRS.sc_frecad1,
@ -218,8 +218,8 @@
, sc_wdate = #{scWdate}
, sc_jbtime = #{scJbtime}
, sc_pos = #{scPos}
, sc_zipcode1 = #{scZipcode1}
, sc_zipcode2 = #{scZipcode2}
, zipcode1 = #{zipcode1}
, zipcode2 = #{zipcode2}
, sc_juso = #{scJuso}
, sc_bunji = #{scBunji}
, sc_frecad1 = NVL(#{scFrecad1}, sc_frecad1)
@ -391,8 +391,8 @@
msu_team,
msu_userid
) VALUES (
#{msuMaincode},
min_simsa_user680_sc_seq.NEXTVAL,
#{msuCode}
#{msuResult},
#{msuTeam},
#{msuUserid}
@ -401,14 +401,14 @@
<native-query id="selectTotJudgeResultGroupByTeamAndChasu">
/* residentAndDisabled-mapper|selectTotJudgeResultGroupByTeamAndChasu|julim */
SELECT MS.msu_team AS msuTeam
SELECT MV.msu_team AS msuTeam
, NVL(SUM(DECODE(MS.ms_result, '2', 1, 0)), 0) bu
, 0 as seo
, NVL(SUM(DECODE(MS.ms_result, '1', 1, 0)), 0) mibu
, NVL(SUM(DECODE(MS.ms_result, '1', 1, '2', 1, 0)), 0) tot
, '결과' as name
FROM min_simsa680_sc MS
, msu680_view MV
, msu680_sc_view MV
WHERE MS.ms_maincode = MV.msu_maincode
<if test="msuTeam != null and msuTeam != ''">
AND MV.msu_team = #{msuTeam}
@ -418,6 +418,7 @@
AND MS.ms_sdate = #{msSdate}
AND MS.ms_edate = #{msEdate}
GROUP BY MV.msu_team, MS.ms_chasu
ORDER BY MV.msu_team
</native-query>
<native-query id="selectJudgeTeamGroupByChasuAndTeamList">
@ -429,7 +430,7 @@
, NVL(SUM(DECODE(MS.ms_result, '1', 1, '2', 1, 0)), 0) tot
, '결과' as name
FROM min_simsa680_sc MS
, msu680_view MV
, msu680_sc_view MV
WHERE MS.ms_maincode = MV.msu_maincode
<if test='msuTeam != null and msuTeam != ""'>
AND MV.msu_team = #{msuTeam}
@ -448,9 +449,9 @@
, 0 as seo
, SUM(DECODE(MSU.MSU_RESULT, '1', 1, 0)) as mibu
, SUM(DECODE(MSU.MSU_RESULT, '1', 1, '2', 1, 0)) as tot
, MU.name
, name
FROM min_simsa680_sc MS
, min_simsa_user680 MSU
, min_simsa_user680_sc MSU
, min_userinfo MU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_datagb = #{msDatagb}
@ -471,7 +472,7 @@
, MS.ms_seq AS msSeq
, MS.ms_carnum AS msCarnum
FROM min_simsa680_sc MS
, min_simsa_user680 MSU
, min_simsa_user680_sc MSU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_datagb = #{msDatagb}
AND MS.ms_chasu = #{msChasu}
@ -504,7 +505,7 @@
AND code_mcd = 'RESULT'
AND code_cd = MSU.msu_result) as msuResult
FROM min_simsa680_sc MS
, min_simsa_user680 MSU
, min_simsa_user680_sc MSU
, min_userinfo MU
WHERE MS.ms_maincode = MSU.msu_maincode
AND MS.ms_datagb = #{msDatagb}
@ -524,7 +525,7 @@
/* residentAndDisabled-mapper|selectJudegStdCount|julim */
SELECT count(msu_code)
FROM min_simsa_user680_sc
WHERE ms_maincode = #{msuMaincode}
WHERE msu_maincode = #{msMaincode}
AND msu_result= '2'
</native-query>
@ -537,26 +538,26 @@
</native-query>
<native-query id="selectJudgeTarget">
/* parking-mapper|selectJudgeTarget|julim */
/* residentAndDisabled-mapper|selectJudgeTarget|julim */
SELECT GRC.sc_code,
GRC.sc_seq,
GRC.sc_carno,
GRC.sc_carnum,
GRC.sc_name,
GRC.sc_cont_doc,
GRC.sc_ingb,
GRC.sc_cdate,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRC.rc_cont_doc = code_cd
WHERE GRC.sc_cont_doc = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RC_CONT_DOC') as rcContDocNm,
AND code_mcd = 'RC_CONT_DOC') as scContDocNm,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRC.rc_ingb = code_cd
WHERE GRC.sc_ingb = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RC_INGB') as rcIngbNm
AND code_mcd = 'RC_INGB') as scIngbNm
FROM gn_recall_sc GRC
WHERE GRC.sc_datagb = #{scDatagb}
AND GRC.sc_state = '1'
@ -601,7 +602,7 @@
WHERE ROWNUM = 1) T
WHERE MS.ms_datagb = #{msDatagb}
AND MS.ms_result = '0'
MS.ms_maincode = MSU.msu_maincode
AND MS.ms_maincode = MSU.msu_maincode
AND MSU.msu_userid = MU.userid
AND MS.ms_edate = T.ms_edate
GROUP BY MS.ms_edate, MSU.msu_team, MU.name

Loading…
Cancel
Save