231 lines
7.8 KiB
Java
231 lines
7.8 KiB
Java
|
|
package geoinfo.admins.userLog;
|
||
|
|
|
||
|
|
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
||
|
|
import geoinfo.admins.userLog.service.GeoInfoChService;
|
||
|
|
import geoinfo.com.EgovExcel;
|
||
|
|
import geoinfo.session.UserInfo;
|
||
|
|
|
||
|
|
import java.net.URLEncoder;
|
||
|
|
import java.text.SimpleDateFormat;
|
||
|
|
import java.util.Date;
|
||
|
|
import java.util.HashMap;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Locale;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
import javax.servlet.ServletOutputStream;
|
||
|
|
import javax.servlet.http.HttpServletRequest;
|
||
|
|
import javax.servlet.http.HttpServletResponse;
|
||
|
|
|
||
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
||
|
|
import org.springframework.stereotype.Controller;
|
||
|
|
import org.springframework.ui.ModelMap;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 관리자시스템 > 사용자접속 통계분석 > 지반정보유통을 처리하는 Controller 클래스
|
||
|
|
*
|
||
|
|
* @author 공간정보기술(주)
|
||
|
|
* @since 2017.06.07
|
||
|
|
* @version 1.0
|
||
|
|
* @see
|
||
|
|
*
|
||
|
|
* <pre>
|
||
|
|
* << 개정이력(Modification Information) >>
|
||
|
|
*
|
||
|
|
* 수정일 수정자 수정내용
|
||
|
|
* ------------ ---------------- ---------------------------
|
||
|
|
* 2017.06.07 공간정보기술(주) 최초 생성
|
||
|
|
*
|
||
|
|
* </pre>
|
||
|
|
*/
|
||
|
|
@Controller
|
||
|
|
public class GeoInfoChController {
|
||
|
|
@Resource(name = "geoInfoChService")
|
||
|
|
private GeoInfoChService masterService;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 관리자시스템 > 사용자접속 통계분석 > 지반정보유통 > 그룹별 리스트
|
||
|
|
*
|
||
|
|
* @param model
|
||
|
|
* @param response
|
||
|
|
* @param request
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "admins/userLog/10.do")
|
||
|
|
public String selectInfoListGrp(ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||
|
|
if (!UserInfo.isValidSession(request, response, "admin")) {
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
// List<?> resultList = masterService.selectInfoListGrp();
|
||
|
|
//
|
||
|
|
// model.addAttribute("resultList", resultList);
|
||
|
|
|
||
|
|
return "admins/userLog/10";
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 관리자시스템 > 사용자접속 통계분석 > 지반정보유통 > 그룹별 엑셀 리스트 다운로드
|
||
|
|
* @param workbook
|
||
|
|
* @param request
|
||
|
|
* @param response
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "admins/userLog/10_excel.do")
|
||
|
|
public void selectInfoListGrpExcel(HSSFWorkbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||
|
|
|
||
|
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||
|
|
|
||
|
|
List<?> selectInfoListExcel = masterService.selectInfoListGrp();
|
||
|
|
|
||
|
|
String[] arrHeader = { "년도", "월", "공급자", "지반조사업체", "설계업체", "시공업체", "유지보수업체", "중앙정부,지방청,공사", "지자체", "연구기관", "개인", "학교", "기타", "총계" };
|
||
|
|
|
||
|
|
map.put("selectInfoListExcel", selectInfoListExcel);
|
||
|
|
map.put("arrHeader", arrHeader);
|
||
|
|
map.put("sheetName", "그룹별 사용자 접속통계");
|
||
|
|
map.put("fileName", "그룹별사용자접속통계_");
|
||
|
|
|
||
|
|
buildExcelDocument(map, workbook, request, response);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 관리자시스템 > 사용자접속 통계분석 > 지반정보유통 > 날짜별 리스트
|
||
|
|
*
|
||
|
|
* @param params
|
||
|
|
* @param model
|
||
|
|
* @param response
|
||
|
|
* @param request
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "admins/userLog/11.do")
|
||
|
|
public String selectInfoListDate(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||
|
|
if (!UserInfo.isValidSession(request, response, "admin")) {
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
List<?> getYear_date = masterService.getYear_date();
|
||
|
|
|
||
|
|
if ("".equals(params.get("year")) || params.get("year") == null) {
|
||
|
|
params.put("year", ((EgovMap) getYear_date.get(0)).get("value"));
|
||
|
|
}
|
||
|
|
|
||
|
|
List<?> getMonth_date = masterService.getMonth_date(params);
|
||
|
|
|
||
|
|
if ("".equals(params.get("month")) || params.get("month") == null || (getMonth_date.size() != 0 && getMonth_date.size() < Integer.valueOf((String) params.get("month")))) {
|
||
|
|
params.put("month", ((EgovMap) getMonth_date.get(0)).get("value"));
|
||
|
|
}
|
||
|
|
|
||
|
|
List<?> resultList = masterService.selectInfoListDate(params);
|
||
|
|
|
||
|
|
model.addAttribute("params", params);
|
||
|
|
model.addAttribute("getYear_date", getYear_date);
|
||
|
|
model.addAttribute("getMonth_date", getMonth_date);
|
||
|
|
model.addAttribute("resultList", resultList);
|
||
|
|
|
||
|
|
return "admins/userLog/11";
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 관리자시스템 > 사용자접속 통계분석 > 지반정보유통 > 날짜별 리스트 > 그래프
|
||
|
|
* @param params
|
||
|
|
* @param model
|
||
|
|
* @param response
|
||
|
|
* @param request
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "admins/userLog/11_graph.do")
|
||
|
|
public String selectInfoGraph(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||
|
|
if (!UserInfo.isValidSession(request, response, "admin")) {
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
List<?> getYear_date = masterService.getYear_date();
|
||
|
|
|
||
|
|
if ("".equals(params.get("year")) || params.get("year") == null) {
|
||
|
|
params.put("year", ((EgovMap) getYear_date.get(0)).get("value"));
|
||
|
|
}
|
||
|
|
|
||
|
|
List<?> getMonth_date = masterService.getMonth_date_graph(params);
|
||
|
|
|
||
|
|
if ("".equals(params.get("month")) || params.get("month") == null || (getMonth_date.size() != 0 && getMonth_date.size() < Integer.valueOf((String) params.get("month")))) {
|
||
|
|
params.put("month", ((EgovMap) getMonth_date.get(0)).get("value"));
|
||
|
|
}
|
||
|
|
|
||
|
|
EgovMap result = masterService.selectInfoGraph(params);
|
||
|
|
model.addAttribute("params", params);
|
||
|
|
model.addAttribute("getYear_date", getYear_date);
|
||
|
|
model.addAttribute("getMonth_date", getMonth_date);
|
||
|
|
model.addAttribute("result", result);
|
||
|
|
|
||
|
|
return "admins/userLog/11_graph";
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 관리자시스템 > 사용자접속 통계분석 > 지반정보유통 > 날짜별 리스트 엑셀 다운로드
|
||
|
|
*
|
||
|
|
* @param workbook
|
||
|
|
* @param request
|
||
|
|
* @param response
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "admins/userLog/11_excel.do")
|
||
|
|
public void selectInfoListDateExcel(HSSFWorkbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||
|
|
|
||
|
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||
|
|
|
||
|
|
List<?> selectInfoListExcel = masterService.selectInfoListDateExcel();
|
||
|
|
|
||
|
|
String[] arrHeader = { "날짜", "총접속수" };
|
||
|
|
|
||
|
|
map.put("selectInfoListExcel", selectInfoListExcel);
|
||
|
|
map.put("arrHeader", arrHeader);
|
||
|
|
map.put("sheetName", "날짜별 사용자 접속통계");
|
||
|
|
map.put("fileName", "날짜별사용자접속통계_");
|
||
|
|
|
||
|
|
buildExcelDocument(map, workbook, request, response);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 관리자시스템 > 사용자접속 통계분석 > 지반정보유통 > 방문자수
|
||
|
|
*
|
||
|
|
* @param model
|
||
|
|
* @param response
|
||
|
|
* @param request
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@RequestMapping(value = "admins/userLog/30.do")
|
||
|
|
public String selectInfoListVisitor(ModelMap model, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||
|
|
if (!UserInfo.isValidSession(request, response, "admin")) {
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
return "admins/userLog/30";
|
||
|
|
}
|
||
|
|
|
||
|
|
public void buildExcelDocument(Map<String, Object> model, HSSFWorkbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||
|
|
|
||
|
|
List<?> selectInfoListExcel = (List<?>) model.get("selectInfoListExcel");
|
||
|
|
|
||
|
|
String[] arrHeader = (String[]) model.get("arrHeader");
|
||
|
|
|
||
|
|
Sheet sheet = workbook.createSheet((String) model.get("sheetName"));
|
||
|
|
|
||
|
|
EgovExcel.SetExcelList(workbook, sheet, arrHeader, selectInfoListExcel, 0, 0);
|
||
|
|
|
||
|
|
response.setContentType("application/vnd.ms-excel");
|
||
|
|
response.setHeader("Content-disposition",
|
||
|
|
"attachment;filename=" + URLEncoder.encode((String) model.get("fileName") + (new SimpleDateFormat("yyyy.MM.dd", Locale.KOREA)).format(new Date()), "UTF-8")
|
||
|
|
+ ".xls" + ";");
|
||
|
|
ServletOutputStream myOut = response.getOutputStream();
|
||
|
|
workbook.write(myOut); // 파일 저장
|
||
|
|
}
|
||
|
|
}
|