package doumeemes.core.utils.dingding; import com.alibaba.fastjson.JSONObject; import com.iflytek.antelope.other.client.dto.resp.Result; import com.iflytek.antelope.other.client.dto.resp.UserDTO; import com.iflytek.antelope.other.client.sdk.UserInfoSdk; import lombok.extern.slf4j.Slf4j; import java.io.*; import java.util.Scanner; @Slf4j public class LingyangUtil { public static final String LINGYANG_APPKEY = "appKey"; public static final String LINGYANG_AESKEY = "aesKey"; public static final String LINGYANG_SECRET = "secret"; private String aesKey;// = "vczfadepbqrdcdae"; private String appKey ;//="rqwryznqsl"; private String appSecret ;//="b2da06d8bb4eae0f0701649571640a203e80ccdc"; public static void main(String[] args) { JSONObject j = new JSONObject(); // j.put(LINGYANG_AESKEY,"vczfadepbqrdcdae"); // j.put(LINGYANG_APPKEY,"rqwryznqsl"); // j.put(LINGYANG_SECRET,"b2da06d8bb4eae0f0701649571640a203e80ccdc"); // System.out.println(j.toJSONString()); try { File file = new File("D:\\doumeeplant.log"); FileWriter out = new FileWriter(new File("D:\\out1.log")); BufferedWriter writer = new BufferedWriter(out); BufferedReader br = new BufferedReader(new FileReader(file)); String line; int lineNum = 1; int num = 1; int tNum = -1; while ((line = br.readLine()) != null) { if(line.contains("\"manager\":\"0\"") ){num++; tNum++; writer.write(line.replace("结果:","")); writer.newLine(); System.out.printf("[%d]: %s%n", lineNum, line); // 输出这一行 } /* if (line.contains("羚羊平台获取用户信息")) { // 如果这一行包含关键词 System.out.printf("[%d]: %s%n", lineNum, line); // 输出这一行 num++; tNum++; }else if(tNum >=0 && tNum <=2){ System.out.printf("[%d]: %s%n", lineNum, line); // 输出这一行 tNum ++; } if(tNum ==3){ tNum=-1; }*/ lineNum++; } out.close(); System.out.println(num); }catch (Exception e){ e.getMessage(); } } /*public LingyangUtil(String param){ JSONObject p = JSONObject.parseObject(param); if(p !=null){ this.aesKey = p.getString(LINGYANG_AESKEY); this.appKey = p.getString(LINGYANG_APPKEY); this.appSecret = p.getString(LINGYANG_SECRET); } }*/ public LingyangUtil(String aesKey,String appKey,String appSecret){ this.aesKey =aesKey; this.appKey = appKey; this.appSecret = appSecret; } public UserDTO getUserInfoByToken(String token) { try { Result result = UserInfoSdk.getUserInfo (appKey, appSecret, aesKey, token); if(result!=null){ log.info("羚羊平台获取用户信息:========================================================================================================" + "\ntoken:"+token+"\n结果:"+JSONObject.toJSONString(result)); } if(result!=null && result.getCode() == 0){ return result.getResult(); } }catch (Exception e){ } return null; } }