Merge branch 'refs/heads/bug'
This commit is contained in:
		
						commit
						07c385ab3d
					
				|  | @ -1558,6 +1558,8 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i | ||||||
|             sn = order.getSn(); |             sn = order.getSn(); | ||||||
|         } |         } | ||||||
|         AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn); |         AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn); | ||||||
|  |         //判断是否在禁停区内,如果在禁停区内,不能还车。  noParkingArea  最新定位 | ||||||
|  |         ServiceUtil.assertion(isNoParkingAreaLatest(asDevice, order.getAreaId()),"在禁停区内,不能锁车"); | ||||||
|         /** 1.获取token*/ |         /** 1.获取token*/ | ||||||
|         String token = Token.getToken(); |         String token = Token.getToken(); | ||||||
|         if(!"true".equals(isBluetooth)){ |         if(!"true".equals(isBluetooth)){ | ||||||
|  | @ -2501,6 +2503,39 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i | ||||||
|         return inCircle; |         return inCircle; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 是否禁停区内 | ||||||
|  |      */ | ||||||
|  |     public boolean isNoParkingAreaLatest(AsDevice device,Long areaId) { | ||||||
|  |         boolean inCircle = false; | ||||||
|  |         EtParkingArea parkingArea = new EtParkingArea(); | ||||||
|  |         parkingArea.setAreaId(areaId); | ||||||
|  |         parkingArea.setStatus("0"); | ||||||
|  |         parkingArea.setType(ServiceConstants.PARKING_AREA_TYPE_NO_PARKFING); | ||||||
|  |         List<EtParkingArea> parkingAreas = parkingAreaService.selectEtParkingAreaList(parkingArea); | ||||||
|  |         if(ObjectUtil.isNull(parkingAreas) || parkingAreas.isEmpty()){ | ||||||
|  |             log.info("【临时锁车】运营区【{}】没有禁停区,",areaId); | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |         for (EtParkingArea etParkingArea : parkingAreas) { | ||||||
|  |             double[] latestLocation = getLatestLocation(device.getMac()); | ||||||
|  |             if(ObjectUtil.isNotNull(latestLocation)){ | ||||||
|  |                 BigDecimal latitude = BigDecimal.valueOf(latestLocation[1]).setScale(8, RoundingMode.HALF_UP); | ||||||
|  |                 BigDecimal longitude = BigDecimal.valueOf(latestLocation[0]).setScale(8, RoundingMode.HALF_UP); | ||||||
|  |                 log.info("【临时锁车】【判断是否在停车区】,lon:{},lat:{}",latitude,longitude); | ||||||
|  |                 Geometry geometry = GeoUtils.fromWkt(etParkingArea.getBoundary()); | ||||||
|  |                 inCircle = GeoUtils.isInCircle(longitude.toString(), latitude.toString(), geometry); | ||||||
|  |                 if(inCircle){ | ||||||
|  |                     log.info("【临时锁车】车辆【{}】在禁停区【{}】内",device.getSn(),etParkingArea.getParkingName()); | ||||||
|  |                     return inCircle; | ||||||
|  |                 }else{ | ||||||
|  |                     log.info("【临时锁车】车辆【{}】不在禁停区【{}】内",device.getSn(),etParkingArea.getParkingName()); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return inCircle; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * 是否禁行区内 |      * 是否禁行区内 | ||||||
|      */ |      */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user