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:
@@ -378,4 +378,6 @@ public interface OrderBasicInfoMapper {
|
||||
* @return
|
||||
*/
|
||||
List<BusinessOrderDetailInfoVO> getOrderDetailByStationIds(@Param("stationIds") List<String> stationIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
List<OrderBasicInfo> queryOrdersByPileConnectorCodeAndStatus(@Param("pileConnectorCode") String pileConnectorCode, @Param("orderStatus") String orderStatus, @Param("payStatus") String payStatus);
|
||||
}
|
||||
@@ -485,4 +485,11 @@ public interface OrderBasicInfoService{
|
||||
|
||||
|
||||
BusinessOrderDetailInfoVO getBusinessOrderDetail(String orderCode);
|
||||
|
||||
/**
|
||||
* 根据枪口编号和状态查询订单
|
||||
* @param pileConnectorCode
|
||||
* @return
|
||||
*/
|
||||
List<OrderBasicInfo> queryOrdersByPileConnectorCodeAndStatus(String pileConnectorCode, String orderStatus, String payStatus);
|
||||
}
|
||||
|
||||
@@ -726,8 +726,8 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
if (StringUtils.isBlank(pileConnectorCode)) {
|
||||
return null;
|
||||
}
|
||||
String pileSn = pileConnectorCode.substring(0, pileConnectorCode.length() - 2);
|
||||
String connectorCode = pileConnectorCode.substring(pileConnectorCode.length() - 2);
|
||||
String pileSn = YKCUtils.getPileSn(pileConnectorCode);
|
||||
String connectorCode = YKCUtils.getConnectorCode(pileConnectorCode);
|
||||
return queryChargingByPileSnAndConnectorCode(pileSn, connectorCode);
|
||||
}
|
||||
|
||||
@@ -4066,5 +4066,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderBasicInfo> queryOrdersByPileConnectorCodeAndStatus(String pileConnectorCode, String orderStatus, String payStatus) {
|
||||
return orderBasicInfoMapper.queryOrdersByPileConnectorCodeAndStatus(pileConnectorCode, orderStatus, payStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -779,7 +779,9 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
public Map<String, Integer> getPileTypeNum(Long stationId) {
|
||||
// 获取充电站枪口列表
|
||||
List<ConnectorInfoVO> connectorList = getUniAppConnectorList(stationId);
|
||||
return getPileTypeNum(connectorList);
|
||||
Map<String, Integer> pileTypeNum = getPileTypeNum(connectorList);
|
||||
log.info("根据站点id:{}, 查询快、慢充设备数量:{}", stationId, pileTypeNum);
|
||||
return pileTypeNum;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -563,13 +563,13 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
|
||||
|
||||
// 查询快慢充数量
|
||||
Map<String, Integer> map = pileConnectorInfoService.getPileTypeNum(Long.parseLong(pileStationVO.getId()));
|
||||
Integer fastFree = map.get("fastFree");
|
||||
Integer slowFree = map.get("slowFree");
|
||||
// Integer fastFree = map.get("fastFree");
|
||||
// Integer slowFree = map.get("slowFree");
|
||||
stationVO.setFastTotal(map.get("fastTotal"));
|
||||
stationVO.setFastFree(fastFree);
|
||||
stationVO.setFastFree(map.get("fastFree"));
|
||||
stationVO.setSlowTotal(map.get("slowTotal"));
|
||||
stationVO.setSlowFree(map.get("slowFree"));
|
||||
stationVO.setTotalFree(fastFree + slowFree);
|
||||
stationVO.setTotalFree(stationVO.getFastFree() + stationVO.getSlowFree());
|
||||
|
||||
// 查询当前时段电费
|
||||
CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(stationVO.getStationId());
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -123,7 +122,7 @@ public abstract class AbstractProgramLogic implements InitializingBean {
|
||||
/**
|
||||
* 生成订单
|
||||
*/
|
||||
public abstract OrderBasicInfo generateOrder(GenerateOrderDTO dto) throws ParseException;
|
||||
public abstract OrderBasicInfo generateOrder(GenerateOrderDTO dto) throws Exception;
|
||||
|
||||
/**
|
||||
* 支付订单
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public OrderBasicInfo generateOrder(GenerateOrderDTO dto) throws ParseException {
|
||||
public OrderBasicInfo generateOrder(GenerateOrderDTO dto) throws Exception {
|
||||
// 处理前端传的参数
|
||||
orderBasicInfoService.analysisPileParameter(dto);
|
||||
|
||||
@@ -112,9 +112,33 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
|
||||
// 无transactionCode, 表示由平台端启动充电, 需要验证充电桩状态
|
||||
orderBasicInfoService.checkPileInfoForEBike(dto);
|
||||
}
|
||||
|
||||
// 校验该桩号枪口是否有待支付订单
|
||||
checkPileConnectorOrder(dto);
|
||||
|
||||
return orderBasicInfoService.saveOrderForEBike(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验该桩号枪口是否有待支付订单
|
||||
*/
|
||||
private void checkPileConnectorOrder(GenerateOrderDTO dto) {
|
||||
String pileConnectorCode = dto.getPileConnectorCode();
|
||||
List<OrderBasicInfo> orderBasicInfoList = orderBasicInfoService.queryOrdersByPileConnectorCodeAndStatus(pileConnectorCode, null, OrderPayStatusEnum.unpaid.getValue());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(orderBasicInfoList)) {
|
||||
List<OrderBasicInfo> collect = orderBasicInfoList.stream()
|
||||
// 这个会员有待支付订单
|
||||
.filter(x -> StringUtils.equals(x.getMemberId(), dto.getMemberId()))
|
||||
// 10分钟内的订单
|
||||
.filter(x -> DateUtils.intervalTime(x.getCreateTime(), DateUtils.getNowDate()) < 10 * 60 * 1000)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(collect)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PENDING_PAYMENT_ORDERS_EXIST_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付订单
|
||||
* @param dto
|
||||
@@ -933,7 +957,7 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
|
||||
OrderBasicInfo orderBasicInfo;
|
||||
try {
|
||||
orderBasicInfo = generateOrder(generateOrderDTO);
|
||||
} catch (ParseException e) {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 支付订单
|
||||
|
||||
Reference in New Issue
Block a user