Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- mysql if
- 앵귤러 애니메이션
- summary
- 검색
- scroll
- TAILWIND
- route
- ApexChart
- angular animation
- 호버
- 모달
- 셀렉트박스 커스텀
- formgroup
- Angular Router
- 옵저버블
- Ionic modal
- 스크롤 이벤트 감지
- 앵귤러 모달
- prisma
- egov spring ajax 사용 예시
- Router
- modal
- Oracle LISTAGG 사용 예시
- 스크롤 이벤트
- ajax 사용 예시
- 아이오닉 스크롤 이벤트
- angular button
- angular modal
- angular route
- flex-1
Archives
- Today
- Total
깜놀하는 해므찌로
Egov Spring Controller 파이차트 상세보기 컨트롤러 예시 본문
반응형
SMALL
/* 차트 클릭 시 상세보기 */
@SuppressWarnings("unchecked")
@RequestMapping("/mgr/statistics/{proc}Point.do")
public String eatPoint(@ModelAttribute("searchVO") Mgr0117VO searchVO, ModelMap model, @PathVariable String proc) throws Exception {
/* 결과 값 저장 변수 */
ArrayList<String> resultInfo = new ArrayList<>();
/* 날짜 값 셋팅 */
String year = DateUtils.getNowDate("yyyy");
searchVO.setSchEtc05(year + "." + searchVO.getSchEtc05().split("_")[0].replace("/", "."));
/* 변수 선언 */
int divnCnt = 0;
String stringDivnCnt = "";
String userSeq = "";
String info = "";
/* 식대 */
if("eat".equals(proc)){
/* 식사인원, 가격, 그룹 수, 그룹 내 인원 수 조회 */
List<Mgr0117VO> circleList = (List<Mgr0117VO>)cmmnService.selectList(searchVO, PROGRAM_ID + ".eatPointClickSelectList");
for (int i = 0; i < circleList.size(); i++) {
divnCnt = circleList.get(i).getUserSeq().split(",").length;
stringDivnCnt += "," + divnCnt;
userSeq += "," + circleList.get(i).getUserSeq();
info += "," + circleList.get(i).getPrice();
}
String[] arrUserSeq = userSeq.split(","); // 사용자 SEQ
String[] arrDivnCnt = stringDivnCnt.split(","); // 그룹 수
String[] arrPrice = info.split(","); // 가격
/* 이름 조회 */
String userName = "";
for(int i = 1; i < arrUserSeq.length; i++){
searchVO.setSchEtc06(arrUserSeq[i]);
LoginVO loginVO = (LoginVO)cmmnService.selectContents(searchVO, PROGRAM_ID + ".findNameSelectContents");
userName += "," + loginVO.getName();
}
/* 조회 결과 배열에 담기 */
String[] arrUserName = userName.split(","); // 사용자 이름 저장
String[] resultUserName = new String[arrDivnCnt.length]; // 이름 배열 : 그룹 수 만큼 길이로 설정
String[] resultPrice = new String[arrDivnCnt.length]; // 가격 배열 : 그룹 수 만큼 길이로 설정
int savePoint = 0; // 마지막 인덱스 저장
int idx = 0;
for(int i = 1; i < arrDivnCnt.length; i++){ // 그룹 수 만큼 반복
int cutLength = Integer.parseInt(arrDivnCnt[i]); // 그륩별 식사 인원수
String groupNames = "";
String str = "";
if(idx == 0){ // 최초 첫번째 바퀴부터
for(int j = 1; j <= cutLength; j++){ // 이름 꺼내기
if(j == cutLength){
str = "";
}else{
str = ",";
}
groupNames += arrUserName[j] + str; // 이름 문자열 구분값
savePoint = j;
}
}else{ // 두번째 바퀴부터
for(int j = savePoint; j < savePoint + cutLength; j++){ // 마지막 인덱스 < 마지막 인덱스 + 그룹별 식사 인원수
if(j == savePoint + cutLength - 1){
str = "";
}else{
str = ",";
}
groupNames += arrUserName[j+1] + str; // 마지막 인덱스 중복 방지 + 1
}
/* 마지막 인덱스 + 그룹 내 인원 수 */
savePoint = savePoint + cutLength;
}
resultUserName[idx] = groupNames; // 추출된 이름 배열에 담기
resultPrice[idx] = arrPrice[i]; // 추출된 가격 배열에 담기
idx++;
}
for(int i = 0; i < resultUserName.length -1; i++){
resultInfo.add(resultUserName[i]+ "_" +resultPrice[i]);
}
}else if("overTime".equals(proc)){ /* 초과근무 차트 */
/* 날짜 값 schEtc05 */
List<Mgr0118VO> circleList = (List<Mgr0118VO>)cmmnService.selectList(searchVO, PROGRAM_ID + ".overTimePointClickSelectList");
String[] resultUserName = new String[circleList.size()];
String[] arrOverTime = new String[circleList.size()];
/* 이름 조회 schEtc06 */
for(int i = 0; i < circleList.size(); i++){
searchVO.setSchEtc06(circleList.get(i).getEmplySeq());
LoginVO loginVO = (LoginVO)cmmnService.selectContents(searchVO, PROGRAM_ID + ".findNameSelectContents");
resultUserName[i] = loginVO.getName();
arrOverTime[i] = circleList.get(i).getCol1();
}
/* 최종 결과 저장 */
for(int i = 0; i < circleList.size(); i++){
resultInfo.add(resultUserName[i] + "_" + arrOverTime[i]);
}
}
model.addAttribute("resultInfo", resultInfo);
model.addAttribute("proc", proc);
return folderPath + "circleChart";
}
반응형
LIST
'IT' 카테고리의 다른 글
Java indexOF 활용 / split 함수 내부 로직 구현 예시 (0) | 2022.07.18 |
---|---|
Java 태그 및 특수 문자 치환 함수 예시 / Egov Spring Controller (0) | 2022.07.18 |
Oracle Merge / Dual / Using on 등가 조인 / When Matched / When Not 사용 예시 (0) | 2022.07.15 |
Oracle ROWUNM, OVER 사용 예시 / MySQL LIMIT (0) | 2022.07.15 |
Oracle 날짜 포멧 TO_CHAR 사용 예시 (0) | 2022.07.15 |