feat: mpower 적용 - 자료관리

dev
Jonguk. Lim 2 years ago
parent 8371c2dd4d
commit 484d62b4e1

@ -0,0 +1,120 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.cmm.dto.CmmCodeDto;
import com.xit.biz.cmm.dto.ComboCodeDto;
import com.xit.biz.cmm.entity.CmmCodeGrp;
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
import com.xit.biz.ctgy.v2.service.ICmmCodeService;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Nonnull;
import java.util.List;
@Tag(name = "CmmCodeMgtController", description = "코드 관리")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/biz/cmm")
public class CmmCodeMgtController {
private final ICmmCodeService cmmCodeService;
@Operation(summary = "콤보코드조회" , description = "콤보코드를 조회")
@GetMapping(value="/combo", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findComboCodes(@Nonnull final CmmCodeSIds searchKeyDto) {
Assert.notNull(searchKeyDto, "조회할 콤보코드 대상이 없습니다.");
Assert.notNull(searchKeyDto.getCodeGrpId(), "조회할 대분류 코드를 선택해 주세요.");
List<ComboCodeDto> list = cmmCodeService.findComboCodes(searchKeyDto);
return RestResponse.of(list);
//return RestResponse.of(cmmCodeService.findComboCodes(searchKeyDto));
}
@Operation(summary = "코드그룹 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "codeGrpId", description = "코드그룹ID", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeNm", description = "코드그룹명", required = false, example = " "),
@Parameter(name = "codeCd", hidden = true),
@Parameter(name = "codeMeta1", hidden = true),
@Parameter(name = "codeMeta2", hidden = true),
@Parameter(name = "codeMeta3", hidden = true),
@Parameter(name = "codeMeta4", hidden = true),
@Parameter(name = "codeMeta5", hidden = true),
@Parameter(name = "createdBy", hidden = true),
@Parameter(name = "modifiedBy", hidden = true),
@Parameter(name = "createdDate", hidden = true),
@Parameter(name = "modifiedDate", hidden = true),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
//@Parameter(in = ParameterIn.QUERY, name = "sort", description = "정렬", required = true, example = "codeOrdr"),
})
@GetMapping(value="/grp", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findCmmCodeGrps(
@Parameter(hidden = true)
final CmmCodeDto codeDto,
@Parameter(hidden = true)
@Nonnull final Pageable pageable) {
return RestResponse.of(cmmCodeService.findCmmCodeGrps(codeDto, pageable));
}
@Operation(summary = "코드 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "codeGrpId", description = "코드그룹ID", required = true, example = "TRAFFIC"),
@Parameter(in = ParameterIn.QUERY, name = "codeLcd", description = "대분류코드", required = false, example = "GANGNAM_SIMSA"),
@Parameter(in = ParameterIn.QUERY, name = "codeMcd", description = "중분류코드", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeCd", description = "코드", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeNm", description = "코드명", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeMeta1", description = "코드메타1", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeMeta2", description = "코드메타2", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeMeta3", description = "코드메타3", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeMeta4", description = "코드메타4", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "codeMeta5", description = "코드메타5", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "createdBy", hidden = true),
@Parameter(in = ParameterIn.QUERY, name = "modifiedBy", hidden = true),
@Parameter(in = ParameterIn.QUERY, name = "createdDate", hidden = true),
@Parameter(in = ParameterIn.QUERY, name = "modifiedDate", hidden = true)
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findCmmCodes(@Parameter(hidden = true) @Nonnull final CmmCodeDto codeDto) {
return RestResponse.of(cmmCodeService.findCmmCodes(codeDto));
}
@Operation(summary = "코드그룹저장" , description = "코드그룹저장")
@PostMapping(value="/grp", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveCmmCodeGrp(@RequestBody @Nonnull CmmCodeGrp cmmCodeGrp) {
return RestResponse.of(cmmCodeService.saveCmmCodeGrp(cmmCodeGrp));
}
// @Operation(summary = "대분류코드저장" , description = "대분류코드저장")
// @PostMapping("/lcode")
// public ResponseEntity<? extends RestResponse> saveCmmCodeL(@RequestBody @Nonnull CmmCodeL cmmCodeL) {
// return RestResult.of(cmmCodeService.saveCmmCodeL(cmmCodeL));
// }
//
// @Operation(summary = "중분류코드저장" , description = "중분류코드저장")
// @PostMapping("/mcode")
// public ResponseEntity<? extends RestResponse> saveCmmCodeM(@RequestBody @Nonnull CmmCodeM cmmCodeM) {
// return RestResult.of(cmmCodeService.saveCmmCodeM(cmmCodeM));
// }
//
// @Operation(summary = "소분류코드저장" , description = "소분류코드저장")
// @PostMapping("/scode")
// public ResponseEntity<? extends RestResponse> saveCmmCodeS(@RequestBody @Nonnull CmmCodeS cmmCodeS) {
// return RestResult.of(cmmCodeService.saveCmmCodeS(cmmCodeS));
// }
@Operation(summary = "코드 저장")
@PostMapping
public ResponseEntity<? extends IRestResponse> saveCmmCode(@RequestBody @Nonnull CmmCodeDto cmmCodeDto) {
return RestResponse.of(cmmCodeService.saveCmmCode(cmmCodeDto));
}
}

@ -0,0 +1,141 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.v2.service.ICtgyFileService;
import com.xit.biz.ctgy.v2.service.IResidentAndDisabledService;
import com.xit.core.constant.ErrorCode;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.util.Checks;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
@Tag(name = "CmmFileController", description = "파일 관리")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/ctgy/cmm")
public class CmmFileController {
private final Environment env;
@Value("${file.cmm.upload.root:c:/data/file/upload}")
private String rootPath;
@Value("${file.cmm.upload.path:/kangnamSIM/simUpFile/}")
private String uploadPath;
@Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}")
private String[] judgeUploadPath;
@Value("${file.cmm.upload.url}")
private String serviceUrl;
private final ICtgyFileService ctgyFileService;
private final IResidentAndDisabledService judgeService;
@Operation(summary = "공지사항 파일 다운로드" , description = "공지사항 파일 다운로드")
@GetMapping("/download/{inCode}")
public void download(@PathVariable Long inCode, HttpServletResponse response) {
MinInfoBoard680Dto dto = ctgyFileService.findFiles(inCode);
String absFile = "";
if (Arrays.asList(env.getActiveProfiles()).contains("prod"))
absFile = dto.getInFileurl() + File.separator + dto.getInFilename();
else
absFile = rootPath + dto.getInFileurl().split(serviceUrl)[1] + File.separator + dto.getInFilename();
download(absFile, dto.getInFilename(), response);
}
@Operation(summary = "거주자/장애인 심사자료 파일 다운로드" , description = "거주자/장애인 심사자료 파일 다운로드")
@GetMapping("/download/judge")
public void download(@Nonnull final String scDatagb, @Nonnull final Long scCode, @Nonnull String methodName, HttpServletResponse response) {
GnRecallScDto savedDto = judgeService.findJudgeData(scCode);
String fileName = "";
try {
Method method = GnRecallScDto.class.getMethod(methodName);
fileName = String.valueOf(method.invoke(savedDto));
if(Checks.isEmpty(fileName)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
String absFile = "";
// TODO : 운영환경에 맞게 적용 필요
if (Arrays.asList(env.getActiveProfiles()).contains("prod"))
absFile = String.format("%s%s%s", "entity.getInFileurl()", File.separator, fileName);
else
absFile = String.format(
"%s%s%s%s",
rootPath,
(CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(scDatagb)? judgeUploadPath[0] : judgeUploadPath[1]),
File.separator, fileName);
download(absFile, fileName, response);
}
private void download(String absFile, String fileName, HttpServletResponse response) {
Path path = Paths.get(absFile);
String contentType = null;
long fileSize = 0L;
try {
contentType = Files.probeContentType(path);
fileSize = Files.size(path);
} catch (IOException e) {
//throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
contentType = "application/octet-stream";
//fileName = "FileNotFound";
}
File file = new File(absFile);
byte[] fileByte = new byte[0];
try {
fileByte = FileUtils.readFileToByteArray(file);
} catch (IOException e) {
fileByte = new byte[0];
//throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
}
response.setContentType(contentType);
response.setHeader(HttpHeaders.CONTENT_TYPE, contentType);
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(fileName, StandardCharsets.UTF_8) + "\";");
//response.setHeader(HttpHeaders.CONTENT_ENCODING, "binary");
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileSize));
try {
response.getOutputStream().write(fileByte);
response.getOutputStream().flush();
response.getOutputStream().close();
} catch (IOException e) {
throw new CustomBaseException(ErrorCode.FILE_NOT_FOUND);
}
}
}

@ -0,0 +1,28 @@
package com.xit.biz.ctgy.v2.repository;
import com.xit.biz.cmm.dto.ComboCodeDto;
import com.xit.biz.ctgy.dto.MinUserinfoDto;
import com.xit.core.config.database.BaseMpowerDaoSupport;
import com.xit.core.support.sql.parser.QueryGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;
@Repository
@Slf4j
public class CmmCodeDao extends BaseMpowerDaoSupport {
private static final String NAME_SPACE = "cmmCode";
public List<ComboCodeDto> queryComboCodeClass(@NotNull final String codeGrpId, @NotNull final String codeLcd, @NotNull final String codeMcd) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectComboCodes")
.setParameter("codeGrpId", codeGrpId)
.setParameter("codeLcd", codeLcd)
.setParameter("codeMcd", codeMcd)
.getQueryString();
return selectList(ComboCodeDto.class, sql, "code, value");
}
}

@ -1,5 +1,6 @@
package com.xit.biz.ctgy.v2.repository;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.entity.MinSimsaUser680Sc;
@ -18,6 +19,53 @@ import java.util.Map;
public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
private static final String NAME_SPACE = "residentAndDisabled";
public Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, @NotNull final Pageable pageable) {
final String cntSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeDataListCnt")
.setParameter("scDatagb", scDatagb)
.getQueryString();
final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeDataList")
.setParameter("scDatagb", scDatagb)
.setParameter("page", pageable.getPageNumber())
.setParameter("size", pageable.getPageSize())
.getQueryString();
final String fieldStrs = "scCode, scSeq, scCarnum, scDong, scName, scContDoc, scIngb, scDatagb, scCdate, scState, scContDocNm, scIngbNm, scStateNm";
return selectList(GnRecallScDto.class, listSql, cntSql, fieldStrs, pageable);
}
public GnRecallScDto findJudgeData(@NotNull final Long scCode) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeData")
.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, " +
"scFrecad1, scFrecad2, scFrecad3, scFrecad4, scPicad1, scPicad2, scPicad3, scPicad4, " +
"scContad1, scContad2, scContad3, scContad4, scContad5, scContad6, scContad7, scContad8, " +
"scContDocNm, scIngbNm, scTransferNm, scStateNm";
return selectOne(GnRecallScDto.class, sql, fieldStrs);
}
public void deleteJudgeData(@NotNull final Long scCode) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "deleteJudgeData")
.setParameter("scCode", scCode)
.getQueryString();
delete(sql);
}
public void saveJudgeData(@NotNull final GnRecallScDto dto, final String curYear){
insert(getJudgeDataSql("insertJudgeData", dto, curYear));
}
public void updateJudgeData(@NotNull final GnRecallScDto dto){
update(getJudgeDataSql("updateJudgeData", dto, ""));
}
public Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable) {
final String cntSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeListCnt")
.setParameter("msYear", dto.getMsYear())
@ -189,4 +237,42 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport {
.getQueryString();
delete(sql);
}
private String getJudgeDataSql(String sqlId, GnRecallScDto dto, final String curYear){
return QueryGenerator.createNamedQuery(NAME_SPACE, sqlId)
.setParameter("curYear", curYear)
.setParameter("scCode", dto.getScCode())
.setParameter("scCarNum", dto.getScCarnum())
.setParameter("scDong", dto.getScDong())
.setParameter("scName", dto.getScName())
.setParameter("scContDoc", dto.getScContDoc())
.setParameter("scIngb", dto.getScIngb())
.setParameter("scDatagb", dto.getScDatagb())
.setParameter("scCdate", dto.getScCdate())
.setParameter("scWdate", dto.getScWdate())
.setParameter("scJbtime", dto.getScJbtime())
.setParameter("scPos", dto.getScPos())
.setParameter("scZipcode1", dto.getZipcode1())
.setParameter("scZipcode2", dto.getZipcode2())
.setParameter("scJuso", dto.getScJuso())
.setParameter("scBunji", dto.getScBunji())
.setParameter("scFrecad1", dto.getScFrecad1())
.setParameter("scFrecad2", dto.getScFrecad2())
.setParameter("scFrecad3", dto.getScFrecad3())
.setParameter("scFrecad4", dto.getScFrecad4())
.setParameter("scPicad1", dto.getScPicad1())
.setParameter("scPicad2", dto.getScPicad2())
.setParameter("scPicad3", dto.getScPicad3())
.setParameter("scPicad4", dto.getScPicad4())
.setParameter("scContad1", dto.getScContad1())
.setParameter("scContad2", dto.getScContad2())
.setParameter("scContad3", dto.getScContad3())
.setParameter("scContad4", dto.getScContad4())
.setParameter("scContad5", dto.getScContad5())
.setParameter("scContad6", dto.getScContad6())
.setParameter("scContad7", dto.getScContad7())
.setParameter("scContad8", dto.getScContad8())
.getQueryString();
}
}

@ -0,0 +1,29 @@
package com.xit.biz.ctgy.v2.service;
import com.xit.biz.cmm.dto.CmmCodeDto;
import com.xit.biz.cmm.dto.ComboCodeDto;
import com.xit.biz.cmm.entity.CmmCodeGrp;
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* @author Lim, Jong Uk (minuk926)
* @since 2021-08-02
*/
public interface ICmmCodeService {
List<ComboCodeDto> findComboCodes(CmmCodeSIds searchKeyDto);
CmmCodeGrp saveCmmCodeGrp(CmmCodeGrp cmmCodeGrp);
// CmmCodeL saveCmmCodeL(CmmCodeL cmmCodeL);
// CmmCodeM saveCmmCodeM(CmmCodeM cmmCodeM);
// CmmCodeS saveCmmCodeS(CmmCodeS cmmCodeS);
Page<CmmCodeGrp> findCmmCodeGrps(CmmCodeDto cmmCodeDto, Pageable pageable);
List<?> findCmmCodes(CmmCodeDto cmmCodeDto);
Object saveCmmCode(CmmCodeDto cmmCodeDto);
}

@ -76,7 +76,7 @@ public interface IResidentAndDisabledService {
*/
void saveJudgeTargets(JudgeTargetDto dto);
void removeJudge(final JudgeListDto dto);
void removeJudge(@NotNull final JudgeListDto dto);
void saveJudgeStds(final JudgeStdDto dto);

@ -0,0 +1,170 @@
package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.cmm.dto.CmmCodeDto;
import com.xit.biz.cmm.dto.ComboCodeDto;
import com.xit.biz.cmm.dto.struct.CmmCodeGrpMapstruct;
import com.xit.biz.cmm.dto.struct.CmmCodeLMapstruct;
import com.xit.biz.cmm.dto.struct.CmmCodeMMapstruct;
import com.xit.biz.cmm.dto.struct.CmmCodeSMapstruct;
import com.xit.biz.cmm.entity.CmmCodeGrp;
import com.xit.biz.cmm.entity.CmmCodeL;
import com.xit.biz.cmm.entity.CmmCodeM;
import com.xit.biz.cmm.entity.CmmCodeS;
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
import com.xit.biz.cmm.repository.*;
import com.xit.biz.ctgy.v2.repository.CmmCodeDao;
import com.xit.biz.ctgy.v2.service.ICmmCodeService;
import com.xit.core.util.AssertUtils;
import com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mapstruct.factory.Mappers;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.List;
@Slf4j
@Service
@RequiredArgsConstructor
public class CmmCodeService implements ICmmCodeService {
private final ICmmCodeGrpRepository cmmCodeGrpRepository;
private final ICmmCodeLRepostory cmmCodeLRepository;
private final ICmmCodeMRepository cmmCodeMRepository;
private final ICmmCodeSRepository cmmCodeSRepository;
private final CmmCodeDao cmmCodeDao;
private CmmCodeGrpMapstruct codeGrpstruct = Mappers.getMapper(CmmCodeGrpMapstruct.class);
private CmmCodeLMapstruct codeLstruct = Mappers.getMapper(CmmCodeLMapstruct.class);
private CmmCodeMMapstruct codeMstruct = Mappers.getMapper(CmmCodeMMapstruct.class);
private CmmCodeSMapstruct codeSstruct = Mappers.getMapper(CmmCodeSMapstruct.class);
@Override
public List<ComboCodeDto> findComboCodes(CmmCodeSIds searchKeyDto) {
AssertUtils.isTrue(!Checks.isEmpty(searchKeyDto.getCodeGrpId()), "조회할 코드그룹을 선택해 주세요.");
// 소분류 코드 조회
if(StringUtils.hasText(searchKeyDto.getCodeMcd())){
AssertUtils.isTrue(!Checks.isEmpty(searchKeyDto.getCodeLcd()), "대분류 코드가 선택되지 않았습니다.");
List<ComboCodeDto> list = cmmCodeDao.queryComboCodeClass(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd());
//List<IComboCodeDto> list = cmmComboCodeRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd());
return list;
//return cmmCodeSRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd());
}
// 중분류 코드 조회
if(StringUtils.hasText(searchKeyDto.getCodeLcd())){
return cmmCodeMRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd());
}
// 대분류 코드 조회
return cmmCodeLRepository.queryComboCode(searchKeyDto.getCodeGrpId());
}
@Override
public Page<CmmCodeGrp> findCmmCodeGrps(CmmCodeDto cmmCodeDto, Pageable pageable) {
Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), sort);
Example<CmmCodeGrp> example = Example.of(codeGrpstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
return cmmCodeGrpRepository.findAll(example, pageable);
}
@Override
public List<?> findCmmCodes(CmmCodeDto cmmCodeDto) {
Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeGrpId()), "조회할 코드그룹을 선택해 주세요.");
// 소분류 코드 조회
if(StringUtils.hasText(cmmCodeDto.getCodeMcd())){
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeLcd()), "대분류 코드가 선택되지 않았습니다.");
Example<CmmCodeS> example = Example.of(codeSstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
return cmmCodeSRepository.findAll(example, sort);
}
// 중분류 코드 조회
if(StringUtils.hasText(cmmCodeDto.getCodeLcd())){
Example<CmmCodeM> example = Example.of(codeMstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
return cmmCodeMRepository.findAll(example, sort);
}
// 대분류 코드 조회
Example<CmmCodeL> example = Example.of(codeLstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
return cmmCodeLRepository.findAll(example, sort);
}
@Override
@Transactional
public CmmCodeGrp saveCmmCodeGrp(CmmCodeGrp cmmCodeGrp) {
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeGrpId()), "코드 그룹을 입력해 주세요.");
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeNm()), "코드 그룹명 입력해 주세요.");
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
return cmmCodeGrpRepository.save(cmmCodeGrp);
}
// @Override
// @Transactional
// public CmmCodeL saveCmmCodeL(CmmCodeL cmmCodeL) {
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeGrpId()), "코드 그룹을 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeCd()), "대분류 코드를 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeNm()), "대분류 코드명 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
// return cmmCodeLRepository.save(cmmCodeL);
// }
//
// @Override
// @Transactional
// public CmmCodeM saveCmmCodeM(CmmCodeM cmmCodeM) {
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeGrpId()), "코드 그룹을 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeLcd()), "대분류 코드를 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeCd()), "중분류 코드를 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeNm()), "중분류 코드명 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
// return cmmCodeMRepository.save(cmmCodeM);
// }
//
// @Override
// @Transactional
// public CmmCodeS saveCmmCodeS(CmmCodeS cmmCodeS) {
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeGrpId()), "코드그룹을 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeLcd()), "대분류 코드를 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeMcd()), "중분류 코드를 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeCd()), "소분류 코드를 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeNm()), "소분류 코드명 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
// return cmmCodeSRepository.save(cmmCodeS);
// }
// private void validate(Class<?> clz){
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeGrpId()), "코드그룹을 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeCd()), "대분류코드를 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeNm()), "대분류코드명 입력해 주세요.");
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeOrdr()), "정렬순서를 입력해 주세요.");
// }
@Transactional
@Override
public Object saveCmmCode(CmmCodeDto cmmCodeDto) {
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeGrpId()), "코드그룹을 입력해 주세요.");
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeCd()), "코드를 입력해 주세요.");
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeNm()), "코드명을 입력해 주세요.");
// 소분류 코드
if(StringUtils.hasText(cmmCodeDto.getCodeMcd())){
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeLcd()), "대분류 코드를 입력해 주세요.");
return cmmCodeSRepository.save(codeSstruct.toEntity(cmmCodeDto));
}
// 중분류 코드
if(StringUtils.hasText(cmmCodeDto.getCodeLcd())){
return cmmCodeMRepository.save(codeMstruct.toEntity(cmmCodeDto));
}
// 대분류 코드
return cmmCodeLRepository.save(codeLstruct.toEntity(cmmCodeDto));
}
}

@ -1,7 +1,6 @@
package com.xit.biz.ctgy.v2.service.impl;
import com.xit.biz.ctgy.dto.MinInfoBoard680Dto;
import com.xit.biz.ctgy.entity.MinInfoBoard680;
import com.xit.biz.ctgy.v2.repository.PublicBoardDao;
import com.xit.biz.ctgy.v2.service.ICtgyFileService;
import com.xit.core.util.AssertUtils;
@ -152,10 +151,4 @@ public class CtgyFileService implements ICtgyFileService {
}
}
private void setEntity(MinInfoBoard680 savedEntity, MinInfoBoard680Dto dto){
savedEntity.setInDept(dto.getInDept());
savedEntity.setInTitle(dto.getInTitle());
savedEntity.setInContents(dto.getInContents());
}
}

@ -80,16 +80,16 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
public Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) {
// Sort sort = Sort.by(Sort.Direction.DESC, "inCode");
pageable = JpaUtil.getPagingInfo(pageable);
return gnReacallRepository.findJudgeDatas(
scDatagb,
PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending()));
// List<CmmUser> userList = page.getContent();
// return gnReacallRepository.findJudgeDatas(
// scDatagb,
// PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending()));
return residentAndDisabledDao.findJudgeDatas(scDatagb, pageable);
}
@Override
@Transactional(readOnly = true)
public GnRecallScDto findJudgeData(final Long scCode) {
return gnReacallRepository.findJudgeData(scCode);
public GnRecallScDto findJudgeData(@NotNull final Long scCode) {
return residentAndDisabledDao.findJudgeData(scCode);
}
@Override
@ -116,20 +116,19 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
// 신규
if (isNew) {
// 접수번호 채번 : 년도 + seq 10자리
dto.setScSeq(gnReacallRepository.getGnRecallScMaxScSeq(String.valueOf(DateUtil.getCurrentYear()), CtgyConstants.Judge.DATAGB_RESIDENT.getCode()));
entity = mapstruct.toEntity(dto);
//dto.setScSeq(gnReacallRepository.getGnRecallScMaxScSeq(String.valueOf(DateUtil.getCurrentYear()), dto.getScDatagb()));
residentAndDisabledDao.saveJudgeData(dto, String.valueOf(DateUtil.getCurrentYear()));
}else{
entity = mapstruct.toEntity(dto);
residentAndDisabledDao.updateJudgeData(dto);
}
gnReacallRepository.save(entity);
}
@Override
@Transactional
public void removeJudgeData(final Long scCode){
gnReacallRepository.deleteById(scCode);
public void removeJudgeData(@NotNull final Long scCode){
residentAndDisabledDao.deleteJudgeData(scCode);
}
@Override

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings namespace="cmmCode">
<native-query id="selectComboCodes">
/* refreshToken-mapper|selectComboCodes|julim */
SELECT code_cd as code,
, code_nm as value
FROM tb_cmm_code_s
WHERE code_grp_id = #{codeGrpId}
AND code_lcd = #{codeLcd}
AND code_mcd = #{codeMcd}
AND use_yn = 'Y'
ORDER BY code_ordr
</native-query>
</entity-mappings>

@ -307,7 +307,7 @@
WHERE TR.rc_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 rcIngbNm
FROM tf680_main TM
, tf680_recall TR
WHERE TM.mm_code = TR.rc_maincode

@ -1,6 +1,249 @@
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings namespace="residentAndDisabled">
/* -------------------- 자료관리 ------------------------- */
<native-query id="selectJudgeDataList">
/* residentAndDisabled-mapper|selectJudgeDataList|julim */
SELECT GRS.sc_code,
GRS.sc_seq,
GRS.sc_carnum,
GRS.sc_dong,
GRS.sc_name,
GRS.sc_cont_doc,
GRS.sc_ingb,
GRS.sc_datagb,
GRS.sc_cdate,
GRS.sc_state,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRS.sc_cont_doc = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'SC_CONT_DOC') as scContDocNm,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRS.sc_ingb = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RC_INGB') as scIngbNm,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRS.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 (
SELECT sc_code
FROM (
SELECT R.sc_code, ROWNUM rn
FROM (
SELECT sc_code
FROM gn_recall_sc
WHERE sc_datagb = #{scDatagb}
ORDER BY sc_code desc
) R
WHERE ROWNUM &lt;= (#{page} + 1) * #{size}
)
WHERE rn &gt; #{page} * #{size}
AND ROWNUM &lt;= #{size}
)
ORDER BY GRS.sc_code DESC
</native-query>
<native-query id="selectJudgeDataListCnt">
/* residentAndDisabled-mapper|selectJudgeDataListCnt|julim */
SELECT count(sc_code) as totalCount
FROM gn_recall_sc
WHERE sc_datagb = #{scDatagb}
</native-query>
<native-query id="selectJudgeData">
/* residentAndDisabled-mapper|selectJudgeData|julim */
SELECT GRS.sc_code,
GRS.sc_seq,
GRS.sc_carnum,
GRS.sc_dong,
GRS.sc_name,
GRS.sc_cont_doc,
GRS.sc_ingb,
GRS.sc_datagb,
GRS.sc_cdate,
GRS.sc_state,
GRS.sc_wdate,
GRS.sc_jbtime,
GRS.sc_pos,
GRS.sc_transfer,
GRS.sc_answer,
GRS.sc_zipcode1,
GRS.sc_zipcode2,
GRS.sc_juso,
GRS.sc_bunji,
GRS.sc_frecad1,
GRS.sc_frecad2,
GRS.sc_frecad3,
GRS.sc_frecad4,
GRS.sc_picad1,
GRS.sc_picad2,
GRS.sc_picad3,
GRS.sc_picad4,
GRS.sc_contad1,
GRS.sc_contad2,
GRS.sc_contad3,
GRS.sc_contad4,
GRS.sc_contad5,
GRS.sc_contad6,
GRS.sc_contad7,
GRS.sc_contad8,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRS.sc_cont_doc = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'SC_CONT_DOC') as scContDocNm,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRS.sc_ingb = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'RC_INGB') as scIngbNm,
(SELECT code_nm
FROM tb_cmm_code_s
WHERE GRS.sc_transfer = code_cd
AND code_grp_id = 'TRAFFIC'
AND code_lcd = 'GANGNAM_SIMSA'
AND code_mcd = 'SC_TRANSFER') as scTransferNm,
(SELECT code_nm
FROM tb_cmm_code_s
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.sc_code = #{scCode}
</native-query>
<native-query id="deleteJudgeData">
/* residentAndDisabled-mapper|deleteJudgeData|julim */
DELETE
FROM gn_recall_sc
WHERE sc_code = #{scCode}
</native-query>
<native-query id="insertJudgeData">
/* residentAndDisabled-mapper|insertJudgeData|julim */
INSERT
INTO gn_recall_sc (
sc_code,
sc_seq,
sc_carnum,
sc_dong,
sc_name,
sc_cont_doc,
sc_ingb,
sc_datagb,
sc_cdate,
sc_wdate,
sc_jbtime,
sc_pos,
sc_zipcode1,
sc_zipcode2,
sc_juso,
sc_bunji,
sc_frecad1,
sc_frecad2,
sc_frecad3,
sc_frecad4,
sc_picad1,
sc_picad2,
sc_picad3,
sc_picad4,
sc_contad1,
sc_contad2,
sc_contad3,
sc_contad4,
sc_contad5,
sc_contad6,
sc_contad7,
sc_contad8
) VALUES (
gn_recall_sc_seq.NEXTVAL,
(SELECT RPAD(NVL(MAX(e.sc_seq), '2022'), 10, '0') + 1
FROM gn_recall_sc e
WHERE e.sc_datagb = #{scDatagb}
AND e.sc_seq LIKE #{curYear} ||'%'),
#{scCarnum},
#{scDong},
#{scName},
#{scContDoc},
#{scIngb},
#{scDatagb},
#{scCdate},
#{scWdate},
#{scJbtime},
#{scPos},
#{scZipcode1},
#{scZipcode2},
#{scJuso},
#{scBunji},
#{scFrecad1},
#{scFrecad2},
#{scFrecad3},
#{scFrecad4},
#{scPicad1},
#{scPicad2},
#{scPicad3},
#{scPicad4},
#{scContad1},
#{scContad2},
#{scContad3},
#{scContad4},
#{scContad5},
#{scContad6},
#{scContad7},
#{scContad8}
)
</native-query>
<native-query id="updateJudgeData">
/* residentAndDisabled-mapper|updateJudgeData|julim */
UPDATE gn_recall_sc
SET sc_carnum = #{scCarnum}
, sc_dong = #{scDong}
, sc_name = #{scName}
, sc_cont_doc = #{scContDoc}
, sc_ingb = #{scIngb}
, sc_datagb = #{scDatagb}
, sc_cdate = #{scCdate}
, sc_wdate = #{scWdate}
, sc_jbtime = #{scJbtime}
, sc_pos = #{scPos}
, sc_zipcode1 = #{scZipcode1}
, sc_zipcode2 = #{scZipcode2}
, sc_juso = #{scJuso}
, sc_bunji = #{scBunji}
, sc_frecad1 = NVL(#{scFrecad1}, sc_frecad1)
, sc_frecad2 = NVL(#{scFrecad2}, sc_frecad2)
, sc_frecad3 = NVL(#{scFrecad3}, sc_frecad3)
, sc_frecad4 = NVL(#{scFrecad4}, sc_frecad4)
, sc_picad1 = NVL(#{scPicad1}, sc_picad1)
, sc_picad2 = NVL(#{scPicad2}, sc_picad2)
, sc_picad3 = NVL(#{scPicad3}, sc_picad3)
, sc_picad4 = NVL(#{scPicad4}, sc_picad4)
, sc_contad1 = NVL(#{scContad1}, sc_contad1)
, sc_contad2 = NVL(#{scContad2}, sc_contad2)
, sc_contad3 = NVL(#{scContad3}, sc_contad3)
, sc_contad4 = NVL(#{scContad4}, sc_contad4)
, sc_contad5 = NVL(#{scContad5}, sc_contad5)
, sc_contad6 = NVL(#{scContad6}, sc_contad6)
, sc_contad7 = NVL(#{scContad7}, sc_contad7)
, sc_contad8 = NVL(#{scContad8}, sc_contad8)
WHERE sc_code = #{scCode}
</native-query>
/* -------------------- 심의목록 ------------------------- */
<native-query id="selectJudgeList">
/* residentAndDisabled-mapper|selectJudgeList|julim */
SELECT ms_year,
@ -10,7 +253,7 @@
ms_edate,
ms_cdate,
ms_closesi,
ms_datagb
ms_datagb,
cnt
FROM (
SELECT R.*, ROWNUM rn
@ -152,7 +395,7 @@
#{msuCode}
#{msuResult},
#{msuTeam},
#{msuUserid},
#{msuUserid}
)
</native-query>
@ -313,7 +556,7 @@
WHERE GRC.rc_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 rcIngbNm
FROM gn_recall_sc GRC
WHERE GRC.sc_datagb = #{scDatagb}
AND GRC.sc_state = '1'

Loading…
Cancel
Save