| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据社会信用代码判断企业是否已存在】请求失败:" + result); |
| | | throw new RuntimeException("【根据社会信用代码判断企业是否已存在】请求失败:" + 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()); |
| | | return null; |
| | | } |
| | | return jsonObject.getObject("object", CheckEnterExist.class); |
| | | } |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据企业名称判断企业是否已存在】请求失败:" + result); |
| | | throw new RuntimeException("【根据企业名称判断企业是否已存在】请求失败:" + 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()); |
| | | return null; |
| | | } |
| | | return jsonObject.getObject("object", CheckEnterExist.class); |
| | | } |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【查询企业详情】请求失败:" + result); |
| | | throw new RuntimeException("【查询企业详情】请求失败:" + 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()); |
| | | return null; |
| | | } |
| | | EnterpriseInfo enterpriseInfo = jsonObject.getObject("object", EnterpriseInfo.class); |
| | | return enterpriseInfo; |
| | |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "GET", skprivateKeyFile, timeStamp, map); |
| | | log.info("【修改企业基本信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String status = jsonObject.getString("status"); |
| | | String status = jsonObject.getString("retCode"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【修改企业基本信息】请求失败:" + result); |
| | | return false; |
| | | throw new RuntimeException("【修改企业基本信息】请求失败:" + result); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | String content = "";//业务参数 |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【创建企业】请求失败:" + result); |
| | | return null; |
| | | throw new RuntimeException("【创建企业】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【创建企业】请求失败:" + result); |
| | | return null; |
| | | log.error("【创建企业】请求失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【创建企业】请求失败:" + object.toJSONString()); |
| | | } |
| | | return object.getObject("data", CreateEnterprise.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除企业信息 |
| | | * |
| | | * @param enterNum 企业编号 |
| | | * @param operator 管理员手机号码 |
| | | * @return |
| | | */ |
| | | public static boolean delEnterprise(String enterNum, String operator) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/delCompany"; |
| | | //私钥文件 |
| | | 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> map = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | map.put(SystemParameterNames.getAppKey(), appKey); |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", "{\"enterNum\":\"" + enterNum + "\",\"operator\":\"" + operator + "\"}"); |
| | | |
| | | log.info("【删除企业信息】请求地址:" + url); |
| | | log.info("【删除企业信息】请求参数:" + JSON.toJSONString(map)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, map); |
| | | 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"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【删除企业信息】请求失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【删除企业信息】请求失败:" + object.toJSONString()); |
| | | } |
| | | return true; |
| | | } |
| | | } |