Skip to content

Commit

Permalink
widget 임시 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
cheonjeongdae committed May 2, 2018
1 parent 225db3c commit 4718fed
Show file tree
Hide file tree
Showing 16 changed files with 979 additions and 248 deletions.
34 changes: 0 additions & 34 deletions eslintrc.json

This file was deleted.

7 changes: 6 additions & 1 deletion mago3d-admin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ war {
version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
// gralde 5.0 lombok error
//options.compilerArgs += ["-proc:none"]
}
compileJava.options.encoding = 'UTF-8'

repositories {
Expand Down
120 changes: 75 additions & 45 deletions mago3d-admin/src/main/java/com/gaia3d/controller/WidgetController.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@

import com.gaia3d.config.PropertiesConfig;
import com.gaia3d.domain.AccessLog;
import com.gaia3d.domain.CacheManager;
import com.gaia3d.domain.DataInfo;
import com.gaia3d.domain.PGStatActivity;
import com.gaia3d.domain.Project;
import com.gaia3d.domain.ScheduleLog;
import com.gaia3d.domain.UserInfo;
import com.gaia3d.domain.UserSession;
import com.gaia3d.domain.Widget;
import com.gaia3d.helper.SessionUserHelper;
import com.gaia3d.service.APIService;
import com.gaia3d.service.AccessLogService;
import com.gaia3d.service.DataService;
import com.gaia3d.service.IssueService;
import com.gaia3d.service.MonitoringService;
import com.gaia3d.service.ProjectService;
import com.gaia3d.service.ScheduleService;
import com.gaia3d.service.UserService;
import com.gaia3d.service.WidgetService;
Expand Down Expand Up @@ -56,7 +61,10 @@ public class WidgetController {

@Autowired
private HikariDataSource dataSource;

@Autowired
private ProjectService projectService;
@Autowired
private DataService dataService;
@Autowired
private APIService aPIService;
@Autowired
Expand Down Expand Up @@ -119,10 +127,10 @@ public String modifyWidget(HttpServletRequest request, Model model) {

// dbcpWidget
model.addAttribute("userSessionCount", SessionUserHelper.loginUsersMap.size());
// model.addAttribute("initialSize", dataSource.getInitialSize());
model.addAttribute("initialSize", dataSource.getMaximumPoolSize());
//// model.addAttribute("maxTotal", dataSource.getMaxTotal());
// model.addAttribute("maxIdle", dataSource.getMaxIdle());
// model.addAttribute("minIdle", dataSource.getMinIdle());
model.addAttribute("minIdle", dataSource.getMinimumIdle());
// model.addAttribute("numActive", dataSource.getNumActive());
// model.addAttribute("numIdle", dataSource.getNumIdle());
// 사용자 dbcp 정보
Expand Down Expand Up @@ -191,6 +199,70 @@ public Map<String, Object> ajaxUpdateWidget(HttpServletRequest request, Widget w
return map;
}

/**
* 프로젝트별 데이터 건수
* @param request
* @return
*/
@RequestMapping(value = "ajax-project-data-widget.do")
@ResponseBody
public Map<String, Object> ajaxProjectDataWidget(HttpServletRequest request) {

Map<String, Object> map = new HashMap<>();
String result = "success";
try {
Project defaultProject = new Project();
defaultProject.setUse_yn(Project.IN_USE);
List<Project> projectList = projectService.getListProject(defaultProject);
List<String> projectNameList = new ArrayList<>();
List<Long> dataTotalCountList = new ArrayList<>();
for(Project project : projectList) {
projectNameList.add(project.getProject_name());
DataInfo dataInfo = new DataInfo();
dataInfo.setProject_id(project.getProject_id());
Long dataTotalCount = dataService.getDataTotalCount(dataInfo);
dataTotalCountList.add(dataTotalCount);
}

map.put("projectNameList", projectNameList);
map.put("dataTotalCountList", dataTotalCountList);
} catch(Exception e) {
e.printStackTrace();
result = "db.exception";
}

map.put("result", result);
return map;
}

/**
* 데이터 상태별 통계 정보
* @param request
* @return
*/
@RequestMapping(value = "ajax-data-status-widget.do")
@ResponseBody
public Map<String, Object> ajaxDataStatusStatistics(HttpServletRequest request) {

Map<String, Object> map = new HashMap<>();
String result = "success";
try {
long useTotalCount = dataService.getDataTotalCountByStatus(DataInfo.STATUS_USE);
long forbidTotalCount = dataService.getDataTotalCountByStatus(DataInfo.STATUS_FORBID);
long etcTotalCount = dataService.getDataTotalCountByStatus(DataInfo.STATUS_ETC);

map.put("useTotalCount", useTotalCount);
map.put("forbidTotalCount", forbidTotalCount);
map.put("etcTotalCount", etcTotalCount);
} catch(Exception e) {
e.printStackTrace();
result = "db.exception";
}

map.put("result", result);
return map;
}

/**
* 사용자 추적 이력 목록
* @param model
Expand Down Expand Up @@ -282,48 +354,6 @@ private Map<String, Integer> getUserDbcp() {
Integer numActive = 0;
Integer numIdle = 0;

// 사용자 서버 8445 포트 license를 갱신해야 함
// ExternalService targetExternalService = null;
// String activeServerIp = WebUtil.getServerIp(CACHE_FILE);
// ExternalService searchExternalService = new ExternalService();
// searchExternalService.setService_type(ExternalService.OTP_SERVER);
// List<ExternalService> remoteCacheServerList = aPIService.getListExternalService(searchExternalService);
// for(ExternalService externalService : remoteCacheServerList) {
// if("UNIX".equals(OS_TYPE)) {
// if(activeServerIp.equals(externalService.getServer_ip()) && (ExternalService.USER_PORT.intValue() == externalService.getUrl_port().intValue())) {
// targetExternalService = externalService;
// break;
// }
// } else {
// targetExternalService = externalService;
// }
// }
//
// targetExternalService.setUrl_path("monitoring/call-dbcp.do");
// String authData = "api-key=" + Crypt.decrypt(REST_AUTH_KEY) + "&time=" + System.nanoTime();
// authData = Crypt.encrypt(authData);
//
// String jsonData = HttpClientHelper.httpsPostAPICallWithoutCertificate(targetExternalService, authData);
// log.info("@@@@@@@@@@@@@@@@@@@@ jsonData = {}", jsonData);
// if(jsonData != null && !"".equals(jsonData)) {
// map resultObject = map.fromObject(jsonData);
// if(!resultObject.isEmpty()) {
// success_yn = resultObject.getString("success_yn");
// result_message = resultObject.getString("result_message");
// if(APILog.RESULT_SUCCESS.equals(success_yn)) {
// userSessionCount = resultObject.getInt("userSessionCount");
// initialSize = resultObject.getInt("initialSize");
// maxTotal = resultObject.getInt("maxTotal");
// maxIdle = resultObject.getInt("maxIdle");
// minIdle = resultObject.getInt("minIdle");
// numActive = resultObject.getInt("numActive");
// numIdle = resultObject.getInt("numIdle");
// } else {
// log.error("@@@ success_yn = N. result_message = {}", result_message);
// }
// }
// }

userDbcp.put("userSessionCount", userSessionCount);
userDbcp.put("initialSize", initialSize);
userDbcp.put("maxTotal", maxTotal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ public interface DataService {
*/
Long getDataTotalCount(DataInfo dataInfo);

/**
* 데이터 상태별 통계 정보
* @param status
* @return
*/
Long getDataTotalCountByStatus(String status);

/**
* Data 목록
* @param dataInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ public Long getDataTotalCount(DataInfo dataInfo) {
return dataMapper.getDataTotalCount(dataInfo);
}

/**
* 데이터 상태별 통계 정보
* @param status
* @return
*/
@Transactional(readOnly=true)
public Long getDataTotalCountByStatus(String status) {
return dataMapper.getDataTotalCountByStatus(status);
}

/**
* Data 목록
* @param dataInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ config.menu.image=이미지
config.menu.image.alt=이미지 Alt
config.menu.cancel=취소
config.widget.top=마우스로 위젯을 끌어 당겨, 메인 화면에 표시할 위치를 정하신 후 저장 버튼을 눌러 주십시오.
config.widget.project.more=프로젝트 현황 더보기
config.widget.data.info.more=데이터 상태별 현황 더보기
config.widget.data.info.log.more=데이터 변경요청 이력 더보기
config.widget.user.status=사용자 상태별 현황
config.widget.user.status.more=사용자 상태별 현황 더보기
config.widget.schedule=스케줄 실행 이력
Expand Down
Loading

0 comments on commit 4718fed

Please sign in to comment.