헬스체크 수정

main
이범준 5 months ago
parent 6106fb5472
commit c691e6b72c

@ -3,6 +3,8 @@ package cfs.schd.config;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.slf4j.Logger;
@ -16,6 +18,7 @@ import cfs.schd.LocalResidentsCarInfo;
import cfs.schd.PrpCarInfo;
import cfs.schd.dao.SchdDao;
import cfs.trsmrcv.dao.TrsmrcvDao;
import cfs.trsmrcv.service.CommCollectServerService;
@EnableScheduling
@Component
@ -32,12 +35,39 @@ public class CfsScheduleCron {
@Resource(name="localResidentsCarInfo")
private LocalResidentsCarInfo localResidentsCarInfo;
@Resource(name="commCollectServerService")
private CommCollectServerService commCollectServerService;
@Resource(name="trsmrcvDao")
private TrsmrcvDao trsmrcvDao;
@Resource(name="schdDao")
private SchdDao schdDao;
/**
* WAS
*/
@Scheduled(cron = "0 */4 * * * *")
public void healthCheckScheduleRun() {
String sysTyCode = "";
if(WASInfo.getWAS().equals("A")){
sysTyCode = "30";
} else if(WASInfo.getWAS().equals("B")){
sysTyCode = "31";
}
if(!sysTyCode.equals("")){
Map<String, String> mapOrg = new HashMap<String, String>();
mapOrg.put("sysTyCode", sysTyCode);
mapOrg.put("sysSttusCode", "2");
try {
commCollectServerService.insertServerStauts(mapOrg);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* ,,
*/

@ -4,7 +4,6 @@
<insert id="insertServerStauts" parameterType="hashmap">
/* 서버 상태정보 추가 */
insert into DBUSER_ICS.TB_ICS_OPER_SYS_STTUS (
SYS_TY_CODE,
COLCT_DT,
@ -15,7 +14,7 @@
values(
#{sysTyCode},
to_char(sysdate, 'YYYYMMDDHH24MISS'),
'2',
#{sysSttusCode},
SYSDATE,
'cfs'
)

@ -0,0 +1,84 @@
package cfs.trsmrcv.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import cfs.common.util.Result;
import cfs.common.util.ResultSmartPlatform;
import cfs.trsmrcv.service.CommCollectServerService;
@Controller
public class CommHealthCheckController {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource(name="commCollectServerService")
private CommCollectServerService commCollectServerService;
/**
*
* <pre></pre>
*/
@RequestMapping(value="/cfs/trsmrcv/insertServerStatus.do", method=RequestMethod.POST)
public @ResponseBody Map<String, Object> insertServerStatus(
@RequestBody Map<String, String> param,
HttpServletRequest request) throws Exception {
ResultSmartPlatform result = new ResultSmartPlatform();
try {
Map<String, String> mapOrg = new HashMap<String, String>();
String sysTyCode = "";
if(param != null){
if(param.get("sysTyCode") != null){
sysTyCode = param.get("sysTyCode");
}
}
boolean isOk = false;
if(!sysTyCode.equals("")) {
mapOrg.put("sysTyCode", sysTyCode);
mapOrg.put("sysSttusCode", param.get("sysSttusCode"));
if(commCollectServerService.insertServerStauts(mapOrg) < 0) {
// 실패
result.setErrorMsg(null, null);
} else {
isOk = true;
}
}
if(isOk == true) {
result.setData(ResultSmartPlatform.RESULT_KEY_DEFAULT, "");
result.setMsg(ResultSmartPlatform.STATUS_SUCESS, "정상적으로 처리되었습니다.");
} else {
result.setErrorMsg(null, null);
}
}catch(RuntimeException e) {
result.setErrorMsg(Result.STATUS_ERROR, Result.STATUS_ERROR_MESSAGE);
} catch (Exception e) {
result.setErrorMsg(Result.STATUS_ERROR, Result.STATUS_ERROR_MESSAGE);
}
finally {
logger.info(result.getResult().get("resultMessage").toString());
}
return result.getResult();
}
}

@ -96,53 +96,7 @@ public class CommHoJController {
/**
*
* <pre></pre>
*/
@RequestMapping(value="/cfs/trsmrcv/insertServerStauts.do", method=RequestMethod.POST)
public @ResponseBody Map<String, Object> insertServerStauts(@RequestBody Map<String, String> param, HttpServletRequest request) throws Exception {
ResultSmartPlatform result = new ResultSmartPlatform();
try {
// 파라미터 없는 경우.....
Map<String, String> mapOrg = new HashMap<String, String>();
List<String> list = new ArrayList<String>();
list.add("30"); // WAS #1
list.add("31"); // WAS #2
list.add("32"); // 수집서버
list.add("33"); // 1호터널 연계서버
list.add("34"); // 3호터널 연계서버
boolean isOk = false;
for(int i = 0; i < list.size(); i++) {
mapOrg.put("sysTyCode", list.get(i));
if(commCollectServerService.insertServerStauts(mapOrg) < 0) {
// 실패
result.setErrorMsg(null, null);
}
else {
isOk = true;
}
}
if(isOk == true) {
result.setData(ResultSmartPlatform.RESULT_KEY_DEFAULT, "");
result.setMsg(ResultSmartPlatform.STATUS_SUCESS, "정상적으로 처리되었습니다.");
}
else
result.setErrorMsg(null, null);
}catch(RuntimeException e) {
result.setErrorMsg(Result.STATUS_ERROR, Result.STATUS_ERROR_MESSAGE);
} catch (Exception e) {
result.setErrorMsg(Result.STATUS_ERROR, Result.STATUS_ERROR_MESSAGE);
}
finally {
logger.info(result.getResult().get("resultMessage").toString());
}
return result.getResult();
}
}

@ -33,7 +33,7 @@ import cfs.schd.dao.SchdDao;
import cfs.trsmrcv.dao.TrsmrcvDao;
@Controller
public class TrsmrcvController {
public class TestController {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
Loading…
Cancel
Save