| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", "{\"mobile\":\"" + mobile + "\",\"enterNum\":\"" + enterNum + "\"}"); |
| | | log.info("【根据手机号和企业编号查询用户信息】请求地址:" + url); |
| | | log.info("【根据手机号和企业编号查询用户信息】请求参数:" + JSON.toJSONString(contentMap)); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("mobile", mobile); |
| | | if (null != enterNum) { |
| | | map.put("enterNum", enterNum); |
| | | } |
| | | contentMap.put("content", JSON.toJSONString(map)); |
| | | log.info("【根据手机号码获取人员信息】请求地址:" + url); |
| | | log.info("【根据手机号码获取人员信息】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "GET", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【根据手机号和企业编号查询用户信息】请求结果:" + result); |
| | | log.info("【根据手机号码获取人员信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据手机号和企业编号查询用户信息】请求失败:" + result); |
| | | throw new RuntimeException("【根据手机号和企业编号查询用户信息】请求失败:" + result); |
| | | log.error("【根据手机号码获取人员信息】请求失败:" + result); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据手机号和企业编号查询用户信息】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据手机号和企业编号查询用户信息】失败:" + object.toJSONString()); |
| | | log.error("【根据手机号码获取人员信息】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | JSONArray data = object.getJSONArray("data"); |
| | | List<QYTUserInfo> list = new ArrayList<>(); |
| | |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", JSON.toJSONString(request)); |
| | | 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); |
| | |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", JSON.toJSONString(request)); |
| | | 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); |
| | |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", JSON.toJSONString(request)); |
| | | 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); |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | List<QYTUserInfo> userInfoByPhone = getUserInfoByPhone("18798410042", "9811000039358999"); |
| | | System.out.println(userInfoByPhone); |
| | | } |
| | | } |