|
|
|
|
@ -9,6 +9,7 @@ import go.kr.project.crdn.crndRegistAndView.crdnActInfo.service.CrdnPhotoService
|
|
|
|
|
import go.kr.project.crdn.crndRegistAndView.crdnActrInfo.mapper.CrdnActrInfoMapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@ -600,4 +601,48 @@ public class CrdnActInfoServiceImpl extends EgovAbstractServiceImpl implements C
|
|
|
|
|
log.info("조치정보 일괄 삭제 완료. 요청: {}건, 삭제: {}건", actnInfoIds.size(), deletedCount);
|
|
|
|
|
return deletedCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BigDecimal getRemainingArea(String actInfoId) {
|
|
|
|
|
log.debug("적을 수 있는 조치면적 조회 요청: actInfoId={}", actInfoId);
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(actInfoId)) {
|
|
|
|
|
throw new MessageException("행위정보 ID가 필요합니다.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 중요한 로직 주석: 행위정보 조회
|
|
|
|
|
CrdnActInfoVO actInfo = mapper.selectActInfoByPk(actInfoId);
|
|
|
|
|
if (actInfo == null) {
|
|
|
|
|
throw new MessageException("행위정보를 찾을 수 없습니다.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 중요한 로직 주석: 해당 행위정보의 모든 조치정보 조회하여 총 면적 계산
|
|
|
|
|
CrdnActnInfoVO actnSearchVO = CrdnActnInfoVO.builder()
|
|
|
|
|
.actInfoId(actInfoId)
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
List<CrdnActnInfoVO> actnInfoList = mapper.selectActnInfoList(actnSearchVO);
|
|
|
|
|
BigDecimal totalActnArea = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
|
|
for (CrdnActnInfoVO actnInfo : actnInfoList) {
|
|
|
|
|
if (actnInfo.getActnArea() != null) {
|
|
|
|
|
totalActnArea = totalActnArea.add(actnInfo.getActnArea());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 중요한 로직 주석: 행위정보 면적에서 기존 조치면적 총합을 뺀 나머지 면적 계산
|
|
|
|
|
BigDecimal remainingArea = BigDecimal.ZERO;
|
|
|
|
|
if (actInfo.getArea() != null) {
|
|
|
|
|
remainingArea = actInfo.getArea().subtract(totalActnArea);
|
|
|
|
|
// 음수인 경우 0으로 설정
|
|
|
|
|
if (remainingArea.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
remainingArea = BigDecimal.ZERO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.debug("적을 수 있는 조치면적 계산 완료: actInfoId={}, 행위면적={}, 기존조치면적={}, 남은면적={}",
|
|
|
|
|
actInfoId, actInfo.getArea(), totalActnArea, remainingArea);
|
|
|
|
|
|
|
|
|
|
return remainingArea.setScale(2, java.math.RoundingMode.HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
}
|