| | |
| | | StaffNodeInfo staffNodeInfo = object.getObject("data", StaffNodeInfo.class); |
| | | return staffNodeInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建账号-同步证联开户信息 |
| | | * @param request |
| | | * @return 状态 0 成功 其他失败 |
| | | */ |
| | | public static Integer addAccountInfo(AddAccountInfoRequest request){ |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/addAccountInfo"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//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(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【创建账号-同步证联开户信息】请求失败:" + jsonObject.getString("resMsg")); |
| | | return -1; |
| | | } |
| | | return jsonObject.getInteger("status"); |
| | | } |
| | | } |