文章目录
业务需求
前端输入所需要的参数数据后来获取后端指定接口中的数据
yml
在application.yml配置文件中声明出接口URL
# 接口URL
open_data_url: http://XXX.XXX.XX.XX:8080
Service
/**
* @Title: 路检路查查询
* @Description: 通过车牌号、车牌颜色、燃油类型查询车辆路检路查记录
* @Author: 半度纳
* @Date: 2022/10/17 10:13
*/
public Map selectBlackListData(String hmhp,String cpys,String rlzl);
ServiceImpl
@Value("${open_data_url}")
public String openDataUrl;
/**
* @Title: 路检路查查询
* @Description: 通过车牌号、车牌颜色、燃油类型查询车辆路检路查记录
* @Author: 半度纳
* @Date: 2022/10/17 10:13
*/
public Map selectBlackListData(String hmhp,String cpys,String rlzl){
String p ="";
try {
p = "hmhp="+URLEncoder.encode(hmhp,"utf-8")+(!"".equals(cpys)?"&cpys="+URLEncoder.encode(cpys,"utf-8")+
(!"".equals(rlzl)?"&rlzl="+URLEncoder.encode(rlzl,"utf-8"):""):"");
} catch (Exception ignored){
}
String s = HttpUtils.sendGet(openDataUrl+"/api_v1/inspection/inspection/roadInspection/search",p);
return JSON.parseObject(s, Map.class);
}
Controller
/**
* @Title: 路检路查查询
* @Description: 通过车牌号、车牌颜色、燃油类型查询车辆路检路查记录
* @Author: 半度纳
* @Date: 2022/10/17 10:13
*/
@GetMapping("/getSearch")
public AjaxResult selectBlackListData(String hmhp,String cpys,String rlzl){
return AjaxResult.success(imDicInspectionAgencyService.selectBlackListData(hmhp, cpys, rlzl));
}