Java Code Examples for cn.hutool.log.StaticLog#info()

The following examples show how to use cn.hutool.log.StaticLog#info() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CityStats.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
public static void parseCounty(String url, Area cityArea) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("countytr");
    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements links = tr.getElementsByTag("a");
        if (links == null || links.size() != 2) {
            continue;
        }
        String href = links.get(0).attr("href");
        String countyCode = links.get(0).text().substring(0, 6);
        String countyName = links.get(1).text();

        Area countyArea = Area.builder().label(countyName).code(countyCode).source(url)
                .sortValue(sort++).level(new RemoteData<>("COUNTY")).fullName(cityArea.getFullName() + countyName)
                .build();

        StaticLog.info("		县级数据:  {}  ", countyArea);

        parseTowntr(COMMON_URL + href.subSequence(2, 5).toString() + "/" + href, countyArea);
        counties.add(cityArea);
    }
    cityArea.setChildren(counties);
}
 
Example 2
Source File: CityStats.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
public static void parseVillagetr(String url, Area countyArea) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("villagetr");

    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements tds = tr.getElementsByTag("td");
        if (tds == null || tds.size() != 3) {
            continue;
        }
        String villagetrCode = tds.get(0).text();
        String villagetrName = tds.get(2).text();

        Area villagetrArea = Area.builder().code(villagetrCode).label(villagetrName).source(url)
                .sortValue(sort++).level(new RemoteData<>("VILLAGETR")).fullName(countyArea.getFullName() + villagetrName)
                .build();
        StaticLog.info("		村级数据:  {}  ", villagetrArea);

        counties.add(villagetrArea);

    }
    countyArea.setChildren(counties);
}
 
Example 3
Source File: NoBootTest.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
@Test
public void testBeanUtil() {

    //10000 - 511
    //50000 - 719
    //100000 - 812
    //1000000 - 2303

    TimeInterval timer = DateUtil.timer();
    for (int i = 0; i <= 1000000; i++) {
        Org org = Org.builder()
                .label("string")
                .id(123L + i)
                .createTime(LocalDateTime.now())
                .build();
        Station station = Station.builder().id(1L + i).name("nihaoa").createTime(LocalDateTime.now()).orgId(new RemoteData(12L, org)).build();

        StationPageDTO stationPageDTO = new StationPageDTO();

        BeanUtil.copyProperties(station, stationPageDTO);
    }

    long interval = timer.interval();// 花费毫秒数
    long intervalMinute = timer.intervalMinute();// 花费分钟数
    StaticLog.info("本次程序执行 花费毫秒数: {} ,   花费分钟数:{} . ", interval, intervalMinute);
}
 
Example 4
Source File: CityStats.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
public static void parseCity(String url, Area provinceArea) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("citytr");
    List<Area> cities = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements links = tr.getElementsByTag("a");
        String href = links.get(0).attr("href");
        String cityCode = links.get(0).text().substring(0, 4);
        String cityName = links.get(1).text();

        Area cityArea = Area.builder().label(cityName).code(cityCode).source(url)
                .sortValue(sort++).level(new RemoteData<>("CITY")).fullName(provinceArea.getFullName() + cityName)
                .build();

        StaticLog.info("	市级数据:  {}  ", cityArea);

        parseCounty(COMMON_URL + href, cityArea);
        cities.add(cityArea);
    }
    provinceArea.setChildren(cities);
}
 
Example 5
Source File: CityStats.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
public static void parseCounty(String url, Area cityArea) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("countytr");
    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements links = tr.getElementsByTag("a");
        if (links == null || links.size() != 2) {
            continue;
        }
        String href = links.get(0).attr("href");
        String countyCode = links.get(0).text().substring(0, 6);
        String countyName = links.get(1).text();

        Area countyArea = Area.builder().label(countyName).code(countyCode).source(url)
                .sortValue(sort++).level(new RemoteData<>("COUNTY")).fullName(cityArea.getFullName() + countyName)
                .build();

        StaticLog.info("		县级数据:  {}  ", countyArea);

        parseTowntr(COMMON_URL + href.subSequence(2, 5).toString() + "/" + href, countyArea);
        counties.add(cityArea);
    }
    cityArea.setChildren(counties);
}
 
Example 6
Source File: CityStats.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
public static void parseVillagetr(String url, Area countyArea) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("villagetr");

    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements tds = tr.getElementsByTag("td");
        if (tds == null || tds.size() != 3) {
            continue;
        }
        String villagetrCode = tds.get(0).text();
        String villagetrName = tds.get(2).text();

        Area villagetrArea = Area.builder().code(villagetrCode).label(villagetrName).source(url)
                .sortValue(sort++).level(new RemoteData<>("VILLAGETR")).fullName(countyArea.getFullName() + villagetrName)
                .build();
        StaticLog.info("		村级数据:  {}  ", villagetrArea);

        counties.add(villagetrArea);

    }
    countyArea.setChildren(counties);
}
 
Example 7
Source File: TestResource.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
@Test
public void testDozerAndBean() {

    //10000 - 688
    //50000 - 2130
    //100000 - 4050  2438
    //1000000 - 22085   20375

    // 放弃理由

    TimeInterval timer = DateUtil.timer();
    for (int i = 0; i <= 1000000; i++) {
        Org org = Org.builder()
                .label("string")
                .id(123L + i)
                .createTime(LocalDateTime.now())
                .build();
        Station station = Station.builder().id(1L + i).name("nihaoa").createTime(LocalDateTime.now()).orgId(new RemoteData(12L, org)).build();

        StationPageDTO stationPageDTO = dozer.map(station, StationPageDTO.class);
    }

    long interval = timer.interval();// 花费毫秒数
    long intervalMinute = timer.intervalMinute();// 花费分钟数
    StaticLog.info("本次程序执行 花费毫秒数: {} ,   花费分钟数:{} . ", interval, intervalMinute);
}
 
Example 8
Source File: NoBootTest.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
@Test
public void testBeanUtil() {

    //10000 - 511
    //50000 - 719
    //100000 - 812
    //1000000 - 2303

    TimeInterval timer = DateUtil.timer();
    for (int i = 0; i <= 1000000; i++) {
        Org org = Org.builder()
                .label("string")
                .id(123L + i)
                .createTime(LocalDateTime.now())
                .build();
        Station station = Station.builder().id(1L + i).name("nihaoa").createTime(LocalDateTime.now()).orgId(new RemoteData(12L, org)).build();

        StationPageDTO stationPageDTO = new StationPageDTO();

        BeanUtil.copyProperties(station, stationPageDTO);
    }

    long interval = timer.interval();// 花费毫秒数
    long intervalMinute = timer.intervalMinute();// 花费分钟数
    StaticLog.info("本次程序执行 花费毫秒数: {} ,   花费分钟数:{} . ", interval, intervalMinute);
}
 
Example 9
Source File: CityParser.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
private List<Area> parseProvince(String url) {

        String htmlStr = HttpUtil.get(url, CHARSET);
        Document document = Jsoup.parse(htmlStr);

        // 获取 class='provincetr' 的元素
        Elements elements = document.getElementsByClass("provincetr");
        List<Area> provinces = new LinkedList<Area>();
        int sort = 1;
        for (Element element : elements) {
            // 获取 elements 下属性是 href 的元素
            Elements links = element.getElementsByAttribute("href");
            for (Element link : links) {
                String provinceName = link.text();
                String href = link.attr("href");
                String provinceCode = href.substring(0, 2);

                Area provinceArea = Area.builder().code(provinceCode + "0000")
                        .label(provinceName).source(url)
                        .sortValue(sort++)
                        .level(new RemoteData<>("PROVINCE"))
                        .fullName(provinceName)
                        .build();
                provinceArea.setChildren(parseCity(provinceName, COMMON_URL + href));

                StaticLog.info("省级数据:  {}  ", provinceArea);

                provinces.add(provinceArea);
            }
        }
        return provinces;
    }
 
Example 10
Source File: CityStats.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
public static void parseTowntr(String url, Area countyArea) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("towntr");

    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements links = tr.getElementsByTag("a");
        if (links == null || links.size() != 2) {
            continue;
        }
        String href = links.get(0).attr("href");
        String towntrCode = links.get(0).text().substring(0, 9);
        String towntrName = links.get(1).text();

        Area towntrArea = Area.builder().label(towntrName).code(towntrCode).source(url)
                .sortValue(sort++).level(new RemoteData<>("TOWNTR")).fullName(countyArea.getFullName() + towntrName)
                .build();

        StaticLog.info("		乡镇级数据:  {}  ", towntrArea);

        parseVillagetr(COMMON_URL + href.subSequence(2, 5).toString() + "/" + href.substring(5, 7) + "/" + href,
                countyArea);

        counties.add(towntrArea);
    }
    countyArea.setChildren(counties);
}
 
Example 11
Source File: CityParserTest.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
@Test
public void init() {
    TimeInterval timer = DateUtil.timer();
    // -------这是执行过程--------------
    cityParserDecorator();
    // ---------------------------------
    long interval = timer.interval();// 花费毫秒数
    long intervalMinute = timer.intervalMinute();// 花费分钟数
    StaticLog.info("本次程序执行 花费毫秒数: {} ,   花费分钟数:{} . ", interval, intervalMinute);
}
 
Example 12
Source File: CityParser.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 村庄数据
 *
 * @param url
 * @return
 */
public List<Area> parseVillagetr(String fullName, String url) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("villagetr");

    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements tds = tr.getElementsByTag("td");
        if (tds == null || tds.size() != 3) {
            continue;
        }
        String villagetrCode = tds.get(0).text();
        String villagetrName = tds.get(2).text();

        Area villagetrArea = Area.builder().code(villagetrCode)
                .label(villagetrName)
                .fullName(fullName + villagetrName)
                .sortValue(sort++)
                .source(url).build();
        StaticLog.info("				村级数据:  {}  ", villagetrArea);

        counties.add(villagetrArea);
    }
    return counties;
}
 
Example 13
Source File: CityParser.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
/**
     * 乡镇级数据
     *
     * @param url
     * @return
     */
    public List<Area> parseTowntr(String fullName, String url) {
        String htmlStr = HttpUtil.get(url, CHARSET);
        Document document = Jsoup.parse(htmlStr);
        Elements trs = document.getElementsByClass("towntr");

        List<Area> counties = new LinkedList<Area>();
        int sort = 1;
        for (Element tr : trs) {
            Elements links = tr.getElementsByTag("a");
            if (links == null || links.size() != 2) {
                continue;
            }
            String href = links.get(0).attr("href");
            String towntrCode = links.get(0).text();
//            String towntrCode = links.get(0).text().substring(0, 6);
            String towntrName = links.get(1).text();

            Area towntrArea = Area.builder()
                    .label(towntrName).code(towntrCode).source(url)
                    .fullName(fullName + towntrName)
                    .level(new RemoteData<>("TOWNTR"))
                    .sortValue(sort++)
//                    .nodes(parseVillagetr(fullName + towntrName, COMMON_URL + href.subSequence(2, 5).toString() + "/" + href.substring(5, 7) + "/" + href))
                    .build();

            StaticLog.info("			乡镇级数据:  {}  ", towntrArea);

            counties.add(towntrArea);
        }
        return counties;
    }
 
Example 14
Source File: OcrUtils.java    From tools-ocr with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static String ocrImg(byte[] imgData) {
    int i = Math.abs(UUID.randomUUID().hashCode()) % 4;
    StaticLog.info("OCR Engine: " + i);
    switch (i){
        case 0:
            return bdGeneralOcr(imgData);
        case 1:
            return bdAccurateOcr(imgData);
        case 2:
            return sogouMobileOcr(imgData);
        default:
            return sogouWebOcr(imgData);
    }
}
 
Example 15
Source File: CityParser.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 村庄数据
 *
 * @param url
 * @return
 */
public List<Area> parseVillagetr(String fullName, String url) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("villagetr");

    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements tds = tr.getElementsByTag("td");
        if (tds == null || tds.size() != 3) {
            continue;
        }
        String villagetrCode = tds.get(0).text();
        String villagetrName = tds.get(2).text();

        Area villagetrArea = Area.builder().code(villagetrCode)
                .label(villagetrName)
                .fullName(fullName + villagetrName)
                .sortValue(sort++)
                .source(url).build();
        StaticLog.info("				村级数据:  {}  ", villagetrArea);

        counties.add(villagetrArea);
    }
    return counties;
}
 
Example 16
Source File: CityParser.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
private List<Area> parseProvince(String url) {

        String htmlStr = HttpUtil.get(url, CHARSET);
        Document document = Jsoup.parse(htmlStr);

        // 获取 class='provincetr' 的元素
        Elements elements = document.getElementsByClass("provincetr");
        List<Area> provinces = new LinkedList<Area>();
        int sort = 1;
        for (Element element : elements) {
            // 获取 elements 下属性是 href 的元素
            Elements links = element.getElementsByAttribute("href");
            for (Element link : links) {
                String provinceName = link.text();
                String href = link.attr("href");
                String provinceCode = href.substring(0, 2);

                Area provinceArea = Area.builder().code(provinceCode + "0000")
                        .label(provinceName).source(url)
                        .sortValue(sort++)
                        .level(new RemoteData<>("PROVINCE"))
                        .fullName(provinceName)
                        .build();
                provinceArea.setChildren(parseCity(provinceName, COMMON_URL + href));

                StaticLog.info("省级数据:  {}  ", provinceArea);

                provinces.add(provinceArea);
            }
        }
        return provinces;
    }
 
Example 17
Source File: CityStats.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
public static void parseTowntr(String url, Area countyArea) {
    String htmlStr = HttpUtil.get(url, CHARSET);
    Document document = Jsoup.parse(htmlStr);
    Elements trs = document.getElementsByClass("towntr");

    List<Area> counties = new LinkedList<Area>();
    int sort = 1;
    for (Element tr : trs) {
        Elements links = tr.getElementsByTag("a");
        if (links == null || links.size() != 2) {
            continue;
        }
        String href = links.get(0).attr("href");
        String towntrCode = links.get(0).text().substring(0, 9);
        String towntrName = links.get(1).text();

        Area towntrArea = Area.builder().label(towntrName).code(towntrCode).source(url)
                .sortValue(sort++).level(new RemoteData<>("TOWNTR")).fullName(countyArea.getFullName() + towntrName)
                .build();

        StaticLog.info("		乡镇级数据:  {}  ", towntrArea);

        parseVillagetr(COMMON_URL + href.subSequence(2, 5).toString() + "/" + href.substring(5, 7) + "/" + href,
                countyArea);

        counties.add(towntrArea);
    }
    countyArea.setChildren(counties);
}
 
Example 18
Source File: CityStats.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
public static void parseProvince(String url) {

        String htmlStr = HttpUtil.get(url, CHARSET);

        Document document = Jsoup.parse(htmlStr);

        // 获取 class='provincetr' 的元素
        Elements elements = document.getElementsByClass("provincetr");
        List<Area> provinces = new LinkedList<Area>();
        int sort = 1;
        for (Element element : elements) {
            // 获取 elements 下属性是 href 的元素
            Elements links = element.getElementsByAttribute("href");
            for (Element link : links) {
                String provinceName = link.text();
                String href = link.attr("href");
                String provinceCode = href.substring(0, 2);

                StaticLog.info("provinceName: {} , provinceCode: {} .", provinceName, provinceCode);

                Area provinceArea = Area.builder().code(provinceCode).label(provinceName).source(url)
                        .sortValue(sort++).fullName(provinceName).level(new RemoteData<>("PROVINCE"))
                        .build();

                StaticLog.info("省级数据:  {}  ", provinceArea);

                parseCity(COMMON_URL + href, provinceArea);
                provinces.add(provinceArea);
            }
        }
        StaticLog.info(JSONUtil.toJsonPrettyStr(provinces));
    }
 
Example 19
Source File: LocationCityParserDecorator.java    From zuihou-admin-cloud with Apache License 2.0 4 votes vote down vote up
public List<Area> parseProvinces(List<Area> list) {

        StaticLog.info("查询出经纬度了. . . ");
        return list;
    }
 
Example 20
Source File: LocationCityParserDecorator.java    From zuihou-admin-boot with Apache License 2.0 4 votes vote down vote up
public List<Area> parseProvinces(List<Area> list) {

        StaticLog.info("查询出经纬度了. . . ");
        return list;
    }