| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 实名认证 |
| | | * @param realName |
| | | * @param cardNo |
| | | * @return |
| | | */ |
| | | public static Boolean idCardAuth(String realName, String cardNo) { |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/idCardAuth"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("realName", realName); |
| | | map.put("cardNo", cardNo); |
| | | contentMap.put("content", JSON.toJSONString(map)); |
| | | log.info("【身份证实名认证】请求地址:" + url); |
| | | log.info("【身份证实名认证】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【身份证实名认证】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【身份证实名认证】请求失败:" + result); |
| | | throw new RuntimeException("【身份证实名认证】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | return object.getBoolean("isok"); |
| | | } |
| | | } |