@ -12,6 +12,7 @@ import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant ;
import com.ccsens.util.bean.message.common.MessageRule ;
import com.ccsens.util.config.RabbitMQConfig ;
import com.ccsens.util.exception.BaseException ;
import com.itextpdf.text.* ;
import com.itextpdf.text.pdf.* ;
import io.swagger.annotations.Api ;
@ -57,9 +58,6 @@ public class DebugController {
@Resource
SqlSessionFactory sqlSessionFactory ;
@Resource
private RestTemplate restTemplate ;
private static RestTemplateUtil util ;
@ApiOperation ( value = "/测试" , notes = "" )
@ -315,31 +313,31 @@ public class DebugController {
int year = 2021 ;
int month = 8 ;
String a = "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query=" + year + "%E5%B9%B4" + month + "%E6%9C%88&co=&resource_id=39043&t=1617089428269&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=wisetpl&cb=jQuery110203576901702188473_1617089118772&_=1617089118776" ;
// long a1 = System.currentTimeMillis();
String s = RestTemplateUtil . getForEntity ( a , new HashMap < > ( ) , StringBuilder . class ) . toString ( ) ;
System . out . println ( s . toString ( ) ) ;
// String s = HttpsUtil.httpsRequest(a,"GET","");
// System.out.println(System.currentTimeMillis() - a1);
s = s . substring ( s . indexOf ( "(" ) ) ;
s = s . substring ( 1 , s . length ( ) - 2 ) ;
Map < String , Object > map = ( Map < String , Object > ) JSONObject . parse ( s ) ;
List list = ( List ) map . get ( "data" ) ;
Map data = ( Map ) list . get ( 0 ) ;
List < Map > almanac = ( List < Map > ) data . get ( "almanac" ) ;
if ( almanac = = null | | almanac . size ( ) = = 0 ) {
return ;
}
for ( int i = 1 ; i < almanac . size ( ) ; i + + ) {
String key = ( ( String ) almanac . get ( i ) . get ( "oDate" ) ) . substring ( 0 , 10 ) ;
String status = ( String ) almanac . get ( i - 1 ) . get ( "status" ) ;
if ( "1" . equals ( status ) | | "2" . equals ( status ) ) {
System . out . println ( key ) ;
System . out . println ( status ) ;
}
}
// String a = "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query="+year+"%E5%B9%B4"+month+"%E6%9C%88&co=&resource_id=39043&t=1617089428269&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=wisetpl&cb=jQuery110203576901702188473_1617089118772&_=1617089118776";
// String s = HttpsUtil.httpsRequest(a,"GET","");
// System.out.println(s);
// Object rest = RestTemplateUtil.getForEntity(a,new HashMap<>(),StringBuilder.class).toString();
// System.out.println(rest.toString());
//
// s = s.substring(s.indexOf("("));
// s = s.substring(1, s.length() - 2);
// Map<String, Object> map = (Map<String, Object>) JSONObject.parse(s);
//
// List list = (List) map.get("data");
// Map data = (Map) list.get(0);
// List<Map> almanac = (List<Map>) data.get("almanac");
// if(almanac == null || almanac.size() == 0) {
// return;
// }
//
// for(int i = 1; i < almanac.size(); i++) {
// String key = ((String)almanac.get(i).get("oDate")).substring(0, 10);
// String status = (String)almanac.get(i - 1).get("status");
// if("1".equals(status) || "2".equals(status)) {
// System.out.println(key);
// System.out.println(status);
// }
// }
}
}