feat: 심의대상 등록시 방어로직 추가(등록된 데이타인 경우 에러 발생)

dev
minuk926 3 years ago
parent 0afc804e2c
commit 7337874e34

@ -10,7 +10,7 @@ import java.util.Map;
@Mapper @Mapper
public interface IParkingMapper { public interface IParkingMapper {
void insertParkingJudgeTargetIntoSelect(ParkingTargetDto dto); int insertParkingJudgeTargetIntoSelect(ParkingTargetDto dto);
/** /**
* && total * && total

@ -11,7 +11,7 @@ import java.util.Map;
@Mapper @Mapper
public interface IResidentAndDisabledMapper { public interface IResidentAndDisabledMapper {
void insertJudgeTargetIntoSelect(JudgeTargetDto dto); int insertJudgeTargetIntoSelect(JudgeTargetDto dto);
/** /**
* && total * && total

@ -9,6 +9,6 @@ import org.springframework.data.repository.query.Param;
public interface IRecallRepository extends JpaRepository<Tf680Recall, Long> { public interface IRecallRepository extends JpaRepository<Tf680Recall, Long> {
@Modifying @Modifying
@Query(value = "UPDATE #{#entityName} m SET m.rcIrTransfer = '1' WHERE m.rcCode = :msMaincode") @Query(value = "UPDATE #{#entityName} m SET m.rcIrTransfer = '1', m.rcState = '0' WHERE m.rcCode = :msMaincode")
int updateRcIrTransfer(@Param("msMaincode")Long msMaincode); int updateRcIrTransferAndRcState(@Param("msMaincode")Long msMaincode);
} }

@ -252,10 +252,10 @@ public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledR
// 자료상태 : 1-접수 // 자료상태 : 1-접수
String stateCond = CtgyConstants.Judge.DATA_STATE_RECEIPT.getCode(); String stateCond = CtgyConstants.Judge.DATA_STATE_RECEIPT.getCode();
return queryReultResidentJudgeTargets(dto.getScDatagb(), stateCond, dto.getScTransfer(), dto.getScSeq1(), dto.getScSeq2()); return queryResidentJudgeTargets(dto.getScDatagb(), stateCond, dto.getScTransfer(), dto.getScSeq1(), dto.getScSeq2());
} }
private List<JudgeTargetDto> queryReultResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){ private List<JudgeTargetDto> queryResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){
return queryFactory return queryFactory
.select(Projections.fields(JudgeTargetDto.class, .select(Projections.fields(JudgeTargetDto.class,
gnRecallSc.scCode, gnRecallSc.scCode,

@ -34,19 +34,6 @@ public class ParkingService implements IParkingService {
private final IParkingJudgeUserRepository parkingJudgeUserRepository; private final IParkingJudgeUserRepository parkingJudgeUserRepository;
private final IParkingMapper mapper; private final IParkingMapper mapper;
// @Override
// @Transactional(readOnly = true)
// public Page<MinSimsa680> findAll(@Nonnull final MinSimsa680 entity, Pageable pageable) {
// pageable = JpaUtil.getPagingInfo(pageable);
// ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
// .withMatcher("ciTitle", contains())
// .withMatcher("ciName", contains());
// Example<MinSimsa680> example = Example.of(entity, exampleMatcher);
// Page<MinSimsa680> page = simsaRepository.findAll(example, pageable);
// // List<CmmUser> userList = page.getContent();
// return page;
// }
@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) {
@ -125,7 +112,7 @@ public class ParkingService implements IParkingService {
dto.setMsResult("0"); dto.setMsResult("0");
isFirst = false; isFirst = false;
} }
mapper.insertParkingJudgeTargetIntoSelect(dto); if(mapper.insertParkingJudgeTargetIntoSelect(dto) == 0) throw new CustomBaseException(String.format("처리된 데이타가 있습니다[ %s ]", dto.getMmOcarno()));
//--------------------------------------------------------- //---------------------------------------------------------
// 등록한 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수 // 등록한 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수
@ -174,7 +161,8 @@ public class ParkingService implements IParkingService {
msMaincodes.forEach(msMaincode -> { msMaincodes.forEach(msMaincode -> {
parkingJudgeUserRepository.deleteByMsuMaincode(msMaincode); parkingJudgeUserRepository.deleteByMsuMaincode(msMaincode);
recallRepository.updateRcIrTransfer(msMaincode); // 전송상태 -> 미접수(1), 심의결과 -> 심의전(0)
recallRepository.updateRcIrTransferAndRcState(msMaincode);
repository.deleteById(msMaincode); repository.deleteById(msMaincode);
}); });
} }

@ -143,14 +143,14 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
dto.setMsResult("0"); dto.setMsResult("0");
isFirst = false; isFirst = false;
} }
residentAndDisabledMapper.insertJudgeTargetIntoSelect(dto); 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)); GnRecallSc entity = gnReacallRepository.findById(dto.getScCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND));
entity.setScTransfer(CtgyConstants.Judge.TRANSFER_ACCEPT.getCode()); entity.setScTransfer(CtgyConstants.Judge.TRANSFER_ACCEPT.getCode());
//entity.setScState(CtgyConstants.Judge.DATA_STATE_JUDGE.getCode()); entity.setScState(CtgyConstants.Judge.DATA_STATE_JUDGE.getCode());
//JpaUtil.saveIfNullId(dto.getScCode(), repository, entity); //JpaUtil.saveIfNullId(dto.getScCode(), repository, entity);
gnReacallRepository.save(entity); gnReacallRepository.save(entity);
@ -250,6 +250,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
msMaincodes.forEach(msMaincode -> { msMaincodes.forEach(msMaincode -> {
//List<MinSimsaUser680Sc> judgeUsers = judgeUserRepository.findByMsuMaincode() //List<MinSimsaUser680Sc> judgeUsers = judgeUserRepository.findByMsuMaincode()
judgeUserRepository.deleteByMsuMaincode(msMaincode); judgeUserRepository.deleteByMsuMaincode(msMaincode);
// 전송상태 -> 미접수(1), 심의결과 -> 접수(1)
gnReacallRepository.updateScTransferAndScState(dto.getMsDatagb(), msMaincode); gnReacallRepository.updateScTransferAndScState(dto.getMsDatagb(), msMaincode);
judgeRepository.deleteById(msMaincode); judgeRepository.deleteById(msMaincode);
}); });

@ -37,6 +37,8 @@
from tf680_recall TR from tf680_recall TR
join tf680_main TM on TR.rc_code = #{rcCode} join tf680_main TM on TR.rc_code = #{rcCode}
and TM.mm_code = TR.rc_maincode and TM.mm_code = TR.rc_maincode
and TR.rc_ir_transfer = '1'
and TR.rc_state = '0'
join tf680_jucha TJ on TM.mm_code = TJ.mj_code join tf680_jucha TJ on TM.mm_code = TJ.mj_code
join tf680_dong TD join tf680_dong TD
on TJ.mj_dong = TD.do_code on TJ.mj_dong = TD.do_code

@ -38,6 +38,8 @@
sc_datagb sc_datagb
from gn_recall_sc from gn_recall_sc
where sc_code = #{scCode} where sc_code = #{scCode}
and sc_transfer = '1'
and sc_state = '1'
</insert> </insert>
<select id="selectTotJudgeResultGroupByTeamAndChasu" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseLinkedMap"> <select id="selectTotJudgeResultGroupByTeamAndChasu" parameterType="com.xit.biz.ctgy.dto.JudgeListDto" resultType="camelCaseLinkedMap">

Loading…
Cancel
Save