|
@@ -137,9 +137,9 @@ public class StationController {
|
|
|
ResultData resultData=null;
|
|
|
JSONObject location = BaiduMapUtil.getLocation(lng, lat);
|
|
|
if(location !=null && location.containsKey("status") && location.get("status").toString().equals("0")){
|
|
|
- JSONObject result = location.getJSONObject("result");
|
|
|
+ JSONObject result = location.getJSONObject("result").getJSONObject("addressComponent");
|
|
|
Map<String, Object> m = new HashMap<>();
|
|
|
- m.put("address", result.getString("formatted_address"));
|
|
|
+ m.put("address", result.getString("street"));
|
|
|
resultData = ResultData.success(m);
|
|
|
}else {
|
|
|
resultData = ResultData.error(CodeMsg.YEWU_FAIL);
|
|
@@ -216,6 +216,52 @@ public class StationController {
|
|
|
}
|
|
|
return gson.toJson(resultData);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据坐标获取油站列表 新的 2021年8月2日16:13:36
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getStationInfoListNew", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public String getStationInfoListNew(@RequestParam String stationLongitude,String stationLatitude,Integer pageNum,Integer pageSize, String appId){
|
|
|
+ Gson gson =new Gson();
|
|
|
+ //返回结果集
|
|
|
+ ResultData resultData= null;
|
|
|
+ if(StringUtils.isNotBlank(appId)){
|
|
|
+ logger.info("有经纬度获取油站列表所需参数appID:"+appId);
|
|
|
+ StationRequest stationRequest = new StationRequest();
|
|
|
+ //StationInfo stationInfo = new StationInfo();
|
|
|
+ stationRequest.setAppId(appId);
|
|
|
+ //stationInfo.setAppId(appId);
|
|
|
+ if(StringUtils.isNotBlank(stationLatitude) && StringUtils.isNotBlank(stationLongitude)){
|
|
|
+ stationRequest.setStationLatitude(stationLatitude);
|
|
|
+ stationRequest.setStationLongitude(stationLongitude);
|
|
|
+ stationRequest.setPageNum(pageNum);
|
|
|
+ stationRequest.setPageSize(pageSize);
|
|
|
+ //调用接口 根据坐标筛选距离最近的加油站
|
|
|
+ StationInfoVo stationInfoVo = stationService.stationInfoList(stationRequest);
|
|
|
+ logger.info("有经纬度获取油站列表:"+stationInfoVo.toString());
|
|
|
+ JSONObject location = BaiduMapUtil.getLocation(stationLongitude, stationLatitude);
|
|
|
+ if(location !=null && location.containsKey("status") && location.get("status").toString().equals("0")){
|
|
|
+ JSONObject result = location.getJSONObject("result").getJSONObject("addressComponent");
|
|
|
+ if(!result.getString("street").equals("")){
|
|
|
+ stationInfoVo.setAddress(result.getString("street"));
|
|
|
+ }else {
|
|
|
+ stationInfoVo.setAddress("未知街道");
|
|
|
+ }
|
|
|
+ resultData=ResultData.success(stationInfoVo);
|
|
|
+ }else {
|
|
|
+ resultData=ResultData.error(CodeMsg.REQUEST_FAIL);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ resultData=ResultData.error(CodeMsg.REQUEST_FAIL);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ resultData=ResultData.error(CodeMsg.REQUEST_FAIL);
|
|
|
+ }
|
|
|
+ return gson.toJson(resultData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 根据公众号appId获取油站列表信息
|
|
|
*/
|
|
@@ -447,4 +493,69 @@ public class StationController {
|
|
|
}
|
|
|
return gson.toJson(resultData);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 油枪管理 :新版接口:2021年8月2日
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/stationOilGunListNew", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public String stationOilGunListNew(@RequestParam Integer stationId, @RequestParam String personnelId){
|
|
|
+ logger.info("获取油枪接口,油站ID:" + stationId + "; 加油员ID:" + personnelId);
|
|
|
+ Gson gson =new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
|
|
|
+ ResultData resultData = null;
|
|
|
+ try {
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+
|
|
|
+ //获取油站加油员列表
|
|
|
+ HashMap<String, Object> params_1 = new HashMap<>();
|
|
|
+ params_1.put("stationId", stationId);
|
|
|
+ List<Map> personnalList = payOrderMapper.selectPersonelName(params_1); //使用list原因:一个枪号对应多个加油员场景
|
|
|
+ resultMap.put("personnalList", personnalList);
|
|
|
+
|
|
|
+ //获取油站图片和公告
|
|
|
+ StationInfo stationPic = new StationInfo();
|
|
|
+ stationPic.setStationId(stationId);
|
|
|
+ StationInfo stationPics = stationService.getStationPicList(stationPic);
|
|
|
+ List<String> listPic = new ArrayList<>();
|
|
|
+ if(stationPics != null && StringUtils.isNotBlank(stationPics.getImage1())){
|
|
|
+ listPic.add(stationPics.getImage1());
|
|
|
+ }
|
|
|
+ if(stationPics != null && StringUtils.isNotBlank(stationPics.getImage2())){
|
|
|
+ listPic.add(stationPics.getImage2());
|
|
|
+ }
|
|
|
+ if(stationPics != null && StringUtils.isNotBlank(stationPics.getImage3())){
|
|
|
+ listPic.add(stationPics.getImage3());
|
|
|
+ }
|
|
|
+ if(stationPics != null && StringUtils.isNotBlank(stationPics.getImage4())){
|
|
|
+ listPic.add(stationPics.getImage4());
|
|
|
+ }
|
|
|
+ if(stationPics != null && StringUtils.isNotBlank(stationPics.getImage5())){
|
|
|
+ listPic.add(stationPics.getImage5());
|
|
|
+ }
|
|
|
+ resultMap.put("notice", stationPics.getNotice());
|
|
|
+ resultMap.put("listPic", listPic);
|
|
|
+
|
|
|
+ //获取油枪
|
|
|
+ if(personnelId !=null && personnelId !="" && !personnelId.equals("undefined")){
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("personnelId", personnelId);
|
|
|
+ List<Map<String, Object>> stationOilGunList = stationOilGunService.selectOilGunByPersonalId(params);
|
|
|
+ resultMap.put("stationOilGunList", stationOilGunList);
|
|
|
+ //resultData=ResultData.success(stationOilGunList);
|
|
|
+ }else {
|
|
|
+ StationOilGun stationOilGun =new StationOilGun();
|
|
|
+ stationOilGun.setStationId(stationId);
|
|
|
+ List<StationOilGun> stationOilGunList = stationOilGunService.stationOilGunList(stationOilGun);
|
|
|
+ resultMap.put("stationOilGunList", stationOilGunList);
|
|
|
+ //resultData=ResultData.success(stationOilGunList);
|
|
|
+ }
|
|
|
+ resultData = ResultData.success(resultMap);
|
|
|
+ }catch (Exception e){
|
|
|
+ resultData=ResultData.success(CodeMsg.SEARCH_FAIL);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return gson.toJson(resultData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|