refactor: 거주자/장애인 의견진술 심의 모둘 공통화 진행

dev
Lim Jonguk 3 years ago
parent fb3b8beefd
commit 571811aa41

@ -1,10 +1,10 @@
package com.xit.biz.ctgy.controller;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.ResidentTargetDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct;
import com.xit.biz.ctgy.service.IResidentService;
import com.xit.biz.ctgy.service.IResidentAndDisabledService;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import com.xit.core.util.AssertUtils;
@ -26,51 +26,55 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Nonnull;
import javax.validation.Valid;
@Tag(name = "ResidentController", description = "거주자의견진술 관리")
/**
* /
* : scDatagb = "1"
* : scDatagb = "2"
*/
@Tag(name = "ResidentAndDisabledController", description = "거주자/장애인 의견진술 관리")
@RestController
@RequestMapping("/api/v1/ctgy/resident")
@RequestMapping("/api/v1/ctgy/judge")
@Validated
@RequiredArgsConstructor
public class ResidentController {
public class ResidentAndDisabledController {
private final IResidentService service;
private final IResidentAndDisabledService service;
private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class);
// TODO :: 파라메터 정의 필요
@Operation(summary = "거주자의견지술자료 목록 조회" , description = "거주자의견진술자료 목록 조회")
@Operation(summary = "거주자/장애인 의견지술자료 목록 조회" , description = "거주자/장애인 의견진술자료 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(value="/data", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findResidentDatas(
public ResponseEntity<? extends IRestResponse> findJudgeDatas(
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findResidentDatas(pageable));
}
return RestResponse.of(service.findJudgeDatas(pageable)); }
@Operation(summary = "거주자 의견진술 자료 등록", description = "거주자 의견진술 자료 등록")
@Operation(summary = "거주자/장애인 의견진술 자료 등록", description = "거주자/장애인 의견진술 자료 등록")
@PostMapping(value = "/data", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<? extends IRestResponse> saveResidentData(@Nonnull GnRecallScDto dto) {
public ResponseEntity<? extends IRestResponse> saveJudgeData(@Nonnull GnRecallScDto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "등록할 거주자 의견진술 자료가 존재하지 않습니다.");
service.saveResidentData(dto);
service.saveJudgeData(dto);
//service.saveResidentData(mapstruct.toEntity(dto), dto.getPicadFiles(), dto.getFrecadFiles(), dto.getContadFiles());
return RestResponse.of(HttpStatus.OK);
// return RestResponse.of(HttpStatus.OK);
}
@Operation(summary = "거주자의견진술 상세" , description = "거주자의견진술 상세")
@Operation(summary = "거주자/장애인 의견진술 자료 상세" , description = "거주자/장애인 의견진술 자료 상세")
@Parameters({
@Parameter(in = ParameterIn.PATH, name = "scCode", description = "의견진술번호", required = true, example = "3778"),
})
@GetMapping(value = "/{scCode}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findResident(@PathVariable final Long scCode) {
return RestResponse.of(service.findResidentData(scCode));
@GetMapping(value = "/data/{scCode}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findJudgeData(@PathVariable final Long scCode) {
return RestResponse.of(service.findJudgeData(scCode));
}
@Operation(summary = "거주자 의견진술 심의대상 조회" , description = "거주자 의견진술 심의대상 조회")
@Operation(summary = "거주자/장애인 의견진술 심의대상 조회" , description = "거주자/장애인 의견진술 심의대상 조회")
@GetMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE)
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "scDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1"),
@ -78,22 +82,22 @@ public class ResidentController {
@Parameter(in = ParameterIn.QUERY, name = "scSeq1", description = "접수번호-시작", required = true, example = "2022200801"),
@Parameter(in = ParameterIn.QUERY, name = "scSeq2", description = "접수번호-종료", required = true, example = "2022200899"),
})
public ResponseEntity<? extends IRestResponse> findResidentJudgeTargets(@Parameter(hidden = true) final ResidentTargetDto dto){
return RestResponse.of(service.findResidentJudgeTargets(dto));
public ResponseEntity<? extends IRestResponse> findResidentJudgeTargets(@Parameter(hidden = true) final JudgeTargetDto dto){
return RestResponse.of(service.findJudgeTargets(dto));
}
@Operation(summary = "거주자 의견진술 심의대상 등록" , description = "거주자 의견진술 심의대상 등록")
@Operation(summary = "거주자/징애인 의견진술 심의대상 등록" , description = "거주자/장애인 의견진술 심의대상 등록")
@PostMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveResidentJudgeTargets(
public ResponseEntity<? extends IRestResponse> saveJudgeTargets(
@Valid
@RequestBody
final ResidentTargetDto dto) {
service.saveResidentJudgeTargets(dto);
final JudgeTargetDto dto) {
service.saveJudgeTargets(dto);
//service.saveParkingSimsaJudgeTargets(dto);
return RestResponse.of(HttpStatus.OK);
}
@Operation(summary = "거주자 의견진술 심의 목록" , description = "거주자 의견진술 심의 목록")
@Operation(summary = "거주자/장애인 의견진술 심의목록 조회" , description = "거주자/장애인 의견진술 심의목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "scYear", description = "심사년도", required = true, example = "2021"),
@Parameter(in = ParameterIn.QUERY, name = "scChasu", description = "차수", required = false, example = " "),
@ -108,7 +112,7 @@ public class ResidentController {
final JudgeListDto dto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findResidents(dto, pageable));
return RestResponse.of(service.findJudges(dto, pageable));
}
}

@ -16,25 +16,25 @@ public class GnRecallScDto {
@Schema(required = true, title = " ", example = " ", description = " ")
private Long scCode;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "접수번호", example = " ", description = " ")
private Long scSeq;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "차량번호", example = " ", description = " ")
private String scCarnum;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "이름", example = " ", description = " ")
private String scName;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scDong;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "진술유형코드", example = " ", description = "진술유형코드")
private String scContDoc;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "접수일자", example = " ", description = "접수일자")
private String scCdate;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "접수방법코드", example = " ", description = "접수방법코드")
private String scIngb;
@Schema(required = true, title = " ", example = " ", description = " ")
@ -46,7 +46,7 @@ public class GnRecallScDto {
@Schema(required = true, title = " ", example = " ", description = " ")
private String scPos;
@Schema(title = " ", example = " ", description = " ")
@Schema(title = "진술서파일1", example = " ", description = " ")
private String scFrecad1;
@Schema(title = " ", example = " ", description = " ")
@ -58,7 +58,7 @@ public class GnRecallScDto {
@Schema(title = " ", example = " ", description = " ")
private String scFrecad4;
@Schema(title = " ", example = " ", description = " ")
@Schema(title = "첨부자료1", example = " ", description = " ")
private String scContad1;
@Schema(title = " ", example = " ", description = " ")
@ -82,7 +82,7 @@ public class GnRecallScDto {
@Schema(title = " ", example = " ", description = " ")
private String scContad8;
@Schema(title = " ", example = " ", description = " ")
@Schema(title = "단속사진1", example = " ", description = " ")
private String scPicad1;
@Schema(title = " ", example = " ", description = " ")
@ -118,13 +118,13 @@ public class GnRecallScDto {
@Schema(title = " ", example = " ", description = " ")
private String scBunji;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "진술유형코드명", example = " ", description = "진술유형코드명")
private String scContDocNm;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "접수방법코드명", example = " ", description = "접수방법코드명")
private String scIngbNm;
@Schema(required = true, title = " ", example = " ", description = " ")
@Schema(required = true, title = "전송여부", example = " ", description = "전송여부")
private String scTransferNm;
@Schema(required = true, title = " ", example = " ", description = " ")
@ -138,6 +138,4 @@ public class GnRecallScDto {
@Schema(required = false, title = "첨부자료파일", example = " ", description = "첨부자료파일")
private MultipartFile[] contadFiles;
}

@ -6,7 +6,6 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDate;
import java.util.List;
@ -16,7 +15,7 @@ import java.util.List;
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class ResidentTargetDto {
public class JudgeTargetDto {
@Schema(title = "메인코드", example = " ", description = "메인코드")
private Long scCode;
@ -48,7 +47,7 @@ public class ResidentTargetDto {
private String scTransfer;
@Schema(title = "데이타구분", example = "1", description = "데이타구분: 1-거주자,2-장애인")
private String scDatagb = "1";
private String scDatagb;
//------------------------------------------------------------------
// 심사대상 저장을 위한 속성

@ -1,126 +0,0 @@
package com.xit.biz.ctgy.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Schema(name = "GnRecallScDto", description = "")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class ResidentDto {
@Schema(required = true, title = " ", example = " ", description = " ")
private Long scCode;
@Schema(required = true, title = "접수번호", example = " ", description = " ")
private Long scSeq;
@Schema(required = true, title = "차량번호", example = " ", description = " ")
private String scCarnum;
@Schema(required = true, title = "이름", example = " ", description = " ")
private String scName;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scDong;
@Schema(required = true, title = "진술유형코드", example = " ", description = "진술유형코드")
private String scContDoc;
@Schema(required = true, title = "진술유형코드명", example = " ", description = "진술유형코드명")
private String scContDocNm;
@Schema(required = true, title = "접수일자", example = " ", description = "접수일자")
private String scCdate;
@Schema(required = true, title = "접수방법코드", example = " ", description = "접수방법코드")
private String scIngb;
@Schema(required = true, title = "접수방법코드명", example = " ", description = "접수방법코드명")
private String scIngbNm;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scWdate;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scJbtime;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scPos;
@Schema(title = " ", example = " ", description = " ")
private String scFrecad1;
@Schema(title = " ", example = " ", description = " ")
private String scFrecad2;
@Schema(title = " ", example = " ", description = " ")
private String scFrecad3;
@Schema(title = " ", example = " ", description = " ")
private String scFrecad4;
@Schema(title = " ", example = " ", description = " ")
private String scContad1;
@Schema(title = " ", example = " ", description = " ")
private String scContad2;
@Schema(title = " ", example = " ", description = " ")
private String scContad3;
@Schema(title = " ", example = " ", description = " ")
private String scContad4;
@Schema(title = " ", example = " ", description = " ")
private String scContad5;
@Schema(title = " ", example = " ", description = " ")
private String scContad6;
@Schema(title = " ", example = " ", description = " ")
private String scContad7;
@Schema(title = " ", example = " ", description = " ")
private String scContad8;
@Schema(title = " ", example = " ", description = " ")
private String scPicad1;
@Schema(title = " ", example = " ", description = " ")
private String scPicad2;
@Schema(title = " ", example = " ", description = " ")
private String scPicad3;
@Schema(title = " ", example = " ", description = " ")
private String scPicad4;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scTransfer;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scDatagb;
@Schema(title = " ", example = " ", description = " ")
private String scAnswer;
@Schema(required = true, title = " ", example = " ", description = " ")
private String scState;
@Schema(title = " ", example = " ", description = " ")
private String zipcode1;
@Schema(title = " ", example = " ", description = " ")
private String zipcode2;
@Schema(title = " ", example = " ", description = " ")
private String scJuso;
@Schema(title = " ", example = " ", description = " ")
private String scBunji;
}

@ -0,0 +1,11 @@
package com.xit.biz.ctgy.mapper;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface IResidentAndDisabledMapper {
void insertJudgeTargetIntoSelect(JudgeTargetDto dto);
}

@ -1,11 +0,0 @@
package com.xit.biz.ctgy.mapper;
import com.xit.biz.ctgy.dto.ResidentTargetDto;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface IResidentMapper {
void insertResidentJudgeTargetIntoSelect(ResidentTargetDto dto);
}

@ -5,12 +5,29 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
public interface IResidentRepository extends JpaRepository<GnRecallSc, Long>, IResidentRepositoryCustom {
/**
* /
* : scDatagb = "1"
* : scDatagb = "2"
*/
public interface IResidentAndDisabledRepository extends JpaRepository<GnRecallSc, Long>, IResidentAndDisabledRepositoryCustom {
// TODO : Ansi - sql 미사용, 채번테이블 사용하도록 변경 필요
//@Query(value = "SELECT max(e.sc_code) + 1 FROM gn_recall_sc e, nativeQuery = true)
/**
* /
* @param year String
* @param scDatagb String
* @return Long
*/
@Query(value = "SELECT rpad(nvl(max(e.sc_seq), :year), 10, '0') + 1 FROM gn_recall_sc e WHERE e.sc_datagb = :scDatagb AND e.sc_seq LIKE :year||'%' ", nativeQuery = true)
Long getGnRecallScMaxScSeq(@Param("year") String year, @Param("scDatagb") String scDatagb);
/**
*
* @param scCode
* @return
*/
GnRecallSc findByScCode(final Long scCode);
}

@ -0,0 +1,47 @@
package com.xit.biz.ctgy.repository;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* /
* : scDatagb = "1"
* : scDatagb = "2"
*/
public interface IResidentAndDisabledRepositoryCustom {
/**
* /
* @param pageable Pageable
* @return Page<GnRecallScDto>
*/
Page<GnRecallScDto> findJudgeDatas(Pageable pageable);
/**
* /
* @param scCode Long
* @return GnRecallScDto
*/
GnRecallScDto findJudgeData(final Long scCode);
/**
* /
* @param dto JudgeListDto
* @param pageable Pageable
* @return Page<JudgeListDto>
*/
Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable);
/**
* /
* @param dto JudgeTargetDto
* @return List<JudgeTargetDto>
*/
List<JudgeTargetDto> findJudgeTargets(final JudgeTargetDto dto);
}

@ -8,8 +8,9 @@ import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.*;
import com.xit.biz.ctgy.entity.GnRecallSc;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
@ -22,16 +23,19 @@ import java.util.List;
import static com.xit.biz.cmm.entity.QCmmCodeS.cmmCodeS;
import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc;
import static com.xit.biz.ctgy.entity.QMinSimsa680Sc.minSimsa680Sc;
import static com.xit.biz.ctgy.entity.QTf680Main.tf680Main;
import static com.xit.biz.ctgy.entity.QTf680Recall.tf680Recall;
/**
* /
* : scDatagb = "1"
* : scDatagb = "2"
*/
@RequiredArgsConstructor
public class IResidentRepositoryImpl implements IResidentRepositoryCustom {
public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledRepositoryCustom {
private final JPAQueryFactory queryFactory;
@Override
public Page<GnRecallScDto> findResidentDatas(Pageable pageable) {
public Page<GnRecallScDto> findJudgeDatas(Pageable pageable) {
// 커버링 인덱스로 대상 조회
QueryResults<Long> scCodeList = queryFactory
@ -84,7 +88,7 @@ public class IResidentRepositoryImpl implements IResidentRepositoryCustom {
}
@Override
public GnRecallScDto findResident(final Long scCode) {
public GnRecallScDto findJudgeData(final Long scCode) {
BooleanBuilder builder = new BooleanBuilder();
builder.and(gnRecallSc.scDatagb.eq(CtgyConstants.Judge.DATAGB_RESIDENT.getCode()));
builder.and(gnRecallSc.scCode.eq(scCode));
@ -173,7 +177,7 @@ AND SC_CODE =
}
@Override
public Page<JudgeListDto> findResidents(final JudgeListDto dto, Pageable pageable) {
public Page<JudgeListDto> findJudges(final JudgeListDto dto, Pageable pageable) {
BooleanBuilder builder = new BooleanBuilder();
if (!Checks.isEmpty(dto.getMsYear())) {
@ -212,7 +216,7 @@ AND SC_CODE =
}
@Override
public List<ResidentTargetDto> findResidentJudgeTargets(final ResidentTargetDto dto) {
public List<JudgeTargetDto> findJudgeTargets(final JudgeTargetDto dto) {
// 자료상태 : 1-접수
String stateCond = CtgyConstants.Judge.DATA_STATE_RECEIPT.getCode();
@ -220,9 +224,9 @@ AND SC_CODE =
return queryReultResidentJudgeTargets(dto.getScDatagb(), stateCond, dto.getScTransfer(), dto.getScSeq1(), dto.getScSeq2());
}
private List<ResidentTargetDto> queryReultResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){
private List<JudgeTargetDto> queryReultResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){
return queryFactory
.select(Projections.fields(ResidentTargetDto.class,
.select(Projections.fields(JudgeTargetDto.class,
gnRecallSc.scCode,
gnRecallSc.scSeq,
gnRecallSc.scCarnum,

@ -1,20 +0,0 @@
package com.xit.biz.ctgy.repository;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ResidentTargetDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface IResidentRepositoryCustom {
Page<GnRecallScDto> findResidentDatas(Pageable pageable);
GnRecallScDto findResident(final Long scCode);
Page<JudgeListDto> findResidents(JudgeListDto dto, Pageable pageable);
List<ResidentTargetDto> findResidentJudgeTargets(final ResidentTargetDto dto);
}

@ -0,0 +1,58 @@
package com.xit.biz.ctgy.service;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* /
* : scDatagb = "1"
* : scDatagb = "2"
*/
public interface IResidentAndDisabledService {
/**
* /
* @param pageable Pageable
* @return Page<GnRecallScDto>
*/
Page<GnRecallScDto> findJudgeDatas(Pageable pageable);
/**
* /
* @param scCode Long
* @return GnRecallScDto
*/
GnRecallScDto findJudgeData(final Long scCode);
//Page<GnRecallSc> findAll(final GnRecallSc entity, Pageable pageable);
// 심의자료 저장
/**
* /
* @param entity GnRecallScDto
*/
void saveJudgeData(GnRecallScDto entity);
/**
* /
* @param dto JufgeTargetDto
* @return List<JudgeTargetDto>
*/
List<JudgeTargetDto> findJudgeTargets(final JudgeTargetDto dto) ;
void saveJudgeTargets(JudgeTargetDto dto);
/**
* /
* @param dto JudgeListDto
* @param pageable Pageable
* @return Page<JudgeListDto>
*/
Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable);
}

@ -1,25 +0,0 @@
package com.xit.biz.ctgy.service;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.ResidentTargetDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface IResidentService {
Page<GnRecallScDto> findResidentDatas(Pageable pageable);
GnRecallScDto findResidentData(final Long scCode);
//Page<GnRecallSc> findAll(final GnRecallSc entity, Pageable pageable);
void saveResidentData(GnRecallScDto entity);
List<ResidentTargetDto> findResidentJudgeTargets(final ResidentTargetDto dto) ;
void saveResidentJudgeTargets(ResidentTargetDto dto);
Page<JudgeListDto> findResidents(JudgeListDto dto, Pageable pageable);
}

@ -3,20 +3,27 @@ package com.xit.biz.ctgy.service.impl;
import com.xit.biz.cmm.service.ICmmFileService;
import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.GnRecallScDto;
import com.xit.biz.ctgy.dto.ResidentTargetDto;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.JudgeTargetDto;
import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct;
import com.xit.biz.ctgy.entity.*;
import com.xit.biz.ctgy.mapper.IResidentMapper;
import com.xit.biz.ctgy.repository.*;
import com.xit.biz.ctgy.service.IResidentService;
import com.xit.biz.ctgy.entity.GnRecallSc;
import com.xit.biz.ctgy.entity.MinSimsaUser680;
import com.xit.biz.ctgy.entity.MinUserinfo;
import com.xit.biz.ctgy.mapper.IResidentAndDisabledMapper;
import com.xit.biz.ctgy.repository.IJudgeUserRepository;
import com.xit.biz.ctgy.repository.IMinUserRepository;
import com.xit.biz.ctgy.repository.IResidentAndDisabledRepository;
import com.xit.biz.ctgy.service.IResidentAndDisabledService;
import com.xit.core.support.jpa.JpaUtil;
import com.xit.core.util.DateUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mapstruct.factory.Mappers;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
@ -31,7 +38,7 @@ import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Slf4j
public class ResidentService implements IResidentService {
public class ResidentAndDisabledService implements IResidentAndDisabledService {
@Value("${file.cmm.upload.root:c:/data/file/upload}")
private String rootPath;
@ -39,7 +46,7 @@ public class ResidentService implements IResidentService {
@Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}")
private String[] uploadPath;
private final IResidentRepository repository;
private final IResidentAndDisabledRepository repository;
private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class);
private final ICmmFileService fileService;
@ -47,45 +54,27 @@ public class ResidentService implements IResidentService {
private final IMinUserRepository userRepository;
private final IJudgeUserRepository judgeUserRepository;
private final IResidentMapper mapper;
private final IResidentAndDisabledMapper mapper;
@Override
@Transactional(readOnly = true)
public Page<GnRecallScDto> findResidentDatas(Pageable pageable) {
public Page<GnRecallScDto> findJudgeDatas(Pageable pageable) {
// Sort sort = Sort.by(Sort.Direction.DESC, "inCode");
pageable = JpaUtil.getPagingInfo(pageable);
Page<GnRecallScDto> page = repository.findResidentDatas(
return repository.findJudgeDatas(
PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending()));
// List<CmmUser> userList = page.getContent();
return page;
}
@Override
@Transactional(readOnly = true)
public GnRecallScDto findResidentData(final Long scCode) {
GnRecallScDto dto = repository.findResident(scCode);
return repository.findResident(scCode);
public GnRecallScDto findJudgeData(final Long scCode) {
return repository.findJudgeData(scCode);
}
// @Override
// @Transactional(readOnly = true)
// public Page<GnRecallSc> findAll(final GnRecallSc entity, Pageable pageable) {
// // Sort sort = Sort.by(Sort.Direction.DESC, "inCode");
// pageable = JpaUtil.getPagingInfo(pageable);
// // pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("inCode").descending())
// ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll();
// //.withMatcher("inTitle", contains())
// //.withMatcher("inName", contains());
// Example<GnRecallSc> example = Example.of(entity, exampleMatcher);
// Page<GnRecallSc> page = repository.findAll(
// example,
// PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending()));
// // List<CmmUser> userList = page.getContent();
// return page;
// }
@Override
public void saveResidentData(GnRecallScDto dto) {
@Transactional
public void saveJudgeData(GnRecallScDto dto) {
if(dto.getPicadFiles() != null) {
setFileInfoAndFileUpload(dto, dto.getPicadFiles(), "setScPicad");
@ -123,20 +112,21 @@ public class ResidentService implements IResidentService {
@Override
public Page<JudgeListDto> findResidents(JudgeListDto dto, Pageable pageable) {
public Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable) {
pageable = JpaUtil.getPagingInfo(pageable);
return repository.findResidents(dto, pageable);
return repository.findJudges(dto, pageable);
}
@Override
@Transactional(readOnly = true)
public List<ResidentTargetDto> findResidentJudgeTargets(ResidentTargetDto dto) {
return repository.findResidentJudgeTargets(dto);
public List<JudgeTargetDto> findJudgeTargets(JudgeTargetDto dto) {
return repository.findJudgeTargets(dto);
}
@Override
@Transactional
public void saveResidentJudgeTargets(ResidentTargetDto dto) {
public void saveJudgeTargets(JudgeTargetDto dto) {
boolean isFirst = true;
for(Long scCode : dto.getScCodes()) {
@ -149,7 +139,7 @@ public class ResidentService implements IResidentService {
}
// 심사대상 등록
mapper.insertResidentJudgeTargetIntoSelect(dto);
mapper.insertJudgeTargetIntoSelect(dto);
// // 등록된 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수
// Tf680Recall recallEntity = recallRepository.findById(dto.getRcCode()).orElseGet(Tf680Recall::new);

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xit.biz.ctgy.mapper.IResidentMapper">
<insert id="insertResidentJudgeTargetIntoSelect" parameterType="com.xit.biz.ctgy.dto.ResidentDto">
/* resident-mapper|insertResidentJudgeTargetIntoSelect|julim */
<mapper namespace="com.xit.biz.ctgy.mapper.IResidentAndDisabledMapper">
<insert id="insertJudgeTargetIntoSelect" parameterType="com.xit.biz.ctgy.dto.JudgeTargetDto">
/* residentanddisabled-mapper|insertJudgeTargetIntoSelect|julim */
insert
into min_simsa680_sc(
ms_maincode,
Loading…
Cancel
Save