mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 04:25:21 +08:00
update 预约充电
This commit is contained in:
@@ -28,6 +28,11 @@ public class PileReservationDTO {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 充电桩枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 开始时间 hh:mm:ss
|
||||
*/
|
||||
|
||||
@@ -34,4 +34,6 @@ public interface PileReservationInfoMapper {
|
||||
List<PileReservationInfo> findByMemberIdAndPileSn(@Param("memberId") String memberId, @Param("pileSn") String pileSn);
|
||||
|
||||
PileReservationInfo selectActiveReservationByPileConnectorCode(String pileConnectorCode);
|
||||
|
||||
PileReservationInfo selectByPileConnectorCode(String pileConnectorCode);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.pile.dto.CreateReservedDTO;
|
||||
import com.jsowell.pile.dto.PersonPileStopChargingDTO;
|
||||
import com.jsowell.pile.dto.PileReservationDTO;
|
||||
import com.jsowell.pile.domain.PileReservationInfo;
|
||||
import com.jsowell.pile.vo.PileReservationInfoVO;
|
||||
|
||||
public interface PileReservationInfoService {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
@@ -68,5 +69,7 @@ public interface PileReservationInfoService {
|
||||
void updateReservation(PileReservationDTO dto);
|
||||
|
||||
void personPileStopCharging(PersonPileStopChargingDTO dto);
|
||||
|
||||
PileReservationInfoVO queryReservationInfo(PileReservationDTO dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.jsowell.pile.dto.StartPersonPileDTO;
|
||||
import com.jsowell.pile.service.MemberPlateNumberRelationService;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import com.jsowell.pile.service.PileRemoteService;
|
||||
import com.jsowell.pile.vo.PileReservedVO;
|
||||
import com.jsowell.pile.vo.PileReservationInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberPlateNumberVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@@ -69,6 +70,11 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
|
||||
@Override
|
||||
public int insertOrUpdateSelective(PileReservationInfo record) {
|
||||
if (record.getId() == null) {
|
||||
record.setCreateTime(DateUtils.getNowDate());
|
||||
} else {
|
||||
record.setUpdateTime(DateUtils.getNowDate());
|
||||
}
|
||||
return pileReservationInfoMapper.insertOrUpdateSelective(record);
|
||||
}
|
||||
|
||||
@@ -112,6 +118,10 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
return pileReservationInfoMapper.findByMemberIdAndPileSn(memberId, pileSn);
|
||||
}
|
||||
|
||||
public PileReservationInfo selectByPileConnectorCode(String pileConnectorCode) {
|
||||
return pileReservationInfoMapper.selectByPileConnectorCode(pileConnectorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用预约/开启预约/启动预约
|
||||
*/
|
||||
@@ -300,11 +310,17 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
|
||||
@Override
|
||||
public int createReservation(CreateReservedDTO dto) {
|
||||
PileReservationInfo reservedInfo = new PileReservationInfo();
|
||||
reservedInfo.setMemberId(dto.getMemberId());
|
||||
PileReservationInfo reservedInfo = selectByPileConnectorCode(dto.getPileConnectorCode());
|
||||
if (reservedInfo == null) {
|
||||
reservedInfo = new PileReservationInfo();
|
||||
reservedInfo.setCreateBy(dto.getMemberId());
|
||||
} else {
|
||||
reservedInfo.setUpdateBy(dto.getMemberId());
|
||||
}
|
||||
// reservedInfo.setMemberId(dto.getMemberId());
|
||||
reservedInfo.setPileSn(dto.getPileSn());
|
||||
reservedInfo.setPileConnectorCode(dto.getPileConnectorCode());
|
||||
reservedInfo.setStatus(Constants.ZERO); // 默认未生效
|
||||
reservedInfo.setStatus(Constants.ONE); // 默认生效
|
||||
// reservedInfo.setStartTime(DateUtils.parseDate(dto.getStartTime()));
|
||||
reservedInfo.setStartTime(Time.valueOf(dto.getStartTime()));
|
||||
// reservedInfo.setEndTime(DateUtils.parseDate(dto.getEndTime()));
|
||||
@@ -325,8 +341,8 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
reservedInfo.setReservationType("recurring");
|
||||
reservedInfo.setFreq("daily");
|
||||
|
||||
reservedInfo.setCreateBy(dto.getMemberId());
|
||||
this.insertSelective(reservedInfo);
|
||||
|
||||
this.insertOrUpdateSelective(reservedInfo);
|
||||
return reservedInfo.getId();
|
||||
}
|
||||
|
||||
@@ -344,15 +360,15 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
pageResponse.setPages(pageInfo.getPages());
|
||||
pageResponse.setTotal(pageInfo.getTotal());
|
||||
|
||||
List<PileReservedVO> resultList = Lists.newArrayList();
|
||||
List<PileReservationInfoVO> resultList = Lists.newArrayList();
|
||||
for (PileReservationInfo reservedInfo : pageInfo.getList()) {
|
||||
resultList.add(
|
||||
PileReservedVO.builder()
|
||||
.reservedId(reservedInfo.getId() + "")
|
||||
PileReservationInfoVO.builder()
|
||||
// .reservationId(reservedInfo.getId() + "")
|
||||
.pileSn(reservedInfo.getPileSn())
|
||||
.startTime(reservedInfo.getStartTime().toString())
|
||||
.endTime(reservedInfo.getEndTime().toString())
|
||||
.freq(reservedInfo.getFreq())
|
||||
// .freq(reservedInfo.getFreq())
|
||||
.status(reservedInfo.getStatus())
|
||||
.build()
|
||||
);
|
||||
@@ -399,6 +415,7 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
if (StringUtils.isNotBlank(dto.getStatus())) {
|
||||
pileReservationInfo.setStatus(dto.getStatus());
|
||||
}
|
||||
pileReservationInfo.setUpdateBy(dto.getMemberId());
|
||||
this.insertOrUpdateSelective(pileReservationInfo);
|
||||
}
|
||||
|
||||
@@ -414,5 +431,20 @@ public class PileReservationInfoServiceImpl implements PileReservationInfoServic
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileReservationInfoVO queryReservationInfo(PileReservationDTO dto) {
|
||||
PileReservationInfo pileReservationInfo = pileReservationInfoMapper.selectByPileConnectorCode(dto.getPileConnectorCode());
|
||||
PileReservationInfoVO build = PileReservationInfoVO.builder()
|
||||
// .reservationId(pileReservationInfo.getId() + "")
|
||||
.pileSn(pileReservationInfo.getPileSn())
|
||||
.pileConnectorCode(pileReservationInfo.getPileConnectorCode())
|
||||
.startTime(pileReservationInfo.getStartTime().toString())
|
||||
.endTime(pileReservationInfo.getEndTime().toString())
|
||||
// .freq(pileReservationInfo.getFreq())
|
||||
.status(pileReservationInfo.getStatus())
|
||||
.build();
|
||||
return build;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,19 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class PileReservedVO {
|
||||
private String reservedId;
|
||||
public class PileReservationInfoVO {
|
||||
// private String reservationId;
|
||||
|
||||
/**
|
||||
* 充电桩编号
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 充电桩枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 预约开始时间
|
||||
*/
|
||||
@@ -28,7 +33,7 @@ public class PileReservedVO {
|
||||
/**
|
||||
* 周期性预约的频率,对于单次预约,该字段可以为 NULL。可能的值包括 daily, weekly, monthly
|
||||
*/
|
||||
private String freq;
|
||||
// private String freq;
|
||||
|
||||
/**
|
||||
* 状态(0-未生效;1-生效)
|
||||
@@ -45,4 +45,14 @@ public class PersonPileRealTimeVO {
|
||||
* 实时功率
|
||||
*/
|
||||
private String instantPower;
|
||||
|
||||
/**
|
||||
* 枪口状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* soc
|
||||
*/
|
||||
private String soc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user