mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-08 12:00:11 +08:00
新增 车辆离场时对应方法、 海南平台新增对应充电平台code
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -15,12 +15,13 @@ public enum ThirdPartyOperatorIdEnum {
|
||||
YONG_CHENG_BO_CHE("4", "330205020"),
|
||||
NING_XIA_JIAO_TOU("5", "MA771QENX"),
|
||||
XIN_DIAN_TU("6", "MA25CNM38"),
|
||||
HAI_NAN("7", "578725200"),
|
||||
HUA_WEI("8", "");
|
||||
HAI_NAN_1("7", "578725200"),
|
||||
HAI_NAN_2("8", "MAA9A0PP1"),
|
||||
HUA_WEI("9", ""),
|
||||
;
|
||||
private String type;
|
||||
|
||||
private String OperatorId;
|
||||
private String operatorId;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
@@ -31,16 +32,16 @@ public enum ThirdPartyOperatorIdEnum {
|
||||
}
|
||||
|
||||
public String getOperatorId() {
|
||||
return OperatorId;
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
public void setOperatorId(String operatorId) {
|
||||
OperatorId = operatorId;
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
ThirdPartyOperatorIdEnum(String type, String operatorId) {
|
||||
this.type = type;
|
||||
OperatorId = operatorId;
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,8 +15,9 @@ public enum ThirdPlatformTypeEnum {
|
||||
YONG_CHENG_BO_CHE("4", "甬城泊车平台"),
|
||||
NING_XIA_JIAO_TOU("5", "宁夏交投"),
|
||||
XIN_DIAN_TU("6", "新电途平台"),
|
||||
HAI_NAN("7", "海南平台"),
|
||||
HUA_WEI("8", "华为平台"),
|
||||
HAI_NAN_1("7", "海南一张网(监管平台)"),
|
||||
HAI_NAN_2("8", "海南一张网(充电平台)"),
|
||||
HUA_WEI("9", "华为平台"),
|
||||
;
|
||||
|
||||
private String code;
|
||||
|
||||
@@ -38,6 +38,11 @@ public class GenerateOccupyOrderDTO {
|
||||
*/
|
||||
private String payStatus;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
|
||||
@@ -19,4 +19,10 @@ public class QueryOccupyOrderDTO {
|
||||
|
||||
// 充电桩枪口编号
|
||||
private String pileConnectorCode;
|
||||
|
||||
// 车牌号码
|
||||
private String plateNumber;
|
||||
|
||||
// 订单状态
|
||||
private String orderStatus;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ public interface OrderPileOccupyService{
|
||||
*/
|
||||
void stopOccupyPileOrder(String pileSn, String connectorCode);
|
||||
|
||||
void stopOccupyPileOrder(OrderPileOccupy orderPileOccupy);
|
||||
|
||||
/**
|
||||
* 通过memberid查询挂起状态订单
|
||||
* @param memberId
|
||||
|
||||
@@ -183,6 +183,7 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
|
||||
String orderStatus = dto.getOrderStatus();
|
||||
String payStatus = dto.getPayStatus();
|
||||
String plateNumber = dto.getPlateNumber();
|
||||
String startTime = dto.getStartTime();
|
||||
|
||||
if (StringUtils.isBlank(orderStatus)) {
|
||||
orderStatus = OccupyOrderStatusEnum.DRAFT_ORDER.getCode(); // 草稿单
|
||||
@@ -207,6 +208,9 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
|
||||
if (StringUtils.isNotBlank(plateNumber)) {
|
||||
orderPileOccupy.setPlateNumber(plateNumber); // 车牌号
|
||||
}
|
||||
if (StringUtils.isNotBlank(startTime)) {
|
||||
orderPileOccupy.setStartTime(DateUtils.getNowDate()); // 开始时间
|
||||
}
|
||||
orderPileOccupy.setPileSn(pileSn);
|
||||
PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn);
|
||||
if (pileInfoVO != null) {
|
||||
@@ -239,6 +243,12 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService {
|
||||
if (orderPileOccupy == null) {
|
||||
return;
|
||||
}
|
||||
stopOccupyPileOrder(orderPileOccupy);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stopOccupyPileOrder(OrderPileOccupy orderPileOccupy) {
|
||||
// 设置结束时间
|
||||
orderPileOccupy.setEndTime(DateUtils.getNowDate());
|
||||
|
||||
|
||||
@@ -852,6 +852,13 @@
|
||||
<if test="dto.pileSn != null and dto.pileSn != ''">
|
||||
and pile_sn = #{dto.pileSn,jdbcType=VARCHAR}
|
||||
</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 id="queryHangUpOrderByMemberId" resultMap="BaseResultMap">
|
||||
|
||||
@@ -157,7 +157,7 @@ public class CommonService {
|
||||
// // 华为
|
||||
// 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);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ public class CommonService {
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -341,7 +341,7 @@ public class CommonService {
|
||||
// // 推送订单信息
|
||||
// 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());
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ import java.util.stream.Collectors;
|
||||
public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic {
|
||||
@Override
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user