zoukankan      html  css  js  c++  java
  • 自动审核工具

    本脚本依赖 jodd http工具箱,流程为登录、查询、解析、审核

    package jodd.http;
    
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    public class AutoApply {
    
        String username = "";
        String password = "";
    
        String machineInfo = "2YOcO6I0x6XXGNfPd5SxS30E%2F26nW7Wd%2FJCZo5%2F0guOo7cjy0DiJVgTio2eNwb0QVroN2sKIzjhumjgQpkLBoghi6zjes2WiEt2D9YhqiZYGWyFRrQOdXUi58SjU9GSapcOUjBSZK61NGkYd0zRdte9fAZbRl3FuU0k22JyrI9APQ%2FbD1RKfKkh4mocLlZD6IAgQBv0k9syWQz%2B60AYwZaQccgFItPuL";
    
        String loginUrl = "http://172.18.138.35:8888/sign/login/login.do?";
    
        String jsessionid = "";
    
        public static void main(String[] args) throws IOException {
    
            new AutoApply().process();
    
        }
    
        public void process() throws IOException {
    
            login();
    
            List<String> list = getIds();
    
            while (list != null && list.size() > 0) {
    
                apply(list);
    
                list = getIds();
            }
    
        }
    
        private void login() throws IOException {
    
            String url = loginUrl + "username=" + username + "&password=" + password + "&machineInfo" + machineInfo;
    
            String body = HttpRequest.post(url).send().toString();
    
            BufferedReader reader = new BufferedReader(new StringReader(body));
    
            String line = reader.readLine();
            while (line != null) {
                if (line.contains("Set-Cookie")) {
                    jsessionid = line.substring(line.indexOf("JSESSIONID="), line.indexOf("; Path")).replace("JSESSIONID=", "");
                    break;
                }
    
                line = reader.readLine();
            }
    
        }
    
        public List<String> getIds() throws IOException {
    
            Map<String, String> para = new HashMap<String, String>();
            para.put("pageNo", "1");
            para.put("query_beginDate", "20121101");
            para.put("query_endDate", "20131206");
            para.put("role", "2");
            para.put("userId", "209");
            para.put("query_chekSt", "01");
    
            String body = HttpRequest.get("http://172.18.138.35:8888/sign/workReport/workReport!list.do").query(para).header("Cookie",
                    "JSESSIONID=" + jsessionid).send().bodyText();
    
            BufferedReader reader = new BufferedReader(new StringReader(body));
    
            List<String> list = new ArrayList<String>();
            String line = reader.readLine();
            while (line != null) {
                if (line.contains("通过审核") && line.contains("/sign/workReport/workReport!checkReport.do")) {
                    String id = line.substring(line.indexOf("workId="), line.indexOf("&workStatus")).replace("workId=", "");
    
                    list.add(id);
                }
    
                line = reader.readLine();
            }
            return list;
        }
    
        public void apply(List<String> list) {
    
            for (String id : list) {
                Map<String, String> para = new HashMap<String, String>();
                para.put("workId", id);
                para.put("workStatus", "02");
                HttpRequest.get("http://172.18.138.35:8888/sign/workReport/workReport!checkReport.do").query(para).header("Cookie",
                        "JSESSIONID=" + jsessionid).send();
    
                System.out.println(id + " success");
    
            }
    
        }
    
    }
  • 相关阅读:
    洛谷 P1045 【麦森数】快速幂
    洛谷 P4838 P哥破解密码 题解
    洛谷 P1609 最小回文数 题解
    洛谷 P4910 帕秋莉的手环 矩阵乘法+快速幂详解
    [SDOI2010]外星千足虫 题解 高斯消元+bitset简介
    UVA1386 【Cellular Automaton】题解
    JavaScript基础(.....持续待更)
    网页布局基础
    css浮动--float/clear通俗讲解(转载)
    css基础
  • 原文地址:https://www.cnblogs.com/benx/p/3461989.html
Copyright © 2011-2022 走看看