Merge branch 'anjooyoung'

This commit is contained in:
JooYoung 2022-12-08 15:18:15 +09:00
commit 8269036e07
2 changed files with 31 additions and 9 deletions

View File

@ -1,6 +1,9 @@
package kcc.kccadr.message; package kcc.kccadr.message;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -52,15 +55,33 @@ public class SchedulerUtil {
@Scheduled(cron = "0 0/10 * * * *") @Scheduled(cron = "0 0/10 * * * *")
@SchedulerLock(name = "kakaoAtSendPrcs", lockAtMostForString = ONE_MIN, lockAtLeastForString = ONE_MIN) @SchedulerLock(name = "kakaoAtSendPrcs", lockAtMostForString = ONE_MIN, lockAtLeastForString = ONE_MIN)
public void kakaoAtSendPrcs() throws Exception { public void kakaoAtSendPrcs() throws Exception {
System.out.println("===========at scheduler run============");
String ip = null; String hostAddr = null;
//모든 OS에서 서버 고정 IP를 가져오기
try {
Enumeration<NetworkInterface> nienum = NetworkInterface.getNetworkInterfaces();
while (nienum.hasMoreElements()) {
NetworkInterface ni = nienum.nextElement();
Enumeration<InetAddress> kk= ni.getInetAddresses();
while (kk.hasMoreElements()) {
InetAddress inetAddress = kk.nextElement();
if (!inetAddress.isLoopbackAddress() &&
!inetAddress.isLinkLocalAddress() &&
inetAddress.isSiteLocalAddress()) {
hostAddr = inetAddress.getHostAddress().toString();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
try { try {
ip = InetAddress.getLocalHost().getHostAddress(); hostAddr = InetAddress.getLocalHost().getHostAddress();
System.out.println("===========at scheduler run============"); System.out.println("server ip ============" + hostAddr);
System.out.println("server ip ============" + ip); if(hostAddr.equals(myLocalIp) || hostAddr.equals(devIp) || hostAddr.equals(dmzIp1) || hostAddr.equals(dmzIp2) ) {
if(ip.equals(myLocalIp) || ip.equals(devIp) || ip.equals(dmzIp1) || ip.equals(dmzIp2) ) {
//접속 서버 분기처리 필요 //접속 서버 분기처리 필요
List<KakaoAtSendVO> list = kakaoAtSendService.selectKakaoAtList(); List<KakaoAtSendVO> list = kakaoAtSendService.selectKakaoAtList();
@ -79,13 +100,14 @@ public class SchedulerUtil {
} }
} }
System.out.println("===========at scheduler finish============");
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
System.out.println("===========at scheduler finish============");
} }
@Bean @Bean

View File

@ -205,6 +205,6 @@ Globals.Kakao.Key=bf3de0d897afe0e4bef0775f7086f048
# \uce74\uce74\uc624\uc54c\ub9bc\ud1a1(\ube44\uc988\ubfcc\ub9ac\uc624) API URL # \uce74\uce74\uc624\uc54c\ub9bc\ud1a1(\ube44\uc988\ubfcc\ub9ac\uc624) API URL
#\uac1c\ubc1c\uc11c\ubc84 #\uac1c\ubc1c\uc11c\ubc84
#Globals.BizPpurio.siteUrl=https://dev-api.bizppurio.com Globals.BizPpurio.siteUrl=https://dev-api.bizppurio.com
#\uc2e4\uc11c\ubc84 #\uc2e4\uc11c\ubc84
Globals.BizPpurio.siteUrl=https://api.bizppurio.com #Globals.BizPpurio.siteUrl=https://api.bizppurio.com