mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 订单相关修改
This commit is contained in:
@@ -626,7 +626,7 @@ public class OrderService {
|
||||
String pileConnectorCode = orderBasicInfo.getPileSn() + orderBasicInfo.getConnectorCode();
|
||||
QueryConnectorListDTO dto = new QueryConnectorListDTO();
|
||||
dto.setConnectorCodeList(Lists.newArrayList(pileConnectorCode));
|
||||
List<RealTimeMonitorData> chargingRealTimeDataList = orderBasicInfoService.getChargingRealTimeData(orderCode);
|
||||
List<RealTimeMonitorData> chargingRealTimeDataList = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
|
||||
if (CollectionUtils.isNotEmpty(chargingRealTimeDataList)) {
|
||||
List<OrderDetailInfoVO.RealTimeMonitorData> infoList = Lists.newArrayList();
|
||||
for (RealTimeMonitorData realTimeMonitorData : chargingRealTimeDataList) {
|
||||
@@ -733,7 +733,9 @@ public class OrderService {
|
||||
vo.setPileConnectorCode(orderBasicInfo.getPileSn() + orderBasicInfo.getConnectorCode());
|
||||
String orderStatus = orderBasicInfo.getOrderStatus();
|
||||
vo.setOrderStatus(orderStatus);
|
||||
vo.setStartChargingTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()));
|
||||
if (Objects.nonNull(orderBasicInfo.getChargeStartTime())) {
|
||||
vo.setStartChargingTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()));
|
||||
}
|
||||
Date chargeEndTime = orderBasicInfo.getChargeEndTime();
|
||||
if (Objects.nonNull(chargeEndTime)) {
|
||||
vo.setEndChargingTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, chargeEndTime));
|
||||
@@ -768,7 +770,7 @@ public class OrderService {
|
||||
}
|
||||
|
||||
// 获取订单充电数据
|
||||
List<RealTimeMonitorData> monitorDataList = orderBasicInfoService.getChargingRealTimeData(orderCode);
|
||||
List<RealTimeMonitorData> monitorDataList = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
|
||||
if (CollectionUtils.isNotEmpty(monitorDataList)) {
|
||||
List<UniAppOrderVO.ChargingData> chargingDataList = Lists.newArrayList();
|
||||
UniAppOrderVO.ChargingData data = null;
|
||||
@@ -821,7 +823,11 @@ public class OrderService {
|
||||
* @return
|
||||
*/
|
||||
public String selectPileStarterStatus(String orderCode) {
|
||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderCode);
|
||||
OrderBasicInfo orderInfoByOrderCode = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
if (orderInfoByOrderCode == null) {
|
||||
return Constants.ZERO;
|
||||
}
|
||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfoByOrderCode.getTransactionCode());
|
||||
// 只有充电桩上传的实时数据中的状态为充电,才能查到实时数据列表
|
||||
return CollectionUtils.isNotEmpty(chargingRealTimeData) ? Constants.ONE : Constants.ZERO;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public class PileService {
|
||||
}
|
||||
String orderCode = basicInfo.getOrderCode();
|
||||
// 根据订单号从redis中获取实时数据信息(默认时间倒叙排列,所以取第一条)
|
||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderCode);
|
||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(basicInfo.getTransactionCode());
|
||||
if (CollectionUtils.isEmpty(chargingRealTimeData)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_NO_REAL_TIME_INFO);
|
||||
}
|
||||
|
||||
@@ -105,6 +105,14 @@ public interface PileBillingTemplateMapper {
|
||||
List<BillingTemplateVO> queryStationBillingTemplateList(@Param("stationId") String stationId,
|
||||
@Param("stationDeptIds") List<String> stationDeptIds);
|
||||
|
||||
/**
|
||||
* 根据站点id查询站点计费模板列表
|
||||
* 根据发布时间倒序,最新一条就是目前正在使用的计费模板
|
||||
* @param stationId 站点id
|
||||
* @return
|
||||
*/
|
||||
List<BillingTemplateVO> queryStationBillingTemplateListForUniApp(@Param("stationId") String stationId);
|
||||
|
||||
/**
|
||||
* 通过桩sn号查询计费模板
|
||||
*
|
||||
|
||||
@@ -89,6 +89,14 @@ public interface IPileBillingTemplateService {
|
||||
*/
|
||||
List<BillingTemplateVO> queryStationBillingTemplateList(String stationId);
|
||||
|
||||
/**
|
||||
* 查询站点计费模板
|
||||
*
|
||||
* @param stationId 站点id
|
||||
* @return
|
||||
*/
|
||||
List<BillingTemplateVO> queryStationBillingTemplateListForUniApp(String stationId);
|
||||
|
||||
/**
|
||||
* 查询正在使用中的计费模板
|
||||
* @param stationId 站点id
|
||||
|
||||
@@ -314,7 +314,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
continue;
|
||||
}
|
||||
// 获取订单的实时检测数据,有实时数据说明充电了,没有实时数据说明桩确实没有充电
|
||||
List<RealTimeMonitorData> chargingRealTimeData = getChargingRealTimeData(orderCode);
|
||||
List<RealTimeMonitorData> chargingRealTimeData = getChargingRealTimeData(orderBasicInfo.getTransactionCode());
|
||||
if (CollectionUtils.isEmpty(chargingRealTimeData)) {
|
||||
// 充电桩在线,并且没有0x13实时数据,则执行结算退款操作
|
||||
chargingPileFailedToStart(orderCode, "充电桩启动失败,执行退款处理");
|
||||
@@ -690,17 +690,18 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
* 根据订单编号获取充电实时数据 时间倒序
|
||||
* 订单只有在充电中,才会把实时数据保存到redis
|
||||
*
|
||||
* @param orderCode 订单编号
|
||||
* @param transactionCode 订单编号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RealTimeMonitorData> getChargingRealTimeData(String orderCode) {
|
||||
public List<RealTimeMonitorData> getChargingRealTimeData(String transactionCode) {
|
||||
List<RealTimeMonitorData> resultList = Lists.newArrayList();
|
||||
if (StringUtils.isBlank(orderCode)) {
|
||||
if (StringUtils.isBlank(transactionCode)) {
|
||||
return resultList;
|
||||
}
|
||||
String pileConnectorCode = orderCode.substring(0, 16);
|
||||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + orderCode;
|
||||
logger.info("transactionCode:{}", transactionCode);
|
||||
String pileConnectorCode = transactionCode.substring(0, 16);
|
||||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode;
|
||||
// 拿到所有数据
|
||||
Map<Object, Object> map = redisCache.hmget(redisKey);
|
||||
if (map != null && !map.isEmpty()) {
|
||||
|
||||
@@ -457,7 +457,7 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
|
||||
@Override
|
||||
public void saveRealTimeMonitorData2Redis(RealTimeMonitorData realTimeMonitorData) {
|
||||
// 保存到redis
|
||||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + realTimeMonitorData.getPileConnectorCode() + "_" + realTimeMonitorData.getConnectorCode();
|
||||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + realTimeMonitorData.getPileConnectorCode() + "_" + realTimeMonitorData.getTransactionCode();
|
||||
|
||||
// 设置接收到实时数据的时间
|
||||
Date now = new Date();
|
||||
|
||||
@@ -359,6 +359,11 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
|
||||
return pileBillingTemplateMapper.queryStationBillingTemplateList(stationId, authorizedMap.getStationDeptIds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BillingTemplateVO> queryStationBillingTemplateListForUniApp(String stationId) {
|
||||
return pileBillingTemplateMapper.queryStationBillingTemplateListForUniApp(stationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询正在使用中的计费模板
|
||||
* 1 发布时间不为null
|
||||
@@ -368,7 +373,7 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
|
||||
*/
|
||||
@Override
|
||||
public BillingTemplateVO queryUsedBillingTemplate(String stationId) {
|
||||
List<BillingTemplateVO> list = queryStationBillingTemplateList(stationId);
|
||||
List<BillingTemplateVO> list = queryStationBillingTemplateListForUniApp(stationId);
|
||||
Optional<BillingTemplateVO> max = list.stream()
|
||||
.filter(x -> StringUtils.isNotBlank(x.getPublishTime()))
|
||||
.max(Comparator.comparing(BillingTemplateVO::getPublishTime));
|
||||
|
||||
@@ -412,8 +412,10 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
|
||||
// 获取枪口的日志记录
|
||||
for (PileConnectorInfoVO pileConnectorInfoVO : pileConnectorInfoList) {
|
||||
// 从redis中获取实时数据信息
|
||||
if (StringUtils.isNotBlank(pileConnectorInfoVO.getOrderCode())) {
|
||||
List<RealTimeMonitorData> chargingRealTimeDataList = orderBasicInfoService.getChargingRealTimeData(pileConnectorInfoVO.getOrderCode());
|
||||
String orderCode = pileConnectorInfoVO.getOrderCode();
|
||||
if (StringUtils.isNotBlank(orderCode)) {
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
List<RealTimeMonitorData> chargingRealTimeDataList = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
|
||||
RealTimeMonitorData realTimeMonitorData = chargingRealTimeDataList.get(0);
|
||||
BigDecimal outputVoltage = new BigDecimal(realTimeMonitorData.getOutputVoltage());
|
||||
pileConnectorInfoVO.setVoltage(outputVoltage);
|
||||
|
||||
@@ -438,4 +438,37 @@
|
||||
order by t2.publish_time DESC
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="queryStationBillingTemplateListForUniApp" resultType="com.jsowell.pile.vo.web.BillingTemplateVO">
|
||||
select
|
||||
t2.id as templateId,
|
||||
t2.template_code as templateCode,
|
||||
t2.name as templateName,
|
||||
t2.remark as remark,
|
||||
t2.type as deviceType,
|
||||
t2.publish_time as publishTime,
|
||||
t3.electricity_price AS sharpElectricityPrice,
|
||||
t3.service_price AS sharpServicePrice,
|
||||
t3.apply_time AS sharpApplyDate,
|
||||
t4.electricity_price AS peakElectricityPrice,
|
||||
t4.service_price AS peakServicePrice,
|
||||
t4.apply_time AS peakApplyDate,
|
||||
t5.electricity_price AS flatElectricityPrice,
|
||||
t5.service_price AS flatServicePrice,
|
||||
t5.apply_time AS flatApplyDate,
|
||||
t6.electricity_price AS valleyElectricityPrice,
|
||||
t6.service_price AS valleyServicePrice,
|
||||
t6.apply_time AS valleyApplyDate
|
||||
from
|
||||
pile_billing_template t2
|
||||
left join pile_station_info t1 on t1.id = t2.station_id
|
||||
left JOIN pile_billing_detail t3 ON t3.template_code = t2.template_code AND t3.time_type = '1'
|
||||
left JOIN pile_billing_detail t4 ON t4.template_code = t2.template_code AND t4.time_type = '2'
|
||||
left JOIN pile_billing_detail t5 ON t5.template_code = t2.template_code AND t5.time_type = '3'
|
||||
left JOIN pile_billing_detail t6 ON t6.template_code = t2.template_code AND t6.time_type = '4'
|
||||
where
|
||||
t2.del_flag = '0'
|
||||
and t2.station_id = #{stationId,jdbcType=VARCHAR}
|
||||
order by t2.publish_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user