新增 车辆离场时对应方法、 海南平台新增对应充电平台code

This commit is contained in:
Lemon
2024-02-23 13:55:28 +08:00
parent 5c40cf5edd
commit ffd02338f1
11 changed files with 81 additions and 17 deletions

View File

@@ -15,6 +15,7 @@ import com.jsowell.netty.server.mqtt.BootNettyMqttChannelInboundHandler;
import com.jsowell.pile.domain.OrderPileOccupy;
import com.jsowell.pile.domain.PileCameraInfo;
import com.jsowell.pile.dto.GenerateOccupyOrderDTO;
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
import com.jsowell.pile.dto.camera.Camera2GroundLockCommand;
import com.jsowell.pile.dto.camera.CameraHeartBeatDTO;
import com.jsowell.pile.dto.camera.CameraIdentifyResultsDTO;
@@ -75,19 +76,49 @@ public class CameraService {
if (parking_state == 1) {
// 入场
String parkingState = "ENTRY";
vehicleEntry(jsonObject, parkingState);
String result = vehicleEntry(jsonObject, parkingState);
logger.info("车辆入场处理 result:{}", result);
}
if (parking_state == 2) {
// 在场
}
if (parking_state == 4) {
// 出场
vehicleLeave(jsonObject);
}
// saveInfo2DataBase(jsonObject);
}
/**
* 车辆离场
* @param jsonObject
*/
private void vehicleLeave(JSONObject jsonObject) {
// 将信息存数据库
Map<String, String> resultMap = saveInfo2DataBase(jsonObject);
if (resultMap == null) {
logger.error("车辆离场,将信息存入数据库 error, 源数据:{}", jsonObject);
return;
}
String plateNumber = resultMap.get("plateNumber");
// 查出该车牌对应的挂起状态的占桩订单
QueryOccupyOrderDTO dto = QueryOccupyOrderDTO.builder()
.plateNumber(plateNumber)
.orderStatus(OccupyOrderStatusEnum.ORDER_HANG_UP.getCode())
.build();
List<OrderPileOccupy> orderPileOccupyList = orderPileOccupyService.queryOccupyOrderList(dto);
if (CollectionUtils.isEmpty(orderPileOccupyList)) {
return;
}
OrderPileOccupy occupy = orderPileOccupyList.get(0);
// 停止占桩订单
orderPileOccupyService.stopOccupyPileOrder(occupy);
}
/**
* 保存心跳到Redis
* @param dto
@@ -122,7 +153,7 @@ public class CameraService {
// 先判断该车牌是否有挂起未支付的占桩订单
OrderPileOccupy occupy = OrderPileOccupy.builder()
.status("2") // 2-订单挂起
.status(OccupyOrderStatusEnum.ORDER_HANG_UP.getCode()) // 2-订单挂起
.plateNumber(plateNumber)
.build();
List<OccupyOrderVO> occupyList = orderPileOccupyService.getOrderPileOccupyList(occupy);
@@ -149,8 +180,9 @@ public class CameraService {
}
}else {
// 如果没有小程序账号,再根据此车牌是否有挂起的占桩订单
OrderPileOccupy orderPileOccupy = new OrderPileOccupy();
orderPileOccupy.setPlateNumber(plateNumber);
OrderPileOccupy orderPileOccupy = OrderPileOccupy.builder()
.plateNumber(plateNumber)
.build();
List<OccupyOrderVO> orderPileOccupyList = orderPileOccupyService.getOrderPileOccupyList(orderPileOccupy);
// TODO 如果有已挂起的占桩订单,则不予降锁,将“已存在有未支付的占桩订单”信息返回
if (CollectionUtils.isNotEmpty(orderPileOccupyList)) {

View File

@@ -85,7 +85,7 @@ public class HaiNanPlatformController extends BaseController {
// 转换成相应对象
QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class);
queryStationInfoDTO.setOperatorId(dto.getOperatorID());
queryStationInfoDTO.setThirdPlatformType(ThirdPlatformTypeEnum.HAI_NAN.getCode());
queryStationInfoDTO.setThirdPlatformType(ThirdPlatformTypeEnum.HAI_NAN_1.getCode());
Map<String, String> map = platformLogic.queryStationsInfo(queryStationInfoDTO);
logger.info("海南平台查询充电站信息 result:{}", JSONObject.toJSONString(map));
return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));