这种代码层次很深,怎么把argValue里面body的密文解析出来,然后替换掉。再重新塞回去呀
我写了一般,解析的,但是感觉有问题。塞进去不知道怎么写了
{"nccontext":{"host":"10.10.18.45","ncacctcontext":{"accountCode":"01","appPubKey":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCS5avjb7GbHWNXB5XPC4gJRJHmvwyPMCvyKV6EJ7mq6kjiJBIf+t5Q8guRD41rswF7Nt+hWKs0rnWCc9ypqcTJwtbtHTkjOlD/I7C1KszyEbPT8mBRr0nQd203rfWZ+oKkPl1ENpmlDiNgStRjHZWvZM1ZzPd3yDhHZaUma0iCHwIDAQAB","appSecret":"4a7499ac19b744958e30","groupCode":"01","moduleName":"uapbd","serviceInfo":{"iswebservice":false,"serviceClassName":"nc.itf.uap.IUAPQueryBS","serviceMethodArgInfo":[{"agg":false,"argType":{"body":"java.lang.String"},"isArray":false,"isPrimitive":false,"argValue":{"body":"JzUxFI6d1RMVVblcwapvbMHsft+4lQ4xLLYSHTy6+bCoPhJAicJq99RAd3nJUukZbQXc1uooE7LDvppmoQLF8fm/B6Yj7MTdP1ISRqBYFJNmH1kGn0VbX+aFpvkoUprlpD5Oi1v0cGyYB80QVlLBDTYJImafzMapZxArcjQ4lPw="}},{"agg":false,"argType":{"body":"nc.jdbc.framework.processor.MapListProcessor"},"isArray":false,"isPrimitive":false,"argValue":{"body":{}}}],"serviceMethodName":"executeQuery","serviceMethodRetInfo":{"retBodyAttr":{}}},"user":"1"},"ncurl":"http://10.10.18.45:7030","ncversion":"yonbip_202207","port":7030,"servletpath":"/service/NCCloudGatewayServlet"},"requestData":true}
这是解析的代码
private void parseSQL(JsonObject ncContext) {
JsonObject ncacctcontext = ncContext.getJsonObject("ncacctcontext");
JsonObject serviceInfo = (JsonObject) ncacctcontext.getMap().get("serviceInfo");
JsonArray serviceMethodArgInfo = (JsonArray)serviceInfo.getMap().get("serviceMethodArgInfo");
JsonObject jsonObject = (JsonObject)serviceMethodArgInfo.getList().get(0);
JsonObject argValue = (JsonObject)jsonObject.getMap().get("argValue");
String encryptionSQL = (String) argValue.getMap().get("body");
try {
String decryptSQL = RSAUtils.decrypt(encryptionSQL, sqlKey);
} catch (Exception e) {
e.printStackTrace();
}
}