新增 运营端小程序通过订单编号查询订单详情接口

This commit is contained in:
Lemon
2024-09-06 10:38:00 +08:00
parent 7e194ec430
commit b573bfb015
11 changed files with 228 additions and 13 deletions

View File

@@ -261,9 +261,9 @@
入参 入参
| 字段名 | 类型 | 是否必传 | 备注 | | 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ---- | -------- | ---- | | ----------------- | ------ | -------- | -------- |
| | | | | | pileConnectorCode | String | Y | 枪口编码 |
反参 反参

View File

@@ -5,15 +5,13 @@ import com.google.common.collect.ImmutableMap;
import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.response.RestApiResponse; import com.jsowell.common.response.RestApiResponse;
import com.jsowell.pile.dto.business.QueryConnectorInfoDTO; import com.jsowell.pile.dto.business.QueryConnectorInfoDTO;
import com.jsowell.pile.service.OrderBasicInfoService;
import com.jsowell.pile.service.PileConnectorInfoService; import com.jsowell.pile.service.PileConnectorInfoService;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO; import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO;
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO; import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@@ -67,4 +65,27 @@ public class BusinessConnectorInfoController extends BaseController {
logger.info("搜索枪口信息接口 params:{}, result:{}", JSONObject.toJSONString(dto), response); logger.info("搜索枪口信息接口 params:{}, result:{}", JSONObject.toJSONString(dto), response);
return response; return response;
} }
/**
* 通过枪口编号查询枪口信息详情
* @param pileConnectorCode
* @return
*/
@GetMapping("/getBusinessPileConnectorDetail/{pileConnectorCode}")
public RestApiResponse<?> getBusinessPileConnectorDetail(@PathVariable("pileConnectorCode") String pileConnectorCode) {
RestApiResponse<?> response = null;
try {
BusinessConnectorInfoVO businessPileConnectorDetail = pileConnectorInfoService.getBusinessPileConnectorDetail(pileConnectorCode);
response = new RestApiResponse<>(ImmutableMap.of("BusinessConnectorInfoVO", businessPileConnectorDetail));
} catch (Exception e) {
logger.error("通过枪口编号查询枪口信息详情 error", e);
response = new RestApiResponse<>(e);
}
logger.info("通过枪口编号查询枪口信息详情 pileConnectorCode:{}, result:{}", pileConnectorCode, response);
return response;
}
} }

View File

@@ -0,0 +1,46 @@
package com.jsowell.api.uniapp.business;
import com.google.common.collect.ImmutableMap;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.pile.service.OrderBasicInfoService;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.xml.ws.soap.Addressing;
/**
* 运营端小程序订单Controller
*
* @author Lemon
* @Date 2024/9/5 8:54:38
*/
@RestController
@RequestMapping("/business/pile/order")
public class BusinessOrderController extends BaseController {
@Addressing
private OrderBasicInfoService orderBasicInfoService;
/**
* 通过订单编号查询订单信息详情
* @param orderCode
* @return
*/
@GetMapping("/getBusinessOrderDetail/{orderCode}")
public RestApiResponse<?> getBusinessOrderDetail(@PathVariable("orderCode") String orderCode) {
RestApiResponse<?> response = null;
try {
orderBasicInfoService.getBusinessOrderDetail(orderCode);
// response = new RestApiResponse<>(ImmutableMap.of("BusinessConnectorInfoVO", businessPileConnectorDetail));
} catch (Exception e) {
logger.error("通过订单编号查询订单信息详情 error", e);
response = new RestApiResponse<>(e);
}
logger.info("通过订单编号查询订单信息详情 orderCode:{}, result:{}", orderCode, response);
return response;
}
}

View File

@@ -463,6 +463,13 @@ public interface OrderBasicInfoService{
List<OrderListVO> queryOrderByOccupyTime(QueryOrderDTO dto); List<OrderListVO> queryOrderByOccupyTime(QueryOrderDTO dto);
/**
* 创建预约启动充电订单
* @param chargingStartupResult
*/
void createReservationOrder(ReservationChargingStartupResult chargingStartupResult);
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 后管小程序 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 后管小程序 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
/** /**
* 通过站点idList创建时间查询订单数据详情 * 通过站点idList创建时间查询订单数据详情
@@ -472,11 +479,6 @@ public interface OrderBasicInfoService{
*/ */
List<BusinessOrderDetailInfoVO> getOrderDetailByStationIds(List<String> stationIds, String startTime, String endTime); List<BusinessOrderDetailInfoVO> getOrderDetailByStationIds(List<String> stationIds, String startTime, String endTime);
/**
* 创建预约启动充电订单
* @param chargingStartupResult
*/
void createReservationOrder(ReservationChargingStartupResult chargingStartupResult);
void getBusinessOrderDetail(String orderCode);
} }

View File

@@ -157,4 +157,12 @@ public interface PileConnectorInfoService {
* @return * @return
*/ */
public PileConnectorInfoVO BusinessSearchConnectorInfo(QueryConnectorInfoDTO dto); public PileConnectorInfoVO BusinessSearchConnectorInfo(QueryConnectorInfoDTO dto);
/**
* 通过枪口编号查询枪口信息详情
* @param pileConnectorCode
* @return
*/
public BusinessConnectorInfoVO getBusinessPileConnectorDetail(String pileConnectorCode);
} }

View File

@@ -3879,5 +3879,20 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
orderPayRecordService.batchInsert(Lists.newArrayList(principalPayRecord)); orderPayRecordService.batchInsert(Lists.newArrayList(principalPayRecord));
} }
/**
* 通过订单编号查询订单详情
* @param orderCode
*/
@Override
public void getBusinessOrderDetail(String orderCode) {
OrderVO orderVO = getChargeOrderInfoByOrderCode(orderCode);
if (orderVO == null) {
return;
}
String createTime = orderVO.getCreateTime();
}
} }

View File

@@ -14,6 +14,8 @@ import com.jsowell.common.core.page.PageResponse;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.enums.ykc.PileStatusEnum; import com.jsowell.common.enums.ykc.PileStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.OrderBasicInfo; import com.jsowell.pile.domain.OrderBasicInfo;
@@ -27,6 +29,7 @@ import com.jsowell.pile.mapper.PileBasicInfoMapper;
import com.jsowell.pile.mapper.PileConnectorInfoMapper; import com.jsowell.pile.mapper.PileConnectorInfoMapper;
import com.jsowell.pile.service.*; import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorDetailVO;
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO; import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO; import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileDetailVO; import com.jsowell.pile.vo.web.PileDetailVO;
@@ -923,4 +926,54 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
} }
return vo; return vo;
} }
/**
* 通过枪口编号查询枪口信息详情
* @param pileConnectorCode
* @return
*/
@Override
public BusinessConnectorInfoVO getBusinessPileConnectorDetail(String pileConnectorCode) {
BusinessConnectorInfoVO vo = new BusinessConnectorInfoVO();
BusinessConnectorDetailVO detailVO = new BusinessConnectorDetailVO();
PileConnectorInfoVO pileConnectorInfoVO = getPileConnectorInfoByConnectorCode(pileConnectorCode);
String status = String.valueOf(pileConnectorInfoVO.getStatus());
if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), status)) {
// 充电中
// 查询正在充电的订单
OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
if (orderBasicInfo == null) {
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
}
// 查询实时数据
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
if (CollectionUtils.isEmpty(chargingRealTimeData)) {
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
}
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
String startSoc = orderBasicInfo.getStartSoc();
String endSoc = realTimeMonitorData.getSOC();
detailVO.setStartSOC(startSoc);
detailVO.setEndSOC(endSoc);
detailVO.setChargeDegree(realTimeMonitorData.getChargingDegree());
detailVO.setTimeRemaining(realTimeMonitorData.getTimeRemaining());
} else if (StringUtils.equals(PileConnectorDataBaseStatusEnum.FAULT.getValue(), status)) {
// 故障
// 查询故障原因
String redisKey = CacheConstants.PILE_HARDWARE_FAULT + pileConnectorInfoVO.getPileConnectorCode();
String faultReason = redisCache.getCacheObject(redisKey);
// 如果不为空set 数据
if (StringUtils.isNotBlank(faultReason)) {
detailVO.setFaultReason(faultReason);
}
}
detailVO.setPileConnectorCode(pileConnectorCode);
detailVO.setStatus(status);
vo.setBusinessConnectorDetail(detailVO);
return vo;
}
} }

View File

@@ -0,0 +1,59 @@
package com.jsowell.pile.vo.uniapp.business;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 运营端小程序枪口详情信息
*
* @author Lemon
* @Date 2024/9/4 8:49:09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BusinessConnectorDetailVO {
/**
* 枪口编号
*/
private String pileConnectorCode;
/**
* 枪口状态
*/
private String status;
/**
* 订单号
*/
private String orderCode;
/**
* 起始soc
*/
private String startSOC;
/**
* 终止soc
*/
private String endSOC;
/**
* 充电度数
*/
private String chargeDegree;
/**
* 剩余时长
*/
private String timeRemaining;
/**
* 故障原因
*/
private String faultReason;
}

View File

@@ -65,4 +65,9 @@ public class BusinessConnectorInfoVO {
private Integer faultConnectorNum; private Integer faultConnectorNum;
private List<PileConnectorInfoVO> pileConnectorInfoVOList; private List<PileConnectorInfoVO> pileConnectorInfoVOList;
/**
* 运营端小程序枪口详情信息
*/
private BusinessConnectorDetailVO businessConnectorDetail;
} }

View File

@@ -136,4 +136,9 @@ public class OrderVO {
private BigDecimal totalElectricityAmount; private BigDecimal totalElectricityAmount;
private BigDecimal totalServiceAmount; private BigDecimal totalServiceAmount;
/**
* 订单创建时间
*/
private String createTime;
} }

View File

@@ -2854,6 +2854,7 @@
t1.plate_number AS plateNumber, t1.plate_number AS plateNumber,
t1.discount_amount AS discountAmount, t1.discount_amount AS discountAmount,
t1.settle_amount AS settleAmount, t1.settle_amount AS settleAmount,
t1.create_time as createTime,
t1.charge_start_time AS startTime, t1.charge_start_time AS startTime,
t1.charge_end_time AS endTime, t1.charge_end_time AS endTime,
t1.start_soc AS startSoc, t1.start_soc AS startSoc,