feat: mpower 적용 진행

dev
Jonguk. Lim 2 years ago
parent 4f94fbe137
commit 267814ff73

@ -1,7 +1,6 @@
package com.xit.biz.ctgy.auth; package com.xit.biz.ctgy.auth;
import com.xit.biz.ctgy.repository.IMinUserRepository; import com.xit.biz.ctgy.v2.repository.MinUserinfoDao;
import com.xit.biz.ctgy.v2.dao.MinUserinfoDao;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

@ -5,8 +5,7 @@ import com.xit.biz.ctgy.auth.service.IAuthMinService;
import com.xit.biz.ctgy.dto.LoginMinRequestDto; import com.xit.biz.ctgy.dto.LoginMinRequestDto;
import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.repository.IMinUserRepository; import com.xit.biz.ctgy.v2.repository.MinUserinfoDao;
import com.xit.biz.ctgy.v2.dao.MinUserinfoDao;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.constant.XitConstants; import com.xit.core.constant.XitConstants;
import com.xit.core.exception.TokenAuthException; import com.xit.core.exception.TokenAuthException;
@ -14,7 +13,6 @@ import com.xit.core.oauth2.api.dao.RefreshTokenDao;
import com.xit.core.oauth2.api.dto.TokenDto; import com.xit.core.oauth2.api.dto.TokenDto;
import com.xit.core.oauth2.api.dto.TokenRequestDto; import com.xit.core.oauth2.api.dto.TokenRequestDto;
import com.xit.core.oauth2.api.entity.RefreshToken; import com.xit.core.oauth2.api.entity.RefreshToken;
import com.xit.core.oauth2.api.repository.RefreshTokenRepository;
import com.xit.core.oauth2.config.properties.AppProperties; import com.xit.core.oauth2.config.properties.AppProperties;
import com.xit.core.oauth2.oauth.JwtTokenProvider; import com.xit.core.oauth2.oauth.JwtTokenProvider;
import com.xit.core.oauth2.utils.CookieUtil; import com.xit.core.oauth2.utils.CookieUtil;

@ -3,8 +3,7 @@ package com.xit.biz.ctgy.auth.service.impl;
import com.xit.biz.ctgy.auth.UserMinPrincipal; import com.xit.biz.ctgy.auth.UserMinPrincipal;
import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.repository.IMinUserRepository; import com.xit.biz.ctgy.v2.repository.MinUserinfoDao;
import com.xit.biz.ctgy.v2.dao.MinUserinfoDao;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException; import com.xit.core.exception.CustomBaseException;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

@ -52,31 +52,31 @@ public class BoardController {
return RestResponse.of(service.findAll(dto, pageable)); return RestResponse.of(service.findAll(dto, pageable));
} }
// @Secured(policy = SecurityPolicy.TOKEN) @Secured(policy = SecurityPolicy.TOKEN)
// @Operation(summary = "게시글 조회수 증가" , description = "게시글 조회수 증가") @Operation(summary = "게시글 조회수 증가" , description = "게시글 조회수 증가")
// @Parameters({ @Parameters({
// @Parameter(in = ParameterIn.PATH, name = "ciCode", description = "게시글번호", required = true, example = "18"), @Parameter(in = ParameterIn.PATH, name = "ciCode", description = "게시글번호", required = true, example = "18"),
// }) })
// @PutMapping(value = "/hit/{ciCode}", produces = MediaType.APPLICATION_JSON_VALUE) @PutMapping(value = "/hit/{ciCode}", produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<? extends IRestResponse> modifyByCiCode(@PathVariable final Long ciCode) { public ResponseEntity<? extends IRestResponse> modifyByCiCode(@PathVariable final Long ciCode) {
// return RestResponse.of(service.modifyByCiCode(ciCode)); return RestResponse.of(service.modifyByCiCode(ciCode));
// } }
//
// @Secured(policy = SecurityPolicy.TOKEN) @Secured(policy = SecurityPolicy.TOKEN)
// @Operation(summary = "게시글 등록" , description = "게시글 등록") @Operation(summary = "게시글 등록" , description = "게시글 등록")
// @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<? extends IRestResponse> saveBoard(BoardDto dto) { public ResponseEntity<? extends IRestResponse> saveBoard(BoardDto dto) {
// service.saveBoard(dto); service.saveBoard(dto);
// return RestResponse.of(HttpStatus.OK); return RestResponse.of(HttpStatus.OK);
// } }
//
// @Secured(policy = SecurityPolicy.TOKEN) @Secured(policy = SecurityPolicy.TOKEN)
// @Operation(summary = "게시글 삭제", description = "게시글 삭제") @Operation(summary = "게시글 삭제", description = "게시글 삭제")
// @PostMapping(value = "/{ciCode}") @PostMapping(value = "/{ciCode}")
// public ResponseEntity<? extends IRestResponse> removeBoard(@PathVariable @Nonnull final Long ciCode) { public ResponseEntity<? extends IRestResponse> removeBoard(@PathVariable @Nonnull final Long ciCode) {
// AssertUtils.isTrue(!Checks.isEmpty(ciCode), "게시글이 선택되지 않았습니다."); AssertUtils.isTrue(!Checks.isEmpty(ciCode), "게시글이 선택되지 않았습니다.");
// service.removeBoard(ciCode); service.removeBoard(ciCode);
//
// return RestResponse.of(HttpStatus.OK); return RestResponse.of(HttpStatus.OK);
// } }
} }

@ -0,0 +1,65 @@
package com.xit.biz.ctgy.v2.repository;
import com.xit.biz.ctgy.dto.BoardDto;
import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.core.support.sql.parser.QueryGenerator;
import com.xit.core.util.mpower.MpowerUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Repository
@Slf4j
public class BoardDao {
public Map<String,Object> 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);
return listQuery.getPagingMap(BoardDto.class, cntSql);
}
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();
}
//@Query("UPDATE MinCivBoard680 m SET m.ciHit = m.ciHit + 1 WHERE m.ciCode = :ciCode")
public int updateInHitForMinCivBoard680(Long ciCode) {
return 0;
}
public Optional<MinCivBoard680> findById(Long ciCode) {
return Optional.empty();
}
//@Query(value = "SELECT max(e.ci_code) + 1 FROM min_civ_board680 e", nativeQuery = true)
public Long getCiCode() {
return null;
}
public void save(MinCivBoard680 entity) {
}
public List<MinCivBoard680> findByCiRef(Long ciCode) {
return null;
}
public void deleteById(Long ciCode) {
}
}

@ -1,4 +1,4 @@
package com.xit.biz.ctgy.v2.dao; package com.xit.biz.ctgy.v2.repository;
import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
@ -57,4 +57,7 @@ public class MinUserinfoDao {
public List<MinUserinfo> findAllByTeamAndIsenableAndAccesstype(String msuTeam, String isenabled, String accesstype){ public List<MinUserinfo> findAllByTeamAndIsenableAndAccesstype(String msuTeam, String isenabled, String accesstype){
return null; return null;
} }
public void save(MinUserinfoDto dto) {
}
} }

@ -0,0 +1,4 @@
package com.xit.biz.ctgy.v2.repository;
public class ParkingDao {
}

@ -0,0 +1,59 @@
package com.xit.biz.ctgy.v2.repository;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.core.support.sql.parser.QueryGenerator;
import com.xit.core.util.mpower.MpowerUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Repository
@Slf4j
public class PublicBoardDao {
public Map<String, Object> findAll(MinInfoBoard680Dto dto, Pageable pageable) {
return null;
}
public MinInfoBoard680Dto findByInCode(Long inCode) {
return null;
}
public int updateInHitForMinInfoBoard680(Long inCode) {
return 1;
}
//public Optional<Object> findById(Long inCode) {
//}
//@Query(value = "SELECT e.msMaincode FROM #{#entityName} e WHERE e.msChasu = :msChasu AND e.msSdate = :msSdate AND e.msEdate = :msEdate")
public List<Long> findAllMsMaincode(Long msChasu, LocalDate msSdate, LocalDate msEdate){
return null;
};
//@Modifying
//@Query(value = "UPDATE #{#entityName} m SET m.msResult = :msResult WHERE m.msMaincode = :msMaincode AND m.msSeq = :msSeq")
public int updateMsResult(final Long msMaincode, final String msSeq, final String msResult){
return 1;
};
public Long getInCodeByInBgubun() {
return 1L;
}
public void save(MinInfoBoard680Dto savedDto) {
}
public void delete(MinInfoBoard680Dto savedEntity) {
}
}

@ -0,0 +1,4 @@
package com.xit.biz.ctgy.v2.repository;
public class ResidentAndDisabledDao {
}

@ -12,11 +12,9 @@ public interface IBoardService {
Page<BoardDto> findAll(final BoardDto dto, Pageable pageable); Page<BoardDto> findAll(final BoardDto dto, Pageable pageable);
// Page<MinCivBoard680> findAll2(final MinCivBoard680 entity, Pageable pageable); int modifyByCiCode(Long ciCode);
//
// int modifyByCiCode(Long ciCode); void saveBoard(BoardDto dto);
//
// void saveBoard(BoardDto dto); void removeBoard(Long ciCode);
//
// void removeBoard(Long ciCode);
} }

@ -11,9 +11,9 @@ import java.util.List;
* @since 2021-07-16 * @since 2021-07-16
*/ */
public interface ICtgyFileService { public interface ICtgyFileService {
MinInfoBoard680 findFiles(Long inCode); MinInfoBoard680Dto findFiles(Long inCode);
// List<MinInfoBoard680> saveFiles(@Nonnull MinInfoBoard680Dto dto); List<MinInfoBoard680Dto> saveFiles(@Nonnull MinInfoBoard680Dto dto);
//
// void removePublicBoardFile(Long inCode); void removePublicBoardFile(Long inCode);
} }

@ -9,11 +9,11 @@ public interface IMinUserService {
Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable); Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable);
// MinUserinfo findMinUser(); MinUserinfo findMinUser();
//
// MinUserinfo findMinUserByUserid(final String userId); MinUserinfo findMinUserByUserid(final String userId);
//
// void saveMinUser(MinUserinfoDto dto); void saveMinUser(MinUserinfoDto dto);
//
// void removeMinUser(MinUserinfoDto dto); void removeMinUser(MinUserinfoDto dto);
} }

@ -12,26 +12,26 @@ public interface IParkingService {
Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable); Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable);
// /** /**
// * 주정차 의견진술 심의 결과 목록 *
// * @param dto JudgeListDto * @param dto JudgeListDto
// * @return Map * @return Map
// */ */
// Map<String,Object> findParkingResults(final JudgeListDto dto); Map<String,Object> findParkingResults(final JudgeListDto dto);
//
// List<ParkingTargetDto> findParkingJudgeTargets(final ParkingTargetDto dto) ; List<ParkingTargetDto> findParkingJudgeTargets(final ParkingTargetDto dto) ;
//
// // Page<MinSimsa680> findAll(final MinSimsa680 minSimsa680, Pageable pageable); // Page<MinSimsa680> findAll(final MinSimsa680 minSimsa680, Pageable pageable);
//
// void saveParkingJudgeTargets(ParkingTargetDto dto); void saveParkingJudgeTargets(ParkingTargetDto dto);
//
// void removeParkingJudge(final ParkingTargetDto dto); void removeParkingJudge(final ParkingTargetDto dto);
//
// //--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// // 심사자 // 심사자
// //--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// List<JudgeListDto> findByUserJudges(); List<JudgeListDto> findByUserJudges();
//
// void saveJudgeResult(JudgeListDto dto); void saveJudgeResult(JudgeListDto dto);
} }

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

@ -27,66 +27,66 @@ public interface IResidentAndDisabledService {
* @return Page<GnRecallScDto> * @return Page<GnRecallScDto>
*/ */
Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable); Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable);
//
// /** /**
// * 거주자 / 장애인 심의자료 정보 조회 * /
// * @param scCode Long * @param scCode Long
// * @return GnRecallScDto * @return GnRecallScDto
// */ */
// GnRecallScDto findJudgeData(final Long scCode); GnRecallScDto findJudgeData(final Long scCode);
//
// //Page<GnRecallSc> findAll(final GnRecallSc entity, Pageable pageable); //Page<GnRecallSc> findAll(final GnRecallSc entity, Pageable pageable);
//
// // 심의자료 저장 // 심의자료 저장
//
// /** /**
// * 거주자 / 장애인 심의자료 저장 * /
// * @param entity GnRecallScDto * @param entity GnRecallScDto
// */ */
// void saveJudgeData(GnRecallScDto entity); void saveJudgeData(GnRecallScDto entity);
//
// void removeJudgeData(Long scCode); void removeJudgeData(Long scCode);
//
// /** /**
// * 거주자 / 장애인 의견진술 심의 목록 조회 * /
// * @param dto JudgeListDto * @param dto JudgeListDto
// * @param pageable Pageable * @param pageable Pageable
// * @return Page<JudgeListDto> * @return Page<JudgeListDto>
// */ */
// Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable); Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable);
//
// /** /**
// * 거주자 / 장애인 의견진술 심의 결과 목록 * /
// * @param dto JudgeListDto * @param dto JudgeListDto
// * @return Map * @return Map
// */ */
// Map<String,Object> findJudgeResults(final JudgeListDto dto); Map<String,Object> findJudgeResults(final JudgeListDto dto);
// Map<String,Object> findJudgeResults2(final JudgeListDto dto); Map<String,Object> findJudgeResults2(final JudgeListDto dto);
//
// /** /**
// * 거주자 / 장애인 심의대상 목록 조회 * /
// * @param dto JufgeTargetDto * @param dto JufgeTargetDto
// * @return List<JudgeTargetDto> * @return List<JudgeTargetDto>
// */ */
// List<JudgeTargetDto> findJudgeTargets(final JudgeTargetDto dto) ; List<JudgeTargetDto> findJudgeTargets(final JudgeTargetDto dto) ;
//
// /** /**
// * 거주자 / 장애인 심의대상 목록 저장 * /
// * @param dto JudgeTargetDto * @param dto JudgeTargetDto
// */ */
// void saveJudgeTargets(JudgeTargetDto dto); void saveJudgeTargets(JudgeTargetDto dto);
//
// void removeJudge(final JudgeListDto dto); void removeJudge(final JudgeListDto dto);
//
// void saveJudgeStds(final JudgeStdDto dto); void saveJudgeStds(final JudgeStdDto dto);
//
// Map<String,Object> findDashboard(); Map<String,Object> findDashboard();
//
// //--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// // 심사자 // 심사자
// //--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
// List<JudgeListDto> findByUserJudges(JudgeListDto dto); List<JudgeListDto> findByUserJudges(JudgeListDto dto);
//
// void saveJudgeResult(JudgeListDto dto); void saveJudgeResult(JudgeListDto dto);
} }

@ -2,131 +2,86 @@ package com.xit.biz.ctgy.v2.service.impl;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.xit.biz.ctgy.dto.BoardDto; import com.xit.biz.ctgy.dto.BoardDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.struct.MinCivBoard680Mapstruct;
import com.xit.biz.ctgy.entity.MinCivBoard680; import com.xit.biz.ctgy.entity.MinCivBoard680;
import com.xit.biz.ctgy.repository.IBoardRepository; import com.xit.biz.ctgy.v2.repository.BoardDao;
import com.xit.biz.ctgy.v2.service.IBoardService; import com.xit.biz.ctgy.v2.service.IBoardService;
import com.xit.core.config.database.BaseMybatisDaoSupport;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException; import com.xit.core.exception.CustomBaseException;
import com.xit.core.oauth2.utils.HeaderUtil; import com.xit.core.oauth2.utils.HeaderUtil;
import com.xit.core.support.jpa.JpaUtil;
import com.xit.core.support.sql.parser.QueryGenerator;
import com.xit.core.util.Checks; import com.xit.core.util.Checks;
import com.xit.core.util.CommUtil; import com.xit.core.util.CommUtil;
import com.xit.core.util.DBUtils;
import com.xit.core.util.mpower.MpowerUtil;
import com.xit.core.util.mpower.MpowerUtils;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
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.*; import org.springframework.data.domain.*;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
public class BoardService implements IBoardService { public class BoardService implements IBoardService {
private final PasswordEncoder passwordEncoder; private final PasswordEncoder passwordEncoder;
private final BoardDao boardDao;
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Page<BoardDto> findAll(final BoardDto dto, Pageable pageable) { public Page<BoardDto> findAll(final BoardDto dto, Pageable pageable) {
String cntSql = getSql("selectBoardListCnt", dto, pageable); Map<String,Object> map = boardDao.findAll(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);
Map<String,Object> map = listQuery.getPagingMap(BoardDto.class, cntSql);
if(Long.parseLong(map.get("totalCount").toString()) <= 0) if(Long.parseLong(map.get("totalCount").toString()) <= 0)
return new PageImpl<>(new ArrayList<>(), pageable, 0); return new PageImpl<>(new ArrayList<>(), pageable, 0);
else else
return new PageImpl<>((List<BoardDto>)map.get("list"), pageable, Long.parseLong(map.get("totalCount").toString())); return new PageImpl<>((List<BoardDto>)map.get("list"), pageable, Long.parseLong(map.get("totalCount").toString()));
} }
private String getSql(String sqlId, BoardDto dto, Pageable pageable){ @Override
return QueryGenerator.createNamedQuery("board", sqlId) @Transactional
.setParameter("ciTitle", dto.getCiTitle()) public int modifyByCiCode(Long ciCode) {
.setParameter("ciName", dto.getCiName()) return boardDao.updateInHitForMinCivBoard680(ciCode);
.setParameter("ciContents", dto.getCiContents()) }
.setParameter("page", pageable.getPageNumber())
.setParameter("size", pageable.getPageSize()) @Override
.getQueryString(); @Transactional
public void saveBoard(BoardDto dto) {
MinCivBoard680 entity = null;
// update 인 경우
if(Checks.isNotEmpty(dto.getCiCode())) {
entity = boardDao.findById(dto.getCiCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND));
if(!entity.getCiPass().equals(passwordEncoder.encode(dto.getCiPass()))){
throw new CustomBaseException(ErrorCode.MISMATCH_PASSWORD);
}
entity.setCiTitle(dto.getCiTitle());
entity.setCiContents(dto.getCiContents());
}else {
dto.setCiCode(boardDao.getCiCode());
dto.setCiContentno(dto.getCiCode());
if (Checks.isEmpty(dto.getCiRef()) || dto.getCiRef() == 0L) {
dto.setCiRef(dto.getCiCode());
dto.setCiStep(0L);
dto.setCiRevel(0L);
}
dto.setCiPass(passwordEncoder.encode(dto.getCiPass()));
dto.setCiIp(CommUtil.getDeviceInfo().getIp());
}
boardDao.save(entity);
}
@Override
@Transactional
public void removeBoard(Long ciCode) {
MinCivBoard680 savedEntity = boardDao.findById(ciCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));
if(!Objects.equal(HeaderUtil.getUserId(), savedEntity.getCiId())) throw new CustomBaseException("삭제 권한(게시글 소유자)이 없는 사용자 입니다");
// 댓글 존재 여부 조회
List<MinCivBoard680> list = boardDao.findByCiRef(ciCode);
if(list.size() > 1) throw new CustomBaseException("삭제 할 수 없는 게시글 입니다[댓글 존재]");
boardDao.deleteById(ciCode);
} }
// @Transactional(readOnly = true)
// public Page<MinCivBoard680> findAll2(final MinCivBoard680 entity, Pageable pageable) {
// pageable = JpaUtil.getPagingInfo(pageable);
// ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
// .withMatcher("ciTitle", contains())
// .withMatcher("ciName", contains());
// Example<MinCivBoard680> example = Example.of(entity, exampleMatcher);
// return repository.findAll(example, pageable);
// }
//
// @Override
// @Transactional
// public int modifyByCiCode(Long ciCode) {
// return repository.updateInHitForMinCivBoard680(ciCode);
// }
//
// @Override
// @Transactional
// public void saveBoard(BoardDto dto) {
// MinCivBoard680 entity = null;
//
// // update 인 경우
// if(Checks.isNotEmpty(dto.getCiCode())) {
// entity = repository.findById(dto.getCiCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND));
// if(!entity.getCiPass().equals(passwordEncoder.encode(dto.getCiPass()))){
// throw new CustomBaseException(ErrorCode.MISMATCH_PASSWORD);
// }
// entity.setCiTitle(dto.getCiTitle());
// entity.setCiContents(dto.getCiContents());
// }else {
// dto.setCiCode(repository.getCiCode());
// dto.setCiContentno(dto.getCiCode());
// if (Checks.isEmpty(dto.getCiRef()) || dto.getCiRef() == 0L) {
// dto.setCiRef(dto.getCiCode());
// dto.setCiStep(0L);
// dto.setCiRevel(0L);
// }
// dto.setCiPass(passwordEncoder.encode(dto.getCiPass()));
// dto.setCiIp(CommUtil.getDeviceInfo().getIp());
// entity = mapstruct.toEntity(dto);
// }
// repository.save(entity);
// }
//
// @Override
// @Transactional
// public void removeBoard(Long ciCode) {
//
// MinCivBoard680 savedEntity = repository.findById(ciCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));
// if(!Objects.equal(HeaderUtil.getUserId(), savedEntity.getCiId())) throw new CustomBaseException("삭제 권한(게시글 소유자)이 없는 사용자 입니다");
//
// // 댓글 존재 여부 조회
// List<MinCivBoard680> list = repository.findByCiRef(ciCode);
// if(list.size() > 1) throw new CustomBaseException("삭제 할 수 없는 게시글 입니다[댓글 존재]");
// repository.deleteById(ciCode);
// }
} }

@ -1,7 +1,10 @@
package com.xit.biz.ctgy.v2.service.impl; package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto; import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.dto.struct.MinInfoBoard680Mapstruct;
import com.xit.biz.ctgy.entity.MinInfoBoard680; import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.repository.IPublicBoardRepository;
import com.xit.biz.ctgy.v2.repository.PublicBoardDao;
import com.xit.biz.ctgy.v2.service.ICtgyFileService; import com.xit.biz.ctgy.v2.service.ICtgyFileService;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException; import com.xit.core.exception.CustomBaseException;
@ -44,134 +47,119 @@ public class CtgyFileService implements ICtgyFileService {
@Value("${file.cmm.upload.max.size:1024}") @Value("${file.cmm.upload.max.size:1024}")
private long maxSize; private long maxSize;
private final PublicBoardDao publicBoardDao;
@Override @Override
public MinInfoBoard680 findFiles(Long inCode) { public MinInfoBoard680Dto findFiles(Long inCode) {
Assert.notNull(inCode, "대상 게시글[inCode]을 선택해 주세요."); Assert.notNull(inCode, "대상 게시글[inCode]을 선택해 주세요.");
return null;
// return repository.findById(inCode).orElse(null); return publicBoardDao.findByInCode(inCode);
} }
//
// /**
// * 파일 등록
// * 신규등록시는 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());
// }
}
/**
*
* CmmFileMst.fileMstId null, not null
* DB
*
* @param dto MinInfoBoard680Dto
* @return CmmFileMst
*/
@Override
@Transactional
public List<MinInfoBoard680Dto> saveFiles(@Nonnull MinInfoBoard680Dto dto) {
List<MinInfoBoard680Dto> 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()));
MinInfoBoard680Dto savedDto = null;
// 파일 저장 && 전송
if(Checks.isEmpty(dto.getInCode())) {
dto.setInCode(publicBoardDao.getInCodeByInBgubun());
dto.setInContentno(dto.getInCode());
dto.setInFilename(orgFileName);
dto.setInFilesize(mf.getSize());
dto.setInFileurl(serviceUrl + urlPath);
publicBoardDao.save(dto);
entityList.add(dto);
}else {
savedDto = publicBoardDao.findByInCode(dto.getInCode());
savedDto.setInFilename(orgFileName);
savedDto.setInFilesize(mf.getSize());
savedDto.setInFileurl(serviceUrl + urlPath);
publicBoardDao.save(savedDto);
entityList.add(savedDto);
}
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{
MinInfoBoard680Dto savedEntity = null;
if(Checks.isEmpty(dto.getInCode())) {
dto.setInCode(publicBoardDao.getInCodeByInBgubun());
dto.setInContentno(dto.getInCode());
publicBoardDao.save(dto);
}else {
savedEntity = publicBoardDao.findByInCode(dto.getInCode());
publicBoardDao.save(savedEntity);
}
publicBoardDao.save(savedEntity);
//JpaUtil.saveIfNullId(dto.getInCode(), repository, savedEntity);
}
return entityList;
}
@Override
@Transactional
public void removePublicBoardFile(Long inCode) {
MinInfoBoard680Dto savedEntity = publicBoardDao.findByInCode(inCode);
publicBoardDao.delete(savedEntity);
/* // 정보 삭제후 파일 삭제 : 에러 발생시 skip
// File.seperator 는 OS종속적이다. if(Checks.isNotEmpty(savedEntity.getInFilename())){
// Spring에서 제공하는 cleanPath()를 통해서 ../ 내부 점들에 대해서 사용을 억제한다 String absFile = rootPath + savedEntity.getInFileurl().split(serviceUrl)[1]+File.separator + savedEntity.getInFilename();
Path copyOfLocation = Paths.get(uploadDir + File.separator + StringUtils.cleanPath(multipartFile.getOriginalFilename())); try {
try { File file = new File(absFile);
// inputStream을 가져와서 if (Checks.isNotEmpty(file) && file.exists()) file.delete();
// copyOfLocation (저장위치)로 파일을 쓴다. }catch(Exception e){
// copy의 옵션은 기존에 존재하면 REPLACE(대체한다), 오버라이딩 한다 //
Files.copy(multipartFile.getInputStream(), copyOfLocation, StandardCopyOption.REPLACE_EXISTING); }
} catch (IOException e) {
e.printStackTrace();
throw new FileStorageException("Could not store file : " + multipartFile.getOriginalFilename());
} }
*/
}
private void setEntity(MinInfoBoard680 savedEntity, MinInfoBoard680Dto dto){
savedEntity.setInDept(dto.getInDept());
savedEntity.setInTitle(dto.getInTitle());
savedEntity.setInContents(dto.getInContents());
}
}

@ -2,6 +2,7 @@ package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.v2.repository.MinUserinfoDao;
import com.xit.biz.ctgy.v2.service.IMinUserService; import com.xit.biz.ctgy.v2.service.IMinUserService;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException; import com.xit.core.exception.CustomBaseException;
@ -20,6 +21,7 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc
public class MinUserService implements IMinUserService { public class MinUserService implements IMinUserService {
private final PasswordEncoder passwordEncoder; private final PasswordEncoder passwordEncoder;
private final MinUserinfoDao minUserinfoDao;
@Transactional//(readOnly = true) @Transactional//(readOnly = true)
public Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable) { public Page<MinUserinfo> findMinUsers(final MinUserinfo minUserinfo, Pageable pageable) {
@ -35,33 +37,33 @@ public class MinUserService implements IMinUserService {
// return page; // return page;
} }
// @Override @Override
// @Transactional(readOnly = true) @Transactional(readOnly = true)
// public MinUserinfo findMinUser() { public MinUserinfo findMinUser() {
// //cmmUserRepos //cmmUserRepos
// //return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId()); //return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId());
// return repository.findMinUserinfoByUserid(HeaderUtil.getUserId()); return minUserinfoDao.findMinUserinfoByUserid(HeaderUtil.getUserId());
// } }
//
// @Override @Override
// @Transactional(readOnly = true) @Transactional(readOnly = true)
// public MinUserinfo findMinUserByUserid(final String userid) { public MinUserinfo findMinUserByUserid(final String userid) {
// return repository.findMinUserinfoByUserid(userid); return minUserinfoDao.findMinUserinfoByUserid(userid);
// } }
//
// @Override @Override
// @Transactional @Transactional
// public void saveMinUser(MinUserinfoDto dto) { public void saveMinUser(MinUserinfoDto dto) {
// if("Y".equals(dto.getNewYn()) && repository.findByUserid(dto.getUserid()).isPresent()) throw new CustomBaseException(ErrorCode.MEMBER_EXISTS); if("Y".equals(dto.getNewYn()) && minUserinfoDao.findByUserid(dto.getUserid()).isPresent()) throw new CustomBaseException(ErrorCode.MEMBER_EXISTS);
// dto.setPasswd(passwordEncoder.encode(dto.getPasswd())); dto.setPasswd(passwordEncoder.encode(dto.getPasswd()));
// repository.save(mapstruct.toEntity(dto)); minUserinfoDao.save(dto);
// } }
//
// @Override @Override
// @Transactional @Transactional
// public void removeMinUser(MinUserinfoDto dto) { public void removeMinUser(MinUserinfoDto dto) {
// MinUserinfo entity = repository.findByUserid(dto.getUserid()).orElseThrow(()-> new CustomBaseException(ErrorCode.USER_NOT_FOUND)); MinUserinfoDto savedDto = minUserinfoDao.findByUserid(dto.getUserid()).orElseThrow(()-> new CustomBaseException(ErrorCode.USER_NOT_FOUND));
// entity.setIsenable("0"); savedDto.setIsenable("0");
// repository.save(entity); minUserinfoDao.save(savedDto);
// } }
} }

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

@ -1,6 +1,9 @@
package com.xit.biz.ctgy.v2.service.impl; package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.dto.BoardDto;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.entity.MinInfoBoard680; import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.v2.repository.PublicBoardDao;
import com.xit.biz.ctgy.v2.service.IPublicBoardService; import com.xit.biz.ctgy.v2.service.IPublicBoardService;
import com.xit.core.support.jpa.JpaUtil; import com.xit.core.support.jpa.JpaUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -8,38 +11,37 @@ import org.springframework.data.domain.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains; import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
public class PublicBoardService implements IPublicBoardService { public class PublicBoardService implements IPublicBoardService {
private final PublicBoardDao publicBoardDao;
@Override
@Transactional(readOnly = true)
public Page<MinInfoBoard680Dto> findAll(final MinInfoBoard680Dto dto, Pageable pageable) {
Map<String,Object> map = publicBoardDao.findAll(dto, pageable);
if(Long.parseLong(map.get("totalCount").toString()) <= 0)
return new PageImpl<>(new ArrayList<>(), pageable, 0);
else
return new PageImpl<>((List<MinInfoBoard680Dto>)map.get("list"), pageable, Long.parseLong(map.get("totalCount").toString()));
}
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Page<MinInfoBoard680> findAll(final MinInfoBoard680 entity, Pageable pageable) { public MinInfoBoard680Dto findByInCode(final Long inCode) {
// Sort sort = Sort.by(Sort.Direction.DESC, "inCode"); return publicBoardDao.findByInCode(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 @Override
// @Transactional(readOnly = true) @Transactional
// public MinInfoBoard680 findByInCode(final Long inCode) { public int modifyByInCode(Long inCode) {
// return repository.findByInCode(inCode); return publicBoardDao.updateInHitForMinInfoBoard680(inCode);
// } }
//
// @Override
// @Transactional
// public int modifyByInCode(Long inCode) {
// return repository.updateInHitForMinInfoBoard680(inCode);
// }
} }

@ -6,11 +6,14 @@ import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeStdDto; import com.xit.biz.ctgy.dto.JudgeStdDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct;
import com.xit.biz.ctgy.entity.GnRecallSc; import com.xit.biz.ctgy.entity.GnRecallSc;
import com.xit.biz.ctgy.entity.MinInfoBoard680; import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.entity.MinSimsaUser680Sc; import com.xit.biz.ctgy.entity.MinSimsaUser680Sc;
import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.mapper.IParkingMapper; import com.xit.biz.ctgy.mapper.IParkingMapper;
import com.xit.biz.ctgy.mapper.IResidentAndDisabledMapper;
import com.xit.biz.ctgy.repository.*;
import com.xit.biz.ctgy.service.IPublicBoardService; import com.xit.biz.ctgy.service.IPublicBoardService;
import com.xit.biz.ctgy.v2.service.IResidentAndDisabledService; import com.xit.biz.ctgy.v2.service.IResidentAndDisabledService;
import com.xit.core.constant.ErrorCode; import com.xit.core.constant.ErrorCode;
@ -54,6 +57,16 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
@Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}") @Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}")
private String[] uploadPath; private String[] uploadPath;
private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class);
private final IResidentAndDisabledRepository gnReacallRepository;
private final IMinUserRepository userRepository;
private final IJudgeUserRepository judgeUserRepository;
private final IJudgeRepository judgeRepository;
private final IResidentAndDisabledMapper residentAndDisabledMapper;
private final IParkingRepository parkingRepository;
private final ICmmFileService fileService; private final ICmmFileService fileService;
private final IPublicBoardService pBoardService; private final IPublicBoardService pBoardService;
private final IParkingMapper parkingMapper; private final IParkingMapper parkingMapper;
@ -68,323 +81,323 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
public Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) { public Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) {
// Sort sort = Sort.by(Sort.Direction.DESC, "inCode"); // Sort sort = Sort.by(Sort.Direction.DESC, "inCode");
pageable = JpaUtil.getPagingInfo(pageable); pageable = JpaUtil.getPagingInfo(pageable);
return null; return gnReacallRepository.findJudgeDatas(
// return gnReacallRepository.findJudgeDatas( scDatagb,
// scDatagb, PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending()));
// PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending())); // List<CmmUser> userList = page.getContent();
}
@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 @Override
// @Transactional(readOnly = true) @Transactional(readOnly = true)
// public GnRecallScDto findJudgeData(final Long scCode) { public Map<String,Object> findJudgeResults(JudgeListDto dto) {
// return gnReacallRepository.findJudgeData(scCode); Map<String, Object> resultMap = new HashMap<>();
// }
// // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두
// @Override // Map<String, Object> teamMap = residentAndDisabledMapper.selectTotJudgeResultGroupByTeamAndChasu(dto);
// @Transactional // if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
// 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); // List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
// totJudgeUserList.add(teamList.get(0)); // totJudgeUserList.add(teamMap);
//
// // 심사대상 차량 목록 List<Map<String, Object>> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto);
// List<Map<String,Object>> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto); if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//
// // 차량별 심사자 심사결과 목록 // 차수별 심사자별 심사결과 합산
// Map<String, Object> paramMap = new HashMap<>(); dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam")));
// paramMap.put("msDatagb", dto.getMsDatagb()); List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
// paramMap.put("msChasu", dto.getMsChasu()); totJudgeUserList.add(teamList.get(0));
// paramMap.put("msSdate", dto.getMsSdate());
// paramMap.put("msEdate", dto.getMsEdate()); // 심사대상 차량 목록
// paramMap.put("msuTeam", dto.getMsuTeam()); List<Map<String,Object>> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto);
//
// 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())); Map<String, Object> paramMap = new HashMap<>();
// List<Map<String,Object>> jurgeUserList = residentAndDisabledMapper.selectJudgeResultList(paramMap); paramMap.put("msDatagb", dto.getMsDatagb());
// paramMap.put("msChasu", dto.getMsChasu());
//// List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> { paramMap.put("msSdate", dto.getMsSdate());
//// paramMap.put("msSeq", m.get("msSeq")); paramMap.put("msEdate", dto.getMsEdate());
//// paramMap.put("msCarnum", m.get("msCarnum")); paramMap.put("msuTeam", dto.getMsuTeam());
//// m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap));
//// }).collect(Collectors.toList()); 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);
// resultMap.put("teamList", teamList);
// // 차수별 심사자별 심사결과 합산 // List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
// resultMap.put("totJudgeUserData", totJudgeUserList); // paramMap.put("msSeq", m.get("msSeq"));
// // 심사대상 차량 목록 // paramMap.put("msCarnum", m.get("msCarnum"));
// resultMap.put("judgeCarData", judgeCarList); // m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap));
// // 차량별 심사자 심사결과 목록 // }).collect(Collectors.toList());
// resultMap.put("judgeUserData", jurgeUserList);
// return resultMap;
// } resultMap.put("teamList", teamList);
// // 차수별 심사자별 심사결과 합산
// @Override resultMap.put("totJudgeUserData", totJudgeUserList);
// @Transactional(readOnly = true) // 심사대상 차량 목록
// public Map<String,Object> findJudgeResults2(JudgeListDto dto) { resultMap.put("judgeCarData", judgeCarList);
// Map<String, Object> resultMap = new HashMap<>(); // 차량별 심사자 심사결과 목록
// resultMap.put("judgeUserData", jurgeUserList);
// // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두 return resultMap;
//// 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); @Override
//// totJudgeUserList.add(teamMap); @Transactional(readOnly = true)
// public Map<String,Object> findJudgeResults2(JudgeListDto dto) {
// List<Map<String, Object>> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto); Map<String, Object> resultMap = new HashMap<>();
// if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
// // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두
// // 차수별 심사자별 심사결과 합산 // Map<String, Object> teamMap = residentAndDisabledMapper.selectTotJudgeResultGroupByTeamAndChasu(dto);
// dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam"))); // if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
// List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto); // List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
// totJudgeUserList.add(teamList.get(0)); // totJudgeUserList.add(teamMap);
//
// // 심사대상 차량 목록 List<Map<String, Object>> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto);
// List<Map<String,Object>> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto); if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
//
// // 차량별 심사자 심사결과 목록 // 차수별 심사자별 심사결과 합산
// Map<String, Object> paramMap = new HashMap<>(); dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam")));
// paramMap.put("msDatagb", dto.getMsDatagb()); List<Map<String, Object>> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto);
// paramMap.put("msChasu", dto.getMsChasu()); totJudgeUserList.add(teamList.get(0));
// paramMap.put("msSdate", dto.getMsSdate());
// paramMap.put("msEdate", dto.getMsEdate()); // 심사대상 차량 목록
// paramMap.put("msuTeam", dto.getMsuTeam()); List<Map<String,Object>> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto);
//
// 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())); Map<String, Object> paramMap = new HashMap<>();
// List<Map<String,Object>> jurgeUserList = residentAndDisabledMapper.selectJudgeResultList(paramMap); paramMap.put("msDatagb", dto.getMsDatagb());
// paramMap.put("msChasu", dto.getMsChasu());
//// List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> { paramMap.put("msSdate", dto.getMsSdate());
//// paramMap.put("msSeq", m.get("msSeq")); paramMap.put("msEdate", dto.getMsEdate());
//// paramMap.put("msCarnum", m.get("msCarnum")); paramMap.put("msuTeam", dto.getMsuTeam());
//// m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap));
//// }).collect(Collectors.toList()); 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);
// resultMap.put("teamList", teamList);
// // 차수별 심사자별 심사결과 합산 // List<Map<String,Object>> resultList = judgeCarList.stream().peek((m) -> {
// resultMap.put("totJudgeUserData", totJudgeUserList); // paramMap.put("msSeq", m.get("msSeq"));
// // 심사대상 차량 목록 // paramMap.put("msCarnum", m.get("msCarnum"));
// resultMap.put("judgeCarData", judgeCarList); // m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap));
// // 차량별 심사자 심사결과 목록 // }).collect(Collectors.toList());
// resultMap.put("judgeUserData", jurgeUserList);
// return resultMap;
// } resultMap.put("teamList", teamList);
// // 차수별 심사자별 심사결과 합산
// /** resultMap.put("totJudgeUserData", totJudgeUserList);
// * 심사자료 삭제 // 심사대상 차량 목록
// * 1. 삭제 대상 조회 : min_simsa680_sc 테이블 : ms_datagb, ms_chasu, ms_sdate, ms_edate 조건으로 ms_maincode 삭제 대상 조회 resultMap.put("judgeCarData", judgeCarList);
// * 2. 심사자 삭제 : min_simsa_user680_sc 테이블 : msu_maincode = ms_maincode // 차량별 심사자 심사결과 목록
// * 3. 단속데이타 정보 변경 : gn_recall_sc 테이블 : sc_transfer = '1', sc_state = '1', sc_code = ms_maincode resultMap.put("judgeUserData", jurgeUserList);
// * 4. 심사자료 삭제 : min_simsa680_sc 테이블 ms_maincode = ms_maincode return resultMap;
// * @param dto ParkingTargetDto }
// */
// @Override /**
// @Transactional *
// public void removeJudge(final JudgeListDto dto) { * 1. : min_simsa680_sc : ms_datagb, ms_chasu, ms_sdate, ms_edate ms_maincode
// * 2. : min_simsa_user680_sc : msu_maincode = ms_maincode
// List<Long> msMaincodes = judgeRepository.findAllMsMaincode(dto.getMsDatagb(), dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate()); * 3. : gn_recall_sc : sc_transfer = '1', sc_state = '1', sc_code = ms_maincode
// * 4. : min_simsa680_sc ms_maincode = ms_maincode
// msMaincodes.forEach(msMaincode -> { * @param dto ParkingTargetDto
// //List<MinSimsaUser680Sc> judgeUsers = judgeUserRepository.findByMsuMaincode() */
// judgeUserRepository.deleteByMsuMaincode(msMaincode); @Override
// // 전송상태 -> 미접수(1), 심의결과 -> 접수(1) @Transactional
// gnReacallRepository.updateScTransferAndScState(dto.getMsDatagb(), msMaincode); public void removeJudge(final JudgeListDto dto) {
// judgeRepository.deleteById(msMaincode);
// }); List<Long> msMaincodes = judgeRepository.findAllMsMaincode(dto.getMsDatagb(), dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate());
// }
// msMaincodes.forEach(msMaincode -> {
// @Override //List<MinSimsaUser680Sc> judgeUsers = judgeUserRepository.findByMsuMaincode()
// @Transactional judgeUserRepository.deleteByMsuMaincode(msMaincode);
// public void saveJudgeStds(final JudgeStdDto dto) { // 전송상태 -> 미접수(1), 심의결과 -> 접수(1)
// int stdCnt = dto.getJudgeStdCnt(); gnReacallRepository.updateScTransferAndScState(dto.getMsDatagb(), msMaincode);
// judgeRepository.deleteById(msMaincode);
// dto.getJudgeDataKeys().forEach(map -> { });
// int cnt = 0; }
// Long msMaincode = Long.valueOf(map.get("msMaincode").toString());
// String msSeq = map.get("msSeq").toString(); @Override
// @Transactional
// // 미부과 public void saveJudgeStds(final JudgeStdDto dto) {
// String msResult = CtgyConstants.Judge.RESULT_JUDGE_NON_IMPOSE.getCode(); int stdCnt = dto.getJudgeStdCnt();
// // 주정차 심사
// if (Checks.isEmpty(dto.getDataGb())) { dto.getJudgeDataKeys().forEach(map -> {
// cnt = parkingRepository.getJudgeStdCnt(msMaincode); int cnt = 0;
// if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode(); Long msMaincode = Long.valueOf(map.get("msMaincode").toString());
// String msSeq = map.get("msSeq").toString();
// parkingRepository.updateMsResult(msMaincode, msSeq, msResult);
// // 미부과
// // 거주자 장애인 심사 String msResult = CtgyConstants.Judge.RESULT_JUDGE_NON_IMPOSE.getCode();
// } else { // 주정차 심사
// cnt = gnReacallRepository.getJudgeStdCnt(msMaincode); if (Checks.isEmpty(dto.getDataGb())) {
// if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode(); cnt = parkingRepository.getJudgeStdCnt(msMaincode);
// if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode();
// judgeRepository.updateMsResult(msMaincode, msSeq, msResult);
// } parkingRepository.updateMsResult(msMaincode, msSeq, msResult);
// });
// } // 거주자 장애인 심사
// } else {
// @Transactional(readOnly = true) cnt = gnReacallRepository.getJudgeStdCnt(msMaincode);
// public Map<String,Object> findDashboard(){ if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode();
// Map<String, Object> resultMap = new HashMap<>();
// resultMap.put("pBoardList", pBoardService.findAll(MinInfoBoard680.builder().build(), PageRequest.of(0, 7))); judgeRepository.updateMsResult(msMaincode, msSeq, msResult);
// 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; @Transactional(readOnly = true)
// } public Map<String,Object> findDashboard(){
// Map<String, Object> resultMap = new HashMap<>();
// private void setFileInfoAndFileUpload(GnRecallScDto dto, MultipartFile[] mfs, String setMethodName) { resultMap.put("pBoardList", pBoardService.findAll(MinInfoBoard680.builder().build(), PageRequest.of(0, 7)));
// String makePath = fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]); resultMap.put("parkJudgeList", parkingMapper.selectDashboardJudgeList());
// //makePath = makePath + File.separator; resultMap.put("residentJudgeList", residentAndDisabledMapper.selectDashboardJudgeList(CtgyConstants.Judge.DATAGB_RESIDENT.getCode()));
// resultMap.put("disabledJudgeList", residentAndDisabledMapper.selectDashboardJudgeList(CtgyConstants.Judge.DATAGB_DISABLED.getCode()));
// for(int idx = 0; idx < mfs.length; idx++){
// MultipartFile mf = mfs[idx]; return resultMap;
// try { }
// Method method = GnRecallScDto.class.getMethod(setMethodName + (idx+1), String.class);
// method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename())); private void setFileInfoAndFileUpload(GnRecallScDto dto, MultipartFile[] mfs, String setMethodName) {
// //method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename())); String makePath = fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]);
// } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { //makePath = makePath + File.separator;
// e.printStackTrace();
// } for(int idx = 0; idx < mfs.length; idx++){
// } MultipartFile mf = mfs[idx];
// } try {
// Method method = GnRecallScDto.class.getMethod(setMethodName + (idx+1), String.class);
// private void changeFileUpload(GnRecallScDto dto, MultipartFile[] mfs) { method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename()));
// fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]); //method.invoke(dto, StringUtils.cleanPath(makePath + mf.getOriginalFilename()));
// } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
// e.printStackTrace();
// }
// //--------------------------------------------------------------------------------- }
// // 심사자 }
// //---------------------------------------------------------------------------------
// @Override private void changeFileUpload(GnRecallScDto dto, MultipartFile[] mfs) {
// @Transactional(readOnly = true) fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]);
// public List<JudgeListDto> findByUserJudges(JudgeListDto dto) { }
// return gnReacallRepository.findByUserJudges(dto);
// }
// //---------------------------------------------------------------------------------
// @Override // 심사자
// @Transactional //---------------------------------------------------------------------------------
// public void saveJudgeResult(JudgeListDto dto){ @Override
// judgeUserRepository.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(), @Transactional(readOnly = true)
// dto.getMsuResult(), public List<JudgeListDto> findByUserJudges(JudgeListDto dto) {
// dto.getMsuReason(), return gnReacallRepository.findByUserJudges(dto);
// LocalDate.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))); }
// }
@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"))));
}
} }

@ -3,10 +3,8 @@ package com.xit.core.config;
import com.xit.biz.ctgy.auth.MinPasswordEncoder; import com.xit.biz.ctgy.auth.MinPasswordEncoder;
import com.xit.biz.ctgy.auth.service.impl.CustomMinOAuth2UserService; import com.xit.biz.ctgy.auth.service.impl.CustomMinOAuth2UserService;
import com.xit.biz.ctgy.auth.service.impl.CustomMinUserDetailsService; import com.xit.biz.ctgy.auth.service.impl.CustomMinUserDetailsService;
import com.xit.biz.ctgy.repository.IMinUserRepository; import com.xit.biz.ctgy.v2.repository.MinUserinfoDao;
import com.xit.biz.ctgy.v2.dao.MinUserinfoDao;
import com.xit.core.oauth2.api.dao.RefreshTokenDao; import com.xit.core.oauth2.api.dao.RefreshTokenDao;
import com.xit.core.oauth2.api.repository.RefreshTokenRepository;
import com.xit.core.oauth2.config.properties.AppProperties; import com.xit.core.oauth2.config.properties.AppProperties;
import com.xit.core.oauth2.config.properties.CorsProperties; import com.xit.core.oauth2.config.properties.CorsProperties;
import com.xit.core.oauth2.oauth.exception.RestAuthenticationEntryPoint; import com.xit.core.oauth2.oauth.exception.RestAuthenticationEntryPoint;

Loading…
Cancel
Save