/********************************************************************************************************* * 프로그램명 : MDoc.java 프로그램설명 : 집계문서 기본정보 제공 작성자 : 강원중 작성일 : 2004.06.07 변경일 : 2004.09.16 **********************************************************************************************************/ package kr.co.kihyun.moumi.doc; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import javax.servlet.http.HttpSession; import kr.co.kihyun.moumi.MoumiConfig; import kr.co.kihyun.beans.entity.TotDoc; import kr.co.kihyun.beans.entity.TotDocProcess; import kr.co.kihyun.moumi.report.MReport; public class MDoc { /******** 집계문서 그룹 ********/ /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Type.FORM_DOC */ @Deprecated public final static int FORM_DOC = 1; // 양식들 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Type.FORM_DOC */ @Deprecated public final static int TOT_DOC = 2; // 문서들 /******** 문서의 기본 아이디 ********/ public final static Long DEF_TOTID = 200000001L; public final static Long DEF_FORMID = 100000001L; public final static int MAX_DOC_SIZE = 32; /******** 보고한 기관 정보 ********/ public final static String[] scope = { MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.personal"), MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.devision"), MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.all"), MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.every") }; public final static String[] scopeENG = { "per", "dept", "part", "all" }; /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Type.Process */ @Deprecated public final static String[] prss = { TotDocProcess.FORM.toString(), TotDocProcess.REG.toString(), TotDocProcess.PRSS.toString(), TotDocProcess.END.toString(), TotDocProcess.CANCEL.toString(), TotDocProcess.READ.toString() }; /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Type.Process */ @Deprecated public final static String[] prssENG = prss; /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.getDelType() */ @Deprecated public final static String[] delType = { MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.normality"), MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.delete") }; /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.getDelType() */ @Deprecated public final static String[] delTypeENG = { "not del", "del" }; /******** 집계문서 프로세스 상수 값 ********/ /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int FORM = TotDocProcess.FORM.ordinal(); // g = 1 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int REG = TotDocProcess.REG.ordinal(); // 등록된 집계문서 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int PRSS = TotDocProcess.PRSS.ordinal(); // 1 //진행중 집계문서 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int SUBMIT = TotDocProcess.SUBMIT.ordinal(); // 1 //종료된 집계문서 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int END = TotDocProcess.END.ordinal(); // 1 //종료된 집계문서 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int CANCLE = TotDocProcess.CANCEL.ordinal(); // 취소된 집계문서 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int READ = TotDocProcess.READ.ordinal(); // 열람된 집계문서 /* * @Deprecated use kr.co.kihyun.beans.entity.TotDoc.Process */ @Deprecated public final static int ALL = TotDocProcess.ALL.ordinal(); // 모든 집계문서 /******** 집계문서 삭제 타입 ********/ public static String getScope(int level) { if (level < 0 || level > scope.length - 1) { level = 2; } return scope[level]; } /***************** 집계글 등록시 양식함에두 같이 저장 *****************/ public static boolean isDoubleRegist = true; /******** 집계상태 종료 유,무 ********/ public static boolean getStatus(String endDate) { if (endDate == null || endDate.trim().equals("")) { return false; } // 현제 년, 월, 일 String currDate = ""; Calendar cl = Calendar.getInstance(); int year = cl.get(Calendar.YEAR); int month = cl.get(Calendar.MONTH) + 1; int date = cl.get(Calendar.DATE); currDate = year + ((month > 9) ? Integer.toString(month) : "0" + month) + ((date > 9) ? Integer.toString(date) : "0" + date); // DocUtil 종료일 try { endDate = (endDate.replaceAll("-", "")).substring(0, 8); if (Integer.parseInt(currDate) > Integer.parseInt(endDate)) { return false; } else { return true; } } catch (NumberFormatException ex) { ex.printStackTrace(); System.err.println("\n\nFile name : DocUtil.java, Method: getStatus()"); System.err.println("message : " + ex); return false; } } /******** 문서 보기 접근 권한 값 ********/ public static boolean isAccess(int accAuth, String regPartID, String regDeptID, String regUserID, String partID, String deptID, String userID) { // 문서의 접근권한 값: accAuth // 문서 소유자: userID // 문서 소유자의 부서: deptID // 문서 소유자의 기관: partID // 접근자: userID // 접근자의 부서: deptID // 접근자의 기관: partID // 1) 문서 정보 // 2) 문서 등록자 정보 // 3) 접근자 정보 // 1) accAuth == 0(전체) 참이면 기관이 같냐..? // 2) accAuth == 1(부서) 참이면 부서가 같냐..? // 3) accAuth == 2(개인) 참이면 본인이냐..? if (accAuth == 0) { if (partID != null && partID.equals(regPartID)) { return true; } } else if (accAuth == 1) { if (deptID != null && deptID.equals(regDeptID)) { return true; } } else if (accAuth == 2) { if (userID != null && userID.equals(regUserID)) { return true; } } return false; } public static void initSession(HttpSession session) { /********** session내의 doc info reset **********/ session.setAttribute("docName", ""); session.setAttribute("deptIDs", ""); session.setAttribute("deptNames", ""); session.setAttribute("accAuth", ""); // session.setAttribute("tableType", ""); old session.setAttribute("stDate", ""); session.setAttribute("stTime", ""); session.setAttribute("edDate", ""); session.setAttribute("edTime", ""); } public static String getTitleForm(TotDoc totDoc, int tableNum) { // 각 제출자의 제출문서에 대한 전체 표를 위한 객체 String[] tables = MReport.geteExtractTable(totDoc.getForm()); List> itemType = new ArrayList>(); List tmpArr; int count = 0; int arrayCount = 0; //+++ for (int i = 0; i < tables.length; i++) { tmpArr = new ArrayList(); //2014.11.11 Update by KWON,HAN : 집계현황에서 1번표 선택시 검색 속도 저하 개선 //for (int y = 0; y < MReport.getArrayCount(tables[i]); y++) { // tmpArr.add(totDoc.getTotItems().get(count++).getType().ordinal()); // if (y == MReport.getArrayCount(tables[i]) - 1) // itemType.add(tmpArr); //} arrayCount = MReport.getArrayCount(tables[i]); for (int y = 0; y < arrayCount; y++) { tmpArr.add(totDoc.getTotItems().get(count++).getType().ordinal()); if (y == (arrayCount - 1)) itemType.add(tmpArr); } //============================================================== } StringBuilder titleForm = new StringBuilder(); if (tableNum != 0) { int[] tmpList = new int[itemType.get(tableNum - 1).size()]; for (int i = 0; i < itemType.get(tableNum - 1).size(); i++) tmpList[i] = itemType.get(tableNum - 1).get(i); titleForm.append(new kr.co.kihyun.moumi.doc.table.MTableAnalysis(tables[tableNum - 1], tmpList).getTitleForm()); titleForm.append(""); } return titleForm.toString(); } }