diff --git a/src/main/java/go/kr/project/noti/service/impl/NotiServiceImpl.java b/src/main/java/go/kr/project/noti/service/impl/NotiServiceImpl.java index d0b1a0b..25eea53 100644 --- a/src/main/java/go/kr/project/noti/service/impl/NotiServiceImpl.java +++ b/src/main/java/go/kr/project/noti/service/impl/NotiServiceImpl.java @@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.springframework.stereotype.Service; -import java.util.List; +import java.util.*; /** @@ -30,17 +30,76 @@ import java.util.List; public class NotiServiceImpl extends EgovAbstractServiceImpl implements NotiService { private final NotiMapper mapper; - + // ==================== 이행정보(TB_IMPLT_INFO) 관련 메서드 ==================== - + @Override public int selectImpltInfoListTotalCount(NotiImpltInfoVO vo) { return mapper.selectImpltInfoListTotalCount(vo); - } + } @Override public List selectImpltInfoList(NotiImpltInfoVO vo) { - return mapper.selectImpltInfoList(vo); + List list = mapper.selectImpltInfoList(vo); + + // 중요로직: 같은 단속년도(crdnYr), 단속번호(crdnNo) 그룹별로 그리드 행에 CSS 클래스를 적용 + applyRowColorByGroup(list); + + return list; + } + + /** + * 단속년도, 단속번호 그룹별로 행 색상 클래스 적용 + * 중요한 로직 주석: 같은 단속년도와 단속번호를 가진 행들에게 그룹별로 다른 색상을 적용합니다. + * @param list 이행정보 목록 + */ + private void applyRowColorByGroup(List list) { + // 단속년도 + 단속번호 조합을 키로 하여 그룹 인덱스 매핑 + Map groupIndexMap = new LinkedHashMap<>(); + int groupIndex = 0; + + // 첫 번째 패스: 각 단속년도+단속번호 조합에 그룹 인덱스 할당 + for (NotiImpltInfoVO item : list) { + if (item.getCrdnYr() != null && item.getCrdnNo() != null) { + String groupKey = item.getCrdnYr() + "-" + item.getCrdnNo(); + + if (!groupIndexMap.containsKey(groupKey)) { + groupIndexMap.put(groupKey, groupIndex++); + } + } + } + + // 두 번째 패스: 각 항목에 _attributes 설정 + for (NotiImpltInfoVO item : list) { + try { + if (item.getCrdnYr() != null && item.getCrdnNo() != null) { + String groupKey = item.getCrdnYr() + "-" + item.getCrdnNo(); + Integer currentGroupIndex = groupIndexMap.get(groupKey); + + if (currentGroupIndex != null) { + // TUI Grid _attributes 설정 + Map attributes = new HashMap<>(); + Map className = new HashMap<>(); + List rowClass = new ArrayList<>(); + + // 그룹 인덱스의 홀/짝에 따라 색상 클래스 적용 + if (currentGroupIndex % 2 == 0) { + rowClass.add("tui-grid-custom-color-blue"); + } else { + rowClass.add("tui-grid-custom-color-red"); + } + + className.put("row", rowClass); + attributes.put("className", className); + item.set_attributes(attributes); + } + } + } catch (Exception e) { + // 예외 발생 시 로그를 남기고 계속 진행 + log.warn("Failed to apply row color for crdnYr: {}, crdnNo: {}", + item.getCrdnYr(), item.getCrdnNo(), e); + } + } } // ==================== 이행 대상자 정보(TB_IMPLT_TRPR_INFO) 관련 메서드 ==================== diff --git a/src/main/webapp/WEB-INF/views/noti/list.jsp b/src/main/webapp/WEB-INF/views/noti/list.jsp index 19b79be..46e632b 100644 --- a/src/main/webapp/WEB-INF/views/noti/list.jsp +++ b/src/main/webapp/WEB-INF/views/noti/list.jsp @@ -20,7 +20,7 @@
  • 단속 년도
  • -
  • +
  • 진행단계
  • -
  • +
  • 행정처분시작일
  • -
  • +
    -
    +
    @@ -72,10 +72,8 @@
    - - - - + +
    @@ -90,38 +88,32 @@
    - - +
    -
    + + \ No newline at end of file +