新增 车辆离场时对应方法、 海南平台新增对应充电平台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.OrderPileOccupy;
import com.jsowell.pile.domain.PileCameraInfo; import com.jsowell.pile.domain.PileCameraInfo;
import com.jsowell.pile.dto.GenerateOccupyOrderDTO; 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.Camera2GroundLockCommand;
import com.jsowell.pile.dto.camera.CameraHeartBeatDTO; import com.jsowell.pile.dto.camera.CameraHeartBeatDTO;
import com.jsowell.pile.dto.camera.CameraIdentifyResultsDTO; import com.jsowell.pile.dto.camera.CameraIdentifyResultsDTO;
@@ -75,19 +76,49 @@ public class CameraService {
if (parking_state == 1) { if (parking_state == 1) {
// 入场 // 入场
String parkingState = "ENTRY"; String parkingState = "ENTRY";
vehicleEntry(jsonObject, parkingState); String result = vehicleEntry(jsonObject, parkingState);
logger.info("车辆入场处理 result:{}", result);
} }
if (parking_state == 2) { if (parking_state == 2) {
// 在场 // 在场
} }
if (parking_state == 4) { if (parking_state == 4) {
// 出场 // 出场
vehicleLeave(jsonObject);
} }
// saveInfo2DataBase(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 * 保存心跳到Redis
* @param dto * @param dto
@@ -122,7 +153,7 @@ public class CameraService {
// 先判断该车牌是否有挂起未支付的占桩订单 // 先判断该车牌是否有挂起未支付的占桩订单
OrderPileOccupy occupy = OrderPileOccupy.builder() OrderPileOccupy occupy = OrderPileOccupy.builder()
.status("2") // 2-订单挂起 .status(OccupyOrderStatusEnum.ORDER_HANG_UP.getCode()) // 2-订单挂起
.plateNumber(plateNumber) .plateNumber(plateNumber)
.build(); .build();
List<OccupyOrderVO> occupyList = orderPileOccupyService.getOrderPileOccupyList(occupy); List<OccupyOrderVO> occupyList = orderPileOccupyService.getOrderPileOccupyList(occupy);
@@ -149,8 +180,9 @@ public class CameraService {
} }
}else { }else {
// 如果没有小程序账号,再根据此车牌是否有挂起的占桩订单 // 如果没有小程序账号,再根据此车牌是否有挂起的占桩订单
OrderPileOccupy orderPileOccupy = new OrderPileOccupy(); OrderPileOccupy orderPileOccupy = OrderPileOccupy.builder()
orderPileOccupy.setPlateNumber(plateNumber); .plateNumber(plateNumber)
.build();
List<OccupyOrderVO> orderPileOccupyList = orderPileOccupyService.getOrderPileOccupyList(orderPileOccupy); List<OccupyOrderVO> orderPileOccupyList = orderPileOccupyService.getOrderPileOccupyList(orderPileOccupy);
// TODO 如果有已挂起的占桩订单,则不予降锁,将“已存在有未支付的占桩订单”信息返回 // TODO 如果有已挂起的占桩订单,则不予降锁,将“已存在有未支付的占桩订单”信息返回
if (CollectionUtils.isNotEmpty(orderPileOccupyList)) { if (CollectionUtils.isNotEmpty(orderPileOccupyList)) {

View File

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

View File

@@ -15,12 +15,13 @@ public enum ThirdPartyOperatorIdEnum {
YONG_CHENG_BO_CHE("4", "330205020"), YONG_CHENG_BO_CHE("4", "330205020"),
NING_XIA_JIAO_TOU("5", "MA771QENX"), NING_XIA_JIAO_TOU("5", "MA771QENX"),
XIN_DIAN_TU("6", "MA25CNM38"), XIN_DIAN_TU("6", "MA25CNM38"),
HAI_NAN("7", "578725200"), HAI_NAN_1("7", "578725200"),
HUA_WEI("8", ""); HAI_NAN_2("8", "MAA9A0PP1"),
HUA_WEI("9", ""),
; ;
private String type; private String type;
private String OperatorId; private String operatorId;
public String getType() { public String getType() {
return type; return type;
@@ -31,16 +32,16 @@ public enum ThirdPartyOperatorIdEnum {
} }
public String getOperatorId() { public String getOperatorId() {
return OperatorId; return operatorId;
} }
public void setOperatorId(String operatorId) { public void setOperatorId(String operatorId) {
OperatorId = operatorId; this.operatorId = operatorId;
} }
ThirdPartyOperatorIdEnum(String type, String operatorId) { ThirdPartyOperatorIdEnum(String type, String operatorId) {
this.type = type; this.type = type;
OperatorId = operatorId; this.operatorId = operatorId;
} }
/** /**

View File

@@ -15,8 +15,9 @@ public enum ThirdPlatformTypeEnum {
YONG_CHENG_BO_CHE("4", "甬城泊车平台"), YONG_CHENG_BO_CHE("4", "甬城泊车平台"),
NING_XIA_JIAO_TOU("5", "宁夏交投"), NING_XIA_JIAO_TOU("5", "宁夏交投"),
XIN_DIAN_TU("6", "新电途平台"), XIN_DIAN_TU("6", "新电途平台"),
HAI_NAN("7", "海南平台"), HAI_NAN_1("7", "海南一张网(监管平台)"),
HUA_WEI("8", "华为平台"), HAI_NAN_2("8", "海南一张网(充电平台)"),
HUA_WEI("9", "华为平台"),
; ;
private String code; private String code;

View File

@@ -38,6 +38,11 @@ public class GenerateOccupyOrderDTO {
*/ */
private String payStatus; private String payStatus;
/**
* 开始时间
*/
private String startTime;
/** /**
* 车牌号 * 车牌号
*/ */

View File

@@ -19,4 +19,10 @@ public class QueryOccupyOrderDTO {
// 充电桩枪口编号 // 充电桩枪口编号
private String pileConnectorCode; private String pileConnectorCode;
// 车牌号码
private String plateNumber;
// 订单状态
private String orderStatus;
} }

View File

@@ -65,6 +65,8 @@ public interface OrderPileOccupyService{
*/ */
void stopOccupyPileOrder(String pileSn, String connectorCode); void stopOccupyPileOrder(String pileSn, String connectorCode);
void stopOccupyPileOrder(OrderPileOccupy orderPileOccupy);
/** /**
* 通过memberid查询挂起状态订单 * 通过memberid查询挂起状态订单
* @param memberId * @param memberId

View File

@@ -183,6 +183,7 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
String orderStatus = dto.getOrderStatus(); String orderStatus = dto.getOrderStatus();
String payStatus = dto.getPayStatus(); String payStatus = dto.getPayStatus();
String plateNumber = dto.getPlateNumber(); String plateNumber = dto.getPlateNumber();
String startTime = dto.getStartTime();
if (StringUtils.isBlank(orderStatus)) { if (StringUtils.isBlank(orderStatus)) {
orderStatus = OccupyOrderStatusEnum.DRAFT_ORDER.getCode(); // 草稿单 orderStatus = OccupyOrderStatusEnum.DRAFT_ORDER.getCode(); // 草稿单
@@ -207,6 +208,9 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
if (StringUtils.isNotBlank(plateNumber)) { if (StringUtils.isNotBlank(plateNumber)) {
orderPileOccupy.setPlateNumber(plateNumber); // 车牌号 orderPileOccupy.setPlateNumber(plateNumber); // 车牌号
} }
if (StringUtils.isNotBlank(startTime)) {
orderPileOccupy.setStartTime(DateUtils.getNowDate()); // 开始时间
}
orderPileOccupy.setPileSn(pileSn); orderPileOccupy.setPileSn(pileSn);
PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn); PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn);
if (pileInfoVO != null) { if (pileInfoVO != null) {
@@ -239,6 +243,12 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
if (orderPileOccupy == null) { if (orderPileOccupy == null) {
return; return;
} }
stopOccupyPileOrder(orderPileOccupy);
}
@Override
public void stopOccupyPileOrder(OrderPileOccupy orderPileOccupy) {
// 设置结束时间 // 设置结束时间
orderPileOccupy.setEndTime(DateUtils.getNowDate()); orderPileOccupy.setEndTime(DateUtils.getNowDate());

View File

@@ -852,6 +852,13 @@
<if test="dto.pileSn != null and dto.pileSn != ''"> <if test="dto.pileSn != null and dto.pileSn != ''">
and pile_sn = #{dto.pileSn,jdbcType=VARCHAR} and pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
</if> </if>
<if test="dto.plateNumber != null and dto.plateNumber != ''">
and plate_number = #{dto.plateNumber,jdbcType=VARCHAR}
</if>
<if test="dto.orderStatus != null and dto.orderStatus != ''">
and status = #{dto.orderStatus,jdbcType=VARCHAR}
</if>
order by create_time DESC
</select> </select>
<select id="queryHangUpOrderByMemberId" resultMap="BaseResultMap"> <select id="queryHangUpOrderByMemberId" resultMap="BaseResultMap">

View File

@@ -157,7 +157,7 @@ public class CommonService {
// // 华为 // // 华为
// result = huaWeiService.notificationOperationSystemInfo(dto); // result = huaWeiService.notificationOperationSystemInfo(dto);
// } // }
if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN.getCode(), dto.getThirdPartyType())) { if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), dto.getThirdPartyType())) {
// 海南 // 海南
result = haiNanChargeService.pushStationInfoV2(dto); result = haiNanChargeService.pushStationInfoV2(dto);
} }
@@ -269,7 +269,7 @@ public class CommonService {
} }
huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode()); huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode());
} }
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN.getCode(), thirdPartyType)) { if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) {
// 海南平台 // 海南平台
haiNanChargeService.notificationStationStatus(pileConnectorCode, changedStatus); haiNanChargeService.notificationStationStatus(pileConnectorCode, changedStatus);
} }
@@ -341,7 +341,7 @@ public class CommonService {
// // 推送订单信息 // // 推送订单信息
// result = huaWeiService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); // result = huaWeiService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
// } // }
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN.getCode(), thirdPartyType)) { if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) {
// 海南平台 // 海南平台
haiNanChargeService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); haiNanChargeService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
} }

View File

@@ -65,7 +65,7 @@ import java.util.stream.Collectors;
public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.HAI_NAN.getCode(), this); InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), this);
} }
public String pushStationInfoV2(PushStationInfoDTO dto) { public String pushStationInfoV2(PushStationInfoDTO dto) {