| | |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.oying.modules.rider.domain.RiderSourceInfo; |
| | | import com.oying.modules.rider.domain.RiderSourceInfoHttp; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp(); |
| | | riderSourceInfoHttp.setCode("500"); |
| | | riderSourceInfoHttp.setMessage(paramMap.get("phone") + "手机号请求异常:" + url); |
| | | riderSourceInfoHttp.setSuccess("false"); |
| | | return JSON.toJSONString(riderSourceInfoHttp); |
| | | } finally { |
| | | IoUtil.close(response); |
| | |
| | | public static RiderSourceInfoHttp getRiderSourceInfoHttp(String phone, String sourcePlatform) { |
| | | HashMap<String, Object> paramMap = new HashMap<>(2); |
| | | paramMap.put("phone", phone); |
| | | paramMap.put("produceType", sourcePlatform); |
| | | String url = ""; |
| | | paramMap.put("sourcePlatform", sourcePlatform); |
| | | // String url = ""; |
| | | // 转化成对象 |
| | | RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp(); |
| | | try { |
| | | String result = httpPostRequest(paramMap, url); |
| | | // 转换数据 |
| | | riderSourceInfoHttp = riderConvertUtils(result); |
| | | } catch (Exception e) { |
| | | riderSourceInfoHttp.setCode("500"); |
| | | riderSourceInfoHttp.setMessage("获取数据失败"); |
| | | riderSourceInfoHttp.setSuccess("false"); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | // try { |
| | | // String result = httpPostRequest(paramMap, url); |
| | | // // 转换数据 |
| | | // riderSourceInfoHttp = riderConvertUtils(result); |
| | | // } catch (Exception e) { |
| | | // riderSourceInfoHttp.setCode("500"); |
| | | // riderSourceInfoHttp.setMessage("获取数据失败"); |
| | | // riderSourceInfoHttp.setSuccess("false"); |
| | | // return riderSourceInfoHttp; |
| | | // } |
| | | riderSourceInfoHttp.setCode(Constants.HTTP_CODE_SUCCESS); |
| | | riderSourceInfoHttp.setMessage("请求成功"); |
| | | RiderSourceInfo riderSourceInfo = new RiderSourceInfo(); |
| | | riderSourceInfo.setSourcePlatform("LY"); |
| | | riderSourceInfo.setCardNum("123456789012345678"); |
| | | riderSourceInfo.setPhone("15202394888"); |
| | | riderSourceInfo.setCardName("张三"); |
| | | riderSourceInfo.setEnabled(Constants.SOURCE_ENABLED_ON); |
| | | riderSourceInfoHttp.setData(riderSourceInfo); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | |
| | |
| | | } catch (Exception e) { |
| | | riderSourceInfoHttp.setCode("500"); |
| | | riderSourceInfoHttp.setMessage("转化数据失败"); |
| | | riderSourceInfoHttp.setSuccess("false"); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | } |