diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index cdbceca9..64903836 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -79,8 +79,8 @@ public class HighGasController { @RequestParam(name = "distance", required = true) Integer distanceRecent, @RequestParam(name = "regionId", required = true) Long regionId, @RequestParam(name = "oilNoName", required = true) String oilNoName, - @RequestParam(name = "longitude", required = true) String longitude, - @RequestParam(name = "latitude", required = true) String latitude, + @RequestParam(name = "longitude", required = false) String longitude, + @RequestParam(name = "latitude", required = false) String latitude, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize ) { @@ -99,17 +99,29 @@ public class HighGasController { store.put("store_logo", null); } } - double distance = CoordCommonUtil.getDistance(Double.valueOf(store.get("latitude").toString()), Double.valueOf(store.get("longitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); - store.put("distance", Math.round(distance/100d)/10d); + + if (StringUtils.isNotBlank(longitude) && StringUtils.isNotBlank(latitude)) { + double distance = CoordCommonUtil.getDistance(Double.valueOf(store.get("latitude").toString()), Double.valueOf(store.get("longitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); + store.put("distance", Math.round(distance/100d)/10d); + } else { + store.put("distance", null); + } } - List> distance = storeList.stream().sorted(Comparator.comparingDouble(entry -> Double.valueOf(entry.get("distance").toString()))).collect(Collectors.toList()); - Iterator> iterator = distance.iterator(); - while (iterator.hasNext()) { - if ((int)Math.round(Double.valueOf(iterator.next().get("distance").toString())) > distanceRecent.intValue()) { - iterator.remove(); + + PageInfo> mapPageInfo; + if (StringUtils.isNotBlank(longitude) && StringUtils.isNotBlank(latitude)) { + List> distance = storeList.stream().sorted(Comparator.comparingDouble(entry -> Double.valueOf(entry.get("distance").toString()))).collect(Collectors.toList()); + Iterator> iterator = distance.iterator(); + while (iterator.hasNext()) { + if ((int)Math.round(Double.valueOf(iterator.next().get("distance").toString())) > distanceRecent.intValue()) { + iterator.remove(); + } } + mapPageInfo = PageUtil.initPageInfoObj(pageNum, distance.size(), pageSize, new PageInfo<>(distance)); + } else { + mapPageInfo = PageUtil.initPageInfoObj(pageNum, storeList.size(), pageSize, new PageInfo<>(storeList)); } - PageInfo> mapPageInfo = PageUtil.initPageInfoObj(pageNum, distance.size(), pageSize, new PageInfo<>(distance)); + for (Map map : mapPageInfo.getList()) { if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) { @@ -250,8 +262,8 @@ public class HighGasController { @ResponseBody @ApiOperation(value = "根据门店key 查询") public ResponseData getGasDetailByStoreKey(@RequestParam(name = "storeKey", required = true) String storeKey, - @RequestParam(name = "longitude", required = true) String longitude, - @RequestParam(name = "latitude", required = true) String latitude, + @RequestParam(name = "longitude", required = false) String longitude, + @RequestParam(name = "latitude", required = false) String latitude, @RequestParam(name = "isTyAgent", required = false) Boolean isTyAgent) { try { @@ -280,9 +292,14 @@ public class HighGasController { param.put("gasLogoSmall", CommonSysConst.getSysConfig().getHsgDomainName()+"/filesystem/"+store.getStoreLogo()); param.put("gasAddressLatitude", store.getLatitude()); param.put("gasAddressLongitude", store.getLongitude()); - // 距离 - double distance = CoordCommonUtil.getDistance(Double.valueOf(param.get("gasAddressLatitude").toString()), Double.valueOf(param.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); - param.put("distance", Math.round(distance/100d)/10d); + + if (StringUtils.isNotBlank(longitude) && StringUtils.isNotBlank(latitude)) { + // 距离 + double distance = CoordCommonUtil.getDistance(Double.valueOf(param.get("gasAddressLatitude").toString()), Double.valueOf(param.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); + param.put("distance", Math.round(distance/100d)/10d); + } else { + param.put("distance", null); + } // 查询油枪 List> gasGunMapList = new ArrayList<>(); @@ -407,8 +424,13 @@ public class HighGasController { } result.put("oilPriceList", newOilPriceList); - double distance = CoordCommonUtil.getDistance(Double.valueOf(result.get("gasAddressLatitude").toString()), Double.valueOf(result.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); - result.put("distance", Math.round(distance/100d)/10d); + if (StringUtils.isNotBlank(longitude) && StringUtils.isNotBlank(latitude)) { + // 距离 + double distance = CoordCommonUtil.getDistance(Double.valueOf(result.get("gasAddressLatitude").toString()), Double.valueOf(result.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); + result.put("distance", Math.round(distance/100d)/10d); + } else { + result.put("distance", null); + } return ResponseMsgUtil.success(jsonObject.get("result")); } throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); diff --git a/v1/target/classes/application.yml b/v1/target/classes/application.yml deleted file mode 100644 index f0e71e2f..00000000 --- a/v1/target/classes/application.yml +++ /dev/null @@ -1,56 +0,0 @@ -server: - port: 9902 - servlet: - context-path: /v1 - -#配置是否为debug模式,debug模式下,不开启权限校验 -debug: false - -#datasource数据源设置 -spring: - datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false - username: root - password: HF123456. - type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.jdbc.Driver - filters: stat - maxActive: 10 - initialSize: 5 - maxWait: 60000 - minIdle: 5 - timeBetweenEvictionRunsMillis: 60000 - minEvictableIdleTimeMillis: 300000 - validationQuery: select 'x' - testWhileIdle: true - testOnBorrow: false - testOnReturn: false - poolPreparedStatements: true - maxOpenPreparedStatements: 20 - redis: - database: 0 - host: 139.159.177.244 - port: 36379 - password: HF123456.Redis - timeout: 36000000 - jedis: - pool: - max-active: 20 - max-wait: -1 - max-idle: 10 - min-idle: 0 - #配置日期返回至前台为时间戳 - jackson: - serialization: - write-dates-as-timestamps: true -mybatis: - mapperLocations: - - classpath*:sqlmap*/*.xml - type-aliases-package: - org.springboot.sample.entity - -pagehelper: - helperDialect: mysql - reasonable: true - supportMethodsArguments: true - params: count=countSql diff --git a/v1/target/classes/logback.xml b/v1/target/classes/logback.xml deleted file mode 100644 index a7602e3d..00000000 --- a/v1/target/classes/logback.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - %d %p (%file:%line\)- %m%n - UTF-8 - - - - log/base.log - - log/base.log.%d.%i - - - 64 MB - - - - - %d %p (%file:%line\)- %m%n - - UTF-8 - - - - log/dao.log - - log/dao.log.%d.%i - - - 64 MB - - - - - %d %p (%file:%line\)- %m%n - - UTF-8 - - - - log/error.log - - log/error.log.%d.%i - - - 64 MB - - - - - %d %p (%file:%line\)- %m%n - - UTF-8 - - - - - - - - - - - - - - - diff --git a/v1/target/hai-v1-1.0-SNAPSHOT.jar b/v1/target/hai-v1-1.0-SNAPSHOT.jar deleted file mode 100644 index 18f1d02d..00000000 Binary files a/v1/target/hai-v1-1.0-SNAPSHOT.jar and /dev/null differ diff --git a/v1/target/hai-v1-1.0-SNAPSHOT.jar.original b/v1/target/hai-v1-1.0-SNAPSHOT.jar.original deleted file mode 100644 index cde7bfd0..00000000 Binary files a/v1/target/hai-v1-1.0-SNAPSHOT.jar.original and /dev/null differ