Commit 3ab18d62 authored by gao's avatar gao

频次认证

parent 55f4f05a
...@@ -4,11 +4,10 @@ import com.legalPersonMonitor.config.ParameterConfig; ...@@ -4,11 +4,10 @@ import com.legalPersonMonitor.config.ParameterConfig;
import com.legalPersonMonitor.connections.HttpClientPool; import com.legalPersonMonitor.connections.HttpClientPool;
import com.legalPersonMonitor.data.*; import com.legalPersonMonitor.data.*;
import com.legalPersonMonitor.utils.FormatBytesUtil; import com.legalPersonMonitor.utils.FormatBytesUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -53,7 +52,7 @@ public class ServiceStateMonitoring { ...@@ -53,7 +52,7 @@ public class ServiceStateMonitoring {
String correctRateQueryStr=""; String correctRateQueryStr="";
try { try {
correctRateQueryStr= HttpClientPool.getRequest("http://121.22.111.251:9002/legalPerson/v1.0/authSucStats?startTime="+startTime+"&endTime="+endTime+"&customer=gtyx01"); correctRateQueryStr= HttpClientPool.getRequest("http://121.22.111.251:9002/legalPerson/v1.0/authSucStats?startTime="+startTime+"&endTime="+endTime+"&customerNumber=gtyx01");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -75,46 +74,41 @@ public class ServiceStateMonitoring { ...@@ -75,46 +74,41 @@ public class ServiceStateMonitoring {
} }
public static String authFrequency(String startTime,String endTime){ public static String authFrequency(String startTime,String endTime){
String authFrequencyStr=""; String authFrequencyStr="";
JSONArray authFrequencyList=null;
String str="法人代理在"; String str="法人代理在";
String key1=""; Object key1="";
String key2=""; Object key2="";
String value=""; Object value="";
int count=1; int count=1;
int i=1; int i=1;
try { try {
authFrequencyStr= HttpClientPool.getRequest("http://121.22.111.251:9002/legalPerson/v1.0/authFreqStats?startTime="+startTime+"&endTime="+endTime+"&customerNumber=gtyx01&units=Hour"); authFrequencyStr= HttpClientPool.getRequest("http://121.22.111.251:9003/legalPerson/v1.0/authFreqStats?startTime="+startTime+"&endTime="+endTime+"&customerNumber=gtyx01&units=Hour");
authFrequencyList = JSONArray.fromObject(authFrequencyStr);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); return "法人代理频次请求失败";
}
JSONObject correctRateQueryStrJson=JSONObject.fromObject(authFrequencyStr);
Iterator iterator = correctRateQueryStrJson.keys();
Iterator iterator1 = correctRateQueryStrJson.keys();
List<String> listKey=new ArrayList();
while(iterator1.hasNext()){
listKey.add((String) iterator1.next());
} }
i=correctRateQueryStrJson.size(); if(authFrequencyList.size()==1){
if(listKey.size()==1){ value = (JSONObject.fromObject(authFrequencyList.get(0)).get("count"));
value = correctRateQueryStrJson.getString(listKey.get(count-1));
str="<div>"+str+FormatBytesUtil.stampToDate(startTime)+"时至"+FormatBytesUtil.stampToDate(endTime)+"时 时间段内认证"+value+"次"+"</div>"; str="<div>"+str+FormatBytesUtil.stampToDate(startTime)+"时至"+FormatBytesUtil.stampToDate(endTime)+"时 时间段内认证"+value+"次"+"</div>";
return str; return str;
} }
while(iterator.hasNext()){ i=authFrequencyList.size();
if(i==correctRateQueryStrJson.size()){ for(int j=0;j<authFrequencyList.size();j++){
key1 = listKey.get(count); if(i==authFrequencyList.size()){
value = correctRateQueryStrJson.getString(listKey.get(count-1)); key1 = (JSONObject.fromObject(authFrequencyList.get(count)).get("time"));
value = (JSONObject.fromObject(authFrequencyList.get(count-1)).get("count"));
str="<div>"+str+FormatBytesUtil.stampToDate(startTime)+"时至"+key1+"时 时间段内认证"+value+"次"+"</div>"; str="<div>"+str+FormatBytesUtil.stampToDate(startTime)+"时至"+key1+"时 时间段内认证"+value+"次"+"</div>";
i--; i--;
count++; count++;
} else if (i!=1){ } else if (i!=1){
key2 = listKey.get(count); key2 = (JSONObject.fromObject(authFrequencyList.get(count)).get("time"));
value = correctRateQueryStrJson.getString(listKey.get(count-1)); value = (JSONObject.fromObject(authFrequencyList.get(count-1)).get("count"));
str=str+"<div>在"+key1+"时至"+key2+"时 时间段内认证"+value+"次"+"</div>"; str=str+"<div>在"+key1+"时至"+key2+"时 时间段内认证"+value+"次"+"</div>";
key1=key2; key1=key2;
count++; count++;
i--; i--;
}else{ }else{
value = correctRateQueryStrJson.getString(listKey.get(count-1)); value = (JSONObject.fromObject(authFrequencyList.get(count-1)).get("count"));
str=str+"<div>在"+key1+"时至"+FormatBytesUtil.stampToDate(endTime)+"时 时间段内认证"+value+"次"+"</div>"; str=str+"<div>在"+key1+"时至"+FormatBytesUtil.stampToDate(endTime)+"时 时间段内认证"+value+"次"+"</div>";
count++; count++;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment