mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 12:05:05 +08:00
个人桩启动充电
This commit is contained in:
@@ -45,7 +45,7 @@ public class PileReservationInfo {
|
||||
/**
|
||||
* 预约类型,单次 (single) 或周期性 (recurring)
|
||||
*/
|
||||
private String reservedType;
|
||||
private String reservationType;
|
||||
|
||||
/**
|
||||
* 预约开始时间
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.Date;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ReservedChargingCommand {
|
||||
public class ReservationChargingCommand {
|
||||
/**
|
||||
* 交易流水号
|
||||
*/
|
||||
@@ -7,7 +7,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class PileReservedDTO {
|
||||
public class PileReservationDTO {
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 查询个人桩相关信息DTO
|
||||
@@ -34,4 +36,15 @@ public class QueryPersonPileDTO {
|
||||
|
||||
private Integer pageNum;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
.append("memberId", memberId)
|
||||
.append("pileConnectorCode", pileConnectorCode)
|
||||
.append("startTime", startTime)
|
||||
.append("endTime", endTime)
|
||||
.append("pageSize", pageSize)
|
||||
.append("pageNum", pageNum)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StartPersonPileDTO {
|
||||
|
||||
/**
|
||||
* 充电桩枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 启动类型
|
||||
* @see com.jsowell.common.enums.ykc.StartTypeEnum
|
||||
*/
|
||||
private String startType;
|
||||
|
||||
private String memberId;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
}
|
||||
@@ -32,4 +32,6 @@ public interface PileReservationInfoMapper {
|
||||
List<PileReservationInfo> findByMemberIdAndPileSnAndStatus(@Param("memberId") String memberId, @Param("pileSn") String pileSn, @Param("status") String status);
|
||||
|
||||
List<PileReservationInfo> findByMemberIdAndPileSn(@Param("memberId") String memberId, @Param("pileSn") String pileSn);
|
||||
|
||||
PileReservationInfo selectActiveReservationByPileConnectorCode(String pileConnectorCode);
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.jsowell.pile.service;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
@@ -290,7 +289,7 @@ public class PileRemoteService {
|
||||
/**
|
||||
* 预约充电指令
|
||||
*/
|
||||
public void reservedCharging(ReservedChargingCommand command) {
|
||||
ykcPushCommandService.pushReservedChargingCommand(command);
|
||||
public void reservationCharging(ReservationChargingCommand command) {
|
||||
ykcPushCommandService.pushReservationChargingCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.dto.PileReservedDTO;
|
||||
import com.jsowell.pile.dto.PileReservationDTO;
|
||||
import com.jsowell.pile.domain.PileReservationInfo;
|
||||
|
||||
public interface PileReservationInfoService {
|
||||
@@ -34,13 +34,13 @@ public interface PileReservationInfoService {
|
||||
* 启动预约
|
||||
* @param dto
|
||||
*/
|
||||
void activateReserved(PileReservedDTO dto);
|
||||
void activateReserved(PileReservationDTO dto);
|
||||
|
||||
/**
|
||||
* 关闭预约
|
||||
* @param dto
|
||||
*/
|
||||
void deactivateReserved(PileReservedDTO dto);
|
||||
void deactivateReserved(PileReservationDTO dto);
|
||||
|
||||
/**
|
||||
* 根据充电枪口编号发送预约指令
|
||||
@@ -53,5 +53,7 @@ public interface PileReservationInfoService {
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
void cancelOneTimeReservation(String pileConnectorCode);
|
||||
|
||||
void deleteReservation(PileReservationDTO dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,5 +82,5 @@ public interface YKCPushCommandService {
|
||||
* 发送预约充电命令
|
||||
* @param command
|
||||
*/
|
||||
void pushReservedChargingCommand(ReservedChargingCommand command);
|
||||
void pushReservationChargingCommand(ReservationChargingCommand command);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import com.jsowell.common.util.bean.BeanUtils;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.common.util.id.SnowflakeIdWorker;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.ykcCommond.ReservedChargingCommand;
|
||||
import com.jsowell.pile.domain.ykcCommond.ReservationChargingCommand;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
|
||||
@@ -3118,7 +3118,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
* 异步发送预约充电指令
|
||||
*/
|
||||
if (StringUtils.equals(orderInfo.getStartType(), StartTypeEnum.RESERVED.getValue())) {
|
||||
ReservedChargingCommand command = ReservedChargingCommand.builder()
|
||||
ReservationChargingCommand command = ReservationChargingCommand.builder()
|
||||
.transactionCode(orderInfo.getTransactionCode())
|
||||
.pileSn(orderInfo.getPileSn())
|
||||
.connectorCode(orderInfo.getConnectorCode())
|
||||
@@ -3129,7 +3129,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
.build();
|
||||
// 发送预约充电指令
|
||||
logger.info("订单:{}支付成功, 发送预约充电指令, command:{}", dto.getOrderCode(), JSON.toJSONString(command));
|
||||
pileRemoteService.reservedCharging(command);
|
||||
pileRemoteService.reservationCharging(command);
|
||||
}
|
||||
|
||||
if (OrderStatusEnum.STAY_RETROACTIVE_AMOUNT.getValue().equals(orderInfo.getOrderStatus())) {
|
||||
|
||||
@@ -1,27 +1,36 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.PileReservedDTO;
|
||||
import com.jsowell.pile.dto.PileReservationDTO;
|
||||
import com.jsowell.pile.service.PileRemoteService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.jsowell.pile.mapper.PileReservationInfoMapper;
|
||||
import com.jsowell.pile.domain.PileReservationInfo;
|
||||
import com.jsowell.pile.service.PileReservationInfoService;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PileReservationInfoServiceImpl implements PileReservationInfoService {
|
||||
|
||||
@Resource
|
||||
private PileReservationInfoMapper pileReservationInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private PileRemoteService pileRemoteService;
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Integer id) {
|
||||
return pileReservationInfoMapper.deleteByPrimaryKey(id);
|
||||
@@ -86,7 +95,7 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
* 启用预约
|
||||
*/
|
||||
@Override
|
||||
public void activateReserved(PileReservedDTO dto) {
|
||||
public void activateReserved(PileReservationDTO dto) {
|
||||
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPrimaryKey(Integer.parseInt(dto.getReservedId()));
|
||||
if (pileReservationInfo == null) {
|
||||
return;
|
||||
@@ -103,7 +112,7 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
* 禁用预约
|
||||
*/
|
||||
@Override
|
||||
public void deactivateReserved(PileReservedDTO dto) {
|
||||
public void deactivateReserved(PileReservationDTO dto) {
|
||||
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPrimaryKey(Integer.parseInt(dto.getReservedId()));
|
||||
if (pileReservationInfo == null) {
|
||||
return;
|
||||
@@ -159,6 +168,12 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
@Override
|
||||
public void pushReservedByPileConnectorCode(String pileConnectorCode) {
|
||||
// 根据充电枪口编号查询正在生效中的预约
|
||||
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectActiveReservationByPileConnectorCode(pileConnectorCode);
|
||||
if (Objects.isNull(pileReservationInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 生成个人桩订单
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,5 +184,18 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
public void cancelOneTimeReservation(String pileConnectorCode) {
|
||||
// 根据充电枪口编号查询仅一次正在生效中的预约
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteReservation(PileReservationDTO dto) {
|
||||
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPrimaryKey(Integer.valueOf(dto.getReservedId()));
|
||||
if (Objects.isNull(pileReservationInfo)) {
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.equals(pileReservationInfo.getMemberId(), dto.getMemberId())) {
|
||||
return;
|
||||
}
|
||||
pileReservationInfo.setDelFlag(DelFlagEnum.DELETE.getValue());
|
||||
pileReservationInfoMapper.updateByPrimaryKey(pileReservationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -482,7 +482,7 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
||||
* @param command
|
||||
*/
|
||||
@Override
|
||||
public void pushReservedChargingCommand(ReservedChargingCommand command) {
|
||||
public void pushReservationChargingCommand(ReservationChargingCommand command) {
|
||||
// 交易流水号
|
||||
String transactionCode = command.getTransactionCode();
|
||||
byte[] transactionCodeArr = BytesUtil.str2Bcd(transactionCode);
|
||||
|
||||
Reference in New Issue
Block a user