Compare commits

...

3 Commits

2 changed files with 37 additions and 1 deletions

View File

@ -1558,6 +1558,8 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
sn = order.getSn();
}
AsDevice asDevice = asDeviceMapper.selectAsDeviceBySn(sn);
//判断是否在禁停区内如果在禁停区内不能还车 noParkingArea 最新定位
ServiceUtil.assertion(isNoParkingAreaLatest(asDevice, order.getAreaId()),"在禁停区内,不能锁车");
/** 1.获取token*/
String token = Token.getToken();
if(!"true".equals(isBluetooth)){
@ -2501,6 +2503,39 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
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;
}
/**
* 是否禁行区内
*/

View File

@ -647,7 +647,8 @@ public class EtOrderServiceImpl implements IEtOrderService
order1.setPayType(ServiceConstants.PAY_TYPE_YJ);
order1.setMark(mark);
order1.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
ChannelVO channelVO = etChannelService.selectSmChannelByChannelId(order.getPayChannel());
order1.setDepositOrderNo(depositOrder.getOrderNo());
ChannelVO channelVO = etChannelService.selectSmChannelByChannelId(depositOrder.getPayChannel());
order1.setCost(getCost(channelVO,ridingFee));
int updateEtOrder = etOrderMapper.updateEtOrder(order1);
if(updateEtOrder == 0){