diff --git a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java b/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java index bd8eb44..7d61fd0 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java @@ -73,6 +73,7 @@ public class ResidentController { @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"), @Parameter(in = ParameterIn.QUERY, name = "scTransfer", description = "전송상태(미접수-1,접수-2)", required = true, example = "1"), @Parameter(in = ParameterIn.QUERY, name = "scSeq1", description = "접수번호-시작", required = true, example = "2022200801"), @Parameter(in = ParameterIn.QUERY, name = "scSeq2", description = "접수번호-종료", required = true, example = "2022200899"), diff --git a/src/main/java/com/xit/biz/ctgy/dto/ResidentTargetDto.java b/src/main/java/com/xit/biz/ctgy/dto/ResidentTargetDto.java index d2450e0..526ebdb 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/ResidentTargetDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/ResidentTargetDto.java @@ -48,7 +48,7 @@ public class ResidentTargetDto { private String scTransfer; @Schema(title = "데이타구분", example = "1", description = "데이타구분: 1-거주자,2-장애인") - private String scDatagb; + private String scDatagb = "1"; //------------------------------------------------------------------ // 심사대상 저장을 위한 속성 diff --git a/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java b/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java index 6846d74..6c0cfc9 100644 --- a/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java +++ b/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java @@ -6,6 +6,6 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface IParkingMapper { - void insertSimsaTargetIntoSelect(ParkingTargetDto dto); + void insertParkingJudgeTargetIntoSelect(ParkingTargetDto dto); } diff --git a/src/main/java/com/xit/biz/ctgy/mapper/IResidentMapper.java b/src/main/java/com/xit/biz/ctgy/mapper/IResidentMapper.java new file mode 100644 index 0000000..9496918 --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/mapper/IResidentMapper.java @@ -0,0 +1,11 @@ +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); + +} diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java index 7184ca7..758593e 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java @@ -214,12 +214,10 @@ AND SC_CODE = @Override public List findResidentJudgeTargets(final ResidentTargetDto dto) { - // 데이타구분 : 1-거주자 2-장애인 - String dataGbCond = CtgyConstants.Judge.DATAGB_RESIDENT.getCode(); // 자료상태 : 1-접수 String stateCond = CtgyConstants.Judge.DATA_STATE_RECEIPT.getCode(); - return queryReultResidentJudgeTargets(dataGbCond, stateCond, dto.getScTransfer(), dto.getScSeq1(), dto.getScSeq2()); + return queryReultResidentJudgeTargets(dto.getScDatagb(), stateCond, dto.getScTransfer(), dto.getScSeq1(), dto.getScSeq2()); } private List queryReultResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){ @@ -238,14 +236,14 @@ AND SC_CODE = .where(gnRecallSc.scContDoc.eq(cmmCodeS.codeCd),cmmCodeS.codeGrpId.eq("TRAFFIC"), cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"), cmmCodeS.codeMcd.eq("RC_CONT_DOC")), - "rcContDocNm"), + "scContDocNm"), ExpressionUtils.as( JPAExpressions.select(cmmCodeS.codeNm) .from(cmmCodeS) .where(gnRecallSc.scIngb.eq(cmmCodeS.codeCd),cmmCodeS.codeGrpId.eq("TRAFFIC"), cmmCodeS.codeLcd.eq("GANGNAM_SIMSA"), cmmCodeS.codeMcd.eq("RC_INGB")), - "rcIngbNm") + "scIngbNm") )) .from(gnRecallSc) .where(datagbEq(dataGb), stateEq(state), transferEq(transfer), seqGt(seq1), seqLt(seq2)) diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java index fd12b6d..71ff2e5 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java @@ -27,10 +27,10 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class ParkingService implements IParkingService { - private final IParkingRepository simsaRepository; + private final IParkingRepository repository; private final IRecallRepository recallRepository; private final IMinUserRepository userRepository; - private final IJudgeUserRepository simsaUserRepository; + private final IJudgeUserRepository judgeUserRepository; private final IParkingMapper mapper; // @Override @@ -49,7 +49,7 @@ public class ParkingService implements IParkingService { @Override @Transactional(readOnly = true) public Page findParkings(final JudgeListDto minSimsa680GroupDto, Pageable pageable) { - return simsaRepository.findParkings(minSimsa680GroupDto, pageable); + return repository.findParkings(minSimsa680GroupDto, pageable); } @Override @@ -61,7 +61,7 @@ public class ParkingService implements IParkingService { @Override @Transactional(readOnly = true) public List findParkingJudgeTargets(ParkingTargetDto dto) { - return simsaRepository.findParkingJudgeTargets(dto); + return repository.findParkingJudgeTargets(dto); } @Override @@ -79,7 +79,7 @@ public class ParkingService implements IParkingService { } // 심사대상 등록 - mapper.insertSimsaTargetIntoSelect(dto); + mapper.insertParkingJudgeTargetIntoSelect(dto); // 등록된 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수 Tf680Recall recallEntity = recallRepository.findById(dto.getRcCode()).orElseGet(()->Tf680Recall.builder().build()); @@ -103,7 +103,7 @@ public class ParkingService implements IParkingService { //.msuIndate() .build() ).collect(Collectors.toList()); - simsaUserRepository.saveAll(simsaUserList); + judgeUserRepository.saveAll(simsaUserList); } } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java index 1e8f553..34b1919 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java @@ -7,6 +7,7 @@ import com.xit.biz.ctgy.dto.ResidentTargetDto; import com.xit.biz.ctgy.dto.JudgeListDto; 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.core.support.jpa.JpaUtil; @@ -25,6 +26,7 @@ import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; +import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -42,6 +44,11 @@ public class ResidentService implements IResidentService { private final ICmmFileService fileService; + private final IMinUserRepository userRepository; + private final IJudgeUserRepository judgeUserRepository; + + private final IResidentMapper mapper; + @Override @Transactional(readOnly = true) public Page findResidentDatas(Pageable pageable) { @@ -130,49 +137,44 @@ public class ResidentService implements IResidentService { @Override @Transactional public void saveResidentJudgeTargets(ResidentTargetDto dto) { -// boolean isFirst = true; -// -// for(Long rcCode : dto.getRcCodes()) { -// dto.setRcCode(rcCode); -// -// if (isFirst) { -// dto.setMsYear(dto.getMsSdate().toString().substring(0, 4)); -// dto.setMsResult("0"); -// isFirst = false; -// } -// -// // 심사대상 등록 -// mapper.insertSimsaTargetIntoSelect(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; + } + + // 심사대상 등록 + mapper.insertResidentJudgeTargetIntoSelect(dto); + // // 등록된 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수 // Tf680Recall recallEntity = recallRepository.findById(dto.getRcCode()).orElseGet(Tf680Recall::new); // recallEntity.setRcIrTransfer(CtgyConstants.Judge.TRANSFER_ACCEPT.getCode()); // JpaUtil.saveIfNullId(recallEntity.getRcCode(), recallRepository, recallEntity); -// -// // 심사자 등록 -// List userinfoList = userRepository.findAllByTeamAndIsenableAndAccesstype( -// dto.getMsuTeam(), -// CtgyConstants.UserInfo.ISENABLED_USE.getCode(), -// CtgyConstants.UserInfo.ACCESSTYPE_SIMSA.getCode()); -// -// List simsaUserList = userinfoList.stream().map(u -> -// MinSimsaUser680.builder() -// .msuMaincode(rcCode) -// .msuUserid(u.getUserid()) -// .msuResult(CtgyConstants.SimsaUserInfo.MSU_RESULT_NONE.getCode()) -// //.msuReason() -// .msuTeam(dto.getMsuTeam()) -// //.msuIndate() -// .build() -// ).collect(Collectors.toList()); -// simsaUserRepository.saveAll(simsaUserList); -// -// } -// -// -//// userinfoList.stream().forEach(user => simsaRepository.save(MinSimsa680)); -//// simsaRepository.save -// return simsaRepository.findParkingTargets(dto); + + // 심사자 등록 + List userinfoList = userRepository.findAllByTeamAndIsenableAndAccesstype( + dto.getMsuTeam(), + CtgyConstants.UserInfo.ISENABLED_USE.getCode(), + CtgyConstants.UserInfo.ACCESSTYPE_SIMSA.getCode()); + + List simsaUserList = userinfoList.stream().map(u -> + MinSimsaUser680.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); + + } } } diff --git a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml index 3fce0f1..419e1e5 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml @@ -2,8 +2,8 @@ - - /* parking-mapper|insertSimsaTargetIntoSelect|julim */ + + /* parking-mapper|insertParkingJudgeTargetIntoSelect|julim */ insert into min_simsa680( ms_maincode, @@ -41,26 +41,4 @@ join tf680_dong TD on TJ.mj_dong = TD.do_code - - - /* parking-mapper|insertSimsaTargetIntoSelect|julim */ - /* - insert - into min_simsa_user680( - msu_code, - msu_maincode, - msu_userid, - msu_result, - msu_reason, - msu_team, - msu_indate - ) select min_simsa680_seq.nextval, - TR.rc_code, - #{userid}, - #{msuResult}, - #{msuReason}, - #{msuTeam}, - #{msuIndate} -*/ - \ No newline at end of file diff --git a/src/main/resources/mybatis-mapper/biz/ctgy/resident-mapper.xml b/src/main/resources/mybatis-mapper/biz/ctgy/resident-mapper.xml new file mode 100644 index 0000000..704da68 --- /dev/null +++ b/src/main/resources/mybatis-mapper/biz/ctgy/resident-mapper.xml @@ -0,0 +1,43 @@ + + + + + + /* resident-mapper|insertResidentJudgeTargetIntoSelect|julim */ + insert + into min_simsa680_sc( + ms_maincode, + ms_seq, + ms_carnum, + ms_year, + ms_chasu, + ms_sdate, + ms_startsi, + ms_edate, + ms_cdate, + ms_closesi, + ms_wdate, + ms_pos, + ms_result, + ms_jbtime, + ms_datagb + ) select sc_code, + sc_seq, + sc_carnum, + #{msYear}, + #{msChasu}, + #{msSdate}, + #{msStartsi}, + #{msEdate}, + #{msCdate}, + #{msClosesi}, + sc_wdate, + sc_dong||''||sc_pos, + #{msResult}, + sc_jbtime, + sc_datagb + from gn_recall_sc + where sc_code = #{scCode} + + + \ No newline at end of file