mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
占桩订单表 实体类update
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class QueryOccupyOrderDTO {
|
||||
// 充电桩编号
|
||||
private String pileSn;
|
||||
|
||||
// 会员id
|
||||
private String memberId;
|
||||
|
||||
// 充电桩枪口编号
|
||||
private String pileConnectorCode;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -63,4 +64,8 @@ public interface OrderPileOccupyMapper {
|
||||
int updateBatchSelective(List<OrderPileOccupy> list);
|
||||
|
||||
int batchInsert(@Param("list") List<OrderPileOccupy> list);
|
||||
|
||||
OrderPileOccupy queryByOccupyCode(@Param("occupyCode") String occupyCode);
|
||||
|
||||
List<OrderPileOccupy> queryOccupyOrderList(@Param("dto") QueryOccupyOrderDTO dto);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||
|
||||
import java.util.List;
|
||||
public interface OrderPileOccupyService{
|
||||
@@ -26,6 +27,10 @@ public interface OrderPileOccupyService{
|
||||
|
||||
int batchInsert(List<OrderPileOccupy> list);
|
||||
|
||||
OrderPileOccupy queryByOccupyCode(String occupyCode);
|
||||
|
||||
List<OrderPileOccupy> queryOccupyOrderList(QueryOccupyOrderDTO dto);
|
||||
|
||||
/**
|
||||
* 生成占桩订单
|
||||
*/
|
||||
|
||||
@@ -1327,7 +1327,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
*/
|
||||
private String generateNewOrderCode() {
|
||||
while (true) {
|
||||
String orderCode = IdUtils.getOrderCode();
|
||||
String orderCode = "C" + IdUtils.getOrderCode();
|
||||
// 通过orderCode查询是否已经存在
|
||||
OrderBasicInfo orderBasicInfo = getOrderInfoByOrderCode(orderCode);
|
||||
if (orderBasicInfo == null) {
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||
import com.jsowell.pile.mapper.OrderPileOccupyMapper;
|
||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
|
||||
@@ -68,6 +75,26 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
return orderPileOccupyMapper.batchInsert(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据占桩订单编号查询占桩订单
|
||||
* @param occupyCode 占桩订单编号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OrderPileOccupy queryByOccupyCode(String occupyCode) {
|
||||
return orderPileOccupyMapper.queryByOccupyCode(occupyCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询占桩订单列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OrderPileOccupy> queryOccupyOrderList(QueryOccupyOrderDTO dto) {
|
||||
return orderPileOccupyMapper.queryOccupyOrderList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成占桩订单
|
||||
* 在会员操作降地锁后,就生成占桩订单
|
||||
@@ -77,11 +104,30 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
||||
*/
|
||||
@Override
|
||||
public void generateOccupyPileOrder(String memberId, String pileSn, String connectorCode) {
|
||||
// 创建占桩订单
|
||||
OrderPileOccupy orderPileOccupy = new OrderPileOccupy();
|
||||
String occupyCode = "OP" + IdUtils.getOrderCode();
|
||||
orderPileOccupy.setOccupyCode(occupyCode);
|
||||
orderPileOccupy.setMemberId(memberId);
|
||||
orderPileOccupy.setStatus(Constants.ZERO);
|
||||
orderPileOccupy.setPileSn(pileSn);
|
||||
orderPileOccupy.setConnectorCode(connectorCode);
|
||||
orderPileOccupy.setPileConnectorCode(pileSn + connectorCode);
|
||||
orderPileOccupy.setStartTime(DateUtils.getNowDate());
|
||||
orderPileOccupyMapper.insertOrUpdate(orderPileOccupy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 占桩订单停止计费
|
||||
*/
|
||||
public void stopOccupyPileOrder(String occupyCode) {
|
||||
OrderPileOccupy orderPileOccupy = queryByOccupyCode(occupyCode);
|
||||
if (orderPileOccupy == null) {
|
||||
log.error("根据占桩订单编号:{}, 查询为空", occupyCode);
|
||||
return;
|
||||
}
|
||||
orderPileOccupy.setEndTime(DateUtils.getNowDate());
|
||||
orderPileOccupyMapper.insertOrUpdate(orderPileOccupy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user