|
|
|
|
@ -5,6 +5,7 @@ import egovframework.constant.TuiGridColorConstants;
|
|
|
|
|
import egovframework.exception.MessageException;
|
|
|
|
|
import egovframework.util.SessionUtil;
|
|
|
|
|
import egovframework.util.StringUtil;
|
|
|
|
|
import go.kr.project.crdn.crndRegistAndView.crdnActInfo.model.CrdnActInfoVO;
|
|
|
|
|
import go.kr.project.crdn.crndRegistAndView.main.mapper.CrdnImpltTaskMapper;
|
|
|
|
|
import go.kr.project.crdn.crndRegistAndView.main.mapper.CrdnLevyPrvntcMapper;
|
|
|
|
|
import go.kr.project.crdn.crndRegistAndView.main.mapper.CrdnRegistAndViewMapper;
|
|
|
|
|
@ -113,17 +114,63 @@ public class CrdnImpltTaskServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
// 이행정보 등록
|
|
|
|
|
int result = crdnImpltTaskMapper.insertImpltInfo(vo);
|
|
|
|
|
|
|
|
|
|
// 이행 대상자 정보 등록
|
|
|
|
|
// 중요한 로직 주석: 단속건의 모든 행위를 조회하여 각 행위별로 이행 대상자 정보를 저장
|
|
|
|
|
if (vo.getImpltTrprInfoList() != null && !vo.getImpltTrprInfoList().isEmpty()) {
|
|
|
|
|
for (CrdnImpltTrprInfoVO trprInfo : vo.getImpltTrprInfoList()) {
|
|
|
|
|
String trprInfoId = crdnImpltTaskMapper.selectNextImpltTrprInfoId();
|
|
|
|
|
trprInfo.setImpltTrprInfoId(trprInfoId);
|
|
|
|
|
trprInfo.setImpltInfoId(impltInfoId);
|
|
|
|
|
trprInfo.setSggCd(vo.getSggCd());
|
|
|
|
|
trprInfo.setRgtr(SessionUtil.getUserId());
|
|
|
|
|
trprInfo.setDelYn("N");
|
|
|
|
|
|
|
|
|
|
crdnImpltTaskMapper.insertImpltTrprInfo(trprInfo);
|
|
|
|
|
// 단속건의 모든 행위 정보 조회 (pstnInfoId 조건 없음)
|
|
|
|
|
List<CrdnActInfoVO> actInfoList = crdnImpltTaskMapper.selectActInfoListForImplt(vo.getCrdnYr(), vo.getCrdnNo());
|
|
|
|
|
|
|
|
|
|
if (actInfoList == null || actInfoList.isEmpty()) {
|
|
|
|
|
log.warn("행위 정보가 없습니다. 단속연도: {}, 단속번호: {}", vo.getCrdnYr(), vo.getCrdnNo());
|
|
|
|
|
} else {
|
|
|
|
|
// 각 소유자/행위자에 대해 모든 행위별로 저장
|
|
|
|
|
for (CrdnImpltTrprInfoVO trprInfo : vo.getImpltTrprInfoList()) {
|
|
|
|
|
for (CrdnActInfoVO actInfo : actInfoList) {
|
|
|
|
|
// 중요한 로직: OWNR_ID로 실제 OWNR_INFO_ID 또는 ACTR_INFO_ID 조회
|
|
|
|
|
String actualInfoId = null;
|
|
|
|
|
if ("1".equals(trprInfo.getImpltTrprSeCd())) {
|
|
|
|
|
// 소유자인 경우
|
|
|
|
|
actualInfoId = crdnImpltTaskMapper.selectOwnrInfoIdByOwnrIdAndActInfoId(
|
|
|
|
|
trprInfo.getOwnrActrInfoId(), actInfo.getActInfoId(), vo.getCrdnYr(), vo.getCrdnNo());
|
|
|
|
|
} else if ("2".equals(trprInfo.getImpltTrprSeCd())) {
|
|
|
|
|
// 행위자인 경우
|
|
|
|
|
actualInfoId = crdnImpltTaskMapper.selectActrInfoIdByOwnrIdAndActInfoId(
|
|
|
|
|
trprInfo.getOwnrActrInfoId(), actInfo.getActInfoId(), vo.getCrdnYr(), vo.getCrdnNo());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (actualInfoId == null) {
|
|
|
|
|
log.warn("실제 ID를 찾을 수 없습니다. OWNR_ID: {}, ACT_INFO_ID: {}, 구분: {}",
|
|
|
|
|
trprInfo.getOwnrActrInfoId(), actInfo.getActInfoId(), trprInfo.getImpltTrprSeCd());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String trprInfoId = crdnImpltTaskMapper.selectNextImpltTrprInfoId();
|
|
|
|
|
CrdnImpltTrprInfoVO newTrprInfo = new CrdnImpltTrprInfoVO();
|
|
|
|
|
newTrprInfo.setImpltTrprInfoId(trprInfoId);
|
|
|
|
|
newTrprInfo.setImpltInfoId(impltInfoId);
|
|
|
|
|
newTrprInfo.setSggCd(vo.getSggCd());
|
|
|
|
|
newTrprInfo.setRgtr(SessionUtil.getUserId());
|
|
|
|
|
newTrprInfo.setDelYn("N");
|
|
|
|
|
|
|
|
|
|
// 실제 조회한 ID 설정
|
|
|
|
|
newTrprInfo.setOwnrActrInfoId(actualInfoId);
|
|
|
|
|
newTrprInfo.setImpltTrprSeCd(trprInfo.getImpltTrprSeCd());
|
|
|
|
|
newTrprInfo.setImpltTrprFlnm(trprInfo.getImpltTrprFlnm());
|
|
|
|
|
newTrprInfo.setImpltTrprZip(trprInfo.getImpltTrprZip());
|
|
|
|
|
newTrprInfo.setImpltTrprAddr(trprInfo.getImpltTrprAddr());
|
|
|
|
|
newTrprInfo.setImpltTrprDaddr(trprInfo.getImpltTrprDaddr());
|
|
|
|
|
|
|
|
|
|
// 행위 정보 설정
|
|
|
|
|
newTrprInfo.setActNo(String.valueOf(actInfo.getActNo()));
|
|
|
|
|
newTrprInfo.setActTypeCd(actInfo.getActTypeCd());
|
|
|
|
|
newTrprInfo.setLotnoMno(trprInfo.getLotnoMno());
|
|
|
|
|
newTrprInfo.setLotnoSno(trprInfo.getLotnoSno());
|
|
|
|
|
|
|
|
|
|
crdnImpltTaskMapper.insertImpltTrprInfo(newTrprInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.debug("이행 대상자 정보 등록 완료: 소유자/행위자 {}명 * 행위 {}건 = 총 {}건",
|
|
|
|
|
vo.getImpltTrprInfoList().size(), actInfoList.size(),
|
|
|
|
|
vo.getImpltTrprInfoList().size() * actInfoList.size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -165,17 +212,62 @@ public class CrdnImpltTaskServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
// 기존 이행 대상자 정보 삭제
|
|
|
|
|
crdnImpltTaskMapper.deleteImpltTrprInfoByImpltInfoId(vo.getImpltInfoId());
|
|
|
|
|
|
|
|
|
|
// 새로운 이행 대상자 정보 등록
|
|
|
|
|
// 중요한 로직 주석: 단속건의 모든 행위를 조회하여 각 행위별로 이행 대상자 정보를 저장
|
|
|
|
|
if (vo.getImpltTrprInfoList() != null && !vo.getImpltTrprInfoList().isEmpty()) {
|
|
|
|
|
for (CrdnImpltTrprInfoVO trprInfo : vo.getImpltTrprInfoList()) {
|
|
|
|
|
String trprInfoId = crdnImpltTaskMapper.selectNextImpltTrprInfoId();
|
|
|
|
|
trprInfo.setImpltTrprInfoId(trprInfoId);
|
|
|
|
|
trprInfo.setImpltInfoId(vo.getImpltInfoId());
|
|
|
|
|
trprInfo.setSggCd(vo.getSggCd());
|
|
|
|
|
trprInfo.setRgtr(SessionUtil.getUserId());
|
|
|
|
|
trprInfo.setDelYn("N");
|
|
|
|
|
|
|
|
|
|
crdnImpltTaskMapper.insertImpltTrprInfo(trprInfo);
|
|
|
|
|
// 단속건의 모든 행위 정보 조회 (pstnInfoId 조건 없음)
|
|
|
|
|
List<CrdnActInfoVO> actInfoList = crdnImpltTaskMapper.selectActInfoListForImplt(vo.getCrdnYr(), vo.getCrdnNo());
|
|
|
|
|
|
|
|
|
|
if (actInfoList == null || actInfoList.isEmpty()) {
|
|
|
|
|
throw new MessageException(String.format("행위 정보가 없습니다. 단속연도: %s, 단속번호: %s", vo.getCrdnYr(), vo.getCrdnNo()));
|
|
|
|
|
} else {
|
|
|
|
|
// 각 소유자/행위자에 대해 모든 행위별로 저장
|
|
|
|
|
for (CrdnImpltTrprInfoVO trprInfo : vo.getImpltTrprInfoList()) {
|
|
|
|
|
for (CrdnActInfoVO actInfo : actInfoList) {
|
|
|
|
|
// 중요한 로직: OWNR_ID로 실제 OWNR_INFO_ID 또는 ACTR_INFO_ID 조회
|
|
|
|
|
String actualInfoId = null;
|
|
|
|
|
if ("1".equals(trprInfo.getImpltTrprSeCd())) {
|
|
|
|
|
// 소유자인 경우
|
|
|
|
|
actualInfoId = crdnImpltTaskMapper.selectOwnrInfoIdByOwnrIdAndActInfoId(
|
|
|
|
|
trprInfo.getOwnrActrInfoId(), actInfo.getActInfoId(), vo.getCrdnYr(), vo.getCrdnNo());
|
|
|
|
|
} else if ("2".equals(trprInfo.getImpltTrprSeCd())) {
|
|
|
|
|
// 행위자인 경우
|
|
|
|
|
actualInfoId = crdnImpltTaskMapper.selectActrInfoIdByOwnrIdAndActInfoId(
|
|
|
|
|
trprInfo.getOwnrActrInfoId(), actInfo.getActInfoId(), vo.getCrdnYr(), vo.getCrdnNo());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (actualInfoId == null) {
|
|
|
|
|
throw new MessageException(String.format("실제 ID를 찾을 수 없습니다. OWNR_ID: %s, ACT_INFO_ID: %s, 구분: %s",
|
|
|
|
|
trprInfo.getOwnrActrInfoId(), actInfo.getActInfoId(), trprInfo.getImpltTrprSeCd()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String trprInfoId = crdnImpltTaskMapper.selectNextImpltTrprInfoId();
|
|
|
|
|
CrdnImpltTrprInfoVO newTrprInfo = new CrdnImpltTrprInfoVO();
|
|
|
|
|
newTrprInfo.setImpltTrprInfoId(trprInfoId);
|
|
|
|
|
newTrprInfo.setImpltInfoId(vo.getImpltInfoId());
|
|
|
|
|
newTrprInfo.setSggCd(vo.getSggCd());
|
|
|
|
|
newTrprInfo.setRgtr(SessionUtil.getUserId());
|
|
|
|
|
newTrprInfo.setDelYn("N");
|
|
|
|
|
|
|
|
|
|
// 실제 조회한 ID 설정
|
|
|
|
|
newTrprInfo.setOwnrActrInfoId(actualInfoId);
|
|
|
|
|
newTrprInfo.setImpltTrprSeCd(trprInfo.getImpltTrprSeCd());
|
|
|
|
|
newTrprInfo.setImpltTrprFlnm(trprInfo.getImpltTrprFlnm());
|
|
|
|
|
newTrprInfo.setImpltTrprZip(trprInfo.getImpltTrprZip());
|
|
|
|
|
newTrprInfo.setImpltTrprAddr(trprInfo.getImpltTrprAddr());
|
|
|
|
|
newTrprInfo.setImpltTrprDaddr(trprInfo.getImpltTrprDaddr());
|
|
|
|
|
|
|
|
|
|
// 행위 정보 설정
|
|
|
|
|
newTrprInfo.setActNo(String.valueOf(actInfo.getActNo()));
|
|
|
|
|
newTrprInfo.setActTypeCd(actInfo.getActTypeCd());
|
|
|
|
|
newTrprInfo.setLotnoMno(trprInfo.getLotnoMno());
|
|
|
|
|
newTrprInfo.setLotnoSno(trprInfo.getLotnoSno());
|
|
|
|
|
|
|
|
|
|
crdnImpltTaskMapper.insertImpltTrprInfo(newTrprInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.debug("이행 대상자 정보 수정 완료: 소유자/행위자 {}명 * 행위 {}건 = 총 {}건",
|
|
|
|
|
vo.getImpltTrprInfoList().size(), actInfoList.size(),
|
|
|
|
|
vo.getImpltTrprInfoList().size() * actInfoList.size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -279,33 +371,6 @@ public class CrdnImpltTaskServiceImpl extends EgovAbstractServiceImpl implements
|
|
|
|
|
list.sort(Comparator.comparing(CrdnImpltTrprInfoVO::getActNo)
|
|
|
|
|
.thenComparing(CrdnImpltTrprInfoVO::getImpltTrprSeCd)
|
|
|
|
|
.thenComparing(CrdnImpltTrprInfoVO::getImpltTrprFlnm));
|
|
|
|
|
|
|
|
|
|
// 중요로직: 행위 번호(actNo)의 홀/짝에 따라 그리드 행에 CSS 클래스를 적용
|
|
|
|
|
for (CrdnImpltTrprInfoVO item : list) {
|
|
|
|
|
try {
|
|
|
|
|
if (item.getActNo() != null && !item.getActNo().isEmpty()) {
|
|
|
|
|
// actNo를 정수로 변환
|
|
|
|
|
int actNo = Integer.parseInt(item.getActNo());
|
|
|
|
|
|
|
|
|
|
// TUI Grid _attributes 설정
|
|
|
|
|
Map<String, Object> attributes = new HashMap<>();
|
|
|
|
|
Map<String, Object> className = new HashMap<>();
|
|
|
|
|
List<String> rowClass = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if (actNo % 2 == 0) {
|
|
|
|
|
rowClass.add(TuiGridColorConstants.ROW_COLOR_RED);
|
|
|
|
|
} else {
|
|
|
|
|
rowClass.add(TuiGridColorConstants.ROW_COLOR_BLUE);
|
|
|
|
|
}
|
|
|
|
|
className.put("row", rowClass);
|
|
|
|
|
attributes.put("className", className);
|
|
|
|
|
item.set_attributes(attributes);
|
|
|
|
|
}
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
// actNo가 숫자가 아닌 경우 로그를 남기거나 무시
|
|
|
|
|
log.warn("actNo is not a valid integer: {}", item.getActNo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|