| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | public class RiderSourceHttpUtils { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(RiderSourceHttpUtils.class); |
| | | // private static final String URL = "http://1.14.71.182:5000/"; |
| | | private static final String URL = "https://1.95.3.255:443/lyhd/api/contract/syncRiderContract"; |
| | | // private static final String URL = "http://192.168.18.111:5000/"; |
| | | |
| | | |
| | |
| | | HashMap<String, Object> param = new HashMap<>(2); |
| | | param.put("phones", phones); |
| | | param.put("sourcePlatform", sourcePlatform); |
| | | // String url = ""; |
| | | String url = URL; |
| | | // 转化成对象 |
| | | RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp(); |
| | | // try { |
| | | // String result = httpPostRequest(param, 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("18706999997"); |
| | | riderSourceInfo.setCardName("张三"); |
| | | riderSourceInfo.setEnabled(Constants.SOURCE_ENABLED_ON); |
| | | riderSourceInfoHttp.getData().add(riderSourceInfo); |
| | | try { |
| | | String result = httpPostRequest(param, url); |
| | | log.info("第三方骑手数据信息:{}", result); |
| | | // 转换数据 |
| | | riderSourceInfoHttp = riderConvertUtils(result); |
| | | } catch (Exception e) { |
| | | riderSourceInfoHttp.setCode("500"); |
| | | riderSourceInfoHttp.setMessage("获取数据失败"); |
| | | riderSourceInfoHttp.setData(null); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | // riderSourceInfoHttp.setCode(Constants.HTTP_CODE_SUCCESS); |
| | | // riderSourceInfoHttp.setMessage("请求成功"); |
| | | // RiderSourceInfo riderSourceInfo = new RiderSourceInfo(); |
| | | // riderSourceInfo.setSourcePlatform("LY"); |
| | | // riderSourceInfo.setCardNum("123456789012345678"); |
| | | // riderSourceInfo.setPhone("18706999997"); |
| | | // riderSourceInfo.setCardName("张三"); |
| | | // riderSourceInfo.setEnabled(Constants.SOURCE_ENABLED_ON); |
| | | // riderSourceInfoHttp.getData().add(riderSourceInfo); |
| | | return riderSourceInfoHttp; |
| | | } |
| | | |
| | |
| | | return riderSourceInfoHttp; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | List<String> phones = new ArrayList<>(); |
| | | phones.add("13954532585"); |
| | | RiderSourceHttpUtils.getRiderSourceInfoHttp(phones, "LY"); |
| | | } |
| | | } |