package com.vrv.paw.axiswebservices;

import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext; import com.vrv.paw.domain.Area;
import com.vrv.paw.service.AreaService; public class AreaWebService {

  //这里用的是最笨的方法,用代码实例化
private static WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();
AreaService areaService = (AreaService) context.getBean("areaService"); public String getAreaCode(String araeIP) {
Area area = areaService.queryAreaByServerIp(araeIP);
String areaCode = area != null ? area.getCode() : "";
return areaCode;
} }
05-08 08:00